@floless/app 0.68.0 → 0.70.0

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.
@@ -6006,7 +6006,7 @@ var require_transport = __commonJS({
6006
6006
  "node_modules/pino/lib/transport.js"(exports2, module2) {
6007
6007
  "use strict";
6008
6008
  var { createRequire: createRequire5 } = require("module");
6009
- var { existsSync: existsSync25 } = require("node:fs");
6009
+ var { existsSync: existsSync26 } = require("node:fs");
6010
6010
  var getCallers = require_caller();
6011
6011
  var { join: join30, isAbsolute: isAbsolute2, sep: sep4 } = require("node:path");
6012
6012
  var { fileURLToPath: fileURLToPath6 } = require("node:url");
@@ -6080,7 +6080,7 @@ var require_transport = __commonJS({
6080
6080
  return false;
6081
6081
  }
6082
6082
  }
6083
- return isAbsolute2(path) && !existsSync25(path);
6083
+ return isAbsolute2(path) && !existsSync26(path);
6084
6084
  }
6085
6085
  function stripQuotes(value) {
6086
6086
  const first = value[0];
@@ -41990,7 +41990,7 @@ var require_send = __commonJS({
41990
41990
  var { parseBytesRange } = require_parseBytesRange();
41991
41991
  var { parseTokenList } = require_parseTokenList();
41992
41992
  var { createHttpError } = require_createHttpError();
41993
- var extname2 = path.extname;
41993
+ var extname3 = path.extname;
41994
41994
  var join30 = path.join;
41995
41995
  var normalize2 = path.normalize;
41996
41996
  var resolve6 = path.resolve;
@@ -42377,7 +42377,7 @@ var require_send = __commonJS({
42377
42377
  }
42378
42378
  async function sendFile(request, path2, options) {
42379
42379
  const { error, stat: stat4 } = await tryStat(path2);
42380
- if (error && error.code === "ENOENT" && !extname2(path2) && path2[path2.length - 1] !== sep4) {
42380
+ if (error && error.code === "ENOENT" && !extname3(path2) && path2[path2.length - 1] !== sep4) {
42381
42381
  let err2 = error;
42382
42382
  for (let i = 0; i < options.extensions.length; i++) {
42383
42383
  const extension = options.extensions[i];
@@ -43012,7 +43012,7 @@ var require_static = __commonJS({
43012
43012
  "use strict";
43013
43013
  var path = require("node:path");
43014
43014
  var { fileURLToPath: fileURLToPath6 } = require("node:url");
43015
- var { statSync: statSync8 } = require("node:fs");
43015
+ var { statSync: statSync9 } = require("node:fs");
43016
43016
  var { glob } = require_commonjs6();
43017
43017
  var fp = require_plugin2();
43018
43018
  var send = require_send2();
@@ -43145,8 +43145,8 @@ var require_static = __commonJS({
43145
43145
  }
43146
43146
  }
43147
43147
  }
43148
- for (const [dirname13, rootPath] of indexDirs.entries()) {
43149
- const pathname = dirname13 + (dirname13.endsWith("/") ? "" : "/");
43148
+ for (const [dirname14, rootPath] of indexDirs.entries()) {
43149
+ const pathname = dirname14 + (dirname14.endsWith("/") ? "" : "/");
43150
43150
  const file = "/" + pathname.replace(prefix, "");
43151
43151
  setUpHeadAndGet(routeOpts, pathname, file, rootPath);
43152
43152
  if (opts.redirect === true) {
@@ -43375,7 +43375,7 @@ var require_static = __commonJS({
43375
43375
  }
43376
43376
  let pathStat;
43377
43377
  try {
43378
- pathStat = statSync8(rootPath);
43378
+ pathStat = statSync9(rootPath);
43379
43379
  } catch (e) {
43380
43380
  if (e.code === "ENOENT") {
43381
43381
  fastify.log.warn(`"root" path "${rootPath}" must exist`);
@@ -43399,7 +43399,7 @@ var require_static = __commonJS({
43399
43399
  return indexFiles.find((filename) => {
43400
43400
  const p = path.join(root, pathname, filename);
43401
43401
  try {
43402
- const stats = statSync8(p);
43402
+ const stats = statSync9(p);
43403
43403
  return !stats.isDirectory();
43404
43404
  } catch {
43405
43405
  return false;
@@ -50822,15 +50822,15 @@ function deriveSandboxLicenseDir() {
50822
50822
  deriveSandboxLicenseDir();
50823
50823
 
50824
50824
  // main.ts
50825
- var import_node_child_process9 = require("node:child_process");
50825
+ var import_node_child_process10 = require("node:child_process");
50826
50826
  var import_node_readline2 = require("node:readline");
50827
50827
 
50828
50828
  // index.ts
50829
50829
  var import_node_url5 = require("node:url");
50830
- var import_node_path28 = require("node:path");
50830
+ var import_node_path29 = require("node:path");
50831
50831
  var import_node_os20 = require("node:os");
50832
- var import_node_fs30 = require("node:fs");
50833
- var import_node_child_process7 = require("node:child_process");
50832
+ var import_node_fs31 = require("node:fs");
50833
+ var import_node_child_process8 = require("node:child_process");
50834
50834
 
50835
50835
  // log.mjs
50836
50836
  var import_node_path = require("node:path");
@@ -53022,7 +53022,7 @@ function appVersion() {
53022
53022
  return resolveVersion({
53023
53023
  isSea: isSea2(),
53024
53024
  sqVersionXml: readSqVersionXml(),
53025
- define: true ? "0.68.0" : void 0,
53025
+ define: true ? "0.70.0" : void 0,
53026
53026
  pkgVersion: readPkgVersion()
53027
53027
  });
53028
53028
  }
@@ -53032,7 +53032,7 @@ function resolveChannel(s) {
53032
53032
  return "dev";
53033
53033
  }
53034
53034
  function appChannel() {
53035
- return resolveChannel({ isSea: isSea2(), define: true ? "0.68.0" : void 0 });
53035
+ return resolveChannel({ isSea: isSea2(), define: true ? "0.70.0" : void 0 });
53036
53036
  }
53037
53037
 
53038
53038
  // workflow-update.ts
@@ -53325,6 +53325,72 @@ function extractReportHtml(events) {
53325
53325
  return found;
53326
53326
  }
53327
53327
 
53328
+ // open-file.ts
53329
+ var import_node_child_process3 = require("node:child_process");
53330
+ var import_node_fs12 = require("node:fs");
53331
+ var import_node_path11 = require("node:path");
53332
+ var OPENABLE_EXTS = /* @__PURE__ */ new Set([".xls", ".xlsx", ".html", ".htm", ".csv"]);
53333
+ function hasOpenableExt(path) {
53334
+ return OPENABLE_EXTS.has((0, import_node_path11.extname)(path).toLowerCase());
53335
+ }
53336
+ function validateOpenable(path) {
53337
+ if (typeof path !== "string" || !path.trim()) return { ok: false, error: "path required" };
53338
+ if (path.includes("%")) return { ok: false, error: "unsupported file path" };
53339
+ if (!hasOpenableExt(path)) return { ok: false, error: "unsupported file type" };
53340
+ let isFile = false;
53341
+ try {
53342
+ isFile = (0, import_node_fs12.existsSync)(path) && (0, import_node_fs12.statSync)(path).isFile();
53343
+ } catch {
53344
+ isFile = false;
53345
+ }
53346
+ if (!isFile) return { ok: false, error: "file not found" };
53347
+ return { ok: true, path };
53348
+ }
53349
+ function openFileCommand(path, platform = process.platform) {
53350
+ if (platform === "win32") {
53351
+ return {
53352
+ cmd: "cmd",
53353
+ args: ["/c", "start", '""', `"${path}"`],
53354
+ opts: { windowsHide: true, windowsVerbatimArguments: true }
53355
+ };
53356
+ }
53357
+ return { cmd: platform === "darwin" ? "open" : "xdg-open", args: [path], opts: { detached: true } };
53358
+ }
53359
+ function revealCommand(path, platform = process.platform) {
53360
+ if (platform === "win32") {
53361
+ return { cmd: "explorer", args: [`/select,"${path}"`], opts: { windowsVerbatimArguments: true } };
53362
+ }
53363
+ if (platform === "darwin") {
53364
+ return { cmd: "open", args: ["-R", path], opts: { detached: true } };
53365
+ }
53366
+ return { cmd: "xdg-open", args: [(0, import_node_path11.dirname)(path)], opts: { detached: true } };
53367
+ }
53368
+ function launchDisabled() {
53369
+ return process.env.FLOLESS_LAUNCH_NOOP === "1";
53370
+ }
53371
+ function fireAndForget(cmd) {
53372
+ (0, import_node_child_process3.spawn)(cmd.cmd, cmd.args, cmd.opts).on("error", (err2) => console.warn(`[open-file] launch failed (${cmd.cmd}):`, err2.message)).unref();
53373
+ }
53374
+ function launchFile(path) {
53375
+ if (launchDisabled()) return;
53376
+ fireAndForget(openFileCommand(path));
53377
+ }
53378
+ function revealFile(path) {
53379
+ if (launchDisabled()) return;
53380
+ fireAndForget(revealCommand(path));
53381
+ }
53382
+ function extractSavedPath(events) {
53383
+ let found = null;
53384
+ for (const ev of events) {
53385
+ const data = ev?.data;
53386
+ if (!data || typeof data !== "object") continue;
53387
+ const result = data.result;
53388
+ const raw = typeof data.saved_path === "string" ? data.saved_path : result && typeof result.saved_path === "string" ? result.saved_path : null;
53389
+ if (raw && raw.trim() && hasOpenableExt(raw)) found = raw;
53390
+ }
53391
+ return found;
53392
+ }
53393
+
53328
53394
  // aisc-shapes.json
53329
53395
  var aisc_shapes_default = { "C10X15.3": 2.6, C10X20: 2.74, C10X25: 2.89, C10X30: 3.03, "C12X20.7": 2.94, C12X25: 3.05, C12X30: 3.17, "C15X33.9": 3.4, C15X40: 3.52, C15X50: 3.72, "C3X3.5": 1.37, "C3X4.1": 1.41, C3X5: 1.5, C3X6: 1.6, "C4X4.5": 1.52, "C4X5.4": 1.58, "C4X6.25": 1.65, "C4X7.25": 1.72, "C5X6.7": 1.75, C5X9: 1.89, "C6X10.5": 2.03, C6X13: 2.16, "C6X8.2": 1.92, "C7X12.25": 2.19, "C7X14.75": 2.3, "C7X9.8": 2.09, "C8X11.5": 2.26, "C8X13.75": 2.34, "C8X18.75": 2.53, "C9X13.4": 2.43, C9X15: 2.49, C9X20: 2.65, HP10X42: 10.1, HP10X57: 10.2, HP12X53: 12, HP12X63: 12.1, HP12X74: 12.2, HP12X84: 12.3, HP12X89: 12.3, HP14X102: 14.8, HP14X117: 14.9, HP14X73: 14.6, HP14X89: 14.7, HP16X101: 15.8, HP16X121: 15.9, HP16X141: 16, HP16X162: 16.1, HP16X183: 16.3, HP16X88: 15.7, HP18X135: 17.8, HP18X157: 17.9, HP18X181: 18, HP18X204: 18.1, HP8X36: 8.16, "M10X7.5": 2.69, M10X8: 2.69, M10X9: 2.69, "M12.5X11.6": 3.5, "M12.5X12.4": 3.75, M12X10: 3.25, "M12X10.8": 3.07, "M12X11.8": 3.07, "M3X2.9": 2.25, "M4X3.2": 2.25, "M4X3.45": 2.25, "M4X4.08": 2.25, M4X6: 3.8, "M5X18.9": 5, "M6X3.7": 2, "M6X4.4": 1.84, "M8X6.2": 2.28, "M8X6.5": 2.28, MC10X22: 3.32, MC10X25: 3.41, "MC10X28.5": 3.95, "MC10X33.6": 4.1, "MC10X41.1": 4.32, "MC10X6.5": 1.17, "MC10X8.4": 1.5, "MC12X10.6": 1.5, "MC12X14.3": 2.12, MC12X31: 3.67, MC12X35: 3.77, MC12X40: 3.89, MC12X45: 4.01, MC12X50: 4.14, "MC13X31.8": 4, MC13X35: 4.07, MC13X40: 4.19, MC13X50: 4.41, "MC18X42.7": 3.95, "MC18X45.8": 4, "MC18X51.9": 4.1, MC18X58: 4.2, "MC3X7.1": 1.94, "MC4X13.8": 2.5, MC6X12: 2.5, "MC6X15.1": 2.94, "MC6X15.3": 3.5, "MC6X16.3": 3, MC6X18: 3.5, "MC6X6.5": 1.85, MC6X7: 1.88, "MC7X19.1": 3.45, "MC7X22.7": 3.6, "MC8X18.7": 2.98, MC8X20: 3.03, "MC8X21.4": 3.45, "MC8X22.8": 3.5, "MC8X8.5": 1.87, "MC9X23.9": 3.45, "MC9X25.4": 3.5, "MT2.5X9.45": 5, MT2X3: 3.8, "MT3X1.85": 2, "MT3X2.2": 1.84, "MT4X3.1": 2.28, "MT4X3.25": 2.28, "MT5X3.75": 2.69, MT5X4: 2.69, "MT5X4.5": 2.69, "MT6.25X5.8": 3.5, "MT6.25X6.2": 3.75, MT6X5: 3.25, "MT6X5.4": 3.07, "MT6X5.9": 3.07, "S10X25.4": 4.66, S10X35: 4.94, "S12X31.8": 5, S12X35: 5.08, "S12X40.8": 5.25, S12X50: 5.48, "S15X42.9": 5.5, S15X50: 5.64, "S18X54.7": 6, S18X70: 6.25, S20X66: 6.26, S20X75: 6.39, S20X86: 7.06, S20X96: 7.2, S24X100: 7.25, S24X106: 7.87, S24X121: 8.05, S24X80: 7, S24X90: 7.13, "S3X5.7": 2.33, "S3X7.5": 2.51, "S4X7.7": 2.66, "S4X9.5": 2.8, S5X10: 3, "S6X12.5": 3.33, "S6X17.25": 3.57, "S8X18.4": 4, S8X23: 4.17, "ST1.5X2.85": 2.33, "ST1.5X3.75": 2.51, ST10X33: 6.26, "ST10X37.5": 6.39, ST10X43: 7.06, ST10X48: 7.2, ST12X40: 7, ST12X45: 7.13, ST12X50: 7.25, ST12X53: 7.87, "ST12X60.5": 8.05, "ST2.5X5": 3, "ST2X3.85": 2.66, "ST2X4.75": 2.8, "ST3X6.25": 3.33, "ST3X8.6": 3.57, "ST4X11.5": 4.17, "ST4X9.2": 4, "ST5X12.7": 4.66, "ST5X17.5": 4.94, "ST6X15.9": 5, "ST6X17.5": 5.08, "ST6X20.4": 5.25, ST6X25: 5.48, "ST7.5X21.45": 5.5, "ST7.5X25": 5.64, "ST9X27.35": 6, ST9X35: 6.25, W10X100: 10.3, W10X112: 10.4, W10X12: 3.96, W10X15: 4, W10X17: 4.01, W10X19: 4.02, W10X22: 5.75, W10X26: 5.77, W10X30: 5.81, W10X33: 7.96, W10X39: 7.99, W10X45: 8.02, W10X49: 10, W10X54: 10, W10X60: 10.1, W10X68: 10.1, W10X77: 10.2, W10X88: 10.3, W12X106: 12.2, W12X120: 12.3, W12X136: 12.4, W12X14: 3.97, W12X152: 12.5, W12X16: 3.99, W12X170: 12.6, W12X19: 4.01, W12X190: 12.7, W12X210: 12.8, W12X22: 4.03, W12X230: 12.9, W12X252: 13, W12X26: 6.49, W12X279: 13.1, W12X30: 6.52, W12X305: 13.2, W12X336: 13.4, W12X35: 6.56, W12X40: 8.01, W12X45: 8.05, W12X50: 8.08, W12X53: 10, W12X58: 10, W12X65: 12, W12X72: 12, W12X79: 12.1, W12X87: 12.1, W12X96: 12.2, W14X109: 14.6, W14X120: 14.7, W14X132: 14.7, W14X145: 15.5, W14X159: 15.6, W14X176: 15.7, W14X193: 15.7, W14X211: 15.8, W14X22: 5, W14X233: 15.9, W14X257: 16, W14X26: 5.03, W14X283: 16.1, W14X30: 6.73, W14X311: 16.2, W14X34: 6.75, W14X342: 16.4, W14X370: 16.5, W14X38: 6.77, W14X398: 16.6, W14X426: 16.7, W14X43: 8, W14X455: 16.8, W14X48: 8.03, W14X500: 17, W14X53: 8.06, W14X550: 17.2, W14X605: 17.4, W14X61: 10, W14X665: 17.7, W14X68: 10, W14X730: 17.9, W14X74: 10.1, W14X808: 18.6, W14X82: 10.1, W14X873: 18.8, W14X90: 14.5, W14X99: 14.6, W16X100: 10.4, W16X26: 5.5, W16X31: 5.53, W16X36: 6.99, W16X40: 7, W16X45: 7.04, W16X50: 7.07, W16X57: 7.12, W16X67: 10.2, W16X77: 10.3, W16X89: 10.4, W18X106: 11.2, W18X119: 11.3, W18X130: 11.2, W18X143: 11.2, W18X158: 11.3, W18X175: 11.4, W18X192: 11.5, W18X211: 11.6, W18X234: 11.7, W18X258: 11.8, W18X283: 11.9, W18X311: 12, W18X35: 6, W18X40: 6.02, W18X46: 6.06, W18X50: 7.5, W18X55: 7.53, W18X60: 7.56, W18X65: 7.59, W18X71: 7.64, W18X76: 11, W18X86: 11.1, W18X97: 11.1, W21X101: 12.3, W21X111: 12.3, W21X122: 12.4, W21X132: 12.4, W21X147: 12.5, W21X166: 12.4, W21X182: 12.5, W21X201: 12.6, W21X223: 12.7, W21X248: 12.8, W21X275: 12.9, W21X44: 6.5, W21X48: 8.14, W21X50: 6.53, W21X55: 8.22, W21X57: 6.56, W21X62: 8.24, W21X68: 8.27, W21X73: 8.3, W21X83: 8.36, W21X93: 8.42, W24X103: 9, W24X104: 12.8, W24X117: 12.8, W24X131: 12.9, W24X146: 12.9, W24X162: 13, W24X176: 12.9, W24X192: 13, W24X207: 13, W24X229: 13.1, W24X250: 13.2, W24X279: 13.3, W24X306: 13.4, W24X335: 13.5, W24X370: 13.7, W24X55: 7.01, W24X62: 7.04, W24X68: 8.97, W24X76: 8.99, W24X84: 9.02, W24X94: 9.07, W27X102: 10, W27X114: 10.1, W27X129: 10, W27X146: 14, W27X161: 14, W27X178: 14.1, W27X194: 14, W27X217: 14.1, W27X235: 14.2, W27X258: 14.3, W27X281: 14.4, W27X307: 14.4, W27X336: 14.6, W27X368: 14.7, W27X539: 15.3, W27X84: 10, W27X94: 10, W30X108: 10.5, W30X116: 10.5, W30X124: 10.5, W30X132: 10.5, W30X148: 10.5, W30X173: 15, W30X191: 15, W30X211: 15.1, W30X235: 15.1, W30X261: 15.2, W30X292: 15.3, W30X326: 15.4, W30X357: 15.5, W30X391: 15.6, W30X90: 10.4, W30X99: 10.5, W33X118: 11.5, W33X130: 11.5, W33X141: 11.5, W33X152: 11.6, W33X169: 11.5, W33X201: 15.7, W33X221: 15.8, W33X241: 15.9, W33X263: 15.8, W33X291: 15.9, W33X318: 16, W33X354: 16.1, W33X387: 16.2, W36X135: 12, W36X150: 12, W36X160: 12, W36X170: 12, W36X182: 12.1, W36X194: 12.1, W36X210: 12.2, W36X231: 16.5, W36X232: 12.1, W36X247: 16.5, W36X256: 12.2, W36X262: 16.6, W36X282: 16.6, W36X302: 16.7, W36X330: 16.6, W36X361: 16.7, W36X395: 16.8, W36X441: 17, W36X487: 17.1, W36X529: 17.2, W36X652: 17.6, W36X723: 17.8, W36X802: 18, W36X853: 18.2, W36X925: 18.6, W40X149: 11.8, W40X167: 11.8, W40X183: 11.8, W40X199: 15.8, W40X211: 11.8, W40X215: 15.8, W40X235: 11.9, W40X249: 15.8, W40X264: 11.9, W40X277: 15.8, W40X278: 12, W40X294: 12, W40X297: 15.8, W40X324: 15.9, W40X327: 12.1, W40X331: 12.2, W40X362: 16, W40X372: 16.1, W40X392: 12.4, W40X397: 16.1, W40X431: 16.2, W40X503: 16.4, W40X593: 16.7, W40X655: 16.9, W44X230: 15.8, W44X262: 15.8, W44X290: 15.8, W44X335: 15.9, W4X13: 4.06, W5X16: 5, W5X19: 5.03, W6X12: 4, W6X15: 5.99, W6X16: 4.03, W6X20: 6.02, W6X25: 6.08, "W6X8.5": 3.94, W6X9: 3.94, W8X10: 3.94, W8X13: 4, W8X15: 4.02, W8X18: 5.25, W8X21: 5.27, W8X24: 6.5, W8X28: 6.54, W8X31: 8, W8X35: 8.02, W8X40: 8.07, W8X48: 8.11, W8X58: 8.22, W8X67: 8.28, "WT10.5X100.5": 12.6, "WT10.5X111.5": 12.7, "WT10.5X124": 12.8, "WT10.5X137.5": 12.9, "WT10.5X22": 6.5, "WT10.5X24": 8.14, "WT10.5X25": 6.53, "WT10.5X27.5": 8.22, "WT10.5X28.5": 6.56, "WT10.5X31": 8.24, "WT10.5X34": 8.27, "WT10.5X36.5": 8.3, "WT10.5X41.5": 8.36, "WT10.5X46.5": 8.42, "WT10.5X50.5": 12.3, "WT10.5X55.5": 12.3, "WT10.5X61": 12.4, "WT10.5X66": 12.4, "WT10.5X73.5": 12.5, "WT10.5X83": 12.4, "WT10.5X91": 12.5, "WT12X103.5": 13, "WT12X114.5": 13.1, WT12X125: 13.2, "WT12X139.5": 13.3, WT12X153: 13.4, "WT12X167.5": 13.5, WT12X185: 13.7, "WT12X27.5": 7.01, WT12X31: 7.04, WT12X34: 8.97, WT12X38: 8.99, WT12X42: 9.02, WT12X47: 9.07, "WT12X51.5": 9, WT12X52: 12.8, "WT12X58.5": 12.8, "WT12X65.5": 12.9, WT12X73: 12.9, WT12X81: 13, WT12X88: 12.9, WT12X96: 13, "WT13.5X108.5": 14.1, "WT13.5X117.5": 14.2, "WT13.5X129": 14.3, "WT13.5X140.5": 14.4, "WT13.5X153.5": 14.4, "WT13.5X168": 14.6, "WT13.5X184": 14.7, "WT13.5X269.5": 15.3, "WT13.5X42": 10, "WT13.5X47": 10, "WT13.5X51": 10, "WT13.5X57": 10.1, "WT13.5X64.5": 10, "WT13.5X73": 14, "WT13.5X80.5": 14, "WT13.5X89": 14.1, "WT13.5X97": 14, "WT15X105.5": 15.1, "WT15X117.5": 15.1, "WT15X130.5": 15.2, WT15X146: 15.3, WT15X163: 15.4, "WT15X178.5": 15.5, "WT15X195.5": 15.6, WT15X45: 10.4, "WT15X49.5": 10.5, WT15X54: 10.5, WT15X58: 10.5, WT15X62: 10.5, WT15X66: 10.5, WT15X74: 10.5, "WT15X86.5": 15, "WT15X95.5": 15, "WT16.5X100.5": 15.7, "WT16.5X110.5": 15.8, "WT16.5X120.5": 15.9, "WT16.5X131.5": 15.8, "WT16.5X145.5": 15.9, "WT16.5X159": 16, "WT16.5X177": 16.1, "WT16.5X193.5": 16.2, "WT16.5X59": 11.5, "WT16.5X65": 11.5, "WT16.5X70.5": 11.5, "WT16.5X76": 11.6, "WT16.5X84.5": 11.5, WT18X105: 12.2, "WT18X115.5": 16.5, WT18X116: 12.1, "WT18X123.5": 16.5, WT18X128: 12.2, WT18X131: 16.6, WT18X141: 16.6, WT18X151: 16.7, WT18X165: 16.6, "WT18X180.5": 16.7, "WT18X197.5": 16.8, "WT18X220.5": 17, "WT18X243.5": 17.1, "WT18X264.5": 17.2, WT18X326: 17.6, "WT18X361.5": 17.8, WT18X401: 18, "WT18X426.5": 18.2, "WT18X462.5": 18.6, "WT18X67.5": 12, WT18X75: 12, WT18X80: 12, WT18X85: 12, WT18X91: 12.1, WT18X97: 12.1, "WT2.5X8": 5, "WT2.5X9.5": 5.03, "WT20X105.5": 11.8, "WT20X107.5": 15.8, "WT20X117.5": 11.9, "WT20X124.5": 15.8, WT20X132: 11.9, "WT20X138.5": 15.8, WT20X139: 12, WT20X147: 12, "WT20X148.5": 15.8, WT20X162: 15.9, "WT20X163.5": 12.1, "WT20X165.5": 12.2, WT20X181: 16, WT20X186: 16.1, WT20X196: 12.4, "WT20X198.5": 16.1, "WT20X215.5": 16.2, "WT20X251.5": 16.4, "WT20X296.5": 16.7, "WT20X327.5": 16.9, "WT20X74.5": 11.8, "WT20X83.5": 11.8, "WT20X91.5": 11.8, "WT20X99.5": 15.8, WT22X115: 15.8, WT22X131: 15.8, WT22X145: 15.8, "WT22X167.5": 15.9, "WT2X6.5": 4.06, WT3X10: 6.02, "WT3X12.5": 6.08, "WT3X4.25": 3.94, "WT3X4.5": 3.94, WT3X6: 4, "WT3X7.5": 5.99, WT3X8: 4.03, "WT4X10.5": 5.27, WT4X12: 6.5, WT4X14: 6.54, "WT4X15.5": 8, "WT4X17.5": 8.02, WT4X20: 8.07, WT4X24: 8.11, WT4X29: 8.22, "WT4X33.5": 8.28, WT4X5: 3.94, "WT4X6.5": 4, "WT4X7.5": 4.02, WT4X9: 5.25, WT5X11: 5.75, WT5X13: 5.77, WT5X15: 5.81, "WT5X16.5": 7.96, "WT5X19.5": 7.99, "WT5X22.5": 8.02, "WT5X24.5": 10, WT5X27: 10, WT5X30: 10.1, WT5X34: 10.1, "WT5X38.5": 10.2, WT5X44: 10.3, WT5X50: 10.3, WT5X56: 10.4, WT5X6: 3.96, "WT5X7.5": 4, "WT5X8.5": 4.01, "WT5X9.5": 4.02, WT6X105: 12.8, WT6X11: 4.03, WT6X115: 12.9, WT6X126: 13, WT6X13: 6.49, "WT6X139.5": 13.1, WT6X15: 6.52, "WT6X152.5": 13.2, WT6X168: 13.4, "WT6X17.5": 6.56, WT6X20: 8.01, "WT6X22.5": 8.05, WT6X25: 8.08, "WT6X26.5": 10, WT6X29: 10, "WT6X32.5": 12, WT6X36: 12, "WT6X39.5": 12.1, "WT6X43.5": 12.1, WT6X48: 12.2, WT6X53: 12.2, WT6X60: 12.3, WT6X68: 12.4, WT6X7: 3.97, WT6X76: 12.5, WT6X8: 3.99, WT6X85: 12.6, "WT6X9.5": 4.01, WT6X95: 12.7, "WT7X105.5": 15.8, WT7X11: 5, "WT7X116.5": 15.9, "WT7X128.5": 16, WT7X13: 5.03, "WT7X141.5": 16.1, WT7X15: 6.73, "WT7X155.5": 16.2, WT7X17: 6.75, WT7X171: 16.4, WT7X185: 16.5, WT7X19: 6.77, WT7X199: 16.6, "WT7X21.5": 8, WT7X213: 16.7, "WT7X227.5": 16.8, WT7X24: 8.03, WT7X250: 17, "WT7X26.5": 8.06, WT7X275: 17.2, "WT7X30.5": 10, "WT7X302.5": 17.4, "WT7X332.5": 17.7, WT7X34: 10, WT7X365: 17.9, WT7X37: 10.1, WT7X404: 18.6, WT7X41: 10.1, "WT7X436.5": 18.8, WT7X45: 14.5, "WT7X49.5": 14.6, "WT7X54.5": 14.6, WT7X60: 14.7, WT7X66: 14.7, "WT7X72.5": 15.5, "WT7X79.5": 15.6, WT7X88: 15.7, "WT7X96.5": 15.7, WT8X13: 5.5, "WT8X15.5": 5.53, WT8X18: 6.99, WT8X20: 7, "WT8X22.5": 7.04, WT8X25: 7.07, "WT8X28.5": 7.12, "WT8X33.5": 10.2, "WT8X38.5": 10.3, "WT8X44.5": 10.4, WT8X50: 10.4, "WT9X105.5": 11.6, WT9X117: 11.7, WT9X129: 11.8, "WT9X141.5": 11.9, "WT9X155.5": 12, "WT9X17.5": 6, WT9X20: 6.02, WT9X23: 6.06, WT9X25: 7.5, "WT9X27.5": 7.53, WT9X30: 7.56, "WT9X32.5": 7.59, "WT9X35.5": 7.64, WT9X38: 11, WT9X43: 11.1, "WT9X48.5": 11.1, WT9X53: 11.2, "WT9X59.5": 11.3, WT9X65: 11.2, "WT9X71.5": 11.2, WT9X79: 11.3, "WT9X87.5": 11.4, WT9X96: 11.5 };
53330
53396
 
@@ -53373,16 +53439,16 @@ function buildPreview(m, sourceKind, sourceRef, stagedRef) {
53373
53439
  }
53374
53440
 
53375
53441
  // graft-manifest-reader.ts
53376
- var import_node_fs12 = require("node:fs");
53377
- var import_node_path11 = require("node:path");
53442
+ var import_node_fs13 = require("node:fs");
53443
+ var import_node_path12 = require("node:path");
53378
53444
  var import_yaml4 = __toESM(require_dist6(), 1);
53379
53445
  var asRecord2 = (v) => v && typeof v === "object" && !Array.isArray(v) ? v : {};
53380
53446
  function readStagedManifest(agentDir) {
53381
- const manifestPath = (0, import_node_path11.join)(agentDir, "manifest.yaml");
53382
- if (!(0, import_node_fs12.existsSync)(manifestPath)) return null;
53447
+ const manifestPath = (0, import_node_path12.join)(agentDir, "manifest.yaml");
53448
+ if (!(0, import_node_fs13.existsSync)(manifestPath)) return null;
53383
53449
  let doc;
53384
53450
  try {
53385
- doc = asRecord2((0, import_yaml4.parse)((0, import_node_fs12.readFileSync)(manifestPath, "utf8")));
53451
+ doc = asRecord2((0, import_yaml4.parse)((0, import_node_fs13.readFileSync)(manifestPath, "utf8")));
53386
53452
  } catch {
53387
53453
  return null;
53388
53454
  }
@@ -53412,10 +53478,10 @@ function readStagedManifest(agentDir) {
53412
53478
  }
53413
53479
  let skillCount = Array.isArray(doc.skills) ? doc.skills.length : 0;
53414
53480
  if (!skillCount) {
53415
- const skillsDir = (0, import_node_path11.join)(agentDir, "skills");
53416
- if ((0, import_node_fs12.existsSync)(skillsDir)) {
53481
+ const skillsDir = (0, import_node_path12.join)(agentDir, "skills");
53482
+ if ((0, import_node_fs13.existsSync)(skillsDir)) {
53417
53483
  try {
53418
- skillCount = (0, import_node_fs12.readdirSync)(skillsDir).filter((f) => f.endsWith(".md")).length;
53484
+ skillCount = (0, import_node_fs13.readdirSync)(skillsDir).filter((f) => f.endsWith(".md")).length;
53419
53485
  } catch {
53420
53486
  }
53421
53487
  }
@@ -53429,7 +53495,7 @@ function readStagedManifest(agentDir) {
53429
53495
  }
53430
53496
 
53431
53497
  // graft-stage-registry.ts
53432
- var import_node_fs13 = require("node:fs");
53498
+ var import_node_fs14 = require("node:fs");
53433
53499
  var TTL_MS = 30 * 60 * 1e3;
53434
53500
  var registry = /* @__PURE__ */ new Map();
53435
53501
  function registerStage(token, tempDir, agentId) {
@@ -53451,7 +53517,7 @@ function evict(token) {
53451
53517
  clearTimeout(e.timer);
53452
53518
  registry.delete(token);
53453
53519
  try {
53454
- (0, import_node_fs13.rmSync)(e.tempDir, { recursive: true, force: true });
53520
+ (0, import_node_fs14.rmSync)(e.tempDir, { recursive: true, force: true });
53455
53521
  } catch {
53456
53522
  }
53457
53523
  }
@@ -53460,8 +53526,8 @@ function clearAllStages() {
53460
53526
  }
53461
53527
 
53462
53528
  // graft-commit.ts
53463
- var import_node_fs14 = require("node:fs");
53464
- var import_node_path12 = require("node:path");
53529
+ var import_node_fs15 = require("node:fs");
53530
+ var import_node_path13 = require("node:path");
53465
53531
  var GraftCommitError = class extends Error {
53466
53532
  constructor(message, code) {
53467
53533
  super(message);
@@ -53471,34 +53537,34 @@ var GraftCommitError = class extends Error {
53471
53537
  code;
53472
53538
  };
53473
53539
  function commitStaged(tempDir, agentId, targetAgentsDir, force) {
53474
- const staged = (0, import_node_path12.join)(tempDir, "agents", agentId);
53475
- const target = (0, import_node_path12.join)(targetAgentsDir, agentId);
53476
- if ((0, import_node_fs14.existsSync)(target)) {
53540
+ const staged = (0, import_node_path13.join)(tempDir, "agents", agentId);
53541
+ const target = (0, import_node_path13.join)(targetAgentsDir, agentId);
53542
+ if ((0, import_node_fs15.existsSync)(target)) {
53477
53543
  if (!force) throw new GraftCommitError(`an agent named "${agentId}" is already installed`, "collision");
53478
- (0, import_node_fs14.rmSync)(target, { recursive: true, force: true });
53544
+ (0, import_node_fs15.rmSync)(target, { recursive: true, force: true });
53479
53545
  }
53480
- (0, import_node_fs14.mkdirSync)(targetAgentsDir, { recursive: true });
53546
+ (0, import_node_fs15.mkdirSync)(targetAgentsDir, { recursive: true });
53481
53547
  try {
53482
- (0, import_node_fs14.renameSync)(staged, target);
53548
+ (0, import_node_fs15.renameSync)(staged, target);
53483
53549
  } catch {
53484
- (0, import_node_fs14.cpSync)(staged, target, { recursive: true });
53550
+ (0, import_node_fs15.cpSync)(staged, target, { recursive: true });
53485
53551
  }
53486
- (0, import_node_fs14.rmSync)(tempDir, { recursive: true, force: true });
53552
+ (0, import_node_fs15.rmSync)(tempDir, { recursive: true, force: true });
53487
53553
  return { agentId };
53488
53554
  }
53489
53555
  function matchAssemblies(globOrDir) {
53490
53556
  let dir;
53491
53557
  let pattern;
53492
- if ((0, import_node_fs14.existsSync)(globOrDir) && (0, import_node_fs14.statSync)(globOrDir).isDirectory()) {
53558
+ if ((0, import_node_fs15.existsSync)(globOrDir) && (0, import_node_fs15.statSync)(globOrDir).isDirectory()) {
53493
53559
  dir = globOrDir;
53494
53560
  pattern = "*.dll";
53495
53561
  } else {
53496
- dir = (0, import_node_path12.dirname)(globOrDir);
53497
- pattern = (0, import_node_path12.basename)(globOrDir);
53562
+ dir = (0, import_node_path13.dirname)(globOrDir);
53563
+ pattern = (0, import_node_path13.basename)(globOrDir);
53498
53564
  }
53499
- if (!dir || !(0, import_node_fs14.existsSync)(dir) || !(0, import_node_fs14.statSync)(dir).isDirectory()) return [];
53565
+ if (!dir || !(0, import_node_fs15.existsSync)(dir) || !(0, import_node_fs15.statSync)(dir).isDirectory()) return [];
53500
53566
  const re = globToRegExp(pattern);
53501
- return (0, import_node_fs14.readdirSync)(dir).filter((f) => re.test(f)).sort();
53567
+ return (0, import_node_fs15.readdirSync)(dir).filter((f) => re.test(f)).sort();
53502
53568
  }
53503
53569
  function globToRegExp(p) {
53504
53570
  const esc = p.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*").replace(/\?/g, ".");
@@ -53507,24 +53573,24 @@ function globToRegExp(p) {
53507
53573
 
53508
53574
  // floless-store.ts
53509
53575
  var import_node_crypto5 = require("node:crypto");
53510
- var import_node_fs15 = require("node:fs");
53576
+ var import_node_fs16 = require("node:fs");
53511
53577
  var import_node_os11 = require("node:os");
53512
- var import_node_path13 = require("node:path");
53513
- var ROOT2 = process.env.FLOLESS_HOME ?? (0, import_node_path13.join)((0, import_node_os11.homedir)(), ".floless");
53514
- var TEMPLATES_FILE = (0, import_node_path13.join)(ROOT2, "templates.json");
53515
- var REQUESTS_DIR = (0, import_node_path13.join)(ROOT2, "requests");
53578
+ var import_node_path14 = require("node:path");
53579
+ var ROOT2 = process.env.FLOLESS_HOME ?? (0, import_node_path14.join)((0, import_node_os11.homedir)(), ".floless");
53580
+ var TEMPLATES_FILE = (0, import_node_path14.join)(ROOT2, "templates.json");
53581
+ var REQUESTS_DIR = (0, import_node_path14.join)(ROOT2, "requests");
53516
53582
  function ensureRoot() {
53517
- if (!(0, import_node_fs15.existsSync)(ROOT2)) (0, import_node_fs15.mkdirSync)(ROOT2, { recursive: true });
53583
+ if (!(0, import_node_fs16.existsSync)(ROOT2)) (0, import_node_fs16.mkdirSync)(ROOT2, { recursive: true });
53518
53584
  }
53519
53585
  function withinRequestsDir(p) {
53520
- const base = (0, import_node_path13.resolve)(REQUESTS_DIR);
53521
- const full = (0, import_node_path13.resolve)(p);
53522
- return full === base || full.startsWith(base + import_node_path13.sep);
53586
+ const base = (0, import_node_path14.resolve)(REQUESTS_DIR);
53587
+ const full = (0, import_node_path14.resolve)(p);
53588
+ return full === base || full.startsWith(base + import_node_path14.sep);
53523
53589
  }
53524
53590
  function listTemplates() {
53525
- if (!(0, import_node_fs15.existsSync)(TEMPLATES_FILE)) return [];
53591
+ if (!(0, import_node_fs16.existsSync)(TEMPLATES_FILE)) return [];
53526
53592
  try {
53527
- const parsed = JSON.parse((0, import_node_fs15.readFileSync)(TEMPLATES_FILE, "utf8"));
53593
+ const parsed = JSON.parse((0, import_node_fs16.readFileSync)(TEMPLATES_FILE, "utf8"));
53528
53594
  return Array.isArray(parsed) ? parsed : [];
53529
53595
  } catch {
53530
53596
  return [];
@@ -53533,8 +53599,8 @@ function listTemplates() {
53533
53599
  function writeTemplates(list) {
53534
53600
  ensureRoot();
53535
53601
  const tmp = `${TEMPLATES_FILE}.${process.pid}.tmp`;
53536
- (0, import_node_fs15.writeFileSync)(tmp, JSON.stringify(list, null, 2));
53537
- (0, import_node_fs15.renameSync)(tmp, TEMPLATES_FILE);
53602
+ (0, import_node_fs16.writeFileSync)(tmp, JSON.stringify(list, null, 2));
53603
+ (0, import_node_fs16.renameSync)(tmp, TEMPLATES_FILE);
53538
53604
  }
53539
53605
  function addTemplate(input) {
53540
53606
  const list = listTemplates();
@@ -53579,13 +53645,13 @@ function updateTemplate(id, patch2) {
53579
53645
  }
53580
53646
  function addRequest(req, decoded = []) {
53581
53647
  ensureRoot();
53582
- if (!(0, import_node_fs15.existsSync)(REQUESTS_DIR)) (0, import_node_fs15.mkdirSync)(REQUESTS_DIR, { recursive: true });
53648
+ if (!(0, import_node_fs16.existsSync)(REQUESTS_DIR)) (0, import_node_fs16.mkdirSync)(REQUESTS_DIR, { recursive: true });
53583
53649
  const id = (0, import_node_crypto5.randomUUID)();
53584
53650
  const createdAt = (/* @__PURE__ */ new Date()).toISOString();
53585
53651
  const base = `${createdAt.replace(/[:.]/g, "-")}__${id}`;
53586
53652
  const snapshots = decoded.map((d, i) => {
53587
- const p = (0, import_node_path13.join)(REQUESTS_DIR, `${base}__snap${i + 1}.${d.ext}`);
53588
- (0, import_node_fs15.writeFileSync)(p, d.buf);
53653
+ const p = (0, import_node_path14.join)(REQUESTS_DIR, `${base}__snap${i + 1}.${d.ext}`);
53654
+ (0, import_node_fs16.writeFileSync)(p, d.buf);
53589
53655
  return p;
53590
53656
  });
53591
53657
  const full = {
@@ -53595,55 +53661,55 @@ function addRequest(req, decoded = []) {
53595
53661
  ...req,
53596
53662
  ...snapshots.length ? { snapshots } : {}
53597
53663
  };
53598
- (0, import_node_fs15.writeFileSync)((0, import_node_path13.join)(REQUESTS_DIR, `${base}.json`), JSON.stringify(full, null, 2));
53664
+ (0, import_node_fs16.writeFileSync)((0, import_node_path14.join)(REQUESTS_DIR, `${base}.json`), JSON.stringify(full, null, 2));
53599
53665
  return full;
53600
53666
  }
53601
53667
  function listRequests() {
53602
- if (!(0, import_node_fs15.existsSync)(REQUESTS_DIR)) return [];
53603
- return (0, import_node_fs15.readdirSync)(REQUESTS_DIR).filter((f) => f.endsWith(".json")).sort().map((f) => {
53668
+ if (!(0, import_node_fs16.existsSync)(REQUESTS_DIR)) return [];
53669
+ return (0, import_node_fs16.readdirSync)(REQUESTS_DIR).filter((f) => f.endsWith(".json")).sort().map((f) => {
53604
53670
  try {
53605
- return JSON.parse((0, import_node_fs15.readFileSync)((0, import_node_path13.join)(REQUESTS_DIR, f), "utf8"));
53671
+ return JSON.parse((0, import_node_fs16.readFileSync)((0, import_node_path14.join)(REQUESTS_DIR, f), "utf8"));
53606
53672
  } catch {
53607
53673
  return null;
53608
53674
  }
53609
53675
  }).filter((r) => r !== null);
53610
53676
  }
53611
53677
  function deleteRequest(id) {
53612
- if (!(0, import_node_fs15.existsSync)(REQUESTS_DIR)) return false;
53613
- const file = (0, import_node_fs15.readdirSync)(REQUESTS_DIR).find((f) => f.endsWith(`__${id}.json`));
53678
+ if (!(0, import_node_fs16.existsSync)(REQUESTS_DIR)) return false;
53679
+ const file = (0, import_node_fs16.readdirSync)(REQUESTS_DIR).find((f) => f.endsWith(`__${id}.json`));
53614
53680
  if (!file) return false;
53615
53681
  try {
53616
- const parsed = JSON.parse((0, import_node_fs15.readFileSync)((0, import_node_path13.join)(REQUESTS_DIR, file), "utf8"));
53682
+ const parsed = JSON.parse((0, import_node_fs16.readFileSync)((0, import_node_path14.join)(REQUESTS_DIR, file), "utf8"));
53617
53683
  for (const p of parsed.snapshots ?? []) {
53618
53684
  if (!withinRequestsDir(p)) continue;
53619
53685
  try {
53620
- (0, import_node_fs15.rmSync)(p);
53686
+ (0, import_node_fs16.rmSync)(p);
53621
53687
  } catch {
53622
53688
  }
53623
53689
  }
53624
53690
  } catch {
53625
53691
  }
53626
- (0, import_node_fs15.rmSync)((0, import_node_path13.join)(REQUESTS_DIR, file));
53692
+ (0, import_node_fs16.rmSync)((0, import_node_path14.join)(REQUESTS_DIR, file));
53627
53693
  return true;
53628
53694
  }
53629
53695
  function clearRequests() {
53630
- if (!(0, import_node_fs15.existsSync)(REQUESTS_DIR)) return 0;
53631
- const allFiles = (0, import_node_fs15.readdirSync)(REQUESTS_DIR);
53696
+ if (!(0, import_node_fs16.existsSync)(REQUESTS_DIR)) return 0;
53697
+ const allFiles = (0, import_node_fs16.readdirSync)(REQUESTS_DIR);
53632
53698
  const jsonFiles = allFiles.filter((f) => f.endsWith(".json"));
53633
53699
  for (const f of allFiles) {
53634
53700
  try {
53635
- (0, import_node_fs15.rmSync)((0, import_node_path13.join)(REQUESTS_DIR, f));
53701
+ (0, import_node_fs16.rmSync)((0, import_node_path14.join)(REQUESTS_DIR, f));
53636
53702
  } catch {
53637
53703
  }
53638
53704
  }
53639
53705
  return jsonFiles.length;
53640
53706
  }
53641
53707
  function snapshotPathFor(id, n) {
53642
- if (!(0, import_node_fs15.existsSync)(REQUESTS_DIR)) return null;
53643
- const file = (0, import_node_fs15.readdirSync)(REQUESTS_DIR).find((f) => f.endsWith(`__${id}.json`));
53708
+ if (!(0, import_node_fs16.existsSync)(REQUESTS_DIR)) return null;
53709
+ const file = (0, import_node_fs16.readdirSync)(REQUESTS_DIR).find((f) => f.endsWith(`__${id}.json`));
53644
53710
  if (!file) return null;
53645
53711
  try {
53646
- const parsed = JSON.parse((0, import_node_fs15.readFileSync)((0, import_node_path13.join)(REQUESTS_DIR, file), "utf8"));
53712
+ const parsed = JSON.parse((0, import_node_fs16.readFileSync)((0, import_node_path14.join)(REQUESTS_DIR, file), "utf8"));
53647
53713
  const cand = parsed.snapshots?.[n] ?? null;
53648
53714
  return cand && withinRequestsDir(cand) ? cand : null;
53649
53715
  } catch {
@@ -53679,13 +53745,13 @@ function decodeSnapshots(inputs) {
53679
53745
  }
53680
53746
 
53681
53747
  // contract-store.ts
53682
- var import_node_fs17 = require("node:fs");
53683
- var import_node_path15 = require("node:path");
53748
+ var import_node_fs18 = require("node:fs");
53749
+ var import_node_path16 = require("node:path");
53684
53750
  var import_node_os12 = require("node:os");
53685
53751
 
53686
53752
  // contract-schema.ts
53687
- var import_node_fs16 = require("node:fs");
53688
- var import_node_path14 = require("node:path");
53753
+ var import_node_fs17 = require("node:fs");
53754
+ var import_node_path15 = require("node:path");
53689
53755
  var import_node_url2 = require("node:url");
53690
53756
  function validate(doc, schema) {
53691
53757
  const errors = [];
@@ -53787,16 +53853,16 @@ var _cache = /* @__PURE__ */ new Map();
53787
53853
  function loadContractSchema(file) {
53788
53854
  const hit = _cache.get(file);
53789
53855
  if (hit) return hit;
53790
- const here2 = (0, import_node_path14.dirname)((0, import_node_url2.fileURLToPath)(__import_meta_url));
53856
+ const here2 = (0, import_node_path15.dirname)((0, import_node_url2.fileURLToPath)(__import_meta_url));
53791
53857
  const candidates = [
53792
- (0, import_node_path14.join)(here2, "..", "schemas", file),
53858
+ (0, import_node_path15.join)(here2, "..", "schemas", file),
53793
53859
  // dev: server/ next to schemas/
53794
- (0, import_node_path14.join)(here2, "schemas", file)
53860
+ (0, import_node_path15.join)(here2, "schemas", file)
53795
53861
  // bundled: dist/ holds ./schemas
53796
53862
  ];
53797
53863
  for (const p of candidates) {
53798
53864
  try {
53799
- const parsed = JSON.parse((0, import_node_fs16.readFileSync)(p, "utf8"));
53865
+ const parsed = JSON.parse((0, import_node_fs17.readFileSync)(p, "utf8"));
53800
53866
  _cache.set(file, parsed);
53801
53867
  return parsed;
53802
53868
  } catch (err2) {
@@ -53826,20 +53892,20 @@ function validateContract(doc) {
53826
53892
  // contract-store.ts
53827
53893
  var ContractError = class extends Error {
53828
53894
  };
53829
- var ROOT3 = process.env.FLOLESS_HOME ?? (0, import_node_path15.join)((0, import_node_os12.homedir)(), ".floless");
53830
- var DIR = (0, import_node_path15.join)(ROOT3, "contracts");
53895
+ var ROOT3 = process.env.FLOLESS_HOME ?? (0, import_node_path16.join)((0, import_node_os12.homedir)(), ".floless");
53896
+ var DIR = (0, import_node_path16.join)(ROOT3, "contracts");
53831
53897
  function safeId(appId) {
53832
53898
  if (!/^[a-z0-9][a-z0-9._-]*$/i.test(appId)) throw new ContractError(`invalid appId: ${appId}`);
53833
53899
  return appId;
53834
53900
  }
53835
53901
  function contractPath(appId) {
53836
- return (0, import_node_path15.join)(DIR, `${safeId(appId)}.json`);
53902
+ return (0, import_node_path16.join)(DIR, `${safeId(appId)}.json`);
53837
53903
  }
53838
53904
  function readContract(appId) {
53839
53905
  const p = contractPath(appId);
53840
- if (!(0, import_node_fs17.existsSync)(p)) return null;
53906
+ if (!(0, import_node_fs18.existsSync)(p)) return null;
53841
53907
  try {
53842
- return JSON.parse((0, import_node_fs17.readFileSync)(p, "utf8"));
53908
+ return JSON.parse((0, import_node_fs18.readFileSync)(p, "utf8"));
53843
53909
  } catch (e) {
53844
53910
  console.warn(`readContract: ignoring unreadable contract at ${p}: ${e instanceof Error ? e.message : e}`);
53845
53911
  return null;
@@ -53852,8 +53918,8 @@ function writeContract(appId, doc) {
53852
53918
  const first = res.errors.slice(0, 5).map((e) => `${e.path}: ${e.message}`).join("; ");
53853
53919
  throw new ContractError(`contract failed schema validation \u2014 ${first}`);
53854
53920
  }
53855
- if (!(0, import_node_fs17.existsSync)(DIR)) (0, import_node_fs17.mkdirSync)(DIR, { recursive: true });
53856
- (0, import_node_fs17.writeFileSync)(p, JSON.stringify(doc));
53921
+ if (!(0, import_node_fs18.existsSync)(DIR)) (0, import_node_fs18.mkdirSync)(DIR, { recursive: true });
53922
+ (0, import_node_fs18.writeFileSync)(p, JSON.stringify(doc));
53857
53923
  }
53858
53924
 
53859
53925
  // contract-resolve.ts
@@ -53876,10 +53942,10 @@ function readContractForApp(appId, readAppFn = readApp) {
53876
53942
  }
53877
53943
 
53878
53944
  // contract-bake.ts
53879
- var import_node_fs18 = require("node:fs");
53945
+ var import_node_fs19 = require("node:fs");
53880
53946
  var import_yaml5 = __toESM(require_dist6(), 1);
53881
53947
  function bakeContractIntoApp(sourcePath, contract) {
53882
- const doc = (0, import_yaml5.parseDocument)((0, import_node_fs18.readFileSync)(sourcePath, "utf8"));
53948
+ const doc = (0, import_yaml5.parseDocument)((0, import_node_fs19.readFileSync)(sourcePath, "utf8"));
53883
53949
  if (doc.errors.length > 0) {
53884
53950
  throw new Error(`contract bake: source is not valid YAML: ${doc.errors[0]?.message ?? "parse error"}`);
53885
53951
  }
@@ -53929,7 +53995,7 @@ function bakeContractIntoApp(sourcePath, contract) {
53929
53995
  );
53930
53996
  }
53931
53997
  doc.setIn(["nodes", idx, "config", "takeoff"], baked);
53932
- (0, import_node_fs18.writeFileSync)(sourcePath, doc.toString());
53998
+ (0, import_node_fs19.writeFileSync)(sourcePath, doc.toString());
53933
53999
  }
53934
54000
 
53935
54001
  // vectorize.ts
@@ -54856,10 +54922,10 @@ function contractToBom(contractInput) {
54856
54922
 
54857
54923
  // bom-export.ts
54858
54924
  var import_node_os13 = require("node:os");
54859
- var import_node_path16 = require("node:path");
54925
+ var import_node_path17 = require("node:path");
54860
54926
 
54861
54927
  // node_modules/write-excel-file/modules/export/writeXlsxFileNode.js
54862
- var import_node_fs19 = __toESM(require("node:fs"), 1);
54928
+ var import_node_fs20 = __toESM(require("node:fs"), 1);
54863
54929
 
54864
54930
  // node_modules/write-excel-file/modules/xlsx/helpers/features/getAdditionalContent.js
54865
54931
  function _createForOfIteratorHelperLoose(r, e) {
@@ -59031,7 +59097,7 @@ function writeXlsxFile(arg1, arg2, arg3) {
59031
59097
  },
59032
59098
  toFile: function toFile(filePath) {
59033
59099
  return createReadableStream().then(function(readableStream) {
59034
- return pipe(readableStream, import_node_fs19.default.createWriteStream(filePath));
59100
+ return pipe(readableStream, import_node_fs20.default.createWriteStream(filePath));
59035
59101
  });
59036
59102
  }
59037
59103
  };
@@ -59056,8 +59122,8 @@ function pipe(readableStream, writableStream) {
59056
59122
 
59057
59123
  // bom-export.ts
59058
59124
  function bomExportPath(appId, format) {
59059
- const root = process.env.FLOLESS_HOME ?? (0, import_node_path16.join)((0, import_node_os13.homedir)(), ".floless");
59060
- return (0, import_node_path16.join)(root, "exports", appId, `${appId}-bom.${format}`);
59125
+ const root = process.env.FLOLESS_HOME ?? (0, import_node_path17.join)((0, import_node_os13.homedir)(), ".floless");
59126
+ return (0, import_node_path17.join)(root, "exports", appId, `${appId}-bom.${format}`);
59061
59127
  }
59062
59128
  function csvField(v) {
59063
59129
  let s = String(v);
@@ -59085,11 +59151,11 @@ async function bomToXlsx(bom) {
59085
59151
  }
59086
59152
 
59087
59153
  // scene-bake.ts
59088
- var import_node_fs20 = require("node:fs");
59089
- var import_node_path17 = require("node:path");
59154
+ var import_node_fs21 = require("node:fs");
59155
+ var import_node_path18 = require("node:path");
59090
59156
  var import_yaml6 = __toESM(require_dist6(), 1);
59091
59157
  function bakeSceneIntoApp(sourcePath, scene, agent = "viewer-3d") {
59092
- const doc = (0, import_yaml6.parseDocument)((0, import_node_fs20.readFileSync)(sourcePath, "utf8"));
59158
+ const doc = (0, import_yaml6.parseDocument)((0, import_node_fs21.readFileSync)(sourcePath, "utf8"));
59093
59159
  if (doc.errors.length > 0) {
59094
59160
  throw new Error(`scene bake: source is not valid YAML: ${doc.errors[0]?.message ?? "parse error"}`);
59095
59161
  }
@@ -59098,10 +59164,10 @@ function bakeSceneIntoApp(sourcePath, scene, agent = "viewer-3d") {
59098
59164
  const idx = items.findIndex((it) => ((0, import_yaml6.isMap)(it) ? it.toJSON() : null)?.agent === agent);
59099
59165
  if (idx < 0) throw new Error(`no ${agent} render node to bake the scene into`);
59100
59166
  doc.setIn(["nodes", idx, "config", "scene"], scene);
59101
- (0, import_node_fs20.writeFileSync)(sourcePath, doc.toString());
59167
+ (0, import_node_fs21.writeFileSync)(sourcePath, doc.toString());
59102
59168
  }
59103
59169
  function bakeNodeConfigById(sourcePath, nodeId, patch2) {
59104
- const doc = (0, import_yaml6.parseDocument)((0, import_node_fs20.readFileSync)(sourcePath, "utf8"));
59170
+ const doc = (0, import_yaml6.parseDocument)((0, import_node_fs21.readFileSync)(sourcePath, "utf8"));
59105
59171
  if (doc.errors.length > 0) {
59106
59172
  throw new Error(`node bake: source is not valid YAML: ${doc.errors[0]?.message ?? "parse error"}`);
59107
59173
  }
@@ -59110,12 +59176,12 @@ function bakeNodeConfigById(sourcePath, nodeId, patch2) {
59110
59176
  const idx = items.findIndex((it) => ((0, import_yaml6.isMap)(it) ? it.toJSON() : null)?.id === nodeId);
59111
59177
  if (idx < 0) throw new Error(`no node with id "${nodeId}"`);
59112
59178
  for (const [key, value] of Object.entries(patch2)) doc.setIn(["nodes", idx, "config", key], value);
59113
- (0, import_node_fs20.writeFileSync)(sourcePath, doc.toString());
59179
+ (0, import_node_fs21.writeFileSync)(sourcePath, doc.toString());
59114
59180
  }
59115
59181
  function writeViewer3dApp(dir, appId, scene) {
59116
- (0, import_node_fs20.mkdirSync)(dir, { recursive: true });
59117
- const flo = (0, import_node_path17.join)(dir, `${appId}.flo`);
59118
- (0, import_node_fs20.writeFileSync)(flo, [
59182
+ (0, import_node_fs21.mkdirSync)(dir, { recursive: true });
59183
+ const flo = (0, import_node_path18.join)(dir, `${appId}.flo`);
59184
+ (0, import_node_fs21.writeFileSync)(flo, [
59119
59185
  `app: ${appId}`,
59120
59186
  "version: 0.1.0",
59121
59187
  "display-name: Steel 3D",
@@ -59136,11 +59202,11 @@ function writeViewer3dApp(dir, appId, scene) {
59136
59202
  return flo;
59137
59203
  }
59138
59204
  function writeIfcApp(dir, appId, scene, outputPath, opts = {}) {
59139
- (0, import_node_fs20.mkdirSync)(dir, { recursive: true });
59140
- const flo = (0, import_node_path17.join)(dir, `${appId}.flo`);
59205
+ (0, import_node_fs21.mkdirSync)(dir, { recursive: true });
59206
+ const flo = (0, import_node_path18.join)(dir, `${appId}.flo`);
59141
59207
  const displayName = opts.displayName ?? "Steel IFC";
59142
59208
  const description = opts.description ?? "IFC file written from an approved steel.takeoff/v1 contract (a companion export; the contract is the source of truth).";
59143
- (0, import_node_fs20.writeFileSync)(flo, [
59209
+ (0, import_node_fs21.writeFileSync)(flo, [
59144
59210
  `app: ${appId}`,
59145
59211
  "version: 0.1.0",
59146
59212
  `display-name: ${displayName}`,
@@ -59163,9 +59229,9 @@ function writeIfcApp(dir, appId, scene, outputPath, opts = {}) {
59163
59229
  return flo;
59164
59230
  }
59165
59231
  function writeTeklaApp(dir, appId, scene, teklaVersion = "2026.0") {
59166
- (0, import_node_fs20.mkdirSync)(dir, { recursive: true });
59167
- const flo = (0, import_node_path17.join)(dir, `${appId}.flo`);
59168
- (0, import_node_fs20.writeFileSync)(flo, [
59232
+ (0, import_node_fs21.mkdirSync)(dir, { recursive: true });
59233
+ const flo = (0, import_node_path18.join)(dir, `${appId}.flo`);
59234
+ (0, import_node_fs21.writeFileSync)(flo, [
59169
59235
  `app: ${appId}`,
59170
59236
  "version: 0.1.0",
59171
59237
  "display-name: Steel to Tekla",
@@ -59227,9 +59293,9 @@ function exportPathsNeedingBake(nodes, appId) {
59227
59293
  }
59228
59294
 
59229
59295
  // tekla-version.ts
59230
- var import_node_child_process3 = require("node:child_process");
59296
+ var import_node_child_process4 = require("node:child_process");
59231
59297
  var import_node_util = require("node:util");
59232
- var pexec = (0, import_node_util.promisify)(import_node_child_process3.execFile);
59298
+ var pexec = (0, import_node_util.promisify)(import_node_child_process4.execFile);
59233
59299
  var DEFAULT_TEKLA_VERSION = "2026.0";
59234
59300
  function parseTeklaVersionFromExePath(p) {
59235
59301
  const m = /Tekla Structures[\\/]+([^\\/]+)[\\/]+bin\b/i.exec(p);
@@ -59573,13 +59639,13 @@ function scoreContract2(contractInput) {
59573
59639
  }
59574
59640
 
59575
59641
  // app-lifecycle.ts
59576
- var import_node_fs23 = require("node:fs");
59642
+ var import_node_fs24 = require("node:fs");
59577
59643
  var import_node_os15 = require("node:os");
59578
- var import_node_path20 = require("node:path");
59644
+ var import_node_path21 = require("node:path");
59579
59645
 
59580
59646
  // routines.ts
59581
- var import_node_fs22 = require("node:fs");
59582
- var import_node_path19 = require("node:path");
59647
+ var import_node_fs23 = require("node:fs");
59648
+ var import_node_path20 = require("node:path");
59583
59649
 
59584
59650
  // sse.ts
59585
59651
  var clients = /* @__PURE__ */ new Set();
@@ -59616,11 +59682,11 @@ function clientCount() {
59616
59682
  }
59617
59683
 
59618
59684
  // trigger-sessions.ts
59619
- var import_node_fs21 = require("node:fs");
59685
+ var import_node_fs22 = require("node:fs");
59620
59686
  var import_node_os14 = require("node:os");
59621
- var import_node_path18 = require("node:path");
59687
+ var import_node_path19 = require("node:path");
59622
59688
  var import_yaml7 = __toESM(require_dist6(), 1);
59623
- var AGENTS_DIR2 = process.env.AWARE_HOME ? (0, import_node_path18.join)(process.env.AWARE_HOME, "agents") : (0, import_node_path18.join)((0, import_node_os14.homedir)(), ".aware", "agents");
59689
+ var AGENTS_DIR2 = process.env.AWARE_HOME ? (0, import_node_path19.join)(process.env.AWARE_HOME, "agents") : (0, import_node_path19.join)((0, import_node_os14.homedir)(), ".aware", "agents");
59624
59690
  function summarizeFire(data) {
59625
59691
  if (!data) return "event";
59626
59692
  const type = typeof data.type === "string" ? data.type : "";
@@ -59637,10 +59703,10 @@ function mapTriggerState(phase) {
59637
59703
  function isHostBacked(agent, agentsDir = AGENTS_DIR2) {
59638
59704
  const safe = (n) => !n.includes("/") && !n.includes("\\") && !n.includes("..");
59639
59705
  if (!safe(agent)) return false;
59640
- const manifestPath = (0, import_node_path18.join)(agentsDir, agent, "manifest.yaml");
59641
- if (!(0, import_node_fs21.existsSync)(manifestPath)) return false;
59706
+ const manifestPath = (0, import_node_path19.join)(agentsDir, agent, "manifest.yaml");
59707
+ if (!(0, import_node_fs22.existsSync)(manifestPath)) return false;
59642
59708
  try {
59643
- const doc = (0, import_yaml7.parse)((0, import_node_fs21.readFileSync)(manifestPath, "utf8"));
59709
+ const doc = (0, import_yaml7.parse)((0, import_node_fs22.readFileSync)(manifestPath, "utf8"));
59644
59710
  const transport = doc?.transport;
59645
59711
  return !!(transport && typeof transport === "object" && "cli" in transport);
59646
59712
  } catch {
@@ -59925,7 +59991,7 @@ var RoutineError = class extends Error {
59925
59991
  }
59926
59992
  status;
59927
59993
  };
59928
- var ROUTINES_FILE = (0, import_node_path19.join)(flolessRoot, "routines.json");
59994
+ var ROUTINES_FILE = (0, import_node_path20.join)(flolessRoot, "routines.json");
59929
59995
  var routines = [];
59930
59996
  var loaded = false;
59931
59997
  function ensureLoaded() {
@@ -59961,10 +60027,10 @@ function sanitizeRoutine(raw) {
59961
60027
  };
59962
60028
  }
59963
60029
  function loadFromDisk() {
59964
- if (!(0, import_node_fs22.existsSync)(ROUTINES_FILE)) return [];
60030
+ if (!(0, import_node_fs23.existsSync)(ROUTINES_FILE)) return [];
59965
60031
  let text;
59966
60032
  try {
59967
- text = (0, import_node_fs22.readFileSync)(ROUTINES_FILE, "utf8");
60033
+ text = (0, import_node_fs23.readFileSync)(ROUTINES_FILE, "utf8");
59968
60034
  } catch {
59969
60035
  return [];
59970
60036
  }
@@ -59973,17 +60039,17 @@ function loadFromDisk() {
59973
60039
  return Array.isArray(parsed) ? parsed.map(sanitizeRoutine).filter((r) => r !== null) : [];
59974
60040
  } catch {
59975
60041
  try {
59976
- (0, import_node_fs22.renameSync)(ROUTINES_FILE, `${ROUTINES_FILE}.corrupt-${Date.now()}`);
60042
+ (0, import_node_fs23.renameSync)(ROUTINES_FILE, `${ROUTINES_FILE}.corrupt-${Date.now()}`);
59977
60043
  } catch {
59978
60044
  }
59979
60045
  return [];
59980
60046
  }
59981
60047
  }
59982
60048
  function saveRoutines() {
59983
- if (!(0, import_node_fs22.existsSync)(flolessRoot)) (0, import_node_fs22.mkdirSync)(flolessRoot, { recursive: true });
60049
+ if (!(0, import_node_fs23.existsSync)(flolessRoot)) (0, import_node_fs23.mkdirSync)(flolessRoot, { recursive: true });
59984
60050
  const tmp = `${ROUTINES_FILE}.${process.pid}.tmp`;
59985
- (0, import_node_fs22.writeFileSync)(tmp, JSON.stringify(routines, null, 2));
59986
- (0, import_node_fs22.renameSync)(tmp, ROUTINES_FILE);
60051
+ (0, import_node_fs23.writeFileSync)(tmp, JSON.stringify(routines, null, 2));
60052
+ (0, import_node_fs23.renameSync)(tmp, ROUTINES_FILE);
59987
60053
  }
59988
60054
  function listRoutines() {
59989
60055
  ensureLoaded();
@@ -60391,13 +60457,13 @@ var AppLifecycleError = class extends Error {
60391
60457
  }
60392
60458
  };
60393
60459
  function appsDir() {
60394
- return process.env.AWARE_HOME ? (0, import_node_path20.join)(process.env.AWARE_HOME, "apps") : (0, import_node_path20.join)((0, import_node_os15.homedir)(), ".aware", "apps");
60460
+ return process.env.AWARE_HOME ? (0, import_node_path21.join)(process.env.AWARE_HOME, "apps") : (0, import_node_path21.join)((0, import_node_os15.homedir)(), ".aware", "apps");
60395
60461
  }
60396
60462
  function appDirPath(id) {
60397
- return (0, import_node_path20.join)(appsDir(), id);
60463
+ return (0, import_node_path21.join)(appsDir(), id);
60398
60464
  }
60399
60465
  function appInstalled(id) {
60400
- return APP_ID3.test(id) && (0, import_node_fs23.existsSync)(appDirPath(id));
60466
+ return APP_ID3.test(id) && (0, import_node_fs24.existsSync)(appDirPath(id));
60401
60467
  }
60402
60468
  function logCascade(what, e) {
60403
60469
  console.error(`[app-lifecycle] cascade step failed (${what}):`, e instanceof Error ? e.message : e);
@@ -60512,10 +60578,10 @@ function isGatedAwareRoute(url, method) {
60512
60578
  }
60513
60579
 
60514
60580
  // autostart.mjs
60515
- var import_node_child_process4 = require("node:child_process");
60516
- var import_node_fs24 = require("node:fs");
60581
+ var import_node_child_process5 = require("node:child_process");
60582
+ var import_node_fs25 = require("node:fs");
60517
60583
  var import_node_os16 = require("node:os");
60518
- var import_node_path21 = require("node:path");
60584
+ var import_node_path22 = require("node:path");
60519
60585
 
60520
60586
  // teardown.mjs
60521
60587
  var RUN_KEY = "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run";
@@ -60621,14 +60687,14 @@ function currentUserId() {
60621
60687
  }
60622
60688
  function removeLegacyRunKey() {
60623
60689
  try {
60624
- (0, import_node_child_process4.execFileSync)("reg", ["delete", RUN_KEY, "/v", RUN_VALUE, "/f"], { stdio: "ignore", windowsHide: true });
60690
+ (0, import_node_child_process5.execFileSync)("reg", ["delete", RUN_KEY, "/v", RUN_VALUE, "/f"], { stdio: "ignore", windowsHide: true });
60625
60691
  } catch {
60626
60692
  }
60627
60693
  }
60628
60694
  function logLine(msg) {
60629
60695
  try {
60630
- (0, import_node_fs24.mkdirSync)(logDir(), { recursive: true });
60631
- (0, import_node_fs24.appendFileSync)(logFilePath(), `${(/* @__PURE__ */ new Date()).toISOString()} ${msg}
60696
+ (0, import_node_fs25.mkdirSync)(logDir(), { recursive: true });
60697
+ (0, import_node_fs25.appendFileSync)(logFilePath(), `${(/* @__PURE__ */ new Date()).toISOString()} ${msg}
60632
60698
  `);
60633
60699
  } catch {
60634
60700
  }
@@ -60636,10 +60702,10 @@ function logLine(msg) {
60636
60702
  function registerAutostart(exePath) {
60637
60703
  if (!isWin) return;
60638
60704
  const xml = buildAutostartTaskXml(exePath, currentUserId());
60639
- const tmp = (0, import_node_path21.join)((0, import_node_os16.tmpdir)(), `floless-autostart-${process.pid}-${Date.now()}.xml`);
60640
- (0, import_node_fs24.writeFileSync)(tmp, "\uFEFF" + xml, { encoding: "utf16le" });
60705
+ const tmp = (0, import_node_path22.join)((0, import_node_os16.tmpdir)(), `floless-autostart-${process.pid}-${Date.now()}.xml`);
60706
+ (0, import_node_fs25.writeFileSync)(tmp, "\uFEFF" + xml, { encoding: "utf16le" });
60641
60707
  try {
60642
- (0, import_node_child_process4.execFileSync)("schtasks", ["/Create", "/TN", TASK_NAME, "/XML", tmp, "/F"], {
60708
+ (0, import_node_child_process5.execFileSync)("schtasks", ["/Create", "/TN", TASK_NAME, "/XML", tmp, "/F"], {
60643
60709
  stdio: ["ignore", "ignore", "ignore"],
60644
60710
  windowsHide: true
60645
60711
  });
@@ -60648,7 +60714,7 @@ function registerAutostart(exePath) {
60648
60714
  throw err2;
60649
60715
  } finally {
60650
60716
  try {
60651
- (0, import_node_fs24.rmSync)(tmp, { force: true });
60717
+ (0, import_node_fs25.rmSync)(tmp, { force: true });
60652
60718
  } catch {
60653
60719
  }
60654
60720
  }
@@ -60657,7 +60723,7 @@ function registerAutostart(exePath) {
60657
60723
  function autostartPresent() {
60658
60724
  if (!isWin) return false;
60659
60725
  try {
60660
- (0, import_node_child_process4.execFileSync)("schtasks", ["/query", "/tn", TASK_NAME], { stdio: "ignore", windowsHide: true });
60726
+ (0, import_node_child_process5.execFileSync)("schtasks", ["/query", "/tn", TASK_NAME], { stdio: "ignore", windowsHide: true });
60661
60727
  return true;
60662
60728
  } catch {
60663
60729
  return false;
@@ -60674,35 +60740,35 @@ function ensureAutostart(exePath) {
60674
60740
  function unregisterAutostart() {
60675
60741
  if (!isWin) return;
60676
60742
  try {
60677
- (0, import_node_child_process4.execFileSync)("schtasks", ["/delete", "/tn", TASK_NAME, "/f"], { stdio: "ignore", windowsHide: true });
60743
+ (0, import_node_child_process5.execFileSync)("schtasks", ["/delete", "/tn", TASK_NAME, "/f"], { stdio: "ignore", windowsHide: true });
60678
60744
  } catch {
60679
60745
  }
60680
60746
  removeLegacyRunKey();
60681
60747
  }
60682
60748
 
60683
60749
  // updater.ts
60684
- var import_node_child_process5 = require("node:child_process");
60750
+ var import_node_child_process6 = require("node:child_process");
60685
60751
  var import_node_crypto6 = require("node:crypto");
60686
- var import_node_fs26 = require("node:fs");
60752
+ var import_node_fs27 = require("node:fs");
60687
60753
  var import_node_stream3 = require("node:stream");
60688
60754
  var import_promises = require("node:stream/promises");
60689
- var import_node_path23 = require("node:path");
60755
+ var import_node_path24 = require("node:path");
60690
60756
 
60691
60757
  // post-update-marker.mjs
60692
- var import_node_fs25 = require("node:fs");
60758
+ var import_node_fs26 = require("node:fs");
60693
60759
  var import_node_os17 = require("node:os");
60694
- var import_node_path22 = require("node:path");
60760
+ var import_node_path23 = require("node:path");
60695
60761
  var FRESH_MS = 12e4;
60696
60762
  function markerPath() {
60697
60763
  const override = (process.env.FLOLESS_POST_UPDATE_MARKER ?? "").trim();
60698
60764
  if (override) return override;
60699
- const root = process.env.FLOLESS_HOME ?? (0, import_node_path22.join)((0, import_node_os17.homedir)(), ".floless");
60700
- return (0, import_node_path22.join)(root, ".post-update");
60765
+ const root = process.env.FLOLESS_HOME ?? (0, import_node_path23.join)((0, import_node_os17.homedir)(), ".floless");
60766
+ return (0, import_node_path23.join)(root, ".post-update");
60701
60767
  }
60702
60768
  function legacyMarkerPath() {
60703
60769
  if ((process.env.FLOLESS_POST_UPDATE_MARKER ?? "").trim()) return null;
60704
60770
  try {
60705
- return (0, import_node_path22.join)((0, import_node_path22.dirname)((0, import_node_path22.dirname)(process.execPath)), ".floless-post-update");
60771
+ return (0, import_node_path23.join)((0, import_node_path23.dirname)((0, import_node_path23.dirname)(process.execPath)), ".floless-post-update");
60706
60772
  } catch {
60707
60773
  return null;
60708
60774
  }
@@ -60712,7 +60778,7 @@ function writePostUpdateMarker() {
60712
60778
  for (const p of [markerPath(), legacyMarkerPath()]) {
60713
60779
  if (!p) continue;
60714
60780
  try {
60715
- (0, import_node_fs25.writeFileSync)(p, (/* @__PURE__ */ new Date()).toISOString());
60781
+ (0, import_node_fs26.writeFileSync)(p, (/* @__PURE__ */ new Date()).toISOString());
60716
60782
  wrote = true;
60717
60783
  } catch {
60718
60784
  }
@@ -60724,9 +60790,9 @@ function consumePostUpdateMarker() {
60724
60790
  for (const p of [markerPath(), legacyMarkerPath()]) {
60725
60791
  if (!p) continue;
60726
60792
  try {
60727
- if (!(0, import_node_fs25.existsSync)(p)) continue;
60728
- const ageMs = Date.now() - (0, import_node_fs25.statSync)(p).mtimeMs;
60729
- (0, import_node_fs25.rmSync)(p, { force: true });
60793
+ if (!(0, import_node_fs26.existsSync)(p)) continue;
60794
+ const ageMs = Date.now() - (0, import_node_fs26.statSync)(p).mtimeMs;
60795
+ (0, import_node_fs26.rmSync)(p, { force: true });
60730
60796
  if (ageMs < FRESH_MS) fresh = true;
60731
60797
  } catch {
60732
60798
  }
@@ -60743,13 +60809,13 @@ function currentVersion() {
60743
60809
  return appVersion();
60744
60810
  }
60745
60811
  function installRoot() {
60746
- return (0, import_node_path23.dirname)((0, import_node_path23.dirname)(process.execPath));
60812
+ return (0, import_node_path24.dirname)((0, import_node_path24.dirname)(process.execPath));
60747
60813
  }
60748
60814
  function updateExePath() {
60749
- return (0, import_node_path23.join)(installRoot(), "Update.exe");
60815
+ return (0, import_node_path24.join)(installRoot(), "Update.exe");
60750
60816
  }
60751
60817
  function packagesDir() {
60752
- return (0, import_node_path23.join)(installRoot(), "packages");
60818
+ return (0, import_node_path24.join)(installRoot(), "packages");
60753
60819
  }
60754
60820
  function feedUrl() {
60755
60821
  const env2 = (process.env.FLOLESS_UPDATE_URL ?? "").trim().replace(/\/+$/, "");
@@ -60842,22 +60908,22 @@ async function checkForUpdate() {
60842
60908
  }
60843
60909
  async function sha1OfFile(path) {
60844
60910
  const hash = (0, import_node_crypto6.createHash)("sha1");
60845
- await (0, import_promises.pipeline)((0, import_node_fs26.createReadStream)(path), hash);
60911
+ await (0, import_promises.pipeline)((0, import_node_fs27.createReadStream)(path), hash);
60846
60912
  return hash.digest("hex").toUpperCase();
60847
60913
  }
60848
60914
  async function downloadPackage(asset) {
60849
60915
  if (!NUPKG_NAME.test(asset.FileName)) throw new Error(`refusing suspicious package name: ${asset.FileName}`);
60850
60916
  const want = asset.SHA1.toUpperCase();
60851
60917
  const dir = packagesDir();
60852
- (0, import_node_fs26.mkdirSync)(dir, { recursive: true });
60853
- const dest = (0, import_node_path23.join)(dir, asset.FileName);
60854
- if ((0, import_node_fs26.existsSync)(dest) && await sha1OfFile(dest) === want) return dest;
60918
+ (0, import_node_fs27.mkdirSync)(dir, { recursive: true });
60919
+ const dest = (0, import_node_path24.join)(dir, asset.FileName);
60920
+ if ((0, import_node_fs27.existsSync)(dest) && await sha1OfFile(dest) === want) return dest;
60855
60921
  const res = await authedFetch(`${feedUrl()}/${encodeURIComponent(asset.FileName)}`, {
60856
60922
  redirect: "follow",
60857
60923
  signal: AbortSignal.timeout(DOWNLOAD_TIMEOUT_MS)
60858
60924
  });
60859
60925
  if (!res.ok || !res.body) throw new Error(`download failed: HTTP ${res.status} for ${asset.FileName}`);
60860
- await (0, import_promises.pipeline)(import_node_stream3.Readable.fromWeb(res.body), (0, import_node_fs26.createWriteStream)(dest));
60926
+ await (0, import_promises.pipeline)(import_node_stream3.Readable.fromWeb(res.body), (0, import_node_fs27.createWriteStream)(dest));
60861
60927
  const got = await sha1OfFile(dest);
60862
60928
  if (got !== want) throw new Error(`SHA1 mismatch for ${asset.FileName}: feed=${want} got=${got}`);
60863
60929
  return dest;
@@ -60866,13 +60932,13 @@ async function applyUpdate(check, opts) {
60866
60932
  if (!check.supported) return { applied: false, message: check.reason ?? "auto-update not supported in this runtime" };
60867
60933
  if (!check.updateAvailable || !check.asset) return { applied: false, message: check.reason ?? "no update available" };
60868
60934
  const exe = updateExePath();
60869
- if (!(0, import_node_fs26.existsSync)(exe)) {
60935
+ if (!(0, import_node_fs27.existsSync)(exe)) {
60870
60936
  return { applied: false, message: `Update.exe not found at ${exe} \u2014 is this a Velopack install?` };
60871
60937
  }
60872
60938
  const pkg = await downloadPackage(check.asset);
60873
60939
  if (opts?.onBeforeApply) await opts.onBeforeApply();
60874
60940
  await new Promise((resolve6, reject) => {
60875
- const child = (0, import_node_child_process5.spawn)(exe, ["apply", "--package", pkg, "--waitPid", String(process.pid)], {
60941
+ const child = (0, import_node_child_process6.spawn)(exe, ["apply", "--package", pkg, "--waitPid", String(process.pid)], {
60876
60942
  cwd: installRoot(),
60877
60943
  detached: true,
60878
60944
  stdio: "ignore",
@@ -61105,13 +61171,13 @@ function isTraceCorrupt(events) {
61105
61171
  }
61106
61172
 
61107
61173
  // launch.mjs
61108
- var import_node_child_process6 = require("node:child_process");
61109
- var import_node_path24 = require("node:path");
61174
+ var import_node_child_process7 = require("node:child_process");
61175
+ var import_node_path25 = require("node:path");
61110
61176
  var import_node_url3 = require("node:url");
61111
- var import_node_fs27 = require("node:fs");
61177
+ var import_node_fs28 = require("node:fs");
61112
61178
  var import_node_http = __toESM(require("node:http"), 1);
61113
61179
  var import_node_readline = require("node:readline");
61114
- var __dirname2 = (0, import_node_path24.dirname)((0, import_node_url3.fileURLToPath)(__import_meta_url));
61180
+ var __dirname2 = (0, import_node_path25.dirname)((0, import_node_url3.fileURLToPath)(__import_meta_url));
61115
61181
  var PORT = Number(process.env.PORT ?? 4317);
61116
61182
  var HEALTH_URL = `http://127.0.0.1:${PORT}/api/health`;
61117
61183
  var BROWSER_URL = `http://floless.localhost:${PORT}`;
@@ -61183,15 +61249,15 @@ async function waitHealthy(timeoutMs = 3e4) {
61183
61249
  function resolveServerStart() {
61184
61250
  const packaged = /flolessapp\.exe$/i.test(process.execPath);
61185
61251
  if (packaged) return { cmd: process.execPath, args: ["--serve"], shell: false };
61186
- const bundle = (0, import_node_path24.join)(__dirname2, "dist", "floless-server.cjs");
61187
- if ((0, import_node_fs27.existsSync)(bundle)) return { cmd: process.execPath, args: [bundle, "--serve"], shell: false };
61252
+ const bundle = (0, import_node_path25.join)(__dirname2, "dist", "floless-server.cjs");
61253
+ if ((0, import_node_fs28.existsSync)(bundle)) return { cmd: process.execPath, args: [bundle, "--serve"], shell: false };
61188
61254
  return { cmd: "npm", args: ["run", "start"], shell: isWin2 };
61189
61255
  }
61190
61256
  function startServerDetached() {
61191
61257
  const { cmd, args, shell } = resolveServerStart();
61192
61258
  rotateLog();
61193
61259
  const fd2 = openLogFd();
61194
- const child = (0, import_node_child_process6.spawn)(cmd, args, {
61260
+ const child = (0, import_node_child_process7.spawn)(cmd, args, {
61195
61261
  cwd: __dirname2,
61196
61262
  detached: true,
61197
61263
  stdio: fd2 == null ? "ignore" : ["ignore", fd2, fd2],
@@ -61201,13 +61267,13 @@ function startServerDetached() {
61201
61267
  child.unref();
61202
61268
  }
61203
61269
  function openBrowser2(url) {
61204
- if (isWin2) (0, import_node_child_process6.spawn)("cmd", ["/c", "start", "", url], { windowsHide: true }).unref();
61205
- else (0, import_node_child_process6.spawn)(process.platform === "darwin" ? "open" : "xdg-open", [url], { detached: true }).unref();
61270
+ if (isWin2) (0, import_node_child_process7.spawn)("cmd", ["/c", "start", "", url], { windowsHide: true }).unref();
61271
+ else (0, import_node_child_process7.spawn)(process.platform === "darwin" ? "open" : "xdg-open", [url], { detached: true }).unref();
61206
61272
  }
61207
61273
  function stopServer() {
61208
61274
  if (!isWin2) {
61209
61275
  try {
61210
- (0, import_node_child_process6.execSync)(`bash -lc "fuser -k ${PORT}/tcp"`, { stdio: "ignore" });
61276
+ (0, import_node_child_process7.execSync)(`bash -lc "fuser -k ${PORT}/tcp"`, { stdio: "ignore" });
61211
61277
  return true;
61212
61278
  } catch {
61213
61279
  return false;
@@ -61215,7 +61281,7 @@ function stopServer() {
61215
61281
  }
61216
61282
  try {
61217
61283
  const ps = `$p = Get-NetTCPConnection -LocalPort ${PORT} -State Listen -ErrorAction SilentlyContinue | Select-Object -Expand OwningProcess -Unique; if ($p) { $p | ForEach-Object { taskkill /PID $_ /T /F } } else { exit 9 }`;
61218
- (0, import_node_child_process6.execSync)(`powershell -NoProfile -Command "${ps}"`, { stdio: "ignore" });
61284
+ (0, import_node_child_process7.execSync)(`powershell -NoProfile -Command "${ps}"`, { stdio: "ignore" });
61219
61285
  return true;
61220
61286
  } catch {
61221
61287
  return false;
@@ -61267,7 +61333,7 @@ async function cmdSupervise() {
61267
61333
  if (isSeaChannel && !process.env[SUPERVISE_RESPAWN_ENV]) {
61268
61334
  rotateLog();
61269
61335
  const fd2 = openLogFd();
61270
- const child = (0, import_node_child_process6.spawn)(process.execPath, ["--supervise"], {
61336
+ const child = (0, import_node_child_process7.spawn)(process.execPath, ["--supervise"], {
61271
61337
  detached: true,
61272
61338
  stdio: fd2 == null ? "ignore" : ["ignore", fd2, fd2],
61273
61339
  windowsHide: true,
@@ -61322,7 +61388,7 @@ function enumerateProcesses() {
61322
61388
  if (!isWin2) return [];
61323
61389
  try {
61324
61390
  const ps = "Get-CimInstance Win32_Process | Select-Object ProcessId,CommandLine | ConvertTo-Json -Compress";
61325
- const out = (0, import_node_child_process6.execSync)(`powershell -NoProfile -Command "${ps}"`, {
61391
+ const out = (0, import_node_child_process7.execSync)(`powershell -NoProfile -Command "${ps}"`, {
61326
61392
  encoding: "utf8",
61327
61393
  windowsHide: true,
61328
61394
  maxBuffer: 16 * 1024 * 1024
@@ -61337,15 +61403,15 @@ function taskkillArgs(pid, { tree = true } = {}) {
61337
61403
  }
61338
61404
  function killSupervisor({ tree = true } = {}) {
61339
61405
  if (!isWin2) return;
61340
- const isNpmChannel = /^node(\.exe)?$/i.test((0, import_node_path24.basename)(process.execPath));
61341
- const scriptMatch = isNpmChannel ? (0, import_node_path24.basename)((0, import_node_url3.fileURLToPath)(__import_meta_url)) : void 0;
61406
+ const isNpmChannel = /^node(\.exe)?$/i.test((0, import_node_path25.basename)(process.execPath));
61407
+ const scriptMatch = isNpmChannel ? (0, import_node_path25.basename)((0, import_node_url3.fileURLToPath)(__import_meta_url)) : void 0;
61342
61408
  const realExe = resolveRealInstallExe(process.execPath);
61343
61409
  const exeMatch = realExe === process.execPath ? process.execPath : [process.execPath, realExe];
61344
61410
  const pids = supervisorPidsToKill(enumerateProcesses(), process.pid, exeMatch, scriptMatch);
61345
61411
  for (const pid of pids) {
61346
61412
  log(`stopping supervisor (pid ${pid})\u2026`);
61347
61413
  try {
61348
- (0, import_node_child_process6.execFileSync)("taskkill", taskkillArgs(pid, { tree }), { stdio: "ignore", windowsHide: true });
61414
+ (0, import_node_child_process7.execFileSync)("taskkill", taskkillArgs(pid, { tree }), { stdio: "ignore", windowsHide: true });
61349
61415
  } catch {
61350
61416
  }
61351
61417
  }
@@ -61436,11 +61502,11 @@ async function cmdUpdate() {
61436
61502
  function removeRegistryFootprint() {
61437
61503
  if (!isWin2) return;
61438
61504
  try {
61439
- (0, import_node_child_process6.execFileSync)("reg", ["delete", RUN_KEY, "/v", RUN_VALUE, "/f"], { stdio: "ignore", windowsHide: true });
61505
+ (0, import_node_child_process7.execFileSync)("reg", ["delete", RUN_KEY, "/v", RUN_VALUE, "/f"], { stdio: "ignore", windowsHide: true });
61440
61506
  } catch {
61441
61507
  }
61442
61508
  try {
61443
- (0, import_node_child_process6.execFileSync)("reg", ["delete", PROTOCOL_KEY, "/f"], { stdio: "ignore", windowsHide: true });
61509
+ (0, import_node_child_process7.execFileSync)("reg", ["delete", PROTOCOL_KEY, "/f"], { stdio: "ignore", windowsHide: true });
61444
61510
  } catch {
61445
61511
  }
61446
61512
  }
@@ -61466,13 +61532,13 @@ async function cmdUninstall(flags = {}) {
61466
61532
  if (removeAware) {
61467
61533
  log("removing the AWARE runtime \u2014 this will affect ANY other tool that uses @aware-aeco/cli.");
61468
61534
  try {
61469
- (0, import_node_child_process6.execSync)("npm uninstall -g @aware-aeco/cli", { stdio: "inherit", shell: isWin2 });
61535
+ (0, import_node_child_process7.execSync)("npm uninstall -g @aware-aeco/cli", { stdio: "inherit", shell: isWin2 });
61470
61536
  } catch {
61471
61537
  log('warning: "npm uninstall -g @aware-aeco/cli" failed \u2014 see the output above.');
61472
61538
  }
61473
61539
  let lsJson = "";
61474
61540
  try {
61475
- lsJson = (0, import_node_child_process6.execSync)("npm ls -g @aware-aeco/cli --depth=0 --json", {
61541
+ lsJson = (0, import_node_child_process7.execSync)("npm ls -g @aware-aeco/cli --depth=0 --json", {
61476
61542
  encoding: "utf8",
61477
61543
  stdio: ["ignore", "pipe", "ignore"],
61478
61544
  shell: isWin2
@@ -61503,7 +61569,7 @@ async function runAction(arg, flagArgv = [], selfVersion = null) {
61503
61569
  }
61504
61570
  await action(parseTeardownFlags(flagArgv));
61505
61571
  }
61506
- var entry = (0, import_node_path24.basename)(process.argv[1] ?? "").toLowerCase();
61572
+ var entry = (0, import_node_path25.basename)(process.argv[1] ?? "").toLowerCase();
61507
61573
  if (entry === "launch.mjs") {
61508
61574
  runAction(process.argv[2], process.argv.slice(3)).catch((e) => {
61509
61575
  log(`error: ${e?.message ?? e}`);
@@ -61577,9 +61643,9 @@ function awareUpgradeBlockReason(s) {
61577
61643
  }
61578
61644
 
61579
61645
  // skill-sync.ts
61580
- var import_node_fs28 = require("node:fs");
61646
+ var import_node_fs29 = require("node:fs");
61581
61647
  var import_node_os18 = require("node:os");
61582
- var import_node_path25 = require("node:path");
61648
+ var import_node_path26 = require("node:path");
61583
61649
  var import_node_url4 = require("node:url");
61584
61650
  var import_yaml8 = __toESM(require_dist6(), 1);
61585
61651
 
@@ -61622,14 +61688,14 @@ function selectShippedSkillNames(names) {
61622
61688
  }
61623
61689
 
61624
61690
  // skill-sync.ts
61625
- var __dirname3 = (0, import_node_path25.dirname)((0, import_node_url4.fileURLToPath)(__import_meta_url));
61691
+ var __dirname3 = (0, import_node_path26.dirname)((0, import_node_url4.fileURLToPath)(__import_meta_url));
61626
61692
  function bundledSkillsRoot() {
61627
61693
  const candidates = [
61628
- (0, import_node_path25.join)(__dirname3, "skills"),
61629
- (0, import_node_path25.join)((0, import_node_path25.dirname)(process.execPath), "skills"),
61630
- (0, import_node_path25.join)(__dirname3, "..", ".claude", "skills")
61694
+ (0, import_node_path26.join)(__dirname3, "skills"),
61695
+ (0, import_node_path26.join)((0, import_node_path26.dirname)(process.execPath), "skills"),
61696
+ (0, import_node_path26.join)(__dirname3, "..", ".claude", "skills")
61631
61697
  ];
61632
- return candidates.find((p) => (0, import_node_fs28.existsSync)(p)) ?? null;
61698
+ return candidates.find((p) => (0, import_node_fs29.existsSync)(p)) ?? null;
61633
61699
  }
61634
61700
  function targetConfigDirs() {
61635
61701
  const override = process.env.FLOLESS_SKILL_TARGETS;
@@ -61638,14 +61704,14 @@ function targetConfigDirs() {
61638
61704
  }
61639
61705
  const home = (0, import_node_os18.homedir)();
61640
61706
  return [
61641
- { runtime: "claude", dir: (0, import_node_path25.join)(home, ".claude") },
61642
- { runtime: "codex", dir: (0, import_node_path25.join)(home, ".codex") },
61643
- { runtime: "opencode", dir: (0, import_node_path25.join)(home, ".opencode") }
61707
+ { runtime: "claude", dir: (0, import_node_path26.join)(home, ".claude") },
61708
+ { runtime: "codex", dir: (0, import_node_path26.join)(home, ".codex") },
61709
+ { runtime: "opencode", dir: (0, import_node_path26.join)(home, ".opencode") }
61644
61710
  ];
61645
61711
  }
61646
61712
  function skillVersion(skillMdPath) {
61647
61713
  try {
61648
- const text = (0, import_node_fs28.readFileSync)(skillMdPath, "utf8");
61714
+ const text = (0, import_node_fs29.readFileSync)(skillMdPath, "utf8");
61649
61715
  const m = /^---\r?\n([\s\S]*?)\r?\n---/.exec(text);
61650
61716
  if (!m || m[1] === void 0) return null;
61651
61717
  const fm = (0, import_yaml8.parse)(m[1]);
@@ -61685,21 +61751,21 @@ function decideAction(installed, bundled) {
61685
61751
  function bundledSkills(root) {
61686
61752
  let entries = [];
61687
61753
  try {
61688
- entries = selectShippedSkillNames((0, import_node_fs28.readdirSync)(root));
61754
+ entries = selectShippedSkillNames((0, import_node_fs29.readdirSync)(root));
61689
61755
  } catch {
61690
61756
  return [];
61691
61757
  }
61692
61758
  const out = [];
61693
61759
  for (const name of entries) {
61694
- const dir = (0, import_node_path25.join)(root, name);
61760
+ const dir = (0, import_node_path26.join)(root, name);
61695
61761
  let isDir = false;
61696
61762
  try {
61697
- isDir = (0, import_node_fs28.statSync)(dir).isDirectory();
61763
+ isDir = (0, import_node_fs29.statSync)(dir).isDirectory();
61698
61764
  } catch {
61699
61765
  isDir = false;
61700
61766
  }
61701
61767
  if (!isDir) continue;
61702
- const v = skillVersion((0, import_node_path25.join)(dir, "SKILL.md"));
61768
+ const v = skillVersion((0, import_node_path26.join)(dir, "SKILL.md"));
61703
61769
  if (!v) continue;
61704
61770
  out.push({ name, dir, version: v });
61705
61771
  }
@@ -61712,17 +61778,17 @@ function syncSkills() {
61712
61778
  const skills = bundledSkills(root);
61713
61779
  if (!skills.length) return results;
61714
61780
  for (const { runtime, dir: cfg } of targetConfigDirs()) {
61715
- if (!(0, import_node_fs28.existsSync)(cfg)) continue;
61716
- const skillsDir = (0, import_node_path25.join)(cfg, "skills");
61781
+ if (!(0, import_node_fs29.existsSync)(cfg)) continue;
61782
+ const skillsDir = (0, import_node_path26.join)(cfg, "skills");
61717
61783
  for (const s of skills) {
61718
- const dest = (0, import_node_path25.join)(skillsDir, s.name);
61719
- const installedMd = (0, import_node_path25.join)(dest, "SKILL.md");
61720
- const installed = (0, import_node_fs28.existsSync)(installedMd) ? skillVersion(installedMd) : null;
61784
+ const dest = (0, import_node_path26.join)(skillsDir, s.name);
61785
+ const installedMd = (0, import_node_path26.join)(dest, "SKILL.md");
61786
+ const installed = (0, import_node_fs29.existsSync)(installedMd) ? skillVersion(installedMd) : null;
61721
61787
  const action = decideAction(installed, s.version);
61722
61788
  if (action === "installed" || action === "updated") {
61723
61789
  try {
61724
- if (action === "updated") (0, import_node_fs28.rmSync)(dest, { recursive: true, force: true });
61725
- (0, import_node_fs28.cpSync)(s.dir, dest, { recursive: true });
61790
+ if (action === "updated") (0, import_node_fs29.rmSync)(dest, { recursive: true, force: true });
61791
+ (0, import_node_fs29.cpSync)(s.dir, dest, { recursive: true });
61726
61792
  results.push({ runtime, skill: s.name, action, from: installed, to: s.version });
61727
61793
  } catch {
61728
61794
  }
@@ -61736,8 +61802,8 @@ function syncSkills() {
61736
61802
 
61737
61803
  // watch.ts
61738
61804
  var import_node_os19 = require("node:os");
61739
- var import_node_path27 = require("node:path");
61740
- var import_node_fs29 = require("node:fs");
61805
+ var import_node_path28 = require("node:path");
61806
+ var import_node_fs30 = require("node:fs");
61741
61807
 
61742
61808
  // node_modules/chokidar/esm/index.js
61743
61809
  var import_fs2 = require("fs");
@@ -61748,7 +61814,7 @@ var sysPath2 = __toESM(require("path"), 1);
61748
61814
  // node_modules/readdirp/esm/index.js
61749
61815
  var import_promises2 = require("node:fs/promises");
61750
61816
  var import_node_stream4 = require("node:stream");
61751
- var import_node_path26 = require("node:path");
61817
+ var import_node_path27 = require("node:path");
61752
61818
  var EntryTypes = {
61753
61819
  FILE_TYPE: "files",
61754
61820
  DIR_TYPE: "directories",
@@ -61823,7 +61889,7 @@ var ReaddirpStream = class extends import_node_stream4.Readable {
61823
61889
  this._wantsDir = type ? DIR_TYPES.has(type) : false;
61824
61890
  this._wantsFile = type ? FILE_TYPES.has(type) : false;
61825
61891
  this._wantsEverything = type === EntryTypes.EVERYTHING_TYPE;
61826
- this._root = (0, import_node_path26.resolve)(root);
61892
+ this._root = (0, import_node_path27.resolve)(root);
61827
61893
  this._isDirent = !opts.alwaysStat;
61828
61894
  this._statsProp = this._isDirent ? "dirent" : "stats";
61829
61895
  this._rdOptions = { encoding: "utf8", withFileTypes: this._isDirent };
@@ -61894,8 +61960,8 @@ var ReaddirpStream = class extends import_node_stream4.Readable {
61894
61960
  let entry2;
61895
61961
  const basename5 = this._isDirent ? dirent.name : dirent;
61896
61962
  try {
61897
- const fullPath = (0, import_node_path26.resolve)((0, import_node_path26.join)(path, basename5));
61898
- entry2 = { path: (0, import_node_path26.relative)(this._root, fullPath), fullPath, basename: basename5 };
61963
+ const fullPath = (0, import_node_path27.resolve)((0, import_node_path27.join)(path, basename5));
61964
+ entry2 = { path: (0, import_node_path27.relative)(this._root, fullPath), fullPath, basename: basename5 };
61899
61965
  entry2[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
61900
61966
  } catch (err2) {
61901
61967
  this._onError(err2);
@@ -61929,7 +61995,7 @@ var ReaddirpStream = class extends import_node_stream4.Readable {
61929
61995
  }
61930
61996
  if (entryRealPathStats.isDirectory()) {
61931
61997
  const len2 = entryRealPath.length;
61932
- if (full.startsWith(entryRealPath) && full.substr(len2, 1) === import_node_path26.sep) {
61998
+ if (full.startsWith(entryRealPath) && full.substr(len2, 1) === import_node_path27.sep) {
61933
61999
  const recursiveError = new Error(`Circular symlink detected: "${full}" points to "${entryRealPath}"`);
61934
62000
  recursiveError.code = RECURSIVE_ERROR_CODE;
61935
62001
  return this._onError(recursiveError);
@@ -62468,9 +62534,9 @@ var NodeFsHandler = class {
62468
62534
  if (this.fsw.closed) {
62469
62535
  return;
62470
62536
  }
62471
- const dirname13 = sysPath.dirname(file);
62537
+ const dirname14 = sysPath.dirname(file);
62472
62538
  const basename5 = sysPath.basename(file);
62473
- const parent = this.fsw._getWatchedDir(dirname13);
62539
+ const parent = this.fsw._getWatchedDir(dirname14);
62474
62540
  let prevStats = stats;
62475
62541
  if (parent.has(basename5))
62476
62542
  return;
@@ -62497,7 +62563,7 @@ var NodeFsHandler = class {
62497
62563
  prevStats = newStats2;
62498
62564
  }
62499
62565
  } catch (error) {
62500
- this.fsw._remove(dirname13, basename5);
62566
+ this.fsw._remove(dirname14, basename5);
62501
62567
  }
62502
62568
  } else if (parent.has(basename5)) {
62503
62569
  const at = newStats.atimeMs;
@@ -63437,33 +63503,33 @@ function appIdFromLogPath(path) {
63437
63503
  return i >= 0 && parts[i + 1] ? parts[i + 1] : null;
63438
63504
  }
63439
63505
  function samePath(a, b) {
63440
- const ra = (0, import_node_path27.resolve)(a);
63441
- const rb = (0, import_node_path27.resolve)(b);
63506
+ const ra = (0, import_node_path28.resolve)(a);
63507
+ const rb = (0, import_node_path28.resolve)(b);
63442
63508
  return process.platform === "win32" ? ra.toLowerCase() === rb.toLowerCase() : ra === rb;
63443
63509
  }
63444
63510
  function underDir(path, dir) {
63445
- const rp = (0, import_node_path27.resolve)(path);
63446
- const rd = (0, import_node_path27.resolve)(dir);
63511
+ const rp = (0, import_node_path28.resolve)(path);
63512
+ const rd = (0, import_node_path28.resolve)(dir);
63447
63513
  const [p, d] = process.platform === "win32" ? [rp.toLowerCase(), rd.toLowerCase()] : [rp, rd];
63448
- return p === d || p.startsWith(d + import_node_path27.sep);
63514
+ return p === d || p.startsWith(d + import_node_path28.sep);
63449
63515
  }
63450
63516
  function startWatcher() {
63451
- const awareDir = process.env.AWARE_HOME ?? (0, import_node_path27.join)((0, import_node_os19.homedir)(), ".aware");
63452
- const credentialsDir = (0, import_node_path27.join)(awareDir, "credentials");
63453
- if (!(0, import_node_fs29.existsSync)(credentialsDir)) {
63517
+ const awareDir = process.env.AWARE_HOME ?? (0, import_node_path28.join)((0, import_node_os19.homedir)(), ".aware");
63518
+ const credentialsDir = (0, import_node_path28.join)(awareDir, "credentials");
63519
+ if (!(0, import_node_fs30.existsSync)(credentialsDir)) {
63454
63520
  try {
63455
- (0, import_node_fs29.mkdirSync)(credentialsDir, { recursive: true });
63521
+ (0, import_node_fs30.mkdirSync)(credentialsDir, { recursive: true });
63456
63522
  } catch {
63457
63523
  }
63458
63524
  }
63459
- if (!(0, import_node_fs29.existsSync)(uiDir)) {
63525
+ if (!(0, import_node_fs30.existsSync)(uiDir)) {
63460
63526
  try {
63461
- (0, import_node_fs29.mkdirSync)(uiDir, { recursive: true });
63527
+ (0, import_node_fs30.mkdirSync)(uiDir, { recursive: true });
63462
63528
  } catch {
63463
63529
  }
63464
63530
  }
63465
- const targets = ["apps", "logs", "credentials"].map((d) => (0, import_node_path27.join)(awareDir, d)).filter((p) => (0, import_node_fs29.existsSync)(p));
63466
- if ((0, import_node_fs29.existsSync)(uiDir)) targets.push(uiDir);
63531
+ const targets = ["apps", "logs", "credentials"].map((d) => (0, import_node_path28.join)(awareDir, d)).filter((p) => (0, import_node_fs30.existsSync)(p));
63532
+ if ((0, import_node_fs30.existsSync)(uiDir)) targets.push(uiDir);
63467
63533
  if (targets.length === 0) {
63468
63534
  return null;
63469
63535
  }
@@ -63492,11 +63558,11 @@ function startWatcher() {
63492
63558
  const isCredential = path.split(/[\\/]/).includes("credentials");
63493
63559
  const kind = isCredential ? "credential" : path.endsWith(".jsonl") ? "trace" : path.endsWith(".lock") ? "lock" : path.endsWith(".flo") || path.endsWith(".app") ? "source" : "file";
63494
63560
  broadcast({ type: "fs-change", kind, event, path });
63495
- if (kind === "trace" && event !== "unlink" && (0, import_node_fs29.existsSync)(path)) {
63561
+ if (kind === "trace" && event !== "unlink" && (0, import_node_fs30.existsSync)(path)) {
63496
63562
  const id = appIdFromLogPath(path);
63497
63563
  if (!id) return;
63498
63564
  try {
63499
- broadcast({ type: "trace-file", id, runId: path.split(import_node_path27.sep).pop()?.replace(/\.jsonl$/, "") ?? null, events: parseTrace((0, import_node_fs29.readFileSync)(path, "utf8")) });
63565
+ broadcast({ type: "trace-file", id, runId: path.split(import_node_path28.sep).pop()?.replace(/\.jsonl$/, "") ?? null, events: parseTrace((0, import_node_fs30.readFileSync)(path, "utf8")) });
63500
63566
  } catch {
63501
63567
  }
63502
63568
  }
@@ -63505,10 +63571,10 @@ function startWatcher() {
63505
63571
  }
63506
63572
 
63507
63573
  // index.ts
63508
- var __dirname4 = (0, import_node_path28.dirname)((0, import_node_url5.fileURLToPath)(__import_meta_url));
63509
- var WEB_ROOT = [(0, import_node_path28.join)(__dirname4, "web"), (0, import_node_path28.join)((0, import_node_path28.dirname)(process.execPath), "web"), (0, import_node_path28.join)(__dirname4, "..", "web")].find(
63510
- (p) => (0, import_node_fs30.existsSync)(p)
63511
- ) ?? (0, import_node_path28.join)(__dirname4, "..", "web");
63574
+ var __dirname4 = (0, import_node_path29.dirname)((0, import_node_url5.fileURLToPath)(__import_meta_url));
63575
+ var WEB_ROOT = [(0, import_node_path29.join)(__dirname4, "web"), (0, import_node_path29.join)((0, import_node_path29.dirname)(process.execPath), "web"), (0, import_node_path29.join)(__dirname4, "..", "web")].find(
63576
+ (p) => (0, import_node_fs31.existsSync)(p)
63577
+ ) ?? (0, import_node_path29.join)(__dirname4, "..", "web");
63512
63578
  var PORT2 = Number(process.env.PORT ?? 4317);
63513
63579
  var HOST = "127.0.0.1";
63514
63580
  var crashHandlersInstalled = false;
@@ -63524,7 +63590,7 @@ function installCrashHandlers() {
63524
63590
  ${stack}
63525
63591
  `;
63526
63592
  try {
63527
- (0, import_node_fs30.appendFileSync)(logFilePath(), line);
63593
+ (0, import_node_fs31.appendFileSync)(logFilePath(), line);
63528
63594
  } catch {
63529
63595
  }
63530
63596
  if (process.stderr.isTTY) process.stderr.write(line);
@@ -63559,7 +63625,7 @@ async function startServer() {
63559
63625
  const isWin3 = process.platform === "win32";
63560
63626
  const has = (cmd) => {
63561
63627
  try {
63562
- (0, import_node_child_process7.execFileSync)(isWin3 ? "where" : "which", [cmd], { stdio: "ignore", windowsHide: true, timeout: 5e3 });
63628
+ (0, import_node_child_process8.execFileSync)(isWin3 ? "where" : "which", [cmd], { stdio: "ignore", windowsHide: true, timeout: 5e3 });
63563
63629
  return true;
63564
63630
  } catch {
63565
63631
  return false;
@@ -63568,7 +63634,7 @@ async function startServer() {
63568
63634
  function installAwareGlobal(spec, onLine = () => {
63569
63635
  }) {
63570
63636
  return new Promise((resolve6, reject) => {
63571
- const child = (0, import_node_child_process7.spawn)("npm", ["i", "-g", `@aware-aeco/cli@${spec}`], { shell: isWin3, windowsHide: true });
63637
+ const child = (0, import_node_child_process8.spawn)("npm", ["i", "-g", `@aware-aeco/cli@${spec}`], { shell: isWin3, windowsHide: true });
63572
63638
  let stderrTail = "";
63573
63639
  let combinedTail = "";
63574
63640
  const tail = (buf, s) => (buf + s).slice(-4e3);
@@ -63818,9 +63884,9 @@ async function startServer() {
63818
63884
  const { id, templateId, templatePath, srcPath, appDirPath: appDirPath2, fromVersion, contract, verb } = opts;
63819
63885
  const bdir = backupDir(id, fromVersion, Date.now());
63820
63886
  try {
63821
- (0, import_node_fs30.mkdirSync)((0, import_node_path28.dirname)(bdir), { recursive: true });
63822
- (0, import_node_fs30.cpSync)(appDirPath2, bdir, { recursive: true });
63823
- (0, import_node_fs30.cpSync)(templatePath, srcPath);
63887
+ (0, import_node_fs31.mkdirSync)((0, import_node_path29.dirname)(bdir), { recursive: true });
63888
+ (0, import_node_fs31.cpSync)(appDirPath2, bdir, { recursive: true });
63889
+ (0, import_node_fs31.cpSync)(templatePath, srcPath);
63824
63890
  if (id !== templateId) stampSourceAppId(srcPath, id);
63825
63891
  if (contract != null) {
63826
63892
  bakeContractIntoApp(srcPath, contract);
@@ -63831,8 +63897,8 @@ async function startServer() {
63831
63897
  } catch (e) {
63832
63898
  const msg = e instanceof Error ? e.message : String(e);
63833
63899
  try {
63834
- (0, import_node_fs30.rmSync)(appDirPath2, { recursive: true, force: true });
63835
- (0, import_node_fs30.cpSync)(bdir, appDirPath2, { recursive: true });
63900
+ (0, import_node_fs31.rmSync)(appDirPath2, { recursive: true, force: true });
63901
+ (0, import_node_fs31.cpSync)(bdir, appDirPath2, { recursive: true });
63836
63902
  } catch (re) {
63837
63903
  const rmsg = re instanceof Error ? re.message : String(re);
63838
63904
  throw new TemplateSwapError(`${verb} failed (${msg}) AND rollback failed (${rmsg}) \u2014 restore manually from ${bdir}`, "rollback-failed", bdir);
@@ -63863,7 +63929,7 @@ async function startServer() {
63863
63929
  return reply.status(409).send({ ok: false, error: `"${id}" is already at ${fromVersion}`, code: "up-to-date" });
63864
63930
  }
63865
63931
  const contract = readContract(id);
63866
- if (contract == null && (0, import_node_fs30.existsSync)(contractPath(id))) {
63932
+ if (contract == null && (0, import_node_fs31.existsSync)(contractPath(id))) {
63867
63933
  return reply.status(409).send({ ok: false, error: `"${id}"'s saved data is unreadable \u2014 open it in the editor and re-save before updating`, code: "contract-corrupt" });
63868
63934
  }
63869
63935
  if (contract != null) {
@@ -64177,7 +64243,7 @@ async function startServer() {
64177
64243
  }
64178
64244
  const companionId = `${req.params.appId}-ifc`;
64179
64245
  const filename = `${req.params.appId}.ifc`;
64180
- const outPath = (0, import_node_path28.join)(appPath(companionId), filename);
64246
+ const outPath = (0, import_node_path29.join)(appPath(companionId), filename);
64181
64247
  let flo;
64182
64248
  try {
64183
64249
  flo = writeIfcApp(appPath(companionId), companionId, scene, outPath, writeOpts);
@@ -64200,8 +64266,8 @@ async function startServer() {
64200
64266
  }
64201
64267
  throw e;
64202
64268
  }
64203
- if (!(0, import_node_fs30.existsSync)(outPath)) return reply.send({ ok: false, error: "the IFC export produced no file" });
64204
- const content = (0, import_node_fs30.readFileSync)(outPath, "utf8");
64269
+ if (!(0, import_node_fs31.existsSync)(outPath)) return reply.send({ ok: false, error: "the IFC export produced no file" });
64270
+ const content = (0, import_node_fs31.readFileSync)(outPath, "utf8");
64205
64271
  broadcast({ type: "apps-changed" });
64206
64272
  return { ok: true, filename, content, bytes: Buffer.byteLength(content), skipped, ...extrusionsSkipped ? { extrusionsSkipped } : {} };
64207
64273
  });
@@ -64280,17 +64346,17 @@ async function startServer() {
64280
64346
  return reply.status(422).send({ ok: false, error: "no priced members to export \u2014 every member is an RFI (no AISC size / weight yet)" });
64281
64347
  }
64282
64348
  const outPath = bomExportPath(appId, format);
64283
- const dir = (0, import_node_path28.dirname)(outPath);
64349
+ const dir = (0, import_node_path29.dirname)(outPath);
64284
64350
  const filename = `${appId}-bom.${format}`;
64285
64351
  try {
64286
- (0, import_node_fs30.mkdirSync)(dir, { recursive: true });
64352
+ (0, import_node_fs31.mkdirSync)(dir, { recursive: true });
64287
64353
  if (format === "csv") {
64288
64354
  const text = bomToCsv(bom);
64289
- (0, import_node_fs30.writeFileSync)(outPath, text, "utf8");
64355
+ (0, import_node_fs31.writeFileSync)(outPath, text, "utf8");
64290
64356
  return { ok: true, filename, encoding: "utf8", content: text, bytes: Buffer.byteLength(text), savedTo: outPath };
64291
64357
  }
64292
64358
  const buf = await bomToXlsx(bom);
64293
- (0, import_node_fs30.writeFileSync)(outPath, buf);
64359
+ (0, import_node_fs31.writeFileSync)(outPath, buf);
64294
64360
  return { ok: true, filename, encoding: "base64", content: buf.toString("base64"), bytes: buf.length, savedTo: outPath };
64295
64361
  } catch (e) {
64296
64362
  app.log.error({ appId, format, err: e instanceof Error ? e.message : e }, "export-bom: generation failed");
@@ -64360,7 +64426,7 @@ async function startServer() {
64360
64426
  return reply.status(404).send({ ok: false, error: `"${id}" is not installed`, code: "not-installed" });
64361
64427
  }
64362
64428
  const contract = readContract(id);
64363
- if (contract == null && (0, import_node_fs30.existsSync)(contractPath(id))) {
64429
+ if (contract == null && (0, import_node_fs31.existsSync)(contractPath(id))) {
64364
64430
  return reply.status(409).send({ ok: false, error: `"${id}"'s saved data is unreadable \u2014 open it in the editor and re-save before restoring`, code: "contract-corrupt" });
64365
64431
  }
64366
64432
  if (contract != null) {
@@ -64438,11 +64504,11 @@ async function startServer() {
64438
64504
  if (appExists(id)) {
64439
64505
  return reply.status(409).send({ ok: false, error: `a workflow named "${id}" is already installed \u2014 remove it first, or rename the file's app: id`, code: "exists", id });
64440
64506
  }
64441
- const stageRoot = (0, import_node_fs30.mkdtempSync)((0, import_node_path28.join)((0, import_node_os20.tmpdir)(), "floless-import-"));
64507
+ const stageRoot = (0, import_node_fs31.mkdtempSync)((0, import_node_path29.join)((0, import_node_os20.tmpdir)(), "floless-import-"));
64442
64508
  try {
64443
- const stageDir = (0, import_node_path28.join)(stageRoot, id);
64444
- (0, import_node_fs30.mkdirSync)(stageDir);
64445
- (0, import_node_fs30.writeFileSync)((0, import_node_path28.join)(stageDir, `${id}.flo`), content);
64509
+ const stageDir = (0, import_node_path29.join)(stageRoot, id);
64510
+ (0, import_node_fs31.mkdirSync)(stageDir);
64511
+ (0, import_node_fs31.writeFileSync)((0, import_node_path29.join)(stageDir, `${id}.flo`), content);
64446
64512
  await aware.install(stageDir);
64447
64513
  } catch (err2) {
64448
64514
  try {
@@ -64452,7 +64518,7 @@ async function startServer() {
64452
64518
  const msg = err2 instanceof AwareError ? err2.message : String(err2?.message ?? err2);
64453
64519
  return reply.status(502).send({ ok: false, error: `import failed: ${msg}` });
64454
64520
  } finally {
64455
- (0, import_node_fs30.rmSync)(stageRoot, { recursive: true, force: true });
64521
+ (0, import_node_fs31.rmSync)(stageRoot, { recursive: true, force: true });
64456
64522
  }
64457
64523
  broadcast({ type: "apps-changed", id });
64458
64524
  return { ok: true, id };
@@ -64466,13 +64532,13 @@ async function startServer() {
64466
64532
  }
64467
64533
  const inputs = appData.inputs.map((i) => ({ name: i.name, type: i.type }));
64468
64534
  const baked = bakeFloSource(appData.source.text, inputs);
64469
- const tmpRoot = (0, import_node_fs30.mkdtempSync)((0, import_node_path28.join)((0, import_node_os20.tmpdir)(), "floless-bake-"));
64470
- const backupDir2 = (0, import_node_path28.join)(tmpRoot, `${id}-backup`);
64471
- const bakeDir = (0, import_node_path28.join)(tmpRoot, id);
64472
- (0, import_node_fs30.cpSync)(appDir(id), backupDir2, { recursive: true });
64473
- (0, import_node_fs30.cpSync)(appDir(id), bakeDir, { recursive: true });
64535
+ const tmpRoot = (0, import_node_fs31.mkdtempSync)((0, import_node_path29.join)((0, import_node_os20.tmpdir)(), "floless-bake-"));
64536
+ const backupDir2 = (0, import_node_path29.join)(tmpRoot, `${id}-backup`);
64537
+ const bakeDir = (0, import_node_path29.join)(tmpRoot, id);
64538
+ (0, import_node_fs31.cpSync)(appDir(id), backupDir2, { recursive: true });
64539
+ (0, import_node_fs31.cpSync)(appDir(id), bakeDir, { recursive: true });
64474
64540
  const floName = appData.source.path.split(/[\\/]/).pop();
64475
- (0, import_node_fs30.writeFileSync)((0, import_node_path28.join)(bakeDir, floName), baked);
64541
+ (0, import_node_fs31.writeFileSync)((0, import_node_path29.join)(bakeDir, floName), baked);
64476
64542
  let appInstalled2 = true;
64477
64543
  try {
64478
64544
  await aware.uninstall(id);
@@ -64494,17 +64560,17 @@ async function startServer() {
64494
64560
  throw installErr;
64495
64561
  }
64496
64562
  try {
64497
- await aware.compile((0, import_node_path28.join)(appDir(id), floName));
64563
+ await aware.compile((0, import_node_path29.join)(appDir(id), floName));
64498
64564
  } catch (compileErr) {
64499
64565
  app.log.warn({ id, compileErr: String(compileErr) }, "bake: post-install recompile failed (app baked but may need a manual Compile)");
64500
64566
  }
64501
64567
  broadcast({ type: "baked", id });
64502
64568
  return { ok: true, id, agent: id, inputs };
64503
64569
  } finally {
64504
- if (appInstalled2) (0, import_node_fs30.rmSync)(tmpRoot, { recursive: true, force: true });
64570
+ if (appInstalled2) (0, import_node_fs31.rmSync)(tmpRoot, { recursive: true, force: true });
64505
64571
  }
64506
64572
  });
64507
- const graftAgentsDir = () => (0, import_node_path28.join)((0, import_node_os20.homedir)(), ".aware", "agents");
64573
+ const graftAgentsDir = () => (0, import_node_path29.join)((0, import_node_os20.homedir)(), ".aware", "agents");
64508
64574
  app.post("/api/graft/match", async (req, reply) => {
64509
64575
  const { glob } = req.body ?? {};
64510
64576
  if (!glob) return reply.status(400).send({ ok: false, error: "glob required" });
@@ -64521,7 +64587,7 @@ async function startServer() {
64521
64587
  if (!sourceKind || !sourceRef) {
64522
64588
  return reply.status(400).send({ ok: false, error: "sourceKind and sourceRef required" });
64523
64589
  }
64524
- const tempHome = (0, import_node_fs30.mkdtempSync)((0, import_node_path28.join)((0, import_node_os20.tmpdir)(), "floless-graft-"));
64590
+ const tempHome = (0, import_node_fs31.mkdtempSync)((0, import_node_path29.join)((0, import_node_os20.tmpdir)(), "floless-graft-"));
64525
64591
  let result;
64526
64592
  try {
64527
64593
  result = await aware.build({
@@ -64534,19 +64600,19 @@ async function startServer() {
64534
64600
  awareHome: tempHome
64535
64601
  });
64536
64602
  } catch (err2) {
64537
- (0, import_node_fs30.rmSync)(tempHome, { recursive: true, force: true });
64603
+ (0, import_node_fs31.rmSync)(tempHome, { recursive: true, force: true });
64538
64604
  const msg = err2 instanceof AwareError ? err2.message : String(err2?.message ?? err2);
64539
64605
  return reply.status(422).send({ ok: false, error: msg });
64540
64606
  }
64541
64607
  const manifest = readStagedManifest(result.agentDir);
64542
64608
  if (!manifest) {
64543
- (0, import_node_fs30.rmSync)(tempHome, { recursive: true, force: true });
64609
+ (0, import_node_fs31.rmSync)(tempHome, { recursive: true, force: true });
64544
64610
  return reply.status(502).send({ ok: false, error: `build produced output at ${result.agentDir} but no manifest.yaml` });
64545
64611
  }
64546
64612
  const token = (0, import_node_crypto7.randomUUID)();
64547
64613
  registerStage(token, tempHome, result.agentId);
64548
64614
  const preview = buildPreview(manifest, sourceKind, sourceRef, token);
64549
- if ((0, import_node_fs30.existsSync)((0, import_node_path28.join)(graftAgentsDir(), result.agentId))) {
64615
+ if ((0, import_node_fs31.existsSync)((0, import_node_path29.join)(graftAgentsDir(), result.agentId))) {
64550
64616
  preview.warnings.unshift(`An agent named "${result.agentId}" is already installed \u2014 creating it will overwrite it.`);
64551
64617
  }
64552
64618
  return { ok: true, preview };
@@ -64565,7 +64631,7 @@ async function startServer() {
64565
64631
  registerStage(stagedRef, stage.tempDir, stage.agentId);
64566
64632
  return reply.status(409).send({ ok: false, error: err2.message, agentId: stage.agentId, collision: true });
64567
64633
  }
64568
- (0, import_node_fs30.rmSync)(stage.tempDir, { recursive: true, force: true });
64634
+ (0, import_node_fs31.rmSync)(stage.tempDir, { recursive: true, force: true });
64569
64635
  throw err2;
64570
64636
  }
64571
64637
  broadcast({ type: "grafted", id: stage.agentId });
@@ -64663,13 +64729,24 @@ async function startServer() {
64663
64729
  report = { ...interactive ? extracted : withBadge(extracted), interactive };
64664
64730
  }
64665
64731
  const credentialIssue = !simulate && hasAuthFailure(events) ? await detectCredentialIssue(id) : null;
64666
- return { ok: true, runId: result.runId, tracePath: result.tracePath, events, report, credentialIssue };
64732
+ const savedPath = extractSavedPath(events);
64733
+ return { ok: true, runId: result.runId, tracePath: result.tracePath, events, report, savedPath, credentialIssue };
64667
64734
  }
64668
64735
  );
64669
64736
  app.post("/api/run/stop", async () => {
64670
64737
  const running = cancelActiveRun();
64671
64738
  return { ok: true, running };
64672
64739
  });
64740
+ function fileVerb(launch) {
64741
+ return async (req, reply) => {
64742
+ const check = validateOpenable(req.body?.path);
64743
+ if (!check.ok) return reply.status(400).send({ ok: false, error: check.error });
64744
+ launch(check.path);
64745
+ return { ok: true };
64746
+ };
64747
+ }
64748
+ app.post("/api/open-file", fileVerb(launchFile));
64749
+ app.post("/api/reveal", fileVerb(revealFile));
64673
64750
  app.post(
64674
64751
  "/api/trigger-run",
64675
64752
  async (req, reply) => {
@@ -64825,11 +64902,11 @@ async function startServer() {
64825
64902
  app.get("/api/requests/:id/snapshot/:n", async (req, reply) => {
64826
64903
  const n = Number.parseInt(req.params.n, 10);
64827
64904
  const p = Number.isInteger(n) ? snapshotPathFor(req.params.id, n) : null;
64828
- if (!p || !(0, import_node_fs30.existsSync)(p)) return reply.status(404).send({ ok: false, error: "snapshot not found" });
64905
+ if (!p || !(0, import_node_fs31.existsSync)(p)) return reply.status(404).send({ ok: false, error: "snapshot not found" });
64829
64906
  const ext = p.split(".").pop().toLowerCase();
64830
64907
  reply.header("Content-Type", ext === "png" ? "image/png" : ext === "webp" ? "image/webp" : ext === "pdf" ? "application/pdf" : "image/jpeg");
64831
64908
  reply.header("Cache-Control", "no-store");
64832
- return (0, import_node_fs30.readFileSync)(p);
64909
+ return (0, import_node_fs31.readFileSync)(p);
64833
64910
  });
64834
64911
  app.post(
64835
64912
  "/api/tweak",
@@ -64985,7 +65062,9 @@ async function startServer() {
64985
65062
  runId: latest.runId,
64986
65063
  status: summarizeRun(events).status,
64987
65064
  rows: extractRunRows(events),
64988
- html: withBadge(extractReportHtml(events))?.html ?? null
65065
+ html: withBadge(extractReportHtml(events))?.html ?? null,
65066
+ saved_path: extractSavedPath(events)
65067
+ // so a cached panel report also restores Open file / Reveal (#209)
64989
65068
  };
64990
65069
  }
64991
65070
  if (kind === "last-run-status") {
@@ -64996,7 +65075,7 @@ async function startServer() {
64996
65075
  warn(`last-run-status:${ref} \u2014 trace exists but couldn't be parsed (corrupt/truncated)`);
64997
65076
  let finishedAt2 = null;
64998
65077
  try {
64999
- finishedAt2 = (0, import_node_fs30.statSync)(latest.path).mtime.toISOString();
65078
+ finishedAt2 = (0, import_node_fs31.statSync)(latest.path).mtime.toISOString();
65000
65079
  } catch {
65001
65080
  finishedAt2 = null;
65002
65081
  }
@@ -65006,7 +65085,7 @@ async function startServer() {
65006
65085
  let finishedAt = typeof runEnd?.ts === "string" ? runEnd.ts : null;
65007
65086
  if (!finishedAt) {
65008
65087
  try {
65009
- finishedAt = (0, import_node_fs30.statSync)(latest.path).mtime.toISOString();
65088
+ finishedAt = (0, import_node_fs31.statSync)(latest.path).mtime.toISOString();
65010
65089
  } catch {
65011
65090
  finishedAt = null;
65012
65091
  }
@@ -65142,10 +65221,10 @@ async function startServer() {
65142
65221
  }
65143
65222
 
65144
65223
  // protocol.ts
65145
- var import_node_child_process8 = require("node:child_process");
65224
+ var import_node_child_process9 = require("node:child_process");
65146
65225
  var BASE = PROTOCOL_KEY;
65147
65226
  function reg(args) {
65148
- (0, import_node_child_process8.execFileSync)("reg", args, { stdio: "ignore", windowsHide: true });
65227
+ (0, import_node_child_process9.execFileSync)("reg", args, { stdio: "ignore", windowsHide: true });
65149
65228
  }
65150
65229
  function registerProtocol(exePath) {
65151
65230
  if (process.platform !== "win32") return;
@@ -65185,13 +65264,13 @@ async function removeAwarePerDecision(removeAwareFlag, prompt) {
65185
65264
  );
65186
65265
  const shell = process.platform === "win32" ? process.env.ComSpec || "cmd.exe" : "/bin/sh";
65187
65266
  try {
65188
- (0, import_node_child_process9.execSync)("npm uninstall -g @aware-aeco/cli", { stdio: "inherit", shell });
65267
+ (0, import_node_child_process10.execSync)("npm uninstall -g @aware-aeco/cli", { stdio: "inherit", shell });
65189
65268
  } catch {
65190
65269
  process.stdout.write('floless: warning: "npm uninstall -g @aware-aeco/cli" failed \u2014 see the output above.\n');
65191
65270
  }
65192
65271
  let lsJson = "";
65193
65272
  try {
65194
- lsJson = (0, import_node_child_process9.execSync)("npm ls -g @aware-aeco/cli --depth=0 --json", {
65273
+ lsJson = (0, import_node_child_process10.execSync)("npm ls -g @aware-aeco/cli --depth=0 --json", {
65195
65274
  encoding: "utf8",
65196
65275
  stdio: ["ignore", "pipe", "ignore"],
65197
65276
  shell