rterm-backend 2.4.1 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +4 -7
- package/bin/gybackend.js +427 -229
- package/package.json +2 -2
package/bin/gybackend.js
CHANGED
|
@@ -19,10 +19,10 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
19
19
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
20
20
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
21
21
|
});
|
|
22
|
-
var __glob = (map3) => (
|
|
23
|
-
var fn = map3[
|
|
22
|
+
var __glob = (map3) => (path31) => {
|
|
23
|
+
var fn = map3[path31];
|
|
24
24
|
if (fn) return fn();
|
|
25
|
-
throw new Error("Module not found in bundle: " +
|
|
25
|
+
throw new Error("Module not found in bundle: " + path31);
|
|
26
26
|
};
|
|
27
27
|
var __esm = (fn, res) => function __init() {
|
|
28
28
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
@@ -23129,11 +23129,11 @@ var require_pdf_worker = __commonJS({
|
|
|
23129
23129
|
var nameTree = new NameTree(nameTreeRef, xref);
|
|
23130
23130
|
var names = nameTree.getAll();
|
|
23131
23131
|
for (var name in names) {
|
|
23132
|
-
var
|
|
23132
|
+
var fs22 = new FileSpec(names[name], xref);
|
|
23133
23133
|
if (!attachments) {
|
|
23134
23134
|
attachments = /* @__PURE__ */ Object.create(null);
|
|
23135
23135
|
}
|
|
23136
|
-
attachments[(0, _util.stringToPDFString)(name)] =
|
|
23136
|
+
attachments[(0, _util.stringToPDFString)(name)] = fs22.serializable;
|
|
23137
23137
|
}
|
|
23138
23138
|
}
|
|
23139
23139
|
return (0, _util.shadow)(this, "attachments", attachments);
|
|
@@ -28433,8 +28433,8 @@ var require_pdf_worker = __commonJS({
|
|
|
28433
28433
|
if (font.data && (isAddToPathSet || this.options.disableFontFace)) {
|
|
28434
28434
|
var buildPath = function buildPath2(fontChar) {
|
|
28435
28435
|
if (!font.renderer.hasBuiltPath(fontChar)) {
|
|
28436
|
-
var
|
|
28437
|
-
_this5.handler.send("commonobj", [font.loadedName + "_path_" + fontChar, "FontPath",
|
|
28436
|
+
var path31 = font.renderer.getPathJs(fontChar);
|
|
28437
|
+
_this5.handler.send("commonobj", [font.loadedName + "_path_" + fontChar, "FontPath", path31]);
|
|
28438
28438
|
}
|
|
28439
28439
|
};
|
|
28440
28440
|
for (var i = 0, ii = glyphs.length; i < ii; i++) {
|
|
@@ -71122,10 +71122,10 @@ var require_pdf = __commonJS({
|
|
|
71122
71122
|
ctx.save();
|
|
71123
71123
|
ctx.beginPath();
|
|
71124
71124
|
for (var i = 0; i < paths.length; i++) {
|
|
71125
|
-
var
|
|
71126
|
-
ctx.setTransform.apply(ctx,
|
|
71127
|
-
ctx.translate(
|
|
71128
|
-
|
|
71125
|
+
var path31 = paths[i];
|
|
71126
|
+
ctx.setTransform.apply(ctx, path31.transform);
|
|
71127
|
+
ctx.translate(path31.x, path31.y);
|
|
71128
|
+
path31.addToPath(ctx, path31.fontSize);
|
|
71129
71129
|
}
|
|
71130
71130
|
ctx.restore();
|
|
71131
71131
|
ctx.clip();
|
|
@@ -72985,7 +72985,7 @@ var require_pdf = __commonJS({
|
|
|
72985
72985
|
throw new TypeError("Cannot call a class as a function");
|
|
72986
72986
|
}
|
|
72987
72987
|
}
|
|
72988
|
-
var
|
|
72988
|
+
var fs22 = __require("fs");
|
|
72989
72989
|
var http2 = __require("http");
|
|
72990
72990
|
var https2 = __require("https");
|
|
72991
72991
|
var url2 = __require("url");
|
|
@@ -73318,8 +73318,8 @@ var require_pdf = __commonJS({
|
|
|
73318
73318
|
function PDFNodeStreamFsFullReader2(stream) {
|
|
73319
73319
|
_classCallCheck(this, PDFNodeStreamFsFullReader2);
|
|
73320
73320
|
var _this7 = _possibleConstructorReturn(this, (PDFNodeStreamFsFullReader2.__proto__ || Object.getPrototypeOf(PDFNodeStreamFsFullReader2)).call(this, stream));
|
|
73321
|
-
var
|
|
73322
|
-
|
|
73321
|
+
var path31 = decodeURI(_this7._url.path);
|
|
73322
|
+
fs22.lstat(path31, function(error40, stat) {
|
|
73323
73323
|
if (error40) {
|
|
73324
73324
|
_this7._errored = true;
|
|
73325
73325
|
_this7._reason = error40;
|
|
@@ -73327,7 +73327,7 @@ var require_pdf = __commonJS({
|
|
|
73327
73327
|
return;
|
|
73328
73328
|
}
|
|
73329
73329
|
_this7._contentLength = stat.size;
|
|
73330
|
-
_this7._setReadableStream(
|
|
73330
|
+
_this7._setReadableStream(fs22.createReadStream(path31));
|
|
73331
73331
|
_this7._headersCapability.resolve();
|
|
73332
73332
|
});
|
|
73333
73333
|
return _this7;
|
|
@@ -73339,7 +73339,7 @@ var require_pdf = __commonJS({
|
|
|
73339
73339
|
function PDFNodeStreamFsRangeReader2(stream, start, end) {
|
|
73340
73340
|
_classCallCheck(this, PDFNodeStreamFsRangeReader2);
|
|
73341
73341
|
var _this8 = _possibleConstructorReturn(this, (PDFNodeStreamFsRangeReader2.__proto__ || Object.getPrototypeOf(PDFNodeStreamFsRangeReader2)).call(this, stream));
|
|
73342
|
-
_this8._setReadableStream(
|
|
73342
|
+
_this8._setReadableStream(fs22.createReadStream(decodeURI(_this8._url.path), {
|
|
73343
73343
|
start,
|
|
73344
73344
|
end: end - 1
|
|
73345
73345
|
}));
|
|
@@ -85333,11 +85333,11 @@ var require_pdf_worker2 = __commonJS({
|
|
|
85333
85333
|
var nameTree = new NameTree(nameTreeRef, xref);
|
|
85334
85334
|
var names = nameTree.getAll();
|
|
85335
85335
|
for (var name in names) {
|
|
85336
|
-
var
|
|
85336
|
+
var fs22 = new FileSpec(names[name], xref);
|
|
85337
85337
|
if (!attachments) {
|
|
85338
85338
|
attachments = /* @__PURE__ */ Object.create(null);
|
|
85339
85339
|
}
|
|
85340
|
-
attachments[(0, _util.stringToPDFString)(name)] =
|
|
85340
|
+
attachments[(0, _util.stringToPDFString)(name)] = fs22.serializable;
|
|
85341
85341
|
}
|
|
85342
85342
|
}
|
|
85343
85343
|
return (0, _util.shadow)(this, "attachments", attachments);
|
|
@@ -90637,8 +90637,8 @@ var require_pdf_worker2 = __commonJS({
|
|
|
90637
90637
|
if (font.data && (isAddToPathSet || this.options.disableFontFace)) {
|
|
90638
90638
|
var buildPath = function buildPath2(fontChar) {
|
|
90639
90639
|
if (!font.renderer.hasBuiltPath(fontChar)) {
|
|
90640
|
-
var
|
|
90641
|
-
_this5.handler.send("commonobj", [font.loadedName + "_path_" + fontChar, "FontPath",
|
|
90640
|
+
var path31 = font.renderer.getPathJs(fontChar);
|
|
90641
|
+
_this5.handler.send("commonobj", [font.loadedName + "_path_" + fontChar, "FontPath", path31]);
|
|
90642
90642
|
}
|
|
90643
90643
|
};
|
|
90644
90644
|
for (var i = 0, ii = glyphs.length; i < ii; i++) {
|
|
@@ -133434,10 +133434,10 @@ var require_pdf2 = __commonJS({
|
|
|
133434
133434
|
ctx.save();
|
|
133435
133435
|
ctx.beginPath();
|
|
133436
133436
|
for (var i = 0; i < paths.length; i++) {
|
|
133437
|
-
var
|
|
133438
|
-
ctx.setTransform.apply(ctx,
|
|
133439
|
-
ctx.translate(
|
|
133440
|
-
|
|
133437
|
+
var path31 = paths[i];
|
|
133438
|
+
ctx.setTransform.apply(ctx, path31.transform);
|
|
133439
|
+
ctx.translate(path31.x, path31.y);
|
|
133440
|
+
path31.addToPath(ctx, path31.fontSize);
|
|
133441
133441
|
}
|
|
133442
133442
|
ctx.restore();
|
|
133443
133443
|
ctx.clip();
|
|
@@ -134821,7 +134821,7 @@ var require_pdf2 = __commonJS({
|
|
|
134821
134821
|
throw new TypeError("Cannot call a class as a function");
|
|
134822
134822
|
}
|
|
134823
134823
|
}
|
|
134824
|
-
var
|
|
134824
|
+
var fs22 = __require("fs");
|
|
134825
134825
|
var http2 = __require("http");
|
|
134826
134826
|
var https2 = __require("https");
|
|
134827
134827
|
var url2 = __require("url");
|
|
@@ -135154,8 +135154,8 @@ var require_pdf2 = __commonJS({
|
|
|
135154
135154
|
function PDFNodeStreamFsFullReader2(stream) {
|
|
135155
135155
|
_classCallCheck(this, PDFNodeStreamFsFullReader2);
|
|
135156
135156
|
var _this7 = _possibleConstructorReturn(this, (PDFNodeStreamFsFullReader2.__proto__ || Object.getPrototypeOf(PDFNodeStreamFsFullReader2)).call(this, stream));
|
|
135157
|
-
var
|
|
135158
|
-
|
|
135157
|
+
var path31 = decodeURI(_this7._url.path);
|
|
135158
|
+
fs22.lstat(path31, function(error40, stat) {
|
|
135159
135159
|
if (error40) {
|
|
135160
135160
|
_this7._errored = true;
|
|
135161
135161
|
_this7._reason = error40;
|
|
@@ -135163,7 +135163,7 @@ var require_pdf2 = __commonJS({
|
|
|
135163
135163
|
return;
|
|
135164
135164
|
}
|
|
135165
135165
|
_this7._contentLength = stat.size;
|
|
135166
|
-
_this7._setReadableStream(
|
|
135166
|
+
_this7._setReadableStream(fs22.createReadStream(path31));
|
|
135167
135167
|
_this7._headersCapability.resolve();
|
|
135168
135168
|
});
|
|
135169
135169
|
return _this7;
|
|
@@ -135175,7 +135175,7 @@ var require_pdf2 = __commonJS({
|
|
|
135175
135175
|
function PDFNodeStreamFsRangeReader2(stream, start, end) {
|
|
135176
135176
|
_classCallCheck(this, PDFNodeStreamFsRangeReader2);
|
|
135177
135177
|
var _this8 = _possibleConstructorReturn(this, (PDFNodeStreamFsRangeReader2.__proto__ || Object.getPrototypeOf(PDFNodeStreamFsRangeReader2)).call(this, stream));
|
|
135178
|
-
_this8._setReadableStream(
|
|
135178
|
+
_this8._setReadableStream(fs22.createReadStream(decodeURI(_this8._url.path), {
|
|
135179
135179
|
start,
|
|
135180
135180
|
end: end - 1
|
|
135181
135181
|
}));
|
|
@@ -152740,8 +152740,8 @@ var require_pdf_worker3 = __commonJS({
|
|
|
152740
152740
|
if (font.data && (isAddToPathSet || this.options.disableFontFace)) {
|
|
152741
152741
|
var buildPath = function buildPath2(fontChar) {
|
|
152742
152742
|
if (!font.renderer.hasBuiltPath(fontChar)) {
|
|
152743
|
-
var
|
|
152744
|
-
_this5.handler.send("commonobj", [font.loadedName + "_path_" + fontChar, "FontPath",
|
|
152743
|
+
var path31 = font.renderer.getPathJs(fontChar);
|
|
152744
|
+
_this5.handler.send("commonobj", [font.loadedName + "_path_" + fontChar, "FontPath", path31]);
|
|
152745
152745
|
}
|
|
152746
152746
|
};
|
|
152747
152747
|
for (var i = 0, ii = glyphs.length; i < ii; i++) {
|
|
@@ -157559,11 +157559,11 @@ var require_pdf_worker3 = __commonJS({
|
|
|
157559
157559
|
var nameTree = new NameTree(nameTreeRef, xref);
|
|
157560
157560
|
var names = nameTree.getAll();
|
|
157561
157561
|
for (var name in names) {
|
|
157562
|
-
var
|
|
157562
|
+
var fs22 = new FileSpec(names[name], xref);
|
|
157563
157563
|
if (!attachments) {
|
|
157564
157564
|
attachments = /* @__PURE__ */ Object.create(null);
|
|
157565
157565
|
}
|
|
157566
|
-
attachments[(0, _util.stringToPDFString)(name)] =
|
|
157566
|
+
attachments[(0, _util.stringToPDFString)(name)] = fs22.serializable;
|
|
157567
157567
|
}
|
|
157568
157568
|
}
|
|
157569
157569
|
return (0, _util.shadow)(this, "attachments", attachments);
|
|
@@ -187196,10 +187196,10 @@ var require_pdf3 = __commonJS({
|
|
|
187196
187196
|
ctx.save();
|
|
187197
187197
|
ctx.beginPath();
|
|
187198
187198
|
for (var i = 0; i < paths.length; i++) {
|
|
187199
|
-
var
|
|
187200
|
-
ctx.setTransform.apply(ctx,
|
|
187201
|
-
ctx.translate(
|
|
187202
|
-
|
|
187199
|
+
var path31 = paths[i];
|
|
187200
|
+
ctx.setTransform.apply(ctx, path31.transform);
|
|
187201
|
+
ctx.translate(path31.x, path31.y);
|
|
187202
|
+
path31.addToPath(ctx, path31.fontSize);
|
|
187203
187203
|
}
|
|
187204
187204
|
ctx.restore();
|
|
187205
187205
|
ctx.clip();
|
|
@@ -199444,11 +199444,11 @@ var require_pdf_worker4 = __commonJS({
|
|
|
199444
199444
|
var nameTree = new NameTree(nameTreeRef, xref);
|
|
199445
199445
|
var names = nameTree.getAll();
|
|
199446
199446
|
for (var name in names) {
|
|
199447
|
-
var
|
|
199447
|
+
var fs22 = new FileSpec(names[name], xref);
|
|
199448
199448
|
if (!attachments) {
|
|
199449
199449
|
attachments = /* @__PURE__ */ Object.create(null);
|
|
199450
199450
|
}
|
|
199451
|
-
attachments[(0, _util.stringToPDFString)(name)] =
|
|
199451
|
+
attachments[(0, _util.stringToPDFString)(name)] = fs22.serializable;
|
|
199452
199452
|
}
|
|
199453
199453
|
}
|
|
199454
199454
|
return (0, _util.shadow)(this, "attachments", attachments);
|
|
@@ -212594,8 +212594,8 @@ var require_pdf_worker4 = __commonJS({
|
|
|
212594
212594
|
if (font.data && (isAddToPathSet || this.options.disableFontFace || state.fillColorSpace.name === "Pattern")) {
|
|
212595
212595
|
var buildPath = function buildPath2(fontChar) {
|
|
212596
212596
|
if (!font.renderer.hasBuiltPath(fontChar)) {
|
|
212597
|
-
var
|
|
212598
|
-
_this5.handler.send("commonobj", [font.loadedName + "_path_" + fontChar, "FontPath",
|
|
212597
|
+
var path31 = font.renderer.getPathJs(fontChar);
|
|
212598
|
+
_this5.handler.send("commonobj", [font.loadedName + "_path_" + fontChar, "FontPath", path31]);
|
|
212599
212599
|
}
|
|
212600
212600
|
};
|
|
212601
212601
|
for (var i = 0, ii = glyphs.length; i < ii; i++) {
|
|
@@ -244559,10 +244559,10 @@ var require_pdf4 = __commonJS({
|
|
|
244559
244559
|
ctx.save();
|
|
244560
244560
|
ctx.beginPath();
|
|
244561
244561
|
for (var i = 0; i < paths.length; i++) {
|
|
244562
|
-
var
|
|
244563
|
-
ctx.setTransform.apply(ctx,
|
|
244564
|
-
ctx.translate(
|
|
244565
|
-
|
|
244562
|
+
var path31 = paths[i];
|
|
244563
|
+
ctx.setTransform.apply(ctx, path31.transform);
|
|
244564
|
+
ctx.translate(path31.x, path31.y);
|
|
244565
|
+
path31.addToPath(ctx, path31.fontSize);
|
|
244566
244566
|
}
|
|
244567
244567
|
ctx.restore();
|
|
244568
244568
|
ctx.clip();
|
|
@@ -249831,7 +249831,7 @@ var require_pdf4 = __commonJS({
|
|
|
249831
249831
|
throw new TypeError("Cannot call a class as a function");
|
|
249832
249832
|
}
|
|
249833
249833
|
}
|
|
249834
|
-
var
|
|
249834
|
+
var fs22 = __require("fs");
|
|
249835
249835
|
var http2 = __require("http");
|
|
249836
249836
|
var https2 = __require("https");
|
|
249837
249837
|
var url2 = __require("url");
|
|
@@ -250185,11 +250185,11 @@ var require_pdf4 = __commonJS({
|
|
|
250185
250185
|
function PDFNodeStreamFsFullReader2(stream) {
|
|
250186
250186
|
_classCallCheck(this, PDFNodeStreamFsFullReader2);
|
|
250187
250187
|
var _this7 = _possibleConstructorReturn(this, (PDFNodeStreamFsFullReader2.__proto__ || Object.getPrototypeOf(PDFNodeStreamFsFullReader2)).call(this, stream));
|
|
250188
|
-
var
|
|
250188
|
+
var path31 = decodeURIComponent(_this7._url.path);
|
|
250189
250189
|
if (fileUriRegex.test(_this7._url.href)) {
|
|
250190
|
-
|
|
250190
|
+
path31 = path31.replace(/^\//, "");
|
|
250191
250191
|
}
|
|
250192
|
-
|
|
250192
|
+
fs22.lstat(path31, function(error40, stat) {
|
|
250193
250193
|
if (error40) {
|
|
250194
250194
|
_this7._errored = true;
|
|
250195
250195
|
_this7._reason = error40;
|
|
@@ -250197,7 +250197,7 @@ var require_pdf4 = __commonJS({
|
|
|
250197
250197
|
return;
|
|
250198
250198
|
}
|
|
250199
250199
|
_this7._contentLength = stat.size;
|
|
250200
|
-
_this7._setReadableStream(
|
|
250200
|
+
_this7._setReadableStream(fs22.createReadStream(path31));
|
|
250201
250201
|
_this7._headersCapability.resolve();
|
|
250202
250202
|
});
|
|
250203
250203
|
return _this7;
|
|
@@ -250209,11 +250209,11 @@ var require_pdf4 = __commonJS({
|
|
|
250209
250209
|
function PDFNodeStreamFsRangeReader2(stream, start, end) {
|
|
250210
250210
|
_classCallCheck(this, PDFNodeStreamFsRangeReader2);
|
|
250211
250211
|
var _this8 = _possibleConstructorReturn(this, (PDFNodeStreamFsRangeReader2.__proto__ || Object.getPrototypeOf(PDFNodeStreamFsRangeReader2)).call(this, stream));
|
|
250212
|
-
var
|
|
250212
|
+
var path31 = decodeURIComponent(_this8._url.path);
|
|
250213
250213
|
if (fileUriRegex.test(_this8._url.href)) {
|
|
250214
|
-
|
|
250214
|
+
path31 = path31.replace(/^\//, "");
|
|
250215
250215
|
}
|
|
250216
|
-
_this8._setReadableStream(
|
|
250216
|
+
_this8._setReadableStream(fs22.createReadStream(path31, {
|
|
250217
250217
|
start,
|
|
250218
250218
|
end: end - 1
|
|
250219
250219
|
}));
|
|
@@ -259333,8 +259333,8 @@ var require_utils2 = __commonJS({
|
|
|
259333
259333
|
}
|
|
259334
259334
|
return ind;
|
|
259335
259335
|
}
|
|
259336
|
-
function removeDotSegments(
|
|
259337
|
-
let input =
|
|
259336
|
+
function removeDotSegments(path31) {
|
|
259337
|
+
let input = path31;
|
|
259338
259338
|
const output = [];
|
|
259339
259339
|
let nextSlash = -1;
|
|
259340
259340
|
let len = 0;
|
|
@@ -259533,8 +259533,8 @@ var require_schemes = __commonJS({
|
|
|
259533
259533
|
wsComponent.secure = void 0;
|
|
259534
259534
|
}
|
|
259535
259535
|
if (wsComponent.resourceName) {
|
|
259536
|
-
const [
|
|
259537
|
-
wsComponent.path =
|
|
259536
|
+
const [path31, query] = wsComponent.resourceName.split("?");
|
|
259537
|
+
wsComponent.path = path31 && path31 !== "/" ? path31 : void 0;
|
|
259538
259538
|
wsComponent.query = query;
|
|
259539
259539
|
wsComponent.resourceName = void 0;
|
|
259540
259540
|
}
|
|
@@ -268573,12 +268573,12 @@ var require_dist2 = __commonJS({
|
|
|
268573
268573
|
throw new Error(`Unknown format "${name}"`);
|
|
268574
268574
|
return f;
|
|
268575
268575
|
};
|
|
268576
|
-
function addFormats(ajv, list,
|
|
268576
|
+
function addFormats(ajv, list, fs22, exportName) {
|
|
268577
268577
|
var _a3;
|
|
268578
268578
|
var _b;
|
|
268579
268579
|
(_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
268580
268580
|
for (const f of list)
|
|
268581
|
-
ajv.addFormat(f,
|
|
268581
|
+
ajv.addFormat(f, fs22[f]);
|
|
268582
268582
|
}
|
|
268583
268583
|
module.exports = exports = formatsPlugin;
|
|
268584
268584
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -268591,8 +268591,8 @@ var require_windows = __commonJS({
|
|
|
268591
268591
|
"../../node_modules/isexe/windows.js"(exports, module) {
|
|
268592
268592
|
module.exports = isexe;
|
|
268593
268593
|
isexe.sync = sync;
|
|
268594
|
-
var
|
|
268595
|
-
function checkPathExt(
|
|
268594
|
+
var fs22 = __require("fs");
|
|
268595
|
+
function checkPathExt(path31, options) {
|
|
268596
268596
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
268597
268597
|
if (!pathext) {
|
|
268598
268598
|
return true;
|
|
@@ -268603,25 +268603,25 @@ var require_windows = __commonJS({
|
|
|
268603
268603
|
}
|
|
268604
268604
|
for (var i = 0; i < pathext.length; i++) {
|
|
268605
268605
|
var p = pathext[i].toLowerCase();
|
|
268606
|
-
if (p &&
|
|
268606
|
+
if (p && path31.substr(-p.length).toLowerCase() === p) {
|
|
268607
268607
|
return true;
|
|
268608
268608
|
}
|
|
268609
268609
|
}
|
|
268610
268610
|
return false;
|
|
268611
268611
|
}
|
|
268612
|
-
function checkStat(stat,
|
|
268612
|
+
function checkStat(stat, path31, options) {
|
|
268613
268613
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
268614
268614
|
return false;
|
|
268615
268615
|
}
|
|
268616
|
-
return checkPathExt(
|
|
268616
|
+
return checkPathExt(path31, options);
|
|
268617
268617
|
}
|
|
268618
|
-
function isexe(
|
|
268619
|
-
|
|
268620
|
-
cb(er, er ? false : checkStat(stat,
|
|
268618
|
+
function isexe(path31, options, cb) {
|
|
268619
|
+
fs22.stat(path31, function(er, stat) {
|
|
268620
|
+
cb(er, er ? false : checkStat(stat, path31, options));
|
|
268621
268621
|
});
|
|
268622
268622
|
}
|
|
268623
|
-
function sync(
|
|
268624
|
-
return checkStat(
|
|
268623
|
+
function sync(path31, options) {
|
|
268624
|
+
return checkStat(fs22.statSync(path31), path31, options);
|
|
268625
268625
|
}
|
|
268626
268626
|
}
|
|
268627
268627
|
});
|
|
@@ -268631,14 +268631,14 @@ var require_mode = __commonJS({
|
|
|
268631
268631
|
"../../node_modules/isexe/mode.js"(exports, module) {
|
|
268632
268632
|
module.exports = isexe;
|
|
268633
268633
|
isexe.sync = sync;
|
|
268634
|
-
var
|
|
268635
|
-
function isexe(
|
|
268636
|
-
|
|
268634
|
+
var fs22 = __require("fs");
|
|
268635
|
+
function isexe(path31, options, cb) {
|
|
268636
|
+
fs22.stat(path31, function(er, stat) {
|
|
268637
268637
|
cb(er, er ? false : checkStat(stat, options));
|
|
268638
268638
|
});
|
|
268639
268639
|
}
|
|
268640
|
-
function sync(
|
|
268641
|
-
return checkStat(
|
|
268640
|
+
function sync(path31, options) {
|
|
268641
|
+
return checkStat(fs22.statSync(path31), options);
|
|
268642
268642
|
}
|
|
268643
268643
|
function checkStat(stat, options) {
|
|
268644
268644
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -268662,7 +268662,7 @@ var require_mode = __commonJS({
|
|
|
268662
268662
|
// ../../node_modules/isexe/index.js
|
|
268663
268663
|
var require_isexe = __commonJS({
|
|
268664
268664
|
"../../node_modules/isexe/index.js"(exports, module) {
|
|
268665
|
-
var
|
|
268665
|
+
var fs22 = __require("fs");
|
|
268666
268666
|
var core2;
|
|
268667
268667
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
268668
268668
|
core2 = require_windows();
|
|
@@ -268671,7 +268671,7 @@ var require_isexe = __commonJS({
|
|
|
268671
268671
|
}
|
|
268672
268672
|
module.exports = isexe;
|
|
268673
268673
|
isexe.sync = sync;
|
|
268674
|
-
function isexe(
|
|
268674
|
+
function isexe(path31, options, cb) {
|
|
268675
268675
|
if (typeof options === "function") {
|
|
268676
268676
|
cb = options;
|
|
268677
268677
|
options = {};
|
|
@@ -268681,7 +268681,7 @@ var require_isexe = __commonJS({
|
|
|
268681
268681
|
throw new TypeError("callback not provided");
|
|
268682
268682
|
}
|
|
268683
268683
|
return new Promise(function(resolve2, reject) {
|
|
268684
|
-
isexe(
|
|
268684
|
+
isexe(path31, options || {}, function(er, is) {
|
|
268685
268685
|
if (er) {
|
|
268686
268686
|
reject(er);
|
|
268687
268687
|
} else {
|
|
@@ -268690,7 +268690,7 @@ var require_isexe = __commonJS({
|
|
|
268690
268690
|
});
|
|
268691
268691
|
});
|
|
268692
268692
|
}
|
|
268693
|
-
core2(
|
|
268693
|
+
core2(path31, options || {}, function(er, is) {
|
|
268694
268694
|
if (er) {
|
|
268695
268695
|
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
268696
268696
|
er = null;
|
|
@@ -268700,9 +268700,9 @@ var require_isexe = __commonJS({
|
|
|
268700
268700
|
cb(er, is);
|
|
268701
268701
|
});
|
|
268702
268702
|
}
|
|
268703
|
-
function sync(
|
|
268703
|
+
function sync(path31, options) {
|
|
268704
268704
|
try {
|
|
268705
|
-
return core2.sync(
|
|
268705
|
+
return core2.sync(path31, options || {});
|
|
268706
268706
|
} catch (er) {
|
|
268707
268707
|
if (options && options.ignoreErrors || er.code === "EACCES") {
|
|
268708
268708
|
return false;
|
|
@@ -268718,7 +268718,7 @@ var require_isexe = __commonJS({
|
|
|
268718
268718
|
var require_which = __commonJS({
|
|
268719
268719
|
"../../node_modules/which/which.js"(exports, module) {
|
|
268720
268720
|
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
268721
|
-
var
|
|
268721
|
+
var path31 = __require("path");
|
|
268722
268722
|
var COLON = isWindows ? ";" : ":";
|
|
268723
268723
|
var isexe = require_isexe();
|
|
268724
268724
|
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
@@ -268756,7 +268756,7 @@ var require_which = __commonJS({
|
|
|
268756
268756
|
return opt.all && found.length ? resolve2(found) : reject(getNotFoundError(cmd));
|
|
268757
268757
|
const ppRaw = pathEnv[i];
|
|
268758
268758
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
268759
|
-
const pCmd =
|
|
268759
|
+
const pCmd = path31.join(pathPart, cmd);
|
|
268760
268760
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
268761
268761
|
resolve2(subStep(p, i, 0));
|
|
268762
268762
|
});
|
|
@@ -268783,7 +268783,7 @@ var require_which = __commonJS({
|
|
|
268783
268783
|
for (let i = 0; i < pathEnv.length; i++) {
|
|
268784
268784
|
const ppRaw = pathEnv[i];
|
|
268785
268785
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
268786
|
-
const pCmd =
|
|
268786
|
+
const pCmd = path31.join(pathPart, cmd);
|
|
268787
268787
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
268788
268788
|
for (let j = 0; j < pathExt.length; j++) {
|
|
268789
268789
|
const cur = p + pathExt[j];
|
|
@@ -268831,7 +268831,7 @@ var require_path_key = __commonJS({
|
|
|
268831
268831
|
var require_resolveCommand = __commonJS({
|
|
268832
268832
|
"../../node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
|
|
268833
268833
|
"use strict";
|
|
268834
|
-
var
|
|
268834
|
+
var path31 = __require("path");
|
|
268835
268835
|
var which = require_which();
|
|
268836
268836
|
var getPathKey = require_path_key();
|
|
268837
268837
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
@@ -268849,7 +268849,7 @@ var require_resolveCommand = __commonJS({
|
|
|
268849
268849
|
try {
|
|
268850
268850
|
resolved = which.sync(parsed.command, {
|
|
268851
268851
|
path: env[getPathKey({ env })],
|
|
268852
|
-
pathExt: withoutPathExt ?
|
|
268852
|
+
pathExt: withoutPathExt ? path31.delimiter : void 0
|
|
268853
268853
|
});
|
|
268854
268854
|
} catch (e) {
|
|
268855
268855
|
} finally {
|
|
@@ -268858,7 +268858,7 @@ var require_resolveCommand = __commonJS({
|
|
|
268858
268858
|
}
|
|
268859
268859
|
}
|
|
268860
268860
|
if (resolved) {
|
|
268861
|
-
resolved =
|
|
268861
|
+
resolved = path31.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
268862
268862
|
}
|
|
268863
268863
|
return resolved;
|
|
268864
268864
|
}
|
|
@@ -268912,8 +268912,8 @@ var require_shebang_command = __commonJS({
|
|
|
268912
268912
|
if (!match) {
|
|
268913
268913
|
return null;
|
|
268914
268914
|
}
|
|
268915
|
-
const [
|
|
268916
|
-
const binary2 =
|
|
268915
|
+
const [path31, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
268916
|
+
const binary2 = path31.split("/").pop();
|
|
268917
268917
|
if (binary2 === "env") {
|
|
268918
268918
|
return argument;
|
|
268919
268919
|
}
|
|
@@ -268926,16 +268926,16 @@ var require_shebang_command = __commonJS({
|
|
|
268926
268926
|
var require_readShebang = __commonJS({
|
|
268927
268927
|
"../../node_modules/cross-spawn/lib/util/readShebang.js"(exports, module) {
|
|
268928
268928
|
"use strict";
|
|
268929
|
-
var
|
|
268929
|
+
var fs22 = __require("fs");
|
|
268930
268930
|
var shebangCommand = require_shebang_command();
|
|
268931
268931
|
function readShebang(command) {
|
|
268932
268932
|
const size = 150;
|
|
268933
268933
|
const buffer = Buffer.alloc(size);
|
|
268934
268934
|
let fd;
|
|
268935
268935
|
try {
|
|
268936
|
-
fd =
|
|
268937
|
-
|
|
268938
|
-
|
|
268936
|
+
fd = fs22.openSync(command, "r");
|
|
268937
|
+
fs22.readSync(fd, buffer, 0, size, 0);
|
|
268938
|
+
fs22.closeSync(fd);
|
|
268939
268939
|
} catch (e) {
|
|
268940
268940
|
}
|
|
268941
268941
|
return shebangCommand(buffer.toString());
|
|
@@ -268948,7 +268948,7 @@ var require_readShebang = __commonJS({
|
|
|
268948
268948
|
var require_parse2 = __commonJS({
|
|
268949
268949
|
"../../node_modules/cross-spawn/lib/parse.js"(exports, module) {
|
|
268950
268950
|
"use strict";
|
|
268951
|
-
var
|
|
268951
|
+
var path31 = __require("path");
|
|
268952
268952
|
var resolveCommand = require_resolveCommand();
|
|
268953
268953
|
var escape2 = require_escape();
|
|
268954
268954
|
var readShebang = require_readShebang();
|
|
@@ -268973,7 +268973,7 @@ var require_parse2 = __commonJS({
|
|
|
268973
268973
|
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
268974
268974
|
if (parsed.options.forceShell || needsShell) {
|
|
268975
268975
|
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
268976
|
-
parsed.command =
|
|
268976
|
+
parsed.command = path31.normalize(parsed.command);
|
|
268977
268977
|
parsed.command = escape2.command(parsed.command);
|
|
268978
268978
|
parsed.args = parsed.args.map((arg) => escape2.argument(arg, needsDoubleEscapeMetaChars));
|
|
268979
268979
|
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
@@ -278597,7 +278597,7 @@ var require_ws_transport = __commonJS({
|
|
|
278597
278597
|
let protocol;
|
|
278598
278598
|
let port;
|
|
278599
278599
|
const host = url2.hostname;
|
|
278600
|
-
const
|
|
278600
|
+
const path31 = url2.pathname;
|
|
278601
278601
|
const search = url2.search || "";
|
|
278602
278602
|
switch (srcProto) {
|
|
278603
278603
|
case "http:":
|
|
@@ -278617,7 +278617,7 @@ var require_ws_transport = __commonJS({
|
|
|
278617
278617
|
protocol = encrypted === true ? "wss:" : "ws:";
|
|
278618
278618
|
break;
|
|
278619
278619
|
}
|
|
278620
|
-
return `${protocol}//${host}:${port}${
|
|
278620
|
+
return `${protocol}//${host}:${port}${path31}${search}`;
|
|
278621
278621
|
}
|
|
278622
278622
|
function wsconnect(opts = {}) {
|
|
278623
278623
|
(0, transport_1.setTransportFactory)({
|
|
@@ -279620,7 +279620,7 @@ var init_natsEventBus = __esm({
|
|
|
279620
279620
|
});
|
|
279621
279621
|
|
|
279622
279622
|
// ../../packages/backend/src/runtimes/gybackend/startGyBackend.ts
|
|
279623
|
-
import
|
|
279623
|
+
import path30 from "node:path";
|
|
279624
279624
|
import process3 from "node:process";
|
|
279625
279625
|
|
|
279626
279626
|
// ../../packages/backend/src/services/TerminalService.ts
|
|
@@ -292292,8 +292292,8 @@ function shallowCopy(obj) {
|
|
|
292292
292292
|
}
|
|
292293
292293
|
function replaceSecrets(root, secretsMap) {
|
|
292294
292294
|
const result = shallowCopy(root);
|
|
292295
|
-
for (const [
|
|
292296
|
-
const [last, ...partsReverse] =
|
|
292295
|
+
for (const [path31, secretId] of Object.entries(secretsMap)) {
|
|
292296
|
+
const [last, ...partsReverse] = path31.split(".").reverse();
|
|
292297
292297
|
let current = result;
|
|
292298
292298
|
for (const part of partsReverse.reverse()) {
|
|
292299
292299
|
if (current[part] === void 0) break;
|
|
@@ -297357,9 +297357,9 @@ var Client2 = class _Client {
|
|
|
297357
297357
|
}
|
|
297358
297358
|
return headers;
|
|
297359
297359
|
}
|
|
297360
|
-
_getPlatformEndpointPath(
|
|
297360
|
+
_getPlatformEndpointPath(path31) {
|
|
297361
297361
|
const needsV1Prefix = this.apiUrl.slice(-3) !== "/v1" && this.apiUrl.slice(-4) !== "/v1/";
|
|
297362
|
-
return needsV1Prefix ? `/v1/platform/${
|
|
297362
|
+
return needsV1Prefix ? `/v1/platform/${path31}` : `/platform/${path31}`;
|
|
297363
297363
|
}
|
|
297364
297364
|
async processInputs(inputs) {
|
|
297365
297365
|
if (this.hideInputs === false) {
|
|
@@ -297395,9 +297395,9 @@ var Client2 = class _Client {
|
|
|
297395
297395
|
}
|
|
297396
297396
|
return runParams;
|
|
297397
297397
|
}
|
|
297398
|
-
async _getResponse(
|
|
297398
|
+
async _getResponse(path31, queryParams) {
|
|
297399
297399
|
const paramsString = queryParams?.toString() ?? "";
|
|
297400
|
-
const url2 = `${this.apiUrl}${
|
|
297400
|
+
const url2 = `${this.apiUrl}${path31}?${paramsString}`;
|
|
297401
297401
|
const response = await this.caller.call(async () => {
|
|
297402
297402
|
const res = await this._fetch(url2, {
|
|
297403
297403
|
method: "GET",
|
|
@@ -297405,22 +297405,22 @@ var Client2 = class _Client {
|
|
|
297405
297405
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
297406
297406
|
...this.fetchOptions
|
|
297407
297407
|
});
|
|
297408
|
-
await raiseForStatus(res, `fetch ${
|
|
297408
|
+
await raiseForStatus(res, `fetch ${path31}`);
|
|
297409
297409
|
return res;
|
|
297410
297410
|
});
|
|
297411
297411
|
return response;
|
|
297412
297412
|
}
|
|
297413
|
-
async _get(
|
|
297414
|
-
const response = await this._getResponse(
|
|
297413
|
+
async _get(path31, queryParams) {
|
|
297414
|
+
const response = await this._getResponse(path31, queryParams);
|
|
297415
297415
|
return response.json();
|
|
297416
297416
|
}
|
|
297417
|
-
async *_getPaginated(
|
|
297417
|
+
async *_getPaginated(path31, queryParams = new URLSearchParams(), transform2) {
|
|
297418
297418
|
let offset = Number(queryParams.get("offset")) || 0;
|
|
297419
297419
|
const limit2 = Number(queryParams.get("limit")) || 100;
|
|
297420
297420
|
while (true) {
|
|
297421
297421
|
queryParams.set("offset", String(offset));
|
|
297422
297422
|
queryParams.set("limit", String(limit2));
|
|
297423
|
-
const url2 = `${this.apiUrl}${
|
|
297423
|
+
const url2 = `${this.apiUrl}${path31}?${queryParams}`;
|
|
297424
297424
|
const response = await this.caller.call(async () => {
|
|
297425
297425
|
const res = await this._fetch(url2, {
|
|
297426
297426
|
method: "GET",
|
|
@@ -297428,7 +297428,7 @@ var Client2 = class _Client {
|
|
|
297428
297428
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
297429
297429
|
...this.fetchOptions
|
|
297430
297430
|
});
|
|
297431
|
-
await raiseForStatus(res, `fetch ${
|
|
297431
|
+
await raiseForStatus(res, `fetch ${path31}`);
|
|
297432
297432
|
return res;
|
|
297433
297433
|
});
|
|
297434
297434
|
const items = transform2 ? transform2(await response.json()) : await response.json();
|
|
@@ -297442,19 +297442,19 @@ var Client2 = class _Client {
|
|
|
297442
297442
|
offset += items.length;
|
|
297443
297443
|
}
|
|
297444
297444
|
}
|
|
297445
|
-
async *_getCursorPaginatedList(
|
|
297445
|
+
async *_getCursorPaginatedList(path31, body = null, requestMethod = "POST", dataKey = "runs") {
|
|
297446
297446
|
const bodyParams = body ? { ...body } : {};
|
|
297447
297447
|
while (true) {
|
|
297448
297448
|
const body2 = JSON.stringify(bodyParams);
|
|
297449
297449
|
const response = await this.caller.call(async () => {
|
|
297450
|
-
const res = await this._fetch(`${this.apiUrl}${
|
|
297450
|
+
const res = await this._fetch(`${this.apiUrl}${path31}`, {
|
|
297451
297451
|
method: requestMethod,
|
|
297452
297452
|
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
297453
297453
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
297454
297454
|
...this.fetchOptions,
|
|
297455
297455
|
body: body2
|
|
297456
297456
|
});
|
|
297457
|
-
await raiseForStatus(res, `fetch ${
|
|
297457
|
+
await raiseForStatus(res, `fetch ${path31}`);
|
|
297458
297458
|
return res;
|
|
297459
297459
|
});
|
|
297460
297460
|
const responseBody = await response.json();
|
|
@@ -298383,8 +298383,8 @@ Context: ${context2}`);
|
|
|
298383
298383
|
limit: Number(limit2) || 100
|
|
298384
298384
|
};
|
|
298385
298385
|
let currentOffset = Number(offset) || 0;
|
|
298386
|
-
const
|
|
298387
|
-
const url2 = `${this.apiUrl}${
|
|
298386
|
+
const path31 = "/runs/group";
|
|
298387
|
+
const url2 = `${this.apiUrl}${path31}`;
|
|
298388
298388
|
while (true) {
|
|
298389
298389
|
const currentBody = {
|
|
298390
298390
|
...baseBody,
|
|
@@ -298400,7 +298400,7 @@ Context: ${context2}`);
|
|
|
298400
298400
|
...this.fetchOptions,
|
|
298401
298401
|
body
|
|
298402
298402
|
});
|
|
298403
|
-
await raiseForStatus(res, `Failed to fetch ${
|
|
298403
|
+
await raiseForStatus(res, `Failed to fetch ${path31}`);
|
|
298404
298404
|
return res;
|
|
298405
298405
|
});
|
|
298406
298406
|
const items = await response.json();
|
|
@@ -298717,20 +298717,20 @@ Message: ${Array.isArray(result.detail) ? result.detail.join("\n") : "Unspecifie
|
|
|
298717
298717
|
return result;
|
|
298718
298718
|
}
|
|
298719
298719
|
async hasProject({ projectId, projectName }) {
|
|
298720
|
-
let
|
|
298720
|
+
let path31 = "/sessions";
|
|
298721
298721
|
const params = new URLSearchParams();
|
|
298722
298722
|
if (projectId !== void 0 && projectName !== void 0) {
|
|
298723
298723
|
throw new Error("Must provide either projectName or projectId, not both");
|
|
298724
298724
|
} else if (projectId !== void 0) {
|
|
298725
298725
|
assertUuid(projectId);
|
|
298726
|
-
|
|
298726
|
+
path31 += `/${projectId}`;
|
|
298727
298727
|
} else if (projectName !== void 0) {
|
|
298728
298728
|
params.append("name", projectName);
|
|
298729
298729
|
} else {
|
|
298730
298730
|
throw new Error("Must provide projectName or projectId");
|
|
298731
298731
|
}
|
|
298732
298732
|
const response = await this.caller.call(async () => {
|
|
298733
|
-
const res = await this._fetch(`${this.apiUrl}${
|
|
298733
|
+
const res = await this._fetch(`${this.apiUrl}${path31}?${params}`, {
|
|
298734
298734
|
method: "GET",
|
|
298735
298735
|
headers: this.headers,
|
|
298736
298736
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
@@ -298753,13 +298753,13 @@ Message: ${Array.isArray(result.detail) ? result.detail.join("\n") : "Unspecifie
|
|
|
298753
298753
|
}
|
|
298754
298754
|
}
|
|
298755
298755
|
async readProject({ projectId, projectName, includeStats }) {
|
|
298756
|
-
let
|
|
298756
|
+
let path31 = "/sessions";
|
|
298757
298757
|
const params = new URLSearchParams();
|
|
298758
298758
|
if (projectId !== void 0 && projectName !== void 0) {
|
|
298759
298759
|
throw new Error("Must provide either projectName or projectId, not both");
|
|
298760
298760
|
} else if (projectId !== void 0) {
|
|
298761
298761
|
assertUuid(projectId);
|
|
298762
|
-
|
|
298762
|
+
path31 += `/${projectId}`;
|
|
298763
298763
|
} else if (projectName !== void 0) {
|
|
298764
298764
|
params.append("name", projectName);
|
|
298765
298765
|
} else {
|
|
@@ -298768,7 +298768,7 @@ Message: ${Array.isArray(result.detail) ? result.detail.join("\n") : "Unspecifie
|
|
|
298768
298768
|
if (includeStats !== void 0) {
|
|
298769
298769
|
params.append("include_stats", includeStats.toString());
|
|
298770
298770
|
}
|
|
298771
|
-
const response = await this._get(
|
|
298771
|
+
const response = await this._get(path31, params);
|
|
298772
298772
|
let result;
|
|
298773
298773
|
if (Array.isArray(response)) {
|
|
298774
298774
|
if (response.length === 0) {
|
|
@@ -298931,19 +298931,19 @@ Message: ${Array.isArray(result.detail) ? result.detail.join("\n") : "Unspecifie
|
|
|
298931
298931
|
return result;
|
|
298932
298932
|
}
|
|
298933
298933
|
async readDataset({ datasetId, datasetName }) {
|
|
298934
|
-
let
|
|
298934
|
+
let path31 = "/datasets";
|
|
298935
298935
|
const params = new URLSearchParams({ limit: "1" });
|
|
298936
298936
|
if (datasetId && datasetName) {
|
|
298937
298937
|
throw new Error("Must provide either datasetName or datasetId, not both");
|
|
298938
298938
|
} else if (datasetId) {
|
|
298939
298939
|
assertUuid(datasetId);
|
|
298940
|
-
|
|
298940
|
+
path31 += `/${datasetId}`;
|
|
298941
298941
|
} else if (datasetName) {
|
|
298942
298942
|
params.append("name", datasetName);
|
|
298943
298943
|
} else {
|
|
298944
298944
|
throw new Error("Must provide datasetName or datasetId");
|
|
298945
298945
|
}
|
|
298946
|
-
const response = await this._get(
|
|
298946
|
+
const response = await this._get(path31, params);
|
|
298947
298947
|
let result;
|
|
298948
298948
|
if (Array.isArray(response)) {
|
|
298949
298949
|
if (response.length === 0) {
|
|
@@ -298987,20 +298987,20 @@ Message: ${Array.isArray(result.detail) ? result.detail.join("\n") : "Unspecifie
|
|
|
298987
298987
|
return response;
|
|
298988
298988
|
}
|
|
298989
298989
|
async readDatasetOpenaiFinetuning({ datasetId, datasetName }) {
|
|
298990
|
-
const
|
|
298990
|
+
const path31 = "/datasets";
|
|
298991
298991
|
if (datasetId !== void 0) {
|
|
298992
298992
|
} else if (datasetName !== void 0) {
|
|
298993
298993
|
datasetId = (await this.readDataset({ datasetName })).id;
|
|
298994
298994
|
} else {
|
|
298995
298995
|
throw new Error("Must provide either datasetName or datasetId");
|
|
298996
298996
|
}
|
|
298997
|
-
const response = await this._getResponse(`${
|
|
298997
|
+
const response = await this._getResponse(`${path31}/${datasetId}/openai_ft`);
|
|
298998
298998
|
const datasetText = await response.text();
|
|
298999
298999
|
const dataset = datasetText.trim().split("\n").map((line) => JSON.parse(line));
|
|
299000
299000
|
return dataset;
|
|
299001
299001
|
}
|
|
299002
299002
|
async *listDatasets({ limit: limit2 = 100, offset = 0, datasetIds, datasetName, datasetNameContains, metadata } = {}) {
|
|
299003
|
-
const
|
|
299003
|
+
const path31 = "/datasets";
|
|
299004
299004
|
const params = new URLSearchParams({
|
|
299005
299005
|
limit: limit2.toString(),
|
|
299006
299006
|
offset: offset.toString()
|
|
@@ -299019,7 +299019,7 @@ Message: ${Array.isArray(result.detail) ? result.detail.join("\n") : "Unspecifie
|
|
|
299019
299019
|
if (metadata !== void 0) {
|
|
299020
299020
|
params.append("metadata", JSON.stringify(metadata));
|
|
299021
299021
|
}
|
|
299022
|
-
for await (const datasets of this._getPaginated(
|
|
299022
|
+
for await (const datasets of this._getPaginated(path31, params)) {
|
|
299023
299023
|
yield* datasets;
|
|
299024
299024
|
}
|
|
299025
299025
|
}
|
|
@@ -299088,7 +299088,7 @@ Message: ${Array.isArray(result.detail) ? result.detail.join("\n") : "Unspecifie
|
|
|
299088
299088
|
});
|
|
299089
299089
|
}
|
|
299090
299090
|
async deleteDataset({ datasetId, datasetName }) {
|
|
299091
|
-
let
|
|
299091
|
+
let path31 = "/datasets";
|
|
299092
299092
|
let datasetId_ = datasetId;
|
|
299093
299093
|
if (datasetId !== void 0 && datasetName !== void 0) {
|
|
299094
299094
|
throw new Error("Must provide either datasetName or datasetId, not both");
|
|
@@ -299098,18 +299098,18 @@ Message: ${Array.isArray(result.detail) ? result.detail.join("\n") : "Unspecifie
|
|
|
299098
299098
|
}
|
|
299099
299099
|
if (datasetId_ !== void 0) {
|
|
299100
299100
|
assertUuid(datasetId_);
|
|
299101
|
-
|
|
299101
|
+
path31 += `/${datasetId_}`;
|
|
299102
299102
|
} else {
|
|
299103
299103
|
throw new Error("Must provide datasetName or datasetId");
|
|
299104
299104
|
}
|
|
299105
299105
|
await this.caller.call(async () => {
|
|
299106
|
-
const res = await this._fetch(this.apiUrl +
|
|
299106
|
+
const res = await this._fetch(this.apiUrl + path31, {
|
|
299107
299107
|
method: "DELETE",
|
|
299108
299108
|
headers: this.headers,
|
|
299109
299109
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
299110
299110
|
...this.fetchOptions
|
|
299111
299111
|
});
|
|
299112
|
-
await raiseForStatus(res, `delete ${
|
|
299112
|
+
await raiseForStatus(res, `delete ${path31}`, true);
|
|
299113
299113
|
return res;
|
|
299114
299114
|
});
|
|
299115
299115
|
}
|
|
@@ -299300,8 +299300,8 @@ Message: ${Array.isArray(result.detail) ? result.detail.join("\n") : "Unspecifie
|
|
|
299300
299300
|
}
|
|
299301
299301
|
async readExample(exampleId) {
|
|
299302
299302
|
assertUuid(exampleId);
|
|
299303
|
-
const
|
|
299304
|
-
const rawExample = await this._get(
|
|
299303
|
+
const path31 = `/examples/${exampleId}`;
|
|
299304
|
+
const rawExample = await this._get(path31);
|
|
299305
299305
|
const { attachment_urls, ...rest } = rawExample;
|
|
299306
299306
|
const example = rest;
|
|
299307
299307
|
if (attachment_urls) {
|
|
@@ -299384,15 +299384,15 @@ Message: ${Array.isArray(result.detail) ? result.detail.join("\n") : "Unspecifie
|
|
|
299384
299384
|
}
|
|
299385
299385
|
async deleteExample(exampleId) {
|
|
299386
299386
|
assertUuid(exampleId);
|
|
299387
|
-
const
|
|
299387
|
+
const path31 = `/examples/${exampleId}`;
|
|
299388
299388
|
await this.caller.call(async () => {
|
|
299389
|
-
const res = await this._fetch(this.apiUrl +
|
|
299389
|
+
const res = await this._fetch(this.apiUrl + path31, {
|
|
299390
299390
|
method: "DELETE",
|
|
299391
299391
|
headers: this.headers,
|
|
299392
299392
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
299393
299393
|
...this.fetchOptions
|
|
299394
299394
|
});
|
|
299395
|
-
await raiseForStatus(res, `delete ${
|
|
299395
|
+
await raiseForStatus(res, `delete ${path31}`, true);
|
|
299396
299396
|
return res;
|
|
299397
299397
|
});
|
|
299398
299398
|
}
|
|
@@ -299405,9 +299405,9 @@ Message: ${Array.isArray(result.detail) ? result.detail.join("\n") : "Unspecifie
|
|
|
299405
299405
|
async deleteExamples(exampleIds, options) {
|
|
299406
299406
|
exampleIds.forEach((id) => assertUuid(id));
|
|
299407
299407
|
if (options?.hardDelete) {
|
|
299408
|
-
const
|
|
299408
|
+
const path31 = this._getPlatformEndpointPath("datasets/examples/delete");
|
|
299409
299409
|
await this.caller.call(async () => {
|
|
299410
|
-
const res = await this._fetch(`${this.apiUrl}${
|
|
299410
|
+
const res = await this._fetch(`${this.apiUrl}${path31}`, {
|
|
299411
299411
|
method: "POST",
|
|
299412
299412
|
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
299413
299413
|
body: JSON.stringify({
|
|
@@ -299641,21 +299641,21 @@ Message: ${Array.isArray(result.detail) ? result.detail.join("\n") : "Unspecifie
|
|
|
299641
299641
|
}
|
|
299642
299642
|
async readFeedback(feedbackId) {
|
|
299643
299643
|
assertUuid(feedbackId);
|
|
299644
|
-
const
|
|
299645
|
-
const response = await this._get(
|
|
299644
|
+
const path31 = `/feedback/${feedbackId}`;
|
|
299645
|
+
const response = await this._get(path31);
|
|
299646
299646
|
return response;
|
|
299647
299647
|
}
|
|
299648
299648
|
async deleteFeedback(feedbackId) {
|
|
299649
299649
|
assertUuid(feedbackId);
|
|
299650
|
-
const
|
|
299650
|
+
const path31 = `/feedback/${feedbackId}`;
|
|
299651
299651
|
await this.caller.call(async () => {
|
|
299652
|
-
const res = await this._fetch(this.apiUrl +
|
|
299652
|
+
const res = await this._fetch(this.apiUrl + path31, {
|
|
299653
299653
|
method: "DELETE",
|
|
299654
299654
|
headers: this.headers,
|
|
299655
299655
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
299656
299656
|
...this.fetchOptions
|
|
299657
299657
|
});
|
|
299658
|
-
await raiseForStatus(res, `delete ${
|
|
299658
|
+
await raiseForStatus(res, `delete ${path31}`, true);
|
|
299659
299659
|
return res;
|
|
299660
299660
|
});
|
|
299661
299661
|
}
|
|
@@ -303251,12 +303251,12 @@ function isInteger(str3) {
|
|
|
303251
303251
|
}
|
|
303252
303252
|
return true;
|
|
303253
303253
|
}
|
|
303254
|
-
function escapePathComponent(
|
|
303255
|
-
if (
|
|
303256
|
-
return
|
|
303254
|
+
function escapePathComponent(path31) {
|
|
303255
|
+
if (path31.indexOf("/") === -1 && path31.indexOf("~") === -1) return path31;
|
|
303256
|
+
return path31.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
303257
303257
|
}
|
|
303258
|
-
function unescapePathComponent(
|
|
303259
|
-
return
|
|
303258
|
+
function unescapePathComponent(path31) {
|
|
303259
|
+
return path31.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
303260
303260
|
}
|
|
303261
303261
|
function hasUndefined(obj) {
|
|
303262
303262
|
if (obj === void 0) return true;
|
|
@@ -303450,8 +303450,8 @@ function applyOperation(document2, operation, validateOperation = false, mutateD
|
|
|
303450
303450
|
else return returnValue;
|
|
303451
303451
|
} else {
|
|
303452
303452
|
if (!mutateDocument) document2 = _deepClone(document2);
|
|
303453
|
-
const
|
|
303454
|
-
const keys =
|
|
303453
|
+
const path31 = operation.path || "";
|
|
303454
|
+
const keys = path31.split("/");
|
|
303455
303455
|
let obj = document2;
|
|
303456
303456
|
let t = 1;
|
|
303457
303457
|
let len = keys.length;
|
|
@@ -303574,7 +303574,7 @@ function _areEquals(a, b) {
|
|
|
303574
303574
|
}
|
|
303575
303575
|
|
|
303576
303576
|
// ../../node_modules/@langchain/core/dist/utils/fast-json-patch/src/duplex.js
|
|
303577
|
-
function _generate(mirror, obj, patches,
|
|
303577
|
+
function _generate(mirror, obj, patches, path31, invertible) {
|
|
303578
303578
|
if (obj === mirror) return;
|
|
303579
303579
|
if (typeof obj.toJSON === "function") obj = obj.toJSON();
|
|
303580
303580
|
var newKeys = _objectKeys(obj);
|
|
@@ -303586,40 +303586,40 @@ function _generate(mirror, obj, patches, path30, invertible) {
|
|
|
303586
303586
|
var oldVal = mirror[key];
|
|
303587
303587
|
if (hasOwnProperty(obj, key) && !(obj[key] === void 0 && oldVal !== void 0 && Array.isArray(obj) === false)) {
|
|
303588
303588
|
var newVal = obj[key];
|
|
303589
|
-
if (typeof oldVal == "object" && oldVal != null && typeof newVal == "object" && newVal != null && Array.isArray(oldVal) === Array.isArray(newVal)) _generate(oldVal, newVal, patches,
|
|
303589
|
+
if (typeof oldVal == "object" && oldVal != null && typeof newVal == "object" && newVal != null && Array.isArray(oldVal) === Array.isArray(newVal)) _generate(oldVal, newVal, patches, path31 + "/" + escapePathComponent(key), invertible);
|
|
303590
303590
|
else if (oldVal !== newVal) {
|
|
303591
303591
|
changed = true;
|
|
303592
303592
|
if (invertible) patches.push({
|
|
303593
303593
|
op: "test",
|
|
303594
|
-
path:
|
|
303594
|
+
path: path31 + "/" + escapePathComponent(key),
|
|
303595
303595
|
value: _deepClone(oldVal)
|
|
303596
303596
|
});
|
|
303597
303597
|
patches.push({
|
|
303598
303598
|
op: "replace",
|
|
303599
|
-
path:
|
|
303599
|
+
path: path31 + "/" + escapePathComponent(key),
|
|
303600
303600
|
value: _deepClone(newVal)
|
|
303601
303601
|
});
|
|
303602
303602
|
}
|
|
303603
303603
|
} else if (Array.isArray(mirror) === Array.isArray(obj)) {
|
|
303604
303604
|
if (invertible) patches.push({
|
|
303605
303605
|
op: "test",
|
|
303606
|
-
path:
|
|
303606
|
+
path: path31 + "/" + escapePathComponent(key),
|
|
303607
303607
|
value: _deepClone(oldVal)
|
|
303608
303608
|
});
|
|
303609
303609
|
patches.push({
|
|
303610
303610
|
op: "remove",
|
|
303611
|
-
path:
|
|
303611
|
+
path: path31 + "/" + escapePathComponent(key)
|
|
303612
303612
|
});
|
|
303613
303613
|
deleted = true;
|
|
303614
303614
|
} else {
|
|
303615
303615
|
if (invertible) patches.push({
|
|
303616
303616
|
op: "test",
|
|
303617
|
-
path:
|
|
303617
|
+
path: path31,
|
|
303618
303618
|
value: mirror
|
|
303619
303619
|
});
|
|
303620
303620
|
patches.push({
|
|
303621
303621
|
op: "replace",
|
|
303622
|
-
path:
|
|
303622
|
+
path: path31,
|
|
303623
303623
|
value: obj
|
|
303624
303624
|
});
|
|
303625
303625
|
changed = true;
|
|
@@ -303630,7 +303630,7 @@ function _generate(mirror, obj, patches, path30, invertible) {
|
|
|
303630
303630
|
var key = newKeys[t];
|
|
303631
303631
|
if (!hasOwnProperty(mirror, key) && obj[key] !== void 0) patches.push({
|
|
303632
303632
|
op: "add",
|
|
303633
|
-
path:
|
|
303633
|
+
path: path31 + "/" + escapePathComponent(key),
|
|
303634
303634
|
value: _deepClone(obj[key])
|
|
303635
303635
|
});
|
|
303636
303636
|
}
|
|
@@ -305016,10 +305016,10 @@ function assignProp(target, prop, value) {
|
|
|
305016
305016
|
configurable: true
|
|
305017
305017
|
});
|
|
305018
305018
|
}
|
|
305019
|
-
function getElementAtPath(obj,
|
|
305020
|
-
if (!
|
|
305019
|
+
function getElementAtPath(obj, path31) {
|
|
305020
|
+
if (!path31)
|
|
305021
305021
|
return obj;
|
|
305022
|
-
return
|
|
305022
|
+
return path31.reduce((acc, key) => acc?.[key], obj);
|
|
305023
305023
|
}
|
|
305024
305024
|
function promiseAllObject(promisesObj) {
|
|
305025
305025
|
const keys = Object.keys(promisesObj);
|
|
@@ -305339,11 +305339,11 @@ function aborted(x, startIndex = 0) {
|
|
|
305339
305339
|
}
|
|
305340
305340
|
return false;
|
|
305341
305341
|
}
|
|
305342
|
-
function prefixIssues(
|
|
305342
|
+
function prefixIssues(path31, issues) {
|
|
305343
305343
|
return issues.map((iss) => {
|
|
305344
305344
|
var _a3;
|
|
305345
305345
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
305346
|
-
iss.path.unshift(
|
|
305346
|
+
iss.path.unshift(path31);
|
|
305347
305347
|
return iss;
|
|
305348
305348
|
});
|
|
305349
305349
|
}
|
|
@@ -305480,7 +305480,7 @@ function treeifyError(error40, _mapper) {
|
|
|
305480
305480
|
return issue2.message;
|
|
305481
305481
|
};
|
|
305482
305482
|
const result = { errors: [] };
|
|
305483
|
-
const processError = (error41,
|
|
305483
|
+
const processError = (error41, path31 = []) => {
|
|
305484
305484
|
var _a3, _b;
|
|
305485
305485
|
for (const issue2 of error41.issues) {
|
|
305486
305486
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
@@ -305490,7 +305490,7 @@ function treeifyError(error40, _mapper) {
|
|
|
305490
305490
|
} else if (issue2.code === "invalid_element") {
|
|
305491
305491
|
processError({ issues: issue2.issues }, issue2.path);
|
|
305492
305492
|
} else {
|
|
305493
|
-
const fullpath = [...
|
|
305493
|
+
const fullpath = [...path31, ...issue2.path];
|
|
305494
305494
|
if (fullpath.length === 0) {
|
|
305495
305495
|
result.errors.push(mapper(issue2));
|
|
305496
305496
|
continue;
|
|
@@ -305520,9 +305520,9 @@ function treeifyError(error40, _mapper) {
|
|
|
305520
305520
|
processError(error40);
|
|
305521
305521
|
return result;
|
|
305522
305522
|
}
|
|
305523
|
-
function toDotPath(
|
|
305523
|
+
function toDotPath(path31) {
|
|
305524
305524
|
const segs = [];
|
|
305525
|
-
for (const seg of
|
|
305525
|
+
for (const seg of path31) {
|
|
305526
305526
|
if (typeof seg === "number")
|
|
305527
305527
|
segs.push(`[${seg}]`);
|
|
305528
305528
|
else if (typeof seg === "symbol")
|
|
@@ -315425,8 +315425,8 @@ function getErrorMap() {
|
|
|
315425
315425
|
|
|
315426
315426
|
// ../../node_modules/zod/v3/helpers/parseUtil.js
|
|
315427
315427
|
var makeIssue = (params) => {
|
|
315428
|
-
const { data, path:
|
|
315429
|
-
const fullPath = [...
|
|
315428
|
+
const { data, path: path31, errorMaps, issueData } = params;
|
|
315429
|
+
const fullPath = [...path31, ...issueData.path || []];
|
|
315430
315430
|
const fullIssue = {
|
|
315431
315431
|
...issueData,
|
|
315432
315432
|
path: fullPath
|
|
@@ -315542,11 +315542,11 @@ var errorUtil;
|
|
|
315542
315542
|
|
|
315543
315543
|
// ../../node_modules/zod/v3/types.js
|
|
315544
315544
|
var ParseInputLazyPath = class {
|
|
315545
|
-
constructor(parent, value,
|
|
315545
|
+
constructor(parent, value, path31, key) {
|
|
315546
315546
|
this._cachedPath = [];
|
|
315547
315547
|
this.parent = parent;
|
|
315548
315548
|
this.data = value;
|
|
315549
|
-
this._path =
|
|
315549
|
+
this._path = path31;
|
|
315550
315550
|
this._key = key;
|
|
315551
315551
|
}
|
|
315552
315552
|
get path() {
|
|
@@ -321807,10 +321807,10 @@ var Runnable = class extends Serializable {
|
|
|
321807
321807
|
}
|
|
321808
321808
|
const paths = log.ops.filter((op) => op.path.startsWith("/logs/")).map((op) => op.path.split("/")[2]);
|
|
321809
321809
|
const dedupedPaths = [...new Set(paths)];
|
|
321810
|
-
for (const
|
|
321810
|
+
for (const path31 of dedupedPaths) {
|
|
321811
321811
|
let eventType;
|
|
321812
321812
|
let data = {};
|
|
321813
|
-
const logEntry = runLog.state.logs[
|
|
321813
|
+
const logEntry = runLog.state.logs[path31];
|
|
321814
321814
|
if (logEntry.end_time === void 0) if (logEntry.streamed_output.length > 0) eventType = "stream";
|
|
321815
321815
|
else eventType = "start";
|
|
321816
321816
|
else eventType = "end";
|
|
@@ -333875,13 +333875,13 @@ function combineAliasesAndInvert(constructor) {
|
|
|
333875
333875
|
}, {});
|
|
333876
333876
|
}
|
|
333877
333877
|
async function reviver(value) {
|
|
333878
|
-
const { optionalImportsMap, optionalImportEntrypoints: optionalImportEntrypoints$1, importMap, secretsMap, secretsFromEnv, path:
|
|
333879
|
-
const pathStr =
|
|
333878
|
+
const { optionalImportsMap, optionalImportEntrypoints: optionalImportEntrypoints$1, importMap, secretsMap, secretsFromEnv, path: path31, depth, maxDepth } = this;
|
|
333879
|
+
const pathStr = path31.join(".");
|
|
333880
333880
|
if (depth > maxDepth) throw new Error(`Maximum recursion depth (${maxDepth}) exceeded during deserialization. This may indicate a malicious payload or you may need to increase maxDepth.`);
|
|
333881
333881
|
if (typeof value !== "object" || value == null) return value;
|
|
333882
333882
|
if (Array.isArray(value)) return Promise.all(value.map((v, i) => reviver.call({
|
|
333883
333883
|
...this,
|
|
333884
|
-
path: [...
|
|
333884
|
+
path: [...path31, `${i}`],
|
|
333885
333885
|
depth: depth + 1
|
|
333886
333886
|
}, v)));
|
|
333887
333887
|
const record2 = value;
|
|
@@ -333936,7 +333936,7 @@ async function reviver(value) {
|
|
|
333936
333936
|
if (typeof builder !== "function") throw new Error(`Invalid identifer: ${pathStr} -> ${str3}`);
|
|
333937
333937
|
const kwargs = await reviver.call({
|
|
333938
333938
|
...this,
|
|
333939
|
-
path: [...
|
|
333939
|
+
path: [...path31, "kwargs"],
|
|
333940
333940
|
depth: depth + 1
|
|
333941
333941
|
}, serialized.kwargs);
|
|
333942
333942
|
const instance = new builder(mapKeys(kwargs, keyFromJson, combineAliasesAndInvert(builder)));
|
|
@@ -333946,7 +333946,7 @@ async function reviver(value) {
|
|
|
333946
333946
|
const result = {};
|
|
333947
333947
|
for (const [key, val] of Object.entries(record2)) result[key] = await reviver.call({
|
|
333948
333948
|
...this,
|
|
333949
|
-
path: [...
|
|
333949
|
+
path: [...path31, key],
|
|
333950
333950
|
depth: depth + 1
|
|
333951
333951
|
}, val);
|
|
333952
333952
|
return result;
|
|
@@ -339074,10 +339074,10 @@ var Graph$1 = class {
|
|
|
339074
339074
|
this.edges.add([startKey, endKey]);
|
|
339075
339075
|
return this;
|
|
339076
339076
|
}
|
|
339077
|
-
addConditionalEdges(source,
|
|
339077
|
+
addConditionalEdges(source, path31, pathMap) {
|
|
339078
339078
|
const options = typeof source === "object" ? source : {
|
|
339079
339079
|
source,
|
|
339080
|
-
path:
|
|
339080
|
+
path: path31,
|
|
339081
339081
|
pathMap
|
|
339082
339082
|
};
|
|
339083
339083
|
this.warnIfCompiled("Adding an edge to a graph that has already been compiled. This will not be reflected in the compiled graph.");
|
|
@@ -340476,16 +340476,16 @@ var Diff = class {
|
|
|
340476
340476
|
}
|
|
340477
340477
|
}
|
|
340478
340478
|
}
|
|
340479
|
-
addToPath(
|
|
340480
|
-
const last =
|
|
340479
|
+
addToPath(path31, added, removed, oldPosInc, options) {
|
|
340480
|
+
const last = path31.lastComponent;
|
|
340481
340481
|
if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
|
|
340482
340482
|
return {
|
|
340483
|
-
oldPos:
|
|
340483
|
+
oldPos: path31.oldPos + oldPosInc,
|
|
340484
340484
|
lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
|
|
340485
340485
|
};
|
|
340486
340486
|
} else {
|
|
340487
340487
|
return {
|
|
340488
|
-
oldPos:
|
|
340488
|
+
oldPos: path31.oldPos + oldPosInc,
|
|
340489
340489
|
lastComponent: { count: 1, added, removed, previousComponent: last }
|
|
340490
340490
|
};
|
|
340491
340491
|
}
|
|
@@ -348348,12 +348348,12 @@ function encodeURIPath(str3) {
|
|
|
348348
348348
|
return str3.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g, encodeURIComponent);
|
|
348349
348349
|
}
|
|
348350
348350
|
var EMPTY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.create(null));
|
|
348351
|
-
var createPathTagFunction = (pathEncoder = encodeURIPath) => function
|
|
348351
|
+
var createPathTagFunction = (pathEncoder = encodeURIPath) => function path31(statics, ...params) {
|
|
348352
348352
|
if (statics.length === 1)
|
|
348353
348353
|
return statics[0];
|
|
348354
348354
|
let postPath = false;
|
|
348355
348355
|
const invalidSegments = [];
|
|
348356
|
-
const
|
|
348356
|
+
const path32 = statics.reduce((previousValue, currentValue, index2) => {
|
|
348357
348357
|
if (/[?#]/.test(currentValue)) {
|
|
348358
348358
|
postPath = true;
|
|
348359
348359
|
}
|
|
@@ -348370,7 +348370,7 @@ var createPathTagFunction = (pathEncoder = encodeURIPath) => function path30(sta
|
|
|
348370
348370
|
}
|
|
348371
348371
|
return previousValue + currentValue + (index2 === params.length ? "" : encoded);
|
|
348372
348372
|
}, "");
|
|
348373
|
-
const pathOnly =
|
|
348373
|
+
const pathOnly = path32.split(/[?#]/, 1)[0];
|
|
348374
348374
|
const invalidSegmentPattern = /(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi;
|
|
348375
348375
|
let match;
|
|
348376
348376
|
while ((match = invalidSegmentPattern.exec(pathOnly)) !== null) {
|
|
@@ -348391,10 +348391,10 @@ var createPathTagFunction = (pathEncoder = encodeURIPath) => function path30(sta
|
|
|
348391
348391
|
}, "");
|
|
348392
348392
|
throw new OpenAIError(`Path parameters result in path with invalid segments:
|
|
348393
348393
|
${invalidSegments.map((e) => e.error).join("\n")}
|
|
348394
|
-
${
|
|
348394
|
+
${path32}
|
|
348395
348395
|
${underline}`);
|
|
348396
348396
|
}
|
|
348397
|
-
return
|
|
348397
|
+
return path32;
|
|
348398
348398
|
};
|
|
348399
348399
|
var path8 = /* @__PURE__ */ createPathTagFunction(encodeURIPath);
|
|
348400
348400
|
|
|
@@ -353211,9 +353211,9 @@ var OpenAI = class {
|
|
|
353211
353211
|
this.apiKey = token;
|
|
353212
353212
|
return true;
|
|
353213
353213
|
}
|
|
353214
|
-
buildURL(
|
|
353214
|
+
buildURL(path31, query, defaultBaseURL) {
|
|
353215
353215
|
const baseURL = !__classPrivateFieldGet(this, _OpenAI_instances, "m", _OpenAI_baseURLOverridden).call(this) && defaultBaseURL || this.baseURL;
|
|
353216
|
-
const url2 = isAbsoluteURL(
|
|
353216
|
+
const url2 = isAbsoluteURL(path31) ? new URL(path31) : new URL(baseURL + (baseURL.endsWith("/") && path31.startsWith("/") ? path31.slice(1) : path31));
|
|
353217
353217
|
const defaultQuery = this.defaultQuery();
|
|
353218
353218
|
if (!isEmptyObj(defaultQuery)) {
|
|
353219
353219
|
query = { ...defaultQuery, ...query };
|
|
@@ -353237,24 +353237,24 @@ var OpenAI = class {
|
|
|
353237
353237
|
*/
|
|
353238
353238
|
async prepareRequest(request, { url: url2, options }) {
|
|
353239
353239
|
}
|
|
353240
|
-
get(
|
|
353241
|
-
return this.methodRequest("get",
|
|
353240
|
+
get(path31, opts) {
|
|
353241
|
+
return this.methodRequest("get", path31, opts);
|
|
353242
353242
|
}
|
|
353243
|
-
post(
|
|
353244
|
-
return this.methodRequest("post",
|
|
353243
|
+
post(path31, opts) {
|
|
353244
|
+
return this.methodRequest("post", path31, opts);
|
|
353245
353245
|
}
|
|
353246
|
-
patch(
|
|
353247
|
-
return this.methodRequest("patch",
|
|
353246
|
+
patch(path31, opts) {
|
|
353247
|
+
return this.methodRequest("patch", path31, opts);
|
|
353248
353248
|
}
|
|
353249
|
-
put(
|
|
353250
|
-
return this.methodRequest("put",
|
|
353249
|
+
put(path31, opts) {
|
|
353250
|
+
return this.methodRequest("put", path31, opts);
|
|
353251
353251
|
}
|
|
353252
|
-
delete(
|
|
353253
|
-
return this.methodRequest("delete",
|
|
353252
|
+
delete(path31, opts) {
|
|
353253
|
+
return this.methodRequest("delete", path31, opts);
|
|
353254
353254
|
}
|
|
353255
|
-
methodRequest(method,
|
|
353255
|
+
methodRequest(method, path31, opts) {
|
|
353256
353256
|
return this.request(Promise.resolve(opts).then((opts2) => {
|
|
353257
|
-
return { method, path:
|
|
353257
|
+
return { method, path: path31, ...opts2 };
|
|
353258
353258
|
}));
|
|
353259
353259
|
}
|
|
353260
353260
|
request(options, remainingRetries = null) {
|
|
@@ -353358,8 +353358,8 @@ var OpenAI = class {
|
|
|
353358
353358
|
}));
|
|
353359
353359
|
return { response, options, controller, requestLogID, retryOfRequestLogID, startTime };
|
|
353360
353360
|
}
|
|
353361
|
-
getAPIList(
|
|
353362
|
-
return this.requestAPIList(Page2, { method: "get", path:
|
|
353361
|
+
getAPIList(path31, Page2, opts) {
|
|
353362
|
+
return this.requestAPIList(Page2, { method: "get", path: path31, ...opts });
|
|
353363
353363
|
}
|
|
353364
353364
|
requestAPIList(Page2, options) {
|
|
353365
353365
|
const request = this.makeRequest(options, null, void 0);
|
|
@@ -353437,8 +353437,8 @@ var OpenAI = class {
|
|
|
353437
353437
|
}
|
|
353438
353438
|
async buildRequest(inputOptions, { retryCount = 0 } = {}) {
|
|
353439
353439
|
const options = { ...inputOptions };
|
|
353440
|
-
const { method, path:
|
|
353441
|
-
const url2 = this.buildURL(
|
|
353440
|
+
const { method, path: path31, query, defaultBaseURL } = options;
|
|
353441
|
+
const url2 = this.buildURL(path31, query, defaultBaseURL);
|
|
353442
353442
|
if ("timeout" in options)
|
|
353443
353443
|
validatePositiveInteger("timeout", options.timeout);
|
|
353444
353444
|
options.timeout = options.timeout ?? this.timeout;
|
|
@@ -355054,23 +355054,23 @@ function isNullable(schema2) {
|
|
|
355054
355054
|
}
|
|
355055
355055
|
return false;
|
|
355056
355056
|
}
|
|
355057
|
-
function ensureStrictJsonSchema(jsonSchema,
|
|
355057
|
+
function ensureStrictJsonSchema(jsonSchema, path31, root) {
|
|
355058
355058
|
if (typeof jsonSchema === "boolean") {
|
|
355059
|
-
throw new TypeError(`Expected object schema but got boolean; path=${
|
|
355059
|
+
throw new TypeError(`Expected object schema but got boolean; path=${path31.join("/")}`);
|
|
355060
355060
|
}
|
|
355061
355061
|
if (!isObject4(jsonSchema)) {
|
|
355062
|
-
throw new TypeError(`Expected ${JSON.stringify(jsonSchema)} to be an object; path=${
|
|
355062
|
+
throw new TypeError(`Expected ${JSON.stringify(jsonSchema)} to be an object; path=${path31.join("/")}`);
|
|
355063
355063
|
}
|
|
355064
355064
|
const defs = jsonSchema.$defs;
|
|
355065
355065
|
if (isObject4(defs)) {
|
|
355066
355066
|
for (const [defName, defSchema] of Object.entries(defs)) {
|
|
355067
|
-
ensureStrictJsonSchema(defSchema, [...
|
|
355067
|
+
ensureStrictJsonSchema(defSchema, [...path31, "$defs", defName], root);
|
|
355068
355068
|
}
|
|
355069
355069
|
}
|
|
355070
355070
|
const definitions = jsonSchema.definitions;
|
|
355071
355071
|
if (isObject4(definitions)) {
|
|
355072
355072
|
for (const [definitionName, definitionSchema] of Object.entries(definitions)) {
|
|
355073
|
-
ensureStrictJsonSchema(definitionSchema, [...
|
|
355073
|
+
ensureStrictJsonSchema(definitionSchema, [...path31, "definitions", definitionName], root);
|
|
355074
355074
|
}
|
|
355075
355075
|
}
|
|
355076
355076
|
const typ = jsonSchema.type;
|
|
@@ -355082,31 +355082,31 @@ function ensureStrictJsonSchema(jsonSchema, path30, root) {
|
|
|
355082
355082
|
if (isObject4(properties)) {
|
|
355083
355083
|
for (const [key, value] of Object.entries(properties)) {
|
|
355084
355084
|
if (!isNullable(value) && !required2.includes(key)) {
|
|
355085
|
-
throw new Error(`Zod field at \`${[...
|
|
355085
|
+
throw new Error(`Zod field at \`${[...path31, "properties", key].join("/")}\` uses \`.optional()\` without \`.nullable()\` which is not supported by the API. See: https://platform.openai.com/docs/guides/structured-outputs?api-mode=responses#all-fields-must-be-required`);
|
|
355086
355086
|
}
|
|
355087
355087
|
}
|
|
355088
355088
|
jsonSchema.required = Object.keys(properties);
|
|
355089
355089
|
jsonSchema.properties = Object.fromEntries(Object.entries(properties).map(([key, propSchema]) => [
|
|
355090
355090
|
key,
|
|
355091
|
-
ensureStrictJsonSchema(propSchema, [...
|
|
355091
|
+
ensureStrictJsonSchema(propSchema, [...path31, "properties", key], root)
|
|
355092
355092
|
]));
|
|
355093
355093
|
}
|
|
355094
355094
|
const items = jsonSchema.items;
|
|
355095
355095
|
if (isObject4(items)) {
|
|
355096
|
-
jsonSchema.items = ensureStrictJsonSchema(items, [...
|
|
355096
|
+
jsonSchema.items = ensureStrictJsonSchema(items, [...path31, "items"], root);
|
|
355097
355097
|
}
|
|
355098
355098
|
const anyOf = jsonSchema.anyOf;
|
|
355099
355099
|
if (Array.isArray(anyOf)) {
|
|
355100
|
-
jsonSchema.anyOf = anyOf.map((variant, i) => ensureStrictJsonSchema(variant, [...
|
|
355100
|
+
jsonSchema.anyOf = anyOf.map((variant, i) => ensureStrictJsonSchema(variant, [...path31, "anyOf", String(i)], root));
|
|
355101
355101
|
}
|
|
355102
355102
|
const allOf = jsonSchema.allOf;
|
|
355103
355103
|
if (Array.isArray(allOf)) {
|
|
355104
355104
|
if (allOf.length === 1) {
|
|
355105
|
-
const resolved = ensureStrictJsonSchema(allOf[0], [...
|
|
355105
|
+
const resolved = ensureStrictJsonSchema(allOf[0], [...path31, "allOf", "0"], root);
|
|
355106
355106
|
Object.assign(jsonSchema, resolved);
|
|
355107
355107
|
delete jsonSchema.allOf;
|
|
355108
355108
|
} else {
|
|
355109
|
-
jsonSchema.allOf = allOf.map((entry, i) => ensureStrictJsonSchema(entry, [...
|
|
355109
|
+
jsonSchema.allOf = allOf.map((entry, i) => ensureStrictJsonSchema(entry, [...path31, "allOf", String(i)], root));
|
|
355110
355110
|
}
|
|
355111
355111
|
}
|
|
355112
355112
|
if (jsonSchema.default === null) {
|
|
@@ -355115,7 +355115,7 @@ function ensureStrictJsonSchema(jsonSchema, path30, root) {
|
|
|
355115
355115
|
const ref = jsonSchema.$ref;
|
|
355116
355116
|
if (ref && hasMoreThanNKeys(jsonSchema, 1)) {
|
|
355117
355117
|
if (typeof ref !== "string") {
|
|
355118
|
-
throw new TypeError(`Received non-string $ref - ${ref}; path=${
|
|
355118
|
+
throw new TypeError(`Received non-string $ref - ${ref}; path=${path31.join("/")}`);
|
|
355119
355119
|
}
|
|
355120
355120
|
const resolved = resolveRef(root, ref);
|
|
355121
355121
|
if (typeof resolved === "boolean") {
|
|
@@ -355126,7 +355126,7 @@ function ensureStrictJsonSchema(jsonSchema, path30, root) {
|
|
|
355126
355126
|
}
|
|
355127
355127
|
Object.assign(jsonSchema, { ...resolved, ...jsonSchema });
|
|
355128
355128
|
delete jsonSchema.$ref;
|
|
355129
|
-
return ensureStrictJsonSchema(jsonSchema,
|
|
355129
|
+
return ensureStrictJsonSchema(jsonSchema, path31, root);
|
|
355130
355130
|
}
|
|
355131
355131
|
return jsonSchema;
|
|
355132
355132
|
}
|
|
@@ -381362,8 +381362,172 @@ function daguExecutionPlan(playbook) {
|
|
|
381362
381362
|
return lines.join("\n");
|
|
381363
381363
|
}
|
|
381364
381364
|
|
|
381365
|
-
// ../../packages/backend/src/services/
|
|
381365
|
+
// ../../packages/backend/src/services/plugin/pluginRegistry.ts
|
|
381366
|
+
import path29 from "node:path";
|
|
381367
|
+
import { promises as fs21 } from "node:fs";
|
|
381366
381368
|
import { randomUUID as randomUUID18 } from "crypto";
|
|
381369
|
+
var DEFAULT_ENTRY_CANDIDATES = ["index.js", "index.ts", "index.mjs"];
|
|
381370
|
+
var PluginRegistry = class {
|
|
381371
|
+
constructor(opts) {
|
|
381372
|
+
this.opts = opts;
|
|
381373
|
+
this.now = opts.now ?? (() => Date.now());
|
|
381374
|
+
}
|
|
381375
|
+
plugins = /* @__PURE__ */ new Map();
|
|
381376
|
+
now;
|
|
381377
|
+
log(line) {
|
|
381378
|
+
try {
|
|
381379
|
+
this.opts.onLog?.(line);
|
|
381380
|
+
} catch {
|
|
381381
|
+
}
|
|
381382
|
+
}
|
|
381383
|
+
/** All discovered plugins. */
|
|
381384
|
+
list() {
|
|
381385
|
+
return Array.from(this.plugins.values());
|
|
381386
|
+
}
|
|
381387
|
+
get(idOrName) {
|
|
381388
|
+
const needle = idOrName.trim().toLowerCase();
|
|
381389
|
+
return this.plugins.get(idOrName) ?? Array.from(this.plugins.values()).find((p) => p.manifest.name.trim().toLowerCase() === needle);
|
|
381390
|
+
}
|
|
381391
|
+
/** Discover + load + register every plugin found in the scan roots. */
|
|
381392
|
+
async reload() {
|
|
381393
|
+
for (const root of this.opts.scanRoots) {
|
|
381394
|
+
const exists = await fs21.access(root).then(() => true).catch(() => false);
|
|
381395
|
+
if (!exists) continue;
|
|
381396
|
+
let entries;
|
|
381397
|
+
try {
|
|
381398
|
+
entries = await fs21.readdir(root, { withFileTypes: true });
|
|
381399
|
+
} catch (e) {
|
|
381400
|
+
this.log(`[plugin] failed to read root ${root}: ${e instanceof Error ? e.message : String(e)}`);
|
|
381401
|
+
continue;
|
|
381402
|
+
}
|
|
381403
|
+
for (const entry of entries) {
|
|
381404
|
+
if (entry.name.startsWith(".") || !entry.isDirectory()) continue;
|
|
381405
|
+
const dir = path29.join(root, entry.name);
|
|
381406
|
+
await this.loadFromDir(dir);
|
|
381407
|
+
}
|
|
381408
|
+
}
|
|
381409
|
+
return this.list();
|
|
381410
|
+
}
|
|
381411
|
+
/** Load + register a single plugin from a directory (must contain plugin.json). */
|
|
381412
|
+
async loadFromDir(dir) {
|
|
381413
|
+
const manifestPath = path29.join(dir, "plugin.json");
|
|
381414
|
+
let manifest;
|
|
381415
|
+
try {
|
|
381416
|
+
const text = await fs21.readFile(manifestPath, "utf8");
|
|
381417
|
+
manifest = JSON.parse(text);
|
|
381418
|
+
} catch (e) {
|
|
381419
|
+
this.log(`[plugin] ${dir}: no valid plugin.json (${e instanceof Error ? e.message : String(e)})`);
|
|
381420
|
+
return void 0;
|
|
381421
|
+
}
|
|
381422
|
+
if (!manifest.name || !manifest.version) {
|
|
381423
|
+
this.log(`[plugin] ${dir}: plugin.json missing required name/version`);
|
|
381424
|
+
return void 0;
|
|
381425
|
+
}
|
|
381426
|
+
const existing = Array.from(this.plugins.values()).find((p) => p.manifest.name === manifest.name);
|
|
381427
|
+
if (existing) {
|
|
381428
|
+
try {
|
|
381429
|
+
await this.unloadModule(existing);
|
|
381430
|
+
} catch {
|
|
381431
|
+
}
|
|
381432
|
+
this.plugins.delete(existing.id);
|
|
381433
|
+
}
|
|
381434
|
+
const record2 = {
|
|
381435
|
+
id: `plugin-${randomUUID18().slice(0, 8)}`,
|
|
381436
|
+
dir,
|
|
381437
|
+
manifest,
|
|
381438
|
+
enabled: true,
|
|
381439
|
+
tools: [],
|
|
381440
|
+
triggers: [],
|
|
381441
|
+
panels: []
|
|
381442
|
+
};
|
|
381443
|
+
const entryName = manifest.entry ?? await this.resolveEntry(dir);
|
|
381444
|
+
if (!entryName) {
|
|
381445
|
+
record2.error = `no entry module found (tried ${DEFAULT_ENTRY_CANDIDATES.join(", ")})`;
|
|
381446
|
+
this.log(`[plugin] ${manifest.name}: ${record2.error}`);
|
|
381447
|
+
this.plugins.set(record2.id, record2);
|
|
381448
|
+
return record2;
|
|
381449
|
+
}
|
|
381450
|
+
const entryPath = path29.join(dir, entryName);
|
|
381451
|
+
try {
|
|
381452
|
+
const mod = this.opts.loadModule ? await this.opts.loadModule(entryPath) : await this.defaultLoadModule(entryPath);
|
|
381453
|
+
if (!mod || typeof mod.register !== "function") {
|
|
381454
|
+
throw new Error("entry module does not export a register(ctx) function");
|
|
381455
|
+
}
|
|
381456
|
+
const ctx = this.opts.createContext(record2);
|
|
381457
|
+
await mod.register(ctx);
|
|
381458
|
+
record2.loadedAt = this.now();
|
|
381459
|
+
this.plugins.set(record2.id, record2);
|
|
381460
|
+
this.log(`[plugin] loaded ${manifest.name}@${manifest.version} (${record2.tools.length} tools, ${record2.triggers.length} triggers, ${record2.panels.length} panels)`);
|
|
381461
|
+
return record2;
|
|
381462
|
+
} catch (e) {
|
|
381463
|
+
record2.error = e instanceof Error ? e.message : String(e);
|
|
381464
|
+
this.log(`[plugin] ${manifest.name} failed to load: ${record2.error}`);
|
|
381465
|
+
this.plugins.set(record2.id, record2);
|
|
381466
|
+
return record2;
|
|
381467
|
+
}
|
|
381468
|
+
}
|
|
381469
|
+
async resolveEntry(dir) {
|
|
381470
|
+
for (const cand of DEFAULT_ENTRY_CANDIDATES) {
|
|
381471
|
+
const p = path29.join(dir, cand);
|
|
381472
|
+
const ok = await fs21.access(p).then(() => true).catch(() => false);
|
|
381473
|
+
if (ok) return cand;
|
|
381474
|
+
}
|
|
381475
|
+
return void 0;
|
|
381476
|
+
}
|
|
381477
|
+
async defaultLoadModule(entryPath) {
|
|
381478
|
+
const url2 = `file://${entryPath}`;
|
|
381479
|
+
return await import(url2);
|
|
381480
|
+
}
|
|
381481
|
+
async unloadModule(record2) {
|
|
381482
|
+
void record2;
|
|
381483
|
+
}
|
|
381484
|
+
/** Enable/disable a plugin (its capabilities are gated by `enabled`). */
|
|
381485
|
+
setEnabled(idOrName, enabled) {
|
|
381486
|
+
const p = this.get(idOrName);
|
|
381487
|
+
if (!p) return false;
|
|
381488
|
+
p.enabled = enabled;
|
|
381489
|
+
return true;
|
|
381490
|
+
}
|
|
381491
|
+
/** Uninstall a plugin (drop it from the registry). */
|
|
381492
|
+
uninstall(idOrName) {
|
|
381493
|
+
const p = this.get(idOrName);
|
|
381494
|
+
if (!p) return false;
|
|
381495
|
+
return this.plugins.delete(p.id);
|
|
381496
|
+
}
|
|
381497
|
+
/** All tools from enabled plugins. */
|
|
381498
|
+
allTools() {
|
|
381499
|
+
return this.list().filter((p) => p.enabled && !p.error).flatMap((p) => p.tools);
|
|
381500
|
+
}
|
|
381501
|
+
/** All triggers from enabled plugins. */
|
|
381502
|
+
allTriggers() {
|
|
381503
|
+
return this.list().filter((p) => p.enabled && !p.error).flatMap((p) => p.triggers);
|
|
381504
|
+
}
|
|
381505
|
+
/** All panels from enabled plugins. */
|
|
381506
|
+
allPanels() {
|
|
381507
|
+
return this.list().filter((p) => p.enabled && !p.error).flatMap((p) => p.panels);
|
|
381508
|
+
}
|
|
381509
|
+
/** Build the default PluginContext for a record (registers into the record's
|
|
381510
|
+
* capability lists; exec/readLedger/log are delegated to the injected fns). */
|
|
381511
|
+
static defaultContext(record2, exec, readLedger, log) {
|
|
381512
|
+
return {
|
|
381513
|
+
registerTool: (tool2) => {
|
|
381514
|
+
record2.tools.push(tool2);
|
|
381515
|
+
},
|
|
381516
|
+
registerTrigger: (trigger) => {
|
|
381517
|
+
record2.triggers.push(trigger);
|
|
381518
|
+
},
|
|
381519
|
+
registerPanel: (name, render3) => {
|
|
381520
|
+
record2.panels.push({ name, render: render3 });
|
|
381521
|
+
},
|
|
381522
|
+
exec,
|
|
381523
|
+
readLedger,
|
|
381524
|
+
log
|
|
381525
|
+
};
|
|
381526
|
+
}
|
|
381527
|
+
};
|
|
381528
|
+
|
|
381529
|
+
// ../../packages/backend/src/services/evals/evalHarness.ts
|
|
381530
|
+
import { randomUUID as randomUUID19 } from "crypto";
|
|
381367
381531
|
function subset(needles, haystack) {
|
|
381368
381532
|
return needles.every((n2) => haystack.includes(n2));
|
|
381369
381533
|
}
|
|
@@ -381426,7 +381590,7 @@ var EvalHarness = class {
|
|
|
381426
381590
|
return arr3.length > 0 ? arr3.filter((r) => r.pass).length / arr3.length * 100 : void 0;
|
|
381427
381591
|
};
|
|
381428
381592
|
return {
|
|
381429
|
-
id: `eval-${
|
|
381593
|
+
id: `eval-${randomUUID19().slice(0, 8)}`,
|
|
381430
381594
|
at: this.now(),
|
|
381431
381595
|
total: results.length,
|
|
381432
381596
|
passed,
|
|
@@ -381524,6 +381688,12 @@ var EarlyWarningService = class {
|
|
|
381524
381688
|
this.now = deps.now ?? (() => Date.now());
|
|
381525
381689
|
}
|
|
381526
381690
|
now;
|
|
381691
|
+
/** cooldown tracker: dedupe identical warnings within a window so repeated
|
|
381692
|
+
* evaluation doesn't re-fire the same warning over and over. */
|
|
381693
|
+
firedAt = /* @__PURE__ */ new Map();
|
|
381694
|
+
/** seconds before an identical warning (host+metric+kind) may fire again
|
|
381695
|
+
* (default 15 min). Prevents warning storms on repeated evaluation. */
|
|
381696
|
+
cooldownMs = 9e5;
|
|
381527
381697
|
/** Evaluate a host+metric for a predictive breach (forecast and/or anomaly). */
|
|
381528
381698
|
evaluate(host, metric, opts) {
|
|
381529
381699
|
const warnings = [];
|
|
@@ -381555,7 +381725,12 @@ var EarlyWarningService = class {
|
|
|
381555
381725
|
});
|
|
381556
381726
|
}
|
|
381557
381727
|
}
|
|
381728
|
+
const nowMs = this.now();
|
|
381558
381729
|
for (const w of warnings) {
|
|
381730
|
+
const key = `${w.host}:${w.metric}:${w.kind}`;
|
|
381731
|
+
const last = this.firedAt.get(key) ?? 0;
|
|
381732
|
+
if (nowMs - last < this.cooldownMs) continue;
|
|
381733
|
+
this.firedAt.set(key, nowMs);
|
|
381559
381734
|
try {
|
|
381560
381735
|
this.deps.onWarning?.(w);
|
|
381561
381736
|
} catch {
|
|
@@ -381770,6 +381945,28 @@ function createObservability(deps) {
|
|
|
381770
381945
|
runAgent: deps.runAgentForEval ?? (async (_prompt) => ({ answer: "", toolsCalled: [] })),
|
|
381771
381946
|
isCommandBlocked: () => false
|
|
381772
381947
|
});
|
|
381948
|
+
const pluginScanRoot = (process.env.GYBACKEND_DATA_DIR ?? "./.gybackend-data") + "/plugins";
|
|
381949
|
+
const pluginRegistry = new PluginRegistry({
|
|
381950
|
+
scanRoots: [pluginScanRoot, "./plugins"],
|
|
381951
|
+
createContext: (record2) => PluginRegistry.defaultContext(
|
|
381952
|
+
record2,
|
|
381953
|
+
async (cmd, opts) => deps.agentService ? `exec(${cmd} on ${opts?.host ?? "local"})` : "",
|
|
381954
|
+
(name) => {
|
|
381955
|
+
if (name === "metrics") return metricsLedger.hosts();
|
|
381956
|
+
if (name === "incidents") return incidentLedger.list();
|
|
381957
|
+
return {};
|
|
381958
|
+
},
|
|
381959
|
+
(line) => {
|
|
381960
|
+
try {
|
|
381961
|
+
deps.onLog?.(line);
|
|
381962
|
+
} catch {
|
|
381963
|
+
}
|
|
381964
|
+
}
|
|
381965
|
+
),
|
|
381966
|
+
onLog: deps.onLog
|
|
381967
|
+
});
|
|
381968
|
+
void pluginRegistry.reload().catch(() => {
|
|
381969
|
+
});
|
|
381773
381970
|
deps.setMonitorPublisher((channel, data) => {
|
|
381774
381971
|
if (channel !== "monitor:snapshot" || !data || typeof data !== "object") return;
|
|
381775
381972
|
const d = data;
|
|
@@ -381798,7 +381995,8 @@ function createObservability(deps) {
|
|
|
381798
381995
|
earlyWarning,
|
|
381799
381996
|
behaviorLedger,
|
|
381800
381997
|
dagu: { parseDaguYaml, parseDaguWorkflow, daguExecutionPlan },
|
|
381801
|
-
notify: { slackChannel, teamsChannel, smtpChannel, telegramChannel }
|
|
381998
|
+
notify: { slackChannel, teamsChannel, smtpChannel, telegramChannel },
|
|
381999
|
+
pluginRegistry
|
|
381802
382000
|
};
|
|
381803
382001
|
}
|
|
381804
382002
|
|
|
@@ -383626,9 +383824,9 @@ function numberFromEnv(name, fallback) {
|
|
|
383626
383824
|
function resolveDataDir() {
|
|
383627
383825
|
const custom3 = (process3.env.GYBACKEND_DATA_DIR || "").trim();
|
|
383628
383826
|
if (custom3) {
|
|
383629
|
-
return
|
|
383827
|
+
return path30.resolve(custom3);
|
|
383630
383828
|
}
|
|
383631
|
-
return
|
|
383829
|
+
return path30.join(process3.cwd(), ".gybackend-data");
|
|
383632
383830
|
}
|
|
383633
383831
|
async function startGyBackend() {
|
|
383634
383832
|
const dataDir = resolveDataDir();
|
|
@@ -383661,7 +383859,7 @@ async function startGyBackend() {
|
|
|
383661
383859
|
const modelCapabilityService = new ModelCapabilityService();
|
|
383662
383860
|
const imageAttachmentService = new ImageAttachmentService(dataDir);
|
|
383663
383861
|
const terminalStateStore = new TerminalStateStore(
|
|
383664
|
-
|
|
383862
|
+
path30.join(dataDir, "terminal-tabs-state.json")
|
|
383665
383863
|
);
|
|
383666
383864
|
const terminalService = new TerminalService({
|
|
383667
383865
|
terminalStateStore
|
|
@@ -383811,7 +384009,7 @@ async function startGyBackend() {
|
|
|
383811
384009
|
});
|
|
383812
384010
|
console.log(`[gybackend] Observability wired: dashboard state available (hosts=${observability.metricsLedger.hosts().length})`);
|
|
383813
384011
|
if (settingsService.getSettings().sessionLogging?.enabled) {
|
|
383814
|
-
const logDir =
|
|
384012
|
+
const logDir = path30.join(
|
|
383815
384013
|
process3.env.GYSHELL_STORE_DIR || "",
|
|
383816
384014
|
"session-logs"
|
|
383817
384015
|
);
|