blun-king-cli 9.1.21 → 9.1.23

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.
@@ -31,6 +31,13 @@ const UPDATE_SIGNAL_EXIT_CODES = Object.freeze({
31
31
  SIGINT: 130,
32
32
  SIGTERM: 143,
33
33
  });
34
+ const INTERACTIVE_START_MODE_FLAGS = new Set([
35
+ '-y',
36
+ '--auto',
37
+ '--auto-approve',
38
+ '--plan',
39
+ '--yolo',
40
+ ]);
34
41
  const SEMVER_IDENTIFIER = '(?:0|[1-9]\\d*|\\d*[A-Za-z-][0-9A-Za-z-]*)';
35
42
  const SEMVER_PATTERN = new RegExp(
36
43
  `^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)`
@@ -435,8 +442,10 @@ function writeSkippedVersion(blunDir, skippedVersion) {
435
442
  }
436
443
 
437
444
  function isInteractiveUpdateStart({ argv, env, stdin, stdout }) {
438
- return Array.isArray(argv)
439
- && argv.length === 0
445
+ const isOrdinaryStartup = Array.isArray(argv)
446
+ && (argv.length === 0
447
+ || (argv.length === 1 && INTERACTIVE_START_MODE_FLAGS.has(argv[0])));
448
+ return isOrdinaryStartup
440
449
  && (!env || env.BLUN_NO_AUTO_UPDATE !== '1')
441
450
  && stdin?.isTTY === true
442
451
  && stdout?.isTTY === true;
package/blun.mjs CHANGED
@@ -1,19 +1,19 @@
1
1
  #!/usr/bin/env node
2
- // BLUN_BUILD_INPUT_SHA256:18b6ba1c5baca9739e0e2b5c280d073bac714589178a987d0bc9fd63d56020f0
2
+ // BLUN_BUILD_INPUT_SHA256:ceb20a9e0d1997d41a1341bbfc3961f3f60de3ed6867c9cff4ee45bc88198aab
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$17 from "node:fs";
9
+ import * as fs$16 from "node:fs";
10
10
  import Kt, { accessSync, appendFileSync, chmodSync, closeSync, constants, copyFileSync, createReadStream, createWriteStream, existsSync, fsyncSync, linkSync, lstatSync, mkdirSync, openSync, promises, readFileSync, readSync, readdirSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
11
11
  import * as path$17 from "node:path";
12
12
  import path, { basename, dirname, extname, isAbsolute, join, normalize, posix, relative, resolve, sep, win32 } from "node:path";
13
13
  import { Blob as Blob$1, Buffer as Buffer$1, File as File$1 } from "node:buffer";
14
14
  import * as nodeOs from "node:os";
15
15
  import os, { arch, homedir, hostname, networkInterfaces, platform, release, tmpdir, type, userInfo } from "node:os";
16
- import fs, { access, appendFile, chmod, constants as constants$1, copyFile, cp, link, lstat, mkdir, mkdtemp, open, readFile, readdir, realpath, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
16
+ import ro, { access, appendFile, chmod, constants as constants$1, copyFile, cp, link, lstat, mkdir, mkdtemp, open, readFile, readdir, realpath, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
17
17
  import { execFile, execFileSync, execSync, spawn, spawnSync } from "node:child_process";
18
18
  import * as sysPath from "path";
19
19
  import path$1, { basename as basename$1, dirname as dirname$1, join as join$1, parse } from "path";
@@ -2072,11 +2072,11 @@ var init_blun_files = __esmMin((() => {
2072
2072
  async uploadVideo(input, options) {
2073
2073
  let file;
2074
2074
  if (typeof input === "string") {
2075
- if (!fs$17.existsSync(input)) throw new ChatProviderError(`Video file not found: ${input}`);
2075
+ if (!fs$16.existsSync(input)) throw new ChatProviderError(`Video file not found: ${input}`);
2076
2076
  const filename = path$17.basename(input);
2077
2077
  const mimeType = guessMimeTypeFromExt(filename);
2078
2078
  if (mimeType === void 0 || !mimeType.startsWith("video/")) throw new ChatProviderError(`BlunFiles.uploadVideo: file extension does not indicate a video type: ${filename}`);
2079
- const data = await fs$17.promises.readFile(input);
2079
+ const data = await fs$16.promises.readFile(input);
2080
2080
  file = new File$1([new Blob$1([new Uint8Array(data)], { type: mimeType })], filename, { type: mimeType });
2081
2081
  } else {
2082
2082
  if (!input.mimeType.startsWith("video/")) throw new ChatProviderError(`Expected a video mime type, got ${input.mimeType}`);
@@ -11425,7 +11425,7 @@ var require_clone$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11425
11425
  //#endregion
11426
11426
  //#region ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
11427
11427
  var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11428
- var fs$16 = __require("fs");
11428
+ var fs$15 = __require("fs");
11429
11429
  var polyfills = require_polyfills();
11430
11430
  var legacy = require_legacy_streams();
11431
11431
  var clone = require_clone$1();
@@ -11454,36 +11454,36 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11454
11454
  m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
11455
11455
  console.error(m);
11456
11456
  };
11457
- if (!fs$16[gracefulQueue]) {
11458
- publishQueue(fs$16, global[gracefulQueue] || []);
11459
- fs$16.close = (function(fs$close) {
11457
+ if (!fs$15[gracefulQueue]) {
11458
+ publishQueue(fs$15, global[gracefulQueue] || []);
11459
+ fs$15.close = (function(fs$close) {
11460
11460
  function close(fd, cb) {
11461
- return fs$close.call(fs$16, fd, function(err) {
11461
+ return fs$close.call(fs$15, fd, function(err) {
11462
11462
  if (!err) resetQueue();
11463
11463
  if (typeof cb === "function") cb.apply(this, arguments);
11464
11464
  });
11465
11465
  }
11466
11466
  Object.defineProperty(close, previousSymbol, { value: fs$close });
11467
11467
  return close;
11468
- })(fs$16.close);
11469
- fs$16.closeSync = (function(fs$closeSync) {
11468
+ })(fs$15.close);
11469
+ fs$15.closeSync = (function(fs$closeSync) {
11470
11470
  function closeSync(fd) {
11471
- fs$closeSync.apply(fs$16, arguments);
11471
+ fs$closeSync.apply(fs$15, arguments);
11472
11472
  resetQueue();
11473
11473
  }
11474
11474
  Object.defineProperty(closeSync, previousSymbol, { value: fs$closeSync });
11475
11475
  return closeSync;
11476
- })(fs$16.closeSync);
11476
+ })(fs$15.closeSync);
11477
11477
  if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) process.on("exit", function() {
11478
- debug(fs$16[gracefulQueue]);
11479
- __require("assert").equal(fs$16[gracefulQueue].length, 0);
11478
+ debug(fs$15[gracefulQueue]);
11479
+ __require("assert").equal(fs$15[gracefulQueue].length, 0);
11480
11480
  });
11481
11481
  }
11482
- if (!global[gracefulQueue]) publishQueue(global, fs$16[gracefulQueue]);
11483
- module.exports = patch(clone(fs$16));
11484
- if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$16.__patched) {
11485
- module.exports = patch(fs$16);
11486
- fs$16.__patched = true;
11482
+ if (!global[gracefulQueue]) publishQueue(global, fs$15[gracefulQueue]);
11483
+ module.exports = patch(clone(fs$15));
11484
+ if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$15.__patched) {
11485
+ module.exports = patch(fs$15);
11486
+ fs$15.__patched = true;
11487
11487
  }
11488
11488
  function patch(fs) {
11489
11489
  polyfills(fs);
@@ -11738,23 +11738,23 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11738
11738
  }
11739
11739
  function enqueue(elem) {
11740
11740
  debug("ENQUEUE", elem[0].name, elem[1]);
11741
- fs$16[gracefulQueue].push(elem);
11741
+ fs$15[gracefulQueue].push(elem);
11742
11742
  retry();
11743
11743
  }
11744
11744
  var retryTimer;
11745
11745
  function resetQueue() {
11746
11746
  var now = Date.now();
11747
- for (var i = 0; i < fs$16[gracefulQueue].length; ++i) if (fs$16[gracefulQueue][i].length > 2) {
11748
- fs$16[gracefulQueue][i][3] = now;
11749
- fs$16[gracefulQueue][i][4] = now;
11747
+ for (var i = 0; i < fs$15[gracefulQueue].length; ++i) if (fs$15[gracefulQueue][i].length > 2) {
11748
+ fs$15[gracefulQueue][i][3] = now;
11749
+ fs$15[gracefulQueue][i][4] = now;
11750
11750
  }
11751
11751
  retry();
11752
11752
  }
11753
11753
  function retry() {
11754
11754
  clearTimeout(retryTimer);
11755
11755
  retryTimer = void 0;
11756
- if (fs$16[gracefulQueue].length === 0) return;
11757
- var elem = fs$16[gracefulQueue].shift();
11756
+ if (fs$15[gracefulQueue].length === 0) return;
11757
+ var elem = fs$15[gracefulQueue].shift();
11758
11758
  var fn = elem[0];
11759
11759
  var args = elem[1];
11760
11760
  var err = elem[2];
@@ -11773,7 +11773,7 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11773
11773
  if (sinceAttempt >= Math.min(sinceStart * 1.2, 100)) {
11774
11774
  debug("RETRY", fn.name, args);
11775
11775
  fn.apply(null, args.concat([startTime]));
11776
- } else fs$16[gracefulQueue].push(elem);
11776
+ } else fs$15[gracefulQueue].push(elem);
11777
11777
  }
11778
11778
  if (retryTimer === void 0) retryTimer = setTimeout(retry, 0);
11779
11779
  }
@@ -14609,7 +14609,7 @@ async function syncDir(dirPath) {
14609
14609
  */
14610
14610
  function syncFd(fd) {
14611
14611
  return new Promise((resolve, reject) => {
14612
- fs$17.fsync(fd, (err) => {
14612
+ fs$16.fsync(fd, (err) => {
14613
14613
  if (err) {
14614
14614
  reject(err);
14615
14615
  return;
@@ -26786,7 +26786,7 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
26786
26786
  };
26787
26787
  return _setPrototypeOf(o, p);
26788
26788
  }
26789
- var fs$15 = __require("fs");
26789
+ var fs$14 = __require("fs");
26790
26790
  var path$14 = __require("path");
26791
26791
  var Loader = require_loader();
26792
26792
  var PrecompiledLoader = require_precompiled_loader().PrecompiledLoader;
@@ -26810,7 +26810,7 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
26810
26810
  } catch (e) {
26811
26811
  throw new Error("watch requires chokidar to be installed");
26812
26812
  }
26813
- var paths = _this.searchPaths.filter(fs$15.existsSync);
26813
+ var paths = _this.searchPaths.filter(fs$14.existsSync);
26814
26814
  var watcher = chokidar.watch(paths);
26815
26815
  watcher.on("all", function(event, fullname) {
26816
26816
  fullname = path$14.resolve(fullname);
@@ -26829,7 +26829,7 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
26829
26829
  for (var i = 0; i < paths.length; i++) {
26830
26830
  var basePath = path$14.resolve(paths[i]);
26831
26831
  var p = path$14.resolve(paths[i], name);
26832
- if (p.indexOf(basePath) === 0 && fs$15.existsSync(p)) {
26832
+ if (p.indexOf(basePath) === 0 && fs$14.existsSync(p)) {
26833
26833
  fullpath = p;
26834
26834
  break;
26835
26835
  }
@@ -26837,7 +26837,7 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
26837
26837
  if (!fullpath) return null;
26838
26838
  this.pathsToNames[fullpath] = name;
26839
26839
  var source = {
26840
- src: fs$15.readFileSync(fullpath, "utf-8"),
26840
+ src: fs$14.readFileSync(fullpath, "utf-8"),
26841
26841
  path: fullpath,
26842
26842
  noCache: this.noCache
26843
26843
  };
@@ -26885,7 +26885,7 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
26885
26885
  }
26886
26886
  this.pathsToNames[fullpath] = name;
26887
26887
  var source = {
26888
- src: fs$15.readFileSync(fullpath, "utf-8"),
26888
+ src: fs$14.readFileSync(fullpath, "utf-8"),
26889
26889
  path: fullpath,
26890
26890
  noCache: this.noCache
26891
26891
  };
@@ -27629,7 +27629,7 @@ var require_precompile_global = /* @__PURE__ */ __commonJSMin(((exports, module)
27629
27629
  //#endregion
27630
27630
  //#region ../../node_modules/.pnpm/nunjucks@3.2.4_chokidar@4.0.3/node_modules/nunjucks/src/precompile.js
27631
27631
  var require_precompile = /* @__PURE__ */ __commonJSMin(((exports, module) => {
27632
- var fs$14 = __require("fs");
27632
+ var fs$13 = __require("fs");
27633
27633
  var path$12 = __require("path");
27634
27634
  var _prettifyError = require_lib$7()._prettifyError;
27635
27635
  var compiler = require_compiler();
@@ -27654,27 +27654,27 @@ var require_precompile = /* @__PURE__ */ __commonJSMin(((exports, module) => {
27654
27654
  var env = opts.env || new Environment([]);
27655
27655
  var wrapper = opts.wrapper || precompileGlobal;
27656
27656
  if (opts.isString) return precompileString(input, opts);
27657
- var pathStats = fs$14.existsSync(input) && fs$14.statSync(input);
27657
+ var pathStats = fs$13.existsSync(input) && fs$13.statSync(input);
27658
27658
  var precompiled = [];
27659
27659
  var templates = [];
27660
27660
  function addTemplates(dir) {
27661
- fs$14.readdirSync(dir).forEach(function(file) {
27661
+ fs$13.readdirSync(dir).forEach(function(file) {
27662
27662
  var filepath = path$12.join(dir, file);
27663
27663
  var subpath = filepath.substr(path$12.join(input, "/").length);
27664
- var stat = fs$14.statSync(filepath);
27664
+ var stat = fs$13.statSync(filepath);
27665
27665
  if (stat && stat.isDirectory()) {
27666
27666
  subpath += "/";
27667
27667
  if (!match(subpath, opts.exclude)) addTemplates(filepath);
27668
27668
  } else if (match(subpath, opts.include)) templates.push(filepath);
27669
27669
  });
27670
27670
  }
27671
- if (pathStats.isFile()) precompiled.push(_precompile(fs$14.readFileSync(input, "utf-8"), opts.name || input, env));
27671
+ if (pathStats.isFile()) precompiled.push(_precompile(fs$13.readFileSync(input, "utf-8"), opts.name || input, env));
27672
27672
  else if (pathStats.isDirectory()) {
27673
27673
  addTemplates(input);
27674
27674
  for (var i = 0; i < templates.length; i++) {
27675
27675
  var name = templates[i].replace(path$12.join(input, "/"), "");
27676
27676
  try {
27677
- precompiled.push(_precompile(fs$14.readFileSync(templates[i], "utf-8"), name, env));
27677
+ precompiled.push(_precompile(fs$13.readFileSync(templates[i], "utf-8"), name, env));
27678
27678
  } catch (e) {
27679
27679
  if (opts.force) console.error(e);
27680
27680
  else throw e;
@@ -36239,7 +36239,7 @@ var require_gifframe = /* @__PURE__ */ __commonJSMin(((exports) => {
36239
36239
  //#region ../../node_modules/.pnpm/gifwrap@0.10.1/node_modules/gifwrap/src/gifutil.js
36240
36240
  var require_gifutil = /* @__PURE__ */ __commonJSMin(((exports) => {
36241
36241
  /** @namespace GifUtil */
36242
- const fs$13 = __require("fs");
36242
+ const fs$12 = __require("fs");
36243
36243
  const ImageQ = require_image_q();
36244
36244
  const BitmapImage = require_bitmapimage();
36245
36245
  const { GifFrame } = require_gifframe();
@@ -36506,7 +36506,7 @@ var require_gifutil = /* @__PURE__ */ __commonJSMin(((exports) => {
36506
36506
  }
36507
36507
  function _readBinary(path) {
36508
36508
  return new Promise((resolve, reject) => {
36509
- fs$13.readFile(path, (err, buffer) => {
36509
+ fs$12.readFile(path, (err, buffer) => {
36510
36510
  if (err) return reject(err);
36511
36511
  return resolve(buffer);
36512
36512
  });
@@ -36514,7 +36514,7 @@ var require_gifutil = /* @__PURE__ */ __commonJSMin(((exports) => {
36514
36514
  }
36515
36515
  function _writeBinary(path, buffer) {
36516
36516
  return new Promise((resolve, reject) => {
36517
- fs$13.writeFile(path, buffer, (err) => {
36517
+ fs$12.writeFile(path, buffer, (err) => {
36518
36518
  if (err) return reject(err);
36519
36519
  return resolve();
36520
36520
  });
@@ -62332,7 +62332,7 @@ var init_file_type = __esmMin((() => {
62332
62332
  }
62333
62333
  async fromFile(path) {
62334
62334
  this.options.signal?.throwIfAborted();
62335
- const fileHandle = await fs.open(path, constants.O_RDONLY | constants.O_NONBLOCK);
62335
+ const fileHandle = await ro.open(path, constants.O_RDONLY | constants.O_NONBLOCK);
62336
62336
  const fileStat = await fileHandle.stat();
62337
62337
  if (!fileStat.isFile()) {
62338
62338
  await fileHandle.close();
@@ -252333,7 +252333,7 @@ function Yn(s, t) {
252333
252333
  function Kn(s, t) {
252334
252334
  s.head = new ue$1(t, void 0, s.head, s), s.tail || (s.tail = s.head), s.length++;
252335
252335
  }
252336
- var zr, Ur, Ds, Wr, Gr, Zr, Q$1, J$1, nt$1, De$1, qt, Ne$1, Ns, Ae$1, As, z$1, Mt, g$1, Qt, Bt, b$1, N$1, _$1, bi, Ie$1, L$1, S, _i, Oi, Is, Ti, Z$1, xi, Ce$1, Jt$1, Rt, C, jt, Yr, Kr, Vr, $r, Fe$1, Li, Xr, qr, A$1, Jr, ht, H$1, te, m$1, Ni, tt$1, Ai, ki, vi, ie$1, ke$1, Ut$1, Ht, Ii, Pt, at, U$1, ot, Y$1, zt, Ci, j$1, ee$1, Fi, ve$1, gt$2, Me, bt, _t, Be$1, et$1, Wt$1, jr, Fs, ks, vs, Ms, Bs, tn, se$1, K$1, sn, M$1, rn, zs, nn, Bi, Tt, Gt, Pi, re, Pe$1, ze$1, Ue, He$1, We$1, Ge$1, Ze$1, Ye$1, Ke$1, Us, hn, an, Hs, ln, cn, Ws, Gs, Hi, ne, dn, Ui, oe$1, Ve$1, un, F$1, mn, xt, Wi, pn, lt, En, wn, Sn, ct, yn, Rn, gn, Gi, bn, Lt, ft, On, Tn, xn, f, $e$1, Dt, Nn, Xi, qi, An, B$1, Nt, it, Zi, Zs, V$1, he$1, dt, Ys, p, st$1, ut, Yi, At, w$1, Xe$1, qe$1, Ki, Ks, Vs, ae$1, Vi, Qe$1, Yt$1, $$1, Je$1, It, je$1, ti, $s, In, le$1, $i, Xs, Cn, rt$1, mt, vn, Qi, Mn, Bn, Ct, Ji, zn, qs, ce$1, ei, ji, Un, Hn, ts, Qs, rr, Wn, tr, er, ir, is$2, sr, fe$1, ii, ss, si, rs, ns, os$6, hs, pt, ri, as, es, q$1, de$1, ni, oi, Gn, hi, ue$1, pi, nr, li, me$1, W$1, pe$2, Et, Ft$1, Ee$1, ai, G, ls, ci, or, ds, us, fi, di, hr, cs, ui, lr, fs$12, 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;
252336
+ var zr, Ur, Ds, Wr, Gr, Zr, Q$1, J$1, nt$1, De$1, qt, Ne$1, Ns, Ae$1, As, z$1, Mt, g$1, Qt, Bt, b$1, N$1, _$1, bi, Ie$1, L$1, S, _i, Oi, Is, Ti, Z$1, xi, Ce$1, Jt$1, Rt, C, jt, Yr, Kr, Vr, $r, Fe$1, Li, Xr, qr, A$1, Jr, ht, H$1, te, m$1, Ni, tt$1, Ai, ki, vi, ie$1, ke$1, Ut$1, Ht, Ii, Pt, at, U$1, ot, Y$1, zt, Ci, j$1, ee$1, Fi, ve$1, gt$2, Me, bt, _t, Be$1, et$1, Wt$1, jr, Fs, ks, vs, Ms, Bs, tn, se$1, K$1, sn, M$1, rn, zs, nn, Bi, Tt, Gt, Pi, re, Pe$1, ze$1, Ue, He$1, We$1, Ge$1, Ze$1, Ye$1, Ke$1, Us, hn, an, Hs, ln, cn, Ws, Gs, Hi, ne, dn, Ui, oe$1, Ve$1, un, F$1, mn, xt, Wi, pn, lt, En, wn, Sn, ct, yn, Rn, gn, Gi, bn, Lt, ft, On, Tn, xn, f, $e$1, Dt, Nn, Xi, qi, An, B$1, Nt, it, Zi, Zs, V$1, he$1, dt, Ys, p, st$1, ut, Yi, At, w$1, Xe$1, qe$1, Ki, Ks, Vs, ae$1, Vi, Qe$1, Yt$1, $$1, Je$1, It, je$1, ti, $s, In, le$1, $i, Xs, Cn, rt$1, mt, vn, Qi, Mn, Bn, Ct, Ji, zn, qs, ce$1, ei, ji, Un, Hn, ts, Qs, rr, Wn, tr, er, ir, is$2, sr, fe$1, ii, ss, si, rs, ns, os$6, hs, pt, ri, as, es, q$1, de$1, ni, oi, Gn, hi, ue$1, pi, nr, li, me$1, W$1, pe$2, Et, Ft$1, Ee$1, ai, G, ls, ci, or, ds, us, fi, di, hr, cs, ui, lr, fs$11, wt, kt, Vn, $n, fr, dr, Xn, qn, Er, wr, ur, Sr, yr, Rr, jn, to, eo, mr, ms, ps, Ei, io, Es, so, ws, Se$1, St, no, gr, Ss, br, oo, _r, ys, Or, Vt$1, Tr, ao, lo, yi, Lr, Dr, _s, Nr, Os, P$1, Ts, xs, gi, Ar, Ir, Re, Cr, Fr, Rs, yt, O$1, Ri, kr, $t, gs, bs, Ls, ge$1, be, _e$1, Oe$1, Te$1, uo, mo, po, vr, Xt$1, ye$1, xe$1, Eo, wo, So, yo, Ro, go, bo, _o, vt, To;
252337
252337
  var init_index_min = __esmMin((() => {
252338
252338
  zr = Object.defineProperty;
252339
252339
  Ur = (s, t) => {
@@ -254303,7 +254303,7 @@ while (this[Zs](this[st$1].shift()));
254303
254303
  constructor(t, e) {
254304
254304
  this.path = t || "./", this.absolute = e;
254305
254305
  }
254306
- }, 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$12 = Symbol("ondrain"), wt = class extends A$1 {
254306
+ }, nr = Buffer.alloc(1024), li = Symbol("onStat"), me$1 = Symbol("ended"), W$1 = Symbol("queue"), pe$2 = Symbol("pendingLinks"), Et = Symbol("current"), Ft$1 = Symbol("process"), Ee$1 = Symbol("processing"), ai = Symbol("processJob"), G = Symbol("jobs"), ls = Symbol("jobDone"), ci = Symbol("addFSEntry"), or = Symbol("addTarEntry"), ds = Symbol("stat"), us = Symbol("readdir"), fi = Symbol("onreaddir"), di = Symbol("pipe"), hr = Symbol("entry"), cs = Symbol("entryOpt"), ui = Symbol("writeEntryClass"), lr = Symbol("write"), fs$11 = Symbol("ondrain"), wt = class extends A$1 {
254307
254307
  sync = !1;
254308
254308
  opt;
254309
254309
  cwd;
@@ -254336,8 +254336,8 @@ while (this[Zs](this[st$1].shift()));
254336
254336
  if ((t.gzip ? 1 : 0) + (t.brotli ? 1 : 0) + (t.zstd ? 1 : 0) > 1) throw new TypeError("gzip, brotli, zstd are mutually exclusive");
254337
254337
  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");
254338
254338
  let e = this.zip;
254339
- e.on("data", (i) => super.write(i)), e.on("end", () => super.end()), e.on("drain", () => this[fs$12]()), this.on("resume", () => e.resume());
254340
- } else this.on("drain", this[fs$12]);
254339
+ e.on("data", (i) => super.write(i)), e.on("end", () => super.end()), e.on("drain", () => this[fs$11]()), this.on("resume", () => e.resume());
254340
+ } else this.on("drain", this[fs$11]);
254341
254341
  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;
254342
254342
  }
254343
254343
  [lr](t) {
@@ -254464,7 +254464,7 @@ while (this[Zs](this[st$1].shift()));
254464
254464
  this.emit("error", e);
254465
254465
  }
254466
254466
  }
254467
- [fs$12]() {
254467
+ [fs$11]() {
254468
254468
  this[Et] && this[Et].entry && this[Et].entry.resume();
254469
254469
  }
254470
254470
  [di](t) {
@@ -254630,7 +254630,7 @@ while (this[Zs](this[st$1].shift()));
254630
254630
  E ? e(E) : x && a ? Es(x, o, h, (Le) => y(Le)) : n ? Kt.chmod(s, r, e) : e();
254631
254631
  };
254632
254632
  if (s === d) return no(s, y);
254633
- if (l) return fs.mkdir(s, {
254633
+ if (l) return ro.mkdir(s, {
254634
254634
  mode: r,
254635
254635
  recursive: !0
254636
254636
  }).then((E) => y(null, E ?? void 0), y);
@@ -255389,7 +255389,7 @@ var require_pend = /* @__PURE__ */ __commonJSMin(((exports, module) => {
255389
255389
  //#endregion
255390
255390
  //#region ../../node_modules/.pnpm/yauzl@3.3.0/node_modules/yauzl/fd-slicer.js
255391
255391
  var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
255392
- var fs$11 = __require("fs");
255392
+ var fs$10 = __require("fs");
255393
255393
  var util$6 = __require("util");
255394
255394
  var stream$2 = __require("stream");
255395
255395
  var Readable = stream$2.Readable;
@@ -255414,7 +255414,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
255414
255414
  FdSlicer.prototype.read = function(buffer, offset, length, position, callback) {
255415
255415
  var self = this;
255416
255416
  self.pend.go(function(cb) {
255417
- fs$11.read(self.fd, buffer, offset, length, position, function(err, bytesRead, buffer) {
255417
+ fs$10.read(self.fd, buffer, offset, length, position, function(err, bytesRead, buffer) {
255418
255418
  cb();
255419
255419
  callback(err, bytesRead, buffer);
255420
255420
  });
@@ -255423,7 +255423,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
255423
255423
  FdSlicer.prototype.write = function(buffer, offset, length, position, callback) {
255424
255424
  var self = this;
255425
255425
  self.pend.go(function(cb) {
255426
- fs$11.write(self.fd, buffer, offset, length, position, function(err, written, buffer) {
255426
+ fs$10.write(self.fd, buffer, offset, length, position, function(err, written, buffer) {
255427
255427
  cb();
255428
255428
  callback(err, written, buffer);
255429
255429
  });
@@ -255443,7 +255443,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
255443
255443
  self.refCount -= 1;
255444
255444
  if (self.refCount > 0) return;
255445
255445
  if (self.refCount < 0) throw new Error("invalid unref");
255446
- if (self.autoClose) fs$11.close(self.fd, onCloseDone);
255446
+ if (self.autoClose) fs$10.close(self.fd, onCloseDone);
255447
255447
  function onCloseDone(err) {
255448
255448
  if (err) self.emit("error", err);
255449
255449
  else self.emit("close");
@@ -255474,7 +255474,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
255474
255474
  self.context.pend.go(function(cb) {
255475
255475
  if (self.destroyed) return cb();
255476
255476
  var buffer = Buffer.allocUnsafe(toRead);
255477
- fs$11.read(self.context.fd, buffer, 0, toRead, self.pos, function(err, bytesRead) {
255477
+ fs$10.read(self.context.fd, buffer, 0, toRead, self.pos, function(err, bytesRead) {
255478
255478
  if (err) self.destroy(err);
255479
255479
  else if (bytesRead === 0) {
255480
255480
  self.destroyed = true;
@@ -255520,7 +255520,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
255520
255520
  }
255521
255521
  self.context.pend.go(function(cb) {
255522
255522
  if (self.destroyed) return cb();
255523
- fs$11.write(self.context.fd, buffer, 0, buffer.length, self.pos, function(err, bytes) {
255523
+ fs$10.write(self.context.fd, buffer, 0, buffer.length, self.pos, function(err, bytes) {
255524
255524
  if (err) {
255525
255525
  self.destroy();
255526
255526
  cb();
@@ -261093,10 +261093,12 @@ function contentPartFor(mimeType, url) {
261093
261093
  function errorMessage$10(error) {
261094
261094
  return error instanceof Error ? error.message : String(error);
261095
261095
  }
261096
- var PromptSchema, MediaIdSchema, GenerateImageInputSchema, GenerateVideoInputSchema, GenerateSpeechInputSchema, GetMediaInputSchema, REQUEST_NOTE, MediaGenerationTool, GenerateImageTool, GenerateVideoTool, GenerateSpeechTool, GetMediaTool;
261096
+ var PromptSchema, MediaIdSchema, GenerateImageInputSchema, GenerateVideoInputSchema, GenerateSpeechInputSchema, GetMediaInputSchema, UnderstandImageInputSchema, UnderstandVideoInputSchema, DubVideoInputSchema, LipSyncMediaInputSchema, REQUEST_NOTE, LIPSYNC_REQUEST_NOTE, MediaGenerationTool, GenerateImageTool, GenerateVideoTool, GenerateSpeechTool, UnderstandImageTool, UnderstandVideoTool, DubVideoTool, LipSyncMediaTool, GetMediaTool;
261097
261097
  var init_blun_media$1 = __esmMin((() => {
261098
261098
  init_zod$1();
261099
261099
  init_tool_access();
261100
+ init_path_access();
261101
+ init_file_type$1();
261100
261102
  init_input_schema();
261101
261103
  init_rule_match();
261102
261104
  PromptSchema = string().trim().min(1).max(2e4);
@@ -261105,9 +261107,27 @@ var init_blun_media$1 = __esmMin((() => {
261105
261107
  GenerateVideoInputSchema = object({ prompt: PromptSchema.describe("A complete visual description of the video to generate.") });
261106
261108
  GenerateSpeechInputSchema = object({ input: PromptSchema.describe("The exact text to synthesize as speech.") });
261107
261109
  GetMediaInputSchema = object({ id: MediaIdSchema.describe("The media job id returned by a generation tool.") });
261110
+ UnderstandImageInputSchema = object({
261111
+ path: string().trim().min(1).describe("Path to a local PNG or JPEG file. Relative paths resolve against the working directory."),
261112
+ prompt: string().trim().max(2e4).optional().describe("An optional question about the image. Omit it for a general description.")
261113
+ });
261114
+ UnderstandVideoInputSchema = object({
261115
+ media_id: MediaIdSchema.describe("The id of a completed video job owned by this account."),
261116
+ prompt: string().trim().max(2e4).optional().describe("An optional question about the video. Omit it for a general description.")
261117
+ });
261118
+ DubVideoInputSchema = object({
261119
+ media_id: MediaIdSchema.describe("The id of a completed video job owned by this account."),
261120
+ input: PromptSchema.describe("The exact text to render as the video soundtrack.")
261121
+ });
261122
+ LipSyncMediaInputSchema = object({
261123
+ image_id: MediaIdSchema.describe("The id of a completed PNG, JPEG, or MP4 source owned by this account."),
261124
+ audio_id: MediaIdSchema.describe("The id of a completed WAV or MP3 source owned by this account.")
261125
+ });
261108
261126
  REQUEST_NOTE = "The request is asynchronous. Use GetMedia with the returned id to check progress and retrieve the result.";
261127
+ LIPSYNC_REQUEST_NOTE = `${REQUEST_NOTE} Lip sync can take up to 35 minutes. No percentage progress is currently available; processing only means that the job is still running.`;
261109
261128
  MediaGenerationTool = class {
261110
261129
  provider;
261130
+ requestNote = REQUEST_NOTE;
261111
261131
  constructor(provider) {
261112
261132
  this.provider = provider;
261113
261133
  }
@@ -261129,7 +261149,7 @@ var init_blun_media$1 = __esmMin((() => {
261129
261149
  toolCallId: ctx.toolCallId
261130
261150
  });
261131
261151
  return {
261132
- output: `Media job ${job.id} accepted with status ${job.status}. ${REQUEST_NOTE}`,
261152
+ output: `Media job ${job.id} accepted with status ${job.status}. ${this.requestNote}`,
261133
261153
  isError: false
261134
261154
  };
261135
261155
  } catch (error) {
@@ -261173,10 +261193,109 @@ var init_blun_media$1 = __esmMin((() => {
261173
261193
  return this.provider.generateSpeech(args.input, options);
261174
261194
  }
261175
261195
  };
261196
+ UnderstandImageTool = class {
261197
+ provider;
261198
+ kaos;
261199
+ workspace;
261200
+ name = "UnderstandImage";
261201
+ description = "Understand or describe a local PNG or JPEG with the protected BLUN image reader. Use this whenever the user sends or references an image path and the current model cannot inspect the image directly. This uploads the file to BLUN and starts a billed asynchronous job.";
261202
+ parameters = toInputJsonSchema(UnderstandImageInputSchema);
261203
+ constructor(provider, kaos, workspace) {
261204
+ this.provider = provider;
261205
+ this.kaos = kaos;
261206
+ this.workspace = workspace;
261207
+ }
261208
+ resolveExecution(args) {
261209
+ const path = resolvePathAccessPath(args.path, {
261210
+ kaos: this.kaos,
261211
+ workspace: this.workspace,
261212
+ operation: "read"
261213
+ });
261214
+ return {
261215
+ accesses: ToolAccesses.readFile(path),
261216
+ description: `Understand image: ${args.path}`,
261217
+ display: {
261218
+ kind: "file_io",
261219
+ operation: "read",
261220
+ path
261221
+ },
261222
+ approvalRule: literalRulePattern(this.name, path),
261223
+ matchesRule: (ruleArgs) => matchesPathRuleSubject(ruleArgs, path, {
261224
+ cwd: this.workspace.workspaceDir,
261225
+ pathClass: this.kaos.pathClass(),
261226
+ homeDir: this.kaos.gethome()
261227
+ }),
261228
+ execute: (ctx) => this.execution(args, path, ctx)
261229
+ };
261230
+ }
261231
+ async execution(args, safePath, ctx) {
261232
+ try {
261233
+ const fileType = detectFileType(safePath, await this.kaos.readBytes(safePath, 512), "media");
261234
+ if (fileType.mimeType !== "image/png" && fileType.mimeType !== "image/jpeg") return {
261235
+ isError: true,
261236
+ output: "Image understanding accepts only PNG or JPEG files."
261237
+ };
261238
+ const data = await this.kaos.readBytes(safePath);
261239
+ if (data.byteLength === 0) return {
261240
+ isError: true,
261241
+ output: `"${args.path}" is empty.`
261242
+ };
261243
+ const options = {
261244
+ signal: ctx.signal,
261245
+ toolCallId: ctx.toolCallId
261246
+ };
261247
+ const upload = await this.provider.uploadMedia(data, fileType.mimeType, options);
261248
+ const job = await this.provider.understandImage(upload.id, args.prompt, options);
261249
+ return {
261250
+ output: `Media job ${job.id} accepted with status ${job.status}. ${REQUEST_NOTE}`,
261251
+ isError: false
261252
+ };
261253
+ } catch (error) {
261254
+ return {
261255
+ isError: true,
261256
+ output: `Image understanding failed: ${errorMessage$10(error)}`
261257
+ };
261258
+ }
261259
+ }
261260
+ };
261261
+ UnderstandVideoTool = class extends MediaGenerationTool {
261262
+ name = "UnderstandVideo";
261263
+ description = "Understand or describe an existing completed BLUN video. The source must be an id returned by a media generation tool. If the source is still processing, retry only when the server explicitly says Retryable: yes.";
261264
+ parameters = toInputJsonSchema(UnderstandVideoInputSchema);
261265
+ subject(args) {
261266
+ return `${args.media_id}: ${args.prompt ?? "general description"}`;
261267
+ }
261268
+ submit(args, options) {
261269
+ return this.provider.understandVideo(args.media_id, args.prompt, options);
261270
+ }
261271
+ };
261272
+ DubVideoTool = class extends MediaGenerationTool {
261273
+ name = "DubVideo";
261274
+ description = "Create a soundtrack for an existing completed BLUN video. The source must be an id returned by a media generation tool. If the source is still processing, retry only when the server explicitly says Retryable: yes.";
261275
+ parameters = toInputJsonSchema(DubVideoInputSchema);
261276
+ subject(args) {
261277
+ return `${args.media_id}: ${args.input}`;
261278
+ }
261279
+ submit(args, options) {
261280
+ return this.provider.dubVideo(args.media_id, args.input, options);
261281
+ }
261282
+ };
261283
+ LipSyncMediaTool = class extends MediaGenerationTool {
261284
+ name = "LipSyncMedia";
261285
+ description = "Create lip-synchronized video from an owned completed image or video id and an owned completed audio id. Before calling, tell the user that this billed job can take up to 35 minutes and currently has no percentage progress.";
261286
+ parameters = toInputJsonSchema(LipSyncMediaInputSchema);
261287
+ requestNote = LIPSYNC_REQUEST_NOTE;
261288
+ subject(args) {
261289
+ return `${args.image_id} + ${args.audio_id}`;
261290
+ }
261291
+ submit(args, options) {
261292
+ return this.provider.lipSyncMedia(args.image_id, args.audio_id, options);
261293
+ }
261294
+ };
261176
261295
  GetMediaTool = class {
261177
261296
  provider;
261178
261297
  name = "GetMedia";
261179
- description = "Check a BLUN media job. If it is complete, return the generated image, audio, or video. Use only ids returned by GenerateImage, GenerateVideo, or GenerateSpeech.";
261298
+ description = "Check a BLUN media job. If it is complete, return the generated image, audio, or video. Use only ids returned by BLUN media tools.";
261180
261299
  parameters = toInputJsonSchema(GetMediaInputSchema);
261181
261300
  constructor(provider) {
261182
261301
  this.provider = provider;
@@ -261690,6 +261809,10 @@ var init_tool$1 = __esmMin((() => {
261690
261809
  toolServices?.media && new GenerateImageTool(toolServices.media),
261691
261810
  toolServices?.media && new GenerateVideoTool(toolServices.media),
261692
261811
  toolServices?.media && new GenerateSpeechTool(toolServices.media),
261812
+ toolServices?.media && new UnderstandImageTool(toolServices.media, kaos, workspace),
261813
+ toolServices?.media && new UnderstandVideoTool(toolServices.media),
261814
+ toolServices?.media && new DubVideoTool(toolServices.media),
261815
+ toolServices?.media && new LipSyncMediaTool(toolServices.media),
261693
261816
  toolServices?.media && new GetMediaTool(toolServices.media),
261694
261817
  new MistakeRecordTool(this.agent),
261695
261818
  new CodebaseSearchTool(cwd)
@@ -292243,7 +292366,7 @@ var init_proxy = __esmMin((() => {
292243
292366
  var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
292244
292367
  module.exports = isexe;
292245
292368
  isexe.sync = sync;
292246
- var fs$9 = __require("fs");
292369
+ var fs$8 = __require("fs");
292247
292370
  function checkPathExt(path, options) {
292248
292371
  var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
292249
292372
  if (!pathext) return true;
@@ -292260,12 +292383,12 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
292260
292383
  return checkPathExt(path, options);
292261
292384
  }
292262
292385
  function isexe(path, options, cb) {
292263
- fs$9.stat(path, function(er, stat) {
292386
+ fs$8.stat(path, function(er, stat) {
292264
292387
  cb(er, er ? false : checkStat(stat, path, options));
292265
292388
  });
292266
292389
  }
292267
292390
  function sync(path, options) {
292268
- return checkStat(fs$9.statSync(path), path, options);
292391
+ return checkStat(fs$8.statSync(path), path, options);
292269
292392
  }
292270
292393
  }));
292271
292394
  //#endregion
@@ -292273,14 +292396,14 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
292273
292396
  var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
292274
292397
  module.exports = isexe;
292275
292398
  isexe.sync = sync;
292276
- var fs$8 = __require("fs");
292399
+ var fs$7 = __require("fs");
292277
292400
  function isexe(path, options, cb) {
292278
- fs$8.stat(path, function(er, stat) {
292401
+ fs$7.stat(path, function(er, stat) {
292279
292402
  cb(er, er ? false : checkStat(stat, options));
292280
292403
  });
292281
292404
  }
292282
292405
  function sync(path, options) {
292283
- return checkStat(fs$8.statSync(path), options);
292406
+ return checkStat(fs$7.statSync(path), options);
292284
292407
  }
292285
292408
  function checkStat(stat, options) {
292286
292409
  return stat.isFile() && checkMode(stat, options);
@@ -292495,16 +292618,16 @@ var require_shebang_command = /* @__PURE__ */ __commonJSMin(((exports, module) =
292495
292618
  //#endregion
292496
292619
  //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
292497
292620
  var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
292498
- const fs$7 = __require("fs");
292621
+ const fs$6 = __require("fs");
292499
292622
  const shebangCommand = require_shebang_command();
292500
292623
  function readShebang(command) {
292501
292624
  const size = 150;
292502
292625
  const buffer = Buffer.alloc(size);
292503
292626
  let fd;
292504
292627
  try {
292505
- fd = fs$7.openSync(command, "r");
292506
- fs$7.readSync(fd, buffer, 0, size, 0);
292507
- fs$7.closeSync(fd);
292628
+ fd = fs$6.openSync(command, "r");
292629
+ fs$6.readSync(fd, buffer, 0, size, 0);
292630
+ fs$6.closeSync(fd);
292508
292631
  } catch (e) {}
292509
292632
  return shebangCommand(buffer.toString());
292510
292633
  }
@@ -309127,6 +309250,15 @@ var init_blun_web_search = __esmMin((() => {
309127
309250
  }));
309128
309251
  //#endregion
309129
309252
  //#region ../../packages/agent-core/src/tools/providers/blun-media.ts
309253
+ async function blockedSubmissionError(response) {
309254
+ let payload = {};
309255
+ try {
309256
+ payload = await response.json();
309257
+ } catch {}
309258
+ const sourceStatus = typeof payload["source_status"] === "string" ? payload["source_status"] : "unknown";
309259
+ const retryable = payload["retryable"];
309260
+ return /* @__PURE__ */ new Error(`Source media is not ready. Source status: ${sourceStatus}.${typeof retryable === "boolean" ? ` Retryable: ${retryable ? "yes" : "no"}.` : " Retryable: unknown."}`);
309261
+ }
309130
309262
  async function parseBlockedStatus(response, id) {
309131
309263
  let payload = {};
309132
309264
  try {
@@ -309165,6 +309297,7 @@ function parseStatus(payload, expectedId) {
309165
309297
  }
309166
309298
  async function assertSuccess(response, operation) {
309167
309299
  if (response.ok) return;
309300
+ if (response.status === 402) throw new Error(`${operation} was rejected (HTTP 402); the cause was not verified.`);
309168
309301
  let detail = "";
309169
309302
  try {
309170
309303
  detail = (await response.text()).trim();
@@ -309197,6 +309330,37 @@ var init_blun_media = __esmMin((() => {
309197
309330
  generateSpeech(input, options) {
309198
309331
  return this.submit("/audio/speech", { input }, options);
309199
309332
  }
309333
+ async uploadMedia(data, mimeType, options) {
309334
+ const response = await this.request("/media/upload", {
309335
+ method: "POST",
309336
+ body: data,
309337
+ contentType: mimeType
309338
+ }, options);
309339
+ await assertSuccess(response, "Media upload");
309340
+ return parseJob(await response.json());
309341
+ }
309342
+ understandImage(imageId, prompt, options) {
309343
+ const body = { image_id: imageId };
309344
+ if (prompt !== void 0 && prompt.length > 0) body["prompt"] = prompt;
309345
+ return this.submit("/images/understand", body, options);
309346
+ }
309347
+ understandVideo(mediaId, prompt, options) {
309348
+ const body = { media_id: mediaId };
309349
+ if (prompt !== void 0 && prompt.length > 0) body["prompt"] = prompt;
309350
+ return this.submit("/videos/understand", body, options);
309351
+ }
309352
+ dubVideo(mediaId, input, options) {
309353
+ return this.submit("/videos/dub", {
309354
+ media_id: mediaId,
309355
+ input
309356
+ }, options);
309357
+ }
309358
+ lipSyncMedia(imageId, audioId, options) {
309359
+ return this.submit("/videos/lipsync", {
309360
+ image_id: imageId,
309361
+ audio_id: audioId
309362
+ }, options);
309363
+ }
309200
309364
  async getMedia(id, options) {
309201
309365
  const response = await this.request(`/media/${encodeURIComponent(id)}`, { method: "GET" }, options);
309202
309366
  if (response.status === 409) return parseBlockedStatus(response, id);
@@ -309221,6 +309385,7 @@ var init_blun_media = __esmMin((() => {
309221
309385
  method: "POST",
309222
309386
  body: JSON.stringify(body)
309223
309387
  }, options);
309388
+ if (response.status === 409) throw await blockedSubmissionError(response);
309224
309389
  await assertSuccess(response, "Media request");
309225
309390
  return parseJob(await response.json());
309226
309391
  }
@@ -309232,13 +309397,14 @@ var init_blun_media = __esmMin((() => {
309232
309397
  return this.fetchWithToken(path, init, options, refreshed);
309233
309398
  }
309234
309399
  fetchWithToken(path, init, options, token) {
309400
+ const { contentType, ...requestInit } = init;
309235
309401
  return this.fetchImpl(`${this.baseUrl}${path}`, {
309236
- ...init,
309402
+ ...requestInit,
309237
309403
  signal: options?.signal,
309238
309404
  headers: {
309239
309405
  ...this.defaultHeaders,
309240
309406
  Authorization: `Bearer ${token}`,
309241
- ...init.body === void 0 ? {} : { "Content-Type": "application/json" },
309407
+ ...init.body === void 0 ? {} : { "Content-Type": contentType ?? "application/json" },
309242
309408
  ...options?.toolCallId === void 0 ? {} : { "X-Msh-Tool-Call-Id": options.toolCallId },
309243
309409
  ...this.customHeaders
309244
309410
  }
@@ -309625,7 +309791,7 @@ var require_dist$5 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
309625
309791
  //#endregion
309626
309792
  //#region ../../node_modules/.pnpm/yazl@3.3.1/node_modules/yazl/index.js
309627
309793
  var require_yazl = /* @__PURE__ */ __commonJSMin(((exports) => {
309628
- var fs$6 = __require("fs");
309794
+ var fs$5 = __require("fs");
309629
309795
  var Transform$2 = __require("stream").Transform;
309630
309796
  var PassThrough$2 = __require("stream").PassThrough;
309631
309797
  var zlib$1 = __require("zlib");
@@ -309654,14 +309820,14 @@ var require_yazl = /* @__PURE__ */ __commonJSMin(((exports) => {
309654
309820
  if (shouldIgnoreAdding(self)) return;
309655
309821
  var entry = new Entry(metadataPath, false, options);
309656
309822
  self.entries.push(entry);
309657
- fs$6.stat(realPath, function(err, stats) {
309823
+ fs$5.stat(realPath, function(err, stats) {
309658
309824
  if (err) return self.emit("error", err);
309659
309825
  if (!stats.isFile()) return self.emit("error", /* @__PURE__ */ new Error("not a file: " + realPath));
309660
309826
  entry.uncompressedSize = stats.size;
309661
309827
  if (options.mtime == null) entry.setLastModDate(stats.mtime);
309662
309828
  if (options.mode == null) entry.setFileAttributesMode(stats.mode);
309663
309829
  entry.setFileDataPumpFunction(function() {
309664
- var readStream = fs$6.createReadStream(realPath);
309830
+ var readStream = fs$5.createReadStream(realPath);
309665
309831
  entry.state = Entry.FILE_DATA_IN_PROGRESS;
309666
309832
  readStream.on("error", function(err) {
309667
309833
  self.emit("error", err);
@@ -326240,7 +326406,7 @@ var require_command = /* @__PURE__ */ __commonJSMin(((exports) => {
326240
326406
  const EventEmitter$12 = __require("node:events").EventEmitter;
326241
326407
  const childProcess = __require("node:child_process");
326242
326408
  const path$7 = __require("node:path");
326243
- const fs$5 = __require("node:fs");
326409
+ const fs$4 = __require("node:fs");
326244
326410
  const process$2 = __require("node:process");
326245
326411
  const { Argument, humanReadableArgName } = require_argument();
326246
326412
  const { CommanderError } = require_error$2();
@@ -327123,7 +327289,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
327123
327289
  * @param {string} subcommandName
327124
327290
  */
327125
327291
  _checkForMissingExecutable(executableFile, executableDir, subcommandName) {
327126
- if (fs$5.existsSync(executableFile)) return;
327292
+ if (fs$4.existsSync(executableFile)) return;
327127
327293
  const executableMissing = `'${executableFile}' does not exist
327128
327294
  - if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
327129
327295
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
@@ -327147,9 +327313,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
327147
327313
  ];
327148
327314
  function findFile(baseDir, baseName) {
327149
327315
  const localBin = path$7.resolve(baseDir, baseName);
327150
- if (fs$5.existsSync(localBin)) return localBin;
327316
+ if (fs$4.existsSync(localBin)) return localBin;
327151
327317
  if (sourceExt.includes(path$7.extname(baseName))) return void 0;
327152
- const foundExt = sourceExt.find((ext) => fs$5.existsSync(`${localBin}${ext}`));
327318
+ const foundExt = sourceExt.find((ext) => fs$4.existsSync(`${localBin}${ext}`));
327153
327319
  if (foundExt) return `${localBin}${foundExt}`;
327154
327320
  }
327155
327321
  this._checkForMissingMandatoryOptions();
@@ -327159,7 +327325,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
327159
327325
  if (this._scriptPath) {
327160
327326
  let resolvedScriptPath;
327161
327327
  try {
327162
- resolvedScriptPath = fs$5.realpathSync(this._scriptPath);
327328
+ resolvedScriptPath = fs$4.realpathSync(this._scriptPath);
327163
327329
  } catch {
327164
327330
  resolvedScriptPath = this._scriptPath;
327165
327331
  }
@@ -345458,7 +345624,7 @@ var require_atomic_sleep = /* @__PURE__ */ __commonJSMin(((exports, module) => {
345458
345624
  //#endregion
345459
345625
  //#region ../../node_modules/.pnpm/sonic-boom@4.2.1/node_modules/sonic-boom/index.js
345460
345626
  var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
345461
- const fs$4 = __require("fs");
345627
+ const fs$3 = __require("fs");
345462
345628
  const EventEmitter$10 = __require("events");
345463
345629
  const inherits$6 = __require("util").inherits;
345464
345630
  const path$6 = __require("path");
@@ -345501,17 +345667,17 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
345501
345667
  const flags = sonic.append ? "a" : "w";
345502
345668
  const mode = sonic.mode;
345503
345669
  if (sonic.sync) try {
345504
- if (sonic.mkdir) fs$4.mkdirSync(path$6.dirname(file), { recursive: true });
345505
- fileOpened(null, fs$4.openSync(file, flags, mode));
345670
+ if (sonic.mkdir) fs$3.mkdirSync(path$6.dirname(file), { recursive: true });
345671
+ fileOpened(null, fs$3.openSync(file, flags, mode));
345506
345672
  } catch (err) {
345507
345673
  fileOpened(err);
345508
345674
  throw err;
345509
345675
  }
345510
- else if (sonic.mkdir) fs$4.mkdir(path$6.dirname(file), { recursive: true }, (err) => {
345676
+ else if (sonic.mkdir) fs$3.mkdir(path$6.dirname(file), { recursive: true }, (err) => {
345511
345677
  if (err) return fileOpened(err);
345512
- fs$4.open(file, flags, mode, fileOpened);
345678
+ fs$3.open(file, flags, mode, fileOpened);
345513
345679
  });
345514
- else fs$4.open(file, flags, mode, fileOpened);
345680
+ else fs$3.open(file, flags, mode, fileOpened);
345515
345681
  }
345516
345682
  function SonicBoom(opts) {
345517
345683
  if (!(this instanceof SonicBoom)) return new SonicBoom(opts);
@@ -345549,8 +345715,8 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
345549
345715
  this.flush = flushBuffer;
345550
345716
  this.flushSync = flushBufferSync;
345551
345717
  this._actualWrite = actualWriteBuffer;
345552
- fsWriteSync = () => fs$4.writeSync(this.fd, this._writingBuf);
345553
- fsWrite = () => fs$4.write(this.fd, this._writingBuf, this.release);
345718
+ fsWriteSync = () => fs$3.writeSync(this.fd, this._writingBuf);
345719
+ fsWrite = () => fs$3.write(this.fd, this._writingBuf, this.release);
345554
345720
  } else if (contentMode === void 0 || contentMode === kContentModeUtf8) {
345555
345721
  this._writingBuf = "";
345556
345722
  this.write = write;
@@ -345558,12 +345724,12 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
345558
345724
  this.flushSync = flushSync;
345559
345725
  this._actualWrite = actualWrite;
345560
345726
  fsWriteSync = () => {
345561
- if (Buffer.isBuffer(this._writingBuf)) return fs$4.writeSync(this.fd, this._writingBuf);
345562
- return fs$4.writeSync(this.fd, this._writingBuf, "utf8");
345727
+ if (Buffer.isBuffer(this._writingBuf)) return fs$3.writeSync(this.fd, this._writingBuf);
345728
+ return fs$3.writeSync(this.fd, this._writingBuf, "utf8");
345563
345729
  };
345564
345730
  fsWrite = () => {
345565
- if (Buffer.isBuffer(this._writingBuf)) return fs$4.write(this.fd, this._writingBuf, this.release);
345566
- return fs$4.write(this.fd, this._writingBuf, "utf8", this.release);
345731
+ if (Buffer.isBuffer(this._writingBuf)) return fs$3.write(this.fd, this._writingBuf, this.release);
345732
+ return fs$3.write(this.fd, this._writingBuf, "utf8", this.release);
345567
345733
  };
345568
345734
  } else throw new Error(`SonicBoom supports "${kContentModeUtf8}" and "${kContentModeBuffer}", but passed ${contentMode}`);
345569
345735
  if (typeof fd === "number") {
@@ -345608,7 +345774,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
345608
345774
  return;
345609
345775
  }
345610
345776
  }
345611
- if (this._fsync) fs$4.fsyncSync(this.fd);
345777
+ if (this._fsync) fs$3.fsyncSync(this.fd);
345612
345778
  const len = this._len;
345613
345779
  if (this._reopening) {
345614
345780
  this._writing = false;
@@ -345705,7 +345871,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
345705
345871
  this._flushPending = true;
345706
345872
  const onDrain = () => {
345707
345873
  if (!this._fsync) try {
345708
- fs$4.fsync(this.fd, (err) => {
345874
+ fs$3.fsync(this.fd, (err) => {
345709
345875
  this._flushPending = false;
345710
345876
  cb(err);
345711
345877
  });
@@ -345782,7 +345948,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
345782
345948
  if (this._writing) return;
345783
345949
  const fd = this.fd;
345784
345950
  this.once("ready", () => {
345785
- if (fd !== this.fd) fs$4.close(fd, (err) => {
345951
+ if (fd !== this.fd) fs$3.close(fd, (err) => {
345786
345952
  if (err) return this.emit("error", err);
345787
345953
  });
345788
345954
  });
@@ -345813,7 +345979,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
345813
345979
  while (this._bufs.length || buf.length) {
345814
345980
  if (buf.length <= 0) buf = this._bufs[0];
345815
345981
  try {
345816
- const n = Buffer.isBuffer(buf) ? fs$4.writeSync(this.fd, buf) : fs$4.writeSync(this.fd, buf, "utf8");
345982
+ const n = Buffer.isBuffer(buf) ? fs$3.writeSync(this.fd, buf) : fs$3.writeSync(this.fd, buf, "utf8");
345817
345983
  const releasedBufObj = releaseWritingBuf(buf, this._len, n);
345818
345984
  buf = releasedBufObj.writingBuf;
345819
345985
  this._len = releasedBufObj.len;
@@ -345824,7 +345990,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
345824
345990
  }
345825
345991
  }
345826
345992
  try {
345827
- fs$4.fsyncSync(this.fd);
345993
+ fs$3.fsyncSync(this.fd);
345828
345994
  } catch {}
345829
345995
  }
345830
345996
  function flushBufferSync() {
@@ -345838,7 +346004,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
345838
346004
  while (this._bufs.length || buf.length) {
345839
346005
  if (buf.length <= 0) buf = mergeBuf(this._bufs[0], this._lens[0]);
345840
346006
  try {
345841
- const n = fs$4.writeSync(this.fd, buf);
346007
+ const n = fs$3.writeSync(this.fd, buf);
345842
346008
  buf = buf.subarray(n);
345843
346009
  this._len = Math.max(this._len - n, 0);
345844
346010
  if (buf.length <= 0) {
@@ -345860,24 +346026,24 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
345860
346026
  this._writing = true;
345861
346027
  this._writingBuf = this._writingBuf.length ? this._writingBuf : this._bufs.shift() || "";
345862
346028
  if (this.sync) try {
345863
- release(null, Buffer.isBuffer(this._writingBuf) ? fs$4.writeSync(this.fd, this._writingBuf) : fs$4.writeSync(this.fd, this._writingBuf, "utf8"));
346029
+ release(null, Buffer.isBuffer(this._writingBuf) ? fs$3.writeSync(this.fd, this._writingBuf) : fs$3.writeSync(this.fd, this._writingBuf, "utf8"));
345864
346030
  } catch (err) {
345865
346031
  release(err);
345866
346032
  }
345867
- else fs$4.write(this.fd, this._writingBuf, release);
346033
+ else fs$3.write(this.fd, this._writingBuf, release);
345868
346034
  }
345869
346035
  function actualWriteBuffer() {
345870
346036
  const release = this.release;
345871
346037
  this._writing = true;
345872
346038
  this._writingBuf = this._writingBuf.length ? this._writingBuf : mergeBuf(this._bufs.shift(), this._lens.shift());
345873
346039
  if (this.sync) try {
345874
- release(null, fs$4.writeSync(this.fd, this._writingBuf));
346040
+ release(null, fs$3.writeSync(this.fd, this._writingBuf));
345875
346041
  } catch (err) {
345876
346042
  release(err);
345877
346043
  }
345878
346044
  else {
345879
346045
  if (kCopyBuffer) this._writingBuf = Buffer.from(this._writingBuf);
345880
- fs$4.write(this.fd, this._writingBuf, release);
346046
+ fs$3.write(this.fd, this._writingBuf, release);
345881
346047
  }
345882
346048
  }
345883
346049
  function actualClose(sonic) {
@@ -345891,10 +346057,10 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
345891
346057
  sonic._lens = [];
345892
346058
  assert$8(typeof sonic.fd === "number", `sonic.fd must be a number, got ${typeof sonic.fd}`);
345893
346059
  try {
345894
- fs$4.fsync(sonic.fd, closeWrapped);
346060
+ fs$3.fsync(sonic.fd, closeWrapped);
345895
346061
  } catch {}
345896
346062
  function closeWrapped() {
345897
- if (sonic.fd !== 1 && sonic.fd !== 2) fs$4.close(sonic.fd, done);
346063
+ if (sonic.fd !== 1 && sonic.fd !== 2) fs$3.close(sonic.fd, done);
345898
346064
  else done();
345899
346065
  }
345900
346066
  function done(err) {
@@ -368517,7 +368683,7 @@ var require_constants$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
368517
368683
  //#endregion
368518
368684
  //#region ../../../../node_modules/node-gyp-build/node-gyp-build.js
368519
368685
  var require_node_gyp_build$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
368520
- var fs$3 = __require("fs");
368686
+ var fs$2 = __require("fs");
368521
368687
  var path$5 = __require("path");
368522
368688
  var os$3 = __require("os");
368523
368689
  var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
@@ -368573,7 +368739,7 @@ var require_node_gyp_build$1 = /* @__PURE__ */ __commonJSMin(((exports, module)
368573
368739
  };
368574
368740
  function readdirSync(dir) {
368575
368741
  try {
368576
- return fs$3.readdirSync(dir);
368742
+ return fs$2.readdirSync(dir);
368577
368743
  } catch (err) {
368578
368744
  return [];
368579
368745
  }
@@ -368661,7 +368827,7 @@ var require_node_gyp_build$1 = /* @__PURE__ */ __commonJSMin(((exports, module)
368661
368827
  return typeof window !== "undefined" && window.process && window.process.type === "renderer";
368662
368828
  }
368663
368829
  function isAlpine(platform) {
368664
- return platform === "linux" && fs$3.existsSync("/etc/alpine-release");
368830
+ return platform === "linux" && fs$2.existsSync("/etc/alpine-release");
368665
368831
  }
368666
368832
  load.parseTags = parseTags;
368667
368833
  load.matchTags = matchTags;
@@ -388814,7 +388980,7 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
388814
388980
  //#region ../../node_modules/.pnpm/@fastify+swagger@9.7.0/node_modules/@fastify/swagger/lib/mode/static.js
388815
388981
  var require_static = /* @__PURE__ */ __commonJSMin(((exports, module) => {
388816
388982
  const path$3 = __require("node:path");
388817
- const fs$2 = __require("node:fs");
388983
+ const fs$1 = __require("node:fs");
388818
388984
  const yaml = require_dist$1();
388819
388985
  module.exports = function(fastify, opts, done) {
388820
388986
  if (!opts.specification) return done(/* @__PURE__ */ new Error("specification is missing in the module options"));
@@ -388823,14 +388989,14 @@ var require_static = /* @__PURE__ */ __commonJSMin(((exports, module) => {
388823
388989
  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"));
388824
388990
  else if (opts.specification.path) {
388825
388991
  if (typeof opts.specification.path !== "string") return done(/* @__PURE__ */ new Error("specification.path is not a string"));
388826
- if (!fs$2.existsSync(path$3.resolve(opts.specification.path))) return done(/* @__PURE__ */ new Error(`${opts.specification.path} does not exist`));
388992
+ if (!fs$1.existsSync(path$3.resolve(opts.specification.path))) return done(/* @__PURE__ */ new Error(`${opts.specification.path} does not exist`));
388827
388993
  const extName = path$3.extname(opts.specification.path).toLowerCase();
388828
388994
  if ([".yaml", ".json"].indexOf(extName) === -1) return done(/* @__PURE__ */ new Error("specification.path extension name is not supported, should be one from ['.yaml', '.json']"));
388829
388995
  if (opts.specification.postProcessor && typeof opts.specification.postProcessor !== "function") return done(/* @__PURE__ */ new Error("specification.postProcessor should be a function"));
388830
388996
  if (opts.specification.baseDir && typeof opts.specification.baseDir !== "string") return done(/* @__PURE__ */ new Error("specification.baseDir should be string"));
388831
388997
  if (!opts.specification.baseDir) opts.specification.baseDir = path$3.resolve(path$3.dirname(opts.specification.path));
388832
388998
  else while (opts.specification.baseDir.endsWith("/")) opts.specification.baseDir = opts.specification.baseDir.slice(0, -1);
388833
- const source = fs$2.readFileSync(path$3.resolve(opts.specification.path), "utf8");
388999
+ const source = fs$1.readFileSync(path$3.resolve(opts.specification.path), "utf8");
388834
389000
  switch (extName) {
388835
389001
  case ".yaml":
388836
389002
  swaggerObject = yaml.parse(source);
@@ -389097,11 +389263,11 @@ var require_should_route_hide = /* @__PURE__ */ __commonJSMin(((exports, module)
389097
389263
  //#endregion
389098
389264
  //#region ../../node_modules/.pnpm/@fastify+swagger@9.7.0/node_modules/@fastify/swagger/lib/util/read-package-json.js
389099
389265
  var require_read_package_json = /* @__PURE__ */ __commonJSMin(((exports, module) => {
389100
- const fs$1 = __require("node:fs");
389266
+ const fs = __require("node:fs");
389101
389267
  const path$2 = __require("node:path");
389102
389268
  function readPackageJson() {
389103
389269
  try {
389104
- return JSON.parse(fs$1.readFileSync(path$2.join(__dirname, "..", "..", "package.json")));
389270
+ return JSON.parse(fs.readFileSync(path$2.join(__dirname, "..", "..", "package.json")));
389105
389271
  } catch {
389106
389272
  return {};
389107
389273
  }
@@ -404051,7 +404217,7 @@ var TUI = class TUI extends Container {
404051
404217
  if (!debugRedraw) return;
404052
404218
  const logPath = path$17.join(nodeOs.homedir(), ".pi", "agent", "pi-debug.log");
404053
404219
  const msg = `[${(/* @__PURE__ */ new Date()).toISOString()}] fullRender: ${reason} (prev=${this.previousLines.length}, new=${newLines.length}, height=${height})\n`;
404054
- fs$17.appendFileSync(logPath, msg);
404220
+ fs$16.appendFileSync(logPath, msg);
404055
404221
  };
404056
404222
  if (this.previousLines.length === 0 && !widthChanged && !heightChanged) {
404057
404223
  logRedraw("first render");
@@ -404198,7 +404364,7 @@ var TUI = class TUI extends Container {
404198
404364
  buffer += "\x1B[?2026l";
404199
404365
  if (process.env["PI_TUI_DEBUG"] === "1") {
404200
404366
  const debugDir = "/tmp/tui";
404201
- fs$17.mkdirSync(debugDir, { recursive: true });
404367
+ fs$16.mkdirSync(debugDir, { recursive: true });
404202
404368
  const debugPath = path$17.join(debugDir, `render-${Date.now()}-${Math.random().toString(36).slice(2)}.log`);
404203
404369
  const debugData = [
404204
404370
  `firstChanged: ${firstChanged}`,
@@ -404222,7 +404388,7 @@ var TUI = class TUI extends Container {
404222
404388
  "=== buffer ===",
404223
404389
  JSON.stringify(buffer)
404224
404390
  ].join("\n");
404225
- fs$17.writeFileSync(debugPath, debugData);
404391
+ fs$16.writeFileSync(debugPath, debugData);
404226
404392
  }
404227
404393
  this.terminal.write(buffer);
404228
404394
  this.cursorRow = Math.max(0, newLines.length - 1);
@@ -408881,7 +409047,7 @@ var ProcessTerminal = class {
408881
409047
  const env = process.env["PI_TUI_WRITE_LOG"] || "";
408882
409048
  if (!env) return "";
408883
409049
  try {
408884
- if (fs$17.statSync(env).isDirectory()) {
409050
+ if (fs$16.statSync(env).isDirectory()) {
408885
409051
  const now = /* @__PURE__ */ new Date();
408886
409052
  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")}`;
408887
409053
  return path$17.join(env, `tui-${ts}-${process.pid}.log`);
@@ -409164,7 +409330,7 @@ var ProcessTerminal = class {
409164
409330
  write(data) {
409165
409331
  process.stdout.write(data);
409166
409332
  if (this.writeLogPath) try {
409167
- fs$17.appendFileSync(this.writeLogPath, data, { encoding: "utf8" });
409333
+ fs$16.appendFileSync(this.writeLogPath, data, { encoding: "utf8" });
409168
409334
  } catch {}
409169
409335
  }
409170
409336
  get columns() {
@@ -498237,7 +498403,7 @@ var EditorKeyboardController = class {
498237
498403
  host.toggleTodoPanelExpansion();
498238
498404
  return;
498239
498405
  }
498240
- if (host.state.appState.streamingPhase === "idle" || host.state.appState.streamingPhase === "shell" || host.state.appState.isCompacting) return;
498406
+ if (host.state.appState.streamingPhase === "idle") return;
498241
498407
  host.flushQueuedMessages(editor.getText().trim(), editor.inputMode);
498242
498408
  host.updateQueueDisplay();
498243
498409
  host.state.ui.requestRender();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.21",
3
+ "version": "9.1.23",
4
4
  "description": "BLUN CLI - your own AI agent with a Telegram channel. Get it done. With BLUN.",
5
5
  "license": "MIT",
6
6
  "bin": {