blun-king-cli 9.1.41 → 9.1.43
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/LIESMICH.txt +12 -1
- package/README.md +11 -1
- package/bin/update-notice.js +103 -8
- package/blun.mjs +498 -215
- package/package.json +1 -1
package/blun.mjs
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// BLUN_BUILD_INPUT_SHA256:
|
|
2
|
+
// BLUN_BUILD_INPUT_SHA256:804ef7d1988621941a7f328013311dcf55daa850695958e9d322a7eb3f92e699
|
|
3
3
|
import { fileURLToPath as __cjsShimFileURLToPath } from 'node:url';
|
|
4
4
|
import { dirname as __cjsShimDirname } from 'node:path';
|
|
5
5
|
const __filename = __cjsShimFileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __cjsShimDirname(__filename);
|
|
7
7
|
import { createRequire } from "node:module";
|
|
8
8
|
import crypto$1, { createHash, randomBytes, randomInt, randomUUID, timingSafeEqual } from "node:crypto";
|
|
9
|
-
import * as fs$
|
|
9
|
+
import * as fs$16 from "node:fs";
|
|
10
10
|
import Kt, { accessSync, appendFileSync, chmodSync, closeSync, constants, copyFileSync, createReadStream, createWriteStream, existsSync, fsyncSync, linkSync, lstatSync, mkdirSync, openSync, promises, readFileSync, readSync, readdirSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
|
|
11
|
-
import * as path$
|
|
11
|
+
import * as path$16 from "node:path";
|
|
12
12
|
import path, { basename, dirname, extname, isAbsolute, join, normalize, posix, relative, resolve, sep, win32 } from "node:path";
|
|
13
13
|
import { Blob as Blob$1, Buffer as Buffer$1, File as File$1 } from "node:buffer";
|
|
14
14
|
import * as nodeOs from "node:os";
|
|
15
15
|
import os, { arch, homedir, hostname, networkInterfaces, platform, release, tmpdir, type, userInfo } from "node:os";
|
|
16
|
-
import
|
|
16
|
+
import ro, { access, appendFile, chmod, constants as constants$1, copyFile, cp, link, lstat, mkdir, mkdtemp, open, readFile, readdir, realpath, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
|
|
17
17
|
import { execFile, execFileSync, execSync, spawn, spawnSync } from "node:child_process";
|
|
18
18
|
import * as sysPath from "path";
|
|
19
|
-
import
|
|
19
|
+
import js, { basename as basename$1, dirname as dirname$1, join as join$1, parse } from "path";
|
|
20
20
|
import I, { existsSync as existsSync$1, promises as promises$1, readdirSync as readdirSync$1, stat as stat$1, statSync as statSync$1, unwatchFile, watch, watchFile } from "fs";
|
|
21
21
|
import { Readable } from "stream";
|
|
22
22
|
import zi from "assert";
|
|
@@ -2133,11 +2133,11 @@ var init_blun_files = __esmMin((() => {
|
|
|
2133
2133
|
async uploadVideo(input, options) {
|
|
2134
2134
|
let file;
|
|
2135
2135
|
if (typeof input === "string") {
|
|
2136
|
-
if (!fs$
|
|
2137
|
-
const filename = path$
|
|
2136
|
+
if (!fs$16.existsSync(input)) throw new ChatProviderError(`Video file not found: ${input}`);
|
|
2137
|
+
const filename = path$16.basename(input);
|
|
2138
2138
|
const mimeType = guessMimeTypeFromExt(filename);
|
|
2139
2139
|
if (mimeType === void 0 || !mimeType.startsWith("video/")) throw new ChatProviderError(`BlunFiles.uploadVideo: file extension does not indicate a video type: ${filename}`);
|
|
2140
|
-
const data = await fs$
|
|
2140
|
+
const data = await fs$16.promises.readFile(input);
|
|
2141
2141
|
file = new File$1([new Blob$1([new Uint8Array(data)], { type: mimeType })], filename, { type: mimeType });
|
|
2142
2142
|
} else {
|
|
2143
2143
|
if (!input.mimeType.startsWith("video/")) throw new ChatProviderError(`Expected a video mime type, got ${input.mimeType}`);
|
|
@@ -11518,7 +11518,7 @@ var require_clone$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
11518
11518
|
//#endregion
|
|
11519
11519
|
//#region ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
|
|
11520
11520
|
var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
11521
|
-
var fs$
|
|
11521
|
+
var fs$15 = __require("fs");
|
|
11522
11522
|
var polyfills = require_polyfills();
|
|
11523
11523
|
var legacy = require_legacy_streams();
|
|
11524
11524
|
var clone = require_clone$1();
|
|
@@ -11547,36 +11547,36 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
11547
11547
|
m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
|
|
11548
11548
|
console.error(m);
|
|
11549
11549
|
};
|
|
11550
|
-
if (!fs$
|
|
11551
|
-
publishQueue(fs$
|
|
11552
|
-
fs$
|
|
11550
|
+
if (!fs$15[gracefulQueue]) {
|
|
11551
|
+
publishQueue(fs$15, global[gracefulQueue] || []);
|
|
11552
|
+
fs$15.close = (function(fs$close) {
|
|
11553
11553
|
function close(fd, cb) {
|
|
11554
|
-
return fs$close.call(fs$
|
|
11554
|
+
return fs$close.call(fs$15, fd, function(err) {
|
|
11555
11555
|
if (!err) resetQueue();
|
|
11556
11556
|
if (typeof cb === "function") cb.apply(this, arguments);
|
|
11557
11557
|
});
|
|
11558
11558
|
}
|
|
11559
11559
|
Object.defineProperty(close, previousSymbol, { value: fs$close });
|
|
11560
11560
|
return close;
|
|
11561
|
-
})(fs$
|
|
11562
|
-
fs$
|
|
11561
|
+
})(fs$15.close);
|
|
11562
|
+
fs$15.closeSync = (function(fs$closeSync) {
|
|
11563
11563
|
function closeSync(fd) {
|
|
11564
|
-
fs$closeSync.apply(fs$
|
|
11564
|
+
fs$closeSync.apply(fs$15, arguments);
|
|
11565
11565
|
resetQueue();
|
|
11566
11566
|
}
|
|
11567
11567
|
Object.defineProperty(closeSync, previousSymbol, { value: fs$closeSync });
|
|
11568
11568
|
return closeSync;
|
|
11569
|
-
})(fs$
|
|
11569
|
+
})(fs$15.closeSync);
|
|
11570
11570
|
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) process.on("exit", function() {
|
|
11571
|
-
debug(fs$
|
|
11572
|
-
__require("assert").equal(fs$
|
|
11571
|
+
debug(fs$15[gracefulQueue]);
|
|
11572
|
+
__require("assert").equal(fs$15[gracefulQueue].length, 0);
|
|
11573
11573
|
});
|
|
11574
11574
|
}
|
|
11575
|
-
if (!global[gracefulQueue]) publishQueue(global, fs$
|
|
11576
|
-
module.exports = patch(clone(fs$
|
|
11577
|
-
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$
|
|
11578
|
-
module.exports = patch(fs$
|
|
11579
|
-
fs$
|
|
11575
|
+
if (!global[gracefulQueue]) publishQueue(global, fs$15[gracefulQueue]);
|
|
11576
|
+
module.exports = patch(clone(fs$15));
|
|
11577
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$15.__patched) {
|
|
11578
|
+
module.exports = patch(fs$15);
|
|
11579
|
+
fs$15.__patched = true;
|
|
11580
11580
|
}
|
|
11581
11581
|
function patch(fs) {
|
|
11582
11582
|
polyfills(fs);
|
|
@@ -11831,23 +11831,23 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
11831
11831
|
}
|
|
11832
11832
|
function enqueue(elem) {
|
|
11833
11833
|
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
11834
|
-
fs$
|
|
11834
|
+
fs$15[gracefulQueue].push(elem);
|
|
11835
11835
|
retry();
|
|
11836
11836
|
}
|
|
11837
11837
|
var retryTimer;
|
|
11838
11838
|
function resetQueue() {
|
|
11839
11839
|
var now = Date.now();
|
|
11840
|
-
for (var i = 0; i < fs$
|
|
11841
|
-
fs$
|
|
11842
|
-
fs$
|
|
11840
|
+
for (var i = 0; i < fs$15[gracefulQueue].length; ++i) if (fs$15[gracefulQueue][i].length > 2) {
|
|
11841
|
+
fs$15[gracefulQueue][i][3] = now;
|
|
11842
|
+
fs$15[gracefulQueue][i][4] = now;
|
|
11843
11843
|
}
|
|
11844
11844
|
retry();
|
|
11845
11845
|
}
|
|
11846
11846
|
function retry() {
|
|
11847
11847
|
clearTimeout(retryTimer);
|
|
11848
11848
|
retryTimer = void 0;
|
|
11849
|
-
if (fs$
|
|
11850
|
-
var elem = fs$
|
|
11849
|
+
if (fs$15[gracefulQueue].length === 0) return;
|
|
11850
|
+
var elem = fs$15[gracefulQueue].shift();
|
|
11851
11851
|
var fn = elem[0];
|
|
11852
11852
|
var args = elem[1];
|
|
11853
11853
|
var err = elem[2];
|
|
@@ -11866,7 +11866,7 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
11866
11866
|
if (sinceAttempt >= Math.min(sinceStart * 1.2, 100)) {
|
|
11867
11867
|
debug("RETRY", fn.name, args);
|
|
11868
11868
|
fn.apply(null, args.concat([startTime]));
|
|
11869
|
-
} else fs$
|
|
11869
|
+
} else fs$15[gracefulQueue].push(elem);
|
|
11870
11870
|
}
|
|
11871
11871
|
if (retryTimer === void 0) retryTimer = setTimeout(retry, 0);
|
|
11872
11872
|
}
|
|
@@ -12218,7 +12218,7 @@ var require_mtime_precision = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
12218
12218
|
//#endregion
|
|
12219
12219
|
//#region ../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/lockfile.js
|
|
12220
12220
|
var require_lockfile = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
12221
|
-
const path$
|
|
12221
|
+
const path$15 = __require("path");
|
|
12222
12222
|
const fs = require_graceful_fs();
|
|
12223
12223
|
const retry = require_retry$3();
|
|
12224
12224
|
const onExit = require_signal_exit();
|
|
@@ -12228,7 +12228,7 @@ var require_lockfile = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
12228
12228
|
return options.lockfilePath || `${file}.lock`;
|
|
12229
12229
|
}
|
|
12230
12230
|
function resolveCanonicalPath(file, options, callback) {
|
|
12231
|
-
if (!options.realpath) return callback(null, path$
|
|
12231
|
+
if (!options.realpath) return callback(null, path$15.resolve(file));
|
|
12232
12232
|
options.fs.realpath(file, callback);
|
|
12233
12233
|
}
|
|
12234
12234
|
function acquireLock(file, options, callback) {
|
|
@@ -14702,7 +14702,7 @@ async function syncDir(dirPath) {
|
|
|
14702
14702
|
*/
|
|
14703
14703
|
function syncFd(fd) {
|
|
14704
14704
|
return new Promise((resolve, reject) => {
|
|
14705
|
-
fs$
|
|
14705
|
+
fs$16.fsync(fd, (err) => {
|
|
14706
14706
|
if (err) {
|
|
14707
14707
|
reject(err);
|
|
14708
14708
|
return;
|
|
@@ -25215,7 +25215,7 @@ var require_loader = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
25215
25215
|
};
|
|
25216
25216
|
return _setPrototypeOf(o, p);
|
|
25217
25217
|
}
|
|
25218
|
-
var path$
|
|
25218
|
+
var path$14 = __require("path");
|
|
25219
25219
|
module.exports = /* @__PURE__ */ function(_EmitterObj) {
|
|
25220
25220
|
_inheritsLoose(Loader, _EmitterObj);
|
|
25221
25221
|
function Loader() {
|
|
@@ -25223,7 +25223,7 @@ var require_loader = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
25223
25223
|
}
|
|
25224
25224
|
var _proto = Loader.prototype;
|
|
25225
25225
|
_proto.resolve = function resolve(from, to) {
|
|
25226
|
-
return path$
|
|
25226
|
+
return path$14.resolve(path$14.dirname(from), to);
|
|
25227
25227
|
};
|
|
25228
25228
|
_proto.isRelative = function isRelative(filename) {
|
|
25229
25229
|
return filename.indexOf("./") === 0 || filename.indexOf("../") === 0;
|
|
@@ -26879,8 +26879,8 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
26879
26879
|
};
|
|
26880
26880
|
return _setPrototypeOf(o, p);
|
|
26881
26881
|
}
|
|
26882
|
-
var fs$
|
|
26883
|
-
var path$
|
|
26882
|
+
var fs$14 = __require("fs");
|
|
26883
|
+
var path$13 = __require("path");
|
|
26884
26884
|
var Loader = require_loader();
|
|
26885
26885
|
var PrecompiledLoader = require_precompiled_loader().PrecompiledLoader;
|
|
26886
26886
|
var chokidar;
|
|
@@ -26895,7 +26895,7 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
26895
26895
|
_this.noCache = !!opts.noCache;
|
|
26896
26896
|
if (searchPaths) {
|
|
26897
26897
|
searchPaths = Array.isArray(searchPaths) ? searchPaths : [searchPaths];
|
|
26898
|
-
_this.searchPaths = searchPaths.map(path$
|
|
26898
|
+
_this.searchPaths = searchPaths.map(path$13.normalize);
|
|
26899
26899
|
} else _this.searchPaths = ["."];
|
|
26900
26900
|
if (opts.watch) {
|
|
26901
26901
|
try {
|
|
@@ -26903,10 +26903,10 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
26903
26903
|
} catch (e) {
|
|
26904
26904
|
throw new Error("watch requires chokidar to be installed");
|
|
26905
26905
|
}
|
|
26906
|
-
var paths = _this.searchPaths.filter(fs$
|
|
26906
|
+
var paths = _this.searchPaths.filter(fs$14.existsSync);
|
|
26907
26907
|
var watcher = chokidar.watch(paths);
|
|
26908
26908
|
watcher.on("all", function(event, fullname) {
|
|
26909
|
-
fullname = path$
|
|
26909
|
+
fullname = path$13.resolve(fullname);
|
|
26910
26910
|
if (event === "change" && fullname in _this.pathsToNames) _this.emit("update", _this.pathsToNames[fullname], fullname);
|
|
26911
26911
|
});
|
|
26912
26912
|
watcher.on("error", function(error) {
|
|
@@ -26920,9 +26920,9 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
26920
26920
|
var fullpath = null;
|
|
26921
26921
|
var paths = this.searchPaths;
|
|
26922
26922
|
for (var i = 0; i < paths.length; i++) {
|
|
26923
|
-
var basePath = path$
|
|
26924
|
-
var p = path$
|
|
26925
|
-
if (p.indexOf(basePath) === 0 && fs$
|
|
26923
|
+
var basePath = path$13.resolve(paths[i]);
|
|
26924
|
+
var p = path$13.resolve(paths[i], name);
|
|
26925
|
+
if (p.indexOf(basePath) === 0 && fs$14.existsSync(p)) {
|
|
26926
26926
|
fullpath = p;
|
|
26927
26927
|
break;
|
|
26928
26928
|
}
|
|
@@ -26930,7 +26930,7 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
26930
26930
|
if (!fullpath) return null;
|
|
26931
26931
|
this.pathsToNames[fullpath] = name;
|
|
26932
26932
|
var source = {
|
|
26933
|
-
src: fs$
|
|
26933
|
+
src: fs$14.readFileSync(fullpath, "utf-8"),
|
|
26934
26934
|
path: fullpath,
|
|
26935
26935
|
noCache: this.noCache
|
|
26936
26936
|
};
|
|
@@ -26978,7 +26978,7 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
26978
26978
|
}
|
|
26979
26979
|
this.pathsToNames[fullpath] = name;
|
|
26980
26980
|
var source = {
|
|
26981
|
-
src: fs$
|
|
26981
|
+
src: fs$14.readFileSync(fullpath, "utf-8"),
|
|
26982
26982
|
path: fullpath,
|
|
26983
26983
|
noCache: this.noCache
|
|
26984
26984
|
};
|
|
@@ -27280,13 +27280,13 @@ var require_globals = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
27280
27280
|
//#endregion
|
|
27281
27281
|
//#region ../../node_modules/.pnpm/nunjucks@3.2.4_chokidar@4.0.3/node_modules/nunjucks/src/express-app.js
|
|
27282
27282
|
var require_express_app = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
27283
|
-
var path$
|
|
27283
|
+
var path$12 = __require("path");
|
|
27284
27284
|
module.exports = function express(env, app) {
|
|
27285
27285
|
function NunjucksView(name, opts) {
|
|
27286
27286
|
this.name = name;
|
|
27287
27287
|
this.path = name;
|
|
27288
27288
|
this.defaultEngine = opts.defaultEngine;
|
|
27289
|
-
this.ext = path$
|
|
27289
|
+
this.ext = path$12.extname(name);
|
|
27290
27290
|
if (!this.ext && !this.defaultEngine) throw new Error("No default engine was specified and no extension was provided.");
|
|
27291
27291
|
if (!this.ext) this.name += this.ext = (this.defaultEngine[0] !== "." ? "." : "") + this.defaultEngine;
|
|
27292
27292
|
}
|
|
@@ -27722,8 +27722,8 @@ var require_precompile_global = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
27722
27722
|
//#endregion
|
|
27723
27723
|
//#region ../../node_modules/.pnpm/nunjucks@3.2.4_chokidar@4.0.3/node_modules/nunjucks/src/precompile.js
|
|
27724
27724
|
var require_precompile = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
27725
|
-
var fs$
|
|
27726
|
-
var path$
|
|
27725
|
+
var fs$13 = __require("fs");
|
|
27726
|
+
var path$11 = __require("path");
|
|
27727
27727
|
var _prettifyError = require_lib$7()._prettifyError;
|
|
27728
27728
|
var compiler = require_compiler();
|
|
27729
27729
|
var Environment = require_environment().Environment;
|
|
@@ -27747,27 +27747,27 @@ var require_precompile = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
27747
27747
|
var env = opts.env || new Environment([]);
|
|
27748
27748
|
var wrapper = opts.wrapper || precompileGlobal;
|
|
27749
27749
|
if (opts.isString) return precompileString(input, opts);
|
|
27750
|
-
var pathStats = fs$
|
|
27750
|
+
var pathStats = fs$13.existsSync(input) && fs$13.statSync(input);
|
|
27751
27751
|
var precompiled = [];
|
|
27752
27752
|
var templates = [];
|
|
27753
27753
|
function addTemplates(dir) {
|
|
27754
|
-
fs$
|
|
27755
|
-
var filepath = path$
|
|
27756
|
-
var subpath = filepath.substr(path$
|
|
27757
|
-
var stat = fs$
|
|
27754
|
+
fs$13.readdirSync(dir).forEach(function(file) {
|
|
27755
|
+
var filepath = path$11.join(dir, file);
|
|
27756
|
+
var subpath = filepath.substr(path$11.join(input, "/").length);
|
|
27757
|
+
var stat = fs$13.statSync(filepath);
|
|
27758
27758
|
if (stat && stat.isDirectory()) {
|
|
27759
27759
|
subpath += "/";
|
|
27760
27760
|
if (!match(subpath, opts.exclude)) addTemplates(filepath);
|
|
27761
27761
|
} else if (match(subpath, opts.include)) templates.push(filepath);
|
|
27762
27762
|
});
|
|
27763
27763
|
}
|
|
27764
|
-
if (pathStats.isFile()) precompiled.push(_precompile(fs$
|
|
27764
|
+
if (pathStats.isFile()) precompiled.push(_precompile(fs$13.readFileSync(input, "utf-8"), opts.name || input, env));
|
|
27765
27765
|
else if (pathStats.isDirectory()) {
|
|
27766
27766
|
addTemplates(input);
|
|
27767
27767
|
for (var i = 0; i < templates.length; i++) {
|
|
27768
|
-
var name = templates[i].replace(path$
|
|
27768
|
+
var name = templates[i].replace(path$11.join(input, "/"), "");
|
|
27769
27769
|
try {
|
|
27770
|
-
precompiled.push(_precompile(fs$
|
|
27770
|
+
precompiled.push(_precompile(fs$13.readFileSync(templates[i], "utf-8"), name, env));
|
|
27771
27771
|
} catch (e) {
|
|
27772
27772
|
if (opts.force) console.error(e);
|
|
27773
27773
|
else throw e;
|
|
@@ -36380,7 +36380,7 @@ var require_gifframe = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
36380
36380
|
//#region ../../node_modules/.pnpm/gifwrap@0.10.1/node_modules/gifwrap/src/gifutil.js
|
|
36381
36381
|
var require_gifutil = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
36382
36382
|
/** @namespace GifUtil */
|
|
36383
|
-
const fs$
|
|
36383
|
+
const fs$12 = __require("fs");
|
|
36384
36384
|
const ImageQ = require_image_q();
|
|
36385
36385
|
const BitmapImage = require_bitmapimage();
|
|
36386
36386
|
const { GifFrame } = require_gifframe();
|
|
@@ -36647,7 +36647,7 @@ var require_gifutil = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
36647
36647
|
}
|
|
36648
36648
|
function _readBinary(path) {
|
|
36649
36649
|
return new Promise((resolve, reject) => {
|
|
36650
|
-
fs$
|
|
36650
|
+
fs$12.readFile(path, (err, buffer) => {
|
|
36651
36651
|
if (err) return reject(err);
|
|
36652
36652
|
return resolve(buffer);
|
|
36653
36653
|
});
|
|
@@ -36655,7 +36655,7 @@ var require_gifutil = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
36655
36655
|
}
|
|
36656
36656
|
function _writeBinary(path, buffer) {
|
|
36657
36657
|
return new Promise((resolve, reject) => {
|
|
36658
|
-
fs$
|
|
36658
|
+
fs$12.writeFile(path, buffer, (err) => {
|
|
36659
36659
|
if (err) return reject(err);
|
|
36660
36660
|
return resolve();
|
|
36661
36661
|
});
|
|
@@ -62473,7 +62473,7 @@ var init_file_type = __esmMin((() => {
|
|
|
62473
62473
|
}
|
|
62474
62474
|
async fromFile(path) {
|
|
62475
62475
|
this.options.signal?.throwIfAborted();
|
|
62476
|
-
const fileHandle = await
|
|
62476
|
+
const fileHandle = await ro.open(path, constants.O_RDONLY | constants.O_NONBLOCK);
|
|
62477
62477
|
const fileStat = await fileHandle.stat();
|
|
62478
62478
|
if (!fileStat.isFile()) {
|
|
62479
62479
|
await fileHandle.close();
|
|
@@ -72978,7 +72978,7 @@ async function processBitmapFont(file, font) {
|
|
|
72978
72978
|
...font,
|
|
72979
72979
|
chars,
|
|
72980
72980
|
kernings,
|
|
72981
|
-
pages: await Promise.all(font.pages.map(async (page) => CharacterJimp.read(
|
|
72981
|
+
pages: await Promise.all(font.pages.map(async (page) => CharacterJimp.read(js.join(js.dirname(file), page))))
|
|
72982
72982
|
};
|
|
72983
72983
|
}
|
|
72984
72984
|
var import_parse_bmfont_ascii, import_lib$1, import_parse_bmfont_binary, convertXML, isWebWorker, CharacterJimp, HEADER;
|
|
@@ -81094,7 +81094,7 @@ var require_buffer_from = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
81094
81094
|
//#region ../../node_modules/.pnpm/source-map-support@0.5.21/node_modules/source-map-support/source-map-support.js
|
|
81095
81095
|
var require_source_map_support = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
81096
81096
|
var SourceMapConsumer = require_source_map().SourceMapConsumer;
|
|
81097
|
-
var path$
|
|
81097
|
+
var path$10 = __require("path");
|
|
81098
81098
|
var fs;
|
|
81099
81099
|
try {
|
|
81100
81100
|
fs = __require("fs");
|
|
@@ -81171,15 +81171,15 @@ var require_source_map_support = /* @__PURE__ */ __commonJSMin(((exports, module
|
|
|
81171
81171
|
});
|
|
81172
81172
|
function supportRelativeURL(file, url) {
|
|
81173
81173
|
if (!file) return url;
|
|
81174
|
-
var dir = path$
|
|
81174
|
+
var dir = path$10.dirname(file);
|
|
81175
81175
|
var match = /^\w+:\/\/[^\/]*/.exec(dir);
|
|
81176
81176
|
var protocol = match ? match[0] : "";
|
|
81177
81177
|
var startPath = dir.slice(protocol.length);
|
|
81178
81178
|
if (protocol && /^\/\w\:/.test(startPath)) {
|
|
81179
81179
|
protocol += "/";
|
|
81180
|
-
return protocol + path$
|
|
81180
|
+
return protocol + path$10.resolve(dir.slice(protocol.length), url).replace(/\\/g, "/");
|
|
81181
81181
|
}
|
|
81182
|
-
return protocol + path$
|
|
81182
|
+
return protocol + path$10.resolve(dir.slice(protocol.length), url);
|
|
81183
81183
|
}
|
|
81184
81184
|
function retrieveSourceMapURL(source) {
|
|
81185
81185
|
var fileData;
|
|
@@ -252768,7 +252768,7 @@ function Yn(s, t) {
|
|
|
252768
252768
|
function Kn(s, t) {
|
|
252769
252769
|
s.head = new ue$1(t, void 0, s.head, s), s.tail || (s.tail = s.head), s.length++;
|
|
252770
252770
|
}
|
|
252771
|
-
var zr, Ur, Ds, Wr, Gr, Zr, Q$1, J$1, nt$1, De$1, qt, Ne$1, Ns, Ae$1, As, z$1, Mt, g$1, Qt, Bt, b$1, N$1, _$1, bi, Ie$1, L$1, S, _i, Oi, Is, Ti, Z$1, xi, Ce$1, Jt$1, Rt, C, jt, Yr, Kr, Vr, $r, Fe$1, Li, Xr, qr, A$1, Jr, ht, H$1, te, m$1, Ni, tt$1, Ai, ki, vi, ie$1, ke$1, Ut$1, Ht, Ii, Pt, at, U$1, ot, Y$1, zt, Ci, j$1, ee$1, Fi, ve$1, gt$2, Me, bt, _t, Be$1, et$1, Wt$1, jr, Fs, ks, vs, Ms, Bs, tn, se$1, K$1, sn, M$1, rn, zs, nn, Bi, Tt, Gt, Pi, re, Pe$1, ze$1, Ue, He$1, We$1, Ge$1, Ze$1, Ye$1, Ke$1, Us, hn, an, Hs, ln, cn, Ws, Gs, Hi, ne, dn, Ui, oe$1, Ve$1, un, F$1, mn, xt, Wi, pn, lt, En, wn, Sn, ct, yn, Rn, gn, Gi, bn, Lt, ft, On, Tn, xn, f, $e$1, Dt, Nn, Xi, qi, An, B$1, Nt, it, Zi, Zs, V$1, he$1, dt, Ys, p, st$1, ut, Yi, At, w$1, Xe$1, qe$1, Ki, Ks, Vs, ae$1, Vi, Qe$1, Yt$1, $$1, Je$1, It, je$1, ti, $s, In, le$1, $i, Xs, Cn, rt$1, mt, vn, Qi, Mn, Bn, Ct, Ji, zn, qs, ce$1, ei, ji, Un, Hn, ts, Qs, rr, Wn, tr, er, ir, is$2, sr, fe$1, ii, ss, si, rs, ns, os$6, hs, pt, ri, as, es, q$1, de$1, ni, oi, Gn, hi, ue$1, pi, nr, li, me$1, W$1, pe$2, Et, Ft$1, Ee$1, ai, G, ls, ci, or, ds, us, fi, di, hr, cs, ui, lr, fs$
|
|
252771
|
+
var zr, Ur, Ds, Wr, Gr, Zr, Q$1, J$1, nt$1, De$1, qt, Ne$1, Ns, Ae$1, As, z$1, Mt, g$1, Qt, Bt, b$1, N$1, _$1, bi, Ie$1, L$1, S, _i, Oi, Is, Ti, Z$1, xi, Ce$1, Jt$1, Rt, C, jt, Yr, Kr, Vr, $r, Fe$1, Li, Xr, qr, A$1, Jr, ht, H$1, te, m$1, Ni, tt$1, Ai, ki, vi, ie$1, ke$1, Ut$1, Ht, Ii, Pt, at, U$1, ot, Y$1, zt, Ci, j$1, ee$1, Fi, ve$1, gt$2, Me, bt, _t, Be$1, et$1, Wt$1, jr, Fs, ks, vs, Ms, Bs, tn, se$1, K$1, sn, M$1, rn, zs, nn, Bi, Tt, Gt, Pi, re, Pe$1, ze$1, Ue, He$1, We$1, Ge$1, Ze$1, Ye$1, Ke$1, Us, hn, an, Hs, ln, cn, Ws, Gs, Hi, ne, dn, Ui, oe$1, Ve$1, un, F$1, mn, xt, Wi, pn, lt, En, wn, Sn, ct, yn, Rn, gn, Gi, bn, Lt, ft, On, Tn, xn, f, $e$1, Dt, Nn, Xi, qi, An, B$1, Nt, it, Zi, Zs, V$1, he$1, dt, Ys, p, st$1, ut, Yi, At, w$1, Xe$1, qe$1, Ki, Ks, Vs, ae$1, Vi, Qe$1, Yt$1, $$1, Je$1, It, je$1, ti, $s, In, le$1, $i, Xs, Cn, rt$1, mt, vn, Qi, Mn, Bn, Ct, Ji, zn, qs, ce$1, ei, ji, Un, Hn, ts, Qs, rr, Wn, tr, er, ir, is$2, sr, fe$1, ii, ss, si, rs, ns, os$6, hs, pt, ri, as, es, q$1, de$1, ni, oi, Gn, hi, ue$1, pi, nr, li, me$1, W$1, pe$2, Et, Ft$1, Ee$1, ai, G, ls, ci, or, ds, us, fi, di, hr, cs, ui, lr, fs$11, wt, kt, Vn, $n, fr, dr, Xn, qn, Er, wr, ur, Sr, yr, Rr, jn, to, eo, mr, ms, ps, Ei, io, Es, so, ws, Se$1, St, no, gr, Ss, br, oo, _r, ys, Or, Vt$1, Tr, ao, lo, yi, Lr, Dr, _s, Nr, Os, P$1, Ts, xs, gi, Ar, Ir, Re, Cr, Fr, Rs, yt, O$1, Ri, kr, $t, gs, bs, Ls, ge$1, be, _e$1, Oe$1, Te$1, uo, mo, po, vr, Xt$1, ye$1, xe$1, Eo, wo, So, yo, Ro, go, bo, _o, vt, To;
|
|
252772
252772
|
var init_index_min = __esmMin((() => {
|
|
252773
252773
|
zr = Object.defineProperty;
|
|
252774
252774
|
Ur = (s, t) => {
|
|
@@ -254296,7 +254296,7 @@ while (this[Zs](this[st$1].shift()));
|
|
|
254296
254296
|
let [o, h] = ce$1(this.path);
|
|
254297
254297
|
o && typeof h == "string" && (this.path = h, r = o);
|
|
254298
254298
|
}
|
|
254299
|
-
this.win32 = !!i.win32 || process.platform === "win32", this.win32 && (this.path = Qs(this.path.replaceAll(/\\/g, "/")), t = t.replaceAll(/\\/g, "/")), this.absolute = f(i.absolute ||
|
|
254299
|
+
this.win32 = !!i.win32 || process.platform === "win32", this.win32 && (this.path = Qs(this.path.replaceAll(/\\/g, "/")), t = t.replaceAll(/\\/g, "/")), this.absolute = f(i.absolute || js.resolve(this.cwd, t)), this.path === "" && (this.path = "./"), r && this.warn("TAR_ENTRY_INFO", `stripping ${r} from absolute path`, {
|
|
254300
254300
|
entry: this,
|
|
254301
254301
|
path: r + this.path
|
|
254302
254302
|
});
|
|
@@ -254379,7 +254379,7 @@ while (this[Zs](this[st$1].shift()));
|
|
|
254379
254379
|
}
|
|
254380
254380
|
[sr](t) {
|
|
254381
254381
|
if (!this.stat) throw new Error("cannot create link entry without stat");
|
|
254382
|
-
this.type = "Link", this.linkpath = f(
|
|
254382
|
+
this.type = "Link", this.linkpath = f(js.relative(this.cwd, t)), this.stat.size = 0, this[fe$1](), this.end();
|
|
254383
254383
|
}
|
|
254384
254384
|
[er]() {
|
|
254385
254385
|
if (!this.stat) throw new Error("cannot create file entry without stat");
|
|
@@ -254738,7 +254738,7 @@ while (this[Zs](this[st$1].shift()));
|
|
|
254738
254738
|
constructor(t, e) {
|
|
254739
254739
|
this.path = t || "./", this.absolute = e;
|
|
254740
254740
|
}
|
|
254741
|
-
}, nr = Buffer.alloc(1024), li = Symbol("onStat"), me$1 = Symbol("ended"), W$1 = Symbol("queue"), pe$2 = Symbol("pendingLinks"), Et = Symbol("current"), Ft$1 = Symbol("process"), Ee$1 = Symbol("processing"), ai = Symbol("processJob"), G = Symbol("jobs"), ls = Symbol("jobDone"), ci = Symbol("addFSEntry"), or = Symbol("addTarEntry"), ds = Symbol("stat"), us = Symbol("readdir"), fi = Symbol("onreaddir"), di = Symbol("pipe"), hr = Symbol("entry"), cs = Symbol("entryOpt"), ui = Symbol("writeEntryClass"), lr = Symbol("write"), fs$
|
|
254741
|
+
}, nr = Buffer.alloc(1024), li = Symbol("onStat"), me$1 = Symbol("ended"), W$1 = Symbol("queue"), pe$2 = Symbol("pendingLinks"), Et = Symbol("current"), Ft$1 = Symbol("process"), Ee$1 = Symbol("processing"), ai = Symbol("processJob"), G = Symbol("jobs"), ls = Symbol("jobDone"), ci = Symbol("addFSEntry"), or = Symbol("addTarEntry"), ds = Symbol("stat"), us = Symbol("readdir"), fi = Symbol("onreaddir"), di = Symbol("pipe"), hr = Symbol("entry"), cs = Symbol("entryOpt"), ui = Symbol("writeEntryClass"), lr = Symbol("write"), fs$11 = Symbol("ondrain"), wt = class extends A$1 {
|
|
254742
254742
|
sync = !1;
|
|
254743
254743
|
opt;
|
|
254744
254744
|
cwd;
|
|
@@ -254771,8 +254771,8 @@ while (this[Zs](this[st$1].shift()));
|
|
|
254771
254771
|
if ((t.gzip ? 1 : 0) + (t.brotli ? 1 : 0) + (t.zstd ? 1 : 0) > 1) throw new TypeError("gzip, brotli, zstd are mutually exclusive");
|
|
254772
254772
|
if (t.gzip && (typeof t.gzip != "object" && (t.gzip = {}), this.portable && (t.gzip.portable = !0), this.zip = new ze$1(t.gzip)), t.brotli && (typeof t.brotli != "object" && (t.brotli = {}), this.zip = new We$1(t.brotli)), t.zstd && (typeof t.zstd != "object" && (t.zstd = {}), this.zip = new Ye$1(t.zstd)), !this.zip) throw new Error("impossible");
|
|
254773
254773
|
let e = this.zip;
|
|
254774
|
-
e.on("data", (i) => super.write(i)), e.on("end", () => super.end()), e.on("drain", () => this[fs$
|
|
254775
|
-
} else this.on("drain", this[fs$
|
|
254774
|
+
e.on("data", (i) => super.write(i)), e.on("end", () => super.end()), e.on("drain", () => this[fs$11]()), this.on("resume", () => e.resume());
|
|
254775
|
+
} else this.on("drain", this[fs$11]);
|
|
254776
254776
|
this.noDirRecurse = !!t.noDirRecurse, this.follow = !!t.follow, this.noMtime = !!t.noMtime, t.mtime && (this.mtime = t.mtime), this.filter = typeof t.filter == "function" ? t.filter : () => !0, this[W$1] = new hi(), this[G] = 0, this.jobs = Number(t.jobs) || 4, this[Ee$1] = !1, this[me$1] = !1;
|
|
254777
254777
|
}
|
|
254778
254778
|
[lr](t) {
|
|
@@ -254789,7 +254789,7 @@ while (this[Zs](this[st$1].shift()));
|
|
|
254789
254789
|
return typeof t == "string" ? this[ci](t) : this[or](t), this.flowing;
|
|
254790
254790
|
}
|
|
254791
254791
|
[or](t) {
|
|
254792
|
-
let e = f(
|
|
254792
|
+
let e = f(js.resolve(this.cwd, t.path));
|
|
254793
254793
|
if (!this.filter(t.path, t)) t.resume();
|
|
254794
254794
|
else {
|
|
254795
254795
|
let i = new pi(t.path, e);
|
|
@@ -254798,7 +254798,7 @@ while (this[Zs](this[st$1].shift()));
|
|
|
254798
254798
|
this[Ft$1]();
|
|
254799
254799
|
}
|
|
254800
254800
|
[ci](t) {
|
|
254801
|
-
let e = f(
|
|
254801
|
+
let e = f(js.resolve(this.cwd, t));
|
|
254802
254802
|
this[W$1].push(new pi(t, e)), this[Ft$1]();
|
|
254803
254803
|
}
|
|
254804
254804
|
[ds](t) {
|
|
@@ -254899,7 +254899,7 @@ while (this[Zs](this[st$1].shift()));
|
|
|
254899
254899
|
this.emit("error", e);
|
|
254900
254900
|
}
|
|
254901
254901
|
}
|
|
254902
|
-
[fs$
|
|
254902
|
+
[fs$11]() {
|
|
254903
254903
|
this[Et] && this[Et].entry && this[Et].entry.resume();
|
|
254904
254904
|
}
|
|
254905
254905
|
[di](t) {
|
|
@@ -255065,7 +255065,7 @@ while (this[Zs](this[st$1].shift()));
|
|
|
255065
255065
|
E ? e(E) : x && a ? Es(x, o, h, (Le) => y(Le)) : n ? Kt.chmod(s, r, e) : e();
|
|
255066
255066
|
};
|
|
255067
255067
|
if (s === d) return no(s, y);
|
|
255068
|
-
if (l) return
|
|
255068
|
+
if (l) return ro.mkdir(s, {
|
|
255069
255069
|
mode: r,
|
|
255070
255070
|
recursive: !0
|
|
255071
255071
|
}).then((E) => y(null, E ?? void 0), y);
|
|
@@ -255824,7 +255824,7 @@ var require_pend = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
255824
255824
|
//#endregion
|
|
255825
255825
|
//#region ../../node_modules/.pnpm/yauzl@3.3.0/node_modules/yauzl/fd-slicer.js
|
|
255826
255826
|
var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
255827
|
-
var fs$
|
|
255827
|
+
var fs$10 = __require("fs");
|
|
255828
255828
|
var util$6 = __require("util");
|
|
255829
255829
|
var stream$2 = __require("stream");
|
|
255830
255830
|
var Readable = stream$2.Readable;
|
|
@@ -255849,7 +255849,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
255849
255849
|
FdSlicer.prototype.read = function(buffer, offset, length, position, callback) {
|
|
255850
255850
|
var self = this;
|
|
255851
255851
|
self.pend.go(function(cb) {
|
|
255852
|
-
fs$
|
|
255852
|
+
fs$10.read(self.fd, buffer, offset, length, position, function(err, bytesRead, buffer) {
|
|
255853
255853
|
cb();
|
|
255854
255854
|
callback(err, bytesRead, buffer);
|
|
255855
255855
|
});
|
|
@@ -255858,7 +255858,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
255858
255858
|
FdSlicer.prototype.write = function(buffer, offset, length, position, callback) {
|
|
255859
255859
|
var self = this;
|
|
255860
255860
|
self.pend.go(function(cb) {
|
|
255861
|
-
fs$
|
|
255861
|
+
fs$10.write(self.fd, buffer, offset, length, position, function(err, written, buffer) {
|
|
255862
255862
|
cb();
|
|
255863
255863
|
callback(err, written, buffer);
|
|
255864
255864
|
});
|
|
@@ -255878,7 +255878,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
255878
255878
|
self.refCount -= 1;
|
|
255879
255879
|
if (self.refCount > 0) return;
|
|
255880
255880
|
if (self.refCount < 0) throw new Error("invalid unref");
|
|
255881
|
-
if (self.autoClose) fs$
|
|
255881
|
+
if (self.autoClose) fs$10.close(self.fd, onCloseDone);
|
|
255882
255882
|
function onCloseDone(err) {
|
|
255883
255883
|
if (err) self.emit("error", err);
|
|
255884
255884
|
else self.emit("close");
|
|
@@ -255909,7 +255909,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
255909
255909
|
self.context.pend.go(function(cb) {
|
|
255910
255910
|
if (self.destroyed) return cb();
|
|
255911
255911
|
var buffer = Buffer.allocUnsafe(toRead);
|
|
255912
|
-
fs$
|
|
255912
|
+
fs$10.read(self.context.fd, buffer, 0, toRead, self.pos, function(err, bytesRead) {
|
|
255913
255913
|
if (err) self.destroy(err);
|
|
255914
255914
|
else if (bytesRead === 0) {
|
|
255915
255915
|
self.destroyed = true;
|
|
@@ -255955,7 +255955,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
255955
255955
|
}
|
|
255956
255956
|
self.context.pend.go(function(cb) {
|
|
255957
255957
|
if (self.destroyed) return cb();
|
|
255958
|
-
fs$
|
|
255958
|
+
fs$10.write(self.context.fd, buffer, 0, buffer.length, self.pos, function(err, bytes) {
|
|
255959
255959
|
if (err) {
|
|
255960
255960
|
self.destroy();
|
|
255961
255961
|
cb();
|
|
@@ -258828,7 +258828,7 @@ var init_read_media = __esmMin((() => {
|
|
|
258828
258828
|
//#region ../../packages/agent-core/src/tools/builtin/file/write.md?raw
|
|
258829
258829
|
var write_default;
|
|
258830
258830
|
var init_write$1 = __esmMin((() => {
|
|
258831
|
-
write_default = "Create, append to, or replace a file entirely.\n\n- Missing parent directories are created automatically (like `mkdir(parents=True, exist_ok=True)`).\n- Mode defaults to overwrite; append adds content at EOF without adding a newline.\n- Write is NOT ALLOWED for incremental changes to existing files, including trivial, one-line, quick, or cosmetic edits. Use Edit instead.\n- Use Write only when the file does not exist, you intend a complete replacement, or the new contents have little continuity with the old contents.\n- Do not create unsolicited documentation files (`*.md` write-ups, `README`s, summaries) just because a task finished — write one only when the user asks for it, or when a task or project instruction requires it (e.g. the plan-mode plan file, created with Write when plan mode directs you to, or a changeset the repo mandates).\n- Read before overwriting an existing file.\n- Write ignores the Read/Edit line-number view. NEVER include line prefixes.\n- Write outputs content literally, including supplied line endings: \\n stays LF, \\r\\n stays CRLF.\n- Source files may contain at most 500 lines. Split larger implementations into focused files; append cannot bypass the limit.\n- Set `single_file_override=true` only when the latest direct user message explicitly requires one single file. The accepted override is reported visibly.\n- For any new or completely replaced file with content too large for one call, use `continuation`. Keep
|
|
258831
|
+
write_default = "Create, append to, or replace a file entirely.\n\n- Missing parent directories are created automatically (like `mkdir(parents=True, exist_ok=True)`).\n- Mode defaults to overwrite; append adds content at EOF without adding a newline.\n- Write is NOT ALLOWED for incremental changes to existing files, including trivial, one-line, quick, or cosmetic edits. Use Edit instead.\n- Use Write only when the file does not exist, you intend a complete replacement, or the new contents have little continuity with the old contents.\n- Do not create unsolicited documentation files (`*.md` write-ups, `README`s, summaries) just because a task finished — write one only when the user asks for it, or when a task or project instruction requires it (e.g. the plan-mode plan file, created with Write when plan mode directs you to, or a changeset the repo mandates).\n- Read before overwriting an existing file.\n- Write ignores the Read/Edit line-number view. NEVER include line prefixes.\n- Write outputs content literally, including supplied line endings: \\n stays LF, \\r\\n stays CRLF.\n- Source files may contain at most 500 lines. Split larger implementations into focused files; append cannot bypass the limit.\n- Set `single_file_override=true` only when the latest direct user message explicitly requires one single file. The accepted override is reported visibly.\n- For any new or completely replaced file with content too large for one call, use `continuation`. Keep each chunk at or below the configured limit. The default is 2,048 UTF-8 bytes, a conservative safety margin for unstable model output rather than a measured hard model limit; operators can set `BLUN_WRITE_CONTINUATION_MAX_BYTES` from 512 through 16,384. End every chunk on a complete line with `\\n`. Set the exact final `expected_lines`; include `expected_sha256` when a source hash is available. Use overwrite and `start_line=1` for the first chunk, then use append for every later chunk and copy the exact `next_start_line` returned by the previous Write result; never continue from a planned boundary. Use consecutive part numbers. The target file remains unchanged until the final line-count and optional SHA-256 checks pass. To discard an unfinished sequence, restart with part 1, overwrite, `start_line=1`, and `reset=true`.\n- Never use continuation to modify an existing file incrementally. Use Edit for incremental changes.\n- Runaway generated JavaScript/TypeScript identifiers are rejected before disk I/O. Regenerate only the affected section as a smaller focused chunk.\n";
|
|
258832
258832
|
}));
|
|
258833
258833
|
//#endregion
|
|
258834
258834
|
//#region ../../packages/agent-core/src/tools/builtin/file/generated-source-health.ts
|
|
@@ -258941,12 +258941,19 @@ var init_generated_source_health = __esmMin((() => {
|
|
|
258941
258941
|
}));
|
|
258942
258942
|
//#endregion
|
|
258943
258943
|
//#region ../../packages/agent-core/src/tools/builtin/file/write.ts
|
|
258944
|
+
function resolveWriteContinuationChunkBytes(env = process.env) {
|
|
258945
|
+
const raw = env[CONTINUATION_CHUNK_BYTES_ENV]?.trim();
|
|
258946
|
+
if (raw === void 0 || raw === "") return DEFAULT_CONTINUATION_CHUNK_BYTES;
|
|
258947
|
+
const parsed = Number(raw);
|
|
258948
|
+
if (!Number.isSafeInteger(parsed) || parsed < MIN_CONTINUATION_CHUNK_BYTES || parsed > MAX_CONTINUATION_CHUNK_BYTES) throw new Error(`${CONTINUATION_CHUNK_BYTES_ENV} must be an integer between ${String(MIN_CONTINUATION_CHUNK_BYTES)} and ${String(MAX_CONTINUATION_CHUNK_BYTES)} bytes; received ${JSON.stringify(raw)}.`);
|
|
258949
|
+
return parsed;
|
|
258950
|
+
}
|
|
258944
258951
|
function countCompletedLines(content) {
|
|
258945
258952
|
let count = 0;
|
|
258946
258953
|
for (const character of content) if (character === "\n") count += 1;
|
|
258947
258954
|
return count;
|
|
258948
258955
|
}
|
|
258949
|
-
var S_IFMT, S_IFDIR, MAX_CONTINUATION_CHUNK_BYTES, WriteContinuationSchema, WriteInputSchema, WriteTool;
|
|
258956
|
+
var S_IFMT, S_IFDIR, DEFAULT_CONTINUATION_CHUNK_BYTES, MIN_CONTINUATION_CHUNK_BYTES, MAX_CONTINUATION_CHUNK_BYTES, CONTINUATION_CHUNK_BYTES_ENV, WriteContinuationSchema, WriteInputSchema, WriteTool;
|
|
258950
258957
|
var init_write = __esmMin((() => {
|
|
258951
258958
|
init_dist$6();
|
|
258952
258959
|
init_zod$1();
|
|
@@ -258960,19 +258967,24 @@ var init_write = __esmMin((() => {
|
|
|
258960
258967
|
init_lsp_diagnostics();
|
|
258961
258968
|
S_IFMT = 61440;
|
|
258962
258969
|
S_IFDIR = 16384;
|
|
258963
|
-
|
|
258970
|
+
DEFAULT_CONTINUATION_CHUNK_BYTES = 2048;
|
|
258971
|
+
MIN_CONTINUATION_CHUNK_BYTES = 512;
|
|
258972
|
+
MAX_CONTINUATION_CHUNK_BYTES = 16384;
|
|
258973
|
+
CONTINUATION_CHUNK_BYTES_ENV = "BLUN_WRITE_CONTINUATION_MAX_BYTES";
|
|
258964
258974
|
WriteContinuationSchema = object({
|
|
258965
258975
|
part: number$1().int().positive().describe("One-based chunk number. Start with 1 and increment by exactly one."),
|
|
258976
|
+
start_line: number$1().int().positive().describe("One-based line where this chunk starts. Use 1 for part 1; for every later part, copy next_start_line from the preceding tool result instead of using a planned boundary."),
|
|
258966
258977
|
expected_lines: number$1().int().positive().describe("Exact completed-line count expected in the final file."),
|
|
258967
258978
|
final: boolean$1().describe("Set true only for the last chunk, when the complete file is present."),
|
|
258968
|
-
expected_sha256: string().regex(/^[0-9a-f]{64}$/i).optional().describe("Optional SHA-256 of the complete expected file for byte-for-byte verification.")
|
|
258979
|
+
expected_sha256: string().regex(/^[0-9a-f]{64}$/i).optional().describe("Optional SHA-256 of the complete expected file for byte-for-byte verification."),
|
|
258980
|
+
reset: boolean$1().optional().describe("Set true only with part 1 and overwrite to discard an unfinished staged write.")
|
|
258969
258981
|
});
|
|
258970
258982
|
WriteInputSchema = object({
|
|
258971
258983
|
path: string().describe("Path to the file to create, append to, or completely overwrite. Relative paths resolve against the working directory; a path outside the working directory must be absolute. Missing parent directories are created automatically."),
|
|
258972
258984
|
content: string().describe("Raw full file content to write exactly as provided. This does not use the Read/Edit text view."),
|
|
258973
258985
|
mode: _enum(["overwrite", "append"]).optional().describe("Write mode. Defaults to overwrite. append adds content to the end exactly as provided and does not add a newline."),
|
|
258974
258986
|
single_file_override: boolean$1().optional().describe("Set true only when the latest direct user message explicitly requires one single source file. The tool verifies that request and reports the override visibly."),
|
|
258975
|
-
continuation: WriteContinuationSchema.optional().describe("Safe long-write protocol. Split generated files into complete-line chunks
|
|
258987
|
+
continuation: WriteContinuationSchema.optional().describe("Safe long-write protocol. Split generated files into complete-line chunks within the configured limit (2,048 UTF-8 bytes by default; operator override BLUN_WRITE_CONTINUATION_MAX_BYTES). Part 1 uses overwrite and start_line=1; later parts use append and the exact next_start_line returned by the previous call. The target file is changed only after the final line-count and optional SHA-256 checks pass.")
|
|
258976
258988
|
});
|
|
258977
258989
|
object({
|
|
258978
258990
|
/** Number of UTF-8 bytes written to disk by this call. */
|
|
@@ -258982,15 +258994,17 @@ bytesWritten: number$1().int().nonnegative() });
|
|
|
258982
258994
|
workspace;
|
|
258983
258995
|
history;
|
|
258984
258996
|
lsp;
|
|
258997
|
+
maxContinuationChunkBytes;
|
|
258985
258998
|
name = "Write";
|
|
258986
258999
|
description = write_default;
|
|
258987
259000
|
parameters = toInputJsonSchema(WriteInputSchema);
|
|
258988
259001
|
pendingContinuations = /* @__PURE__ */ new Map();
|
|
258989
|
-
constructor(kaos, workspace, history, lsp) {
|
|
259002
|
+
constructor(kaos, workspace, history, lsp, maxContinuationChunkBytes = resolveWriteContinuationChunkBytes()) {
|
|
258990
259003
|
this.kaos = kaos;
|
|
258991
259004
|
this.workspace = workspace;
|
|
258992
259005
|
this.history = history;
|
|
258993
259006
|
this.lsp = lsp;
|
|
259007
|
+
this.maxContinuationChunkBytes = maxContinuationChunkBytes;
|
|
258994
259008
|
}
|
|
258995
259009
|
resolveExecution(args) {
|
|
258996
259010
|
const path = resolvePathAccessPath(args.path, {
|
|
@@ -259029,20 +259043,30 @@ bytesWritten: number$1().int().nonnegative() });
|
|
|
259029
259043
|
if (continuation === void 0) throw new Error("continuation is required");
|
|
259030
259044
|
const mode = args.mode ?? "overwrite";
|
|
259031
259045
|
const chunkBytes = Buffer.byteLength(args.content, "utf8");
|
|
259032
|
-
if (chunkBytes >
|
|
259046
|
+
if (chunkBytes > this.maxContinuationChunkBytes) return {
|
|
259033
259047
|
isError: true,
|
|
259034
|
-
output: `Refused continuation part ${String(continuation.part)} for ${args.path}: chunks may contain at most ${
|
|
259048
|
+
output: `Refused continuation part ${String(continuation.part)} for ${args.path}: chunks may contain at most ${this.maxContinuationChunkBytes.toLocaleString("en-US")} UTF-8 bytes (${String(chunkBytes)} received). No content was staged and no file was written.`
|
|
259035
259049
|
};
|
|
259036
259050
|
if (args.content.length === 0 || !args.content.endsWith("\n")) return {
|
|
259037
259051
|
isError: true,
|
|
259038
259052
|
output: `Refused continuation part ${String(continuation.part)} for ${args.path}: every chunk must end on a complete line with a newline. No content was staged and no file was written.`
|
|
259039
259053
|
};
|
|
259054
|
+
if (continuation.reset === true && (continuation.part !== 1 || mode !== "overwrite")) return {
|
|
259055
|
+
isError: true,
|
|
259056
|
+
output: `Refused continuation reset for ${args.path}: reset requires part 1 with mode=overwrite. No content was staged and no file was written.`
|
|
259057
|
+
};
|
|
259058
|
+
if (continuation.reset === true) this.pendingContinuations.delete(safePath);
|
|
259040
259059
|
const current = this.pendingContinuations.get(safePath);
|
|
259041
259060
|
const expectedPart = current === void 0 ? 1 : current.chunks.length + 1;
|
|
259042
259061
|
if (continuation.part !== expectedPart) return {
|
|
259043
259062
|
isError: true,
|
|
259044
259063
|
output: `Refused continuation part ${String(continuation.part)} for ${args.path}: expected part ${String(expectedPart)}. No content was staged and no file was written.`
|
|
259045
259064
|
};
|
|
259065
|
+
const expectedStartLine = (current?.completedLines ?? 0) + 1;
|
|
259066
|
+
if (continuation.start_line !== expectedStartLine) return {
|
|
259067
|
+
isError: true,
|
|
259068
|
+
output: `Refused continuation part ${String(continuation.part)} for ${args.path}: expected start_line ${String(expectedStartLine)} from the actually staged content, received ${String(continuation.start_line)}. No content was staged and no file was written.`
|
|
259069
|
+
};
|
|
259046
259070
|
if (continuation.part === 1 && mode !== "overwrite" || continuation.part > 1 && mode !== "append") return {
|
|
259047
259071
|
isError: true,
|
|
259048
259072
|
output: `Refused continuation part ${String(continuation.part)} for ${args.path}: part 1 must use overwrite and later parts must use append. No content was staged and no file was written.`
|
|
@@ -259093,7 +259117,7 @@ bytesWritten: number$1().int().nonnegative() });
|
|
|
259093
259117
|
});
|
|
259094
259118
|
if (!continuation.final) {
|
|
259095
259119
|
this.pendingContinuations.set(safePath, staged);
|
|
259096
|
-
return { output: `Write continuation part ${String(continuation.part)} staged lines ${boundary} of ${String(continuation.expected_lines)} (${String(percent)}%, ${String(chunkBytes)} bytes). Target unchanged. Continue with mode=append, part=${String(continuation.part + 1)}.` };
|
|
259120
|
+
return { output: `Write continuation part ${String(continuation.part)} staged lines ${boundary} of ${String(continuation.expected_lines)} (${String(percent)}%, ${String(chunkBytes)} bytes). Target unchanged. Continue with mode=append, part=${String(continuation.part + 1)}, next_start_line=${String(completedLines + 1)}.` };
|
|
259097
259121
|
}
|
|
259098
259122
|
const content = chunks.join("");
|
|
259099
259123
|
const actualSha256 = createHash("sha256").update(content).digest("hex");
|
|
@@ -259108,6 +259132,20 @@ bytesWritten: number$1().int().nonnegative() });
|
|
|
259108
259132
|
continuation: void 0
|
|
259109
259133
|
}, safePath, true);
|
|
259110
259134
|
if (result.isError === true) return result;
|
|
259135
|
+
let persistedSha256;
|
|
259136
|
+
try {
|
|
259137
|
+
const persistedContent = await this.kaos.readText(safePath);
|
|
259138
|
+
persistedSha256 = createHash("sha256").update(persistedContent).digest("hex");
|
|
259139
|
+
} catch (error) {
|
|
259140
|
+
return {
|
|
259141
|
+
isError: true,
|
|
259142
|
+
output: `Write continuation wrote ${args.path}, but could not verify the persisted bytes: ${error instanceof Error ? error.message : String(error)}. Inspect the target before continuing.`
|
|
259143
|
+
};
|
|
259144
|
+
}
|
|
259145
|
+
if (persistedSha256 !== actualSha256) return {
|
|
259146
|
+
isError: true,
|
|
259147
|
+
output: `Write continuation integrity failure for ${args.path}: staged SHA-256 ${actualSha256}, persisted SHA-256 ${persistedSha256}. The target may be incomplete; inspect it before continuing.`
|
|
259148
|
+
};
|
|
259111
259149
|
this.pendingContinuations.delete(safePath);
|
|
259112
259150
|
const writeOutput = typeof result.output === "string" ? result.output : "Write completed.";
|
|
259113
259151
|
return {
|
|
@@ -259142,9 +259180,9 @@ bytesWritten: number$1().int().nonnegative() });
|
|
|
259142
259180
|
output: lineLimit.error
|
|
259143
259181
|
};
|
|
259144
259182
|
const contentBytes = Buffer.byteLength(args.content, "utf8");
|
|
259145
|
-
if (!allowLargeContent && contentBytes >
|
|
259183
|
+
if (!allowLargeContent && contentBytes > this.maxContinuationChunkBytes) return {
|
|
259146
259184
|
isError: true,
|
|
259147
|
-
output: `Refused to write ${args.path}: the content is ${String(contentBytes)} UTF-8 bytes. Long generated writes must use the continuation protocol with complete-line chunks of at most ${
|
|
259185
|
+
output: `Refused to write ${args.path}: the content is ${String(contentBytes)} UTF-8 bytes. Long generated writes must use the continuation protocol with complete-line chunks of at most ${this.maxContinuationChunkBytes.toLocaleString("en-US")} bytes. No file was written.`
|
|
259148
259186
|
};
|
|
259149
259187
|
const parentError = await this.ensureParentDirectory(safePath);
|
|
259150
259188
|
if (parentError !== void 0) return {
|
|
@@ -293165,7 +293203,7 @@ var init_proxy = __esmMin((() => {
|
|
|
293165
293203
|
var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
293166
293204
|
module.exports = isexe;
|
|
293167
293205
|
isexe.sync = sync;
|
|
293168
|
-
var fs$
|
|
293206
|
+
var fs$8 = __require("fs");
|
|
293169
293207
|
function checkPathExt(path, options) {
|
|
293170
293208
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
293171
293209
|
if (!pathext) return true;
|
|
@@ -293182,12 +293220,12 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
293182
293220
|
return checkPathExt(path, options);
|
|
293183
293221
|
}
|
|
293184
293222
|
function isexe(path, options, cb) {
|
|
293185
|
-
fs$
|
|
293223
|
+
fs$8.stat(path, function(er, stat) {
|
|
293186
293224
|
cb(er, er ? false : checkStat(stat, path, options));
|
|
293187
293225
|
});
|
|
293188
293226
|
}
|
|
293189
293227
|
function sync(path, options) {
|
|
293190
|
-
return checkStat(fs$
|
|
293228
|
+
return checkStat(fs$8.statSync(path), path, options);
|
|
293191
293229
|
}
|
|
293192
293230
|
}));
|
|
293193
293231
|
//#endregion
|
|
@@ -293195,14 +293233,14 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
293195
293233
|
var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
293196
293234
|
module.exports = isexe;
|
|
293197
293235
|
isexe.sync = sync;
|
|
293198
|
-
var fs$
|
|
293236
|
+
var fs$7 = __require("fs");
|
|
293199
293237
|
function isexe(path, options, cb) {
|
|
293200
|
-
fs$
|
|
293238
|
+
fs$7.stat(path, function(er, stat) {
|
|
293201
293239
|
cb(er, er ? false : checkStat(stat, options));
|
|
293202
293240
|
});
|
|
293203
293241
|
}
|
|
293204
293242
|
function sync(path, options) {
|
|
293205
|
-
return checkStat(fs$
|
|
293243
|
+
return checkStat(fs$7.statSync(path), options);
|
|
293206
293244
|
}
|
|
293207
293245
|
function checkStat(stat, options) {
|
|
293208
293246
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -293266,7 +293304,7 @@ var require_isexe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
293266
293304
|
//#region ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
|
|
293267
293305
|
var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
293268
293306
|
const isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
293269
|
-
const path$
|
|
293307
|
+
const path$9 = __require("path");
|
|
293270
293308
|
const COLON = isWindows ? ";" : ":";
|
|
293271
293309
|
const isexe = require_isexe();
|
|
293272
293310
|
const getNotFoundError = (cmd) => Object.assign(/* @__PURE__ */ new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
@@ -293296,7 +293334,7 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
293296
293334
|
if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
|
|
293297
293335
|
const ppRaw = pathEnv[i];
|
|
293298
293336
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
293299
|
-
const pCmd = path$
|
|
293337
|
+
const pCmd = path$9.join(pathPart, cmd);
|
|
293300
293338
|
resolve(subStep(!pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd, i, 0));
|
|
293301
293339
|
});
|
|
293302
293340
|
const subStep = (p, i, ii) => new Promise((resolve, reject) => {
|
|
@@ -293317,7 +293355,7 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
293317
293355
|
for (let i = 0; i < pathEnv.length; i++) {
|
|
293318
293356
|
const ppRaw = pathEnv[i];
|
|
293319
293357
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
293320
|
-
const pCmd = path$
|
|
293358
|
+
const pCmd = path$9.join(pathPart, cmd);
|
|
293321
293359
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
293322
293360
|
for (let j = 0; j < pathExt.length; j++) {
|
|
293323
293361
|
const cur = p + pathExt[j];
|
|
@@ -293348,7 +293386,7 @@ var require_path_key = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
293348
293386
|
//#endregion
|
|
293349
293387
|
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
293350
293388
|
var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
293351
|
-
const path$
|
|
293389
|
+
const path$8 = __require("path");
|
|
293352
293390
|
const which = require_which();
|
|
293353
293391
|
const getPathKey = require_path_key();
|
|
293354
293392
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
@@ -293363,12 +293401,12 @@ var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
293363
293401
|
try {
|
|
293364
293402
|
resolved = which.sync(parsed.command, {
|
|
293365
293403
|
path: env[getPathKey({ env })],
|
|
293366
|
-
pathExt: withoutPathExt ? path$
|
|
293404
|
+
pathExt: withoutPathExt ? path$8.delimiter : void 0
|
|
293367
293405
|
});
|
|
293368
293406
|
} catch (e) {} finally {
|
|
293369
293407
|
if (shouldSwitchCwd) process.chdir(cwd);
|
|
293370
293408
|
}
|
|
293371
|
-
if (resolved) resolved = path$
|
|
293409
|
+
if (resolved) resolved = path$8.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
293372
293410
|
return resolved;
|
|
293373
293411
|
}
|
|
293374
293412
|
function resolveCommand(parsed) {
|
|
@@ -293417,16 +293455,16 @@ var require_shebang_command = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
293417
293455
|
//#endregion
|
|
293418
293456
|
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
|
|
293419
293457
|
var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
293420
|
-
const fs$
|
|
293458
|
+
const fs$6 = __require("fs");
|
|
293421
293459
|
const shebangCommand = require_shebang_command();
|
|
293422
293460
|
function readShebang(command) {
|
|
293423
293461
|
const size = 150;
|
|
293424
293462
|
const buffer = Buffer.alloc(size);
|
|
293425
293463
|
let fd;
|
|
293426
293464
|
try {
|
|
293427
|
-
fd = fs$
|
|
293428
|
-
fs$
|
|
293429
|
-
fs$
|
|
293465
|
+
fd = fs$6.openSync(command, "r");
|
|
293466
|
+
fs$6.readSync(fd, buffer, 0, size, 0);
|
|
293467
|
+
fs$6.closeSync(fd);
|
|
293430
293468
|
} catch (e) {}
|
|
293431
293469
|
return shebangCommand(buffer.toString());
|
|
293432
293470
|
}
|
|
@@ -293435,7 +293473,7 @@ var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
293435
293473
|
//#endregion
|
|
293436
293474
|
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
|
|
293437
293475
|
var require_parse$5 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
293438
|
-
const path$
|
|
293476
|
+
const path$7 = __require("path");
|
|
293439
293477
|
const resolveCommand = require_resolveCommand();
|
|
293440
293478
|
const escape = require_escape();
|
|
293441
293479
|
const readShebang = require_readShebang();
|
|
@@ -293458,7 +293496,7 @@ var require_parse$5 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
293458
293496
|
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
293459
293497
|
if (parsed.options.forceShell || needsShell) {
|
|
293460
293498
|
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
293461
|
-
parsed.command = path$
|
|
293499
|
+
parsed.command = path$7.normalize(parsed.command);
|
|
293462
293500
|
parsed.command = escape.command(parsed.command);
|
|
293463
293501
|
parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
|
|
293464
293502
|
parsed.args = [
|
|
@@ -311175,7 +311213,7 @@ var require_dist$5 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
311175
311213
|
//#endregion
|
|
311176
311214
|
//#region ../../node_modules/.pnpm/yazl@3.3.1/node_modules/yazl/index.js
|
|
311177
311215
|
var require_yazl = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
311178
|
-
var fs$
|
|
311216
|
+
var fs$5 = __require("fs");
|
|
311179
311217
|
var Transform$2 = __require("stream").Transform;
|
|
311180
311218
|
var PassThrough$2 = __require("stream").PassThrough;
|
|
311181
311219
|
var zlib$1 = __require("zlib");
|
|
@@ -311204,14 +311242,14 @@ var require_yazl = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
311204
311242
|
if (shouldIgnoreAdding(self)) return;
|
|
311205
311243
|
var entry = new Entry(metadataPath, false, options);
|
|
311206
311244
|
self.entries.push(entry);
|
|
311207
|
-
fs$
|
|
311245
|
+
fs$5.stat(realPath, function(err, stats) {
|
|
311208
311246
|
if (err) return self.emit("error", err);
|
|
311209
311247
|
if (!stats.isFile()) return self.emit("error", /* @__PURE__ */ new Error("not a file: " + realPath));
|
|
311210
311248
|
entry.uncompressedSize = stats.size;
|
|
311211
311249
|
if (options.mtime == null) entry.setLastModDate(stats.mtime);
|
|
311212
311250
|
if (options.mode == null) entry.setFileAttributesMode(stats.mode);
|
|
311213
311251
|
entry.setFileDataPumpFunction(function() {
|
|
311214
|
-
var readStream = fs$
|
|
311252
|
+
var readStream = fs$5.createReadStream(realPath);
|
|
311215
311253
|
entry.state = Entry.FILE_DATA_IN_PROGRESS;
|
|
311216
311254
|
readStream.on("error", function(err) {
|
|
311217
311255
|
self.emit("error", err);
|
|
@@ -313057,14 +313095,14 @@ async function readGitExecPath(deps, gitExe) {
|
|
|
313057
313095
|
}
|
|
313058
313096
|
}
|
|
313059
313097
|
function gitBashCandidatesFromGitExe(gitExe) {
|
|
313060
|
-
const normalizedGitExe = path$
|
|
313061
|
-
const gitDir = path$
|
|
313062
|
-
const gitDirName = path$
|
|
313098
|
+
const normalizedGitExe = path$16.win32.normalize(normalizeWindowsPath(gitExe));
|
|
313099
|
+
const gitDir = path$16.win32.dirname(normalizedGitExe);
|
|
313100
|
+
const gitDirName = path$16.win32.basename(gitDir).toLowerCase();
|
|
313063
313101
|
if (gitDirName !== "cmd" && gitDirName !== "bin") return;
|
|
313064
|
-
return gitBashCandidatesFromGitRoot(path$
|
|
313102
|
+
return gitBashCandidatesFromGitRoot(path$16.win32.dirname(gitDir));
|
|
313065
313103
|
}
|
|
313066
313104
|
function gitBashCandidatesFromGitExecPath(execPath) {
|
|
313067
|
-
const normalized = path$
|
|
313105
|
+
const normalized = path$16.win32.normalize(normalizeWindowsPath(execPath));
|
|
313068
313106
|
const parts = normalized.split("\\");
|
|
313069
313107
|
for (let i = parts.length - 1; i >= 0; i -= 1) {
|
|
313070
313108
|
const segment = parts[i]?.toLowerCase();
|
|
@@ -313073,16 +313111,16 @@ function gitBashCandidatesFromGitExecPath(execPath) {
|
|
|
313073
313111
|
if (root.length > 0) return gitBashCandidatesFromGitRoot(root);
|
|
313074
313112
|
}
|
|
313075
313113
|
}
|
|
313076
|
-
return gitBashCandidatesFromGitRoot(path$
|
|
313114
|
+
return gitBashCandidatesFromGitRoot(path$16.win32.join(normalized, "..", ".."));
|
|
313077
313115
|
}
|
|
313078
313116
|
function gitBashCandidatesFromGitRoot(root) {
|
|
313079
|
-
return [path$
|
|
313117
|
+
return [path$16.win32.normalize(path$16.win32.join(root, "bin", "bash.exe")), path$16.win32.normalize(path$16.win32.join(root, "usr", "bin", "bash.exe"))];
|
|
313080
313118
|
}
|
|
313081
313119
|
function normalizeWindowsPath(path) {
|
|
313082
313120
|
return path.replaceAll("/", "\\");
|
|
313083
313121
|
}
|
|
313084
313122
|
function isAbsoluteWindowsPath(path) {
|
|
313085
|
-
return path$
|
|
313123
|
+
return path$16.win32.isAbsolute(normalizeWindowsPath(path));
|
|
313086
313124
|
}
|
|
313087
313125
|
function dedupeWindowsPaths(paths) {
|
|
313088
313126
|
const deduped = [];
|
|
@@ -327791,8 +327829,8 @@ var require_suggestSimilar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
327791
327829
|
var require_command = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
327792
327830
|
const EventEmitter$12 = __require("node:events").EventEmitter;
|
|
327793
327831
|
const childProcess = __require("node:child_process");
|
|
327794
|
-
const path$
|
|
327795
|
-
const fs$
|
|
327832
|
+
const path$6 = __require("node:path");
|
|
327833
|
+
const fs$4 = __require("node:fs");
|
|
327796
327834
|
const process$2 = __require("node:process");
|
|
327797
327835
|
const { Argument, humanReadableArgName } = require_argument();
|
|
327798
327836
|
const { CommanderError } = require_error$2();
|
|
@@ -328675,7 +328713,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
328675
328713
|
* @param {string} subcommandName
|
|
328676
328714
|
*/
|
|
328677
328715
|
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
|
|
328678
|
-
if (fs$
|
|
328716
|
+
if (fs$4.existsSync(executableFile)) return;
|
|
328679
328717
|
const executableMissing = `'${executableFile}' does not exist
|
|
328680
328718
|
- if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
328681
328719
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
@@ -328698,10 +328736,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
328698
328736
|
".cjs"
|
|
328699
328737
|
];
|
|
328700
328738
|
function findFile(baseDir, baseName) {
|
|
328701
|
-
const localBin = path$
|
|
328702
|
-
if (fs$
|
|
328703
|
-
if (sourceExt.includes(path$
|
|
328704
|
-
const foundExt = sourceExt.find((ext) => fs$
|
|
328739
|
+
const localBin = path$6.resolve(baseDir, baseName);
|
|
328740
|
+
if (fs$4.existsSync(localBin)) return localBin;
|
|
328741
|
+
if (sourceExt.includes(path$6.extname(baseName))) return void 0;
|
|
328742
|
+
const foundExt = sourceExt.find((ext) => fs$4.existsSync(`${localBin}${ext}`));
|
|
328705
328743
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
328706
328744
|
}
|
|
328707
328745
|
this._checkForMissingMandatoryOptions();
|
|
@@ -328711,21 +328749,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
328711
328749
|
if (this._scriptPath) {
|
|
328712
328750
|
let resolvedScriptPath;
|
|
328713
328751
|
try {
|
|
328714
|
-
resolvedScriptPath = fs$
|
|
328752
|
+
resolvedScriptPath = fs$4.realpathSync(this._scriptPath);
|
|
328715
328753
|
} catch {
|
|
328716
328754
|
resolvedScriptPath = this._scriptPath;
|
|
328717
328755
|
}
|
|
328718
|
-
executableDir = path$
|
|
328756
|
+
executableDir = path$6.resolve(path$6.dirname(resolvedScriptPath), executableDir);
|
|
328719
328757
|
}
|
|
328720
328758
|
if (executableDir) {
|
|
328721
328759
|
let localFile = findFile(executableDir, executableFile);
|
|
328722
328760
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
328723
|
-
const legacyName = path$
|
|
328761
|
+
const legacyName = path$6.basename(this._scriptPath, path$6.extname(this._scriptPath));
|
|
328724
328762
|
if (legacyName !== this._name) localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
|
|
328725
328763
|
}
|
|
328726
328764
|
executableFile = localFile || executableFile;
|
|
328727
328765
|
}
|
|
328728
|
-
launchWithNode = sourceExt.includes(path$
|
|
328766
|
+
launchWithNode = sourceExt.includes(path$6.extname(executableFile));
|
|
328729
328767
|
let proc;
|
|
328730
328768
|
if (process$2.platform !== "win32") if (launchWithNode) {
|
|
328731
328769
|
args.unshift(executableFile);
|
|
@@ -329429,7 +329467,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
329429
329467
|
* @return {Command}
|
|
329430
329468
|
*/
|
|
329431
329469
|
nameFromFilename(filename) {
|
|
329432
|
-
this._name = path$
|
|
329470
|
+
this._name = path$6.basename(filename, path$6.extname(filename));
|
|
329433
329471
|
return this;
|
|
329434
329472
|
}
|
|
329435
329473
|
/**
|
|
@@ -347192,10 +347230,10 @@ var require_atomic_sleep = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
347192
347230
|
//#endregion
|
|
347193
347231
|
//#region ../../node_modules/.pnpm/sonic-boom@4.2.1/node_modules/sonic-boom/index.js
|
|
347194
347232
|
var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
347195
|
-
const fs$
|
|
347233
|
+
const fs$3 = __require("fs");
|
|
347196
347234
|
const EventEmitter$10 = __require("events");
|
|
347197
347235
|
const inherits$6 = __require("util").inherits;
|
|
347198
|
-
const path$
|
|
347236
|
+
const path$5 = __require("path");
|
|
347199
347237
|
const sleep = require_atomic_sleep();
|
|
347200
347238
|
const assert$8 = __require("assert");
|
|
347201
347239
|
const BUSY_WRITE_TIMEOUT = 100;
|
|
@@ -347235,17 +347273,17 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
347235
347273
|
const flags = sonic.append ? "a" : "w";
|
|
347236
347274
|
const mode = sonic.mode;
|
|
347237
347275
|
if (sonic.sync) try {
|
|
347238
|
-
if (sonic.mkdir) fs$
|
|
347239
|
-
fileOpened(null, fs$
|
|
347276
|
+
if (sonic.mkdir) fs$3.mkdirSync(path$5.dirname(file), { recursive: true });
|
|
347277
|
+
fileOpened(null, fs$3.openSync(file, flags, mode));
|
|
347240
347278
|
} catch (err) {
|
|
347241
347279
|
fileOpened(err);
|
|
347242
347280
|
throw err;
|
|
347243
347281
|
}
|
|
347244
|
-
else if (sonic.mkdir) fs$
|
|
347282
|
+
else if (sonic.mkdir) fs$3.mkdir(path$5.dirname(file), { recursive: true }, (err) => {
|
|
347245
347283
|
if (err) return fileOpened(err);
|
|
347246
|
-
fs$
|
|
347284
|
+
fs$3.open(file, flags, mode, fileOpened);
|
|
347247
347285
|
});
|
|
347248
|
-
else fs$
|
|
347286
|
+
else fs$3.open(file, flags, mode, fileOpened);
|
|
347249
347287
|
}
|
|
347250
347288
|
function SonicBoom(opts) {
|
|
347251
347289
|
if (!(this instanceof SonicBoom)) return new SonicBoom(opts);
|
|
@@ -347283,8 +347321,8 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
347283
347321
|
this.flush = flushBuffer;
|
|
347284
347322
|
this.flushSync = flushBufferSync;
|
|
347285
347323
|
this._actualWrite = actualWriteBuffer;
|
|
347286
|
-
fsWriteSync = () => fs$
|
|
347287
|
-
fsWrite = () => fs$
|
|
347324
|
+
fsWriteSync = () => fs$3.writeSync(this.fd, this._writingBuf);
|
|
347325
|
+
fsWrite = () => fs$3.write(this.fd, this._writingBuf, this.release);
|
|
347288
347326
|
} else if (contentMode === void 0 || contentMode === kContentModeUtf8) {
|
|
347289
347327
|
this._writingBuf = "";
|
|
347290
347328
|
this.write = write;
|
|
@@ -347292,12 +347330,12 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
347292
347330
|
this.flushSync = flushSync;
|
|
347293
347331
|
this._actualWrite = actualWrite;
|
|
347294
347332
|
fsWriteSync = () => {
|
|
347295
|
-
if (Buffer.isBuffer(this._writingBuf)) return fs$
|
|
347296
|
-
return fs$
|
|
347333
|
+
if (Buffer.isBuffer(this._writingBuf)) return fs$3.writeSync(this.fd, this._writingBuf);
|
|
347334
|
+
return fs$3.writeSync(this.fd, this._writingBuf, "utf8");
|
|
347297
347335
|
};
|
|
347298
347336
|
fsWrite = () => {
|
|
347299
|
-
if (Buffer.isBuffer(this._writingBuf)) return fs$
|
|
347300
|
-
return fs$
|
|
347337
|
+
if (Buffer.isBuffer(this._writingBuf)) return fs$3.write(this.fd, this._writingBuf, this.release);
|
|
347338
|
+
return fs$3.write(this.fd, this._writingBuf, "utf8", this.release);
|
|
347301
347339
|
};
|
|
347302
347340
|
} else throw new Error(`SonicBoom supports "${kContentModeUtf8}" and "${kContentModeBuffer}", but passed ${contentMode}`);
|
|
347303
347341
|
if (typeof fd === "number") {
|
|
@@ -347342,7 +347380,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
347342
347380
|
return;
|
|
347343
347381
|
}
|
|
347344
347382
|
}
|
|
347345
|
-
if (this._fsync) fs$
|
|
347383
|
+
if (this._fsync) fs$3.fsyncSync(this.fd);
|
|
347346
347384
|
const len = this._len;
|
|
347347
347385
|
if (this._reopening) {
|
|
347348
347386
|
this._writing = false;
|
|
@@ -347439,7 +347477,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
347439
347477
|
this._flushPending = true;
|
|
347440
347478
|
const onDrain = () => {
|
|
347441
347479
|
if (!this._fsync) try {
|
|
347442
|
-
fs$
|
|
347480
|
+
fs$3.fsync(this.fd, (err) => {
|
|
347443
347481
|
this._flushPending = false;
|
|
347444
347482
|
cb(err);
|
|
347445
347483
|
});
|
|
@@ -347516,7 +347554,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
347516
347554
|
if (this._writing) return;
|
|
347517
347555
|
const fd = this.fd;
|
|
347518
347556
|
this.once("ready", () => {
|
|
347519
|
-
if (fd !== this.fd) fs$
|
|
347557
|
+
if (fd !== this.fd) fs$3.close(fd, (err) => {
|
|
347520
347558
|
if (err) return this.emit("error", err);
|
|
347521
347559
|
});
|
|
347522
347560
|
});
|
|
@@ -347547,7 +347585,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
347547
347585
|
while (this._bufs.length || buf.length) {
|
|
347548
347586
|
if (buf.length <= 0) buf = this._bufs[0];
|
|
347549
347587
|
try {
|
|
347550
|
-
const n = Buffer.isBuffer(buf) ? fs$
|
|
347588
|
+
const n = Buffer.isBuffer(buf) ? fs$3.writeSync(this.fd, buf) : fs$3.writeSync(this.fd, buf, "utf8");
|
|
347551
347589
|
const releasedBufObj = releaseWritingBuf(buf, this._len, n);
|
|
347552
347590
|
buf = releasedBufObj.writingBuf;
|
|
347553
347591
|
this._len = releasedBufObj.len;
|
|
@@ -347558,7 +347596,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
347558
347596
|
}
|
|
347559
347597
|
}
|
|
347560
347598
|
try {
|
|
347561
|
-
fs$
|
|
347599
|
+
fs$3.fsyncSync(this.fd);
|
|
347562
347600
|
} catch {}
|
|
347563
347601
|
}
|
|
347564
347602
|
function flushBufferSync() {
|
|
@@ -347572,7 +347610,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
347572
347610
|
while (this._bufs.length || buf.length) {
|
|
347573
347611
|
if (buf.length <= 0) buf = mergeBuf(this._bufs[0], this._lens[0]);
|
|
347574
347612
|
try {
|
|
347575
|
-
const n = fs$
|
|
347613
|
+
const n = fs$3.writeSync(this.fd, buf);
|
|
347576
347614
|
buf = buf.subarray(n);
|
|
347577
347615
|
this._len = Math.max(this._len - n, 0);
|
|
347578
347616
|
if (buf.length <= 0) {
|
|
@@ -347594,24 +347632,24 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
347594
347632
|
this._writing = true;
|
|
347595
347633
|
this._writingBuf = this._writingBuf.length ? this._writingBuf : this._bufs.shift() || "";
|
|
347596
347634
|
if (this.sync) try {
|
|
347597
|
-
release(null, Buffer.isBuffer(this._writingBuf) ? fs$
|
|
347635
|
+
release(null, Buffer.isBuffer(this._writingBuf) ? fs$3.writeSync(this.fd, this._writingBuf) : fs$3.writeSync(this.fd, this._writingBuf, "utf8"));
|
|
347598
347636
|
} catch (err) {
|
|
347599
347637
|
release(err);
|
|
347600
347638
|
}
|
|
347601
|
-
else fs$
|
|
347639
|
+
else fs$3.write(this.fd, this._writingBuf, release);
|
|
347602
347640
|
}
|
|
347603
347641
|
function actualWriteBuffer() {
|
|
347604
347642
|
const release = this.release;
|
|
347605
347643
|
this._writing = true;
|
|
347606
347644
|
this._writingBuf = this._writingBuf.length ? this._writingBuf : mergeBuf(this._bufs.shift(), this._lens.shift());
|
|
347607
347645
|
if (this.sync) try {
|
|
347608
|
-
release(null, fs$
|
|
347646
|
+
release(null, fs$3.writeSync(this.fd, this._writingBuf));
|
|
347609
347647
|
} catch (err) {
|
|
347610
347648
|
release(err);
|
|
347611
347649
|
}
|
|
347612
347650
|
else {
|
|
347613
347651
|
if (kCopyBuffer) this._writingBuf = Buffer.from(this._writingBuf);
|
|
347614
|
-
fs$
|
|
347652
|
+
fs$3.write(this.fd, this._writingBuf, release);
|
|
347615
347653
|
}
|
|
347616
347654
|
}
|
|
347617
347655
|
function actualClose(sonic) {
|
|
@@ -347625,10 +347663,10 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
347625
347663
|
sonic._lens = [];
|
|
347626
347664
|
assert$8(typeof sonic.fd === "number", `sonic.fd must be a number, got ${typeof sonic.fd}`);
|
|
347627
347665
|
try {
|
|
347628
|
-
fs$
|
|
347666
|
+
fs$3.fsync(sonic.fd, closeWrapped);
|
|
347629
347667
|
} catch {}
|
|
347630
347668
|
function closeWrapped() {
|
|
347631
|
-
if (sonic.fd !== 1 && sonic.fd !== 2) fs$
|
|
347669
|
+
if (sonic.fd !== 1 && sonic.fd !== 2) fs$3.close(sonic.fd, done);
|
|
347632
347670
|
else done();
|
|
347633
347671
|
}
|
|
347634
347672
|
function done(err) {
|
|
@@ -370251,8 +370289,8 @@ var require_constants$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
370251
370289
|
//#endregion
|
|
370252
370290
|
//#region ../../../../node_modules/node-gyp-build/node-gyp-build.js
|
|
370253
370291
|
var require_node_gyp_build$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
370254
|
-
var fs$
|
|
370255
|
-
var path$
|
|
370292
|
+
var fs$2 = __require("fs");
|
|
370293
|
+
var path$4 = __require("path");
|
|
370256
370294
|
var os$3 = __require("os");
|
|
370257
370295
|
var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
|
|
370258
370296
|
var vars = process.config && process.config.variables || {};
|
|
@@ -370269,20 +370307,20 @@ var require_node_gyp_build$1 = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
370269
370307
|
return runtimeRequire(load.resolve(dir));
|
|
370270
370308
|
}
|
|
370271
370309
|
load.resolve = load.path = function(dir) {
|
|
370272
|
-
dir = path$
|
|
370310
|
+
dir = path$4.resolve(dir || ".");
|
|
370273
370311
|
try {
|
|
370274
|
-
var name = runtimeRequire(path$
|
|
370312
|
+
var name = runtimeRequire(path$4.join(dir, "package.json")).name.toUpperCase().replace(/-/g, "_");
|
|
370275
370313
|
if (process.env[name + "_PREBUILD"]) dir = process.env[name + "_PREBUILD"];
|
|
370276
370314
|
} catch (err) {}
|
|
370277
370315
|
if (!prebuildsOnly) {
|
|
370278
|
-
var release = getFirst(path$
|
|
370316
|
+
var release = getFirst(path$4.join(dir, "build/Release"), matchBuild);
|
|
370279
370317
|
if (release) return release;
|
|
370280
|
-
var debug = getFirst(path$
|
|
370318
|
+
var debug = getFirst(path$4.join(dir, "build/Debug"), matchBuild);
|
|
370281
370319
|
if (debug) return debug;
|
|
370282
370320
|
}
|
|
370283
370321
|
var prebuild = resolve(dir);
|
|
370284
370322
|
if (prebuild) return prebuild;
|
|
370285
|
-
var nearby = resolve(path$
|
|
370323
|
+
var nearby = resolve(path$4.dirname(process.execPath));
|
|
370286
370324
|
if (nearby) return nearby;
|
|
370287
370325
|
var target = [
|
|
370288
370326
|
"platform=" + platform,
|
|
@@ -370298,23 +370336,23 @@ var require_node_gyp_build$1 = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
370298
370336
|
].filter(Boolean).join(" ");
|
|
370299
370337
|
throw new Error("No native build was found for " + target + "\n loaded from: " + dir + "\n");
|
|
370300
370338
|
function resolve(dir) {
|
|
370301
|
-
var tuple = readdirSync(path$
|
|
370339
|
+
var tuple = readdirSync(path$4.join(dir, "prebuilds")).map(parseTuple).filter(matchTuple(platform, arch)).sort(compareTuples)[0];
|
|
370302
370340
|
if (!tuple) return;
|
|
370303
|
-
var prebuilds = path$
|
|
370341
|
+
var prebuilds = path$4.join(dir, "prebuilds", tuple.name);
|
|
370304
370342
|
var winner = readdirSync(prebuilds).map(parseTags).filter(matchTags(runtime, abi)).sort(compareTags(runtime))[0];
|
|
370305
|
-
if (winner) return path$
|
|
370343
|
+
if (winner) return path$4.join(prebuilds, winner.file);
|
|
370306
370344
|
}
|
|
370307
370345
|
};
|
|
370308
370346
|
function readdirSync(dir) {
|
|
370309
370347
|
try {
|
|
370310
|
-
return fs$
|
|
370348
|
+
return fs$2.readdirSync(dir);
|
|
370311
370349
|
} catch (err) {
|
|
370312
370350
|
return [];
|
|
370313
370351
|
}
|
|
370314
370352
|
}
|
|
370315
370353
|
function getFirst(dir, filter) {
|
|
370316
370354
|
var files = readdirSync(dir).filter(filter);
|
|
370317
|
-
return files[0] && path$
|
|
370355
|
+
return files[0] && path$4.join(dir, files[0]);
|
|
370318
370356
|
}
|
|
370319
370357
|
function matchBuild(name) {
|
|
370320
370358
|
return /\.node$/.test(name);
|
|
@@ -370395,7 +370433,7 @@ var require_node_gyp_build$1 = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
370395
370433
|
return typeof window !== "undefined" && window.process && window.process.type === "renderer";
|
|
370396
370434
|
}
|
|
370397
370435
|
function isAlpine(platform) {
|
|
370398
|
-
return platform === "linux" && fs$
|
|
370436
|
+
return platform === "linux" && fs$2.existsSync("/etc/alpine-release");
|
|
370399
370437
|
}
|
|
370400
370438
|
load.parseTags = parseTags;
|
|
370401
370439
|
load.matchTags = matchTags;
|
|
@@ -377511,7 +377549,7 @@ var import_multipart = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((
|
|
|
377511
377549
|
const fp = require_plugin();
|
|
377512
377550
|
const { createWriteStream: createWriteStream$1 } = __require("node:fs");
|
|
377513
377551
|
const { unlink: unlink$1 } = __require("node:fs/promises");
|
|
377514
|
-
const path$
|
|
377552
|
+
const path$3 = __require("node:path");
|
|
377515
377553
|
const { generateId } = require_generateId();
|
|
377516
377554
|
const createError = require_error$1();
|
|
377517
377555
|
const streamToNull = require_stream_consumer();
|
|
@@ -377806,7 +377844,7 @@ var import_multipart = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((
|
|
|
377806
377844
|
for await (const part of parts) {
|
|
377807
377845
|
values = part.fields;
|
|
377808
377846
|
if (!part.file) continue;
|
|
377809
|
-
const filepath = path$
|
|
377847
|
+
const filepath = path$3.join(tmpdir, generateId() + path$3.extname(part.filename || "file" + i++));
|
|
377810
377848
|
const target = createWriteStream$1(filepath);
|
|
377811
377849
|
try {
|
|
377812
377850
|
this.tmpUploads.push(filepath);
|
|
@@ -390547,8 +390585,8 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
390547
390585
|
//#endregion
|
|
390548
390586
|
//#region ../../node_modules/.pnpm/@fastify+swagger@9.7.0/node_modules/@fastify/swagger/lib/mode/static.js
|
|
390549
390587
|
var require_static = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
390550
|
-
const path$
|
|
390551
|
-
const fs$
|
|
390588
|
+
const path$2 = __require("node:path");
|
|
390589
|
+
const fs$1 = __require("node:fs");
|
|
390552
390590
|
const yaml = require_dist$1();
|
|
390553
390591
|
module.exports = function(fastify, opts, done) {
|
|
390554
390592
|
if (!opts.specification) return done(/* @__PURE__ */ new Error("specification is missing in the module options"));
|
|
@@ -390557,14 +390595,14 @@ var require_static = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
390557
390595
|
if (!opts.specification.path && !opts.specification.document) return done(/* @__PURE__ */ new Error("both specification.path and specification.document are missing, should be path to the file or swagger document spec"));
|
|
390558
390596
|
else if (opts.specification.path) {
|
|
390559
390597
|
if (typeof opts.specification.path !== "string") return done(/* @__PURE__ */ new Error("specification.path is not a string"));
|
|
390560
|
-
if (!fs$
|
|
390561
|
-
const extName = path$
|
|
390598
|
+
if (!fs$1.existsSync(path$2.resolve(opts.specification.path))) return done(/* @__PURE__ */ new Error(`${opts.specification.path} does not exist`));
|
|
390599
|
+
const extName = path$2.extname(opts.specification.path).toLowerCase();
|
|
390562
390600
|
if ([".yaml", ".json"].indexOf(extName) === -1) return done(/* @__PURE__ */ new Error("specification.path extension name is not supported, should be one from ['.yaml', '.json']"));
|
|
390563
390601
|
if (opts.specification.postProcessor && typeof opts.specification.postProcessor !== "function") return done(/* @__PURE__ */ new Error("specification.postProcessor should be a function"));
|
|
390564
390602
|
if (opts.specification.baseDir && typeof opts.specification.baseDir !== "string") return done(/* @__PURE__ */ new Error("specification.baseDir should be string"));
|
|
390565
|
-
if (!opts.specification.baseDir) opts.specification.baseDir = path$
|
|
390603
|
+
if (!opts.specification.baseDir) opts.specification.baseDir = path$2.resolve(path$2.dirname(opts.specification.path));
|
|
390566
390604
|
else while (opts.specification.baseDir.endsWith("/")) opts.specification.baseDir = opts.specification.baseDir.slice(0, -1);
|
|
390567
|
-
const source = fs$
|
|
390605
|
+
const source = fs$1.readFileSync(path$2.resolve(opts.specification.path), "utf8");
|
|
390568
390606
|
switch (extName) {
|
|
390569
390607
|
case ".yaml":
|
|
390570
390608
|
swaggerObject = yaml.parse(source);
|
|
@@ -390831,11 +390869,11 @@ var require_should_route_hide = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
390831
390869
|
//#endregion
|
|
390832
390870
|
//#region ../../node_modules/.pnpm/@fastify+swagger@9.7.0/node_modules/@fastify/swagger/lib/util/read-package-json.js
|
|
390833
390871
|
var require_read_package_json = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
390834
|
-
const fs
|
|
390835
|
-
const path$
|
|
390872
|
+
const fs = __require("node:fs");
|
|
390873
|
+
const path$1 = __require("node:path");
|
|
390836
390874
|
function readPackageJson() {
|
|
390837
390875
|
try {
|
|
390838
|
-
return JSON.parse(fs
|
|
390876
|
+
return JSON.parse(fs.readFileSync(path$1.join(__dirname, "..", "..", "package.json")));
|
|
390839
390877
|
} catch {
|
|
390840
390878
|
return {};
|
|
390841
390879
|
}
|
|
@@ -405796,9 +405834,9 @@ var TUI = class TUI extends Container {
|
|
|
405796
405834
|
const debugRedraw = process.env["PI_DEBUG_REDRAW"] === "1";
|
|
405797
405835
|
const logRedraw = (reason) => {
|
|
405798
405836
|
if (!debugRedraw) return;
|
|
405799
|
-
const logPath = path$
|
|
405837
|
+
const logPath = path$16.join(nodeOs.homedir(), ".pi", "agent", "pi-debug.log");
|
|
405800
405838
|
const msg = `[${(/* @__PURE__ */ new Date()).toISOString()}] fullRender: ${reason} (prev=${this.previousLines.length}, new=${newLines.length}, height=${height})\n`;
|
|
405801
|
-
fs$
|
|
405839
|
+
fs$16.appendFileSync(logPath, msg);
|
|
405802
405840
|
};
|
|
405803
405841
|
if (this.previousLines.length === 0 && !widthChanged && !heightChanged) {
|
|
405804
405842
|
logRedraw("first render");
|
|
@@ -405945,8 +405983,8 @@ var TUI = class TUI extends Container {
|
|
|
405945
405983
|
buffer += "\x1B[?2026l";
|
|
405946
405984
|
if (process.env["PI_TUI_DEBUG"] === "1") {
|
|
405947
405985
|
const debugDir = "/tmp/tui";
|
|
405948
|
-
fs$
|
|
405949
|
-
const debugPath = path$
|
|
405986
|
+
fs$16.mkdirSync(debugDir, { recursive: true });
|
|
405987
|
+
const debugPath = path$16.join(debugDir, `render-${Date.now()}-${Math.random().toString(36).slice(2)}.log`);
|
|
405950
405988
|
const debugData = [
|
|
405951
405989
|
`firstChanged: ${firstChanged}`,
|
|
405952
405990
|
`viewportTop: ${viewportTop}`,
|
|
@@ -405969,7 +406007,7 @@ var TUI = class TUI extends Container {
|
|
|
405969
406007
|
"=== buffer ===",
|
|
405970
406008
|
JSON.stringify(buffer)
|
|
405971
406009
|
].join("\n");
|
|
405972
|
-
fs$
|
|
406010
|
+
fs$16.writeFileSync(debugPath, debugData);
|
|
405973
406011
|
}
|
|
405974
406012
|
this.terminal.write(buffer);
|
|
405975
406013
|
this.cursorRow = Math.max(0, newLines.length - 1);
|
|
@@ -410550,12 +410588,12 @@ function loadNativeModifiersHelper() {
|
|
|
410550
410588
|
if (process.platform !== "darwin") return void 0;
|
|
410551
410589
|
const arch = process.arch;
|
|
410552
410590
|
if (arch !== "x64" && arch !== "arm64") return void 0;
|
|
410553
|
-
const moduleDir = path$
|
|
410554
|
-
const nativePath = path$
|
|
410591
|
+
const moduleDir = path$16.dirname(fileURLToPath(import.meta.url));
|
|
410592
|
+
const nativePath = path$16.join("native", "darwin", "prebuilds", `darwin-${arch}`, "darwin-modifiers.node");
|
|
410555
410593
|
const candidates = [
|
|
410556
|
-
path$
|
|
410557
|
-
path$
|
|
410558
|
-
path$
|
|
410594
|
+
path$16.join(moduleDir, "..", nativePath),
|
|
410595
|
+
path$16.join(moduleDir, nativePath),
|
|
410596
|
+
path$16.join(path$16.dirname(process.execPath), nativePath)
|
|
410559
410597
|
];
|
|
410560
410598
|
for (const modulePath of candidates) try {
|
|
410561
410599
|
const helper = cjsRequire$1(modulePath);
|
|
@@ -410628,10 +410666,10 @@ var ProcessTerminal = class {
|
|
|
410628
410666
|
const env = process.env["PI_TUI_WRITE_LOG"] || "";
|
|
410629
410667
|
if (!env) return "";
|
|
410630
410668
|
try {
|
|
410631
|
-
if (fs$
|
|
410669
|
+
if (fs$16.statSync(env).isDirectory()) {
|
|
410632
410670
|
const now = /* @__PURE__ */ new Date();
|
|
410633
410671
|
const ts = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}-${String(now.getDate()).padStart(2, "0")}_${String(now.getHours()).padStart(2, "0")}-${String(now.getMinutes()).padStart(2, "0")}-${String(now.getSeconds()).padStart(2, "0")}`;
|
|
410634
|
-
return path$
|
|
410672
|
+
return path$16.join(env, `tui-${ts}-${process.pid}.log`);
|
|
410635
410673
|
}
|
|
410636
410674
|
} catch {}
|
|
410637
410675
|
return env;
|
|
@@ -410834,12 +410872,12 @@ var ProcessTerminal = class {
|
|
|
410834
410872
|
try {
|
|
410835
410873
|
const arch = process.arch;
|
|
410836
410874
|
if (arch !== "x64" && arch !== "arm64") return;
|
|
410837
|
-
const moduleDir = path$
|
|
410838
|
-
const nativePath = path$
|
|
410875
|
+
const moduleDir = path$16.dirname(fileURLToPath(import.meta.url));
|
|
410876
|
+
const nativePath = path$16.join("native", "win32", "prebuilds", `win32-${arch}`, "win32-console-mode.node");
|
|
410839
410877
|
const candidates = [
|
|
410840
|
-
path$
|
|
410841
|
-
path$
|
|
410842
|
-
path$
|
|
410878
|
+
path$16.join(moduleDir, "..", nativePath),
|
|
410879
|
+
path$16.join(moduleDir, nativePath),
|
|
410880
|
+
path$16.join(path$16.dirname(process.execPath), nativePath)
|
|
410843
410881
|
];
|
|
410844
410882
|
for (const modulePath of candidates) try {
|
|
410845
410883
|
cjsRequire(modulePath).enableVirtualTerminalInput?.();
|
|
@@ -410911,7 +410949,7 @@ var ProcessTerminal = class {
|
|
|
410911
410949
|
write(data) {
|
|
410912
410950
|
process.stdout.write(data);
|
|
410913
410951
|
if (this.writeLogPath) try {
|
|
410914
|
-
fs$
|
|
410952
|
+
fs$16.appendFileSync(this.writeLogPath, data, { encoding: "utf8" });
|
|
410915
410953
|
} catch {}
|
|
410916
410954
|
}
|
|
410917
410955
|
get columns() {
|
|
@@ -420021,6 +420059,15 @@ function isBusy(host) {
|
|
|
420021
420059
|
//#endregion
|
|
420022
420060
|
//#region src/tui/commands/loop.ts
|
|
420023
420061
|
const LOOP_ARGUMENT_HINT = "/loop [interval] [prompt]";
|
|
420062
|
+
const LOOP_CREATE_FILLERS = new Set([
|
|
420063
|
+
"mit",
|
|
420064
|
+
"alle",
|
|
420065
|
+
"jede",
|
|
420066
|
+
"jeden",
|
|
420067
|
+
"every",
|
|
420068
|
+
"each"
|
|
420069
|
+
]);
|
|
420070
|
+
const LOOP_INTERVAL_TOKEN = /^\d+(?:m|h|d)$/i;
|
|
420024
420071
|
function parseLoopCommand(rawArgs) {
|
|
420025
420072
|
const args = rawArgs.trim();
|
|
420026
420073
|
if (args.length === 0 || args.toLowerCase() === "status") return { kind: "status" };
|
|
@@ -420031,10 +420078,11 @@ function parseLoopCommand(rawArgs) {
|
|
|
420031
420078
|
if (action === "resume") return { kind: "resume" };
|
|
420032
420079
|
if (action === "stop") return { kind: "stop" };
|
|
420033
420080
|
}
|
|
420034
|
-
|
|
420081
|
+
let startIndex = action === "start" ? 1 : 0;
|
|
420082
|
+
if (LOOP_CREATE_FILLERS.has(tokens[startIndex]?.toLowerCase() ?? "")) startIndex += 1;
|
|
420035
420083
|
const interval = tokens[startIndex];
|
|
420036
420084
|
const prompt = tokens.slice(startIndex + 1).join(" ").trim();
|
|
420037
|
-
if (interval === void 0 || prompt.length === 0) return { kind: "error" };
|
|
420085
|
+
if (interval === void 0 || !LOOP_INTERVAL_TOKEN.test(interval) || prompt.length === 0) return { kind: "error" };
|
|
420038
420086
|
return {
|
|
420039
420087
|
kind: "create",
|
|
420040
420088
|
interval,
|
|
@@ -502393,7 +502441,9 @@ registerUiCatalogFragment({
|
|
|
502393
502441
|
"sessionEvent.mcp.needsAuth": "MCP server \"{name}\" needs OAuth — run /mcp-config login {name}",
|
|
502394
502442
|
"sessionEvent.mcp.disabled": "MCP server \"{name}\" disabled",
|
|
502395
502443
|
"sessionEvent.mcp.connecting": "MCP server \"{name}\" connecting…",
|
|
502396
|
-
"sessionEvent.skill.activated": "Activated skill: {skillName}"
|
|
502444
|
+
"sessionEvent.skill.activated": "Activated skill: {skillName}",
|
|
502445
|
+
"sessionEvent.watchdog.idle": "Turn running for {minutes} min; last tool: {tool}; repeated failures: {repetitions}.",
|
|
502446
|
+
"sessionEvent.watchdog.aborted": "Turn stopped after {repetitions} repeated failed calls to {tool}."
|
|
502397
502447
|
},
|
|
502398
502448
|
de: {
|
|
502399
502449
|
"sessionEvent.error.mcpSync": "Der MCP-Serverstatus konnte nicht synchronisiert werden: {error}",
|
|
@@ -502420,7 +502470,9 @@ registerUiCatalogFragment({
|
|
|
502420
502470
|
"sessionEvent.mcp.needsAuth": "MCP-Server „{name}“ benötigt OAuth — /mcp-config login {name} ausführen",
|
|
502421
502471
|
"sessionEvent.mcp.disabled": "MCP-Server „{name}“ deaktiviert",
|
|
502422
502472
|
"sessionEvent.mcp.connecting": "MCP-Server „{name}“ wird verbunden…",
|
|
502423
|
-
"sessionEvent.skill.activated": "Skill aktiviert: {skillName}"
|
|
502473
|
+
"sessionEvent.skill.activated": "Skill aktiviert: {skillName}",
|
|
502474
|
+
"sessionEvent.watchdog.idle": "Zug läuft seit {minutes} Min.; letztes Werkzeug: {tool}; wiederholte Fehler: {repetitions}.",
|
|
502475
|
+
"sessionEvent.watchdog.aborted": "Zug nach {repetitions} wiederholten fehlgeschlagenen Aufrufen von {tool} beendet."
|
|
502424
502476
|
},
|
|
502425
502477
|
es: {
|
|
502426
502478
|
"sessionEvent.error.mcpSync": "No se pudo sincronizar el estado de los servidores MCP: {error}",
|
|
@@ -502447,7 +502499,9 @@ registerUiCatalogFragment({
|
|
|
502447
502499
|
"sessionEvent.mcp.needsAuth": "El servidor MCP «{name}» requiere OAuth; ejecuta /mcp-config login {name}",
|
|
502448
502500
|
"sessionEvent.mcp.disabled": "Servidor MCP «{name}» desactivado",
|
|
502449
502501
|
"sessionEvent.mcp.connecting": "Conectando el servidor MCP «{name}»…",
|
|
502450
|
-
"sessionEvent.skill.activated": "Skill activado: {skillName}"
|
|
502502
|
+
"sessionEvent.skill.activated": "Skill activado: {skillName}",
|
|
502503
|
+
"sessionEvent.watchdog.idle": "El turno lleva {minutes} min en curso; última herramienta: {tool}; fallos repetidos: {repetitions}.",
|
|
502504
|
+
"sessionEvent.watchdog.aborted": "Turno detenido tras {repetitions} llamadas fallidas repetidas a {tool}."
|
|
502451
502505
|
},
|
|
502452
502506
|
fr: {
|
|
502453
502507
|
"sessionEvent.error.mcpSync": "Impossible de synchroniser l’état des serveurs MCP : {error}",
|
|
@@ -502474,7 +502528,9 @@ registerUiCatalogFragment({
|
|
|
502474
502528
|
"sessionEvent.mcp.needsAuth": "Le serveur MCP « {name} » requiert OAuth — exécutez /mcp-config login {name}",
|
|
502475
502529
|
"sessionEvent.mcp.disabled": "Serveur MCP « {name} » désactivé",
|
|
502476
502530
|
"sessionEvent.mcp.connecting": "Connexion du serveur MCP « {name} »…",
|
|
502477
|
-
"sessionEvent.skill.activated": "Skill activé
|
|
502531
|
+
"sessionEvent.skill.activated": "Skill activé : {skillName}",
|
|
502532
|
+
"sessionEvent.watchdog.idle": "Tour en cours depuis {minutes} min ; dernier outil : {tool} ; échecs répétés : {repetitions}.",
|
|
502533
|
+
"sessionEvent.watchdog.aborted": "Tour arrêté après {repetitions} appels répétés ayant échoué pour l'outil {tool}."
|
|
502478
502534
|
},
|
|
502479
502535
|
sv: {
|
|
502480
502536
|
"sessionEvent.error.mcpSync": "Det gick inte att synkronisera MCP-serverstatus: {error}",
|
|
@@ -502501,7 +502557,9 @@ registerUiCatalogFragment({
|
|
|
502501
502557
|
"sessionEvent.mcp.needsAuth": "MCP-servern ”{name}” behöver OAuth – kör /mcp-config login {name}",
|
|
502502
502558
|
"sessionEvent.mcp.disabled": "MCP-servern ”{name}” är inaktiverad",
|
|
502503
502559
|
"sessionEvent.mcp.connecting": "Ansluter MCP-servern ”{name}”…",
|
|
502504
|
-
"sessionEvent.skill.activated": "Skill aktiverad: {skillName}"
|
|
502560
|
+
"sessionEvent.skill.activated": "Skill aktiverad: {skillName}",
|
|
502561
|
+
"sessionEvent.watchdog.idle": "Körningen har pågått i {minutes} min. Senaste verktyg: {tool}. Upprepade fel: {repetitions}.",
|
|
502562
|
+
"sessionEvent.watchdog.aborted": "Körningen stoppades efter {repetitions} upprepade misslyckade anrop till {tool}."
|
|
502505
502563
|
},
|
|
502506
502564
|
cs: {
|
|
502507
502565
|
"sessionEvent.error.mcpSync": "Selhala synchronizace stavu serveru MCP: {error}",
|
|
@@ -502528,7 +502586,9 @@ registerUiCatalogFragment({
|
|
|
502528
502586
|
"sessionEvent.mcp.needsAuth": "Server MCP \"{name}\" vyžaduje přihlášení přes OAuth — spusťte /mcp-config login {name}",
|
|
502529
502587
|
"sessionEvent.mcp.disabled": "Server MCP \"{name}\" zakázán",
|
|
502530
502588
|
"sessionEvent.mcp.connecting": "Server MCP \"{name}\" se připojuje…",
|
|
502531
|
-
"sessionEvent.skill.activated": "Aktivována dovednost: {skillName}"
|
|
502589
|
+
"sessionEvent.skill.activated": "Aktivována dovednost: {skillName}",
|
|
502590
|
+
"sessionEvent.watchdog.idle": "Kolo běží {minutes} min; poslední nástroj: {tool}; opakovaná selhání: {repetitions}.",
|
|
502591
|
+
"sessionEvent.watchdog.aborted": "Kolo bylo zastaveno po {repetitions} opakovaných neúspěšných voláních nástroje {tool}."
|
|
502532
502592
|
}
|
|
502533
502593
|
});
|
|
502534
502594
|
//#endregion
|
|
@@ -503670,6 +503730,140 @@ function isUserCancelledSubagentError(error) {
|
|
|
503670
503730
|
}
|
|
503671
503731
|
}
|
|
503672
503732
|
//#endregion
|
|
503733
|
+
//#region src/tui/controllers/turn-watchdog.ts
|
|
503734
|
+
const DEFAULT_IDLE_MINUTES = 20;
|
|
503735
|
+
const DEFAULT_MAX_FAILED_REPETITIONS = 5;
|
|
503736
|
+
const MIN_IDLE_MINUTES = 1;
|
|
503737
|
+
const MAX_IDLE_MINUTES = 1440;
|
|
503738
|
+
const MIN_FAILED_REPETITIONS = 2;
|
|
503739
|
+
const MAX_FAILED_REPETITIONS = 100;
|
|
503740
|
+
const TURN_WATCHDOG_IDLE_MINUTES_ENV = "BLUN_TURN_WATCHDOG_IDLE_MINUTES";
|
|
503741
|
+
const TURN_WATCHDOG_MAX_FAILED_REPETITIONS_ENV = "BLUN_TURN_WATCHDOG_MAX_FAILED_REPETITIONS";
|
|
503742
|
+
function resolveTurnWatchdogConfig(env = process.env) {
|
|
503743
|
+
const idleMinutes = parseBoundedInteger(env[TURN_WATCHDOG_IDLE_MINUTES_ENV], DEFAULT_IDLE_MINUTES, MIN_IDLE_MINUTES, MAX_IDLE_MINUTES);
|
|
503744
|
+
const maxFailedRepetitions = parseBoundedInteger(env[TURN_WATCHDOG_MAX_FAILED_REPETITIONS_ENV], DEFAULT_MAX_FAILED_REPETITIONS, MIN_FAILED_REPETITIONS, MAX_FAILED_REPETITIONS);
|
|
503745
|
+
return {
|
|
503746
|
+
idleMs: idleMinutes * 6e4,
|
|
503747
|
+
maxFailedRepetitions
|
|
503748
|
+
};
|
|
503749
|
+
}
|
|
503750
|
+
var TurnWatchdogController = class {
|
|
503751
|
+
config;
|
|
503752
|
+
now;
|
|
503753
|
+
setTimer;
|
|
503754
|
+
clearTimer;
|
|
503755
|
+
onIdle;
|
|
503756
|
+
onAbort;
|
|
503757
|
+
toolCalls = /* @__PURE__ */ new Map();
|
|
503758
|
+
active = false;
|
|
503759
|
+
startedAtMs = 0;
|
|
503760
|
+
lastProgressAtMs = 0;
|
|
503761
|
+
lastToolName = "none";
|
|
503762
|
+
lastFailedKey;
|
|
503763
|
+
failedRepetitions = 0;
|
|
503764
|
+
idleReportedForProgressAtMs;
|
|
503765
|
+
timer;
|
|
503766
|
+
constructor(options) {
|
|
503767
|
+
this.config = options.config ?? resolveTurnWatchdogConfig();
|
|
503768
|
+
this.now = options.now ?? Date.now;
|
|
503769
|
+
this.setTimer = options.setTimer ?? setTimeout;
|
|
503770
|
+
this.clearTimer = options.clearTimer ?? clearTimeout;
|
|
503771
|
+
this.onIdle = options.onIdle;
|
|
503772
|
+
this.onAbort = options.onAbort;
|
|
503773
|
+
}
|
|
503774
|
+
start() {
|
|
503775
|
+
this.stop();
|
|
503776
|
+
const now = this.now();
|
|
503777
|
+
this.active = true;
|
|
503778
|
+
this.startedAtMs = now;
|
|
503779
|
+
this.lastProgressAtMs = now;
|
|
503780
|
+
this.lastToolName = "none";
|
|
503781
|
+
this.lastFailedKey = void 0;
|
|
503782
|
+
this.failedRepetitions = 0;
|
|
503783
|
+
this.idleReportedForProgressAtMs = void 0;
|
|
503784
|
+
this.scheduleIdleCheck();
|
|
503785
|
+
}
|
|
503786
|
+
stop() {
|
|
503787
|
+
this.active = false;
|
|
503788
|
+
this.toolCalls.clear();
|
|
503789
|
+
if (this.timer !== void 0) {
|
|
503790
|
+
this.clearTimer(this.timer);
|
|
503791
|
+
this.timer = void 0;
|
|
503792
|
+
}
|
|
503793
|
+
}
|
|
503794
|
+
recordToolCall(toolCallId, name, args) {
|
|
503795
|
+
if (!this.active) return;
|
|
503796
|
+
this.lastToolName = name;
|
|
503797
|
+
this.toolCalls.set(toolCallId, {
|
|
503798
|
+
name,
|
|
503799
|
+
key: `${name}\0${canonicalJson(args)}`
|
|
503800
|
+
});
|
|
503801
|
+
}
|
|
503802
|
+
recordToolResult(toolCallId, isError) {
|
|
503803
|
+
if (!this.active) return;
|
|
503804
|
+
const toolCall = this.toolCalls.get(toolCallId);
|
|
503805
|
+
this.toolCalls.delete(toolCallId);
|
|
503806
|
+
if (toolCall !== void 0) this.lastToolName = toolCall.name;
|
|
503807
|
+
this.lastProgressAtMs = this.now();
|
|
503808
|
+
this.idleReportedForProgressAtMs = void 0;
|
|
503809
|
+
this.scheduleIdleCheck();
|
|
503810
|
+
if (!isError || toolCall === void 0) {
|
|
503811
|
+
this.lastFailedKey = void 0;
|
|
503812
|
+
this.failedRepetitions = 0;
|
|
503813
|
+
return;
|
|
503814
|
+
}
|
|
503815
|
+
if (toolCall.key === this.lastFailedKey) this.failedRepetitions += 1;
|
|
503816
|
+
else {
|
|
503817
|
+
this.lastFailedKey = toolCall.key;
|
|
503818
|
+
this.failedRepetitions = 1;
|
|
503819
|
+
}
|
|
503820
|
+
if (this.failedRepetitions < this.config.maxFailedRepetitions) return;
|
|
503821
|
+
const snapshot = this.snapshot();
|
|
503822
|
+
this.stop();
|
|
503823
|
+
this.onAbort(snapshot);
|
|
503824
|
+
}
|
|
503825
|
+
scheduleIdleCheck() {
|
|
503826
|
+
if (!this.active) return;
|
|
503827
|
+
if (this.timer !== void 0) this.clearTimer(this.timer);
|
|
503828
|
+
const remaining = Math.max(0, this.config.idleMs - (this.now() - this.lastProgressAtMs));
|
|
503829
|
+
this.timer = this.setTimer(() => {
|
|
503830
|
+
this.timer = void 0;
|
|
503831
|
+
this.checkIdle();
|
|
503832
|
+
}, remaining);
|
|
503833
|
+
}
|
|
503834
|
+
checkIdle() {
|
|
503835
|
+
if (!this.active) return;
|
|
503836
|
+
if (this.now() - this.lastProgressAtMs >= this.config.idleMs && this.idleReportedForProgressAtMs !== this.lastProgressAtMs) {
|
|
503837
|
+
this.idleReportedForProgressAtMs = this.lastProgressAtMs;
|
|
503838
|
+
this.onIdle(this.snapshot());
|
|
503839
|
+
return;
|
|
503840
|
+
}
|
|
503841
|
+
this.scheduleIdleCheck();
|
|
503842
|
+
}
|
|
503843
|
+
snapshot() {
|
|
503844
|
+
return {
|
|
503845
|
+
elapsedMinutes: Math.max(1, Math.floor((this.now() - this.startedAtMs) / 6e4)),
|
|
503846
|
+
lastToolName: this.lastToolName,
|
|
503847
|
+
failedRepetitions: this.failedRepetitions
|
|
503848
|
+
};
|
|
503849
|
+
}
|
|
503850
|
+
};
|
|
503851
|
+
function parseBoundedInteger(raw, fallback, minimum, maximum) {
|
|
503852
|
+
if (raw === void 0 || raw.trim() === "") return fallback;
|
|
503853
|
+
const value = Number(raw);
|
|
503854
|
+
return Number.isSafeInteger(value) && value >= minimum && value <= maximum ? value : fallback;
|
|
503855
|
+
}
|
|
503856
|
+
function canonicalJson(value) {
|
|
503857
|
+
const normalized = normalizeJson(value);
|
|
503858
|
+
return JSON.stringify(normalized) ?? "undefined";
|
|
503859
|
+
}
|
|
503860
|
+
function normalizeJson(value) {
|
|
503861
|
+
if (Array.isArray(value)) return value.map(normalizeJson);
|
|
503862
|
+
if (value === null || typeof value !== "object") return value;
|
|
503863
|
+
const record = value;
|
|
503864
|
+
return Object.fromEntries(Object.keys(record).toSorted().map((key) => [key, normalizeJson(record[key])]));
|
|
503865
|
+
}
|
|
503866
|
+
//#endregion
|
|
503673
503867
|
//#region src/tui/controllers/session-event-handler.ts
|
|
503674
503868
|
const MANAGED_TELEGRAM_MCP_SERVER = "plugin-telegram:telegram";
|
|
503675
503869
|
function isManagedTelegramMissingTokenFailure(server) {
|
|
@@ -503678,6 +503872,7 @@ function isManagedTelegramMissingTokenFailure(server) {
|
|
|
503678
503872
|
var SessionEventHandler = class {
|
|
503679
503873
|
host;
|
|
503680
503874
|
subAgentEventHandler;
|
|
503875
|
+
turnWatchdog;
|
|
503681
503876
|
constructor(host) {
|
|
503682
503877
|
this.host = host;
|
|
503683
503878
|
this.subAgentEventHandler = new SubAgentEventHandler(host, {
|
|
@@ -503687,6 +503882,10 @@ var SessionEventHandler = class {
|
|
|
503687
503882
|
this.syncBackgroundTaskBadge();
|
|
503688
503883
|
}
|
|
503689
503884
|
});
|
|
503885
|
+
this.turnWatchdog = new TurnWatchdogController({
|
|
503886
|
+
onIdle: (snapshot) => this.reportWatchdogIdle(snapshot),
|
|
503887
|
+
onAbort: (snapshot) => this.abortWatchdogLoop(snapshot)
|
|
503888
|
+
});
|
|
503690
503889
|
}
|
|
503691
503890
|
backgroundTasks = /* @__PURE__ */ new Map();
|
|
503692
503891
|
backgroundTaskTranscriptedTerminal = /* @__PURE__ */ new Set();
|
|
@@ -503706,6 +503905,7 @@ var SessionEventHandler = class {
|
|
|
503706
503905
|
queuedGoalPromotionTimer;
|
|
503707
503906
|
lastCompactionInstruction;
|
|
503708
503907
|
resetRuntimeState() {
|
|
503908
|
+
this.turnWatchdog.stop();
|
|
503709
503909
|
this.backgroundTasks.clear();
|
|
503710
503910
|
this.backgroundTaskTranscriptedTerminal.clear();
|
|
503711
503911
|
this.subAgentEventHandler.resetRuntimeState();
|
|
@@ -503891,6 +504091,7 @@ var SessionEventHandler = class {
|
|
|
503891
504091
|
this.mcpServerStatusSpinners.clear();
|
|
503892
504092
|
}
|
|
503893
504093
|
handleTurnBegin(event) {
|
|
504094
|
+
this.turnWatchdog.start();
|
|
503894
504095
|
const sessionId = this.host.session?.id;
|
|
503895
504096
|
if (sessionId !== void 0) bindPersonalMemoryRememberIntentTurn(sessionId, event.turnId);
|
|
503896
504097
|
this.currentTurnHasAssistantText = false;
|
|
@@ -503929,6 +504130,7 @@ var SessionEventHandler = class {
|
|
|
503929
504130
|
});
|
|
503930
504131
|
}
|
|
503931
504132
|
handleTurnEnd(event, sendQueued) {
|
|
504133
|
+
this.turnWatchdog.stop();
|
|
503932
504134
|
this.host.restoreQueuedSteerAtTurnEnd(event.turnId);
|
|
503933
504135
|
const sessionId = this.host.session?.id;
|
|
503934
504136
|
if (sessionId !== void 0) finishPersonalMemoryRememberIntentTurn(sessionId, event.turnId);
|
|
@@ -504073,6 +504275,7 @@ var SessionEventHandler = class {
|
|
|
504073
504275
|
});
|
|
504074
504276
|
}
|
|
504075
504277
|
handleToolCall(event) {
|
|
504278
|
+
this.turnWatchdog.recordToolCall(event.toolCallId, event.name, event.args);
|
|
504076
504279
|
const { streamingUI } = this.host;
|
|
504077
504280
|
streamingUI.flushNow();
|
|
504078
504281
|
const { turnId, step } = streamingUI.getTurnContext();
|
|
@@ -504122,6 +504325,7 @@ var SessionEventHandler = class {
|
|
|
504122
504325
|
if (event.update.kind === "stdout" || event.update.kind === "stderr") tc.appendLiveOutput(text);
|
|
504123
504326
|
}
|
|
504124
504327
|
handleToolResult(event) {
|
|
504328
|
+
this.turnWatchdog.recordToolResult(event.toolCallId, event.isError === true);
|
|
504125
504329
|
const { streamingUI } = this.host;
|
|
504126
504330
|
streamingUI.flushNow();
|
|
504127
504331
|
const resultData = {
|
|
@@ -504145,6 +504349,26 @@ var SessionEventHandler = class {
|
|
|
504145
504349
|
}
|
|
504146
504350
|
this.host.patchLivePane({ mode: "waiting" });
|
|
504147
504351
|
}
|
|
504352
|
+
reportWatchdogIdle(snapshot) {
|
|
504353
|
+
const message = uiText("sessionEvent.watchdog.idle", {
|
|
504354
|
+
minutes: snapshot.elapsedMinutes,
|
|
504355
|
+
tool: snapshot.lastToolName,
|
|
504356
|
+
repetitions: snapshot.failedRepetitions
|
|
504357
|
+
});
|
|
504358
|
+
this.host.showStatus(message, "warning");
|
|
504359
|
+
this.host.sendChannelTurnStatus?.(message);
|
|
504360
|
+
}
|
|
504361
|
+
abortWatchdogLoop(snapshot) {
|
|
504362
|
+
const message = uiText("sessionEvent.watchdog.aborted", {
|
|
504363
|
+
tool: snapshot.lastToolName,
|
|
504364
|
+
repetitions: snapshot.failedRepetitions
|
|
504365
|
+
});
|
|
504366
|
+
this.host.showError(message);
|
|
504367
|
+
this.host.sendChannelTurnStatus?.(message);
|
|
504368
|
+
this.host.session?.cancel().catch((error) => {
|
|
504369
|
+
this.host.showError(formatErrorMessage$2(error));
|
|
504370
|
+
});
|
|
504371
|
+
}
|
|
504148
504372
|
handleStatusUpdate(event) {
|
|
504149
504373
|
const shouldRenderSwarmEnded = event.swarmMode === false && this.host.state.appState.swarmMode && this.host.state.appState.swarmModeEntry === "task";
|
|
504150
504374
|
const patch = {};
|
|
@@ -512827,6 +513051,13 @@ var BlunTUI = class {
|
|
|
512827
513051
|
this.showError(uiText("blunTui.session.sendFailed", { error: "Telegram media" }));
|
|
512828
513052
|
});
|
|
512829
513053
|
}
|
|
513054
|
+
sendChannelTurnStatus(message) {
|
|
513055
|
+
const guard = this.pendingChannelReplyGuard;
|
|
513056
|
+
if (guard === void 0) return;
|
|
513057
|
+
sendReplyFallback(guard.chatId, message, guard.contextOnly).then((sent) => {
|
|
513058
|
+
if (sent && this.pendingChannelReplyGuard === guard) guard.outboxMarker = outboxMarker();
|
|
513059
|
+
});
|
|
513060
|
+
}
|
|
512830
513061
|
runChannelReplyFallback(reason) {
|
|
512831
513062
|
const guard = this.pendingChannelReplyGuard;
|
|
512832
513063
|
if (guard === void 0) return;
|
|
@@ -514419,6 +514650,51 @@ var BlunTUI = class {
|
|
|
514419
514650
|
}
|
|
514420
514651
|
};
|
|
514421
514652
|
//#endregion
|
|
514653
|
+
//#region src/tui/utils/telegram-update-notice.ts
|
|
514654
|
+
const MAX_ACCESS_FILE_BYTES = 256 * 1024;
|
|
514655
|
+
const TELEGRAM_DM_ID = /^[1-9]\d*$/u;
|
|
514656
|
+
function defaultTelegramStateDir() {
|
|
514657
|
+
const explicit = process.env["BLUN_TELEGRAM_STATE_DIR"]?.trim();
|
|
514658
|
+
if (explicit !== void 0 && explicit.length > 0) return explicit;
|
|
514659
|
+
const blunHome = process.env["BLUN_HOME"]?.trim();
|
|
514660
|
+
return join(blunHome !== void 0 && blunHome.length > 0 ? blunHome : join(homedir(), ".blun"), "channels", "telegram");
|
|
514661
|
+
}
|
|
514662
|
+
function hasConfiguredToken(stateDir) {
|
|
514663
|
+
try {
|
|
514664
|
+
return readFileSync(join(stateDir, ".env"), "utf8").replace(/^\uFEFF/u, "").split(/\r?\n/u).some((line) => {
|
|
514665
|
+
const token = /^BLUN_TELEGRAM_BOT_TOKEN=(.+)$/u.exec(line)?.[1]?.trim();
|
|
514666
|
+
return token !== void 0 && token.includes(":") && !/replace|paste|your[-_]|xxxx/iu.test(token);
|
|
514667
|
+
});
|
|
514668
|
+
} catch {
|
|
514669
|
+
return false;
|
|
514670
|
+
}
|
|
514671
|
+
}
|
|
514672
|
+
function readTelegramUpdateRecipients(stateDir = defaultTelegramStateDir()) {
|
|
514673
|
+
try {
|
|
514674
|
+
const filePath = join(stateDir, "access.json");
|
|
514675
|
+
const info = lstatSync(filePath);
|
|
514676
|
+
if (!info.isFile() || info.isSymbolicLink() || info.size > MAX_ACCESS_FILE_BYTES) return [];
|
|
514677
|
+
const parsed = JSON.parse(readFileSync(filePath, "utf8"));
|
|
514678
|
+
if (!Array.isArray(parsed.allowFrom)) return [];
|
|
514679
|
+
return [...new Set(parsed.allowFrom.map((value) => String(value).trim()).filter((value) => TELEGRAM_DM_ID.test(value)))];
|
|
514680
|
+
} catch {
|
|
514681
|
+
return [];
|
|
514682
|
+
}
|
|
514683
|
+
}
|
|
514684
|
+
async function sendTelegramUpdateNotice(text, options = {}) {
|
|
514685
|
+
const stateDir = options.stateDir ?? defaultTelegramStateDir();
|
|
514686
|
+
const configured = hasConfiguredToken(stateDir);
|
|
514687
|
+
const recipients = configured ? readTelegramUpdateRecipients(stateDir) : [];
|
|
514688
|
+
const send = options.send ?? ((chatId, message) => sendReplyFallback(chatId, message));
|
|
514689
|
+
let sent = 0;
|
|
514690
|
+
for (const chatId of recipients) if (await send(chatId, text).catch(() => false)) sent += 1;
|
|
514691
|
+
return {
|
|
514692
|
+
configured,
|
|
514693
|
+
attempted: recipients.length,
|
|
514694
|
+
sent
|
|
514695
|
+
};
|
|
514696
|
+
}
|
|
514697
|
+
//#endregion
|
|
514422
514698
|
//#region src/constant/update.ts
|
|
514423
514699
|
const UPDATE_PROMPT_PRIMARY = "#1783ff";
|
|
514424
514700
|
const UPDATE_PROMPT_SUCCESS = "#16A34A";
|
|
@@ -514506,6 +514782,7 @@ async function runShell(opts, version, updateStartupNotice) {
|
|
|
514506
514782
|
const configStartedAt = startedAt;
|
|
514507
514783
|
let tuiConfig;
|
|
514508
514784
|
let configWarning;
|
|
514785
|
+
let updateNoticeText;
|
|
514509
514786
|
try {
|
|
514510
514787
|
tuiConfig = await loadTuiConfig();
|
|
514511
514788
|
} catch (error) {
|
|
@@ -514513,7 +514790,10 @@ async function runShell(opts, version, updateStartupNotice) {
|
|
|
514513
514790
|
tuiConfig = error.fallback;
|
|
514514
514791
|
configWarning = error.message;
|
|
514515
514792
|
}
|
|
514516
|
-
if (updateStartupNotice !== void 0)
|
|
514793
|
+
if (updateStartupNotice !== void 0) {
|
|
514794
|
+
updateNoticeText = renderUpdateSuccessNotice(updateStartupNotice.details, resolveUiLocale(tuiConfig.uiLocale));
|
|
514795
|
+
configWarning = combineStartupNotice(configWarning, updateNoticeText);
|
|
514796
|
+
}
|
|
514517
514797
|
const palette = await getColorPalette(tuiConfig.theme);
|
|
514518
514798
|
currentTheme.setPalette(palette);
|
|
514519
514799
|
const workDir = process.cwd();
|
|
@@ -514562,7 +514842,10 @@ async function runShell(opts, version, updateStartupNotice) {
|
|
|
514562
514842
|
version,
|
|
514563
514843
|
workDir,
|
|
514564
514844
|
startupNotice: configWarning,
|
|
514565
|
-
onStartupNoticeShown: updateStartupNotice
|
|
514845
|
+
onStartupNoticeShown: updateStartupNotice === void 0 || updateNoticeText === void 0 ? void 0 : async () => {
|
|
514846
|
+
const delivery = await sendTelegramUpdateNotice(updateNoticeText);
|
|
514847
|
+
if (!delivery.configured || delivery.attempted === 0 || delivery.sent === delivery.attempted) await updateStartupNotice.acknowledge();
|
|
514848
|
+
}
|
|
514566
514849
|
});
|
|
514567
514850
|
initializeCliTelemetry({
|
|
514568
514851
|
harness,
|
|
@@ -515539,11 +515822,8 @@ async function runUpdatePreflight(currentVersion, options = {}) {
|
|
|
515539
515822
|
const stderr = options.stderr ?? process.stderr;
|
|
515540
515823
|
const logger = options.logger ?? log;
|
|
515541
515824
|
const platform = process.platform;
|
|
515542
|
-
if (isAutoUpdateDisabledByEnv()) return "continue";
|
|
515543
515825
|
try {
|
|
515544
515826
|
const isInteractive = options.isTTY ?? (process.stdin.isTTY && process.stdout.isTTY);
|
|
515545
|
-
const deviceId = resolveUpdateDeviceId();
|
|
515546
|
-
const bypassRollout = isRolloutBypassedByExperimentalEnv();
|
|
515547
515827
|
const installState = await readUpdateInstallState().catch(() => emptyUpdateInstallState());
|
|
515548
515828
|
if (isInteractive) {
|
|
515549
515829
|
const startupNotice = pendingBackgroundInstallNotice(installState, currentVersion, options.track, logger);
|
|
@@ -515552,6 +515832,9 @@ async function runUpdatePreflight(currentVersion, options = {}) {
|
|
|
515552
515832
|
startupNotice
|
|
515553
515833
|
};
|
|
515554
515834
|
}
|
|
515835
|
+
if (isAutoUpdateDisabledByEnv()) return "continue";
|
|
515836
|
+
const deviceId = resolveUpdateDeviceId();
|
|
515837
|
+
const bypassRollout = isRolloutBypassedByExperimentalEnv();
|
|
515555
515838
|
const cache = await readUpdateCache().catch(() => null);
|
|
515556
515839
|
const cachedManifest = cache?.manifest ?? null;
|
|
515557
515840
|
const cachedDecision = decidePassiveUpdateTarget(currentVersion, cache?.latest ?? null, cachedManifest, deviceId, /* @__PURE__ */ new Date(), bypassRollout);
|