@floless/app 0.28.0 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/floless-server.cjs +700 -271
- package/dist/schemas/steel.takeoff.v1.schema.json +148 -0
- package/dist/skills/floless-app-tweak-contract/SKILL.md +111 -0
- package/dist/web/app.css +31 -0
- package/dist/web/aware.js +105 -3
- package/dist/web/index.html +14 -0
- package/dist/web/renderers.js +25 -0
- package/dist/web/steel-editor.html +1019 -0
- package/package.json +1 -1
package/dist/floless-server.cjs
CHANGED
|
@@ -3201,7 +3201,7 @@ var require_validation = __commonJS({
|
|
|
3201
3201
|
return false;
|
|
3202
3202
|
}
|
|
3203
3203
|
}
|
|
3204
|
-
function
|
|
3204
|
+
function validate2(context, request, execution) {
|
|
3205
3205
|
const runExecution = execution === void 0;
|
|
3206
3206
|
if (runExecution || !execution.skipParams) {
|
|
3207
3207
|
const params = validateParam(context[paramsSchema], request, "params");
|
|
@@ -3258,7 +3258,7 @@ var require_validation = __commonJS({
|
|
|
3258
3258
|
if (paramsResult) {
|
|
3259
3259
|
return wrapValidationError(paramsResult, "params", context.schemaErrorFormatter);
|
|
3260
3260
|
}
|
|
3261
|
-
return
|
|
3261
|
+
return validate2(context, request, { skipParams: true });
|
|
3262
3262
|
});
|
|
3263
3263
|
}
|
|
3264
3264
|
function validateAsyncBody(validatePromise, context, request) {
|
|
@@ -3266,7 +3266,7 @@ var require_validation = __commonJS({
|
|
|
3266
3266
|
if (bodyResult) {
|
|
3267
3267
|
return wrapValidationError(bodyResult, "body", context.schemaErrorFormatter);
|
|
3268
3268
|
}
|
|
3269
|
-
return
|
|
3269
|
+
return validate2(context, request, { skipParams: true, skipBody: true });
|
|
3270
3270
|
});
|
|
3271
3271
|
}
|
|
3272
3272
|
function validateAsyncQuery(validatePromise, context, request) {
|
|
@@ -3274,7 +3274,7 @@ var require_validation = __commonJS({
|
|
|
3274
3274
|
if (queryResult) {
|
|
3275
3275
|
return wrapValidationError(queryResult, "querystring", context.schemaErrorFormatter);
|
|
3276
3276
|
}
|
|
3277
|
-
return
|
|
3277
|
+
return validate2(context, request, { skipParams: true, skipBody: true, skipQuery: true });
|
|
3278
3278
|
});
|
|
3279
3279
|
}
|
|
3280
3280
|
function validateAsyncHeaders(validatePromise, context, request) {
|
|
@@ -3307,7 +3307,7 @@ var require_validation = __commonJS({
|
|
|
3307
3307
|
symbols: { bodySchema, querystringSchema, responseSchema, paramsSchema, headersSchema },
|
|
3308
3308
|
compileSchemasForValidation,
|
|
3309
3309
|
compileSchemasForSerialization,
|
|
3310
|
-
validate
|
|
3310
|
+
validate: validate2
|
|
3311
3311
|
};
|
|
3312
3312
|
}
|
|
3313
3313
|
});
|
|
@@ -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,10 +6006,10 @@ 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:
|
|
6012
|
-
var { fileURLToPath:
|
|
6011
|
+
var { join: join28, isAbsolute: isAbsolute2, sep: sep4 } = require("node:path");
|
|
6012
|
+
var { fileURLToPath: fileURLToPath5 } = require("node:url");
|
|
6013
6013
|
var sleep = require_atomic_sleep();
|
|
6014
6014
|
var onExit = require_on_exit_leak_free();
|
|
6015
6015
|
var ThreadStream = require_thread_stream();
|
|
@@ -6075,12 +6075,12 @@ var require_transport = __commonJS({
|
|
|
6075
6075
|
let path = unquoted;
|
|
6076
6076
|
if (path.startsWith("file://")) {
|
|
6077
6077
|
try {
|
|
6078
|
-
path =
|
|
6078
|
+
path = fileURLToPath5(path);
|
|
6079
6079
|
} catch {
|
|
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) {
|
|
@@ -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 = `
|
|
@@ -11094,21 +11094,21 @@ var require_request = __commonJS({
|
|
|
11094
11094
|
value: function(input, schema, httpPart) {
|
|
11095
11095
|
httpPart = typeof schema === "string" ? schema : httpPart;
|
|
11096
11096
|
const symbol = httpPart != null && typeof httpPart === "string" && HTTP_PART_SYMBOL_MAP[httpPart];
|
|
11097
|
-
let
|
|
11097
|
+
let validate2;
|
|
11098
11098
|
if (symbol) {
|
|
11099
|
-
|
|
11099
|
+
validate2 = this[kRouteContext][symbol];
|
|
11100
11100
|
}
|
|
11101
|
-
if (
|
|
11101
|
+
if (validate2 == null && (schema == null || typeof schema !== "object" || Array.isArray(schema))) {
|
|
11102
11102
|
throw new FST_ERR_REQ_INVALID_VALIDATION_INVOCATION(httpPart);
|
|
11103
11103
|
}
|
|
11104
|
-
if (
|
|
11104
|
+
if (validate2 == null) {
|
|
11105
11105
|
if (this[kRouteContext][kRequestCacheValidateFns]?.has(schema)) {
|
|
11106
|
-
|
|
11106
|
+
validate2 = this[kRouteContext][kRequestCacheValidateFns].get(schema);
|
|
11107
11107
|
} else {
|
|
11108
|
-
|
|
11108
|
+
validate2 = this.compileValidationSchema(schema, httpPart);
|
|
11109
11109
|
}
|
|
11110
11110
|
}
|
|
11111
|
-
return
|
|
11111
|
+
return validate2(input);
|
|
11112
11112
|
}
|
|
11113
11113
|
},
|
|
11114
11114
|
getDecorator: {
|
|
@@ -14195,8 +14195,8 @@ var require_keyword = __commonJS({
|
|
|
14195
14195
|
var _a;
|
|
14196
14196
|
const { gen, keyword, schema, parentSchema, $data, it } = cxt;
|
|
14197
14197
|
checkAsyncKeyword(it, def);
|
|
14198
|
-
const
|
|
14199
|
-
const validateRef = useKeyword(gen, keyword,
|
|
14198
|
+
const validate2 = !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate;
|
|
14199
|
+
const validateRef = useKeyword(gen, keyword, validate2);
|
|
14200
14200
|
const valid = gen.let("valid");
|
|
14201
14201
|
cxt.block$data(valid, validateKeyword);
|
|
14202
14202
|
cxt.ok((_a = def.valid) !== null && _a !== void 0 ? _a : valid);
|
|
@@ -15269,28 +15269,28 @@ var require_compile = __commonJS({
|
|
|
15269
15269
|
if (this.opts.code.process)
|
|
15270
15270
|
sourceCode = this.opts.code.process(sourceCode, sch);
|
|
15271
15271
|
const makeValidate = new Function(`${names_1.default.self}`, `${names_1.default.scope}`, sourceCode);
|
|
15272
|
-
const
|
|
15273
|
-
this.scope.value(validateName, { ref:
|
|
15274
|
-
|
|
15275
|
-
|
|
15276
|
-
|
|
15272
|
+
const validate2 = makeValidate(this, this.scope.get());
|
|
15273
|
+
this.scope.value(validateName, { ref: validate2 });
|
|
15274
|
+
validate2.errors = null;
|
|
15275
|
+
validate2.schema = sch.schema;
|
|
15276
|
+
validate2.schemaEnv = sch;
|
|
15277
15277
|
if (sch.$async)
|
|
15278
|
-
|
|
15278
|
+
validate2.$async = true;
|
|
15279
15279
|
if (this.opts.code.source === true) {
|
|
15280
|
-
|
|
15280
|
+
validate2.source = { validateName, validateCode, scopeValues: gen._values };
|
|
15281
15281
|
}
|
|
15282
15282
|
if (this.opts.unevaluated) {
|
|
15283
15283
|
const { props, items } = schemaCxt;
|
|
15284
|
-
|
|
15284
|
+
validate2.evaluated = {
|
|
15285
15285
|
props: props instanceof codegen_1.Name ? void 0 : props,
|
|
15286
15286
|
items: items instanceof codegen_1.Name ? void 0 : items,
|
|
15287
15287
|
dynamicProps: props instanceof codegen_1.Name,
|
|
15288
15288
|
dynamicItems: items instanceof codegen_1.Name
|
|
15289
15289
|
};
|
|
15290
|
-
if (
|
|
15291
|
-
|
|
15290
|
+
if (validate2.source)
|
|
15291
|
+
validate2.source.evaluated = (0, codegen_1.stringify)(validate2.evaluated);
|
|
15292
15292
|
}
|
|
15293
|
-
sch.validate =
|
|
15293
|
+
sch.validate = validate2;
|
|
15294
15294
|
return sch;
|
|
15295
15295
|
} catch (e) {
|
|
15296
15296
|
delete sch.validate;
|
|
@@ -15303,7 +15303,7 @@ var require_compile = __commonJS({
|
|
|
15303
15303
|
}
|
|
15304
15304
|
}
|
|
15305
15305
|
exports2.compileSchema = compileSchema;
|
|
15306
|
-
function
|
|
15306
|
+
function resolveRef2(root, baseId, ref) {
|
|
15307
15307
|
var _a;
|
|
15308
15308
|
ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref);
|
|
15309
15309
|
const schOrFunc = root.refs[ref];
|
|
@@ -15320,7 +15320,7 @@ var require_compile = __commonJS({
|
|
|
15320
15320
|
return;
|
|
15321
15321
|
return root.refs[ref] = inlineOrCompile.call(this, _sch);
|
|
15322
15322
|
}
|
|
15323
|
-
exports2.resolveRef =
|
|
15323
|
+
exports2.resolveRef = resolveRef2;
|
|
15324
15324
|
function inlineOrCompile(sch) {
|
|
15325
15325
|
if ((0, resolve_1.inlineRef)(sch.schema, this.opts.inlineRefs))
|
|
15326
15326
|
return sch.schema;
|
|
@@ -20616,8 +20616,8 @@ var require_formats = __commonJS({
|
|
|
20616
20616
|
"use strict";
|
|
20617
20617
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
20618
20618
|
exports2.formatNames = exports2.fastFormats = exports2.fullFormats = void 0;
|
|
20619
|
-
function fmtDef(
|
|
20620
|
-
return { validate, compare };
|
|
20619
|
+
function fmtDef(validate2, compare) {
|
|
20620
|
+
return { validate: validate2, compare };
|
|
20621
20621
|
}
|
|
20622
20622
|
exports2.fullFormats = {
|
|
20623
20623
|
// date: http://tools.ietf.org/html/rfc3339#section-5.6
|
|
@@ -21058,14 +21058,14 @@ var require_standalone = __commonJS({
|
|
|
21058
21058
|
const v = vRef;
|
|
21059
21059
|
return validateCode(usedValues, v.source);
|
|
21060
21060
|
} else if ((n.prefix === "root" || n.prefix === "wrapper") && typeof vRef == "object") {
|
|
21061
|
-
const { validate, validateName } = vRef;
|
|
21061
|
+
const { validate: validate2, validateName } = vRef;
|
|
21062
21062
|
if (!validateName)
|
|
21063
21063
|
throw new Error("ajv internal error");
|
|
21064
21064
|
const def = ajv.opts.code.es5 ? scope_1.varKinds.var : scope_1.varKinds.const;
|
|
21065
21065
|
const wrapper = (0, code_1._)`${def} ${n} = {validate: ${validateName}};`;
|
|
21066
21066
|
if (usedState(validateName) === scope_1.UsedValueState.Started)
|
|
21067
21067
|
return wrapper;
|
|
21068
|
-
const vCode = validateCode(usedValues,
|
|
21068
|
+
const vCode = validateCode(usedValues, validate2 === null || validate2 === void 0 ? void 0 : validate2.source);
|
|
21069
21069
|
return (0, code_1._)`${wrapper}${_n}${vCode}`;
|
|
21070
21070
|
}
|
|
21071
21071
|
return void 0;
|
|
@@ -21259,7 +21259,7 @@ var require_dist2 = __commonJS({
|
|
|
21259
21259
|
var require_json_schema_ref_resolver = __commonJS({
|
|
21260
21260
|
"node_modules/json-schema-ref-resolver/index.js"(exports2, module2) {
|
|
21261
21261
|
"use strict";
|
|
21262
|
-
var { dequal:
|
|
21262
|
+
var { dequal: deepEqual2 } = require_dist2();
|
|
21263
21263
|
var jsonSchemaRefSymbol = /* @__PURE__ */ Symbol.for("json-schema-ref");
|
|
21264
21264
|
var RefResolver = class {
|
|
21265
21265
|
#schemas;
|
|
@@ -21445,7 +21445,7 @@ var require_json_schema_ref_resolver = __commonJS({
|
|
|
21445
21445
|
for (const key in targetSchema) {
|
|
21446
21446
|
if (key === "$id") continue;
|
|
21447
21447
|
if (sourceSchema[key] !== void 0) {
|
|
21448
|
-
if (
|
|
21448
|
+
if (deepEqual2(sourceSchema[key], targetSchema[key])) continue;
|
|
21449
21449
|
throw new Error(
|
|
21450
21450
|
`Cannot resolve ref "${ref.ref}". Property "${key}" already exists in schema "${ref.sourceSchemaId}".`
|
|
21451
21451
|
);
|
|
@@ -21457,7 +21457,7 @@ var require_json_schema_ref_resolver = __commonJS({
|
|
|
21457
21457
|
#insertSchemaBySchemaId(schema, schemaId) {
|
|
21458
21458
|
const foundSchema = this.#schemas[schemaId];
|
|
21459
21459
|
if (foundSchema !== void 0) {
|
|
21460
|
-
if (this.#allowEqualDuplicates &&
|
|
21460
|
+
if (this.#allowEqualDuplicates && deepEqual2(schema, foundSchema.schema)) return;
|
|
21461
21461
|
throw new Error(`There is already another schema with id "${schemaId}".`);
|
|
21462
21462
|
}
|
|
21463
21463
|
this.#schemas[schemaId] = { schema, anchors: {}, refs: [] };
|
|
@@ -22696,7 +22696,7 @@ var require_errors4 = __commonJS({
|
|
|
22696
22696
|
var require_resolvers = __commonJS({
|
|
22697
22697
|
"node_modules/@fastify/merge-json-schemas/lib/resolvers.js"(exports2, module2) {
|
|
22698
22698
|
"use strict";
|
|
22699
|
-
var { dequal:
|
|
22699
|
+
var { dequal: deepEqual2 } = require_dist2();
|
|
22700
22700
|
var { MergeError } = require_errors4();
|
|
22701
22701
|
function _arraysIntersection(arrays) {
|
|
22702
22702
|
let intersection = arrays[0];
|
|
@@ -22765,7 +22765,7 @@ var require_resolvers = __commonJS({
|
|
|
22765
22765
|
function allEqual(keyword, values, mergedSchema) {
|
|
22766
22766
|
const firstValue = values[0];
|
|
22767
22767
|
for (let i = 1; i < values.length; i++) {
|
|
22768
|
-
if (!
|
|
22768
|
+
if (!deepEqual2(values[i], firstValue)) {
|
|
22769
22769
|
throw new MergeError(keyword, values);
|
|
22770
22770
|
}
|
|
22771
22771
|
}
|
|
@@ -22810,7 +22810,7 @@ var require_resolvers = __commonJS({
|
|
|
22810
22810
|
var require_merge_json_schemas = __commonJS({
|
|
22811
22811
|
"node_modules/@fastify/merge-json-schemas/index.js"(exports2, module2) {
|
|
22812
22812
|
"use strict";
|
|
22813
|
-
var { dequal:
|
|
22813
|
+
var { dequal: deepEqual2 } = require_dist2();
|
|
22814
22814
|
var resolvers = require_resolvers();
|
|
22815
22815
|
var errors = require_errors4();
|
|
22816
22816
|
var keywordsResolvers = {
|
|
@@ -23082,7 +23082,7 @@ var require_merge_json_schemas = __commonJS({
|
|
|
23082
23082
|
}
|
|
23083
23083
|
let allValuesEqual = true;
|
|
23084
23084
|
for (let i = 1; i < values.length; i++) {
|
|
23085
|
-
if (!
|
|
23085
|
+
if (!deepEqual2(values[i], values[0])) {
|
|
23086
23086
|
allValuesEqual = false;
|
|
23087
23087
|
break;
|
|
23088
23088
|
}
|
|
@@ -23165,7 +23165,7 @@ var require_fast_json_stringify = __commonJS({
|
|
|
23165
23165
|
var Serializer = require_serializer();
|
|
23166
23166
|
var Validator = require_validator();
|
|
23167
23167
|
var Location = require_location();
|
|
23168
|
-
var
|
|
23168
|
+
var validate2 = require_schema_validator();
|
|
23169
23169
|
var mergeSchemas = require_merge_schemas();
|
|
23170
23170
|
var SINGLE_TICK = /'/g;
|
|
23171
23171
|
var largeArraySize = 2e4;
|
|
@@ -23196,19 +23196,19 @@ const asInteger = serializer.asInteger.bind(serializer)
|
|
|
23196
23196
|
]);
|
|
23197
23197
|
var schemaIdCounter = 0;
|
|
23198
23198
|
function isValidSchema(schema, name) {
|
|
23199
|
-
if (!
|
|
23199
|
+
if (!validate2(schema)) {
|
|
23200
23200
|
if (name) {
|
|
23201
23201
|
name = `"${name}" `;
|
|
23202
23202
|
} else {
|
|
23203
23203
|
name = "";
|
|
23204
23204
|
}
|
|
23205
|
-
const first =
|
|
23205
|
+
const first = validate2.errors[0];
|
|
23206
23206
|
const err = new Error(`${name}schema is invalid: data${first.instancePath} ${first.message}`);
|
|
23207
23207
|
err.errors = isValidSchema.errors;
|
|
23208
23208
|
throw err;
|
|
23209
23209
|
}
|
|
23210
23210
|
}
|
|
23211
|
-
function
|
|
23211
|
+
function resolveRef2(context, location) {
|
|
23212
23212
|
const ref = location.schema.$ref;
|
|
23213
23213
|
let hashIndex = ref.indexOf("#");
|
|
23214
23214
|
if (hashIndex === -1) {
|
|
@@ -23222,7 +23222,7 @@ const asInteger = serializer.asInteger.bind(serializer)
|
|
|
23222
23222
|
}
|
|
23223
23223
|
const newLocation = new Location(schema, schemaId, jsonPointer);
|
|
23224
23224
|
if (schema.$ref !== void 0) {
|
|
23225
|
-
return
|
|
23225
|
+
return resolveRef2(context, newLocation);
|
|
23226
23226
|
}
|
|
23227
23227
|
return newLocation;
|
|
23228
23228
|
}
|
|
@@ -23485,7 +23485,7 @@ ${contextFunctionCode}`,
|
|
|
23485
23485
|
const propertyLocation = propertiesLocation.getPropertyLocation(key);
|
|
23486
23486
|
let resolvedLocation = propertyLocation;
|
|
23487
23487
|
if (propertyLocation.schema.$ref) {
|
|
23488
|
-
resolvedLocation =
|
|
23488
|
+
resolvedLocation = resolveRef2(context, propertyLocation);
|
|
23489
23489
|
}
|
|
23490
23490
|
const sanitizedKey = JSON.stringify(key);
|
|
23491
23491
|
const value = `value_${key.replace(/[^a-zA-Z0-9]/g, "_")}_${context.uid++}`;
|
|
@@ -23525,7 +23525,7 @@ ${contextFunctionCode}`,
|
|
|
23525
23525
|
for (const key of propertiesKeys) {
|
|
23526
23526
|
let propertyLocation = propertiesLocation.getPropertyLocation(key);
|
|
23527
23527
|
if (propertyLocation.schema.$ref) {
|
|
23528
|
-
propertyLocation =
|
|
23528
|
+
propertyLocation = resolveRef2(context, propertyLocation);
|
|
23529
23529
|
}
|
|
23530
23530
|
const sanitizedKey = JSON.stringify(key);
|
|
23531
23531
|
const value = `value_${key.replace(/[^a-zA-Z0-9]/g, "_")}_${context.uid++}`;
|
|
@@ -23567,7 +23567,7 @@ ${contextFunctionCode}`,
|
|
|
23567
23567
|
const location = mergedLocations[i];
|
|
23568
23568
|
const schema = location.schema;
|
|
23569
23569
|
if (schema.$ref) {
|
|
23570
|
-
mergedLocations[i] =
|
|
23570
|
+
mergedLocations[i] = resolveRef2(context, location);
|
|
23571
23571
|
}
|
|
23572
23572
|
}
|
|
23573
23573
|
const mergedSchemas = [];
|
|
@@ -23654,7 +23654,7 @@ ${contextFunctionCode}`,
|
|
|
23654
23654
|
let itemsLocation = location.getPropertyLocation("items");
|
|
23655
23655
|
itemsLocation.schema = itemsLocation.schema || {};
|
|
23656
23656
|
if (itemsLocation.schema.$ref) {
|
|
23657
|
-
itemsLocation =
|
|
23657
|
+
itemsLocation = resolveRef2(context, itemsLocation);
|
|
23658
23658
|
}
|
|
23659
23659
|
const itemsSchema = itemsLocation.schema;
|
|
23660
23660
|
if (context.functionsNamesBySchema.has(schema)) {
|
|
@@ -23700,7 +23700,7 @@ ${contextFunctionCode}`,
|
|
|
23700
23700
|
let item = itemsSchema[i];
|
|
23701
23701
|
let itemLocation = itemsLocation.getPropertyLocation(i);
|
|
23702
23702
|
if (itemLocation.schema.$ref) {
|
|
23703
|
-
itemLocation =
|
|
23703
|
+
itemLocation = resolveRef2(context, itemLocation);
|
|
23704
23704
|
item = itemLocation.schema;
|
|
23705
23705
|
}
|
|
23706
23706
|
const value = `value_${i}`;
|
|
@@ -23781,7 +23781,7 @@ ${contextFunctionCode}`,
|
|
|
23781
23781
|
let item = itemsSchema[i];
|
|
23782
23782
|
let itemLocation = itemsLocation.getPropertyLocation(i);
|
|
23783
23783
|
if (itemLocation.schema.$ref) {
|
|
23784
|
-
itemLocation =
|
|
23784
|
+
itemLocation = resolveRef2(context, itemLocation);
|
|
23785
23785
|
item = itemLocation.schema;
|
|
23786
23786
|
}
|
|
23787
23787
|
const value = `value_${i}_${context.uid++}`;
|
|
@@ -24008,7 +24008,7 @@ ${contextFunctionCode}`,
|
|
|
24008
24008
|
pathStack.add(fullPath);
|
|
24009
24009
|
if (schema.$ref) {
|
|
24010
24010
|
try {
|
|
24011
|
-
const res =
|
|
24011
|
+
const res = resolveRef2(context, location2);
|
|
24012
24012
|
traverse(res);
|
|
24013
24013
|
} catch (err) {
|
|
24014
24014
|
}
|
|
@@ -24213,7 +24213,7 @@ ${contextFunctionCode}`,
|
|
|
24213
24213
|
return `json += JSON.stringify(${input})`;
|
|
24214
24214
|
}
|
|
24215
24215
|
if (schema.$ref) {
|
|
24216
|
-
location =
|
|
24216
|
+
location = resolveRef2(context, location);
|
|
24217
24217
|
schema = location.schema;
|
|
24218
24218
|
}
|
|
24219
24219
|
if (schema.allOf) {
|
|
@@ -28124,7 +28124,7 @@ var require_safe_regex2 = __commonJS({
|
|
|
28124
28124
|
"use strict";
|
|
28125
28125
|
var parse = require_dist3();
|
|
28126
28126
|
var { types } = require_dist3();
|
|
28127
|
-
function
|
|
28127
|
+
function walk2(node, opts, starHeight) {
|
|
28128
28128
|
let i;
|
|
28129
28129
|
let ok;
|
|
28130
28130
|
let len;
|
|
@@ -28137,14 +28137,14 @@ var require_safe_regex2 = __commonJS({
|
|
|
28137
28137
|
const options = node.options || node.value?.options;
|
|
28138
28138
|
if (options) {
|
|
28139
28139
|
for (i = 0, len = options.length; i < len; i++) {
|
|
28140
|
-
ok =
|
|
28140
|
+
ok = walk2({ stack: options[i] }, opts, starHeight);
|
|
28141
28141
|
if (!ok) return false;
|
|
28142
28142
|
}
|
|
28143
28143
|
}
|
|
28144
28144
|
const stack = node.stack || node.value?.stack;
|
|
28145
28145
|
if (!stack) return true;
|
|
28146
28146
|
for (i = 0, len = stack.length; i < len; i++) {
|
|
28147
|
-
ok =
|
|
28147
|
+
ok = walk2(stack[i], opts, starHeight);
|
|
28148
28148
|
if (!ok) return false;
|
|
28149
28149
|
}
|
|
28150
28150
|
return true;
|
|
@@ -28157,7 +28157,7 @@ var require_safe_regex2 = __commonJS({
|
|
|
28157
28157
|
if (isRegExp(re)) re = re.source;
|
|
28158
28158
|
else if (typeof re !== "string") re = String(re);
|
|
28159
28159
|
try {
|
|
28160
|
-
return
|
|
28160
|
+
return walk2(parse(re), opts, 0);
|
|
28161
28161
|
} catch {
|
|
28162
28162
|
return false;
|
|
28163
28163
|
}
|
|
@@ -28199,7 +28199,7 @@ var require_http_method = __commonJS({
|
|
|
28199
28199
|
var require_pretty_print = __commonJS({
|
|
28200
28200
|
"node_modules/find-my-way/lib/pretty-print.js"(exports2, module2) {
|
|
28201
28201
|
"use strict";
|
|
28202
|
-
var
|
|
28202
|
+
var deepEqual2 = require_fast_deep_equal();
|
|
28203
28203
|
var httpMethodStrategy = require_http_method();
|
|
28204
28204
|
var treeDataSymbol = /* @__PURE__ */ Symbol("treeData");
|
|
28205
28205
|
function printObjectTree(obj, parentPrefix = "") {
|
|
@@ -28275,7 +28275,7 @@ var require_pretty_print = __commonJS({
|
|
|
28275
28275
|
function mergeSimilarRoutes(routes) {
|
|
28276
28276
|
return routes.reduce((mergedRoutes, route) => {
|
|
28277
28277
|
for (const nodeRoute of mergedRoutes) {
|
|
28278
|
-
if (
|
|
28278
|
+
if (deepEqual2(route.opts.constraints, nodeRoute.opts.constraints) && deepEqual2(route.metaData, nodeRoute.metaData)) {
|
|
28279
28279
|
nodeRoute.method += ", " + route.method;
|
|
28280
28280
|
return mergedRoutes;
|
|
28281
28281
|
}
|
|
@@ -29058,7 +29058,7 @@ var require_find_my_way = __commonJS({
|
|
|
29058
29058
|
var assert = require("node:assert");
|
|
29059
29059
|
var querystring = require_lib();
|
|
29060
29060
|
var isRegexSafe = require_safe_regex2();
|
|
29061
|
-
var
|
|
29061
|
+
var deepEqual2 = require_fast_deep_equal();
|
|
29062
29062
|
var { prettyPrintTree } = require_pretty_print();
|
|
29063
29063
|
var { StaticNode, NODE_TYPES } = require_node();
|
|
29064
29064
|
var Constrainer = require_constrainer();
|
|
@@ -29269,7 +29269,7 @@ var require_find_my_way = __commonJS({
|
|
|
29269
29269
|
}
|
|
29270
29270
|
for (const existRoute of this.routes) {
|
|
29271
29271
|
const routeConstraints = existRoute.opts.constraints || {};
|
|
29272
|
-
if (existRoute.method === method && existRoute.pattern === pattern &&
|
|
29272
|
+
if (existRoute.method === method && existRoute.pattern === pattern && deepEqual2(routeConstraints, constraints)) {
|
|
29273
29273
|
throw new Error(`Method '${method}' already declared for route '${pattern}' with constraints '${JSON.stringify(constraints)}'`);
|
|
29274
29274
|
}
|
|
29275
29275
|
}
|
|
@@ -29382,7 +29382,7 @@ var require_find_my_way = __commonJS({
|
|
|
29382
29382
|
}
|
|
29383
29383
|
for (const existRoute of this.routes) {
|
|
29384
29384
|
const routeConstraints = existRoute.opts.constraints || {};
|
|
29385
|
-
if (existRoute.method === method && existRoute.pattern === pattern &&
|
|
29385
|
+
if (existRoute.method === method && existRoute.pattern === pattern && deepEqual2(routeConstraints, constraints)) {
|
|
29386
29386
|
return {
|
|
29387
29387
|
handler: existRoute.handler,
|
|
29388
29388
|
store: existRoute.store,
|
|
@@ -29438,7 +29438,7 @@ var require_find_my_way = __commonJS({
|
|
|
29438
29438
|
return method !== route.method || path !== route.path;
|
|
29439
29439
|
}
|
|
29440
29440
|
function matcherWithConstraints(route) {
|
|
29441
|
-
return matcherWithoutConstraints(route) || !
|
|
29441
|
+
return matcherWithoutConstraints(route) || !deepEqual2(constraints, route.opts.constraints || {});
|
|
29442
29442
|
}
|
|
29443
29443
|
const predicate = constraints ? matcherWithConstraints : matcherWithoutConstraints;
|
|
29444
29444
|
const newRoutes = this.routes.filter(predicate);
|
|
@@ -31612,14 +31612,14 @@ var require_config_validator = __commonJS({
|
|
|
31612
31612
|
var require_initial_config_validation = __commonJS({
|
|
31613
31613
|
"node_modules/fastify/lib/initial-config-validation.js"(exports2, module2) {
|
|
31614
31614
|
"use strict";
|
|
31615
|
-
var
|
|
31615
|
+
var validate2 = require_config_validator();
|
|
31616
31616
|
var deepClone = require_rfdc()({ circles: true, proto: false });
|
|
31617
31617
|
var { FST_ERR_INIT_OPTS_INVALID } = require_errors2();
|
|
31618
31618
|
function validateInitialConfig(options) {
|
|
31619
31619
|
const opts = deepClone(options);
|
|
31620
|
-
if (!
|
|
31621
|
-
const error = new FST_ERR_INIT_OPTS_INVALID(JSON.stringify(
|
|
31622
|
-
error.errors =
|
|
31620
|
+
if (!validate2(opts)) {
|
|
31621
|
+
const error = new FST_ERR_INIT_OPTS_INVALID(JSON.stringify(validate2.errors.map((e) => e.message)));
|
|
31622
|
+
error.errors = validate2.errors;
|
|
31623
31623
|
throw error;
|
|
31624
31624
|
}
|
|
31625
31625
|
return deepFreezeObject(opts);
|
|
@@ -31636,7 +31636,7 @@ var require_initial_config_validation = __commonJS({
|
|
|
31636
31636
|
return Object.freeze(object);
|
|
31637
31637
|
}
|
|
31638
31638
|
module2.exports = validateInitialConfig;
|
|
31639
|
-
module2.exports.defaultInitOptions =
|
|
31639
|
+
module2.exports.defaultInitOptions = validate2.defaultInitOptions;
|
|
31640
31640
|
module2.exports.utils = { deepFreezeObject };
|
|
31641
31641
|
}
|
|
31642
31642
|
});
|
|
@@ -39303,7 +39303,7 @@ var require_commonjs5 = __commonJS({
|
|
|
39303
39303
|
results.push(withFileTypes ? entry2 : entry2.fullpath());
|
|
39304
39304
|
}
|
|
39305
39305
|
const dirs = /* @__PURE__ */ new Set();
|
|
39306
|
-
const
|
|
39306
|
+
const walk2 = (dir, cb) => {
|
|
39307
39307
|
dirs.add(dir);
|
|
39308
39308
|
dir.readdirCB((er, entries) => {
|
|
39309
39309
|
if (er) {
|
|
@@ -39322,10 +39322,10 @@ var require_commonjs5 = __commonJS({
|
|
|
39322
39322
|
results.push(withFileTypes ? e : e.fullpath());
|
|
39323
39323
|
}
|
|
39324
39324
|
if (follow && e.isSymbolicLink()) {
|
|
39325
|
-
e.realpath().then((r) => r?.isUnknown() ? r.lstat() : r).then((r) => r?.shouldWalk(dirs, walkFilter) ?
|
|
39325
|
+
e.realpath().then((r) => r?.isUnknown() ? r.lstat() : r).then((r) => r?.shouldWalk(dirs, walkFilter) ? walk2(r, next) : next());
|
|
39326
39326
|
} else {
|
|
39327
39327
|
if (e.shouldWalk(dirs, walkFilter)) {
|
|
39328
|
-
|
|
39328
|
+
walk2(e, next);
|
|
39329
39329
|
} else {
|
|
39330
39330
|
next();
|
|
39331
39331
|
}
|
|
@@ -39335,7 +39335,7 @@ var require_commonjs5 = __commonJS({
|
|
|
39335
39335
|
};
|
|
39336
39336
|
const start = entry2;
|
|
39337
39337
|
return new Promise((res, rej) => {
|
|
39338
|
-
|
|
39338
|
+
walk2(start, (er) => {
|
|
39339
39339
|
if (er)
|
|
39340
39340
|
return rej(er);
|
|
39341
39341
|
res(results);
|
|
@@ -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);
|
|
@@ -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;
|
|
@@ -43011,7 +43011,7 @@ var require_static = __commonJS({
|
|
|
43011
43011
|
"node_modules/@fastify/static/index.js"(exports2, module2) {
|
|
43012
43012
|
"use strict";
|
|
43013
43013
|
var path = require("node:path");
|
|
43014
|
-
var { fileURLToPath:
|
|
43014
|
+
var { fileURLToPath: fileURLToPath5 } = require("node:url");
|
|
43015
43015
|
var { statSync: statSync8 } = require("node:fs");
|
|
43016
43016
|
var { glob } = require_commonjs6();
|
|
43017
43017
|
var fp = require_plugin2();
|
|
@@ -43145,8 +43145,8 @@ var require_static = __commonJS({
|
|
|
43145
43145
|
}
|
|
43146
43146
|
}
|
|
43147
43147
|
}
|
|
43148
|
-
for (const [
|
|
43149
|
-
const pathname =
|
|
43148
|
+
for (const [dirname11, rootPath] of indexDirs.entries()) {
|
|
43149
|
+
const pathname = dirname11 + (dirname11.endsWith("/") ? "" : "/");
|
|
43150
43150
|
const file = "/" + pathname.replace(prefix, "");
|
|
43151
43151
|
setUpHeadAndGet(routeOpts, pathname, file, rootPath);
|
|
43152
43152
|
if (opts.redirect === true) {
|
|
@@ -43330,13 +43330,13 @@ var require_static = __commonJS({
|
|
|
43330
43330
|
return root;
|
|
43331
43331
|
}
|
|
43332
43332
|
if (root instanceof URL && root.protocol === "file:") {
|
|
43333
|
-
return
|
|
43333
|
+
return fileURLToPath5(root);
|
|
43334
43334
|
}
|
|
43335
43335
|
if (Array.isArray(root)) {
|
|
43336
43336
|
const result = [];
|
|
43337
43337
|
for (let i = 0, il = root.length; i < il; ++i) {
|
|
43338
43338
|
if (root[i] instanceof URL && root[i].protocol === "file:") {
|
|
43339
|
-
result.push(
|
|
43339
|
+
result.push(fileURLToPath5(root[i]));
|
|
43340
43340
|
} else {
|
|
43341
43341
|
result.push(root[i]);
|
|
43342
43342
|
}
|
|
@@ -43454,10 +43454,10 @@ var require_identity = __commonJS({
|
|
|
43454
43454
|
var NODE_TYPE = /* @__PURE__ */ Symbol.for("yaml.node.type");
|
|
43455
43455
|
var isAlias = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === ALIAS;
|
|
43456
43456
|
var isDocument = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === DOC;
|
|
43457
|
-
var
|
|
43457
|
+
var isMap3 = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === MAP;
|
|
43458
43458
|
var isPair = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === PAIR;
|
|
43459
43459
|
var isScalar = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === SCALAR;
|
|
43460
|
-
var
|
|
43460
|
+
var isSeq3 = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === SEQ;
|
|
43461
43461
|
function isCollection(node) {
|
|
43462
43462
|
if (node && typeof node === "object")
|
|
43463
43463
|
switch (node[NODE_TYPE]) {
|
|
@@ -43490,11 +43490,11 @@ var require_identity = __commonJS({
|
|
|
43490
43490
|
exports2.isAlias = isAlias;
|
|
43491
43491
|
exports2.isCollection = isCollection;
|
|
43492
43492
|
exports2.isDocument = isDocument;
|
|
43493
|
-
exports2.isMap =
|
|
43493
|
+
exports2.isMap = isMap3;
|
|
43494
43494
|
exports2.isNode = isNode;
|
|
43495
43495
|
exports2.isPair = isPair;
|
|
43496
43496
|
exports2.isScalar = isScalar;
|
|
43497
|
-
exports2.isSeq =
|
|
43497
|
+
exports2.isSeq = isSeq3;
|
|
43498
43498
|
}
|
|
43499
43499
|
});
|
|
43500
43500
|
|
|
@@ -47600,9 +47600,9 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
47600
47600
|
var blockMsg = "Block collections are not allowed within flow collections";
|
|
47601
47601
|
var isBlock = (token) => token && (token.type === "block-map" || token.type === "block-seq");
|
|
47602
47602
|
function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onError, tag) {
|
|
47603
|
-
const
|
|
47604
|
-
const fcName =
|
|
47605
|
-
const NodeClass = tag?.nodeClass ?? (
|
|
47603
|
+
const isMap3 = fc.start.source === "{";
|
|
47604
|
+
const fcName = isMap3 ? "flow map" : "flow sequence";
|
|
47605
|
+
const NodeClass = tag?.nodeClass ?? (isMap3 ? YAMLMap.YAMLMap : YAMLSeq.YAMLSeq);
|
|
47606
47606
|
const coll = new NodeClass(ctx.schema);
|
|
47607
47607
|
coll.flow = true;
|
|
47608
47608
|
const atRoot = ctx.atRoot;
|
|
@@ -47638,7 +47638,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
47638
47638
|
offset = props.end;
|
|
47639
47639
|
continue;
|
|
47640
47640
|
}
|
|
47641
|
-
if (!
|
|
47641
|
+
if (!isMap3 && ctx.options.strict && utilContainsNewline.containsNewline(key))
|
|
47642
47642
|
onError(
|
|
47643
47643
|
key,
|
|
47644
47644
|
// checked by containsNewline()
|
|
@@ -47678,7 +47678,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
47678
47678
|
}
|
|
47679
47679
|
}
|
|
47680
47680
|
}
|
|
47681
|
-
if (!
|
|
47681
|
+
if (!isMap3 && !sep4 && !props.found) {
|
|
47682
47682
|
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep4, null, props, onError);
|
|
47683
47683
|
coll.items.push(valueNode);
|
|
47684
47684
|
offset = valueNode.range[2];
|
|
@@ -47701,7 +47701,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
47701
47701
|
startOnNewline: false
|
|
47702
47702
|
});
|
|
47703
47703
|
if (valueProps.found) {
|
|
47704
|
-
if (!
|
|
47704
|
+
if (!isMap3 && !props.found && ctx.options.strict) {
|
|
47705
47705
|
if (sep4)
|
|
47706
47706
|
for (const st of sep4) {
|
|
47707
47707
|
if (st === valueProps.found)
|
|
@@ -47733,7 +47733,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
47733
47733
|
const pair = new Pair.Pair(keyNode, valueNode);
|
|
47734
47734
|
if (ctx.options.keepSourceTokens)
|
|
47735
47735
|
pair.srcToken = collItem;
|
|
47736
|
-
if (
|
|
47736
|
+
if (isMap3) {
|
|
47737
47737
|
const map = coll;
|
|
47738
47738
|
if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
|
|
47739
47739
|
onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
|
|
@@ -47749,7 +47749,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
47749
47749
|
offset = valueNode ? valueNode.range[2] : valueProps.end;
|
|
47750
47750
|
}
|
|
47751
47751
|
}
|
|
47752
|
-
const expectedEnd =
|
|
47752
|
+
const expectedEnd = isMap3 ? "}" : "]";
|
|
47753
47753
|
const [ce, ...ee] = fc.end;
|
|
47754
47754
|
let cePos = offset;
|
|
47755
47755
|
if (ce?.source === expectedEnd)
|
|
@@ -50649,7 +50649,7 @@ var require_public_api = __commonJS({
|
|
|
50649
50649
|
return docs;
|
|
50650
50650
|
return Object.assign([], { empty: true }, composer$1.streamInfo());
|
|
50651
50651
|
}
|
|
50652
|
-
function
|
|
50652
|
+
function parseDocument4(source, options = {}) {
|
|
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);
|
|
@@ -50675,7 +50675,7 @@ var require_public_api = __commonJS({
|
|
|
50675
50675
|
} else if (options === void 0 && reviver && typeof reviver === "object") {
|
|
50676
50676
|
options = reviver;
|
|
50677
50677
|
}
|
|
50678
|
-
const doc2 =
|
|
50678
|
+
const doc2 = parseDocument4(src, options);
|
|
50679
50679
|
if (!doc2)
|
|
50680
50680
|
return null;
|
|
50681
50681
|
doc2.warnings.forEach((warning) => log2.warn(doc2.options.logLevel, warning));
|
|
@@ -50711,7 +50711,7 @@ var require_public_api = __commonJS({
|
|
|
50711
50711
|
}
|
|
50712
50712
|
exports2.parse = parse;
|
|
50713
50713
|
exports2.parseAllDocuments = parseAllDocuments;
|
|
50714
|
-
exports2.parseDocument =
|
|
50714
|
+
exports2.parseDocument = parseDocument4;
|
|
50715
50715
|
exports2.stringify = stringify;
|
|
50716
50716
|
}
|
|
50717
50717
|
});
|
|
@@ -50826,10 +50826,10 @@ var import_node_child_process8 = require("node:child_process");
|
|
|
50826
50826
|
var import_node_readline2 = require("node:readline");
|
|
50827
50827
|
|
|
50828
50828
|
// index.ts
|
|
50829
|
-
var
|
|
50830
|
-
var
|
|
50831
|
-
var
|
|
50832
|
-
var
|
|
50829
|
+
var import_node_url4 = require("node:url");
|
|
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_process6 = require("node:child_process");
|
|
50834
50834
|
|
|
50835
50835
|
// log.mjs
|
|
@@ -50920,6 +50920,10 @@ function appDir(id) {
|
|
|
50920
50920
|
if (!(0, import_node_fs3.existsSync)(dir)) throw new AppNotFoundError(id);
|
|
50921
50921
|
return dir;
|
|
50922
50922
|
}
|
|
50923
|
+
function appPath(id) {
|
|
50924
|
+
if (id.includes("/") || id.includes("\\") || id.includes("..")) throw new AppNotFoundError(id);
|
|
50925
|
+
return (0, import_node_path2.join)(APPS_DIR, id);
|
|
50926
|
+
}
|
|
50923
50927
|
function appExists(id) {
|
|
50924
50928
|
if (id.includes("/") || id.includes("\\") || id.includes("..")) return false;
|
|
50925
50929
|
return (0, import_node_fs3.existsSync)((0, import_node_path2.join)(APPS_DIR, id));
|
|
@@ -52792,7 +52796,7 @@ function appVersion() {
|
|
|
52792
52796
|
return resolveVersion({
|
|
52793
52797
|
isSea: isSea2(),
|
|
52794
52798
|
sqVersionXml: readSqVersionXml(),
|
|
52795
|
-
define: true ? "0.
|
|
52799
|
+
define: true ? "0.29.0" : void 0,
|
|
52796
52800
|
pkgVersion: readPkgVersion()
|
|
52797
52801
|
});
|
|
52798
52802
|
}
|
|
@@ -52802,7 +52806,7 @@ function resolveChannel(s) {
|
|
|
52802
52806
|
return "dev";
|
|
52803
52807
|
}
|
|
52804
52808
|
function appChannel() {
|
|
52805
|
-
return resolveChannel({ isSea: isSea2(), define: true ? "0.
|
|
52809
|
+
return resolveChannel({ isSea: isSea2(), define: true ? "0.29.0" : void 0 });
|
|
52806
52810
|
}
|
|
52807
52811
|
|
|
52808
52812
|
// oauth-presets.ts
|
|
@@ -53492,14 +53496,323 @@ function deleteVisualInputs(id) {
|
|
|
53492
53496
|
if ((0, import_node_fs14.existsSync)(dir)) (0, import_node_fs14.rmSync)(dir, { recursive: true, force: true });
|
|
53493
53497
|
}
|
|
53494
53498
|
|
|
53495
|
-
//
|
|
53499
|
+
// contract-store.ts
|
|
53500
|
+
var import_node_fs16 = require("node:fs");
|
|
53501
|
+
var import_node_path14 = require("node:path");
|
|
53502
|
+
var import_node_os11 = require("node:os");
|
|
53503
|
+
|
|
53504
|
+
// contract-schema.ts
|
|
53505
|
+
var import_node_fs15 = require("node:fs");
|
|
53506
|
+
var import_node_path13 = require("node:path");
|
|
53507
|
+
var import_node_url = require("node:url");
|
|
53508
|
+
function validate(doc2, schema) {
|
|
53509
|
+
const errors = [];
|
|
53510
|
+
walk(doc2, schema, schema, "$", errors);
|
|
53511
|
+
return { valid: errors.length === 0, errors };
|
|
53512
|
+
}
|
|
53513
|
+
function isPlainObject(v) {
|
|
53514
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
53515
|
+
}
|
|
53516
|
+
function resolveRef(root, ref) {
|
|
53517
|
+
const m = /^#\/\$defs\/(.+)$/.exec(ref);
|
|
53518
|
+
if (!m) return null;
|
|
53519
|
+
return root.$defs?.[m[1]] ?? null;
|
|
53520
|
+
}
|
|
53521
|
+
function typeMatches(value, t) {
|
|
53522
|
+
switch (t) {
|
|
53523
|
+
case "object":
|
|
53524
|
+
return isPlainObject(value);
|
|
53525
|
+
case "array":
|
|
53526
|
+
return Array.isArray(value);
|
|
53527
|
+
case "string":
|
|
53528
|
+
return typeof value === "string";
|
|
53529
|
+
case "number":
|
|
53530
|
+
return typeof value === "number";
|
|
53531
|
+
case "integer":
|
|
53532
|
+
return typeof value === "number" && Number.isInteger(value);
|
|
53533
|
+
case "boolean":
|
|
53534
|
+
return typeof value === "boolean";
|
|
53535
|
+
case "null":
|
|
53536
|
+
return value === null;
|
|
53537
|
+
default:
|
|
53538
|
+
return false;
|
|
53539
|
+
}
|
|
53540
|
+
}
|
|
53541
|
+
function kindOf(v) {
|
|
53542
|
+
if (v === null) return "null";
|
|
53543
|
+
if (Array.isArray(v)) return "array";
|
|
53544
|
+
return typeof v;
|
|
53545
|
+
}
|
|
53546
|
+
function deepEqual(a, b) {
|
|
53547
|
+
if (a === b) return true;
|
|
53548
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
53549
|
+
return a.length === b.length && a.every((x, i) => deepEqual(x, b[i]));
|
|
53550
|
+
}
|
|
53551
|
+
return false;
|
|
53552
|
+
}
|
|
53553
|
+
function walk(value, node, root, path, errors) {
|
|
53554
|
+
if (node.$ref) {
|
|
53555
|
+
const target = resolveRef(root, node.$ref);
|
|
53556
|
+
if (!target) {
|
|
53557
|
+
errors.push({ path, message: `unresolved $ref ${node.$ref}` });
|
|
53558
|
+
return;
|
|
53559
|
+
}
|
|
53560
|
+
walk(value, target, root, path, errors);
|
|
53561
|
+
return;
|
|
53562
|
+
}
|
|
53563
|
+
if ("const" in node && !deepEqual(value, node.const)) {
|
|
53564
|
+
errors.push({ path, message: `must equal ${JSON.stringify(node.const)}` });
|
|
53565
|
+
}
|
|
53566
|
+
if (node.enum && !node.enum.some((e) => deepEqual(value, e))) {
|
|
53567
|
+
errors.push({ path, message: `must be one of ${JSON.stringify(node.enum)}` });
|
|
53568
|
+
}
|
|
53569
|
+
if (node.type) {
|
|
53570
|
+
const types = Array.isArray(node.type) ? node.type : [node.type];
|
|
53571
|
+
if (!types.some((t) => typeMatches(value, t))) {
|
|
53572
|
+
errors.push({ path, message: `expected ${types.join(" | ")}, got ${kindOf(value)}` });
|
|
53573
|
+
return;
|
|
53574
|
+
}
|
|
53575
|
+
}
|
|
53576
|
+
if (isPlainObject(value)) {
|
|
53577
|
+
for (const r of node.required ?? []) {
|
|
53578
|
+
if (!Object.hasOwn(value, r)) errors.push({ path: `${path}.${r}`, message: "required" });
|
|
53579
|
+
}
|
|
53580
|
+
const props = node.properties ?? {};
|
|
53581
|
+
const ap = node.additionalProperties;
|
|
53582
|
+
for (const key of Object.keys(value)) {
|
|
53583
|
+
if (Object.hasOwn(props, key)) {
|
|
53584
|
+
walk(value[key], props[key], root, `${path}.${key}`, errors);
|
|
53585
|
+
} else if (ap === false) {
|
|
53586
|
+
errors.push({ path: `${path}.${key}`, message: "additional property not allowed" });
|
|
53587
|
+
} else if (ap && typeof ap === "object") {
|
|
53588
|
+
walk(value[key], ap, root, `${path}.${key}`, errors);
|
|
53589
|
+
}
|
|
53590
|
+
}
|
|
53591
|
+
}
|
|
53592
|
+
if (Array.isArray(value)) {
|
|
53593
|
+
if (typeof node.minItems === "number" && value.length < node.minItems) {
|
|
53594
|
+
errors.push({ path, message: `expected at least ${node.minItems} items, got ${value.length}` });
|
|
53595
|
+
}
|
|
53596
|
+
if (typeof node.maxItems === "number" && value.length > node.maxItems) {
|
|
53597
|
+
errors.push({ path, message: `expected at most ${node.maxItems} items, got ${value.length}` });
|
|
53598
|
+
}
|
|
53599
|
+
if (node.items) {
|
|
53600
|
+
value.forEach((el, i) => walk(el, node.items, root, `${path}[${i}]`, errors));
|
|
53601
|
+
}
|
|
53602
|
+
}
|
|
53603
|
+
}
|
|
53604
|
+
var _cached = null;
|
|
53605
|
+
function loadSteelTakeoffSchema() {
|
|
53606
|
+
if (_cached) return _cached;
|
|
53607
|
+
const here = (0, import_node_path13.dirname)((0, import_node_url.fileURLToPath)(__import_meta_url));
|
|
53608
|
+
const candidates = [
|
|
53609
|
+
(0, import_node_path13.join)(here, "..", "schemas", "steel.takeoff.v1.schema.json"),
|
|
53610
|
+
// dev: server/ next to schemas/
|
|
53611
|
+
(0, import_node_path13.join)(here, "schemas", "steel.takeoff.v1.schema.json")
|
|
53612
|
+
// bundled: dist/ holds ./schemas
|
|
53613
|
+
];
|
|
53614
|
+
for (const p of candidates) {
|
|
53615
|
+
try {
|
|
53616
|
+
const text = (0, import_node_fs15.readFileSync)(p, "utf8");
|
|
53617
|
+
_cached = JSON.parse(text);
|
|
53618
|
+
return _cached;
|
|
53619
|
+
} catch (err) {
|
|
53620
|
+
if (err.code !== "ENOENT") throw err;
|
|
53621
|
+
}
|
|
53622
|
+
}
|
|
53623
|
+
throw new Error("steel.takeoff/v1 schema file not found");
|
|
53624
|
+
}
|
|
53625
|
+
function validateSteelTakeoff(doc2) {
|
|
53626
|
+
return validate(doc2, loadSteelTakeoffSchema());
|
|
53627
|
+
}
|
|
53628
|
+
|
|
53629
|
+
// contract-store.ts
|
|
53630
|
+
var ContractError = class extends Error {
|
|
53631
|
+
};
|
|
53632
|
+
var ROOT3 = process.env.FLOLESS_HOME ?? (0, import_node_path14.join)((0, import_node_os11.homedir)(), ".floless");
|
|
53633
|
+
var DIR = (0, import_node_path14.join)(ROOT3, "contracts");
|
|
53634
|
+
function safeId(appId) {
|
|
53635
|
+
if (!/^[a-z0-9][a-z0-9._-]*$/i.test(appId)) throw new ContractError(`invalid appId: ${appId}`);
|
|
53636
|
+
return appId;
|
|
53637
|
+
}
|
|
53638
|
+
function contractPath(appId) {
|
|
53639
|
+
return (0, import_node_path14.join)(DIR, `${safeId(appId)}.json`);
|
|
53640
|
+
}
|
|
53641
|
+
function readContract(appId) {
|
|
53642
|
+
const p = contractPath(appId);
|
|
53643
|
+
if (!(0, import_node_fs16.existsSync)(p)) return null;
|
|
53644
|
+
try {
|
|
53645
|
+
return JSON.parse((0, import_node_fs16.readFileSync)(p, "utf8"));
|
|
53646
|
+
} catch (e) {
|
|
53647
|
+
console.warn(`readContract: ignoring unreadable contract at ${p}: ${e instanceof Error ? e.message : e}`);
|
|
53648
|
+
return null;
|
|
53649
|
+
}
|
|
53650
|
+
}
|
|
53651
|
+
function writeContract(appId, doc2) {
|
|
53652
|
+
const p = contractPath(appId);
|
|
53653
|
+
const res = validateSteelTakeoff(doc2);
|
|
53654
|
+
if (!res.valid) {
|
|
53655
|
+
const first = res.errors.slice(0, 5).map((e) => `${e.path}: ${e.message}`).join("; ");
|
|
53656
|
+
throw new ContractError(`contract failed schema validation \u2014 ${first}`);
|
|
53657
|
+
}
|
|
53658
|
+
if (!(0, import_node_fs16.existsSync)(DIR)) (0, import_node_fs16.mkdirSync)(DIR, { recursive: true });
|
|
53659
|
+
(0, import_node_fs16.writeFileSync)(p, JSON.stringify(doc2));
|
|
53660
|
+
}
|
|
53661
|
+
|
|
53662
|
+
// contract-bake.ts
|
|
53496
53663
|
var import_node_fs17 = require("node:fs");
|
|
53497
|
-
var
|
|
53664
|
+
var import_yaml4 = __toESM(require_dist6(), 1);
|
|
53665
|
+
function bakeContractIntoApp(sourcePath, contract) {
|
|
53666
|
+
const doc2 = (0, import_yaml4.parseDocument)((0, import_node_fs17.readFileSync)(sourcePath, "utf8"));
|
|
53667
|
+
if (doc2.errors.length > 0) {
|
|
53668
|
+
throw new Error(`contract bake: source is not valid YAML: ${doc2.errors[0]?.message ?? "parse error"}`);
|
|
53669
|
+
}
|
|
53670
|
+
const seq = doc2.get("nodes");
|
|
53671
|
+
const items = (0, import_yaml4.isSeq)(seq) ? seq.items : [];
|
|
53672
|
+
const nodeOf = (it) => (0, import_yaml4.isMap)(it) ? it.toJSON() : null;
|
|
53673
|
+
let idx = items.findIndex((it) => nodeOf(it)?.config?.contract === contract.type);
|
|
53674
|
+
if (idx < 0) idx = items.findIndex((it) => nodeOf(it)?.agent === "steel-takeoff-us");
|
|
53675
|
+
if (idx < 0) throw new Error("no contract-emitting node to bake the contract into");
|
|
53676
|
+
doc2.setIn(["nodes", idx, "config", "contract"], contract.type);
|
|
53677
|
+
doc2.setIn(["nodes", idx, "config", "takeoff"], contract);
|
|
53678
|
+
(0, import_node_fs17.writeFileSync)(sourcePath, doc2.toString());
|
|
53679
|
+
}
|
|
53680
|
+
|
|
53681
|
+
// contract-to-scene.ts
|
|
53682
|
+
var FT_TO_MM = 304.8;
|
|
53683
|
+
var IN_TO_MM = 25.4;
|
|
53684
|
+
function profileDims(profile) {
|
|
53685
|
+
if (!profile) return null;
|
|
53686
|
+
const p = profile.trim().toUpperCase();
|
|
53687
|
+
if (p === "" || /(^|[^A-Z])MF($|[^A-Z])/.test(p)) return null;
|
|
53688
|
+
const m = p.match(/^([A-Z]+)\s*([0-9X./]+)/);
|
|
53689
|
+
if (!m) return null;
|
|
53690
|
+
const prefix = m[1];
|
|
53691
|
+
const nums = m[2].split("X").map((t) => parseFloat(t)).filter((n) => !isNaN(n));
|
|
53692
|
+
if (nums.length === 0) return null;
|
|
53693
|
+
if ((prefix === "HSS" || prefix === "TUBE" || prefix === "L") && nums.length >= 3) {
|
|
53694
|
+
return { d: nums[0] * IN_TO_MM, w: nums[1] * IN_TO_MM, approx: false };
|
|
53695
|
+
}
|
|
53696
|
+
if (prefix === "HSS" || prefix === "PIPE") {
|
|
53697
|
+
const dia = nums[0] * IN_TO_MM;
|
|
53698
|
+
return { d: dia, w: dia, approx: false };
|
|
53699
|
+
}
|
|
53700
|
+
if (/^(W|S|M|HP|C|MC|WT|ST|MT)$/.test(prefix)) {
|
|
53701
|
+
const d = nums[0] * IN_TO_MM;
|
|
53702
|
+
const ratio = prefix === "C" || prefix === "MC" ? 0.28 : 0.42;
|
|
53703
|
+
return { d, w: d * ratio, approx: true };
|
|
53704
|
+
}
|
|
53705
|
+
return null;
|
|
53706
|
+
}
|
|
53707
|
+
function pickColor(profile, idx, contract) {
|
|
53708
|
+
const pc = contract.profile_colors ?? {};
|
|
53709
|
+
const override = pc[profile] ?? Object.entries(pc).find(([k]) => k.toUpperCase() === profile)?.[1];
|
|
53710
|
+
if (override) return override;
|
|
53711
|
+
const pal = contract.palette ?? [];
|
|
53712
|
+
if (pal.length === 0) return "#94a3b8";
|
|
53713
|
+
return pal[(idx % pal.length + pal.length) % pal.length];
|
|
53714
|
+
}
|
|
53715
|
+
function dispToMm(pt, ptPerFt) {
|
|
53716
|
+
const k = FT_TO_MM / ptPerFt;
|
|
53717
|
+
return [pt[0] * k, -pt[1] * k];
|
|
53718
|
+
}
|
|
53719
|
+
function contractToScene(contractInput) {
|
|
53720
|
+
const contract = contractInput ?? {};
|
|
53721
|
+
const elements = [];
|
|
53722
|
+
const skipped = [];
|
|
53723
|
+
const profileOrder = [];
|
|
53724
|
+
const seenProfile = /* @__PURE__ */ new Set();
|
|
53725
|
+
for (const plan of contract.plans ?? []) {
|
|
53726
|
+
const ptPerFt = plan.pt_per_ft && plan.pt_per_ft > 0 ? plan.pt_per_ft : 1;
|
|
53727
|
+
const defaultTosMm = (plan.default_tos ?? 0) * IN_TO_MM;
|
|
53728
|
+
for (const m of plan.members ?? []) {
|
|
53729
|
+
const dims = profileDims(m.profile);
|
|
53730
|
+
if (!dims || !Array.isArray(m.wp) || m.wp.length < 2) {
|
|
53731
|
+
skipped.push(m.id);
|
|
53732
|
+
continue;
|
|
53733
|
+
}
|
|
53734
|
+
const profile = (m.profile ?? "").trim().toUpperCase();
|
|
53735
|
+
if (!seenProfile.has(profile)) {
|
|
53736
|
+
seenProfile.add(profile);
|
|
53737
|
+
profileOrder.push(profile);
|
|
53738
|
+
}
|
|
53739
|
+
const [ax, ay] = dispToMm(m.wp[0], ptPerFt);
|
|
53740
|
+
const [bx, by] = dispToMm(m.wp[1], ptPerFt);
|
|
53741
|
+
let from;
|
|
53742
|
+
let to;
|
|
53743
|
+
if (m.role === "column") {
|
|
53744
|
+
const bos = m.col?.bos != null ? m.col.bos * IN_TO_MM : 0;
|
|
53745
|
+
const tos = m.col?.tos != null ? m.col.tos * IN_TO_MM : defaultTosMm;
|
|
53746
|
+
from = [ax, ay, bos];
|
|
53747
|
+
to = [ax, ay, tos];
|
|
53748
|
+
} else {
|
|
53749
|
+
const z0 = m.ends?.[0]?.tos != null ? m.ends[0].tos * IN_TO_MM : defaultTosMm;
|
|
53750
|
+
const z1 = m.ends?.[1]?.tos != null ? m.ends[1].tos * IN_TO_MM : defaultTosMm;
|
|
53751
|
+
from = [ax, ay, z0];
|
|
53752
|
+
to = [bx, by, z1];
|
|
53753
|
+
}
|
|
53754
|
+
elements.push({ id: m.id, group: profile, kind: "box", from, to, section: { w: dims.w, d: dims.d }, meta: { profile } });
|
|
53755
|
+
}
|
|
53756
|
+
}
|
|
53757
|
+
const groups = profileOrder.map((profile, i) => ({
|
|
53758
|
+
key: profile,
|
|
53759
|
+
label: profile,
|
|
53760
|
+
color: pickColor(profile, i, contract)
|
|
53761
|
+
}));
|
|
53762
|
+
return {
|
|
53763
|
+
scene: { meta: { name: contract.title || "Steel takeoff", units: "mm", up: "z" }, groups, elements },
|
|
53764
|
+
skipped
|
|
53765
|
+
};
|
|
53766
|
+
}
|
|
53767
|
+
|
|
53768
|
+
// scene-bake.ts
|
|
53769
|
+
var import_node_fs18 = require("node:fs");
|
|
53498
53770
|
var import_node_path15 = require("node:path");
|
|
53771
|
+
var import_yaml5 = __toESM(require_dist6(), 1);
|
|
53772
|
+
function bakeSceneIntoApp(sourcePath, scene, agent = "viewer-3d") {
|
|
53773
|
+
const doc2 = (0, import_yaml5.parseDocument)((0, import_node_fs18.readFileSync)(sourcePath, "utf8"));
|
|
53774
|
+
if (doc2.errors.length > 0) {
|
|
53775
|
+
throw new Error(`scene bake: source is not valid YAML: ${doc2.errors[0]?.message ?? "parse error"}`);
|
|
53776
|
+
}
|
|
53777
|
+
const seq = doc2.get("nodes");
|
|
53778
|
+
const items = (0, import_yaml5.isSeq)(seq) ? seq.items : [];
|
|
53779
|
+
const idx = items.findIndex((it) => ((0, import_yaml5.isMap)(it) ? it.toJSON() : null)?.agent === agent);
|
|
53780
|
+
if (idx < 0) throw new Error(`no ${agent} render node to bake the scene into`);
|
|
53781
|
+
doc2.setIn(["nodes", idx, "config", "scene"], scene);
|
|
53782
|
+
(0, import_node_fs18.writeFileSync)(sourcePath, doc2.toString());
|
|
53783
|
+
}
|
|
53784
|
+
function writeViewer3dApp(dir, appId, scene) {
|
|
53785
|
+
(0, import_node_fs18.mkdirSync)(dir, { recursive: true });
|
|
53786
|
+
const flo = (0, import_node_path15.join)(dir, `${appId}.flo`);
|
|
53787
|
+
(0, import_node_fs18.writeFileSync)(flo, [
|
|
53788
|
+
`app: ${appId}`,
|
|
53789
|
+
"version: 0.1.0",
|
|
53790
|
+
"display-name: Steel 3D",
|
|
53791
|
+
"description: 3D model rendered from an approved steel.takeoff/v1 contract (a companion view; the contract is the source of truth).",
|
|
53792
|
+
"exposes-as-agent: false",
|
|
53793
|
+
"requires:",
|
|
53794
|
+
" - viewer-3d@0.1.x",
|
|
53795
|
+
"layout: linear",
|
|
53796
|
+
"nodes:",
|
|
53797
|
+
" - id: view",
|
|
53798
|
+
" agent: viewer-3d",
|
|
53799
|
+
" command: render",
|
|
53800
|
+
" config:",
|
|
53801
|
+
" scene: {}",
|
|
53802
|
+
""
|
|
53803
|
+
].join("\n"));
|
|
53804
|
+
bakeSceneIntoApp(flo, scene);
|
|
53805
|
+
return flo;
|
|
53806
|
+
}
|
|
53807
|
+
|
|
53808
|
+
// app-lifecycle.ts
|
|
53809
|
+
var import_node_fs21 = require("node:fs");
|
|
53810
|
+
var import_node_os13 = require("node:os");
|
|
53811
|
+
var import_node_path18 = require("node:path");
|
|
53499
53812
|
|
|
53500
53813
|
// routines.ts
|
|
53501
|
-
var
|
|
53502
|
-
var
|
|
53814
|
+
var import_node_fs20 = require("node:fs");
|
|
53815
|
+
var import_node_path17 = require("node:path");
|
|
53503
53816
|
|
|
53504
53817
|
// sse.ts
|
|
53505
53818
|
var clients = /* @__PURE__ */ new Set();
|
|
@@ -53536,11 +53849,11 @@ function clientCount() {
|
|
|
53536
53849
|
}
|
|
53537
53850
|
|
|
53538
53851
|
// trigger-sessions.ts
|
|
53539
|
-
var
|
|
53540
|
-
var
|
|
53541
|
-
var
|
|
53542
|
-
var
|
|
53543
|
-
var AGENTS_DIR2 = process.env.AWARE_HOME ? (0,
|
|
53852
|
+
var import_node_fs19 = require("node:fs");
|
|
53853
|
+
var import_node_os12 = require("node:os");
|
|
53854
|
+
var import_node_path16 = require("node:path");
|
|
53855
|
+
var import_yaml6 = __toESM(require_dist6(), 1);
|
|
53856
|
+
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");
|
|
53544
53857
|
function summarizeFire(data) {
|
|
53545
53858
|
if (!data) return "event";
|
|
53546
53859
|
const type = typeof data.type === "string" ? data.type : "";
|
|
@@ -53557,10 +53870,10 @@ function mapTriggerState(phase) {
|
|
|
53557
53870
|
function isHostBacked(agent, agentsDir = AGENTS_DIR2) {
|
|
53558
53871
|
const safe = (n) => !n.includes("/") && !n.includes("\\") && !n.includes("..");
|
|
53559
53872
|
if (!safe(agent)) return false;
|
|
53560
|
-
const manifestPath = (0,
|
|
53561
|
-
if (!(0,
|
|
53873
|
+
const manifestPath = (0, import_node_path16.join)(agentsDir, agent, "manifest.yaml");
|
|
53874
|
+
if (!(0, import_node_fs19.existsSync)(manifestPath)) return false;
|
|
53562
53875
|
try {
|
|
53563
|
-
const doc2 = (0,
|
|
53876
|
+
const doc2 = (0, import_yaml6.parse)((0, import_node_fs19.readFileSync)(manifestPath, "utf8"));
|
|
53564
53877
|
const transport = doc2?.transport;
|
|
53565
53878
|
return !!(transport && typeof transport === "object" && "cli" in transport);
|
|
53566
53879
|
} catch {
|
|
@@ -53845,7 +54158,7 @@ var RoutineError = class extends Error {
|
|
|
53845
54158
|
}
|
|
53846
54159
|
status;
|
|
53847
54160
|
};
|
|
53848
|
-
var ROUTINES_FILE = (0,
|
|
54161
|
+
var ROUTINES_FILE = (0, import_node_path17.join)(flolessRoot, "routines.json");
|
|
53849
54162
|
var routines = [];
|
|
53850
54163
|
var loaded = false;
|
|
53851
54164
|
function ensureLoaded() {
|
|
@@ -53881,10 +54194,10 @@ function sanitizeRoutine(raw) {
|
|
|
53881
54194
|
};
|
|
53882
54195
|
}
|
|
53883
54196
|
function loadFromDisk() {
|
|
53884
|
-
if (!(0,
|
|
54197
|
+
if (!(0, import_node_fs20.existsSync)(ROUTINES_FILE)) return [];
|
|
53885
54198
|
let text;
|
|
53886
54199
|
try {
|
|
53887
|
-
text = (0,
|
|
54200
|
+
text = (0, import_node_fs20.readFileSync)(ROUTINES_FILE, "utf8");
|
|
53888
54201
|
} catch {
|
|
53889
54202
|
return [];
|
|
53890
54203
|
}
|
|
@@ -53893,17 +54206,17 @@ function loadFromDisk() {
|
|
|
53893
54206
|
return Array.isArray(parsed) ? parsed.map(sanitizeRoutine).filter((r) => r !== null) : [];
|
|
53894
54207
|
} catch {
|
|
53895
54208
|
try {
|
|
53896
|
-
(0,
|
|
54209
|
+
(0, import_node_fs20.renameSync)(ROUTINES_FILE, `${ROUTINES_FILE}.corrupt-${Date.now()}`);
|
|
53897
54210
|
} catch {
|
|
53898
54211
|
}
|
|
53899
54212
|
return [];
|
|
53900
54213
|
}
|
|
53901
54214
|
}
|
|
53902
54215
|
function saveRoutines() {
|
|
53903
|
-
if (!(0,
|
|
54216
|
+
if (!(0, import_node_fs20.existsSync)(flolessRoot)) (0, import_node_fs20.mkdirSync)(flolessRoot, { recursive: true });
|
|
53904
54217
|
const tmp = `${ROUTINES_FILE}.${process.pid}.tmp`;
|
|
53905
|
-
(0,
|
|
53906
|
-
(0,
|
|
54218
|
+
(0, import_node_fs20.writeFileSync)(tmp, JSON.stringify(routines, null, 2));
|
|
54219
|
+
(0, import_node_fs20.renameSync)(tmp, ROUTINES_FILE);
|
|
53907
54220
|
}
|
|
53908
54221
|
function listRoutines() {
|
|
53909
54222
|
ensureLoaded();
|
|
@@ -54311,13 +54624,13 @@ var AppLifecycleError = class extends Error {
|
|
|
54311
54624
|
}
|
|
54312
54625
|
};
|
|
54313
54626
|
function appsDir() {
|
|
54314
|
-
return process.env.AWARE_HOME ? (0,
|
|
54627
|
+
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");
|
|
54315
54628
|
}
|
|
54316
54629
|
function appDirPath(id) {
|
|
54317
|
-
return (0,
|
|
54630
|
+
return (0, import_node_path18.join)(appsDir(), id);
|
|
54318
54631
|
}
|
|
54319
54632
|
function appInstalled(id) {
|
|
54320
|
-
return APP_ID3.test(id) && (0,
|
|
54633
|
+
return APP_ID3.test(id) && (0, import_node_fs21.existsSync)(appDirPath(id));
|
|
54321
54634
|
}
|
|
54322
54635
|
function logCascade(what, e) {
|
|
54323
54636
|
console.error(`[app-lifecycle] cascade step failed (${what}):`, e instanceof Error ? e.message : e);
|
|
@@ -54410,14 +54723,17 @@ function isGatedAwareRoute(url, method) {
|
|
|
54410
54723
|
if (path.startsWith("/api/trigger-run/")) return false;
|
|
54411
54724
|
if (path === "/api/trigger-run") return m === "POST";
|
|
54412
54725
|
if (path.startsWith("/api/app/")) return m === "PATCH" || m === "POST" || m === "DELETE";
|
|
54726
|
+
if (path.startsWith("/api/contract/")) {
|
|
54727
|
+
return m === "POST" && (path.endsWith("/approve") || path.endsWith("/export-3d"));
|
|
54728
|
+
}
|
|
54413
54729
|
return AWARE_ROUTES.some((p) => path.startsWith(p));
|
|
54414
54730
|
}
|
|
54415
54731
|
|
|
54416
54732
|
// autostart.mjs
|
|
54417
54733
|
var import_node_child_process3 = require("node:child_process");
|
|
54418
|
-
var
|
|
54419
|
-
var
|
|
54420
|
-
var
|
|
54734
|
+
var import_node_fs22 = require("node:fs");
|
|
54735
|
+
var import_node_os14 = require("node:os");
|
|
54736
|
+
var import_node_path19 = require("node:path");
|
|
54421
54737
|
|
|
54422
54738
|
// teardown.mjs
|
|
54423
54739
|
var RUN_KEY = "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run";
|
|
@@ -54529,8 +54845,8 @@ function removeLegacyRunKey() {
|
|
|
54529
54845
|
}
|
|
54530
54846
|
function logLine(msg) {
|
|
54531
54847
|
try {
|
|
54532
|
-
(0,
|
|
54533
|
-
(0,
|
|
54848
|
+
(0, import_node_fs22.mkdirSync)(logDir(), { recursive: true });
|
|
54849
|
+
(0, import_node_fs22.appendFileSync)(logFilePath(), `${(/* @__PURE__ */ new Date()).toISOString()} ${msg}
|
|
54534
54850
|
`);
|
|
54535
54851
|
} catch {
|
|
54536
54852
|
}
|
|
@@ -54538,8 +54854,8 @@ function logLine(msg) {
|
|
|
54538
54854
|
function registerAutostart(exePath) {
|
|
54539
54855
|
if (!isWin) return;
|
|
54540
54856
|
const xml = buildAutostartTaskXml(exePath, currentUserId());
|
|
54541
|
-
const tmp = (0,
|
|
54542
|
-
(0,
|
|
54857
|
+
const tmp = (0, import_node_path19.join)((0, import_node_os14.tmpdir)(), `floless-autostart-${process.pid}-${Date.now()}.xml`);
|
|
54858
|
+
(0, import_node_fs22.writeFileSync)(tmp, "\uFEFF" + xml, { encoding: "utf16le" });
|
|
54543
54859
|
try {
|
|
54544
54860
|
(0, import_node_child_process3.execFileSync)("schtasks", ["/Create", "/TN", TASK_NAME, "/XML", tmp, "/F"], {
|
|
54545
54861
|
stdio: ["ignore", "ignore", "ignore"],
|
|
@@ -54550,7 +54866,7 @@ function registerAutostart(exePath) {
|
|
|
54550
54866
|
throw err;
|
|
54551
54867
|
} finally {
|
|
54552
54868
|
try {
|
|
54553
|
-
(0,
|
|
54869
|
+
(0, import_node_fs22.rmSync)(tmp, { force: true });
|
|
54554
54870
|
} catch {
|
|
54555
54871
|
}
|
|
54556
54872
|
}
|
|
@@ -54585,26 +54901,26 @@ function unregisterAutostart() {
|
|
|
54585
54901
|
// updater.ts
|
|
54586
54902
|
var import_node_child_process4 = require("node:child_process");
|
|
54587
54903
|
var import_node_crypto6 = require("node:crypto");
|
|
54588
|
-
var
|
|
54904
|
+
var import_node_fs24 = require("node:fs");
|
|
54589
54905
|
var import_node_stream = require("node:stream");
|
|
54590
54906
|
var import_promises = require("node:stream/promises");
|
|
54591
|
-
var
|
|
54907
|
+
var import_node_path21 = require("node:path");
|
|
54592
54908
|
|
|
54593
54909
|
// post-update-marker.mjs
|
|
54594
|
-
var
|
|
54595
|
-
var
|
|
54596
|
-
var
|
|
54910
|
+
var import_node_fs23 = require("node:fs");
|
|
54911
|
+
var import_node_os15 = require("node:os");
|
|
54912
|
+
var import_node_path20 = require("node:path");
|
|
54597
54913
|
var FRESH_MS = 12e4;
|
|
54598
54914
|
function markerPath() {
|
|
54599
54915
|
const override = (process.env.FLOLESS_POST_UPDATE_MARKER ?? "").trim();
|
|
54600
54916
|
if (override) return override;
|
|
54601
|
-
const root = process.env.FLOLESS_HOME ?? (0,
|
|
54602
|
-
return (0,
|
|
54917
|
+
const root = process.env.FLOLESS_HOME ?? (0, import_node_path20.join)((0, import_node_os15.homedir)(), ".floless");
|
|
54918
|
+
return (0, import_node_path20.join)(root, ".post-update");
|
|
54603
54919
|
}
|
|
54604
54920
|
function legacyMarkerPath() {
|
|
54605
54921
|
if ((process.env.FLOLESS_POST_UPDATE_MARKER ?? "").trim()) return null;
|
|
54606
54922
|
try {
|
|
54607
|
-
return (0,
|
|
54923
|
+
return (0, import_node_path20.join)((0, import_node_path20.dirname)((0, import_node_path20.dirname)(process.execPath)), ".floless-post-update");
|
|
54608
54924
|
} catch {
|
|
54609
54925
|
return null;
|
|
54610
54926
|
}
|
|
@@ -54614,7 +54930,7 @@ function writePostUpdateMarker() {
|
|
|
54614
54930
|
for (const p of [markerPath(), legacyMarkerPath()]) {
|
|
54615
54931
|
if (!p) continue;
|
|
54616
54932
|
try {
|
|
54617
|
-
(0,
|
|
54933
|
+
(0, import_node_fs23.writeFileSync)(p, (/* @__PURE__ */ new Date()).toISOString());
|
|
54618
54934
|
wrote = true;
|
|
54619
54935
|
} catch {
|
|
54620
54936
|
}
|
|
@@ -54626,9 +54942,9 @@ function consumePostUpdateMarker() {
|
|
|
54626
54942
|
for (const p of [markerPath(), legacyMarkerPath()]) {
|
|
54627
54943
|
if (!p) continue;
|
|
54628
54944
|
try {
|
|
54629
|
-
if (!(0,
|
|
54630
|
-
const ageMs = Date.now() - (0,
|
|
54631
|
-
(0,
|
|
54945
|
+
if (!(0, import_node_fs23.existsSync)(p)) continue;
|
|
54946
|
+
const ageMs = Date.now() - (0, import_node_fs23.statSync)(p).mtimeMs;
|
|
54947
|
+
(0, import_node_fs23.rmSync)(p, { force: true });
|
|
54632
54948
|
if (ageMs < FRESH_MS) fresh = true;
|
|
54633
54949
|
} catch {
|
|
54634
54950
|
}
|
|
@@ -54645,13 +54961,13 @@ function currentVersion() {
|
|
|
54645
54961
|
return appVersion();
|
|
54646
54962
|
}
|
|
54647
54963
|
function installRoot() {
|
|
54648
|
-
return (0,
|
|
54964
|
+
return (0, import_node_path21.dirname)((0, import_node_path21.dirname)(process.execPath));
|
|
54649
54965
|
}
|
|
54650
54966
|
function updateExePath() {
|
|
54651
|
-
return (0,
|
|
54967
|
+
return (0, import_node_path21.join)(installRoot(), "Update.exe");
|
|
54652
54968
|
}
|
|
54653
54969
|
function packagesDir() {
|
|
54654
|
-
return (0,
|
|
54970
|
+
return (0, import_node_path21.join)(installRoot(), "packages");
|
|
54655
54971
|
}
|
|
54656
54972
|
function feedUrl() {
|
|
54657
54973
|
const env2 = (process.env.FLOLESS_UPDATE_URL ?? "").trim().replace(/\/+$/, "");
|
|
@@ -54744,22 +55060,22 @@ async function checkForUpdate() {
|
|
|
54744
55060
|
}
|
|
54745
55061
|
async function sha1OfFile(path) {
|
|
54746
55062
|
const hash = (0, import_node_crypto6.createHash)("sha1");
|
|
54747
|
-
await (0, import_promises.pipeline)((0,
|
|
55063
|
+
await (0, import_promises.pipeline)((0, import_node_fs24.createReadStream)(path), hash);
|
|
54748
55064
|
return hash.digest("hex").toUpperCase();
|
|
54749
55065
|
}
|
|
54750
55066
|
async function downloadPackage(asset) {
|
|
54751
55067
|
if (!NUPKG_NAME.test(asset.FileName)) throw new Error(`refusing suspicious package name: ${asset.FileName}`);
|
|
54752
55068
|
const want = asset.SHA1.toUpperCase();
|
|
54753
55069
|
const dir = packagesDir();
|
|
54754
|
-
(0,
|
|
54755
|
-
const dest = (0,
|
|
54756
|
-
if ((0,
|
|
55070
|
+
(0, import_node_fs24.mkdirSync)(dir, { recursive: true });
|
|
55071
|
+
const dest = (0, import_node_path21.join)(dir, asset.FileName);
|
|
55072
|
+
if ((0, import_node_fs24.existsSync)(dest) && await sha1OfFile(dest) === want) return dest;
|
|
54757
55073
|
const res = await authedFetch(`${feedUrl()}/${encodeURIComponent(asset.FileName)}`, {
|
|
54758
55074
|
redirect: "follow",
|
|
54759
55075
|
signal: AbortSignal.timeout(DOWNLOAD_TIMEOUT_MS)
|
|
54760
55076
|
});
|
|
54761
55077
|
if (!res.ok || !res.body) throw new Error(`download failed: HTTP ${res.status} for ${asset.FileName}`);
|
|
54762
|
-
await (0, import_promises.pipeline)(import_node_stream.Readable.fromWeb(res.body), (0,
|
|
55078
|
+
await (0, import_promises.pipeline)(import_node_stream.Readable.fromWeb(res.body), (0, import_node_fs24.createWriteStream)(dest));
|
|
54763
55079
|
const got = await sha1OfFile(dest);
|
|
54764
55080
|
if (got !== want) throw new Error(`SHA1 mismatch for ${asset.FileName}: feed=${want} got=${got}`);
|
|
54765
55081
|
return dest;
|
|
@@ -54768,7 +55084,7 @@ async function applyUpdate(check, opts) {
|
|
|
54768
55084
|
if (!check.supported) return { applied: false, message: check.reason ?? "auto-update not supported in this runtime" };
|
|
54769
55085
|
if (!check.updateAvailable || !check.asset) return { applied: false, message: check.reason ?? "no update available" };
|
|
54770
55086
|
const exe = updateExePath();
|
|
54771
|
-
if (!(0,
|
|
55087
|
+
if (!(0, import_node_fs24.existsSync)(exe)) {
|
|
54772
55088
|
return { applied: false, message: `Update.exe not found at ${exe} \u2014 is this a Velopack install?` };
|
|
54773
55089
|
}
|
|
54774
55090
|
const pkg = await downloadPackage(check.asset);
|
|
@@ -55008,12 +55324,12 @@ function isTraceCorrupt(events) {
|
|
|
55008
55324
|
|
|
55009
55325
|
// launch.mjs
|
|
55010
55326
|
var import_node_child_process5 = require("node:child_process");
|
|
55011
|
-
var
|
|
55012
|
-
var
|
|
55013
|
-
var
|
|
55327
|
+
var import_node_path22 = require("node:path");
|
|
55328
|
+
var import_node_url2 = require("node:url");
|
|
55329
|
+
var import_node_fs25 = require("node:fs");
|
|
55014
55330
|
var import_node_http = __toESM(require("node:http"), 1);
|
|
55015
55331
|
var import_node_readline = require("node:readline");
|
|
55016
|
-
var __dirname2 = (0,
|
|
55332
|
+
var __dirname2 = (0, import_node_path22.dirname)((0, import_node_url2.fileURLToPath)(__import_meta_url));
|
|
55017
55333
|
var PORT = Number(process.env.PORT ?? 4317);
|
|
55018
55334
|
var HEALTH_URL = `http://127.0.0.1:${PORT}/api/health`;
|
|
55019
55335
|
var BROWSER_URL = `http://floless.localhost:${PORT}`;
|
|
@@ -55085,8 +55401,8 @@ async function waitHealthy(timeoutMs = 3e4) {
|
|
|
55085
55401
|
function resolveServerStart() {
|
|
55086
55402
|
const packaged = /flolessapp\.exe$/i.test(process.execPath);
|
|
55087
55403
|
if (packaged) return { cmd: process.execPath, args: ["--serve"], shell: false };
|
|
55088
|
-
const bundle = (0,
|
|
55089
|
-
if ((0,
|
|
55404
|
+
const bundle = (0, import_node_path22.join)(__dirname2, "dist", "floless-server.cjs");
|
|
55405
|
+
if ((0, import_node_fs25.existsSync)(bundle)) return { cmd: process.execPath, args: [bundle, "--serve"], shell: false };
|
|
55090
55406
|
return { cmd: "npm", args: ["run", "start"], shell: isWin2 };
|
|
55091
55407
|
}
|
|
55092
55408
|
function startServerDetached() {
|
|
@@ -55239,8 +55555,8 @@ function taskkillArgs(pid, { tree = true } = {}) {
|
|
|
55239
55555
|
}
|
|
55240
55556
|
function killSupervisor({ tree = true } = {}) {
|
|
55241
55557
|
if (!isWin2) return;
|
|
55242
|
-
const isNpmChannel = /^node(\.exe)?$/i.test((0,
|
|
55243
|
-
const scriptMatch = isNpmChannel ? (0,
|
|
55558
|
+
const isNpmChannel = /^node(\.exe)?$/i.test((0, import_node_path22.basename)(process.execPath));
|
|
55559
|
+
const scriptMatch = isNpmChannel ? (0, import_node_path22.basename)((0, import_node_url2.fileURLToPath)(__import_meta_url)) : void 0;
|
|
55244
55560
|
const realExe = resolveRealInstallExe(process.execPath);
|
|
55245
55561
|
const exeMatch = realExe === process.execPath ? process.execPath : [process.execPath, realExe];
|
|
55246
55562
|
const pids = supervisorPidsToKill(enumerateProcesses(), process.pid, exeMatch, scriptMatch);
|
|
@@ -55405,7 +55721,7 @@ async function runAction(arg, flagArgv = [], selfVersion = null) {
|
|
|
55405
55721
|
}
|
|
55406
55722
|
await action(parseTeardownFlags(flagArgv));
|
|
55407
55723
|
}
|
|
55408
|
-
var entry = (0,
|
|
55724
|
+
var entry = (0, import_node_path22.basename)(process.argv[1] ?? "").toLowerCase();
|
|
55409
55725
|
if (entry === "launch.mjs") {
|
|
55410
55726
|
runAction(process.argv[2], process.argv.slice(3)).catch((e) => {
|
|
55411
55727
|
log(`error: ${e?.message ?? e}`);
|
|
@@ -55479,11 +55795,11 @@ function awareUpgradeBlockReason(s) {
|
|
|
55479
55795
|
}
|
|
55480
55796
|
|
|
55481
55797
|
// skill-sync.ts
|
|
55482
|
-
var
|
|
55483
|
-
var
|
|
55484
|
-
var
|
|
55485
|
-
var
|
|
55486
|
-
var
|
|
55798
|
+
var import_node_fs26 = require("node:fs");
|
|
55799
|
+
var import_node_os16 = require("node:os");
|
|
55800
|
+
var import_node_path23 = require("node:path");
|
|
55801
|
+
var import_node_url3 = require("node:url");
|
|
55802
|
+
var import_yaml7 = __toESM(require_dist6(), 1);
|
|
55487
55803
|
|
|
55488
55804
|
// build/ship-skills.mjs
|
|
55489
55805
|
var PRODUCT_SKILLS = [
|
|
@@ -55499,6 +55815,8 @@ var PRODUCT_SKILLS = [
|
|
|
55499
55815
|
// author event-driven ("on trigger") routines
|
|
55500
55816
|
"floless-app-steel-from-drawings",
|
|
55501
55817
|
// read a steel drawing into an interactive 3D model (bake the viewer-3d scene)
|
|
55818
|
+
"floless-app-tweak-contract",
|
|
55819
|
+
// handle a tweak-contract request from the steel-takeoff contract editor (Slice 2 AI round-trip)
|
|
55502
55820
|
"floless-app-ui",
|
|
55503
55821
|
// compose Custom Panels (~/.floless/ui/extensions.json) for the Dashboard
|
|
55504
55822
|
"floless-app-workflows"
|
|
@@ -55510,33 +55828,33 @@ function selectShippedSkillNames(names) {
|
|
|
55510
55828
|
}
|
|
55511
55829
|
|
|
55512
55830
|
// skill-sync.ts
|
|
55513
|
-
var __dirname3 = (0,
|
|
55831
|
+
var __dirname3 = (0, import_node_path23.dirname)((0, import_node_url3.fileURLToPath)(__import_meta_url));
|
|
55514
55832
|
function bundledSkillsRoot() {
|
|
55515
55833
|
const candidates = [
|
|
55516
|
-
(0,
|
|
55517
|
-
(0,
|
|
55518
|
-
(0,
|
|
55834
|
+
(0, import_node_path23.join)(__dirname3, "skills"),
|
|
55835
|
+
(0, import_node_path23.join)((0, import_node_path23.dirname)(process.execPath), "skills"),
|
|
55836
|
+
(0, import_node_path23.join)(__dirname3, "..", ".claude", "skills")
|
|
55519
55837
|
];
|
|
55520
|
-
return candidates.find((p) => (0,
|
|
55838
|
+
return candidates.find((p) => (0, import_node_fs26.existsSync)(p)) ?? null;
|
|
55521
55839
|
}
|
|
55522
55840
|
function targetConfigDirs() {
|
|
55523
55841
|
const override = process.env.FLOLESS_SKILL_TARGETS;
|
|
55524
55842
|
if (override) {
|
|
55525
55843
|
return override.split(";").map((d) => d.trim()).filter(Boolean).map((dir) => ({ runtime: "custom", dir }));
|
|
55526
55844
|
}
|
|
55527
|
-
const home = (0,
|
|
55845
|
+
const home = (0, import_node_os16.homedir)();
|
|
55528
55846
|
return [
|
|
55529
|
-
{ runtime: "claude", dir: (0,
|
|
55530
|
-
{ runtime: "codex", dir: (0,
|
|
55531
|
-
{ runtime: "opencode", dir: (0,
|
|
55847
|
+
{ runtime: "claude", dir: (0, import_node_path23.join)(home, ".claude") },
|
|
55848
|
+
{ runtime: "codex", dir: (0, import_node_path23.join)(home, ".codex") },
|
|
55849
|
+
{ runtime: "opencode", dir: (0, import_node_path23.join)(home, ".opencode") }
|
|
55532
55850
|
];
|
|
55533
55851
|
}
|
|
55534
55852
|
function skillVersion(skillMdPath) {
|
|
55535
55853
|
try {
|
|
55536
|
-
const text = (0,
|
|
55854
|
+
const text = (0, import_node_fs26.readFileSync)(skillMdPath, "utf8");
|
|
55537
55855
|
const m = /^---\r?\n([\s\S]*?)\r?\n---/.exec(text);
|
|
55538
55856
|
if (!m || m[1] === void 0) return null;
|
|
55539
|
-
const fm = (0,
|
|
55857
|
+
const fm = (0, import_yaml7.parse)(m[1]);
|
|
55540
55858
|
const meta = fm?.metadata;
|
|
55541
55859
|
const v = meta?.version;
|
|
55542
55860
|
return typeof v === "string" || typeof v === "number" ? String(v) : null;
|
|
@@ -55573,21 +55891,21 @@ function decideAction(installed, bundled) {
|
|
|
55573
55891
|
function bundledSkills(root) {
|
|
55574
55892
|
let entries = [];
|
|
55575
55893
|
try {
|
|
55576
|
-
entries = selectShippedSkillNames((0,
|
|
55894
|
+
entries = selectShippedSkillNames((0, import_node_fs26.readdirSync)(root));
|
|
55577
55895
|
} catch {
|
|
55578
55896
|
return [];
|
|
55579
55897
|
}
|
|
55580
55898
|
const out = [];
|
|
55581
55899
|
for (const name of entries) {
|
|
55582
|
-
const dir = (0,
|
|
55900
|
+
const dir = (0, import_node_path23.join)(root, name);
|
|
55583
55901
|
let isDir = false;
|
|
55584
55902
|
try {
|
|
55585
|
-
isDir = (0,
|
|
55903
|
+
isDir = (0, import_node_fs26.statSync)(dir).isDirectory();
|
|
55586
55904
|
} catch {
|
|
55587
55905
|
isDir = false;
|
|
55588
55906
|
}
|
|
55589
55907
|
if (!isDir) continue;
|
|
55590
|
-
const v = skillVersion((0,
|
|
55908
|
+
const v = skillVersion((0, import_node_path23.join)(dir, "SKILL.md"));
|
|
55591
55909
|
if (!v) continue;
|
|
55592
55910
|
out.push({ name, dir, version: v });
|
|
55593
55911
|
}
|
|
@@ -55600,17 +55918,17 @@ function syncSkills() {
|
|
|
55600
55918
|
const skills = bundledSkills(root);
|
|
55601
55919
|
if (!skills.length) return results;
|
|
55602
55920
|
for (const { runtime, dir: cfg } of targetConfigDirs()) {
|
|
55603
|
-
if (!(0,
|
|
55604
|
-
const skillsDir = (0,
|
|
55921
|
+
if (!(0, import_node_fs26.existsSync)(cfg)) continue;
|
|
55922
|
+
const skillsDir = (0, import_node_path23.join)(cfg, "skills");
|
|
55605
55923
|
for (const s of skills) {
|
|
55606
|
-
const dest = (0,
|
|
55607
|
-
const installedMd = (0,
|
|
55608
|
-
const installed = (0,
|
|
55924
|
+
const dest = (0, import_node_path23.join)(skillsDir, s.name);
|
|
55925
|
+
const installedMd = (0, import_node_path23.join)(dest, "SKILL.md");
|
|
55926
|
+
const installed = (0, import_node_fs26.existsSync)(installedMd) ? skillVersion(installedMd) : null;
|
|
55609
55927
|
const action = decideAction(installed, s.version);
|
|
55610
55928
|
if (action === "installed" || action === "updated") {
|
|
55611
55929
|
try {
|
|
55612
|
-
if (action === "updated") (0,
|
|
55613
|
-
(0,
|
|
55930
|
+
if (action === "updated") (0, import_node_fs26.rmSync)(dest, { recursive: true, force: true });
|
|
55931
|
+
(0, import_node_fs26.cpSync)(s.dir, dest, { recursive: true });
|
|
55614
55932
|
results.push({ runtime, skill: s.name, action, from: installed, to: s.version });
|
|
55615
55933
|
} catch {
|
|
55616
55934
|
}
|
|
@@ -55623,9 +55941,9 @@ function syncSkills() {
|
|
|
55623
55941
|
}
|
|
55624
55942
|
|
|
55625
55943
|
// watch.ts
|
|
55626
|
-
var
|
|
55627
|
-
var
|
|
55628
|
-
var
|
|
55944
|
+
var import_node_os17 = require("node:os");
|
|
55945
|
+
var import_node_path25 = require("node:path");
|
|
55946
|
+
var import_node_fs27 = require("node:fs");
|
|
55629
55947
|
|
|
55630
55948
|
// node_modules/chokidar/esm/index.js
|
|
55631
55949
|
var import_fs2 = require("fs");
|
|
@@ -55636,7 +55954,7 @@ var sysPath2 = __toESM(require("path"), 1);
|
|
|
55636
55954
|
// node_modules/readdirp/esm/index.js
|
|
55637
55955
|
var import_promises2 = require("node:fs/promises");
|
|
55638
55956
|
var import_node_stream2 = require("node:stream");
|
|
55639
|
-
var
|
|
55957
|
+
var import_node_path24 = require("node:path");
|
|
55640
55958
|
var EntryTypes = {
|
|
55641
55959
|
FILE_TYPE: "files",
|
|
55642
55960
|
DIR_TYPE: "directories",
|
|
@@ -55711,7 +56029,7 @@ var ReaddirpStream = class extends import_node_stream2.Readable {
|
|
|
55711
56029
|
this._wantsDir = type ? DIR_TYPES.has(type) : false;
|
|
55712
56030
|
this._wantsFile = type ? FILE_TYPES.has(type) : false;
|
|
55713
56031
|
this._wantsEverything = type === EntryTypes.EVERYTHING_TYPE;
|
|
55714
|
-
this._root = (0,
|
|
56032
|
+
this._root = (0, import_node_path24.resolve)(root);
|
|
55715
56033
|
this._isDirent = !opts.alwaysStat;
|
|
55716
56034
|
this._statsProp = this._isDirent ? "dirent" : "stats";
|
|
55717
56035
|
this._rdOptions = { encoding: "utf8", withFileTypes: this._isDirent };
|
|
@@ -55782,8 +56100,8 @@ var ReaddirpStream = class extends import_node_stream2.Readable {
|
|
|
55782
56100
|
let entry2;
|
|
55783
56101
|
const basename5 = this._isDirent ? dirent.name : dirent;
|
|
55784
56102
|
try {
|
|
55785
|
-
const fullPath = (0,
|
|
55786
|
-
entry2 = { path: (0,
|
|
56103
|
+
const fullPath = (0, import_node_path24.resolve)((0, import_node_path24.join)(path, basename5));
|
|
56104
|
+
entry2 = { path: (0, import_node_path24.relative)(this._root, fullPath), fullPath, basename: basename5 };
|
|
55787
56105
|
entry2[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
|
|
55788
56106
|
} catch (err) {
|
|
55789
56107
|
this._onError(err);
|
|
@@ -55817,7 +56135,7 @@ var ReaddirpStream = class extends import_node_stream2.Readable {
|
|
|
55817
56135
|
}
|
|
55818
56136
|
if (entryRealPathStats.isDirectory()) {
|
|
55819
56137
|
const len = entryRealPath.length;
|
|
55820
|
-
if (full.startsWith(entryRealPath) && full.substr(len, 1) ===
|
|
56138
|
+
if (full.startsWith(entryRealPath) && full.substr(len, 1) === import_node_path24.sep) {
|
|
55821
56139
|
const recursiveError = new Error(`Circular symlink detected: "${full}" points to "${entryRealPath}"`);
|
|
55822
56140
|
recursiveError.code = RECURSIVE_ERROR_CODE;
|
|
55823
56141
|
return this._onError(recursiveError);
|
|
@@ -56356,9 +56674,9 @@ var NodeFsHandler = class {
|
|
|
56356
56674
|
if (this.fsw.closed) {
|
|
56357
56675
|
return;
|
|
56358
56676
|
}
|
|
56359
|
-
const
|
|
56677
|
+
const dirname11 = sysPath.dirname(file);
|
|
56360
56678
|
const basename5 = sysPath.basename(file);
|
|
56361
|
-
const parent = this.fsw._getWatchedDir(
|
|
56679
|
+
const parent = this.fsw._getWatchedDir(dirname11);
|
|
56362
56680
|
let prevStats = stats;
|
|
56363
56681
|
if (parent.has(basename5))
|
|
56364
56682
|
return;
|
|
@@ -56385,7 +56703,7 @@ var NodeFsHandler = class {
|
|
|
56385
56703
|
prevStats = newStats2;
|
|
56386
56704
|
}
|
|
56387
56705
|
} catch (error) {
|
|
56388
|
-
this.fsw._remove(
|
|
56706
|
+
this.fsw._remove(dirname11, basename5);
|
|
56389
56707
|
}
|
|
56390
56708
|
} else if (parent.has(basename5)) {
|
|
56391
56709
|
const at = newStats.atimeMs;
|
|
@@ -57325,33 +57643,33 @@ function appIdFromLogPath(path) {
|
|
|
57325
57643
|
return i >= 0 && parts[i + 1] ? parts[i + 1] : null;
|
|
57326
57644
|
}
|
|
57327
57645
|
function samePath(a, b) {
|
|
57328
|
-
const ra = (0,
|
|
57329
|
-
const rb = (0,
|
|
57646
|
+
const ra = (0, import_node_path25.resolve)(a);
|
|
57647
|
+
const rb = (0, import_node_path25.resolve)(b);
|
|
57330
57648
|
return process.platform === "win32" ? ra.toLowerCase() === rb.toLowerCase() : ra === rb;
|
|
57331
57649
|
}
|
|
57332
57650
|
function underDir(path, dir) {
|
|
57333
|
-
const rp = (0,
|
|
57334
|
-
const rd = (0,
|
|
57651
|
+
const rp = (0, import_node_path25.resolve)(path);
|
|
57652
|
+
const rd = (0, import_node_path25.resolve)(dir);
|
|
57335
57653
|
const [p, d] = process.platform === "win32" ? [rp.toLowerCase(), rd.toLowerCase()] : [rp, rd];
|
|
57336
|
-
return p === d || p.startsWith(d +
|
|
57654
|
+
return p === d || p.startsWith(d + import_node_path25.sep);
|
|
57337
57655
|
}
|
|
57338
57656
|
function startWatcher() {
|
|
57339
|
-
const awareDir = process.env.AWARE_HOME ?? (0,
|
|
57340
|
-
const credentialsDir = (0,
|
|
57341
|
-
if (!(0,
|
|
57657
|
+
const awareDir = process.env.AWARE_HOME ?? (0, import_node_path25.join)((0, import_node_os17.homedir)(), ".aware");
|
|
57658
|
+
const credentialsDir = (0, import_node_path25.join)(awareDir, "credentials");
|
|
57659
|
+
if (!(0, import_node_fs27.existsSync)(credentialsDir)) {
|
|
57342
57660
|
try {
|
|
57343
|
-
(0,
|
|
57661
|
+
(0, import_node_fs27.mkdirSync)(credentialsDir, { recursive: true });
|
|
57344
57662
|
} catch {
|
|
57345
57663
|
}
|
|
57346
57664
|
}
|
|
57347
|
-
if (!(0,
|
|
57665
|
+
if (!(0, import_node_fs27.existsSync)(uiDir)) {
|
|
57348
57666
|
try {
|
|
57349
|
-
(0,
|
|
57667
|
+
(0, import_node_fs27.mkdirSync)(uiDir, { recursive: true });
|
|
57350
57668
|
} catch {
|
|
57351
57669
|
}
|
|
57352
57670
|
}
|
|
57353
|
-
const targets = ["apps", "logs", "credentials"].map((d) => (0,
|
|
57354
|
-
if ((0,
|
|
57671
|
+
const targets = ["apps", "logs", "credentials"].map((d) => (0, import_node_path25.join)(awareDir, d)).filter((p) => (0, import_node_fs27.existsSync)(p));
|
|
57672
|
+
if ((0, import_node_fs27.existsSync)(uiDir)) targets.push(uiDir);
|
|
57355
57673
|
if (targets.length === 0) {
|
|
57356
57674
|
return null;
|
|
57357
57675
|
}
|
|
@@ -57380,11 +57698,11 @@ function startWatcher() {
|
|
|
57380
57698
|
const isCredential = path.split(/[\\/]/).includes("credentials");
|
|
57381
57699
|
const kind = isCredential ? "credential" : path.endsWith(".jsonl") ? "trace" : path.endsWith(".lock") ? "lock" : path.endsWith(".flo") || path.endsWith(".app") ? "source" : "file";
|
|
57382
57700
|
broadcast({ type: "fs-change", kind, event, path });
|
|
57383
|
-
if (kind === "trace" && event !== "unlink" && (0,
|
|
57701
|
+
if (kind === "trace" && event !== "unlink" && (0, import_node_fs27.existsSync)(path)) {
|
|
57384
57702
|
const id = appIdFromLogPath(path);
|
|
57385
57703
|
if (!id) return;
|
|
57386
57704
|
try {
|
|
57387
|
-
broadcast({ type: "trace-file", id, runId: path.split(
|
|
57705
|
+
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")) });
|
|
57388
57706
|
} catch {
|
|
57389
57707
|
}
|
|
57390
57708
|
}
|
|
@@ -57393,10 +57711,10 @@ function startWatcher() {
|
|
|
57393
57711
|
}
|
|
57394
57712
|
|
|
57395
57713
|
// index.ts
|
|
57396
|
-
var __dirname4 = (0,
|
|
57397
|
-
var WEB_ROOT = [(0,
|
|
57398
|
-
(p) => (0,
|
|
57399
|
-
) ?? (0,
|
|
57714
|
+
var __dirname4 = (0, import_node_path26.dirname)((0, import_node_url4.fileURLToPath)(__import_meta_url));
|
|
57715
|
+
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(
|
|
57716
|
+
(p) => (0, import_node_fs28.existsSync)(p)
|
|
57717
|
+
) ?? (0, import_node_path26.join)(__dirname4, "..", "web");
|
|
57400
57718
|
var PORT2 = Number(process.env.PORT ?? 4317);
|
|
57401
57719
|
var HOST = "127.0.0.1";
|
|
57402
57720
|
var crashHandlersInstalled = false;
|
|
@@ -57412,7 +57730,7 @@ function installCrashHandlers() {
|
|
|
57412
57730
|
${stack}
|
|
57413
57731
|
`;
|
|
57414
57732
|
try {
|
|
57415
|
-
(0,
|
|
57733
|
+
(0, import_node_fs28.appendFileSync)(logFilePath(), line);
|
|
57416
57734
|
} catch {
|
|
57417
57735
|
}
|
|
57418
57736
|
if (process.stderr.isTTY) process.stderr.write(line);
|
|
@@ -57492,6 +57810,9 @@ async function startServer() {
|
|
|
57492
57810
|
if (err instanceof AppNotFoundError) {
|
|
57493
57811
|
return reply.status(404).send({ ok: false, error: err.message });
|
|
57494
57812
|
}
|
|
57813
|
+
if (err instanceof ContractError) {
|
|
57814
|
+
return reply.status(400).send({ ok: false, error: err.message });
|
|
57815
|
+
}
|
|
57495
57816
|
if (err instanceof RoutineError) {
|
|
57496
57817
|
return reply.status(err.status).send({ ok: false, error: err.message });
|
|
57497
57818
|
}
|
|
@@ -57786,6 +58107,95 @@ async function startServer() {
|
|
|
57786
58107
|
app.get("/api/app/:id", async (req) => {
|
|
57787
58108
|
return { ok: true, app: readApp(req.params.id) };
|
|
57788
58109
|
});
|
|
58110
|
+
app.get("/api/contract/:appId", async (req, reply) => {
|
|
58111
|
+
const doc2 = readContract(req.params.appId);
|
|
58112
|
+
if (doc2 == null) return reply.status(404).send({ ok: false, error: "no contract for this app yet" });
|
|
58113
|
+
return doc2;
|
|
58114
|
+
});
|
|
58115
|
+
app.put(
|
|
58116
|
+
"/api/contract/:appId",
|
|
58117
|
+
{ bodyLimit: 25 * 1024 * 1024 },
|
|
58118
|
+
// contracts embed rasters
|
|
58119
|
+
async (req, reply) => {
|
|
58120
|
+
try {
|
|
58121
|
+
writeContract(req.params.appId, req.body);
|
|
58122
|
+
} catch (e) {
|
|
58123
|
+
if (e instanceof ContractError) return reply.status(400).send({ ok: false, error: e.message });
|
|
58124
|
+
throw e;
|
|
58125
|
+
}
|
|
58126
|
+
broadcast({ type: "contract-changed", appId: req.params.appId });
|
|
58127
|
+
return { ok: true };
|
|
58128
|
+
}
|
|
58129
|
+
);
|
|
58130
|
+
app.post("/api/contract/:appId/approve", async (req, reply) => {
|
|
58131
|
+
const doc2 = readContract(req.params.appId);
|
|
58132
|
+
if (doc2 == null) return reply.status(404).send({ ok: false, error: "no contract to approve" });
|
|
58133
|
+
const v = validateSteelTakeoff(doc2);
|
|
58134
|
+
if (!v.valid) return reply.status(400).send({ ok: false, error: "stored contract is invalid \u2014 re-save it in the editor" });
|
|
58135
|
+
const sourcePath = readApp(req.params.appId).source.path;
|
|
58136
|
+
try {
|
|
58137
|
+
bakeContractIntoApp(sourcePath, doc2);
|
|
58138
|
+
} catch (e) {
|
|
58139
|
+
return reply.status(422).send({ ok: false, error: e instanceof Error ? e.message : "bake failed" });
|
|
58140
|
+
}
|
|
58141
|
+
let result;
|
|
58142
|
+
try {
|
|
58143
|
+
result = await aware.compile(sourcePath);
|
|
58144
|
+
} catch (e) {
|
|
58145
|
+
return reply.status(422).send({
|
|
58146
|
+
ok: false,
|
|
58147
|
+
error: `contract was baked but compile failed \u2014 fix the workflow and Approve again: ${e instanceof Error ? e.message : "compile error"}`
|
|
58148
|
+
});
|
|
58149
|
+
}
|
|
58150
|
+
broadcast({ type: "compiled", id: req.params.appId, lockPath: result.lockPath });
|
|
58151
|
+
return { ok: true, result };
|
|
58152
|
+
});
|
|
58153
|
+
function awareStderr(e) {
|
|
58154
|
+
if (e instanceof AwareError && e.detail && typeof e.detail === "object") {
|
|
58155
|
+
const s = e.detail.stderr;
|
|
58156
|
+
return typeof s === "string" && s.trim() ? s.trim() : null;
|
|
58157
|
+
}
|
|
58158
|
+
return null;
|
|
58159
|
+
}
|
|
58160
|
+
app.post("/api/contract/:appId/export-3d", async (req, reply) => {
|
|
58161
|
+
const doc2 = readContract(req.params.appId);
|
|
58162
|
+
if (doc2 == null) return reply.status(404).send({ ok: false, error: "no contract to export" });
|
|
58163
|
+
const v = validateSteelTakeoff(doc2);
|
|
58164
|
+
if (!v.valid) return reply.status(400).send({ ok: false, error: "stored contract is invalid \u2014 re-save it in the editor" });
|
|
58165
|
+
const { scene, skipped } = contractToScene(doc2);
|
|
58166
|
+
if (scene.elements.length === 0) {
|
|
58167
|
+
return reply.status(422).send({ ok: false, error: "no resolvable members to render \u2014 every member is an RFI (no AISC size yet)", skipped });
|
|
58168
|
+
}
|
|
58169
|
+
const companionId = `${req.params.appId}-3d`;
|
|
58170
|
+
let flo;
|
|
58171
|
+
try {
|
|
58172
|
+
flo = writeViewer3dApp(appPath(companionId), companionId, scene);
|
|
58173
|
+
} catch (e) {
|
|
58174
|
+
app.log.error({ companionId, err: e instanceof Error ? e.message : e }, "export-3d: companion app write failed");
|
|
58175
|
+
return reply.status(500).send({ ok: false, error: `could not write the 3D companion app: ${e instanceof Error ? e.message : "write error"}` });
|
|
58176
|
+
}
|
|
58177
|
+
try {
|
|
58178
|
+
await aware.compile(flo);
|
|
58179
|
+
} catch (e) {
|
|
58180
|
+
app.log.warn({ companionId, detail: e instanceof AwareError ? e.detail : void 0 }, "3D compile failed");
|
|
58181
|
+
return reply.status(422).send({ ok: false, error: `3D compile failed: ${e instanceof Error ? e.message : "compile error"}`, reason: awareStderr(e) });
|
|
58182
|
+
}
|
|
58183
|
+
let result;
|
|
58184
|
+
try {
|
|
58185
|
+
result = await aware.run(companionId, {});
|
|
58186
|
+
} catch (e) {
|
|
58187
|
+
if (e instanceof AwareError) {
|
|
58188
|
+
app.log.warn({ companionId, detail: e.detail }, "3D render failed");
|
|
58189
|
+
return reply.send({ ok: false, error: e.message, reason: awareStderr(e) });
|
|
58190
|
+
}
|
|
58191
|
+
throw e;
|
|
58192
|
+
}
|
|
58193
|
+
const events = result.traceText ? parseTrace(result.traceText) : [];
|
|
58194
|
+
const extracted = extractReportHtml(events, companionId);
|
|
58195
|
+
if (!extracted) return reply.send({ ok: false, error: "the 3D render produced no html" });
|
|
58196
|
+
broadcast({ type: "apps-changed" });
|
|
58197
|
+
return { ok: true, report: { ...extracted, interactive: true }, skipped };
|
|
58198
|
+
});
|
|
57789
58199
|
async function stopForegroundSession(id) {
|
|
57790
58200
|
try {
|
|
57791
58201
|
const sid = foregroundSessionId(id);
|
|
@@ -57837,11 +58247,11 @@ async function startServer() {
|
|
|
57837
58247
|
if (appExists(id)) {
|
|
57838
58248
|
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 });
|
|
57839
58249
|
}
|
|
57840
|
-
const stageRoot = (0,
|
|
58250
|
+
const stageRoot = (0, import_node_fs28.mkdtempSync)((0, import_node_path26.join)((0, import_node_os18.tmpdir)(), "floless-import-"));
|
|
57841
58251
|
try {
|
|
57842
|
-
const stageDir = (0,
|
|
57843
|
-
(0,
|
|
57844
|
-
(0,
|
|
58252
|
+
const stageDir = (0, import_node_path26.join)(stageRoot, id);
|
|
58253
|
+
(0, import_node_fs28.mkdirSync)(stageDir);
|
|
58254
|
+
(0, import_node_fs28.writeFileSync)((0, import_node_path26.join)(stageDir, `${id}.flo`), content);
|
|
57845
58255
|
await aware.install(stageDir);
|
|
57846
58256
|
} catch (err) {
|
|
57847
58257
|
try {
|
|
@@ -57851,7 +58261,7 @@ async function startServer() {
|
|
|
57851
58261
|
const msg = err instanceof AwareError ? err.message : String(err?.message ?? err);
|
|
57852
58262
|
return reply.status(502).send({ ok: false, error: `import failed: ${msg}` });
|
|
57853
58263
|
} finally {
|
|
57854
|
-
(0,
|
|
58264
|
+
(0, import_node_fs28.rmSync)(stageRoot, { recursive: true, force: true });
|
|
57855
58265
|
}
|
|
57856
58266
|
broadcast({ type: "apps-changed", id });
|
|
57857
58267
|
return { ok: true, id };
|
|
@@ -57865,13 +58275,13 @@ async function startServer() {
|
|
|
57865
58275
|
}
|
|
57866
58276
|
const inputs = appData.inputs.map((i) => ({ name: i.name, type: i.type }));
|
|
57867
58277
|
const baked = bakeFloSource(appData.source.text, inputs);
|
|
57868
|
-
const tmpRoot = (0,
|
|
57869
|
-
const backupDir = (0,
|
|
57870
|
-
const bakeDir = (0,
|
|
57871
|
-
(0,
|
|
57872
|
-
(0,
|
|
58278
|
+
const tmpRoot = (0, import_node_fs28.mkdtempSync)((0, import_node_path26.join)((0, import_node_os18.tmpdir)(), "floless-bake-"));
|
|
58279
|
+
const backupDir = (0, import_node_path26.join)(tmpRoot, `${id}-backup`);
|
|
58280
|
+
const bakeDir = (0, import_node_path26.join)(tmpRoot, id);
|
|
58281
|
+
(0, import_node_fs28.cpSync)(appDir(id), backupDir, { recursive: true });
|
|
58282
|
+
(0, import_node_fs28.cpSync)(appDir(id), bakeDir, { recursive: true });
|
|
57873
58283
|
const floName = appData.source.path.split(/[\\/]/).pop();
|
|
57874
|
-
(0,
|
|
58284
|
+
(0, import_node_fs28.writeFileSync)((0, import_node_path26.join)(bakeDir, floName), baked);
|
|
57875
58285
|
let appInstalled2 = true;
|
|
57876
58286
|
try {
|
|
57877
58287
|
await aware.uninstall(id);
|
|
@@ -57893,17 +58303,17 @@ async function startServer() {
|
|
|
57893
58303
|
throw installErr;
|
|
57894
58304
|
}
|
|
57895
58305
|
try {
|
|
57896
|
-
await aware.compile((0,
|
|
58306
|
+
await aware.compile((0, import_node_path26.join)(appDir(id), floName));
|
|
57897
58307
|
} catch (compileErr) {
|
|
57898
58308
|
app.log.warn({ id, compileErr: String(compileErr) }, "bake: post-install recompile failed (app baked but may need a manual Compile)");
|
|
57899
58309
|
}
|
|
57900
58310
|
broadcast({ type: "baked", id });
|
|
57901
58311
|
return { ok: true, id, agent: id, inputs };
|
|
57902
58312
|
} finally {
|
|
57903
|
-
if (appInstalled2) (0,
|
|
58313
|
+
if (appInstalled2) (0, import_node_fs28.rmSync)(tmpRoot, { recursive: true, force: true });
|
|
57904
58314
|
}
|
|
57905
58315
|
});
|
|
57906
|
-
const graftAgentsDir = () => (0,
|
|
58316
|
+
const graftAgentsDir = () => (0, import_node_path26.join)((0, import_node_os18.homedir)(), ".aware", "agents");
|
|
57907
58317
|
app.post("/api/graft/match", async (req, reply) => {
|
|
57908
58318
|
const { glob } = req.body ?? {};
|
|
57909
58319
|
if (!glob) return reply.status(400).send({ ok: false, error: "glob required" });
|
|
@@ -57920,7 +58330,7 @@ async function startServer() {
|
|
|
57920
58330
|
if (!sourceKind || !sourceRef) {
|
|
57921
58331
|
return reply.status(400).send({ ok: false, error: "sourceKind and sourceRef required" });
|
|
57922
58332
|
}
|
|
57923
|
-
const tempHome = (0,
|
|
58333
|
+
const tempHome = (0, import_node_fs28.mkdtempSync)((0, import_node_path26.join)((0, import_node_os18.tmpdir)(), "floless-graft-"));
|
|
57924
58334
|
let result;
|
|
57925
58335
|
try {
|
|
57926
58336
|
result = await aware.build({
|
|
@@ -57933,19 +58343,19 @@ async function startServer() {
|
|
|
57933
58343
|
awareHome: tempHome
|
|
57934
58344
|
});
|
|
57935
58345
|
} catch (err) {
|
|
57936
|
-
(0,
|
|
58346
|
+
(0, import_node_fs28.rmSync)(tempHome, { recursive: true, force: true });
|
|
57937
58347
|
const msg = err instanceof AwareError ? err.message : String(err?.message ?? err);
|
|
57938
58348
|
return reply.status(422).send({ ok: false, error: msg });
|
|
57939
58349
|
}
|
|
57940
58350
|
const manifest = readStagedManifest(result.agentDir);
|
|
57941
58351
|
if (!manifest) {
|
|
57942
|
-
(0,
|
|
58352
|
+
(0, import_node_fs28.rmSync)(tempHome, { recursive: true, force: true });
|
|
57943
58353
|
return reply.status(502).send({ ok: false, error: `build produced output at ${result.agentDir} but no manifest.yaml` });
|
|
57944
58354
|
}
|
|
57945
58355
|
const token = (0, import_node_crypto7.randomUUID)();
|
|
57946
58356
|
registerStage(token, tempHome, result.agentId);
|
|
57947
58357
|
const preview = buildPreview(manifest, sourceKind, sourceRef, token);
|
|
57948
|
-
if ((0,
|
|
58358
|
+
if ((0, import_node_fs28.existsSync)((0, import_node_path26.join)(graftAgentsDir(), result.agentId))) {
|
|
57949
58359
|
preview.warnings.unshift(`An agent named "${result.agentId}" is already installed \u2014 creating it will overwrite it.`);
|
|
57950
58360
|
}
|
|
57951
58361
|
return { ok: true, preview };
|
|
@@ -57964,7 +58374,7 @@ async function startServer() {
|
|
|
57964
58374
|
registerStage(stagedRef, stage.tempDir, stage.agentId);
|
|
57965
58375
|
return reply.status(409).send({ ok: false, error: err.message, agentId: stage.agentId, collision: true });
|
|
57966
58376
|
}
|
|
57967
|
-
(0,
|
|
58377
|
+
(0, import_node_fs28.rmSync)(stage.tempDir, { recursive: true, force: true });
|
|
57968
58378
|
throw err;
|
|
57969
58379
|
}
|
|
57970
58380
|
broadcast({ type: "grafted", id: stage.agentId });
|
|
@@ -58197,11 +58607,11 @@ async function startServer() {
|
|
|
58197
58607
|
app.get("/api/requests/:id/snapshot/:n", async (req, reply) => {
|
|
58198
58608
|
const n = Number.parseInt(req.params.n, 10);
|
|
58199
58609
|
const p = Number.isInteger(n) ? snapshotPathFor(req.params.id, n) : null;
|
|
58200
|
-
if (!p || !(0,
|
|
58610
|
+
if (!p || !(0, import_node_fs28.existsSync)(p)) return reply.status(404).send({ ok: false, error: "snapshot not found" });
|
|
58201
58611
|
const ext = p.split(".").pop().toLowerCase();
|
|
58202
58612
|
reply.header("Content-Type", ext === "png" ? "image/png" : ext === "webp" ? "image/webp" : ext === "pdf" ? "application/pdf" : "image/jpeg");
|
|
58203
58613
|
reply.header("Cache-Control", "no-store");
|
|
58204
|
-
return (0,
|
|
58614
|
+
return (0, import_node_fs28.readFileSync)(p);
|
|
58205
58615
|
});
|
|
58206
58616
|
app.post(
|
|
58207
58617
|
"/api/tweak",
|
|
@@ -58222,6 +58632,25 @@ async function startServer() {
|
|
|
58222
58632
|
return { ok: true, request };
|
|
58223
58633
|
}
|
|
58224
58634
|
);
|
|
58635
|
+
app.post(
|
|
58636
|
+
"/api/contract-request",
|
|
58637
|
+
{ bodyLimit: 25 * 1024 * 1024 },
|
|
58638
|
+
async (req, reply) => {
|
|
58639
|
+
const { appId, instruction, snapshots } = req.body ?? {};
|
|
58640
|
+
if (!appId || !instruction) {
|
|
58641
|
+
return reply.status(400).send({ ok: false, error: "appId, instruction required" });
|
|
58642
|
+
}
|
|
58643
|
+
let decoded;
|
|
58644
|
+
try {
|
|
58645
|
+
decoded = decodeSnapshots(snapshots);
|
|
58646
|
+
} catch (e) {
|
|
58647
|
+
return reply.status(400).send({ ok: false, error: e instanceof Error ? e.message : "bad snapshot" });
|
|
58648
|
+
}
|
|
58649
|
+
const request = addRequest({ type: "tweak-contract", appId, instruction }, decoded);
|
|
58650
|
+
broadcast({ type: "request-added", request });
|
|
58651
|
+
return { ok: true, request };
|
|
58652
|
+
}
|
|
58653
|
+
);
|
|
58225
58654
|
const REBAKE_INSTRUCTION = "Re-read the attached drawing and re-bake the extracted values into this app's config.yaml (the literals the deterministic run uses), then `aware app compile` the app and tell me to approve the new lock. Do not change node logic \u2014 only the baked config values.";
|
|
58226
58655
|
app.post(
|
|
58227
58656
|
"/api/rebake",
|
|
@@ -58331,7 +58760,7 @@ async function startServer() {
|
|
|
58331
58760
|
warn(`last-run-status:${ref} \u2014 trace exists but couldn't be parsed (corrupt/truncated)`);
|
|
58332
58761
|
let finishedAt2 = null;
|
|
58333
58762
|
try {
|
|
58334
|
-
finishedAt2 = (0,
|
|
58763
|
+
finishedAt2 = (0, import_node_fs28.statSync)(latest.path).mtime.toISOString();
|
|
58335
58764
|
} catch {
|
|
58336
58765
|
finishedAt2 = null;
|
|
58337
58766
|
}
|
|
@@ -58341,7 +58770,7 @@ async function startServer() {
|
|
|
58341
58770
|
let finishedAt = typeof runEnd?.ts === "string" ? runEnd.ts : null;
|
|
58342
58771
|
if (!finishedAt) {
|
|
58343
58772
|
try {
|
|
58344
|
-
finishedAt = (0,
|
|
58773
|
+
finishedAt = (0, import_node_fs28.statSync)(latest.path).mtime.toISOString();
|
|
58345
58774
|
} catch {
|
|
58346
58775
|
finishedAt = null;
|
|
58347
58776
|
}
|