@floless/app 0.69.0 → 0.71.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.69.0" : void 0,
53025
+ define: true ? "0.71.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.69.0" : void 0 });
53035
+ return resolveChannel({ isSea: isSea2(), define: true ? "0.71.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
@@ -54632,6 +54698,8 @@ function expandJoints(joints, memberGeo) {
54632
54698
  return;
54633
54699
  }
54634
54700
  for (const part of expandBasePlate(j, col)) {
54701
+ part.conn = j.id;
54702
+ part.connKind = j.kind;
54635
54703
  elements.push(part);
54636
54704
  usedGroups.add(part.group);
54637
54705
  }
@@ -54653,6 +54721,8 @@ function expandJoints(joints, memberGeo) {
54653
54721
  return;
54654
54722
  }
54655
54723
  for (const part of parts) {
54724
+ part.conn = j.id;
54725
+ part.connKind = j.kind;
54656
54726
  elements.push(part);
54657
54727
  if (part.kind !== "cut") usedGroups.add(part.group);
54658
54728
  }
@@ -54856,10 +54926,10 @@ function contractToBom(contractInput) {
54856
54926
 
54857
54927
  // bom-export.ts
54858
54928
  var import_node_os13 = require("node:os");
54859
- var import_node_path16 = require("node:path");
54929
+ var import_node_path17 = require("node:path");
54860
54930
 
54861
54931
  // node_modules/write-excel-file/modules/export/writeXlsxFileNode.js
54862
- var import_node_fs19 = __toESM(require("node:fs"), 1);
54932
+ var import_node_fs20 = __toESM(require("node:fs"), 1);
54863
54933
 
54864
54934
  // node_modules/write-excel-file/modules/xlsx/helpers/features/getAdditionalContent.js
54865
54935
  function _createForOfIteratorHelperLoose(r, e) {
@@ -59031,7 +59101,7 @@ function writeXlsxFile(arg1, arg2, arg3) {
59031
59101
  },
59032
59102
  toFile: function toFile(filePath) {
59033
59103
  return createReadableStream().then(function(readableStream) {
59034
- return pipe(readableStream, import_node_fs19.default.createWriteStream(filePath));
59104
+ return pipe(readableStream, import_node_fs20.default.createWriteStream(filePath));
59035
59105
  });
59036
59106
  }
59037
59107
  };
@@ -59056,8 +59126,8 @@ function pipe(readableStream, writableStream) {
59056
59126
 
59057
59127
  // bom-export.ts
59058
59128
  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}`);
59129
+ const root = process.env.FLOLESS_HOME ?? (0, import_node_path17.join)((0, import_node_os13.homedir)(), ".floless");
59130
+ return (0, import_node_path17.join)(root, "exports", appId, `${appId}-bom.${format}`);
59061
59131
  }
59062
59132
  function csvField(v) {
59063
59133
  let s = String(v);
@@ -59085,11 +59155,11 @@ async function bomToXlsx(bom) {
59085
59155
  }
59086
59156
 
59087
59157
  // scene-bake.ts
59088
- var import_node_fs20 = require("node:fs");
59089
- var import_node_path17 = require("node:path");
59158
+ var import_node_fs21 = require("node:fs");
59159
+ var import_node_path18 = require("node:path");
59090
59160
  var import_yaml6 = __toESM(require_dist6(), 1);
59091
59161
  function bakeSceneIntoApp(sourcePath, scene, agent = "viewer-3d") {
59092
- const doc = (0, import_yaml6.parseDocument)((0, import_node_fs20.readFileSync)(sourcePath, "utf8"));
59162
+ const doc = (0, import_yaml6.parseDocument)((0, import_node_fs21.readFileSync)(sourcePath, "utf8"));
59093
59163
  if (doc.errors.length > 0) {
59094
59164
  throw new Error(`scene bake: source is not valid YAML: ${doc.errors[0]?.message ?? "parse error"}`);
59095
59165
  }
@@ -59098,10 +59168,10 @@ function bakeSceneIntoApp(sourcePath, scene, agent = "viewer-3d") {
59098
59168
  const idx = items.findIndex((it) => ((0, import_yaml6.isMap)(it) ? it.toJSON() : null)?.agent === agent);
59099
59169
  if (idx < 0) throw new Error(`no ${agent} render node to bake the scene into`);
59100
59170
  doc.setIn(["nodes", idx, "config", "scene"], scene);
59101
- (0, import_node_fs20.writeFileSync)(sourcePath, doc.toString());
59171
+ (0, import_node_fs21.writeFileSync)(sourcePath, doc.toString());
59102
59172
  }
59103
59173
  function bakeNodeConfigById(sourcePath, nodeId, patch2) {
59104
- const doc = (0, import_yaml6.parseDocument)((0, import_node_fs20.readFileSync)(sourcePath, "utf8"));
59174
+ const doc = (0, import_yaml6.parseDocument)((0, import_node_fs21.readFileSync)(sourcePath, "utf8"));
59105
59175
  if (doc.errors.length > 0) {
59106
59176
  throw new Error(`node bake: source is not valid YAML: ${doc.errors[0]?.message ?? "parse error"}`);
59107
59177
  }
@@ -59110,12 +59180,12 @@ function bakeNodeConfigById(sourcePath, nodeId, patch2) {
59110
59180
  const idx = items.findIndex((it) => ((0, import_yaml6.isMap)(it) ? it.toJSON() : null)?.id === nodeId);
59111
59181
  if (idx < 0) throw new Error(`no node with id "${nodeId}"`);
59112
59182
  for (const [key, value] of Object.entries(patch2)) doc.setIn(["nodes", idx, "config", key], value);
59113
- (0, import_node_fs20.writeFileSync)(sourcePath, doc.toString());
59183
+ (0, import_node_fs21.writeFileSync)(sourcePath, doc.toString());
59114
59184
  }
59115
59185
  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, [
59186
+ (0, import_node_fs21.mkdirSync)(dir, { recursive: true });
59187
+ const flo = (0, import_node_path18.join)(dir, `${appId}.flo`);
59188
+ (0, import_node_fs21.writeFileSync)(flo, [
59119
59189
  `app: ${appId}`,
59120
59190
  "version: 0.1.0",
59121
59191
  "display-name: Steel 3D",
@@ -59136,11 +59206,11 @@ function writeViewer3dApp(dir, appId, scene) {
59136
59206
  return flo;
59137
59207
  }
59138
59208
  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`);
59209
+ (0, import_node_fs21.mkdirSync)(dir, { recursive: true });
59210
+ const flo = (0, import_node_path18.join)(dir, `${appId}.flo`);
59141
59211
  const displayName = opts.displayName ?? "Steel IFC";
59142
59212
  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, [
59213
+ (0, import_node_fs21.writeFileSync)(flo, [
59144
59214
  `app: ${appId}`,
59145
59215
  "version: 0.1.0",
59146
59216
  `display-name: ${displayName}`,
@@ -59163,9 +59233,9 @@ function writeIfcApp(dir, appId, scene, outputPath, opts = {}) {
59163
59233
  return flo;
59164
59234
  }
59165
59235
  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, [
59236
+ (0, import_node_fs21.mkdirSync)(dir, { recursive: true });
59237
+ const flo = (0, import_node_path18.join)(dir, `${appId}.flo`);
59238
+ (0, import_node_fs21.writeFileSync)(flo, [
59169
59239
  `app: ${appId}`,
59170
59240
  "version: 0.1.0",
59171
59241
  "display-name: Steel to Tekla",
@@ -59227,9 +59297,9 @@ function exportPathsNeedingBake(nodes, appId) {
59227
59297
  }
59228
59298
 
59229
59299
  // tekla-version.ts
59230
- var import_node_child_process3 = require("node:child_process");
59300
+ var import_node_child_process4 = require("node:child_process");
59231
59301
  var import_node_util = require("node:util");
59232
- var pexec = (0, import_node_util.promisify)(import_node_child_process3.execFile);
59302
+ var pexec = (0, import_node_util.promisify)(import_node_child_process4.execFile);
59233
59303
  var DEFAULT_TEKLA_VERSION = "2026.0";
59234
59304
  function parseTeklaVersionFromExePath(p) {
59235
59305
  const m = /Tekla Structures[\\/]+([^\\/]+)[\\/]+bin\b/i.exec(p);
@@ -59573,13 +59643,13 @@ function scoreContract2(contractInput) {
59573
59643
  }
59574
59644
 
59575
59645
  // app-lifecycle.ts
59576
- var import_node_fs23 = require("node:fs");
59646
+ var import_node_fs24 = require("node:fs");
59577
59647
  var import_node_os15 = require("node:os");
59578
- var import_node_path20 = require("node:path");
59648
+ var import_node_path21 = require("node:path");
59579
59649
 
59580
59650
  // routines.ts
59581
- var import_node_fs22 = require("node:fs");
59582
- var import_node_path19 = require("node:path");
59651
+ var import_node_fs23 = require("node:fs");
59652
+ var import_node_path20 = require("node:path");
59583
59653
 
59584
59654
  // sse.ts
59585
59655
  var clients = /* @__PURE__ */ new Set();
@@ -59616,11 +59686,11 @@ function clientCount() {
59616
59686
  }
59617
59687
 
59618
59688
  // trigger-sessions.ts
59619
- var import_node_fs21 = require("node:fs");
59689
+ var import_node_fs22 = require("node:fs");
59620
59690
  var import_node_os14 = require("node:os");
59621
- var import_node_path18 = require("node:path");
59691
+ var import_node_path19 = require("node:path");
59622
59692
  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");
59693
+ 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
59694
  function summarizeFire(data) {
59625
59695
  if (!data) return "event";
59626
59696
  const type = typeof data.type === "string" ? data.type : "";
@@ -59637,10 +59707,10 @@ function mapTriggerState(phase) {
59637
59707
  function isHostBacked(agent, agentsDir = AGENTS_DIR2) {
59638
59708
  const safe = (n) => !n.includes("/") && !n.includes("\\") && !n.includes("..");
59639
59709
  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;
59710
+ const manifestPath = (0, import_node_path19.join)(agentsDir, agent, "manifest.yaml");
59711
+ if (!(0, import_node_fs22.existsSync)(manifestPath)) return false;
59642
59712
  try {
59643
- const doc = (0, import_yaml7.parse)((0, import_node_fs21.readFileSync)(manifestPath, "utf8"));
59713
+ const doc = (0, import_yaml7.parse)((0, import_node_fs22.readFileSync)(manifestPath, "utf8"));
59644
59714
  const transport = doc?.transport;
59645
59715
  return !!(transport && typeof transport === "object" && "cli" in transport);
59646
59716
  } catch {
@@ -59925,7 +59995,7 @@ var RoutineError = class extends Error {
59925
59995
  }
59926
59996
  status;
59927
59997
  };
59928
- var ROUTINES_FILE = (0, import_node_path19.join)(flolessRoot, "routines.json");
59998
+ var ROUTINES_FILE = (0, import_node_path20.join)(flolessRoot, "routines.json");
59929
59999
  var routines = [];
59930
60000
  var loaded = false;
59931
60001
  function ensureLoaded() {
@@ -59961,10 +60031,10 @@ function sanitizeRoutine(raw) {
59961
60031
  };
59962
60032
  }
59963
60033
  function loadFromDisk() {
59964
- if (!(0, import_node_fs22.existsSync)(ROUTINES_FILE)) return [];
60034
+ if (!(0, import_node_fs23.existsSync)(ROUTINES_FILE)) return [];
59965
60035
  let text;
59966
60036
  try {
59967
- text = (0, import_node_fs22.readFileSync)(ROUTINES_FILE, "utf8");
60037
+ text = (0, import_node_fs23.readFileSync)(ROUTINES_FILE, "utf8");
59968
60038
  } catch {
59969
60039
  return [];
59970
60040
  }
@@ -59973,17 +60043,17 @@ function loadFromDisk() {
59973
60043
  return Array.isArray(parsed) ? parsed.map(sanitizeRoutine).filter((r) => r !== null) : [];
59974
60044
  } catch {
59975
60045
  try {
59976
- (0, import_node_fs22.renameSync)(ROUTINES_FILE, `${ROUTINES_FILE}.corrupt-${Date.now()}`);
60046
+ (0, import_node_fs23.renameSync)(ROUTINES_FILE, `${ROUTINES_FILE}.corrupt-${Date.now()}`);
59977
60047
  } catch {
59978
60048
  }
59979
60049
  return [];
59980
60050
  }
59981
60051
  }
59982
60052
  function saveRoutines() {
59983
- if (!(0, import_node_fs22.existsSync)(flolessRoot)) (0, import_node_fs22.mkdirSync)(flolessRoot, { recursive: true });
60053
+ if (!(0, import_node_fs23.existsSync)(flolessRoot)) (0, import_node_fs23.mkdirSync)(flolessRoot, { recursive: true });
59984
60054
  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);
60055
+ (0, import_node_fs23.writeFileSync)(tmp, JSON.stringify(routines, null, 2));
60056
+ (0, import_node_fs23.renameSync)(tmp, ROUTINES_FILE);
59987
60057
  }
59988
60058
  function listRoutines() {
59989
60059
  ensureLoaded();
@@ -60391,13 +60461,13 @@ var AppLifecycleError = class extends Error {
60391
60461
  }
60392
60462
  };
60393
60463
  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");
60464
+ 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
60465
  }
60396
60466
  function appDirPath(id) {
60397
- return (0, import_node_path20.join)(appsDir(), id);
60467
+ return (0, import_node_path21.join)(appsDir(), id);
60398
60468
  }
60399
60469
  function appInstalled(id) {
60400
- return APP_ID3.test(id) && (0, import_node_fs23.existsSync)(appDirPath(id));
60470
+ return APP_ID3.test(id) && (0, import_node_fs24.existsSync)(appDirPath(id));
60401
60471
  }
60402
60472
  function logCascade(what, e) {
60403
60473
  console.error(`[app-lifecycle] cascade step failed (${what}):`, e instanceof Error ? e.message : e);
@@ -60512,10 +60582,10 @@ function isGatedAwareRoute(url, method) {
60512
60582
  }
60513
60583
 
60514
60584
  // autostart.mjs
60515
- var import_node_child_process4 = require("node:child_process");
60516
- var import_node_fs24 = require("node:fs");
60585
+ var import_node_child_process5 = require("node:child_process");
60586
+ var import_node_fs25 = require("node:fs");
60517
60587
  var import_node_os16 = require("node:os");
60518
- var import_node_path21 = require("node:path");
60588
+ var import_node_path22 = require("node:path");
60519
60589
 
60520
60590
  // teardown.mjs
60521
60591
  var RUN_KEY = "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run";
@@ -60621,14 +60691,14 @@ function currentUserId() {
60621
60691
  }
60622
60692
  function removeLegacyRunKey() {
60623
60693
  try {
60624
- (0, import_node_child_process4.execFileSync)("reg", ["delete", RUN_KEY, "/v", RUN_VALUE, "/f"], { stdio: "ignore", windowsHide: true });
60694
+ (0, import_node_child_process5.execFileSync)("reg", ["delete", RUN_KEY, "/v", RUN_VALUE, "/f"], { stdio: "ignore", windowsHide: true });
60625
60695
  } catch {
60626
60696
  }
60627
60697
  }
60628
60698
  function logLine(msg) {
60629
60699
  try {
60630
- (0, import_node_fs24.mkdirSync)(logDir(), { recursive: true });
60631
- (0, import_node_fs24.appendFileSync)(logFilePath(), `${(/* @__PURE__ */ new Date()).toISOString()} ${msg}
60700
+ (0, import_node_fs25.mkdirSync)(logDir(), { recursive: true });
60701
+ (0, import_node_fs25.appendFileSync)(logFilePath(), `${(/* @__PURE__ */ new Date()).toISOString()} ${msg}
60632
60702
  `);
60633
60703
  } catch {
60634
60704
  }
@@ -60636,10 +60706,10 @@ function logLine(msg) {
60636
60706
  function registerAutostart(exePath) {
60637
60707
  if (!isWin) return;
60638
60708
  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" });
60709
+ const tmp = (0, import_node_path22.join)((0, import_node_os16.tmpdir)(), `floless-autostart-${process.pid}-${Date.now()}.xml`);
60710
+ (0, import_node_fs25.writeFileSync)(tmp, "\uFEFF" + xml, { encoding: "utf16le" });
60641
60711
  try {
60642
- (0, import_node_child_process4.execFileSync)("schtasks", ["/Create", "/TN", TASK_NAME, "/XML", tmp, "/F"], {
60712
+ (0, import_node_child_process5.execFileSync)("schtasks", ["/Create", "/TN", TASK_NAME, "/XML", tmp, "/F"], {
60643
60713
  stdio: ["ignore", "ignore", "ignore"],
60644
60714
  windowsHide: true
60645
60715
  });
@@ -60648,7 +60718,7 @@ function registerAutostart(exePath) {
60648
60718
  throw err2;
60649
60719
  } finally {
60650
60720
  try {
60651
- (0, import_node_fs24.rmSync)(tmp, { force: true });
60721
+ (0, import_node_fs25.rmSync)(tmp, { force: true });
60652
60722
  } catch {
60653
60723
  }
60654
60724
  }
@@ -60657,7 +60727,7 @@ function registerAutostart(exePath) {
60657
60727
  function autostartPresent() {
60658
60728
  if (!isWin) return false;
60659
60729
  try {
60660
- (0, import_node_child_process4.execFileSync)("schtasks", ["/query", "/tn", TASK_NAME], { stdio: "ignore", windowsHide: true });
60730
+ (0, import_node_child_process5.execFileSync)("schtasks", ["/query", "/tn", TASK_NAME], { stdio: "ignore", windowsHide: true });
60661
60731
  return true;
60662
60732
  } catch {
60663
60733
  return false;
@@ -60674,35 +60744,35 @@ function ensureAutostart(exePath) {
60674
60744
  function unregisterAutostart() {
60675
60745
  if (!isWin) return;
60676
60746
  try {
60677
- (0, import_node_child_process4.execFileSync)("schtasks", ["/delete", "/tn", TASK_NAME, "/f"], { stdio: "ignore", windowsHide: true });
60747
+ (0, import_node_child_process5.execFileSync)("schtasks", ["/delete", "/tn", TASK_NAME, "/f"], { stdio: "ignore", windowsHide: true });
60678
60748
  } catch {
60679
60749
  }
60680
60750
  removeLegacyRunKey();
60681
60751
  }
60682
60752
 
60683
60753
  // updater.ts
60684
- var import_node_child_process5 = require("node:child_process");
60754
+ var import_node_child_process6 = require("node:child_process");
60685
60755
  var import_node_crypto6 = require("node:crypto");
60686
- var import_node_fs26 = require("node:fs");
60756
+ var import_node_fs27 = require("node:fs");
60687
60757
  var import_node_stream3 = require("node:stream");
60688
60758
  var import_promises = require("node:stream/promises");
60689
- var import_node_path23 = require("node:path");
60759
+ var import_node_path24 = require("node:path");
60690
60760
 
60691
60761
  // post-update-marker.mjs
60692
- var import_node_fs25 = require("node:fs");
60762
+ var import_node_fs26 = require("node:fs");
60693
60763
  var import_node_os17 = require("node:os");
60694
- var import_node_path22 = require("node:path");
60764
+ var import_node_path23 = require("node:path");
60695
60765
  var FRESH_MS = 12e4;
60696
60766
  function markerPath() {
60697
60767
  const override = (process.env.FLOLESS_POST_UPDATE_MARKER ?? "").trim();
60698
60768
  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");
60769
+ const root = process.env.FLOLESS_HOME ?? (0, import_node_path23.join)((0, import_node_os17.homedir)(), ".floless");
60770
+ return (0, import_node_path23.join)(root, ".post-update");
60701
60771
  }
60702
60772
  function legacyMarkerPath() {
60703
60773
  if ((process.env.FLOLESS_POST_UPDATE_MARKER ?? "").trim()) return null;
60704
60774
  try {
60705
- return (0, import_node_path22.join)((0, import_node_path22.dirname)((0, import_node_path22.dirname)(process.execPath)), ".floless-post-update");
60775
+ return (0, import_node_path23.join)((0, import_node_path23.dirname)((0, import_node_path23.dirname)(process.execPath)), ".floless-post-update");
60706
60776
  } catch {
60707
60777
  return null;
60708
60778
  }
@@ -60712,7 +60782,7 @@ function writePostUpdateMarker() {
60712
60782
  for (const p of [markerPath(), legacyMarkerPath()]) {
60713
60783
  if (!p) continue;
60714
60784
  try {
60715
- (0, import_node_fs25.writeFileSync)(p, (/* @__PURE__ */ new Date()).toISOString());
60785
+ (0, import_node_fs26.writeFileSync)(p, (/* @__PURE__ */ new Date()).toISOString());
60716
60786
  wrote = true;
60717
60787
  } catch {
60718
60788
  }
@@ -60724,9 +60794,9 @@ function consumePostUpdateMarker() {
60724
60794
  for (const p of [markerPath(), legacyMarkerPath()]) {
60725
60795
  if (!p) continue;
60726
60796
  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 });
60797
+ if (!(0, import_node_fs26.existsSync)(p)) continue;
60798
+ const ageMs = Date.now() - (0, import_node_fs26.statSync)(p).mtimeMs;
60799
+ (0, import_node_fs26.rmSync)(p, { force: true });
60730
60800
  if (ageMs < FRESH_MS) fresh = true;
60731
60801
  } catch {
60732
60802
  }
@@ -60743,13 +60813,13 @@ function currentVersion() {
60743
60813
  return appVersion();
60744
60814
  }
60745
60815
  function installRoot() {
60746
- return (0, import_node_path23.dirname)((0, import_node_path23.dirname)(process.execPath));
60816
+ return (0, import_node_path24.dirname)((0, import_node_path24.dirname)(process.execPath));
60747
60817
  }
60748
60818
  function updateExePath() {
60749
- return (0, import_node_path23.join)(installRoot(), "Update.exe");
60819
+ return (0, import_node_path24.join)(installRoot(), "Update.exe");
60750
60820
  }
60751
60821
  function packagesDir() {
60752
- return (0, import_node_path23.join)(installRoot(), "packages");
60822
+ return (0, import_node_path24.join)(installRoot(), "packages");
60753
60823
  }
60754
60824
  function feedUrl() {
60755
60825
  const env2 = (process.env.FLOLESS_UPDATE_URL ?? "").trim().replace(/\/+$/, "");
@@ -60842,22 +60912,22 @@ async function checkForUpdate() {
60842
60912
  }
60843
60913
  async function sha1OfFile(path) {
60844
60914
  const hash = (0, import_node_crypto6.createHash)("sha1");
60845
- await (0, import_promises.pipeline)((0, import_node_fs26.createReadStream)(path), hash);
60915
+ await (0, import_promises.pipeline)((0, import_node_fs27.createReadStream)(path), hash);
60846
60916
  return hash.digest("hex").toUpperCase();
60847
60917
  }
60848
60918
  async function downloadPackage(asset) {
60849
60919
  if (!NUPKG_NAME.test(asset.FileName)) throw new Error(`refusing suspicious package name: ${asset.FileName}`);
60850
60920
  const want = asset.SHA1.toUpperCase();
60851
60921
  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;
60922
+ (0, import_node_fs27.mkdirSync)(dir, { recursive: true });
60923
+ const dest = (0, import_node_path24.join)(dir, asset.FileName);
60924
+ if ((0, import_node_fs27.existsSync)(dest) && await sha1OfFile(dest) === want) return dest;
60855
60925
  const res = await authedFetch(`${feedUrl()}/${encodeURIComponent(asset.FileName)}`, {
60856
60926
  redirect: "follow",
60857
60927
  signal: AbortSignal.timeout(DOWNLOAD_TIMEOUT_MS)
60858
60928
  });
60859
60929
  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));
60930
+ await (0, import_promises.pipeline)(import_node_stream3.Readable.fromWeb(res.body), (0, import_node_fs27.createWriteStream)(dest));
60861
60931
  const got = await sha1OfFile(dest);
60862
60932
  if (got !== want) throw new Error(`SHA1 mismatch for ${asset.FileName}: feed=${want} got=${got}`);
60863
60933
  return dest;
@@ -60866,13 +60936,13 @@ async function applyUpdate(check, opts) {
60866
60936
  if (!check.supported) return { applied: false, message: check.reason ?? "auto-update not supported in this runtime" };
60867
60937
  if (!check.updateAvailable || !check.asset) return { applied: false, message: check.reason ?? "no update available" };
60868
60938
  const exe = updateExePath();
60869
- if (!(0, import_node_fs26.existsSync)(exe)) {
60939
+ if (!(0, import_node_fs27.existsSync)(exe)) {
60870
60940
  return { applied: false, message: `Update.exe not found at ${exe} \u2014 is this a Velopack install?` };
60871
60941
  }
60872
60942
  const pkg = await downloadPackage(check.asset);
60873
60943
  if (opts?.onBeforeApply) await opts.onBeforeApply();
60874
60944
  await new Promise((resolve6, reject) => {
60875
- const child = (0, import_node_child_process5.spawn)(exe, ["apply", "--package", pkg, "--waitPid", String(process.pid)], {
60945
+ const child = (0, import_node_child_process6.spawn)(exe, ["apply", "--package", pkg, "--waitPid", String(process.pid)], {
60876
60946
  cwd: installRoot(),
60877
60947
  detached: true,
60878
60948
  stdio: "ignore",
@@ -61105,13 +61175,13 @@ function isTraceCorrupt(events) {
61105
61175
  }
61106
61176
 
61107
61177
  // launch.mjs
61108
- var import_node_child_process6 = require("node:child_process");
61109
- var import_node_path24 = require("node:path");
61178
+ var import_node_child_process7 = require("node:child_process");
61179
+ var import_node_path25 = require("node:path");
61110
61180
  var import_node_url3 = require("node:url");
61111
- var import_node_fs27 = require("node:fs");
61181
+ var import_node_fs28 = require("node:fs");
61112
61182
  var import_node_http = __toESM(require("node:http"), 1);
61113
61183
  var import_node_readline = require("node:readline");
61114
- var __dirname2 = (0, import_node_path24.dirname)((0, import_node_url3.fileURLToPath)(__import_meta_url));
61184
+ var __dirname2 = (0, import_node_path25.dirname)((0, import_node_url3.fileURLToPath)(__import_meta_url));
61115
61185
  var PORT = Number(process.env.PORT ?? 4317);
61116
61186
  var HEALTH_URL = `http://127.0.0.1:${PORT}/api/health`;
61117
61187
  var BROWSER_URL = `http://floless.localhost:${PORT}`;
@@ -61183,15 +61253,15 @@ async function waitHealthy(timeoutMs = 3e4) {
61183
61253
  function resolveServerStart() {
61184
61254
  const packaged = /flolessapp\.exe$/i.test(process.execPath);
61185
61255
  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 };
61256
+ const bundle = (0, import_node_path25.join)(__dirname2, "dist", "floless-server.cjs");
61257
+ if ((0, import_node_fs28.existsSync)(bundle)) return { cmd: process.execPath, args: [bundle, "--serve"], shell: false };
61188
61258
  return { cmd: "npm", args: ["run", "start"], shell: isWin2 };
61189
61259
  }
61190
61260
  function startServerDetached() {
61191
61261
  const { cmd, args, shell } = resolveServerStart();
61192
61262
  rotateLog();
61193
61263
  const fd2 = openLogFd();
61194
- const child = (0, import_node_child_process6.spawn)(cmd, args, {
61264
+ const child = (0, import_node_child_process7.spawn)(cmd, args, {
61195
61265
  cwd: __dirname2,
61196
61266
  detached: true,
61197
61267
  stdio: fd2 == null ? "ignore" : ["ignore", fd2, fd2],
@@ -61201,13 +61271,13 @@ function startServerDetached() {
61201
61271
  child.unref();
61202
61272
  }
61203
61273
  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();
61274
+ if (isWin2) (0, import_node_child_process7.spawn)("cmd", ["/c", "start", "", url], { windowsHide: true }).unref();
61275
+ else (0, import_node_child_process7.spawn)(process.platform === "darwin" ? "open" : "xdg-open", [url], { detached: true }).unref();
61206
61276
  }
61207
61277
  function stopServer() {
61208
61278
  if (!isWin2) {
61209
61279
  try {
61210
- (0, import_node_child_process6.execSync)(`bash -lc "fuser -k ${PORT}/tcp"`, { stdio: "ignore" });
61280
+ (0, import_node_child_process7.execSync)(`bash -lc "fuser -k ${PORT}/tcp"`, { stdio: "ignore" });
61211
61281
  return true;
61212
61282
  } catch {
61213
61283
  return false;
@@ -61215,7 +61285,7 @@ function stopServer() {
61215
61285
  }
61216
61286
  try {
61217
61287
  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" });
61288
+ (0, import_node_child_process7.execSync)(`powershell -NoProfile -Command "${ps}"`, { stdio: "ignore" });
61219
61289
  return true;
61220
61290
  } catch {
61221
61291
  return false;
@@ -61267,7 +61337,7 @@ async function cmdSupervise() {
61267
61337
  if (isSeaChannel && !process.env[SUPERVISE_RESPAWN_ENV]) {
61268
61338
  rotateLog();
61269
61339
  const fd2 = openLogFd();
61270
- const child = (0, import_node_child_process6.spawn)(process.execPath, ["--supervise"], {
61340
+ const child = (0, import_node_child_process7.spawn)(process.execPath, ["--supervise"], {
61271
61341
  detached: true,
61272
61342
  stdio: fd2 == null ? "ignore" : ["ignore", fd2, fd2],
61273
61343
  windowsHide: true,
@@ -61322,7 +61392,7 @@ function enumerateProcesses() {
61322
61392
  if (!isWin2) return [];
61323
61393
  try {
61324
61394
  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}"`, {
61395
+ const out = (0, import_node_child_process7.execSync)(`powershell -NoProfile -Command "${ps}"`, {
61326
61396
  encoding: "utf8",
61327
61397
  windowsHide: true,
61328
61398
  maxBuffer: 16 * 1024 * 1024
@@ -61337,15 +61407,15 @@ function taskkillArgs(pid, { tree = true } = {}) {
61337
61407
  }
61338
61408
  function killSupervisor({ tree = true } = {}) {
61339
61409
  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;
61410
+ const isNpmChannel = /^node(\.exe)?$/i.test((0, import_node_path25.basename)(process.execPath));
61411
+ const scriptMatch = isNpmChannel ? (0, import_node_path25.basename)((0, import_node_url3.fileURLToPath)(__import_meta_url)) : void 0;
61342
61412
  const realExe = resolveRealInstallExe(process.execPath);
61343
61413
  const exeMatch = realExe === process.execPath ? process.execPath : [process.execPath, realExe];
61344
61414
  const pids = supervisorPidsToKill(enumerateProcesses(), process.pid, exeMatch, scriptMatch);
61345
61415
  for (const pid of pids) {
61346
61416
  log(`stopping supervisor (pid ${pid})\u2026`);
61347
61417
  try {
61348
- (0, import_node_child_process6.execFileSync)("taskkill", taskkillArgs(pid, { tree }), { stdio: "ignore", windowsHide: true });
61418
+ (0, import_node_child_process7.execFileSync)("taskkill", taskkillArgs(pid, { tree }), { stdio: "ignore", windowsHide: true });
61349
61419
  } catch {
61350
61420
  }
61351
61421
  }
@@ -61436,11 +61506,11 @@ async function cmdUpdate() {
61436
61506
  function removeRegistryFootprint() {
61437
61507
  if (!isWin2) return;
61438
61508
  try {
61439
- (0, import_node_child_process6.execFileSync)("reg", ["delete", RUN_KEY, "/v", RUN_VALUE, "/f"], { stdio: "ignore", windowsHide: true });
61509
+ (0, import_node_child_process7.execFileSync)("reg", ["delete", RUN_KEY, "/v", RUN_VALUE, "/f"], { stdio: "ignore", windowsHide: true });
61440
61510
  } catch {
61441
61511
  }
61442
61512
  try {
61443
- (0, import_node_child_process6.execFileSync)("reg", ["delete", PROTOCOL_KEY, "/f"], { stdio: "ignore", windowsHide: true });
61513
+ (0, import_node_child_process7.execFileSync)("reg", ["delete", PROTOCOL_KEY, "/f"], { stdio: "ignore", windowsHide: true });
61444
61514
  } catch {
61445
61515
  }
61446
61516
  }
@@ -61466,13 +61536,13 @@ async function cmdUninstall(flags = {}) {
61466
61536
  if (removeAware) {
61467
61537
  log("removing the AWARE runtime \u2014 this will affect ANY other tool that uses @aware-aeco/cli.");
61468
61538
  try {
61469
- (0, import_node_child_process6.execSync)("npm uninstall -g @aware-aeco/cli", { stdio: "inherit", shell: isWin2 });
61539
+ (0, import_node_child_process7.execSync)("npm uninstall -g @aware-aeco/cli", { stdio: "inherit", shell: isWin2 });
61470
61540
  } catch {
61471
61541
  log('warning: "npm uninstall -g @aware-aeco/cli" failed \u2014 see the output above.');
61472
61542
  }
61473
61543
  let lsJson = "";
61474
61544
  try {
61475
- lsJson = (0, import_node_child_process6.execSync)("npm ls -g @aware-aeco/cli --depth=0 --json", {
61545
+ lsJson = (0, import_node_child_process7.execSync)("npm ls -g @aware-aeco/cli --depth=0 --json", {
61476
61546
  encoding: "utf8",
61477
61547
  stdio: ["ignore", "pipe", "ignore"],
61478
61548
  shell: isWin2
@@ -61503,7 +61573,7 @@ async function runAction(arg, flagArgv = [], selfVersion = null) {
61503
61573
  }
61504
61574
  await action(parseTeardownFlags(flagArgv));
61505
61575
  }
61506
- var entry = (0, import_node_path24.basename)(process.argv[1] ?? "").toLowerCase();
61576
+ var entry = (0, import_node_path25.basename)(process.argv[1] ?? "").toLowerCase();
61507
61577
  if (entry === "launch.mjs") {
61508
61578
  runAction(process.argv[2], process.argv.slice(3)).catch((e) => {
61509
61579
  log(`error: ${e?.message ?? e}`);
@@ -61577,9 +61647,9 @@ function awareUpgradeBlockReason(s) {
61577
61647
  }
61578
61648
 
61579
61649
  // skill-sync.ts
61580
- var import_node_fs28 = require("node:fs");
61650
+ var import_node_fs29 = require("node:fs");
61581
61651
  var import_node_os18 = require("node:os");
61582
- var import_node_path25 = require("node:path");
61652
+ var import_node_path26 = require("node:path");
61583
61653
  var import_node_url4 = require("node:url");
61584
61654
  var import_yaml8 = __toESM(require_dist6(), 1);
61585
61655
 
@@ -61622,14 +61692,14 @@ function selectShippedSkillNames(names) {
61622
61692
  }
61623
61693
 
61624
61694
  // skill-sync.ts
61625
- var __dirname3 = (0, import_node_path25.dirname)((0, import_node_url4.fileURLToPath)(__import_meta_url));
61695
+ var __dirname3 = (0, import_node_path26.dirname)((0, import_node_url4.fileURLToPath)(__import_meta_url));
61626
61696
  function bundledSkillsRoot() {
61627
61697
  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")
61698
+ (0, import_node_path26.join)(__dirname3, "skills"),
61699
+ (0, import_node_path26.join)((0, import_node_path26.dirname)(process.execPath), "skills"),
61700
+ (0, import_node_path26.join)(__dirname3, "..", ".claude", "skills")
61631
61701
  ];
61632
- return candidates.find((p) => (0, import_node_fs28.existsSync)(p)) ?? null;
61702
+ return candidates.find((p) => (0, import_node_fs29.existsSync)(p)) ?? null;
61633
61703
  }
61634
61704
  function targetConfigDirs() {
61635
61705
  const override = process.env.FLOLESS_SKILL_TARGETS;
@@ -61638,14 +61708,14 @@ function targetConfigDirs() {
61638
61708
  }
61639
61709
  const home = (0, import_node_os18.homedir)();
61640
61710
  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") }
61711
+ { runtime: "claude", dir: (0, import_node_path26.join)(home, ".claude") },
61712
+ { runtime: "codex", dir: (0, import_node_path26.join)(home, ".codex") },
61713
+ { runtime: "opencode", dir: (0, import_node_path26.join)(home, ".opencode") }
61644
61714
  ];
61645
61715
  }
61646
61716
  function skillVersion(skillMdPath) {
61647
61717
  try {
61648
- const text = (0, import_node_fs28.readFileSync)(skillMdPath, "utf8");
61718
+ const text = (0, import_node_fs29.readFileSync)(skillMdPath, "utf8");
61649
61719
  const m = /^---\r?\n([\s\S]*?)\r?\n---/.exec(text);
61650
61720
  if (!m || m[1] === void 0) return null;
61651
61721
  const fm = (0, import_yaml8.parse)(m[1]);
@@ -61685,21 +61755,21 @@ function decideAction(installed, bundled) {
61685
61755
  function bundledSkills(root) {
61686
61756
  let entries = [];
61687
61757
  try {
61688
- entries = selectShippedSkillNames((0, import_node_fs28.readdirSync)(root));
61758
+ entries = selectShippedSkillNames((0, import_node_fs29.readdirSync)(root));
61689
61759
  } catch {
61690
61760
  return [];
61691
61761
  }
61692
61762
  const out = [];
61693
61763
  for (const name of entries) {
61694
- const dir = (0, import_node_path25.join)(root, name);
61764
+ const dir = (0, import_node_path26.join)(root, name);
61695
61765
  let isDir = false;
61696
61766
  try {
61697
- isDir = (0, import_node_fs28.statSync)(dir).isDirectory();
61767
+ isDir = (0, import_node_fs29.statSync)(dir).isDirectory();
61698
61768
  } catch {
61699
61769
  isDir = false;
61700
61770
  }
61701
61771
  if (!isDir) continue;
61702
- const v = skillVersion((0, import_node_path25.join)(dir, "SKILL.md"));
61772
+ const v = skillVersion((0, import_node_path26.join)(dir, "SKILL.md"));
61703
61773
  if (!v) continue;
61704
61774
  out.push({ name, dir, version: v });
61705
61775
  }
@@ -61712,17 +61782,17 @@ function syncSkills() {
61712
61782
  const skills = bundledSkills(root);
61713
61783
  if (!skills.length) return results;
61714
61784
  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");
61785
+ if (!(0, import_node_fs29.existsSync)(cfg)) continue;
61786
+ const skillsDir = (0, import_node_path26.join)(cfg, "skills");
61717
61787
  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;
61788
+ const dest = (0, import_node_path26.join)(skillsDir, s.name);
61789
+ const installedMd = (0, import_node_path26.join)(dest, "SKILL.md");
61790
+ const installed = (0, import_node_fs29.existsSync)(installedMd) ? skillVersion(installedMd) : null;
61721
61791
  const action = decideAction(installed, s.version);
61722
61792
  if (action === "installed" || action === "updated") {
61723
61793
  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 });
61794
+ if (action === "updated") (0, import_node_fs29.rmSync)(dest, { recursive: true, force: true });
61795
+ (0, import_node_fs29.cpSync)(s.dir, dest, { recursive: true });
61726
61796
  results.push({ runtime, skill: s.name, action, from: installed, to: s.version });
61727
61797
  } catch {
61728
61798
  }
@@ -61736,8 +61806,8 @@ function syncSkills() {
61736
61806
 
61737
61807
  // watch.ts
61738
61808
  var import_node_os19 = require("node:os");
61739
- var import_node_path27 = require("node:path");
61740
- var import_node_fs29 = require("node:fs");
61809
+ var import_node_path28 = require("node:path");
61810
+ var import_node_fs30 = require("node:fs");
61741
61811
 
61742
61812
  // node_modules/chokidar/esm/index.js
61743
61813
  var import_fs2 = require("fs");
@@ -61748,7 +61818,7 @@ var sysPath2 = __toESM(require("path"), 1);
61748
61818
  // node_modules/readdirp/esm/index.js
61749
61819
  var import_promises2 = require("node:fs/promises");
61750
61820
  var import_node_stream4 = require("node:stream");
61751
- var import_node_path26 = require("node:path");
61821
+ var import_node_path27 = require("node:path");
61752
61822
  var EntryTypes = {
61753
61823
  FILE_TYPE: "files",
61754
61824
  DIR_TYPE: "directories",
@@ -61823,7 +61893,7 @@ var ReaddirpStream = class extends import_node_stream4.Readable {
61823
61893
  this._wantsDir = type ? DIR_TYPES.has(type) : false;
61824
61894
  this._wantsFile = type ? FILE_TYPES.has(type) : false;
61825
61895
  this._wantsEverything = type === EntryTypes.EVERYTHING_TYPE;
61826
- this._root = (0, import_node_path26.resolve)(root);
61896
+ this._root = (0, import_node_path27.resolve)(root);
61827
61897
  this._isDirent = !opts.alwaysStat;
61828
61898
  this._statsProp = this._isDirent ? "dirent" : "stats";
61829
61899
  this._rdOptions = { encoding: "utf8", withFileTypes: this._isDirent };
@@ -61894,8 +61964,8 @@ var ReaddirpStream = class extends import_node_stream4.Readable {
61894
61964
  let entry2;
61895
61965
  const basename5 = this._isDirent ? dirent.name : dirent;
61896
61966
  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 };
61967
+ const fullPath = (0, import_node_path27.resolve)((0, import_node_path27.join)(path, basename5));
61968
+ entry2 = { path: (0, import_node_path27.relative)(this._root, fullPath), fullPath, basename: basename5 };
61899
61969
  entry2[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
61900
61970
  } catch (err2) {
61901
61971
  this._onError(err2);
@@ -61929,7 +61999,7 @@ var ReaddirpStream = class extends import_node_stream4.Readable {
61929
61999
  }
61930
62000
  if (entryRealPathStats.isDirectory()) {
61931
62001
  const len2 = entryRealPath.length;
61932
- if (full.startsWith(entryRealPath) && full.substr(len2, 1) === import_node_path26.sep) {
62002
+ if (full.startsWith(entryRealPath) && full.substr(len2, 1) === import_node_path27.sep) {
61933
62003
  const recursiveError = new Error(`Circular symlink detected: "${full}" points to "${entryRealPath}"`);
61934
62004
  recursiveError.code = RECURSIVE_ERROR_CODE;
61935
62005
  return this._onError(recursiveError);
@@ -62468,9 +62538,9 @@ var NodeFsHandler = class {
62468
62538
  if (this.fsw.closed) {
62469
62539
  return;
62470
62540
  }
62471
- const dirname13 = sysPath.dirname(file);
62541
+ const dirname14 = sysPath.dirname(file);
62472
62542
  const basename5 = sysPath.basename(file);
62473
- const parent = this.fsw._getWatchedDir(dirname13);
62543
+ const parent = this.fsw._getWatchedDir(dirname14);
62474
62544
  let prevStats = stats;
62475
62545
  if (parent.has(basename5))
62476
62546
  return;
@@ -62497,7 +62567,7 @@ var NodeFsHandler = class {
62497
62567
  prevStats = newStats2;
62498
62568
  }
62499
62569
  } catch (error) {
62500
- this.fsw._remove(dirname13, basename5);
62570
+ this.fsw._remove(dirname14, basename5);
62501
62571
  }
62502
62572
  } else if (parent.has(basename5)) {
62503
62573
  const at = newStats.atimeMs;
@@ -63437,33 +63507,33 @@ function appIdFromLogPath(path) {
63437
63507
  return i >= 0 && parts[i + 1] ? parts[i + 1] : null;
63438
63508
  }
63439
63509
  function samePath(a, b) {
63440
- const ra = (0, import_node_path27.resolve)(a);
63441
- const rb = (0, import_node_path27.resolve)(b);
63510
+ const ra = (0, import_node_path28.resolve)(a);
63511
+ const rb = (0, import_node_path28.resolve)(b);
63442
63512
  return process.platform === "win32" ? ra.toLowerCase() === rb.toLowerCase() : ra === rb;
63443
63513
  }
63444
63514
  function underDir(path, dir) {
63445
- const rp = (0, import_node_path27.resolve)(path);
63446
- const rd = (0, import_node_path27.resolve)(dir);
63515
+ const rp = (0, import_node_path28.resolve)(path);
63516
+ const rd = (0, import_node_path28.resolve)(dir);
63447
63517
  const [p, d] = process.platform === "win32" ? [rp.toLowerCase(), rd.toLowerCase()] : [rp, rd];
63448
- return p === d || p.startsWith(d + import_node_path27.sep);
63518
+ return p === d || p.startsWith(d + import_node_path28.sep);
63449
63519
  }
63450
63520
  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)) {
63521
+ const awareDir = process.env.AWARE_HOME ?? (0, import_node_path28.join)((0, import_node_os19.homedir)(), ".aware");
63522
+ const credentialsDir = (0, import_node_path28.join)(awareDir, "credentials");
63523
+ if (!(0, import_node_fs30.existsSync)(credentialsDir)) {
63454
63524
  try {
63455
- (0, import_node_fs29.mkdirSync)(credentialsDir, { recursive: true });
63525
+ (0, import_node_fs30.mkdirSync)(credentialsDir, { recursive: true });
63456
63526
  } catch {
63457
63527
  }
63458
63528
  }
63459
- if (!(0, import_node_fs29.existsSync)(uiDir)) {
63529
+ if (!(0, import_node_fs30.existsSync)(uiDir)) {
63460
63530
  try {
63461
- (0, import_node_fs29.mkdirSync)(uiDir, { recursive: true });
63531
+ (0, import_node_fs30.mkdirSync)(uiDir, { recursive: true });
63462
63532
  } catch {
63463
63533
  }
63464
63534
  }
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);
63535
+ const targets = ["apps", "logs", "credentials"].map((d) => (0, import_node_path28.join)(awareDir, d)).filter((p) => (0, import_node_fs30.existsSync)(p));
63536
+ if ((0, import_node_fs30.existsSync)(uiDir)) targets.push(uiDir);
63467
63537
  if (targets.length === 0) {
63468
63538
  return null;
63469
63539
  }
@@ -63492,11 +63562,11 @@ function startWatcher() {
63492
63562
  const isCredential = path.split(/[\\/]/).includes("credentials");
63493
63563
  const kind = isCredential ? "credential" : path.endsWith(".jsonl") ? "trace" : path.endsWith(".lock") ? "lock" : path.endsWith(".flo") || path.endsWith(".app") ? "source" : "file";
63494
63564
  broadcast({ type: "fs-change", kind, event, path });
63495
- if (kind === "trace" && event !== "unlink" && (0, import_node_fs29.existsSync)(path)) {
63565
+ if (kind === "trace" && event !== "unlink" && (0, import_node_fs30.existsSync)(path)) {
63496
63566
  const id = appIdFromLogPath(path);
63497
63567
  if (!id) return;
63498
63568
  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")) });
63569
+ 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
63570
  } catch {
63501
63571
  }
63502
63572
  }
@@ -63505,10 +63575,10 @@ function startWatcher() {
63505
63575
  }
63506
63576
 
63507
63577
  // 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");
63578
+ var __dirname4 = (0, import_node_path29.dirname)((0, import_node_url5.fileURLToPath)(__import_meta_url));
63579
+ 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(
63580
+ (p) => (0, import_node_fs31.existsSync)(p)
63581
+ ) ?? (0, import_node_path29.join)(__dirname4, "..", "web");
63512
63582
  var PORT2 = Number(process.env.PORT ?? 4317);
63513
63583
  var HOST = "127.0.0.1";
63514
63584
  var crashHandlersInstalled = false;
@@ -63524,7 +63594,7 @@ function installCrashHandlers() {
63524
63594
  ${stack}
63525
63595
  `;
63526
63596
  try {
63527
- (0, import_node_fs30.appendFileSync)(logFilePath(), line);
63597
+ (0, import_node_fs31.appendFileSync)(logFilePath(), line);
63528
63598
  } catch {
63529
63599
  }
63530
63600
  if (process.stderr.isTTY) process.stderr.write(line);
@@ -63559,7 +63629,7 @@ async function startServer() {
63559
63629
  const isWin3 = process.platform === "win32";
63560
63630
  const has = (cmd) => {
63561
63631
  try {
63562
- (0, import_node_child_process7.execFileSync)(isWin3 ? "where" : "which", [cmd], { stdio: "ignore", windowsHide: true, timeout: 5e3 });
63632
+ (0, import_node_child_process8.execFileSync)(isWin3 ? "where" : "which", [cmd], { stdio: "ignore", windowsHide: true, timeout: 5e3 });
63563
63633
  return true;
63564
63634
  } catch {
63565
63635
  return false;
@@ -63568,7 +63638,7 @@ async function startServer() {
63568
63638
  function installAwareGlobal(spec, onLine = () => {
63569
63639
  }) {
63570
63640
  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 });
63641
+ const child = (0, import_node_child_process8.spawn)("npm", ["i", "-g", `@aware-aeco/cli@${spec}`], { shell: isWin3, windowsHide: true });
63572
63642
  let stderrTail = "";
63573
63643
  let combinedTail = "";
63574
63644
  const tail = (buf, s) => (buf + s).slice(-4e3);
@@ -63818,9 +63888,9 @@ async function startServer() {
63818
63888
  const { id, templateId, templatePath, srcPath, appDirPath: appDirPath2, fromVersion, contract, verb } = opts;
63819
63889
  const bdir = backupDir(id, fromVersion, Date.now());
63820
63890
  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);
63891
+ (0, import_node_fs31.mkdirSync)((0, import_node_path29.dirname)(bdir), { recursive: true });
63892
+ (0, import_node_fs31.cpSync)(appDirPath2, bdir, { recursive: true });
63893
+ (0, import_node_fs31.cpSync)(templatePath, srcPath);
63824
63894
  if (id !== templateId) stampSourceAppId(srcPath, id);
63825
63895
  if (contract != null) {
63826
63896
  bakeContractIntoApp(srcPath, contract);
@@ -63831,8 +63901,8 @@ async function startServer() {
63831
63901
  } catch (e) {
63832
63902
  const msg = e instanceof Error ? e.message : String(e);
63833
63903
  try {
63834
- (0, import_node_fs30.rmSync)(appDirPath2, { recursive: true, force: true });
63835
- (0, import_node_fs30.cpSync)(bdir, appDirPath2, { recursive: true });
63904
+ (0, import_node_fs31.rmSync)(appDirPath2, { recursive: true, force: true });
63905
+ (0, import_node_fs31.cpSync)(bdir, appDirPath2, { recursive: true });
63836
63906
  } catch (re) {
63837
63907
  const rmsg = re instanceof Error ? re.message : String(re);
63838
63908
  throw new TemplateSwapError(`${verb} failed (${msg}) AND rollback failed (${rmsg}) \u2014 restore manually from ${bdir}`, "rollback-failed", bdir);
@@ -63863,7 +63933,7 @@ async function startServer() {
63863
63933
  return reply.status(409).send({ ok: false, error: `"${id}" is already at ${fromVersion}`, code: "up-to-date" });
63864
63934
  }
63865
63935
  const contract = readContract(id);
63866
- if (contract == null && (0, import_node_fs30.existsSync)(contractPath(id))) {
63936
+ if (contract == null && (0, import_node_fs31.existsSync)(contractPath(id))) {
63867
63937
  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
63938
  }
63869
63939
  if (contract != null) {
@@ -64177,7 +64247,7 @@ async function startServer() {
64177
64247
  }
64178
64248
  const companionId = `${req.params.appId}-ifc`;
64179
64249
  const filename = `${req.params.appId}.ifc`;
64180
- const outPath = (0, import_node_path28.join)(appPath(companionId), filename);
64250
+ const outPath = (0, import_node_path29.join)(appPath(companionId), filename);
64181
64251
  let flo;
64182
64252
  try {
64183
64253
  flo = writeIfcApp(appPath(companionId), companionId, scene, outPath, writeOpts);
@@ -64200,8 +64270,8 @@ async function startServer() {
64200
64270
  }
64201
64271
  throw e;
64202
64272
  }
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");
64273
+ if (!(0, import_node_fs31.existsSync)(outPath)) return reply.send({ ok: false, error: "the IFC export produced no file" });
64274
+ const content = (0, import_node_fs31.readFileSync)(outPath, "utf8");
64205
64275
  broadcast({ type: "apps-changed" });
64206
64276
  return { ok: true, filename, content, bytes: Buffer.byteLength(content), skipped, ...extrusionsSkipped ? { extrusionsSkipped } : {} };
64207
64277
  });
@@ -64280,17 +64350,17 @@ async function startServer() {
64280
64350
  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
64351
  }
64282
64352
  const outPath = bomExportPath(appId, format);
64283
- const dir = (0, import_node_path28.dirname)(outPath);
64353
+ const dir = (0, import_node_path29.dirname)(outPath);
64284
64354
  const filename = `${appId}-bom.${format}`;
64285
64355
  try {
64286
- (0, import_node_fs30.mkdirSync)(dir, { recursive: true });
64356
+ (0, import_node_fs31.mkdirSync)(dir, { recursive: true });
64287
64357
  if (format === "csv") {
64288
64358
  const text = bomToCsv(bom);
64289
- (0, import_node_fs30.writeFileSync)(outPath, text, "utf8");
64359
+ (0, import_node_fs31.writeFileSync)(outPath, text, "utf8");
64290
64360
  return { ok: true, filename, encoding: "utf8", content: text, bytes: Buffer.byteLength(text), savedTo: outPath };
64291
64361
  }
64292
64362
  const buf = await bomToXlsx(bom);
64293
- (0, import_node_fs30.writeFileSync)(outPath, buf);
64363
+ (0, import_node_fs31.writeFileSync)(outPath, buf);
64294
64364
  return { ok: true, filename, encoding: "base64", content: buf.toString("base64"), bytes: buf.length, savedTo: outPath };
64295
64365
  } catch (e) {
64296
64366
  app.log.error({ appId, format, err: e instanceof Error ? e.message : e }, "export-bom: generation failed");
@@ -64360,7 +64430,7 @@ async function startServer() {
64360
64430
  return reply.status(404).send({ ok: false, error: `"${id}" is not installed`, code: "not-installed" });
64361
64431
  }
64362
64432
  const contract = readContract(id);
64363
- if (contract == null && (0, import_node_fs30.existsSync)(contractPath(id))) {
64433
+ if (contract == null && (0, import_node_fs31.existsSync)(contractPath(id))) {
64364
64434
  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
64435
  }
64366
64436
  if (contract != null) {
@@ -64438,11 +64508,11 @@ async function startServer() {
64438
64508
  if (appExists(id)) {
64439
64509
  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
64510
  }
64441
- const stageRoot = (0, import_node_fs30.mkdtempSync)((0, import_node_path28.join)((0, import_node_os20.tmpdir)(), "floless-import-"));
64511
+ const stageRoot = (0, import_node_fs31.mkdtempSync)((0, import_node_path29.join)((0, import_node_os20.tmpdir)(), "floless-import-"));
64442
64512
  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);
64513
+ const stageDir = (0, import_node_path29.join)(stageRoot, id);
64514
+ (0, import_node_fs31.mkdirSync)(stageDir);
64515
+ (0, import_node_fs31.writeFileSync)((0, import_node_path29.join)(stageDir, `${id}.flo`), content);
64446
64516
  await aware.install(stageDir);
64447
64517
  } catch (err2) {
64448
64518
  try {
@@ -64452,7 +64522,7 @@ async function startServer() {
64452
64522
  const msg = err2 instanceof AwareError ? err2.message : String(err2?.message ?? err2);
64453
64523
  return reply.status(502).send({ ok: false, error: `import failed: ${msg}` });
64454
64524
  } finally {
64455
- (0, import_node_fs30.rmSync)(stageRoot, { recursive: true, force: true });
64525
+ (0, import_node_fs31.rmSync)(stageRoot, { recursive: true, force: true });
64456
64526
  }
64457
64527
  broadcast({ type: "apps-changed", id });
64458
64528
  return { ok: true, id };
@@ -64466,13 +64536,13 @@ async function startServer() {
64466
64536
  }
64467
64537
  const inputs = appData.inputs.map((i) => ({ name: i.name, type: i.type }));
64468
64538
  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 });
64539
+ const tmpRoot = (0, import_node_fs31.mkdtempSync)((0, import_node_path29.join)((0, import_node_os20.tmpdir)(), "floless-bake-"));
64540
+ const backupDir2 = (0, import_node_path29.join)(tmpRoot, `${id}-backup`);
64541
+ const bakeDir = (0, import_node_path29.join)(tmpRoot, id);
64542
+ (0, import_node_fs31.cpSync)(appDir(id), backupDir2, { recursive: true });
64543
+ (0, import_node_fs31.cpSync)(appDir(id), bakeDir, { recursive: true });
64474
64544
  const floName = appData.source.path.split(/[\\/]/).pop();
64475
- (0, import_node_fs30.writeFileSync)((0, import_node_path28.join)(bakeDir, floName), baked);
64545
+ (0, import_node_fs31.writeFileSync)((0, import_node_path29.join)(bakeDir, floName), baked);
64476
64546
  let appInstalled2 = true;
64477
64547
  try {
64478
64548
  await aware.uninstall(id);
@@ -64494,17 +64564,17 @@ async function startServer() {
64494
64564
  throw installErr;
64495
64565
  }
64496
64566
  try {
64497
- await aware.compile((0, import_node_path28.join)(appDir(id), floName));
64567
+ await aware.compile((0, import_node_path29.join)(appDir(id), floName));
64498
64568
  } catch (compileErr) {
64499
64569
  app.log.warn({ id, compileErr: String(compileErr) }, "bake: post-install recompile failed (app baked but may need a manual Compile)");
64500
64570
  }
64501
64571
  broadcast({ type: "baked", id });
64502
64572
  return { ok: true, id, agent: id, inputs };
64503
64573
  } finally {
64504
- if (appInstalled2) (0, import_node_fs30.rmSync)(tmpRoot, { recursive: true, force: true });
64574
+ if (appInstalled2) (0, import_node_fs31.rmSync)(tmpRoot, { recursive: true, force: true });
64505
64575
  }
64506
64576
  });
64507
- const graftAgentsDir = () => (0, import_node_path28.join)((0, import_node_os20.homedir)(), ".aware", "agents");
64577
+ const graftAgentsDir = () => (0, import_node_path29.join)((0, import_node_os20.homedir)(), ".aware", "agents");
64508
64578
  app.post("/api/graft/match", async (req, reply) => {
64509
64579
  const { glob } = req.body ?? {};
64510
64580
  if (!glob) return reply.status(400).send({ ok: false, error: "glob required" });
@@ -64521,7 +64591,7 @@ async function startServer() {
64521
64591
  if (!sourceKind || !sourceRef) {
64522
64592
  return reply.status(400).send({ ok: false, error: "sourceKind and sourceRef required" });
64523
64593
  }
64524
- const tempHome = (0, import_node_fs30.mkdtempSync)((0, import_node_path28.join)((0, import_node_os20.tmpdir)(), "floless-graft-"));
64594
+ const tempHome = (0, import_node_fs31.mkdtempSync)((0, import_node_path29.join)((0, import_node_os20.tmpdir)(), "floless-graft-"));
64525
64595
  let result;
64526
64596
  try {
64527
64597
  result = await aware.build({
@@ -64534,19 +64604,19 @@ async function startServer() {
64534
64604
  awareHome: tempHome
64535
64605
  });
64536
64606
  } catch (err2) {
64537
- (0, import_node_fs30.rmSync)(tempHome, { recursive: true, force: true });
64607
+ (0, import_node_fs31.rmSync)(tempHome, { recursive: true, force: true });
64538
64608
  const msg = err2 instanceof AwareError ? err2.message : String(err2?.message ?? err2);
64539
64609
  return reply.status(422).send({ ok: false, error: msg });
64540
64610
  }
64541
64611
  const manifest = readStagedManifest(result.agentDir);
64542
64612
  if (!manifest) {
64543
- (0, import_node_fs30.rmSync)(tempHome, { recursive: true, force: true });
64613
+ (0, import_node_fs31.rmSync)(tempHome, { recursive: true, force: true });
64544
64614
  return reply.status(502).send({ ok: false, error: `build produced output at ${result.agentDir} but no manifest.yaml` });
64545
64615
  }
64546
64616
  const token = (0, import_node_crypto7.randomUUID)();
64547
64617
  registerStage(token, tempHome, result.agentId);
64548
64618
  const preview = buildPreview(manifest, sourceKind, sourceRef, token);
64549
- if ((0, import_node_fs30.existsSync)((0, import_node_path28.join)(graftAgentsDir(), result.agentId))) {
64619
+ if ((0, import_node_fs31.existsSync)((0, import_node_path29.join)(graftAgentsDir(), result.agentId))) {
64550
64620
  preview.warnings.unshift(`An agent named "${result.agentId}" is already installed \u2014 creating it will overwrite it.`);
64551
64621
  }
64552
64622
  return { ok: true, preview };
@@ -64565,7 +64635,7 @@ async function startServer() {
64565
64635
  registerStage(stagedRef, stage.tempDir, stage.agentId);
64566
64636
  return reply.status(409).send({ ok: false, error: err2.message, agentId: stage.agentId, collision: true });
64567
64637
  }
64568
- (0, import_node_fs30.rmSync)(stage.tempDir, { recursive: true, force: true });
64638
+ (0, import_node_fs31.rmSync)(stage.tempDir, { recursive: true, force: true });
64569
64639
  throw err2;
64570
64640
  }
64571
64641
  broadcast({ type: "grafted", id: stage.agentId });
@@ -64663,13 +64733,24 @@ async function startServer() {
64663
64733
  report = { ...interactive ? extracted : withBadge(extracted), interactive };
64664
64734
  }
64665
64735
  const credentialIssue = !simulate && hasAuthFailure(events) ? await detectCredentialIssue(id) : null;
64666
- return { ok: true, runId: result.runId, tracePath: result.tracePath, events, report, credentialIssue };
64736
+ const savedPath = extractSavedPath(events);
64737
+ return { ok: true, runId: result.runId, tracePath: result.tracePath, events, report, savedPath, credentialIssue };
64667
64738
  }
64668
64739
  );
64669
64740
  app.post("/api/run/stop", async () => {
64670
64741
  const running = cancelActiveRun();
64671
64742
  return { ok: true, running };
64672
64743
  });
64744
+ function fileVerb(launch) {
64745
+ return async (req, reply) => {
64746
+ const check = validateOpenable(req.body?.path);
64747
+ if (!check.ok) return reply.status(400).send({ ok: false, error: check.error });
64748
+ launch(check.path);
64749
+ return { ok: true };
64750
+ };
64751
+ }
64752
+ app.post("/api/open-file", fileVerb(launchFile));
64753
+ app.post("/api/reveal", fileVerb(revealFile));
64673
64754
  app.post(
64674
64755
  "/api/trigger-run",
64675
64756
  async (req, reply) => {
@@ -64825,11 +64906,11 @@ async function startServer() {
64825
64906
  app.get("/api/requests/:id/snapshot/:n", async (req, reply) => {
64826
64907
  const n = Number.parseInt(req.params.n, 10);
64827
64908
  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" });
64909
+ if (!p || !(0, import_node_fs31.existsSync)(p)) return reply.status(404).send({ ok: false, error: "snapshot not found" });
64829
64910
  const ext = p.split(".").pop().toLowerCase();
64830
64911
  reply.header("Content-Type", ext === "png" ? "image/png" : ext === "webp" ? "image/webp" : ext === "pdf" ? "application/pdf" : "image/jpeg");
64831
64912
  reply.header("Cache-Control", "no-store");
64832
- return (0, import_node_fs30.readFileSync)(p);
64913
+ return (0, import_node_fs31.readFileSync)(p);
64833
64914
  });
64834
64915
  app.post(
64835
64916
  "/api/tweak",
@@ -64985,7 +65066,9 @@ async function startServer() {
64985
65066
  runId: latest.runId,
64986
65067
  status: summarizeRun(events).status,
64987
65068
  rows: extractRunRows(events),
64988
- html: withBadge(extractReportHtml(events))?.html ?? null
65069
+ html: withBadge(extractReportHtml(events))?.html ?? null,
65070
+ saved_path: extractSavedPath(events)
65071
+ // so a cached panel report also restores Open file / Reveal (#209)
64989
65072
  };
64990
65073
  }
64991
65074
  if (kind === "last-run-status") {
@@ -64996,7 +65079,7 @@ async function startServer() {
64996
65079
  warn(`last-run-status:${ref} \u2014 trace exists but couldn't be parsed (corrupt/truncated)`);
64997
65080
  let finishedAt2 = null;
64998
65081
  try {
64999
- finishedAt2 = (0, import_node_fs30.statSync)(latest.path).mtime.toISOString();
65082
+ finishedAt2 = (0, import_node_fs31.statSync)(latest.path).mtime.toISOString();
65000
65083
  } catch {
65001
65084
  finishedAt2 = null;
65002
65085
  }
@@ -65006,7 +65089,7 @@ async function startServer() {
65006
65089
  let finishedAt = typeof runEnd?.ts === "string" ? runEnd.ts : null;
65007
65090
  if (!finishedAt) {
65008
65091
  try {
65009
- finishedAt = (0, import_node_fs30.statSync)(latest.path).mtime.toISOString();
65092
+ finishedAt = (0, import_node_fs31.statSync)(latest.path).mtime.toISOString();
65010
65093
  } catch {
65011
65094
  finishedAt = null;
65012
65095
  }
@@ -65142,10 +65225,10 @@ async function startServer() {
65142
65225
  }
65143
65226
 
65144
65227
  // protocol.ts
65145
- var import_node_child_process8 = require("node:child_process");
65228
+ var import_node_child_process9 = require("node:child_process");
65146
65229
  var BASE = PROTOCOL_KEY;
65147
65230
  function reg(args) {
65148
- (0, import_node_child_process8.execFileSync)("reg", args, { stdio: "ignore", windowsHide: true });
65231
+ (0, import_node_child_process9.execFileSync)("reg", args, { stdio: "ignore", windowsHide: true });
65149
65232
  }
65150
65233
  function registerProtocol(exePath) {
65151
65234
  if (process.platform !== "win32") return;
@@ -65185,13 +65268,13 @@ async function removeAwarePerDecision(removeAwareFlag, prompt) {
65185
65268
  );
65186
65269
  const shell = process.platform === "win32" ? process.env.ComSpec || "cmd.exe" : "/bin/sh";
65187
65270
  try {
65188
- (0, import_node_child_process9.execSync)("npm uninstall -g @aware-aeco/cli", { stdio: "inherit", shell });
65271
+ (0, import_node_child_process10.execSync)("npm uninstall -g @aware-aeco/cli", { stdio: "inherit", shell });
65189
65272
  } catch {
65190
65273
  process.stdout.write('floless: warning: "npm uninstall -g @aware-aeco/cli" failed \u2014 see the output above.\n');
65191
65274
  }
65192
65275
  let lsJson = "";
65193
65276
  try {
65194
- lsJson = (0, import_node_child_process9.execSync)("npm ls -g @aware-aeco/cli --depth=0 --json", {
65277
+ lsJson = (0, import_node_child_process10.execSync)("npm ls -g @aware-aeco/cli --depth=0 --json", {
65195
65278
  encoding: "utf8",
65196
65279
  stdio: ["ignore", "pipe", "ignore"],
65197
65280
  shell