pullfrog 0.1.95 → 0.1.96
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 -0
- package/dist/cli.mjs +784 -836
- package/dist/external.d.ts +1 -1
- package/dist/index.js +776 -828
- package/dist/internal/index.d.ts +1 -1
- package/dist/internal.js +48 -20
- package/dist/mcp/comment.d.ts +3 -0
- package/dist/models.d.ts +5 -5
- package/dist/toolState.d.ts +6 -4
- package/dist/utils/github.d.ts +1 -1
- package/dist/utils/patchWorkflowRunFields.d.ts +8 -1
- package/dist/utils/runContext.d.ts +8 -0
- package/dist/utils/runContextData.d.ts +2 -0
- package/dist/utils/runStatusCheck.d.ts +11 -0
- package/dist/utils/statusChecks.d.ts +2 -1
- package/dist/utils/subprocess.d.ts +1 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1415,9 +1415,9 @@ var require_timers = __commonJS({
|
|
|
1415
1415
|
}
|
|
1416
1416
|
}
|
|
1417
1417
|
var Timeout = class {
|
|
1418
|
-
constructor(callback,
|
|
1418
|
+
constructor(callback, delay3, opaque) {
|
|
1419
1419
|
this.callback = callback;
|
|
1420
|
-
this.delay =
|
|
1420
|
+
this.delay = delay3;
|
|
1421
1421
|
this.opaque = opaque;
|
|
1422
1422
|
this.state = -2;
|
|
1423
1423
|
this.refresh();
|
|
@@ -1436,8 +1436,8 @@ var require_timers = __commonJS({
|
|
|
1436
1436
|
}
|
|
1437
1437
|
};
|
|
1438
1438
|
module.exports = {
|
|
1439
|
-
setTimeout(callback,
|
|
1440
|
-
return
|
|
1439
|
+
setTimeout(callback, delay3, opaque) {
|
|
1440
|
+
return delay3 < 1e3 ? setTimeout(callback, delay3, opaque) : new Timeout(callback, delay3, opaque);
|
|
1441
1441
|
},
|
|
1442
1442
|
clearTimeout(timeout) {
|
|
1443
1443
|
if (timeout instanceof Timeout) {
|
|
@@ -5717,7 +5717,7 @@ var require_request = __commonJS({
|
|
|
5717
5717
|
method,
|
|
5718
5718
|
body,
|
|
5719
5719
|
headers,
|
|
5720
|
-
query,
|
|
5720
|
+
query: query2,
|
|
5721
5721
|
idempotent,
|
|
5722
5722
|
blocking,
|
|
5723
5723
|
upgrade,
|
|
@@ -5794,7 +5794,7 @@ var require_request = __commonJS({
|
|
|
5794
5794
|
this.completed = false;
|
|
5795
5795
|
this.aborted = false;
|
|
5796
5796
|
this.upgrade = upgrade || null;
|
|
5797
|
-
this.path =
|
|
5797
|
+
this.path = query2 ? util2.buildURL(path4, query2) : path4;
|
|
5798
5798
|
this.origin = origin;
|
|
5799
5799
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
5800
5800
|
this.blocking = blocking == null ? false : blocking;
|
|
@@ -10508,13 +10508,13 @@ var require_mock_utils = __commonJS({
|
|
|
10508
10508
|
}
|
|
10509
10509
|
}
|
|
10510
10510
|
function buildKey(opts) {
|
|
10511
|
-
const { path: path4, method, body, headers, query } = opts;
|
|
10511
|
+
const { path: path4, method, body, headers, query: query2 } = opts;
|
|
10512
10512
|
return {
|
|
10513
10513
|
path: path4,
|
|
10514
10514
|
method,
|
|
10515
10515
|
body,
|
|
10516
10516
|
headers,
|
|
10517
|
-
query
|
|
10517
|
+
query: query2
|
|
10518
10518
|
};
|
|
10519
10519
|
}
|
|
10520
10520
|
function generateKeyValues(data) {
|
|
@@ -10541,7 +10541,7 @@ var require_mock_utils = __commonJS({
|
|
|
10541
10541
|
if (mockDispatch2.data.callback) {
|
|
10542
10542
|
mockDispatch2.data = { ...mockDispatch2.data, ...mockDispatch2.data.callback(opts) };
|
|
10543
10543
|
}
|
|
10544
|
-
const { data: { statusCode, data, headers, trailers, error: error49 }, delay:
|
|
10544
|
+
const { data: { statusCode, data, headers, trailers, error: error49 }, delay: delay3, persist } = mockDispatch2;
|
|
10545
10545
|
const { timesInvoked, times } = mockDispatch2;
|
|
10546
10546
|
mockDispatch2.consumed = !persist && timesInvoked >= times;
|
|
10547
10547
|
mockDispatch2.pending = timesInvoked < times;
|
|
@@ -10550,10 +10550,10 @@ var require_mock_utils = __commonJS({
|
|
|
10550
10550
|
handler2.onError(error49);
|
|
10551
10551
|
return true;
|
|
10552
10552
|
}
|
|
10553
|
-
if (typeof
|
|
10553
|
+
if (typeof delay3 === "number" && delay3 > 0) {
|
|
10554
10554
|
setTimeout(() => {
|
|
10555
10555
|
handleReply(this[kDispatches]);
|
|
10556
|
-
},
|
|
10556
|
+
}, delay3);
|
|
10557
10557
|
} else {
|
|
10558
10558
|
handleReply(this[kDispatches]);
|
|
10559
10559
|
}
|
|
@@ -26388,8 +26388,8 @@ var require_coerce = __commonJS({
|
|
|
26388
26388
|
const minor = match3[3] || "0";
|
|
26389
26389
|
const patch = match3[4] || "0";
|
|
26390
26390
|
const prerelease = options.includePrerelease && match3[5] ? `-${match3[5]}` : "";
|
|
26391
|
-
const
|
|
26392
|
-
return parse6(`${major}.${minor}.${patch}${prerelease}${
|
|
26391
|
+
const build4 = options.includePrerelease && match3[6] ? `+${match3[6]}` : "";
|
|
26392
|
+
return parse6(`${major}.${minor}.${patch}${prerelease}${build4}`, options);
|
|
26393
26393
|
};
|
|
26394
26394
|
module.exports = coerce;
|
|
26395
26395
|
}
|
|
@@ -40308,9 +40308,9 @@ var require_timers2 = __commonJS({
|
|
|
40308
40308
|
* before the specified function or code is executed.
|
|
40309
40309
|
* @param {*} arg
|
|
40310
40310
|
*/
|
|
40311
|
-
constructor(callback,
|
|
40311
|
+
constructor(callback, delay3, arg) {
|
|
40312
40312
|
this._onTimeout = callback;
|
|
40313
|
-
this._idleTimeout =
|
|
40313
|
+
this._idleTimeout = delay3;
|
|
40314
40314
|
this._timerArg = arg;
|
|
40315
40315
|
this.refresh();
|
|
40316
40316
|
}
|
|
@@ -40355,8 +40355,8 @@ var require_timers2 = __commonJS({
|
|
|
40355
40355
|
* when the timer expires.
|
|
40356
40356
|
* @returns {NodeJS.Timeout|FastTimer}
|
|
40357
40357
|
*/
|
|
40358
|
-
setTimeout(callback,
|
|
40359
|
-
return
|
|
40358
|
+
setTimeout(callback, delay3, arg) {
|
|
40359
|
+
return delay3 <= RESOLUTION_MS ? setTimeout(callback, delay3, arg) : new FastTimer(callback, delay3, arg);
|
|
40360
40360
|
},
|
|
40361
40361
|
/**
|
|
40362
40362
|
* The clearTimeout method cancels an instantiated Timer previously created
|
|
@@ -40382,8 +40382,8 @@ var require_timers2 = __commonJS({
|
|
|
40382
40382
|
* when the timer expires.
|
|
40383
40383
|
* @returns {FastTimer}
|
|
40384
40384
|
*/
|
|
40385
|
-
setFastTimeout(callback,
|
|
40386
|
-
return new FastTimer(callback,
|
|
40385
|
+
setFastTimeout(callback, delay3, arg) {
|
|
40386
|
+
return new FastTimer(callback, delay3, arg);
|
|
40387
40387
|
},
|
|
40388
40388
|
/**
|
|
40389
40389
|
* The clearTimeout method cancels an instantiated FastTimer previously
|
|
@@ -40409,8 +40409,8 @@ var require_timers2 = __commonJS({
|
|
|
40409
40409
|
* @deprecated
|
|
40410
40410
|
* @param {number} [delay=0] The delay in milliseconds to add to the now value.
|
|
40411
40411
|
*/
|
|
40412
|
-
tick(
|
|
40413
|
-
fastNow +=
|
|
40412
|
+
tick(delay3 = 0) {
|
|
40413
|
+
fastNow += delay3 - RESOLUTION_MS + 1;
|
|
40414
40414
|
onTick();
|
|
40415
40415
|
onTick();
|
|
40416
40416
|
},
|
|
@@ -42234,7 +42234,7 @@ var require_request3 = __commonJS({
|
|
|
42234
42234
|
method,
|
|
42235
42235
|
body,
|
|
42236
42236
|
headers,
|
|
42237
|
-
query,
|
|
42237
|
+
query: query2,
|
|
42238
42238
|
idempotent,
|
|
42239
42239
|
blocking,
|
|
42240
42240
|
upgrade,
|
|
@@ -42326,7 +42326,7 @@ var require_request3 = __commonJS({
|
|
|
42326
42326
|
this.completed = false;
|
|
42327
42327
|
this.aborted = false;
|
|
42328
42328
|
this.upgrade = upgrade || null;
|
|
42329
|
-
this.path =
|
|
42329
|
+
this.path = query2 ? serializePathWithQuery(path4, query2) : path4;
|
|
42330
42330
|
this.origin = origin;
|
|
42331
42331
|
this.protocol = getProtocolFromUrlString(origin);
|
|
42332
42332
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
@@ -46893,21 +46893,21 @@ var require_client_h1 = __commonJS({
|
|
|
46893
46893
|
this.connection = "";
|
|
46894
46894
|
this.maxResponseSize = client2[kMaxResponseSize];
|
|
46895
46895
|
}
|
|
46896
|
-
setTimeout(
|
|
46897
|
-
if (
|
|
46896
|
+
setTimeout(delay3, type2) {
|
|
46897
|
+
if (delay3 !== this.timeoutValue || type2 & USE_FAST_TIMER ^ this.timeoutType & USE_FAST_TIMER) {
|
|
46898
46898
|
if (this.timeout) {
|
|
46899
46899
|
timers.clearTimeout(this.timeout);
|
|
46900
46900
|
this.timeout = null;
|
|
46901
46901
|
}
|
|
46902
|
-
if (
|
|
46902
|
+
if (delay3) {
|
|
46903
46903
|
if (type2 & USE_FAST_TIMER) {
|
|
46904
|
-
this.timeout = timers.setFastTimeout(onParserTimeout,
|
|
46904
|
+
this.timeout = timers.setFastTimeout(onParserTimeout, delay3, this.timeoutWeakRef);
|
|
46905
46905
|
} else {
|
|
46906
|
-
this.timeout = setTimeout(onParserTimeout,
|
|
46906
|
+
this.timeout = setTimeout(onParserTimeout, delay3, this.timeoutWeakRef);
|
|
46907
46907
|
this.timeout?.unref();
|
|
46908
46908
|
}
|
|
46909
46909
|
}
|
|
46910
|
-
this.timeoutValue =
|
|
46910
|
+
this.timeoutValue = delay3;
|
|
46911
46911
|
} else if (this.timeout) {
|
|
46912
46912
|
if (this.timeout.refresh) {
|
|
46913
46913
|
this.timeout.refresh();
|
|
@@ -52901,11 +52901,11 @@ var require_mock_utils2 = __commonJS({
|
|
|
52901
52901
|
}
|
|
52902
52902
|
return true;
|
|
52903
52903
|
}
|
|
52904
|
-
function normalizeSearchParams(
|
|
52905
|
-
if (typeof
|
|
52906
|
-
return
|
|
52904
|
+
function normalizeSearchParams(query2) {
|
|
52905
|
+
if (typeof query2 !== "string") {
|
|
52906
|
+
return query2;
|
|
52907
52907
|
}
|
|
52908
|
-
const originalQp = new URLSearchParams(
|
|
52908
|
+
const originalQp = new URLSearchParams(query2);
|
|
52909
52909
|
const normalizedQp = new URLSearchParams();
|
|
52910
52910
|
for (let [key, value2] of originalQp.entries()) {
|
|
52911
52911
|
key = key.replace("[]", "");
|
|
@@ -53013,13 +53013,13 @@ var require_mock_utils2 = __commonJS({
|
|
|
53013
53013
|
return path4;
|
|
53014
53014
|
}
|
|
53015
53015
|
function buildKey(opts) {
|
|
53016
|
-
const { path: path4, method, body, headers, query } = opts;
|
|
53016
|
+
const { path: path4, method, body, headers, query: query2 } = opts;
|
|
53017
53017
|
return {
|
|
53018
53018
|
path: path4,
|
|
53019
53019
|
method,
|
|
53020
53020
|
body,
|
|
53021
53021
|
headers,
|
|
53022
|
-
query
|
|
53022
|
+
query: query2
|
|
53023
53023
|
};
|
|
53024
53024
|
}
|
|
53025
53025
|
function generateKeyValues(data) {
|
|
@@ -53056,7 +53056,7 @@ var require_mock_utils2 = __commonJS({
|
|
|
53056
53056
|
if (mockDispatch2.data.callback) {
|
|
53057
53057
|
mockDispatch2.data = { ...mockDispatch2.data, ...mockDispatch2.data.callback(opts) };
|
|
53058
53058
|
}
|
|
53059
|
-
const { data: { statusCode, data, headers, trailers, error: error49 }, delay:
|
|
53059
|
+
const { data: { statusCode, data, headers, trailers, error: error49 }, delay: delay3, persist } = mockDispatch2;
|
|
53060
53060
|
const { timesInvoked, times } = mockDispatch2;
|
|
53061
53061
|
mockDispatch2.consumed = !persist && timesInvoked >= times;
|
|
53062
53062
|
mockDispatch2.pending = timesInvoked < times;
|
|
@@ -53079,11 +53079,11 @@ var require_mock_utils2 = __commonJS({
|
|
|
53079
53079
|
handler2.onError(err);
|
|
53080
53080
|
}
|
|
53081
53081
|
handler2.onConnect?.(abort, null);
|
|
53082
|
-
if (typeof
|
|
53082
|
+
if (typeof delay3 === "number" && delay3 > 0) {
|
|
53083
53083
|
timer = setTimeout(() => {
|
|
53084
53084
|
timer = null;
|
|
53085
53085
|
handleReply(this[kDispatches]);
|
|
53086
|
-
},
|
|
53086
|
+
}, delay3);
|
|
53087
53087
|
} else {
|
|
53088
53088
|
handleReply(this[kDispatches]);
|
|
53089
53089
|
}
|
|
@@ -53453,13 +53453,13 @@ var require_mock_call_history = __commonJS({
|
|
|
53453
53453
|
function makeFilterCalls(parameterName) {
|
|
53454
53454
|
return (parameterValue, logs) => {
|
|
53455
53455
|
if (typeof parameterValue === "string" || parameterValue == null) {
|
|
53456
|
-
return logs.filter((
|
|
53457
|
-
return
|
|
53456
|
+
return logs.filter((log2) => {
|
|
53457
|
+
return log2[parameterName] === parameterValue;
|
|
53458
53458
|
});
|
|
53459
53459
|
}
|
|
53460
53460
|
if (parameterValue instanceof RegExp) {
|
|
53461
|
-
return logs.filter((
|
|
53462
|
-
return parameterValue.test(
|
|
53461
|
+
return logs.filter((log2) => {
|
|
53462
|
+
return parameterValue.test(log2[parameterName]);
|
|
53463
53463
|
});
|
|
53464
53464
|
}
|
|
53465
53465
|
throw new InvalidArgumentError(`${parameterName} parameter should be one of string, regexp, undefined or null`);
|
|
@@ -53554,8 +53554,8 @@ var require_mock_call_history = __commonJS({
|
|
|
53554
53554
|
return this.logs.filter(criteria);
|
|
53555
53555
|
}
|
|
53556
53556
|
if (criteria instanceof RegExp) {
|
|
53557
|
-
return this.logs.filter((
|
|
53558
|
-
return criteria.test(
|
|
53557
|
+
return this.logs.filter((log2) => {
|
|
53558
|
+
return criteria.test(log2.toString());
|
|
53559
53559
|
});
|
|
53560
53560
|
}
|
|
53561
53561
|
if (typeof criteria === "object" && criteria !== null) {
|
|
@@ -53605,13 +53605,13 @@ var require_mock_call_history = __commonJS({
|
|
|
53605
53605
|
this.logs = [];
|
|
53606
53606
|
}
|
|
53607
53607
|
[kMockCallHistoryAddLog](requestInit) {
|
|
53608
|
-
const
|
|
53609
|
-
this.logs.push(
|
|
53610
|
-
return
|
|
53608
|
+
const log2 = new MockCallHistoryLog(requestInit);
|
|
53609
|
+
this.logs.push(log2);
|
|
53610
|
+
return log2;
|
|
53611
53611
|
}
|
|
53612
53612
|
*[Symbol.iterator]() {
|
|
53613
|
-
for (const
|
|
53614
|
-
yield
|
|
53613
|
+
for (const log2 of this.calls()) {
|
|
53614
|
+
yield log2;
|
|
53615
53615
|
}
|
|
53616
53616
|
}
|
|
53617
53617
|
};
|
|
@@ -56023,18 +56023,18 @@ var require_cache2 = __commonJS({
|
|
|
56023
56023
|
}
|
|
56024
56024
|
}
|
|
56025
56025
|
}
|
|
56026
|
-
function makeDeduplicationKey(
|
|
56026
|
+
function makeDeduplicationKey(cacheKey3, excludeHeaders) {
|
|
56027
56027
|
const headers = {};
|
|
56028
|
-
if (
|
|
56029
|
-
const sortedHeaders = Object.keys(
|
|
56028
|
+
if (cacheKey3.headers) {
|
|
56029
|
+
const sortedHeaders = Object.keys(cacheKey3.headers).sort();
|
|
56030
56030
|
for (const header of sortedHeaders) {
|
|
56031
56031
|
if (excludeHeaders?.has(header.toLowerCase())) {
|
|
56032
56032
|
continue;
|
|
56033
56033
|
}
|
|
56034
|
-
headers[header] =
|
|
56034
|
+
headers[header] = cacheKey3.headers[header];
|
|
56035
56035
|
}
|
|
56036
56036
|
}
|
|
56037
|
-
return JSON.stringify([
|
|
56037
|
+
return JSON.stringify([cacheKey3.origin, cacheKey3.method, cacheKey3.path, headers]);
|
|
56038
56038
|
}
|
|
56039
56039
|
module.exports = {
|
|
56040
56040
|
makeCacheKey,
|
|
@@ -56608,7 +56608,7 @@ var require_cache_handler = __commonJS({
|
|
|
56608
56608
|
}
|
|
56609
56609
|
}
|
|
56610
56610
|
}
|
|
56611
|
-
function getSameOriginPath(
|
|
56611
|
+
function getSameOriginPath(cacheKey3, location) {
|
|
56612
56612
|
if (typeof location !== "string") {
|
|
56613
56613
|
return void 0;
|
|
56614
56614
|
}
|
|
@@ -56616,8 +56616,8 @@ var require_cache_handler = __commonJS({
|
|
|
56616
56616
|
let requestUrl;
|
|
56617
56617
|
let locationUrl;
|
|
56618
56618
|
try {
|
|
56619
|
-
originUrl = new URL(
|
|
56620
|
-
requestUrl = new URL(
|
|
56619
|
+
originUrl = new URL(cacheKey3.origin);
|
|
56620
|
+
requestUrl = new URL(cacheKey3.path, originUrl);
|
|
56621
56621
|
locationUrl = new URL(location, requestUrl);
|
|
56622
56622
|
} catch {
|
|
56623
56623
|
return void 0;
|
|
@@ -56627,38 +56627,38 @@ var require_cache_handler = __commonJS({
|
|
|
56627
56627
|
}
|
|
56628
56628
|
return locationUrl.pathname + locationUrl.search;
|
|
56629
56629
|
}
|
|
56630
|
-
function deleteCachedUri(store,
|
|
56630
|
+
function deleteCachedUri(store, cacheKey3, path4) {
|
|
56631
56631
|
deleteCachedValue(store, {
|
|
56632
|
-
...
|
|
56632
|
+
...cacheKey3,
|
|
56633
56633
|
path: path4
|
|
56634
56634
|
});
|
|
56635
56635
|
for (let i = 0; i < util2.safeHTTPMethods.length; i++) {
|
|
56636
56636
|
const method = util2.safeHTTPMethods[i];
|
|
56637
|
-
if (method !==
|
|
56637
|
+
if (method !== cacheKey3.method) {
|
|
56638
56638
|
deleteCachedValue(store, {
|
|
56639
|
-
...
|
|
56639
|
+
...cacheKey3,
|
|
56640
56640
|
method,
|
|
56641
56641
|
path: path4
|
|
56642
56642
|
});
|
|
56643
56643
|
}
|
|
56644
56644
|
}
|
|
56645
56645
|
}
|
|
56646
|
-
function deleteLocationTargets(store,
|
|
56646
|
+
function deleteLocationTargets(store, cacheKey3, headerValue) {
|
|
56647
56647
|
if (headerValue === void 0) {
|
|
56648
56648
|
return;
|
|
56649
56649
|
}
|
|
56650
56650
|
const values = Array.isArray(headerValue) ? headerValue : [headerValue];
|
|
56651
56651
|
for (let i = 0; i < values.length; i++) {
|
|
56652
|
-
const path4 = getSameOriginPath(
|
|
56652
|
+
const path4 = getSameOriginPath(cacheKey3, values[i]);
|
|
56653
56653
|
if (path4 !== void 0) {
|
|
56654
|
-
deleteCachedUri(store,
|
|
56654
|
+
deleteCachedUri(store, cacheKey3, path4);
|
|
56655
56655
|
}
|
|
56656
56656
|
}
|
|
56657
56657
|
}
|
|
56658
|
-
function invalidateUnsafeRequest(store,
|
|
56659
|
-
deleteCachedUri(store,
|
|
56660
|
-
deleteLocationTargets(store,
|
|
56661
|
-
deleteLocationTargets(store,
|
|
56658
|
+
function invalidateUnsafeRequest(store, cacheKey3, resHeaders) {
|
|
56659
|
+
deleteCachedUri(store, cacheKey3, cacheKey3.path);
|
|
56660
|
+
deleteLocationTargets(store, cacheKey3, resHeaders.location);
|
|
56661
|
+
deleteLocationTargets(store, cacheKey3, resHeaders["content-location"]);
|
|
56662
56662
|
}
|
|
56663
56663
|
var CacheHandler = class {
|
|
56664
56664
|
/**
|
|
@@ -56690,11 +56690,11 @@ var require_cache_handler = __commonJS({
|
|
|
56690
56690
|
* @param {import('../../types/cache-interceptor.d.ts').default.CacheKey} cacheKey
|
|
56691
56691
|
* @param {import('../../types/dispatcher.d.ts').default.DispatchHandler} handler
|
|
56692
56692
|
*/
|
|
56693
|
-
constructor({ store, type: type2, cacheByDefault },
|
|
56693
|
+
constructor({ store, type: type2, cacheByDefault }, cacheKey3, handler2) {
|
|
56694
56694
|
this.#store = store;
|
|
56695
56695
|
this.#cacheType = type2;
|
|
56696
56696
|
this.#cacheByDefault = cacheByDefault;
|
|
56697
|
-
this.#cacheKey =
|
|
56697
|
+
this.#cacheKey = cacheKey3;
|
|
56698
56698
|
this.#handler = handler2;
|
|
56699
56699
|
}
|
|
56700
56700
|
onRequestStart(controller, context) {
|
|
@@ -56887,15 +56887,15 @@ var require_cache_handler = __commonJS({
|
|
|
56887
56887
|
this.#handler.onResponseError?.(controller, err);
|
|
56888
56888
|
}
|
|
56889
56889
|
};
|
|
56890
|
-
function deleteCachedValue(store,
|
|
56890
|
+
function deleteCachedValue(store, cacheKey3) {
|
|
56891
56891
|
try {
|
|
56892
|
-
store.delete(
|
|
56892
|
+
store.delete(cacheKey3)?.catch?.(noop4);
|
|
56893
56893
|
} catch {
|
|
56894
56894
|
}
|
|
56895
56895
|
}
|
|
56896
|
-
function deleteCachedValueIfNotModified(statusCode, store,
|
|
56896
|
+
function deleteCachedValueIfNotModified(statusCode, store, cacheKey3) {
|
|
56897
56897
|
if (statusCode === 304) {
|
|
56898
|
-
deleteCachedValue(store,
|
|
56898
|
+
deleteCachedValue(store, cacheKey3);
|
|
56899
56899
|
}
|
|
56900
56900
|
}
|
|
56901
56901
|
function revalidationResponseDisallowsCachedReuse(cacheType, resHeaders, cacheControlDirectives) {
|
|
@@ -57461,9 +57461,9 @@ var require_cache3 = __commonJS({
|
|
|
57461
57461
|
function revalidationResponseUpdatesCacheControl(headers) {
|
|
57462
57462
|
return headers["cache-control"] !== void 0;
|
|
57463
57463
|
}
|
|
57464
|
-
function deleteCachedValue(store,
|
|
57464
|
+
function deleteCachedValue(store, cacheKey3) {
|
|
57465
57465
|
try {
|
|
57466
|
-
store.delete(
|
|
57466
|
+
store.delete(cacheKey3)?.catch?.(nop);
|
|
57467
57467
|
} catch {
|
|
57468
57468
|
}
|
|
57469
57469
|
}
|
|
@@ -57515,7 +57515,7 @@ var require_cache3 = __commonJS({
|
|
|
57515
57515
|
const staleWhileRevalidateExpiry = result.staleAt + staleWhileRevalidate * 1e3;
|
|
57516
57516
|
return now <= staleWhileRevalidateExpiry;
|
|
57517
57517
|
}
|
|
57518
|
-
function handleUncachedResponse(dispatch, globalOpts,
|
|
57518
|
+
function handleUncachedResponse(dispatch, globalOpts, cacheKey3, handler2, opts, reqCacheControl) {
|
|
57519
57519
|
if (reqCacheControl?.["only-if-cached"]) {
|
|
57520
57520
|
let aborted3 = false;
|
|
57521
57521
|
try {
|
|
@@ -57543,7 +57543,7 @@ var require_cache3 = __commonJS({
|
|
|
57543
57543
|
}
|
|
57544
57544
|
return true;
|
|
57545
57545
|
}
|
|
57546
|
-
return dispatch(opts, new CacheHandler(globalOpts,
|
|
57546
|
+
return dispatch(opts, new CacheHandler(globalOpts, cacheKey3, handler2));
|
|
57547
57547
|
}
|
|
57548
57548
|
function sendCachedValue(handler2, opts, result, age, context, isStale2) {
|
|
57549
57549
|
const stream = util2.isStream(result.body) ? result.body : Readable2.from(result.body ?? []);
|
|
@@ -57599,20 +57599,20 @@ var require_cache3 = __commonJS({
|
|
|
57599
57599
|
});
|
|
57600
57600
|
}
|
|
57601
57601
|
}
|
|
57602
|
-
function handleResult2(dispatch, globalOpts,
|
|
57602
|
+
function handleResult2(dispatch, globalOpts, cacheKey3, handler2, opts, reqCacheControl, result) {
|
|
57603
57603
|
if (!result) {
|
|
57604
|
-
return handleUncachedResponse(dispatch, globalOpts,
|
|
57604
|
+
return handleUncachedResponse(dispatch, globalOpts, cacheKey3, handler2, opts, reqCacheControl);
|
|
57605
57605
|
}
|
|
57606
57606
|
if (globalOpts.type === "shared" && Object.hasOwn(result.headers, "set-cookie")) {
|
|
57607
57607
|
if (util2.isStream(result.body)) {
|
|
57608
57608
|
result.body.on("error", nop).destroy();
|
|
57609
57609
|
}
|
|
57610
|
-
deleteCachedValue(globalOpts.store,
|
|
57611
|
-
return handleUncachedResponse(dispatch, globalOpts,
|
|
57610
|
+
deleteCachedValue(globalOpts.store, cacheKey3);
|
|
57611
|
+
return handleUncachedResponse(dispatch, globalOpts, cacheKey3, handler2, opts, reqCacheControl);
|
|
57612
57612
|
}
|
|
57613
57613
|
const now = Date.now();
|
|
57614
57614
|
if (now > result.deleteAt) {
|
|
57615
|
-
return dispatch(opts, new CacheHandler(globalOpts,
|
|
57615
|
+
return dispatch(opts, new CacheHandler(globalOpts, cacheKey3, handler2));
|
|
57616
57616
|
}
|
|
57617
57617
|
const age = Math.round((now - result.cachedAt) / 1e3);
|
|
57618
57618
|
const requestMaxAgeExpired = reqCacheControl?.["max-age"] !== void 0 && age >= reqCacheControl["max-age"];
|
|
@@ -57620,7 +57620,7 @@ var require_cache3 = __commonJS({
|
|
|
57620
57620
|
const revalidate = requestMaxAgeExpired || needsRevalidation(result, reqCacheControl, opts);
|
|
57621
57621
|
if (stale || revalidate) {
|
|
57622
57622
|
if (util2.isStream(opts.body) && util2.bodyLength(opts.body) !== 0) {
|
|
57623
|
-
return dispatch(opts, new CacheHandler(globalOpts,
|
|
57623
|
+
return dispatch(opts, new CacheHandler(globalOpts, cacheKey3, handler2));
|
|
57624
57624
|
}
|
|
57625
57625
|
if (!revalidate && withinStaleWhileRevalidateWindow(result, globalOpts.type)) {
|
|
57626
57626
|
sendCachedValue(handler2, opts, result, age, null, true);
|
|
@@ -57631,7 +57631,7 @@ var require_cache3 = __commonJS({
|
|
|
57631
57631
|
...opts,
|
|
57632
57632
|
headers: headers2
|
|
57633
57633
|
},
|
|
57634
|
-
new CacheHandler(globalOpts,
|
|
57634
|
+
new CacheHandler(globalOpts, cacheKey3, {
|
|
57635
57635
|
// Silent handler that just updates the cache
|
|
57636
57636
|
onRequestStart() {
|
|
57637
57637
|
},
|
|
@@ -57671,11 +57671,11 @@ var require_cache3 = __commonJS({
|
|
|
57671
57671
|
if (util2.isStream(result.body)) {
|
|
57672
57672
|
result.body.on("error", nop).destroy();
|
|
57673
57673
|
}
|
|
57674
|
-
deleteCachedValue(globalOpts.store,
|
|
57675
|
-
return dispatch(opts, new CacheHandler(globalOpts,
|
|
57674
|
+
deleteCachedValue(globalOpts.store, cacheKey3);
|
|
57675
|
+
return dispatch(opts, new CacheHandler(globalOpts, cacheKey3, handler2));
|
|
57676
57676
|
}
|
|
57677
57677
|
if (revalidationResponseUpdatesCacheControl(headers2)) {
|
|
57678
|
-
deleteCachedValue(globalOpts.store,
|
|
57678
|
+
deleteCachedValue(globalOpts.store, cacheKey3);
|
|
57679
57679
|
}
|
|
57680
57680
|
}
|
|
57681
57681
|
sendCachedValue(handler2, opts, result, age, context, stale);
|
|
@@ -57683,7 +57683,7 @@ var require_cache3 = __commonJS({
|
|
|
57683
57683
|
result.body.on("error", nop).destroy();
|
|
57684
57684
|
}
|
|
57685
57685
|
},
|
|
57686
|
-
new CacheHandler(globalOpts,
|
|
57686
|
+
new CacheHandler(globalOpts, cacheKey3, handler2),
|
|
57687
57687
|
withinStaleIfErrorThreshold
|
|
57688
57688
|
)
|
|
57689
57689
|
);
|
|
@@ -57758,16 +57758,16 @@ var require_cache3 = __commonJS({
|
|
|
57758
57758
|
if (reqCacheControl?.["no-store"]) {
|
|
57759
57759
|
return dispatch(opts2, handler2);
|
|
57760
57760
|
}
|
|
57761
|
-
const
|
|
57761
|
+
const cacheKey3 = makeCacheKey(opts2);
|
|
57762
57762
|
if (!arrayIncludes(util2.safeHTTPMethods, opts2.method)) {
|
|
57763
|
-
return dispatch(opts2, new CacheHandler(globalOpts,
|
|
57763
|
+
return dispatch(opts2, new CacheHandler(globalOpts, cacheKey3, handler2));
|
|
57764
57764
|
}
|
|
57765
|
-
const result = store.get(
|
|
57765
|
+
const result = store.get(cacheKey3);
|
|
57766
57766
|
if (result && typeof result.then === "function") {
|
|
57767
57767
|
return result.then((result2) => handleResult2(
|
|
57768
57768
|
dispatch,
|
|
57769
57769
|
globalOpts,
|
|
57770
|
-
|
|
57770
|
+
cacheKey3,
|
|
57771
57771
|
handler2,
|
|
57772
57772
|
opts2,
|
|
57773
57773
|
reqCacheControl,
|
|
@@ -57777,7 +57777,7 @@ var require_cache3 = __commonJS({
|
|
|
57777
57777
|
return handleResult2(
|
|
57778
57778
|
dispatch,
|
|
57779
57779
|
globalOpts,
|
|
57780
|
-
|
|
57780
|
+
cacheKey3,
|
|
57781
57781
|
handler2,
|
|
57782
57782
|
opts2,
|
|
57783
57783
|
reqCacheControl,
|
|
@@ -58670,8 +58670,8 @@ var require_deduplicate = __commonJS({
|
|
|
58670
58670
|
}
|
|
58671
58671
|
}
|
|
58672
58672
|
}
|
|
58673
|
-
const
|
|
58674
|
-
const dedupeKey = makeDeduplicationKey(
|
|
58673
|
+
const cacheKey3 = makeCacheKey(opts2);
|
|
58674
|
+
const dedupeKey = makeDeduplicationKey(cacheKey3, excludeHeaderNamesSet);
|
|
58675
58675
|
const pendingHandler = pendingRequests.get(dedupeKey);
|
|
58676
58676
|
if (pendingHandler) {
|
|
58677
58677
|
if (pendingHandler.addWaitingHandler(handler2)) {
|
|
@@ -76276,8 +76276,8 @@ var require_core2 = __commonJS({
|
|
|
76276
76276
|
return this;
|
|
76277
76277
|
}
|
|
76278
76278
|
case "object": {
|
|
76279
|
-
const
|
|
76280
|
-
this._cache.delete(
|
|
76279
|
+
const cacheKey3 = schemaKeyRef;
|
|
76280
|
+
this._cache.delete(cacheKey3);
|
|
76281
76281
|
let id = schemaKeyRef[this.opts.schemaId];
|
|
76282
76282
|
if (id) {
|
|
76283
76283
|
id = (0, resolve_1.normalizeId)(id);
|
|
@@ -76442,11 +76442,11 @@ var require_core2 = __commonJS({
|
|
|
76442
76442
|
Ajv5.ValidationError = validation_error_1.default;
|
|
76443
76443
|
Ajv5.MissingRefError = ref_error_1.default;
|
|
76444
76444
|
exports.default = Ajv5;
|
|
76445
|
-
function checkOptions(checkOpts, options, msg,
|
|
76445
|
+
function checkOptions(checkOpts, options, msg, log2 = "error") {
|
|
76446
76446
|
for (const key in checkOpts) {
|
|
76447
76447
|
const opt = key;
|
|
76448
76448
|
if (opt in options)
|
|
76449
|
-
this.logger[
|
|
76449
|
+
this.logger[log2](`${msg}: option ${key}. ${checkOpts[opt]}`);
|
|
76450
76450
|
}
|
|
76451
76451
|
}
|
|
76452
76452
|
function getSchEnv(keyRef) {
|
|
@@ -99714,7 +99714,7 @@ var require_node = __commonJS({
|
|
|
99714
99714
|
var tty = __require("tty");
|
|
99715
99715
|
var util2 = __require("util");
|
|
99716
99716
|
exports.init = init;
|
|
99717
|
-
exports.log =
|
|
99717
|
+
exports.log = log2;
|
|
99718
99718
|
exports.formatArgs = formatArgs2;
|
|
99719
99719
|
exports.save = save;
|
|
99720
99720
|
exports.load = load;
|
|
@@ -99849,7 +99849,7 @@ var require_node = __commonJS({
|
|
|
99849
99849
|
}
|
|
99850
99850
|
return (/* @__PURE__ */ new Date()).toISOString() + " ";
|
|
99851
99851
|
}
|
|
99852
|
-
function
|
|
99852
|
+
function log2(...args2) {
|
|
99853
99853
|
return process.stderr.write(util2.formatWithOptions(exports.inspectOpts, ...args2) + "\n");
|
|
99854
99854
|
}
|
|
99855
99855
|
function save(namespaces) {
|
|
@@ -104053,7 +104053,11 @@ var providers = {
|
|
|
104053
104053
|
"glm-flash": {
|
|
104054
104054
|
displayName: "GLM Flash",
|
|
104055
104055
|
resolve: "opencode-go/glm-5.3-flash",
|
|
104056
|
-
|
|
104056
|
+
// the Go endpoint intermittently rejects reasoning_effort ("native reasoning
|
|
104057
|
+
// control reasoning_effort is not allowed") mid-run, despite models.dev
|
|
104058
|
+
// advertising a ladder — so this route sends none.
|
|
104059
|
+
effort: [],
|
|
104060
|
+
openRouterEffort: ["low", "high", "max"],
|
|
104057
104061
|
openRouterResolve: "openrouter/z-ai/glm-5.3-flash"
|
|
104058
104062
|
},
|
|
104059
104063
|
// legacy alias — the slug pinned a version instead of a brand tier and
|
|
@@ -104509,7 +104513,7 @@ var providers = {
|
|
|
104509
104513
|
"deepseek-pro": {
|
|
104510
104514
|
displayName: "DeepSeek Pro",
|
|
104511
104515
|
resolve: "vercel/deepseek/deepseek-v4-pro-0813",
|
|
104512
|
-
effort: ["none", "high", "max"]
|
|
104516
|
+
effort: ["none", "low", "high", "max"]
|
|
104513
104517
|
},
|
|
104514
104518
|
// the gateway's bare `deepseek-v4-flash` is the April preview — the same
|
|
104515
104519
|
// fork trap as OpenRouter, with `deepseek-v4-flash-0731` beside it — so
|
|
@@ -104517,7 +104521,7 @@ var providers = {
|
|
|
104517
104521
|
"deepseek-flash": {
|
|
104518
104522
|
displayName: "DeepSeek Flash",
|
|
104519
104523
|
resolve: "vercel/deepseek/deepseek-v4.1-flash",
|
|
104520
|
-
effort: ["none", "high", "max"]
|
|
104524
|
+
effort: ["none", "low", "high", "max"]
|
|
104521
104525
|
},
|
|
104522
104526
|
glm: {
|
|
104523
104527
|
displayName: "GLM",
|
|
@@ -104723,13 +104727,13 @@ for (const [name, ladder] of Object.entries({ ...PROVIDER_LADDERS, router: ROUTE
|
|
|
104723
104727
|
if (terminal.size < 2) throw new Error(`${name} ladder runs every tier on ${[...terminal][0]}`);
|
|
104724
104728
|
}
|
|
104725
104729
|
var OSS_MODEL_ALLOWLIST = [
|
|
104726
|
-
"deepseek/deepseek-flash",
|
|
104727
|
-
"openai/gpt-luna",
|
|
104728
|
-
"openrouter/minimax-m2.5",
|
|
104729
104730
|
// opt-in: 0.86x the old default on the measured mix, and Meta trains on the
|
|
104730
104731
|
// traffic — fine for public code on headless runs, the human decided
|
|
104731
104732
|
// 2026-09-11. unmeasured on a real run; not the default until it is.
|
|
104732
|
-
"meta/muse-spark-contributor"
|
|
104733
|
+
"meta/muse-spark-contributor",
|
|
104734
|
+
"deepseek/deepseek-flash",
|
|
104735
|
+
"openai/gpt-luna",
|
|
104736
|
+
"openrouter/minimax-m2.5"
|
|
104733
104737
|
];
|
|
104734
104738
|
var OSS_RECOMMENDED_MODEL = AUTO_TIER_TARGET[AUTO_EFFICIENT];
|
|
104735
104739
|
function ossFundedModelNames() {
|
|
@@ -105605,7 +105609,7 @@ var import_semver = __toESM(require_semver2(), 1);
|
|
|
105605
105609
|
// package.json
|
|
105606
105610
|
var package_default = {
|
|
105607
105611
|
name: "pullfrog",
|
|
105608
|
-
version: "0.1.
|
|
105612
|
+
version: "0.1.96",
|
|
105609
105613
|
cliContractVersion: "1",
|
|
105610
105614
|
type: "module",
|
|
105611
105615
|
bin: {
|
|
@@ -105671,7 +105675,7 @@ var package_default = {
|
|
|
105671
105675
|
undici: "^7.22.0",
|
|
105672
105676
|
vitest: "^4.0.17",
|
|
105673
105677
|
yaml: "^2.8.2",
|
|
105674
|
-
yes: "0.
|
|
105678
|
+
yes: "0.2.3",
|
|
105675
105679
|
zod: "4.3.6"
|
|
105676
105680
|
},
|
|
105677
105681
|
repository: {
|
|
@@ -105839,6 +105843,9 @@ function trackChild(options) {
|
|
|
105839
105843
|
function untrackChild(child) {
|
|
105840
105844
|
activeChildren.delete(child);
|
|
105841
105845
|
}
|
|
105846
|
+
function isTrackedChild(child) {
|
|
105847
|
+
return activeChildren.has(child);
|
|
105848
|
+
}
|
|
105842
105849
|
function killTrackedChildren() {
|
|
105843
105850
|
for (const entry of activeChildren) {
|
|
105844
105851
|
const child = entry[0];
|
|
@@ -105852,6 +105859,7 @@ function killTrackedChildren() {
|
|
|
105852
105859
|
}
|
|
105853
105860
|
child.kill("SIGKILL");
|
|
105854
105861
|
}
|
|
105862
|
+
activeChildren.clear();
|
|
105855
105863
|
}
|
|
105856
105864
|
var handlersInstalled = false;
|
|
105857
105865
|
function installSignalHandler() {
|
|
@@ -106574,7 +106582,7 @@ ${PR_SUMMARY_FORMAT}`
|
|
|
106574
106582
|
|
|
106575
106583
|
Follow these rules:
|
|
106576
106584
|
- note: the first create_pull_request_review submission may error with a one-time diff-coverage nudge listing unread TOC regions. retry the same call to proceed \u2014 optionally after reading the listed ranges. the pre-flight will not block again this session.
|
|
106577
|
-
- IF NO NEW ISSUES, NON-SUBSTANTIVE CHANGES ONLY (trivial formatting, import reordering, comment tweaks): do NOT submit a review. Instead call \`${t("report_progress")}\` with a 1-2 sentence note explaining no review was warranted (e.g. "No new issues. Changes since last review are formatting-only."). this leaves a visible signal that the run completed.
|
|
106585
|
+
- IF NO NEW ISSUES, NON-SUBSTANTIVE CHANGES ONLY (trivial formatting, import reordering, comment tweaks): do NOT submit a review. Instead call \`${t("report_progress")}\` with \`no_review_needed: true\` and a 1-2 sentence note explaining no review was warranted (e.g. "No new issues. Changes since last review are formatting-only."). this leaves a visible signal that the run completed.
|
|
106578
106586
|
- ELSE IF NEW CRITICAL ISSUES (blocks merge \u2014 bugs, security, data loss, broken core flows): call \`${t("create_pull_request_review")}\` with \`approved: false\`, all comments, and the review body. body opens with \`> [!CAUTION]\\n> This PR introduces ...\`, followed by the PR summary using the default format below.
|
|
106579
106587
|
- ELSE IF NEW MUST-ADDRESS NON-CRITICAL FINDINGS (real consequences if shipped \u2014 incorrect behavior, missing validation, regressions the author should fix before merge): call \`${t("create_pull_request_review")}\` with \`approved: false\`, all comments, and the review body. body opens with \`> [!IMPORTANT]\\n> ...\`, followed by the PR summary using the default format below. Do NOT use this tier for nits, style preferences, or "consider also" suggestions.
|
|
106580
106588
|
- ELSE IF NEW MINOR SUGGESTIONS ONLY (low-stakes findings, or Nitpicks only): call \`${t("create_pull_request_review")}\` with \`approved: false\`, all comments, and the review body. body opens with \`> \u2139\uFE0F No critical issues \u2014 minor suggestions inline.\\n\\n\` (vary the wording after \u2139\uFE0F to fit the review), followed by the PR summary using the default format below.
|
|
@@ -106735,7 +106743,7 @@ function buildUnsubmittedReviewPrompt(mode) {
|
|
|
106735
106743
|
"",
|
|
106736
106744
|
"do exactly one of:",
|
|
106737
106745
|
"- if you have findings: call `create_pull_request_review` now with your aggregated review (body + inline comments). the first call may error once with a diff-coverage nudge \u2014 retry the same call to proceed.",
|
|
106738
|
-
"- if there are genuinely no actionable findings since the last review (e.g. only formatting / comment / lockfile changes): call `report_progress` with a 1-2 sentence summary explaining that no review was warranted.",
|
|
106746
|
+
"- if there are genuinely no actionable findings since the last review (e.g. only formatting / comment / lockfile changes): call `report_progress` with `no_review_needed: true` and a 1-2 sentence summary explaining that no review was warranted.",
|
|
106739
106747
|
"",
|
|
106740
106748
|
"do NOT stop again until one of those tools has been called successfully."
|
|
106741
106749
|
].join("\n");
|
|
@@ -107716,6 +107724,8 @@ var claude = agent({
|
|
|
107716
107724
|
PWD: repoDir
|
|
107717
107725
|
};
|
|
107718
107726
|
env2.CLAUDE_CODE_AUTO_COMPACT_WINDOW ||= "500000";
|
|
107727
|
+
env2.CLAUDE_CODE_ENABLE_TODO_TOOLS = "1";
|
|
107728
|
+
env2.CLAUDE_CODE_ENABLE_TASKS = "0";
|
|
107719
107729
|
if (isBedrockRoute) {
|
|
107720
107730
|
env2.CLAUDE_CODE_USE_BEDROCK = "1";
|
|
107721
107731
|
}
|
|
@@ -110955,6 +110965,7 @@ var codex = agent({
|
|
|
110955
110965
|
// agents/opencode.ts
|
|
110956
110966
|
import { spawn as nodeSpawn2 } from "node:child_process";
|
|
110957
110967
|
import { mkdirSync as mkdirSync7, writeFileSync as writeFileSync6 } from "node:fs";
|
|
110968
|
+
import { totalmem } from "node:os";
|
|
110958
110969
|
import { join as join7 } from "node:path";
|
|
110959
110970
|
import { performance as performance7 } from "node:perf_hooks";
|
|
110960
110971
|
|
|
@@ -111232,13 +111243,13 @@ var defaultPathSerializer = ({ path: path4, url: _url3 }) => {
|
|
|
111232
111243
|
}
|
|
111233
111244
|
return url4;
|
|
111234
111245
|
};
|
|
111235
|
-
var getUrl = ({ baseUrl, path: path4, query, querySerializer, url: _url3 }) => {
|
|
111246
|
+
var getUrl = ({ baseUrl, path: path4, query: query2, querySerializer, url: _url3 }) => {
|
|
111236
111247
|
const pathUrl = _url3.startsWith("/") ? _url3 : `/${_url3}`;
|
|
111237
111248
|
let url4 = (baseUrl ?? "") + pathUrl;
|
|
111238
111249
|
if (path4) {
|
|
111239
111250
|
url4 = defaultPathSerializer({ path: path4, url: url4 });
|
|
111240
111251
|
}
|
|
111241
|
-
let search2 =
|
|
111252
|
+
let search2 = query2 ? querySerializer(query2) : "";
|
|
111242
111253
|
if (search2.startsWith("?")) {
|
|
111243
111254
|
search2 = search2.substring(1);
|
|
111244
111255
|
}
|
|
@@ -116306,9 +116317,9 @@ function rewrite(request2, values) {
|
|
|
116306
116317
|
const value2 = pick2(request2.headers.get(name), key === "directory" ? values.directory : values.workspace, key === "directory" ? encodeURIComponent : void 0);
|
|
116307
116318
|
if (!value2)
|
|
116308
116319
|
continue;
|
|
116309
|
-
for (const
|
|
116310
|
-
if (!url4.searchParams.has(
|
|
116311
|
-
url4.searchParams.set(
|
|
116320
|
+
for (const query2 of url4.pathname.startsWith("/api/") ? [key, `location[${key}]`] : [key]) {
|
|
116321
|
+
if (!url4.searchParams.has(query2)) {
|
|
116322
|
+
url4.searchParams.set(query2, value2);
|
|
116312
116323
|
}
|
|
116313
116324
|
}
|
|
116314
116325
|
changed = true;
|
|
@@ -116828,11 +116839,12 @@ function bootOpencodeServer(params) {
|
|
|
116828
116839
|
log.debug(`[opencode serve] ${text}`);
|
|
116829
116840
|
});
|
|
116830
116841
|
let closed = false;
|
|
116842
|
+
let exitCause;
|
|
116831
116843
|
const close = async () => {
|
|
116832
116844
|
if (closed) return;
|
|
116833
116845
|
closed = true;
|
|
116834
116846
|
untrackChild(proc);
|
|
116835
|
-
if (proc.pid &&
|
|
116847
|
+
if (proc.pid && proc.exitCode === null && proc.signalCode === null) {
|
|
116836
116848
|
try {
|
|
116837
116849
|
process.kill(-proc.pid, "SIGTERM");
|
|
116838
116850
|
} catch {
|
|
@@ -116866,7 +116878,7 @@ function bootOpencodeServer(params) {
|
|
|
116866
116878
|
if (match3?.[1]) {
|
|
116867
116879
|
resolved = true;
|
|
116868
116880
|
log.info(`\xBB opencode server up: ${match3[1]}`);
|
|
116869
|
-
resolve3({ baseUrl: match3[1], proc, close, recentStderr });
|
|
116881
|
+
resolve3({ baseUrl: match3[1], proc, close, recentStderr, exitCause: () => exitCause });
|
|
116870
116882
|
}
|
|
116871
116883
|
}
|
|
116872
116884
|
const lines = text.split("\n");
|
|
@@ -116883,6 +116895,11 @@ function bootOpencodeServer(params) {
|
|
|
116883
116895
|
reject(new Error(`failed to spawn opencode serve: ${err.message}`));
|
|
116884
116896
|
}
|
|
116885
116897
|
});
|
|
116898
|
+
proc.once("exit", (code, signal) => {
|
|
116899
|
+
if (!resolved || !isTrackedChild(proc)) return;
|
|
116900
|
+
exitCause = describeServerExit(code, signal);
|
|
116901
|
+
log.warning(withServerStderr(`\xBB ${exitCause}`, recentStderr));
|
|
116902
|
+
});
|
|
116886
116903
|
proc.once("close", (code, signal) => {
|
|
116887
116904
|
if (!resolved) {
|
|
116888
116905
|
const tail = recentStderr.slice(-5).join("\n");
|
|
@@ -116916,6 +116933,12 @@ function withServerStderr(message, recentStderr) {
|
|
|
116916
116933
|
opencode server stderr:
|
|
116917
116934
|
${tail}` : message;
|
|
116918
116935
|
}
|
|
116936
|
+
function describeServerExit(code, signal) {
|
|
116937
|
+
if (signal !== "SIGKILL") return `opencode server exited mid-run (${signal ?? `code ${code}`})`;
|
|
116938
|
+
const limit = process.constrainedMemory();
|
|
116939
|
+
const memoryGb = ((limit > 0 ? Math.min(limit, totalmem()) : totalmem()) / 1024 ** 3).toFixed(1);
|
|
116940
|
+
return `opencode server was killed (SIGKILL) mid-run, usually by the kernel OOM killer \u2014 this runner has ${memoryGb} GB of memory`;
|
|
116941
|
+
}
|
|
116919
116942
|
function newTurn() {
|
|
116920
116943
|
return {
|
|
116921
116944
|
finalText: "",
|
|
@@ -117141,7 +117164,8 @@ async function runPromptTurn(ctx, params) {
|
|
|
117141
117164
|
costUsd: usage.costUsd
|
|
117142
117165
|
});
|
|
117143
117166
|
}
|
|
117144
|
-
const
|
|
117167
|
+
const cause = ctx.serverExitCause() ?? ctx.diagnostic.lastProviderError;
|
|
117168
|
+
const diagnosis = cause ? ` \u2014 likely cause: ${cause}` : "";
|
|
117145
117169
|
if (networkError) {
|
|
117146
117170
|
return {
|
|
117147
117171
|
success: false,
|
|
@@ -117459,6 +117483,7 @@ var opencode = agent({
|
|
|
117459
117483
|
loggedToolCallIDs: /* @__PURE__ */ new Set(),
|
|
117460
117484
|
mcpToolCalls: 0,
|
|
117461
117485
|
recentStderr: server.recentStderr,
|
|
117486
|
+
serverExitCause: server.exitCause,
|
|
117462
117487
|
diagnostic: {
|
|
117463
117488
|
label: "Pullfrog",
|
|
117464
117489
|
recentStderr: server.recentStderr,
|
|
@@ -122889,10 +122914,10 @@ function getMatch(pattern, exp) {
|
|
|
122889
122914
|
}
|
|
122890
122915
|
function parseQuery(pattern, options = {}) {
|
|
122891
122916
|
return pattern.replace(/\\\|/g, ESCAPED_PIPE).split(OR_TOKEN).map((item) => {
|
|
122892
|
-
const
|
|
122917
|
+
const query2 = tokenize(item.replace(/\u0000/g, "|").trim()).filter((item2) => item2 && !!item2.trim());
|
|
122893
122918
|
const results = [];
|
|
122894
|
-
for (let i = 0, len =
|
|
122895
|
-
const queryItem =
|
|
122919
|
+
for (let i = 0, len = query2.length; i < len; i += 1) {
|
|
122920
|
+
const queryItem = query2[i];
|
|
122896
122921
|
let found = false;
|
|
122897
122922
|
let idx = -1;
|
|
122898
122923
|
while (!found && ++idx < matchersLen) {
|
|
@@ -122940,8 +122965,8 @@ var ExtendedSearch = class {
|
|
|
122940
122965
|
return options.useExtendedSearch;
|
|
122941
122966
|
}
|
|
122942
122967
|
searchIn(text) {
|
|
122943
|
-
const
|
|
122944
|
-
if (!
|
|
122968
|
+
const query2 = this.query;
|
|
122969
|
+
if (!query2) return {
|
|
122945
122970
|
isMatch: false,
|
|
122946
122971
|
score: 1
|
|
122947
122972
|
};
|
|
@@ -122952,8 +122977,8 @@ var ExtendedSearch = class {
|
|
|
122952
122977
|
const allIndices = [];
|
|
122953
122978
|
let totalScore = 0;
|
|
122954
122979
|
let hasInverse = false;
|
|
122955
|
-
for (let i = 0, qLen =
|
|
122956
|
-
const searchers =
|
|
122980
|
+
for (let i = 0, qLen = query2.length; i < qLen; i += 1) {
|
|
122981
|
+
const searchers = query2[i];
|
|
122957
122982
|
allIndices.length = 0;
|
|
122958
122983
|
numMatches = 0;
|
|
122959
122984
|
hasInverse = false;
|
|
@@ -123009,26 +123034,26 @@ var KeyType = {
|
|
|
123009
123034
|
PATH: "$path",
|
|
123010
123035
|
PATTERN: "$val"
|
|
123011
123036
|
};
|
|
123012
|
-
var isExpression = (
|
|
123013
|
-
var isPath = (
|
|
123014
|
-
var isLeaf = (
|
|
123015
|
-
var convertToExplicit = (
|
|
123016
|
-
function parse3(
|
|
123017
|
-
const next2 = (
|
|
123018
|
-
if (isString(
|
|
123037
|
+
var isExpression = (query2) => !!(query2[LogicalOperator.AND] || query2[LogicalOperator.OR]);
|
|
123038
|
+
var isPath = (query2) => !!query2[KeyType.PATH];
|
|
123039
|
+
var isLeaf = (query2) => !isArray2(query2) && isObject2(query2) && !isExpression(query2);
|
|
123040
|
+
var convertToExplicit = (query2) => ({ [LogicalOperator.AND]: Object.keys(query2).map((key) => ({ [key]: query2[key] })) });
|
|
123041
|
+
function parse3(query2, options, { auto = true } = {}) {
|
|
123042
|
+
const next2 = (query3) => {
|
|
123043
|
+
if (isString(query3)) {
|
|
123019
123044
|
const obj = {
|
|
123020
123045
|
keyId: null,
|
|
123021
|
-
pattern:
|
|
123046
|
+
pattern: query3
|
|
123022
123047
|
};
|
|
123023
|
-
if (auto) obj.searcher = createSearcher(
|
|
123048
|
+
if (auto) obj.searcher = createSearcher(query3, options);
|
|
123024
123049
|
return obj;
|
|
123025
123050
|
}
|
|
123026
|
-
const keys = Object.keys(
|
|
123027
|
-
const isQueryPath = isPath(
|
|
123028
|
-
if (!isQueryPath && keys.length > 1 && !isExpression(
|
|
123029
|
-
if (isLeaf(
|
|
123030
|
-
const key = isQueryPath ?
|
|
123031
|
-
const pattern = isQueryPath ?
|
|
123051
|
+
const keys = Object.keys(query3);
|
|
123052
|
+
const isQueryPath = isPath(query3);
|
|
123053
|
+
if (!isQueryPath && keys.length > 1 && !isExpression(query3)) return next2(convertToExplicit(query3));
|
|
123054
|
+
if (isLeaf(query3)) {
|
|
123055
|
+
const key = isQueryPath ? query3[KeyType.PATH] : keys[0];
|
|
123056
|
+
const pattern = isQueryPath ? query3[KeyType.PATTERN] : query3[key];
|
|
123032
123057
|
if (!isString(pattern)) throw new Error(LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(key));
|
|
123033
123058
|
const obj = {
|
|
123034
123059
|
keyId: createKeyId(key),
|
|
@@ -123042,15 +123067,15 @@ function parse3(query, options, { auto = true } = {}) {
|
|
|
123042
123067
|
operator: keys[0]
|
|
123043
123068
|
};
|
|
123044
123069
|
keys.forEach((key) => {
|
|
123045
|
-
const value2 =
|
|
123070
|
+
const value2 = query3[key];
|
|
123046
123071
|
if (isArray2(value2)) value2.forEach((item) => {
|
|
123047
123072
|
node2.children.push(next2(item));
|
|
123048
123073
|
});
|
|
123049
123074
|
});
|
|
123050
123075
|
return node2;
|
|
123051
123076
|
};
|
|
123052
|
-
if (!isExpression(
|
|
123053
|
-
return next2(
|
|
123077
|
+
if (!isExpression(query2)) query2 = convertToExplicit(query2);
|
|
123078
|
+
return next2(query2);
|
|
123054
123079
|
}
|
|
123055
123080
|
function computeScoreSingle(matches, { ignoreFieldNorm = Config3.ignoreFieldNorm }) {
|
|
123056
123081
|
let totalScore = 1;
|
|
@@ -123346,13 +123371,13 @@ var Fuse = class {
|
|
|
123346
123371
|
this._lastQuery = null;
|
|
123347
123372
|
this._lastSearcher = null;
|
|
123348
123373
|
}
|
|
123349
|
-
_getSearcher(
|
|
123350
|
-
if (this._lastQuery ===
|
|
123351
|
-
const searcher = createSearcher(
|
|
123374
|
+
_getSearcher(query2) {
|
|
123375
|
+
if (this._lastQuery === query2) return this._lastSearcher;
|
|
123376
|
+
const searcher = createSearcher(query2, this._invertedIndex ? {
|
|
123352
123377
|
...this.options,
|
|
123353
123378
|
_invertedIndex: this._invertedIndex
|
|
123354
123379
|
} : this.options);
|
|
123355
|
-
this._lastQuery =
|
|
123380
|
+
this._lastQuery = query2;
|
|
123356
123381
|
this._lastSearcher = searcher;
|
|
123357
123382
|
return searcher;
|
|
123358
123383
|
}
|
|
@@ -123421,10 +123446,10 @@ var Fuse = class {
|
|
|
123421
123446
|
_normalizedKeys() {
|
|
123422
123447
|
return this._myIndex.keys.map((key) => this._keyStore.get(key.id) || key);
|
|
123423
123448
|
}
|
|
123424
|
-
search(
|
|
123449
|
+
search(query2, options) {
|
|
123425
123450
|
const { limit = -1 } = options || {};
|
|
123426
123451
|
const { includeMatches, includeScore, shouldSort, sortFn, ignoreFieldNorm } = this.options;
|
|
123427
|
-
if (isString(
|
|
123452
|
+
if (isString(query2) && !query2.trim()) {
|
|
123428
123453
|
let docs = this._docs.map((item, idx) => ({
|
|
123429
123454
|
item,
|
|
123430
123455
|
refIndex: idx
|
|
@@ -123432,25 +123457,25 @@ var Fuse = class {
|
|
|
123432
123457
|
if (isNumber(limit) && limit > -1) docs = docs.slice(0, limit);
|
|
123433
123458
|
return docs;
|
|
123434
123459
|
}
|
|
123435
|
-
const useHeap = shouldSort && isNumber(limit) && limit > 0 && isString(
|
|
123460
|
+
const useHeap = shouldSort && isNumber(limit) && limit > 0 && isString(query2);
|
|
123436
123461
|
const comparator = sortFn;
|
|
123437
123462
|
const stable = (a, b) => comparator(a, b) || a.idx - b.idx;
|
|
123438
123463
|
let results;
|
|
123439
123464
|
if (useHeap) {
|
|
123440
123465
|
const heap = new MaxHeap(limit, stable);
|
|
123441
|
-
if (isString(this._docs[0])) this._searchStringList(
|
|
123466
|
+
if (isString(this._docs[0])) this._searchStringList(query2, {
|
|
123442
123467
|
heap,
|
|
123443
123468
|
ignoreFieldNorm
|
|
123444
123469
|
});
|
|
123445
|
-
else this._searchObjectList(
|
|
123470
|
+
else this._searchObjectList(query2, {
|
|
123446
123471
|
heap,
|
|
123447
123472
|
ignoreFieldNorm
|
|
123448
123473
|
});
|
|
123449
123474
|
results = heap.extractSorted();
|
|
123450
123475
|
} else {
|
|
123451
|
-
results = isString(
|
|
123476
|
+
results = isString(query2) ? isString(this._docs[0]) ? this._searchStringList(query2) : this._searchObjectList(query2) : this._searchLogical(query2);
|
|
123452
123477
|
computeScore(results, { ignoreFieldNorm });
|
|
123453
|
-
if (shouldSort) results.sort(isString(
|
|
123478
|
+
if (shouldSort) results.sort(isString(query2) ? stable : comparator);
|
|
123454
123479
|
if (isNumber(limit) && limit > -1) results = results.slice(0, limit);
|
|
123455
123480
|
}
|
|
123456
123481
|
return format(results, this._docs, {
|
|
@@ -123458,8 +123483,8 @@ var Fuse = class {
|
|
|
123458
123483
|
includeScore
|
|
123459
123484
|
});
|
|
123460
123485
|
}
|
|
123461
|
-
_searchStringList(
|
|
123462
|
-
const searcher = this._getSearcher(
|
|
123486
|
+
_searchStringList(query2, { heap, ignoreFieldNorm } = {}) {
|
|
123487
|
+
const searcher = this._getSearcher(query2);
|
|
123463
123488
|
const requireAllTokens = this.options.useTokenSearch && this.options.tokenMatch === "all";
|
|
123464
123489
|
const { records } = this._myIndex;
|
|
123465
123490
|
const results = heap ? null : [];
|
|
@@ -123494,8 +123519,8 @@ var Fuse = class {
|
|
|
123494
123519
|
});
|
|
123495
123520
|
return results;
|
|
123496
123521
|
}
|
|
123497
|
-
_searchLogical(
|
|
123498
|
-
const expression = parse3(
|
|
123522
|
+
_searchLogical(query2) {
|
|
123523
|
+
const expression = parse3(query2, this.options);
|
|
123499
123524
|
const keys = this._normalizedKeys();
|
|
123500
123525
|
const evaluate = (node2, item, idx) => {
|
|
123501
123526
|
if (!("children" in node2)) {
|
|
@@ -123555,8 +123580,8 @@ var Fuse = class {
|
|
|
123555
123580
|
});
|
|
123556
123581
|
return results;
|
|
123557
123582
|
}
|
|
123558
|
-
_searchObjectList(
|
|
123559
|
-
const searcher = this._getSearcher(
|
|
123583
|
+
_searchObjectList(query2, { heap, ignoreFieldNorm } = {}) {
|
|
123584
|
+
const searcher = this._getSearcher(query2);
|
|
123560
123585
|
const requireAllTokens = this.options.useTokenSearch && this.options.tokenMatch === "all";
|
|
123561
123586
|
const { records } = this._myIndex;
|
|
123562
123587
|
const keys = this._normalizedKeys();
|
|
@@ -123783,10 +123808,10 @@ var getPattern = (label, next2) => {
|
|
|
123783
123808
|
if (label === "*") return "*";
|
|
123784
123809
|
const match3 = label.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);
|
|
123785
123810
|
if (match3) {
|
|
123786
|
-
const
|
|
123787
|
-
if (!patternCache[
|
|
123788
|
-
if (match3[2]) patternCache[
|
|
123789
|
-
|
|
123811
|
+
const cacheKey3 = `${label}#${next2}`;
|
|
123812
|
+
if (!patternCache[cacheKey3]) {
|
|
123813
|
+
if (match3[2]) patternCache[cacheKey3] = next2 && next2[0] !== ":" && next2[0] !== "*" ? [
|
|
123814
|
+
cacheKey3,
|
|
123790
123815
|
match3[1],
|
|
123791
123816
|
new RegExp(`^${match3[2]}(?=/${next2})`)
|
|
123792
123817
|
] : [
|
|
@@ -123794,13 +123819,13 @@ var getPattern = (label, next2) => {
|
|
|
123794
123819
|
match3[1],
|
|
123795
123820
|
new RegExp(`^${match3[2]}$`)
|
|
123796
123821
|
];
|
|
123797
|
-
else patternCache[
|
|
123822
|
+
else patternCache[cacheKey3] = [
|
|
123798
123823
|
label,
|
|
123799
123824
|
match3[1],
|
|
123800
123825
|
true
|
|
123801
123826
|
];
|
|
123802
123827
|
}
|
|
123803
|
-
return patternCache[
|
|
123828
|
+
return patternCache[cacheKey3];
|
|
123804
123829
|
}
|
|
123805
123830
|
return null;
|
|
123806
123831
|
};
|
|
@@ -134289,9 +134314,9 @@ var require_schemes2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
134289
134314
|
wsComponent.secure = void 0;
|
|
134290
134315
|
}
|
|
134291
134316
|
if (wsComponent.resourceName) {
|
|
134292
|
-
const [path4,
|
|
134317
|
+
const [path4, query2] = wsComponent.resourceName.split("?");
|
|
134293
134318
|
wsComponent.path = path4 && path4 !== "/" ? path4 : void 0;
|
|
134294
|
-
wsComponent.query =
|
|
134319
|
+
wsComponent.query = query2;
|
|
134295
134320
|
wsComponent.resourceName = void 0;
|
|
134296
134321
|
}
|
|
134297
134322
|
wsComponent.fragment = void 0;
|
|
@@ -134906,8 +134931,8 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
134906
134931
|
return this;
|
|
134907
134932
|
}
|
|
134908
134933
|
case "object": {
|
|
134909
|
-
const
|
|
134910
|
-
this._cache.delete(
|
|
134934
|
+
const cacheKey3 = schemaKeyRef;
|
|
134935
|
+
this._cache.delete(cacheKey3);
|
|
134911
134936
|
let id = schemaKeyRef[this.opts.schemaId];
|
|
134912
134937
|
if (id) {
|
|
134913
134938
|
id = (0, resolve_1.normalizeId)(id);
|
|
@@ -135050,10 +135075,10 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
135050
135075
|
Ajv5.ValidationError = validation_error_1.default;
|
|
135051
135076
|
Ajv5.MissingRefError = ref_error_1.default;
|
|
135052
135077
|
exports.default = Ajv5;
|
|
135053
|
-
function checkOptions(checkOpts, options, msg,
|
|
135078
|
+
function checkOptions(checkOpts, options, msg, log2 = "error") {
|
|
135054
135079
|
for (const key in checkOpts) {
|
|
135055
135080
|
const opt = key;
|
|
135056
|
-
if (opt in options) this.logger[
|
|
135081
|
+
if (opt in options) this.logger[log2](`${msg}: option ${key}. ${checkOpts[opt]}`);
|
|
135057
135082
|
}
|
|
135058
135083
|
}
|
|
135059
135084
|
function getSchEnv(keyRef) {
|
|
@@ -148574,9 +148599,9 @@ var require_schemes3 = /* @__PURE__ */ __commonJSMin2(((exports, module) => {
|
|
|
148574
148599
|
wsComponent.secure = void 0;
|
|
148575
148600
|
}
|
|
148576
148601
|
if (wsComponent.resourceName) {
|
|
148577
|
-
const [path4,
|
|
148602
|
+
const [path4, query2] = wsComponent.resourceName.split("?");
|
|
148578
148603
|
wsComponent.path = path4 && path4 !== "/" ? path4 : void 0;
|
|
148579
|
-
wsComponent.query =
|
|
148604
|
+
wsComponent.query = query2;
|
|
148580
148605
|
wsComponent.resourceName = void 0;
|
|
148581
148606
|
}
|
|
148582
148607
|
wsComponent.fragment = void 0;
|
|
@@ -149191,8 +149216,8 @@ var require_core$32 = /* @__PURE__ */ __commonJSMin2(((exports) => {
|
|
|
149191
149216
|
return this;
|
|
149192
149217
|
}
|
|
149193
149218
|
case "object": {
|
|
149194
|
-
const
|
|
149195
|
-
this._cache.delete(
|
|
149219
|
+
const cacheKey3 = schemaKeyRef;
|
|
149220
|
+
this._cache.delete(cacheKey3);
|
|
149196
149221
|
let id = schemaKeyRef[this.opts.schemaId];
|
|
149197
149222
|
if (id) {
|
|
149198
149223
|
id = (0, resolve_1.normalizeId)(id);
|
|
@@ -149335,10 +149360,10 @@ var require_core$32 = /* @__PURE__ */ __commonJSMin2(((exports) => {
|
|
|
149335
149360
|
Ajv5.ValidationError = validation_error_1.default;
|
|
149336
149361
|
Ajv5.MissingRefError = ref_error_1.default;
|
|
149337
149362
|
exports.default = Ajv5;
|
|
149338
|
-
function checkOptions(checkOpts, options, msg,
|
|
149363
|
+
function checkOptions(checkOpts, options, msg, log2 = "error") {
|
|
149339
149364
|
for (const key in checkOpts) {
|
|
149340
149365
|
const opt = key;
|
|
149341
|
-
if (opt in options) this.logger[
|
|
149366
|
+
if (opt in options) this.logger[log2](`${msg}: option ${key}. ${checkOpts[opt]}`);
|
|
149342
149367
|
}
|
|
149343
149368
|
}
|
|
149344
149369
|
function getSchEnv(keyRef) {
|
|
@@ -160031,7 +160056,7 @@ var require_depd = /* @__PURE__ */ __commonJSMin3(((exports, module) => {
|
|
|
160031
160056
|
if (!namespace) throw new TypeError("argument namespace is required");
|
|
160032
160057
|
var file2 = callSiteLocation(getStack()[1])[0];
|
|
160033
160058
|
function deprecate$1(message) {
|
|
160034
|
-
|
|
160059
|
+
log2.call(deprecate$1, message);
|
|
160035
160060
|
}
|
|
160036
160061
|
deprecate$1._file = file2;
|
|
160037
160062
|
deprecate$1._ignored = isignored(namespace);
|
|
@@ -160053,7 +160078,7 @@ var require_depd = /* @__PURE__ */ __commonJSMin3(((exports, module) => {
|
|
|
160053
160078
|
if (process.traceDeprecation) return true;
|
|
160054
160079
|
return containsNamespace(process.env.TRACE_DEPRECATION || "", namespace);
|
|
160055
160080
|
}
|
|
160056
|
-
function
|
|
160081
|
+
function log2(message, site) {
|
|
160057
160082
|
var haslisteners = eehaslisteners(process, "deprecation");
|
|
160058
160083
|
if (!haslisteners && this._ignored) return;
|
|
160059
160084
|
var caller;
|
|
@@ -160159,7 +160184,7 @@ var require_depd = /* @__PURE__ */ __commonJSMin3(((exports, module) => {
|
|
|
160159
160184
|
var args2 = createArgumentsString(fn2.length);
|
|
160160
160185
|
var site = callSiteLocation(getStack()[1]);
|
|
160161
160186
|
site.name = fn2.name;
|
|
160162
|
-
return new Function("fn", "log", "deprecate", "message", "site", '"use strict"\nreturn function (' + args2 + ") {log.call(deprecate, message, site)\nreturn fn.apply(this, arguments)\n}")(fn2,
|
|
160187
|
+
return new Function("fn", "log", "deprecate", "message", "site", '"use strict"\nreturn function (' + args2 + ") {log.call(deprecate, message, site)\nreturn fn.apply(this, arguments)\n}")(fn2, log2, this, message, site);
|
|
160163
160188
|
}
|
|
160164
160189
|
function wrapproperty(obj, prop, message) {
|
|
160165
160190
|
if (!obj || typeof obj !== "object" && typeof obj !== "function") throw new TypeError("argument obj must be object");
|
|
@@ -160173,11 +160198,11 @@ var require_depd = /* @__PURE__ */ __commonJSMin3(((exports, module) => {
|
|
|
160173
160198
|
var get2 = descriptor.get;
|
|
160174
160199
|
var set2 = descriptor.set;
|
|
160175
160200
|
if (typeof get2 === "function") descriptor.get = function getter() {
|
|
160176
|
-
|
|
160201
|
+
log2.call(deprecate$1, message, site);
|
|
160177
160202
|
return get2.apply(this, arguments);
|
|
160178
160203
|
};
|
|
160179
160204
|
if (typeof set2 === "function") descriptor.set = function setter() {
|
|
160180
|
-
|
|
160205
|
+
log2.call(deprecate$1, message, site);
|
|
160181
160206
|
return set2.apply(this, arguments);
|
|
160182
160207
|
};
|
|
160183
160208
|
Object.defineProperty(obj, prop, descriptor);
|
|
@@ -171225,7 +171250,7 @@ ${error49 instanceof Error ? error49.stack : JSON.stringify(error49)}`
|
|
|
171225
171250
|
);
|
|
171226
171251
|
}
|
|
171227
171252
|
};
|
|
171228
|
-
const
|
|
171253
|
+
const log2 = {
|
|
171229
171254
|
debug: (message, context) => {
|
|
171230
171255
|
this.#server.sendLoggingMessage({
|
|
171231
171256
|
data: {
|
|
@@ -171293,7 +171318,7 @@ ${error49 instanceof Error ? error49.stack : JSON.stringify(error49)}`
|
|
|
171293
171318
|
client: {
|
|
171294
171319
|
version: this.#server.getClientVersion()
|
|
171295
171320
|
},
|
|
171296
|
-
log:
|
|
171321
|
+
log: log2,
|
|
171297
171322
|
reportProgress: reportProgress2,
|
|
171298
171323
|
requestId: typeof request2.params?._meta?.requestId === "string" ? request2.params._meta.requestId : void 0,
|
|
171299
171324
|
session: this.#auth,
|
|
@@ -174378,8 +174403,8 @@ var defaultableMorphCache = {};
|
|
|
174378
174403
|
var getDefaultableMorph = (node2) => {
|
|
174379
174404
|
if (!node2.hasDefault())
|
|
174380
174405
|
return;
|
|
174381
|
-
const
|
|
174382
|
-
return defaultableMorphCache[
|
|
174406
|
+
const cacheKey3 = `{${node2.compiledKey}: ${node2.value.id} = ${defaultValueSerializer(node2.default)}}`;
|
|
174407
|
+
return defaultableMorphCache[cacheKey3] ??= computeDefaultValueMorph(node2.key, node2.value, node2.default);
|
|
174383
174408
|
};
|
|
174384
174409
|
var computeDefaultValueMorph = (key, value2, defaultInput) => {
|
|
174385
174410
|
if (typeof defaultInput === "function") {
|
|
@@ -176552,15 +176577,15 @@ var getDefaultableMorphs = (node2) => {
|
|
|
176552
176577
|
if (!node2.defaultables)
|
|
176553
176578
|
return [];
|
|
176554
176579
|
const morphs = [];
|
|
176555
|
-
let
|
|
176580
|
+
let cacheKey3 = "[";
|
|
176556
176581
|
const lastDefaultableIndex = node2.prefixLength + node2.defaultablesLength - 1;
|
|
176557
176582
|
for (let i = node2.prefixLength; i <= lastDefaultableIndex; i++) {
|
|
176558
176583
|
const [elementNode, defaultValue] = node2.defaultables[i - node2.prefixLength];
|
|
176559
176584
|
morphs.push(computeDefaultValueMorph(i, elementNode, defaultValue));
|
|
176560
|
-
|
|
176585
|
+
cacheKey3 += `${i}: ${elementNode.id} = ${defaultValueSerializer(defaultValue)}, `;
|
|
176561
176586
|
}
|
|
176562
|
-
|
|
176563
|
-
return defaultableMorphsCache[
|
|
176587
|
+
cacheKey3 += "]";
|
|
176588
|
+
return defaultableMorphsCache[cacheKey3] ??= morphs;
|
|
176564
176589
|
};
|
|
176565
176590
|
var Sequence = {
|
|
176566
176591
|
implementation: implementation21,
|
|
@@ -177250,40 +177275,40 @@ var StructureNode = class extends BaseConstraint {
|
|
|
177250
177275
|
};
|
|
177251
177276
|
var defaultableMorphsCache2 = {};
|
|
177252
177277
|
var constructStructuralMorphCacheKey = (node2) => {
|
|
177253
|
-
let
|
|
177278
|
+
let cacheKey3 = "";
|
|
177254
177279
|
for (let i = 0; i < node2.defaultable.length; i++)
|
|
177255
|
-
|
|
177280
|
+
cacheKey3 += node2.defaultable[i].defaultValueMorphRef;
|
|
177256
177281
|
if (node2.sequence?.defaultValueMorphsReference)
|
|
177257
|
-
|
|
177282
|
+
cacheKey3 += node2.sequence?.defaultValueMorphsReference;
|
|
177258
177283
|
if (node2.undeclared === "delete") {
|
|
177259
|
-
|
|
177284
|
+
cacheKey3 += "delete !(";
|
|
177260
177285
|
if (node2.required)
|
|
177261
177286
|
for (const n of node2.required)
|
|
177262
|
-
|
|
177287
|
+
cacheKey3 += n.compiledKey + " | ";
|
|
177263
177288
|
if (node2.optional)
|
|
177264
177289
|
for (const n of node2.optional)
|
|
177265
|
-
|
|
177290
|
+
cacheKey3 += n.compiledKey + " | ";
|
|
177266
177291
|
if (node2.index)
|
|
177267
177292
|
for (const index of node2.index)
|
|
177268
|
-
|
|
177293
|
+
cacheKey3 += index.signature.id + " | ";
|
|
177269
177294
|
if (node2.sequence) {
|
|
177270
177295
|
if (node2.sequence.maxLength === null)
|
|
177271
|
-
|
|
177296
|
+
cacheKey3 += intrinsic.nonNegativeIntegerString.id;
|
|
177272
177297
|
else {
|
|
177273
177298
|
for (let i = 0; i < node2.sequence.tuple.length; i++)
|
|
177274
|
-
|
|
177299
|
+
cacheKey3 += i + " | ";
|
|
177275
177300
|
}
|
|
177276
177301
|
}
|
|
177277
|
-
|
|
177302
|
+
cacheKey3 += ")";
|
|
177278
177303
|
}
|
|
177279
|
-
return
|
|
177304
|
+
return cacheKey3;
|
|
177280
177305
|
};
|
|
177281
177306
|
var getPossibleMorph = (node2) => {
|
|
177282
|
-
const
|
|
177283
|
-
if (!
|
|
177307
|
+
const cacheKey3 = constructStructuralMorphCacheKey(node2);
|
|
177308
|
+
if (!cacheKey3)
|
|
177284
177309
|
return void 0;
|
|
177285
|
-
if (defaultableMorphsCache2[
|
|
177286
|
-
return defaultableMorphsCache2[
|
|
177310
|
+
if (defaultableMorphsCache2[cacheKey3])
|
|
177311
|
+
return defaultableMorphsCache2[cacheKey3];
|
|
177287
177312
|
const $arkStructuralMorph = (data, ctx) => {
|
|
177288
177313
|
for (let i = 0; i < node2.defaultable.length; i++) {
|
|
177289
177314
|
if (!(node2.defaultable[i].key in data))
|
|
@@ -177300,7 +177325,7 @@ var getPossibleMorph = (node2) => {
|
|
|
177300
177325
|
}
|
|
177301
177326
|
return data;
|
|
177302
177327
|
};
|
|
177303
|
-
return defaultableMorphsCache2[
|
|
177328
|
+
return defaultableMorphsCache2[cacheKey3] = $arkStructuralMorph;
|
|
177304
177329
|
};
|
|
177305
177330
|
var precompileMorphs = (js, node2) => {
|
|
177306
177331
|
const requiresContext = node2.defaultable.some((node3) => node3.defaultValueMorph.length === 2) || node2.sequence?.defaultValueMorphs.some((morph) => morph.length === 2);
|
|
@@ -179705,10 +179730,10 @@ var schema = ark.schema;
|
|
|
179705
179730
|
var define2 = ark.define;
|
|
179706
179731
|
var declare = ark.declare;
|
|
179707
179732
|
|
|
179708
|
-
// node_modules/.pnpm/yes@0.
|
|
179733
|
+
// node_modules/.pnpm/yes@0.2.3_typescript@5.9.3/node_modules/yes/dist/index.js
|
|
179709
179734
|
import { setTimeout as sleep2 } from "node:timers/promises";
|
|
179710
179735
|
|
|
179711
|
-
// node_modules/.pnpm/yes@0.
|
|
179736
|
+
// node_modules/.pnpm/yes@0.2.3_typescript@5.9.3/node_modules/yes/dist/cache/adapter.js
|
|
179712
179737
|
var AdapterError = class extends Error {
|
|
179713
179738
|
method;
|
|
179714
179739
|
/** the full store key, or the op's prefix when the call covered many keys. never the raw input. */
|
|
@@ -180306,43 +180331,45 @@ var I = class d2 {
|
|
|
180306
180331
|
}
|
|
180307
180332
|
};
|
|
180308
180333
|
|
|
180309
|
-
// node_modules/.pnpm/yes@0.
|
|
180310
|
-
function memory(
|
|
180311
|
-
const store = new I({ max:
|
|
180334
|
+
// node_modules/.pnpm/yes@0.2.3_typescript@5.9.3/node_modules/yes/dist/cache/memory.js
|
|
180335
|
+
function memory({ maxItems = 1e3 } = {}) {
|
|
180336
|
+
const store = new I({ max: maxItems });
|
|
180312
180337
|
return {
|
|
180313
180338
|
get: (key) => store.get(key),
|
|
180314
180339
|
peek: (key) => store.peek(key),
|
|
180315
|
-
// the TTL rides on each entry
|
|
180316
|
-
|
|
180317
|
-
set: (key, entry, ttlMs) => {
|
|
180318
|
-
store.set(key, entry, { ttl: ttlMs });
|
|
180319
|
-
},
|
|
180340
|
+
// the TTL rides on each entry, so ops with different lifetimes can share one store
|
|
180341
|
+
set: (key, entry, ttlMs) => store.set(key, entry, { ttl: ttlMs }),
|
|
180320
180342
|
delete: (keys) => {
|
|
180321
180343
|
for (const key of keys)
|
|
180322
180344
|
store.delete(key);
|
|
180323
180345
|
},
|
|
180324
|
-
// a snapshot, so deleting while iterating is safe
|
|
180325
|
-
// entries itself.
|
|
180346
|
+
// a snapshot, so deleting while iterating is safe
|
|
180326
180347
|
list: (prefix) => [...store.entries()].filter(([key]) => key.startsWith(prefix))
|
|
180327
180348
|
};
|
|
180328
180349
|
}
|
|
180329
180350
|
|
|
180330
|
-
// node_modules/.pnpm/yes@0.
|
|
180351
|
+
// node_modules/.pnpm/yes@0.2.3_typescript@5.9.3/node_modules/yes/dist/key.js
|
|
180331
180352
|
import { hash as hash2 } from "node:crypto";
|
|
180332
180353
|
function hashKey(value2) {
|
|
180333
|
-
return hash2("sha1",
|
|
180354
|
+
return hash2("sha1", canonical(value2));
|
|
180355
|
+
}
|
|
180356
|
+
function canonical(value2) {
|
|
180357
|
+
return serialize(value2, 0);
|
|
180358
|
+
}
|
|
180359
|
+
function cacheKey2(value2) {
|
|
180360
|
+
if (value2 === null)
|
|
180361
|
+
throw new Error("null cannot be part of a cache key");
|
|
180362
|
+
return value2 === void 0 ? "~void" : hashKey(value2);
|
|
180334
180363
|
}
|
|
180335
|
-
var MAX_DEPTH = 64;
|
|
180336
180364
|
function serialize(value2, depth) {
|
|
180337
180365
|
switch (typeof value2) {
|
|
180338
|
-
case "string":
|
|
180339
|
-
return JSON.stringify(value2);
|
|
180340
180366
|
case "number":
|
|
180341
|
-
if (
|
|
180342
|
-
|
|
180343
|
-
|
|
180367
|
+
if (Number.isFinite(value2))
|
|
180368
|
+
return String(value2);
|
|
180369
|
+
throw new Error(`${value2} cannot be part of a cache key`);
|
|
180370
|
+
case "string":
|
|
180344
180371
|
case "boolean":
|
|
180345
|
-
return value2
|
|
180372
|
+
return JSON.stringify(value2);
|
|
180346
180373
|
case "undefined":
|
|
180347
180374
|
throw new Error("undefined cannot be part of a cache key, except as an object property");
|
|
180348
180375
|
case "object":
|
|
@@ -180352,9 +180379,8 @@ function serialize(value2, depth) {
|
|
|
180352
180379
|
}
|
|
180353
180380
|
if (value2 === null)
|
|
180354
180381
|
return "null";
|
|
180355
|
-
if (depth ===
|
|
180356
|
-
throw new Error(
|
|
180357
|
-
depth++;
|
|
180382
|
+
if (depth++ === 64)
|
|
180383
|
+
throw new Error("an input nested more than 64 levels deep, or circular");
|
|
180358
180384
|
if (Array.isArray(value2)) {
|
|
180359
180385
|
let out2 = "[";
|
|
180360
180386
|
for (let i = 0; i < value2.length; i++)
|
|
@@ -180366,77 +180392,26 @@ function serialize(value2, depth) {
|
|
|
180366
180392
|
const name = proto.constructor?.name || "class instance";
|
|
180367
180393
|
throw new Error(`a ${name} cannot be part of a cache key: only JSON data can`);
|
|
180368
180394
|
}
|
|
180369
|
-
const record3 = value2;
|
|
180370
|
-
const keys = Object.keys(record3).sort();
|
|
180371
180395
|
let out = "";
|
|
180372
|
-
for (const key of keys) {
|
|
180373
|
-
const v =
|
|
180396
|
+
for (const key of Object.keys(value2).sort()) {
|
|
180397
|
+
const v = value2[key];
|
|
180374
180398
|
if (v !== void 0)
|
|
180375
180399
|
out += `${out ? "," : ""}${JSON.stringify(key)}:${serialize(v, depth)}`;
|
|
180376
180400
|
}
|
|
180377
180401
|
return `{${out}}`;
|
|
180378
180402
|
}
|
|
180379
180403
|
|
|
180380
|
-
// node_modules/.pnpm/yes@0.
|
|
180381
|
-
|
|
180382
|
-
|
|
180383
|
-
|
|
180384
|
-
return VOID_KEY;
|
|
180385
|
-
if (value2 === null) {
|
|
180386
|
-
throw new Error("cache key cannot be null");
|
|
180387
|
-
}
|
|
180388
|
-
try {
|
|
180389
|
-
return hashKey(value2);
|
|
180390
|
-
} catch (error49) {
|
|
180391
|
-
throw new Error(`cache key cannot be hashed: ${error49 instanceof Error ? error49.message : String(error49)}`);
|
|
180392
|
-
}
|
|
180393
|
-
}
|
|
180394
|
-
function jitter(delayMs) {
|
|
180395
|
-
const half = delayMs / 2;
|
|
180396
|
-
return Math.round(half + Math.random() * half);
|
|
180397
|
-
}
|
|
180398
|
-
var DEFAULT_RETRY_AFTER_CAP_MS = 2e4;
|
|
180399
|
-
function getErrorResponseHeaders(error49) {
|
|
180400
|
-
if (error49 === null || typeof error49 !== "object")
|
|
180401
|
-
return void 0;
|
|
180402
|
-
const source = error49;
|
|
180403
|
-
const headers = source.response?.headers ?? source.headers;
|
|
180404
|
-
if (headers === null || typeof headers !== "object")
|
|
180405
|
-
return void 0;
|
|
180406
|
-
return headers;
|
|
180407
|
-
}
|
|
180408
|
-
function retryAfterMs(error49) {
|
|
180409
|
-
const headers = getErrorResponseHeaders(error49);
|
|
180410
|
-
if (!headers)
|
|
180411
|
-
return void 0;
|
|
180412
|
-
const retryAfter = headers["retry-after"];
|
|
180413
|
-
if (typeof retryAfter === "string" && retryAfter.trim() !== "") {
|
|
180414
|
-
const seconds = Number(retryAfter);
|
|
180415
|
-
if (Number.isFinite(seconds))
|
|
180416
|
-
return Math.max(0, seconds * 1e3);
|
|
180417
|
-
const dateMs = Date.parse(retryAfter);
|
|
180418
|
-
if (!Number.isNaN(dateMs))
|
|
180419
|
-
return Math.max(0, dateMs - Date.now());
|
|
180420
|
-
}
|
|
180421
|
-
if (headers["x-ratelimit-remaining"] === "0") {
|
|
180422
|
-
const reset = headers["x-ratelimit-reset"];
|
|
180423
|
-
if (typeof reset === "string" && reset.trim() !== "") {
|
|
180424
|
-
const resetEpoch = Number(reset);
|
|
180425
|
-
if (Number.isFinite(resetEpoch))
|
|
180426
|
-
return Math.max(0, resetEpoch * 1e3 - Date.now());
|
|
180427
|
-
}
|
|
180428
|
-
}
|
|
180429
|
-
return void 0;
|
|
180404
|
+
// node_modules/.pnpm/yes@0.2.3_typescript@5.9.3/node_modules/yes/dist/index.js
|
|
180405
|
+
function delay2(schedule, attempt) {
|
|
180406
|
+
const d3 = schedule[attempt - 1];
|
|
180407
|
+
return d3 === void 0 ? -1 : Math.round(d3 / 2 + Math.random() * d3 / 2);
|
|
180430
180408
|
}
|
|
180431
180409
|
var ValidationError = class extends Error {
|
|
180432
|
-
|
|
180433
|
-
issues;
|
|
180410
|
+
name = "ValidationError";
|
|
180434
180411
|
constructor(result) {
|
|
180435
|
-
const
|
|
180436
|
-
super(message);
|
|
180437
|
-
this.
|
|
180438
|
-
this.result = result;
|
|
180439
|
-
this.issues = result.issues;
|
|
180412
|
+
const { message } = result;
|
|
180413
|
+
super(typeof message === "string" ? message : `validation failed: ${result.issues.map((i) => i.message).join(", ")}`);
|
|
180414
|
+
Object.assign(this, { result, issues: result.issues });
|
|
180440
180415
|
}
|
|
180441
180416
|
};
|
|
180442
180417
|
async function assertSchema(schema2, value2) {
|
|
@@ -180445,322 +180420,212 @@ async function assertSchema(schema2, value2) {
|
|
|
180445
180420
|
throw new ValidationError(result);
|
|
180446
180421
|
return result.value;
|
|
180447
180422
|
}
|
|
180448
|
-
|
|
180449
|
-
|
|
180450
|
-
|
|
180451
|
-
|
|
180452
|
-
|
|
180453
|
-
|
|
180454
|
-
|
|
180455
|
-
|
|
180456
|
-
|
|
180457
|
-
|
|
180458
|
-
|
|
180459
|
-
|
|
180460
|
-
|
|
180461
|
-
|
|
180462
|
-
|
|
180463
|
-
|
|
180464
|
-
};
|
|
180465
|
-
}
|
|
180466
|
-
|
|
180467
|
-
|
|
180468
|
-
|
|
180469
|
-
|
|
180470
|
-
|
|
180471
|
-
|
|
180472
|
-
|
|
180473
|
-
var isThenable = (value2) => typeof value2?.then === "function";
|
|
180474
|
-
function freshEntry(value2) {
|
|
180475
|
-
if (value2 === null || typeof value2 !== "object" || !("value" in value2))
|
|
180476
|
-
return void 0;
|
|
180477
|
-
const expires = value2.expires;
|
|
180478
|
-
return typeof expires === "number" && expires > Date.now() ? value2 : void 0;
|
|
180479
|
-
}
|
|
180480
|
-
var adapterMethods = ["get", "set", "delete", "list"];
|
|
180481
|
-
function callAdapter(method, key, run) {
|
|
180482
|
-
let result;
|
|
180483
|
-
try {
|
|
180484
|
-
result = run();
|
|
180485
|
-
} catch (error49) {
|
|
180486
|
-
throw new AdapterError(method, key, error49);
|
|
180487
|
-
}
|
|
180488
|
-
if (!isThenable(result))
|
|
180489
|
-
return result;
|
|
180490
|
-
return result.then(void 0, (error49) => {
|
|
180491
|
-
throw new AdapterError(method, key, error49);
|
|
180492
|
-
});
|
|
180493
|
-
}
|
|
180494
|
-
var DELETE_BATCH = 1e3;
|
|
180495
|
-
function sweep(store, prefix, match3) {
|
|
180496
|
-
const now = Date.now();
|
|
180497
|
-
const keys = [];
|
|
180498
|
-
let count = 0;
|
|
180499
|
-
let matchError;
|
|
180500
|
-
const take = ([key, entry]) => {
|
|
180501
|
-
if (!(entry.expires > now))
|
|
180502
|
-
return void keys.push(key);
|
|
180503
|
-
let matched;
|
|
180423
|
+
function op(options) {
|
|
180424
|
+
return build3(options, true);
|
|
180425
|
+
}
|
|
180426
|
+
function build3(options, cacheMethods) {
|
|
180427
|
+
const { name, input: inputSchema, output: outputSchema, run, dedupe, ttl, cache: adapter } = options;
|
|
180428
|
+
const { retry } = options;
|
|
180429
|
+
const delayFor = Array.isArray(retry) ? (_, attempt) => delay2(retry, attempt) : retry;
|
|
180430
|
+
if (ttl !== void 0 && typeof ttl !== "function" && !isLifetime(ttl)) {
|
|
180431
|
+
throw new TypeError(`yes.op: ttl must be a positive number of milliseconds, got ${ttl}`);
|
|
180432
|
+
}
|
|
180433
|
+
const lifetime = typeof ttl === "function" ? ttl : () => ttl;
|
|
180434
|
+
if (adapter && (!name || name.includes(":"))) {
|
|
180435
|
+
throw new TypeError(`yes.op: an op with a cache adapter needs a name without ":", got ${JSON.stringify(name)}`);
|
|
180436
|
+
}
|
|
180437
|
+
if (adapter && ttl === void 0)
|
|
180438
|
+
throw new TypeError(`yes.op: a cache adapter does nothing without a ttl`);
|
|
180439
|
+
const store = ttl === void 0 ? void 0 : adapter ?? memory({ maxItems: options.maxItems });
|
|
180440
|
+
const prefix = adapter ? `yes:${name}:` : "";
|
|
180441
|
+
const label = name ? `[${name}] ` : "";
|
|
180442
|
+
const logCache = (event) => () => {
|
|
180443
|
+
if (name && store && process.env.NODE_ENV === "production")
|
|
180444
|
+
console.log(`${label}cache ${event}`);
|
|
180445
|
+
};
|
|
180446
|
+
const { cacheHit = logCache("hit"), cacheMiss = logCache("miss") } = options;
|
|
180447
|
+
const keyOf = (input) => {
|
|
180504
180448
|
try {
|
|
180505
|
-
|
|
180449
|
+
return cacheKey2(input);
|
|
180506
180450
|
} catch (error49) {
|
|
180507
|
-
|
|
180508
|
-
throw error49;
|
|
180509
|
-
}
|
|
180510
|
-
if (matched) {
|
|
180511
|
-
keys.push(key);
|
|
180512
|
-
count++;
|
|
180451
|
+
throw new Error(`${label}${error49.message}. dedupe and ttl key the input, and a query always dedupes; a write is yes.mutation, which never keys.`, { cause: error49 });
|
|
180513
180452
|
}
|
|
180514
180453
|
};
|
|
180515
|
-
const
|
|
180516
|
-
|
|
180517
|
-
|
|
180518
|
-
|
|
180519
|
-
for (let i = from; i < keys.length; i += DELETE_BATCH) {
|
|
180520
|
-
const batch = keys.slice(i, i + DELETE_BATCH);
|
|
180521
|
-
const deleted = callAdapter("delete", prefix, () => store.delete(batch));
|
|
180522
|
-
if (isThenable(deleted))
|
|
180523
|
-
return Promise.resolve(deleted).then(() => deleteFrom(i + DELETE_BATCH));
|
|
180524
|
-
}
|
|
180525
|
-
return count;
|
|
180454
|
+
const report = (attempt, message, error49, key) => {
|
|
180455
|
+
console.log(`${label}attempt ${attempt} ${message}`);
|
|
180456
|
+
const data = key === void 0 ? { error: error49, attempt } : { key, error: error49, attempt };
|
|
180457
|
+
console.log(...label ? [label, data] : [data]);
|
|
180526
180458
|
};
|
|
180527
|
-
|
|
180528
|
-
|
|
180529
|
-
listed = store.list(prefix);
|
|
180530
|
-
} catch (error49) {
|
|
180531
|
-
return fail(error49);
|
|
180532
|
-
}
|
|
180533
|
-
if (!isThenable(listed) && Symbol.iterator in Object(listed)) {
|
|
180534
|
-
try {
|
|
180535
|
-
for (const item of listed)
|
|
180536
|
-
take(item);
|
|
180537
|
-
} catch (error49) {
|
|
180538
|
-
fail(error49);
|
|
180539
|
-
}
|
|
180540
|
-
return deleteFrom(0);
|
|
180541
|
-
}
|
|
180542
|
-
return (async () => {
|
|
180543
|
-
try {
|
|
180544
|
-
for await (const item of await listed)
|
|
180545
|
-
take(item);
|
|
180546
|
-
} catch (error49) {
|
|
180547
|
-
fail(error49);
|
|
180548
|
-
}
|
|
180549
|
-
return deleteFrom(0);
|
|
180550
|
-
})();
|
|
180551
|
-
}
|
|
180552
|
-
function _op(fn2, options, schemas = {}) {
|
|
180553
|
-
const { ttl, cache: adapter } = options;
|
|
180554
|
-
const shouldCache = ttl !== void 0;
|
|
180555
|
-
if (shouldCache && !(ttl > 0 && Number.isFinite(ttl))) {
|
|
180556
|
-
throw new Error(`ttl must be a positive number of milliseconds, got ${ttl}`);
|
|
180557
|
-
}
|
|
180558
|
-
if (adapter) {
|
|
180559
|
-
if (!options.name)
|
|
180560
|
-
throw new Error(`an op with a cache adapter needs a name: its keys are "yes:<name>:<hash>"`);
|
|
180561
|
-
if (options.name.includes(":")) {
|
|
180562
|
-
throw new Error(`op name "${options.name}" cannot contain ":" with a cache adapter: its keys would overlap another op's`);
|
|
180563
|
-
}
|
|
180564
|
-
if (!shouldCache)
|
|
180565
|
-
throw new Error(`${options.name}: a cache adapter does nothing without a ttl`);
|
|
180566
|
-
if (options.maxItems !== void 0) {
|
|
180567
|
-
throw new Error(`${options.name}: maxItems sizes the default memory store; size the adapter instead`);
|
|
180568
|
-
}
|
|
180569
|
-
const missing = adapterMethods.filter((method) => typeof adapter[method] !== "function");
|
|
180570
|
-
if (missing.length) {
|
|
180571
|
-
throw new Error(`${options.name}: cache is missing ${missing.join(", ")}; an adapter has get, set, delete and list (a Map or a Keyv is not one)`);
|
|
180572
|
-
}
|
|
180573
|
-
}
|
|
180574
|
-
const defaultStore = shouldCache && !adapter ? memory({ maxItems: options.maxItems }) : void 0;
|
|
180575
|
-
const store = adapter ?? defaultStore;
|
|
180576
|
-
const prefix = adapter ? `yes:${options.name}:` : "";
|
|
180577
|
-
const inFlightPromises = /* @__PURE__ */ new Map();
|
|
180578
|
-
const namePrefix = options.name ? `[${options.name}] ` : "";
|
|
180579
|
-
const defaultCacheHit = options.cacheHit === null ? () => {
|
|
180580
|
-
} : options.cacheHit ?? (() => {
|
|
180581
|
-
if (options.name && shouldCache)
|
|
180582
|
-
log2.prod(`${namePrefix}cache hit`);
|
|
180583
|
-
});
|
|
180584
|
-
const defaultCacheMiss = options.cacheMiss === null ? () => {
|
|
180585
|
-
} : options.cacheMiss ?? (() => {
|
|
180586
|
-
if (options.name && shouldCache)
|
|
180587
|
-
log2.prod(`${namePrefix}cache miss`);
|
|
180588
|
-
});
|
|
180589
|
-
const methodKey = (value2, method) => {
|
|
180590
|
-
const toKey = (input) => {
|
|
180459
|
+
const attempts = async (input, ctx, key, trace) => {
|
|
180460
|
+
for (let attempt = 1; ; attempt++) {
|
|
180591
180461
|
try {
|
|
180592
|
-
|
|
180593
|
-
|
|
180594
|
-
|
|
180595
|
-
|
|
180596
|
-
}
|
|
180597
|
-
|
|
180598
|
-
|
|
180599
|
-
|
|
180600
|
-
|
|
180601
|
-
|
|
180602
|
-
|
|
180603
|
-
|
|
180604
|
-
|
|
180605
|
-
|
|
180606
|
-
|
|
180607
|
-
|
|
180608
|
-
|
|
180609
|
-
|
|
180610
|
-
} catch (error49) {
|
|
180611
|
-
const errorMessage = error49 instanceof Error ? error49.message : String(error49);
|
|
180612
|
-
throw new Error(`failed to create cache key${namePrefix ? ` for ${options.name}` : ""}: ${errorMessage}`);
|
|
180613
|
-
}
|
|
180614
|
-
const trace = debugTrace(namePrefix, key);
|
|
180615
|
-
trace?.log("cache lookup started");
|
|
180616
|
-
const inFlight = inFlightPromises.get(key);
|
|
180617
|
-
if (inFlight) {
|
|
180618
|
-
trace?.log("cache hit (in-flight)");
|
|
180619
|
-
defaultCacheHit(key);
|
|
180620
|
-
return inFlight;
|
|
180621
|
-
}
|
|
180622
|
-
const fullKey = store ? prefix + key : "";
|
|
180623
|
-
let pendingRead;
|
|
180624
|
-
if (store) {
|
|
180625
|
-
let read2;
|
|
180626
|
-
try {
|
|
180627
|
-
read2 = store.get(fullKey);
|
|
180628
|
-
} catch (error49) {
|
|
180629
|
-
throw new AdapterError("get", fullKey, error49);
|
|
180630
|
-
}
|
|
180631
|
-
if (isThenable(read2)) {
|
|
180632
|
-
pendingRead = read2.then(void 0, (error49) => {
|
|
180633
|
-
throw new AdapterError("get", fullKey, error49);
|
|
180634
|
-
});
|
|
180635
|
-
} else {
|
|
180636
|
-
const entry = store === defaultStore ? read2 : freshEntry(read2);
|
|
180637
|
-
if (entry) {
|
|
180638
|
-
trace?.log("cache hit (from store)", { runtime: trace.since(trace.start) });
|
|
180639
|
-
defaultCacheHit(key);
|
|
180640
|
-
return entry.value;
|
|
180462
|
+
const returned = await run(input, ctx);
|
|
180463
|
+
const result = outputSchema ? await assertSchema(outputSchema, returned) : returned;
|
|
180464
|
+
trace?.(`run resolved on attempt ${attempt}`);
|
|
180465
|
+
return result;
|
|
180466
|
+
} catch (thrown) {
|
|
180467
|
+
let error49 = thrown;
|
|
180468
|
+
let wait = -1;
|
|
180469
|
+
if (delayFor && !(error49 instanceof ValidationError)) {
|
|
180470
|
+
try {
|
|
180471
|
+
wait = delayFor(error49, attempt);
|
|
180472
|
+
} catch (stop2) {
|
|
180473
|
+
error49 = stop2;
|
|
180474
|
+
}
|
|
180475
|
+
}
|
|
180476
|
+
if (wait >= 0) {
|
|
180477
|
+
report(attempt, `failed, retrying in ${wait}ms`, error49, key);
|
|
180478
|
+
await sleep2(wait);
|
|
180479
|
+
continue;
|
|
180641
180480
|
}
|
|
180481
|
+
if (attempt > 1)
|
|
180482
|
+
report(attempt, "failed, not retrying", error49, key);
|
|
180483
|
+
trace?.(`run failed on attempt ${attempt}`, { error: error49 });
|
|
180484
|
+
throw error49;
|
|
180642
180485
|
}
|
|
180643
180486
|
}
|
|
180644
|
-
|
|
180645
|
-
|
|
180487
|
+
};
|
|
180488
|
+
const hit = (key, trace, from, value2) => {
|
|
180489
|
+
trace?.(`cache hit (${from})`);
|
|
180490
|
+
cacheHit?.(key);
|
|
180491
|
+
return value2;
|
|
180492
|
+
};
|
|
180493
|
+
const inFlight = /* @__PURE__ */ new Map();
|
|
180494
|
+
const call = async (rawInput, ctx) => {
|
|
180495
|
+
const input = inputSchema ? await assertSchema(inputSchema, rawInput) : rawInput;
|
|
180496
|
+
if (!dedupe && !store)
|
|
180497
|
+
return attempts(input, ctx, void 0, debugTrace(label));
|
|
180498
|
+
const key = keyOf(input);
|
|
180499
|
+
const trace = debugTrace(label, key);
|
|
180500
|
+
const shared = inFlight.get(key);
|
|
180501
|
+
if (shared)
|
|
180502
|
+
return hit(key, trace, "in-flight", shared);
|
|
180503
|
+
const fullKey = prefix + key;
|
|
180504
|
+
const read2 = store && callAdapter("get", fullKey, () => store.get(fullKey));
|
|
180505
|
+
const entry = freshEntry(read2);
|
|
180506
|
+
if (entry)
|
|
180507
|
+
return hit(key, trace, "from store", entry.value);
|
|
180646
180508
|
const promise2 = (async () => {
|
|
180647
|
-
|
|
180648
|
-
|
|
180649
|
-
|
|
180650
|
-
|
|
180651
|
-
|
|
180652
|
-
|
|
180653
|
-
|
|
180654
|
-
|
|
180655
|
-
trace?.log("cache miss, executing function");
|
|
180656
|
-
defaultCacheMiss(key);
|
|
180657
|
-
let result;
|
|
180658
|
-
let lastError;
|
|
180659
|
-
let attempt = 0;
|
|
180660
|
-
for (; attempt <= retries.length; attempt++) {
|
|
180661
|
-
try {
|
|
180662
|
-
const returned = await fn2(input, ctx);
|
|
180663
|
-
result = schemas.output ? await assertSchema(schemas.output, returned) : returned;
|
|
180664
|
-
break;
|
|
180665
|
-
} catch (error49) {
|
|
180666
|
-
if (error49 instanceof ValidationError || options.rethrow?.(error49))
|
|
180667
|
-
throw error49;
|
|
180668
|
-
lastError = error49;
|
|
180669
|
-
const isLastAttempt = attempt >= retries.length;
|
|
180670
|
-
if (isLastAttempt) {
|
|
180671
|
-
if (namePrefix) {
|
|
180672
|
-
log2.info(`${namePrefix}attempt ${attempt + 1}/${retries.length + 1} failed, no more retries`);
|
|
180673
|
-
log2.info(`${namePrefix}`, { key, error: error49, attempt });
|
|
180674
|
-
} else {
|
|
180675
|
-
log2.info(`attempt ${attempt + 1}/${retries.length + 1} failed, no more retries`);
|
|
180676
|
-
log2.info({ key, error: error49, attempt });
|
|
180677
|
-
}
|
|
180678
|
-
} else {
|
|
180679
|
-
let delay2 = retries[attempt];
|
|
180680
|
-
if (options.retryAfter) {
|
|
180681
|
-
const extract = options.retryAfter === true ? retryAfterMs : options.retryAfter;
|
|
180682
|
-
const hint = extract(error49);
|
|
180683
|
-
if (hint !== void 0) {
|
|
180684
|
-
const cap = options.retryAfterCap ?? DEFAULT_RETRY_AFTER_CAP_MS;
|
|
180685
|
-
delay2 = Math.max(delay2, Math.min(cap, hint));
|
|
180686
|
-
}
|
|
180687
|
-
}
|
|
180688
|
-
delay2 = jitter(delay2);
|
|
180689
|
-
if (namePrefix) {
|
|
180690
|
-
log2.info(`${namePrefix}attempt ${attempt + 1}/${retries.length + 1} failed, retrying in ${delay2}ms`);
|
|
180691
|
-
log2.info(`${namePrefix}`, { key, error: error49, attempt });
|
|
180692
|
-
} else {
|
|
180693
|
-
log2.info(`attempt ${attempt + 1}/${retries.length + 1} failed, retrying in ${delay2}ms`);
|
|
180694
|
-
log2.info({ key, error: error49, attempt });
|
|
180695
|
-
}
|
|
180696
|
-
await sleep2(delay2);
|
|
180697
|
-
}
|
|
180698
|
-
}
|
|
180699
|
-
}
|
|
180700
|
-
if (attempt > retries.length) {
|
|
180701
|
-
trace?.log("function failed after all retries", {
|
|
180702
|
-
runtime: trace.since(execStart),
|
|
180703
|
-
attempts: retries.length + 1,
|
|
180704
|
-
error: lastError instanceof Error ? lastError.message : lastError
|
|
180705
|
-
});
|
|
180706
|
-
throw lastError;
|
|
180707
|
-
}
|
|
180708
|
-
const skip = options.skipCache ? options.skipCache(result) : false;
|
|
180709
|
-
const storable = store !== void 0 && result !== null && result !== void 0 && !(result instanceof Error) && !skip;
|
|
180710
|
-
let cached4 = false;
|
|
180711
|
-
if (storable) {
|
|
180509
|
+
const stored = isThenable(read2) ? freshEntry(await read2) : void 0;
|
|
180510
|
+
if (stored)
|
|
180511
|
+
return hit(key, trace, "from store", stored.value);
|
|
180512
|
+
trace?.("cache miss, running");
|
|
180513
|
+
cacheMiss?.(key);
|
|
180514
|
+
const result = await attempts(input, ctx, key, trace);
|
|
180515
|
+
const ms = store && !options.skipCache?.(result) && result != null && !(result instanceof Error) && lifetime(result);
|
|
180516
|
+
if (store && isLifetime(ms)) {
|
|
180712
180517
|
const created = Date.now();
|
|
180713
|
-
const entry = { value: result, created, expires: created + ttl, input };
|
|
180714
180518
|
try {
|
|
180715
|
-
|
|
180716
|
-
if (isThenable(written))
|
|
180717
|
-
await written;
|
|
180718
|
-
cached4 = true;
|
|
180519
|
+
await store.set(fullKey, { value: result, created, expires: created + ms, input }, ms);
|
|
180719
180520
|
} catch (error49) {
|
|
180720
|
-
|
|
180521
|
+
console.error(`${label}cache write failed, returning the result uncached`, new AdapterError("set", fullKey, error49));
|
|
180721
180522
|
}
|
|
180722
180523
|
}
|
|
180723
|
-
trace?.log("function executed successfully", { runtime: trace.since(execStart), attempt: attempt + 1, cached: cached4 });
|
|
180724
180524
|
return result;
|
|
180725
180525
|
})();
|
|
180726
|
-
|
|
180727
|
-
|
|
180728
|
-
|
|
180729
|
-
|
|
180730
|
-
|
|
180526
|
+
if (!dedupe)
|
|
180527
|
+
return promise2;
|
|
180528
|
+
inFlight.set(key, promise2);
|
|
180529
|
+
return promise2.finally(() => inFlight.delete(key));
|
|
180530
|
+
};
|
|
180531
|
+
if (!cacheMethods)
|
|
180532
|
+
return call;
|
|
180533
|
+
const withKey = (input, use) => {
|
|
180534
|
+
const toKey = (result2) => use(prefix + keyOf(result2 && !result2.issues ? result2.value : input));
|
|
180535
|
+
const result = inputSchema?.["~standard"].validate(input);
|
|
180536
|
+
return result instanceof Promise ? result.then(toKey) : toKey(result);
|
|
180537
|
+
};
|
|
180538
|
+
return Object.assign(call, {
|
|
180539
|
+
clear: async (input) => {
|
|
180540
|
+
if (!store)
|
|
180541
|
+
return;
|
|
180542
|
+
if (input === void 0)
|
|
180543
|
+
await sweep(store, prefix, () => true);
|
|
180544
|
+
else
|
|
180545
|
+
await withKey(input, (key) => callAdapter("delete", key, () => store.delete([key])));
|
|
180546
|
+
},
|
|
180547
|
+
// the memory store peeks, so asking whether a key is cached does not change which key is evicted next
|
|
180548
|
+
has: async (input) => !!store && !!freshEntry(await withKey(input, (key) => callAdapter("get", key, () => "peek" in store ? store.peek(key) : store.get(key)))),
|
|
180549
|
+
// not `async`: on the memory store a predicate that throws throws here, not in a promise nobody awaits
|
|
180550
|
+
invalidate: (match3) => {
|
|
180551
|
+
const accepts = typeof match3 === "function" ? match3 : fieldsMatch(match3);
|
|
180552
|
+
return Promise.resolve(store ? sweep(store, prefix, accepts) : 0);
|
|
180731
180553
|
}
|
|
180732
|
-
};
|
|
180733
|
-
|
|
180734
|
-
|
|
180735
|
-
|
|
180736
|
-
|
|
180737
|
-
|
|
180738
|
-
|
|
180554
|
+
});
|
|
180555
|
+
}
|
|
180556
|
+
function query(options) {
|
|
180557
|
+
return op({ ...options, dedupe: true });
|
|
180558
|
+
}
|
|
180559
|
+
function mutation({ dedupe: _dedupe, ttl: _ttl, cache: _cache, ...options }) {
|
|
180560
|
+
return build3(options, false);
|
|
180561
|
+
}
|
|
180562
|
+
function debugTrace(label, key) {
|
|
180563
|
+
if (process.env.LOG_LEVEL !== "debug")
|
|
180564
|
+
return;
|
|
180565
|
+
const prefix = `${label}[${(/* @__PURE__ */ new Date()).toISOString()}]`;
|
|
180566
|
+
const start = performance.now();
|
|
180567
|
+
return (message, data) => console.log(`${prefix} ${message} +${Math.round(performance.now() - start)}ms`, { ...key && { key }, ...data });
|
|
180568
|
+
}
|
|
180569
|
+
var isLifetime = (ms) => typeof ms === "number" && ms > 0 && Number.isFinite(ms);
|
|
180570
|
+
function fieldsMatch(partial3) {
|
|
180571
|
+
const fields = Object.entries(partial3).map(([field, value2]) => [
|
|
180572
|
+
field,
|
|
180573
|
+
value2 === void 0 ? void 0 : canonical(value2)
|
|
180574
|
+
]);
|
|
180575
|
+
return (input) => typeof input === "object" && input !== null && fields.every(([field, value2]) => {
|
|
180576
|
+
const actual = input[field];
|
|
180577
|
+
return actual === void 0 ? value2 === void 0 : value2 !== void 0 && canonical(actual) === value2;
|
|
180578
|
+
});
|
|
180579
|
+
}
|
|
180580
|
+
var isThenable = (value2) => typeof value2?.then === "function";
|
|
180581
|
+
function freshEntry(value2) {
|
|
180582
|
+
return typeof value2?.expires === "number" && value2.expires > Date.now() && "value" in value2 ? value2 : void 0;
|
|
180583
|
+
}
|
|
180584
|
+
function callAdapter(method, key, run) {
|
|
180585
|
+
try {
|
|
180586
|
+
const result = run();
|
|
180587
|
+
if (!isThenable(result))
|
|
180588
|
+
return result;
|
|
180589
|
+
return result.then(void 0, (error49) => {
|
|
180590
|
+
throw new AdapterError(method, key, error49);
|
|
180591
|
+
});
|
|
180592
|
+
} catch (error49) {
|
|
180593
|
+
throw new AdapterError(method, key, error49);
|
|
180594
|
+
}
|
|
180595
|
+
}
|
|
180596
|
+
function sweep(store, prefix, match3) {
|
|
180597
|
+
const purge = (listed2) => {
|
|
180598
|
+
const now = Date.now();
|
|
180599
|
+
const keys = [];
|
|
180600
|
+
let count = 0;
|
|
180601
|
+
for (const [key, { input, expires }] of listed2) {
|
|
180602
|
+
if (!(expires > now))
|
|
180603
|
+
keys.push(key);
|
|
180604
|
+
else if (match3(input)) {
|
|
180605
|
+
keys.push(key);
|
|
180606
|
+
count++;
|
|
180607
|
+
}
|
|
180739
180608
|
}
|
|
180740
|
-
|
|
180741
|
-
|
|
180742
|
-
|
|
180743
|
-
|
|
180744
|
-
|
|
180745
|
-
|
|
180746
|
-
|
|
180747
|
-
if (!store)
|
|
180748
|
-
return false;
|
|
180749
|
-
let fullKey = methodKey(key, "has");
|
|
180750
|
-
if (typeof fullKey !== "string")
|
|
180751
|
-
fullKey = await fullKey;
|
|
180752
|
-
const target = fullKey;
|
|
180753
|
-
const memoryStore = store;
|
|
180754
|
-
const read2 = callAdapter("get", target, () => memoryStore.peek ? memoryStore.peek(target) : store.get(target));
|
|
180755
|
-
return freshEntry(await read2) !== void 0;
|
|
180756
|
-
};
|
|
180757
|
-
cachedFn.invalidate = (predicate) => {
|
|
180758
|
-
if (!store)
|
|
180759
|
-
return Promise.resolve(0);
|
|
180760
|
-
const count = sweep(store, prefix, predicate);
|
|
180761
|
-
return typeof count === "number" ? Promise.resolve(count) : count;
|
|
180609
|
+
const remove = (from) => {
|
|
180610
|
+
if (from >= keys.length)
|
|
180611
|
+
return count;
|
|
180612
|
+
const deleted = callAdapter("delete", prefix, () => store.delete(keys.slice(from, from + 1e3)));
|
|
180613
|
+
return isThenable(deleted) ? Promise.resolve(deleted).then(() => remove(from + 1e3)) : remove(from + 1e3);
|
|
180614
|
+
};
|
|
180615
|
+
return remove(0);
|
|
180762
180616
|
};
|
|
180763
|
-
|
|
180617
|
+
const listed = callAdapter("list", prefix, () => {
|
|
180618
|
+
const listed2 = store.list(prefix);
|
|
180619
|
+
if (Array.isArray(listed2))
|
|
180620
|
+
return listed2;
|
|
180621
|
+
return (async () => {
|
|
180622
|
+
const items = [];
|
|
180623
|
+
for await (const item of await listed2)
|
|
180624
|
+
items.push(item);
|
|
180625
|
+
return items;
|
|
180626
|
+
})();
|
|
180627
|
+
});
|
|
180628
|
+
return Array.isArray(listed) ? purge(listed) : listed.then(purge);
|
|
180764
180629
|
}
|
|
180765
180630
|
|
|
180766
180631
|
// utils/progressComment.ts
|
|
@@ -182546,7 +182411,7 @@ function ShellTool(ctx) {
|
|
|
182546
182411
|
return tool({
|
|
182547
182412
|
name: "shell",
|
|
182548
182413
|
timeoutMs: 12e4,
|
|
182549
|
-
description: `Execute shell commands securely. Environment is filtered to remove API keys and secrets.
|
|
182414
|
+
description: `Execute shell commands securely.${ctx.payload.shell === "restricted" ? " Environment is filtered to remove API keys and secrets." : ""}
|
|
182550
182415
|
|
|
182551
182416
|
Example: \`shell({ command: "pnpm test", description: "run the test suite" })\`.
|
|
182552
182417
|
|
|
@@ -184391,7 +184256,7 @@ async function fetchWrapper(requestOptions) {
|
|
|
184391
184256
|
"fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing"
|
|
184392
184257
|
);
|
|
184393
184258
|
}
|
|
184394
|
-
const
|
|
184259
|
+
const log2 = requestOptions.request?.log || console;
|
|
184395
184260
|
const parseSuccessResponseBody = requestOptions.request?.parseSuccessResponseBody !== false;
|
|
184396
184261
|
const body = isPlainObject8(requestOptions.body) || Array.isArray(requestOptions.body) ? JSONStringify(requestOptions.body) : requestOptions.body;
|
|
184397
184262
|
const requestHeaders = Object.fromEntries(
|
|
@@ -184449,7 +184314,7 @@ async function fetchWrapper(requestOptions) {
|
|
|
184449
184314
|
if ("deprecation" in responseHeaders) {
|
|
184450
184315
|
const matches = responseHeaders.link && responseHeaders.link.match(/<([^<>]+)>; rel="deprecation"/);
|
|
184451
184316
|
const deprecationLink = matches && matches.pop();
|
|
184452
|
-
|
|
184317
|
+
log2.warn(
|
|
184453
184318
|
`[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}`
|
|
184454
184319
|
);
|
|
184455
184320
|
}
|
|
@@ -184587,9 +184452,9 @@ var NON_VARIABLE_OPTIONS = [
|
|
|
184587
184452
|
];
|
|
184588
184453
|
var FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"];
|
|
184589
184454
|
var GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/;
|
|
184590
|
-
function graphql(request2,
|
|
184455
|
+
function graphql(request2, query2, options) {
|
|
184591
184456
|
if (options) {
|
|
184592
|
-
if (typeof
|
|
184457
|
+
if (typeof query2 === "string" && "query" in options) {
|
|
184593
184458
|
return Promise.reject(
|
|
184594
184459
|
new Error(`[@octokit/graphql] "query" cannot be used as variable name`)
|
|
184595
184460
|
);
|
|
@@ -184603,7 +184468,7 @@ function graphql(request2, query, options) {
|
|
|
184603
184468
|
);
|
|
184604
184469
|
}
|
|
184605
184470
|
}
|
|
184606
|
-
const parsedOptions = typeof
|
|
184471
|
+
const parsedOptions = typeof query2 === "string" ? Object.assign({ query: query2 }, options) : query2;
|
|
184607
184472
|
const requestOptions = Object.keys(
|
|
184608
184473
|
parsedOptions
|
|
184609
184474
|
).reduce((result, key) => {
|
|
@@ -184638,8 +184503,8 @@ function graphql(request2, query, options) {
|
|
|
184638
184503
|
}
|
|
184639
184504
|
function withDefaults3(request2, newDefaults) {
|
|
184640
184505
|
const newRequest2 = request2.defaults(newDefaults);
|
|
184641
|
-
const newApi = (
|
|
184642
|
-
return graphql(newRequest2,
|
|
184506
|
+
const newApi = (query2, options) => {
|
|
184507
|
+
return graphql(newRequest2, query2, options);
|
|
184643
184508
|
};
|
|
184644
184509
|
return Object.assign(newApi, {
|
|
184645
184510
|
defaults: withDefaults3.bind(null, newRequest2),
|
|
@@ -187483,16 +187348,17 @@ function translateIdTokenError(error49) {
|
|
|
187483
187348
|
if (!status) return error49;
|
|
187484
187349
|
return new TokenExchangeError(Number(status), error49.message);
|
|
187485
187350
|
}
|
|
187486
|
-
var mintIdToken =
|
|
187487
|
-
async () => {
|
|
187351
|
+
var mintIdToken = query({
|
|
187352
|
+
run: async () => {
|
|
187488
187353
|
try {
|
|
187489
187354
|
return await core4.getIDToken(OIDC_AUDIENCE);
|
|
187490
187355
|
} catch (error49) {
|
|
187491
187356
|
throw translateIdTokenError(error49);
|
|
187492
187357
|
}
|
|
187493
187358
|
},
|
|
187494
|
-
|
|
187495
|
-
|
|
187359
|
+
ttl: 6e4,
|
|
187360
|
+
name: "OIDC ID token"
|
|
187361
|
+
});
|
|
187496
187362
|
async function acquireTokenViaOIDC(opts) {
|
|
187497
187363
|
const oidcToken = opts?.oidc ? await fetchIdTokenFromStash(opts.oidc) : await mintIdToken();
|
|
187498
187364
|
const repos = [...opts?.repos ?? []];
|
|
@@ -187650,10 +187516,10 @@ function isTransientTokenError(error49) {
|
|
|
187650
187516
|
}
|
|
187651
187517
|
async function acquireNewToken(opts) {
|
|
187652
187518
|
if (opts?.oidc || isOIDCAvailable()) {
|
|
187653
|
-
return await
|
|
187519
|
+
return await mutation({
|
|
187520
|
+
run: () => acquireTokenViaOIDC(opts),
|
|
187654
187521
|
name: "token exchange",
|
|
187655
|
-
|
|
187656
|
-
rethrow: (error49) => !isTransientTokenError(error49)
|
|
187522
|
+
retry: (error49, attempt) => isTransientTokenError(error49) ? delay2([1e3, 2e3], attempt) : -1
|
|
187657
187523
|
})();
|
|
187658
187524
|
}
|
|
187659
187525
|
if (process.env.GITHUB_ACTIONS === "true") {
|
|
@@ -187987,19 +187853,19 @@ async function pushWithRetry(args2, token, refreshGitToken, cwd = process.cwd())
|
|
|
187987
187853
|
if ((kind === "transient" || kind === "transient-auth") && attempt < TRANSIENT_RETRY_DELAYS_MS.length) {
|
|
187988
187854
|
if (kind === "transient-auth" && refreshGitToken) {
|
|
187989
187855
|
currentToken = await refreshGitToken(currentToken);
|
|
187990
|
-
const
|
|
187856
|
+
const delay4 = Math.round(1e3 * (0.75 + Math.random() * 0.5));
|
|
187991
187857
|
log.info(
|
|
187992
|
-
`push attempt ${attempt + 1} failed (auth), re-minted token, retrying in ${
|
|
187858
|
+
`push attempt ${attempt + 1} failed (auth), re-minted token, retrying in ${delay4}ms: ${msg.slice(0, 300)}`
|
|
187993
187859
|
);
|
|
187994
|
-
await new Promise((r) => setTimeout(r,
|
|
187860
|
+
await new Promise((r) => setTimeout(r, delay4));
|
|
187995
187861
|
continue;
|
|
187996
187862
|
}
|
|
187997
187863
|
const baseDelay = TRANSIENT_RETRY_DELAYS_MS[attempt] ?? 5e3;
|
|
187998
|
-
const
|
|
187864
|
+
const delay3 = Math.round(baseDelay * (0.75 + Math.random() * 0.5));
|
|
187999
187865
|
log.info(
|
|
188000
|
-
`push attempt ${attempt + 1} failed (transient), retrying in ${
|
|
187866
|
+
`push attempt ${attempt + 1} failed (transient), retrying in ${delay3}ms: ${msg.slice(0, 300)}`
|
|
188001
187867
|
);
|
|
188002
|
-
await new Promise((r) => setTimeout(r,
|
|
187868
|
+
await new Promise((r) => setTimeout(r, delay3));
|
|
188003
187869
|
continue;
|
|
188004
187870
|
}
|
|
188005
187871
|
throw err;
|
|
@@ -188724,6 +188590,112 @@ function isTransientOctokitError(error49) {
|
|
|
188724
188590
|
return isTransientNetworkError(error49);
|
|
188725
188591
|
}
|
|
188726
188592
|
|
|
188593
|
+
// utils/runContext.ts
|
|
188594
|
+
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
188595
|
+
var START_KEY = randomUUID5();
|
|
188596
|
+
var defaultSettings = {
|
|
188597
|
+
model: null,
|
|
188598
|
+
effort: null,
|
|
188599
|
+
modes: [],
|
|
188600
|
+
setupScript: null,
|
|
188601
|
+
postCheckoutScript: null,
|
|
188602
|
+
prepushScript: null,
|
|
188603
|
+
stopScript: null,
|
|
188604
|
+
push: "restricted",
|
|
188605
|
+
shell: "restricted",
|
|
188606
|
+
prApproveEnabled: false,
|
|
188607
|
+
reviewDrafts: false,
|
|
188608
|
+
autoMergeEnabled: false,
|
|
188609
|
+
codexAgent: false,
|
|
188610
|
+
signedCommits: false,
|
|
188611
|
+
repoIntelligence: false,
|
|
188612
|
+
progressComments: true,
|
|
188613
|
+
statusChecks: true,
|
|
188614
|
+
approvalCheck: false,
|
|
188615
|
+
modeInstructions: {},
|
|
188616
|
+
learnings: null,
|
|
188617
|
+
learningsHeadings: [],
|
|
188618
|
+
envAllowlist: null,
|
|
188619
|
+
xrepoBrief: null,
|
|
188620
|
+
xrepoLearnings: null,
|
|
188621
|
+
xrepoLearningsHeadings: []
|
|
188622
|
+
};
|
|
188623
|
+
var defaultRunContext = {
|
|
188624
|
+
settings: defaultSettings,
|
|
188625
|
+
apiToken: "",
|
|
188626
|
+
oss: false,
|
|
188627
|
+
plan: "none"
|
|
188628
|
+
};
|
|
188629
|
+
var unknownSecretsRunContext = {
|
|
188630
|
+
...defaultRunContext,
|
|
188631
|
+
secretsUnavailable: true
|
|
188632
|
+
};
|
|
188633
|
+
async function fetchRunContext(params) {
|
|
188634
|
+
const timeoutMs = 3e4;
|
|
188635
|
+
const controller = new AbortController();
|
|
188636
|
+
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
188637
|
+
try {
|
|
188638
|
+
const headers = {
|
|
188639
|
+
Authorization: `Bearer ${params.token}`,
|
|
188640
|
+
"X-Pullfrog-Credential-Pools": "1"
|
|
188641
|
+
};
|
|
188642
|
+
if (params.oidcToken) {
|
|
188643
|
+
headers["X-GitHub-OIDC-Token"] = params.oidcToken;
|
|
188644
|
+
}
|
|
188645
|
+
const query2 = new URLSearchParams({ start: START_KEY });
|
|
188646
|
+
if (params.runType) query2.set("type", params.runType);
|
|
188647
|
+
if (params.plainPrompt) query2.set("prompt", "plain");
|
|
188648
|
+
if (params.routedTier) query2.set("tier", params.routedTier);
|
|
188649
|
+
const search2 = query2.toString();
|
|
188650
|
+
const response = await apiFetch({
|
|
188651
|
+
path: `/api/repo/${params.repoContext.owner}/${params.repoContext.name}/run-context${search2 ? `?${search2}` : ""}`,
|
|
188652
|
+
headers,
|
|
188653
|
+
signal: controller.signal
|
|
188654
|
+
});
|
|
188655
|
+
clearTimeout(timeoutId);
|
|
188656
|
+
if (response.status === 402) {
|
|
188657
|
+
const body = await response.json().catch(() => null);
|
|
188658
|
+
const reason = typeof body === "object" && body !== null && "reason" in body ? body.reason : null;
|
|
188659
|
+
const commercialRefused = reason === "subscription_unpaid" || reason === "subscription_ended" ? reason : "commercial";
|
|
188660
|
+
return { ...defaultRunContext, commercialRefused };
|
|
188661
|
+
}
|
|
188662
|
+
if (!response.ok) {
|
|
188663
|
+
return response.status >= 500 ? unknownSecretsRunContext : defaultRunContext;
|
|
188664
|
+
}
|
|
188665
|
+
const data = await response.json();
|
|
188666
|
+
if (data === null) {
|
|
188667
|
+
return defaultRunContext;
|
|
188668
|
+
}
|
|
188669
|
+
return {
|
|
188670
|
+
settings: {
|
|
188671
|
+
...defaultSettings,
|
|
188672
|
+
...data.settings,
|
|
188673
|
+
modes: data.settings?.modes ?? [],
|
|
188674
|
+
setupScript: data.settings?.setupScript ?? null,
|
|
188675
|
+
postCheckoutScript: data.settings?.postCheckoutScript ?? null,
|
|
188676
|
+
prepushScript: data.settings?.prepushScript ?? null,
|
|
188677
|
+
stopScript: data.settings?.stopScript ?? null,
|
|
188678
|
+
learningsHeadings: data.settings?.learningsHeadings ?? [],
|
|
188679
|
+
xrepoBrief: data.settings?.xrepoBrief ?? null,
|
|
188680
|
+
xrepoLearnings: data.settings?.xrepoLearnings ?? null,
|
|
188681
|
+
xrepoLearningsHeadings: data.settings?.xrepoLearningsHeadings ?? []
|
|
188682
|
+
},
|
|
188683
|
+
apiToken: data.apiToken,
|
|
188684
|
+
oss: data.oss ?? false,
|
|
188685
|
+
plan: data.plan ?? "none",
|
|
188686
|
+
proxyModel: data.proxyModel,
|
|
188687
|
+
dbSecrets: data.dbSecrets,
|
|
188688
|
+
credentialAccess: data.credentialAccess,
|
|
188689
|
+
secretsUnavailable: data.secretsUnavailable,
|
|
188690
|
+
routerUnfunded: data.routerUnfunded,
|
|
188691
|
+
trialFallback: data.trialFallback
|
|
188692
|
+
};
|
|
188693
|
+
} catch {
|
|
188694
|
+
clearTimeout(timeoutId);
|
|
188695
|
+
return unknownSecretsRunContext;
|
|
188696
|
+
}
|
|
188697
|
+
}
|
|
188698
|
+
|
|
188727
188699
|
// utils/patchWorkflowRunFields.ts
|
|
188728
188700
|
var STRING_KEYS = [
|
|
188729
188701
|
"prNodeId",
|
|
@@ -188742,6 +188714,7 @@ var NUMBER_KEYS = [
|
|
|
188742
188714
|
"cacheWriteTokens",
|
|
188743
188715
|
"costUsd"
|
|
188744
188716
|
];
|
|
188717
|
+
var FLAG_KEYS = ["reviewSkipped"];
|
|
188745
188718
|
async function patchWorkflowRunFields(ctx, fields) {
|
|
188746
188719
|
if (ctx.runId === void 0 || !ctx.apiToken) return;
|
|
188747
188720
|
if (ctx.toolState.workflowRunUnclaimed) return;
|
|
@@ -188758,10 +188731,17 @@ async function patchWorkflowRunFields(ctx, fields) {
|
|
|
188758
188731
|
body[key] = value2;
|
|
188759
188732
|
}
|
|
188760
188733
|
}
|
|
188734
|
+
for (const key of FLAG_KEYS) {
|
|
188735
|
+
if (fields[key]) body[key] = true;
|
|
188736
|
+
}
|
|
188737
|
+
if (fields.succeeded !== void 0) body.succeeded = fields.succeeded;
|
|
188761
188738
|
if (Object.keys(body).length === 0) return;
|
|
188739
|
+
body.startKey = START_KEY;
|
|
188740
|
+
const runAttempt = Number(process.env.GITHUB_RUN_ATTEMPT);
|
|
188741
|
+
if (Number.isInteger(runAttempt) && runAttempt >= 1) body.runAttempt = runAttempt;
|
|
188762
188742
|
try {
|
|
188763
|
-
await
|
|
188764
|
-
async () => {
|
|
188743
|
+
await mutation({
|
|
188744
|
+
run: async () => {
|
|
188765
188745
|
const response = await apiFetch({
|
|
188766
188746
|
path: `/api/workflow-run/${ctx.runId}`,
|
|
188767
188747
|
method: "PATCH",
|
|
@@ -188772,17 +188752,18 @@ async function patchWorkflowRunFields(ctx, fields) {
|
|
|
188772
188752
|
body: JSON.stringify(body),
|
|
188773
188753
|
signal: AbortSignal.timeout(1e4)
|
|
188774
188754
|
});
|
|
188775
|
-
if (response.status === 404)
|
|
188755
|
+
if (response.status === 404) {
|
|
188756
|
+
ctx.toolState.workflowRunUnclaimed = true;
|
|
188757
|
+
log.info(`\xBB Pullfrog has no record of run ${ctx.runId}; skipping run metadata updates`);
|
|
188758
|
+
return;
|
|
188759
|
+
}
|
|
188776
188760
|
if (!response.ok) throw new Error(`PATCH workflow-run: ${response.status}`);
|
|
188777
188761
|
},
|
|
188778
|
-
|
|
188779
|
-
|
|
188780
|
-
|
|
188781
|
-
|
|
188782
|
-
|
|
188783
|
-
rethrow: (error49) => !isTransientNetworkError(error49)
|
|
188784
|
-
}
|
|
188785
|
-
)();
|
|
188762
|
+
// only retry transient network errors; explicit HTTP failures throw
|
|
188763
|
+
// a status-bearing message and should fail fast.
|
|
188764
|
+
retry: (error49, attempt) => isTransientNetworkError(error49) ? delay2([2e3, 4e3], attempt) : -1,
|
|
188765
|
+
name: "patchWorkflowRunFields"
|
|
188766
|
+
})();
|
|
188786
188767
|
} catch (error49) {
|
|
188787
188768
|
log.warning(`patchWorkflowRunFields failed: ${error49}`);
|
|
188788
188769
|
}
|
|
@@ -188955,6 +188936,9 @@ var ReportProgress = type({
|
|
|
188955
188936
|
body: type.string.describe("the progress update content to share"),
|
|
188956
188937
|
"target_plan_comment?": type("boolean").describe(
|
|
188957
188938
|
"for revising an existing plan comment ONLY. set to true only when the PlanEdit checklist from select_mode tells you to (i.e. a prior plan comment was found for this issue). NEVER set on the initial plan post \u2014 the initial plan reuses the run's progress comment and is posted by calling report_progress without this flag."
|
|
188939
|
+
),
|
|
188940
|
+
"no_review_needed?": type("boolean").describe(
|
|
188941
|
+
"IncrementalReview only: true when you judged the new commits need no review, never for a blocker."
|
|
188958
188942
|
)
|
|
188959
188943
|
});
|
|
188960
188944
|
async function reportProgress(ctx, params) {
|
|
@@ -189082,6 +189066,9 @@ function ReportProgressTool(ctx) {
|
|
|
189082
189066
|
description: 'Share progress on the associated GitHub issue/PR. The first call creates a comment; subsequent calls update it in place. Example: `report_progress({ body: "Implemented the auth check and added tests." })`. Call this at the end of every run with a brief final summary (1-3 sentences) unless the mode guidance instructs otherwise. The current task list is automatically appended in a collapsible section \u2014 do not restate individual steps.',
|
|
189083
189067
|
parameters: ReportProgress,
|
|
189084
189068
|
execute: execute(async (params) => {
|
|
189069
|
+
if (params.no_review_needed) {
|
|
189070
|
+
ctx.toolState.noReviewNeededSha = primaryRepoState(ctx.toolState).checkoutSha;
|
|
189071
|
+
}
|
|
189085
189072
|
if (ctx.toolState.standaloneCommentId !== void 0 && !params.target_plan_comment) {
|
|
189086
189073
|
ctx.toolState.lastProgressBody = params.body;
|
|
189087
189074
|
return {
|
|
@@ -189613,18 +189600,15 @@ function CreatePullRequestReviewTool(ctx) {
|
|
|
189613
189600
|
}
|
|
189614
189601
|
let result;
|
|
189615
189602
|
try {
|
|
189616
|
-
result = await
|
|
189617
|
-
() => body ? createAndSubmitWithFooter(ctx, params, {
|
|
189603
|
+
result = await mutation({
|
|
189604
|
+
run: () => body ? createAndSubmitWithFooter(ctx, params, {
|
|
189618
189605
|
body,
|
|
189619
189606
|
approved: approved ?? false,
|
|
189620
189607
|
hasComments: (params.comments?.length ?? 0) > 0
|
|
189621
189608
|
}) : createReviewWithStrandedRecovery(ctx, params),
|
|
189622
|
-
|
|
189623
|
-
|
|
189624
|
-
|
|
189625
|
-
name: "review submission"
|
|
189626
|
-
}
|
|
189627
|
-
)();
|
|
189609
|
+
retry: (error49, attempt) => isTransientReviewError(error49) ? delay2(TRANSIENT_REVIEW_RETRY_DELAYS_MS, attempt) : -1,
|
|
189610
|
+
name: "review submission"
|
|
189611
|
+
})();
|
|
189628
189612
|
} catch (err) {
|
|
189629
189613
|
if (ctx.toolState.approval) ctx.toolState.approval.wouldApprove = false;
|
|
189630
189614
|
if (isTransientReviewError(err)) {
|
|
@@ -190297,8 +190281,8 @@ async function checkoutPrBranch(pr, params) {
|
|
|
190297
190281
|
if (!alreadyOnBranch) {
|
|
190298
190282
|
$("git", ["checkout", "-B", pr.baseRef, `origin/${pr.baseRef}`], { log: false });
|
|
190299
190283
|
log.debug(`\xBB fetching PR #${pr.number} (${localBranch})...`);
|
|
190300
|
-
await
|
|
190301
|
-
async () => {
|
|
190284
|
+
await mutation({
|
|
190285
|
+
run: async () => {
|
|
190302
190286
|
try {
|
|
190303
190287
|
await $gitFetchWithDeepen(
|
|
190304
190288
|
["--no-tags", "origin", `+pull/${pr.number}/head:${localBranch}`],
|
|
@@ -190313,12 +190297,9 @@ async function checkoutPrBranch(pr, params) {
|
|
|
190313
190297
|
throw e;
|
|
190314
190298
|
}
|
|
190315
190299
|
},
|
|
190316
|
-
|
|
190317
|
-
|
|
190318
|
-
|
|
190319
|
-
rethrow: (e) => !PULL_REF_MISSING_PATTERN.test(e instanceof Error ? e.message : String(e))
|
|
190320
|
-
}
|
|
190321
|
-
)();
|
|
190300
|
+
retry: (error49, attempt) => PULL_REF_MISSING_PATTERN.test(error49 instanceof Error ? error49.message : String(error49)) ? delay2(PULL_REF_RETRY_DELAYS_MS, attempt) : -1,
|
|
190301
|
+
name: `pull/${pr.number}/head fetch`
|
|
190302
|
+
})();
|
|
190322
190303
|
$("git", ["checkout", localBranch], { log: false });
|
|
190323
190304
|
log.debug(`\xBB checked out PR #${pr.number}`);
|
|
190324
190305
|
repoState.checkoutSha = $("git", ["rev-parse", "HEAD"], { log: false }).trim();
|
|
@@ -192664,8 +192645,8 @@ function buildThreadBlocks(threads, filePatchMap, reviewId) {
|
|
|
192664
192645
|
}
|
|
192665
192646
|
return threadBlocks;
|
|
192666
192647
|
}
|
|
192667
|
-
var fetchAllReviewThreads =
|
|
192668
|
-
async (key, ctx) => {
|
|
192648
|
+
var fetchAllReviewThreads = query({
|
|
192649
|
+
run: async (key, ctx) => {
|
|
192669
192650
|
const threads = [];
|
|
192670
192651
|
let cursor = null;
|
|
192671
192652
|
for (let page = 0; page < 50; page += 1) {
|
|
@@ -192682,21 +192663,21 @@ var fetchAllReviewThreads = op(
|
|
|
192682
192663
|
}
|
|
192683
192664
|
return threads;
|
|
192684
192665
|
},
|
|
192685
|
-
|
|
192686
|
-
|
|
192687
|
-
|
|
192688
|
-
|
|
192666
|
+
ttl: 6e4,
|
|
192667
|
+
name: "reviewThreads"
|
|
192668
|
+
});
|
|
192669
|
+
var fetchPrFiles = query({
|
|
192670
|
+
run: async (key, ctx) => ctx.octokit.paginate(ctx.octokit.rest.pulls.listFiles, {
|
|
192689
192671
|
owner: key.owner,
|
|
192690
192672
|
repo: key.name,
|
|
192691
192673
|
pull_number: key.pullNumber,
|
|
192692
192674
|
per_page: 100
|
|
192693
192675
|
}),
|
|
192694
|
-
|
|
192695
|
-
|
|
192676
|
+
ttl: 6e4,
|
|
192677
|
+
name: "prFiles"
|
|
192678
|
+
});
|
|
192696
192679
|
function invalidateReviewThreadCache(repo) {
|
|
192697
|
-
fetchAllReviewThreads.invalidate(
|
|
192698
|
-
(cached4) => cached4.owner === repo.owner && cached4.name === repo.name
|
|
192699
|
-
);
|
|
192680
|
+
fetchAllReviewThreads.invalidate({ owner: repo.owner, name: repo.name });
|
|
192700
192681
|
}
|
|
192701
192682
|
async function getReviewThreads(input) {
|
|
192702
192683
|
const allThreads = structuredClone(
|
|
@@ -193423,7 +193404,7 @@ function buildCommonTools(ctx, outputSchema) {
|
|
|
193423
193404
|
if (isStandalone || outputSchema) {
|
|
193424
193405
|
tools.push(SetOutputTool(ctx, outputSchema));
|
|
193425
193406
|
}
|
|
193426
|
-
if (ctx.payload.shell
|
|
193407
|
+
if (ctx.payload.shell !== "disabled") {
|
|
193427
193408
|
tools.push(ShellTool(ctx));
|
|
193428
193409
|
tools.push(KillBackgroundTool(ctx));
|
|
193429
193410
|
}
|
|
@@ -194255,11 +194236,11 @@ function formatBillingErrorSummary(error49, owner) {
|
|
|
194255
194236
|
}
|
|
194256
194237
|
if (error49.code === "router_monthly_limit") {
|
|
194257
194238
|
return [
|
|
194258
|
-
"**Pullfrog Router
|
|
194239
|
+
"**Pullfrog Router is out of credit, and the monthly spend limit blocks the next auto-reload.**",
|
|
194259
194240
|
"",
|
|
194260
|
-
"
|
|
194241
|
+
"Top up by hand, ask your admin to raise the cap, or wait for it to reset at 00:00 UTC on the 1st.",
|
|
194261
194242
|
"",
|
|
194262
|
-
`[Adjust limit \u2192](${billingConsoleUrl(owner)})`
|
|
194243
|
+
`[Top up balance \u2192](${billingConsoleUrl(owner)}) \xB7 [Adjust limit \u2192](${billingConsoleUrl(owner)})`
|
|
194263
194244
|
].join("\n");
|
|
194264
194245
|
}
|
|
194265
194246
|
if (error49.code === "commercial_plan_required") {
|
|
@@ -194546,7 +194527,13 @@ var codexUsageSchema = external_exports.object({
|
|
|
194546
194527
|
limit_reached: external_exports.boolean(),
|
|
194547
194528
|
primary_window: codexWindowSchema,
|
|
194548
194529
|
secondary_window: codexWindowSchema
|
|
194549
|
-
}).optional()
|
|
194530
|
+
}).optional(),
|
|
194531
|
+
credits: external_exports.object({
|
|
194532
|
+
has_credits: external_exports.boolean().optional(),
|
|
194533
|
+
unlimited: external_exports.boolean().optional(),
|
|
194534
|
+
overage_limit_reached: external_exports.boolean().optional()
|
|
194535
|
+
}).nullish(),
|
|
194536
|
+
spend_control: external_exports.object({ reached: external_exports.boolean().optional() }).nullish()
|
|
194550
194537
|
});
|
|
194551
194538
|
var unknown4 = { status: "unknown" };
|
|
194552
194539
|
async function readSubscriptionEndpoint(input) {
|
|
@@ -194589,9 +194576,12 @@ async function probeSubscription(input) {
|
|
|
194589
194576
|
const body = await response.json().catch(() => null);
|
|
194590
194577
|
if (!codex2) return unknown4;
|
|
194591
194578
|
const parsed2 = codexUsageSchema.safeParse(body);
|
|
194592
|
-
|
|
194593
|
-
|
|
194579
|
+
if (!parsed2.success || !parsed2.data.rate_limit) return unknown4;
|
|
194580
|
+
const limit = parsed2.data.rate_limit;
|
|
194594
194581
|
if (limit.allowed && !limit.limit_reached) return { status: "usable" };
|
|
194582
|
+
const credits = parsed2.data.credits;
|
|
194583
|
+
if ((credits?.has_credits || credits?.unlimited) && !credits.overage_limit_reached && !parsed2.data.spend_control?.reached)
|
|
194584
|
+
return { status: "usable" };
|
|
194595
194585
|
const windows = [limit.primary_window, limit.secondary_window];
|
|
194596
194586
|
const full = windows.filter((window2) => (window2?.used_percent ?? 0) >= 100);
|
|
194597
194587
|
const resets = (full.length ? full : windows).flatMap(
|
|
@@ -194639,15 +194629,24 @@ async function probeInference(input) {
|
|
|
194639
194629
|
const error49 = external_exports.object({ error: external_exports.object({ code: external_exports.string() }) }).safeParse(await response.json().catch(() => null));
|
|
194640
194630
|
return error49.success && error49.data.error.code === "insufficient_quota" ? { status: "exhausted", detail: "refused with 429: insufficient quota", resetAt: void 0 } : unknown4;
|
|
194641
194631
|
}
|
|
194632
|
+
if (response?.status === 401 || response?.status === 403)
|
|
194633
|
+
return {
|
|
194634
|
+
status: "rejected",
|
|
194635
|
+
detail: `rejected with ${response.status}${await providerReason(response)}`
|
|
194636
|
+
};
|
|
194642
194637
|
await response?.body?.cancel();
|
|
194643
194638
|
if (!response) return unknown4;
|
|
194644
194639
|
if (response.ok) return { status: "usable" };
|
|
194645
|
-
if (response.status === 401 || response.status === 403)
|
|
194646
|
-
return { status: "rejected", detail: `rejected with ${response.status}` };
|
|
194647
194640
|
if (response.status === 402)
|
|
194648
194641
|
return { status: "exhausted", detail: "refused with 402", resetAt: void 0 };
|
|
194649
194642
|
return unknown4;
|
|
194650
194643
|
}
|
|
194644
|
+
async function providerReason(response) {
|
|
194645
|
+
const body = external_exports.object({ error: external_exports.union([external_exports.string(), external_exports.object({ message: external_exports.string() })]) }).safeParse(await response.json().catch(() => null));
|
|
194646
|
+
if (!body.success) return "";
|
|
194647
|
+
const error49 = body.data.error;
|
|
194648
|
+
return `: ${(typeof error49 === "string" ? error49 : error49.message).slice(0, 300)}`;
|
|
194649
|
+
}
|
|
194651
194650
|
|
|
194652
194651
|
// utils/credentialPool.ts
|
|
194653
194652
|
var receipts = {};
|
|
@@ -194656,8 +194655,8 @@ function saveReceipts() {
|
|
|
194656
194655
|
for (const receipt of Object.values(receipts)) maskSecret(receipt);
|
|
194657
194656
|
saveSecretState("credential_receipts", JSON.stringify(receipts));
|
|
194658
194657
|
}
|
|
194659
|
-
var select =
|
|
194660
|
-
async (input) => {
|
|
194658
|
+
var select = mutation({
|
|
194659
|
+
run: async (input) => {
|
|
194661
194660
|
const response = await apiFetch({
|
|
194662
194661
|
path: "/api/runtime/credentials",
|
|
194663
194662
|
method: "POST",
|
|
@@ -194675,11 +194674,8 @@ var select = op(
|
|
|
194675
194674
|
});
|
|
194676
194675
|
return selectedCredentialSchema.parse(await response.json());
|
|
194677
194676
|
},
|
|
194678
|
-
|
|
194679
|
-
|
|
194680
|
-
rethrow: (error49) => error49 instanceof Error && typeof error49.cause === "number" && error49.cause >= 400 && error49.cause < 500
|
|
194681
|
-
}
|
|
194682
|
-
);
|
|
194677
|
+
retry: (error49, attempt) => error49 instanceof Error && typeof error49.cause === "number" && error49.cause >= 400 && error49.cause < 500 ? -1 : delay2([250, 1e3], attempt)
|
|
194678
|
+
});
|
|
194683
194679
|
function subscriptionForModel(model) {
|
|
194684
194680
|
if (!model.includes("/")) return null;
|
|
194685
194681
|
const provider2 = getModelProvider(model);
|
|
@@ -194742,12 +194738,14 @@ async function selectConfiguredCredential(input) {
|
|
|
194742
194738
|
const subscription = subscriptionForModel(model);
|
|
194743
194739
|
const names = getModelEnvVars(model).filter((name) => name !== subscription);
|
|
194744
194740
|
if (subscription) names.unshift(subscription);
|
|
194741
|
+
const opencodePinned = process.env.PULLFROG_AGENT?.trim() === "opencode";
|
|
194742
|
+
const presentable = (name) => canInstallSubscription(name) && !(opencodePinned && CLAUDE_CODE_ONLY_CREDENTIALS.includes(name));
|
|
194745
194743
|
const candidates = access.candidates.filter(
|
|
194746
|
-
(candidate) => names.includes(candidate.name) &&
|
|
194744
|
+
(candidate) => names.includes(candidate.name) && presentable(candidate.name)
|
|
194747
194745
|
);
|
|
194748
194746
|
if (!candidates.length) return false;
|
|
194749
194747
|
const options = [
|
|
194750
|
-
...names.filter((name) => workflowCredentials[name] &&
|
|
194748
|
+
...names.filter((name) => workflowCredentials[name] && presentable(name)).map((name) => ({ name, candidate: void 0 })),
|
|
194751
194749
|
...candidates.map((candidate) => ({ name: candidate.name, candidate }))
|
|
194752
194750
|
].sort((a, b) => Number(b.name === subscription) - Number(a.name === subscription));
|
|
194753
194751
|
const refused = [];
|
|
@@ -194804,7 +194802,7 @@ function activate(input) {
|
|
|
194804
194802
|
}
|
|
194805
194803
|
|
|
194806
194804
|
// utils/gitAuthServer.ts
|
|
194807
|
-
import { randomUUID as
|
|
194805
|
+
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
194808
194806
|
import { writeFileSync as writeFileSync14 } from "node:fs";
|
|
194809
194807
|
import { createServer as createServer3 } from "node:http";
|
|
194810
194808
|
import { join as join24 } from "node:path";
|
|
@@ -194862,7 +194860,7 @@ async function startGitAuthServer(tmpdir3) {
|
|
|
194862
194860
|
const port = rawAddr.port;
|
|
194863
194861
|
log.debug(`git auth server listening on 127.0.0.1:${port}`);
|
|
194864
194862
|
function register7(token) {
|
|
194865
|
-
const code =
|
|
194863
|
+
const code = randomUUID6();
|
|
194866
194864
|
codes.set(code, { token, state: "active" });
|
|
194867
194865
|
return code;
|
|
194868
194866
|
}
|
|
@@ -194874,7 +194872,7 @@ async function startGitAuthServer(tmpdir3) {
|
|
|
194874
194872
|
entry.timeout.unref();
|
|
194875
194873
|
}
|
|
194876
194874
|
function writeAskpassScript(code) {
|
|
194877
|
-
const scriptId =
|
|
194875
|
+
const scriptId = randomUUID6();
|
|
194878
194876
|
const scriptName = `askpass-${scriptId}.js`;
|
|
194879
194877
|
const scriptPath = join24(tmpdir3, scriptName);
|
|
194880
194878
|
const content = [
|
|
@@ -194965,13 +194963,10 @@ function getShellInstructions(shell, t) {
|
|
|
194965
194963
|
|
|
194966
194964
|
Shell command execution is DISABLED. Do not attempt to run shell commands.`;
|
|
194967
194965
|
case "restricted":
|
|
194968
|
-
return `### Shell commands
|
|
194969
|
-
|
|
194970
|
-
Use the \`${t("shell")}\` MCP tool for all shell command execution. This tool provides a secure environment with filtered credentials. Do NOT use any native shell tool \u2014 it is disabled for security. For long-running processes (dev servers, watchers), use \`shell({ command, background: true })\`. Use \`${t("kill_background")}\` to stop background processes.`;
|
|
194971
194966
|
case "enabled":
|
|
194972
194967
|
return `### Shell commands
|
|
194973
194968
|
|
|
194974
|
-
Use
|
|
194969
|
+
Use the \`${t("shell")}\` MCP tool for all shell command execution.${shell === "restricted" ? " This tool provides a secure environment with filtered credentials. Do NOT use any native shell tool \u2014 it is disabled for security." : ""} For long-running processes (dev servers, watchers), use \`shell({ command, background: true })\`. Use \`${t("kill_background")}\` to stop background processes.`;
|
|
194975
194970
|
default: {
|
|
194976
194971
|
const _exhaustive = shell;
|
|
194977
194972
|
return _exhaustive;
|
|
@@ -196116,8 +196111,8 @@ async function mintProxyKey(ctx) {
|
|
|
196116
196111
|
try {
|
|
196117
196112
|
const headers = await buildProxyTokenHeaders(ctx);
|
|
196118
196113
|
if (!headers) return null;
|
|
196119
|
-
const response = await
|
|
196120
|
-
async () => {
|
|
196114
|
+
const response = await mutation({
|
|
196115
|
+
run: async () => {
|
|
196121
196116
|
const r = await apiFetch({ path: "/api/proxy-token", method: "POST", headers });
|
|
196122
196117
|
if (r.status >= 500) {
|
|
196123
196118
|
const body = await r.json().catch(() => null);
|
|
@@ -196127,12 +196122,9 @@ async function mintProxyKey(ctx) {
|
|
|
196127
196122
|
}
|
|
196128
196123
|
return r;
|
|
196129
196124
|
},
|
|
196130
|
-
|
|
196131
|
-
|
|
196132
|
-
|
|
196133
|
-
rethrow: (error49) => !(error49 instanceof TransientError)
|
|
196134
|
-
}
|
|
196135
|
-
)();
|
|
196125
|
+
name: "proxy key mint",
|
|
196126
|
+
retry: (error49, attempt) => error49 instanceof TransientError ? delay2([1e3, 2e3], attempt) : -1
|
|
196127
|
+
})();
|
|
196136
196128
|
if (response.status === 402) {
|
|
196137
196129
|
const body = await response.json().catch(() => null);
|
|
196138
196130
|
throw new BillingError(body?.error ?? "insufficient balance", {
|
|
@@ -196165,10 +196157,10 @@ async function buildProxyTokenHeaders(ctx) {
|
|
|
196165
196157
|
const fundingSource = ctx.fundingSource;
|
|
196166
196158
|
if (ctx.oidcCredentials) {
|
|
196167
196159
|
const creds = ctx.oidcCredentials;
|
|
196168
|
-
const oidcToken = await
|
|
196160
|
+
const oidcToken = await query({
|
|
196161
|
+
run: () => fetchIdTokenFromStash(creds),
|
|
196169
196162
|
name: "ID token mint",
|
|
196170
|
-
|
|
196171
|
-
rethrow: (error49) => !isTransientTokenError(error49)
|
|
196163
|
+
retry: (error49, attempt) => isTransientTokenError(error49) ? delay2([1e3, 2e3], attempt) : -1
|
|
196172
196164
|
})();
|
|
196173
196165
|
return {
|
|
196174
196166
|
Authorization: `Bearer ${oidcToken}`,
|
|
@@ -196415,109 +196407,6 @@ ${collapsible}` : output;
|
|
|
196415
196407
|
};
|
|
196416
196408
|
}
|
|
196417
196409
|
|
|
196418
|
-
// utils/runContext.ts
|
|
196419
|
-
var defaultSettings = {
|
|
196420
|
-
model: null,
|
|
196421
|
-
effort: null,
|
|
196422
|
-
modes: [],
|
|
196423
|
-
setupScript: null,
|
|
196424
|
-
postCheckoutScript: null,
|
|
196425
|
-
prepushScript: null,
|
|
196426
|
-
stopScript: null,
|
|
196427
|
-
push: "restricted",
|
|
196428
|
-
shell: "restricted",
|
|
196429
|
-
prApproveEnabled: false,
|
|
196430
|
-
reviewDrafts: false,
|
|
196431
|
-
autoMergeEnabled: false,
|
|
196432
|
-
codexAgent: false,
|
|
196433
|
-
signedCommits: false,
|
|
196434
|
-
repoIntelligence: false,
|
|
196435
|
-
progressComments: true,
|
|
196436
|
-
statusChecks: true,
|
|
196437
|
-
approvalCheck: false,
|
|
196438
|
-
modeInstructions: {},
|
|
196439
|
-
learnings: null,
|
|
196440
|
-
learningsHeadings: [],
|
|
196441
|
-
envAllowlist: null,
|
|
196442
|
-
xrepoBrief: null,
|
|
196443
|
-
xrepoLearnings: null,
|
|
196444
|
-
xrepoLearningsHeadings: []
|
|
196445
|
-
};
|
|
196446
|
-
var defaultRunContext = {
|
|
196447
|
-
settings: defaultSettings,
|
|
196448
|
-
apiToken: "",
|
|
196449
|
-
oss: false,
|
|
196450
|
-
plan: "none"
|
|
196451
|
-
};
|
|
196452
|
-
var unknownSecretsRunContext = {
|
|
196453
|
-
...defaultRunContext,
|
|
196454
|
-
secretsUnavailable: true
|
|
196455
|
-
};
|
|
196456
|
-
async function fetchRunContext(params) {
|
|
196457
|
-
const timeoutMs = 3e4;
|
|
196458
|
-
const controller = new AbortController();
|
|
196459
|
-
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
196460
|
-
try {
|
|
196461
|
-
const headers = {
|
|
196462
|
-
Authorization: `Bearer ${params.token}`,
|
|
196463
|
-
"X-Pullfrog-Credential-Pools": "1"
|
|
196464
|
-
};
|
|
196465
|
-
if (params.oidcToken) {
|
|
196466
|
-
headers["X-GitHub-OIDC-Token"] = params.oidcToken;
|
|
196467
|
-
}
|
|
196468
|
-
const query = new URLSearchParams();
|
|
196469
|
-
if (params.runType) query.set("type", params.runType);
|
|
196470
|
-
if (params.routedTier) query.set("tier", params.routedTier);
|
|
196471
|
-
const search2 = query.toString();
|
|
196472
|
-
const response = await apiFetch({
|
|
196473
|
-
path: `/api/repo/${params.repoContext.owner}/${params.repoContext.name}/run-context${search2 ? `?${search2}` : ""}`,
|
|
196474
|
-
headers,
|
|
196475
|
-
signal: controller.signal
|
|
196476
|
-
});
|
|
196477
|
-
clearTimeout(timeoutId);
|
|
196478
|
-
if (response.status === 402) {
|
|
196479
|
-
const body = await response.json().catch(() => null);
|
|
196480
|
-
const reason = typeof body === "object" && body !== null && "reason" in body ? body.reason : null;
|
|
196481
|
-
const commercialRefused = reason === "subscription_unpaid" || reason === "subscription_ended" ? reason : "commercial";
|
|
196482
|
-
return { ...defaultRunContext, commercialRefused };
|
|
196483
|
-
}
|
|
196484
|
-
if (!response.ok) {
|
|
196485
|
-
return response.status >= 500 ? unknownSecretsRunContext : defaultRunContext;
|
|
196486
|
-
}
|
|
196487
|
-
const data = await response.json();
|
|
196488
|
-
if (data === null) {
|
|
196489
|
-
return defaultRunContext;
|
|
196490
|
-
}
|
|
196491
|
-
return {
|
|
196492
|
-
settings: {
|
|
196493
|
-
...defaultSettings,
|
|
196494
|
-
...data.settings,
|
|
196495
|
-
modes: data.settings?.modes ?? [],
|
|
196496
|
-
setupScript: data.settings?.setupScript ?? null,
|
|
196497
|
-
postCheckoutScript: data.settings?.postCheckoutScript ?? null,
|
|
196498
|
-
prepushScript: data.settings?.prepushScript ?? null,
|
|
196499
|
-
stopScript: data.settings?.stopScript ?? null,
|
|
196500
|
-
learningsHeadings: data.settings?.learningsHeadings ?? [],
|
|
196501
|
-
xrepoBrief: data.settings?.xrepoBrief ?? null,
|
|
196502
|
-
xrepoLearnings: data.settings?.xrepoLearnings ?? null,
|
|
196503
|
-
xrepoLearningsHeadings: data.settings?.xrepoLearningsHeadings ?? []
|
|
196504
|
-
},
|
|
196505
|
-
apiToken: data.apiToken,
|
|
196506
|
-
oss: data.oss ?? false,
|
|
196507
|
-
plan: data.plan ?? "none",
|
|
196508
|
-
proxyModel: data.proxyModel,
|
|
196509
|
-
dbSecrets: data.dbSecrets,
|
|
196510
|
-
credentialAccess: data.credentialAccess,
|
|
196511
|
-
secretsUnavailable: data.secretsUnavailable,
|
|
196512
|
-
routerUnfunded: data.routerUnfunded,
|
|
196513
|
-
trialFallback: data.trialFallback
|
|
196514
|
-
};
|
|
196515
|
-
} catch {
|
|
196516
|
-
clearTimeout(timeoutId);
|
|
196517
|
-
return unknownSecretsRunContext;
|
|
196518
|
-
}
|
|
196519
|
-
}
|
|
196520
|
-
|
|
196521
196410
|
// utils/runContextData.ts
|
|
196522
196411
|
async function resolveRunContextData(params) {
|
|
196523
196412
|
const actionRef = process.env.GITHUB_ACTION_REF;
|
|
@@ -196527,23 +196416,25 @@ async function resolveRunContextData(params) {
|
|
|
196527
196416
|
const repoContext = parseRepoContext();
|
|
196528
196417
|
let oidcToken;
|
|
196529
196418
|
try {
|
|
196530
|
-
oidcToken = await
|
|
196419
|
+
oidcToken = await query({
|
|
196420
|
+
run: () => mintIdToken(),
|
|
196531
196421
|
name: "OIDC mint",
|
|
196532
|
-
|
|
196422
|
+
retry: process.env.ACTIONS_ID_TOKEN_REQUEST_URL ? [200, 1e3] : []
|
|
196533
196423
|
})();
|
|
196534
196424
|
} catch {
|
|
196535
196425
|
}
|
|
196536
196426
|
const [repoResponse, runContext] = await Promise.all([
|
|
196537
|
-
|
|
196427
|
+
query({
|
|
196428
|
+
run: () => params.octokit.repos.get({ owner: repoContext.owner, repo: repoContext.name }),
|
|
196538
196429
|
name: "repos.get",
|
|
196539
|
-
|
|
196540
|
-
rethrow: (error49) => !isTransientOctokitError(error49)
|
|
196430
|
+
retry: (error49, attempt) => isTransientOctokitError(error49) ? delay2([100, 500], attempt) : -1
|
|
196541
196431
|
})(),
|
|
196542
196432
|
fetchRunContext({
|
|
196543
196433
|
token: params.token,
|
|
196544
196434
|
repoContext,
|
|
196545
196435
|
oidcToken,
|
|
196546
196436
|
runType: params.runType,
|
|
196437
|
+
plainPrompt: params.plainPrompt,
|
|
196547
196438
|
routedTier: params.routedTier
|
|
196548
196439
|
})
|
|
196549
196440
|
]);
|
|
@@ -197080,17 +196971,14 @@ async function autoMergeAfterApprove(ctx) {
|
|
|
197080
196971
|
});
|
|
197081
196972
|
if (hasBlockingHumanReview(reviews)) return skip("human changes requested");
|
|
197082
196973
|
try {
|
|
197083
|
-
await
|
|
197084
|
-
() => ctx.octokit.graphql(ENABLE_AUTO_MERGE, {
|
|
196974
|
+
await mutation({
|
|
196975
|
+
run: () => ctx.octokit.graphql(ENABLE_AUTO_MERGE, {
|
|
197085
196976
|
pullRequestId: pr.data.node_id,
|
|
197086
196977
|
headSha
|
|
197087
196978
|
}),
|
|
197088
|
-
|
|
197089
|
-
|
|
197090
|
-
|
|
197091
|
-
rethrow: (error49) => !isTransientOctokitError(error49)
|
|
197092
|
-
}
|
|
197093
|
-
)();
|
|
196979
|
+
name: "enablePullRequestAutoMerge",
|
|
196980
|
+
retry: (error49, attempt) => isTransientOctokitError(error49) ? delay2([500, 2e3], attempt) : -1
|
|
196981
|
+
})();
|
|
197094
196982
|
log.info(`autoMerge: pr=#${pullNumber} @ ${headSha.slice(0, 7)} \u2192 native auto-merge enabled`);
|
|
197095
196983
|
await comment(
|
|
197096
196984
|
"> \u2705 Approved \u2014 auto-merge enabled; GitHub will merge once required checks pass."
|
|
@@ -197128,7 +197016,17 @@ async function autoMergeAfterApprove(ctx) {
|
|
|
197128
197016
|
var RE_REVIEW_PREAMBLE = "Incrementally re-review the new commits on this pull request. Use the IncrementalReview mode.";
|
|
197129
197017
|
async function postReviewCleanup(ctx) {
|
|
197130
197018
|
const review = ctx.toolState.review;
|
|
197131
|
-
if (!review)
|
|
197019
|
+
if (!review) {
|
|
197020
|
+
const checkoutSha = primaryRepoState(ctx.toolState).checkoutSha;
|
|
197021
|
+
if (ctx.toolState.selectedMode === "IncrementalReview" && checkoutSha) {
|
|
197022
|
+
await patchWorkflowRunFields(ctx, { reviewSkipped: true });
|
|
197023
|
+
await bestEffort(
|
|
197024
|
+
() => dispatchFollowUpReReview(ctx, checkoutSha),
|
|
197025
|
+
"follow-up re-review dispatch"
|
|
197026
|
+
);
|
|
197027
|
+
}
|
|
197028
|
+
return;
|
|
197029
|
+
}
|
|
197132
197030
|
delete ctx.toolState.review;
|
|
197133
197031
|
await bestEffort(() => reportReviewNodeId(ctx, { nodeId: review.nodeId }), "reportReviewNodeId");
|
|
197134
197032
|
if (review.reviewedSha) {
|
|
@@ -197181,20 +197079,17 @@ async function dispatchFollowUpReReview(ctx, reviewedSha) {
|
|
|
197181
197079
|
eventInstructions: RE_REVIEW_PREAMBLE,
|
|
197182
197080
|
event
|
|
197183
197081
|
};
|
|
197184
|
-
await
|
|
197185
|
-
() => ctx.octokit.rest.actions.createWorkflowDispatch({
|
|
197082
|
+
await mutation({
|
|
197083
|
+
run: () => ctx.octokit.rest.actions.createWorkflowDispatch({
|
|
197186
197084
|
owner: ctx.repo.owner,
|
|
197187
197085
|
repo: ctx.repo.name,
|
|
197188
197086
|
workflow_id: getCurrentWorkflowFilename(),
|
|
197189
197087
|
ref: pr.data.base.repo.default_branch,
|
|
197190
197088
|
inputs: { prompt: JSON.stringify(payload) }
|
|
197191
197089
|
}),
|
|
197192
|
-
|
|
197193
|
-
|
|
197194
|
-
|
|
197195
|
-
rethrow: (error49) => !isTransientOctokitError(error49)
|
|
197196
|
-
}
|
|
197197
|
-
)();
|
|
197090
|
+
name: "reReviewDispatch",
|
|
197091
|
+
retry: (error49, attempt) => isTransientOctokitError(error49) ? delay2([500, 2e3], attempt) : -1
|
|
197092
|
+
})();
|
|
197198
197093
|
}
|
|
197199
197094
|
function getCurrentWorkflowFilename() {
|
|
197200
197095
|
const ref = process.env.GITHUB_WORKFLOW_REF ?? "";
|
|
@@ -197204,6 +197099,7 @@ function getCurrentWorkflowFilename() {
|
|
|
197204
197099
|
|
|
197205
197100
|
// utils/runStatusCheck.ts
|
|
197206
197101
|
var RUN_STATUS_CHECK_NAME = "pullfrog";
|
|
197102
|
+
var GITHUB_ACTIONS_APP_SLUG = "github-actions";
|
|
197207
197103
|
var APPROVAL_CHECK_NAME = "pullfrog-approval";
|
|
197208
197104
|
function parseCheckRunId(raw2) {
|
|
197209
197105
|
if (!raw2?.id) return void 0;
|
|
@@ -197257,7 +197153,12 @@ function terminalOutput(params) {
|
|
|
197257
197153
|
const review = params.reviewUrl ? `
|
|
197258
197154
|
|
|
197259
197155
|
[View the review Pullfrog posted \u2192](${params.reviewUrl})` : "";
|
|
197260
|
-
if (params.conclusion === "success")
|
|
197156
|
+
if (params.conclusion === "success") {
|
|
197157
|
+
const note = params.note ? `
|
|
197158
|
+
|
|
197159
|
+
${params.note}` : "";
|
|
197160
|
+
return { title: base.title, summary: base.summary + review + note };
|
|
197161
|
+
}
|
|
197261
197162
|
return {
|
|
197262
197163
|
title: base.title,
|
|
197263
197164
|
summary: base.summary + logsLine(params.detailsUrl) + review + disableCheckLine(params.owner, params.repo)
|
|
@@ -197275,7 +197176,8 @@ async function finalizeRunStatusCheck(params) {
|
|
|
197275
197176
|
owner: params.owner,
|
|
197276
197177
|
repo: params.repo,
|
|
197277
197178
|
detailsUrl: params.detailsUrl,
|
|
197278
|
-
reviewUrl: params.reviewUrl
|
|
197179
|
+
reviewUrl: params.reviewUrl,
|
|
197180
|
+
note: params.note
|
|
197279
197181
|
})
|
|
197280
197182
|
};
|
|
197281
197183
|
if (params.detailsUrl) updateParams.details_url = params.detailsUrl;
|
|
@@ -197294,7 +197196,8 @@ async function createTerminalRunStatusCheck(params) {
|
|
|
197294
197196
|
owner: params.owner,
|
|
197295
197197
|
repo: params.repo,
|
|
197296
197198
|
detailsUrl: params.detailsUrl,
|
|
197297
|
-
reviewUrl: params.reviewUrl
|
|
197199
|
+
reviewUrl: params.reviewUrl,
|
|
197200
|
+
note: params.note
|
|
197298
197201
|
})
|
|
197299
197202
|
};
|
|
197300
197203
|
if (params.detailsUrl) createParams.details_url = params.detailsUrl;
|
|
@@ -197310,6 +197213,8 @@ async function reportStatusChecks(ctx, params) {
|
|
|
197310
197213
|
if (checkRunId === void 0 && !ctx.payload.runStatusCheck && !ctx.payload.approvalCheck) return;
|
|
197311
197214
|
const conclusion = params.runSucceeded ? "success" : "failure";
|
|
197312
197215
|
const detailsUrl = ctx.runId ? `https://github.com/${ctx.repo.owner}/${ctx.repo.name}/actions/runs/${ctx.runId}` : void 0;
|
|
197216
|
+
const approval = ctx.toolState.approval;
|
|
197217
|
+
const note = event.silent && !approval?.url ? ctx.toolState.lastProgressBody : void 0;
|
|
197313
197218
|
if (checkRunId !== void 0) {
|
|
197314
197219
|
await finalizeRunStatusCheck({
|
|
197315
197220
|
octokit: ctx.octokit,
|
|
@@ -197318,11 +197223,12 @@ async function reportStatusChecks(ctx, params) {
|
|
|
197318
197223
|
checkRunId,
|
|
197319
197224
|
conclusion,
|
|
197320
197225
|
detailsUrl,
|
|
197321
|
-
reviewUrl:
|
|
197226
|
+
reviewUrl: approval?.url,
|
|
197227
|
+
note
|
|
197322
197228
|
}).then(() => log.info(`\xBB finalized ${RUN_STATUS_CHECK_NAME} check (${conclusion})`)).catch((err) => log.debug(`status checks: ${RUN_STATUS_CHECK_NAME} finalize failed: ${err}`));
|
|
197323
197229
|
}
|
|
197324
|
-
const
|
|
197325
|
-
const needsApprovalCheck = ctx.payload.approvalCheck && params.runSucceeded && approval;
|
|
197230
|
+
const carriesApproval = !approval && ctx.toolState.selectedMode === "IncrementalReview";
|
|
197231
|
+
const needsApprovalCheck = ctx.payload.approvalCheck && params.runSucceeded && (approval !== void 0 || carriesApproval);
|
|
197326
197232
|
const needsFallbackRunCheck = ctx.payload.runStatusCheck && checkRunId === void 0;
|
|
197327
197233
|
if (!needsApprovalCheck && !needsFallbackRunCheck) return;
|
|
197328
197234
|
let headSha;
|
|
@@ -197345,25 +197251,64 @@ async function reportStatusChecks(ctx, params) {
|
|
|
197345
197251
|
headSha: primaryRepoState(ctx.toolState).checkoutSha ?? headSha,
|
|
197346
197252
|
conclusion,
|
|
197347
197253
|
detailsUrl,
|
|
197348
|
-
reviewUrl:
|
|
197254
|
+
reviewUrl: approval?.url,
|
|
197255
|
+
note
|
|
197349
197256
|
}).then(() => log.info(`\xBB posted ${RUN_STATUS_CHECK_NAME} check (${conclusion})`)).catch((err) => log.debug(`status checks: ${RUN_STATUS_CHECK_NAME} post failed: ${err}`));
|
|
197350
197257
|
}
|
|
197351
|
-
if (!needsApprovalCheck
|
|
197258
|
+
if (!needsApprovalCheck) return;
|
|
197259
|
+
const verdict = approval ? { wouldApprove: approval.wouldApprove, sha: approval.sha ?? headSha, carriedLine: "" } : await carriedApproval(ctx, pullNumber).catch((err) => {
|
|
197260
|
+
log.debug(`status checks: ${APPROVAL_CHECK_NAME} carry-forward failed: ${err}`);
|
|
197261
|
+
return void 0;
|
|
197262
|
+
});
|
|
197263
|
+
if (!verdict) return;
|
|
197352
197264
|
const createParams = {
|
|
197353
197265
|
owner: ctx.repo.owner,
|
|
197354
197266
|
repo: ctx.repo.name,
|
|
197355
197267
|
name: APPROVAL_CHECK_NAME,
|
|
197356
|
-
head_sha:
|
|
197268
|
+
head_sha: verdict.sha,
|
|
197357
197269
|
status: "completed",
|
|
197358
|
-
conclusion:
|
|
197270
|
+
conclusion: verdict.wouldApprove ? "success" : "failure",
|
|
197359
197271
|
output: {
|
|
197360
|
-
title:
|
|
197361
|
-
summary:
|
|
197272
|
+
title: verdict.wouldApprove ? "Pullfrog would approve" : "Pullfrog would not approve",
|
|
197273
|
+
summary: (verdict.wouldApprove ? "Pullfrog has no outstanding review feedback on this PR." : "Pullfrog has outstanding review feedback or requested changes on this PR.") + verdict.carriedLine
|
|
197362
197274
|
}
|
|
197363
197275
|
};
|
|
197364
197276
|
if (detailsUrl) createParams.details_url = detailsUrl;
|
|
197365
197277
|
await ctx.octokit.rest.checks.create(createParams).then(() => log.info(`\xBB posted ${APPROVAL_CHECK_NAME} check`)).catch((err) => log.debug(`status checks: ${APPROVAL_CHECK_NAME} post failed: ${err}`));
|
|
197366
197278
|
}
|
|
197279
|
+
async function carriedApproval(ctx, pullNumber) {
|
|
197280
|
+
const primary = primaryRepoState(ctx.toolState);
|
|
197281
|
+
if (!primary.beforeSha || !primary.checkoutSha) return void 0;
|
|
197282
|
+
if (await latestApprovalConclusion(ctx, primary.checkoutSha) !== void 0) return void 0;
|
|
197283
|
+
const prior = await latestApprovalConclusion(ctx, primary.beforeSha);
|
|
197284
|
+
if (prior === void 0) return void 0;
|
|
197285
|
+
const from = primary.beforeSha.slice(0, 7);
|
|
197286
|
+
if (prior !== "success") {
|
|
197287
|
+
const carriedLine = `
|
|
197288
|
+
|
|
197289
|
+
No review covered this commit, so the verdict on ${from} carries forward.`;
|
|
197290
|
+
return { wouldApprove: false, sha: primary.checkoutSha, carriedLine };
|
|
197291
|
+
}
|
|
197292
|
+
if (ctx.toolState.noReviewNeededSha !== primary.checkoutSha) return void 0;
|
|
197293
|
+
return {
|
|
197294
|
+
wouldApprove: await countOutstandingPullfrogThreads(ctx, pullNumber) === 0,
|
|
197295
|
+
sha: primary.checkoutSha,
|
|
197296
|
+
carriedLine: `
|
|
197297
|
+
|
|
197298
|
+
Pullfrog found nothing to review in the commits since ${from}.`
|
|
197299
|
+
};
|
|
197300
|
+
}
|
|
197301
|
+
async function latestApprovalConclusion(ctx, ref) {
|
|
197302
|
+
const result = await ctx.octokit.rest.checks.listForRef({
|
|
197303
|
+
owner: ctx.repo.owner,
|
|
197304
|
+
repo: ctx.repo.name,
|
|
197305
|
+
ref,
|
|
197306
|
+
check_name: APPROVAL_CHECK_NAME,
|
|
197307
|
+
status: "completed"
|
|
197308
|
+
});
|
|
197309
|
+
const latest = result.data.check_runs.filter((run) => run.app?.slug !== GITHUB_ACTIONS_APP_SLUG).sort((a, b) => (b.completed_at ?? "").localeCompare(a.completed_at ?? ""))[0];
|
|
197310
|
+
return latest?.conclusion ?? void 0;
|
|
197311
|
+
}
|
|
197367
197312
|
|
|
197368
197313
|
// utils/runLifecycle.ts
|
|
197369
197314
|
async function persistRunArtifacts(toolContext) {
|
|
@@ -197702,6 +197647,7 @@ async function main() {
|
|
|
197702
197647
|
octokit: initialOctokit,
|
|
197703
197648
|
token: jobToken,
|
|
197704
197649
|
runType: typeof resolvedPromptInput === "string" ? void 0 : resolvedPromptInput.type,
|
|
197650
|
+
plainPrompt: typeof resolvedPromptInput === "string",
|
|
197705
197651
|
routedTier: typeof resolvedPromptInput === "string" ? void 0 : resolvedPromptInput.routing?.tier
|
|
197706
197652
|
});
|
|
197707
197653
|
timer.checkpoint("runContextData");
|
|
@@ -197798,7 +197744,7 @@ async function main() {
|
|
|
197798
197744
|
oidc: oidcCredentials
|
|
197799
197745
|
}), true);
|
|
197800
197746
|
wipeRunnerLeakSurface();
|
|
197801
|
-
if (payload.shell === "
|
|
197747
|
+
if (payload.shell !== "disabled" && process.env.CI === "true" && getSandboxMethod() === "none") {
|
|
197802
197748
|
payload.shell = "disabled";
|
|
197803
197749
|
log.warning(
|
|
197804
197750
|
"\xBB shell commands are disabled for this run: this runner provides no PID-namespace isolation (unprivileged unshare, sudo unshare and userns-nested unshare all failed). on a self-hosted Kubernetes/ARC runner, allow user-namespace creation in the pod's seccomp profile \u2014 see https://docs.pullfrog.com/security#self-hosted-runners"
|
|
@@ -197819,6 +197765,7 @@ async function main() {
|
|
|
197819
197765
|
const octokit = createOctokit(tokenRef.mcpToken, getMcpTokenRefresh());
|
|
197820
197766
|
const runInfo = await resolveRun({ octokit });
|
|
197821
197767
|
let toolContext;
|
|
197768
|
+
let succeeded = false;
|
|
197822
197769
|
let progressCallbackDisabled = false;
|
|
197823
197770
|
let todoTracker;
|
|
197824
197771
|
let vertexCredentials;
|
|
@@ -198236,11 +198183,13 @@ ${instructions.user}` : null,
|
|
|
198236
198183
|
);
|
|
198237
198184
|
}
|
|
198238
198185
|
await finalizeSuccessRun({ toolContext, toolState, result, repo: runContext.repo });
|
|
198239
|
-
|
|
198186
|
+
const outcome = await handleAgentResult({
|
|
198240
198187
|
result,
|
|
198241
198188
|
toolContext,
|
|
198242
198189
|
silent: payload.event.silent ?? false
|
|
198243
198190
|
});
|
|
198191
|
+
succeeded = outcome.success;
|
|
198192
|
+
return outcome;
|
|
198244
198193
|
} catch (_2) {
|
|
198245
198194
|
var _error2 = _2, _hasError2 = true;
|
|
198246
198195
|
} finally {
|
|
@@ -198286,9 +198235,8 @@ ${instructions.user}` : null,
|
|
|
198286
198235
|
if (toolState.model) patch.model = toolState.model;
|
|
198287
198236
|
if (toolState.agent) patch.agent = toolState.agent;
|
|
198288
198237
|
if (toolState.credential) patch.credential = toolState.credential;
|
|
198289
|
-
|
|
198290
|
-
|
|
198291
|
-
}
|
|
198238
|
+
patch.succeeded = succeeded;
|
|
198239
|
+
await patchWorkflowRunFields(toolContext, patch);
|
|
198292
198240
|
}
|
|
198293
198241
|
cleanupVertexCredentials(vertexCredentials);
|
|
198294
198242
|
}
|