@floless/app 0.47.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.
- package/dist/floless-server.cjs +598 -634
- package/dist/schemas/steel.takeoff.v1.schema.json +20 -2
- package/dist/web/steel-editor.html +41 -5
- package/package.json +1 -1
- package/dist/skills/floless-app-steel-from-drawings/SKILL.md +0 -120
- package/dist/templates/steel-from-drawings.flo +0 -73
- package/dist/templates/steel-to-ifc.flo +0 -294
- package/dist/templates/steel-to-tekla.flo +0 -293
package/dist/floless-server.cjs
CHANGED
|
@@ -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:
|
|
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"] ||
|
|
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:
|
|
6009
|
+
var { existsSync: existsSync24 } = require("node:fs");
|
|
6010
6010
|
var getCallers = require_caller();
|
|
6011
|
-
var { join:
|
|
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) && !
|
|
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"] ||
|
|
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"] ||
|
|
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
|
|
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,
|
|
6320
|
+
function asJson(obj, msg, num, time) {
|
|
6321
6321
|
if (asJsonChan.hasSubscribers === false) {
|
|
6322
|
-
return _asJson.call(this, obj, msg,
|
|
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,
|
|
6325
|
+
return asJsonChan.traceSync(_asJson, store, this, obj, msg, num, time);
|
|
6326
6326
|
}
|
|
6327
|
-
function _asJson(obj, msg,
|
|
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][
|
|
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,
|
|
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,
|
|
6984
|
+
obj = mixinMergeStrategy(obj, mixin(obj, num, this));
|
|
6985
6985
|
}
|
|
6986
|
-
const s = this[asJsonSym](obj, msg,
|
|
6986
|
+
const s = this[asJsonSym](obj, msg, num, t);
|
|
6987
6987
|
const stream = this[streamSym];
|
|
6988
6988
|
if (stream[needsMetadataGsym] === true) {
|
|
6989
|
-
stream.lastLevel =
|
|
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
|
|
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
|
-
|
|
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 +=
|
|
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 += `${
|
|
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
|
-
|
|
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 =
|
|
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 =
|
|
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
|
|
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
|
-
|
|
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 +=
|
|
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 += `${
|
|
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
|
-
|
|
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 =
|
|
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
|
|
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 +=
|
|
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 += `${
|
|
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
|
|
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,
|
|
7437
|
+
res += stringifyTypedArray(value, join28, maximumBreadth);
|
|
7438
7438
|
keys = keys.slice(value.length);
|
|
7439
7439
|
maximumPropertiesToStringify -= value.length;
|
|
7440
|
-
separator =
|
|
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 =
|
|
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 =
|
|
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
|
|
8517
|
-
if (
|
|
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 (
|
|
8519
|
+
} else if (num === Infinity || num === -Infinity) {
|
|
8520
8520
|
return "null";
|
|
8521
8521
|
} else {
|
|
8522
|
-
return "" +
|
|
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
|
|
24677
|
-
if (
|
|
24678
|
-
return
|
|
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
|
|
41040
|
-
if (arr != null && (
|
|
41041
|
-
if (arr[3] != null) return
|
|
41042
|
-
if (arr[4] != null) return
|
|
41043
|
-
if (arr[5] != null) return
|
|
41044
|
-
if (arr[6] != null) return
|
|
41045
|
-
if (arr[7] != null) return
|
|
41046
|
-
if (arr[8] != null) return
|
|
41047
|
-
return
|
|
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
|
|
41052
|
-
return pfx +
|
|
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(
|
|
41055
|
-
var pfx =
|
|
41056
|
-
if (abs < SEC) return
|
|
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
|
|
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(
|
|
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
|
|
42197
|
+
const doc = ERROR_RESPONSES[statusCode];
|
|
42198
42198
|
headers["Content-Type"] = "text/html; charset=utf-8";
|
|
42199
|
-
headers["Content-Length"] =
|
|
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(
|
|
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
|
|
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"] =
|
|
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(
|
|
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 =
|
|
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(
|
|
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 (
|
|
43806
|
+
if (doc && tagEntries.length > 0 && identity.isNode(doc.contents)) {
|
|
43807
43807
|
const tags = {};
|
|
43808
|
-
visit.visit(
|
|
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 (!
|
|
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(
|
|
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(
|
|
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(
|
|
44000
|
-
if (!identity.isDocument(
|
|
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
|
|
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(
|
|
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(
|
|
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
|
|
44074
|
-
const source = this.resolve(
|
|
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(
|
|
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(
|
|
44113
|
+
function getAliasCount(doc, node, anchors2) {
|
|
44114
44114
|
if (identity.isAlias(node)) {
|
|
44115
|
-
const source = node.resolve(
|
|
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(
|
|
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(
|
|
44128
|
-
const vc = getAliasCount(
|
|
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(
|
|
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
|
-
},
|
|
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
|
|
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
|
|
44899
|
-
if (!
|
|
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(
|
|
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
|
|
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 =
|
|
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
|
|
45788
|
-
if (!isFinite(
|
|
45789
|
-
return isNaN(
|
|
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
|
|
45830
|
-
return isFinite(
|
|
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
|
|
46270
|
-
return isFinite(
|
|
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
|
|
46473
|
-
const res = parts.replace(/_/g, "").split(":").reduce((res2, p) => res2 *
|
|
46474
|
-
return sign === "-" ?
|
|
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
|
|
46478
|
+
let num = (n) => n;
|
|
46479
46479
|
if (typeof value === "bigint")
|
|
46480
|
-
|
|
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 *=
|
|
46486
|
+
value *= num(-1);
|
|
46487
46487
|
}
|
|
46488
|
-
const _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(
|
|
46729
|
+
function stringifyDocument(doc, options) {
|
|
46730
46730
|
const lines = [];
|
|
46731
46731
|
let hasDirectives = options.directives === true;
|
|
46732
|
-
if (options.directives !== false &&
|
|
46733
|
-
const dir =
|
|
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 (
|
|
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(
|
|
46742
|
+
const ctx = stringify.createStringifyContext(doc, options);
|
|
46743
46743
|
const { commentString } = ctx.options;
|
|
46744
|
-
if (
|
|
46744
|
+
if (doc.commentBefore) {
|
|
46745
46745
|
if (lines.length !== 1)
|
|
46746
46746
|
lines.unshift("");
|
|
46747
|
-
const cs = commentString(
|
|
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 (
|
|
46753
|
-
if (identity.isNode(
|
|
46754
|
-
if (
|
|
46752
|
+
if (doc.contents) {
|
|
46753
|
+
if (identity.isNode(doc.contents)) {
|
|
46754
|
+
if (doc.contents.spaceBefore && hasDirectives)
|
|
46755
46755
|
lines.push("");
|
|
46756
|
-
if (
|
|
46757
|
-
const cs = commentString(
|
|
46756
|
+
if (doc.contents.commentBefore) {
|
|
46757
|
+
const cs = commentString(doc.contents.commentBefore);
|
|
46758
46758
|
lines.push(stringifyComment.indentComment(cs, ""));
|
|
46759
46759
|
}
|
|
46760
|
-
ctx.forceBlockIndent = !!
|
|
46761
|
-
contentComment =
|
|
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(
|
|
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(
|
|
46772
|
+
lines.push(stringify.stringify(doc.contents, ctx));
|
|
46773
46773
|
}
|
|
46774
|
-
if (
|
|
46775
|
-
if (
|
|
46776
|
-
const cs = commentString(
|
|
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 =
|
|
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
|
|
48477
|
+
const doc = new Document.Document(void 0, opts);
|
|
48478
48478
|
const ctx = {
|
|
48479
48479
|
atKey: false,
|
|
48480
48480
|
atRoot: true,
|
|
48481
|
-
directives:
|
|
48482
|
-
options:
|
|
48483
|
-
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
|
-
|
|
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
|
-
|
|
48499
|
-
const contentEnd =
|
|
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
|
-
|
|
48503
|
-
|
|
48504
|
-
return
|
|
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(
|
|
48571
|
+
decorate(doc, afterDoc) {
|
|
48572
48572
|
const { comment, afterEmptyLine } = parsePrelude(this.prelude);
|
|
48573
48573
|
if (comment) {
|
|
48574
|
-
const dc =
|
|
48574
|
+
const dc = doc.contents;
|
|
48575
48575
|
if (afterDoc) {
|
|
48576
|
-
|
|
48576
|
+
doc.comment = doc.comment ? `${doc.comment}
|
|
48577
48577
|
${comment}` : comment;
|
|
48578
|
-
} else if (afterEmptyLine ||
|
|
48579
|
-
|
|
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
|
-
|
|
48595
|
+
doc.errors.push(this.errors[i]);
|
|
48596
48596
|
for (let i = 0; i < this.warnings.length; ++i)
|
|
48597
|
-
|
|
48597
|
+
doc.warnings.push(this.warnings[i]);
|
|
48598
48598
|
} else {
|
|
48599
|
-
|
|
48600
|
-
|
|
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
|
|
48646
|
-
if (this.atDirectives && !
|
|
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(
|
|
48648
|
+
this.decorate(doc, false);
|
|
48649
48649
|
if (this.doc)
|
|
48650
48650
|
yield this.doc;
|
|
48651
|
-
this.doc =
|
|
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
|
|
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
|
-
|
|
48709
|
-
this.decorate(
|
|
48710
|
-
yield
|
|
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
|
|
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
|
-
|
|
50074
|
-
this.stack.push(
|
|
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(
|
|
50086
|
-
if (
|
|
50087
|
-
return yield* this.lineEnd(
|
|
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(
|
|
50090
|
+
if (findNonEmptyIndex(doc.start) !== -1) {
|
|
50091
50091
|
yield* this.pop();
|
|
50092
50092
|
yield* this.step();
|
|
50093
50093
|
} else
|
|
50094
|
-
|
|
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
|
-
|
|
50102
|
+
doc.start.push(this.sourceToken);
|
|
50103
50103
|
return;
|
|
50104
50104
|
}
|
|
50105
|
-
const bv = this.startBlockValue(
|
|
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
|
|
50645
|
-
|
|
50646
|
-
|
|
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
|
|
50656
|
+
let doc = null;
|
|
50657
50657
|
for (const _doc of composer$1.compose(parser$1.parse(source), true, source.length)) {
|
|
50658
|
-
if (!
|
|
50659
|
-
|
|
50660
|
-
else if (
|
|
50661
|
-
|
|
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
|
-
|
|
50667
|
-
|
|
50666
|
+
doc.errors.forEach(errors.prettifyError(source, lineCounter2));
|
|
50667
|
+
doc.warnings.forEach(errors.prettifyError(source, lineCounter2));
|
|
50668
50668
|
}
|
|
50669
|
-
return
|
|
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
|
|
50679
|
-
if (!
|
|
50678
|
+
const doc = parseDocument4(src, options);
|
|
50679
|
+
if (!doc)
|
|
50680
50680
|
return null;
|
|
50681
|
-
|
|
50682
|
-
if (
|
|
50683
|
-
if (
|
|
50684
|
-
throw
|
|
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
|
-
|
|
50686
|
+
doc.errors = [];
|
|
50687
50687
|
}
|
|
50688
|
-
return
|
|
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
|
|
50831
|
-
var
|
|
50832
|
-
var
|
|
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
|
|
51087
|
+
let doc;
|
|
51088
51088
|
try {
|
|
51089
|
-
|
|
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(
|
|
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
|
|
51132
|
+
let doc;
|
|
51133
51133
|
try {
|
|
51134
|
-
|
|
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(
|
|
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
|
|
51150
|
-
agentDescription: firstParagraph(
|
|
51151
|
-
homepage: typeof
|
|
51152
|
-
capabilities: Object.keys(asRecord(
|
|
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
|
|
51175
|
-
const raw =
|
|
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
|
|
51197
|
+
let doc;
|
|
51198
51198
|
try {
|
|
51199
|
-
|
|
51199
|
+
doc = asRecord((0, import_yaml.parse)(manifestText));
|
|
51200
51200
|
} catch {
|
|
51201
51201
|
continue;
|
|
51202
51202
|
}
|
|
51203
|
-
const requires = asRecord(
|
|
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
|
|
51213
|
-
vendor: typeof
|
|
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.
|
|
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.
|
|
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
|
|
52910
|
+
const doc = (0, import_yaml2.parse)((0, import_node_fs8.readFileSync)(path, "utf8")) ?? {};
|
|
52911
52911
|
return {
|
|
52912
|
-
id: String(
|
|
52913
|
-
version:
|
|
52914
|
-
publisher: typeof
|
|
52915
|
-
module: typeof
|
|
52916
|
-
changelog: Array.isArray(
|
|
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
|
|
53055
|
-
if (
|
|
53056
|
-
throw new Error(`bake: source is not valid YAML: ${
|
|
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
|
-
|
|
53059
|
-
|
|
53060
|
-
return
|
|
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, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
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">✓ IFC file written</div><div class="sub">${esc(fname)}</div><div class="big">${members} <span>members · ${columns} columns · ${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 — 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> — IFC is the universal exchange format. Schematic model — confirm & 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 ? ` · ${failed} failed` : "") + (skipped > 0 ? ` · ${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">✓ ${created} member(s) created in the live model</div><div class="sub">${esc(sceneName)} → ${esc(model)}</div><div class="big">${created} <span>members · ${columns} columns · ${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
|
|
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
|
|
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
|
|
53276
|
-
var
|
|
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,
|
|
53281
|
-
if (!(0,
|
|
53282
|
-
let
|
|
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
|
-
|
|
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(
|
|
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(
|
|
53233
|
+
let skillCount = Array.isArray(doc.skills) ? doc.skills.length : 0;
|
|
53313
53234
|
if (!skillCount) {
|
|
53314
|
-
const skillsDir = (0,
|
|
53315
|
-
if ((0,
|
|
53235
|
+
const skillsDir = (0, import_node_path9.join)(agentDir, "skills");
|
|
53236
|
+
if ((0, import_node_fs10.existsSync)(skillsDir)) {
|
|
53316
53237
|
try {
|
|
53317
|
-
skillCount = (0,
|
|
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
|
|
53324
|
-
description: typeof
|
|
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
|
|
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,
|
|
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
|
|
53363
|
-
var
|
|
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,
|
|
53374
|
-
const target = (0,
|
|
53375
|
-
if ((0,
|
|
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,
|
|
53298
|
+
(0, import_node_fs12.rmSync)(target, { recursive: true, force: true });
|
|
53378
53299
|
}
|
|
53379
|
-
(0,
|
|
53300
|
+
(0, import_node_fs12.mkdirSync)(targetAgentsDir, { recursive: true });
|
|
53380
53301
|
try {
|
|
53381
|
-
(0,
|
|
53302
|
+
(0, import_node_fs12.renameSync)(staged, target);
|
|
53382
53303
|
} catch {
|
|
53383
|
-
(0,
|
|
53304
|
+
(0, import_node_fs12.cpSync)(staged, target, { recursive: true });
|
|
53384
53305
|
}
|
|
53385
|
-
(0,
|
|
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,
|
|
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,
|
|
53396
|
-
pattern = (0,
|
|
53316
|
+
dir = (0, import_node_path10.dirname)(globOrDir);
|
|
53317
|
+
pattern = (0, import_node_path10.basename)(globOrDir);
|
|
53397
53318
|
}
|
|
53398
|
-
if (!dir || !(0,
|
|
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,
|
|
53321
|
+
return (0, import_node_fs12.readdirSync)(dir).filter((f) => re.test(f)).sort();
|
|
53401
53322
|
}
|
|
53402
53323
|
function globToRegExp(p) {
|
|
53403
|
-
const
|
|
53404
|
-
return new RegExp(`^${
|
|
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
|
|
53410
|
-
var
|
|
53411
|
-
var
|
|
53412
|
-
var ROOT2 = process.env.FLOLESS_HOME ?? (0,
|
|
53413
|
-
var TEMPLATES_FILE = (0,
|
|
53414
|
-
var REQUESTS_DIR = (0,
|
|
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,
|
|
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,
|
|
53420
|
-
const full = (0,
|
|
53421
|
-
return full === base || full.startsWith(base +
|
|
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,
|
|
53345
|
+
if (!(0, import_node_fs13.existsSync)(TEMPLATES_FILE)) return [];
|
|
53425
53346
|
try {
|
|
53426
|
-
const parsed = JSON.parse((0,
|
|
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,
|
|
53436
|
-
(0,
|
|
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,
|
|
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,
|
|
53487
|
-
(0,
|
|
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,
|
|
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,
|
|
53502
|
-
return (0,
|
|
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,
|
|
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,
|
|
53512
|
-
const file = (0,
|
|
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,
|
|
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,
|
|
53440
|
+
(0, import_node_fs13.rmSync)(p);
|
|
53520
53441
|
} catch {
|
|
53521
53442
|
}
|
|
53522
53443
|
}
|
|
53523
53444
|
} catch {
|
|
53524
53445
|
}
|
|
53525
|
-
(0,
|
|
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,
|
|
53530
|
-
const allFiles = (0,
|
|
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,
|
|
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,
|
|
53542
|
-
const file = (0,
|
|
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,
|
|
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
|
|
53583
|
-
var
|
|
53584
|
-
var
|
|
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,
|
|
53590
|
-
return (0,
|
|
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(
|
|
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,
|
|
53621
|
-
const path = (0,
|
|
53622
|
-
const root = (0,
|
|
53623
|
-
const target = (0,
|
|
53624
|
-
if (target !== root && !target.startsWith(root +
|
|
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,
|
|
53628
|
-
if (!(0,
|
|
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,
|
|
53631
|
-
(0,
|
|
53551
|
+
(0, import_node_fs14.writeFileSync)(tmp, buf);
|
|
53552
|
+
(0, import_node_fs14.renameSync)(tmp, path);
|
|
53632
53553
|
}
|
|
53633
|
-
return { path, ext, bytes: (0,
|
|
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,
|
|
53638
|
-
if (!(0,
|
|
53639
|
-
const to = (0,
|
|
53640
|
-
if ((0,
|
|
53641
|
-
(0,
|
|
53642
|
-
(0,
|
|
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,
|
|
53647
|
-
if (!(0,
|
|
53648
|
-
(0,
|
|
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,
|
|
53653
|
-
if ((0,
|
|
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(
|
|
53586
|
+
function validate(doc, schema) {
|
|
53666
53587
|
const errors = [];
|
|
53667
|
-
walk(
|
|
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,
|
|
53685
|
+
const here2 = (0, import_node_path13.dirname)((0, import_node_url2.fileURLToPath)(__import_meta_url));
|
|
53765
53686
|
const candidates = [
|
|
53766
|
-
(0,
|
|
53687
|
+
(0, import_node_path13.join)(here2, "..", "schemas", "steel.takeoff.v1.schema.json"),
|
|
53767
53688
|
// dev: server/ next to schemas/
|
|
53768
|
-
(0,
|
|
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,
|
|
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(
|
|
53783
|
-
return validate(
|
|
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,
|
|
53790
|
-
var DIR = (0,
|
|
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,
|
|
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,
|
|
53721
|
+
if (!(0, import_node_fs16.existsSync)(p)) return null;
|
|
53801
53722
|
try {
|
|
53802
|
-
return JSON.parse((0,
|
|
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,
|
|
53729
|
+
function writeContract(appId, doc) {
|
|
53809
53730
|
const p = contractPath(appId);
|
|
53810
|
-
const res = validateSteelTakeoff(
|
|
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,
|
|
53816
|
-
(0,
|
|
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
|
|
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
|
|
53842
|
-
if (
|
|
53843
|
-
throw new Error(`contract bake: source is not valid YAML: ${
|
|
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 =
|
|
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
|
-
|
|
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
|
-
|
|
53884
|
-
(0,
|
|
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
|
|
53982
|
-
var
|
|
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
|
|
53986
|
-
if (
|
|
53987
|
-
throw new Error(`scene bake: source is not valid YAML: ${
|
|
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 =
|
|
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
|
-
|
|
53994
|
-
(0,
|
|
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
|
|
53998
|
-
if (
|
|
53999
|
-
throw new Error(`node bake: source is not valid YAML: ${
|
|
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 =
|
|
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))
|
|
54006
|
-
(0,
|
|
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,
|
|
54010
|
-
const flo = (0,
|
|
54011
|
-
(0,
|
|
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,
|
|
54033
|
-
const flo = (0,
|
|
54034
|
-
(0,
|
|
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,
|
|
54058
|
-
const flo = (0,
|
|
54059
|
-
(0,
|
|
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,20 +54219,65 @@ function memberTons(contract, m) {
|
|
|
54298
54219
|
}
|
|
54299
54220
|
function rollup(members, countWeighted = false) {
|
|
54300
54221
|
const counts = emptyCounts();
|
|
54301
|
-
let
|
|
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
|
-
|
|
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(
|
|
54231
|
+
return { score: den > 0 ? Math.round(num / den * 100) : null, tons, counts };
|
|
54232
|
+
}
|
|
54233
|
+
function bandEnd(end, rows) {
|
|
54234
|
+
const row = end.conn ? rows.get(end.conn) : void 0;
|
|
54235
|
+
const complete = !!(row && row.type && row.detail && row.targets && Object.keys(row.targets).length > 0);
|
|
54236
|
+
const hasNote = !!(end.note && end.note.trim() !== "");
|
|
54237
|
+
const evidence = hasNote || row?.source === "drawing";
|
|
54238
|
+
if (end.connVerified === true) return { band: "verified", reason: "" };
|
|
54239
|
+
if (!end.conn && !hasNote) return { band: "rfi", reason: "no connection assigned" };
|
|
54240
|
+
if (complete && evidence) return { band: "high", reason: "" };
|
|
54241
|
+
if (complete) return { band: "med", reason: "connection type assumed (no drawing note)" };
|
|
54242
|
+
if (hasNote && end.detail && end.detail.trim() !== "") return { band: "med", reason: "free-text note + detail (not a mapped library row)" };
|
|
54243
|
+
if (end.conn && !row) return { band: "low", reason: "references an unknown connection row" };
|
|
54244
|
+
return { band: "low", reason: row ? "library row has a type only (no detail/component id)" : "connection type only (no detail)" };
|
|
54245
|
+
}
|
|
54246
|
+
function scoreConnections(contractInput) {
|
|
54247
|
+
const contract = contractInput ?? {};
|
|
54248
|
+
const rows = /* @__PURE__ */ new Map();
|
|
54249
|
+
for (const c of contract.connections ?? []) if (c && c.id) rows.set(c.id, c);
|
|
54250
|
+
const byEnd = [];
|
|
54251
|
+
(contract.plans ?? []).forEach((plan, planIdx) => {
|
|
54252
|
+
for (const m of plan.members ?? []) {
|
|
54253
|
+
if (m.role === "column") {
|
|
54254
|
+
const c = m.col ?? {};
|
|
54255
|
+
const { band, reason } = bandEnd(c, rows);
|
|
54256
|
+
byEnd.push({ id: `${m.id}#col`, planIdx, sheet: plan.sheet ?? "", memberId: m.id, which: "col", band, reason });
|
|
54257
|
+
} else {
|
|
54258
|
+
const ends = m.ends ?? [];
|
|
54259
|
+
for (const which of [0, 1]) {
|
|
54260
|
+
const { band, reason } = bandEnd(ends[which] ?? {}, rows);
|
|
54261
|
+
byEnd.push({ id: `${m.id}#${which}`, planIdx, sheet: plan.sheet ?? "", memberId: m.id, which, band, reason });
|
|
54262
|
+
}
|
|
54263
|
+
}
|
|
54264
|
+
}
|
|
54265
|
+
});
|
|
54266
|
+
const counts = emptyCounts();
|
|
54267
|
+
let num = 0, den = 0;
|
|
54268
|
+
for (const e of byEnd) {
|
|
54269
|
+
counts[e.band]++;
|
|
54270
|
+
if (e.band === "rfi") continue;
|
|
54271
|
+
num += BAND_WEIGHT[e.band];
|
|
54272
|
+
den += 1;
|
|
54273
|
+
}
|
|
54274
|
+
const category = { score: den > 0 ? Math.round(num / den * 100) : null, tons: 0, counts };
|
|
54275
|
+
return { byEnd, category };
|
|
54311
54276
|
}
|
|
54312
54277
|
function scoreContract(contractInput) {
|
|
54313
54278
|
const contract = contractInput ?? {};
|
|
54314
54279
|
const plans = contract.plans ?? [];
|
|
54280
|
+
const conn = scoreConnections(contract);
|
|
54315
54281
|
const byMember = [];
|
|
54316
54282
|
const byDetail = [];
|
|
54317
54283
|
let totalSegments = 0;
|
|
@@ -54352,16 +54318,17 @@ function scoreContract(contractInput) {
|
|
|
54352
54318
|
const columns = rollup(byMember.filter((m) => m.role === "column"));
|
|
54353
54319
|
const details = rollupDetails(byDetail);
|
|
54354
54320
|
const scored = byMember.filter((m) => m.band !== "rfi");
|
|
54355
|
-
const
|
|
54321
|
+
const num = scored.reduce((s, m) => s + m.tons * BAND_WEIGHT[m.band], 0);
|
|
54356
54322
|
const den = scored.reduce((s, m) => s + m.tons, 0);
|
|
54357
54323
|
return {
|
|
54358
54324
|
byMember,
|
|
54359
54325
|
byDetail,
|
|
54326
|
+
byConnection: conn.byEnd,
|
|
54360
54327
|
byCategory: {
|
|
54361
54328
|
beams,
|
|
54362
54329
|
columns,
|
|
54363
54330
|
details,
|
|
54364
|
-
connections:
|
|
54331
|
+
connections: conn.category
|
|
54365
54332
|
},
|
|
54366
54333
|
coverage: {
|
|
54367
54334
|
members: byMember.length,
|
|
@@ -54369,7 +54336,7 @@ function scoreContract(contractInput) {
|
|
|
54369
54336
|
note: "Approximate in v1 \u2014 precise per-segment binding is Slice 2."
|
|
54370
54337
|
},
|
|
54371
54338
|
overall: {
|
|
54372
|
-
score: den > 0 ? Math.round(
|
|
54339
|
+
score: den > 0 ? Math.round(num / den * 100) : null,
|
|
54373
54340
|
tons: den,
|
|
54374
54341
|
rfiCount: byMember.filter((m) => m.band === "rfi").length
|
|
54375
54342
|
}
|
|
@@ -54381,13 +54348,13 @@ function detailSheet(text) {
|
|
|
54381
54348
|
}
|
|
54382
54349
|
function rollupDetails(details) {
|
|
54383
54350
|
const counts = emptyCounts();
|
|
54384
|
-
let
|
|
54351
|
+
let num = 0, den = 0;
|
|
54385
54352
|
for (const d of details) {
|
|
54386
54353
|
counts[d.band]++;
|
|
54387
|
-
|
|
54354
|
+
num += BAND_WEIGHT[d.band];
|
|
54388
54355
|
den += 1;
|
|
54389
54356
|
}
|
|
54390
|
-
return { score: den > 0 ? Math.round(
|
|
54357
|
+
return { score: den > 0 ? Math.round(num / den * 100) : null, tons: 0, counts };
|
|
54391
54358
|
}
|
|
54392
54359
|
|
|
54393
54360
|
// contract-score.ts
|
|
@@ -54433,14 +54400,14 @@ function scoreContract2(contractInput) {
|
|
|
54433
54400
|
}
|
|
54434
54401
|
|
|
54435
54402
|
// app-lifecycle.ts
|
|
54436
|
-
var import_node_fs22 = require("node:fs");
|
|
54437
|
-
var import_node_os14 = require("node:os");
|
|
54438
|
-
var import_node_path19 = require("node:path");
|
|
54439
|
-
|
|
54440
|
-
// routines.ts
|
|
54441
54403
|
var import_node_fs21 = require("node:fs");
|
|
54404
|
+
var import_node_os13 = require("node:os");
|
|
54442
54405
|
var import_node_path18 = require("node:path");
|
|
54443
54406
|
|
|
54407
|
+
// routines.ts
|
|
54408
|
+
var import_node_fs20 = require("node:fs");
|
|
54409
|
+
var import_node_path17 = require("node:path");
|
|
54410
|
+
|
|
54444
54411
|
// sse.ts
|
|
54445
54412
|
var clients = /* @__PURE__ */ new Set();
|
|
54446
54413
|
var HEARTBEAT_MS = 2e4;
|
|
@@ -54476,11 +54443,11 @@ function clientCount() {
|
|
|
54476
54443
|
}
|
|
54477
54444
|
|
|
54478
54445
|
// trigger-sessions.ts
|
|
54479
|
-
var
|
|
54480
|
-
var
|
|
54481
|
-
var
|
|
54446
|
+
var import_node_fs19 = require("node:fs");
|
|
54447
|
+
var import_node_os12 = require("node:os");
|
|
54448
|
+
var import_node_path16 = require("node:path");
|
|
54482
54449
|
var import_yaml7 = __toESM(require_dist6(), 1);
|
|
54483
|
-
var AGENTS_DIR2 = process.env.AWARE_HOME ? (0,
|
|
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");
|
|
54484
54451
|
function summarizeFire(data) {
|
|
54485
54452
|
if (!data) return "event";
|
|
54486
54453
|
const type = typeof data.type === "string" ? data.type : "";
|
|
@@ -54497,11 +54464,11 @@ function mapTriggerState(phase) {
|
|
|
54497
54464
|
function isHostBacked(agent, agentsDir = AGENTS_DIR2) {
|
|
54498
54465
|
const safe = (n) => !n.includes("/") && !n.includes("\\") && !n.includes("..");
|
|
54499
54466
|
if (!safe(agent)) return false;
|
|
54500
|
-
const manifestPath = (0,
|
|
54501
|
-
if (!(0,
|
|
54467
|
+
const manifestPath = (0, import_node_path16.join)(agentsDir, agent, "manifest.yaml");
|
|
54468
|
+
if (!(0, import_node_fs19.existsSync)(manifestPath)) return false;
|
|
54502
54469
|
try {
|
|
54503
|
-
const
|
|
54504
|
-
const transport =
|
|
54470
|
+
const doc = (0, import_yaml7.parse)((0, import_node_fs19.readFileSync)(manifestPath, "utf8"));
|
|
54471
|
+
const transport = doc?.transport;
|
|
54505
54472
|
return !!(transport && typeof transport === "object" && "cli" in transport);
|
|
54506
54473
|
} catch {
|
|
54507
54474
|
return false;
|
|
@@ -54785,7 +54752,7 @@ var RoutineError = class extends Error {
|
|
|
54785
54752
|
}
|
|
54786
54753
|
status;
|
|
54787
54754
|
};
|
|
54788
|
-
var ROUTINES_FILE = (0,
|
|
54755
|
+
var ROUTINES_FILE = (0, import_node_path17.join)(flolessRoot, "routines.json");
|
|
54789
54756
|
var routines = [];
|
|
54790
54757
|
var loaded = false;
|
|
54791
54758
|
function ensureLoaded() {
|
|
@@ -54821,10 +54788,10 @@ function sanitizeRoutine(raw) {
|
|
|
54821
54788
|
};
|
|
54822
54789
|
}
|
|
54823
54790
|
function loadFromDisk() {
|
|
54824
|
-
if (!(0,
|
|
54791
|
+
if (!(0, import_node_fs20.existsSync)(ROUTINES_FILE)) return [];
|
|
54825
54792
|
let text;
|
|
54826
54793
|
try {
|
|
54827
|
-
text = (0,
|
|
54794
|
+
text = (0, import_node_fs20.readFileSync)(ROUTINES_FILE, "utf8");
|
|
54828
54795
|
} catch {
|
|
54829
54796
|
return [];
|
|
54830
54797
|
}
|
|
@@ -54833,17 +54800,17 @@ function loadFromDisk() {
|
|
|
54833
54800
|
return Array.isArray(parsed) ? parsed.map(sanitizeRoutine).filter((r) => r !== null) : [];
|
|
54834
54801
|
} catch {
|
|
54835
54802
|
try {
|
|
54836
|
-
(0,
|
|
54803
|
+
(0, import_node_fs20.renameSync)(ROUTINES_FILE, `${ROUTINES_FILE}.corrupt-${Date.now()}`);
|
|
54837
54804
|
} catch {
|
|
54838
54805
|
}
|
|
54839
54806
|
return [];
|
|
54840
54807
|
}
|
|
54841
54808
|
}
|
|
54842
54809
|
function saveRoutines() {
|
|
54843
|
-
if (!(0,
|
|
54810
|
+
if (!(0, import_node_fs20.existsSync)(flolessRoot)) (0, import_node_fs20.mkdirSync)(flolessRoot, { recursive: true });
|
|
54844
54811
|
const tmp = `${ROUTINES_FILE}.${process.pid}.tmp`;
|
|
54845
|
-
(0,
|
|
54846
|
-
(0,
|
|
54812
|
+
(0, import_node_fs20.writeFileSync)(tmp, JSON.stringify(routines, null, 2));
|
|
54813
|
+
(0, import_node_fs20.renameSync)(tmp, ROUTINES_FILE);
|
|
54847
54814
|
}
|
|
54848
54815
|
function listRoutines() {
|
|
54849
54816
|
ensureLoaded();
|
|
@@ -55167,7 +55134,7 @@ async function runRoutine(id) {
|
|
|
55167
55134
|
durationMs: Date.now() - startedAt.getTime()
|
|
55168
55135
|
});
|
|
55169
55136
|
try {
|
|
55170
|
-
const report = withBadge(extractReportHtml(events
|
|
55137
|
+
const report = withBadge(extractReportHtml(events));
|
|
55171
55138
|
if (report?.html) {
|
|
55172
55139
|
broadcast({ type: "routine-report", id: r.id, workflow: r.workflow, nodeId: report.nodeId, html: report.html });
|
|
55173
55140
|
}
|
|
@@ -55251,13 +55218,13 @@ var AppLifecycleError = class extends Error {
|
|
|
55251
55218
|
}
|
|
55252
55219
|
};
|
|
55253
55220
|
function appsDir() {
|
|
55254
|
-
return process.env.AWARE_HOME ? (0,
|
|
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");
|
|
55255
55222
|
}
|
|
55256
55223
|
function appDirPath(id) {
|
|
55257
|
-
return (0,
|
|
55224
|
+
return (0, import_node_path18.join)(appsDir(), id);
|
|
55258
55225
|
}
|
|
55259
55226
|
function appInstalled(id) {
|
|
55260
|
-
return APP_ID3.test(id) && (0,
|
|
55227
|
+
return APP_ID3.test(id) && (0, import_node_fs21.existsSync)(appDirPath(id));
|
|
55261
55228
|
}
|
|
55262
55229
|
function logCascade(what, e) {
|
|
55263
55230
|
console.error(`[app-lifecycle] cascade step failed (${what}):`, e instanceof Error ? e.message : e);
|
|
@@ -55358,9 +55325,9 @@ function isGatedAwareRoute(url, method) {
|
|
|
55358
55325
|
|
|
55359
55326
|
// autostart.mjs
|
|
55360
55327
|
var import_node_child_process4 = require("node:child_process");
|
|
55361
|
-
var
|
|
55362
|
-
var
|
|
55363
|
-
var
|
|
55328
|
+
var import_node_fs22 = require("node:fs");
|
|
55329
|
+
var import_node_os14 = require("node:os");
|
|
55330
|
+
var import_node_path19 = require("node:path");
|
|
55364
55331
|
|
|
55365
55332
|
// teardown.mjs
|
|
55366
55333
|
var RUN_KEY = "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run";
|
|
@@ -55472,8 +55439,8 @@ function removeLegacyRunKey() {
|
|
|
55472
55439
|
}
|
|
55473
55440
|
function logLine(msg) {
|
|
55474
55441
|
try {
|
|
55475
|
-
(0,
|
|
55476
|
-
(0,
|
|
55442
|
+
(0, import_node_fs22.mkdirSync)(logDir(), { recursive: true });
|
|
55443
|
+
(0, import_node_fs22.appendFileSync)(logFilePath(), `${(/* @__PURE__ */ new Date()).toISOString()} ${msg}
|
|
55477
55444
|
`);
|
|
55478
55445
|
} catch {
|
|
55479
55446
|
}
|
|
@@ -55481,8 +55448,8 @@ function logLine(msg) {
|
|
|
55481
55448
|
function registerAutostart(exePath) {
|
|
55482
55449
|
if (!isWin) return;
|
|
55483
55450
|
const xml = buildAutostartTaskXml(exePath, currentUserId());
|
|
55484
|
-
const tmp = (0,
|
|
55485
|
-
(0,
|
|
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" });
|
|
55486
55453
|
try {
|
|
55487
55454
|
(0, import_node_child_process4.execFileSync)("schtasks", ["/Create", "/TN", TASK_NAME, "/XML", tmp, "/F"], {
|
|
55488
55455
|
stdio: ["ignore", "ignore", "ignore"],
|
|
@@ -55493,7 +55460,7 @@ function registerAutostart(exePath) {
|
|
|
55493
55460
|
throw err;
|
|
55494
55461
|
} finally {
|
|
55495
55462
|
try {
|
|
55496
|
-
(0,
|
|
55463
|
+
(0, import_node_fs22.rmSync)(tmp, { force: true });
|
|
55497
55464
|
} catch {
|
|
55498
55465
|
}
|
|
55499
55466
|
}
|
|
@@ -55528,26 +55495,26 @@ function unregisterAutostart() {
|
|
|
55528
55495
|
// updater.ts
|
|
55529
55496
|
var import_node_child_process5 = require("node:child_process");
|
|
55530
55497
|
var import_node_crypto6 = require("node:crypto");
|
|
55531
|
-
var
|
|
55498
|
+
var import_node_fs24 = require("node:fs");
|
|
55532
55499
|
var import_node_stream = require("node:stream");
|
|
55533
55500
|
var import_promises = require("node:stream/promises");
|
|
55534
|
-
var
|
|
55501
|
+
var import_node_path21 = require("node:path");
|
|
55535
55502
|
|
|
55536
55503
|
// post-update-marker.mjs
|
|
55537
|
-
var
|
|
55538
|
-
var
|
|
55539
|
-
var
|
|
55504
|
+
var import_node_fs23 = require("node:fs");
|
|
55505
|
+
var import_node_os15 = require("node:os");
|
|
55506
|
+
var import_node_path20 = require("node:path");
|
|
55540
55507
|
var FRESH_MS = 12e4;
|
|
55541
55508
|
function markerPath() {
|
|
55542
55509
|
const override = (process.env.FLOLESS_POST_UPDATE_MARKER ?? "").trim();
|
|
55543
55510
|
if (override) return override;
|
|
55544
|
-
const root = process.env.FLOLESS_HOME ?? (0,
|
|
55545
|
-
return (0,
|
|
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");
|
|
55546
55513
|
}
|
|
55547
55514
|
function legacyMarkerPath() {
|
|
55548
55515
|
if ((process.env.FLOLESS_POST_UPDATE_MARKER ?? "").trim()) return null;
|
|
55549
55516
|
try {
|
|
55550
|
-
return (0,
|
|
55517
|
+
return (0, import_node_path20.join)((0, import_node_path20.dirname)((0, import_node_path20.dirname)(process.execPath)), ".floless-post-update");
|
|
55551
55518
|
} catch {
|
|
55552
55519
|
return null;
|
|
55553
55520
|
}
|
|
@@ -55557,7 +55524,7 @@ function writePostUpdateMarker() {
|
|
|
55557
55524
|
for (const p of [markerPath(), legacyMarkerPath()]) {
|
|
55558
55525
|
if (!p) continue;
|
|
55559
55526
|
try {
|
|
55560
|
-
(0,
|
|
55527
|
+
(0, import_node_fs23.writeFileSync)(p, (/* @__PURE__ */ new Date()).toISOString());
|
|
55561
55528
|
wrote = true;
|
|
55562
55529
|
} catch {
|
|
55563
55530
|
}
|
|
@@ -55569,9 +55536,9 @@ function consumePostUpdateMarker() {
|
|
|
55569
55536
|
for (const p of [markerPath(), legacyMarkerPath()]) {
|
|
55570
55537
|
if (!p) continue;
|
|
55571
55538
|
try {
|
|
55572
|
-
if (!(0,
|
|
55573
|
-
const ageMs = Date.now() - (0,
|
|
55574
|
-
(0,
|
|
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 });
|
|
55575
55542
|
if (ageMs < FRESH_MS) fresh = true;
|
|
55576
55543
|
} catch {
|
|
55577
55544
|
}
|
|
@@ -55588,13 +55555,13 @@ function currentVersion() {
|
|
|
55588
55555
|
return appVersion();
|
|
55589
55556
|
}
|
|
55590
55557
|
function installRoot() {
|
|
55591
|
-
return (0,
|
|
55558
|
+
return (0, import_node_path21.dirname)((0, import_node_path21.dirname)(process.execPath));
|
|
55592
55559
|
}
|
|
55593
55560
|
function updateExePath() {
|
|
55594
|
-
return (0,
|
|
55561
|
+
return (0, import_node_path21.join)(installRoot(), "Update.exe");
|
|
55595
55562
|
}
|
|
55596
55563
|
function packagesDir() {
|
|
55597
|
-
return (0,
|
|
55564
|
+
return (0, import_node_path21.join)(installRoot(), "packages");
|
|
55598
55565
|
}
|
|
55599
55566
|
function feedUrl() {
|
|
55600
55567
|
const env2 = (process.env.FLOLESS_UPDATE_URL ?? "").trim().replace(/\/+$/, "");
|
|
@@ -55687,22 +55654,22 @@ async function checkForUpdate() {
|
|
|
55687
55654
|
}
|
|
55688
55655
|
async function sha1OfFile(path) {
|
|
55689
55656
|
const hash = (0, import_node_crypto6.createHash)("sha1");
|
|
55690
|
-
await (0, import_promises.pipeline)((0,
|
|
55657
|
+
await (0, import_promises.pipeline)((0, import_node_fs24.createReadStream)(path), hash);
|
|
55691
55658
|
return hash.digest("hex").toUpperCase();
|
|
55692
55659
|
}
|
|
55693
55660
|
async function downloadPackage(asset) {
|
|
55694
55661
|
if (!NUPKG_NAME.test(asset.FileName)) throw new Error(`refusing suspicious package name: ${asset.FileName}`);
|
|
55695
55662
|
const want = asset.SHA1.toUpperCase();
|
|
55696
55663
|
const dir = packagesDir();
|
|
55697
|
-
(0,
|
|
55698
|
-
const dest = (0,
|
|
55699
|
-
if ((0,
|
|
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;
|
|
55700
55667
|
const res = await authedFetch(`${feedUrl()}/${encodeURIComponent(asset.FileName)}`, {
|
|
55701
55668
|
redirect: "follow",
|
|
55702
55669
|
signal: AbortSignal.timeout(DOWNLOAD_TIMEOUT_MS)
|
|
55703
55670
|
});
|
|
55704
55671
|
if (!res.ok || !res.body) throw new Error(`download failed: HTTP ${res.status} for ${asset.FileName}`);
|
|
55705
|
-
await (0, import_promises.pipeline)(import_node_stream.Readable.fromWeb(res.body), (0,
|
|
55672
|
+
await (0, import_promises.pipeline)(import_node_stream.Readable.fromWeb(res.body), (0, import_node_fs24.createWriteStream)(dest));
|
|
55706
55673
|
const got = await sha1OfFile(dest);
|
|
55707
55674
|
if (got !== want) throw new Error(`SHA1 mismatch for ${asset.FileName}: feed=${want} got=${got}`);
|
|
55708
55675
|
return dest;
|
|
@@ -55711,7 +55678,7 @@ async function applyUpdate(check, opts) {
|
|
|
55711
55678
|
if (!check.supported) return { applied: false, message: check.reason ?? "auto-update not supported in this runtime" };
|
|
55712
55679
|
if (!check.updateAvailable || !check.asset) return { applied: false, message: check.reason ?? "no update available" };
|
|
55713
55680
|
const exe = updateExePath();
|
|
55714
|
-
if (!(0,
|
|
55681
|
+
if (!(0, import_node_fs24.existsSync)(exe)) {
|
|
55715
55682
|
return { applied: false, message: `Update.exe not found at ${exe} \u2014 is this a Velopack install?` };
|
|
55716
55683
|
}
|
|
55717
55684
|
const pkg = await downloadPackage(check.asset);
|
|
@@ -55951,12 +55918,12 @@ function isTraceCorrupt(events) {
|
|
|
55951
55918
|
|
|
55952
55919
|
// launch.mjs
|
|
55953
55920
|
var import_node_child_process6 = require("node:child_process");
|
|
55954
|
-
var
|
|
55921
|
+
var import_node_path22 = require("node:path");
|
|
55955
55922
|
var import_node_url3 = require("node:url");
|
|
55956
|
-
var
|
|
55923
|
+
var import_node_fs25 = require("node:fs");
|
|
55957
55924
|
var import_node_http = __toESM(require("node:http"), 1);
|
|
55958
55925
|
var import_node_readline = require("node:readline");
|
|
55959
|
-
var __dirname2 = (0,
|
|
55926
|
+
var __dirname2 = (0, import_node_path22.dirname)((0, import_node_url3.fileURLToPath)(__import_meta_url));
|
|
55960
55927
|
var PORT = Number(process.env.PORT ?? 4317);
|
|
55961
55928
|
var HEALTH_URL = `http://127.0.0.1:${PORT}/api/health`;
|
|
55962
55929
|
var BROWSER_URL = `http://floless.localhost:${PORT}`;
|
|
@@ -56028,8 +55995,8 @@ async function waitHealthy(timeoutMs = 3e4) {
|
|
|
56028
55995
|
function resolveServerStart() {
|
|
56029
55996
|
const packaged = /flolessapp\.exe$/i.test(process.execPath);
|
|
56030
55997
|
if (packaged) return { cmd: process.execPath, args: ["--serve"], shell: false };
|
|
56031
|
-
const bundle = (0,
|
|
56032
|
-
if ((0,
|
|
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 };
|
|
56033
56000
|
return { cmd: "npm", args: ["run", "start"], shell: isWin2 };
|
|
56034
56001
|
}
|
|
56035
56002
|
function startServerDetached() {
|
|
@@ -56182,8 +56149,8 @@ function taskkillArgs(pid, { tree = true } = {}) {
|
|
|
56182
56149
|
}
|
|
56183
56150
|
function killSupervisor({ tree = true } = {}) {
|
|
56184
56151
|
if (!isWin2) return;
|
|
56185
|
-
const isNpmChannel = /^node(\.exe)?$/i.test((0,
|
|
56186
|
-
const scriptMatch = isNpmChannel ? (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;
|
|
56187
56154
|
const realExe = resolveRealInstallExe(process.execPath);
|
|
56188
56155
|
const exeMatch = realExe === process.execPath ? process.execPath : [process.execPath, realExe];
|
|
56189
56156
|
const pids = supervisorPidsToKill(enumerateProcesses(), process.pid, exeMatch, scriptMatch);
|
|
@@ -56348,7 +56315,7 @@ async function runAction(arg, flagArgv = [], selfVersion = null) {
|
|
|
56348
56315
|
}
|
|
56349
56316
|
await action(parseTeardownFlags(flagArgv));
|
|
56350
56317
|
}
|
|
56351
|
-
var entry = (0,
|
|
56318
|
+
var entry = (0, import_node_path22.basename)(process.argv[1] ?? "").toLowerCase();
|
|
56352
56319
|
if (entry === "launch.mjs") {
|
|
56353
56320
|
runAction(process.argv[2], process.argv.slice(3)).catch((e) => {
|
|
56354
56321
|
log(`error: ${e?.message ?? e}`);
|
|
@@ -56422,9 +56389,9 @@ function awareUpgradeBlockReason(s) {
|
|
|
56422
56389
|
}
|
|
56423
56390
|
|
|
56424
56391
|
// skill-sync.ts
|
|
56425
|
-
var
|
|
56426
|
-
var
|
|
56427
|
-
var
|
|
56392
|
+
var import_node_fs26 = require("node:fs");
|
|
56393
|
+
var import_node_os16 = require("node:os");
|
|
56394
|
+
var import_node_path23 = require("node:path");
|
|
56428
56395
|
var import_node_url4 = require("node:url");
|
|
56429
56396
|
var import_yaml8 = __toESM(require_dist6(), 1);
|
|
56430
56397
|
|
|
@@ -56442,8 +56409,6 @@ var PRODUCT_SKILLS = [
|
|
|
56442
56409
|
// file a diagnosed bug/idea/question to the private log via the floless.io relay
|
|
56443
56410
|
"floless-app-routines",
|
|
56444
56411
|
// author event-driven ("on trigger") routines
|
|
56445
|
-
"floless-app-steel-from-drawings",
|
|
56446
|
-
// read a steel drawing into an interactive 3D model (bake the viewer-3d scene)
|
|
56447
56412
|
"floless-app-steel-takeoff",
|
|
56448
56413
|
// read a steel drawing into an editable steel.takeoff/v1 contract (the Steel Takeoff reader)
|
|
56449
56414
|
"floless-app-tweak-contract",
|
|
@@ -56459,30 +56424,30 @@ function selectShippedSkillNames(names) {
|
|
|
56459
56424
|
}
|
|
56460
56425
|
|
|
56461
56426
|
// skill-sync.ts
|
|
56462
|
-
var __dirname3 = (0,
|
|
56427
|
+
var __dirname3 = (0, import_node_path23.dirname)((0, import_node_url4.fileURLToPath)(__import_meta_url));
|
|
56463
56428
|
function bundledSkillsRoot() {
|
|
56464
56429
|
const candidates = [
|
|
56465
|
-
(0,
|
|
56466
|
-
(0,
|
|
56467
|
-
(0,
|
|
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")
|
|
56468
56433
|
];
|
|
56469
|
-
return candidates.find((p) => (0,
|
|
56434
|
+
return candidates.find((p) => (0, import_node_fs26.existsSync)(p)) ?? null;
|
|
56470
56435
|
}
|
|
56471
56436
|
function targetConfigDirs() {
|
|
56472
56437
|
const override = process.env.FLOLESS_SKILL_TARGETS;
|
|
56473
56438
|
if (override) {
|
|
56474
56439
|
return override.split(";").map((d) => d.trim()).filter(Boolean).map((dir) => ({ runtime: "custom", dir }));
|
|
56475
56440
|
}
|
|
56476
|
-
const home = (0,
|
|
56441
|
+
const home = (0, import_node_os16.homedir)();
|
|
56477
56442
|
return [
|
|
56478
|
-
{ runtime: "claude", dir: (0,
|
|
56479
|
-
{ runtime: "codex", dir: (0,
|
|
56480
|
-
{ runtime: "opencode", dir: (0,
|
|
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") }
|
|
56481
56446
|
];
|
|
56482
56447
|
}
|
|
56483
56448
|
function skillVersion(skillMdPath) {
|
|
56484
56449
|
try {
|
|
56485
|
-
const text = (0,
|
|
56450
|
+
const text = (0, import_node_fs26.readFileSync)(skillMdPath, "utf8");
|
|
56486
56451
|
const m = /^---\r?\n([\s\S]*?)\r?\n---/.exec(text);
|
|
56487
56452
|
if (!m || m[1] === void 0) return null;
|
|
56488
56453
|
const fm = (0, import_yaml8.parse)(m[1]);
|
|
@@ -56522,21 +56487,21 @@ function decideAction(installed, bundled) {
|
|
|
56522
56487
|
function bundledSkills(root) {
|
|
56523
56488
|
let entries = [];
|
|
56524
56489
|
try {
|
|
56525
|
-
entries = selectShippedSkillNames((0,
|
|
56490
|
+
entries = selectShippedSkillNames((0, import_node_fs26.readdirSync)(root));
|
|
56526
56491
|
} catch {
|
|
56527
56492
|
return [];
|
|
56528
56493
|
}
|
|
56529
56494
|
const out = [];
|
|
56530
56495
|
for (const name of entries) {
|
|
56531
|
-
const dir = (0,
|
|
56496
|
+
const dir = (0, import_node_path23.join)(root, name);
|
|
56532
56497
|
let isDir = false;
|
|
56533
56498
|
try {
|
|
56534
|
-
isDir = (0,
|
|
56499
|
+
isDir = (0, import_node_fs26.statSync)(dir).isDirectory();
|
|
56535
56500
|
} catch {
|
|
56536
56501
|
isDir = false;
|
|
56537
56502
|
}
|
|
56538
56503
|
if (!isDir) continue;
|
|
56539
|
-
const v = skillVersion((0,
|
|
56504
|
+
const v = skillVersion((0, import_node_path23.join)(dir, "SKILL.md"));
|
|
56540
56505
|
if (!v) continue;
|
|
56541
56506
|
out.push({ name, dir, version: v });
|
|
56542
56507
|
}
|
|
@@ -56549,17 +56514,17 @@ function syncSkills() {
|
|
|
56549
56514
|
const skills = bundledSkills(root);
|
|
56550
56515
|
if (!skills.length) return results;
|
|
56551
56516
|
for (const { runtime, dir: cfg } of targetConfigDirs()) {
|
|
56552
|
-
if (!(0,
|
|
56553
|
-
const skillsDir = (0,
|
|
56517
|
+
if (!(0, import_node_fs26.existsSync)(cfg)) continue;
|
|
56518
|
+
const skillsDir = (0, import_node_path23.join)(cfg, "skills");
|
|
56554
56519
|
for (const s of skills) {
|
|
56555
|
-
const dest = (0,
|
|
56556
|
-
const installedMd = (0,
|
|
56557
|
-
const installed = (0,
|
|
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;
|
|
56558
56523
|
const action = decideAction(installed, s.version);
|
|
56559
56524
|
if (action === "installed" || action === "updated") {
|
|
56560
56525
|
try {
|
|
56561
|
-
if (action === "updated") (0,
|
|
56562
|
-
(0,
|
|
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 });
|
|
56563
56528
|
results.push({ runtime, skill: s.name, action, from: installed, to: s.version });
|
|
56564
56529
|
} catch {
|
|
56565
56530
|
}
|
|
@@ -56572,9 +56537,9 @@ function syncSkills() {
|
|
|
56572
56537
|
}
|
|
56573
56538
|
|
|
56574
56539
|
// watch.ts
|
|
56575
|
-
var
|
|
56576
|
-
var
|
|
56577
|
-
var
|
|
56540
|
+
var import_node_os17 = require("node:os");
|
|
56541
|
+
var import_node_path25 = require("node:path");
|
|
56542
|
+
var import_node_fs27 = require("node:fs");
|
|
56578
56543
|
|
|
56579
56544
|
// node_modules/chokidar/esm/index.js
|
|
56580
56545
|
var import_fs2 = require("fs");
|
|
@@ -56585,7 +56550,7 @@ var sysPath2 = __toESM(require("path"), 1);
|
|
|
56585
56550
|
// node_modules/readdirp/esm/index.js
|
|
56586
56551
|
var import_promises2 = require("node:fs/promises");
|
|
56587
56552
|
var import_node_stream2 = require("node:stream");
|
|
56588
|
-
var
|
|
56553
|
+
var import_node_path24 = require("node:path");
|
|
56589
56554
|
var EntryTypes = {
|
|
56590
56555
|
FILE_TYPE: "files",
|
|
56591
56556
|
DIR_TYPE: "directories",
|
|
@@ -56660,7 +56625,7 @@ var ReaddirpStream = class extends import_node_stream2.Readable {
|
|
|
56660
56625
|
this._wantsDir = type ? DIR_TYPES.has(type) : false;
|
|
56661
56626
|
this._wantsFile = type ? FILE_TYPES.has(type) : false;
|
|
56662
56627
|
this._wantsEverything = type === EntryTypes.EVERYTHING_TYPE;
|
|
56663
|
-
this._root = (0,
|
|
56628
|
+
this._root = (0, import_node_path24.resolve)(root);
|
|
56664
56629
|
this._isDirent = !opts.alwaysStat;
|
|
56665
56630
|
this._statsProp = this._isDirent ? "dirent" : "stats";
|
|
56666
56631
|
this._rdOptions = { encoding: "utf8", withFileTypes: this._isDirent };
|
|
@@ -56731,8 +56696,8 @@ var ReaddirpStream = class extends import_node_stream2.Readable {
|
|
|
56731
56696
|
let entry2;
|
|
56732
56697
|
const basename5 = this._isDirent ? dirent.name : dirent;
|
|
56733
56698
|
try {
|
|
56734
|
-
const fullPath = (0,
|
|
56735
|
-
entry2 = { path: (0,
|
|
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 };
|
|
56736
56701
|
entry2[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
|
|
56737
56702
|
} catch (err) {
|
|
56738
56703
|
this._onError(err);
|
|
@@ -56766,7 +56731,7 @@ var ReaddirpStream = class extends import_node_stream2.Readable {
|
|
|
56766
56731
|
}
|
|
56767
56732
|
if (entryRealPathStats.isDirectory()) {
|
|
56768
56733
|
const len2 = entryRealPath.length;
|
|
56769
|
-
if (full.startsWith(entryRealPath) && full.substr(len2, 1) ===
|
|
56734
|
+
if (full.startsWith(entryRealPath) && full.substr(len2, 1) === import_node_path24.sep) {
|
|
56770
56735
|
const recursiveError = new Error(`Circular symlink detected: "${full}" points to "${entryRealPath}"`);
|
|
56771
56736
|
recursiveError.code = RECURSIVE_ERROR_CODE;
|
|
56772
56737
|
return this._onError(recursiveError);
|
|
@@ -58274,33 +58239,33 @@ function appIdFromLogPath(path) {
|
|
|
58274
58239
|
return i >= 0 && parts[i + 1] ? parts[i + 1] : null;
|
|
58275
58240
|
}
|
|
58276
58241
|
function samePath(a, b) {
|
|
58277
|
-
const ra = (0,
|
|
58278
|
-
const rb = (0,
|
|
58242
|
+
const ra = (0, import_node_path25.resolve)(a);
|
|
58243
|
+
const rb = (0, import_node_path25.resolve)(b);
|
|
58279
58244
|
return process.platform === "win32" ? ra.toLowerCase() === rb.toLowerCase() : ra === rb;
|
|
58280
58245
|
}
|
|
58281
58246
|
function underDir(path, dir) {
|
|
58282
|
-
const rp = (0,
|
|
58283
|
-
const rd = (0,
|
|
58247
|
+
const rp = (0, import_node_path25.resolve)(path);
|
|
58248
|
+
const rd = (0, import_node_path25.resolve)(dir);
|
|
58284
58249
|
const [p, d] = process.platform === "win32" ? [rp.toLowerCase(), rd.toLowerCase()] : [rp, rd];
|
|
58285
|
-
return p === d || p.startsWith(d +
|
|
58250
|
+
return p === d || p.startsWith(d + import_node_path25.sep);
|
|
58286
58251
|
}
|
|
58287
58252
|
function startWatcher() {
|
|
58288
|
-
const awareDir = process.env.AWARE_HOME ?? (0,
|
|
58289
|
-
const credentialsDir = (0,
|
|
58290
|
-
if (!(0,
|
|
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)) {
|
|
58291
58256
|
try {
|
|
58292
|
-
(0,
|
|
58257
|
+
(0, import_node_fs27.mkdirSync)(credentialsDir, { recursive: true });
|
|
58293
58258
|
} catch {
|
|
58294
58259
|
}
|
|
58295
58260
|
}
|
|
58296
|
-
if (!(0,
|
|
58261
|
+
if (!(0, import_node_fs27.existsSync)(uiDir)) {
|
|
58297
58262
|
try {
|
|
58298
|
-
(0,
|
|
58263
|
+
(0, import_node_fs27.mkdirSync)(uiDir, { recursive: true });
|
|
58299
58264
|
} catch {
|
|
58300
58265
|
}
|
|
58301
58266
|
}
|
|
58302
|
-
const targets = ["apps", "logs", "credentials"].map((d) => (0,
|
|
58303
|
-
if ((0,
|
|
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);
|
|
58304
58269
|
if (targets.length === 0) {
|
|
58305
58270
|
return null;
|
|
58306
58271
|
}
|
|
@@ -58329,11 +58294,11 @@ function startWatcher() {
|
|
|
58329
58294
|
const isCredential = path.split(/[\\/]/).includes("credentials");
|
|
58330
58295
|
const kind = isCredential ? "credential" : path.endsWith(".jsonl") ? "trace" : path.endsWith(".lock") ? "lock" : path.endsWith(".flo") || path.endsWith(".app") ? "source" : "file";
|
|
58331
58296
|
broadcast({ type: "fs-change", kind, event, path });
|
|
58332
|
-
if (kind === "trace" && event !== "unlink" && (0,
|
|
58297
|
+
if (kind === "trace" && event !== "unlink" && (0, import_node_fs27.existsSync)(path)) {
|
|
58333
58298
|
const id = appIdFromLogPath(path);
|
|
58334
58299
|
if (!id) return;
|
|
58335
58300
|
try {
|
|
58336
|
-
broadcast({ type: "trace-file", id, runId: path.split(
|
|
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")) });
|
|
58337
58302
|
} catch {
|
|
58338
58303
|
}
|
|
58339
58304
|
}
|
|
@@ -58342,10 +58307,10 @@ function startWatcher() {
|
|
|
58342
58307
|
}
|
|
58343
58308
|
|
|
58344
58309
|
// index.ts
|
|
58345
|
-
var __dirname4 = (0,
|
|
58346
|
-
var WEB_ROOT = [(0,
|
|
58347
|
-
(p) => (0,
|
|
58348
|
-
) ?? (0,
|
|
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");
|
|
58349
58314
|
var PORT2 = Number(process.env.PORT ?? 4317);
|
|
58350
58315
|
var HOST = "127.0.0.1";
|
|
58351
58316
|
var crashHandlersInstalled = false;
|
|
@@ -58361,7 +58326,7 @@ function installCrashHandlers() {
|
|
|
58361
58326
|
${stack}
|
|
58362
58327
|
`;
|
|
58363
58328
|
try {
|
|
58364
|
-
(0,
|
|
58329
|
+
(0, import_node_fs28.appendFileSync)(logFilePath(), line);
|
|
58365
58330
|
} catch {
|
|
58366
58331
|
}
|
|
58367
58332
|
if (process.stderr.isTTY) process.stderr.write(line);
|
|
@@ -58659,7 +58624,7 @@ async function startServer() {
|
|
|
58659
58624
|
return reply.status(409).send({ ok: false, error: `"${id}" is already at ${fromVersion}`, code: "up-to-date" });
|
|
58660
58625
|
}
|
|
58661
58626
|
const contract = readContract(id);
|
|
58662
|
-
if (contract == null && (0,
|
|
58627
|
+
if (contract == null && (0, import_node_fs28.existsSync)(contractPath(id))) {
|
|
58663
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" });
|
|
58664
58629
|
}
|
|
58665
58630
|
if (contract != null) {
|
|
@@ -58669,9 +58634,9 @@ async function startServer() {
|
|
|
58669
58634
|
_wfUpdating.add(id);
|
|
58670
58635
|
const bdir = backupDir(id, fromVersion, Date.now());
|
|
58671
58636
|
try {
|
|
58672
|
-
(0,
|
|
58673
|
-
(0,
|
|
58674
|
-
(0,
|
|
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);
|
|
58675
58640
|
if (contract != null) {
|
|
58676
58641
|
bakeContractIntoApp(srcPath, contract);
|
|
58677
58642
|
bakeDownstream(srcPath, contract);
|
|
@@ -58682,8 +58647,8 @@ async function startServer() {
|
|
|
58682
58647
|
} catch (e) {
|
|
58683
58648
|
const msg = e instanceof Error ? e.message : String(e);
|
|
58684
58649
|
try {
|
|
58685
|
-
(0,
|
|
58686
|
-
(0,
|
|
58650
|
+
(0, import_node_fs28.rmSync)(appDirPath2, { recursive: true, force: true });
|
|
58651
|
+
(0, import_node_fs28.cpSync)(bdir, appDirPath2, { recursive: true });
|
|
58687
58652
|
} catch (re) {
|
|
58688
58653
|
const rmsg = re instanceof Error ? re.message : String(re);
|
|
58689
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 });
|
|
@@ -58809,9 +58774,9 @@ async function startServer() {
|
|
|
58809
58774
|
return { ok: true, app: readApp(req.params.id) };
|
|
58810
58775
|
});
|
|
58811
58776
|
app.get("/api/contract/:appId", async (req, reply) => {
|
|
58812
|
-
const
|
|
58813
|
-
if (
|
|
58814
|
-
return
|
|
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;
|
|
58815
58780
|
});
|
|
58816
58781
|
app.put(
|
|
58817
58782
|
"/api/contract/:appId",
|
|
@@ -58829,14 +58794,14 @@ async function startServer() {
|
|
|
58829
58794
|
}
|
|
58830
58795
|
);
|
|
58831
58796
|
app.post("/api/contract/:appId/approve", async (req, reply) => {
|
|
58832
|
-
const
|
|
58833
|
-
if (
|
|
58834
|
-
const v = validateSteelTakeoff(
|
|
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);
|
|
58835
58800
|
if (!v.valid) return reply.status(400).send({ ok: false, error: "stored contract is invalid \u2014 re-save it in the editor" });
|
|
58836
58801
|
const sourcePath = readApp(req.params.appId).source.path;
|
|
58837
58802
|
try {
|
|
58838
|
-
bakeContractIntoApp(sourcePath,
|
|
58839
|
-
bakeDownstream(sourcePath,
|
|
58803
|
+
bakeContractIntoApp(sourcePath, doc);
|
|
58804
|
+
bakeDownstream(sourcePath, doc);
|
|
58840
58805
|
} catch (e) {
|
|
58841
58806
|
return reply.status(422).send({ ok: false, error: e instanceof Error ? e.message : "bake failed" });
|
|
58842
58807
|
}
|
|
@@ -58857,14 +58822,14 @@ async function startServer() {
|
|
|
58857
58822
|
{ bodyLimit: 25 * 1024 * 1024 },
|
|
58858
58823
|
// contracts embed rasters (matches /scene + PUT) — the editor/host-AI POSTs the live contract to score
|
|
58859
58824
|
async (req, reply) => {
|
|
58860
|
-
const
|
|
58861
|
-
if (
|
|
58862
|
-
const v = validateSteelTakeoff(
|
|
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);
|
|
58863
58828
|
if (!v.valid) {
|
|
58864
58829
|
const first = v.errors[0];
|
|
58865
58830
|
return reply.status(400).send({ ok: false, error: `contract failed schema validation \u2014 ${first ? `${first.path}: ${first.message}` : "invalid"}` });
|
|
58866
58831
|
}
|
|
58867
|
-
const docTarget =
|
|
58832
|
+
const docTarget = doc && typeof doc === "object" ? doc.target_confidence : void 0;
|
|
58868
58833
|
let appDefault = 70;
|
|
58869
58834
|
try {
|
|
58870
58835
|
const inp = readApp(req.params.appId).inputs.find((i) => i.name === "target_confidence");
|
|
@@ -58872,7 +58837,7 @@ async function startServer() {
|
|
|
58872
58837
|
} catch {
|
|
58873
58838
|
}
|
|
58874
58839
|
const target = typeof req.body?.target === "number" ? req.body.target : typeof docTarget === "number" ? docTarget : appDefault;
|
|
58875
|
-
const result = scoreContract2(
|
|
58840
|
+
const result = scoreContract2(doc);
|
|
58876
58841
|
const meetsTarget = result.score != null && result.score >= target;
|
|
58877
58842
|
return {
|
|
58878
58843
|
ok: true,
|
|
@@ -58888,14 +58853,14 @@ async function startServer() {
|
|
|
58888
58853
|
{ bodyLimit: 25 * 1024 * 1024 },
|
|
58889
58854
|
// contracts embed rasters (matches PUT /api/contract) — the editor POSTs the live contract on every 3D rebuild
|
|
58890
58855
|
async (req, reply) => {
|
|
58891
|
-
const
|
|
58892
|
-
if (
|
|
58893
|
-
const v = validateSteelTakeoff(
|
|
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);
|
|
58894
58859
|
if (!v.valid) {
|
|
58895
58860
|
const first = v.errors[0];
|
|
58896
58861
|
return reply.status(400).send({ ok: false, error: `contract failed schema validation \u2014 ${first ? `${first.path}: ${first.message}` : "invalid"}` });
|
|
58897
58862
|
}
|
|
58898
|
-
return { ok: true, ...contractToScene(
|
|
58863
|
+
return { ok: true, ...contractToScene(doc) };
|
|
58899
58864
|
}
|
|
58900
58865
|
);
|
|
58901
58866
|
function awareStderr(e) {
|
|
@@ -58906,11 +58871,11 @@ async function startServer() {
|
|
|
58906
58871
|
return null;
|
|
58907
58872
|
}
|
|
58908
58873
|
app.post("/api/contract/:appId/export-3d", async (req, reply) => {
|
|
58909
|
-
const
|
|
58910
|
-
if (
|
|
58911
|
-
const v = validateSteelTakeoff(
|
|
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);
|
|
58912
58877
|
if (!v.valid) return reply.status(400).send({ ok: false, error: "stored contract is invalid \u2014 re-save it in the editor" });
|
|
58913
|
-
const { scene, skipped } = contractToScene(
|
|
58878
|
+
const { scene, skipped } = contractToScene(doc);
|
|
58914
58879
|
if (scene.elements.length === 0) {
|
|
58915
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 });
|
|
58916
58881
|
}
|
|
@@ -58939,23 +58904,23 @@ async function startServer() {
|
|
|
58939
58904
|
throw e;
|
|
58940
58905
|
}
|
|
58941
58906
|
const events = result.traceText ? parseTrace(result.traceText) : [];
|
|
58942
|
-
const extracted = extractReportHtml(events
|
|
58907
|
+
const extracted = extractReportHtml(events);
|
|
58943
58908
|
if (!extracted) return reply.send({ ok: false, error: "the 3D render produced no html" });
|
|
58944
58909
|
broadcast({ type: "apps-changed" });
|
|
58945
58910
|
return { ok: true, report: { ...extracted, interactive: true }, skipped };
|
|
58946
58911
|
});
|
|
58947
58912
|
app.post("/api/contract/:appId/export-ifc", async (req, reply) => {
|
|
58948
|
-
const
|
|
58949
|
-
if (
|
|
58950
|
-
const v = validateSteelTakeoff(
|
|
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);
|
|
58951
58916
|
if (!v.valid) return reply.status(400).send({ ok: false, error: "stored contract is invalid \u2014 re-save it in the editor" });
|
|
58952
|
-
const { scene, skipped } = contractToScene(
|
|
58917
|
+
const { scene, skipped } = contractToScene(doc);
|
|
58953
58918
|
if (scene.elements.length === 0) {
|
|
58954
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 });
|
|
58955
58920
|
}
|
|
58956
58921
|
const companionId = `${req.params.appId}-ifc`;
|
|
58957
58922
|
const filename = `${req.params.appId}.ifc`;
|
|
58958
|
-
const outPath = (0,
|
|
58923
|
+
const outPath = (0, import_node_path26.join)(appPath(companionId), filename);
|
|
58959
58924
|
let flo;
|
|
58960
58925
|
try {
|
|
58961
58926
|
flo = writeIfcApp(appPath(companionId), companionId, scene, outPath);
|
|
@@ -58978,17 +58943,17 @@ async function startServer() {
|
|
|
58978
58943
|
}
|
|
58979
58944
|
throw e;
|
|
58980
58945
|
}
|
|
58981
|
-
if (!(0,
|
|
58982
|
-
const content = (0,
|
|
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");
|
|
58983
58948
|
broadcast({ type: "apps-changed" });
|
|
58984
58949
|
return { ok: true, filename, content, bytes: Buffer.byteLength(content), skipped };
|
|
58985
58950
|
});
|
|
58986
58951
|
app.post("/api/contract/:appId/export-tekla", async (req, reply) => {
|
|
58987
|
-
const
|
|
58988
|
-
if (
|
|
58989
|
-
const v = validateSteelTakeoff(
|
|
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);
|
|
58990
58955
|
if (!v.valid) return reply.status(400).send({ ok: false, error: "stored contract is invalid \u2014 re-save it in the editor" });
|
|
58991
|
-
const { scene, skipped } = contractToScene(
|
|
58956
|
+
const { scene, skipped } = contractToScene(doc);
|
|
58992
58957
|
if (scene.elements.length === 0) {
|
|
58993
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 });
|
|
58994
58959
|
}
|
|
@@ -59128,11 +59093,11 @@ async function startServer() {
|
|
|
59128
59093
|
if (appExists(id)) {
|
|
59129
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 });
|
|
59130
59095
|
}
|
|
59131
|
-
const stageRoot = (0,
|
|
59096
|
+
const stageRoot = (0, import_node_fs28.mkdtempSync)((0, import_node_path26.join)((0, import_node_os18.tmpdir)(), "floless-import-"));
|
|
59132
59097
|
try {
|
|
59133
|
-
const stageDir = (0,
|
|
59134
|
-
(0,
|
|
59135
|
-
(0,
|
|
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);
|
|
59136
59101
|
await aware.install(stageDir);
|
|
59137
59102
|
} catch (err) {
|
|
59138
59103
|
try {
|
|
@@ -59142,7 +59107,7 @@ async function startServer() {
|
|
|
59142
59107
|
const msg = err instanceof AwareError ? err.message : String(err?.message ?? err);
|
|
59143
59108
|
return reply.status(502).send({ ok: false, error: `import failed: ${msg}` });
|
|
59144
59109
|
} finally {
|
|
59145
|
-
(0,
|
|
59110
|
+
(0, import_node_fs28.rmSync)(stageRoot, { recursive: true, force: true });
|
|
59146
59111
|
}
|
|
59147
59112
|
broadcast({ type: "apps-changed", id });
|
|
59148
59113
|
return { ok: true, id };
|
|
@@ -59156,13 +59121,13 @@ async function startServer() {
|
|
|
59156
59121
|
}
|
|
59157
59122
|
const inputs = appData.inputs.map((i) => ({ name: i.name, type: i.type }));
|
|
59158
59123
|
const baked = bakeFloSource(appData.source.text, inputs);
|
|
59159
|
-
const tmpRoot = (0,
|
|
59160
|
-
const backupDir2 = (0,
|
|
59161
|
-
const bakeDir = (0,
|
|
59162
|
-
(0,
|
|
59163
|
-
(0,
|
|
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 });
|
|
59164
59129
|
const floName = appData.source.path.split(/[\\/]/).pop();
|
|
59165
|
-
(0,
|
|
59130
|
+
(0, import_node_fs28.writeFileSync)((0, import_node_path26.join)(bakeDir, floName), baked);
|
|
59166
59131
|
let appInstalled2 = true;
|
|
59167
59132
|
try {
|
|
59168
59133
|
await aware.uninstall(id);
|
|
@@ -59184,17 +59149,17 @@ async function startServer() {
|
|
|
59184
59149
|
throw installErr;
|
|
59185
59150
|
}
|
|
59186
59151
|
try {
|
|
59187
|
-
await aware.compile((0,
|
|
59152
|
+
await aware.compile((0, import_node_path26.join)(appDir(id), floName));
|
|
59188
59153
|
} catch (compileErr) {
|
|
59189
59154
|
app.log.warn({ id, compileErr: String(compileErr) }, "bake: post-install recompile failed (app baked but may need a manual Compile)");
|
|
59190
59155
|
}
|
|
59191
59156
|
broadcast({ type: "baked", id });
|
|
59192
59157
|
return { ok: true, id, agent: id, inputs };
|
|
59193
59158
|
} finally {
|
|
59194
|
-
if (appInstalled2) (0,
|
|
59159
|
+
if (appInstalled2) (0, import_node_fs28.rmSync)(tmpRoot, { recursive: true, force: true });
|
|
59195
59160
|
}
|
|
59196
59161
|
});
|
|
59197
|
-
const graftAgentsDir = () => (0,
|
|
59162
|
+
const graftAgentsDir = () => (0, import_node_path26.join)((0, import_node_os18.homedir)(), ".aware", "agents");
|
|
59198
59163
|
app.post("/api/graft/match", async (req, reply) => {
|
|
59199
59164
|
const { glob } = req.body ?? {};
|
|
59200
59165
|
if (!glob) return reply.status(400).send({ ok: false, error: "glob required" });
|
|
@@ -59211,7 +59176,7 @@ async function startServer() {
|
|
|
59211
59176
|
if (!sourceKind || !sourceRef) {
|
|
59212
59177
|
return reply.status(400).send({ ok: false, error: "sourceKind and sourceRef required" });
|
|
59213
59178
|
}
|
|
59214
|
-
const tempHome = (0,
|
|
59179
|
+
const tempHome = (0, import_node_fs28.mkdtempSync)((0, import_node_path26.join)((0, import_node_os18.tmpdir)(), "floless-graft-"));
|
|
59215
59180
|
let result;
|
|
59216
59181
|
try {
|
|
59217
59182
|
result = await aware.build({
|
|
@@ -59224,19 +59189,19 @@ async function startServer() {
|
|
|
59224
59189
|
awareHome: tempHome
|
|
59225
59190
|
});
|
|
59226
59191
|
} catch (err) {
|
|
59227
|
-
(0,
|
|
59192
|
+
(0, import_node_fs28.rmSync)(tempHome, { recursive: true, force: true });
|
|
59228
59193
|
const msg = err instanceof AwareError ? err.message : String(err?.message ?? err);
|
|
59229
59194
|
return reply.status(422).send({ ok: false, error: msg });
|
|
59230
59195
|
}
|
|
59231
59196
|
const manifest = readStagedManifest(result.agentDir);
|
|
59232
59197
|
if (!manifest) {
|
|
59233
|
-
(0,
|
|
59198
|
+
(0, import_node_fs28.rmSync)(tempHome, { recursive: true, force: true });
|
|
59234
59199
|
return reply.status(502).send({ ok: false, error: `build produced output at ${result.agentDir} but no manifest.yaml` });
|
|
59235
59200
|
}
|
|
59236
59201
|
const token = (0, import_node_crypto7.randomUUID)();
|
|
59237
59202
|
registerStage(token, tempHome, result.agentId);
|
|
59238
59203
|
const preview = buildPreview(manifest, sourceKind, sourceRef, token);
|
|
59239
|
-
if ((0,
|
|
59204
|
+
if ((0, import_node_fs28.existsSync)((0, import_node_path26.join)(graftAgentsDir(), result.agentId))) {
|
|
59240
59205
|
preview.warnings.unshift(`An agent named "${result.agentId}" is already installed \u2014 creating it will overwrite it.`);
|
|
59241
59206
|
}
|
|
59242
59207
|
return { ok: true, preview };
|
|
@@ -59255,7 +59220,7 @@ async function startServer() {
|
|
|
59255
59220
|
registerStage(stagedRef, stage.tempDir, stage.agentId);
|
|
59256
59221
|
return reply.status(409).send({ ok: false, error: err.message, agentId: stage.agentId, collision: true });
|
|
59257
59222
|
}
|
|
59258
|
-
(0,
|
|
59223
|
+
(0, import_node_fs28.rmSync)(stage.tempDir, { recursive: true, force: true });
|
|
59259
59224
|
throw err;
|
|
59260
59225
|
}
|
|
59261
59226
|
broadcast({ type: "grafted", id: stage.agentId });
|
|
@@ -59293,10 +59258,9 @@ async function startServer() {
|
|
|
59293
59258
|
if (!id) return reply.status(400).send({ ok: false, error: "id required" });
|
|
59294
59259
|
const blocked = hostRunBlocked(appProvider(id));
|
|
59295
59260
|
if (blocked) return reply.send({ ok: false, error: blocked, blocked: true, simulate: !!simulate });
|
|
59296
|
-
const runInputs = steelIfcRunInputs(id, inputs);
|
|
59297
59261
|
let result;
|
|
59298
59262
|
try {
|
|
59299
|
-
result = await aware.run(id, { dryRun, simulate, inputs
|
|
59263
|
+
result = await aware.run(id, { dryRun, simulate, inputs });
|
|
59300
59264
|
} catch (err) {
|
|
59301
59265
|
if (err instanceof AwareError) {
|
|
59302
59266
|
const detail = err.detail && typeof err.detail === "object" ? err.detail : null;
|
|
@@ -59315,7 +59279,7 @@ async function startServer() {
|
|
|
59315
59279
|
broadcast({ type: "run-started", id, dryRun: !!dryRun, simulate: !!simulate, runId: result.runId });
|
|
59316
59280
|
for (const ev of events) broadcast({ type: "trace", id, event: ev });
|
|
59317
59281
|
broadcast({ type: "run-ended", id, runId: result.runId });
|
|
59318
|
-
const extracted = extractReportHtml(events
|
|
59282
|
+
const extracted = extractReportHtml(events);
|
|
59319
59283
|
let report = null;
|
|
59320
59284
|
if (extracted) {
|
|
59321
59285
|
let interactive = false;
|
|
@@ -59488,11 +59452,11 @@ async function startServer() {
|
|
|
59488
59452
|
app.get("/api/requests/:id/snapshot/:n", async (req, reply) => {
|
|
59489
59453
|
const n = Number.parseInt(req.params.n, 10);
|
|
59490
59454
|
const p = Number.isInteger(n) ? snapshotPathFor(req.params.id, n) : null;
|
|
59491
|
-
if (!p || !(0,
|
|
59455
|
+
if (!p || !(0, import_node_fs28.existsSync)(p)) return reply.status(404).send({ ok: false, error: "snapshot not found" });
|
|
59492
59456
|
const ext = p.split(".").pop().toLowerCase();
|
|
59493
59457
|
reply.header("Content-Type", ext === "png" ? "image/png" : ext === "webp" ? "image/webp" : ext === "pdf" ? "application/pdf" : "image/jpeg");
|
|
59494
59458
|
reply.header("Cache-Control", "no-store");
|
|
59495
|
-
return (0,
|
|
59459
|
+
return (0, import_node_fs28.readFileSync)(p);
|
|
59496
59460
|
});
|
|
59497
59461
|
app.post(
|
|
59498
59462
|
"/api/tweak",
|
|
@@ -59631,7 +59595,7 @@ async function startServer() {
|
|
|
59631
59595
|
runId: latest.runId,
|
|
59632
59596
|
status: summarizeRun(events).status,
|
|
59633
59597
|
rows: extractRunRows(events),
|
|
59634
|
-
html: withBadge(extractReportHtml(events
|
|
59598
|
+
html: withBadge(extractReportHtml(events))?.html ?? null
|
|
59635
59599
|
};
|
|
59636
59600
|
}
|
|
59637
59601
|
if (kind === "last-run-status") {
|
|
@@ -59642,7 +59606,7 @@ async function startServer() {
|
|
|
59642
59606
|
warn(`last-run-status:${ref} \u2014 trace exists but couldn't be parsed (corrupt/truncated)`);
|
|
59643
59607
|
let finishedAt2 = null;
|
|
59644
59608
|
try {
|
|
59645
|
-
finishedAt2 = (0,
|
|
59609
|
+
finishedAt2 = (0, import_node_fs28.statSync)(latest.path).mtime.toISOString();
|
|
59646
59610
|
} catch {
|
|
59647
59611
|
finishedAt2 = null;
|
|
59648
59612
|
}
|
|
@@ -59652,7 +59616,7 @@ async function startServer() {
|
|
|
59652
59616
|
let finishedAt = typeof runEnd?.ts === "string" ? runEnd.ts : null;
|
|
59653
59617
|
if (!finishedAt) {
|
|
59654
59618
|
try {
|
|
59655
|
-
finishedAt = (0,
|
|
59619
|
+
finishedAt = (0, import_node_fs28.statSync)(latest.path).mtime.toISOString();
|
|
59656
59620
|
} catch {
|
|
59657
59621
|
finishedAt = null;
|
|
59658
59622
|
}
|