@floless/app 0.48.0 → 0.48.1

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.
@@ -5489,7 +5489,7 @@ var require_thread_stream = __commonJS({
5489
5489
  var { version } = require_package();
5490
5490
  var { EventEmitter: EventEmitter2 } = require("events");
5491
5491
  var { Worker } = require("worker_threads");
5492
- var { join: join29 } = require("path");
5492
+ var { join: join28 } = require("path");
5493
5493
  var { pathToFileURL } = require("url");
5494
5494
  var { wait } = require_wait();
5495
5495
  var {
@@ -5540,7 +5540,7 @@ var require_thread_stream = __commonJS({
5540
5540
  function createWorker(stream, opts) {
5541
5541
  const { filename, workerData } = opts;
5542
5542
  const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
5543
- const toExecute = bundlerOverrides["thread-stream-worker"] || join29(__dirname, "lib", "worker.js");
5543
+ const toExecute = bundlerOverrides["thread-stream-worker"] || join28(__dirname, "lib", "worker.js");
5544
5544
  const worker = new Worker(toExecute, {
5545
5545
  ...opts.workerOpts,
5546
5546
  name: opts.workerOpts?.name || "thread-stream",
@@ -6006,9 +6006,9 @@ var require_transport = __commonJS({
6006
6006
  "node_modules/pino/lib/transport.js"(exports2, module2) {
6007
6007
  "use strict";
6008
6008
  var { createRequire: createRequire4 } = require("module");
6009
- var { existsSync: existsSync25 } = require("node:fs");
6009
+ var { existsSync: existsSync24 } = require("node:fs");
6010
6010
  var getCallers = require_caller();
6011
- var { join: join29, isAbsolute: isAbsolute2, sep: sep4 } = require("node:path");
6011
+ var { join: join28, isAbsolute: isAbsolute2, sep: sep4 } = require("node:path");
6012
6012
  var { fileURLToPath: fileURLToPath6 } = require("node:url");
6013
6013
  var sleep = require_atomic_sleep();
6014
6014
  var onExit = require_on_exit_leak_free();
@@ -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) && !existsSync24(path);
6084
6084
  }
6085
6085
  function stripQuotes(value) {
6086
6086
  const first = value[0];
@@ -6161,7 +6161,7 @@ var require_transport = __commonJS({
6161
6161
  throw new Error("only one of target or targets can be specified");
6162
6162
  }
6163
6163
  if (targets) {
6164
- target = bundlerOverrides["pino-worker"] || join29(__dirname, "worker.js");
6164
+ target = bundlerOverrides["pino-worker"] || join28(__dirname, "worker.js");
6165
6165
  options.targets = targets.filter((dest) => dest.target).map((dest) => {
6166
6166
  return {
6167
6167
  ...dest,
@@ -6179,7 +6179,7 @@ var require_transport = __commonJS({
6179
6179
  });
6180
6180
  });
6181
6181
  } else if (pipeline2) {
6182
- target = bundlerOverrides["pino-worker"] || join29(__dirname, "worker.js");
6182
+ target = bundlerOverrides["pino-worker"] || join28(__dirname, "worker.js");
6183
6183
  options.pipelines = [pipeline2.map((dest) => {
6184
6184
  return {
6185
6185
  ...dest,
@@ -6202,7 +6202,7 @@ var require_transport = __commonJS({
6202
6202
  return origin;
6203
6203
  }
6204
6204
  if (origin === "pino/file") {
6205
- return join29(__dirname, "..", "file.js");
6205
+ return join28(__dirname, "..", "file.js");
6206
6206
  }
6207
6207
  let fixTarget2;
6208
6208
  for (const filePath of callers) {
@@ -6317,14 +6317,14 @@ var require_tools = __commonJS({
6317
6317
  }
6318
6318
  return point < 32 ? JSON.stringify(str) : '"' + result + '"';
6319
6319
  }
6320
- function asJson(obj, msg, num2, time) {
6320
+ function asJson(obj, msg, num, time) {
6321
6321
  if (asJsonChan.hasSubscribers === false) {
6322
- return _asJson.call(this, obj, msg, num2, time);
6322
+ return _asJson.call(this, obj, msg, num, time);
6323
6323
  }
6324
6324
  const store = { instance: this, arguments };
6325
- return asJsonChan.traceSync(_asJson, store, this, obj, msg, num2, time);
6325
+ return asJsonChan.traceSync(_asJson, store, this, obj, msg, num, time);
6326
6326
  }
6327
- function _asJson(obj, msg, num2, time) {
6327
+ function _asJson(obj, msg, num, time) {
6328
6328
  const stringify2 = this[stringifySym];
6329
6329
  const stringifySafe = this[stringifySafeSym];
6330
6330
  const stringifiers = this[stringifiersSym];
@@ -6334,7 +6334,7 @@ var require_tools = __commonJS({
6334
6334
  const formatters = this[formattersSym];
6335
6335
  const messageKey = this[messageKeySym];
6336
6336
  const errorKey = this[errorKeySym];
6337
- let data = this[lsCacheSym][num2] + time;
6337
+ let data = this[lsCacheSym][num] + time;
6338
6338
  data = data + chindings;
6339
6339
  let value;
6340
6340
  if (formatters.log) {
@@ -6959,7 +6959,7 @@ var require_proto = __commonJS({
6959
6959
  function defaultMixinMergeStrategy(mergeObject, mixinObject) {
6960
6960
  return Object.assign(mixinObject, mergeObject);
6961
6961
  }
6962
- function write(_obj, msg, num2) {
6962
+ function write(_obj, msg, num) {
6963
6963
  const t = this[timeSym]();
6964
6964
  const mixin = this[mixinSym];
6965
6965
  const errorKey = this[errorKeySym];
@@ -6981,12 +6981,12 @@ var require_proto = __commonJS({
6981
6981
  }
6982
6982
  }
6983
6983
  if (mixin) {
6984
- obj = mixinMergeStrategy(obj, mixin(obj, num2, this));
6984
+ obj = mixinMergeStrategy(obj, mixin(obj, num, this));
6985
6985
  }
6986
- const s = this[asJsonSym](obj, msg, num2, t);
6986
+ const s = this[asJsonSym](obj, msg, num, t);
6987
6987
  const stream = this[streamSym];
6988
6988
  if (stream[needsMetadataGsym] === true) {
6989
- stream.lastLevel = num2;
6989
+ stream.lastLevel = num;
6990
6990
  stream.lastObj = obj;
6991
6991
  stream.lastMsg = msg;
6992
6992
  stream.lastTime = t.slice(this[timeSliceIndexSym]);
@@ -7182,7 +7182,7 @@ var require_safe_stable_stringify = __commonJS({
7182
7182
  return circularValue;
7183
7183
  }
7184
7184
  let res = "";
7185
- let join29 = ",";
7185
+ let join28 = ",";
7186
7186
  const originalIndentation = indentation;
7187
7187
  if (Array.isArray(value)) {
7188
7188
  if (value.length === 0) {
@@ -7196,7 +7196,7 @@ var require_safe_stable_stringify = __commonJS({
7196
7196
  indentation += spacer;
7197
7197
  res += `
7198
7198
  ${indentation}`;
7199
- join29 = `,
7199
+ join28 = `,
7200
7200
  ${indentation}`;
7201
7201
  }
7202
7202
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -7204,13 +7204,13 @@ ${indentation}`;
7204
7204
  for (; i < maximumValuesToStringify - 1; i++) {
7205
7205
  const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
7206
7206
  res += tmp2 !== void 0 ? tmp2 : "null";
7207
- res += join29;
7207
+ res += join28;
7208
7208
  }
7209
7209
  const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
7210
7210
  res += tmp !== void 0 ? tmp : "null";
7211
7211
  if (value.length - 1 > maximumBreadth) {
7212
7212
  const removedKeys = value.length - maximumBreadth - 1;
7213
- res += `${join29}"... ${getItemCount(removedKeys)} not stringified"`;
7213
+ res += `${join28}"... ${getItemCount(removedKeys)} not stringified"`;
7214
7214
  }
7215
7215
  if (spacer !== "") {
7216
7216
  res += `
@@ -7231,7 +7231,7 @@ ${originalIndentation}`;
7231
7231
  let separator = "";
7232
7232
  if (spacer !== "") {
7233
7233
  indentation += spacer;
7234
- join29 = `,
7234
+ join28 = `,
7235
7235
  ${indentation}`;
7236
7236
  whitespace = " ";
7237
7237
  }
@@ -7245,13 +7245,13 @@ ${indentation}`;
7245
7245
  const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
7246
7246
  if (tmp !== void 0) {
7247
7247
  res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
7248
- separator = join29;
7248
+ separator = join28;
7249
7249
  }
7250
7250
  }
7251
7251
  if (keyLength > maximumBreadth) {
7252
7252
  const removedKeys = keyLength - maximumBreadth;
7253
7253
  res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
7254
- separator = join29;
7254
+ separator = join28;
7255
7255
  }
7256
7256
  if (spacer !== "" && separator.length > 1) {
7257
7257
  res = `
@@ -7292,7 +7292,7 @@ ${originalIndentation}`;
7292
7292
  }
7293
7293
  const originalIndentation = indentation;
7294
7294
  let res = "";
7295
- let join29 = ",";
7295
+ let join28 = ",";
7296
7296
  if (Array.isArray(value)) {
7297
7297
  if (value.length === 0) {
7298
7298
  return "[]";
@@ -7305,7 +7305,7 @@ ${originalIndentation}`;
7305
7305
  indentation += spacer;
7306
7306
  res += `
7307
7307
  ${indentation}`;
7308
- join29 = `,
7308
+ join28 = `,
7309
7309
  ${indentation}`;
7310
7310
  }
7311
7311
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -7313,13 +7313,13 @@ ${indentation}`;
7313
7313
  for (; i < maximumValuesToStringify - 1; i++) {
7314
7314
  const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
7315
7315
  res += tmp2 !== void 0 ? tmp2 : "null";
7316
- res += join29;
7316
+ res += join28;
7317
7317
  }
7318
7318
  const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
7319
7319
  res += tmp !== void 0 ? tmp : "null";
7320
7320
  if (value.length - 1 > maximumBreadth) {
7321
7321
  const removedKeys = value.length - maximumBreadth - 1;
7322
- res += `${join29}"... ${getItemCount(removedKeys)} not stringified"`;
7322
+ res += `${join28}"... ${getItemCount(removedKeys)} not stringified"`;
7323
7323
  }
7324
7324
  if (spacer !== "") {
7325
7325
  res += `
@@ -7332,7 +7332,7 @@ ${originalIndentation}`;
7332
7332
  let whitespace = "";
7333
7333
  if (spacer !== "") {
7334
7334
  indentation += spacer;
7335
- join29 = `,
7335
+ join28 = `,
7336
7336
  ${indentation}`;
7337
7337
  whitespace = " ";
7338
7338
  }
@@ -7341,7 +7341,7 @@ ${indentation}`;
7341
7341
  const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
7342
7342
  if (tmp !== void 0) {
7343
7343
  res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
7344
- separator = join29;
7344
+ separator = join28;
7345
7345
  }
7346
7346
  }
7347
7347
  if (spacer !== "" && separator.length > 1) {
@@ -7399,20 +7399,20 @@ ${originalIndentation}`;
7399
7399
  indentation += spacer;
7400
7400
  let res2 = `
7401
7401
  ${indentation}`;
7402
- const join30 = `,
7402
+ const join29 = `,
7403
7403
  ${indentation}`;
7404
7404
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
7405
7405
  let i = 0;
7406
7406
  for (; i < maximumValuesToStringify - 1; i++) {
7407
7407
  const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
7408
7408
  res2 += tmp2 !== void 0 ? tmp2 : "null";
7409
- res2 += join30;
7409
+ res2 += join29;
7410
7410
  }
7411
7411
  const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
7412
7412
  res2 += tmp !== void 0 ? tmp : "null";
7413
7413
  if (value.length - 1 > maximumBreadth) {
7414
7414
  const removedKeys = value.length - maximumBreadth - 1;
7415
- res2 += `${join30}"... ${getItemCount(removedKeys)} not stringified"`;
7415
+ res2 += `${join29}"... ${getItemCount(removedKeys)} not stringified"`;
7416
7416
  }
7417
7417
  res2 += `
7418
7418
  ${originalIndentation}`;
@@ -7428,16 +7428,16 @@ ${originalIndentation}`;
7428
7428
  return '"[Object]"';
7429
7429
  }
7430
7430
  indentation += spacer;
7431
- const join29 = `,
7431
+ const join28 = `,
7432
7432
  ${indentation}`;
7433
7433
  let res = "";
7434
7434
  let separator = "";
7435
7435
  let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
7436
7436
  if (isTypedArrayWithEntries(value)) {
7437
- res += stringifyTypedArray(value, join29, maximumBreadth);
7437
+ res += stringifyTypedArray(value, join28, maximumBreadth);
7438
7438
  keys = keys.slice(value.length);
7439
7439
  maximumPropertiesToStringify -= value.length;
7440
- separator = join29;
7440
+ separator = join28;
7441
7441
  }
7442
7442
  if (deterministic) {
7443
7443
  keys = sort(keys, comparator);
@@ -7448,13 +7448,13 @@ ${indentation}`;
7448
7448
  const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
7449
7449
  if (tmp !== void 0) {
7450
7450
  res += `${separator}${strEscape(key2)}: ${tmp}`;
7451
- separator = join29;
7451
+ separator = join28;
7452
7452
  }
7453
7453
  }
7454
7454
  if (keyLength > maximumBreadth) {
7455
7455
  const removedKeys = keyLength - maximumBreadth;
7456
7456
  res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
7457
- separator = join29;
7457
+ separator = join28;
7458
7458
  }
7459
7459
  if (separator !== "") {
7460
7460
  res = `
@@ -8513,13 +8513,13 @@ var require_serializer = __commonJS({
8513
8513
  return "" + integer;
8514
8514
  }
8515
8515
  asNumber(i) {
8516
- const num2 = Number(i);
8517
- if (num2 !== num2) {
8516
+ const num = Number(i);
8517
+ if (num !== num) {
8518
8518
  throw new Error(`The value "${i}" cannot be converted to a number.`);
8519
- } else if (num2 === Infinity || num2 === -Infinity) {
8519
+ } else if (num === Infinity || num === -Infinity) {
8520
8520
  return "null";
8521
8521
  } else {
8522
- return "" + num2;
8522
+ return "" + num;
8523
8523
  }
8524
8524
  }
8525
8525
  asBoolean(bool) {
@@ -24673,9 +24673,9 @@ var require_semver = __commonJS({
24673
24673
  } else {
24674
24674
  this.prerelease = m[4].split(".").map((id) => {
24675
24675
  if (/^[0-9]+$/.test(id)) {
24676
- const num2 = +id;
24677
- if (num2 >= 0 && num2 < MAX_SAFE_INTEGER) {
24678
- return num2;
24676
+ const num = +id;
24677
+ if (num >= 0 && num < MAX_SAFE_INTEGER) {
24678
+ return num;
24679
24679
  }
24680
24680
  }
24681
24681
  return id;
@@ -41036,24 +41036,24 @@ var require_dist5 = __commonJS({
41036
41036
  var DAY = HOUR * 24;
41037
41037
  var YEAR = DAY * 365.25;
41038
41038
  function parse(val) {
41039
- var num2, arr = val.toLowerCase().match(RGX);
41040
- if (arr != null && (num2 = parseFloat(arr[1]))) {
41041
- if (arr[3] != null) return num2 * SEC;
41042
- if (arr[4] != null) return num2 * MIN;
41043
- if (arr[5] != null) return num2 * HOUR;
41044
- if (arr[6] != null) return num2 * DAY;
41045
- if (arr[7] != null) return num2 * DAY * 7;
41046
- if (arr[8] != null) return num2 * YEAR;
41047
- return num2;
41039
+ var num, arr = val.toLowerCase().match(RGX);
41040
+ if (arr != null && (num = parseFloat(arr[1]))) {
41041
+ if (arr[3] != null) return num * SEC;
41042
+ if (arr[4] != null) return num * MIN;
41043
+ if (arr[5] != null) return num * HOUR;
41044
+ if (arr[6] != null) return num * DAY;
41045
+ if (arr[7] != null) return num * DAY * 7;
41046
+ if (arr[8] != null) return num * YEAR;
41047
+ return num;
41048
41048
  }
41049
41049
  }
41050
41050
  function fmt(val, pfx, str, long) {
41051
- var num2 = (val | 0) === val ? val : ~~(val + 0.5);
41052
- return pfx + num2 + (long ? " " + str + (num2 != 1 ? "s" : "") : str[0]);
41051
+ var num = (val | 0) === val ? val : ~~(val + 0.5);
41052
+ return pfx + num + (long ? " " + str + (num != 1 ? "s" : "") : str[0]);
41053
41053
  }
41054
- function format(num2, long) {
41055
- var pfx = num2 < 0 ? "-" : "", abs = num2 < 0 ? -num2 : num2;
41056
- if (abs < SEC) return num2 + (long ? " ms" : "ms");
41054
+ function format(num, long) {
41055
+ var pfx = num < 0 ? "-" : "", abs = num < 0 ? -num : num;
41056
+ if (abs < SEC) return num + (long ? " ms" : "ms");
41057
41057
  if (abs < MIN) return fmt(abs / SEC, pfx, "second", long);
41058
41058
  if (abs < HOUR) return fmt(abs / MIN, pfx, "minute", long);
41059
41059
  if (abs < DAY) return fmt(abs / HOUR, pfx, "hour", long);
@@ -41991,7 +41991,7 @@ var require_send = __commonJS({
41991
41991
  var { parseTokenList } = require_parseTokenList();
41992
41992
  var { createHttpError } = require_createHttpError();
41993
41993
  var extname2 = path.extname;
41994
- var join29 = path.join;
41994
+ var join28 = path.join;
41995
41995
  var normalize2 = path.normalize;
41996
41996
  var resolve6 = path.resolve;
41997
41997
  var sep4 = path.sep;
@@ -42078,7 +42078,7 @@ var require_send = __commonJS({
42078
42078
  return { statusCode: 403 };
42079
42079
  }
42080
42080
  parts = path2.split(sep4);
42081
- path2 = normalize2(join29(root, path2));
42081
+ path2 = normalize2(join28(root, path2));
42082
42082
  } else {
42083
42083
  if (UP_PATH_REGEXP.test(path2)) {
42084
42084
  debug('malicious path "%s"', path2);
@@ -42194,15 +42194,15 @@ var require_send = __commonJS({
42194
42194
  headers[headerName] = err.headers[headerName];
42195
42195
  }
42196
42196
  }
42197
- const doc2 = ERROR_RESPONSES[statusCode];
42197
+ const doc = ERROR_RESPONSES[statusCode];
42198
42198
  headers["Content-Type"] = "text/html; charset=utf-8";
42199
- headers["Content-Length"] = doc2[1];
42199
+ headers["Content-Length"] = doc[1];
42200
42200
  headers["Content-Security-Policy"] = "default-src 'none'";
42201
42201
  headers["X-Content-Type-Options"] = "nosniff";
42202
42202
  return {
42203
42203
  statusCode,
42204
42204
  headers,
42205
- stream: Readable3.from(doc2[0]),
42205
+ stream: Readable3.from(doc[0]),
42206
42206
  // metadata
42207
42207
  type: "error",
42208
42208
  metadata: { error: createHttpError(statusCode, err) }
@@ -42341,17 +42341,17 @@ var require_send = __commonJS({
42341
42341
  return sendError(403);
42342
42342
  }
42343
42343
  const loc = encodeURI(collapseLeadingSlashes(options.path + "/"));
42344
- const doc2 = createHtmlDocument("Redirecting", "Redirecting to " + escapeHtml(loc));
42344
+ const doc = createHtmlDocument("Redirecting", "Redirecting to " + escapeHtml(loc));
42345
42345
  const headers = {};
42346
42346
  headers["Content-Type"] = "text/html; charset=utf-8";
42347
- headers["Content-Length"] = doc2[1];
42347
+ headers["Content-Length"] = doc[1];
42348
42348
  headers["Content-Security-Policy"] = "default-src 'none'";
42349
42349
  headers["X-Content-Type-Options"] = "nosniff";
42350
42350
  headers.Location = loc;
42351
42351
  return {
42352
42352
  statusCode: 301,
42353
42353
  headers,
42354
- stream: Readable3.from(doc2[0]),
42354
+ stream: Readable3.from(doc[0]),
42355
42355
  // metadata
42356
42356
  type: "directory",
42357
42357
  metadata: { requestPath: options.path, path: path2 }
@@ -42361,7 +42361,7 @@ var require_send = __commonJS({
42361
42361
  let err;
42362
42362
  for (let i = 0; i < options.index.length; i++) {
42363
42363
  const index = options.index[i];
42364
- const p = join29(path2, index);
42364
+ const p = join28(path2, index);
42365
42365
  const { error, stat: stat4 } = await tryStat(p);
42366
42366
  if (error) {
42367
42367
  err = error;
@@ -43799,13 +43799,13 @@ var require_directives = __commonJS({
43799
43799
  }
43800
43800
  return tag[0] === "!" ? tag : `!<${tag}>`;
43801
43801
  }
43802
- toString(doc2) {
43802
+ toString(doc) {
43803
43803
  const lines = this.yaml.explicit ? [`%YAML ${this.yaml.version || "1.2"}`] : [];
43804
43804
  const tagEntries = Object.entries(this.tags);
43805
43805
  let tagNames;
43806
- if (doc2 && tagEntries.length > 0 && identity.isNode(doc2.contents)) {
43806
+ if (doc && tagEntries.length > 0 && identity.isNode(doc.contents)) {
43807
43807
  const tags = {};
43808
- visit.visit(doc2.contents, (_key, node) => {
43808
+ visit.visit(doc.contents, (_key, node) => {
43809
43809
  if (identity.isNode(node) && node.tag)
43810
43810
  tags[node.tag] = true;
43811
43811
  });
@@ -43815,7 +43815,7 @@ var require_directives = __commonJS({
43815
43815
  for (const [handle, prefix] of tagEntries) {
43816
43816
  if (handle === "!!" && prefix === "tag:yaml.org,2002:")
43817
43817
  continue;
43818
- if (!doc2 || tagNames.some((tn) => tn.startsWith(prefix)))
43818
+ if (!doc || tagNames.some((tn) => tn.startsWith(prefix)))
43819
43819
  lines.push(`%TAG ${handle} ${prefix}`);
43820
43820
  }
43821
43821
  return lines.join("\n");
@@ -43858,14 +43858,14 @@ var require_anchors = __commonJS({
43858
43858
  return name;
43859
43859
  }
43860
43860
  }
43861
- function createNodeAnchors(doc2, prefix) {
43861
+ function createNodeAnchors(doc, prefix) {
43862
43862
  const aliasObjects = [];
43863
43863
  const sourceObjects = /* @__PURE__ */ new Map();
43864
43864
  let prevAnchors = null;
43865
43865
  return {
43866
43866
  onAnchor: (source) => {
43867
43867
  aliasObjects.push(source);
43868
- prevAnchors ?? (prevAnchors = anchorNames(doc2));
43868
+ prevAnchors ?? (prevAnchors = anchorNames(doc));
43869
43869
  const anchor = findNewAnchor(prefix, prevAnchors);
43870
43870
  prevAnchors.add(anchor);
43871
43871
  return anchor;
@@ -43996,12 +43996,12 @@ var require_Node = __commonJS({
43996
43996
  return copy;
43997
43997
  }
43998
43998
  /** A plain JavaScript representation of this node. */
43999
- toJS(doc2, { mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {
44000
- if (!identity.isDocument(doc2))
43999
+ toJS(doc, { mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {
44000
+ if (!identity.isDocument(doc))
44001
44001
  throw new TypeError("A document argument is required");
44002
44002
  const ctx = {
44003
44003
  anchors: /* @__PURE__ */ new Map(),
44004
- doc: doc2,
44004
+ doc,
44005
44005
  keep: true,
44006
44006
  mapAsMap: mapAsMap === true,
44007
44007
  mapKeyWarned: false,
@@ -44041,7 +44041,7 @@ var require_Alias = __commonJS({
44041
44041
  * Resolve the value of this alias within `doc`, finding the last
44042
44042
  * instance of the `source` anchor before this node.
44043
44043
  */
44044
- resolve(doc2, ctx) {
44044
+ resolve(doc, ctx) {
44045
44045
  if (ctx?.maxAliasCount === 0)
44046
44046
  throw new ReferenceError("Alias resolution is disabled");
44047
44047
  let nodes;
@@ -44049,7 +44049,7 @@ var require_Alias = __commonJS({
44049
44049
  nodes = ctx.aliasResolveCache;
44050
44050
  } else {
44051
44051
  nodes = [];
44052
- visit.visit(doc2, {
44052
+ visit.visit(doc, {
44053
44053
  Node: (_key, node) => {
44054
44054
  if (identity.isAlias(node) || identity.hasAnchor(node))
44055
44055
  nodes.push(node);
@@ -44070,8 +44070,8 @@ var require_Alias = __commonJS({
44070
44070
  toJSON(_arg, ctx) {
44071
44071
  if (!ctx)
44072
44072
  return { source: this.source };
44073
- const { anchors: anchors2, doc: doc2, maxAliasCount } = ctx;
44074
- const source = this.resolve(doc2, ctx);
44073
+ const { anchors: anchors2, doc, maxAliasCount } = ctx;
44074
+ const source = this.resolve(doc, ctx);
44075
44075
  if (!source) {
44076
44076
  const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
44077
44077
  throw new ReferenceError(msg);
@@ -44088,7 +44088,7 @@ var require_Alias = __commonJS({
44088
44088
  if (maxAliasCount >= 0) {
44089
44089
  data.count += 1;
44090
44090
  if (data.aliasCount === 0)
44091
- data.aliasCount = getAliasCount(doc2, source, anchors2);
44091
+ data.aliasCount = getAliasCount(doc, source, anchors2);
44092
44092
  if (data.count * data.aliasCount > maxAliasCount) {
44093
44093
  const msg = "Excessive alias count indicates a resource exhaustion attack";
44094
44094
  throw new ReferenceError(msg);
@@ -44110,22 +44110,22 @@ var require_Alias = __commonJS({
44110
44110
  return src;
44111
44111
  }
44112
44112
  };
44113
- function getAliasCount(doc2, node, anchors2) {
44113
+ function getAliasCount(doc, node, anchors2) {
44114
44114
  if (identity.isAlias(node)) {
44115
- const source = node.resolve(doc2);
44115
+ const source = node.resolve(doc);
44116
44116
  const anchor = anchors2 && source && anchors2.get(source);
44117
44117
  return anchor ? anchor.count * anchor.aliasCount : 0;
44118
44118
  } else if (identity.isCollection(node)) {
44119
44119
  let count = 0;
44120
44120
  for (const item of node.items) {
44121
- const c = getAliasCount(doc2, item, anchors2);
44121
+ const c = getAliasCount(doc, item, anchors2);
44122
44122
  if (c > count)
44123
44123
  count = c;
44124
44124
  }
44125
44125
  return count;
44126
44126
  } else if (identity.isPair(node)) {
44127
- const kc = getAliasCount(doc2, node.key, anchors2);
44128
- const vc = getAliasCount(doc2, node.value, anchors2);
44127
+ const kc = getAliasCount(doc, node.key, anchors2);
44128
+ const vc = getAliasCount(doc, node.value, anchors2);
44129
44129
  return Math.max(kc, vc);
44130
44130
  }
44131
44131
  return 1;
@@ -44826,7 +44826,7 @@ var require_stringify2 = __commonJS({
44826
44826
  var identity = require_identity();
44827
44827
  var stringifyComment = require_stringifyComment();
44828
44828
  var stringifyString = require_stringifyString();
44829
- function createStringifyContext(doc2, options) {
44829
+ function createStringifyContext(doc, options) {
44830
44830
  const opt = Object.assign({
44831
44831
  blockQuote: true,
44832
44832
  commentString: stringifyComment.stringifyComment,
@@ -44846,7 +44846,7 @@ var require_stringify2 = __commonJS({
44846
44846
  trailingComma: false,
44847
44847
  trueStr: "true",
44848
44848
  verifyAliasOrder: true
44849
- }, doc2.schema.toStringOptions, options);
44849
+ }, doc.schema.toStringOptions, options);
44850
44850
  let inFlow;
44851
44851
  switch (opt.collectionStyle) {
44852
44852
  case "block":
@@ -44860,7 +44860,7 @@ var require_stringify2 = __commonJS({
44860
44860
  }
44861
44861
  return {
44862
44862
  anchors: /* @__PURE__ */ new Set(),
44863
- doc: doc2,
44863
+ doc,
44864
44864
  flowCollectionPadding: opt.flowCollectionPadding ? " " : "",
44865
44865
  indent: "",
44866
44866
  indentStep: typeof opt.indent === "number" ? " ".repeat(opt.indent) : " ",
@@ -44895,8 +44895,8 @@ var require_stringify2 = __commonJS({
44895
44895
  }
44896
44896
  return tagObj;
44897
44897
  }
44898
- function stringifyProps(node, tagObj, { anchors: anchors$1, doc: doc2 }) {
44899
- if (!doc2.directives)
44898
+ function stringifyProps(node, tagObj, { anchors: anchors$1, doc }) {
44899
+ if (!doc.directives)
44900
44900
  return "";
44901
44901
  const props = [];
44902
44902
  const anchor = (identity.isScalar(node) || identity.isCollection(node)) && node.anchor;
@@ -44906,7 +44906,7 @@ var require_stringify2 = __commonJS({
44906
44906
  }
44907
44907
  const tag = node.tag ?? (tagObj.default ? null : tagObj.tag);
44908
44908
  if (tag)
44909
- props.push(doc2.directives.tagString(tag));
44909
+ props.push(doc.directives.tagString(tag));
44910
44910
  return props.join(" ");
44911
44911
  }
44912
44912
  function stringify(item, ctx, onComment, onChompKeep) {
@@ -44951,7 +44951,7 @@ var require_stringifyPair = __commonJS({
44951
44951
  var stringify = require_stringify2();
44952
44952
  var stringifyComment = require_stringifyComment();
44953
44953
  function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
44954
- const { allNullValues, doc: doc2, indent, indentStep, options: { commentString, indentSeq, simpleKeys } } = ctx;
44954
+ const { allNullValues, doc, indent, indentStep, options: { commentString, indentSeq, simpleKeys } } = ctx;
44955
44955
  let keyComment = identity.isNode(key) && key.comment || null;
44956
44956
  if (simpleKeys) {
44957
44957
  if (keyComment) {
@@ -45012,7 +45012,7 @@ ${indent}:`;
45012
45012
  vcb = null;
45013
45013
  valueComment = null;
45014
45014
  if (value && typeof value === "object")
45015
- value = doc2.createNode(value);
45015
+ value = doc.createNode(value);
45016
45016
  }
45017
45017
  ctx.implicitKey = false;
45018
45018
  if (!explicitKey && !keyComment && identity.isScalar(value))
@@ -45784,9 +45784,9 @@ var require_stringifyNumber = __commonJS({
45784
45784
  function stringifyNumber({ format, minFractionDigits, tag, value }) {
45785
45785
  if (typeof value === "bigint")
45786
45786
  return String(value);
45787
- const num2 = typeof value === "number" ? value : Number(value);
45788
- if (!isFinite(num2))
45789
- return isNaN(num2) ? ".nan" : num2 < 0 ? "-.inf" : ".inf";
45787
+ const num = typeof value === "number" ? value : Number(value);
45788
+ if (!isFinite(num))
45789
+ return isNaN(num) ? ".nan" : num < 0 ? "-.inf" : ".inf";
45790
45790
  let n = Object.is(value, -0) ? "-0" : JSON.stringify(value);
45791
45791
  if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^-?\d/.test(n) && !n.includes("e")) {
45792
45792
  let i = n.indexOf(".");
@@ -45826,8 +45826,8 @@ var require_float = __commonJS({
45826
45826
  test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
45827
45827
  resolve: (str) => parseFloat(str),
45828
45828
  stringify(node) {
45829
- const num2 = Number(node.value);
45830
- return isFinite(num2) ? num2.toExponential() : stringifyNumber.stringifyNumber(node);
45829
+ const num = Number(node.value);
45830
+ return isFinite(num) ? num.toExponential() : stringifyNumber.stringifyNumber(node);
45831
45831
  }
45832
45832
  };
45833
45833
  var float = {
@@ -46266,8 +46266,8 @@ var require_float2 = __commonJS({
46266
46266
  test: /^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,
46267
46267
  resolve: (str) => parseFloat(str.replace(/_/g, "")),
46268
46268
  stringify(node) {
46269
- const num2 = Number(node.value);
46270
- return isFinite(num2) ? num2.toExponential() : stringifyNumber.stringifyNumber(node);
46269
+ const num = Number(node.value);
46270
+ return isFinite(num) ? num.toExponential() : stringifyNumber.stringifyNumber(node);
46271
46271
  }
46272
46272
  };
46273
46273
  var float = {
@@ -46469,23 +46469,23 @@ var require_timestamp2 = __commonJS({
46469
46469
  function parseSexagesimal(str, asBigInt) {
46470
46470
  const sign = str[0];
46471
46471
  const parts = sign === "-" || sign === "+" ? str.substring(1) : str;
46472
- const num2 = (n) => asBigInt ? BigInt(n) : Number(n);
46473
- const res = parts.replace(/_/g, "").split(":").reduce((res2, p) => res2 * num2(60) + num2(p), num2(0));
46474
- return sign === "-" ? num2(-1) * res : res;
46472
+ const num = (n) => asBigInt ? BigInt(n) : Number(n);
46473
+ const res = parts.replace(/_/g, "").split(":").reduce((res2, p) => res2 * num(60) + num(p), num(0));
46474
+ return sign === "-" ? num(-1) * res : res;
46475
46475
  }
46476
46476
  function stringifySexagesimal(node) {
46477
46477
  let { value } = node;
46478
- let num2 = (n) => n;
46478
+ let num = (n) => n;
46479
46479
  if (typeof value === "bigint")
46480
- num2 = (n) => BigInt(n);
46480
+ num = (n) => BigInt(n);
46481
46481
  else if (isNaN(value) || !isFinite(value))
46482
46482
  return stringifyNumber.stringifyNumber(node);
46483
46483
  let sign = "";
46484
46484
  if (value < 0) {
46485
46485
  sign = "-";
46486
- value *= num2(-1);
46486
+ value *= num(-1);
46487
46487
  }
46488
- const _60 = num2(60);
46488
+ const _60 = num(60);
46489
46489
  const parts = [value % _60];
46490
46490
  if (value < 60) {
46491
46491
  parts.unshift(0);
@@ -46726,42 +46726,42 @@ var require_stringifyDocument = __commonJS({
46726
46726
  var identity = require_identity();
46727
46727
  var stringify = require_stringify2();
46728
46728
  var stringifyComment = require_stringifyComment();
46729
- function stringifyDocument(doc2, options) {
46729
+ function stringifyDocument(doc, options) {
46730
46730
  const lines = [];
46731
46731
  let hasDirectives = options.directives === true;
46732
- if (options.directives !== false && doc2.directives) {
46733
- const dir = doc2.directives.toString(doc2);
46732
+ if (options.directives !== false && doc.directives) {
46733
+ const dir = doc.directives.toString(doc);
46734
46734
  if (dir) {
46735
46735
  lines.push(dir);
46736
46736
  hasDirectives = true;
46737
- } else if (doc2.directives.docStart)
46737
+ } else if (doc.directives.docStart)
46738
46738
  hasDirectives = true;
46739
46739
  }
46740
46740
  if (hasDirectives)
46741
46741
  lines.push("---");
46742
- const ctx = stringify.createStringifyContext(doc2, options);
46742
+ const ctx = stringify.createStringifyContext(doc, options);
46743
46743
  const { commentString } = ctx.options;
46744
- if (doc2.commentBefore) {
46744
+ if (doc.commentBefore) {
46745
46745
  if (lines.length !== 1)
46746
46746
  lines.unshift("");
46747
- const cs = commentString(doc2.commentBefore);
46747
+ const cs = commentString(doc.commentBefore);
46748
46748
  lines.unshift(stringifyComment.indentComment(cs, ""));
46749
46749
  }
46750
46750
  let chompKeep = false;
46751
46751
  let contentComment = null;
46752
- if (doc2.contents) {
46753
- if (identity.isNode(doc2.contents)) {
46754
- if (doc2.contents.spaceBefore && hasDirectives)
46752
+ if (doc.contents) {
46753
+ if (identity.isNode(doc.contents)) {
46754
+ if (doc.contents.spaceBefore && hasDirectives)
46755
46755
  lines.push("");
46756
- if (doc2.contents.commentBefore) {
46757
- const cs = commentString(doc2.contents.commentBefore);
46756
+ if (doc.contents.commentBefore) {
46757
+ const cs = commentString(doc.contents.commentBefore);
46758
46758
  lines.push(stringifyComment.indentComment(cs, ""));
46759
46759
  }
46760
- ctx.forceBlockIndent = !!doc2.comment;
46761
- contentComment = doc2.contents.comment;
46760
+ ctx.forceBlockIndent = !!doc.comment;
46761
+ contentComment = doc.contents.comment;
46762
46762
  }
46763
46763
  const onChompKeep = contentComment ? void 0 : () => chompKeep = true;
46764
- let body = stringify.stringify(doc2.contents, ctx, () => contentComment = null, onChompKeep);
46764
+ let body = stringify.stringify(doc.contents, ctx, () => contentComment = null, onChompKeep);
46765
46765
  if (contentComment)
46766
46766
  body += stringifyComment.lineComment(body, "", commentString(contentComment));
46767
46767
  if ((body[0] === "|" || body[0] === ">") && lines[lines.length - 1] === "---") {
@@ -46769,11 +46769,11 @@ var require_stringifyDocument = __commonJS({
46769
46769
  } else
46770
46770
  lines.push(body);
46771
46771
  } else {
46772
- lines.push(stringify.stringify(doc2.contents, ctx));
46772
+ lines.push(stringify.stringify(doc.contents, ctx));
46773
46773
  }
46774
- if (doc2.directives?.docEnd) {
46775
- if (doc2.comment) {
46776
- const cs = commentString(doc2.comment);
46774
+ if (doc.directives?.docEnd) {
46775
+ if (doc.comment) {
46776
+ const cs = commentString(doc.comment);
46777
46777
  if (cs.includes("\n")) {
46778
46778
  lines.push("...");
46779
46779
  lines.push(stringifyComment.indentComment(cs, ""));
@@ -46784,7 +46784,7 @@ var require_stringifyDocument = __commonJS({
46784
46784
  lines.push("...");
46785
46785
  }
46786
46786
  } else {
46787
- let dc = doc2.comment;
46787
+ let dc = doc.comment;
46788
46788
  if (dc && chompKeep)
46789
46789
  dc = dc.replace(/^\n+/, "");
46790
46790
  if (dc) {
@@ -48474,13 +48474,13 @@ var require_compose_doc = __commonJS({
48474
48474
  var resolveProps = require_resolve_props();
48475
48475
  function composeDoc(options, directives, { offset, start, value, end }, onError) {
48476
48476
  const opts = Object.assign({ _directives: directives }, options);
48477
- const doc2 = new Document.Document(void 0, opts);
48477
+ const doc = new Document.Document(void 0, opts);
48478
48478
  const ctx = {
48479
48479
  atKey: false,
48480
48480
  atRoot: true,
48481
- directives: doc2.directives,
48482
- options: doc2.options,
48483
- schema: doc2.schema
48481
+ directives: doc.directives,
48482
+ options: doc.options,
48483
+ schema: doc.schema
48484
48484
  };
48485
48485
  const props = resolveProps.resolveProps(start, {
48486
48486
  indicator: "doc-start",
@@ -48491,17 +48491,17 @@ var require_compose_doc = __commonJS({
48491
48491
  startOnNewline: true
48492
48492
  });
48493
48493
  if (props.found) {
48494
- doc2.directives.docStart = true;
48494
+ doc.directives.docStart = true;
48495
48495
  if (value && (value.type === "block-map" || value.type === "block-seq") && !props.hasNewline)
48496
48496
  onError(props.end, "MISSING_CHAR", "Block collection cannot start on same line with directives-end marker");
48497
48497
  }
48498
- doc2.contents = value ? composeNode.composeNode(ctx, value, props, onError) : composeNode.composeEmptyNode(ctx, props.end, start, null, props, onError);
48499
- const contentEnd = doc2.contents.range[2];
48498
+ doc.contents = value ? composeNode.composeNode(ctx, value, props, onError) : composeNode.composeEmptyNode(ctx, props.end, start, null, props, onError);
48499
+ const contentEnd = doc.contents.range[2];
48500
48500
  const re = resolveEnd.resolveEnd(end, contentEnd, false, onError);
48501
48501
  if (re.comment)
48502
- doc2.comment = re.comment;
48503
- doc2.range = [offset, contentEnd, re.offset];
48504
- return doc2;
48502
+ doc.comment = re.comment;
48503
+ doc.range = [offset, contentEnd, re.offset];
48504
+ return doc;
48505
48505
  }
48506
48506
  exports2.composeDoc = composeDoc;
48507
48507
  }
@@ -48568,15 +48568,15 @@ var require_composer = __commonJS({
48568
48568
  this.directives = new directives.Directives({ version: options.version || "1.2" });
48569
48569
  this.options = options;
48570
48570
  }
48571
- decorate(doc2, afterDoc) {
48571
+ decorate(doc, afterDoc) {
48572
48572
  const { comment, afterEmptyLine } = parsePrelude(this.prelude);
48573
48573
  if (comment) {
48574
- const dc = doc2.contents;
48574
+ const dc = doc.contents;
48575
48575
  if (afterDoc) {
48576
- doc2.comment = doc2.comment ? `${doc2.comment}
48576
+ doc.comment = doc.comment ? `${doc.comment}
48577
48577
  ${comment}` : comment;
48578
- } else if (afterEmptyLine || doc2.directives.docStart || !dc) {
48579
- doc2.commentBefore = comment;
48578
+ } else if (afterEmptyLine || doc.directives.docStart || !dc) {
48579
+ doc.commentBefore = comment;
48580
48580
  } else if (identity.isCollection(dc) && !dc.flow && dc.items.length > 0) {
48581
48581
  let it = dc.items[0];
48582
48582
  if (identity.isPair(it))
@@ -48592,12 +48592,12 @@ ${cb}` : comment;
48592
48592
  }
48593
48593
  if (afterDoc) {
48594
48594
  for (let i = 0; i < this.errors.length; ++i)
48595
- doc2.errors.push(this.errors[i]);
48595
+ doc.errors.push(this.errors[i]);
48596
48596
  for (let i = 0; i < this.warnings.length; ++i)
48597
- doc2.warnings.push(this.warnings[i]);
48597
+ doc.warnings.push(this.warnings[i]);
48598
48598
  } else {
48599
- doc2.errors = this.errors;
48600
- doc2.warnings = this.warnings;
48599
+ doc.errors = this.errors;
48600
+ doc.warnings = this.warnings;
48601
48601
  }
48602
48602
  this.prelude = [];
48603
48603
  this.errors = [];
@@ -48642,13 +48642,13 @@ ${cb}` : comment;
48642
48642
  this.atDirectives = true;
48643
48643
  break;
48644
48644
  case "document": {
48645
- const doc2 = composeDoc.composeDoc(this.options, this.directives, token, this.onError);
48646
- if (this.atDirectives && !doc2.directives.docStart)
48645
+ const doc = composeDoc.composeDoc(this.options, this.directives, token, this.onError);
48646
+ if (this.atDirectives && !doc.directives.docStart)
48647
48647
  this.onError(token, "MISSING_CHAR", "Missing directives-end/doc-start indicator line");
48648
- this.decorate(doc2, false);
48648
+ this.decorate(doc, false);
48649
48649
  if (this.doc)
48650
48650
  yield this.doc;
48651
- this.doc = doc2;
48651
+ this.doc = doc;
48652
48652
  this.atDirectives = false;
48653
48653
  break;
48654
48654
  }
@@ -48702,12 +48702,12 @@ ${end.comment}` : end.comment;
48702
48702
  this.doc = null;
48703
48703
  } else if (forceDoc) {
48704
48704
  const opts = Object.assign({ _directives: this.directives }, this.options);
48705
- const doc2 = new Document.Document(void 0, opts);
48705
+ const doc = new Document.Document(void 0, opts);
48706
48706
  if (this.atDirectives)
48707
48707
  this.onError(endOffset, "MISSING_CHAR", "Missing directives-end indicator line");
48708
- doc2.range = [0, endOffset, endOffset];
48709
- this.decorate(doc2, false);
48710
- yield doc2;
48708
+ doc.range = [0, endOffset, endOffset];
48709
+ this.decorate(doc, false);
48710
+ yield doc;
48711
48711
  }
48712
48712
  }
48713
48713
  };
@@ -50064,14 +50064,14 @@ var require_parser = __commonJS({
50064
50064
  return;
50065
50065
  case "doc-mode":
50066
50066
  case "doc-start": {
50067
- const doc2 = {
50067
+ const doc = {
50068
50068
  type: "document",
50069
50069
  offset: this.offset,
50070
50070
  start: []
50071
50071
  };
50072
50072
  if (this.type === "doc-start")
50073
- doc2.start.push(this.sourceToken);
50074
- this.stack.push(doc2);
50073
+ doc.start.push(this.sourceToken);
50074
+ this.stack.push(doc);
50075
50075
  return;
50076
50076
  }
50077
50077
  }
@@ -50082,16 +50082,16 @@ var require_parser = __commonJS({
50082
50082
  source: this.source
50083
50083
  };
50084
50084
  }
50085
- *document(doc2) {
50086
- if (doc2.value)
50087
- return yield* this.lineEnd(doc2);
50085
+ *document(doc) {
50086
+ if (doc.value)
50087
+ return yield* this.lineEnd(doc);
50088
50088
  switch (this.type) {
50089
50089
  case "doc-start": {
50090
- if (findNonEmptyIndex(doc2.start) !== -1) {
50090
+ if (findNonEmptyIndex(doc.start) !== -1) {
50091
50091
  yield* this.pop();
50092
50092
  yield* this.step();
50093
50093
  } else
50094
- doc2.start.push(this.sourceToken);
50094
+ doc.start.push(this.sourceToken);
50095
50095
  return;
50096
50096
  }
50097
50097
  case "anchor":
@@ -50099,10 +50099,10 @@ var require_parser = __commonJS({
50099
50099
  case "space":
50100
50100
  case "comment":
50101
50101
  case "newline":
50102
- doc2.start.push(this.sourceToken);
50102
+ doc.start.push(this.sourceToken);
50103
50103
  return;
50104
50104
  }
50105
- const bv = this.startBlockValue(doc2);
50105
+ const bv = this.startBlockValue(doc);
50106
50106
  if (bv)
50107
50107
  this.stack.push(bv);
50108
50108
  else {
@@ -50641,9 +50641,9 @@ var require_public_api = __commonJS({
50641
50641
  const composer$1 = new composer.Composer(options);
50642
50642
  const docs = Array.from(composer$1.compose(parser$1.parse(source)));
50643
50643
  if (prettyErrors && lineCounter2)
50644
- for (const doc2 of docs) {
50645
- doc2.errors.forEach(errors.prettifyError(source, lineCounter2));
50646
- doc2.warnings.forEach(errors.prettifyError(source, lineCounter2));
50644
+ for (const doc of docs) {
50645
+ doc.errors.forEach(errors.prettifyError(source, lineCounter2));
50646
+ doc.warnings.forEach(errors.prettifyError(source, lineCounter2));
50647
50647
  }
50648
50648
  if (docs.length > 0)
50649
50649
  return docs;
@@ -50653,20 +50653,20 @@ var require_public_api = __commonJS({
50653
50653
  const { lineCounter: lineCounter2, prettyErrors } = parseOptions(options);
50654
50654
  const parser$1 = new parser.Parser(lineCounter2?.addNewLine);
50655
50655
  const composer$1 = new composer.Composer(options);
50656
- let doc2 = null;
50656
+ let doc = null;
50657
50657
  for (const _doc of composer$1.compose(parser$1.parse(source), true, source.length)) {
50658
- if (!doc2)
50659
- doc2 = _doc;
50660
- else if (doc2.options.logLevel !== "silent") {
50661
- doc2.errors.push(new errors.YAMLParseError(_doc.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
50658
+ if (!doc)
50659
+ doc = _doc;
50660
+ else if (doc.options.logLevel !== "silent") {
50661
+ doc.errors.push(new errors.YAMLParseError(_doc.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
50662
50662
  break;
50663
50663
  }
50664
50664
  }
50665
50665
  if (prettyErrors && lineCounter2) {
50666
- doc2.errors.forEach(errors.prettifyError(source, lineCounter2));
50667
- doc2.warnings.forEach(errors.prettifyError(source, lineCounter2));
50666
+ doc.errors.forEach(errors.prettifyError(source, lineCounter2));
50667
+ doc.warnings.forEach(errors.prettifyError(source, lineCounter2));
50668
50668
  }
50669
- return doc2;
50669
+ return doc;
50670
50670
  }
50671
50671
  function parse(src, reviver, options) {
50672
50672
  let _reviver = void 0;
@@ -50675,17 +50675,17 @@ var require_public_api = __commonJS({
50675
50675
  } else if (options === void 0 && reviver && typeof reviver === "object") {
50676
50676
  options = reviver;
50677
50677
  }
50678
- const doc2 = parseDocument4(src, options);
50679
- if (!doc2)
50678
+ const doc = parseDocument4(src, options);
50679
+ if (!doc)
50680
50680
  return null;
50681
- doc2.warnings.forEach((warning) => log2.warn(doc2.options.logLevel, warning));
50682
- if (doc2.errors.length > 0) {
50683
- if (doc2.options.logLevel !== "silent")
50684
- throw doc2.errors[0];
50681
+ doc.warnings.forEach((warning) => log2.warn(doc.options.logLevel, warning));
50682
+ if (doc.errors.length > 0) {
50683
+ if (doc.options.logLevel !== "silent")
50684
+ throw doc.errors[0];
50685
50685
  else
50686
- doc2.errors = [];
50686
+ doc.errors = [];
50687
50687
  }
50688
- return doc2.toJS(Object.assign({ reviver: _reviver }, options));
50688
+ return doc.toJS(Object.assign({ reviver: _reviver }, options));
50689
50689
  }
50690
50690
  function stringify(value, replacer, options) {
50691
50691
  let _replacer = null;
@@ -50827,9 +50827,9 @@ 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_path27 = require("node:path");
50831
- var import_node_os19 = require("node:os");
50832
- var import_node_fs29 = require("node:fs");
50830
+ var import_node_path26 = require("node:path");
50831
+ var import_node_os18 = require("node:os");
50832
+ var import_node_fs28 = require("node:fs");
50833
50833
  var import_node_child_process7 = require("node:child_process");
50834
50834
 
50835
50835
  // log.mjs
@@ -51084,13 +51084,13 @@ function readCommandSpec(agent, command, agentsDir = AGENTS_DIR) {
51084
51084
  if (!safe(agent) || !safe(command)) return null;
51085
51085
  const manifestPath = (0, import_node_path2.join)(agentsDir, agent, "manifest.yaml");
51086
51086
  if (!(0, import_node_fs3.existsSync)(manifestPath)) return null;
51087
- let doc2;
51087
+ let doc;
51088
51088
  try {
51089
- doc2 = asRecord((0, import_yaml.parse)((0, import_node_fs3.readFileSync)(manifestPath, "utf8")));
51089
+ doc = asRecord((0, import_yaml.parse)((0, import_node_fs3.readFileSync)(manifestPath, "utf8")));
51090
51090
  } catch {
51091
51091
  return null;
51092
51092
  }
51093
- const cmd = asRecord(asRecord(doc2.commands)[command]);
51093
+ const cmd = asRecord(asRecord(doc.commands)[command]);
51094
51094
  if (Object.keys(cmd).length === 0) return null;
51095
51095
  const lifecycle = typeof cmd.lifecycle === "string" ? cmd.lifecycle : "single";
51096
51096
  const streaming = asRecord(cmd.outputs).type === "stream";
@@ -51129,13 +51129,13 @@ function readNodeSkill(agent, command, agentsDir = AGENTS_DIR) {
51129
51129
  if (!safe(agent) || !safe(command)) return null;
51130
51130
  const manifestPath = (0, import_node_path2.join)(agentsDir, agent, "manifest.yaml");
51131
51131
  if (!(0, import_node_fs3.existsSync)(manifestPath)) return null;
51132
- let doc2;
51132
+ let doc;
51133
51133
  try {
51134
- doc2 = asRecord((0, import_yaml.parse)((0, import_node_fs3.readFileSync)(manifestPath, "utf8")));
51134
+ doc = asRecord((0, import_yaml.parse)((0, import_node_fs3.readFileSync)(manifestPath, "utf8")));
51135
51135
  } catch {
51136
51136
  return null;
51137
51137
  }
51138
- const cmd = asRecord(asRecord(doc2.commands)[command]);
51138
+ const cmd = asRecord(asRecord(doc.commands)[command]);
51139
51139
  if (Object.keys(cmd).length === 0) return null;
51140
51140
  const outRec = asRecord(cmd.outputs);
51141
51141
  const outputs = typeof outRec.type === "string" ? {
@@ -51146,10 +51146,10 @@ function readNodeSkill(agent, command, agentsDir = AGENTS_DIR) {
51146
51146
  } : null;
51147
51147
  return {
51148
51148
  agent,
51149
- agentDisplayName: typeof doc2["display-name"] === "string" ? doc2["display-name"] : agent,
51150
- agentDescription: firstParagraph(doc2.description),
51151
- homepage: typeof doc2.homepage === "string" ? doc2.homepage : null,
51152
- capabilities: Object.keys(asRecord(doc2.requires)),
51149
+ agentDisplayName: typeof doc["display-name"] === "string" ? doc["display-name"] : agent,
51150
+ agentDescription: firstParagraph(doc.description),
51151
+ homepage: typeof doc.homepage === "string" ? doc.homepage : null,
51152
+ capabilities: Object.keys(asRecord(doc.requires)),
51153
51153
  command,
51154
51154
  commandDescription: firstParagraph(cmd.description),
51155
51155
  inputs: parseManifestInputs(cmd.inputs),
@@ -51171,8 +51171,8 @@ function credentialStatus(secret) {
51171
51171
  const file = (0, import_node_path2.join)(CREDENTIALS_DIR, `${secret}.json`);
51172
51172
  if (!(0, import_node_fs3.existsSync)(file)) return { status: "disconnected", expiresAt: null };
51173
51173
  try {
51174
- const doc2 = JSON.parse((0, import_node_fs3.readFileSync)(file, "utf8"));
51175
- const raw = doc2["expires_at"] ?? doc2["expiresAt"] ?? doc2["expiry"];
51174
+ const doc = JSON.parse((0, import_node_fs3.readFileSync)(file, "utf8"));
51175
+ const raw = doc["expires_at"] ?? doc["expiresAt"] ?? doc["expiry"];
51176
51176
  if (raw != null) {
51177
51177
  const ms = typeof raw === "number" ? raw * (raw < 1e12 ? 1e3 : 1) : Date.parse(String(raw));
51178
51178
  if (!Number.isNaN(ms)) {
@@ -51194,13 +51194,13 @@ function listIntegrations() {
51194
51194
  if (!(0, import_node_fs3.existsSync)(manifestPath)) continue;
51195
51195
  const manifestText = (0, import_node_fs3.readFileSync)(manifestPath, "utf8");
51196
51196
  if (!manifestText.includes("secrets:")) continue;
51197
- let doc2;
51197
+ let doc;
51198
51198
  try {
51199
- doc2 = asRecord((0, import_yaml.parse)(manifestText));
51199
+ doc = asRecord((0, import_yaml.parse)(manifestText));
51200
51200
  } catch {
51201
51201
  continue;
51202
51202
  }
51203
- const requires = asRecord(doc2.requires);
51203
+ const requires = asRecord(doc.requires);
51204
51204
  const secrets = Array.isArray(requires.secrets) ? requires.secrets.map(String) : [];
51205
51205
  if (!secrets.length) continue;
51206
51206
  const network = Array.isArray(requires.network) ? requires.network.map(String) : [];
@@ -51209,8 +51209,8 @@ function listIntegrations() {
51209
51209
  seen.add(secret);
51210
51210
  out.push({
51211
51211
  id: secret,
51212
- name: typeof doc2["display-name"] === "string" ? doc2["display-name"] : agentId,
51213
- vendor: typeof doc2.vendor === "string" ? doc2.vendor : null,
51212
+ name: typeof doc["display-name"] === "string" ? doc["display-name"] : agentId,
51213
+ vendor: typeof doc.vendor === "string" ? doc.vendor : null,
51214
51214
  agent: agentId,
51215
51215
  network,
51216
51216
  ...credentialStatus(secret)
@@ -52856,7 +52856,7 @@ function appVersion() {
52856
52856
  return resolveVersion({
52857
52857
  isSea: isSea2(),
52858
52858
  sqVersionXml: readSqVersionXml(),
52859
- define: true ? "0.48.0" : void 0,
52859
+ define: true ? "0.48.1" : void 0,
52860
52860
  pkgVersion: readPkgVersion()
52861
52861
  });
52862
52862
  }
@@ -52866,7 +52866,7 @@ function resolveChannel(s) {
52866
52866
  return "dev";
52867
52867
  }
52868
52868
  function appChannel() {
52869
- return resolveChannel({ isSea: isSea2(), define: true ? "0.48.0" : void 0 });
52869
+ return resolveChannel({ isSea: isSea2(), define: true ? "0.48.1" : void 0 });
52870
52870
  }
52871
52871
 
52872
52872
  // workflow-update.ts
@@ -52907,13 +52907,13 @@ function detectUpdates(installed, templates) {
52907
52907
  return out;
52908
52908
  }
52909
52909
  function readTemplateMeta(path) {
52910
- const doc2 = (0, import_yaml2.parse)((0, import_node_fs8.readFileSync)(path, "utf8")) ?? {};
52910
+ const doc = (0, import_yaml2.parse)((0, import_node_fs8.readFileSync)(path, "utf8")) ?? {};
52911
52911
  return {
52912
- id: String(doc2.app ?? ""),
52913
- version: doc2.version != null ? String(doc2.version) : "0.0.0",
52914
- publisher: typeof doc2.publisher === "string" ? doc2.publisher : void 0,
52915
- module: typeof doc2.module === "string" ? doc2.module : void 0,
52916
- changelog: Array.isArray(doc2.changelog) ? doc2.changelog : void 0,
52912
+ id: String(doc.app ?? ""),
52913
+ version: doc.version != null ? String(doc.version) : "0.0.0",
52914
+ publisher: typeof doc.publisher === "string" ? doc.publisher : void 0,
52915
+ module: typeof doc.module === "string" ? doc.module : void 0,
52916
+ changelog: Array.isArray(doc.changelog) ? doc.changelog : void 0,
52917
52917
  path
52918
52918
  };
52919
52919
  }
@@ -53051,13 +53051,13 @@ function buildExposedCommands(inputs) {
53051
53051
  };
53052
53052
  }
53053
53053
  function bakeFloSource(source, inputs) {
53054
- const doc2 = (0, import_yaml3.parseDocument)(source);
53055
- if (doc2.errors.length > 0) {
53056
- throw new Error(`bake: source is not valid YAML: ${doc2.errors[0]?.message ?? "parse error"}`);
53054
+ const doc = (0, import_yaml3.parseDocument)(source);
53055
+ if (doc.errors.length > 0) {
53056
+ throw new Error(`bake: source is not valid YAML: ${doc.errors[0]?.message ?? "parse error"}`);
53057
53057
  }
53058
- doc2.set("exposes-as-agent", true);
53059
- doc2.set("exposed-commands", buildExposedCommands(inputs));
53060
- return doc2.toString();
53058
+ doc.set("exposes-as-agent", true);
53059
+ doc.set("exposed-commands", buildExposedCommands(inputs));
53060
+ return doc.toString();
53061
53061
  }
53062
53062
 
53063
53063
  // app-import.ts
@@ -53133,72 +53133,9 @@ function withBadge(report, opts) {
53133
53133
  return { ...report, html: injectBadge(report.html, opts) };
53134
53134
  }
53135
53135
 
53136
- // steel-report.ts
53137
- var esc = (s) => String(s ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
53138
- var num = (v) => typeof v === "number" ? v : Number(v) || 0;
53139
- var STYLE = `<style>
53140
- body{font-family:-apple-system,'Segoe UI',Roboto,sans-serif;background:#0f172a;color:#e2e8f0;padding:2.5rem;line-height:1.55}
53141
- .wrap{max-width:560px;margin:0 auto;background:#111c33;border:1px solid #1e293b;border-radius:14px;padding:1.9rem 2.1rem;box-shadow:0 12px 34px rgba(2,6,23,.5)}
53142
- h1{font-size:1.4rem;font-weight:800;margin:0 0 .3rem;color:#f1f5f9}
53143
- .ok{color:#4ade80;font-size:.82rem;font-weight:700;margin:.15rem 0 .25rem;letter-spacing:.02em}
53144
- .sub{color:#94a3b8;font-size:.92rem;margin-bottom:1.3rem}
53145
- .big{font-size:2.1rem;font-weight:800;color:#60a5fa;line-height:1}
53146
- .big span{font-size:1rem;font-weight:600;color:#94a3b8}
53147
- table{width:100%;border-collapse:collapse;font-size:.9rem;margin:1.2rem 0}
53148
- td{padding:.45rem .2rem;border-bottom:1px solid #1e293b}td:last-child{text-align:right;font-weight:700;color:#cbd5e1}
53149
- thead td{color:#64748b;font-weight:600;font-size:.78rem;text-transform:uppercase;letter-spacing:.04em}thead td:last-child{text-align:right}
53150
- .path{font-family:ui-monospace,Menlo,Consolas,monospace;font-size:.82rem;background:#0b1424;border:1px solid #1e293b;border-radius:7px;padding:.6rem .75rem;color:#93c5fd;word-break:break-all;margin:.6rem 0 1.1rem}
53151
- .path-label{color:#94a3b8;font-size:.8rem;margin:.2rem 0 .35rem}
53152
- .tools{font-size:.9rem;color:#cbd5e1}.tools b{color:#f1f5f9}
53153
- </style>`;
53154
- function profileRows(profiles) {
53155
- if (!profiles || typeof profiles !== "object") return "";
53156
- return Object.entries(profiles).map(([k, v]) => `<tr><td>${esc(k)}</td><td>${num(v)}</td></tr>`).join("");
53157
- }
53158
- function doc(body) {
53159
- return `<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>Steel report</title>${STYLE}</head><body><div class="wrap">${body}</div></body></html>`;
53160
- }
53161
- function ifcCard(r) {
53162
- const members = num(r.members);
53163
- const columns = num(r.columns);
53164
- const beams = num(r.beams);
53165
- const path = String(r.path ?? "");
53166
- const fname = path.split(/[\\/]/).pop() || "model.ifc";
53167
- const rows = profileRows(r.profiles);
53168
- return doc(
53169
- `<h1>Steel exported to IFC</h1><div class="ok">&#10003; IFC file written</div><div class="sub">${esc(fname)}</div><div class="big">${members} <span>members &middot; ${columns} columns &middot; ${beams} beams</span></div>` + (rows ? `<table><thead><tr><td>Profile</td><td>Count</td></tr></thead><tbody>${rows}</tbody></table>` : "") + `<div class="path-label">Saved here &mdash; open it in Tekla / SDS2 / Revit:</div><div class="path">${esc(path)}</div><div class="tools">Open the IFC in <b>Tekla</b>, <b>SDS2</b>, <b>Revit</b> or <b>Navisworks</b> &mdash; IFC is the universal exchange format. Schematic model &mdash; confirm &amp; detail in your tool.</div>`
53170
- );
53171
- }
53172
- function teklaCard(r) {
53173
- const created = num(r.created);
53174
- const columns = num(r.columns);
53175
- const beams = num(r.beams);
53176
- const failed = num(r.failed);
53177
- const skipped = num(r.skipped);
53178
- const placeholder = num(r.placeholder);
53179
- const sceneName = String(r.scene_name ?? "Steel from Drawings");
53180
- const model = String(r.model ?? "Tekla model");
53181
- const rows = profileRows(r.profiles);
53182
- const extra = (failed > 0 ? ` &middot; ${failed} failed` : "") + (skipped > 0 ? ` &middot; ${skipped} skipped` : "");
53183
- const note = placeholder > 0 ? `${placeholder} member(s) used a sized placeholder profile because this Tekla environment didn't have the drawing's catalogue profile \u2014 remap those. <b>Undo</b> in Tekla reverts the whole bake.` : `Native Tekla parts on the model grid \u2014 detail them as usual. <b>Undo</b> in Tekla reverts the whole bake.`;
53184
- return doc(
53185
- `<h1>Steel baked into Tekla</h1><div class="ok">&#10003; ${created} member(s) created in the live model</div><div class="sub">${esc(sceneName)} &rarr; ${esc(model)}</div><div class="big">${created} <span>members &middot; ${columns} columns &middot; ${beams} beams${extra}</span></div>` + (rows ? `<table><thead><tr><td>Profile</td><td>Count</td></tr></thead><tbody>${rows}</tbody></table>` : "") + `<div class="tools">${note}</div>`
53186
- );
53187
- }
53188
- function buildSteelReportHtml(data) {
53189
- if (!data || typeof data !== "object") return null;
53190
- const result = data.result && typeof data.result === "object" ? data.result : null;
53191
- if (result && typeof result.created === "number") return teklaCard(result);
53192
- if (typeof data.members === "number" && typeof data.path === "string") return ifcCard(data);
53193
- if (result && typeof result.members === "number" && typeof result.path === "string") return ifcCard(result);
53194
- return null;
53195
- }
53196
-
53197
53136
  // report-html.ts
53198
- function extractReportHtml(events, appId) {
53137
+ function extractReportHtml(events) {
53199
53138
  let found = null;
53200
- const steelApp = appId === "steel-to-ifc" || appId === "steel-to-tekla";
53201
- let steel = null;
53202
53139
  for (const ev of events) {
53203
53140
  const data = ev?.data;
53204
53141
  if (!data || typeof data !== "object") continue;
@@ -53206,25 +53143,9 @@ function extractReportHtml(events, appId) {
53206
53143
  const html = typeof data.html === "string" ? data.html : result && typeof result.html === "string" ? result.html : null;
53207
53144
  if (html) {
53208
53145
  found = { nodeId: ev.node ?? null, html };
53209
- } else if (steelApp) {
53210
- const card = buildSteelReportHtml(data);
53211
- if (card) steel = { nodeId: ev.node ?? null, html: card };
53212
53146
  }
53213
53147
  }
53214
- return found ?? steel;
53215
- }
53216
-
53217
- // steel-output-path.ts
53218
- var import_node_path9 = require("node:path");
53219
- var import_node_os9 = require("node:os");
53220
- var import_node_fs10 = require("node:fs");
53221
- function steelIfcRunInputs(id, inputs) {
53222
- if (id !== "steel-to-ifc") return inputs;
53223
- const op = inputs?.output_path;
53224
- if (op != null && op !== "" && op !== "steel-from-drawings.ifc") return inputs;
53225
- const dl = (0, import_node_path9.join)((0, import_node_os9.homedir)(), "Downloads");
53226
- const dir = (0, import_node_fs10.existsSync)(dl) ? dl : (0, import_node_os9.homedir)();
53227
- return { ...inputs ?? {}, output_path: (0, import_node_path9.join)(dir, "steel-from-drawings.ifc") };
53148
+ return found;
53228
53149
  }
53229
53150
 
53230
53151
  // index.ts
@@ -53272,21 +53193,21 @@ function buildPreview(m, sourceKind, sourceRef, stagedRef) {
53272
53193
  }
53273
53194
 
53274
53195
  // graft-manifest-reader.ts
53275
- var import_node_fs11 = require("node:fs");
53276
- var import_node_path10 = require("node:path");
53196
+ var import_node_fs10 = require("node:fs");
53197
+ var import_node_path9 = require("node:path");
53277
53198
  var import_yaml4 = __toESM(require_dist6(), 1);
53278
53199
  var asRecord2 = (v) => v && typeof v === "object" && !Array.isArray(v) ? v : {};
53279
53200
  function readStagedManifest(agentDir) {
53280
- const manifestPath = (0, import_node_path10.join)(agentDir, "manifest.yaml");
53281
- if (!(0, import_node_fs11.existsSync)(manifestPath)) return null;
53282
- let doc2;
53201
+ const manifestPath = (0, import_node_path9.join)(agentDir, "manifest.yaml");
53202
+ if (!(0, import_node_fs10.existsSync)(manifestPath)) return null;
53203
+ let doc;
53283
53204
  try {
53284
- doc2 = asRecord2((0, import_yaml4.parse)((0, import_node_fs11.readFileSync)(manifestPath, "utf8")));
53205
+ doc = asRecord2((0, import_yaml4.parse)((0, import_node_fs10.readFileSync)(manifestPath, "utf8")));
53285
53206
  } catch {
53286
53207
  return null;
53287
53208
  }
53288
53209
  const commands = {};
53289
- for (const [name, raw] of Object.entries(asRecord2(doc2.commands))) {
53210
+ for (const [name, raw] of Object.entries(asRecord2(doc.commands))) {
53290
53211
  const c = asRecord2(raw);
53291
53212
  const inputs = {};
53292
53213
  for (const [inName, inRaw] of Object.entries(asRecord2(c.inputs))) {
@@ -53309,26 +53230,26 @@ function readStagedManifest(agentDir) {
53309
53230
  inputs
53310
53231
  };
53311
53232
  }
53312
- let skillCount = Array.isArray(doc2.skills) ? doc2.skills.length : 0;
53233
+ let skillCount = Array.isArray(doc.skills) ? doc.skills.length : 0;
53313
53234
  if (!skillCount) {
53314
- const skillsDir = (0, import_node_path10.join)(agentDir, "skills");
53315
- if ((0, import_node_fs11.existsSync)(skillsDir)) {
53235
+ const skillsDir = (0, import_node_path9.join)(agentDir, "skills");
53236
+ if ((0, import_node_fs10.existsSync)(skillsDir)) {
53316
53237
  try {
53317
- skillCount = (0, import_node_fs11.readdirSync)(skillsDir).filter((f) => f.endsWith(".md")).length;
53238
+ skillCount = (0, import_node_fs10.readdirSync)(skillsDir).filter((f) => f.endsWith(".md")).length;
53318
53239
  } catch {
53319
53240
  }
53320
53241
  }
53321
53242
  }
53322
53243
  return {
53323
- agentId: typeof doc2.agent === "string" ? doc2.agent : "",
53324
- description: typeof doc2.description === "string" ? doc2.description : "",
53244
+ agentId: typeof doc.agent === "string" ? doc.agent : "",
53245
+ description: typeof doc.description === "string" ? doc.description : "",
53325
53246
  skillCount,
53326
53247
  commands
53327
53248
  };
53328
53249
  }
53329
53250
 
53330
53251
  // graft-stage-registry.ts
53331
- var import_node_fs12 = require("node:fs");
53252
+ var import_node_fs11 = require("node:fs");
53332
53253
  var TTL_MS = 30 * 60 * 1e3;
53333
53254
  var registry = /* @__PURE__ */ new Map();
53334
53255
  function registerStage(token, tempDir, agentId) {
@@ -53350,7 +53271,7 @@ function evict(token) {
53350
53271
  clearTimeout(e.timer);
53351
53272
  registry.delete(token);
53352
53273
  try {
53353
- (0, import_node_fs12.rmSync)(e.tempDir, { recursive: true, force: true });
53274
+ (0, import_node_fs11.rmSync)(e.tempDir, { recursive: true, force: true });
53354
53275
  } catch {
53355
53276
  }
53356
53277
  }
@@ -53359,8 +53280,8 @@ function clearAllStages() {
53359
53280
  }
53360
53281
 
53361
53282
  // graft-commit.ts
53362
- var import_node_fs13 = require("node:fs");
53363
- var import_node_path11 = require("node:path");
53283
+ var import_node_fs12 = require("node:fs");
53284
+ var import_node_path10 = require("node:path");
53364
53285
  var GraftCommitError = class extends Error {
53365
53286
  constructor(message, code) {
53366
53287
  super(message);
@@ -53370,60 +53291,60 @@ var GraftCommitError = class extends Error {
53370
53291
  code;
53371
53292
  };
53372
53293
  function commitStaged(tempDir, agentId, targetAgentsDir, force) {
53373
- const staged = (0, import_node_path11.join)(tempDir, "agents", agentId);
53374
- const target = (0, import_node_path11.join)(targetAgentsDir, agentId);
53375
- if ((0, import_node_fs13.existsSync)(target)) {
53294
+ const staged = (0, import_node_path10.join)(tempDir, "agents", agentId);
53295
+ const target = (0, import_node_path10.join)(targetAgentsDir, agentId);
53296
+ if ((0, import_node_fs12.existsSync)(target)) {
53376
53297
  if (!force) throw new GraftCommitError(`an agent named "${agentId}" is already installed`, "collision");
53377
- (0, import_node_fs13.rmSync)(target, { recursive: true, force: true });
53298
+ (0, import_node_fs12.rmSync)(target, { recursive: true, force: true });
53378
53299
  }
53379
- (0, import_node_fs13.mkdirSync)(targetAgentsDir, { recursive: true });
53300
+ (0, import_node_fs12.mkdirSync)(targetAgentsDir, { recursive: true });
53380
53301
  try {
53381
- (0, import_node_fs13.renameSync)(staged, target);
53302
+ (0, import_node_fs12.renameSync)(staged, target);
53382
53303
  } catch {
53383
- (0, import_node_fs13.cpSync)(staged, target, { recursive: true });
53304
+ (0, import_node_fs12.cpSync)(staged, target, { recursive: true });
53384
53305
  }
53385
- (0, import_node_fs13.rmSync)(tempDir, { recursive: true, force: true });
53306
+ (0, import_node_fs12.rmSync)(tempDir, { recursive: true, force: true });
53386
53307
  return { agentId };
53387
53308
  }
53388
53309
  function matchAssemblies(globOrDir) {
53389
53310
  let dir;
53390
53311
  let pattern;
53391
- if ((0, import_node_fs13.existsSync)(globOrDir) && (0, import_node_fs13.statSync)(globOrDir).isDirectory()) {
53312
+ if ((0, import_node_fs12.existsSync)(globOrDir) && (0, import_node_fs12.statSync)(globOrDir).isDirectory()) {
53392
53313
  dir = globOrDir;
53393
53314
  pattern = "*.dll";
53394
53315
  } else {
53395
- dir = (0, import_node_path11.dirname)(globOrDir);
53396
- pattern = (0, import_node_path11.basename)(globOrDir);
53316
+ dir = (0, import_node_path10.dirname)(globOrDir);
53317
+ pattern = (0, import_node_path10.basename)(globOrDir);
53397
53318
  }
53398
- if (!dir || !(0, import_node_fs13.existsSync)(dir) || !(0, import_node_fs13.statSync)(dir).isDirectory()) return [];
53319
+ if (!dir || !(0, import_node_fs12.existsSync)(dir) || !(0, import_node_fs12.statSync)(dir).isDirectory()) return [];
53399
53320
  const re = globToRegExp(pattern);
53400
- return (0, import_node_fs13.readdirSync)(dir).filter((f) => re.test(f)).sort();
53321
+ return (0, import_node_fs12.readdirSync)(dir).filter((f) => re.test(f)).sort();
53401
53322
  }
53402
53323
  function globToRegExp(p) {
53403
- const esc2 = p.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*").replace(/\?/g, ".");
53404
- return new RegExp(`^${esc2}$`, "i");
53324
+ const esc = p.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*").replace(/\?/g, ".");
53325
+ return new RegExp(`^${esc}$`, "i");
53405
53326
  }
53406
53327
 
53407
53328
  // floless-store.ts
53408
53329
  var import_node_crypto4 = require("node:crypto");
53409
- var import_node_fs14 = require("node:fs");
53410
- var import_node_os10 = require("node:os");
53411
- var import_node_path12 = require("node:path");
53412
- var ROOT2 = process.env.FLOLESS_HOME ?? (0, import_node_path12.join)((0, import_node_os10.homedir)(), ".floless");
53413
- var TEMPLATES_FILE = (0, import_node_path12.join)(ROOT2, "templates.json");
53414
- var REQUESTS_DIR = (0, import_node_path12.join)(ROOT2, "requests");
53330
+ var import_node_fs13 = require("node:fs");
53331
+ var import_node_os9 = require("node:os");
53332
+ var import_node_path11 = require("node:path");
53333
+ var ROOT2 = process.env.FLOLESS_HOME ?? (0, import_node_path11.join)((0, import_node_os9.homedir)(), ".floless");
53334
+ var TEMPLATES_FILE = (0, import_node_path11.join)(ROOT2, "templates.json");
53335
+ var REQUESTS_DIR = (0, import_node_path11.join)(ROOT2, "requests");
53415
53336
  function ensureRoot() {
53416
- if (!(0, import_node_fs14.existsSync)(ROOT2)) (0, import_node_fs14.mkdirSync)(ROOT2, { recursive: true });
53337
+ if (!(0, import_node_fs13.existsSync)(ROOT2)) (0, import_node_fs13.mkdirSync)(ROOT2, { recursive: true });
53417
53338
  }
53418
53339
  function withinRequestsDir(p) {
53419
- const base = (0, import_node_path12.resolve)(REQUESTS_DIR);
53420
- const full = (0, import_node_path12.resolve)(p);
53421
- return full === base || full.startsWith(base + import_node_path12.sep);
53340
+ const base = (0, import_node_path11.resolve)(REQUESTS_DIR);
53341
+ const full = (0, import_node_path11.resolve)(p);
53342
+ return full === base || full.startsWith(base + import_node_path11.sep);
53422
53343
  }
53423
53344
  function listTemplates() {
53424
- if (!(0, import_node_fs14.existsSync)(TEMPLATES_FILE)) return [];
53345
+ if (!(0, import_node_fs13.existsSync)(TEMPLATES_FILE)) return [];
53425
53346
  try {
53426
- const parsed = JSON.parse((0, import_node_fs14.readFileSync)(TEMPLATES_FILE, "utf8"));
53347
+ const parsed = JSON.parse((0, import_node_fs13.readFileSync)(TEMPLATES_FILE, "utf8"));
53427
53348
  return Array.isArray(parsed) ? parsed : [];
53428
53349
  } catch {
53429
53350
  return [];
@@ -53432,8 +53353,8 @@ function listTemplates() {
53432
53353
  function writeTemplates(list) {
53433
53354
  ensureRoot();
53434
53355
  const tmp = `${TEMPLATES_FILE}.${process.pid}.tmp`;
53435
- (0, import_node_fs14.writeFileSync)(tmp, JSON.stringify(list, null, 2));
53436
- (0, import_node_fs14.renameSync)(tmp, TEMPLATES_FILE);
53356
+ (0, import_node_fs13.writeFileSync)(tmp, JSON.stringify(list, null, 2));
53357
+ (0, import_node_fs13.renameSync)(tmp, TEMPLATES_FILE);
53437
53358
  }
53438
53359
  function addTemplate(input) {
53439
53360
  const list = listTemplates();
@@ -53478,13 +53399,13 @@ function updateTemplate(id, patch) {
53478
53399
  }
53479
53400
  function addRequest(req, decoded = []) {
53480
53401
  ensureRoot();
53481
- if (!(0, import_node_fs14.existsSync)(REQUESTS_DIR)) (0, import_node_fs14.mkdirSync)(REQUESTS_DIR, { recursive: true });
53402
+ if (!(0, import_node_fs13.existsSync)(REQUESTS_DIR)) (0, import_node_fs13.mkdirSync)(REQUESTS_DIR, { recursive: true });
53482
53403
  const id = (0, import_node_crypto4.randomUUID)();
53483
53404
  const createdAt = (/* @__PURE__ */ new Date()).toISOString();
53484
53405
  const base = `${createdAt.replace(/[:.]/g, "-")}__${id}`;
53485
53406
  const snapshots = decoded.map((d, i) => {
53486
- const p = (0, import_node_path12.join)(REQUESTS_DIR, `${base}__snap${i + 1}.${d.ext}`);
53487
- (0, import_node_fs14.writeFileSync)(p, d.buf);
53407
+ const p = (0, import_node_path11.join)(REQUESTS_DIR, `${base}__snap${i + 1}.${d.ext}`);
53408
+ (0, import_node_fs13.writeFileSync)(p, d.buf);
53488
53409
  return p;
53489
53410
  });
53490
53411
  const full = {
@@ -53494,55 +53415,55 @@ function addRequest(req, decoded = []) {
53494
53415
  ...req,
53495
53416
  ...snapshots.length ? { snapshots } : {}
53496
53417
  };
53497
- (0, import_node_fs14.writeFileSync)((0, import_node_path12.join)(REQUESTS_DIR, `${base}.json`), JSON.stringify(full, null, 2));
53418
+ (0, import_node_fs13.writeFileSync)((0, import_node_path11.join)(REQUESTS_DIR, `${base}.json`), JSON.stringify(full, null, 2));
53498
53419
  return full;
53499
53420
  }
53500
53421
  function listRequests() {
53501
- if (!(0, import_node_fs14.existsSync)(REQUESTS_DIR)) return [];
53502
- return (0, import_node_fs14.readdirSync)(REQUESTS_DIR).filter((f) => f.endsWith(".json")).sort().map((f) => {
53422
+ if (!(0, import_node_fs13.existsSync)(REQUESTS_DIR)) return [];
53423
+ return (0, import_node_fs13.readdirSync)(REQUESTS_DIR).filter((f) => f.endsWith(".json")).sort().map((f) => {
53503
53424
  try {
53504
- return JSON.parse((0, import_node_fs14.readFileSync)((0, import_node_path12.join)(REQUESTS_DIR, f), "utf8"));
53425
+ return JSON.parse((0, import_node_fs13.readFileSync)((0, import_node_path11.join)(REQUESTS_DIR, f), "utf8"));
53505
53426
  } catch {
53506
53427
  return null;
53507
53428
  }
53508
53429
  }).filter((r) => r !== null);
53509
53430
  }
53510
53431
  function deleteRequest(id) {
53511
- if (!(0, import_node_fs14.existsSync)(REQUESTS_DIR)) return false;
53512
- const file = (0, import_node_fs14.readdirSync)(REQUESTS_DIR).find((f) => f.endsWith(`__${id}.json`));
53432
+ if (!(0, import_node_fs13.existsSync)(REQUESTS_DIR)) return false;
53433
+ const file = (0, import_node_fs13.readdirSync)(REQUESTS_DIR).find((f) => f.endsWith(`__${id}.json`));
53513
53434
  if (!file) return false;
53514
53435
  try {
53515
- const parsed = JSON.parse((0, import_node_fs14.readFileSync)((0, import_node_path12.join)(REQUESTS_DIR, file), "utf8"));
53436
+ const parsed = JSON.parse((0, import_node_fs13.readFileSync)((0, import_node_path11.join)(REQUESTS_DIR, file), "utf8"));
53516
53437
  for (const p of parsed.snapshots ?? []) {
53517
53438
  if (!withinRequestsDir(p)) continue;
53518
53439
  try {
53519
- (0, import_node_fs14.rmSync)(p);
53440
+ (0, import_node_fs13.rmSync)(p);
53520
53441
  } catch {
53521
53442
  }
53522
53443
  }
53523
53444
  } catch {
53524
53445
  }
53525
- (0, import_node_fs14.rmSync)((0, import_node_path12.join)(REQUESTS_DIR, file));
53446
+ (0, import_node_fs13.rmSync)((0, import_node_path11.join)(REQUESTS_DIR, file));
53526
53447
  return true;
53527
53448
  }
53528
53449
  function clearRequests() {
53529
- if (!(0, import_node_fs14.existsSync)(REQUESTS_DIR)) return 0;
53530
- const allFiles = (0, import_node_fs14.readdirSync)(REQUESTS_DIR);
53450
+ if (!(0, import_node_fs13.existsSync)(REQUESTS_DIR)) return 0;
53451
+ const allFiles = (0, import_node_fs13.readdirSync)(REQUESTS_DIR);
53531
53452
  const jsonFiles = allFiles.filter((f) => f.endsWith(".json"));
53532
53453
  for (const f of allFiles) {
53533
53454
  try {
53534
- (0, import_node_fs14.rmSync)((0, import_node_path12.join)(REQUESTS_DIR, f));
53455
+ (0, import_node_fs13.rmSync)((0, import_node_path11.join)(REQUESTS_DIR, f));
53535
53456
  } catch {
53536
53457
  }
53537
53458
  }
53538
53459
  return jsonFiles.length;
53539
53460
  }
53540
53461
  function snapshotPathFor(id, n) {
53541
- if (!(0, import_node_fs14.existsSync)(REQUESTS_DIR)) return null;
53542
- const file = (0, import_node_fs14.readdirSync)(REQUESTS_DIR).find((f) => f.endsWith(`__${id}.json`));
53462
+ if (!(0, import_node_fs13.existsSync)(REQUESTS_DIR)) return null;
53463
+ const file = (0, import_node_fs13.readdirSync)(REQUESTS_DIR).find((f) => f.endsWith(`__${id}.json`));
53543
53464
  if (!file) return null;
53544
53465
  try {
53545
- const parsed = JSON.parse((0, import_node_fs14.readFileSync)((0, import_node_path12.join)(REQUESTS_DIR, file), "utf8"));
53466
+ const parsed = JSON.parse((0, import_node_fs13.readFileSync)((0, import_node_path11.join)(REQUESTS_DIR, file), "utf8"));
53546
53467
  const cand = parsed.snapshots?.[n] ?? null;
53547
53468
  return cand && withinRequestsDir(cand) ? cand : null;
53548
53469
  } catch {
@@ -53579,15 +53500,15 @@ function decodeSnapshots(inputs) {
53579
53500
 
53580
53501
  // visual-input-store.ts
53581
53502
  var import_node_crypto5 = require("node:crypto");
53582
- var import_node_fs15 = require("node:fs");
53583
- var import_node_os11 = require("node:os");
53584
- var import_node_path13 = require("node:path");
53503
+ var import_node_fs14 = require("node:fs");
53504
+ var import_node_os10 = require("node:os");
53505
+ var import_node_path12 = require("node:path");
53585
53506
  var MAX_BYTES3 = 25 * 1024 * 1024;
53586
53507
  var VisualInputError = class extends Error {
53587
53508
  };
53588
53509
  function inputsDir() {
53589
- const root = process.env.FLOLESS_HOME ?? (0, import_node_path13.join)((0, import_node_os11.homedir)(), ".floless");
53590
- return (0, import_node_path13.join)(root, "inputs");
53510
+ const root = process.env.FLOLESS_HOME ?? (0, import_node_path12.join)((0, import_node_os10.homedir)(), ".floless");
53511
+ return (0, import_node_path12.join)(root, "inputs");
53591
53512
  }
53592
53513
  function sniffExt2(buf) {
53593
53514
  if (buf.length >= 8 && buf[0] === 137 && buf[1] === 80 && buf[2] === 78 && buf[3] === 71) return "png";
@@ -53599,7 +53520,7 @@ function sniffExt2(buf) {
53599
53520
  var RESERVED = /^(con|prn|aux|nul|com[1-9]|lpt[1-9])(\..*)?$/i;
53600
53521
  function safeSegment(s) {
53601
53522
  if (!s || s === "." || s.includes("..")) return false;
53602
- if (s.includes("/") || s.includes("\\") || s.includes(import_node_path13.sep)) return false;
53523
+ if (s.includes("/") || s.includes("\\") || s.includes(import_node_path12.sep)) return false;
53603
53524
  for (let i = 0; i < s.length; i++) {
53604
53525
  const c = s.charCodeAt(i);
53605
53526
  if (c < 32 || c === 58) return false;
@@ -53617,54 +53538,54 @@ function storeVisualInput(appId, dataUrl) {
53617
53538
  const ext = sniffExt2(buf);
53618
53539
  if (!ext) throw new VisualInputError("visual input must be PNG, JPEG, WebP, or PDF");
53619
53540
  const sha2562 = (0, import_node_crypto5.createHash)("sha256").update(buf).digest("hex");
53620
- const dir = (0, import_node_path13.join)(inputsDir(), appId);
53621
- const path = (0, import_node_path13.join)(dir, `${sha2562}.${ext}`);
53622
- const root = (0, import_node_path13.resolve)(inputsDir());
53623
- const target = (0, import_node_path13.resolve)(path);
53624
- if (target !== root && !target.startsWith(root + import_node_path13.sep)) {
53541
+ const dir = (0, import_node_path12.join)(inputsDir(), appId);
53542
+ const path = (0, import_node_path12.join)(dir, `${sha2562}.${ext}`);
53543
+ const root = (0, import_node_path12.resolve)(inputsDir());
53544
+ const target = (0, import_node_path12.resolve)(path);
53545
+ if (target !== root && !target.startsWith(root + import_node_path12.sep)) {
53625
53546
  throw new VisualInputError("refusing to write outside the inputs root");
53626
53547
  }
53627
- (0, import_node_fs15.mkdirSync)(dir, { recursive: true });
53628
- if (!(0, import_node_fs15.existsSync)(path)) {
53548
+ (0, import_node_fs14.mkdirSync)(dir, { recursive: true });
53549
+ if (!(0, import_node_fs14.existsSync)(path)) {
53629
53550
  const tmp = `${path}.tmp`;
53630
- (0, import_node_fs15.writeFileSync)(tmp, buf);
53631
- (0, import_node_fs15.renameSync)(tmp, path);
53551
+ (0, import_node_fs14.writeFileSync)(tmp, buf);
53552
+ (0, import_node_fs14.renameSync)(tmp, path);
53632
53553
  }
53633
- return { path, ext, bytes: (0, import_node_fs15.statSync)(path).size, sha256: sha2562 };
53554
+ return { path, ext, bytes: (0, import_node_fs14.statSync)(path).size, sha256: sha2562 };
53634
53555
  }
53635
53556
  function renameVisualInputs(oldId, newId) {
53636
53557
  if (!safeSegment(oldId) || !safeSegment(newId)) throw new VisualInputError("invalid app id");
53637
- const from = (0, import_node_path13.join)(inputsDir(), oldId);
53638
- if (!(0, import_node_fs15.existsSync)(from)) return;
53639
- const to = (0, import_node_path13.join)(inputsDir(), newId);
53640
- if ((0, import_node_fs15.existsSync)(to)) (0, import_node_fs15.rmSync)(to, { recursive: true, force: true });
53641
- (0, import_node_fs15.mkdirSync)(inputsDir(), { recursive: true });
53642
- (0, import_node_fs15.renameSync)(from, to);
53558
+ const from = (0, import_node_path12.join)(inputsDir(), oldId);
53559
+ if (!(0, import_node_fs14.existsSync)(from)) return;
53560
+ const to = (0, import_node_path12.join)(inputsDir(), newId);
53561
+ if ((0, import_node_fs14.existsSync)(to)) (0, import_node_fs14.rmSync)(to, { recursive: true, force: true });
53562
+ (0, import_node_fs14.mkdirSync)(inputsDir(), { recursive: true });
53563
+ (0, import_node_fs14.renameSync)(from, to);
53643
53564
  }
53644
53565
  function copyVisualInputs(srcId, newId) {
53645
53566
  if (!safeSegment(srcId) || !safeSegment(newId)) throw new VisualInputError("invalid app id");
53646
- const from = (0, import_node_path13.join)(inputsDir(), srcId);
53647
- if (!(0, import_node_fs15.existsSync)(from)) return;
53648
- (0, import_node_fs15.cpSync)(from, (0, import_node_path13.join)(inputsDir(), newId), { recursive: true });
53567
+ const from = (0, import_node_path12.join)(inputsDir(), srcId);
53568
+ if (!(0, import_node_fs14.existsSync)(from)) return;
53569
+ (0, import_node_fs14.cpSync)(from, (0, import_node_path12.join)(inputsDir(), newId), { recursive: true });
53649
53570
  }
53650
53571
  function deleteVisualInputs(id) {
53651
53572
  if (!safeSegment(id)) throw new VisualInputError("invalid app id");
53652
- const dir = (0, import_node_path13.join)(inputsDir(), id);
53653
- if ((0, import_node_fs15.existsSync)(dir)) (0, import_node_fs15.rmSync)(dir, { recursive: true, force: true });
53573
+ const dir = (0, import_node_path12.join)(inputsDir(), id);
53574
+ if ((0, import_node_fs14.existsSync)(dir)) (0, import_node_fs14.rmSync)(dir, { recursive: true, force: true });
53654
53575
  }
53655
53576
 
53656
53577
  // contract-store.ts
53657
- var import_node_fs17 = require("node:fs");
53658
- var import_node_path15 = require("node:path");
53659
- var import_node_os12 = require("node:os");
53660
-
53661
- // contract-schema.ts
53662
53578
  var import_node_fs16 = require("node:fs");
53663
53579
  var import_node_path14 = require("node:path");
53580
+ var import_node_os11 = require("node:os");
53581
+
53582
+ // contract-schema.ts
53583
+ var import_node_fs15 = require("node:fs");
53584
+ var import_node_path13 = require("node:path");
53664
53585
  var import_node_url2 = require("node:url");
53665
- function validate(doc2, schema) {
53586
+ function validate(doc, schema) {
53666
53587
  const errors = [];
53667
- walk(doc2, schema, schema, "$", errors);
53588
+ walk(doc, schema, schema, "$", errors);
53668
53589
  return { valid: errors.length === 0, errors };
53669
53590
  }
53670
53591
  function isPlainObject(v) {
@@ -53761,16 +53682,16 @@ function walk(value, node, root, path, errors) {
53761
53682
  var _cached = null;
53762
53683
  function loadSteelTakeoffSchema() {
53763
53684
  if (_cached) return _cached;
53764
- const here2 = (0, import_node_path14.dirname)((0, import_node_url2.fileURLToPath)(__import_meta_url));
53685
+ const here2 = (0, import_node_path13.dirname)((0, import_node_url2.fileURLToPath)(__import_meta_url));
53765
53686
  const candidates = [
53766
- (0, import_node_path14.join)(here2, "..", "schemas", "steel.takeoff.v1.schema.json"),
53687
+ (0, import_node_path13.join)(here2, "..", "schemas", "steel.takeoff.v1.schema.json"),
53767
53688
  // dev: server/ next to schemas/
53768
- (0, import_node_path14.join)(here2, "schemas", "steel.takeoff.v1.schema.json")
53689
+ (0, import_node_path13.join)(here2, "schemas", "steel.takeoff.v1.schema.json")
53769
53690
  // bundled: dist/ holds ./schemas
53770
53691
  ];
53771
53692
  for (const p of candidates) {
53772
53693
  try {
53773
- const text = (0, import_node_fs16.readFileSync)(p, "utf8");
53694
+ const text = (0, import_node_fs15.readFileSync)(p, "utf8");
53774
53695
  _cached = JSON.parse(text);
53775
53696
  return _cached;
53776
53697
  } catch (err) {
@@ -53779,41 +53700,41 @@ function loadSteelTakeoffSchema() {
53779
53700
  }
53780
53701
  throw new Error("steel.takeoff/v1 schema file not found");
53781
53702
  }
53782
- function validateSteelTakeoff(doc2) {
53783
- return validate(doc2, loadSteelTakeoffSchema());
53703
+ function validateSteelTakeoff(doc) {
53704
+ return validate(doc, loadSteelTakeoffSchema());
53784
53705
  }
53785
53706
 
53786
53707
  // contract-store.ts
53787
53708
  var ContractError = class extends Error {
53788
53709
  };
53789
- var ROOT3 = process.env.FLOLESS_HOME ?? (0, import_node_path15.join)((0, import_node_os12.homedir)(), ".floless");
53790
- var DIR = (0, import_node_path15.join)(ROOT3, "contracts");
53710
+ var ROOT3 = process.env.FLOLESS_HOME ?? (0, import_node_path14.join)((0, import_node_os11.homedir)(), ".floless");
53711
+ var DIR = (0, import_node_path14.join)(ROOT3, "contracts");
53791
53712
  function safeId(appId) {
53792
53713
  if (!/^[a-z0-9][a-z0-9._-]*$/i.test(appId)) throw new ContractError(`invalid appId: ${appId}`);
53793
53714
  return appId;
53794
53715
  }
53795
53716
  function contractPath(appId) {
53796
- return (0, import_node_path15.join)(DIR, `${safeId(appId)}.json`);
53717
+ return (0, import_node_path14.join)(DIR, `${safeId(appId)}.json`);
53797
53718
  }
53798
53719
  function readContract(appId) {
53799
53720
  const p = contractPath(appId);
53800
- if (!(0, import_node_fs17.existsSync)(p)) return null;
53721
+ if (!(0, import_node_fs16.existsSync)(p)) return null;
53801
53722
  try {
53802
- return JSON.parse((0, import_node_fs17.readFileSync)(p, "utf8"));
53723
+ return JSON.parse((0, import_node_fs16.readFileSync)(p, "utf8"));
53803
53724
  } catch (e) {
53804
53725
  console.warn(`readContract: ignoring unreadable contract at ${p}: ${e instanceof Error ? e.message : e}`);
53805
53726
  return null;
53806
53727
  }
53807
53728
  }
53808
- function writeContract(appId, doc2) {
53729
+ function writeContract(appId, doc) {
53809
53730
  const p = contractPath(appId);
53810
- const res = validateSteelTakeoff(doc2);
53731
+ const res = validateSteelTakeoff(doc);
53811
53732
  if (!res.valid) {
53812
53733
  const first = res.errors.slice(0, 5).map((e) => `${e.path}: ${e.message}`).join("; ");
53813
53734
  throw new ContractError(`contract failed schema validation \u2014 ${first}`);
53814
53735
  }
53815
- if (!(0, import_node_fs17.existsSync)(DIR)) (0, import_node_fs17.mkdirSync)(DIR, { recursive: true });
53816
- (0, import_node_fs17.writeFileSync)(p, JSON.stringify(doc2));
53736
+ if (!(0, import_node_fs16.existsSync)(DIR)) (0, import_node_fs16.mkdirSync)(DIR, { recursive: true });
53737
+ (0, import_node_fs16.writeFileSync)(p, JSON.stringify(doc));
53817
53738
  }
53818
53739
 
53819
53740
  // contract-resolve.ts
@@ -53835,20 +53756,20 @@ function readContractForApp(appId, readAppFn = readApp) {
53835
53756
  }
53836
53757
 
53837
53758
  // contract-bake.ts
53838
- var import_node_fs18 = require("node:fs");
53759
+ var import_node_fs17 = require("node:fs");
53839
53760
  var import_yaml5 = __toESM(require_dist6(), 1);
53840
53761
  function bakeContractIntoApp(sourcePath, contract) {
53841
- const doc2 = (0, import_yaml5.parseDocument)((0, import_node_fs18.readFileSync)(sourcePath, "utf8"));
53842
- if (doc2.errors.length > 0) {
53843
- throw new Error(`contract bake: source is not valid YAML: ${doc2.errors[0]?.message ?? "parse error"}`);
53762
+ const doc = (0, import_yaml5.parseDocument)((0, import_node_fs17.readFileSync)(sourcePath, "utf8"));
53763
+ if (doc.errors.length > 0) {
53764
+ throw new Error(`contract bake: source is not valid YAML: ${doc.errors[0]?.message ?? "parse error"}`);
53844
53765
  }
53845
- const seq = doc2.get("nodes");
53766
+ const seq = doc.get("nodes");
53846
53767
  const items = (0, import_yaml5.isSeq)(seq) ? seq.items : [];
53847
53768
  const nodeOf = (it) => (0, import_yaml5.isMap)(it) ? it.toJSON() : null;
53848
53769
  let idx = items.findIndex((it) => nodeOf(it)?.config?.contract === contract.type);
53849
53770
  if (idx < 0) idx = items.findIndex((it) => nodeOf(it)?.agent === "steel-takeoff-us");
53850
53771
  if (idx < 0) throw new Error("no contract-emitting node to bake the contract into");
53851
- doc2.setIn(["nodes", idx, "config", "contract"], contract.type);
53772
+ doc.setIn(["nodes", idx, "config", "contract"], contract.type);
53852
53773
  const baked = { ...contract };
53853
53774
  delete baked.dims3d;
53854
53775
  if (Array.isArray(contract.plans)) {
@@ -53880,8 +53801,8 @@ function bakeContractIntoApp(sourcePath, contract) {
53880
53801
  }
53881
53802
  baked.filter = next;
53882
53803
  }
53883
- doc2.setIn(["nodes", idx, "config", "takeoff"], baked);
53884
- (0, import_node_fs18.writeFileSync)(sourcePath, doc2.toString());
53804
+ doc.setIn(["nodes", idx, "config", "takeoff"], baked);
53805
+ (0, import_node_fs17.writeFileSync)(sourcePath, doc.toString());
53885
53806
  }
53886
53807
 
53887
53808
  // contract-to-scene.ts
@@ -53978,37 +53899,37 @@ function contractToScene(contractInput) {
53978
53899
  }
53979
53900
 
53980
53901
  // scene-bake.ts
53981
- var import_node_fs19 = require("node:fs");
53982
- var import_node_path16 = require("node:path");
53902
+ var import_node_fs18 = require("node:fs");
53903
+ var import_node_path15 = require("node:path");
53983
53904
  var import_yaml6 = __toESM(require_dist6(), 1);
53984
53905
  function bakeSceneIntoApp(sourcePath, scene, agent = "viewer-3d") {
53985
- const doc2 = (0, import_yaml6.parseDocument)((0, import_node_fs19.readFileSync)(sourcePath, "utf8"));
53986
- if (doc2.errors.length > 0) {
53987
- throw new Error(`scene bake: source is not valid YAML: ${doc2.errors[0]?.message ?? "parse error"}`);
53906
+ const doc = (0, import_yaml6.parseDocument)((0, import_node_fs18.readFileSync)(sourcePath, "utf8"));
53907
+ if (doc.errors.length > 0) {
53908
+ throw new Error(`scene bake: source is not valid YAML: ${doc.errors[0]?.message ?? "parse error"}`);
53988
53909
  }
53989
- const seq = doc2.get("nodes");
53910
+ const seq = doc.get("nodes");
53990
53911
  const items = (0, import_yaml6.isSeq)(seq) ? seq.items : [];
53991
53912
  const idx = items.findIndex((it) => ((0, import_yaml6.isMap)(it) ? it.toJSON() : null)?.agent === agent);
53992
53913
  if (idx < 0) throw new Error(`no ${agent} render node to bake the scene into`);
53993
- doc2.setIn(["nodes", idx, "config", "scene"], scene);
53994
- (0, import_node_fs19.writeFileSync)(sourcePath, doc2.toString());
53914
+ doc.setIn(["nodes", idx, "config", "scene"], scene);
53915
+ (0, import_node_fs18.writeFileSync)(sourcePath, doc.toString());
53995
53916
  }
53996
53917
  function bakeNodeConfigById(sourcePath, nodeId, patch) {
53997
- const doc2 = (0, import_yaml6.parseDocument)((0, import_node_fs19.readFileSync)(sourcePath, "utf8"));
53998
- if (doc2.errors.length > 0) {
53999
- throw new Error(`node bake: source is not valid YAML: ${doc2.errors[0]?.message ?? "parse error"}`);
53918
+ const doc = (0, import_yaml6.parseDocument)((0, import_node_fs18.readFileSync)(sourcePath, "utf8"));
53919
+ if (doc.errors.length > 0) {
53920
+ throw new Error(`node bake: source is not valid YAML: ${doc.errors[0]?.message ?? "parse error"}`);
54000
53921
  }
54001
- const seq = doc2.get("nodes");
53922
+ const seq = doc.get("nodes");
54002
53923
  const items = (0, import_yaml6.isSeq)(seq) ? seq.items : [];
54003
53924
  const idx = items.findIndex((it) => ((0, import_yaml6.isMap)(it) ? it.toJSON() : null)?.id === nodeId);
54004
53925
  if (idx < 0) throw new Error(`no node with id "${nodeId}"`);
54005
- for (const [key, value] of Object.entries(patch)) doc2.setIn(["nodes", idx, "config", key], value);
54006
- (0, import_node_fs19.writeFileSync)(sourcePath, doc2.toString());
53926
+ for (const [key, value] of Object.entries(patch)) doc.setIn(["nodes", idx, "config", key], value);
53927
+ (0, import_node_fs18.writeFileSync)(sourcePath, doc.toString());
54007
53928
  }
54008
53929
  function writeViewer3dApp(dir, appId, scene) {
54009
- (0, import_node_fs19.mkdirSync)(dir, { recursive: true });
54010
- const flo = (0, import_node_path16.join)(dir, `${appId}.flo`);
54011
- (0, import_node_fs19.writeFileSync)(flo, [
53930
+ (0, import_node_fs18.mkdirSync)(dir, { recursive: true });
53931
+ const flo = (0, import_node_path15.join)(dir, `${appId}.flo`);
53932
+ (0, import_node_fs18.writeFileSync)(flo, [
54012
53933
  `app: ${appId}`,
54013
53934
  "version: 0.1.0",
54014
53935
  "display-name: Steel 3D",
@@ -54029,9 +53950,9 @@ function writeViewer3dApp(dir, appId, scene) {
54029
53950
  return flo;
54030
53951
  }
54031
53952
  function writeIfcApp(dir, appId, scene, outputPath) {
54032
- (0, import_node_fs19.mkdirSync)(dir, { recursive: true });
54033
- const flo = (0, import_node_path16.join)(dir, `${appId}.flo`);
54034
- (0, import_node_fs19.writeFileSync)(flo, [
53953
+ (0, import_node_fs18.mkdirSync)(dir, { recursive: true });
53954
+ const flo = (0, import_node_path15.join)(dir, `${appId}.flo`);
53955
+ (0, import_node_fs18.writeFileSync)(flo, [
54035
53956
  `app: ${appId}`,
54036
53957
  "version: 0.1.0",
54037
53958
  "display-name: Steel IFC",
@@ -54054,9 +53975,9 @@ function writeIfcApp(dir, appId, scene, outputPath) {
54054
53975
  return flo;
54055
53976
  }
54056
53977
  function writeTeklaApp(dir, appId, scene, teklaVersion = "2026.0") {
54057
- (0, import_node_fs19.mkdirSync)(dir, { recursive: true });
54058
- const flo = (0, import_node_path16.join)(dir, `${appId}.flo`);
54059
- (0, import_node_fs19.writeFileSync)(flo, [
53978
+ (0, import_node_fs18.mkdirSync)(dir, { recursive: true });
53979
+ const flo = (0, import_node_path15.join)(dir, `${appId}.flo`);
53980
+ (0, import_node_fs18.writeFileSync)(flo, [
54060
53981
  `app: ${appId}`,
54061
53982
  "version: 0.1.0",
54062
53983
  "display-name: Steel to Tekla",
@@ -54298,16 +54219,16 @@ function memberTons(contract, m) {
54298
54219
  }
54299
54220
  function rollup(members, countWeighted = false) {
54300
54221
  const counts = emptyCounts();
54301
- let num2 = 0, den = 0, tons = 0;
54222
+ let num = 0, den = 0, tons = 0;
54302
54223
  for (const m of members) {
54303
54224
  counts[m.band]++;
54304
54225
  if (m.band === "rfi") continue;
54305
54226
  const w = countWeighted ? 1 : m.tons;
54306
- num2 += w * BAND_WEIGHT[m.band];
54227
+ num += w * BAND_WEIGHT[m.band];
54307
54228
  den += w;
54308
54229
  tons += m.tons;
54309
54230
  }
54310
- return { score: den > 0 ? Math.round(num2 / den * 100) : null, tons, counts };
54231
+ return { score: den > 0 ? Math.round(num / den * 100) : null, tons, counts };
54311
54232
  }
54312
54233
  function bandEnd(end, rows) {
54313
54234
  const row = end.conn ? rows.get(end.conn) : void 0;
@@ -54343,14 +54264,14 @@ function scoreConnections(contractInput) {
54343
54264
  }
54344
54265
  });
54345
54266
  const counts = emptyCounts();
54346
- let num2 = 0, den = 0;
54267
+ let num = 0, den = 0;
54347
54268
  for (const e of byEnd) {
54348
54269
  counts[e.band]++;
54349
54270
  if (e.band === "rfi") continue;
54350
- num2 += BAND_WEIGHT[e.band];
54271
+ num += BAND_WEIGHT[e.band];
54351
54272
  den += 1;
54352
54273
  }
54353
- const category = { score: den > 0 ? Math.round(num2 / den * 100) : null, tons: 0, counts };
54274
+ const category = { score: den > 0 ? Math.round(num / den * 100) : null, tons: 0, counts };
54354
54275
  return { byEnd, category };
54355
54276
  }
54356
54277
  function scoreContract(contractInput) {
@@ -54397,7 +54318,7 @@ function scoreContract(contractInput) {
54397
54318
  const columns = rollup(byMember.filter((m) => m.role === "column"));
54398
54319
  const details = rollupDetails(byDetail);
54399
54320
  const scored = byMember.filter((m) => m.band !== "rfi");
54400
- const num2 = scored.reduce((s, m) => s + m.tons * BAND_WEIGHT[m.band], 0);
54321
+ const num = scored.reduce((s, m) => s + m.tons * BAND_WEIGHT[m.band], 0);
54401
54322
  const den = scored.reduce((s, m) => s + m.tons, 0);
54402
54323
  return {
54403
54324
  byMember,
@@ -54415,7 +54336,7 @@ function scoreContract(contractInput) {
54415
54336
  note: "Approximate in v1 \u2014 precise per-segment binding is Slice 2."
54416
54337
  },
54417
54338
  overall: {
54418
- score: den > 0 ? Math.round(num2 / den * 100) : null,
54339
+ score: den > 0 ? Math.round(num / den * 100) : null,
54419
54340
  tons: den,
54420
54341
  rfiCount: byMember.filter((m) => m.band === "rfi").length
54421
54342
  }
@@ -54427,13 +54348,13 @@ function detailSheet(text) {
54427
54348
  }
54428
54349
  function rollupDetails(details) {
54429
54350
  const counts = emptyCounts();
54430
- let num2 = 0, den = 0;
54351
+ let num = 0, den = 0;
54431
54352
  for (const d of details) {
54432
54353
  counts[d.band]++;
54433
- num2 += BAND_WEIGHT[d.band];
54354
+ num += BAND_WEIGHT[d.band];
54434
54355
  den += 1;
54435
54356
  }
54436
- return { score: den > 0 ? Math.round(num2 / den * 100) : null, tons: 0, counts };
54357
+ return { score: den > 0 ? Math.round(num / den * 100) : null, tons: 0, counts };
54437
54358
  }
54438
54359
 
54439
54360
  // contract-score.ts
@@ -54479,14 +54400,14 @@ function scoreContract2(contractInput) {
54479
54400
  }
54480
54401
 
54481
54402
  // app-lifecycle.ts
54482
- var import_node_fs22 = require("node:fs");
54483
- var import_node_os14 = require("node:os");
54484
- var import_node_path19 = require("node:path");
54485
-
54486
- // routines.ts
54487
54403
  var import_node_fs21 = require("node:fs");
54404
+ var import_node_os13 = require("node:os");
54488
54405
  var import_node_path18 = require("node:path");
54489
54406
 
54407
+ // routines.ts
54408
+ var import_node_fs20 = require("node:fs");
54409
+ var import_node_path17 = require("node:path");
54410
+
54490
54411
  // sse.ts
54491
54412
  var clients = /* @__PURE__ */ new Set();
54492
54413
  var HEARTBEAT_MS = 2e4;
@@ -54522,11 +54443,11 @@ function clientCount() {
54522
54443
  }
54523
54444
 
54524
54445
  // trigger-sessions.ts
54525
- var import_node_fs20 = require("node:fs");
54526
- var import_node_os13 = require("node:os");
54527
- var import_node_path17 = require("node:path");
54446
+ var import_node_fs19 = require("node:fs");
54447
+ var import_node_os12 = require("node:os");
54448
+ var import_node_path16 = require("node:path");
54528
54449
  var import_yaml7 = __toESM(require_dist6(), 1);
54529
- var AGENTS_DIR2 = process.env.AWARE_HOME ? (0, import_node_path17.join)(process.env.AWARE_HOME, "agents") : (0, import_node_path17.join)((0, import_node_os13.homedir)(), ".aware", "agents");
54450
+ var AGENTS_DIR2 = process.env.AWARE_HOME ? (0, import_node_path16.join)(process.env.AWARE_HOME, "agents") : (0, import_node_path16.join)((0, import_node_os12.homedir)(), ".aware", "agents");
54530
54451
  function summarizeFire(data) {
54531
54452
  if (!data) return "event";
54532
54453
  const type = typeof data.type === "string" ? data.type : "";
@@ -54543,11 +54464,11 @@ function mapTriggerState(phase) {
54543
54464
  function isHostBacked(agent, agentsDir = AGENTS_DIR2) {
54544
54465
  const safe = (n) => !n.includes("/") && !n.includes("\\") && !n.includes("..");
54545
54466
  if (!safe(agent)) return false;
54546
- const manifestPath = (0, import_node_path17.join)(agentsDir, agent, "manifest.yaml");
54547
- if (!(0, import_node_fs20.existsSync)(manifestPath)) return false;
54467
+ const manifestPath = (0, import_node_path16.join)(agentsDir, agent, "manifest.yaml");
54468
+ if (!(0, import_node_fs19.existsSync)(manifestPath)) return false;
54548
54469
  try {
54549
- const doc2 = (0, import_yaml7.parse)((0, import_node_fs20.readFileSync)(manifestPath, "utf8"));
54550
- const transport = doc2?.transport;
54470
+ const doc = (0, import_yaml7.parse)((0, import_node_fs19.readFileSync)(manifestPath, "utf8"));
54471
+ const transport = doc?.transport;
54551
54472
  return !!(transport && typeof transport === "object" && "cli" in transport);
54552
54473
  } catch {
54553
54474
  return false;
@@ -54831,7 +54752,7 @@ var RoutineError = class extends Error {
54831
54752
  }
54832
54753
  status;
54833
54754
  };
54834
- var ROUTINES_FILE = (0, import_node_path18.join)(flolessRoot, "routines.json");
54755
+ var ROUTINES_FILE = (0, import_node_path17.join)(flolessRoot, "routines.json");
54835
54756
  var routines = [];
54836
54757
  var loaded = false;
54837
54758
  function ensureLoaded() {
@@ -54867,10 +54788,10 @@ function sanitizeRoutine(raw) {
54867
54788
  };
54868
54789
  }
54869
54790
  function loadFromDisk() {
54870
- if (!(0, import_node_fs21.existsSync)(ROUTINES_FILE)) return [];
54791
+ if (!(0, import_node_fs20.existsSync)(ROUTINES_FILE)) return [];
54871
54792
  let text;
54872
54793
  try {
54873
- text = (0, import_node_fs21.readFileSync)(ROUTINES_FILE, "utf8");
54794
+ text = (0, import_node_fs20.readFileSync)(ROUTINES_FILE, "utf8");
54874
54795
  } catch {
54875
54796
  return [];
54876
54797
  }
@@ -54879,17 +54800,17 @@ function loadFromDisk() {
54879
54800
  return Array.isArray(parsed) ? parsed.map(sanitizeRoutine).filter((r) => r !== null) : [];
54880
54801
  } catch {
54881
54802
  try {
54882
- (0, import_node_fs21.renameSync)(ROUTINES_FILE, `${ROUTINES_FILE}.corrupt-${Date.now()}`);
54803
+ (0, import_node_fs20.renameSync)(ROUTINES_FILE, `${ROUTINES_FILE}.corrupt-${Date.now()}`);
54883
54804
  } catch {
54884
54805
  }
54885
54806
  return [];
54886
54807
  }
54887
54808
  }
54888
54809
  function saveRoutines() {
54889
- if (!(0, import_node_fs21.existsSync)(flolessRoot)) (0, import_node_fs21.mkdirSync)(flolessRoot, { recursive: true });
54810
+ if (!(0, import_node_fs20.existsSync)(flolessRoot)) (0, import_node_fs20.mkdirSync)(flolessRoot, { recursive: true });
54890
54811
  const tmp = `${ROUTINES_FILE}.${process.pid}.tmp`;
54891
- (0, import_node_fs21.writeFileSync)(tmp, JSON.stringify(routines, null, 2));
54892
- (0, import_node_fs21.renameSync)(tmp, ROUTINES_FILE);
54812
+ (0, import_node_fs20.writeFileSync)(tmp, JSON.stringify(routines, null, 2));
54813
+ (0, import_node_fs20.renameSync)(tmp, ROUTINES_FILE);
54893
54814
  }
54894
54815
  function listRoutines() {
54895
54816
  ensureLoaded();
@@ -55213,7 +55134,7 @@ async function runRoutine(id) {
55213
55134
  durationMs: Date.now() - startedAt.getTime()
55214
55135
  });
55215
55136
  try {
55216
- const report = withBadge(extractReportHtml(events, r.workflow));
55137
+ const report = withBadge(extractReportHtml(events));
55217
55138
  if (report?.html) {
55218
55139
  broadcast({ type: "routine-report", id: r.id, workflow: r.workflow, nodeId: report.nodeId, html: report.html });
55219
55140
  }
@@ -55297,13 +55218,13 @@ var AppLifecycleError = class extends Error {
55297
55218
  }
55298
55219
  };
55299
55220
  function appsDir() {
55300
- return process.env.AWARE_HOME ? (0, import_node_path19.join)(process.env.AWARE_HOME, "apps") : (0, import_node_path19.join)((0, import_node_os14.homedir)(), ".aware", "apps");
55221
+ return process.env.AWARE_HOME ? (0, import_node_path18.join)(process.env.AWARE_HOME, "apps") : (0, import_node_path18.join)((0, import_node_os13.homedir)(), ".aware", "apps");
55301
55222
  }
55302
55223
  function appDirPath(id) {
55303
- return (0, import_node_path19.join)(appsDir(), id);
55224
+ return (0, import_node_path18.join)(appsDir(), id);
55304
55225
  }
55305
55226
  function appInstalled(id) {
55306
- return APP_ID3.test(id) && (0, import_node_fs22.existsSync)(appDirPath(id));
55227
+ return APP_ID3.test(id) && (0, import_node_fs21.existsSync)(appDirPath(id));
55307
55228
  }
55308
55229
  function logCascade(what, e) {
55309
55230
  console.error(`[app-lifecycle] cascade step failed (${what}):`, e instanceof Error ? e.message : e);
@@ -55404,9 +55325,9 @@ function isGatedAwareRoute(url, method) {
55404
55325
 
55405
55326
  // autostart.mjs
55406
55327
  var import_node_child_process4 = require("node:child_process");
55407
- var import_node_fs23 = require("node:fs");
55408
- var import_node_os15 = require("node:os");
55409
- var import_node_path20 = require("node:path");
55328
+ var import_node_fs22 = require("node:fs");
55329
+ var import_node_os14 = require("node:os");
55330
+ var import_node_path19 = require("node:path");
55410
55331
 
55411
55332
  // teardown.mjs
55412
55333
  var RUN_KEY = "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run";
@@ -55518,8 +55439,8 @@ function removeLegacyRunKey() {
55518
55439
  }
55519
55440
  function logLine(msg) {
55520
55441
  try {
55521
- (0, import_node_fs23.mkdirSync)(logDir(), { recursive: true });
55522
- (0, import_node_fs23.appendFileSync)(logFilePath(), `${(/* @__PURE__ */ new Date()).toISOString()} ${msg}
55442
+ (0, import_node_fs22.mkdirSync)(logDir(), { recursive: true });
55443
+ (0, import_node_fs22.appendFileSync)(logFilePath(), `${(/* @__PURE__ */ new Date()).toISOString()} ${msg}
55523
55444
  `);
55524
55445
  } catch {
55525
55446
  }
@@ -55527,8 +55448,8 @@ function logLine(msg) {
55527
55448
  function registerAutostart(exePath) {
55528
55449
  if (!isWin) return;
55529
55450
  const xml = buildAutostartTaskXml(exePath, currentUserId());
55530
- const tmp = (0, import_node_path20.join)((0, import_node_os15.tmpdir)(), `floless-autostart-${process.pid}-${Date.now()}.xml`);
55531
- (0, import_node_fs23.writeFileSync)(tmp, "\uFEFF" + xml, { encoding: "utf16le" });
55451
+ const tmp = (0, import_node_path19.join)((0, import_node_os14.tmpdir)(), `floless-autostart-${process.pid}-${Date.now()}.xml`);
55452
+ (0, import_node_fs22.writeFileSync)(tmp, "\uFEFF" + xml, { encoding: "utf16le" });
55532
55453
  try {
55533
55454
  (0, import_node_child_process4.execFileSync)("schtasks", ["/Create", "/TN", TASK_NAME, "/XML", tmp, "/F"], {
55534
55455
  stdio: ["ignore", "ignore", "ignore"],
@@ -55539,7 +55460,7 @@ function registerAutostart(exePath) {
55539
55460
  throw err;
55540
55461
  } finally {
55541
55462
  try {
55542
- (0, import_node_fs23.rmSync)(tmp, { force: true });
55463
+ (0, import_node_fs22.rmSync)(tmp, { force: true });
55543
55464
  } catch {
55544
55465
  }
55545
55466
  }
@@ -55574,26 +55495,26 @@ function unregisterAutostart() {
55574
55495
  // updater.ts
55575
55496
  var import_node_child_process5 = require("node:child_process");
55576
55497
  var import_node_crypto6 = require("node:crypto");
55577
- var import_node_fs25 = require("node:fs");
55498
+ var import_node_fs24 = require("node:fs");
55578
55499
  var import_node_stream = require("node:stream");
55579
55500
  var import_promises = require("node:stream/promises");
55580
- var import_node_path22 = require("node:path");
55501
+ var import_node_path21 = require("node:path");
55581
55502
 
55582
55503
  // post-update-marker.mjs
55583
- var import_node_fs24 = require("node:fs");
55584
- var import_node_os16 = require("node:os");
55585
- var import_node_path21 = require("node:path");
55504
+ var import_node_fs23 = require("node:fs");
55505
+ var import_node_os15 = require("node:os");
55506
+ var import_node_path20 = require("node:path");
55586
55507
  var FRESH_MS = 12e4;
55587
55508
  function markerPath() {
55588
55509
  const override = (process.env.FLOLESS_POST_UPDATE_MARKER ?? "").trim();
55589
55510
  if (override) return override;
55590
- const root = process.env.FLOLESS_HOME ?? (0, import_node_path21.join)((0, import_node_os16.homedir)(), ".floless");
55591
- return (0, import_node_path21.join)(root, ".post-update");
55511
+ const root = process.env.FLOLESS_HOME ?? (0, import_node_path20.join)((0, import_node_os15.homedir)(), ".floless");
55512
+ return (0, import_node_path20.join)(root, ".post-update");
55592
55513
  }
55593
55514
  function legacyMarkerPath() {
55594
55515
  if ((process.env.FLOLESS_POST_UPDATE_MARKER ?? "").trim()) return null;
55595
55516
  try {
55596
- return (0, import_node_path21.join)((0, import_node_path21.dirname)((0, import_node_path21.dirname)(process.execPath)), ".floless-post-update");
55517
+ return (0, import_node_path20.join)((0, import_node_path20.dirname)((0, import_node_path20.dirname)(process.execPath)), ".floless-post-update");
55597
55518
  } catch {
55598
55519
  return null;
55599
55520
  }
@@ -55603,7 +55524,7 @@ function writePostUpdateMarker() {
55603
55524
  for (const p of [markerPath(), legacyMarkerPath()]) {
55604
55525
  if (!p) continue;
55605
55526
  try {
55606
- (0, import_node_fs24.writeFileSync)(p, (/* @__PURE__ */ new Date()).toISOString());
55527
+ (0, import_node_fs23.writeFileSync)(p, (/* @__PURE__ */ new Date()).toISOString());
55607
55528
  wrote = true;
55608
55529
  } catch {
55609
55530
  }
@@ -55615,9 +55536,9 @@ function consumePostUpdateMarker() {
55615
55536
  for (const p of [markerPath(), legacyMarkerPath()]) {
55616
55537
  if (!p) continue;
55617
55538
  try {
55618
- if (!(0, import_node_fs24.existsSync)(p)) continue;
55619
- const ageMs = Date.now() - (0, import_node_fs24.statSync)(p).mtimeMs;
55620
- (0, import_node_fs24.rmSync)(p, { force: true });
55539
+ if (!(0, import_node_fs23.existsSync)(p)) continue;
55540
+ const ageMs = Date.now() - (0, import_node_fs23.statSync)(p).mtimeMs;
55541
+ (0, import_node_fs23.rmSync)(p, { force: true });
55621
55542
  if (ageMs < FRESH_MS) fresh = true;
55622
55543
  } catch {
55623
55544
  }
@@ -55634,13 +55555,13 @@ function currentVersion() {
55634
55555
  return appVersion();
55635
55556
  }
55636
55557
  function installRoot() {
55637
- return (0, import_node_path22.dirname)((0, import_node_path22.dirname)(process.execPath));
55558
+ return (0, import_node_path21.dirname)((0, import_node_path21.dirname)(process.execPath));
55638
55559
  }
55639
55560
  function updateExePath() {
55640
- return (0, import_node_path22.join)(installRoot(), "Update.exe");
55561
+ return (0, import_node_path21.join)(installRoot(), "Update.exe");
55641
55562
  }
55642
55563
  function packagesDir() {
55643
- return (0, import_node_path22.join)(installRoot(), "packages");
55564
+ return (0, import_node_path21.join)(installRoot(), "packages");
55644
55565
  }
55645
55566
  function feedUrl() {
55646
55567
  const env2 = (process.env.FLOLESS_UPDATE_URL ?? "").trim().replace(/\/+$/, "");
@@ -55733,22 +55654,22 @@ async function checkForUpdate() {
55733
55654
  }
55734
55655
  async function sha1OfFile(path) {
55735
55656
  const hash = (0, import_node_crypto6.createHash)("sha1");
55736
- await (0, import_promises.pipeline)((0, import_node_fs25.createReadStream)(path), hash);
55657
+ await (0, import_promises.pipeline)((0, import_node_fs24.createReadStream)(path), hash);
55737
55658
  return hash.digest("hex").toUpperCase();
55738
55659
  }
55739
55660
  async function downloadPackage(asset) {
55740
55661
  if (!NUPKG_NAME.test(asset.FileName)) throw new Error(`refusing suspicious package name: ${asset.FileName}`);
55741
55662
  const want = asset.SHA1.toUpperCase();
55742
55663
  const dir = packagesDir();
55743
- (0, import_node_fs25.mkdirSync)(dir, { recursive: true });
55744
- const dest = (0, import_node_path22.join)(dir, asset.FileName);
55745
- if ((0, import_node_fs25.existsSync)(dest) && await sha1OfFile(dest) === want) return dest;
55664
+ (0, import_node_fs24.mkdirSync)(dir, { recursive: true });
55665
+ const dest = (0, import_node_path21.join)(dir, asset.FileName);
55666
+ if ((0, import_node_fs24.existsSync)(dest) && await sha1OfFile(dest) === want) return dest;
55746
55667
  const res = await authedFetch(`${feedUrl()}/${encodeURIComponent(asset.FileName)}`, {
55747
55668
  redirect: "follow",
55748
55669
  signal: AbortSignal.timeout(DOWNLOAD_TIMEOUT_MS)
55749
55670
  });
55750
55671
  if (!res.ok || !res.body) throw new Error(`download failed: HTTP ${res.status} for ${asset.FileName}`);
55751
- await (0, import_promises.pipeline)(import_node_stream.Readable.fromWeb(res.body), (0, import_node_fs25.createWriteStream)(dest));
55672
+ await (0, import_promises.pipeline)(import_node_stream.Readable.fromWeb(res.body), (0, import_node_fs24.createWriteStream)(dest));
55752
55673
  const got = await sha1OfFile(dest);
55753
55674
  if (got !== want) throw new Error(`SHA1 mismatch for ${asset.FileName}: feed=${want} got=${got}`);
55754
55675
  return dest;
@@ -55757,7 +55678,7 @@ async function applyUpdate(check, opts) {
55757
55678
  if (!check.supported) return { applied: false, message: check.reason ?? "auto-update not supported in this runtime" };
55758
55679
  if (!check.updateAvailable || !check.asset) return { applied: false, message: check.reason ?? "no update available" };
55759
55680
  const exe = updateExePath();
55760
- if (!(0, import_node_fs25.existsSync)(exe)) {
55681
+ if (!(0, import_node_fs24.existsSync)(exe)) {
55761
55682
  return { applied: false, message: `Update.exe not found at ${exe} \u2014 is this a Velopack install?` };
55762
55683
  }
55763
55684
  const pkg = await downloadPackage(check.asset);
@@ -55997,12 +55918,12 @@ function isTraceCorrupt(events) {
55997
55918
 
55998
55919
  // launch.mjs
55999
55920
  var import_node_child_process6 = require("node:child_process");
56000
- var import_node_path23 = require("node:path");
55921
+ var import_node_path22 = require("node:path");
56001
55922
  var import_node_url3 = require("node:url");
56002
- var import_node_fs26 = require("node:fs");
55923
+ var import_node_fs25 = require("node:fs");
56003
55924
  var import_node_http = __toESM(require("node:http"), 1);
56004
55925
  var import_node_readline = require("node:readline");
56005
- var __dirname2 = (0, import_node_path23.dirname)((0, import_node_url3.fileURLToPath)(__import_meta_url));
55926
+ var __dirname2 = (0, import_node_path22.dirname)((0, import_node_url3.fileURLToPath)(__import_meta_url));
56006
55927
  var PORT = Number(process.env.PORT ?? 4317);
56007
55928
  var HEALTH_URL = `http://127.0.0.1:${PORT}/api/health`;
56008
55929
  var BROWSER_URL = `http://floless.localhost:${PORT}`;
@@ -56074,8 +55995,8 @@ async function waitHealthy(timeoutMs = 3e4) {
56074
55995
  function resolveServerStart() {
56075
55996
  const packaged = /flolessapp\.exe$/i.test(process.execPath);
56076
55997
  if (packaged) return { cmd: process.execPath, args: ["--serve"], shell: false };
56077
- const bundle = (0, import_node_path23.join)(__dirname2, "dist", "floless-server.cjs");
56078
- if ((0, import_node_fs26.existsSync)(bundle)) return { cmd: process.execPath, args: [bundle, "--serve"], shell: false };
55998
+ const bundle = (0, import_node_path22.join)(__dirname2, "dist", "floless-server.cjs");
55999
+ if ((0, import_node_fs25.existsSync)(bundle)) return { cmd: process.execPath, args: [bundle, "--serve"], shell: false };
56079
56000
  return { cmd: "npm", args: ["run", "start"], shell: isWin2 };
56080
56001
  }
56081
56002
  function startServerDetached() {
@@ -56228,8 +56149,8 @@ function taskkillArgs(pid, { tree = true } = {}) {
56228
56149
  }
56229
56150
  function killSupervisor({ tree = true } = {}) {
56230
56151
  if (!isWin2) return;
56231
- const isNpmChannel = /^node(\.exe)?$/i.test((0, import_node_path23.basename)(process.execPath));
56232
- const scriptMatch = isNpmChannel ? (0, import_node_path23.basename)((0, import_node_url3.fileURLToPath)(__import_meta_url)) : void 0;
56152
+ const isNpmChannel = /^node(\.exe)?$/i.test((0, import_node_path22.basename)(process.execPath));
56153
+ const scriptMatch = isNpmChannel ? (0, import_node_path22.basename)((0, import_node_url3.fileURLToPath)(__import_meta_url)) : void 0;
56233
56154
  const realExe = resolveRealInstallExe(process.execPath);
56234
56155
  const exeMatch = realExe === process.execPath ? process.execPath : [process.execPath, realExe];
56235
56156
  const pids = supervisorPidsToKill(enumerateProcesses(), process.pid, exeMatch, scriptMatch);
@@ -56394,7 +56315,7 @@ async function runAction(arg, flagArgv = [], selfVersion = null) {
56394
56315
  }
56395
56316
  await action(parseTeardownFlags(flagArgv));
56396
56317
  }
56397
- var entry = (0, import_node_path23.basename)(process.argv[1] ?? "").toLowerCase();
56318
+ var entry = (0, import_node_path22.basename)(process.argv[1] ?? "").toLowerCase();
56398
56319
  if (entry === "launch.mjs") {
56399
56320
  runAction(process.argv[2], process.argv.slice(3)).catch((e) => {
56400
56321
  log(`error: ${e?.message ?? e}`);
@@ -56468,9 +56389,9 @@ function awareUpgradeBlockReason(s) {
56468
56389
  }
56469
56390
 
56470
56391
  // skill-sync.ts
56471
- var import_node_fs27 = require("node:fs");
56472
- var import_node_os17 = require("node:os");
56473
- var import_node_path24 = require("node:path");
56392
+ var import_node_fs26 = require("node:fs");
56393
+ var import_node_os16 = require("node:os");
56394
+ var import_node_path23 = require("node:path");
56474
56395
  var import_node_url4 = require("node:url");
56475
56396
  var import_yaml8 = __toESM(require_dist6(), 1);
56476
56397
 
@@ -56488,8 +56409,6 @@ var PRODUCT_SKILLS = [
56488
56409
  // file a diagnosed bug/idea/question to the private log via the floless.io relay
56489
56410
  "floless-app-routines",
56490
56411
  // author event-driven ("on trigger") routines
56491
- "floless-app-steel-from-drawings",
56492
- // read a steel drawing into an interactive 3D model (bake the viewer-3d scene)
56493
56412
  "floless-app-steel-takeoff",
56494
56413
  // read a steel drawing into an editable steel.takeoff/v1 contract (the Steel Takeoff reader)
56495
56414
  "floless-app-tweak-contract",
@@ -56505,30 +56424,30 @@ function selectShippedSkillNames(names) {
56505
56424
  }
56506
56425
 
56507
56426
  // skill-sync.ts
56508
- var __dirname3 = (0, import_node_path24.dirname)((0, import_node_url4.fileURLToPath)(__import_meta_url));
56427
+ var __dirname3 = (0, import_node_path23.dirname)((0, import_node_url4.fileURLToPath)(__import_meta_url));
56509
56428
  function bundledSkillsRoot() {
56510
56429
  const candidates = [
56511
- (0, import_node_path24.join)(__dirname3, "skills"),
56512
- (0, import_node_path24.join)((0, import_node_path24.dirname)(process.execPath), "skills"),
56513
- (0, import_node_path24.join)(__dirname3, "..", ".claude", "skills")
56430
+ (0, import_node_path23.join)(__dirname3, "skills"),
56431
+ (0, import_node_path23.join)((0, import_node_path23.dirname)(process.execPath), "skills"),
56432
+ (0, import_node_path23.join)(__dirname3, "..", ".claude", "skills")
56514
56433
  ];
56515
- return candidates.find((p) => (0, import_node_fs27.existsSync)(p)) ?? null;
56434
+ return candidates.find((p) => (0, import_node_fs26.existsSync)(p)) ?? null;
56516
56435
  }
56517
56436
  function targetConfigDirs() {
56518
56437
  const override = process.env.FLOLESS_SKILL_TARGETS;
56519
56438
  if (override) {
56520
56439
  return override.split(";").map((d) => d.trim()).filter(Boolean).map((dir) => ({ runtime: "custom", dir }));
56521
56440
  }
56522
- const home = (0, import_node_os17.homedir)();
56441
+ const home = (0, import_node_os16.homedir)();
56523
56442
  return [
56524
- { runtime: "claude", dir: (0, import_node_path24.join)(home, ".claude") },
56525
- { runtime: "codex", dir: (0, import_node_path24.join)(home, ".codex") },
56526
- { runtime: "opencode", dir: (0, import_node_path24.join)(home, ".opencode") }
56443
+ { runtime: "claude", dir: (0, import_node_path23.join)(home, ".claude") },
56444
+ { runtime: "codex", dir: (0, import_node_path23.join)(home, ".codex") },
56445
+ { runtime: "opencode", dir: (0, import_node_path23.join)(home, ".opencode") }
56527
56446
  ];
56528
56447
  }
56529
56448
  function skillVersion(skillMdPath) {
56530
56449
  try {
56531
- const text = (0, import_node_fs27.readFileSync)(skillMdPath, "utf8");
56450
+ const text = (0, import_node_fs26.readFileSync)(skillMdPath, "utf8");
56532
56451
  const m = /^---\r?\n([\s\S]*?)\r?\n---/.exec(text);
56533
56452
  if (!m || m[1] === void 0) return null;
56534
56453
  const fm = (0, import_yaml8.parse)(m[1]);
@@ -56568,21 +56487,21 @@ function decideAction(installed, bundled) {
56568
56487
  function bundledSkills(root) {
56569
56488
  let entries = [];
56570
56489
  try {
56571
- entries = selectShippedSkillNames((0, import_node_fs27.readdirSync)(root));
56490
+ entries = selectShippedSkillNames((0, import_node_fs26.readdirSync)(root));
56572
56491
  } catch {
56573
56492
  return [];
56574
56493
  }
56575
56494
  const out = [];
56576
56495
  for (const name of entries) {
56577
- const dir = (0, import_node_path24.join)(root, name);
56496
+ const dir = (0, import_node_path23.join)(root, name);
56578
56497
  let isDir = false;
56579
56498
  try {
56580
- isDir = (0, import_node_fs27.statSync)(dir).isDirectory();
56499
+ isDir = (0, import_node_fs26.statSync)(dir).isDirectory();
56581
56500
  } catch {
56582
56501
  isDir = false;
56583
56502
  }
56584
56503
  if (!isDir) continue;
56585
- const v = skillVersion((0, import_node_path24.join)(dir, "SKILL.md"));
56504
+ const v = skillVersion((0, import_node_path23.join)(dir, "SKILL.md"));
56586
56505
  if (!v) continue;
56587
56506
  out.push({ name, dir, version: v });
56588
56507
  }
@@ -56595,17 +56514,17 @@ function syncSkills() {
56595
56514
  const skills = bundledSkills(root);
56596
56515
  if (!skills.length) return results;
56597
56516
  for (const { runtime, dir: cfg } of targetConfigDirs()) {
56598
- if (!(0, import_node_fs27.existsSync)(cfg)) continue;
56599
- const skillsDir = (0, import_node_path24.join)(cfg, "skills");
56517
+ if (!(0, import_node_fs26.existsSync)(cfg)) continue;
56518
+ const skillsDir = (0, import_node_path23.join)(cfg, "skills");
56600
56519
  for (const s of skills) {
56601
- const dest = (0, import_node_path24.join)(skillsDir, s.name);
56602
- const installedMd = (0, import_node_path24.join)(dest, "SKILL.md");
56603
- const installed = (0, import_node_fs27.existsSync)(installedMd) ? skillVersion(installedMd) : null;
56520
+ const dest = (0, import_node_path23.join)(skillsDir, s.name);
56521
+ const installedMd = (0, import_node_path23.join)(dest, "SKILL.md");
56522
+ const installed = (0, import_node_fs26.existsSync)(installedMd) ? skillVersion(installedMd) : null;
56604
56523
  const action = decideAction(installed, s.version);
56605
56524
  if (action === "installed" || action === "updated") {
56606
56525
  try {
56607
- if (action === "updated") (0, import_node_fs27.rmSync)(dest, { recursive: true, force: true });
56608
- (0, import_node_fs27.cpSync)(s.dir, dest, { recursive: true });
56526
+ if (action === "updated") (0, import_node_fs26.rmSync)(dest, { recursive: true, force: true });
56527
+ (0, import_node_fs26.cpSync)(s.dir, dest, { recursive: true });
56609
56528
  results.push({ runtime, skill: s.name, action, from: installed, to: s.version });
56610
56529
  } catch {
56611
56530
  }
@@ -56618,9 +56537,9 @@ function syncSkills() {
56618
56537
  }
56619
56538
 
56620
56539
  // watch.ts
56621
- var import_node_os18 = require("node:os");
56622
- var import_node_path26 = require("node:path");
56623
- var import_node_fs28 = require("node:fs");
56540
+ var import_node_os17 = require("node:os");
56541
+ var import_node_path25 = require("node:path");
56542
+ var import_node_fs27 = require("node:fs");
56624
56543
 
56625
56544
  // node_modules/chokidar/esm/index.js
56626
56545
  var import_fs2 = require("fs");
@@ -56631,7 +56550,7 @@ var sysPath2 = __toESM(require("path"), 1);
56631
56550
  // node_modules/readdirp/esm/index.js
56632
56551
  var import_promises2 = require("node:fs/promises");
56633
56552
  var import_node_stream2 = require("node:stream");
56634
- var import_node_path25 = require("node:path");
56553
+ var import_node_path24 = require("node:path");
56635
56554
  var EntryTypes = {
56636
56555
  FILE_TYPE: "files",
56637
56556
  DIR_TYPE: "directories",
@@ -56706,7 +56625,7 @@ var ReaddirpStream = class extends import_node_stream2.Readable {
56706
56625
  this._wantsDir = type ? DIR_TYPES.has(type) : false;
56707
56626
  this._wantsFile = type ? FILE_TYPES.has(type) : false;
56708
56627
  this._wantsEverything = type === EntryTypes.EVERYTHING_TYPE;
56709
- this._root = (0, import_node_path25.resolve)(root);
56628
+ this._root = (0, import_node_path24.resolve)(root);
56710
56629
  this._isDirent = !opts.alwaysStat;
56711
56630
  this._statsProp = this._isDirent ? "dirent" : "stats";
56712
56631
  this._rdOptions = { encoding: "utf8", withFileTypes: this._isDirent };
@@ -56777,8 +56696,8 @@ var ReaddirpStream = class extends import_node_stream2.Readable {
56777
56696
  let entry2;
56778
56697
  const basename5 = this._isDirent ? dirent.name : dirent;
56779
56698
  try {
56780
- const fullPath = (0, import_node_path25.resolve)((0, import_node_path25.join)(path, basename5));
56781
- entry2 = { path: (0, import_node_path25.relative)(this._root, fullPath), fullPath, basename: basename5 };
56699
+ const fullPath = (0, import_node_path24.resolve)((0, import_node_path24.join)(path, basename5));
56700
+ entry2 = { path: (0, import_node_path24.relative)(this._root, fullPath), fullPath, basename: basename5 };
56782
56701
  entry2[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
56783
56702
  } catch (err) {
56784
56703
  this._onError(err);
@@ -56812,7 +56731,7 @@ var ReaddirpStream = class extends import_node_stream2.Readable {
56812
56731
  }
56813
56732
  if (entryRealPathStats.isDirectory()) {
56814
56733
  const len2 = entryRealPath.length;
56815
- if (full.startsWith(entryRealPath) && full.substr(len2, 1) === import_node_path25.sep) {
56734
+ if (full.startsWith(entryRealPath) && full.substr(len2, 1) === import_node_path24.sep) {
56816
56735
  const recursiveError = new Error(`Circular symlink detected: "${full}" points to "${entryRealPath}"`);
56817
56736
  recursiveError.code = RECURSIVE_ERROR_CODE;
56818
56737
  return this._onError(recursiveError);
@@ -58320,33 +58239,33 @@ function appIdFromLogPath(path) {
58320
58239
  return i >= 0 && parts[i + 1] ? parts[i + 1] : null;
58321
58240
  }
58322
58241
  function samePath(a, b) {
58323
- const ra = (0, import_node_path26.resolve)(a);
58324
- const rb = (0, import_node_path26.resolve)(b);
58242
+ const ra = (0, import_node_path25.resolve)(a);
58243
+ const rb = (0, import_node_path25.resolve)(b);
58325
58244
  return process.platform === "win32" ? ra.toLowerCase() === rb.toLowerCase() : ra === rb;
58326
58245
  }
58327
58246
  function underDir(path, dir) {
58328
- const rp = (0, import_node_path26.resolve)(path);
58329
- const rd = (0, import_node_path26.resolve)(dir);
58247
+ const rp = (0, import_node_path25.resolve)(path);
58248
+ const rd = (0, import_node_path25.resolve)(dir);
58330
58249
  const [p, d] = process.platform === "win32" ? [rp.toLowerCase(), rd.toLowerCase()] : [rp, rd];
58331
- return p === d || p.startsWith(d + import_node_path26.sep);
58250
+ return p === d || p.startsWith(d + import_node_path25.sep);
58332
58251
  }
58333
58252
  function startWatcher() {
58334
- const awareDir = process.env.AWARE_HOME ?? (0, import_node_path26.join)((0, import_node_os18.homedir)(), ".aware");
58335
- const credentialsDir = (0, import_node_path26.join)(awareDir, "credentials");
58336
- if (!(0, import_node_fs28.existsSync)(credentialsDir)) {
58253
+ const awareDir = process.env.AWARE_HOME ?? (0, import_node_path25.join)((0, import_node_os17.homedir)(), ".aware");
58254
+ const credentialsDir = (0, import_node_path25.join)(awareDir, "credentials");
58255
+ if (!(0, import_node_fs27.existsSync)(credentialsDir)) {
58337
58256
  try {
58338
- (0, import_node_fs28.mkdirSync)(credentialsDir, { recursive: true });
58257
+ (0, import_node_fs27.mkdirSync)(credentialsDir, { recursive: true });
58339
58258
  } catch {
58340
58259
  }
58341
58260
  }
58342
- if (!(0, import_node_fs28.existsSync)(uiDir)) {
58261
+ if (!(0, import_node_fs27.existsSync)(uiDir)) {
58343
58262
  try {
58344
- (0, import_node_fs28.mkdirSync)(uiDir, { recursive: true });
58263
+ (0, import_node_fs27.mkdirSync)(uiDir, { recursive: true });
58345
58264
  } catch {
58346
58265
  }
58347
58266
  }
58348
- const targets = ["apps", "logs", "credentials"].map((d) => (0, import_node_path26.join)(awareDir, d)).filter((p) => (0, import_node_fs28.existsSync)(p));
58349
- if ((0, import_node_fs28.existsSync)(uiDir)) targets.push(uiDir);
58267
+ const targets = ["apps", "logs", "credentials"].map((d) => (0, import_node_path25.join)(awareDir, d)).filter((p) => (0, import_node_fs27.existsSync)(p));
58268
+ if ((0, import_node_fs27.existsSync)(uiDir)) targets.push(uiDir);
58350
58269
  if (targets.length === 0) {
58351
58270
  return null;
58352
58271
  }
@@ -58375,11 +58294,11 @@ function startWatcher() {
58375
58294
  const isCredential = path.split(/[\\/]/).includes("credentials");
58376
58295
  const kind = isCredential ? "credential" : path.endsWith(".jsonl") ? "trace" : path.endsWith(".lock") ? "lock" : path.endsWith(".flo") || path.endsWith(".app") ? "source" : "file";
58377
58296
  broadcast({ type: "fs-change", kind, event, path });
58378
- if (kind === "trace" && event !== "unlink" && (0, import_node_fs28.existsSync)(path)) {
58297
+ if (kind === "trace" && event !== "unlink" && (0, import_node_fs27.existsSync)(path)) {
58379
58298
  const id = appIdFromLogPath(path);
58380
58299
  if (!id) return;
58381
58300
  try {
58382
- broadcast({ type: "trace-file", id, runId: path.split(import_node_path26.sep).pop()?.replace(/\.jsonl$/, "") ?? null, events: parseTrace((0, import_node_fs28.readFileSync)(path, "utf8")) });
58301
+ broadcast({ type: "trace-file", id, runId: path.split(import_node_path25.sep).pop()?.replace(/\.jsonl$/, "") ?? null, events: parseTrace((0, import_node_fs27.readFileSync)(path, "utf8")) });
58383
58302
  } catch {
58384
58303
  }
58385
58304
  }
@@ -58388,10 +58307,10 @@ function startWatcher() {
58388
58307
  }
58389
58308
 
58390
58309
  // index.ts
58391
- var __dirname4 = (0, import_node_path27.dirname)((0, import_node_url5.fileURLToPath)(__import_meta_url));
58392
- var WEB_ROOT = [(0, import_node_path27.join)(__dirname4, "web"), (0, import_node_path27.join)((0, import_node_path27.dirname)(process.execPath), "web"), (0, import_node_path27.join)(__dirname4, "..", "web")].find(
58393
- (p) => (0, import_node_fs29.existsSync)(p)
58394
- ) ?? (0, import_node_path27.join)(__dirname4, "..", "web");
58310
+ var __dirname4 = (0, import_node_path26.dirname)((0, import_node_url5.fileURLToPath)(__import_meta_url));
58311
+ var WEB_ROOT = [(0, import_node_path26.join)(__dirname4, "web"), (0, import_node_path26.join)((0, import_node_path26.dirname)(process.execPath), "web"), (0, import_node_path26.join)(__dirname4, "..", "web")].find(
58312
+ (p) => (0, import_node_fs28.existsSync)(p)
58313
+ ) ?? (0, import_node_path26.join)(__dirname4, "..", "web");
58395
58314
  var PORT2 = Number(process.env.PORT ?? 4317);
58396
58315
  var HOST = "127.0.0.1";
58397
58316
  var crashHandlersInstalled = false;
@@ -58407,7 +58326,7 @@ function installCrashHandlers() {
58407
58326
  ${stack}
58408
58327
  `;
58409
58328
  try {
58410
- (0, import_node_fs29.appendFileSync)(logFilePath(), line);
58329
+ (0, import_node_fs28.appendFileSync)(logFilePath(), line);
58411
58330
  } catch {
58412
58331
  }
58413
58332
  if (process.stderr.isTTY) process.stderr.write(line);
@@ -58705,7 +58624,7 @@ async function startServer() {
58705
58624
  return reply.status(409).send({ ok: false, error: `"${id}" is already at ${fromVersion}`, code: "up-to-date" });
58706
58625
  }
58707
58626
  const contract = readContract(id);
58708
- if (contract == null && (0, import_node_fs29.existsSync)(contractPath(id))) {
58627
+ if (contract == null && (0, import_node_fs28.existsSync)(contractPath(id))) {
58709
58628
  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" });
58710
58629
  }
58711
58630
  if (contract != null) {
@@ -58715,9 +58634,9 @@ async function startServer() {
58715
58634
  _wfUpdating.add(id);
58716
58635
  const bdir = backupDir(id, fromVersion, Date.now());
58717
58636
  try {
58718
- (0, import_node_fs29.mkdirSync)((0, import_node_path27.dirname)(bdir), { recursive: true });
58719
- (0, import_node_fs29.cpSync)(appDirPath2, bdir, { recursive: true });
58720
- (0, import_node_fs29.cpSync)(t.path, srcPath);
58637
+ (0, import_node_fs28.mkdirSync)((0, import_node_path26.dirname)(bdir), { recursive: true });
58638
+ (0, import_node_fs28.cpSync)(appDirPath2, bdir, { recursive: true });
58639
+ (0, import_node_fs28.cpSync)(t.path, srcPath);
58721
58640
  if (contract != null) {
58722
58641
  bakeContractIntoApp(srcPath, contract);
58723
58642
  bakeDownstream(srcPath, contract);
@@ -58728,8 +58647,8 @@ async function startServer() {
58728
58647
  } catch (e) {
58729
58648
  const msg = e instanceof Error ? e.message : String(e);
58730
58649
  try {
58731
- (0, import_node_fs29.rmSync)(appDirPath2, { recursive: true, force: true });
58732
- (0, import_node_fs29.cpSync)(bdir, appDirPath2, { recursive: true });
58650
+ (0, import_node_fs28.rmSync)(appDirPath2, { recursive: true, force: true });
58651
+ (0, import_node_fs28.cpSync)(bdir, appDirPath2, { recursive: true });
58733
58652
  } catch (re) {
58734
58653
  const rmsg = re instanceof Error ? re.message : String(re);
58735
58654
  return reply.status(500).send({ ok: false, error: `update failed (${msg}) AND rollback failed (${rmsg}) \u2014 restore manually from ${bdir}`, code: "rollback-failed", backupPath: bdir });
@@ -58855,9 +58774,9 @@ async function startServer() {
58855
58774
  return { ok: true, app: readApp(req.params.id) };
58856
58775
  });
58857
58776
  app.get("/api/contract/:appId", async (req, reply) => {
58858
- const doc2 = readContractForApp(req.params.appId);
58859
- if (doc2 == null) return reply.status(404).send({ ok: false, error: "no contract for this app yet" });
58860
- return doc2;
58777
+ const doc = readContractForApp(req.params.appId);
58778
+ if (doc == null) return reply.status(404).send({ ok: false, error: "no contract for this app yet" });
58779
+ return doc;
58861
58780
  });
58862
58781
  app.put(
58863
58782
  "/api/contract/:appId",
@@ -58875,14 +58794,14 @@ async function startServer() {
58875
58794
  }
58876
58795
  );
58877
58796
  app.post("/api/contract/:appId/approve", async (req, reply) => {
58878
- const doc2 = readContract(req.params.appId);
58879
- if (doc2 == null) return reply.status(404).send({ ok: false, error: "no contract to approve" });
58880
- const v = validateSteelTakeoff(doc2);
58797
+ const doc = readContract(req.params.appId);
58798
+ if (doc == null) return reply.status(404).send({ ok: false, error: "no contract to approve" });
58799
+ const v = validateSteelTakeoff(doc);
58881
58800
  if (!v.valid) return reply.status(400).send({ ok: false, error: "stored contract is invalid \u2014 re-save it in the editor" });
58882
58801
  const sourcePath = readApp(req.params.appId).source.path;
58883
58802
  try {
58884
- bakeContractIntoApp(sourcePath, doc2);
58885
- bakeDownstream(sourcePath, doc2);
58803
+ bakeContractIntoApp(sourcePath, doc);
58804
+ bakeDownstream(sourcePath, doc);
58886
58805
  } catch (e) {
58887
58806
  return reply.status(422).send({ ok: false, error: e instanceof Error ? e.message : "bake failed" });
58888
58807
  }
@@ -58903,14 +58822,14 @@ async function startServer() {
58903
58822
  { bodyLimit: 25 * 1024 * 1024 },
58904
58823
  // contracts embed rasters (matches /scene + PUT) — the editor/host-AI POSTs the live contract to score
58905
58824
  async (req, reply) => {
58906
- const doc2 = req.body && "contract" in req.body ? req.body.contract : readContract(req.params.appId);
58907
- if (doc2 == null) return reply.status(404).send({ ok: false, error: "no contract to score" });
58908
- const v = validateSteelTakeoff(doc2);
58825
+ const doc = req.body && "contract" in req.body ? req.body.contract : readContract(req.params.appId);
58826
+ if (doc == null) return reply.status(404).send({ ok: false, error: "no contract to score" });
58827
+ const v = validateSteelTakeoff(doc);
58909
58828
  if (!v.valid) {
58910
58829
  const first = v.errors[0];
58911
58830
  return reply.status(400).send({ ok: false, error: `contract failed schema validation \u2014 ${first ? `${first.path}: ${first.message}` : "invalid"}` });
58912
58831
  }
58913
- const docTarget = doc2 && typeof doc2 === "object" ? doc2.target_confidence : void 0;
58832
+ const docTarget = doc && typeof doc === "object" ? doc.target_confidence : void 0;
58914
58833
  let appDefault = 70;
58915
58834
  try {
58916
58835
  const inp = readApp(req.params.appId).inputs.find((i) => i.name === "target_confidence");
@@ -58918,7 +58837,7 @@ async function startServer() {
58918
58837
  } catch {
58919
58838
  }
58920
58839
  const target = typeof req.body?.target === "number" ? req.body.target : typeof docTarget === "number" ? docTarget : appDefault;
58921
- const result = scoreContract2(doc2);
58840
+ const result = scoreContract2(doc);
58922
58841
  const meetsTarget = result.score != null && result.score >= target;
58923
58842
  return {
58924
58843
  ok: true,
@@ -58934,14 +58853,14 @@ async function startServer() {
58934
58853
  { bodyLimit: 25 * 1024 * 1024 },
58935
58854
  // contracts embed rasters (matches PUT /api/contract) — the editor POSTs the live contract on every 3D rebuild
58936
58855
  async (req, reply) => {
58937
- const doc2 = req.body && "contract" in req.body ? req.body.contract : readContract(req.params.appId);
58938
- if (doc2 == null) return reply.status(404).send({ ok: false, error: "no contract to render" });
58939
- const v = validateSteelTakeoff(doc2);
58856
+ const doc = req.body && "contract" in req.body ? req.body.contract : readContract(req.params.appId);
58857
+ if (doc == null) return reply.status(404).send({ ok: false, error: "no contract to render" });
58858
+ const v = validateSteelTakeoff(doc);
58940
58859
  if (!v.valid) {
58941
58860
  const first = v.errors[0];
58942
58861
  return reply.status(400).send({ ok: false, error: `contract failed schema validation \u2014 ${first ? `${first.path}: ${first.message}` : "invalid"}` });
58943
58862
  }
58944
- return { ok: true, ...contractToScene(doc2) };
58863
+ return { ok: true, ...contractToScene(doc) };
58945
58864
  }
58946
58865
  );
58947
58866
  function awareStderr(e) {
@@ -58952,11 +58871,11 @@ async function startServer() {
58952
58871
  return null;
58953
58872
  }
58954
58873
  app.post("/api/contract/:appId/export-3d", async (req, reply) => {
58955
- const doc2 = readContract(req.params.appId);
58956
- if (doc2 == null) return reply.status(404).send({ ok: false, error: "no contract to export" });
58957
- const v = validateSteelTakeoff(doc2);
58874
+ const doc = readContract(req.params.appId);
58875
+ if (doc == null) return reply.status(404).send({ ok: false, error: "no contract to export" });
58876
+ const v = validateSteelTakeoff(doc);
58958
58877
  if (!v.valid) return reply.status(400).send({ ok: false, error: "stored contract is invalid \u2014 re-save it in the editor" });
58959
- const { scene, skipped } = contractToScene(doc2);
58878
+ const { scene, skipped } = contractToScene(doc);
58960
58879
  if (scene.elements.length === 0) {
58961
58880
  return reply.status(422).send({ ok: false, error: "no resolvable members to render \u2014 every member is an RFI (no AISC size yet)", skipped });
58962
58881
  }
@@ -58985,23 +58904,23 @@ async function startServer() {
58985
58904
  throw e;
58986
58905
  }
58987
58906
  const events = result.traceText ? parseTrace(result.traceText) : [];
58988
- const extracted = extractReportHtml(events, companionId);
58907
+ const extracted = extractReportHtml(events);
58989
58908
  if (!extracted) return reply.send({ ok: false, error: "the 3D render produced no html" });
58990
58909
  broadcast({ type: "apps-changed" });
58991
58910
  return { ok: true, report: { ...extracted, interactive: true }, skipped };
58992
58911
  });
58993
58912
  app.post("/api/contract/:appId/export-ifc", async (req, reply) => {
58994
- const doc2 = readContract(req.params.appId);
58995
- if (doc2 == null) return reply.status(404).send({ ok: false, error: "no contract to export" });
58996
- const v = validateSteelTakeoff(doc2);
58913
+ const doc = readContract(req.params.appId);
58914
+ if (doc == null) return reply.status(404).send({ ok: false, error: "no contract to export" });
58915
+ const v = validateSteelTakeoff(doc);
58997
58916
  if (!v.valid) return reply.status(400).send({ ok: false, error: "stored contract is invalid \u2014 re-save it in the editor" });
58998
- const { scene, skipped } = contractToScene(doc2);
58917
+ const { scene, skipped } = contractToScene(doc);
58999
58918
  if (scene.elements.length === 0) {
59000
58919
  return reply.status(422).send({ ok: false, error: "no resolvable members to export \u2014 every member is an RFI (no AISC size yet)", skipped });
59001
58920
  }
59002
58921
  const companionId = `${req.params.appId}-ifc`;
59003
58922
  const filename = `${req.params.appId}.ifc`;
59004
- const outPath = (0, import_node_path27.join)(appPath(companionId), filename);
58923
+ const outPath = (0, import_node_path26.join)(appPath(companionId), filename);
59005
58924
  let flo;
59006
58925
  try {
59007
58926
  flo = writeIfcApp(appPath(companionId), companionId, scene, outPath);
@@ -59024,17 +58943,17 @@ async function startServer() {
59024
58943
  }
59025
58944
  throw e;
59026
58945
  }
59027
- if (!(0, import_node_fs29.existsSync)(outPath)) return reply.send({ ok: false, error: "the IFC export produced no file" });
59028
- const content = (0, import_node_fs29.readFileSync)(outPath, "utf8");
58946
+ if (!(0, import_node_fs28.existsSync)(outPath)) return reply.send({ ok: false, error: "the IFC export produced no file" });
58947
+ const content = (0, import_node_fs28.readFileSync)(outPath, "utf8");
59029
58948
  broadcast({ type: "apps-changed" });
59030
58949
  return { ok: true, filename, content, bytes: Buffer.byteLength(content), skipped };
59031
58950
  });
59032
58951
  app.post("/api/contract/:appId/export-tekla", async (req, reply) => {
59033
- const doc2 = readContract(req.params.appId);
59034
- if (doc2 == null) return reply.status(404).send({ ok: false, error: "no contract to bake" });
59035
- const v = validateSteelTakeoff(doc2);
58952
+ const doc = readContract(req.params.appId);
58953
+ if (doc == null) return reply.status(404).send({ ok: false, error: "no contract to bake" });
58954
+ const v = validateSteelTakeoff(doc);
59036
58955
  if (!v.valid) return reply.status(400).send({ ok: false, error: "stored contract is invalid \u2014 re-save it in the editor" });
59037
- const { scene, skipped } = contractToScene(doc2);
58956
+ const { scene, skipped } = contractToScene(doc);
59038
58957
  if (scene.elements.length === 0) {
59039
58958
  return reply.status(422).send({ ok: false, error: "no resolvable members to bake \u2014 every member is an RFI (no AISC size yet)", skipped });
59040
58959
  }
@@ -59174,11 +59093,11 @@ async function startServer() {
59174
59093
  if (appExists(id)) {
59175
59094
  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 });
59176
59095
  }
59177
- const stageRoot = (0, import_node_fs29.mkdtempSync)((0, import_node_path27.join)((0, import_node_os19.tmpdir)(), "floless-import-"));
59096
+ const stageRoot = (0, import_node_fs28.mkdtempSync)((0, import_node_path26.join)((0, import_node_os18.tmpdir)(), "floless-import-"));
59178
59097
  try {
59179
- const stageDir = (0, import_node_path27.join)(stageRoot, id);
59180
- (0, import_node_fs29.mkdirSync)(stageDir);
59181
- (0, import_node_fs29.writeFileSync)((0, import_node_path27.join)(stageDir, `${id}.flo`), content);
59098
+ const stageDir = (0, import_node_path26.join)(stageRoot, id);
59099
+ (0, import_node_fs28.mkdirSync)(stageDir);
59100
+ (0, import_node_fs28.writeFileSync)((0, import_node_path26.join)(stageDir, `${id}.flo`), content);
59182
59101
  await aware.install(stageDir);
59183
59102
  } catch (err) {
59184
59103
  try {
@@ -59188,7 +59107,7 @@ async function startServer() {
59188
59107
  const msg = err instanceof AwareError ? err.message : String(err?.message ?? err);
59189
59108
  return reply.status(502).send({ ok: false, error: `import failed: ${msg}` });
59190
59109
  } finally {
59191
- (0, import_node_fs29.rmSync)(stageRoot, { recursive: true, force: true });
59110
+ (0, import_node_fs28.rmSync)(stageRoot, { recursive: true, force: true });
59192
59111
  }
59193
59112
  broadcast({ type: "apps-changed", id });
59194
59113
  return { ok: true, id };
@@ -59202,13 +59121,13 @@ async function startServer() {
59202
59121
  }
59203
59122
  const inputs = appData.inputs.map((i) => ({ name: i.name, type: i.type }));
59204
59123
  const baked = bakeFloSource(appData.source.text, inputs);
59205
- const tmpRoot = (0, import_node_fs29.mkdtempSync)((0, import_node_path27.join)((0, import_node_os19.tmpdir)(), "floless-bake-"));
59206
- const backupDir2 = (0, import_node_path27.join)(tmpRoot, `${id}-backup`);
59207
- const bakeDir = (0, import_node_path27.join)(tmpRoot, id);
59208
- (0, import_node_fs29.cpSync)(appDir(id), backupDir2, { recursive: true });
59209
- (0, import_node_fs29.cpSync)(appDir(id), bakeDir, { recursive: true });
59124
+ const tmpRoot = (0, import_node_fs28.mkdtempSync)((0, import_node_path26.join)((0, import_node_os18.tmpdir)(), "floless-bake-"));
59125
+ const backupDir2 = (0, import_node_path26.join)(tmpRoot, `${id}-backup`);
59126
+ const bakeDir = (0, import_node_path26.join)(tmpRoot, id);
59127
+ (0, import_node_fs28.cpSync)(appDir(id), backupDir2, { recursive: true });
59128
+ (0, import_node_fs28.cpSync)(appDir(id), bakeDir, { recursive: true });
59210
59129
  const floName = appData.source.path.split(/[\\/]/).pop();
59211
- (0, import_node_fs29.writeFileSync)((0, import_node_path27.join)(bakeDir, floName), baked);
59130
+ (0, import_node_fs28.writeFileSync)((0, import_node_path26.join)(bakeDir, floName), baked);
59212
59131
  let appInstalled2 = true;
59213
59132
  try {
59214
59133
  await aware.uninstall(id);
@@ -59230,17 +59149,17 @@ async function startServer() {
59230
59149
  throw installErr;
59231
59150
  }
59232
59151
  try {
59233
- await aware.compile((0, import_node_path27.join)(appDir(id), floName));
59152
+ await aware.compile((0, import_node_path26.join)(appDir(id), floName));
59234
59153
  } catch (compileErr) {
59235
59154
  app.log.warn({ id, compileErr: String(compileErr) }, "bake: post-install recompile failed (app baked but may need a manual Compile)");
59236
59155
  }
59237
59156
  broadcast({ type: "baked", id });
59238
59157
  return { ok: true, id, agent: id, inputs };
59239
59158
  } finally {
59240
- if (appInstalled2) (0, import_node_fs29.rmSync)(tmpRoot, { recursive: true, force: true });
59159
+ if (appInstalled2) (0, import_node_fs28.rmSync)(tmpRoot, { recursive: true, force: true });
59241
59160
  }
59242
59161
  });
59243
- const graftAgentsDir = () => (0, import_node_path27.join)((0, import_node_os19.homedir)(), ".aware", "agents");
59162
+ const graftAgentsDir = () => (0, import_node_path26.join)((0, import_node_os18.homedir)(), ".aware", "agents");
59244
59163
  app.post("/api/graft/match", async (req, reply) => {
59245
59164
  const { glob } = req.body ?? {};
59246
59165
  if (!glob) return reply.status(400).send({ ok: false, error: "glob required" });
@@ -59257,7 +59176,7 @@ async function startServer() {
59257
59176
  if (!sourceKind || !sourceRef) {
59258
59177
  return reply.status(400).send({ ok: false, error: "sourceKind and sourceRef required" });
59259
59178
  }
59260
- const tempHome = (0, import_node_fs29.mkdtempSync)((0, import_node_path27.join)((0, import_node_os19.tmpdir)(), "floless-graft-"));
59179
+ const tempHome = (0, import_node_fs28.mkdtempSync)((0, import_node_path26.join)((0, import_node_os18.tmpdir)(), "floless-graft-"));
59261
59180
  let result;
59262
59181
  try {
59263
59182
  result = await aware.build({
@@ -59270,19 +59189,19 @@ async function startServer() {
59270
59189
  awareHome: tempHome
59271
59190
  });
59272
59191
  } catch (err) {
59273
- (0, import_node_fs29.rmSync)(tempHome, { recursive: true, force: true });
59192
+ (0, import_node_fs28.rmSync)(tempHome, { recursive: true, force: true });
59274
59193
  const msg = err instanceof AwareError ? err.message : String(err?.message ?? err);
59275
59194
  return reply.status(422).send({ ok: false, error: msg });
59276
59195
  }
59277
59196
  const manifest = readStagedManifest(result.agentDir);
59278
59197
  if (!manifest) {
59279
- (0, import_node_fs29.rmSync)(tempHome, { recursive: true, force: true });
59198
+ (0, import_node_fs28.rmSync)(tempHome, { recursive: true, force: true });
59280
59199
  return reply.status(502).send({ ok: false, error: `build produced output at ${result.agentDir} but no manifest.yaml` });
59281
59200
  }
59282
59201
  const token = (0, import_node_crypto7.randomUUID)();
59283
59202
  registerStage(token, tempHome, result.agentId);
59284
59203
  const preview = buildPreview(manifest, sourceKind, sourceRef, token);
59285
- if ((0, import_node_fs29.existsSync)((0, import_node_path27.join)(graftAgentsDir(), result.agentId))) {
59204
+ if ((0, import_node_fs28.existsSync)((0, import_node_path26.join)(graftAgentsDir(), result.agentId))) {
59286
59205
  preview.warnings.unshift(`An agent named "${result.agentId}" is already installed \u2014 creating it will overwrite it.`);
59287
59206
  }
59288
59207
  return { ok: true, preview };
@@ -59301,7 +59220,7 @@ async function startServer() {
59301
59220
  registerStage(stagedRef, stage.tempDir, stage.agentId);
59302
59221
  return reply.status(409).send({ ok: false, error: err.message, agentId: stage.agentId, collision: true });
59303
59222
  }
59304
- (0, import_node_fs29.rmSync)(stage.tempDir, { recursive: true, force: true });
59223
+ (0, import_node_fs28.rmSync)(stage.tempDir, { recursive: true, force: true });
59305
59224
  throw err;
59306
59225
  }
59307
59226
  broadcast({ type: "grafted", id: stage.agentId });
@@ -59339,10 +59258,9 @@ async function startServer() {
59339
59258
  if (!id) return reply.status(400).send({ ok: false, error: "id required" });
59340
59259
  const blocked = hostRunBlocked(appProvider(id));
59341
59260
  if (blocked) return reply.send({ ok: false, error: blocked, blocked: true, simulate: !!simulate });
59342
- const runInputs = steelIfcRunInputs(id, inputs);
59343
59261
  let result;
59344
59262
  try {
59345
- result = await aware.run(id, { dryRun, simulate, inputs: runInputs });
59263
+ result = await aware.run(id, { dryRun, simulate, inputs });
59346
59264
  } catch (err) {
59347
59265
  if (err instanceof AwareError) {
59348
59266
  const detail = err.detail && typeof err.detail === "object" ? err.detail : null;
@@ -59361,7 +59279,7 @@ async function startServer() {
59361
59279
  broadcast({ type: "run-started", id, dryRun: !!dryRun, simulate: !!simulate, runId: result.runId });
59362
59280
  for (const ev of events) broadcast({ type: "trace", id, event: ev });
59363
59281
  broadcast({ type: "run-ended", id, runId: result.runId });
59364
- const extracted = extractReportHtml(events, id);
59282
+ const extracted = extractReportHtml(events);
59365
59283
  let report = null;
59366
59284
  if (extracted) {
59367
59285
  let interactive = false;
@@ -59534,11 +59452,11 @@ async function startServer() {
59534
59452
  app.get("/api/requests/:id/snapshot/:n", async (req, reply) => {
59535
59453
  const n = Number.parseInt(req.params.n, 10);
59536
59454
  const p = Number.isInteger(n) ? snapshotPathFor(req.params.id, n) : null;
59537
- if (!p || !(0, import_node_fs29.existsSync)(p)) return reply.status(404).send({ ok: false, error: "snapshot not found" });
59455
+ if (!p || !(0, import_node_fs28.existsSync)(p)) return reply.status(404).send({ ok: false, error: "snapshot not found" });
59538
59456
  const ext = p.split(".").pop().toLowerCase();
59539
59457
  reply.header("Content-Type", ext === "png" ? "image/png" : ext === "webp" ? "image/webp" : ext === "pdf" ? "application/pdf" : "image/jpeg");
59540
59458
  reply.header("Cache-Control", "no-store");
59541
- return (0, import_node_fs29.readFileSync)(p);
59459
+ return (0, import_node_fs28.readFileSync)(p);
59542
59460
  });
59543
59461
  app.post(
59544
59462
  "/api/tweak",
@@ -59677,7 +59595,7 @@ async function startServer() {
59677
59595
  runId: latest.runId,
59678
59596
  status: summarizeRun(events).status,
59679
59597
  rows: extractRunRows(events),
59680
- html: withBadge(extractReportHtml(events, ref))?.html ?? null
59598
+ html: withBadge(extractReportHtml(events))?.html ?? null
59681
59599
  };
59682
59600
  }
59683
59601
  if (kind === "last-run-status") {
@@ -59688,7 +59606,7 @@ async function startServer() {
59688
59606
  warn(`last-run-status:${ref} \u2014 trace exists but couldn't be parsed (corrupt/truncated)`);
59689
59607
  let finishedAt2 = null;
59690
59608
  try {
59691
- finishedAt2 = (0, import_node_fs29.statSync)(latest.path).mtime.toISOString();
59609
+ finishedAt2 = (0, import_node_fs28.statSync)(latest.path).mtime.toISOString();
59692
59610
  } catch {
59693
59611
  finishedAt2 = null;
59694
59612
  }
@@ -59698,7 +59616,7 @@ async function startServer() {
59698
59616
  let finishedAt = typeof runEnd?.ts === "string" ? runEnd.ts : null;
59699
59617
  if (!finishedAt) {
59700
59618
  try {
59701
- finishedAt = (0, import_node_fs29.statSync)(latest.path).mtime.toISOString();
59619
+ finishedAt = (0, import_node_fs28.statSync)(latest.path).mtime.toISOString();
59702
59620
  } catch {
59703
59621
  finishedAt = null;
59704
59622
  }