blun-king-cli 9.1.608 → 9.1.610
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/CHANGELOG.md +15 -0
- package/LIESMICH.txt +1 -1
- package/README.md +1 -1
- package/bin/launcher-runtime.js +120 -39
- package/bin/private-paths.js +75 -37
- package/bin/profile-launch.cjs +42 -0
- package/blun.mjs +508 -368
- package/package.json +2 -1
- package/telegram-plugin/dist/bridge.mjs +20 -3
- package/telegram-plugin/dist/mcp-server.mjs +6 -0
- package/telegram-plugin/dist/noise.mjs +11 -1
- package/worker-host.mjs +66 -2
package/blun.mjs
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// BLUN_BUILD_INPUT_SHA256:
|
|
2
|
+
// BLUN_BUILD_INPUT_SHA256:8c6e16ea727bc28d31e8a784ec7ab7cc656e35f70f996bb1e64df97776875360
|
|
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$18 from "node:fs";
|
|
10
10
|
import Kt, { accessSync, appendFileSync, chmodSync, closeSync, constants, copyFileSync, createReadStream, createWriteStream, existsSync, fstatSync, fsyncSync, linkSync, lstatSync, mkdirSync, openSync, opendirSync, promises, readFileSync, readSync, readdirSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
|
|
11
|
-
import * as path$
|
|
11
|
+
import * as path$18 from "node:path";
|
|
12
12
|
import path, { basename, dirname, extname, isAbsolute, join, normalize, parse, 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
|
-
import
|
|
14
|
+
import fs, { access, appendFile, chmod, constants as constants$1, copyFile, cp, link, lstat, mkdir, mkdtemp, open, readFile, readdir, readlink, realpath, rename, rm, rmdir, stat, unlink, writeFile } from "node:fs/promises";
|
|
15
15
|
import * as nodeOs from "node:os";
|
|
16
16
|
import os, { arch, homedir, hostname, networkInterfaces, platform, release, tmpdir, type, userInfo } from "node:os";
|
|
17
17
|
import { execFile, execFileSync, execSync, spawn, spawnSync } from "node:child_process";
|
|
18
18
|
import { Worker } from "node:worker_threads";
|
|
19
19
|
import * as sysPath from "path";
|
|
20
|
-
import
|
|
20
|
+
import path$1, { basename as basename$1, dirname as dirname$1, join as join$1, parse as parse$1 } from "path";
|
|
21
21
|
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";
|
|
22
22
|
import { Readable } from "stream";
|
|
23
23
|
import zi from "assert";
|
|
@@ -2236,11 +2236,11 @@ var init_blun_files = __esmMin((() => {
|
|
|
2236
2236
|
async uploadVideo(input, options) {
|
|
2237
2237
|
let file;
|
|
2238
2238
|
if (typeof input === "string") {
|
|
2239
|
-
if (!fs$
|
|
2240
|
-
const filename = path$
|
|
2239
|
+
if (!fs$18.existsSync(input)) throw new ChatProviderError(`Video file not found: ${input}`);
|
|
2240
|
+
const filename = path$18.basename(input);
|
|
2241
2241
|
const mimeType = guessMimeTypeFromExt(filename);
|
|
2242
2242
|
if (mimeType === void 0 || !mimeType.startsWith("video/")) throw new ChatProviderError(`BlunFiles.uploadVideo: file extension does not indicate a video type: ${filename}`);
|
|
2243
|
-
const data = await fs$
|
|
2243
|
+
const data = await fs$18.promises.readFile(input);
|
|
2244
2244
|
file = new File$1([new Blob$1([new Uint8Array(data)], { type: mimeType })], filename, { type: mimeType });
|
|
2245
2245
|
} else {
|
|
2246
2246
|
if (!input.mimeType.startsWith("video/")) throw new ChatProviderError(`Expected a video mime type, got ${input.mimeType}`);
|
|
@@ -11897,7 +11897,7 @@ var require_clone$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
11897
11897
|
//#endregion
|
|
11898
11898
|
//#region ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
|
|
11899
11899
|
var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
11900
|
-
var fs$
|
|
11900
|
+
var fs$17 = __require("fs");
|
|
11901
11901
|
var polyfills = require_polyfills();
|
|
11902
11902
|
var legacy = require_legacy_streams();
|
|
11903
11903
|
var clone = require_clone$1();
|
|
@@ -11926,36 +11926,36 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
11926
11926
|
m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
|
|
11927
11927
|
console.error(m);
|
|
11928
11928
|
};
|
|
11929
|
-
if (!fs$
|
|
11930
|
-
publishQueue(fs$
|
|
11931
|
-
fs$
|
|
11929
|
+
if (!fs$17[gracefulQueue]) {
|
|
11930
|
+
publishQueue(fs$17, global[gracefulQueue] || []);
|
|
11931
|
+
fs$17.close = (function(fs$close) {
|
|
11932
11932
|
function close(fd, cb) {
|
|
11933
|
-
return fs$close.call(fs$
|
|
11933
|
+
return fs$close.call(fs$17, fd, function(err) {
|
|
11934
11934
|
if (!err) resetQueue();
|
|
11935
11935
|
if (typeof cb === "function") cb.apply(this, arguments);
|
|
11936
11936
|
});
|
|
11937
11937
|
}
|
|
11938
11938
|
Object.defineProperty(close, previousSymbol, { value: fs$close });
|
|
11939
11939
|
return close;
|
|
11940
|
-
})(fs$
|
|
11941
|
-
fs$
|
|
11940
|
+
})(fs$17.close);
|
|
11941
|
+
fs$17.closeSync = (function(fs$closeSync) {
|
|
11942
11942
|
function closeSync(fd) {
|
|
11943
|
-
fs$closeSync.apply(fs$
|
|
11943
|
+
fs$closeSync.apply(fs$17, arguments);
|
|
11944
11944
|
resetQueue();
|
|
11945
11945
|
}
|
|
11946
11946
|
Object.defineProperty(closeSync, previousSymbol, { value: fs$closeSync });
|
|
11947
11947
|
return closeSync;
|
|
11948
|
-
})(fs$
|
|
11948
|
+
})(fs$17.closeSync);
|
|
11949
11949
|
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) process.on("exit", function() {
|
|
11950
|
-
debug(fs$
|
|
11951
|
-
__require("assert").equal(fs$
|
|
11950
|
+
debug(fs$17[gracefulQueue]);
|
|
11951
|
+
__require("assert").equal(fs$17[gracefulQueue].length, 0);
|
|
11952
11952
|
});
|
|
11953
11953
|
}
|
|
11954
|
-
if (!global[gracefulQueue]) publishQueue(global, fs$
|
|
11955
|
-
module.exports = patch(clone(fs$
|
|
11956
|
-
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$
|
|
11957
|
-
module.exports = patch(fs$
|
|
11958
|
-
fs$
|
|
11954
|
+
if (!global[gracefulQueue]) publishQueue(global, fs$17[gracefulQueue]);
|
|
11955
|
+
module.exports = patch(clone(fs$17));
|
|
11956
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$17.__patched) {
|
|
11957
|
+
module.exports = patch(fs$17);
|
|
11958
|
+
fs$17.__patched = true;
|
|
11959
11959
|
}
|
|
11960
11960
|
function patch(fs) {
|
|
11961
11961
|
polyfills(fs);
|
|
@@ -12210,23 +12210,23 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
12210
12210
|
}
|
|
12211
12211
|
function enqueue(elem) {
|
|
12212
12212
|
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
12213
|
-
fs$
|
|
12213
|
+
fs$17[gracefulQueue].push(elem);
|
|
12214
12214
|
retry();
|
|
12215
12215
|
}
|
|
12216
12216
|
var retryTimer;
|
|
12217
12217
|
function resetQueue() {
|
|
12218
12218
|
var now = Date.now();
|
|
12219
|
-
for (var i = 0; i < fs$
|
|
12220
|
-
fs$
|
|
12221
|
-
fs$
|
|
12219
|
+
for (var i = 0; i < fs$17[gracefulQueue].length; ++i) if (fs$17[gracefulQueue][i].length > 2) {
|
|
12220
|
+
fs$17[gracefulQueue][i][3] = now;
|
|
12221
|
+
fs$17[gracefulQueue][i][4] = now;
|
|
12222
12222
|
}
|
|
12223
12223
|
retry();
|
|
12224
12224
|
}
|
|
12225
12225
|
function retry() {
|
|
12226
12226
|
clearTimeout(retryTimer);
|
|
12227
12227
|
retryTimer = void 0;
|
|
12228
|
-
if (fs$
|
|
12229
|
-
var elem = fs$
|
|
12228
|
+
if (fs$17[gracefulQueue].length === 0) return;
|
|
12229
|
+
var elem = fs$17[gracefulQueue].shift();
|
|
12230
12230
|
var fn = elem[0];
|
|
12231
12231
|
var args = elem[1];
|
|
12232
12232
|
var err = elem[2];
|
|
@@ -12245,7 +12245,7 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
12245
12245
|
if (sinceAttempt >= Math.min(sinceStart * 1.2, 100)) {
|
|
12246
12246
|
debug("RETRY", fn.name, args);
|
|
12247
12247
|
fn.apply(null, args.concat([startTime]));
|
|
12248
|
-
} else fs$
|
|
12248
|
+
} else fs$17[gracefulQueue].push(elem);
|
|
12249
12249
|
}
|
|
12250
12250
|
if (retryTimer === void 0) retryTimer = setTimeout(retry, 0);
|
|
12251
12251
|
}
|
|
@@ -12597,7 +12597,7 @@ var require_mtime_precision = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
12597
12597
|
//#endregion
|
|
12598
12598
|
//#region ../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/lockfile.js
|
|
12599
12599
|
var require_lockfile = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
12600
|
-
const path$
|
|
12600
|
+
const path$17 = __require("path");
|
|
12601
12601
|
const fs = require_graceful_fs();
|
|
12602
12602
|
const retry = require_retry$3();
|
|
12603
12603
|
const onExit = require_signal_exit();
|
|
@@ -12607,7 +12607,7 @@ var require_lockfile = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
12607
12607
|
return options.lockfilePath || `${file}.lock`;
|
|
12608
12608
|
}
|
|
12609
12609
|
function resolveCanonicalPath(file, options, callback) {
|
|
12610
|
-
if (!options.realpath) return callback(null, path$
|
|
12610
|
+
if (!options.realpath) return callback(null, path$17.resolve(file));
|
|
12611
12611
|
options.fs.realpath(file, callback);
|
|
12612
12612
|
}
|
|
12613
12613
|
function acquireLock(file, options, callback) {
|
|
@@ -15089,7 +15089,7 @@ async function syncDir(dirPath) {
|
|
|
15089
15089
|
*/
|
|
15090
15090
|
function syncFd(fd) {
|
|
15091
15091
|
return new Promise((resolve, reject) => {
|
|
15092
|
-
fs$
|
|
15092
|
+
fs$18.fsync(fd, (err) => {
|
|
15093
15093
|
if (err) {
|
|
15094
15094
|
reject(err);
|
|
15095
15095
|
return;
|
|
@@ -26044,7 +26044,7 @@ var require_loader = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
26044
26044
|
};
|
|
26045
26045
|
return _setPrototypeOf(o, p);
|
|
26046
26046
|
}
|
|
26047
|
-
var path$
|
|
26047
|
+
var path$16 = __require("path");
|
|
26048
26048
|
module.exports = /* @__PURE__ */ function(_EmitterObj) {
|
|
26049
26049
|
_inheritsLoose(Loader, _EmitterObj);
|
|
26050
26050
|
function Loader() {
|
|
@@ -26052,7 +26052,7 @@ var require_loader = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
26052
26052
|
}
|
|
26053
26053
|
var _proto = Loader.prototype;
|
|
26054
26054
|
_proto.resolve = function resolve(from, to) {
|
|
26055
|
-
return path$
|
|
26055
|
+
return path$16.resolve(path$16.dirname(from), to);
|
|
26056
26056
|
};
|
|
26057
26057
|
_proto.isRelative = function isRelative(filename) {
|
|
26058
26058
|
return filename.indexOf("./") === 0 || filename.indexOf("../") === 0;
|
|
@@ -27708,8 +27708,8 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
27708
27708
|
};
|
|
27709
27709
|
return _setPrototypeOf(o, p);
|
|
27710
27710
|
}
|
|
27711
|
-
var fs$
|
|
27712
|
-
var path$
|
|
27711
|
+
var fs$16 = __require("fs");
|
|
27712
|
+
var path$15 = __require("path");
|
|
27713
27713
|
var Loader = require_loader();
|
|
27714
27714
|
var PrecompiledLoader = require_precompiled_loader().PrecompiledLoader;
|
|
27715
27715
|
var chokidar;
|
|
@@ -27724,7 +27724,7 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
27724
27724
|
_this.noCache = !!opts.noCache;
|
|
27725
27725
|
if (searchPaths) {
|
|
27726
27726
|
searchPaths = Array.isArray(searchPaths) ? searchPaths : [searchPaths];
|
|
27727
|
-
_this.searchPaths = searchPaths.map(path$
|
|
27727
|
+
_this.searchPaths = searchPaths.map(path$15.normalize);
|
|
27728
27728
|
} else _this.searchPaths = ["."];
|
|
27729
27729
|
if (opts.watch) {
|
|
27730
27730
|
try {
|
|
@@ -27732,10 +27732,10 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
27732
27732
|
} catch (e) {
|
|
27733
27733
|
throw new Error("watch requires chokidar to be installed");
|
|
27734
27734
|
}
|
|
27735
|
-
var paths = _this.searchPaths.filter(fs$
|
|
27735
|
+
var paths = _this.searchPaths.filter(fs$16.existsSync);
|
|
27736
27736
|
var watcher = chokidar.watch(paths);
|
|
27737
27737
|
watcher.on("all", function(event, fullname) {
|
|
27738
|
-
fullname = path$
|
|
27738
|
+
fullname = path$15.resolve(fullname);
|
|
27739
27739
|
if (event === "change" && fullname in _this.pathsToNames) _this.emit("update", _this.pathsToNames[fullname], fullname);
|
|
27740
27740
|
});
|
|
27741
27741
|
watcher.on("error", function(error) {
|
|
@@ -27749,9 +27749,9 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
27749
27749
|
var fullpath = null;
|
|
27750
27750
|
var paths = this.searchPaths;
|
|
27751
27751
|
for (var i = 0; i < paths.length; i++) {
|
|
27752
|
-
var basePath = path$
|
|
27753
|
-
var p = path$
|
|
27754
|
-
if (p.indexOf(basePath) === 0 && fs$
|
|
27752
|
+
var basePath = path$15.resolve(paths[i]);
|
|
27753
|
+
var p = path$15.resolve(paths[i], name);
|
|
27754
|
+
if (p.indexOf(basePath) === 0 && fs$16.existsSync(p)) {
|
|
27755
27755
|
fullpath = p;
|
|
27756
27756
|
break;
|
|
27757
27757
|
}
|
|
@@ -27759,7 +27759,7 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
27759
27759
|
if (!fullpath) return null;
|
|
27760
27760
|
this.pathsToNames[fullpath] = name;
|
|
27761
27761
|
var source = {
|
|
27762
|
-
src: fs$
|
|
27762
|
+
src: fs$16.readFileSync(fullpath, "utf-8"),
|
|
27763
27763
|
path: fullpath,
|
|
27764
27764
|
noCache: this.noCache
|
|
27765
27765
|
};
|
|
@@ -27807,7 +27807,7 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
27807
27807
|
}
|
|
27808
27808
|
this.pathsToNames[fullpath] = name;
|
|
27809
27809
|
var source = {
|
|
27810
|
-
src: fs$
|
|
27810
|
+
src: fs$16.readFileSync(fullpath, "utf-8"),
|
|
27811
27811
|
path: fullpath,
|
|
27812
27812
|
noCache: this.noCache
|
|
27813
27813
|
};
|
|
@@ -28109,13 +28109,13 @@ var require_globals = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
28109
28109
|
//#endregion
|
|
28110
28110
|
//#region ../../node_modules/.pnpm/nunjucks@3.2.4_chokidar@4.0.3/node_modules/nunjucks/src/express-app.js
|
|
28111
28111
|
var require_express_app = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28112
|
-
var path$
|
|
28112
|
+
var path$14 = __require("path");
|
|
28113
28113
|
module.exports = function express(env, app) {
|
|
28114
28114
|
function NunjucksView(name, opts) {
|
|
28115
28115
|
this.name = name;
|
|
28116
28116
|
this.path = name;
|
|
28117
28117
|
this.defaultEngine = opts.defaultEngine;
|
|
28118
|
-
this.ext = path$
|
|
28118
|
+
this.ext = path$14.extname(name);
|
|
28119
28119
|
if (!this.ext && !this.defaultEngine) throw new Error("No default engine was specified and no extension was provided.");
|
|
28120
28120
|
if (!this.ext) this.name += this.ext = (this.defaultEngine[0] !== "." ? "." : "") + this.defaultEngine;
|
|
28121
28121
|
}
|
|
@@ -28551,8 +28551,8 @@ var require_precompile_global = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
28551
28551
|
//#endregion
|
|
28552
28552
|
//#region ../../node_modules/.pnpm/nunjucks@3.2.4_chokidar@4.0.3/node_modules/nunjucks/src/precompile.js
|
|
28553
28553
|
var require_precompile = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28554
|
-
var fs$
|
|
28555
|
-
var path$
|
|
28554
|
+
var fs$15 = __require("fs");
|
|
28555
|
+
var path$13 = __require("path");
|
|
28556
28556
|
var _prettifyError = require_lib$8()._prettifyError;
|
|
28557
28557
|
var compiler = require_compiler();
|
|
28558
28558
|
var Environment = require_environment().Environment;
|
|
@@ -28576,27 +28576,27 @@ var require_precompile = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
28576
28576
|
var env = opts.env || new Environment([]);
|
|
28577
28577
|
var wrapper = opts.wrapper || precompileGlobal;
|
|
28578
28578
|
if (opts.isString) return precompileString(input, opts);
|
|
28579
|
-
var pathStats = fs$
|
|
28579
|
+
var pathStats = fs$15.existsSync(input) && fs$15.statSync(input);
|
|
28580
28580
|
var precompiled = [];
|
|
28581
28581
|
var templates = [];
|
|
28582
28582
|
function addTemplates(dir) {
|
|
28583
|
-
fs$
|
|
28584
|
-
var filepath = path$
|
|
28585
|
-
var subpath = filepath.substr(path$
|
|
28586
|
-
var stat = fs$
|
|
28583
|
+
fs$15.readdirSync(dir).forEach(function(file) {
|
|
28584
|
+
var filepath = path$13.join(dir, file);
|
|
28585
|
+
var subpath = filepath.substr(path$13.join(input, "/").length);
|
|
28586
|
+
var stat = fs$15.statSync(filepath);
|
|
28587
28587
|
if (stat && stat.isDirectory()) {
|
|
28588
28588
|
subpath += "/";
|
|
28589
28589
|
if (!match(subpath, opts.exclude)) addTemplates(filepath);
|
|
28590
28590
|
} else if (match(subpath, opts.include)) templates.push(filepath);
|
|
28591
28591
|
});
|
|
28592
28592
|
}
|
|
28593
|
-
if (pathStats.isFile()) precompiled.push(_precompile(fs$
|
|
28593
|
+
if (pathStats.isFile()) precompiled.push(_precompile(fs$15.readFileSync(input, "utf-8"), opts.name || input, env));
|
|
28594
28594
|
else if (pathStats.isDirectory()) {
|
|
28595
28595
|
addTemplates(input);
|
|
28596
28596
|
for (var i = 0; i < templates.length; i++) {
|
|
28597
|
-
var name = templates[i].replace(path$
|
|
28597
|
+
var name = templates[i].replace(path$13.join(input, "/"), "");
|
|
28598
28598
|
try {
|
|
28599
|
-
precompiled.push(_precompile(fs$
|
|
28599
|
+
precompiled.push(_precompile(fs$15.readFileSync(templates[i], "utf-8"), name, env));
|
|
28600
28600
|
} catch (e) {
|
|
28601
28601
|
if (opts.force) console.error(e);
|
|
28602
28602
|
else throw e;
|
|
@@ -32634,7 +32634,7 @@ var require_buffer_from = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
32634
32634
|
//#region ../../node_modules/.pnpm/source-map-support@0.5.21/node_modules/source-map-support/source-map-support.js
|
|
32635
32635
|
var require_source_map_support = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
32636
32636
|
var SourceMapConsumer = require_source_map().SourceMapConsumer;
|
|
32637
|
-
var path$
|
|
32637
|
+
var path$12 = __require("path");
|
|
32638
32638
|
var fs;
|
|
32639
32639
|
try {
|
|
32640
32640
|
fs = __require("fs");
|
|
@@ -32711,15 +32711,15 @@ var require_source_map_support = /* @__PURE__ */ __commonJSMin(((exports, module
|
|
|
32711
32711
|
});
|
|
32712
32712
|
function supportRelativeURL(file, url) {
|
|
32713
32713
|
if (!file) return url;
|
|
32714
|
-
var dir = path$
|
|
32714
|
+
var dir = path$12.dirname(file);
|
|
32715
32715
|
var match = /^\w+:\/\/[^\/]*/.exec(dir);
|
|
32716
32716
|
var protocol = match ? match[0] : "";
|
|
32717
32717
|
var startPath = dir.slice(protocol.length);
|
|
32718
32718
|
if (protocol && /^\/\w\:/.test(startPath)) {
|
|
32719
32719
|
protocol += "/";
|
|
32720
|
-
return protocol + path$
|
|
32720
|
+
return protocol + path$12.resolve(dir.slice(protocol.length), url).replace(/\\/g, "/");
|
|
32721
32721
|
}
|
|
32722
|
-
return protocol + path$
|
|
32722
|
+
return protocol + path$12.resolve(dir.slice(protocol.length), url);
|
|
32723
32723
|
}
|
|
32724
32724
|
function retrieveSourceMapURL(source) {
|
|
32725
32725
|
var fileData;
|
|
@@ -191962,7 +191962,7 @@ var require_gifframe = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
191962
191962
|
//#region ../../node_modules/.pnpm/gifwrap@0.10.1/node_modules/gifwrap/src/gifutil.js
|
|
191963
191963
|
var require_gifutil = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
191964
191964
|
/** @namespace GifUtil */
|
|
191965
|
-
const fs$
|
|
191965
|
+
const fs$14 = __require("fs");
|
|
191966
191966
|
const ImageQ = require_image_q();
|
|
191967
191967
|
const BitmapImage = require_bitmapimage();
|
|
191968
191968
|
const { GifFrame } = require_gifframe();
|
|
@@ -192229,7 +192229,7 @@ var require_gifutil = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
192229
192229
|
}
|
|
192230
192230
|
function _readBinary(path) {
|
|
192231
192231
|
return new Promise((resolve, reject) => {
|
|
192232
|
-
fs$
|
|
192232
|
+
fs$14.readFile(path, (err, buffer) => {
|
|
192233
192233
|
if (err) return reject(err);
|
|
192234
192234
|
return resolve(buffer);
|
|
192235
192235
|
});
|
|
@@ -192237,7 +192237,7 @@ var require_gifutil = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
192237
192237
|
}
|
|
192238
192238
|
function _writeBinary(path, buffer) {
|
|
192239
192239
|
return new Promise((resolve, reject) => {
|
|
192240
|
-
fs$
|
|
192240
|
+
fs$14.writeFile(path, buffer, (err) => {
|
|
192241
192241
|
if (err) return reject(err);
|
|
192242
192242
|
return resolve();
|
|
192243
192243
|
});
|
|
@@ -218055,7 +218055,7 @@ var init_file_type = __esmMin((() => {
|
|
|
218055
218055
|
}
|
|
218056
218056
|
async fromFile(path) {
|
|
218057
218057
|
this.options.signal?.throwIfAborted();
|
|
218058
|
-
const fileHandle = await
|
|
218058
|
+
const fileHandle = await fs.open(path, constants.O_RDONLY | constants.O_NONBLOCK);
|
|
218059
218059
|
const fileStat = await fileHandle.stat();
|
|
218060
218060
|
if (!fileStat.isFile()) {
|
|
218061
218061
|
await fileHandle.close();
|
|
@@ -228560,7 +228560,7 @@ async function processBitmapFont(file, font) {
|
|
|
228560
228560
|
...font,
|
|
228561
228561
|
chars,
|
|
228562
228562
|
kernings,
|
|
228563
|
-
pages: await Promise.all(font.pages.map(async (page) => CharacterJimp.read(
|
|
228563
|
+
pages: await Promise.all(font.pages.map(async (page) => CharacterJimp.read(path$1.join(path$1.dirname(file), page))))
|
|
228564
228564
|
};
|
|
228565
228565
|
}
|
|
228566
228566
|
var import_parse_bmfont_ascii, import_lib$1, import_parse_bmfont_binary, convertXML, isWebWorker, CharacterJimp, HEADER;
|
|
@@ -259124,7 +259124,7 @@ function Yn(s, t) {
|
|
|
259124
259124
|
function Kn(s, t) {
|
|
259125
259125
|
s.head = new ue$1(t, void 0, s.head, s), s.tail || (s.tail = s.head), s.length++;
|
|
259126
259126
|
}
|
|
259127
|
-
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$7, 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$
|
|
259127
|
+
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$7, 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$13, 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;
|
|
259128
259128
|
var init_index_min = __esmMin((() => {
|
|
259129
259129
|
zr = Object.defineProperty;
|
|
259130
259130
|
Ur = (s, t) => {
|
|
@@ -260652,7 +260652,7 @@ while (this[Zs](this[st$1].shift()));
|
|
|
260652
260652
|
let [o, h] = ce$1(this.path);
|
|
260653
260653
|
o && typeof h == "string" && (this.path = h, r = o);
|
|
260654
260654
|
}
|
|
260655
|
-
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 ||
|
|
260655
|
+
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 || path$1.resolve(this.cwd, t)), this.path === "" && (this.path = "./"), r && this.warn("TAR_ENTRY_INFO", `stripping ${r} from absolute path`, {
|
|
260656
260656
|
entry: this,
|
|
260657
260657
|
path: r + this.path
|
|
260658
260658
|
});
|
|
@@ -260735,7 +260735,7 @@ while (this[Zs](this[st$1].shift()));
|
|
|
260735
260735
|
}
|
|
260736
260736
|
[sr](t) {
|
|
260737
260737
|
if (!this.stat) throw new Error("cannot create link entry without stat");
|
|
260738
|
-
this.type = "Link", this.linkpath = f(
|
|
260738
|
+
this.type = "Link", this.linkpath = f(path$1.relative(this.cwd, t)), this.stat.size = 0, this[fe$1](), this.end();
|
|
260739
260739
|
}
|
|
260740
260740
|
[er]() {
|
|
260741
260741
|
if (!this.stat) throw new Error("cannot create file entry without stat");
|
|
@@ -261094,7 +261094,7 @@ while (this[Zs](this[st$1].shift()));
|
|
|
261094
261094
|
constructor(t, e) {
|
|
261095
261095
|
this.path = t || "./", this.absolute = e;
|
|
261096
261096
|
}
|
|
261097
|
-
}, 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$
|
|
261097
|
+
}, 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$13 = Symbol("ondrain"), wt = class extends A$1 {
|
|
261098
261098
|
sync = !1;
|
|
261099
261099
|
opt;
|
|
261100
261100
|
cwd;
|
|
@@ -261127,8 +261127,8 @@ while (this[Zs](this[st$1].shift()));
|
|
|
261127
261127
|
if ((t.gzip ? 1 : 0) + (t.brotli ? 1 : 0) + (t.zstd ? 1 : 0) > 1) throw new TypeError("gzip, brotli, zstd are mutually exclusive");
|
|
261128
261128
|
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");
|
|
261129
261129
|
let e = this.zip;
|
|
261130
|
-
e.on("data", (i) => super.write(i)), e.on("end", () => super.end()), e.on("drain", () => this[fs$
|
|
261131
|
-
} else this.on("drain", this[fs$
|
|
261130
|
+
e.on("data", (i) => super.write(i)), e.on("end", () => super.end()), e.on("drain", () => this[fs$13]()), this.on("resume", () => e.resume());
|
|
261131
|
+
} else this.on("drain", this[fs$13]);
|
|
261132
261132
|
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;
|
|
261133
261133
|
}
|
|
261134
261134
|
[lr](t) {
|
|
@@ -261145,7 +261145,7 @@ while (this[Zs](this[st$1].shift()));
|
|
|
261145
261145
|
return typeof t == "string" ? this[ci](t) : this[or](t), this.flowing;
|
|
261146
261146
|
}
|
|
261147
261147
|
[or](t) {
|
|
261148
|
-
let e = f(
|
|
261148
|
+
let e = f(path$1.resolve(this.cwd, t.path));
|
|
261149
261149
|
if (!this.filter(t.path, t)) t.resume();
|
|
261150
261150
|
else {
|
|
261151
261151
|
let i = new pi(t.path, e);
|
|
@@ -261154,7 +261154,7 @@ while (this[Zs](this[st$1].shift()));
|
|
|
261154
261154
|
this[Ft$1]();
|
|
261155
261155
|
}
|
|
261156
261156
|
[ci](t) {
|
|
261157
|
-
let e = f(
|
|
261157
|
+
let e = f(path$1.resolve(this.cwd, t));
|
|
261158
261158
|
this[W$1].push(new pi(t, e)), this[Ft$1]();
|
|
261159
261159
|
}
|
|
261160
261160
|
[ds](t) {
|
|
@@ -261255,7 +261255,7 @@ while (this[Zs](this[st$1].shift()));
|
|
|
261255
261255
|
this.emit("error", e);
|
|
261256
261256
|
}
|
|
261257
261257
|
}
|
|
261258
|
-
[fs$
|
|
261258
|
+
[fs$13]() {
|
|
261259
261259
|
this[Et] && this[Et].entry && this[Et].entry.resume();
|
|
261260
261260
|
}
|
|
261261
261261
|
[di](t) {
|
|
@@ -261421,7 +261421,7 @@ while (this[Zs](this[st$1].shift()));
|
|
|
261421
261421
|
E ? e(E) : x && a ? Es(x, o, h, (Le) => y(Le)) : n ? Kt.chmod(s, r, e) : e();
|
|
261422
261422
|
};
|
|
261423
261423
|
if (s === d) return no(s, y);
|
|
261424
|
-
if (l) return
|
|
261424
|
+
if (l) return fs.mkdir(s, {
|
|
261425
261425
|
mode: r,
|
|
261426
261426
|
recursive: !0
|
|
261427
261427
|
}).then((E) => y(null, E ?? void 0), y);
|
|
@@ -262180,7 +262180,7 @@ var require_pend = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
262180
262180
|
//#endregion
|
|
262181
262181
|
//#region ../../node_modules/.pnpm/yauzl@3.3.0/node_modules/yauzl/fd-slicer.js
|
|
262182
262182
|
var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
262183
|
-
var fs$
|
|
262183
|
+
var fs$12 = __require("fs");
|
|
262184
262184
|
var util$6 = __require("util");
|
|
262185
262185
|
var stream$2 = __require("stream");
|
|
262186
262186
|
var Readable = stream$2.Readable;
|
|
@@ -262205,7 +262205,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
262205
262205
|
FdSlicer.prototype.read = function(buffer, offset, length, position, callback) {
|
|
262206
262206
|
var self = this;
|
|
262207
262207
|
self.pend.go(function(cb) {
|
|
262208
|
-
fs$
|
|
262208
|
+
fs$12.read(self.fd, buffer, offset, length, position, function(err, bytesRead, buffer) {
|
|
262209
262209
|
cb();
|
|
262210
262210
|
callback(err, bytesRead, buffer);
|
|
262211
262211
|
});
|
|
@@ -262214,7 +262214,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
262214
262214
|
FdSlicer.prototype.write = function(buffer, offset, length, position, callback) {
|
|
262215
262215
|
var self = this;
|
|
262216
262216
|
self.pend.go(function(cb) {
|
|
262217
|
-
fs$
|
|
262217
|
+
fs$12.write(self.fd, buffer, offset, length, position, function(err, written, buffer) {
|
|
262218
262218
|
cb();
|
|
262219
262219
|
callback(err, written, buffer);
|
|
262220
262220
|
});
|
|
@@ -262234,7 +262234,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
262234
262234
|
self.refCount -= 1;
|
|
262235
262235
|
if (self.refCount > 0) return;
|
|
262236
262236
|
if (self.refCount < 0) throw new Error("invalid unref");
|
|
262237
|
-
if (self.autoClose) fs$
|
|
262237
|
+
if (self.autoClose) fs$12.close(self.fd, onCloseDone);
|
|
262238
262238
|
function onCloseDone(err) {
|
|
262239
262239
|
if (err) self.emit("error", err);
|
|
262240
262240
|
else self.emit("close");
|
|
@@ -262265,7 +262265,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
262265
262265
|
self.context.pend.go(function(cb) {
|
|
262266
262266
|
if (self.destroyed) return cb();
|
|
262267
262267
|
var buffer = Buffer.allocUnsafe(toRead);
|
|
262268
|
-
fs$
|
|
262268
|
+
fs$12.read(self.context.fd, buffer, 0, toRead, self.pos, function(err, bytesRead) {
|
|
262269
262269
|
if (err) self.destroy(err);
|
|
262270
262270
|
else if (bytesRead === 0) {
|
|
262271
262271
|
self.destroyed = true;
|
|
@@ -262311,7 +262311,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
262311
262311
|
}
|
|
262312
262312
|
self.context.pend.go(function(cb) {
|
|
262313
262313
|
if (self.destroyed) return cb();
|
|
262314
|
-
fs$
|
|
262314
|
+
fs$12.write(self.context.fd, buffer, 0, buffer.length, self.pos, function(err, bytes) {
|
|
262315
262315
|
if (err) {
|
|
262316
262316
|
self.destroy();
|
|
262317
262317
|
cb();
|
|
@@ -266224,14 +266224,14 @@ async function readGitExecPath(deps, gitExe) {
|
|
|
266224
266224
|
}
|
|
266225
266225
|
}
|
|
266226
266226
|
function gitBashCandidatesFromGitExe(gitExe) {
|
|
266227
|
-
const normalizedGitExe = path$
|
|
266228
|
-
const gitDir = path$
|
|
266229
|
-
const gitDirName = path$
|
|
266227
|
+
const normalizedGitExe = path$18.win32.normalize(normalizeWindowsPath(gitExe));
|
|
266228
|
+
const gitDir = path$18.win32.dirname(normalizedGitExe);
|
|
266229
|
+
const gitDirName = path$18.win32.basename(gitDir).toLowerCase();
|
|
266230
266230
|
if (gitDirName !== "cmd" && gitDirName !== "bin") return;
|
|
266231
|
-
return gitBashCandidatesFromGitRoot(path$
|
|
266231
|
+
return gitBashCandidatesFromGitRoot(path$18.win32.dirname(gitDir));
|
|
266232
266232
|
}
|
|
266233
266233
|
function gitBashCandidatesFromGitExecPath(execPath) {
|
|
266234
|
-
const normalized = path$
|
|
266234
|
+
const normalized = path$18.win32.normalize(normalizeWindowsPath(execPath));
|
|
266235
266235
|
const parts = normalized.split("\\");
|
|
266236
266236
|
for (let i = parts.length - 1; i >= 0; i -= 1) {
|
|
266237
266237
|
const segment = parts[i]?.toLowerCase();
|
|
@@ -266240,16 +266240,16 @@ function gitBashCandidatesFromGitExecPath(execPath) {
|
|
|
266240
266240
|
if (root.length > 0) return gitBashCandidatesFromGitRoot(root);
|
|
266241
266241
|
}
|
|
266242
266242
|
}
|
|
266243
|
-
return gitBashCandidatesFromGitRoot(path$
|
|
266243
|
+
return gitBashCandidatesFromGitRoot(path$18.win32.join(normalized, "..", ".."));
|
|
266244
266244
|
}
|
|
266245
266245
|
function gitBashCandidatesFromGitRoot(root) {
|
|
266246
|
-
return [path$
|
|
266246
|
+
return [path$18.win32.normalize(path$18.win32.join(root, "bin", "bash.exe")), path$18.win32.normalize(path$18.win32.join(root, "usr", "bin", "bash.exe"))];
|
|
266247
266247
|
}
|
|
266248
266248
|
function normalizeWindowsPath(path) {
|
|
266249
266249
|
return path.replaceAll("/", "\\");
|
|
266250
266250
|
}
|
|
266251
266251
|
function isAbsoluteWindowsPath(path) {
|
|
266252
|
-
return path$
|
|
266252
|
+
return path$18.win32.isAbsolute(normalizeWindowsPath(path));
|
|
266253
266253
|
}
|
|
266254
266254
|
function dedupeWindowsPaths(paths) {
|
|
266255
266255
|
const deduped = [];
|
|
@@ -303168,7 +303168,7 @@ var init_proxy = __esmMin((() => {
|
|
|
303168
303168
|
var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
303169
303169
|
module.exports = isexe;
|
|
303170
303170
|
isexe.sync = sync;
|
|
303171
|
-
var fs$
|
|
303171
|
+
var fs$10 = __require("fs");
|
|
303172
303172
|
function checkPathExt(path, options) {
|
|
303173
303173
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
303174
303174
|
if (!pathext) return true;
|
|
@@ -303185,12 +303185,12 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
303185
303185
|
return checkPathExt(path, options);
|
|
303186
303186
|
}
|
|
303187
303187
|
function isexe(path, options, cb) {
|
|
303188
|
-
fs$
|
|
303188
|
+
fs$10.stat(path, function(er, stat) {
|
|
303189
303189
|
cb(er, er ? false : checkStat(stat, path, options));
|
|
303190
303190
|
});
|
|
303191
303191
|
}
|
|
303192
303192
|
function sync(path, options) {
|
|
303193
|
-
return checkStat(fs$
|
|
303193
|
+
return checkStat(fs$10.statSync(path), path, options);
|
|
303194
303194
|
}
|
|
303195
303195
|
}));
|
|
303196
303196
|
//#endregion
|
|
@@ -303198,14 +303198,14 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
303198
303198
|
var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
303199
303199
|
module.exports = isexe;
|
|
303200
303200
|
isexe.sync = sync;
|
|
303201
|
-
var fs$
|
|
303201
|
+
var fs$9 = __require("fs");
|
|
303202
303202
|
function isexe(path, options, cb) {
|
|
303203
|
-
fs$
|
|
303203
|
+
fs$9.stat(path, function(er, stat) {
|
|
303204
303204
|
cb(er, er ? false : checkStat(stat, options));
|
|
303205
303205
|
});
|
|
303206
303206
|
}
|
|
303207
303207
|
function sync(path, options) {
|
|
303208
|
-
return checkStat(fs$
|
|
303208
|
+
return checkStat(fs$9.statSync(path), options);
|
|
303209
303209
|
}
|
|
303210
303210
|
function checkStat(stat, options) {
|
|
303211
303211
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -303269,7 +303269,7 @@ var require_isexe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
303269
303269
|
//#region ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
|
|
303270
303270
|
var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
303271
303271
|
const isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
303272
|
-
const path$
|
|
303272
|
+
const path$11 = __require("path");
|
|
303273
303273
|
const COLON = isWindows ? ";" : ":";
|
|
303274
303274
|
const isexe = require_isexe();
|
|
303275
303275
|
const getNotFoundError = (cmd) => Object.assign(/* @__PURE__ */ new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
@@ -303299,7 +303299,7 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
303299
303299
|
if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
|
|
303300
303300
|
const ppRaw = pathEnv[i];
|
|
303301
303301
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
303302
|
-
const pCmd = path$
|
|
303302
|
+
const pCmd = path$11.join(pathPart, cmd);
|
|
303303
303303
|
resolve(subStep(!pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd, i, 0));
|
|
303304
303304
|
});
|
|
303305
303305
|
const subStep = (p, i, ii) => new Promise((resolve, reject) => {
|
|
@@ -303320,7 +303320,7 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
303320
303320
|
for (let i = 0; i < pathEnv.length; i++) {
|
|
303321
303321
|
const ppRaw = pathEnv[i];
|
|
303322
303322
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
303323
|
-
const pCmd = path$
|
|
303323
|
+
const pCmd = path$11.join(pathPart, cmd);
|
|
303324
303324
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
303325
303325
|
for (let j = 0; j < pathExt.length; j++) {
|
|
303326
303326
|
const cur = p + pathExt[j];
|
|
@@ -303351,7 +303351,7 @@ var require_path_key = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
303351
303351
|
//#endregion
|
|
303352
303352
|
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
303353
303353
|
var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
303354
|
-
const path$
|
|
303354
|
+
const path$10 = __require("path");
|
|
303355
303355
|
const which = require_which();
|
|
303356
303356
|
const getPathKey = require_path_key();
|
|
303357
303357
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
@@ -303366,12 +303366,12 @@ var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
303366
303366
|
try {
|
|
303367
303367
|
resolved = which.sync(parsed.command, {
|
|
303368
303368
|
path: env[getPathKey({ env })],
|
|
303369
|
-
pathExt: withoutPathExt ? path$
|
|
303369
|
+
pathExt: withoutPathExt ? path$10.delimiter : void 0
|
|
303370
303370
|
});
|
|
303371
303371
|
} catch (e) {} finally {
|
|
303372
303372
|
if (shouldSwitchCwd) process.chdir(cwd);
|
|
303373
303373
|
}
|
|
303374
|
-
if (resolved) resolved = path$
|
|
303374
|
+
if (resolved) resolved = path$10.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
303375
303375
|
return resolved;
|
|
303376
303376
|
}
|
|
303377
303377
|
function resolveCommand(parsed) {
|
|
@@ -303420,16 +303420,16 @@ var require_shebang_command = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
303420
303420
|
//#endregion
|
|
303421
303421
|
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
|
|
303422
303422
|
var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
303423
|
-
const fs$
|
|
303423
|
+
const fs$8 = __require("fs");
|
|
303424
303424
|
const shebangCommand = require_shebang_command();
|
|
303425
303425
|
function readShebang(command) {
|
|
303426
303426
|
const size = 150;
|
|
303427
303427
|
const buffer = Buffer.alloc(size);
|
|
303428
303428
|
let fd;
|
|
303429
303429
|
try {
|
|
303430
|
-
fd = fs$
|
|
303431
|
-
fs$
|
|
303432
|
-
fs$
|
|
303430
|
+
fd = fs$8.openSync(command, "r");
|
|
303431
|
+
fs$8.readSync(fd, buffer, 0, size, 0);
|
|
303432
|
+
fs$8.closeSync(fd);
|
|
303433
303433
|
} catch (e) {}
|
|
303434
303434
|
return shebangCommand(buffer.toString());
|
|
303435
303435
|
}
|
|
@@ -303438,7 +303438,7 @@ var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
303438
303438
|
//#endregion
|
|
303439
303439
|
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
|
|
303440
303440
|
var require_parse$5 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
303441
|
-
const path$
|
|
303441
|
+
const path$9 = __require("path");
|
|
303442
303442
|
const resolveCommand = require_resolveCommand();
|
|
303443
303443
|
const escape = require_escape();
|
|
303444
303444
|
const readShebang = require_readShebang();
|
|
@@ -303461,7 +303461,7 @@ var require_parse$5 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
303461
303461
|
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
303462
303462
|
if (parsed.options.forceShell || needsShell) {
|
|
303463
303463
|
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
303464
|
-
parsed.command = path$
|
|
303464
|
+
parsed.command = path$9.normalize(parsed.command);
|
|
303465
303465
|
parsed.command = escape.command(parsed.command);
|
|
303466
303466
|
parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
|
|
303467
303467
|
parsed.args = [
|
|
@@ -337591,7 +337591,7 @@ var require_dist$5 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
337591
337591
|
//#endregion
|
|
337592
337592
|
//#region ../../node_modules/.pnpm/yazl@3.3.1/node_modules/yazl/index.js
|
|
337593
337593
|
var require_yazl = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
337594
|
-
var fs$
|
|
337594
|
+
var fs$7 = __require("fs");
|
|
337595
337595
|
var Transform$2 = __require("stream").Transform;
|
|
337596
337596
|
var PassThrough$2 = __require("stream").PassThrough;
|
|
337597
337597
|
var zlib$1 = __require("zlib");
|
|
@@ -337620,14 +337620,14 @@ var require_yazl = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
337620
337620
|
if (shouldIgnoreAdding(self)) return;
|
|
337621
337621
|
var entry = new Entry(metadataPath, false, options);
|
|
337622
337622
|
self.entries.push(entry);
|
|
337623
|
-
fs$
|
|
337623
|
+
fs$7.stat(realPath, function(err, stats) {
|
|
337624
337624
|
if (err) return self.emit("error", err);
|
|
337625
337625
|
if (!stats.isFile()) return self.emit("error", /* @__PURE__ */ new Error("not a file: " + realPath));
|
|
337626
337626
|
entry.uncompressedSize = stats.size;
|
|
337627
337627
|
if (options.mtime == null) entry.setLastModDate(stats.mtime);
|
|
337628
337628
|
if (options.mode == null) entry.setFileAttributesMode(stats.mode);
|
|
337629
337629
|
entry.setFileDataPumpFunction(function() {
|
|
337630
|
-
var readStream = fs$
|
|
337630
|
+
var readStream = fs$7.createReadStream(realPath);
|
|
337631
337631
|
entry.state = Entry.FILE_DATA_IN_PROGRESS;
|
|
337632
337632
|
readStream.on("error", function(err) {
|
|
337633
337633
|
self.emit("error", err);
|
|
@@ -350557,6 +350557,7 @@ var BlunAuthTransitionError = class extends Error {
|
|
|
350557
350557
|
function blunAuthWarningsFromError(error) {
|
|
350558
350558
|
return error instanceof BlunAuthTransitionError ? error.warnings : void 0;
|
|
350559
350559
|
}
|
|
350560
|
+
const LEGACY_PROFILE_MODEL = "blun/king";
|
|
350560
350561
|
var BlunAuthFacade = class {
|
|
350561
350562
|
options;
|
|
350562
350563
|
toolkit;
|
|
@@ -350583,6 +350584,57 @@ var BlunAuthFacade = class {
|
|
|
350583
350584
|
}
|
|
350584
350585
|
});
|
|
350585
350586
|
}
|
|
350587
|
+
async restoreMissingProfileModel() {
|
|
350588
|
+
const needsRepair = (config) => config.defaultModel === LEGACY_PROFILE_MODEL && config.models?.[LEGACY_PROFILE_MODEL] === void 0 && config.providers["managed:blun"] === void 0;
|
|
350589
|
+
if (!needsRepair(readConfigFileForUpdate(this.options.configPath))) return false;
|
|
350590
|
+
const runtime = this.resolveRuntimeManagedAuth(BLUN_PROVIDER_NAME$1);
|
|
350591
|
+
if (!(await this.toolkit.status("managed:blun", runtime.oauthRef)).providers.some((provider) => provider.hasToken)) return false;
|
|
350592
|
+
let accessToken;
|
|
350593
|
+
try {
|
|
350594
|
+
accessToken = await this.toolkit.ensureFresh(BLUN_PROVIDER_NAME$1, { oauthRef: runtime.oauthRef });
|
|
350595
|
+
} catch (error) {
|
|
350596
|
+
if (error instanceof OAuthError$1) return false;
|
|
350597
|
+
throw error;
|
|
350598
|
+
}
|
|
350599
|
+
let models;
|
|
350600
|
+
try {
|
|
350601
|
+
models = requireManagedBlunKingCatalog(await fetchManagedBlunCodeModels({
|
|
350602
|
+
accessToken,
|
|
350603
|
+
baseUrl: runtime.baseUrl,
|
|
350604
|
+
headers: this.options.identity === void 0 ? void 0 : createBlunDefaultHeaders({
|
|
350605
|
+
homeDir: this.options.homeDir,
|
|
350606
|
+
...this.options.identity
|
|
350607
|
+
})
|
|
350608
|
+
}));
|
|
350609
|
+
} catch (error) {
|
|
350610
|
+
if (error instanceof ManagedBlunCodeModelsAuthError) return false;
|
|
350611
|
+
throw error;
|
|
350612
|
+
}
|
|
350613
|
+
const repaired = await mutateConfigFile(this.options.configPath, (config) => {
|
|
350614
|
+
if (!needsRepair(config)) return {
|
|
350615
|
+
config,
|
|
350616
|
+
result: false
|
|
350617
|
+
};
|
|
350618
|
+
const existingServices = config.services;
|
|
350619
|
+
applyManagedBlunCodeConfig(config, {
|
|
350620
|
+
models,
|
|
350621
|
+
baseUrl: runtime.baseUrl,
|
|
350622
|
+
oauthKey: runtime.oauthRef.key,
|
|
350623
|
+
oauthHost: runtime.oauthRef.oauthHost,
|
|
350624
|
+
preserveDefaultModel: true
|
|
350625
|
+
});
|
|
350626
|
+
config.services = {
|
|
350627
|
+
...config.services,
|
|
350628
|
+
...existingServices
|
|
350629
|
+
};
|
|
350630
|
+
return {
|
|
350631
|
+
config,
|
|
350632
|
+
result: true
|
|
350633
|
+
};
|
|
350634
|
+
});
|
|
350635
|
+
if (repaired) this.options.onConfigUpdated?.(readConfigFile(this.options.configPath));
|
|
350636
|
+
return repaired;
|
|
350637
|
+
}
|
|
350586
350638
|
async status(providerName) {
|
|
350587
350639
|
const auth = this.resolveManagedAuth(providerName);
|
|
350588
350640
|
const apiKey = nonEmpty(auth.apiKey);
|
|
@@ -351618,6 +351670,15 @@ function errorMessage$9(error) {
|
|
|
351618
351670
|
//#region ../../packages/node-sdk/src/sdk-rpc-client.ts
|
|
351619
351671
|
init_src();
|
|
351620
351672
|
init_src$3();
|
|
351673
|
+
function authHomeForProfile(homeDir) {
|
|
351674
|
+
const sharedHome = process.env["BLUN_SHARED_HOME"]?.trim();
|
|
351675
|
+
const profile = process.env["BLUN_PROFILE"]?.trim();
|
|
351676
|
+
if (!sharedHome || !profile || !/^[a-z0-9][a-z0-9_-]{0,31}$/u.test(profile)) return homeDir;
|
|
351677
|
+
const expected = resolve(join(sharedHome, "profile", profile));
|
|
351678
|
+
const actual = resolve(homeDir);
|
|
351679
|
+
if ((process.platform === "win32" ? expected.toLowerCase() : expected) !== (process.platform === "win32" ? actual.toLowerCase() : actual)) return homeDir;
|
|
351680
|
+
return resolve(sharedHome);
|
|
351681
|
+
}
|
|
351621
351682
|
var SDKRpcClient = class extends SDKRpcClientBase {
|
|
351622
351683
|
homeDir;
|
|
351623
351684
|
configPath;
|
|
@@ -351626,6 +351687,7 @@ var SDKRpcClient = class extends SDKRpcClientBase {
|
|
|
351626
351687
|
auth;
|
|
351627
351688
|
core;
|
|
351628
351689
|
ready;
|
|
351690
|
+
usesDefaultConfigPath;
|
|
351629
351691
|
constructor(options = {}) {
|
|
351630
351692
|
super();
|
|
351631
351693
|
this.identity = options.identity === void 0 ? void 0 : assertBlunHostIdentity(options.identity);
|
|
@@ -351634,9 +351696,10 @@ var SDKRpcClient = class extends SDKRpcClientBase {
|
|
|
351634
351696
|
homeDir: this.homeDir,
|
|
351635
351697
|
configPath: options.configPath
|
|
351636
351698
|
});
|
|
351699
|
+
this.usesDefaultConfigPath = options.configPath === void 0;
|
|
351637
351700
|
this.telemetry = options.telemetry ?? noopTelemetryClient;
|
|
351638
351701
|
this.auth = new BlunAuthFacade({
|
|
351639
|
-
homeDir: this.homeDir,
|
|
351702
|
+
homeDir: authHomeForProfile(this.homeDir),
|
|
351640
351703
|
configPath: this.configPath,
|
|
351641
351704
|
identity: this.identity,
|
|
351642
351705
|
onRefresh: options.onOAuthRefresh
|
|
@@ -351656,6 +351719,7 @@ var SDKRpcClient = class extends SDKRpcClientBase {
|
|
|
351656
351719
|
}
|
|
351657
351720
|
async ensureConfigFile() {
|
|
351658
351721
|
await ensureConfigFile(this.configPath);
|
|
351722
|
+
if (this.usesDefaultConfigPath && authHomeForProfile(this.homeDir) !== this.homeDir) await this.auth.restoreMissingProfileModel();
|
|
351659
351723
|
}
|
|
351660
351724
|
async close() {
|
|
351661
351725
|
try {
|
|
@@ -353428,8 +353492,8 @@ var require_suggestSimilar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
353428
353492
|
var require_command = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
353429
353493
|
const EventEmitter$12 = __require("node:events").EventEmitter;
|
|
353430
353494
|
const childProcess = __require("node:child_process");
|
|
353431
|
-
const path$
|
|
353432
|
-
const fs$
|
|
353495
|
+
const path$8 = __require("node:path");
|
|
353496
|
+
const fs$6 = __require("node:fs");
|
|
353433
353497
|
const process$2 = __require("node:process");
|
|
353434
353498
|
const { Argument, humanReadableArgName } = require_argument();
|
|
353435
353499
|
const { CommanderError } = require_error$2();
|
|
@@ -354312,7 +354376,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
354312
354376
|
* @param {string} subcommandName
|
|
354313
354377
|
*/
|
|
354314
354378
|
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
|
|
354315
|
-
if (fs$
|
|
354379
|
+
if (fs$6.existsSync(executableFile)) return;
|
|
354316
354380
|
const executableMissing = `'${executableFile}' does not exist
|
|
354317
354381
|
- if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
354318
354382
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
@@ -354335,10 +354399,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
354335
354399
|
".cjs"
|
|
354336
354400
|
];
|
|
354337
354401
|
function findFile(baseDir, baseName) {
|
|
354338
|
-
const localBin = path$
|
|
354339
|
-
if (fs$
|
|
354340
|
-
if (sourceExt.includes(path$
|
|
354341
|
-
const foundExt = sourceExt.find((ext) => fs$
|
|
354402
|
+
const localBin = path$8.resolve(baseDir, baseName);
|
|
354403
|
+
if (fs$6.existsSync(localBin)) return localBin;
|
|
354404
|
+
if (sourceExt.includes(path$8.extname(baseName))) return void 0;
|
|
354405
|
+
const foundExt = sourceExt.find((ext) => fs$6.existsSync(`${localBin}${ext}`));
|
|
354342
354406
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
354343
354407
|
}
|
|
354344
354408
|
this._checkForMissingMandatoryOptions();
|
|
@@ -354348,21 +354412,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
354348
354412
|
if (this._scriptPath) {
|
|
354349
354413
|
let resolvedScriptPath;
|
|
354350
354414
|
try {
|
|
354351
|
-
resolvedScriptPath = fs$
|
|
354415
|
+
resolvedScriptPath = fs$6.realpathSync(this._scriptPath);
|
|
354352
354416
|
} catch {
|
|
354353
354417
|
resolvedScriptPath = this._scriptPath;
|
|
354354
354418
|
}
|
|
354355
|
-
executableDir = path$
|
|
354419
|
+
executableDir = path$8.resolve(path$8.dirname(resolvedScriptPath), executableDir);
|
|
354356
354420
|
}
|
|
354357
354421
|
if (executableDir) {
|
|
354358
354422
|
let localFile = findFile(executableDir, executableFile);
|
|
354359
354423
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
354360
|
-
const legacyName = path$
|
|
354424
|
+
const legacyName = path$8.basename(this._scriptPath, path$8.extname(this._scriptPath));
|
|
354361
354425
|
if (legacyName !== this._name) localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
|
|
354362
354426
|
}
|
|
354363
354427
|
executableFile = localFile || executableFile;
|
|
354364
354428
|
}
|
|
354365
|
-
launchWithNode = sourceExt.includes(path$
|
|
354429
|
+
launchWithNode = sourceExt.includes(path$8.extname(executableFile));
|
|
354366
354430
|
let proc;
|
|
354367
354431
|
if (process$2.platform !== "win32") if (launchWithNode) {
|
|
354368
354432
|
args.unshift(executableFile);
|
|
@@ -355066,7 +355130,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
355066
355130
|
* @return {Command}
|
|
355067
355131
|
*/
|
|
355068
355132
|
nameFromFilename(filename) {
|
|
355069
|
-
this._name = path$
|
|
355133
|
+
this._name = path$8.basename(filename, path$8.extname(filename));
|
|
355070
355134
|
return this;
|
|
355071
355135
|
}
|
|
355072
355136
|
/**
|
|
@@ -372865,10 +372929,10 @@ var require_atomic_sleep = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
372865
372929
|
//#endregion
|
|
372866
372930
|
//#region ../../node_modules/.pnpm/sonic-boom@4.2.1/node_modules/sonic-boom/index.js
|
|
372867
372931
|
var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
372868
|
-
const fs$
|
|
372932
|
+
const fs$5 = __require("fs");
|
|
372869
372933
|
const EventEmitter$10 = __require("events");
|
|
372870
372934
|
const inherits$6 = __require("util").inherits;
|
|
372871
|
-
const path$
|
|
372935
|
+
const path$7 = __require("path");
|
|
372872
372936
|
const sleep = require_atomic_sleep();
|
|
372873
372937
|
const assert$8 = __require("assert");
|
|
372874
372938
|
const BUSY_WRITE_TIMEOUT = 100;
|
|
@@ -372908,17 +372972,17 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
372908
372972
|
const flags = sonic.append ? "a" : "w";
|
|
372909
372973
|
const mode = sonic.mode;
|
|
372910
372974
|
if (sonic.sync) try {
|
|
372911
|
-
if (sonic.mkdir) fs$
|
|
372912
|
-
fileOpened(null, fs$
|
|
372975
|
+
if (sonic.mkdir) fs$5.mkdirSync(path$7.dirname(file), { recursive: true });
|
|
372976
|
+
fileOpened(null, fs$5.openSync(file, flags, mode));
|
|
372913
372977
|
} catch (err) {
|
|
372914
372978
|
fileOpened(err);
|
|
372915
372979
|
throw err;
|
|
372916
372980
|
}
|
|
372917
|
-
else if (sonic.mkdir) fs$
|
|
372981
|
+
else if (sonic.mkdir) fs$5.mkdir(path$7.dirname(file), { recursive: true }, (err) => {
|
|
372918
372982
|
if (err) return fileOpened(err);
|
|
372919
|
-
fs$
|
|
372983
|
+
fs$5.open(file, flags, mode, fileOpened);
|
|
372920
372984
|
});
|
|
372921
|
-
else fs$
|
|
372985
|
+
else fs$5.open(file, flags, mode, fileOpened);
|
|
372922
372986
|
}
|
|
372923
372987
|
function SonicBoom(opts) {
|
|
372924
372988
|
if (!(this instanceof SonicBoom)) return new SonicBoom(opts);
|
|
@@ -372956,8 +373020,8 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
372956
373020
|
this.flush = flushBuffer;
|
|
372957
373021
|
this.flushSync = flushBufferSync;
|
|
372958
373022
|
this._actualWrite = actualWriteBuffer;
|
|
372959
|
-
fsWriteSync = () => fs$
|
|
372960
|
-
fsWrite = () => fs$
|
|
373023
|
+
fsWriteSync = () => fs$5.writeSync(this.fd, this._writingBuf);
|
|
373024
|
+
fsWrite = () => fs$5.write(this.fd, this._writingBuf, this.release);
|
|
372961
373025
|
} else if (contentMode === void 0 || contentMode === kContentModeUtf8) {
|
|
372962
373026
|
this._writingBuf = "";
|
|
372963
373027
|
this.write = write;
|
|
@@ -372965,12 +373029,12 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
372965
373029
|
this.flushSync = flushSync;
|
|
372966
373030
|
this._actualWrite = actualWrite;
|
|
372967
373031
|
fsWriteSync = () => {
|
|
372968
|
-
if (Buffer.isBuffer(this._writingBuf)) return fs$
|
|
372969
|
-
return fs$
|
|
373032
|
+
if (Buffer.isBuffer(this._writingBuf)) return fs$5.writeSync(this.fd, this._writingBuf);
|
|
373033
|
+
return fs$5.writeSync(this.fd, this._writingBuf, "utf8");
|
|
372970
373034
|
};
|
|
372971
373035
|
fsWrite = () => {
|
|
372972
|
-
if (Buffer.isBuffer(this._writingBuf)) return fs$
|
|
372973
|
-
return fs$
|
|
373036
|
+
if (Buffer.isBuffer(this._writingBuf)) return fs$5.write(this.fd, this._writingBuf, this.release);
|
|
373037
|
+
return fs$5.write(this.fd, this._writingBuf, "utf8", this.release);
|
|
372974
373038
|
};
|
|
372975
373039
|
} else throw new Error(`SonicBoom supports "${kContentModeUtf8}" and "${kContentModeBuffer}", but passed ${contentMode}`);
|
|
372976
373040
|
if (typeof fd === "number") {
|
|
@@ -373015,7 +373079,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
373015
373079
|
return;
|
|
373016
373080
|
}
|
|
373017
373081
|
}
|
|
373018
|
-
if (this._fsync) fs$
|
|
373082
|
+
if (this._fsync) fs$5.fsyncSync(this.fd);
|
|
373019
373083
|
const len = this._len;
|
|
373020
373084
|
if (this._reopening) {
|
|
373021
373085
|
this._writing = false;
|
|
@@ -373112,7 +373176,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
373112
373176
|
this._flushPending = true;
|
|
373113
373177
|
const onDrain = () => {
|
|
373114
373178
|
if (!this._fsync) try {
|
|
373115
|
-
fs$
|
|
373179
|
+
fs$5.fsync(this.fd, (err) => {
|
|
373116
373180
|
this._flushPending = false;
|
|
373117
373181
|
cb(err);
|
|
373118
373182
|
});
|
|
@@ -373189,7 +373253,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
373189
373253
|
if (this._writing) return;
|
|
373190
373254
|
const fd = this.fd;
|
|
373191
373255
|
this.once("ready", () => {
|
|
373192
|
-
if (fd !== this.fd) fs$
|
|
373256
|
+
if (fd !== this.fd) fs$5.close(fd, (err) => {
|
|
373193
373257
|
if (err) return this.emit("error", err);
|
|
373194
373258
|
});
|
|
373195
373259
|
});
|
|
@@ -373220,7 +373284,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
373220
373284
|
while (this._bufs.length || buf.length) {
|
|
373221
373285
|
if (buf.length <= 0) buf = this._bufs[0];
|
|
373222
373286
|
try {
|
|
373223
|
-
const n = Buffer.isBuffer(buf) ? fs$
|
|
373287
|
+
const n = Buffer.isBuffer(buf) ? fs$5.writeSync(this.fd, buf) : fs$5.writeSync(this.fd, buf, "utf8");
|
|
373224
373288
|
const releasedBufObj = releaseWritingBuf(buf, this._len, n);
|
|
373225
373289
|
buf = releasedBufObj.writingBuf;
|
|
373226
373290
|
this._len = releasedBufObj.len;
|
|
@@ -373231,7 +373295,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
373231
373295
|
}
|
|
373232
373296
|
}
|
|
373233
373297
|
try {
|
|
373234
|
-
fs$
|
|
373298
|
+
fs$5.fsyncSync(this.fd);
|
|
373235
373299
|
} catch {}
|
|
373236
373300
|
}
|
|
373237
373301
|
function flushBufferSync() {
|
|
@@ -373245,7 +373309,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
373245
373309
|
while (this._bufs.length || buf.length) {
|
|
373246
373310
|
if (buf.length <= 0) buf = mergeBuf(this._bufs[0], this._lens[0]);
|
|
373247
373311
|
try {
|
|
373248
|
-
const n = fs$
|
|
373312
|
+
const n = fs$5.writeSync(this.fd, buf);
|
|
373249
373313
|
buf = buf.subarray(n);
|
|
373250
373314
|
this._len = Math.max(this._len - n, 0);
|
|
373251
373315
|
if (buf.length <= 0) {
|
|
@@ -373267,24 +373331,24 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
373267
373331
|
this._writing = true;
|
|
373268
373332
|
this._writingBuf = this._writingBuf.length ? this._writingBuf : this._bufs.shift() || "";
|
|
373269
373333
|
if (this.sync) try {
|
|
373270
|
-
release(null, Buffer.isBuffer(this._writingBuf) ? fs$
|
|
373334
|
+
release(null, Buffer.isBuffer(this._writingBuf) ? fs$5.writeSync(this.fd, this._writingBuf) : fs$5.writeSync(this.fd, this._writingBuf, "utf8"));
|
|
373271
373335
|
} catch (err) {
|
|
373272
373336
|
release(err);
|
|
373273
373337
|
}
|
|
373274
|
-
else fs$
|
|
373338
|
+
else fs$5.write(this.fd, this._writingBuf, release);
|
|
373275
373339
|
}
|
|
373276
373340
|
function actualWriteBuffer() {
|
|
373277
373341
|
const release = this.release;
|
|
373278
373342
|
this._writing = true;
|
|
373279
373343
|
this._writingBuf = this._writingBuf.length ? this._writingBuf : mergeBuf(this._bufs.shift(), this._lens.shift());
|
|
373280
373344
|
if (this.sync) try {
|
|
373281
|
-
release(null, fs$
|
|
373345
|
+
release(null, fs$5.writeSync(this.fd, this._writingBuf));
|
|
373282
373346
|
} catch (err) {
|
|
373283
373347
|
release(err);
|
|
373284
373348
|
}
|
|
373285
373349
|
else {
|
|
373286
373350
|
if (kCopyBuffer) this._writingBuf = Buffer.from(this._writingBuf);
|
|
373287
|
-
fs$
|
|
373351
|
+
fs$5.write(this.fd, this._writingBuf, release);
|
|
373288
373352
|
}
|
|
373289
373353
|
}
|
|
373290
373354
|
function actualClose(sonic) {
|
|
@@ -373298,10 +373362,10 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
373298
373362
|
sonic._lens = [];
|
|
373299
373363
|
assert$8(typeof sonic.fd === "number", `sonic.fd must be a number, got ${typeof sonic.fd}`);
|
|
373300
373364
|
try {
|
|
373301
|
-
fs$
|
|
373365
|
+
fs$5.fsync(sonic.fd, closeWrapped);
|
|
373302
373366
|
} catch {}
|
|
373303
373367
|
function closeWrapped() {
|
|
373304
|
-
if (sonic.fd !== 1 && sonic.fd !== 2) fs$
|
|
373368
|
+
if (sonic.fd !== 1 && sonic.fd !== 2) fs$5.close(sonic.fd, done);
|
|
373305
373369
|
else done();
|
|
373306
373370
|
}
|
|
373307
373371
|
function done(err) {
|
|
@@ -395924,8 +395988,8 @@ var require_constants$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
395924
395988
|
//#endregion
|
|
395925
395989
|
//#region ../../../../../node_modules/node-gyp-build/node-gyp-build.js
|
|
395926
395990
|
var require_node_gyp_build$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
395927
|
-
var fs$
|
|
395928
|
-
var path$
|
|
395991
|
+
var fs$4 = __require("fs");
|
|
395992
|
+
var path$6 = __require("path");
|
|
395929
395993
|
var os$4 = __require("os");
|
|
395930
395994
|
var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
|
|
395931
395995
|
var vars = process.config && process.config.variables || {};
|
|
@@ -395942,20 +396006,20 @@ var require_node_gyp_build$1 = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
395942
396006
|
return runtimeRequire(load.resolve(dir));
|
|
395943
396007
|
}
|
|
395944
396008
|
load.resolve = load.path = function(dir) {
|
|
395945
|
-
dir = path$
|
|
396009
|
+
dir = path$6.resolve(dir || ".");
|
|
395946
396010
|
try {
|
|
395947
|
-
var name = runtimeRequire(path$
|
|
396011
|
+
var name = runtimeRequire(path$6.join(dir, "package.json")).name.toUpperCase().replace(/-/g, "_");
|
|
395948
396012
|
if (process.env[name + "_PREBUILD"]) dir = process.env[name + "_PREBUILD"];
|
|
395949
396013
|
} catch (err) {}
|
|
395950
396014
|
if (!prebuildsOnly) {
|
|
395951
|
-
var release = getFirst(path$
|
|
396015
|
+
var release = getFirst(path$6.join(dir, "build/Release"), matchBuild);
|
|
395952
396016
|
if (release) return release;
|
|
395953
|
-
var debug = getFirst(path$
|
|
396017
|
+
var debug = getFirst(path$6.join(dir, "build/Debug"), matchBuild);
|
|
395954
396018
|
if (debug) return debug;
|
|
395955
396019
|
}
|
|
395956
396020
|
var prebuild = resolve(dir);
|
|
395957
396021
|
if (prebuild) return prebuild;
|
|
395958
|
-
var nearby = resolve(path$
|
|
396022
|
+
var nearby = resolve(path$6.dirname(process.execPath));
|
|
395959
396023
|
if (nearby) return nearby;
|
|
395960
396024
|
var target = [
|
|
395961
396025
|
"platform=" + platform,
|
|
@@ -395971,23 +396035,23 @@ var require_node_gyp_build$1 = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
395971
396035
|
].filter(Boolean).join(" ");
|
|
395972
396036
|
throw new Error("No native build was found for " + target + "\n loaded from: " + dir + "\n");
|
|
395973
396037
|
function resolve(dir) {
|
|
395974
|
-
var tuple = readdirSync(path$
|
|
396038
|
+
var tuple = readdirSync(path$6.join(dir, "prebuilds")).map(parseTuple).filter(matchTuple(platform, arch)).sort(compareTuples)[0];
|
|
395975
396039
|
if (!tuple) return;
|
|
395976
|
-
var prebuilds = path$
|
|
396040
|
+
var prebuilds = path$6.join(dir, "prebuilds", tuple.name);
|
|
395977
396041
|
var winner = readdirSync(prebuilds).map(parseTags).filter(matchTags(runtime, abi)).sort(compareTags(runtime))[0];
|
|
395978
|
-
if (winner) return path$
|
|
396042
|
+
if (winner) return path$6.join(prebuilds, winner.file);
|
|
395979
396043
|
}
|
|
395980
396044
|
};
|
|
395981
396045
|
function readdirSync(dir) {
|
|
395982
396046
|
try {
|
|
395983
|
-
return fs$
|
|
396047
|
+
return fs$4.readdirSync(dir);
|
|
395984
396048
|
} catch (err) {
|
|
395985
396049
|
return [];
|
|
395986
396050
|
}
|
|
395987
396051
|
}
|
|
395988
396052
|
function getFirst(dir, filter) {
|
|
395989
396053
|
var files = readdirSync(dir).filter(filter);
|
|
395990
|
-
return files[0] && path$
|
|
396054
|
+
return files[0] && path$6.join(dir, files[0]);
|
|
395991
396055
|
}
|
|
395992
396056
|
function matchBuild(name) {
|
|
395993
396057
|
return /\.node$/.test(name);
|
|
@@ -396068,7 +396132,7 @@ var require_node_gyp_build$1 = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
396068
396132
|
return typeof window !== "undefined" && window.process && window.process.type === "renderer";
|
|
396069
396133
|
}
|
|
396070
396134
|
function isAlpine(platform) {
|
|
396071
|
-
return platform === "linux" && fs$
|
|
396135
|
+
return platform === "linux" && fs$4.existsSync("/etc/alpine-release");
|
|
396072
396136
|
}
|
|
396073
396137
|
load.parseTags = parseTags;
|
|
396074
396138
|
load.matchTags = matchTags;
|
|
@@ -403184,7 +403248,7 @@ var import_multipart = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((
|
|
|
403184
403248
|
const fp = require_plugin();
|
|
403185
403249
|
const { createWriteStream: createWriteStream$1 } = __require("node:fs");
|
|
403186
403250
|
const { unlink: unlink$1 } = __require("node:fs/promises");
|
|
403187
|
-
const path$
|
|
403251
|
+
const path$5 = __require("node:path");
|
|
403188
403252
|
const { generateId } = require_generateId();
|
|
403189
403253
|
const createError = require_error$1();
|
|
403190
403254
|
const streamToNull = require_stream_consumer();
|
|
@@ -403479,7 +403543,7 @@ var import_multipart = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((
|
|
|
403479
403543
|
for await (const part of parts) {
|
|
403480
403544
|
values = part.fields;
|
|
403481
403545
|
if (!part.file) continue;
|
|
403482
|
-
const filepath = path$
|
|
403546
|
+
const filepath = path$5.join(tmpdir, generateId() + path$5.extname(part.filename || "file" + i++));
|
|
403483
403547
|
const target = createWriteStream$1(filepath);
|
|
403484
403548
|
try {
|
|
403485
403549
|
this.tmpUploads.push(filepath);
|
|
@@ -416220,8 +416284,8 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
416220
416284
|
//#endregion
|
|
416221
416285
|
//#region ../../node_modules/.pnpm/@fastify+swagger@9.7.0/node_modules/@fastify/swagger/lib/mode/static.js
|
|
416222
416286
|
var require_static = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
416223
|
-
const path$
|
|
416224
|
-
const fs$
|
|
416287
|
+
const path$4 = __require("node:path");
|
|
416288
|
+
const fs$3 = __require("node:fs");
|
|
416225
416289
|
const yaml = require_dist$1();
|
|
416226
416290
|
module.exports = function(fastify, opts, done) {
|
|
416227
416291
|
if (!opts.specification) return done(/* @__PURE__ */ new Error("specification is missing in the module options"));
|
|
@@ -416230,14 +416294,14 @@ var require_static = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
416230
416294
|
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"));
|
|
416231
416295
|
else if (opts.specification.path) {
|
|
416232
416296
|
if (typeof opts.specification.path !== "string") return done(/* @__PURE__ */ new Error("specification.path is not a string"));
|
|
416233
|
-
if (!fs$
|
|
416234
|
-
const extName = path$
|
|
416297
|
+
if (!fs$3.existsSync(path$4.resolve(opts.specification.path))) return done(/* @__PURE__ */ new Error(`${opts.specification.path} does not exist`));
|
|
416298
|
+
const extName = path$4.extname(opts.specification.path).toLowerCase();
|
|
416235
416299
|
if ([".yaml", ".json"].indexOf(extName) === -1) return done(/* @__PURE__ */ new Error("specification.path extension name is not supported, should be one from ['.yaml', '.json']"));
|
|
416236
416300
|
if (opts.specification.postProcessor && typeof opts.specification.postProcessor !== "function") return done(/* @__PURE__ */ new Error("specification.postProcessor should be a function"));
|
|
416237
416301
|
if (opts.specification.baseDir && typeof opts.specification.baseDir !== "string") return done(/* @__PURE__ */ new Error("specification.baseDir should be string"));
|
|
416238
|
-
if (!opts.specification.baseDir) opts.specification.baseDir = path$
|
|
416302
|
+
if (!opts.specification.baseDir) opts.specification.baseDir = path$4.resolve(path$4.dirname(opts.specification.path));
|
|
416239
416303
|
else while (opts.specification.baseDir.endsWith("/")) opts.specification.baseDir = opts.specification.baseDir.slice(0, -1);
|
|
416240
|
-
const source = fs$
|
|
416304
|
+
const source = fs$3.readFileSync(path$4.resolve(opts.specification.path), "utf8");
|
|
416241
416305
|
switch (extName) {
|
|
416242
416306
|
case ".yaml":
|
|
416243
416307
|
swaggerObject = yaml.parse(source);
|
|
@@ -416504,11 +416568,11 @@ var require_should_route_hide = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
416504
416568
|
//#endregion
|
|
416505
416569
|
//#region ../../node_modules/.pnpm/@fastify+swagger@9.7.0/node_modules/@fastify/swagger/lib/util/read-package-json.js
|
|
416506
416570
|
var require_read_package_json = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
416507
|
-
const fs$
|
|
416508
|
-
const path$
|
|
416571
|
+
const fs$2 = __require("node:fs");
|
|
416572
|
+
const path$3 = __require("node:path");
|
|
416509
416573
|
function readPackageJson() {
|
|
416510
416574
|
try {
|
|
416511
|
-
return JSON.parse(fs$
|
|
416575
|
+
return JSON.parse(fs$2.readFileSync(path$3.join(__dirname, "..", "..", "package.json")));
|
|
416512
416576
|
} catch {
|
|
416513
416577
|
return {};
|
|
416514
416578
|
}
|
|
@@ -432499,9 +432563,9 @@ var TUI = class TUI extends Container {
|
|
|
432499
432563
|
const debugRedraw = process.env["PI_DEBUG_REDRAW"] === "1";
|
|
432500
432564
|
const logRedraw = (reason) => {
|
|
432501
432565
|
if (!debugRedraw) return;
|
|
432502
|
-
const logPath = path$
|
|
432566
|
+
const logPath = path$18.join(nodeOs.homedir(), ".pi", "agent", "pi-debug.log");
|
|
432503
432567
|
const msg = `[${(/* @__PURE__ */ new Date()).toISOString()}] fullRender: ${reason} (prev=${this.previousLines.length}, new=${newLines.length}, height=${height})\n`;
|
|
432504
|
-
fs$
|
|
432568
|
+
fs$18.appendFileSync(logPath, msg);
|
|
432505
432569
|
};
|
|
432506
432570
|
if (this.previousLines.length === 0 && !widthChanged && !heightChanged) {
|
|
432507
432571
|
logRedraw("first render");
|
|
@@ -432648,8 +432712,8 @@ var TUI = class TUI extends Container {
|
|
|
432648
432712
|
buffer += "\x1B[?2026l";
|
|
432649
432713
|
if (process.env["PI_TUI_DEBUG"] === "1") {
|
|
432650
432714
|
const debugDir = "/tmp/tui";
|
|
432651
|
-
fs$
|
|
432652
|
-
const debugPath = path$
|
|
432715
|
+
fs$18.mkdirSync(debugDir, { recursive: true });
|
|
432716
|
+
const debugPath = path$18.join(debugDir, `render-${Date.now()}-${Math.random().toString(36).slice(2)}.log`);
|
|
432653
432717
|
const debugData = [
|
|
432654
432718
|
`firstChanged: ${firstChanged}`,
|
|
432655
432719
|
`viewportTop: ${viewportTop}`,
|
|
@@ -432672,7 +432736,7 @@ var TUI = class TUI extends Container {
|
|
|
432672
432736
|
"=== buffer ===",
|
|
432673
432737
|
JSON.stringify(buffer)
|
|
432674
432738
|
].join("\n");
|
|
432675
|
-
fs$
|
|
432739
|
+
fs$18.writeFileSync(debugPath, debugData);
|
|
432676
432740
|
}
|
|
432677
432741
|
this.terminal.write(buffer);
|
|
432678
432742
|
this.cursorRow = Math.max(0, newLines.length - 1);
|
|
@@ -437258,12 +437322,12 @@ function loadNativeModifiersHelper() {
|
|
|
437258
437322
|
if (process.platform !== "darwin") return void 0;
|
|
437259
437323
|
const arch = process.arch;
|
|
437260
437324
|
if (arch !== "x64" && arch !== "arm64") return void 0;
|
|
437261
|
-
const moduleDir = path$
|
|
437262
|
-
const nativePath = path$
|
|
437325
|
+
const moduleDir = path$18.dirname(fileURLToPath(import.meta.url));
|
|
437326
|
+
const nativePath = path$18.join("native", "darwin", "prebuilds", `darwin-${arch}`, "darwin-modifiers.node");
|
|
437263
437327
|
const candidates = [
|
|
437264
|
-
path$
|
|
437265
|
-
path$
|
|
437266
|
-
path$
|
|
437328
|
+
path$18.join(moduleDir, "..", nativePath),
|
|
437329
|
+
path$18.join(moduleDir, nativePath),
|
|
437330
|
+
path$18.join(path$18.dirname(process.execPath), nativePath)
|
|
437267
437331
|
];
|
|
437268
437332
|
for (const modulePath of candidates) try {
|
|
437269
437333
|
const helper = cjsRequire$1(modulePath);
|
|
@@ -437336,10 +437400,10 @@ var ProcessTerminal = class {
|
|
|
437336
437400
|
const env = process.env["PI_TUI_WRITE_LOG"] || "";
|
|
437337
437401
|
if (!env) return "";
|
|
437338
437402
|
try {
|
|
437339
|
-
if (fs$
|
|
437403
|
+
if (fs$18.statSync(env).isDirectory()) {
|
|
437340
437404
|
const now = /* @__PURE__ */ new Date();
|
|
437341
437405
|
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")}`;
|
|
437342
|
-
return path$
|
|
437406
|
+
return path$18.join(env, `tui-${ts}-${process.pid}.log`);
|
|
437343
437407
|
}
|
|
437344
437408
|
} catch {}
|
|
437345
437409
|
return env;
|
|
@@ -437542,12 +437606,12 @@ var ProcessTerminal = class {
|
|
|
437542
437606
|
try {
|
|
437543
437607
|
const arch = process.arch;
|
|
437544
437608
|
if (arch !== "x64" && arch !== "arm64") return;
|
|
437545
|
-
const moduleDir = path$
|
|
437546
|
-
const nativePath = path$
|
|
437609
|
+
const moduleDir = path$18.dirname(fileURLToPath(import.meta.url));
|
|
437610
|
+
const nativePath = path$18.join("native", "win32", "prebuilds", `win32-${arch}`, "win32-console-mode.node");
|
|
437547
437611
|
const candidates = [
|
|
437548
|
-
path$
|
|
437549
|
-
path$
|
|
437550
|
-
path$
|
|
437612
|
+
path$18.join(moduleDir, "..", nativePath),
|
|
437613
|
+
path$18.join(moduleDir, nativePath),
|
|
437614
|
+
path$18.join(path$18.dirname(process.execPath), nativePath)
|
|
437551
437615
|
];
|
|
437552
437616
|
for (const modulePath of candidates) try {
|
|
437553
437617
|
cjsRequire(modulePath).enableVirtualTerminalInput?.();
|
|
@@ -437619,7 +437683,7 @@ var ProcessTerminal = class {
|
|
|
437619
437683
|
write(data) {
|
|
437620
437684
|
process.stdout.write(data);
|
|
437621
437685
|
if (this.writeLogPath) try {
|
|
437622
|
-
fs$
|
|
437686
|
+
fs$18.appendFileSync(this.writeLogPath, data, { encoding: "utf8" });
|
|
437623
437687
|
} catch {}
|
|
437624
437688
|
}
|
|
437625
437689
|
get columns() {
|
|
@@ -499461,6 +499525,7 @@ var CustomEditor = class extends Editor {
|
|
|
499461
499525
|
onToggleToolExpand;
|
|
499462
499526
|
onOpenExternalEditor;
|
|
499463
499527
|
onOpenSessionPicker;
|
|
499528
|
+
onOpenEffortPicker;
|
|
499464
499529
|
onCtrlS;
|
|
499465
499530
|
/** Return `true` to consume Ctrl+B; return `false`/`undefined` to fall through to the editor default (cursor-left). */
|
|
499466
499531
|
onCtrlB;
|
|
@@ -499649,6 +499714,10 @@ var CustomEditor = class extends Editor {
|
|
|
499649
499714
|
this.onOpenSessionPicker?.();
|
|
499650
499715
|
return;
|
|
499651
499716
|
}
|
|
499717
|
+
if (matchesKey(normalized, Key.ctrl("l"))) {
|
|
499718
|
+
this.onOpenEffortPicker?.();
|
|
499719
|
+
return;
|
|
499720
|
+
}
|
|
499652
499721
|
if (matchesKey(normalized, Key.ctrl("g"))) {
|
|
499653
499722
|
this.onOpenExternalEditor?.();
|
|
499654
499723
|
return;
|
|
@@ -505091,6 +505160,134 @@ registerUiCatalogFragment({
|
|
|
505091
505160
|
//#region src/tui/constant/telegram-session-queue.ts
|
|
505092
505161
|
const SESSION_QUEUE_READ_BYTES = 65536;
|
|
505093
505162
|
//#endregion
|
|
505163
|
+
//#region src/tui/constant/channel-command.ts
|
|
505164
|
+
const REMOTE_COMMANDS = new Set([
|
|
505165
|
+
"loop",
|
|
505166
|
+
"goal",
|
|
505167
|
+
"idea",
|
|
505168
|
+
"chancenradar",
|
|
505169
|
+
"curiosity",
|
|
505170
|
+
"scout",
|
|
505171
|
+
"reload",
|
|
505172
|
+
"memory",
|
|
505173
|
+
"queue",
|
|
505174
|
+
"usage",
|
|
505175
|
+
"befehle"
|
|
505176
|
+
]);
|
|
505177
|
+
const REMOTE_COMMAND_LIST = "/loop [interval] [prompt]\n/loop status|pause|resume|stop\n/goal\n/idea\n/chancenradar\n/curiosity\n/scout\n/reload\n/memory status|on|off\n/queue [steer|followup|collect|interrupt|reset|default] [debounce:500ms] [batch:20]\n/usage off|tokens|full|reset\n/befehle";
|
|
505178
|
+
//#endregion
|
|
505179
|
+
//#region src/tui/controllers/channel-command.ts
|
|
505180
|
+
function channelSlashCommandCandidate(envelope) {
|
|
505181
|
+
if (!channelMessageAddressed(envelope) || envelope.meta["addressed"]?.trim().toLowerCase() === "semantic") return false;
|
|
505182
|
+
return parseSlashInput(envelope.text.trim()) !== null;
|
|
505183
|
+
}
|
|
505184
|
+
function channelCommandInput(envelope) {
|
|
505185
|
+
if (!channelMessageAddressed(envelope) || envelope.meta["addressed"]?.trim().toLowerCase() === "semantic") return void 0;
|
|
505186
|
+
const parsed = parseSlashInput(envelope.text.trim());
|
|
505187
|
+
if (parsed === null) return void 0;
|
|
505188
|
+
const name = parsed.name.toLowerCase().split("@")[0];
|
|
505189
|
+
if (!REMOTE_COMMANDS.has(name)) return void 0;
|
|
505190
|
+
if (name === "usage" && !isUsageDisplayArgument(parsed.args)) return void 0;
|
|
505191
|
+
return parsed.args.length === 0 ? `/${name}` : `/${name} ${parsed.args}`;
|
|
505192
|
+
}
|
|
505193
|
+
function channelCommandCanInterrupt(input) {
|
|
505194
|
+
const parsed = parseSlashInput(input);
|
|
505195
|
+
if (parsed?.name === "befehle") return true;
|
|
505196
|
+
if (parsed === null) return false;
|
|
505197
|
+
if (parsed.name === "usage") return isUsageDisplayArgument(parsed.args);
|
|
505198
|
+
if ([
|
|
505199
|
+
"goal",
|
|
505200
|
+
"idea",
|
|
505201
|
+
"chancenradar",
|
|
505202
|
+
"curiosity",
|
|
505203
|
+
"scout"
|
|
505204
|
+
].includes(parsed.name)) {
|
|
505205
|
+
if (!/^(?:status|pause|paused|cancel|clear|stop)?$/i.test(parsed.args.trim())) return false;
|
|
505206
|
+
} else if (parsed.name !== "loop" && parsed.name !== "queue") return false;
|
|
505207
|
+
const command = findBuiltInSlashCommand(parsed.name);
|
|
505208
|
+
return command !== void 0 && resolveSlashCommandAvailability(command, parsed.args) === "always";
|
|
505209
|
+
}
|
|
505210
|
+
/** Capture only this command's output, never another room's concurrent turn. */
|
|
505211
|
+
var ChannelCommandController = class {
|
|
505212
|
+
host;
|
|
505213
|
+
execution = new AsyncLocalStorage();
|
|
505214
|
+
constructor(host) {
|
|
505215
|
+
this.host = host;
|
|
505216
|
+
}
|
|
505217
|
+
get context() {
|
|
505218
|
+
const execution = this.execution.getStore();
|
|
505219
|
+
return execution?.active ? {
|
|
505220
|
+
input: execution.input,
|
|
505221
|
+
chatId: execution.envelope.meta.chat_id,
|
|
505222
|
+
...execution.envelope.meta.message_thread_id === void 0 ? {} : { threadId: execution.envelope.meta.message_thread_id }
|
|
505223
|
+
} : void 0;
|
|
505224
|
+
}
|
|
505225
|
+
commit() {
|
|
505226
|
+
const execution = this.execution.getStore();
|
|
505227
|
+
if (execution?.active) this.acknowledge(execution);
|
|
505228
|
+
}
|
|
505229
|
+
bindGoal(goalId) {
|
|
505230
|
+
const execution = this.execution.getStore();
|
|
505231
|
+
if (!execution?.active) return false;
|
|
505232
|
+
execution.goalId = goalId;
|
|
505233
|
+
return true;
|
|
505234
|
+
}
|
|
505235
|
+
acknowledge(execution) {
|
|
505236
|
+
if (execution.acknowledged) return;
|
|
505237
|
+
execution.acknowledged = true;
|
|
505238
|
+
execution.acknowledge?.();
|
|
505239
|
+
}
|
|
505240
|
+
captureStatus(message) {
|
|
505241
|
+
const execution = this.execution.getStore();
|
|
505242
|
+
if (execution?.active) execution.responses.push(message);
|
|
505243
|
+
}
|
|
505244
|
+
capturePrompt(text) {
|
|
505245
|
+
const execution = this.execution.getStore();
|
|
505246
|
+
if (!execution?.active) return false;
|
|
505247
|
+
this.host.sendPrompt(execution.envelope, text, () => {
|
|
505248
|
+
this.acknowledge(execution);
|
|
505249
|
+
}, execution.goalId);
|
|
505250
|
+
execution.sentModelTurn = true;
|
|
505251
|
+
return true;
|
|
505252
|
+
}
|
|
505253
|
+
async run(envelope, input, acknowledge) {
|
|
505254
|
+
const execution = {
|
|
505255
|
+
input,
|
|
505256
|
+
envelope,
|
|
505257
|
+
acknowledge,
|
|
505258
|
+
responses: [],
|
|
505259
|
+
active: true,
|
|
505260
|
+
sentModelTurn: false,
|
|
505261
|
+
acknowledged: false
|
|
505262
|
+
};
|
|
505263
|
+
await this.execution.run(execution, async () => {
|
|
505264
|
+
try {
|
|
505265
|
+
if (parseSlashInput(input)?.name === "befehle") this.host.showStatus(REMOTE_COMMAND_LIST);
|
|
505266
|
+
else await this.host.dispatch(input);
|
|
505267
|
+
} catch (error) {
|
|
505268
|
+
this.host.showError(formatErrorMessage$2(error));
|
|
505269
|
+
} finally {
|
|
505270
|
+
execution.active = false;
|
|
505271
|
+
}
|
|
505272
|
+
if (execution.sentModelTurn) return;
|
|
505273
|
+
this.acknowledge(execution);
|
|
505274
|
+
const text = execution.responses.at(-1) ?? input;
|
|
505275
|
+
if (envelope.meta.message_thread_id === void 0) await this.host.reply(envelope.meta.chat_id, text);
|
|
505276
|
+
else await this.host.reply(envelope.meta.chat_id, text, envelope.meta.message_thread_id);
|
|
505277
|
+
});
|
|
505278
|
+
}
|
|
505279
|
+
async rejectBusy(envelope, acknowledge) {
|
|
505280
|
+
await this.reject(envelope, "Befehl nicht ausgeführt: Die Konsole ist beschäftigt oder hat keine aktive Sitzung. Bitte erneut senden.", acknowledge);
|
|
505281
|
+
}
|
|
505282
|
+
async rejectUnsupported(envelope, acknowledge) {
|
|
505283
|
+
await this.reject(envelope, "Dieser Befehl ist über Telegram nicht freigegeben. Mit /befehle siehst du die verfügbaren Fernbefehle.", acknowledge);
|
|
505284
|
+
}
|
|
505285
|
+
async reject(envelope, message, acknowledge) {
|
|
505286
|
+
acknowledge?.();
|
|
505287
|
+
await this.host.reply(envelope.meta.chat_id, message, envelope.meta.message_thread_id);
|
|
505288
|
+
}
|
|
505289
|
+
};
|
|
505290
|
+
//#endregion
|
|
505094
505291
|
//#region src/tui/controllers/telegram-session-queue.ts
|
|
505095
505292
|
function requireValid(condition) {
|
|
505096
505293
|
if (!condition) throw new Error("Invalid Telegram session queue state or transition");
|
|
@@ -505341,6 +505538,8 @@ var SessionQueueDelivery = class {
|
|
|
505341
505538
|
host;
|
|
505342
505539
|
boundSessionId;
|
|
505343
505540
|
inFlight = /* @__PURE__ */ new Set();
|
|
505541
|
+
commandsInFlight = /* @__PURE__ */ new Set();
|
|
505542
|
+
priorityScanEnd = 0;
|
|
505344
505543
|
queueFile;
|
|
505345
505544
|
stateFile;
|
|
505346
505545
|
constructor(dir, host) {
|
|
@@ -505376,28 +505575,59 @@ var SessionQueueDelivery = class {
|
|
|
505376
505575
|
if (state === void 0) throw new Error("Telegram session queue checkpoint is missing");
|
|
505377
505576
|
state = observeSessionQueue(state, position);
|
|
505378
505577
|
if (JSON.stringify(state) !== before) writeSessionQueue(this.stateFile, state);
|
|
505379
|
-
if (rebind)
|
|
505578
|
+
if (rebind) {
|
|
505579
|
+
this.inFlight.clear();
|
|
505580
|
+
this.commandsInFlight.clear();
|
|
505581
|
+
this.priorityScanEnd = 0;
|
|
505582
|
+
}
|
|
505380
505583
|
this.boundSessionId = scope.sessionId;
|
|
505381
505584
|
if (!deliver) return;
|
|
505382
|
-
|
|
505383
|
-
|
|
505384
|
-
|
|
505385
|
-
|
|
505386
|
-
|
|
505387
|
-
|
|
505388
|
-
|
|
505389
|
-
if (
|
|
505390
|
-
const
|
|
505391
|
-
|
|
505392
|
-
|
|
505393
|
-
|
|
505394
|
-
|
|
505395
|
-
|
|
505396
|
-
|
|
505397
|
-
|
|
505398
|
-
|
|
505399
|
-
|
|
505400
|
-
|
|
505585
|
+
const ranges = pendingSessionQueue(state, scope.sessionId);
|
|
505586
|
+
for (const commandsOnly of [true, false]) {
|
|
505587
|
+
if (!commandsOnly && this.inFlight.size >= 16) return;
|
|
505588
|
+
let delivered = 0;
|
|
505589
|
+
let limitReached = false;
|
|
505590
|
+
for (const pending of ranges) {
|
|
505591
|
+
const start = commandsOnly ? Math.max(pending.start, this.priorityScanEnd) : pending.start;
|
|
505592
|
+
if (start >= pending.end) continue;
|
|
505593
|
+
for (const line of readLines(this.queueFile, {
|
|
505594
|
+
...pending,
|
|
505595
|
+
start
|
|
505596
|
+
})) {
|
|
505597
|
+
if (!this.host.ownsChannel() || this.host.currentSessionId() !== scope.sessionId) return;
|
|
505598
|
+
if (commandsOnly) this.priorityScanEnd = line.range.end;
|
|
505599
|
+
const key = `${line.range.fileId}:${line.range.start}:${line.range.end}`;
|
|
505600
|
+
if (this.inFlight.has(key)) continue;
|
|
505601
|
+
const envelope = parseChannelEnvelope(line.text);
|
|
505602
|
+
const isCommand = envelope !== void 0 && channelSlashCommandCandidate(envelope);
|
|
505603
|
+
if (isCommand !== commandsOnly) continue;
|
|
505604
|
+
if (commandsOnly && this.commandsInFlight.size >= 16) {
|
|
505605
|
+
this.priorityScanEnd = line.range.start;
|
|
505606
|
+
limitReached = true;
|
|
505607
|
+
break;
|
|
505608
|
+
}
|
|
505609
|
+
if (!commandsOnly && this.inFlight.size >= 16) return;
|
|
505610
|
+
const acknowledge = () => {
|
|
505611
|
+
if (!this.host.ownsChannel()) return;
|
|
505612
|
+
const current = readSessionQueue(this.stateFile);
|
|
505613
|
+
if (current === void 0) throw new Error("Telegram session queue checkpoint is missing");
|
|
505614
|
+
writeSessionQueue(this.stateFile, acknowledgeSessionQueue(current, scope.sessionId, line.range));
|
|
505615
|
+
this.inFlight.delete(key);
|
|
505616
|
+
this.commandsInFlight.delete(key);
|
|
505617
|
+
};
|
|
505618
|
+
this.inFlight.add(key);
|
|
505619
|
+
if (isCommand) this.commandsInFlight.add(key);
|
|
505620
|
+
if (envelope === void 0) acknowledge();
|
|
505621
|
+
else this.host.inject(envelope, acknowledge);
|
|
505622
|
+
delivered += 1;
|
|
505623
|
+
if (delivered >= 16) {
|
|
505624
|
+
limitReached = true;
|
|
505625
|
+
break;
|
|
505626
|
+
}
|
|
505627
|
+
}
|
|
505628
|
+
if (limitReached) break;
|
|
505629
|
+
}
|
|
505630
|
+
if (commandsOnly && !limitReached) this.priorityScanEnd = position.frontier;
|
|
505401
505631
|
}
|
|
505402
505632
|
}
|
|
505403
505633
|
};
|
|
@@ -527952,6 +528182,9 @@ var AuthFlowController = class {
|
|
|
527952
528182
|
enterLoginRequiredStartupState() {
|
|
527953
528183
|
this.enterSessionlessStartupState(oauthLoginRequiredStartupNotice());
|
|
527954
528184
|
}
|
|
528185
|
+
enterMissingModelStartupState() {
|
|
528186
|
+
this.enterSessionlessStartupState(uiText("core.error.llmNotSet"));
|
|
528187
|
+
}
|
|
527955
528188
|
enterManagedAccountUnavailableStartupState(kind) {
|
|
527956
528189
|
this.enterSessionlessStartupState(uiText(kind === "invalid_payload" ? "usage.plan.error.invalidPayload" : "usage.plan.error.unavailable"));
|
|
527957
528190
|
}
|
|
@@ -529443,120 +529676,6 @@ function planQueueCollection(messages, policy, now, activeContext) {
|
|
|
529443
529676
|
};
|
|
529444
529677
|
}
|
|
529445
529678
|
//#endregion
|
|
529446
|
-
//#region src/tui/constant/channel-command.ts
|
|
529447
|
-
const REMOTE_COMMANDS = new Set([
|
|
529448
|
-
"loop",
|
|
529449
|
-
"goal",
|
|
529450
|
-
"idea",
|
|
529451
|
-
"chancenradar",
|
|
529452
|
-
"curiosity",
|
|
529453
|
-
"scout",
|
|
529454
|
-
"reload",
|
|
529455
|
-
"memory",
|
|
529456
|
-
"queue",
|
|
529457
|
-
"usage",
|
|
529458
|
-
"befehle"
|
|
529459
|
-
]);
|
|
529460
|
-
const REMOTE_COMMAND_LIST = "/loop [interval] [prompt]\n/loop status|pause|resume|stop\n/goal\n/idea\n/chancenradar\n/curiosity\n/scout\n/reload\n/memory status|on|off\n/queue [steer|followup|collect|interrupt|reset|default] [debounce:500ms] [batch:20]\n/usage off|tokens|full|reset\n/befehle";
|
|
529461
|
-
//#endregion
|
|
529462
|
-
//#region src/tui/controllers/channel-command.ts
|
|
529463
|
-
function channelCommandInput(envelope) {
|
|
529464
|
-
if (!channelMessageAddressed(envelope) || envelope.meta["addressed"]?.trim().toLowerCase() === "semantic") return void 0;
|
|
529465
|
-
const parsed = parseSlashInput(envelope.text.trim());
|
|
529466
|
-
if (parsed === null) return void 0;
|
|
529467
|
-
const name = parsed.name.toLowerCase().split("@")[0];
|
|
529468
|
-
if (!REMOTE_COMMANDS.has(name)) return void 0;
|
|
529469
|
-
if (name === "usage" && !isUsageDisplayArgument(parsed.args)) return void 0;
|
|
529470
|
-
return parsed.args.length === 0 ? `/${name}` : `/${name} ${parsed.args}`;
|
|
529471
|
-
}
|
|
529472
|
-
function channelCommandCanInterrupt(input) {
|
|
529473
|
-
const parsed = parseSlashInput(input);
|
|
529474
|
-
if (parsed?.name === "befehle") return true;
|
|
529475
|
-
if (parsed === null) return false;
|
|
529476
|
-
if (parsed.name === "usage") return isUsageDisplayArgument(parsed.args);
|
|
529477
|
-
if ([
|
|
529478
|
-
"goal",
|
|
529479
|
-
"idea",
|
|
529480
|
-
"chancenradar",
|
|
529481
|
-
"curiosity",
|
|
529482
|
-
"scout"
|
|
529483
|
-
].includes(parsed.name)) {
|
|
529484
|
-
if (!/^(?:status|pause|paused|cancel|clear|stop)?$/i.test(parsed.args.trim())) return false;
|
|
529485
|
-
} else if (parsed.name !== "loop" && parsed.name !== "queue") return false;
|
|
529486
|
-
const command = findBuiltInSlashCommand(parsed.name);
|
|
529487
|
-
return command !== void 0 && resolveSlashCommandAvailability(command, parsed.args) === "always";
|
|
529488
|
-
}
|
|
529489
|
-
/** Capture only this command's output, never another room's concurrent turn. */
|
|
529490
|
-
var ChannelCommandController = class {
|
|
529491
|
-
host;
|
|
529492
|
-
execution = new AsyncLocalStorage();
|
|
529493
|
-
constructor(host) {
|
|
529494
|
-
this.host = host;
|
|
529495
|
-
}
|
|
529496
|
-
get context() {
|
|
529497
|
-
const execution = this.execution.getStore();
|
|
529498
|
-
return execution?.active ? {
|
|
529499
|
-
input: execution.input,
|
|
529500
|
-
chatId: execution.envelope.meta.chat_id,
|
|
529501
|
-
...execution.envelope.meta.message_thread_id === void 0 ? {} : { threadId: execution.envelope.meta.message_thread_id }
|
|
529502
|
-
} : void 0;
|
|
529503
|
-
}
|
|
529504
|
-
commit() {
|
|
529505
|
-
const execution = this.execution.getStore();
|
|
529506
|
-
if (execution?.active) this.acknowledge(execution);
|
|
529507
|
-
}
|
|
529508
|
-
bindGoal(goalId) {
|
|
529509
|
-
const execution = this.execution.getStore();
|
|
529510
|
-
if (!execution?.active) return false;
|
|
529511
|
-
execution.goalId = goalId;
|
|
529512
|
-
return true;
|
|
529513
|
-
}
|
|
529514
|
-
acknowledge(execution) {
|
|
529515
|
-
if (execution.acknowledged) return;
|
|
529516
|
-
execution.acknowledged = true;
|
|
529517
|
-
execution.acknowledge?.();
|
|
529518
|
-
}
|
|
529519
|
-
captureStatus(message) {
|
|
529520
|
-
const execution = this.execution.getStore();
|
|
529521
|
-
if (execution?.active) execution.responses.push(message);
|
|
529522
|
-
}
|
|
529523
|
-
capturePrompt(text) {
|
|
529524
|
-
const execution = this.execution.getStore();
|
|
529525
|
-
if (!execution?.active) return false;
|
|
529526
|
-
this.host.sendPrompt(execution.envelope, text, () => {
|
|
529527
|
-
this.acknowledge(execution);
|
|
529528
|
-
}, execution.goalId);
|
|
529529
|
-
execution.sentModelTurn = true;
|
|
529530
|
-
return true;
|
|
529531
|
-
}
|
|
529532
|
-
async run(envelope, input, acknowledge) {
|
|
529533
|
-
const execution = {
|
|
529534
|
-
input,
|
|
529535
|
-
envelope,
|
|
529536
|
-
acknowledge,
|
|
529537
|
-
responses: [],
|
|
529538
|
-
active: true,
|
|
529539
|
-
sentModelTurn: false,
|
|
529540
|
-
acknowledged: false
|
|
529541
|
-
};
|
|
529542
|
-
await this.execution.run(execution, async () => {
|
|
529543
|
-
try {
|
|
529544
|
-
if (parseSlashInput(input)?.name === "befehle") this.host.showStatus(REMOTE_COMMAND_LIST);
|
|
529545
|
-
else await this.host.dispatch(input);
|
|
529546
|
-
} catch (error) {
|
|
529547
|
-
this.host.showError(formatErrorMessage$2(error));
|
|
529548
|
-
} finally {
|
|
529549
|
-
execution.active = false;
|
|
529550
|
-
}
|
|
529551
|
-
if (execution.sentModelTurn) return;
|
|
529552
|
-
this.acknowledge(execution);
|
|
529553
|
-
const text = execution.responses.at(-1) ?? input;
|
|
529554
|
-
if (envelope.meta.message_thread_id === void 0) await this.host.reply(envelope.meta.chat_id, text);
|
|
529555
|
-
else await this.host.reply(envelope.meta.chat_id, text, envelope.meta.message_thread_id);
|
|
529556
|
-
});
|
|
529557
|
-
}
|
|
529558
|
-
};
|
|
529559
|
-
//#endregion
|
|
529560
529679
|
//#region src/tui/constant/goal-channel-replies.ts
|
|
529561
529680
|
const GOAL_REPLY_RETRY_DELAY_MS = 1e3;
|
|
529562
529681
|
const GOAL_REPLY_REQUEST_TIMEOUT_MS = 15e3;
|
|
@@ -531444,6 +531563,10 @@ var EditorKeyboardController = class {
|
|
|
531444
531563
|
this.clearPendingExit();
|
|
531445
531564
|
host.openSessionPickerShortcut();
|
|
531446
531565
|
};
|
|
531566
|
+
editor.onOpenEffortPicker = () => {
|
|
531567
|
+
this.clearPendingExit();
|
|
531568
|
+
host.openEffortPickerShortcut();
|
|
531569
|
+
};
|
|
531447
531570
|
editor.onOpenExternalEditor = () => {
|
|
531448
531571
|
host.track("shortcut_editor");
|
|
531449
531572
|
this.openExternalEditor();
|
|
@@ -542658,6 +542781,12 @@ var BlunTUI = class {
|
|
|
542658
542781
|
}
|
|
542659
542782
|
if (this.startupWorkspaceSelectionPending) return false;
|
|
542660
542783
|
await this.refreshProviderModelsBeforeSession();
|
|
542784
|
+
const config = await this.harness.getConfig();
|
|
542785
|
+
if (Object.keys(config.providers ?? {}).length === 0 && Object.keys(config.models ?? {}).length === 0) {
|
|
542786
|
+
this.authFlow.enterMissingModelStartupState();
|
|
542787
|
+
this.startupLoginRequired = true;
|
|
542788
|
+
return false;
|
|
542789
|
+
}
|
|
542661
542790
|
const { startup } = this.options;
|
|
542662
542791
|
const { workDir } = this.state.appState;
|
|
542663
542792
|
let session;
|
|
@@ -543352,33 +543481,35 @@ var BlunTUI = class {
|
|
|
543352
543481
|
/**
|
|
543353
543482
|
* Remote channel inbound (Telegram) into THIS visible session.
|
|
543354
543483
|
* Never routes through handleUserInput: only allowlisted slash dispatch (a Telegram
|
|
543355
|
-
* "/new" is
|
|
543484
|
+
* "/new" is rejected without execution), no local editor history. The transcript
|
|
543356
543485
|
* shows a clean user line with a muted origin prefix; the
|
|
543357
|
-
* model receives the full <channel …> payload.
|
|
543358
|
-
*
|
|
543359
|
-
*
|
|
543486
|
+
* model receives the full <channel …> payload. Model messages use the shared
|
|
543487
|
+
* queue; recognized remote controls run now or receive an immediate busy
|
|
543488
|
+
* reply, so they never wait behind ordinary prompts.
|
|
543360
543489
|
*/
|
|
543361
543490
|
injectChannelMessage(envelope, acknowledge) {
|
|
543362
543491
|
const command = channelCommandInput(envelope);
|
|
543363
543492
|
if (command !== void 0) {
|
|
543364
|
-
const
|
|
543493
|
+
const active = this.queueSteerInFlight !== void 0 || this.manualPromptInFlight !== void 0 || this.state.appState.streamingPhase !== "idle" || this.state.appState.isCompacting;
|
|
543494
|
+
if (this.session === void 0 || this.deferUserMessages || this.queueCommandRunning || this.editorReplacementActive || active && !channelCommandCanInterrupt(command)) {
|
|
543495
|
+
this.channelCommands.rejectBusy(envelope, acknowledge).catch((error) => {
|
|
543496
|
+
this.showError(formatErrorMessage$2(error));
|
|
543497
|
+
});
|
|
543498
|
+
return;
|
|
543499
|
+
}
|
|
543500
|
+
this.runChannelCommand({
|
|
543365
543501
|
text: command,
|
|
543366
|
-
displayText: envelope.text,
|
|
543367
543502
|
origin: channelOrigin(envelope),
|
|
543368
|
-
mode: "command",
|
|
543369
543503
|
agentId: this.harness.interactiveAgentId,
|
|
543370
|
-
|
|
543371
|
-
channelThreadId: envelope.meta.message_thread_id,
|
|
543372
|
-
channelCommandEnvelope: envelope,
|
|
543504
|
+
mode: "command",
|
|
543373
543505
|
channelAcknowledge: acknowledge
|
|
543374
|
-
};
|
|
543375
|
-
|
|
543376
|
-
|
|
543377
|
-
|
|
543378
|
-
|
|
543379
|
-
this.
|
|
543380
|
-
|
|
543381
|
-
} else this.runChannelCommand(item, envelope);
|
|
543506
|
+
}, envelope);
|
|
543507
|
+
return;
|
|
543508
|
+
}
|
|
543509
|
+
if (channelSlashCommandCandidate(envelope)) {
|
|
543510
|
+
this.channelCommands.rejectUnsupported(envelope, acknowledge).catch((error) => {
|
|
543511
|
+
this.showError(formatErrorMessage$2(error));
|
|
543512
|
+
});
|
|
543382
543513
|
return;
|
|
543383
543514
|
}
|
|
543384
543515
|
injectChannelEnvelope({
|
|
@@ -545278,6 +545409,15 @@ var BlunTUI = class {
|
|
|
545278
545409
|
if (this.state.queuedMessages.some((item) => item.mode === "command" && item.text === "/sessions" && item.agentId === this.harness.interactiveAgentId && item.channelCommandEnvelope === void 0)) return;
|
|
545279
545410
|
this.runSlashCommand("/sessions");
|
|
545280
545411
|
}
|
|
545412
|
+
openEffortPickerShortcut() {
|
|
545413
|
+
if (this.editorReplacementActive || this.queueCommandRunning) return;
|
|
545414
|
+
if (this.state.appState.isReplaying) {
|
|
545415
|
+
this.showError(uiText("blunTui.input.replayBlocked"));
|
|
545416
|
+
return;
|
|
545417
|
+
}
|
|
545418
|
+
if (this.state.queuedMessages.some((item) => item.mode === "command" && item.text === "/effort" && item.agentId === this.harness.interactiveAgentId && item.channelCommandEnvelope === void 0)) return;
|
|
545419
|
+
this.runSlashCommand("/effort");
|
|
545420
|
+
}
|
|
545281
545421
|
async showSessionPicker(target) {
|
|
545282
545422
|
await this.openSessionPicker({
|
|
545283
545423
|
target,
|
|
@@ -545491,13 +545631,13 @@ var BlunTUI = class {
|
|
|
545491
545631
|
//#endregion
|
|
545492
545632
|
//#region src/constant/update.ts
|
|
545493
545633
|
var import_runtime_exit_ledger = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
545494
|
-
const fs = __require("node:fs");
|
|
545634
|
+
const fs$1 = __require("node:fs");
|
|
545495
545635
|
const os$1 = __require("node:os");
|
|
545496
|
-
const path$
|
|
545636
|
+
const path$2 = __require("node:path");
|
|
545497
545637
|
const DEFAULT_MAX_BYTES = 1024 * 1024;
|
|
545498
545638
|
const DEFAULT_RETAIN_BYTES = 512 * 1024;
|
|
545499
545639
|
function runtimeExitLedgerPath(homeDir) {
|
|
545500
|
-
return path$
|
|
545640
|
+
return path$2.join(homeDir, "diagnostics", "runtime-exits.jsonl");
|
|
545501
545641
|
}
|
|
545502
545642
|
function sanitizeExitText(input, maxChars = 2048) {
|
|
545503
545643
|
let value = String(input ?? "");
|
|
@@ -545506,7 +545646,7 @@ var import_runtime_exit_ledger = (/* @__PURE__ */ __commonJSMin(((exports, modul
|
|
|
545506
545646
|
process.env.USERPROFILE,
|
|
545507
545647
|
process.env.HOME
|
|
545508
545648
|
].filter((entry) => typeof entry === "string" && entry.length > 2));
|
|
545509
|
-
for (const home of homes) for (const variant of [path$
|
|
545649
|
+
for (const home of homes) for (const variant of [path$2.normalize(home), home.replaceAll("\\", "/")]) {
|
|
545510
545650
|
const escaped = variant.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
|
|
545511
545651
|
value = value.replace(new RegExp(escaped, process.platform === "win32" ? "giu" : "gu"), "$HOME");
|
|
545512
545652
|
}
|
|
@@ -545545,7 +545685,7 @@ var import_runtime_exit_ledger = (/* @__PURE__ */ __commonJSMin(((exports, modul
|
|
|
545545
545685
|
return record;
|
|
545546
545686
|
}
|
|
545547
545687
|
function directoryIdentity(directory) {
|
|
545548
|
-
const stat = fs.lstatSync(directory, { bigint: true });
|
|
545688
|
+
const stat = fs$1.lstatSync(directory, { bigint: true });
|
|
545549
545689
|
if (!stat.isDirectory() || stat.isSymbolicLink()) throw new Error("Unsafe exit directory");
|
|
545550
545690
|
return stat;
|
|
545551
545691
|
}
|
|
@@ -545557,46 +545697,46 @@ var import_runtime_exit_ledger = (/* @__PURE__ */ __commonJSMin(((exports, modul
|
|
|
545557
545697
|
return stat;
|
|
545558
545698
|
}
|
|
545559
545699
|
function trimLedger(descriptor, maxBytes, retainBytes, incomingBytes) {
|
|
545560
|
-
const size = Number(regularLedger(fs.fstatSync(descriptor, { bigint: true })).size);
|
|
545700
|
+
const size = Number(regularLedger(fs$1.fstatSync(descriptor, { bigint: true })).size);
|
|
545561
545701
|
if (!Number.isSafeInteger(size)) throw new Error("Invalid exit ledger size");
|
|
545562
545702
|
if (size + incomingBytes <= maxBytes) return;
|
|
545563
545703
|
const keepBytes = Math.max(0, Math.min(size, retainBytes, maxBytes - incomingBytes));
|
|
545564
545704
|
const contents = Buffer.alloc(keepBytes);
|
|
545565
|
-
const read = fs.readSync(descriptor, contents, 0, keepBytes, size - keepBytes);
|
|
545705
|
+
const read = fs$1.readSync(descriptor, contents, 0, keepBytes, size - keepBytes);
|
|
545566
545706
|
const tail = contents.subarray(0, read);
|
|
545567
545707
|
const lineStart = size > keepBytes ? tail.indexOf(10) + 1 : 0;
|
|
545568
|
-
fs.ftruncateSync(descriptor, 0);
|
|
545569
|
-
fs.writeFileSync(descriptor, lineStart > 0 || size === keepBytes ? tail.subarray(lineStart) : "");
|
|
545708
|
+
fs$1.ftruncateSync(descriptor, 0);
|
|
545709
|
+
fs$1.writeFileSync(descriptor, lineStart > 0 || size === keepBytes ? tail.subarray(lineStart) : "");
|
|
545570
545710
|
}
|
|
545571
545711
|
function recordRuntimeExit(input = {}) {
|
|
545572
545712
|
let descriptor;
|
|
545573
545713
|
let appendDescriptor;
|
|
545574
545714
|
try {
|
|
545575
545715
|
const homeDir = typeof input.homeDir === "string" ? input.homeDir.trim() : "";
|
|
545576
|
-
if (!homeDir || !path$
|
|
545577
|
-
fs.mkdirSync(homeDir, {
|
|
545716
|
+
if (!homeDir || !path$2.isAbsolute(homeDir)) return false;
|
|
545717
|
+
fs$1.mkdirSync(homeDir, {
|
|
545578
545718
|
recursive: true,
|
|
545579
545719
|
mode: 448
|
|
545580
545720
|
});
|
|
545581
545721
|
const homeIdentity = directoryIdentity(homeDir);
|
|
545582
545722
|
const file = runtimeExitLedgerPath(homeDir);
|
|
545583
|
-
const directory = path$
|
|
545723
|
+
const directory = path$2.dirname(file);
|
|
545584
545724
|
try {
|
|
545585
|
-
fs.mkdirSync(directory, { mode: 448 });
|
|
545725
|
+
fs$1.mkdirSync(directory, { mode: 448 });
|
|
545586
545726
|
} catch (error) {
|
|
545587
545727
|
if (error.code !== "EEXIST") throw error;
|
|
545588
545728
|
}
|
|
545589
545729
|
const directoryStat = directoryIdentity(directory);
|
|
545590
545730
|
let before;
|
|
545591
545731
|
try {
|
|
545592
|
-
before = regularLedger(fs.lstatSync(file, { bigint: true }));
|
|
545732
|
+
before = regularLedger(fs$1.lstatSync(file, { bigint: true }));
|
|
545593
545733
|
} catch (error) {
|
|
545594
545734
|
if (error.code !== "ENOENT") throw error;
|
|
545595
545735
|
}
|
|
545596
|
-
const flags = fs.constants.O_RDWR | (fs.constants.O_NOFOLLOW ?? 0) | (fs.constants.O_NONBLOCK ?? 0) | (before ? 0 : fs.constants.O_CREAT | fs.constants.O_EXCL);
|
|
545597
|
-
descriptor = fs.openSync(file, flags, 384);
|
|
545598
|
-
const opened = regularLedger(fs.fstatSync(descriptor, { bigint: true }));
|
|
545599
|
-
if (before && !sameIdentity(before, opened) || !sameIdentity(opened, regularLedger(fs.lstatSync(file, { bigint: true }))) || !sameIdentity(homeIdentity, directoryIdentity(homeDir)) || !sameIdentity(directoryStat, directoryIdentity(directory))) throw new Error("Exit ledger changed");
|
|
545736
|
+
const flags = fs$1.constants.O_RDWR | (fs$1.constants.O_NOFOLLOW ?? 0) | (fs$1.constants.O_NONBLOCK ?? 0) | (before ? 0 : fs$1.constants.O_CREAT | fs$1.constants.O_EXCL);
|
|
545737
|
+
descriptor = fs$1.openSync(file, flags, 384);
|
|
545738
|
+
const opened = regularLedger(fs$1.fstatSync(descriptor, { bigint: true }));
|
|
545739
|
+
if (before && !sameIdentity(before, opened) || !sameIdentity(opened, regularLedger(fs$1.lstatSync(file, { bigint: true }))) || !sameIdentity(homeIdentity, directoryIdentity(homeDir)) || !sameIdentity(directoryStat, directoryIdentity(directory))) throw new Error("Exit ledger changed");
|
|
545600
545740
|
const maxBytes = Math.max(1024, Number.isInteger(input.maxBytes) ? input.maxBytes : DEFAULT_MAX_BYTES);
|
|
545601
545741
|
const retainBytes = Math.max(0, Number.isInteger(input.retainBytes) ? input.retainBytes : DEFAULT_RETAIN_BYTES);
|
|
545602
545742
|
const record = buildRuntimeExitRecord(input);
|
|
@@ -545619,21 +545759,21 @@ var import_runtime_exit_ledger = (/* @__PURE__ */ __commonJSMin(((exports, modul
|
|
|
545619
545759
|
line = `${JSON.stringify(record)}\n`;
|
|
545620
545760
|
}
|
|
545621
545761
|
trimLedger(descriptor, maxBytes, retainBytes, Buffer.byteLength(line));
|
|
545622
|
-
appendDescriptor = fs.openSync(file, fs.constants.O_WRONLY | fs.constants.O_APPEND | (fs.constants.O_NOFOLLOW ?? 0) | (fs.constants.O_NONBLOCK ?? 0));
|
|
545623
|
-
if (!sameIdentity(opened, regularLedger(fs.fstatSync(appendDescriptor, { bigint: true }))) || !sameIdentity(opened, regularLedger(fs.lstatSync(file, { bigint: true }))) || !sameIdentity(homeIdentity, directoryIdentity(homeDir)) || !sameIdentity(directoryStat, directoryIdentity(directory))) throw new Error("Exit ledger changed");
|
|
545624
|
-
fs.appendFileSync(appendDescriptor, line, { encoding: "utf8" });
|
|
545762
|
+
appendDescriptor = fs$1.openSync(file, fs$1.constants.O_WRONLY | fs$1.constants.O_APPEND | (fs$1.constants.O_NOFOLLOW ?? 0) | (fs$1.constants.O_NONBLOCK ?? 0));
|
|
545763
|
+
if (!sameIdentity(opened, regularLedger(fs$1.fstatSync(appendDescriptor, { bigint: true }))) || !sameIdentity(opened, regularLedger(fs$1.lstatSync(file, { bigint: true }))) || !sameIdentity(homeIdentity, directoryIdentity(homeDir)) || !sameIdentity(directoryStat, directoryIdentity(directory))) throw new Error("Exit ledger changed");
|
|
545764
|
+
fs$1.appendFileSync(appendDescriptor, line, { encoding: "utf8" });
|
|
545625
545765
|
try {
|
|
545626
|
-
fs.fchmodSync(descriptor, 384);
|
|
545766
|
+
fs$1.fchmodSync(descriptor, 384);
|
|
545627
545767
|
} catch {}
|
|
545628
545768
|
return true;
|
|
545629
545769
|
} catch {
|
|
545630
545770
|
return false;
|
|
545631
545771
|
} finally {
|
|
545632
545772
|
if (appendDescriptor !== void 0) try {
|
|
545633
|
-
fs.closeSync(appendDescriptor);
|
|
545773
|
+
fs$1.closeSync(appendDescriptor);
|
|
545634
545774
|
} catch {}
|
|
545635
545775
|
if (descriptor !== void 0) try {
|
|
545636
|
-
fs.closeSync(descriptor);
|
|
545776
|
+
fs$1.closeSync(descriptor);
|
|
545637
545777
|
} catch {}
|
|
545638
545778
|
}
|
|
545639
545779
|
}
|