@adhdev/daemon-standalone 0.7.9 → 0.7.11

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/dist/index.js CHANGED
@@ -283,10 +283,10 @@ function mergeDefs(...defs) {
283
283
  function cloneDef(schema) {
284
284
  return mergeDefs(schema._zod.def);
285
285
  }
286
- function getElementAtPath(obj, path17) {
287
- if (!path17)
286
+ function getElementAtPath(obj, path18) {
287
+ if (!path18)
288
288
  return obj;
289
- return path17.reduce((acc, key) => acc?.[key], obj);
289
+ return path18.reduce((acc, key) => acc?.[key], obj);
290
290
  }
291
291
  function promiseAllObject(promisesObj) {
292
292
  const keys = Object.keys(promisesObj);
@@ -598,11 +598,11 @@ function aborted(x, startIndex = 0) {
598
598
  }
599
599
  return false;
600
600
  }
601
- function prefixIssues(path17, issues) {
601
+ function prefixIssues(path18, issues) {
602
602
  return issues.map((iss) => {
603
603
  var _a2;
604
604
  (_a2 = iss).path ?? (_a2.path = []);
605
- iss.path.unshift(path17);
605
+ iss.path.unshift(path18);
606
606
  return iss;
607
607
  });
608
608
  }
@@ -845,7 +845,7 @@ function formatError(error48, mapper = (issue2) => issue2.message) {
845
845
  }
846
846
  function treeifyError(error48, mapper = (issue2) => issue2.message) {
847
847
  const result = { errors: [] };
848
- const processError = (error49, path17 = []) => {
848
+ const processError = (error49, path18 = []) => {
849
849
  var _a2, _b;
850
850
  for (const issue2 of error49.issues) {
851
851
  if (issue2.code === "invalid_union" && issue2.errors.length) {
@@ -855,7 +855,7 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
855
855
  } else if (issue2.code === "invalid_element") {
856
856
  processError({ issues: issue2.issues }, issue2.path);
857
857
  } else {
858
- const fullpath = [...path17, ...issue2.path];
858
+ const fullpath = [...path18, ...issue2.path];
859
859
  if (fullpath.length === 0) {
860
860
  result.errors.push(mapper(issue2));
861
861
  continue;
@@ -887,8 +887,8 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
887
887
  }
888
888
  function toDotPath(_path) {
889
889
  const segs = [];
890
- const path17 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
891
- for (const seg of path17) {
890
+ const path18 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
891
+ for (const seg of path18) {
892
892
  if (typeof seg === "number")
893
893
  segs.push(`[${seg}]`);
894
894
  else if (typeof seg === "symbol")
@@ -13652,13 +13652,13 @@ function resolveRef(ref, ctx) {
13652
13652
  if (!ref.startsWith("#")) {
13653
13653
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
13654
13654
  }
13655
- const path17 = ref.slice(1).split("/").filter(Boolean);
13656
- if (path17.length === 0) {
13655
+ const path18 = ref.slice(1).split("/").filter(Boolean);
13656
+ if (path18.length === 0) {
13657
13657
  return ctx.rootSchema;
13658
13658
  }
13659
13659
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
13660
- if (path17[0] === defsKey) {
13661
- const key = path17[1];
13660
+ if (path18[0] === defsKey) {
13661
+ const key = path18[1];
13662
13662
  if (!key || !ctx.defs[key]) {
13663
13663
  throw new Error(`Reference not found: ${ref}`);
13664
13664
  }
@@ -16085,8 +16085,8 @@ var init_acp = __esm({
16085
16085
  this.#requestHandler = requestHandler;
16086
16086
  this.#notificationHandler = notificationHandler;
16087
16087
  this.#stream = stream;
16088
- this.#closedPromise = new Promise((resolve11) => {
16089
- this.#abortController.signal.addEventListener("abort", () => resolve11());
16088
+ this.#closedPromise = new Promise((resolve12) => {
16089
+ this.#abortController.signal.addEventListener("abort", () => resolve12());
16090
16090
  });
16091
16091
  this.#receive();
16092
16092
  }
@@ -16235,8 +16235,8 @@ var init_acp = __esm({
16235
16235
  }
16236
16236
  async sendRequest(method, params) {
16237
16237
  const id = this.#nextRequestId++;
16238
- const responsePromise = new Promise((resolve11, reject) => {
16239
- this.#pendingResponses.set(id, { resolve: resolve11, reject });
16238
+ const responsePromise = new Promise((resolve12, reject) => {
16239
+ this.#pendingResponses.set(id, { resolve: resolve12, reject });
16240
16240
  });
16241
16241
  await this.#sendMessage({ jsonrpc: "2.0", id, method, params });
16242
16242
  return responsePromise;
@@ -16334,21 +16334,21 @@ var init_acp = __esm({
16334
16334
  // src/index.ts
16335
16335
  var import_http = require("http");
16336
16336
  var import_ws2 = require("ws");
16337
- var path16 = __toESM(require("path"));
16337
+ var path17 = __toESM(require("path"));
16338
16338
  var fs12 = __toESM(require("fs"));
16339
16339
  var os17 = __toESM(require("os"));
16340
16340
 
16341
16341
  // ../daemon-core/dist/index.mjs
16342
16342
  var fs = __toESM(require("fs"), 1);
16343
16343
  var os2 = __toESM(require("os"), 1);
16344
- var path3 = __toESM(require("path"), 1);
16344
+ var path = __toESM(require("path"), 1);
16345
16345
  var import_crypto2 = require("crypto");
16346
16346
  var import_os = require("os");
16347
16347
  var import_path = require("path");
16348
16348
  var import_fs = require("fs");
16349
16349
  var import_crypto3 = require("crypto");
16350
16350
  var fs2 = __toESM(require("fs"), 1);
16351
- var path32 = __toESM(require("path"), 1);
16351
+ var path3 = __toESM(require("path"), 1);
16352
16352
  var os4 = __toESM(require("os"), 1);
16353
16353
  var os11 = __toESM(require("os"), 1);
16354
16354
  var os12 = __toESM(require("os"), 1);
@@ -16469,7 +16469,7 @@ var ReaddirpStream = class extends import_node_stream.Readable {
16469
16469
  this._directoryFilter = normalizeFilter(opts.directoryFilter);
16470
16470
  const statMethod = opts.lstat ? import_promises.lstat : import_promises.stat;
16471
16471
  if (wantBigintFsStats) {
16472
- this._stat = (path17) => statMethod(path17, { bigint: true });
16472
+ this._stat = (path18) => statMethod(path18, { bigint: true });
16473
16473
  } else {
16474
16474
  this._stat = statMethod;
16475
16475
  }
@@ -16494,8 +16494,8 @@ var ReaddirpStream = class extends import_node_stream.Readable {
16494
16494
  const par = this.parent;
16495
16495
  const fil = par && par.files;
16496
16496
  if (fil && fil.length > 0) {
16497
- const { path: path17, depth } = par;
16498
- const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path17));
16497
+ const { path: path18, depth } = par;
16498
+ const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path18));
16499
16499
  const awaited = await Promise.all(slice);
16500
16500
  for (const entry of awaited) {
16501
16501
  if (!entry)
@@ -16535,20 +16535,20 @@ var ReaddirpStream = class extends import_node_stream.Readable {
16535
16535
  this.reading = false;
16536
16536
  }
16537
16537
  }
16538
- async _exploreDir(path17, depth) {
16538
+ async _exploreDir(path18, depth) {
16539
16539
  let files;
16540
16540
  try {
16541
- files = await (0, import_promises.readdir)(path17, this._rdOptions);
16541
+ files = await (0, import_promises.readdir)(path18, this._rdOptions);
16542
16542
  } catch (error48) {
16543
16543
  this._onError(error48);
16544
16544
  }
16545
- return { files, depth, path: path17 };
16545
+ return { files, depth, path: path18 };
16546
16546
  }
16547
- async _formatEntry(dirent, path17) {
16547
+ async _formatEntry(dirent, path18) {
16548
16548
  let entry;
16549
16549
  const basename7 = this._isDirent ? dirent.name : dirent;
16550
16550
  try {
16551
- const fullPath = (0, import_node_path.resolve)((0, import_node_path.join)(path17, basename7));
16551
+ const fullPath = (0, import_node_path.resolve)((0, import_node_path.join)(path18, basename7));
16552
16552
  entry = { path: (0, import_node_path.relative)(this._root, fullPath), fullPath, basename: basename7 };
16553
16553
  entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
16554
16554
  } catch (err) {
@@ -16948,16 +16948,16 @@ var delFromSet = (main2, prop, item) => {
16948
16948
  };
16949
16949
  var isEmptySet = (val) => val instanceof Set ? val.size === 0 : !val;
16950
16950
  var FsWatchInstances = /* @__PURE__ */ new Map();
16951
- function createFsWatchInstance(path17, options, listener, errHandler, emitRaw) {
16951
+ function createFsWatchInstance(path18, options, listener, errHandler, emitRaw) {
16952
16952
  const handleEvent = (rawEvent, evPath) => {
16953
- listener(path17);
16954
- emitRaw(rawEvent, evPath, { watchedPath: path17 });
16955
- if (evPath && path17 !== evPath) {
16956
- fsWatchBroadcast(sp.resolve(path17, evPath), KEY_LISTENERS, sp.join(path17, evPath));
16953
+ listener(path18);
16954
+ emitRaw(rawEvent, evPath, { watchedPath: path18 });
16955
+ if (evPath && path18 !== evPath) {
16956
+ fsWatchBroadcast(sp.resolve(path18, evPath), KEY_LISTENERS, sp.join(path18, evPath));
16957
16957
  }
16958
16958
  };
16959
16959
  try {
16960
- return (0, import_node_fs.watch)(path17, {
16960
+ return (0, import_node_fs.watch)(path18, {
16961
16961
  persistent: options.persistent
16962
16962
  }, handleEvent);
16963
16963
  } catch (error48) {
@@ -16973,12 +16973,12 @@ var fsWatchBroadcast = (fullPath, listenerType, val1, val2, val3) => {
16973
16973
  listener(val1, val2, val3);
16974
16974
  });
16975
16975
  };
16976
- var setFsWatchListener = (path17, fullPath, options, handlers) => {
16976
+ var setFsWatchListener = (path18, fullPath, options, handlers) => {
16977
16977
  const { listener, errHandler, rawEmitter } = handlers;
16978
16978
  let cont = FsWatchInstances.get(fullPath);
16979
16979
  let watcher;
16980
16980
  if (!options.persistent) {
16981
- watcher = createFsWatchInstance(path17, options, listener, errHandler, rawEmitter);
16981
+ watcher = createFsWatchInstance(path18, options, listener, errHandler, rawEmitter);
16982
16982
  if (!watcher)
16983
16983
  return;
16984
16984
  return watcher.close.bind(watcher);
@@ -16989,7 +16989,7 @@ var setFsWatchListener = (path17, fullPath, options, handlers) => {
16989
16989
  addAndConvert(cont, KEY_RAW, rawEmitter);
16990
16990
  } else {
16991
16991
  watcher = createFsWatchInstance(
16992
- path17,
16992
+ path18,
16993
16993
  options,
16994
16994
  fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS),
16995
16995
  errHandler,
@@ -17004,7 +17004,7 @@ var setFsWatchListener = (path17, fullPath, options, handlers) => {
17004
17004
  cont.watcherUnusable = true;
17005
17005
  if (isWindows && error48.code === "EPERM") {
17006
17006
  try {
17007
- const fd = await (0, import_promises2.open)(path17, "r");
17007
+ const fd = await (0, import_promises2.open)(path18, "r");
17008
17008
  await fd.close();
17009
17009
  broadcastErr(error48);
17010
17010
  } catch (err) {
@@ -17035,7 +17035,7 @@ var setFsWatchListener = (path17, fullPath, options, handlers) => {
17035
17035
  };
17036
17036
  };
17037
17037
  var FsWatchFileInstances = /* @__PURE__ */ new Map();
17038
- var setFsWatchFileListener = (path17, fullPath, options, handlers) => {
17038
+ var setFsWatchFileListener = (path18, fullPath, options, handlers) => {
17039
17039
  const { listener, rawEmitter } = handlers;
17040
17040
  let cont = FsWatchFileInstances.get(fullPath);
17041
17041
  const copts = cont && cont.options;
@@ -17057,7 +17057,7 @@ var setFsWatchFileListener = (path17, fullPath, options, handlers) => {
17057
17057
  });
17058
17058
  const currmtime = curr.mtimeMs;
17059
17059
  if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
17060
- foreach(cont.listeners, (listener2) => listener2(path17, curr));
17060
+ foreach(cont.listeners, (listener2) => listener2(path18, curr));
17061
17061
  }
17062
17062
  })
17063
17063
  };
@@ -17087,13 +17087,13 @@ var NodeFsHandler = class {
17087
17087
  * @param listener on fs change
17088
17088
  * @returns closer for the watcher instance
17089
17089
  */
17090
- _watchWithNodeFs(path17, listener) {
17090
+ _watchWithNodeFs(path18, listener) {
17091
17091
  const opts = this.fsw.options;
17092
- const directory = sp.dirname(path17);
17093
- const basename7 = sp.basename(path17);
17092
+ const directory = sp.dirname(path18);
17093
+ const basename7 = sp.basename(path18);
17094
17094
  const parent = this.fsw._getWatchedDir(directory);
17095
17095
  parent.add(basename7);
17096
- const absolutePath = sp.resolve(path17);
17096
+ const absolutePath = sp.resolve(path18);
17097
17097
  const options = {
17098
17098
  persistent: opts.persistent
17099
17099
  };
@@ -17103,12 +17103,12 @@ var NodeFsHandler = class {
17103
17103
  if (opts.usePolling) {
17104
17104
  const enableBin = opts.interval !== opts.binaryInterval;
17105
17105
  options.interval = enableBin && isBinaryPath(basename7) ? opts.binaryInterval : opts.interval;
17106
- closer = setFsWatchFileListener(path17, absolutePath, options, {
17106
+ closer = setFsWatchFileListener(path18, absolutePath, options, {
17107
17107
  listener,
17108
17108
  rawEmitter: this.fsw._emitRaw
17109
17109
  });
17110
17110
  } else {
17111
- closer = setFsWatchListener(path17, absolutePath, options, {
17111
+ closer = setFsWatchListener(path18, absolutePath, options, {
17112
17112
  listener,
17113
17113
  errHandler: this._boundHandleError,
17114
17114
  rawEmitter: this.fsw._emitRaw
@@ -17130,7 +17130,7 @@ var NodeFsHandler = class {
17130
17130
  let prevStats = stats;
17131
17131
  if (parent.has(basename7))
17132
17132
  return;
17133
- const listener = async (path17, newStats) => {
17133
+ const listener = async (path18, newStats) => {
17134
17134
  if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file2, 5))
17135
17135
  return;
17136
17136
  if (!newStats || newStats.mtimeMs === 0) {
@@ -17144,11 +17144,11 @@ var NodeFsHandler = class {
17144
17144
  this.fsw._emit(EV.CHANGE, file2, newStats2);
17145
17145
  }
17146
17146
  if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats2.ino) {
17147
- this.fsw._closeFile(path17);
17147
+ this.fsw._closeFile(path18);
17148
17148
  prevStats = newStats2;
17149
17149
  const closer2 = this._watchWithNodeFs(file2, listener);
17150
17150
  if (closer2)
17151
- this.fsw._addPathCloser(path17, closer2);
17151
+ this.fsw._addPathCloser(path18, closer2);
17152
17152
  } else {
17153
17153
  prevStats = newStats2;
17154
17154
  }
@@ -17180,7 +17180,7 @@ var NodeFsHandler = class {
17180
17180
  * @param item basename of this item
17181
17181
  * @returns true if no more processing is needed for this entry.
17182
17182
  */
17183
- async _handleSymlink(entry, directory, path17, item) {
17183
+ async _handleSymlink(entry, directory, path18, item) {
17184
17184
  if (this.fsw.closed) {
17185
17185
  return;
17186
17186
  }
@@ -17190,7 +17190,7 @@ var NodeFsHandler = class {
17190
17190
  this.fsw._incrReadyCount();
17191
17191
  let linkPath;
17192
17192
  try {
17193
- linkPath = await (0, import_promises2.realpath)(path17);
17193
+ linkPath = await (0, import_promises2.realpath)(path18);
17194
17194
  } catch (e) {
17195
17195
  this.fsw._emitReady();
17196
17196
  return true;
@@ -17200,12 +17200,12 @@ var NodeFsHandler = class {
17200
17200
  if (dir.has(item)) {
17201
17201
  if (this.fsw._symlinkPaths.get(full) !== linkPath) {
17202
17202
  this.fsw._symlinkPaths.set(full, linkPath);
17203
- this.fsw._emit(EV.CHANGE, path17, entry.stats);
17203
+ this.fsw._emit(EV.CHANGE, path18, entry.stats);
17204
17204
  }
17205
17205
  } else {
17206
17206
  dir.add(item);
17207
17207
  this.fsw._symlinkPaths.set(full, linkPath);
17208
- this.fsw._emit(EV.ADD, path17, entry.stats);
17208
+ this.fsw._emit(EV.ADD, path18, entry.stats);
17209
17209
  }
17210
17210
  this.fsw._emitReady();
17211
17211
  return true;
@@ -17235,9 +17235,9 @@ var NodeFsHandler = class {
17235
17235
  return;
17236
17236
  }
17237
17237
  const item = entry.path;
17238
- let path17 = sp.join(directory, item);
17238
+ let path18 = sp.join(directory, item);
17239
17239
  current.add(item);
17240
- if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path17, item)) {
17240
+ if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path18, item)) {
17241
17241
  return;
17242
17242
  }
17243
17243
  if (this.fsw.closed) {
@@ -17246,11 +17246,11 @@ var NodeFsHandler = class {
17246
17246
  }
17247
17247
  if (item === target || !target && !previous.has(item)) {
17248
17248
  this.fsw._incrReadyCount();
17249
- path17 = sp.join(dir, sp.relative(dir, path17));
17250
- this._addToNodeFs(path17, initialAdd, wh, depth + 1);
17249
+ path18 = sp.join(dir, sp.relative(dir, path18));
17250
+ this._addToNodeFs(path18, initialAdd, wh, depth + 1);
17251
17251
  }
17252
17252
  }).on(EV.ERROR, this._boundHandleError);
17253
- return new Promise((resolve11, reject) => {
17253
+ return new Promise((resolve12, reject) => {
17254
17254
  if (!stream)
17255
17255
  return reject();
17256
17256
  stream.once(STR_END, () => {
@@ -17259,7 +17259,7 @@ var NodeFsHandler = class {
17259
17259
  return;
17260
17260
  }
17261
17261
  const wasThrottled = throttler ? throttler.clear() : false;
17262
- resolve11(void 0);
17262
+ resolve12(void 0);
17263
17263
  previous.getChildren().filter((item) => {
17264
17264
  return item !== directory && !current.has(item);
17265
17265
  }).forEach((item) => {
@@ -17316,13 +17316,13 @@ var NodeFsHandler = class {
17316
17316
  * @param depth Child path actually targeted for watch
17317
17317
  * @param target Child path actually targeted for watch
17318
17318
  */
17319
- async _addToNodeFs(path17, initialAdd, priorWh, depth, target) {
17319
+ async _addToNodeFs(path18, initialAdd, priorWh, depth, target) {
17320
17320
  const ready = this.fsw._emitReady;
17321
- if (this.fsw._isIgnored(path17) || this.fsw.closed) {
17321
+ if (this.fsw._isIgnored(path18) || this.fsw.closed) {
17322
17322
  ready();
17323
17323
  return false;
17324
17324
  }
17325
- const wh = this.fsw._getWatchHelpers(path17);
17325
+ const wh = this.fsw._getWatchHelpers(path18);
17326
17326
  if (priorWh) {
17327
17327
  wh.filterPath = (entry) => priorWh.filterPath(entry);
17328
17328
  wh.filterDir = (entry) => priorWh.filterDir(entry);
@@ -17338,8 +17338,8 @@ var NodeFsHandler = class {
17338
17338
  const follow = this.fsw.options.followSymlinks;
17339
17339
  let closer;
17340
17340
  if (stats.isDirectory()) {
17341
- const absPath = sp.resolve(path17);
17342
- const targetPath = follow ? await (0, import_promises2.realpath)(path17) : path17;
17341
+ const absPath = sp.resolve(path18);
17342
+ const targetPath = follow ? await (0, import_promises2.realpath)(path18) : path18;
17343
17343
  if (this.fsw.closed)
17344
17344
  return;
17345
17345
  closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
@@ -17349,29 +17349,29 @@ var NodeFsHandler = class {
17349
17349
  this.fsw._symlinkPaths.set(absPath, targetPath);
17350
17350
  }
17351
17351
  } else if (stats.isSymbolicLink()) {
17352
- const targetPath = follow ? await (0, import_promises2.realpath)(path17) : path17;
17352
+ const targetPath = follow ? await (0, import_promises2.realpath)(path18) : path18;
17353
17353
  if (this.fsw.closed)
17354
17354
  return;
17355
17355
  const parent = sp.dirname(wh.watchPath);
17356
17356
  this.fsw._getWatchedDir(parent).add(wh.watchPath);
17357
17357
  this.fsw._emit(EV.ADD, wh.watchPath, stats);
17358
- closer = await this._handleDir(parent, stats, initialAdd, depth, path17, wh, targetPath);
17358
+ closer = await this._handleDir(parent, stats, initialAdd, depth, path18, wh, targetPath);
17359
17359
  if (this.fsw.closed)
17360
17360
  return;
17361
17361
  if (targetPath !== void 0) {
17362
- this.fsw._symlinkPaths.set(sp.resolve(path17), targetPath);
17362
+ this.fsw._symlinkPaths.set(sp.resolve(path18), targetPath);
17363
17363
  }
17364
17364
  } else {
17365
17365
  closer = this._handleFile(wh.watchPath, stats, initialAdd);
17366
17366
  }
17367
17367
  ready();
17368
17368
  if (closer)
17369
- this.fsw._addPathCloser(path17, closer);
17369
+ this.fsw._addPathCloser(path18, closer);
17370
17370
  return false;
17371
17371
  } catch (error48) {
17372
17372
  if (this.fsw._handleError(error48)) {
17373
17373
  ready();
17374
- return path17;
17374
+ return path18;
17375
17375
  }
17376
17376
  }
17377
17377
  }
@@ -17414,24 +17414,24 @@ function createPattern(matcher) {
17414
17414
  }
17415
17415
  return () => false;
17416
17416
  }
17417
- function normalizePath(path17) {
17418
- if (typeof path17 !== "string")
17417
+ function normalizePath(path18) {
17418
+ if (typeof path18 !== "string")
17419
17419
  throw new Error("string expected");
17420
- path17 = sp2.normalize(path17);
17421
- path17 = path17.replace(/\\/g, "/");
17420
+ path18 = sp2.normalize(path18);
17421
+ path18 = path18.replace(/\\/g, "/");
17422
17422
  let prepend = false;
17423
- if (path17.startsWith("//"))
17423
+ if (path18.startsWith("//"))
17424
17424
  prepend = true;
17425
- path17 = path17.replace(DOUBLE_SLASH_RE, "/");
17425
+ path18 = path18.replace(DOUBLE_SLASH_RE, "/");
17426
17426
  if (prepend)
17427
- path17 = "/" + path17;
17428
- return path17;
17427
+ path18 = "/" + path18;
17428
+ return path18;
17429
17429
  }
17430
17430
  function matchPatterns(patterns, testString, stats) {
17431
- const path17 = normalizePath(testString);
17431
+ const path18 = normalizePath(testString);
17432
17432
  for (let index = 0; index < patterns.length; index++) {
17433
17433
  const pattern = patterns[index];
17434
- if (pattern(path17, stats)) {
17434
+ if (pattern(path18, stats)) {
17435
17435
  return true;
17436
17436
  }
17437
17437
  }
@@ -17469,19 +17469,19 @@ var toUnix = (string4) => {
17469
17469
  }
17470
17470
  return str;
17471
17471
  };
17472
- var normalizePathToUnix = (path17) => toUnix(sp2.normalize(toUnix(path17)));
17473
- var normalizeIgnored = (cwd = "") => (path17) => {
17474
- if (typeof path17 === "string") {
17475
- return normalizePathToUnix(sp2.isAbsolute(path17) ? path17 : sp2.join(cwd, path17));
17472
+ var normalizePathToUnix = (path18) => toUnix(sp2.normalize(toUnix(path18)));
17473
+ var normalizeIgnored = (cwd = "") => (path18) => {
17474
+ if (typeof path18 === "string") {
17475
+ return normalizePathToUnix(sp2.isAbsolute(path18) ? path18 : sp2.join(cwd, path18));
17476
17476
  } else {
17477
- return path17;
17477
+ return path18;
17478
17478
  }
17479
17479
  };
17480
- var getAbsolutePath = (path17, cwd) => {
17481
- if (sp2.isAbsolute(path17)) {
17482
- return path17;
17480
+ var getAbsolutePath = (path18, cwd) => {
17481
+ if (sp2.isAbsolute(path18)) {
17482
+ return path18;
17483
17483
  }
17484
- return sp2.join(cwd, path17);
17484
+ return sp2.join(cwd, path18);
17485
17485
  };
17486
17486
  var EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set());
17487
17487
  var DirEntry = class {
@@ -17546,10 +17546,10 @@ var WatchHelper = class {
17546
17546
  dirParts;
17547
17547
  followSymlinks;
17548
17548
  statMethod;
17549
- constructor(path17, follow, fsw) {
17549
+ constructor(path18, follow, fsw) {
17550
17550
  this.fsw = fsw;
17551
- const watchPath = path17;
17552
- this.path = path17 = path17.replace(REPLACER_RE, "");
17551
+ const watchPath = path18;
17552
+ this.path = path18 = path18.replace(REPLACER_RE, "");
17553
17553
  this.watchPath = watchPath;
17554
17554
  this.fullWatchPath = sp2.resolve(watchPath);
17555
17555
  this.dirParts = [];
@@ -17689,20 +17689,20 @@ var FSWatcher = class extends import_node_events.EventEmitter {
17689
17689
  this._closePromise = void 0;
17690
17690
  let paths = unifyPaths(paths_);
17691
17691
  if (cwd) {
17692
- paths = paths.map((path17) => {
17693
- const absPath = getAbsolutePath(path17, cwd);
17692
+ paths = paths.map((path18) => {
17693
+ const absPath = getAbsolutePath(path18, cwd);
17694
17694
  return absPath;
17695
17695
  });
17696
17696
  }
17697
- paths.forEach((path17) => {
17698
- this._removeIgnoredPath(path17);
17697
+ paths.forEach((path18) => {
17698
+ this._removeIgnoredPath(path18);
17699
17699
  });
17700
17700
  this._userIgnored = void 0;
17701
17701
  if (!this._readyCount)
17702
17702
  this._readyCount = 0;
17703
17703
  this._readyCount += paths.length;
17704
- Promise.all(paths.map(async (path17) => {
17705
- const res = await this._nodeFsHandler._addToNodeFs(path17, !_internal, void 0, 0, _origAdd);
17704
+ Promise.all(paths.map(async (path18) => {
17705
+ const res = await this._nodeFsHandler._addToNodeFs(path18, !_internal, void 0, 0, _origAdd);
17706
17706
  if (res)
17707
17707
  this._emitReady();
17708
17708
  return res;
@@ -17724,17 +17724,17 @@ var FSWatcher = class extends import_node_events.EventEmitter {
17724
17724
  return this;
17725
17725
  const paths = unifyPaths(paths_);
17726
17726
  const { cwd } = this.options;
17727
- paths.forEach((path17) => {
17728
- if (!sp2.isAbsolute(path17) && !this._closers.has(path17)) {
17727
+ paths.forEach((path18) => {
17728
+ if (!sp2.isAbsolute(path18) && !this._closers.has(path18)) {
17729
17729
  if (cwd)
17730
- path17 = sp2.join(cwd, path17);
17731
- path17 = sp2.resolve(path17);
17730
+ path18 = sp2.join(cwd, path18);
17731
+ path18 = sp2.resolve(path18);
17732
17732
  }
17733
- this._closePath(path17);
17734
- this._addIgnoredPath(path17);
17735
- if (this._watched.has(path17)) {
17733
+ this._closePath(path18);
17734
+ this._addIgnoredPath(path18);
17735
+ if (this._watched.has(path18)) {
17736
17736
  this._addIgnoredPath({
17737
- path: path17,
17737
+ path: path18,
17738
17738
  recursive: true
17739
17739
  });
17740
17740
  }
@@ -17798,38 +17798,38 @@ var FSWatcher = class extends import_node_events.EventEmitter {
17798
17798
  * @param stats arguments to be passed with event
17799
17799
  * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
17800
17800
  */
17801
- async _emit(event, path17, stats) {
17801
+ async _emit(event, path18, stats) {
17802
17802
  if (this.closed)
17803
17803
  return;
17804
17804
  const opts = this.options;
17805
17805
  if (isWindows)
17806
- path17 = sp2.normalize(path17);
17806
+ path18 = sp2.normalize(path18);
17807
17807
  if (opts.cwd)
17808
- path17 = sp2.relative(opts.cwd, path17);
17809
- const args = [path17];
17808
+ path18 = sp2.relative(opts.cwd, path18);
17809
+ const args = [path18];
17810
17810
  if (stats != null)
17811
17811
  args.push(stats);
17812
17812
  const awf = opts.awaitWriteFinish;
17813
17813
  let pw;
17814
- if (awf && (pw = this._pendingWrites.get(path17))) {
17814
+ if (awf && (pw = this._pendingWrites.get(path18))) {
17815
17815
  pw.lastChange = /* @__PURE__ */ new Date();
17816
17816
  return this;
17817
17817
  }
17818
17818
  if (opts.atomic) {
17819
17819
  if (event === EVENTS.UNLINK) {
17820
- this._pendingUnlinks.set(path17, [event, ...args]);
17820
+ this._pendingUnlinks.set(path18, [event, ...args]);
17821
17821
  setTimeout(() => {
17822
- this._pendingUnlinks.forEach((entry, path18) => {
17822
+ this._pendingUnlinks.forEach((entry, path19) => {
17823
17823
  this.emit(...entry);
17824
17824
  this.emit(EVENTS.ALL, ...entry);
17825
- this._pendingUnlinks.delete(path18);
17825
+ this._pendingUnlinks.delete(path19);
17826
17826
  });
17827
17827
  }, typeof opts.atomic === "number" ? opts.atomic : 100);
17828
17828
  return this;
17829
17829
  }
17830
- if (event === EVENTS.ADD && this._pendingUnlinks.has(path17)) {
17830
+ if (event === EVENTS.ADD && this._pendingUnlinks.has(path18)) {
17831
17831
  event = EVENTS.CHANGE;
17832
- this._pendingUnlinks.delete(path17);
17832
+ this._pendingUnlinks.delete(path18);
17833
17833
  }
17834
17834
  }
17835
17835
  if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
@@ -17847,16 +17847,16 @@ var FSWatcher = class extends import_node_events.EventEmitter {
17847
17847
  this.emitWithAll(event, args);
17848
17848
  }
17849
17849
  };
17850
- this._awaitWriteFinish(path17, awf.stabilityThreshold, event, awfEmit);
17850
+ this._awaitWriteFinish(path18, awf.stabilityThreshold, event, awfEmit);
17851
17851
  return this;
17852
17852
  }
17853
17853
  if (event === EVENTS.CHANGE) {
17854
- const isThrottled = !this._throttle(EVENTS.CHANGE, path17, 50);
17854
+ const isThrottled = !this._throttle(EVENTS.CHANGE, path18, 50);
17855
17855
  if (isThrottled)
17856
17856
  return this;
17857
17857
  }
17858
17858
  if (opts.alwaysStat && stats === void 0 && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
17859
- const fullPath = opts.cwd ? sp2.join(opts.cwd, path17) : path17;
17859
+ const fullPath = opts.cwd ? sp2.join(opts.cwd, path18) : path18;
17860
17860
  let stats2;
17861
17861
  try {
17862
17862
  stats2 = await (0, import_promises3.stat)(fullPath);
@@ -17887,23 +17887,23 @@ var FSWatcher = class extends import_node_events.EventEmitter {
17887
17887
  * @param timeout duration of time to suppress duplicate actions
17888
17888
  * @returns tracking object or false if action should be suppressed
17889
17889
  */
17890
- _throttle(actionType, path17, timeout) {
17890
+ _throttle(actionType, path18, timeout) {
17891
17891
  if (!this._throttled.has(actionType)) {
17892
17892
  this._throttled.set(actionType, /* @__PURE__ */ new Map());
17893
17893
  }
17894
17894
  const action = this._throttled.get(actionType);
17895
17895
  if (!action)
17896
17896
  throw new Error("invalid throttle");
17897
- const actionPath = action.get(path17);
17897
+ const actionPath = action.get(path18);
17898
17898
  if (actionPath) {
17899
17899
  actionPath.count++;
17900
17900
  return false;
17901
17901
  }
17902
17902
  let timeoutObject;
17903
17903
  const clear = () => {
17904
- const item = action.get(path17);
17904
+ const item = action.get(path18);
17905
17905
  const count = item ? item.count : 0;
17906
- action.delete(path17);
17906
+ action.delete(path18);
17907
17907
  clearTimeout(timeoutObject);
17908
17908
  if (item)
17909
17909
  clearTimeout(item.timeoutObject);
@@ -17911,7 +17911,7 @@ var FSWatcher = class extends import_node_events.EventEmitter {
17911
17911
  };
17912
17912
  timeoutObject = setTimeout(clear, timeout);
17913
17913
  const thr = { timeoutObject, clear, count: 0 };
17914
- action.set(path17, thr);
17914
+ action.set(path18, thr);
17915
17915
  return thr;
17916
17916
  }
17917
17917
  _incrReadyCount() {
@@ -17925,44 +17925,44 @@ var FSWatcher = class extends import_node_events.EventEmitter {
17925
17925
  * @param event
17926
17926
  * @param awfEmit Callback to be called when ready for event to be emitted.
17927
17927
  */
17928
- _awaitWriteFinish(path17, threshold, event, awfEmit) {
17928
+ _awaitWriteFinish(path18, threshold, event, awfEmit) {
17929
17929
  const awf = this.options.awaitWriteFinish;
17930
17930
  if (typeof awf !== "object")
17931
17931
  return;
17932
17932
  const pollInterval = awf.pollInterval;
17933
17933
  let timeoutHandler;
17934
- let fullPath = path17;
17935
- if (this.options.cwd && !sp2.isAbsolute(path17)) {
17936
- fullPath = sp2.join(this.options.cwd, path17);
17934
+ let fullPath = path18;
17935
+ if (this.options.cwd && !sp2.isAbsolute(path18)) {
17936
+ fullPath = sp2.join(this.options.cwd, path18);
17937
17937
  }
17938
17938
  const now = /* @__PURE__ */ new Date();
17939
17939
  const writes = this._pendingWrites;
17940
17940
  function awaitWriteFinishFn(prevStat) {
17941
17941
  (0, import_node_fs2.stat)(fullPath, (err, curStat) => {
17942
- if (err || !writes.has(path17)) {
17942
+ if (err || !writes.has(path18)) {
17943
17943
  if (err && err.code !== "ENOENT")
17944
17944
  awfEmit(err);
17945
17945
  return;
17946
17946
  }
17947
17947
  const now2 = Number(/* @__PURE__ */ new Date());
17948
17948
  if (prevStat && curStat.size !== prevStat.size) {
17949
- writes.get(path17).lastChange = now2;
17949
+ writes.get(path18).lastChange = now2;
17950
17950
  }
17951
- const pw = writes.get(path17);
17951
+ const pw = writes.get(path18);
17952
17952
  const df = now2 - pw.lastChange;
17953
17953
  if (df >= threshold) {
17954
- writes.delete(path17);
17954
+ writes.delete(path18);
17955
17955
  awfEmit(void 0, curStat);
17956
17956
  } else {
17957
17957
  timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
17958
17958
  }
17959
17959
  });
17960
17960
  }
17961
- if (!writes.has(path17)) {
17962
- writes.set(path17, {
17961
+ if (!writes.has(path18)) {
17962
+ writes.set(path18, {
17963
17963
  lastChange: now,
17964
17964
  cancelWait: () => {
17965
- writes.delete(path17);
17965
+ writes.delete(path18);
17966
17966
  clearTimeout(timeoutHandler);
17967
17967
  return event;
17968
17968
  }
@@ -17973,8 +17973,8 @@ var FSWatcher = class extends import_node_events.EventEmitter {
17973
17973
  /**
17974
17974
  * Determines whether user has asked to ignore this path.
17975
17975
  */
17976
- _isIgnored(path17, stats) {
17977
- if (this.options.atomic && DOT_RE.test(path17))
17976
+ _isIgnored(path18, stats) {
17977
+ if (this.options.atomic && DOT_RE.test(path18))
17978
17978
  return true;
17979
17979
  if (!this._userIgnored) {
17980
17980
  const { cwd } = this.options;
@@ -17984,17 +17984,17 @@ var FSWatcher = class extends import_node_events.EventEmitter {
17984
17984
  const list = [...ignoredPaths.map(normalizeIgnored(cwd)), ...ignored];
17985
17985
  this._userIgnored = anymatch(list, void 0);
17986
17986
  }
17987
- return this._userIgnored(path17, stats);
17987
+ return this._userIgnored(path18, stats);
17988
17988
  }
17989
- _isntIgnored(path17, stat4) {
17990
- return !this._isIgnored(path17, stat4);
17989
+ _isntIgnored(path18, stat4) {
17990
+ return !this._isIgnored(path18, stat4);
17991
17991
  }
17992
17992
  /**
17993
17993
  * Provides a set of common helpers and properties relating to symlink handling.
17994
17994
  * @param path file or directory pattern being watched
17995
17995
  */
17996
- _getWatchHelpers(path17) {
17997
- return new WatchHelper(path17, this.options.followSymlinks, this);
17996
+ _getWatchHelpers(path18) {
17997
+ return new WatchHelper(path18, this.options.followSymlinks, this);
17998
17998
  }
17999
17999
  // Directory helpers
18000
18000
  // -----------------
@@ -18026,63 +18026,63 @@ var FSWatcher = class extends import_node_events.EventEmitter {
18026
18026
  * @param item base path of item/directory
18027
18027
  */
18028
18028
  _remove(directory, item, isDirectory) {
18029
- const path17 = sp2.join(directory, item);
18030
- const fullPath = sp2.resolve(path17);
18031
- isDirectory = isDirectory != null ? isDirectory : this._watched.has(path17) || this._watched.has(fullPath);
18032
- if (!this._throttle("remove", path17, 100))
18029
+ const path18 = sp2.join(directory, item);
18030
+ const fullPath = sp2.resolve(path18);
18031
+ isDirectory = isDirectory != null ? isDirectory : this._watched.has(path18) || this._watched.has(fullPath);
18032
+ if (!this._throttle("remove", path18, 100))
18033
18033
  return;
18034
18034
  if (!isDirectory && this._watched.size === 1) {
18035
18035
  this.add(directory, item, true);
18036
18036
  }
18037
- const wp = this._getWatchedDir(path17);
18037
+ const wp = this._getWatchedDir(path18);
18038
18038
  const nestedDirectoryChildren = wp.getChildren();
18039
- nestedDirectoryChildren.forEach((nested) => this._remove(path17, nested));
18039
+ nestedDirectoryChildren.forEach((nested) => this._remove(path18, nested));
18040
18040
  const parent = this._getWatchedDir(directory);
18041
18041
  const wasTracked = parent.has(item);
18042
18042
  parent.remove(item);
18043
18043
  if (this._symlinkPaths.has(fullPath)) {
18044
18044
  this._symlinkPaths.delete(fullPath);
18045
18045
  }
18046
- let relPath = path17;
18046
+ let relPath = path18;
18047
18047
  if (this.options.cwd)
18048
- relPath = sp2.relative(this.options.cwd, path17);
18048
+ relPath = sp2.relative(this.options.cwd, path18);
18049
18049
  if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
18050
18050
  const event = this._pendingWrites.get(relPath).cancelWait();
18051
18051
  if (event === EVENTS.ADD)
18052
18052
  return;
18053
18053
  }
18054
- this._watched.delete(path17);
18054
+ this._watched.delete(path18);
18055
18055
  this._watched.delete(fullPath);
18056
18056
  const eventName = isDirectory ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
18057
- if (wasTracked && !this._isIgnored(path17))
18058
- this._emit(eventName, path17);
18059
- this._closePath(path17);
18057
+ if (wasTracked && !this._isIgnored(path18))
18058
+ this._emit(eventName, path18);
18059
+ this._closePath(path18);
18060
18060
  }
18061
18061
  /**
18062
18062
  * Closes all watchers for a path
18063
18063
  */
18064
- _closePath(path17) {
18065
- this._closeFile(path17);
18066
- const dir = sp2.dirname(path17);
18067
- this._getWatchedDir(dir).remove(sp2.basename(path17));
18064
+ _closePath(path18) {
18065
+ this._closeFile(path18);
18066
+ const dir = sp2.dirname(path18);
18067
+ this._getWatchedDir(dir).remove(sp2.basename(path18));
18068
18068
  }
18069
18069
  /**
18070
18070
  * Closes only file-specific watchers
18071
18071
  */
18072
- _closeFile(path17) {
18073
- const closers = this._closers.get(path17);
18072
+ _closeFile(path18) {
18073
+ const closers = this._closers.get(path18);
18074
18074
  if (!closers)
18075
18075
  return;
18076
18076
  closers.forEach((closer) => closer());
18077
- this._closers.delete(path17);
18077
+ this._closers.delete(path18);
18078
18078
  }
18079
- _addPathCloser(path17, closer) {
18079
+ _addPathCloser(path18, closer) {
18080
18080
  if (!closer)
18081
18081
  return;
18082
- let list = this._closers.get(path17);
18082
+ let list = this._closers.get(path18);
18083
18083
  if (!list) {
18084
18084
  list = [];
18085
- this._closers.set(path17, list);
18085
+ this._closers.set(path18, list);
18086
18086
  }
18087
18087
  list.push(closer);
18088
18088
  }
@@ -18205,8 +18205,8 @@ var SessionHostClient = class {
18205
18205
  }
18206
18206
  this.requestWaiters.clear();
18207
18207
  });
18208
- await new Promise((resolve11, reject) => {
18209
- socket.once("connect", () => resolve11());
18208
+ await new Promise((resolve12, reject) => {
18209
+ socket.once("connect", () => resolve12());
18210
18210
  socket.once("error", reject);
18211
18211
  });
18212
18212
  }
@@ -18225,8 +18225,8 @@ var SessionHostClient = class {
18225
18225
  requestId,
18226
18226
  request
18227
18227
  };
18228
- const response = await new Promise((resolve11, reject) => {
18229
- this.requestWaiters.set(requestId, { resolve: resolve11, reject });
18228
+ const response = await new Promise((resolve12, reject) => {
18229
+ this.requestWaiters.set(requestId, { resolve: resolve12, reject });
18230
18230
  this.socket?.write(serializeEnvelope(envelope));
18231
18231
  });
18232
18232
  return response;
@@ -18239,12 +18239,12 @@ var SessionHostClient = class {
18239
18239
  waiter.reject(new Error("Session host client closed"));
18240
18240
  }
18241
18241
  this.requestWaiters.clear();
18242
- await new Promise((resolve11) => {
18242
+ await new Promise((resolve12) => {
18243
18243
  let settled = false;
18244
18244
  const done = () => {
18245
18245
  if (settled) return;
18246
18246
  settled = true;
18247
- resolve11();
18247
+ resolve12();
18248
18248
  };
18249
18249
  socket.once("close", done);
18250
18250
  socket.end();
@@ -18284,8 +18284,8 @@ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: t
18284
18284
  function expandPath(p) {
18285
18285
  const t = (p || "").trim();
18286
18286
  if (!t) return "";
18287
- if (t.startsWith("~")) return path3.join(os2.homedir(), t.slice(1).replace(/^\//, ""));
18288
- return path3.resolve(t);
18287
+ if (t.startsWith("~")) return path.join(os2.homedir(), t.slice(1).replace(/^\//, ""));
18288
+ return path.resolve(t);
18289
18289
  }
18290
18290
  function validateWorkspacePath(absPath) {
18291
18291
  try {
@@ -18299,7 +18299,7 @@ function validateWorkspacePath(absPath) {
18299
18299
  }
18300
18300
  }
18301
18301
  function defaultWorkspaceLabel(absPath) {
18302
- const base = path3.basename(absPath) || absPath;
18302
+ const base = path.basename(absPath) || absPath;
18303
18303
  return base;
18304
18304
  }
18305
18305
  function migrateWorkspacesFromRecent(config2) {
@@ -18310,7 +18310,7 @@ function migrateWorkspacesFromRecent(config2) {
18310
18310
  for (const raw of recent) {
18311
18311
  const abs = expandPath(raw);
18312
18312
  if (!abs || validateWorkspacePath(abs).ok !== true) continue;
18313
- if (config2.workspaces.some((w) => path3.resolve(w.path) === abs)) continue;
18313
+ if (config2.workspaces.some((w) => path.resolve(w.path) === abs)) continue;
18314
18314
  config2.workspaces.push({
18315
18315
  id: (0, import_crypto2.randomUUID)(),
18316
18316
  path: abs,
@@ -18409,16 +18409,16 @@ function resolveIdeLaunchWorkspace(args, config2) {
18409
18409
  return getDefaultWorkspacePath(config2) || void 0;
18410
18410
  }
18411
18411
  function findWorkspaceByPath(config2, rawPath) {
18412
- const abs = path3.resolve(expandPath(rawPath));
18412
+ const abs = path.resolve(expandPath(rawPath));
18413
18413
  if (!abs) return void 0;
18414
- return (config2.workspaces || []).find((w) => path3.resolve(expandPath(w.path)) === abs);
18414
+ return (config2.workspaces || []).find((w) => path.resolve(expandPath(w.path)) === abs);
18415
18415
  }
18416
18416
  function addWorkspaceEntry(config2, rawPath, label) {
18417
18417
  const abs = expandPath(rawPath);
18418
18418
  const v = validateWorkspacePath(abs);
18419
18419
  if (!v.ok) return { error: v.error };
18420
18420
  const list = [...config2.workspaces || []];
18421
- if (list.some((w) => path3.resolve(w.path) === abs)) {
18421
+ if (list.some((w) => path.resolve(w.path) === abs)) {
18422
18422
  return { error: "Workspace already in list" };
18423
18423
  }
18424
18424
  if (list.length >= MAX_WORKSPACES) {
@@ -18654,7 +18654,7 @@ function checkDateRotation() {
18654
18654
  const today = getDateStr();
18655
18655
  if (today !== currentDate) {
18656
18656
  currentDate = today;
18657
- currentLogFile = path32.join(LOG_DIR, `daemon-${currentDate}.log`);
18657
+ currentLogFile = path3.join(LOG_DIR, `daemon-${currentDate}.log`);
18658
18658
  cleanOldLogs();
18659
18659
  }
18660
18660
  }
@@ -18668,7 +18668,7 @@ function cleanOldLogs() {
18668
18668
  const dateMatch = file2.match(/daemon-(\d{4}-\d{2}-\d{2})/);
18669
18669
  if (dateMatch && dateMatch[1] < cutoffStr) {
18670
18670
  try {
18671
- fs2.unlinkSync(path32.join(LOG_DIR, file2));
18671
+ fs2.unlinkSync(path3.join(LOG_DIR, file2));
18672
18672
  } catch {
18673
18673
  }
18674
18674
  }
@@ -18808,7 +18808,7 @@ var init_logger = __esm2({
18808
18808
  LEVEL_NUM = { debug: 0, info: 1, warn: 2, error: 3 };
18809
18809
  LEVEL_LABEL = { debug: "DBG", info: "INF", warn: "WRN", error: "ERR" };
18810
18810
  currentLevel = "info";
18811
- LOG_DIR = process.platform === "darwin" ? path32.join(os4.homedir(), "Library", "Logs", "adhdev") : path32.join(os4.homedir(), ".local", "share", "adhdev", "logs");
18811
+ LOG_DIR = process.platform === "darwin" ? path3.join(os4.homedir(), "Library", "Logs", "adhdev") : path3.join(os4.homedir(), ".local", "share", "adhdev", "logs");
18812
18812
  MAX_LOG_SIZE = 5 * 1024 * 1024;
18813
18813
  MAX_LOG_DAYS = 7;
18814
18814
  try {
@@ -18816,16 +18816,16 @@ var init_logger = __esm2({
18816
18816
  } catch {
18817
18817
  }
18818
18818
  currentDate = getDateStr();
18819
- currentLogFile = path32.join(LOG_DIR, `daemon-${currentDate}.log`);
18819
+ currentLogFile = path3.join(LOG_DIR, `daemon-${currentDate}.log`);
18820
18820
  cleanOldLogs();
18821
18821
  try {
18822
- const oldLog = path32.join(LOG_DIR, "daemon.log");
18822
+ const oldLog = path3.join(LOG_DIR, "daemon.log");
18823
18823
  if (fs2.existsSync(oldLog)) {
18824
18824
  const stat4 = fs2.statSync(oldLog);
18825
18825
  const oldDate = stat4.mtime.toISOString().slice(0, 10);
18826
- fs2.renameSync(oldLog, path32.join(LOG_DIR, `daemon-${oldDate}.log`));
18826
+ fs2.renameSync(oldLog, path3.join(LOG_DIR, `daemon-${oldDate}.log`));
18827
18827
  }
18828
- const oldLogBackup = path32.join(LOG_DIR, "daemon.log.old");
18828
+ const oldLogBackup = path3.join(LOG_DIR, "daemon.log.old");
18829
18829
  if (fs2.existsSync(oldLogBackup)) {
18830
18830
  fs2.unlinkSync(oldLogBackup);
18831
18831
  }
@@ -18857,7 +18857,7 @@ var init_logger = __esm2({
18857
18857
  }
18858
18858
  };
18859
18859
  interceptorInstalled = false;
18860
- LOG_PATH = path32.join(LOG_DIR, `daemon-${getDateStr()}.log`);
18860
+ LOG_PATH = path3.join(LOG_DIR, `daemon-${getDateStr()}.log`);
18861
18861
  }
18862
18862
  });
18863
18863
  function isModuleNotFoundError(error48, ref) {
@@ -18931,6 +18931,9 @@ var init_ghostty_vt_backend = __esm2({
18931
18931
  terminal;
18932
18932
  constructor(options) {
18933
18933
  const binding = loadGhosttyVtBinding(true);
18934
+ if (!binding) {
18935
+ throw new Error("ghostty-vt backend requested but no binding is available");
18936
+ }
18934
18937
  this.terminal = binding.createTerminal({
18935
18938
  cols: Math.max(1, options.cols | 0),
18936
18939
  rows: Math.max(1, options.rows | 0),
@@ -29644,7 +29647,7 @@ async function handleScriptsRun(ctx, req, res) {
29644
29647
  ctx.json(res, 400, { error: "type and script required" });
29645
29648
  return;
29646
29649
  }
29647
- await this.handleRunScript(type, req, res, body);
29650
+ await ctx.handleRunScript(type, req, res, body);
29648
29651
  }
29649
29652
  async function handleTypeAndSend(ctx, type, req, res) {
29650
29653
  const body = await ctx.readBody(req);
@@ -29685,7 +29688,7 @@ async function handleTypeAndSendAt(ctx, type, req, res) {
29685
29688
  }
29686
29689
  }
29687
29690
  async function handleScriptHints(ctx, type, _req, res) {
29688
- const dir = this.findProviderDir(type);
29691
+ const dir = ctx.findProviderDir(type);
29689
29692
  if (!dir) {
29690
29693
  ctx.json(res, 404, { error: `Provider not found: ${type}` });
29691
29694
  return;
@@ -33761,6 +33764,7 @@ async function shutdownDaemonComponents(components) {
33761
33764
 
33762
33765
  // src/session-host.ts
33763
33766
  var import_child_process8 = require("child_process");
33767
+ var path15 = __toESM(require("path"));
33764
33768
  var STARTUP_TIMEOUT_MS = 8e3;
33765
33769
  var STARTUP_POLL_MS = 200;
33766
33770
  var SESSION_HOST_APP_NAME = process.env.ADHDEV_SESSION_HOST_NAME || "adhdev";
@@ -33778,14 +33782,14 @@ async function waitForReady(endpoint, timeoutMs = STARTUP_TIMEOUT_MS) {
33778
33782
  const deadline = Date.now() + timeoutMs;
33779
33783
  while (Date.now() < deadline) {
33780
33784
  if (await canConnect(endpoint)) return;
33781
- await new Promise((resolve11) => setTimeout(resolve11, STARTUP_POLL_MS));
33785
+ await new Promise((resolve12) => setTimeout(resolve12, STARTUP_POLL_MS));
33782
33786
  }
33783
33787
  throw new Error(`Session host did not become ready within ${timeoutMs}ms`);
33784
33788
  }
33785
33789
  function resolveSessionHostEntry() {
33786
33790
  const localCandidates = [
33787
- path.resolve(__dirname, "../vendor/session-host-daemon/index.js"),
33788
- path.resolve(__dirname, "../../vendor/session-host-daemon/index.js")
33791
+ path15.resolve(__dirname, "../vendor/session-host-daemon/index.js"),
33792
+ path15.resolve(__dirname, "../../vendor/session-host-daemon/index.js")
33789
33793
  ];
33790
33794
  for (const candidate of localCandidates) {
33791
33795
  if (require("fs").existsSync(candidate)) {
@@ -33803,9 +33807,9 @@ async function runSessionHostCli(args) {
33803
33807
  ADHDEV_SESSION_HOST_NAME: SESSION_HOST_APP_NAME
33804
33808
  }
33805
33809
  });
33806
- return await new Promise((resolve11, reject) => {
33810
+ return await new Promise((resolve12, reject) => {
33807
33811
  child.on("error", reject);
33808
- child.on("exit", (code) => resolve11(code ?? 0));
33812
+ child.on("exit", (code) => resolve12(code ?? 0));
33809
33813
  });
33810
33814
  }
33811
33815
  async function ensureSessionHostReady() {
@@ -33930,8 +33934,8 @@ var AdhMuxControlClient = class {
33930
33934
  }
33931
33935
  this.waiters.clear();
33932
33936
  });
33933
- await new Promise((resolve11, reject) => {
33934
- socket.once("connect", () => resolve11());
33937
+ await new Promise((resolve12, reject) => {
33938
+ socket.once("connect", () => resolve12());
33935
33939
  socket.once("error", reject);
33936
33940
  });
33937
33941
  }
@@ -33940,8 +33944,8 @@ var AdhMuxControlClient = class {
33940
33944
  if (!this.socket) throw new Error("adhmux control socket unavailable");
33941
33945
  const requestId = `${Date.now()}-${Math.random().toString(36).slice(2)}`;
33942
33946
  const envelope = { kind: "request", requestId, request };
33943
- const response = await new Promise((resolve11, reject) => {
33944
- this.waiters.set(requestId, { resolve: resolve11, reject });
33947
+ const response = await new Promise((resolve12, reject) => {
33948
+ this.waiters.set(requestId, { resolve: resolve12, reject });
33945
33949
  this.socket?.write(serializeEnvelope2(envelope));
33946
33950
  });
33947
33951
  return response;
@@ -33960,12 +33964,12 @@ var AdhMuxControlClient = class {
33960
33964
  waiter.reject(new Error("adhmux control client closed"));
33961
33965
  }
33962
33966
  this.waiters.clear();
33963
- await new Promise((resolve11) => {
33967
+ await new Promise((resolve12) => {
33964
33968
  let settled = false;
33965
33969
  const done = () => {
33966
33970
  if (settled) return;
33967
33971
  settled = true;
33968
- resolve11();
33972
+ resolve12();
33969
33973
  };
33970
33974
  socket.once("close", done);
33971
33975
  socket.end();
@@ -34023,8 +34027,8 @@ var pkgVersion = process.env.ADHDEV_PKG_VERSION || "unknown";
34023
34027
  if (pkgVersion === "unknown") {
34024
34028
  try {
34025
34029
  const possiblePaths = [
34026
- path16.join(__dirname, "..", "package.json"),
34027
- path16.join(__dirname, "package.json")
34030
+ path17.join(__dirname, "..", "package.json"),
34031
+ path17.join(__dirname, "package.json")
34028
34032
  ];
34029
34033
  for (const candidate of possiblePaths) {
34030
34034
  try {
@@ -34128,9 +34132,9 @@ var StandaloneServer = class {
34128
34132
  this.broadcastStatus();
34129
34133
  }, STATUS_INTERVAL);
34130
34134
  this.running = true;
34131
- await new Promise((resolve11) => {
34135
+ await new Promise((resolve12) => {
34132
34136
  this.httpServer.listen(port, host, () => {
34133
- resolve11();
34137
+ resolve12();
34134
34138
  });
34135
34139
  });
34136
34140
  console.log("");
@@ -34324,9 +34328,9 @@ var StandaloneServer = class {
34324
34328
  }
34325
34329
  if (publicDir) {
34326
34330
  const filePath = url2 === "/" ? "/index.html" : url2;
34327
- const fullPath = path16.join(publicDir, filePath);
34331
+ const fullPath = path17.join(publicDir, filePath);
34328
34332
  if (fs12.existsSync(fullPath) && fs12.statSync(fullPath).isFile()) {
34329
- const ext = path16.extname(fullPath);
34333
+ const ext = path17.extname(fullPath);
34330
34334
  const mimeTypes = {
34331
34335
  ".html": "text/html",
34332
34336
  ".js": "application/javascript",
@@ -34341,7 +34345,7 @@ var StandaloneServer = class {
34341
34345
  fs12.createReadStream(fullPath).pipe(res);
34342
34346
  return;
34343
34347
  }
34344
- const indexPath = path16.join(publicDir, "index.html");
34348
+ const indexPath = path17.join(publicDir, "index.html");
34345
34349
  if (fs12.existsSync(indexPath) && !url2.startsWith("/api/")) {
34346
34350
  res.writeHead(200, { "Content-Type": "text/html" });
34347
34351
  fs12.createReadStream(indexPath).pipe(res);
@@ -34648,12 +34652,12 @@ Runtime commands:
34648
34652
  }
34649
34653
  if (!options.publicDir) {
34650
34654
  const candidates = [
34651
- path16.join(__dirname, "../../web-standalone/dist"),
34652
- path16.join(__dirname, "../public"),
34653
- path16.join(process.cwd(), "public")
34655
+ path17.join(__dirname, "../../web-standalone/dist"),
34656
+ path17.join(__dirname, "../public"),
34657
+ path17.join(process.cwd(), "public")
34654
34658
  ];
34655
34659
  for (const candidate of candidates) {
34656
- if (fs12.existsSync(path16.join(candidate, "index.html"))) {
34660
+ if (fs12.existsSync(path17.join(candidate, "index.html"))) {
34657
34661
  options.publicDir = candidate;
34658
34662
  break;
34659
34663
  }