blun-king-cli 9.1.22 → 9.1.24

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/blun.mjs CHANGED
@@ -1,19 +1,19 @@
1
1
  #!/usr/bin/env node
2
- // BLUN_BUILD_INPUT_SHA256:18b6ba1c5baca9739e0e2b5c280d073bac714589178a987d0bc9fd63d56020f0
2
+ // BLUN_BUILD_INPUT_SHA256:420510ac14726514cc4725577c2fe8d0fd038c1471bdbda1c15ace32f3ceaba0
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;
@@ -261209,6 +261328,10 @@ var init_blun_media$1 = __esmMin((() => {
261209
261328
  isError: terminalError
261210
261329
  };
261211
261330
  }
261331
+ if (result.kind === "text") return {
261332
+ output: result.text,
261333
+ isError: false
261334
+ };
261212
261335
  const url = `data:${result.mimeType};base64,${Buffer.from(result.data).toString("base64")}`;
261213
261336
  const mediaPart = contentPartFor(result.mimeType, url);
261214
261337
  if (mediaPart === void 0) return {
@@ -261690,6 +261813,10 @@ var init_tool$1 = __esmMin((() => {
261690
261813
  toolServices?.media && new GenerateImageTool(toolServices.media),
261691
261814
  toolServices?.media && new GenerateVideoTool(toolServices.media),
261692
261815
  toolServices?.media && new GenerateSpeechTool(toolServices.media),
261816
+ toolServices?.media && new UnderstandImageTool(toolServices.media, kaos, workspace),
261817
+ toolServices?.media && new UnderstandVideoTool(toolServices.media),
261818
+ toolServices?.media && new DubVideoTool(toolServices.media),
261819
+ toolServices?.media && new LipSyncMediaTool(toolServices.media),
261693
261820
  toolServices?.media && new GetMediaTool(toolServices.media),
261694
261821
  new MistakeRecordTool(this.agent),
261695
261822
  new CodebaseSearchTool(cwd)
@@ -292243,7 +292370,7 @@ var init_proxy = __esmMin((() => {
292243
292370
  var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
292244
292371
  module.exports = isexe;
292245
292372
  isexe.sync = sync;
292246
- var fs$9 = __require("fs");
292373
+ var fs$8 = __require("fs");
292247
292374
  function checkPathExt(path, options) {
292248
292375
  var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
292249
292376
  if (!pathext) return true;
@@ -292260,12 +292387,12 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
292260
292387
  return checkPathExt(path, options);
292261
292388
  }
292262
292389
  function isexe(path, options, cb) {
292263
- fs$9.stat(path, function(er, stat) {
292390
+ fs$8.stat(path, function(er, stat) {
292264
292391
  cb(er, er ? false : checkStat(stat, path, options));
292265
292392
  });
292266
292393
  }
292267
292394
  function sync(path, options) {
292268
- return checkStat(fs$9.statSync(path), path, options);
292395
+ return checkStat(fs$8.statSync(path), path, options);
292269
292396
  }
292270
292397
  }));
292271
292398
  //#endregion
@@ -292273,14 +292400,14 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
292273
292400
  var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
292274
292401
  module.exports = isexe;
292275
292402
  isexe.sync = sync;
292276
- var fs$8 = __require("fs");
292403
+ var fs$7 = __require("fs");
292277
292404
  function isexe(path, options, cb) {
292278
- fs$8.stat(path, function(er, stat) {
292405
+ fs$7.stat(path, function(er, stat) {
292279
292406
  cb(er, er ? false : checkStat(stat, options));
292280
292407
  });
292281
292408
  }
292282
292409
  function sync(path, options) {
292283
- return checkStat(fs$8.statSync(path), options);
292410
+ return checkStat(fs$7.statSync(path), options);
292284
292411
  }
292285
292412
  function checkStat(stat, options) {
292286
292413
  return stat.isFile() && checkMode(stat, options);
@@ -292495,16 +292622,16 @@ var require_shebang_command = /* @__PURE__ */ __commonJSMin(((exports, module) =
292495
292622
  //#endregion
292496
292623
  //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
292497
292624
  var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
292498
- const fs$7 = __require("fs");
292625
+ const fs$6 = __require("fs");
292499
292626
  const shebangCommand = require_shebang_command();
292500
292627
  function readShebang(command) {
292501
292628
  const size = 150;
292502
292629
  const buffer = Buffer.alloc(size);
292503
292630
  let fd;
292504
292631
  try {
292505
- fd = fs$7.openSync(command, "r");
292506
- fs$7.readSync(fd, buffer, 0, size, 0);
292507
- fs$7.closeSync(fd);
292632
+ fd = fs$6.openSync(command, "r");
292633
+ fs$6.readSync(fd, buffer, 0, size, 0);
292634
+ fs$6.closeSync(fd);
292508
292635
  } catch (e) {}
292509
292636
  return shebangCommand(buffer.toString());
292510
292637
  }
@@ -309127,6 +309254,15 @@ var init_blun_web_search = __esmMin((() => {
309127
309254
  }));
309128
309255
  //#endregion
309129
309256
  //#region ../../packages/agent-core/src/tools/providers/blun-media.ts
309257
+ async function blockedSubmissionError(response) {
309258
+ let payload = {};
309259
+ try {
309260
+ payload = await response.json();
309261
+ } catch {}
309262
+ const sourceStatus = typeof payload["source_status"] === "string" ? payload["source_status"] : "unknown";
309263
+ const retryable = payload["retryable"];
309264
+ return /* @__PURE__ */ new Error(`Source media is not ready. Source status: ${sourceStatus}.${typeof retryable === "boolean" ? ` Retryable: ${retryable ? "yes" : "no"}.` : " Retryable: unknown."}`);
309265
+ }
309130
309266
  async function parseBlockedStatus(response, id) {
309131
309267
  let payload = {};
309132
309268
  try {
@@ -309165,6 +309301,7 @@ function parseStatus(payload, expectedId) {
309165
309301
  }
309166
309302
  async function assertSuccess(response, operation) {
309167
309303
  if (response.ok) return;
309304
+ if (response.status === 402) throw new Error(`${operation} was rejected (HTTP 402); the cause was not verified.`);
309168
309305
  let detail = "";
309169
309306
  try {
309170
309307
  detail = (await response.text()).trim();
@@ -309197,6 +309334,37 @@ var init_blun_media = __esmMin((() => {
309197
309334
  generateSpeech(input, options) {
309198
309335
  return this.submit("/audio/speech", { input }, options);
309199
309336
  }
309337
+ async uploadMedia(data, mimeType, options) {
309338
+ const response = await this.request("/media/upload", {
309339
+ method: "POST",
309340
+ body: data,
309341
+ contentType: mimeType
309342
+ }, options);
309343
+ await assertSuccess(response, "Media upload");
309344
+ return parseJob(await response.json());
309345
+ }
309346
+ understandImage(imageId, prompt, options) {
309347
+ const body = { image_id: imageId };
309348
+ if (prompt !== void 0 && prompt.length > 0) body["prompt"] = prompt;
309349
+ return this.submit("/images/understand", body, options);
309350
+ }
309351
+ understandVideo(mediaId, prompt, options) {
309352
+ const body = { media_id: mediaId };
309353
+ if (prompt !== void 0 && prompt.length > 0) body["prompt"] = prompt;
309354
+ return this.submit("/videos/understand", body, options);
309355
+ }
309356
+ dubVideo(mediaId, input, options) {
309357
+ return this.submit("/videos/dub", {
309358
+ media_id: mediaId,
309359
+ input
309360
+ }, options);
309361
+ }
309362
+ lipSyncMedia(imageId, audioId, options) {
309363
+ return this.submit("/videos/lipsync", {
309364
+ image_id: imageId,
309365
+ audio_id: audioId
309366
+ }, options);
309367
+ }
309200
309368
  async getMedia(id, options) {
309201
309369
  const response = await this.request(`/media/${encodeURIComponent(id)}`, { method: "GET" }, options);
309202
309370
  if (response.status === 409) return parseBlockedStatus(response, id);
@@ -309208,6 +309376,12 @@ var init_blun_media = __esmMin((() => {
309208
309376
  await assertSuccess(response, "Media lookup");
309209
309377
  const mimeType = response.headers.get("content-type")?.split(";", 1)[0]?.trim().toLowerCase() ?? "";
309210
309378
  if (mimeType === "application/json" || mimeType.endsWith("+json")) return parseStatus(await response.json(), id);
309379
+ if (mimeType === "text/plain") return {
309380
+ kind: "text",
309381
+ id,
309382
+ mimeType,
309383
+ text: await response.text()
309384
+ };
309211
309385
  if (!mimeType.startsWith("image/") && !mimeType.startsWith("audio/") && !mimeType.startsWith("video/")) throw new Error(`Media lookup returned unsupported content type ${mimeType || "(missing)"}`);
309212
309386
  return {
309213
309387
  kind: "file",
@@ -309221,6 +309395,7 @@ var init_blun_media = __esmMin((() => {
309221
309395
  method: "POST",
309222
309396
  body: JSON.stringify(body)
309223
309397
  }, options);
309398
+ if (response.status === 409) throw await blockedSubmissionError(response);
309224
309399
  await assertSuccess(response, "Media request");
309225
309400
  return parseJob(await response.json());
309226
309401
  }
@@ -309232,13 +309407,14 @@ var init_blun_media = __esmMin((() => {
309232
309407
  return this.fetchWithToken(path, init, options, refreshed);
309233
309408
  }
309234
309409
  fetchWithToken(path, init, options, token) {
309410
+ const { contentType, ...requestInit } = init;
309235
309411
  return this.fetchImpl(`${this.baseUrl}${path}`, {
309236
- ...init,
309412
+ ...requestInit,
309237
309413
  signal: options?.signal,
309238
309414
  headers: {
309239
309415
  ...this.defaultHeaders,
309240
309416
  Authorization: `Bearer ${token}`,
309241
- ...init.body === void 0 ? {} : { "Content-Type": "application/json" },
309417
+ ...init.body === void 0 ? {} : { "Content-Type": contentType ?? "application/json" },
309242
309418
  ...options?.toolCallId === void 0 ? {} : { "X-Msh-Tool-Call-Id": options.toolCallId },
309243
309419
  ...this.customHeaders
309244
309420
  }
@@ -309625,7 +309801,7 @@ var require_dist$5 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
309625
309801
  //#endregion
309626
309802
  //#region ../../node_modules/.pnpm/yazl@3.3.1/node_modules/yazl/index.js
309627
309803
  var require_yazl = /* @__PURE__ */ __commonJSMin(((exports) => {
309628
- var fs$6 = __require("fs");
309804
+ var fs$5 = __require("fs");
309629
309805
  var Transform$2 = __require("stream").Transform;
309630
309806
  var PassThrough$2 = __require("stream").PassThrough;
309631
309807
  var zlib$1 = __require("zlib");
@@ -309654,14 +309830,14 @@ var require_yazl = /* @__PURE__ */ __commonJSMin(((exports) => {
309654
309830
  if (shouldIgnoreAdding(self)) return;
309655
309831
  var entry = new Entry(metadataPath, false, options);
309656
309832
  self.entries.push(entry);
309657
- fs$6.stat(realPath, function(err, stats) {
309833
+ fs$5.stat(realPath, function(err, stats) {
309658
309834
  if (err) return self.emit("error", err);
309659
309835
  if (!stats.isFile()) return self.emit("error", /* @__PURE__ */ new Error("not a file: " + realPath));
309660
309836
  entry.uncompressedSize = stats.size;
309661
309837
  if (options.mtime == null) entry.setLastModDate(stats.mtime);
309662
309838
  if (options.mode == null) entry.setFileAttributesMode(stats.mode);
309663
309839
  entry.setFileDataPumpFunction(function() {
309664
- var readStream = fs$6.createReadStream(realPath);
309840
+ var readStream = fs$5.createReadStream(realPath);
309665
309841
  entry.state = Entry.FILE_DATA_IN_PROGRESS;
309666
309842
  readStream.on("error", function(err) {
309667
309843
  self.emit("error", err);
@@ -326240,7 +326416,7 @@ var require_command = /* @__PURE__ */ __commonJSMin(((exports) => {
326240
326416
  const EventEmitter$12 = __require("node:events").EventEmitter;
326241
326417
  const childProcess = __require("node:child_process");
326242
326418
  const path$7 = __require("node:path");
326243
- const fs$5 = __require("node:fs");
326419
+ const fs$4 = __require("node:fs");
326244
326420
  const process$2 = __require("node:process");
326245
326421
  const { Argument, humanReadableArgName } = require_argument();
326246
326422
  const { CommanderError } = require_error$2();
@@ -327123,7 +327299,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
327123
327299
  * @param {string} subcommandName
327124
327300
  */
327125
327301
  _checkForMissingExecutable(executableFile, executableDir, subcommandName) {
327126
- if (fs$5.existsSync(executableFile)) return;
327302
+ if (fs$4.existsSync(executableFile)) return;
327127
327303
  const executableMissing = `'${executableFile}' does not exist
327128
327304
  - if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
327129
327305
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
@@ -327147,9 +327323,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
327147
327323
  ];
327148
327324
  function findFile(baseDir, baseName) {
327149
327325
  const localBin = path$7.resolve(baseDir, baseName);
327150
- if (fs$5.existsSync(localBin)) return localBin;
327326
+ if (fs$4.existsSync(localBin)) return localBin;
327151
327327
  if (sourceExt.includes(path$7.extname(baseName))) return void 0;
327152
- const foundExt = sourceExt.find((ext) => fs$5.existsSync(`${localBin}${ext}`));
327328
+ const foundExt = sourceExt.find((ext) => fs$4.existsSync(`${localBin}${ext}`));
327153
327329
  if (foundExt) return `${localBin}${foundExt}`;
327154
327330
  }
327155
327331
  this._checkForMissingMandatoryOptions();
@@ -327159,7 +327335,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
327159
327335
  if (this._scriptPath) {
327160
327336
  let resolvedScriptPath;
327161
327337
  try {
327162
- resolvedScriptPath = fs$5.realpathSync(this._scriptPath);
327338
+ resolvedScriptPath = fs$4.realpathSync(this._scriptPath);
327163
327339
  } catch {
327164
327340
  resolvedScriptPath = this._scriptPath;
327165
327341
  }
@@ -340310,6 +340486,18 @@ const PERSONAL_MEMORY_MEMORY_CREATE_METHOD = "POST";
340310
340486
  const PERSONAL_MEMORY_RECALL_METHOD = "POST";
340311
340487
  const PERSONAL_MEMORY_EXPLICIT_KEY = "explicit_user_memory";
340312
340488
  const PERSONAL_MEMORY_EXPLICIT_CATEGORY = "user_explicit";
340489
+ const SAFE_BROKER_ERROR_CODES = new Set([
340490
+ "AUTHENTICATION_REQUIRED",
340491
+ "EXPLICIT_CONSENT_REQUIRED",
340492
+ "INTERNAL_ERROR",
340493
+ "INTERACTIVE_CONFIRMATION_REQUIRED",
340494
+ "INSUFFICIENT_SCOPE",
340495
+ "INVALID_PAYLOAD",
340496
+ "MEMORY_NOT_FOUND",
340497
+ "MEMORY_WRITE_DISABLED",
340498
+ "SECRET_REJECTED",
340499
+ "UNAVAILABLE"
340500
+ ]);
340313
340501
  var PersonalMemoryBrokerError = class extends Error {
340314
340502
  code;
340315
340503
  status;
@@ -340347,9 +340535,118 @@ function explicitPersonalMemoryBody(content) {
340347
340535
  kategorie: PERSONAL_MEMORY_EXPLICIT_CATEGORY
340348
340536
  };
340349
340537
  }
340538
+ var PersonalMemoryBrokerClient = class {
340539
+ options;
340540
+ baseUrl;
340541
+ fetchImpl;
340542
+ idempotencyKey;
340543
+ timeoutMs;
340544
+ constructor(options) {
340545
+ this.options = options;
340546
+ this.baseUrl = options.baseUrl.replace(/\/+$/, "");
340547
+ this.fetchImpl = options.fetchImpl ?? fetch;
340548
+ this.idempotencyKey = options.idempotencyKey ?? randomUUID;
340549
+ this.timeoutMs = options.timeoutMs ?? 1e4;
340550
+ }
340551
+ async getSettings() {
340552
+ const parsed = parsePersonalMemorySettings(await this.request("GET", PERSONAL_MEMORY_SETTINGS_PATH));
340553
+ if (parsed === void 0) throw new PersonalMemoryBrokerError("INVALID_PAYLOAD");
340554
+ return parsed;
340555
+ }
340556
+ async updateSettings(patch) {
340557
+ await this.request("PUT", PERSONAL_MEMORY_SETTINGS_PATH, patch);
340558
+ }
340559
+ async request(method, path, body) {
340560
+ if (!isAllowedBrokerRequest(method, path)) throw new PersonalMemoryBrokerError("INVALID_PAYLOAD");
340561
+ const idempotencyKey = method === "GET" ? void 0 : this.idempotencyKey();
340562
+ const firstToken = await this.accessToken();
340563
+ let response = await this.fetchWithToken(method, path, firstToken, body, idempotencyKey);
340564
+ if (response.status === 401) {
340565
+ const refreshed = await this.accessToken({ force: true });
340566
+ response = await this.fetchWithToken(method, path, refreshed, body, idempotencyKey);
340567
+ }
340568
+ if (!response.ok) throw await brokerHttpError(response);
340569
+ if (response.status === 204) return null;
340570
+ const text = await response.text();
340571
+ if (text.trim().length === 0) return null;
340572
+ try {
340573
+ return JSON.parse(text);
340574
+ } catch {
340575
+ throw new PersonalMemoryBrokerError("INVALID_PAYLOAD");
340576
+ }
340577
+ }
340578
+ async accessToken(options) {
340579
+ try {
340580
+ const token = await this.options.tokenProvider.getAccessToken(options);
340581
+ if (token.trim().length === 0) throw new Error("empty token");
340582
+ return token;
340583
+ } catch {
340584
+ throw new PersonalMemoryBrokerError("AUTHENTICATION_REQUIRED");
340585
+ }
340586
+ }
340587
+ async fetchWithToken(method, path, accessToken, body, idempotencyKey) {
340588
+ const controller = new AbortController();
340589
+ const timer = setTimeout(() => {
340590
+ controller.abort();
340591
+ }, this.timeoutMs);
340592
+ timer.unref?.();
340593
+ const headers = new Headers();
340594
+ headers.set("Accept", "application/json");
340595
+ headers.set("Authorization", `Bearer ${accessToken}`);
340596
+ if (body !== void 0) headers.set("Content-Type", "application/json");
340597
+ if (idempotencyKey !== void 0) headers.set("Idempotency-Key", idempotencyKey);
340598
+ try {
340599
+ return await this.fetchImpl(`${this.baseUrl}${path}`, {
340600
+ method,
340601
+ headers,
340602
+ body: body === void 0 ? void 0 : JSON.stringify(body),
340603
+ signal: controller.signal
340604
+ });
340605
+ } catch {
340606
+ throw new PersonalMemoryBrokerError("UNAVAILABLE");
340607
+ } finally {
340608
+ clearTimeout(timer);
340609
+ }
340610
+ }
340611
+ };
340612
+ async function brokerHttpError(response) {
340613
+ const status = response.status;
340614
+ const responseCode = await safeBrokerResponseCode(response);
340615
+ if (responseCode !== void 0) return new PersonalMemoryBrokerError(responseCode, status);
340616
+ if (status === 401) return new PersonalMemoryBrokerError("AUTHENTICATION_REQUIRED", status);
340617
+ if (status === 403) return new PersonalMemoryBrokerError("INSUFFICIENT_SCOPE", status);
340618
+ return new PersonalMemoryBrokerError("UNAVAILABLE", status);
340619
+ }
340620
+ async function safeBrokerResponseCode(response) {
340621
+ try {
340622
+ const payload = await response.json();
340623
+ if (!isRecord$11(payload)) return void 0;
340624
+ const nested = isRecord$11(payload["error"]) ? payload["error"]["code"] : void 0;
340625
+ const candidate = payload["code"] ?? payload["error_code"] ?? nested;
340626
+ return typeof candidate === "string" && SAFE_BROKER_ERROR_CODES.has(candidate) ? candidate : void 0;
340627
+ } catch {
340628
+ return;
340629
+ }
340630
+ }
340350
340631
  function isRecord$11(value) {
340351
340632
  return typeof value === "object" && value !== null && !Array.isArray(value);
340352
340633
  }
340634
+ function isAllowedBrokerRequest(method, path) {
340635
+ let url;
340636
+ try {
340637
+ url = new URL(path, "https://personal-memory.invalid");
340638
+ } catch {
340639
+ return false;
340640
+ }
340641
+ if (url.origin !== "https://personal-memory.invalid") return false;
340642
+ if (url.search.length > 0 || url.hash.length > 0) return false;
340643
+ const pathname = url.pathname;
340644
+ if (pathname === PERSONAL_MEMORY_SETTINGS_PATH) return method === "GET" || method === "PUT";
340645
+ if (pathname === PERSONAL_MEMORY_MEMORIES_PATH) return method === "GET" || method === "POST";
340646
+ if (/^\/v1\/me\/memories\/[0-9a-f-]{36}$/i.test(pathname)) return false;
340647
+ if (pathname === PERSONAL_MEMORY_RECALL_PATH) return method === PERSONAL_MEMORY_RECALL_METHOD;
340648
+ return false;
340649
+ }
340353
340650
  //#endregion
340354
340651
  //#region src/personal-memory/explicit-remember.ts
340355
340652
  /** The sole Phase-1 write path: invoked by an explicit host command, never by the model. */
@@ -340373,7 +340670,17 @@ async function rememberExplicitPersonalMemory(options) {
340373
340670
  //#region src/personal-memory/runtime.ts
340374
340671
  init_src$3();
340375
340672
  function createPersonalMemoryBrokerClient(harness) {
340376
- throw new PersonalMemoryBrokerError("UNAVAILABLE");
340673
+ const provider = loadRuntimeConfigSafe(harness.configPath).config.providers[DEFAULT_OAUTH_PROVIDER_NAME];
340674
+ const runtime = resolveBlunCodeRuntimeAuth({
340675
+ configuredBaseUrl: provider?.baseUrl,
340676
+ configuredOAuthRef: provider?.oauth
340677
+ });
340678
+ const brokerBaseUrl = runtime.oauthRef.oauthHost ?? BLUN_FLOW_CONFIG.oauthHost;
340679
+ if (brokerBaseUrl.trim().length === 0) throw new PersonalMemoryBrokerError("UNAVAILABLE");
340680
+ return new PersonalMemoryBrokerClient({
340681
+ baseUrl: brokerBaseUrl,
340682
+ tokenProvider: harness.auth.resolveOAuthTokenProvider(DEFAULT_OAUTH_PROVIDER_NAME, runtime.oauthRef)
340683
+ });
340377
340684
  }
340378
340685
  //#endregion
340379
340686
  //#region src/cli/sub/personal-memory.ts
@@ -345458,7 +345765,7 @@ var require_atomic_sleep = /* @__PURE__ */ __commonJSMin(((exports, module) => {
345458
345765
  //#endregion
345459
345766
  //#region ../../node_modules/.pnpm/sonic-boom@4.2.1/node_modules/sonic-boom/index.js
345460
345767
  var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
345461
- const fs$4 = __require("fs");
345768
+ const fs$3 = __require("fs");
345462
345769
  const EventEmitter$10 = __require("events");
345463
345770
  const inherits$6 = __require("util").inherits;
345464
345771
  const path$6 = __require("path");
@@ -345501,17 +345808,17 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
345501
345808
  const flags = sonic.append ? "a" : "w";
345502
345809
  const mode = sonic.mode;
345503
345810
  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));
345811
+ if (sonic.mkdir) fs$3.mkdirSync(path$6.dirname(file), { recursive: true });
345812
+ fileOpened(null, fs$3.openSync(file, flags, mode));
345506
345813
  } catch (err) {
345507
345814
  fileOpened(err);
345508
345815
  throw err;
345509
345816
  }
345510
- else if (sonic.mkdir) fs$4.mkdir(path$6.dirname(file), { recursive: true }, (err) => {
345817
+ else if (sonic.mkdir) fs$3.mkdir(path$6.dirname(file), { recursive: true }, (err) => {
345511
345818
  if (err) return fileOpened(err);
345512
- fs$4.open(file, flags, mode, fileOpened);
345819
+ fs$3.open(file, flags, mode, fileOpened);
345513
345820
  });
345514
- else fs$4.open(file, flags, mode, fileOpened);
345821
+ else fs$3.open(file, flags, mode, fileOpened);
345515
345822
  }
345516
345823
  function SonicBoom(opts) {
345517
345824
  if (!(this instanceof SonicBoom)) return new SonicBoom(opts);
@@ -345549,8 +345856,8 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
345549
345856
  this.flush = flushBuffer;
345550
345857
  this.flushSync = flushBufferSync;
345551
345858
  this._actualWrite = actualWriteBuffer;
345552
- fsWriteSync = () => fs$4.writeSync(this.fd, this._writingBuf);
345553
- fsWrite = () => fs$4.write(this.fd, this._writingBuf, this.release);
345859
+ fsWriteSync = () => fs$3.writeSync(this.fd, this._writingBuf);
345860
+ fsWrite = () => fs$3.write(this.fd, this._writingBuf, this.release);
345554
345861
  } else if (contentMode === void 0 || contentMode === kContentModeUtf8) {
345555
345862
  this._writingBuf = "";
345556
345863
  this.write = write;
@@ -345558,12 +345865,12 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
345558
345865
  this.flushSync = flushSync;
345559
345866
  this._actualWrite = actualWrite;
345560
345867
  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");
345868
+ if (Buffer.isBuffer(this._writingBuf)) return fs$3.writeSync(this.fd, this._writingBuf);
345869
+ return fs$3.writeSync(this.fd, this._writingBuf, "utf8");
345563
345870
  };
345564
345871
  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);
345872
+ if (Buffer.isBuffer(this._writingBuf)) return fs$3.write(this.fd, this._writingBuf, this.release);
345873
+ return fs$3.write(this.fd, this._writingBuf, "utf8", this.release);
345567
345874
  };
345568
345875
  } else throw new Error(`SonicBoom supports "${kContentModeUtf8}" and "${kContentModeBuffer}", but passed ${contentMode}`);
345569
345876
  if (typeof fd === "number") {
@@ -345608,7 +345915,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
345608
345915
  return;
345609
345916
  }
345610
345917
  }
345611
- if (this._fsync) fs$4.fsyncSync(this.fd);
345918
+ if (this._fsync) fs$3.fsyncSync(this.fd);
345612
345919
  const len = this._len;
345613
345920
  if (this._reopening) {
345614
345921
  this._writing = false;
@@ -345705,7 +346012,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
345705
346012
  this._flushPending = true;
345706
346013
  const onDrain = () => {
345707
346014
  if (!this._fsync) try {
345708
- fs$4.fsync(this.fd, (err) => {
346015
+ fs$3.fsync(this.fd, (err) => {
345709
346016
  this._flushPending = false;
345710
346017
  cb(err);
345711
346018
  });
@@ -345782,7 +346089,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
345782
346089
  if (this._writing) return;
345783
346090
  const fd = this.fd;
345784
346091
  this.once("ready", () => {
345785
- if (fd !== this.fd) fs$4.close(fd, (err) => {
346092
+ if (fd !== this.fd) fs$3.close(fd, (err) => {
345786
346093
  if (err) return this.emit("error", err);
345787
346094
  });
345788
346095
  });
@@ -345813,7 +346120,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
345813
346120
  while (this._bufs.length || buf.length) {
345814
346121
  if (buf.length <= 0) buf = this._bufs[0];
345815
346122
  try {
345816
- const n = Buffer.isBuffer(buf) ? fs$4.writeSync(this.fd, buf) : fs$4.writeSync(this.fd, buf, "utf8");
346123
+ const n = Buffer.isBuffer(buf) ? fs$3.writeSync(this.fd, buf) : fs$3.writeSync(this.fd, buf, "utf8");
345817
346124
  const releasedBufObj = releaseWritingBuf(buf, this._len, n);
345818
346125
  buf = releasedBufObj.writingBuf;
345819
346126
  this._len = releasedBufObj.len;
@@ -345824,7 +346131,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
345824
346131
  }
345825
346132
  }
345826
346133
  try {
345827
- fs$4.fsyncSync(this.fd);
346134
+ fs$3.fsyncSync(this.fd);
345828
346135
  } catch {}
345829
346136
  }
345830
346137
  function flushBufferSync() {
@@ -345838,7 +346145,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
345838
346145
  while (this._bufs.length || buf.length) {
345839
346146
  if (buf.length <= 0) buf = mergeBuf(this._bufs[0], this._lens[0]);
345840
346147
  try {
345841
- const n = fs$4.writeSync(this.fd, buf);
346148
+ const n = fs$3.writeSync(this.fd, buf);
345842
346149
  buf = buf.subarray(n);
345843
346150
  this._len = Math.max(this._len - n, 0);
345844
346151
  if (buf.length <= 0) {
@@ -345860,24 +346167,24 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
345860
346167
  this._writing = true;
345861
346168
  this._writingBuf = this._writingBuf.length ? this._writingBuf : this._bufs.shift() || "";
345862
346169
  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"));
346170
+ release(null, Buffer.isBuffer(this._writingBuf) ? fs$3.writeSync(this.fd, this._writingBuf) : fs$3.writeSync(this.fd, this._writingBuf, "utf8"));
345864
346171
  } catch (err) {
345865
346172
  release(err);
345866
346173
  }
345867
- else fs$4.write(this.fd, this._writingBuf, release);
346174
+ else fs$3.write(this.fd, this._writingBuf, release);
345868
346175
  }
345869
346176
  function actualWriteBuffer() {
345870
346177
  const release = this.release;
345871
346178
  this._writing = true;
345872
346179
  this._writingBuf = this._writingBuf.length ? this._writingBuf : mergeBuf(this._bufs.shift(), this._lens.shift());
345873
346180
  if (this.sync) try {
345874
- release(null, fs$4.writeSync(this.fd, this._writingBuf));
346181
+ release(null, fs$3.writeSync(this.fd, this._writingBuf));
345875
346182
  } catch (err) {
345876
346183
  release(err);
345877
346184
  }
345878
346185
  else {
345879
346186
  if (kCopyBuffer) this._writingBuf = Buffer.from(this._writingBuf);
345880
- fs$4.write(this.fd, this._writingBuf, release);
346187
+ fs$3.write(this.fd, this._writingBuf, release);
345881
346188
  }
345882
346189
  }
345883
346190
  function actualClose(sonic) {
@@ -345891,10 +346198,10 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
345891
346198
  sonic._lens = [];
345892
346199
  assert$8(typeof sonic.fd === "number", `sonic.fd must be a number, got ${typeof sonic.fd}`);
345893
346200
  try {
345894
- fs$4.fsync(sonic.fd, closeWrapped);
346201
+ fs$3.fsync(sonic.fd, closeWrapped);
345895
346202
  } catch {}
345896
346203
  function closeWrapped() {
345897
- if (sonic.fd !== 1 && sonic.fd !== 2) fs$4.close(sonic.fd, done);
346204
+ if (sonic.fd !== 1 && sonic.fd !== 2) fs$3.close(sonic.fd, done);
345898
346205
  else done();
345899
346206
  }
345900
346207
  function done(err) {
@@ -368517,7 +368824,7 @@ var require_constants$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
368517
368824
  //#endregion
368518
368825
  //#region ../../../../node_modules/node-gyp-build/node-gyp-build.js
368519
368826
  var require_node_gyp_build$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
368520
- var fs$3 = __require("fs");
368827
+ var fs$2 = __require("fs");
368521
368828
  var path$5 = __require("path");
368522
368829
  var os$3 = __require("os");
368523
368830
  var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
@@ -368573,7 +368880,7 @@ var require_node_gyp_build$1 = /* @__PURE__ */ __commonJSMin(((exports, module)
368573
368880
  };
368574
368881
  function readdirSync(dir) {
368575
368882
  try {
368576
- return fs$3.readdirSync(dir);
368883
+ return fs$2.readdirSync(dir);
368577
368884
  } catch (err) {
368578
368885
  return [];
368579
368886
  }
@@ -368661,7 +368968,7 @@ var require_node_gyp_build$1 = /* @__PURE__ */ __commonJSMin(((exports, module)
368661
368968
  return typeof window !== "undefined" && window.process && window.process.type === "renderer";
368662
368969
  }
368663
368970
  function isAlpine(platform) {
368664
- return platform === "linux" && fs$3.existsSync("/etc/alpine-release");
368971
+ return platform === "linux" && fs$2.existsSync("/etc/alpine-release");
368665
368972
  }
368666
368973
  load.parseTags = parseTags;
368667
368974
  load.matchTags = matchTags;
@@ -388814,7 +389121,7 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
388814
389121
  //#region ../../node_modules/.pnpm/@fastify+swagger@9.7.0/node_modules/@fastify/swagger/lib/mode/static.js
388815
389122
  var require_static = /* @__PURE__ */ __commonJSMin(((exports, module) => {
388816
389123
  const path$3 = __require("node:path");
388817
- const fs$2 = __require("node:fs");
389124
+ const fs$1 = __require("node:fs");
388818
389125
  const yaml = require_dist$1();
388819
389126
  module.exports = function(fastify, opts, done) {
388820
389127
  if (!opts.specification) return done(/* @__PURE__ */ new Error("specification is missing in the module options"));
@@ -388823,14 +389130,14 @@ var require_static = /* @__PURE__ */ __commonJSMin(((exports, module) => {
388823
389130
  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
389131
  else if (opts.specification.path) {
388825
389132
  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`));
389133
+ if (!fs$1.existsSync(path$3.resolve(opts.specification.path))) return done(/* @__PURE__ */ new Error(`${opts.specification.path} does not exist`));
388827
389134
  const extName = path$3.extname(opts.specification.path).toLowerCase();
388828
389135
  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
389136
  if (opts.specification.postProcessor && typeof opts.specification.postProcessor !== "function") return done(/* @__PURE__ */ new Error("specification.postProcessor should be a function"));
388830
389137
  if (opts.specification.baseDir && typeof opts.specification.baseDir !== "string") return done(/* @__PURE__ */ new Error("specification.baseDir should be string"));
388831
389138
  if (!opts.specification.baseDir) opts.specification.baseDir = path$3.resolve(path$3.dirname(opts.specification.path));
388832
389139
  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");
389140
+ const source = fs$1.readFileSync(path$3.resolve(opts.specification.path), "utf8");
388834
389141
  switch (extName) {
388835
389142
  case ".yaml":
388836
389143
  swaggerObject = yaml.parse(source);
@@ -389097,11 +389404,11 @@ var require_should_route_hide = /* @__PURE__ */ __commonJSMin(((exports, module)
389097
389404
  //#endregion
389098
389405
  //#region ../../node_modules/.pnpm/@fastify+swagger@9.7.0/node_modules/@fastify/swagger/lib/util/read-package-json.js
389099
389406
  var require_read_package_json = /* @__PURE__ */ __commonJSMin(((exports, module) => {
389100
- const fs$1 = __require("node:fs");
389407
+ const fs = __require("node:fs");
389101
389408
  const path$2 = __require("node:path");
389102
389409
  function readPackageJson() {
389103
389410
  try {
389104
- return JSON.parse(fs$1.readFileSync(path$2.join(__dirname, "..", "..", "package.json")));
389411
+ return JSON.parse(fs.readFileSync(path$2.join(__dirname, "..", "..", "package.json")));
389105
389412
  } catch {
389106
389413
  return {};
389107
389414
  }
@@ -398954,42 +399261,42 @@ registerUiCatalogFragment({
398954
399261
  registerUiCatalogFragment({
398955
399262
  en: {
398956
399263
  "startupPersonalMemory.title": "Personal memory",
398957
- "startupPersonalMemory.details": "When personal memory is enabled, BLUN automatically extracts useful information from your chats and can use it in future conversations. This stays off until you enable it.",
399264
+ "startupPersonalMemory.details": "When personal memory is enabled, BLUN can save information only when you explicitly ask it to remember something and can use saved information in later conversations. Your chats are not evaluated automatically. This stays off until you enable it.",
398958
399265
  "startupPersonalMemory.enable": "Enable memory",
398959
399266
  "startupPersonalMemory.decline": "Do not enable",
398960
399267
  "startupPersonalMemory.persistenceFailed": "Memory settings could not be saved. Personal memory remains off."
398961
399268
  },
398962
399269
  de: {
398963
399270
  "startupPersonalMemory.title": "Persönliches Gedächtnis",
398964
- "startupPersonalMemory.details": "Wenn das persönliche Gedächtnis aktiviert ist, übernimmt BLUN automatisch nützliche Informationen aus deinen Chats und kann sie in späteren Gesprächen verwenden. Die Funktion bleibt deaktiviert, bis du sie einschaltest.",
399271
+ "startupPersonalMemory.details": "Wenn das persönliche Gedächtnis aktiviert ist, kann BLUN Informationen nur dann speichern, wenn du ausdrücklich darum bittest, sich etwas zu merken. Gespeicherte Informationen können in späteren Gesprächen verwendet werden. Deine Chats werden nicht automatisch ausgewertet. Die Funktion bleibt deaktiviert, bis du sie einschaltest.",
398965
399272
  "startupPersonalMemory.enable": "Gedächtnis aktivieren",
398966
399273
  "startupPersonalMemory.decline": "Nicht aktivieren",
398967
399274
  "startupPersonalMemory.persistenceFailed": "Die Gedächtniseinstellungen konnten nicht gespeichert werden. Das persönliche Gedächtnis bleibt deaktiviert."
398968
399275
  },
398969
399276
  es: {
398970
399277
  "startupPersonalMemory.title": "Memoria personal",
398971
- "startupPersonalMemory.details": "Cuando activas la memoria personal, BLUN extrae automáticamente información útil de tus chats y puede utilizarla en conversaciones futuras. La función permanece desactivada hasta que la actives.",
399278
+ "startupPersonalMemory.details": "Cuando la memoria personal está activada, BLUN solo puede guardar información si le pides expresamente que recuerde algo y puede utilizar la información guardada en conversaciones posteriores. Tus chats no se analizan automáticamente. Esta función permanece desactivada hasta que la actives.",
398972
399279
  "startupPersonalMemory.enable": "Activar la memoria",
398973
399280
  "startupPersonalMemory.decline": "No activar",
398974
399281
  "startupPersonalMemory.persistenceFailed": "No se pudo guardar la configuración de la memoria. La memoria personal permanece desactivada."
398975
399282
  },
398976
399283
  fr: {
398977
399284
  "startupPersonalMemory.title": "Mémoire personnelle",
398978
- "startupPersonalMemory.details": "Lorsque vous activez la mémoire personnelle, BLUN extrait automatiquement les informations utiles de vos conversations et peut les réutiliser ultérieurement. La fonction reste désactivée tant que vous ne l’activez pas.",
399285
+ "startupPersonalMemory.details": "Lorsque la mémoire personnelle est activée, BLUN ne peut enregistrer des informations que si vous lui demandez explicitement de retenir quelque chose. Il peut ensuite utiliser les informations enregistrées dans de futures conversations. Vos discussions ne sont pas analysées automatiquement. Cette fonction reste désactivée tant que vous ne l’activez pas.",
398979
399286
  "startupPersonalMemory.enable": "Activer la mémoire",
398980
399287
  "startupPersonalMemory.decline": "Ne pas activer",
398981
399288
  "startupPersonalMemory.persistenceFailed": "Les réglages de la mémoire n’ont pas pu être enregistrés. La mémoire personnelle reste désactivée."
398982
399289
  },
398983
399290
  sv: {
398984
399291
  "startupPersonalMemory.title": "Personligt minne",
398985
- "startupPersonalMemory.details": "När du aktiverar det personliga minnet hämtar BLUN automatiskt användbar information från dina chattar och kan använda den i framtida samtal. Funktionen är avstängd tills du aktiverar den.",
399292
+ "startupPersonalMemory.details": "När det personliga minnet är aktiverat kan BLUN bara spara information om du uttryckligen ber BLUN att komma ihåg något. Sparad information kan sedan användas i framtida samtal. Dina chattar analyseras inte automatiskt. Funktionen är avstängd tills du aktiverar den.",
398986
399293
  "startupPersonalMemory.enable": "Aktivera minnet",
398987
399294
  "startupPersonalMemory.decline": "Aktivera inte",
398988
399295
  "startupPersonalMemory.persistenceFailed": "Minnesinställningarna kunde inte sparas. Det personliga minnet förblir avstängt."
398989
399296
  },
398990
399297
  cs: {
398991
399298
  "startupPersonalMemory.title": "Osobní paměť",
398992
- "startupPersonalMemory.details": "Když zapnete osobní paměť, BLUN automaticky získává užitečné informace z vašich chatů a může je použít v budoucích konverzacích. Funkce zůstává vypnutá, dokud ji nezapnete.",
399299
+ "startupPersonalMemory.details": "Když je osobní paměť zapnutá, BLUN může uložit informace pouze tehdy, když ho výslovně požádáte, aby si něco zapamatoval. Uložené informace pak může použít v budoucích konverzacích. Vaše chaty se automaticky nevyhodnocují. Funkce zůstává vypnutá, dokud ji nezapnete.",
398993
399300
  "startupPersonalMemory.enable": "Zapnout paměť",
398994
399301
  "startupPersonalMemory.decline": "Nezapínat",
398995
399302
  "startupPersonalMemory.persistenceFailed": "Nastavení paměti se nepodařilo uložit. Osobní paměť zůstává vypnutá."
@@ -404051,7 +404358,7 @@ var TUI = class TUI extends Container {
404051
404358
  if (!debugRedraw) return;
404052
404359
  const logPath = path$17.join(nodeOs.homedir(), ".pi", "agent", "pi-debug.log");
404053
404360
  const msg = `[${(/* @__PURE__ */ new Date()).toISOString()}] fullRender: ${reason} (prev=${this.previousLines.length}, new=${newLines.length}, height=${height})\n`;
404054
- fs$17.appendFileSync(logPath, msg);
404361
+ fs$16.appendFileSync(logPath, msg);
404055
404362
  };
404056
404363
  if (this.previousLines.length === 0 && !widthChanged && !heightChanged) {
404057
404364
  logRedraw("first render");
@@ -404198,7 +404505,7 @@ var TUI = class TUI extends Container {
404198
404505
  buffer += "\x1B[?2026l";
404199
404506
  if (process.env["PI_TUI_DEBUG"] === "1") {
404200
404507
  const debugDir = "/tmp/tui";
404201
- fs$17.mkdirSync(debugDir, { recursive: true });
404508
+ fs$16.mkdirSync(debugDir, { recursive: true });
404202
404509
  const debugPath = path$17.join(debugDir, `render-${Date.now()}-${Math.random().toString(36).slice(2)}.log`);
404203
404510
  const debugData = [
404204
404511
  `firstChanged: ${firstChanged}`,
@@ -404222,7 +404529,7 @@ var TUI = class TUI extends Container {
404222
404529
  "=== buffer ===",
404223
404530
  JSON.stringify(buffer)
404224
404531
  ].join("\n");
404225
- fs$17.writeFileSync(debugPath, debugData);
404532
+ fs$16.writeFileSync(debugPath, debugData);
404226
404533
  }
404227
404534
  this.terminal.write(buffer);
404228
404535
  this.cursorRow = Math.max(0, newLines.length - 1);
@@ -408881,7 +409188,7 @@ var ProcessTerminal = class {
408881
409188
  const env = process.env["PI_TUI_WRITE_LOG"] || "";
408882
409189
  if (!env) return "";
408883
409190
  try {
408884
- if (fs$17.statSync(env).isDirectory()) {
409191
+ if (fs$16.statSync(env).isDirectory()) {
408885
409192
  const now = /* @__PURE__ */ new Date();
408886
409193
  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
409194
  return path$17.join(env, `tui-${ts}-${process.pid}.log`);
@@ -409164,7 +409471,7 @@ var ProcessTerminal = class {
409164
409471
  write(data) {
409165
409472
  process.stdout.write(data);
409166
409473
  if (this.writeLogPath) try {
409167
- fs$17.appendFileSync(this.writeLogPath, data, { encoding: "utf8" });
409474
+ fs$16.appendFileSync(this.writeLogPath, data, { encoding: "utf8" });
409168
409475
  } catch {}
409169
409476
  }
409170
409477
  get columns() {
@@ -498237,7 +498544,7 @@ var EditorKeyboardController = class {
498237
498544
  host.toggleTodoPanelExpansion();
498238
498545
  return;
498239
498546
  }
498240
- if (host.state.appState.streamingPhase === "idle" || host.state.appState.streamingPhase === "shell" || host.state.appState.isCompacting) return;
498547
+ if (host.state.appState.streamingPhase === "idle") return;
498241
498548
  host.flushQueuedMessages(editor.getText().trim(), editor.inputMode);
498242
498549
  host.updateQueueDisplay();
498243
498550
  host.state.ui.requestRender();
@@ -509002,11 +509309,9 @@ var BlunTUI = class {
509002
509309
  editorKeyboard;
509003
509310
  scrollbackController;
509004
509311
  personalMemoryController;
509005
- accountMemory;
509006
- accountMemoryEnabledForSession = false;
509007
- pendingAccountMemoryExtractions = /* @__PURE__ */ new Set();
509008
509312
  managedQuotaWarningController;
509009
509313
  managedQuotaWarningPersistence = Promise.resolve();
509314
+ footerMounted = false;
509010
509315
  /** Timer that auto-clears the one-shot "moved to background" footer hint. */
509011
509316
  detachHintClearTimer;
509012
509317
  telegramChannel;
@@ -509022,7 +509327,6 @@ var BlunTUI = class {
509022
509327
  }
509023
509328
  constructor(harness, startupInput) {
509024
509329
  this.harness = harness;
509025
- this.accountMemory = createAccountMemoryClient(harness.auth);
509026
509330
  const initialAppState = createInitialAppState(startupInput);
509027
509331
  setCurrentUiLocale(initialAppState.uiLocale);
509028
509332
  const invalidAppearance = initialAppState.appearance !== void 0 && !validateAppearance(currentTheme.palette, initialAppState.appearance).valid;
@@ -509273,6 +509577,13 @@ var BlunTUI = class {
509273
509577
  }), "warning");
509274
509578
  } catch {}
509275
509579
  }
509580
+ async refreshProviderModelsBeforeSession() {
509581
+ if ((await this.harness.getConfig()).models?.["blun/king"] === void 0) {
509582
+ await this.refreshProviderModelsInBackground();
509583
+ return;
509584
+ }
509585
+ this.refreshProviderModelsInBackground();
509586
+ }
509276
509587
  async finishStartup(shouldReplayHistory) {
509277
509588
  while (!this.aborted) {
509278
509589
  await this.flushStartupNotice();
@@ -509374,7 +509685,7 @@ var BlunTUI = class {
509374
509685
  return false;
509375
509686
  }
509376
509687
  if (this.startupWorkspaceSelectionPending) return false;
509377
- this.refreshProviderModelsInBackground();
509688
+ await this.refreshProviderModelsBeforeSession();
509378
509689
  const { startup } = this.options;
509379
509690
  const { workDir } = this.state.appState;
509380
509691
  let session;
@@ -509481,7 +509792,6 @@ var BlunTUI = class {
509481
509792
  this.channelQueueDeadline?.dispose();
509482
509793
  await this.telegramChannel?.stop();
509483
509794
  this.telegramChannel = void 0;
509484
- await Promise.allSettled(this.pendingAccountMemoryExtractions);
509485
509795
  this.streamingUI.discardPending();
509486
509796
  this.tasksBrowserController.close();
509487
509797
  this.btwPanelController.clear();
@@ -509587,9 +509897,11 @@ var BlunTUI = class {
509587
509897
  }
509588
509898
  }
509589
509899
  mountFooter() {
509900
+ if (this.footerMounted) return;
509590
509901
  const footerWrap = new GutterContainer(1, 1);
509591
509902
  footerWrap.addChild(this.state.footer);
509592
509903
  this.state.ui.addChild(footerWrap);
509904
+ this.footerMounted = true;
509593
509905
  }
509594
509906
  handlePlanToggle(next) {
509595
509907
  handlePlanCommand(this, next ? "on" : "off");
@@ -509989,9 +510301,7 @@ var BlunTUI = class {
509989
510301
  type: "text",
509990
510302
  text: modelInput
509991
510303
  }, imagePart] : modelInput;
509992
- session.promptAccepted(promptInput).then((result) => {
509993
- if (result.accepted) this.extractAccountMemory(displayText);
509994
- }).catch((error) => {
510304
+ session.promptAccepted(promptInput).catch((error) => {
509995
510305
  this.failSessionRequest(uiText("blunTui.session.sendFailed", { error: formatErrorMessage$2(error) }));
509996
510306
  });
509997
510307
  this.updateQueueDisplay();
@@ -510202,9 +510512,7 @@ var BlunTUI = class {
510202
510512
  model: BLUN_KING_MODEL_ALIAS,
510203
510513
  modelFallbackAllowed: false
510204
510514
  });
510205
- session.promptAccepted(sdkInput).then((result) => {
510206
- if (result.accepted) this.extractAccountMemory(input);
510207
- }).catch((error) => {
510515
+ session.promptAccepted(sdkInput).catch((error) => {
510208
510516
  finishPersonalMemoryRememberIntentTurn(session.id);
510209
510517
  const message = formatErrorMessage$2(error);
510210
510518
  this.failSessionRequest(uiText("blunTui.session.sendFailed", { error: message }));
@@ -510254,9 +510562,7 @@ var BlunTUI = class {
510254
510562
  content: part
510255
510563
  });
510256
510564
  const text = input.join("\n\n");
510257
- session.steer(text).then(() => {
510258
- this.extractAccountMemory(text);
510259
- }).catch((error) => {
510565
+ session.steer(text).catch((error) => {
510260
510566
  const message = formatErrorMessage$2(error);
510261
510567
  this.showError(uiText("blunTui.steer.failed", { error: message }));
510262
510568
  });
@@ -510346,51 +510652,8 @@ var BlunTUI = class {
510346
510652
  this.authFlow.refreshManagedQuotaWindows();
510347
510653
  }
510348
510654
  async refreshPersonalMemory(promptIfNeverAsked = false) {
510349
- const session = this.session;
510350
- if (session === void 0) return;
510351
- this.accountMemoryEnabledForSession = false;
510352
- try {
510353
- let consentStatus = await this.accountMemory.getConsentStatus();
510354
- if (consentStatus === "never_asked" && promptIfNeverAsked) {
510355
- const consent = await ensureStartupPersonalMemoryConsent({
510356
- host: this,
510357
- consentStatus,
510358
- copy: startupPersonalMemoryConsentCopy(),
510359
- updateSettings: async (patch) => {
510360
- await this.accountMemory.setConsent(patch.memory_enabled === true);
510361
- }
510362
- });
510363
- if (consent === "persistence-failed") this.showStatus(startupPersonalMemoryConsentCopy().persistenceFailed, "warning");
510364
- consentStatus = consent === "enabled" || consent === "disabled" ? consent : "never_asked";
510365
- }
510366
- this.accountMemoryEnabledForSession = consentStatus === "enabled";
510367
- } catch (error) {
510368
- this.reportAccountMemoryIssue("Account memory consent unavailable", error);
510369
- }
510370
- await this.applyAccountMemoryContext(session);
510371
- }
510372
- async applyAccountMemoryContext(session) {
510373
- try {
510374
- const context = this.accountMemoryEnabledForSession ? await this.accountMemory.loadSystemContext() : void 0;
510375
- await session.setAccountMemoryContext(context);
510376
- } catch (error) {
510377
- try {
510378
- await session.setAccountMemoryContext(void 0);
510379
- } catch {}
510380
- this.reportAccountMemoryIssue("Account memory unavailable", error);
510381
- }
510382
- }
510383
- extractAccountMemory(text) {
510384
- if (!this.accountMemoryEnabledForSession || text.trim().length === 0) return;
510385
- let pending;
510386
- pending = this.accountMemory.extract(text).catch((error) => {
510387
- this.reportAccountMemoryIssue("Account memory update failed", error);
510388
- }).finally(() => {
510389
- this.pendingAccountMemoryExtractions.delete(pending);
510390
- });
510391
- this.pendingAccountMemoryExtractions.add(pending);
510655
+ await this.personalMemoryController.refresh({ promptIfNeverAsked });
510392
510656
  }
510393
- reportAccountMemoryIssue(_label, _error) {}
510394
510657
  patchLivePane(patch) {
510395
510658
  if (!hasPatchChanges(this.state.livePane, patch)) return;
510396
510659
  Object.assign(this.state.livePane, patch);
@@ -510441,7 +510704,7 @@ var BlunTUI = class {
510441
510704
  this.registerSessionHandlers(session);
510442
510705
  this.syncAdditionalDirs(session);
510443
510706
  await this.authFlow.applyManagedAccountContextToSession();
510444
- await this.applyAccountMemoryContext(session);
510707
+ await this.personalMemoryController.refresh();
510445
510708
  }
510446
510709
  async syncRuntimeState(session = this.requireSession()) {
510447
510710
  const [status, goalResult] = await Promise.all([session.getStatus(), session.getGoal()]);
@@ -510650,7 +510913,7 @@ var BlunTUI = class {
510650
510913
  this.session = session;
510651
510914
  this.harness.setTelemetryContext({ sessionId: session.id });
510652
510915
  this.registerSessionHandlers(session);
510653
- await this.applyAccountMemoryContext(session);
510916
+ await this.personalMemoryController.refresh();
510654
510917
  await this.syncRuntimeState(session);
510655
510918
  this.updateTerminalTitle();
510656
510919
  try {