@floless/app 0.28.0 → 0.30.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 +775 -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 +58 -0
- package/dist/web/app.js +4 -1
- package/dist/web/aware.js +217 -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));
|
|
@@ -51012,6 +51016,8 @@ function readApp(id) {
|
|
|
51012
51016
|
kind: locked && typeof locked.kind === "string" ? locked.kind : "agent",
|
|
51013
51017
|
mode: lockMode === "write" || lockMode === "read" ? lockMode : "unknown",
|
|
51014
51018
|
runtimeModel: !!locked && locked["runtime-model"] === true,
|
|
51019
|
+
// `frozen:` lives on the SOURCE node (the user froze it); present (non-null) = frozen.
|
|
51020
|
+
frozen: n.frozen != null,
|
|
51015
51021
|
inputs: asRecord(locked?.inputs),
|
|
51016
51022
|
config: asRecord(n.config),
|
|
51017
51023
|
notes: notes2,
|
|
@@ -51623,6 +51629,10 @@ function assertId(id) {
|
|
|
51623
51629
|
if (!APP_ID.test(id)) throw new AwareError(`invalid app id: ${JSON.stringify(id)}`);
|
|
51624
51630
|
return id;
|
|
51625
51631
|
}
|
|
51632
|
+
function assertNodeId(id) {
|
|
51633
|
+
if (!APP_ID.test(id)) throw new AwareError(`invalid node id: ${JSON.stringify(id)}`);
|
|
51634
|
+
return id;
|
|
51635
|
+
}
|
|
51626
51636
|
var SOURCE_EXT = /\.(flo|app|flow|aware)$/i;
|
|
51627
51637
|
function assertSourcePath(p) {
|
|
51628
51638
|
if (!SOURCE_EXT.test(p)) throw new AwareError(`source must be a .flo/.app file: ${JSON.stringify(p)}`);
|
|
@@ -52004,6 +52014,39 @@ var aware = {
|
|
|
52004
52014
|
}
|
|
52005
52015
|
return { compiled: /lock refreshed/i.test(stdout), output: stdout.trim() };
|
|
52006
52016
|
},
|
|
52017
|
+
/**
|
|
52018
|
+
* Freeze a node (`aware app freeze <app> <node>`, CLI ≥ 0.77, aware-aeco#261). Pins the
|
|
52019
|
+
* node's LAST run output into the source as a `frozen:` block so Run skips the agent
|
|
52020
|
+
* (replays the pinned value, never re-runs it) and recompiles the lock. Fails when the
|
|
52021
|
+
* node has never produced output (nothing to pin) — the route relays that as "run it
|
|
52022
|
+
* once first". Throws AwareUnsupportedError on a pre-0.77 CLI so the route can say "update
|
|
52023
|
+
* AWARE" instead of treating an old CLI as a hard fault (mirrors rename/duplicate).
|
|
52024
|
+
*/
|
|
52025
|
+
async freeze(appId, nodeId) {
|
|
52026
|
+
const { code, stdout, stderr } = await runRaw(["app", "freeze", assertId(appId), assertNodeId(nodeId)]);
|
|
52027
|
+
if (code !== 0) {
|
|
52028
|
+
if (isInvokeUnsupported({ stdout, stderr })) {
|
|
52029
|
+
throw new AwareUnsupportedError("aware CLI does not support `app freeze` (needs \u2265 0.77) \u2014 update AWARE", { stdout, stderr });
|
|
52030
|
+
}
|
|
52031
|
+
throw new AwareError(`aware app freeze ${nodeId} failed (exit ${code})`, { stdout, stderr, code });
|
|
52032
|
+
}
|
|
52033
|
+
return { output: stdout.trim() };
|
|
52034
|
+
},
|
|
52035
|
+
/**
|
|
52036
|
+
* Unfreeze a node (`aware app unfreeze <app> <node>`, CLI ≥ 0.77). Removes the node's
|
|
52037
|
+
* `frozen:` block so it runs normally again and recompiles. Same unsupported-degradation
|
|
52038
|
+
* contract as freeze.
|
|
52039
|
+
*/
|
|
52040
|
+
async unfreeze(appId, nodeId) {
|
|
52041
|
+
const { code, stdout, stderr } = await runRaw(["app", "unfreeze", assertId(appId), assertNodeId(nodeId)]);
|
|
52042
|
+
if (code !== 0) {
|
|
52043
|
+
if (isInvokeUnsupported({ stdout, stderr })) {
|
|
52044
|
+
throw new AwareUnsupportedError("aware CLI does not support `app unfreeze` (needs \u2265 0.77) \u2014 update AWARE", { stdout, stderr });
|
|
52045
|
+
}
|
|
52046
|
+
throw new AwareError(`aware app unfreeze ${nodeId} failed (exit ${code})`, { stdout, stderr, code });
|
|
52047
|
+
}
|
|
52048
|
+
return { output: stdout.trim() };
|
|
52049
|
+
},
|
|
52007
52050
|
/**
|
|
52008
52051
|
* Install a first-party agent by registry id (`aware agent install <id>`). The
|
|
52009
52052
|
* registry install pulls a large tarball (~200s observed) — far over runRaw's 60s
|
|
@@ -52792,7 +52835,7 @@ function appVersion() {
|
|
|
52792
52835
|
return resolveVersion({
|
|
52793
52836
|
isSea: isSea2(),
|
|
52794
52837
|
sqVersionXml: readSqVersionXml(),
|
|
52795
|
-
define: true ? "0.
|
|
52838
|
+
define: true ? "0.30.0" : void 0,
|
|
52796
52839
|
pkgVersion: readPkgVersion()
|
|
52797
52840
|
});
|
|
52798
52841
|
}
|
|
@@ -52802,7 +52845,7 @@ function resolveChannel(s) {
|
|
|
52802
52845
|
return "dev";
|
|
52803
52846
|
}
|
|
52804
52847
|
function appChannel() {
|
|
52805
|
-
return resolveChannel({ isSea: isSea2(), define: true ? "0.
|
|
52848
|
+
return resolveChannel({ isSea: isSea2(), define: true ? "0.30.0" : void 0 });
|
|
52806
52849
|
}
|
|
52807
52850
|
|
|
52808
52851
|
// oauth-presets.ts
|
|
@@ -53492,14 +53535,323 @@ function deleteVisualInputs(id) {
|
|
|
53492
53535
|
if ((0, import_node_fs14.existsSync)(dir)) (0, import_node_fs14.rmSync)(dir, { recursive: true, force: true });
|
|
53493
53536
|
}
|
|
53494
53537
|
|
|
53495
|
-
//
|
|
53538
|
+
// contract-store.ts
|
|
53539
|
+
var import_node_fs16 = require("node:fs");
|
|
53540
|
+
var import_node_path14 = require("node:path");
|
|
53541
|
+
var import_node_os11 = require("node:os");
|
|
53542
|
+
|
|
53543
|
+
// contract-schema.ts
|
|
53544
|
+
var import_node_fs15 = require("node:fs");
|
|
53545
|
+
var import_node_path13 = require("node:path");
|
|
53546
|
+
var import_node_url = require("node:url");
|
|
53547
|
+
function validate(doc2, schema) {
|
|
53548
|
+
const errors = [];
|
|
53549
|
+
walk(doc2, schema, schema, "$", errors);
|
|
53550
|
+
return { valid: errors.length === 0, errors };
|
|
53551
|
+
}
|
|
53552
|
+
function isPlainObject(v) {
|
|
53553
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
53554
|
+
}
|
|
53555
|
+
function resolveRef(root, ref) {
|
|
53556
|
+
const m = /^#\/\$defs\/(.+)$/.exec(ref);
|
|
53557
|
+
if (!m) return null;
|
|
53558
|
+
return root.$defs?.[m[1]] ?? null;
|
|
53559
|
+
}
|
|
53560
|
+
function typeMatches(value, t) {
|
|
53561
|
+
switch (t) {
|
|
53562
|
+
case "object":
|
|
53563
|
+
return isPlainObject(value);
|
|
53564
|
+
case "array":
|
|
53565
|
+
return Array.isArray(value);
|
|
53566
|
+
case "string":
|
|
53567
|
+
return typeof value === "string";
|
|
53568
|
+
case "number":
|
|
53569
|
+
return typeof value === "number";
|
|
53570
|
+
case "integer":
|
|
53571
|
+
return typeof value === "number" && Number.isInteger(value);
|
|
53572
|
+
case "boolean":
|
|
53573
|
+
return typeof value === "boolean";
|
|
53574
|
+
case "null":
|
|
53575
|
+
return value === null;
|
|
53576
|
+
default:
|
|
53577
|
+
return false;
|
|
53578
|
+
}
|
|
53579
|
+
}
|
|
53580
|
+
function kindOf(v) {
|
|
53581
|
+
if (v === null) return "null";
|
|
53582
|
+
if (Array.isArray(v)) return "array";
|
|
53583
|
+
return typeof v;
|
|
53584
|
+
}
|
|
53585
|
+
function deepEqual(a, b) {
|
|
53586
|
+
if (a === b) return true;
|
|
53587
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
53588
|
+
return a.length === b.length && a.every((x, i) => deepEqual(x, b[i]));
|
|
53589
|
+
}
|
|
53590
|
+
return false;
|
|
53591
|
+
}
|
|
53592
|
+
function walk(value, node, root, path, errors) {
|
|
53593
|
+
if (node.$ref) {
|
|
53594
|
+
const target = resolveRef(root, node.$ref);
|
|
53595
|
+
if (!target) {
|
|
53596
|
+
errors.push({ path, message: `unresolved $ref ${node.$ref}` });
|
|
53597
|
+
return;
|
|
53598
|
+
}
|
|
53599
|
+
walk(value, target, root, path, errors);
|
|
53600
|
+
return;
|
|
53601
|
+
}
|
|
53602
|
+
if ("const" in node && !deepEqual(value, node.const)) {
|
|
53603
|
+
errors.push({ path, message: `must equal ${JSON.stringify(node.const)}` });
|
|
53604
|
+
}
|
|
53605
|
+
if (node.enum && !node.enum.some((e) => deepEqual(value, e))) {
|
|
53606
|
+
errors.push({ path, message: `must be one of ${JSON.stringify(node.enum)}` });
|
|
53607
|
+
}
|
|
53608
|
+
if (node.type) {
|
|
53609
|
+
const types = Array.isArray(node.type) ? node.type : [node.type];
|
|
53610
|
+
if (!types.some((t) => typeMatches(value, t))) {
|
|
53611
|
+
errors.push({ path, message: `expected ${types.join(" | ")}, got ${kindOf(value)}` });
|
|
53612
|
+
return;
|
|
53613
|
+
}
|
|
53614
|
+
}
|
|
53615
|
+
if (isPlainObject(value)) {
|
|
53616
|
+
for (const r of node.required ?? []) {
|
|
53617
|
+
if (!Object.hasOwn(value, r)) errors.push({ path: `${path}.${r}`, message: "required" });
|
|
53618
|
+
}
|
|
53619
|
+
const props = node.properties ?? {};
|
|
53620
|
+
const ap = node.additionalProperties;
|
|
53621
|
+
for (const key of Object.keys(value)) {
|
|
53622
|
+
if (Object.hasOwn(props, key)) {
|
|
53623
|
+
walk(value[key], props[key], root, `${path}.${key}`, errors);
|
|
53624
|
+
} else if (ap === false) {
|
|
53625
|
+
errors.push({ path: `${path}.${key}`, message: "additional property not allowed" });
|
|
53626
|
+
} else if (ap && typeof ap === "object") {
|
|
53627
|
+
walk(value[key], ap, root, `${path}.${key}`, errors);
|
|
53628
|
+
}
|
|
53629
|
+
}
|
|
53630
|
+
}
|
|
53631
|
+
if (Array.isArray(value)) {
|
|
53632
|
+
if (typeof node.minItems === "number" && value.length < node.minItems) {
|
|
53633
|
+
errors.push({ path, message: `expected at least ${node.minItems} items, got ${value.length}` });
|
|
53634
|
+
}
|
|
53635
|
+
if (typeof node.maxItems === "number" && value.length > node.maxItems) {
|
|
53636
|
+
errors.push({ path, message: `expected at most ${node.maxItems} items, got ${value.length}` });
|
|
53637
|
+
}
|
|
53638
|
+
if (node.items) {
|
|
53639
|
+
value.forEach((el, i) => walk(el, node.items, root, `${path}[${i}]`, errors));
|
|
53640
|
+
}
|
|
53641
|
+
}
|
|
53642
|
+
}
|
|
53643
|
+
var _cached = null;
|
|
53644
|
+
function loadSteelTakeoffSchema() {
|
|
53645
|
+
if (_cached) return _cached;
|
|
53646
|
+
const here = (0, import_node_path13.dirname)((0, import_node_url.fileURLToPath)(__import_meta_url));
|
|
53647
|
+
const candidates = [
|
|
53648
|
+
(0, import_node_path13.join)(here, "..", "schemas", "steel.takeoff.v1.schema.json"),
|
|
53649
|
+
// dev: server/ next to schemas/
|
|
53650
|
+
(0, import_node_path13.join)(here, "schemas", "steel.takeoff.v1.schema.json")
|
|
53651
|
+
// bundled: dist/ holds ./schemas
|
|
53652
|
+
];
|
|
53653
|
+
for (const p of candidates) {
|
|
53654
|
+
try {
|
|
53655
|
+
const text = (0, import_node_fs15.readFileSync)(p, "utf8");
|
|
53656
|
+
_cached = JSON.parse(text);
|
|
53657
|
+
return _cached;
|
|
53658
|
+
} catch (err) {
|
|
53659
|
+
if (err.code !== "ENOENT") throw err;
|
|
53660
|
+
}
|
|
53661
|
+
}
|
|
53662
|
+
throw new Error("steel.takeoff/v1 schema file not found");
|
|
53663
|
+
}
|
|
53664
|
+
function validateSteelTakeoff(doc2) {
|
|
53665
|
+
return validate(doc2, loadSteelTakeoffSchema());
|
|
53666
|
+
}
|
|
53667
|
+
|
|
53668
|
+
// contract-store.ts
|
|
53669
|
+
var ContractError = class extends Error {
|
|
53670
|
+
};
|
|
53671
|
+
var ROOT3 = process.env.FLOLESS_HOME ?? (0, import_node_path14.join)((0, import_node_os11.homedir)(), ".floless");
|
|
53672
|
+
var DIR = (0, import_node_path14.join)(ROOT3, "contracts");
|
|
53673
|
+
function safeId(appId) {
|
|
53674
|
+
if (!/^[a-z0-9][a-z0-9._-]*$/i.test(appId)) throw new ContractError(`invalid appId: ${appId}`);
|
|
53675
|
+
return appId;
|
|
53676
|
+
}
|
|
53677
|
+
function contractPath(appId) {
|
|
53678
|
+
return (0, import_node_path14.join)(DIR, `${safeId(appId)}.json`);
|
|
53679
|
+
}
|
|
53680
|
+
function readContract(appId) {
|
|
53681
|
+
const p = contractPath(appId);
|
|
53682
|
+
if (!(0, import_node_fs16.existsSync)(p)) return null;
|
|
53683
|
+
try {
|
|
53684
|
+
return JSON.parse((0, import_node_fs16.readFileSync)(p, "utf8"));
|
|
53685
|
+
} catch (e) {
|
|
53686
|
+
console.warn(`readContract: ignoring unreadable contract at ${p}: ${e instanceof Error ? e.message : e}`);
|
|
53687
|
+
return null;
|
|
53688
|
+
}
|
|
53689
|
+
}
|
|
53690
|
+
function writeContract(appId, doc2) {
|
|
53691
|
+
const p = contractPath(appId);
|
|
53692
|
+
const res = validateSteelTakeoff(doc2);
|
|
53693
|
+
if (!res.valid) {
|
|
53694
|
+
const first = res.errors.slice(0, 5).map((e) => `${e.path}: ${e.message}`).join("; ");
|
|
53695
|
+
throw new ContractError(`contract failed schema validation \u2014 ${first}`);
|
|
53696
|
+
}
|
|
53697
|
+
if (!(0, import_node_fs16.existsSync)(DIR)) (0, import_node_fs16.mkdirSync)(DIR, { recursive: true });
|
|
53698
|
+
(0, import_node_fs16.writeFileSync)(p, JSON.stringify(doc2));
|
|
53699
|
+
}
|
|
53700
|
+
|
|
53701
|
+
// contract-bake.ts
|
|
53496
53702
|
var import_node_fs17 = require("node:fs");
|
|
53497
|
-
var
|
|
53703
|
+
var import_yaml4 = __toESM(require_dist6(), 1);
|
|
53704
|
+
function bakeContractIntoApp(sourcePath, contract) {
|
|
53705
|
+
const doc2 = (0, import_yaml4.parseDocument)((0, import_node_fs17.readFileSync)(sourcePath, "utf8"));
|
|
53706
|
+
if (doc2.errors.length > 0) {
|
|
53707
|
+
throw new Error(`contract bake: source is not valid YAML: ${doc2.errors[0]?.message ?? "parse error"}`);
|
|
53708
|
+
}
|
|
53709
|
+
const seq = doc2.get("nodes");
|
|
53710
|
+
const items = (0, import_yaml4.isSeq)(seq) ? seq.items : [];
|
|
53711
|
+
const nodeOf = (it) => (0, import_yaml4.isMap)(it) ? it.toJSON() : null;
|
|
53712
|
+
let idx = items.findIndex((it) => nodeOf(it)?.config?.contract === contract.type);
|
|
53713
|
+
if (idx < 0) idx = items.findIndex((it) => nodeOf(it)?.agent === "steel-takeoff-us");
|
|
53714
|
+
if (idx < 0) throw new Error("no contract-emitting node to bake the contract into");
|
|
53715
|
+
doc2.setIn(["nodes", idx, "config", "contract"], contract.type);
|
|
53716
|
+
doc2.setIn(["nodes", idx, "config", "takeoff"], contract);
|
|
53717
|
+
(0, import_node_fs17.writeFileSync)(sourcePath, doc2.toString());
|
|
53718
|
+
}
|
|
53719
|
+
|
|
53720
|
+
// contract-to-scene.ts
|
|
53721
|
+
var FT_TO_MM = 304.8;
|
|
53722
|
+
var IN_TO_MM = 25.4;
|
|
53723
|
+
function profileDims(profile) {
|
|
53724
|
+
if (!profile) return null;
|
|
53725
|
+
const p = profile.trim().toUpperCase();
|
|
53726
|
+
if (p === "" || /(^|[^A-Z])MF($|[^A-Z])/.test(p)) return null;
|
|
53727
|
+
const m = p.match(/^([A-Z]+)\s*([0-9X./]+)/);
|
|
53728
|
+
if (!m) return null;
|
|
53729
|
+
const prefix = m[1];
|
|
53730
|
+
const nums = m[2].split("X").map((t) => parseFloat(t)).filter((n) => !isNaN(n));
|
|
53731
|
+
if (nums.length === 0) return null;
|
|
53732
|
+
if ((prefix === "HSS" || prefix === "TUBE" || prefix === "L") && nums.length >= 3) {
|
|
53733
|
+
return { d: nums[0] * IN_TO_MM, w: nums[1] * IN_TO_MM, approx: false };
|
|
53734
|
+
}
|
|
53735
|
+
if (prefix === "HSS" || prefix === "PIPE") {
|
|
53736
|
+
const dia = nums[0] * IN_TO_MM;
|
|
53737
|
+
return { d: dia, w: dia, approx: false };
|
|
53738
|
+
}
|
|
53739
|
+
if (/^(W|S|M|HP|C|MC|WT|ST|MT)$/.test(prefix)) {
|
|
53740
|
+
const d = nums[0] * IN_TO_MM;
|
|
53741
|
+
const ratio = prefix === "C" || prefix === "MC" ? 0.28 : 0.42;
|
|
53742
|
+
return { d, w: d * ratio, approx: true };
|
|
53743
|
+
}
|
|
53744
|
+
return null;
|
|
53745
|
+
}
|
|
53746
|
+
function pickColor(profile, idx, contract) {
|
|
53747
|
+
const pc = contract.profile_colors ?? {};
|
|
53748
|
+
const override = pc[profile] ?? Object.entries(pc).find(([k]) => k.toUpperCase() === profile)?.[1];
|
|
53749
|
+
if (override) return override;
|
|
53750
|
+
const pal = contract.palette ?? [];
|
|
53751
|
+
if (pal.length === 0) return "#94a3b8";
|
|
53752
|
+
return pal[(idx % pal.length + pal.length) % pal.length];
|
|
53753
|
+
}
|
|
53754
|
+
function dispToMm(pt, ptPerFt) {
|
|
53755
|
+
const k = FT_TO_MM / ptPerFt;
|
|
53756
|
+
return [pt[0] * k, -pt[1] * k];
|
|
53757
|
+
}
|
|
53758
|
+
function contractToScene(contractInput) {
|
|
53759
|
+
const contract = contractInput ?? {};
|
|
53760
|
+
const elements = [];
|
|
53761
|
+
const skipped = [];
|
|
53762
|
+
const profileOrder = [];
|
|
53763
|
+
const seenProfile = /* @__PURE__ */ new Set();
|
|
53764
|
+
for (const plan of contract.plans ?? []) {
|
|
53765
|
+
const ptPerFt = plan.pt_per_ft && plan.pt_per_ft > 0 ? plan.pt_per_ft : 1;
|
|
53766
|
+
const defaultTosMm = (plan.default_tos ?? 0) * IN_TO_MM;
|
|
53767
|
+
for (const m of plan.members ?? []) {
|
|
53768
|
+
const dims = profileDims(m.profile);
|
|
53769
|
+
if (!dims || !Array.isArray(m.wp) || m.wp.length < 2) {
|
|
53770
|
+
skipped.push(m.id);
|
|
53771
|
+
continue;
|
|
53772
|
+
}
|
|
53773
|
+
const profile = (m.profile ?? "").trim().toUpperCase();
|
|
53774
|
+
if (!seenProfile.has(profile)) {
|
|
53775
|
+
seenProfile.add(profile);
|
|
53776
|
+
profileOrder.push(profile);
|
|
53777
|
+
}
|
|
53778
|
+
const [ax, ay] = dispToMm(m.wp[0], ptPerFt);
|
|
53779
|
+
const [bx, by] = dispToMm(m.wp[1], ptPerFt);
|
|
53780
|
+
let from;
|
|
53781
|
+
let to;
|
|
53782
|
+
if (m.role === "column") {
|
|
53783
|
+
const bos = m.col?.bos != null ? m.col.bos * IN_TO_MM : 0;
|
|
53784
|
+
const tos = m.col?.tos != null ? m.col.tos * IN_TO_MM : defaultTosMm;
|
|
53785
|
+
from = [ax, ay, bos];
|
|
53786
|
+
to = [ax, ay, tos];
|
|
53787
|
+
} else {
|
|
53788
|
+
const z0 = m.ends?.[0]?.tos != null ? m.ends[0].tos * IN_TO_MM : defaultTosMm;
|
|
53789
|
+
const z1 = m.ends?.[1]?.tos != null ? m.ends[1].tos * IN_TO_MM : defaultTosMm;
|
|
53790
|
+
from = [ax, ay, z0];
|
|
53791
|
+
to = [bx, by, z1];
|
|
53792
|
+
}
|
|
53793
|
+
elements.push({ id: m.id, group: profile, kind: "box", from, to, section: { w: dims.w, d: dims.d }, meta: { profile } });
|
|
53794
|
+
}
|
|
53795
|
+
}
|
|
53796
|
+
const groups = profileOrder.map((profile, i) => ({
|
|
53797
|
+
key: profile,
|
|
53798
|
+
label: profile,
|
|
53799
|
+
color: pickColor(profile, i, contract)
|
|
53800
|
+
}));
|
|
53801
|
+
return {
|
|
53802
|
+
scene: { meta: { name: contract.title || "Steel takeoff", units: "mm", up: "z" }, groups, elements },
|
|
53803
|
+
skipped
|
|
53804
|
+
};
|
|
53805
|
+
}
|
|
53806
|
+
|
|
53807
|
+
// scene-bake.ts
|
|
53808
|
+
var import_node_fs18 = require("node:fs");
|
|
53498
53809
|
var import_node_path15 = require("node:path");
|
|
53810
|
+
var import_yaml5 = __toESM(require_dist6(), 1);
|
|
53811
|
+
function bakeSceneIntoApp(sourcePath, scene, agent = "viewer-3d") {
|
|
53812
|
+
const doc2 = (0, import_yaml5.parseDocument)((0, import_node_fs18.readFileSync)(sourcePath, "utf8"));
|
|
53813
|
+
if (doc2.errors.length > 0) {
|
|
53814
|
+
throw new Error(`scene bake: source is not valid YAML: ${doc2.errors[0]?.message ?? "parse error"}`);
|
|
53815
|
+
}
|
|
53816
|
+
const seq = doc2.get("nodes");
|
|
53817
|
+
const items = (0, import_yaml5.isSeq)(seq) ? seq.items : [];
|
|
53818
|
+
const idx = items.findIndex((it) => ((0, import_yaml5.isMap)(it) ? it.toJSON() : null)?.agent === agent);
|
|
53819
|
+
if (idx < 0) throw new Error(`no ${agent} render node to bake the scene into`);
|
|
53820
|
+
doc2.setIn(["nodes", idx, "config", "scene"], scene);
|
|
53821
|
+
(0, import_node_fs18.writeFileSync)(sourcePath, doc2.toString());
|
|
53822
|
+
}
|
|
53823
|
+
function writeViewer3dApp(dir, appId, scene) {
|
|
53824
|
+
(0, import_node_fs18.mkdirSync)(dir, { recursive: true });
|
|
53825
|
+
const flo = (0, import_node_path15.join)(dir, `${appId}.flo`);
|
|
53826
|
+
(0, import_node_fs18.writeFileSync)(flo, [
|
|
53827
|
+
`app: ${appId}`,
|
|
53828
|
+
"version: 0.1.0",
|
|
53829
|
+
"display-name: Steel 3D",
|
|
53830
|
+
"description: 3D model rendered from an approved steel.takeoff/v1 contract (a companion view; the contract is the source of truth).",
|
|
53831
|
+
"exposes-as-agent: false",
|
|
53832
|
+
"requires:",
|
|
53833
|
+
" - viewer-3d@0.1.x",
|
|
53834
|
+
"layout: linear",
|
|
53835
|
+
"nodes:",
|
|
53836
|
+
" - id: view",
|
|
53837
|
+
" agent: viewer-3d",
|
|
53838
|
+
" command: render",
|
|
53839
|
+
" config:",
|
|
53840
|
+
" scene: {}",
|
|
53841
|
+
""
|
|
53842
|
+
].join("\n"));
|
|
53843
|
+
bakeSceneIntoApp(flo, scene);
|
|
53844
|
+
return flo;
|
|
53845
|
+
}
|
|
53846
|
+
|
|
53847
|
+
// app-lifecycle.ts
|
|
53848
|
+
var import_node_fs21 = require("node:fs");
|
|
53849
|
+
var import_node_os13 = require("node:os");
|
|
53850
|
+
var import_node_path18 = require("node:path");
|
|
53499
53851
|
|
|
53500
53852
|
// routines.ts
|
|
53501
|
-
var
|
|
53502
|
-
var
|
|
53853
|
+
var import_node_fs20 = require("node:fs");
|
|
53854
|
+
var import_node_path17 = require("node:path");
|
|
53503
53855
|
|
|
53504
53856
|
// sse.ts
|
|
53505
53857
|
var clients = /* @__PURE__ */ new Set();
|
|
@@ -53536,11 +53888,11 @@ function clientCount() {
|
|
|
53536
53888
|
}
|
|
53537
53889
|
|
|
53538
53890
|
// trigger-sessions.ts
|
|
53539
|
-
var
|
|
53540
|
-
var
|
|
53541
|
-
var
|
|
53542
|
-
var
|
|
53543
|
-
var AGENTS_DIR2 = process.env.AWARE_HOME ? (0,
|
|
53891
|
+
var import_node_fs19 = require("node:fs");
|
|
53892
|
+
var import_node_os12 = require("node:os");
|
|
53893
|
+
var import_node_path16 = require("node:path");
|
|
53894
|
+
var import_yaml6 = __toESM(require_dist6(), 1);
|
|
53895
|
+
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
53896
|
function summarizeFire(data) {
|
|
53545
53897
|
if (!data) return "event";
|
|
53546
53898
|
const type = typeof data.type === "string" ? data.type : "";
|
|
@@ -53557,10 +53909,10 @@ function mapTriggerState(phase) {
|
|
|
53557
53909
|
function isHostBacked(agent, agentsDir = AGENTS_DIR2) {
|
|
53558
53910
|
const safe = (n) => !n.includes("/") && !n.includes("\\") && !n.includes("..");
|
|
53559
53911
|
if (!safe(agent)) return false;
|
|
53560
|
-
const manifestPath = (0,
|
|
53561
|
-
if (!(0,
|
|
53912
|
+
const manifestPath = (0, import_node_path16.join)(agentsDir, agent, "manifest.yaml");
|
|
53913
|
+
if (!(0, import_node_fs19.existsSync)(manifestPath)) return false;
|
|
53562
53914
|
try {
|
|
53563
|
-
const doc2 = (0,
|
|
53915
|
+
const doc2 = (0, import_yaml6.parse)((0, import_node_fs19.readFileSync)(manifestPath, "utf8"));
|
|
53564
53916
|
const transport = doc2?.transport;
|
|
53565
53917
|
return !!(transport && typeof transport === "object" && "cli" in transport);
|
|
53566
53918
|
} catch {
|
|
@@ -53845,7 +54197,7 @@ var RoutineError = class extends Error {
|
|
|
53845
54197
|
}
|
|
53846
54198
|
status;
|
|
53847
54199
|
};
|
|
53848
|
-
var ROUTINES_FILE = (0,
|
|
54200
|
+
var ROUTINES_FILE = (0, import_node_path17.join)(flolessRoot, "routines.json");
|
|
53849
54201
|
var routines = [];
|
|
53850
54202
|
var loaded = false;
|
|
53851
54203
|
function ensureLoaded() {
|
|
@@ -53881,10 +54233,10 @@ function sanitizeRoutine(raw) {
|
|
|
53881
54233
|
};
|
|
53882
54234
|
}
|
|
53883
54235
|
function loadFromDisk() {
|
|
53884
|
-
if (!(0,
|
|
54236
|
+
if (!(0, import_node_fs20.existsSync)(ROUTINES_FILE)) return [];
|
|
53885
54237
|
let text;
|
|
53886
54238
|
try {
|
|
53887
|
-
text = (0,
|
|
54239
|
+
text = (0, import_node_fs20.readFileSync)(ROUTINES_FILE, "utf8");
|
|
53888
54240
|
} catch {
|
|
53889
54241
|
return [];
|
|
53890
54242
|
}
|
|
@@ -53893,17 +54245,17 @@ function loadFromDisk() {
|
|
|
53893
54245
|
return Array.isArray(parsed) ? parsed.map(sanitizeRoutine).filter((r) => r !== null) : [];
|
|
53894
54246
|
} catch {
|
|
53895
54247
|
try {
|
|
53896
|
-
(0,
|
|
54248
|
+
(0, import_node_fs20.renameSync)(ROUTINES_FILE, `${ROUTINES_FILE}.corrupt-${Date.now()}`);
|
|
53897
54249
|
} catch {
|
|
53898
54250
|
}
|
|
53899
54251
|
return [];
|
|
53900
54252
|
}
|
|
53901
54253
|
}
|
|
53902
54254
|
function saveRoutines() {
|
|
53903
|
-
if (!(0,
|
|
54255
|
+
if (!(0, import_node_fs20.existsSync)(flolessRoot)) (0, import_node_fs20.mkdirSync)(flolessRoot, { recursive: true });
|
|
53904
54256
|
const tmp = `${ROUTINES_FILE}.${process.pid}.tmp`;
|
|
53905
|
-
(0,
|
|
53906
|
-
(0,
|
|
54257
|
+
(0, import_node_fs20.writeFileSync)(tmp, JSON.stringify(routines, null, 2));
|
|
54258
|
+
(0, import_node_fs20.renameSync)(tmp, ROUTINES_FILE);
|
|
53907
54259
|
}
|
|
53908
54260
|
function listRoutines() {
|
|
53909
54261
|
ensureLoaded();
|
|
@@ -54311,13 +54663,13 @@ var AppLifecycleError = class extends Error {
|
|
|
54311
54663
|
}
|
|
54312
54664
|
};
|
|
54313
54665
|
function appsDir() {
|
|
54314
|
-
return process.env.AWARE_HOME ? (0,
|
|
54666
|
+
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
54667
|
}
|
|
54316
54668
|
function appDirPath(id) {
|
|
54317
|
-
return (0,
|
|
54669
|
+
return (0, import_node_path18.join)(appsDir(), id);
|
|
54318
54670
|
}
|
|
54319
54671
|
function appInstalled(id) {
|
|
54320
|
-
return APP_ID3.test(id) && (0,
|
|
54672
|
+
return APP_ID3.test(id) && (0, import_node_fs21.existsSync)(appDirPath(id));
|
|
54321
54673
|
}
|
|
54322
54674
|
function logCascade(what, e) {
|
|
54323
54675
|
console.error(`[app-lifecycle] cascade step failed (${what}):`, e instanceof Error ? e.message : e);
|
|
@@ -54410,14 +54762,17 @@ function isGatedAwareRoute(url, method) {
|
|
|
54410
54762
|
if (path.startsWith("/api/trigger-run/")) return false;
|
|
54411
54763
|
if (path === "/api/trigger-run") return m === "POST";
|
|
54412
54764
|
if (path.startsWith("/api/app/")) return m === "PATCH" || m === "POST" || m === "DELETE";
|
|
54765
|
+
if (path.startsWith("/api/contract/")) {
|
|
54766
|
+
return m === "POST" && (path.endsWith("/approve") || path.endsWith("/export-3d"));
|
|
54767
|
+
}
|
|
54413
54768
|
return AWARE_ROUTES.some((p) => path.startsWith(p));
|
|
54414
54769
|
}
|
|
54415
54770
|
|
|
54416
54771
|
// autostart.mjs
|
|
54417
54772
|
var import_node_child_process3 = require("node:child_process");
|
|
54418
|
-
var
|
|
54419
|
-
var
|
|
54420
|
-
var
|
|
54773
|
+
var import_node_fs22 = require("node:fs");
|
|
54774
|
+
var import_node_os14 = require("node:os");
|
|
54775
|
+
var import_node_path19 = require("node:path");
|
|
54421
54776
|
|
|
54422
54777
|
// teardown.mjs
|
|
54423
54778
|
var RUN_KEY = "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run";
|
|
@@ -54529,8 +54884,8 @@ function removeLegacyRunKey() {
|
|
|
54529
54884
|
}
|
|
54530
54885
|
function logLine(msg) {
|
|
54531
54886
|
try {
|
|
54532
|
-
(0,
|
|
54533
|
-
(0,
|
|
54887
|
+
(0, import_node_fs22.mkdirSync)(logDir(), { recursive: true });
|
|
54888
|
+
(0, import_node_fs22.appendFileSync)(logFilePath(), `${(/* @__PURE__ */ new Date()).toISOString()} ${msg}
|
|
54534
54889
|
`);
|
|
54535
54890
|
} catch {
|
|
54536
54891
|
}
|
|
@@ -54538,8 +54893,8 @@ function logLine(msg) {
|
|
|
54538
54893
|
function registerAutostart(exePath) {
|
|
54539
54894
|
if (!isWin) return;
|
|
54540
54895
|
const xml = buildAutostartTaskXml(exePath, currentUserId());
|
|
54541
|
-
const tmp = (0,
|
|
54542
|
-
(0,
|
|
54896
|
+
const tmp = (0, import_node_path19.join)((0, import_node_os14.tmpdir)(), `floless-autostart-${process.pid}-${Date.now()}.xml`);
|
|
54897
|
+
(0, import_node_fs22.writeFileSync)(tmp, "\uFEFF" + xml, { encoding: "utf16le" });
|
|
54543
54898
|
try {
|
|
54544
54899
|
(0, import_node_child_process3.execFileSync)("schtasks", ["/Create", "/TN", TASK_NAME, "/XML", tmp, "/F"], {
|
|
54545
54900
|
stdio: ["ignore", "ignore", "ignore"],
|
|
@@ -54550,7 +54905,7 @@ function registerAutostart(exePath) {
|
|
|
54550
54905
|
throw err;
|
|
54551
54906
|
} finally {
|
|
54552
54907
|
try {
|
|
54553
|
-
(0,
|
|
54908
|
+
(0, import_node_fs22.rmSync)(tmp, { force: true });
|
|
54554
54909
|
} catch {
|
|
54555
54910
|
}
|
|
54556
54911
|
}
|
|
@@ -54585,26 +54940,26 @@ function unregisterAutostart() {
|
|
|
54585
54940
|
// updater.ts
|
|
54586
54941
|
var import_node_child_process4 = require("node:child_process");
|
|
54587
54942
|
var import_node_crypto6 = require("node:crypto");
|
|
54588
|
-
var
|
|
54943
|
+
var import_node_fs24 = require("node:fs");
|
|
54589
54944
|
var import_node_stream = require("node:stream");
|
|
54590
54945
|
var import_promises = require("node:stream/promises");
|
|
54591
|
-
var
|
|
54946
|
+
var import_node_path21 = require("node:path");
|
|
54592
54947
|
|
|
54593
54948
|
// post-update-marker.mjs
|
|
54594
|
-
var
|
|
54595
|
-
var
|
|
54596
|
-
var
|
|
54949
|
+
var import_node_fs23 = require("node:fs");
|
|
54950
|
+
var import_node_os15 = require("node:os");
|
|
54951
|
+
var import_node_path20 = require("node:path");
|
|
54597
54952
|
var FRESH_MS = 12e4;
|
|
54598
54953
|
function markerPath() {
|
|
54599
54954
|
const override = (process.env.FLOLESS_POST_UPDATE_MARKER ?? "").trim();
|
|
54600
54955
|
if (override) return override;
|
|
54601
|
-
const root = process.env.FLOLESS_HOME ?? (0,
|
|
54602
|
-
return (0,
|
|
54956
|
+
const root = process.env.FLOLESS_HOME ?? (0, import_node_path20.join)((0, import_node_os15.homedir)(), ".floless");
|
|
54957
|
+
return (0, import_node_path20.join)(root, ".post-update");
|
|
54603
54958
|
}
|
|
54604
54959
|
function legacyMarkerPath() {
|
|
54605
54960
|
if ((process.env.FLOLESS_POST_UPDATE_MARKER ?? "").trim()) return null;
|
|
54606
54961
|
try {
|
|
54607
|
-
return (0,
|
|
54962
|
+
return (0, import_node_path20.join)((0, import_node_path20.dirname)((0, import_node_path20.dirname)(process.execPath)), ".floless-post-update");
|
|
54608
54963
|
} catch {
|
|
54609
54964
|
return null;
|
|
54610
54965
|
}
|
|
@@ -54614,7 +54969,7 @@ function writePostUpdateMarker() {
|
|
|
54614
54969
|
for (const p of [markerPath(), legacyMarkerPath()]) {
|
|
54615
54970
|
if (!p) continue;
|
|
54616
54971
|
try {
|
|
54617
|
-
(0,
|
|
54972
|
+
(0, import_node_fs23.writeFileSync)(p, (/* @__PURE__ */ new Date()).toISOString());
|
|
54618
54973
|
wrote = true;
|
|
54619
54974
|
} catch {
|
|
54620
54975
|
}
|
|
@@ -54626,9 +54981,9 @@ function consumePostUpdateMarker() {
|
|
|
54626
54981
|
for (const p of [markerPath(), legacyMarkerPath()]) {
|
|
54627
54982
|
if (!p) continue;
|
|
54628
54983
|
try {
|
|
54629
|
-
if (!(0,
|
|
54630
|
-
const ageMs = Date.now() - (0,
|
|
54631
|
-
(0,
|
|
54984
|
+
if (!(0, import_node_fs23.existsSync)(p)) continue;
|
|
54985
|
+
const ageMs = Date.now() - (0, import_node_fs23.statSync)(p).mtimeMs;
|
|
54986
|
+
(0, import_node_fs23.rmSync)(p, { force: true });
|
|
54632
54987
|
if (ageMs < FRESH_MS) fresh = true;
|
|
54633
54988
|
} catch {
|
|
54634
54989
|
}
|
|
@@ -54645,13 +55000,13 @@ function currentVersion() {
|
|
|
54645
55000
|
return appVersion();
|
|
54646
55001
|
}
|
|
54647
55002
|
function installRoot() {
|
|
54648
|
-
return (0,
|
|
55003
|
+
return (0, import_node_path21.dirname)((0, import_node_path21.dirname)(process.execPath));
|
|
54649
55004
|
}
|
|
54650
55005
|
function updateExePath() {
|
|
54651
|
-
return (0,
|
|
55006
|
+
return (0, import_node_path21.join)(installRoot(), "Update.exe");
|
|
54652
55007
|
}
|
|
54653
55008
|
function packagesDir() {
|
|
54654
|
-
return (0,
|
|
55009
|
+
return (0, import_node_path21.join)(installRoot(), "packages");
|
|
54655
55010
|
}
|
|
54656
55011
|
function feedUrl() {
|
|
54657
55012
|
const env2 = (process.env.FLOLESS_UPDATE_URL ?? "").trim().replace(/\/+$/, "");
|
|
@@ -54744,22 +55099,22 @@ async function checkForUpdate() {
|
|
|
54744
55099
|
}
|
|
54745
55100
|
async function sha1OfFile(path) {
|
|
54746
55101
|
const hash = (0, import_node_crypto6.createHash)("sha1");
|
|
54747
|
-
await (0, import_promises.pipeline)((0,
|
|
55102
|
+
await (0, import_promises.pipeline)((0, import_node_fs24.createReadStream)(path), hash);
|
|
54748
55103
|
return hash.digest("hex").toUpperCase();
|
|
54749
55104
|
}
|
|
54750
55105
|
async function downloadPackage(asset) {
|
|
54751
55106
|
if (!NUPKG_NAME.test(asset.FileName)) throw new Error(`refusing suspicious package name: ${asset.FileName}`);
|
|
54752
55107
|
const want = asset.SHA1.toUpperCase();
|
|
54753
55108
|
const dir = packagesDir();
|
|
54754
|
-
(0,
|
|
54755
|
-
const dest = (0,
|
|
54756
|
-
if ((0,
|
|
55109
|
+
(0, import_node_fs24.mkdirSync)(dir, { recursive: true });
|
|
55110
|
+
const dest = (0, import_node_path21.join)(dir, asset.FileName);
|
|
55111
|
+
if ((0, import_node_fs24.existsSync)(dest) && await sha1OfFile(dest) === want) return dest;
|
|
54757
55112
|
const res = await authedFetch(`${feedUrl()}/${encodeURIComponent(asset.FileName)}`, {
|
|
54758
55113
|
redirect: "follow",
|
|
54759
55114
|
signal: AbortSignal.timeout(DOWNLOAD_TIMEOUT_MS)
|
|
54760
55115
|
});
|
|
54761
55116
|
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,
|
|
55117
|
+
await (0, import_promises.pipeline)(import_node_stream.Readable.fromWeb(res.body), (0, import_node_fs24.createWriteStream)(dest));
|
|
54763
55118
|
const got = await sha1OfFile(dest);
|
|
54764
55119
|
if (got !== want) throw new Error(`SHA1 mismatch for ${asset.FileName}: feed=${want} got=${got}`);
|
|
54765
55120
|
return dest;
|
|
@@ -54768,7 +55123,7 @@ async function applyUpdate(check, opts) {
|
|
|
54768
55123
|
if (!check.supported) return { applied: false, message: check.reason ?? "auto-update not supported in this runtime" };
|
|
54769
55124
|
if (!check.updateAvailable || !check.asset) return { applied: false, message: check.reason ?? "no update available" };
|
|
54770
55125
|
const exe = updateExePath();
|
|
54771
|
-
if (!(0,
|
|
55126
|
+
if (!(0, import_node_fs24.existsSync)(exe)) {
|
|
54772
55127
|
return { applied: false, message: `Update.exe not found at ${exe} \u2014 is this a Velopack install?` };
|
|
54773
55128
|
}
|
|
54774
55129
|
const pkg = await downloadPackage(check.asset);
|
|
@@ -55008,12 +55363,12 @@ function isTraceCorrupt(events) {
|
|
|
55008
55363
|
|
|
55009
55364
|
// launch.mjs
|
|
55010
55365
|
var import_node_child_process5 = require("node:child_process");
|
|
55011
|
-
var
|
|
55012
|
-
var
|
|
55013
|
-
var
|
|
55366
|
+
var import_node_path22 = require("node:path");
|
|
55367
|
+
var import_node_url2 = require("node:url");
|
|
55368
|
+
var import_node_fs25 = require("node:fs");
|
|
55014
55369
|
var import_node_http = __toESM(require("node:http"), 1);
|
|
55015
55370
|
var import_node_readline = require("node:readline");
|
|
55016
|
-
var __dirname2 = (0,
|
|
55371
|
+
var __dirname2 = (0, import_node_path22.dirname)((0, import_node_url2.fileURLToPath)(__import_meta_url));
|
|
55017
55372
|
var PORT = Number(process.env.PORT ?? 4317);
|
|
55018
55373
|
var HEALTH_URL = `http://127.0.0.1:${PORT}/api/health`;
|
|
55019
55374
|
var BROWSER_URL = `http://floless.localhost:${PORT}`;
|
|
@@ -55085,8 +55440,8 @@ async function waitHealthy(timeoutMs = 3e4) {
|
|
|
55085
55440
|
function resolveServerStart() {
|
|
55086
55441
|
const packaged = /flolessapp\.exe$/i.test(process.execPath);
|
|
55087
55442
|
if (packaged) return { cmd: process.execPath, args: ["--serve"], shell: false };
|
|
55088
|
-
const bundle = (0,
|
|
55089
|
-
if ((0,
|
|
55443
|
+
const bundle = (0, import_node_path22.join)(__dirname2, "dist", "floless-server.cjs");
|
|
55444
|
+
if ((0, import_node_fs25.existsSync)(bundle)) return { cmd: process.execPath, args: [bundle, "--serve"], shell: false };
|
|
55090
55445
|
return { cmd: "npm", args: ["run", "start"], shell: isWin2 };
|
|
55091
55446
|
}
|
|
55092
55447
|
function startServerDetached() {
|
|
@@ -55239,8 +55594,8 @@ function taskkillArgs(pid, { tree = true } = {}) {
|
|
|
55239
55594
|
}
|
|
55240
55595
|
function killSupervisor({ tree = true } = {}) {
|
|
55241
55596
|
if (!isWin2) return;
|
|
55242
|
-
const isNpmChannel = /^node(\.exe)?$/i.test((0,
|
|
55243
|
-
const scriptMatch = isNpmChannel ? (0,
|
|
55597
|
+
const isNpmChannel = /^node(\.exe)?$/i.test((0, import_node_path22.basename)(process.execPath));
|
|
55598
|
+
const scriptMatch = isNpmChannel ? (0, import_node_path22.basename)((0, import_node_url2.fileURLToPath)(__import_meta_url)) : void 0;
|
|
55244
55599
|
const realExe = resolveRealInstallExe(process.execPath);
|
|
55245
55600
|
const exeMatch = realExe === process.execPath ? process.execPath : [process.execPath, realExe];
|
|
55246
55601
|
const pids = supervisorPidsToKill(enumerateProcesses(), process.pid, exeMatch, scriptMatch);
|
|
@@ -55405,7 +55760,7 @@ async function runAction(arg, flagArgv = [], selfVersion = null) {
|
|
|
55405
55760
|
}
|
|
55406
55761
|
await action(parseTeardownFlags(flagArgv));
|
|
55407
55762
|
}
|
|
55408
|
-
var entry = (0,
|
|
55763
|
+
var entry = (0, import_node_path22.basename)(process.argv[1] ?? "").toLowerCase();
|
|
55409
55764
|
if (entry === "launch.mjs") {
|
|
55410
55765
|
runAction(process.argv[2], process.argv.slice(3)).catch((e) => {
|
|
55411
55766
|
log(`error: ${e?.message ?? e}`);
|
|
@@ -55479,11 +55834,11 @@ function awareUpgradeBlockReason(s) {
|
|
|
55479
55834
|
}
|
|
55480
55835
|
|
|
55481
55836
|
// skill-sync.ts
|
|
55482
|
-
var
|
|
55483
|
-
var
|
|
55484
|
-
var
|
|
55485
|
-
var
|
|
55486
|
-
var
|
|
55837
|
+
var import_node_fs26 = require("node:fs");
|
|
55838
|
+
var import_node_os16 = require("node:os");
|
|
55839
|
+
var import_node_path23 = require("node:path");
|
|
55840
|
+
var import_node_url3 = require("node:url");
|
|
55841
|
+
var import_yaml7 = __toESM(require_dist6(), 1);
|
|
55487
55842
|
|
|
55488
55843
|
// build/ship-skills.mjs
|
|
55489
55844
|
var PRODUCT_SKILLS = [
|
|
@@ -55499,6 +55854,8 @@ var PRODUCT_SKILLS = [
|
|
|
55499
55854
|
// author event-driven ("on trigger") routines
|
|
55500
55855
|
"floless-app-steel-from-drawings",
|
|
55501
55856
|
// read a steel drawing into an interactive 3D model (bake the viewer-3d scene)
|
|
55857
|
+
"floless-app-tweak-contract",
|
|
55858
|
+
// handle a tweak-contract request from the steel-takeoff contract editor (Slice 2 AI round-trip)
|
|
55502
55859
|
"floless-app-ui",
|
|
55503
55860
|
// compose Custom Panels (~/.floless/ui/extensions.json) for the Dashboard
|
|
55504
55861
|
"floless-app-workflows"
|
|
@@ -55510,33 +55867,33 @@ function selectShippedSkillNames(names) {
|
|
|
55510
55867
|
}
|
|
55511
55868
|
|
|
55512
55869
|
// skill-sync.ts
|
|
55513
|
-
var __dirname3 = (0,
|
|
55870
|
+
var __dirname3 = (0, import_node_path23.dirname)((0, import_node_url3.fileURLToPath)(__import_meta_url));
|
|
55514
55871
|
function bundledSkillsRoot() {
|
|
55515
55872
|
const candidates = [
|
|
55516
|
-
(0,
|
|
55517
|
-
(0,
|
|
55518
|
-
(0,
|
|
55873
|
+
(0, import_node_path23.join)(__dirname3, "skills"),
|
|
55874
|
+
(0, import_node_path23.join)((0, import_node_path23.dirname)(process.execPath), "skills"),
|
|
55875
|
+
(0, import_node_path23.join)(__dirname3, "..", ".claude", "skills")
|
|
55519
55876
|
];
|
|
55520
|
-
return candidates.find((p) => (0,
|
|
55877
|
+
return candidates.find((p) => (0, import_node_fs26.existsSync)(p)) ?? null;
|
|
55521
55878
|
}
|
|
55522
55879
|
function targetConfigDirs() {
|
|
55523
55880
|
const override = process.env.FLOLESS_SKILL_TARGETS;
|
|
55524
55881
|
if (override) {
|
|
55525
55882
|
return override.split(";").map((d) => d.trim()).filter(Boolean).map((dir) => ({ runtime: "custom", dir }));
|
|
55526
55883
|
}
|
|
55527
|
-
const home = (0,
|
|
55884
|
+
const home = (0, import_node_os16.homedir)();
|
|
55528
55885
|
return [
|
|
55529
|
-
{ runtime: "claude", dir: (0,
|
|
55530
|
-
{ runtime: "codex", dir: (0,
|
|
55531
|
-
{ runtime: "opencode", dir: (0,
|
|
55886
|
+
{ runtime: "claude", dir: (0, import_node_path23.join)(home, ".claude") },
|
|
55887
|
+
{ runtime: "codex", dir: (0, import_node_path23.join)(home, ".codex") },
|
|
55888
|
+
{ runtime: "opencode", dir: (0, import_node_path23.join)(home, ".opencode") }
|
|
55532
55889
|
];
|
|
55533
55890
|
}
|
|
55534
55891
|
function skillVersion(skillMdPath) {
|
|
55535
55892
|
try {
|
|
55536
|
-
const text = (0,
|
|
55893
|
+
const text = (0, import_node_fs26.readFileSync)(skillMdPath, "utf8");
|
|
55537
55894
|
const m = /^---\r?\n([\s\S]*?)\r?\n---/.exec(text);
|
|
55538
55895
|
if (!m || m[1] === void 0) return null;
|
|
55539
|
-
const fm = (0,
|
|
55896
|
+
const fm = (0, import_yaml7.parse)(m[1]);
|
|
55540
55897
|
const meta = fm?.metadata;
|
|
55541
55898
|
const v = meta?.version;
|
|
55542
55899
|
return typeof v === "string" || typeof v === "number" ? String(v) : null;
|
|
@@ -55573,21 +55930,21 @@ function decideAction(installed, bundled) {
|
|
|
55573
55930
|
function bundledSkills(root) {
|
|
55574
55931
|
let entries = [];
|
|
55575
55932
|
try {
|
|
55576
|
-
entries = selectShippedSkillNames((0,
|
|
55933
|
+
entries = selectShippedSkillNames((0, import_node_fs26.readdirSync)(root));
|
|
55577
55934
|
} catch {
|
|
55578
55935
|
return [];
|
|
55579
55936
|
}
|
|
55580
55937
|
const out = [];
|
|
55581
55938
|
for (const name of entries) {
|
|
55582
|
-
const dir = (0,
|
|
55939
|
+
const dir = (0, import_node_path23.join)(root, name);
|
|
55583
55940
|
let isDir = false;
|
|
55584
55941
|
try {
|
|
55585
|
-
isDir = (0,
|
|
55942
|
+
isDir = (0, import_node_fs26.statSync)(dir).isDirectory();
|
|
55586
55943
|
} catch {
|
|
55587
55944
|
isDir = false;
|
|
55588
55945
|
}
|
|
55589
55946
|
if (!isDir) continue;
|
|
55590
|
-
const v = skillVersion((0,
|
|
55947
|
+
const v = skillVersion((0, import_node_path23.join)(dir, "SKILL.md"));
|
|
55591
55948
|
if (!v) continue;
|
|
55592
55949
|
out.push({ name, dir, version: v });
|
|
55593
55950
|
}
|
|
@@ -55600,17 +55957,17 @@ function syncSkills() {
|
|
|
55600
55957
|
const skills = bundledSkills(root);
|
|
55601
55958
|
if (!skills.length) return results;
|
|
55602
55959
|
for (const { runtime, dir: cfg } of targetConfigDirs()) {
|
|
55603
|
-
if (!(0,
|
|
55604
|
-
const skillsDir = (0,
|
|
55960
|
+
if (!(0, import_node_fs26.existsSync)(cfg)) continue;
|
|
55961
|
+
const skillsDir = (0, import_node_path23.join)(cfg, "skills");
|
|
55605
55962
|
for (const s of skills) {
|
|
55606
|
-
const dest = (0,
|
|
55607
|
-
const installedMd = (0,
|
|
55608
|
-
const installed = (0,
|
|
55963
|
+
const dest = (0, import_node_path23.join)(skillsDir, s.name);
|
|
55964
|
+
const installedMd = (0, import_node_path23.join)(dest, "SKILL.md");
|
|
55965
|
+
const installed = (0, import_node_fs26.existsSync)(installedMd) ? skillVersion(installedMd) : null;
|
|
55609
55966
|
const action = decideAction(installed, s.version);
|
|
55610
55967
|
if (action === "installed" || action === "updated") {
|
|
55611
55968
|
try {
|
|
55612
|
-
if (action === "updated") (0,
|
|
55613
|
-
(0,
|
|
55969
|
+
if (action === "updated") (0, import_node_fs26.rmSync)(dest, { recursive: true, force: true });
|
|
55970
|
+
(0, import_node_fs26.cpSync)(s.dir, dest, { recursive: true });
|
|
55614
55971
|
results.push({ runtime, skill: s.name, action, from: installed, to: s.version });
|
|
55615
55972
|
} catch {
|
|
55616
55973
|
}
|
|
@@ -55623,9 +55980,9 @@ function syncSkills() {
|
|
|
55623
55980
|
}
|
|
55624
55981
|
|
|
55625
55982
|
// watch.ts
|
|
55626
|
-
var
|
|
55627
|
-
var
|
|
55628
|
-
var
|
|
55983
|
+
var import_node_os17 = require("node:os");
|
|
55984
|
+
var import_node_path25 = require("node:path");
|
|
55985
|
+
var import_node_fs27 = require("node:fs");
|
|
55629
55986
|
|
|
55630
55987
|
// node_modules/chokidar/esm/index.js
|
|
55631
55988
|
var import_fs2 = require("fs");
|
|
@@ -55636,7 +55993,7 @@ var sysPath2 = __toESM(require("path"), 1);
|
|
|
55636
55993
|
// node_modules/readdirp/esm/index.js
|
|
55637
55994
|
var import_promises2 = require("node:fs/promises");
|
|
55638
55995
|
var import_node_stream2 = require("node:stream");
|
|
55639
|
-
var
|
|
55996
|
+
var import_node_path24 = require("node:path");
|
|
55640
55997
|
var EntryTypes = {
|
|
55641
55998
|
FILE_TYPE: "files",
|
|
55642
55999
|
DIR_TYPE: "directories",
|
|
@@ -55711,7 +56068,7 @@ var ReaddirpStream = class extends import_node_stream2.Readable {
|
|
|
55711
56068
|
this._wantsDir = type ? DIR_TYPES.has(type) : false;
|
|
55712
56069
|
this._wantsFile = type ? FILE_TYPES.has(type) : false;
|
|
55713
56070
|
this._wantsEverything = type === EntryTypes.EVERYTHING_TYPE;
|
|
55714
|
-
this._root = (0,
|
|
56071
|
+
this._root = (0, import_node_path24.resolve)(root);
|
|
55715
56072
|
this._isDirent = !opts.alwaysStat;
|
|
55716
56073
|
this._statsProp = this._isDirent ? "dirent" : "stats";
|
|
55717
56074
|
this._rdOptions = { encoding: "utf8", withFileTypes: this._isDirent };
|
|
@@ -55782,8 +56139,8 @@ var ReaddirpStream = class extends import_node_stream2.Readable {
|
|
|
55782
56139
|
let entry2;
|
|
55783
56140
|
const basename5 = this._isDirent ? dirent.name : dirent;
|
|
55784
56141
|
try {
|
|
55785
|
-
const fullPath = (0,
|
|
55786
|
-
entry2 = { path: (0,
|
|
56142
|
+
const fullPath = (0, import_node_path24.resolve)((0, import_node_path24.join)(path, basename5));
|
|
56143
|
+
entry2 = { path: (0, import_node_path24.relative)(this._root, fullPath), fullPath, basename: basename5 };
|
|
55787
56144
|
entry2[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
|
|
55788
56145
|
} catch (err) {
|
|
55789
56146
|
this._onError(err);
|
|
@@ -55817,7 +56174,7 @@ var ReaddirpStream = class extends import_node_stream2.Readable {
|
|
|
55817
56174
|
}
|
|
55818
56175
|
if (entryRealPathStats.isDirectory()) {
|
|
55819
56176
|
const len = entryRealPath.length;
|
|
55820
|
-
if (full.startsWith(entryRealPath) && full.substr(len, 1) ===
|
|
56177
|
+
if (full.startsWith(entryRealPath) && full.substr(len, 1) === import_node_path24.sep) {
|
|
55821
56178
|
const recursiveError = new Error(`Circular symlink detected: "${full}" points to "${entryRealPath}"`);
|
|
55822
56179
|
recursiveError.code = RECURSIVE_ERROR_CODE;
|
|
55823
56180
|
return this._onError(recursiveError);
|
|
@@ -56356,9 +56713,9 @@ var NodeFsHandler = class {
|
|
|
56356
56713
|
if (this.fsw.closed) {
|
|
56357
56714
|
return;
|
|
56358
56715
|
}
|
|
56359
|
-
const
|
|
56716
|
+
const dirname11 = sysPath.dirname(file);
|
|
56360
56717
|
const basename5 = sysPath.basename(file);
|
|
56361
|
-
const parent = this.fsw._getWatchedDir(
|
|
56718
|
+
const parent = this.fsw._getWatchedDir(dirname11);
|
|
56362
56719
|
let prevStats = stats;
|
|
56363
56720
|
if (parent.has(basename5))
|
|
56364
56721
|
return;
|
|
@@ -56385,7 +56742,7 @@ var NodeFsHandler = class {
|
|
|
56385
56742
|
prevStats = newStats2;
|
|
56386
56743
|
}
|
|
56387
56744
|
} catch (error) {
|
|
56388
|
-
this.fsw._remove(
|
|
56745
|
+
this.fsw._remove(dirname11, basename5);
|
|
56389
56746
|
}
|
|
56390
56747
|
} else if (parent.has(basename5)) {
|
|
56391
56748
|
const at = newStats.atimeMs;
|
|
@@ -57325,33 +57682,33 @@ function appIdFromLogPath(path) {
|
|
|
57325
57682
|
return i >= 0 && parts[i + 1] ? parts[i + 1] : null;
|
|
57326
57683
|
}
|
|
57327
57684
|
function samePath(a, b) {
|
|
57328
|
-
const ra = (0,
|
|
57329
|
-
const rb = (0,
|
|
57685
|
+
const ra = (0, import_node_path25.resolve)(a);
|
|
57686
|
+
const rb = (0, import_node_path25.resolve)(b);
|
|
57330
57687
|
return process.platform === "win32" ? ra.toLowerCase() === rb.toLowerCase() : ra === rb;
|
|
57331
57688
|
}
|
|
57332
57689
|
function underDir(path, dir) {
|
|
57333
|
-
const rp = (0,
|
|
57334
|
-
const rd = (0,
|
|
57690
|
+
const rp = (0, import_node_path25.resolve)(path);
|
|
57691
|
+
const rd = (0, import_node_path25.resolve)(dir);
|
|
57335
57692
|
const [p, d] = process.platform === "win32" ? [rp.toLowerCase(), rd.toLowerCase()] : [rp, rd];
|
|
57336
|
-
return p === d || p.startsWith(d +
|
|
57693
|
+
return p === d || p.startsWith(d + import_node_path25.sep);
|
|
57337
57694
|
}
|
|
57338
57695
|
function startWatcher() {
|
|
57339
|
-
const awareDir = process.env.AWARE_HOME ?? (0,
|
|
57340
|
-
const credentialsDir = (0,
|
|
57341
|
-
if (!(0,
|
|
57696
|
+
const awareDir = process.env.AWARE_HOME ?? (0, import_node_path25.join)((0, import_node_os17.homedir)(), ".aware");
|
|
57697
|
+
const credentialsDir = (0, import_node_path25.join)(awareDir, "credentials");
|
|
57698
|
+
if (!(0, import_node_fs27.existsSync)(credentialsDir)) {
|
|
57342
57699
|
try {
|
|
57343
|
-
(0,
|
|
57700
|
+
(0, import_node_fs27.mkdirSync)(credentialsDir, { recursive: true });
|
|
57344
57701
|
} catch {
|
|
57345
57702
|
}
|
|
57346
57703
|
}
|
|
57347
|
-
if (!(0,
|
|
57704
|
+
if (!(0, import_node_fs27.existsSync)(uiDir)) {
|
|
57348
57705
|
try {
|
|
57349
|
-
(0,
|
|
57706
|
+
(0, import_node_fs27.mkdirSync)(uiDir, { recursive: true });
|
|
57350
57707
|
} catch {
|
|
57351
57708
|
}
|
|
57352
57709
|
}
|
|
57353
|
-
const targets = ["apps", "logs", "credentials"].map((d) => (0,
|
|
57354
|
-
if ((0,
|
|
57710
|
+
const targets = ["apps", "logs", "credentials"].map((d) => (0, import_node_path25.join)(awareDir, d)).filter((p) => (0, import_node_fs27.existsSync)(p));
|
|
57711
|
+
if ((0, import_node_fs27.existsSync)(uiDir)) targets.push(uiDir);
|
|
57355
57712
|
if (targets.length === 0) {
|
|
57356
57713
|
return null;
|
|
57357
57714
|
}
|
|
@@ -57380,11 +57737,11 @@ function startWatcher() {
|
|
|
57380
57737
|
const isCredential = path.split(/[\\/]/).includes("credentials");
|
|
57381
57738
|
const kind = isCredential ? "credential" : path.endsWith(".jsonl") ? "trace" : path.endsWith(".lock") ? "lock" : path.endsWith(".flo") || path.endsWith(".app") ? "source" : "file";
|
|
57382
57739
|
broadcast({ type: "fs-change", kind, event, path });
|
|
57383
|
-
if (kind === "trace" && event !== "unlink" && (0,
|
|
57740
|
+
if (kind === "trace" && event !== "unlink" && (0, import_node_fs27.existsSync)(path)) {
|
|
57384
57741
|
const id = appIdFromLogPath(path);
|
|
57385
57742
|
if (!id) return;
|
|
57386
57743
|
try {
|
|
57387
|
-
broadcast({ type: "trace-file", id, runId: path.split(
|
|
57744
|
+
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
57745
|
} catch {
|
|
57389
57746
|
}
|
|
57390
57747
|
}
|
|
@@ -57393,10 +57750,10 @@ function startWatcher() {
|
|
|
57393
57750
|
}
|
|
57394
57751
|
|
|
57395
57752
|
// index.ts
|
|
57396
|
-
var __dirname4 = (0,
|
|
57397
|
-
var WEB_ROOT = [(0,
|
|
57398
|
-
(p) => (0,
|
|
57399
|
-
) ?? (0,
|
|
57753
|
+
var __dirname4 = (0, import_node_path26.dirname)((0, import_node_url4.fileURLToPath)(__import_meta_url));
|
|
57754
|
+
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(
|
|
57755
|
+
(p) => (0, import_node_fs28.existsSync)(p)
|
|
57756
|
+
) ?? (0, import_node_path26.join)(__dirname4, "..", "web");
|
|
57400
57757
|
var PORT2 = Number(process.env.PORT ?? 4317);
|
|
57401
57758
|
var HOST = "127.0.0.1";
|
|
57402
57759
|
var crashHandlersInstalled = false;
|
|
@@ -57412,7 +57769,7 @@ function installCrashHandlers() {
|
|
|
57412
57769
|
${stack}
|
|
57413
57770
|
`;
|
|
57414
57771
|
try {
|
|
57415
|
-
(0,
|
|
57772
|
+
(0, import_node_fs28.appendFileSync)(logFilePath(), line);
|
|
57416
57773
|
} catch {
|
|
57417
57774
|
}
|
|
57418
57775
|
if (process.stderr.isTTY) process.stderr.write(line);
|
|
@@ -57492,6 +57849,9 @@ async function startServer() {
|
|
|
57492
57849
|
if (err instanceof AppNotFoundError) {
|
|
57493
57850
|
return reply.status(404).send({ ok: false, error: err.message });
|
|
57494
57851
|
}
|
|
57852
|
+
if (err instanceof ContractError) {
|
|
57853
|
+
return reply.status(400).send({ ok: false, error: err.message });
|
|
57854
|
+
}
|
|
57495
57855
|
if (err instanceof RoutineError) {
|
|
57496
57856
|
return reply.status(err.status).send({ ok: false, error: err.message });
|
|
57497
57857
|
}
|
|
@@ -57786,6 +58146,95 @@ async function startServer() {
|
|
|
57786
58146
|
app.get("/api/app/:id", async (req) => {
|
|
57787
58147
|
return { ok: true, app: readApp(req.params.id) };
|
|
57788
58148
|
});
|
|
58149
|
+
app.get("/api/contract/:appId", async (req, reply) => {
|
|
58150
|
+
const doc2 = readContract(req.params.appId);
|
|
58151
|
+
if (doc2 == null) return reply.status(404).send({ ok: false, error: "no contract for this app yet" });
|
|
58152
|
+
return doc2;
|
|
58153
|
+
});
|
|
58154
|
+
app.put(
|
|
58155
|
+
"/api/contract/:appId",
|
|
58156
|
+
{ bodyLimit: 25 * 1024 * 1024 },
|
|
58157
|
+
// contracts embed rasters
|
|
58158
|
+
async (req, reply) => {
|
|
58159
|
+
try {
|
|
58160
|
+
writeContract(req.params.appId, req.body);
|
|
58161
|
+
} catch (e) {
|
|
58162
|
+
if (e instanceof ContractError) return reply.status(400).send({ ok: false, error: e.message });
|
|
58163
|
+
throw e;
|
|
58164
|
+
}
|
|
58165
|
+
broadcast({ type: "contract-changed", appId: req.params.appId });
|
|
58166
|
+
return { ok: true };
|
|
58167
|
+
}
|
|
58168
|
+
);
|
|
58169
|
+
app.post("/api/contract/:appId/approve", async (req, reply) => {
|
|
58170
|
+
const doc2 = readContract(req.params.appId);
|
|
58171
|
+
if (doc2 == null) return reply.status(404).send({ ok: false, error: "no contract to approve" });
|
|
58172
|
+
const v = validateSteelTakeoff(doc2);
|
|
58173
|
+
if (!v.valid) return reply.status(400).send({ ok: false, error: "stored contract is invalid \u2014 re-save it in the editor" });
|
|
58174
|
+
const sourcePath = readApp(req.params.appId).source.path;
|
|
58175
|
+
try {
|
|
58176
|
+
bakeContractIntoApp(sourcePath, doc2);
|
|
58177
|
+
} catch (e) {
|
|
58178
|
+
return reply.status(422).send({ ok: false, error: e instanceof Error ? e.message : "bake failed" });
|
|
58179
|
+
}
|
|
58180
|
+
let result;
|
|
58181
|
+
try {
|
|
58182
|
+
result = await aware.compile(sourcePath);
|
|
58183
|
+
} catch (e) {
|
|
58184
|
+
return reply.status(422).send({
|
|
58185
|
+
ok: false,
|
|
58186
|
+
error: `contract was baked but compile failed \u2014 fix the workflow and Approve again: ${e instanceof Error ? e.message : "compile error"}`
|
|
58187
|
+
});
|
|
58188
|
+
}
|
|
58189
|
+
broadcast({ type: "compiled", id: req.params.appId, lockPath: result.lockPath });
|
|
58190
|
+
return { ok: true, result };
|
|
58191
|
+
});
|
|
58192
|
+
function awareStderr(e) {
|
|
58193
|
+
if (e instanceof AwareError && e.detail && typeof e.detail === "object") {
|
|
58194
|
+
const s = e.detail.stderr;
|
|
58195
|
+
return typeof s === "string" && s.trim() ? s.trim() : null;
|
|
58196
|
+
}
|
|
58197
|
+
return null;
|
|
58198
|
+
}
|
|
58199
|
+
app.post("/api/contract/:appId/export-3d", async (req, reply) => {
|
|
58200
|
+
const doc2 = readContract(req.params.appId);
|
|
58201
|
+
if (doc2 == null) return reply.status(404).send({ ok: false, error: "no contract to export" });
|
|
58202
|
+
const v = validateSteelTakeoff(doc2);
|
|
58203
|
+
if (!v.valid) return reply.status(400).send({ ok: false, error: "stored contract is invalid \u2014 re-save it in the editor" });
|
|
58204
|
+
const { scene, skipped } = contractToScene(doc2);
|
|
58205
|
+
if (scene.elements.length === 0) {
|
|
58206
|
+
return reply.status(422).send({ ok: false, error: "no resolvable members to render \u2014 every member is an RFI (no AISC size yet)", skipped });
|
|
58207
|
+
}
|
|
58208
|
+
const companionId = `${req.params.appId}-3d`;
|
|
58209
|
+
let flo;
|
|
58210
|
+
try {
|
|
58211
|
+
flo = writeViewer3dApp(appPath(companionId), companionId, scene);
|
|
58212
|
+
} catch (e) {
|
|
58213
|
+
app.log.error({ companionId, err: e instanceof Error ? e.message : e }, "export-3d: companion app write failed");
|
|
58214
|
+
return reply.status(500).send({ ok: false, error: `could not write the 3D companion app: ${e instanceof Error ? e.message : "write error"}` });
|
|
58215
|
+
}
|
|
58216
|
+
try {
|
|
58217
|
+
await aware.compile(flo);
|
|
58218
|
+
} catch (e) {
|
|
58219
|
+
app.log.warn({ companionId, detail: e instanceof AwareError ? e.detail : void 0 }, "3D compile failed");
|
|
58220
|
+
return reply.status(422).send({ ok: false, error: `3D compile failed: ${e instanceof Error ? e.message : "compile error"}`, reason: awareStderr(e) });
|
|
58221
|
+
}
|
|
58222
|
+
let result;
|
|
58223
|
+
try {
|
|
58224
|
+
result = await aware.run(companionId, {});
|
|
58225
|
+
} catch (e) {
|
|
58226
|
+
if (e instanceof AwareError) {
|
|
58227
|
+
app.log.warn({ companionId, detail: e.detail }, "3D render failed");
|
|
58228
|
+
return reply.send({ ok: false, error: e.message, reason: awareStderr(e) });
|
|
58229
|
+
}
|
|
58230
|
+
throw e;
|
|
58231
|
+
}
|
|
58232
|
+
const events = result.traceText ? parseTrace(result.traceText) : [];
|
|
58233
|
+
const extracted = extractReportHtml(events, companionId);
|
|
58234
|
+
if (!extracted) return reply.send({ ok: false, error: "the 3D render produced no html" });
|
|
58235
|
+
broadcast({ type: "apps-changed" });
|
|
58236
|
+
return { ok: true, report: { ...extracted, interactive: true }, skipped };
|
|
58237
|
+
});
|
|
57789
58238
|
async function stopForegroundSession(id) {
|
|
57790
58239
|
try {
|
|
57791
58240
|
const sid = foregroundSessionId(id);
|
|
@@ -57815,6 +58264,42 @@ async function startServer() {
|
|
|
57815
58264
|
broadcast({ type: "apps-changed", id: req.params.id });
|
|
57816
58265
|
return { ok: true };
|
|
57817
58266
|
});
|
|
58267
|
+
app.post("/api/app/:id/freeze", async (req, reply) => {
|
|
58268
|
+
const nodeId = typeof req.body?.nodeId === "string" ? req.body.nodeId.trim() : "";
|
|
58269
|
+
if (!nodeId) return reply.status(400).send({ ok: false, error: "nodeId required" });
|
|
58270
|
+
try {
|
|
58271
|
+
await aware.freeze(req.params.id, nodeId);
|
|
58272
|
+
} catch (e) {
|
|
58273
|
+
if (e instanceof AwareUnsupportedError) {
|
|
58274
|
+
return reply.status(422).send({ ok: false, error: "Freezing needs AWARE 0.77 or newer \u2014 update AWARE from the footer." });
|
|
58275
|
+
}
|
|
58276
|
+
if (e instanceof AwareError) {
|
|
58277
|
+
app.log.warn({ id: req.params.id, nodeId, detail: e.detail }, "freeze failed");
|
|
58278
|
+
return reply.status(422).send({ ok: false, error: "Couldn't freeze this node \u2014 it may have no saved output yet (run it once first).", reason: awareStderr(e) });
|
|
58279
|
+
}
|
|
58280
|
+
throw e;
|
|
58281
|
+
}
|
|
58282
|
+
broadcast({ type: "apps-changed", id: req.params.id });
|
|
58283
|
+
return { ok: true };
|
|
58284
|
+
});
|
|
58285
|
+
app.post("/api/app/:id/unfreeze", async (req, reply) => {
|
|
58286
|
+
const nodeId = typeof req.body?.nodeId === "string" ? req.body.nodeId.trim() : "";
|
|
58287
|
+
if (!nodeId) return reply.status(400).send({ ok: false, error: "nodeId required" });
|
|
58288
|
+
try {
|
|
58289
|
+
await aware.unfreeze(req.params.id, nodeId);
|
|
58290
|
+
} catch (e) {
|
|
58291
|
+
if (e instanceof AwareUnsupportedError) {
|
|
58292
|
+
return reply.status(422).send({ ok: false, error: "Freezing needs AWARE 0.77 or newer \u2014 update AWARE from the footer." });
|
|
58293
|
+
}
|
|
58294
|
+
if (e instanceof AwareError) {
|
|
58295
|
+
app.log.warn({ id: req.params.id, nodeId, detail: e.detail }, "unfreeze failed");
|
|
58296
|
+
return reply.status(422).send({ ok: false, error: "Could not unfreeze this node.", reason: awareStderr(e) });
|
|
58297
|
+
}
|
|
58298
|
+
throw e;
|
|
58299
|
+
}
|
|
58300
|
+
broadcast({ type: "apps-changed", id: req.params.id });
|
|
58301
|
+
return { ok: true };
|
|
58302
|
+
});
|
|
57818
58303
|
app.post("/api/compile", async (req, reply) => {
|
|
57819
58304
|
const { id, sourcePath } = req.body ?? {};
|
|
57820
58305
|
const path = sourcePath ?? (id ? readApp(id).source.path : void 0);
|
|
@@ -57837,11 +58322,11 @@ async function startServer() {
|
|
|
57837
58322
|
if (appExists(id)) {
|
|
57838
58323
|
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
58324
|
}
|
|
57840
|
-
const stageRoot = (0,
|
|
58325
|
+
const stageRoot = (0, import_node_fs28.mkdtempSync)((0, import_node_path26.join)((0, import_node_os18.tmpdir)(), "floless-import-"));
|
|
57841
58326
|
try {
|
|
57842
|
-
const stageDir = (0,
|
|
57843
|
-
(0,
|
|
57844
|
-
(0,
|
|
58327
|
+
const stageDir = (0, import_node_path26.join)(stageRoot, id);
|
|
58328
|
+
(0, import_node_fs28.mkdirSync)(stageDir);
|
|
58329
|
+
(0, import_node_fs28.writeFileSync)((0, import_node_path26.join)(stageDir, `${id}.flo`), content);
|
|
57845
58330
|
await aware.install(stageDir);
|
|
57846
58331
|
} catch (err) {
|
|
57847
58332
|
try {
|
|
@@ -57851,7 +58336,7 @@ async function startServer() {
|
|
|
57851
58336
|
const msg = err instanceof AwareError ? err.message : String(err?.message ?? err);
|
|
57852
58337
|
return reply.status(502).send({ ok: false, error: `import failed: ${msg}` });
|
|
57853
58338
|
} finally {
|
|
57854
|
-
(0,
|
|
58339
|
+
(0, import_node_fs28.rmSync)(stageRoot, { recursive: true, force: true });
|
|
57855
58340
|
}
|
|
57856
58341
|
broadcast({ type: "apps-changed", id });
|
|
57857
58342
|
return { ok: true, id };
|
|
@@ -57865,13 +58350,13 @@ async function startServer() {
|
|
|
57865
58350
|
}
|
|
57866
58351
|
const inputs = appData.inputs.map((i) => ({ name: i.name, type: i.type }));
|
|
57867
58352
|
const baked = bakeFloSource(appData.source.text, inputs);
|
|
57868
|
-
const tmpRoot = (0,
|
|
57869
|
-
const backupDir = (0,
|
|
57870
|
-
const bakeDir = (0,
|
|
57871
|
-
(0,
|
|
57872
|
-
(0,
|
|
58353
|
+
const tmpRoot = (0, import_node_fs28.mkdtempSync)((0, import_node_path26.join)((0, import_node_os18.tmpdir)(), "floless-bake-"));
|
|
58354
|
+
const backupDir = (0, import_node_path26.join)(tmpRoot, `${id}-backup`);
|
|
58355
|
+
const bakeDir = (0, import_node_path26.join)(tmpRoot, id);
|
|
58356
|
+
(0, import_node_fs28.cpSync)(appDir(id), backupDir, { recursive: true });
|
|
58357
|
+
(0, import_node_fs28.cpSync)(appDir(id), bakeDir, { recursive: true });
|
|
57873
58358
|
const floName = appData.source.path.split(/[\\/]/).pop();
|
|
57874
|
-
(0,
|
|
58359
|
+
(0, import_node_fs28.writeFileSync)((0, import_node_path26.join)(bakeDir, floName), baked);
|
|
57875
58360
|
let appInstalled2 = true;
|
|
57876
58361
|
try {
|
|
57877
58362
|
await aware.uninstall(id);
|
|
@@ -57893,17 +58378,17 @@ async function startServer() {
|
|
|
57893
58378
|
throw installErr;
|
|
57894
58379
|
}
|
|
57895
58380
|
try {
|
|
57896
|
-
await aware.compile((0,
|
|
58381
|
+
await aware.compile((0, import_node_path26.join)(appDir(id), floName));
|
|
57897
58382
|
} catch (compileErr) {
|
|
57898
58383
|
app.log.warn({ id, compileErr: String(compileErr) }, "bake: post-install recompile failed (app baked but may need a manual Compile)");
|
|
57899
58384
|
}
|
|
57900
58385
|
broadcast({ type: "baked", id });
|
|
57901
58386
|
return { ok: true, id, agent: id, inputs };
|
|
57902
58387
|
} finally {
|
|
57903
|
-
if (appInstalled2) (0,
|
|
58388
|
+
if (appInstalled2) (0, import_node_fs28.rmSync)(tmpRoot, { recursive: true, force: true });
|
|
57904
58389
|
}
|
|
57905
58390
|
});
|
|
57906
|
-
const graftAgentsDir = () => (0,
|
|
58391
|
+
const graftAgentsDir = () => (0, import_node_path26.join)((0, import_node_os18.homedir)(), ".aware", "agents");
|
|
57907
58392
|
app.post("/api/graft/match", async (req, reply) => {
|
|
57908
58393
|
const { glob } = req.body ?? {};
|
|
57909
58394
|
if (!glob) return reply.status(400).send({ ok: false, error: "glob required" });
|
|
@@ -57920,7 +58405,7 @@ async function startServer() {
|
|
|
57920
58405
|
if (!sourceKind || !sourceRef) {
|
|
57921
58406
|
return reply.status(400).send({ ok: false, error: "sourceKind and sourceRef required" });
|
|
57922
58407
|
}
|
|
57923
|
-
const tempHome = (0,
|
|
58408
|
+
const tempHome = (0, import_node_fs28.mkdtempSync)((0, import_node_path26.join)((0, import_node_os18.tmpdir)(), "floless-graft-"));
|
|
57924
58409
|
let result;
|
|
57925
58410
|
try {
|
|
57926
58411
|
result = await aware.build({
|
|
@@ -57933,19 +58418,19 @@ async function startServer() {
|
|
|
57933
58418
|
awareHome: tempHome
|
|
57934
58419
|
});
|
|
57935
58420
|
} catch (err) {
|
|
57936
|
-
(0,
|
|
58421
|
+
(0, import_node_fs28.rmSync)(tempHome, { recursive: true, force: true });
|
|
57937
58422
|
const msg = err instanceof AwareError ? err.message : String(err?.message ?? err);
|
|
57938
58423
|
return reply.status(422).send({ ok: false, error: msg });
|
|
57939
58424
|
}
|
|
57940
58425
|
const manifest = readStagedManifest(result.agentDir);
|
|
57941
58426
|
if (!manifest) {
|
|
57942
|
-
(0,
|
|
58427
|
+
(0, import_node_fs28.rmSync)(tempHome, { recursive: true, force: true });
|
|
57943
58428
|
return reply.status(502).send({ ok: false, error: `build produced output at ${result.agentDir} but no manifest.yaml` });
|
|
57944
58429
|
}
|
|
57945
58430
|
const token = (0, import_node_crypto7.randomUUID)();
|
|
57946
58431
|
registerStage(token, tempHome, result.agentId);
|
|
57947
58432
|
const preview = buildPreview(manifest, sourceKind, sourceRef, token);
|
|
57948
|
-
if ((0,
|
|
58433
|
+
if ((0, import_node_fs28.existsSync)((0, import_node_path26.join)(graftAgentsDir(), result.agentId))) {
|
|
57949
58434
|
preview.warnings.unshift(`An agent named "${result.agentId}" is already installed \u2014 creating it will overwrite it.`);
|
|
57950
58435
|
}
|
|
57951
58436
|
return { ok: true, preview };
|
|
@@ -57964,7 +58449,7 @@ async function startServer() {
|
|
|
57964
58449
|
registerStage(stagedRef, stage.tempDir, stage.agentId);
|
|
57965
58450
|
return reply.status(409).send({ ok: false, error: err.message, agentId: stage.agentId, collision: true });
|
|
57966
58451
|
}
|
|
57967
|
-
(0,
|
|
58452
|
+
(0, import_node_fs28.rmSync)(stage.tempDir, { recursive: true, force: true });
|
|
57968
58453
|
throw err;
|
|
57969
58454
|
}
|
|
57970
58455
|
broadcast({ type: "grafted", id: stage.agentId });
|
|
@@ -58197,11 +58682,11 @@ async function startServer() {
|
|
|
58197
58682
|
app.get("/api/requests/:id/snapshot/:n", async (req, reply) => {
|
|
58198
58683
|
const n = Number.parseInt(req.params.n, 10);
|
|
58199
58684
|
const p = Number.isInteger(n) ? snapshotPathFor(req.params.id, n) : null;
|
|
58200
|
-
if (!p || !(0,
|
|
58685
|
+
if (!p || !(0, import_node_fs28.existsSync)(p)) return reply.status(404).send({ ok: false, error: "snapshot not found" });
|
|
58201
58686
|
const ext = p.split(".").pop().toLowerCase();
|
|
58202
58687
|
reply.header("Content-Type", ext === "png" ? "image/png" : ext === "webp" ? "image/webp" : ext === "pdf" ? "application/pdf" : "image/jpeg");
|
|
58203
58688
|
reply.header("Cache-Control", "no-store");
|
|
58204
|
-
return (0,
|
|
58689
|
+
return (0, import_node_fs28.readFileSync)(p);
|
|
58205
58690
|
});
|
|
58206
58691
|
app.post(
|
|
58207
58692
|
"/api/tweak",
|
|
@@ -58222,6 +58707,25 @@ async function startServer() {
|
|
|
58222
58707
|
return { ok: true, request };
|
|
58223
58708
|
}
|
|
58224
58709
|
);
|
|
58710
|
+
app.post(
|
|
58711
|
+
"/api/contract-request",
|
|
58712
|
+
{ bodyLimit: 25 * 1024 * 1024 },
|
|
58713
|
+
async (req, reply) => {
|
|
58714
|
+
const { appId, instruction, snapshots } = req.body ?? {};
|
|
58715
|
+
if (!appId || !instruction) {
|
|
58716
|
+
return reply.status(400).send({ ok: false, error: "appId, instruction required" });
|
|
58717
|
+
}
|
|
58718
|
+
let decoded;
|
|
58719
|
+
try {
|
|
58720
|
+
decoded = decodeSnapshots(snapshots);
|
|
58721
|
+
} catch (e) {
|
|
58722
|
+
return reply.status(400).send({ ok: false, error: e instanceof Error ? e.message : "bad snapshot" });
|
|
58723
|
+
}
|
|
58724
|
+
const request = addRequest({ type: "tweak-contract", appId, instruction }, decoded);
|
|
58725
|
+
broadcast({ type: "request-added", request });
|
|
58726
|
+
return { ok: true, request };
|
|
58727
|
+
}
|
|
58728
|
+
);
|
|
58225
58729
|
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
58730
|
app.post(
|
|
58227
58731
|
"/api/rebake",
|
|
@@ -58331,7 +58835,7 @@ async function startServer() {
|
|
|
58331
58835
|
warn(`last-run-status:${ref} \u2014 trace exists but couldn't be parsed (corrupt/truncated)`);
|
|
58332
58836
|
let finishedAt2 = null;
|
|
58333
58837
|
try {
|
|
58334
|
-
finishedAt2 = (0,
|
|
58838
|
+
finishedAt2 = (0, import_node_fs28.statSync)(latest.path).mtime.toISOString();
|
|
58335
58839
|
} catch {
|
|
58336
58840
|
finishedAt2 = null;
|
|
58337
58841
|
}
|
|
@@ -58341,7 +58845,7 @@ async function startServer() {
|
|
|
58341
58845
|
let finishedAt = typeof runEnd?.ts === "string" ? runEnd.ts : null;
|
|
58342
58846
|
if (!finishedAt) {
|
|
58343
58847
|
try {
|
|
58344
|
-
finishedAt = (0,
|
|
58848
|
+
finishedAt = (0, import_node_fs28.statSync)(latest.path).mtime.toISOString();
|
|
58345
58849
|
} catch {
|
|
58346
58850
|
finishedAt = null;
|
|
58347
58851
|
}
|