@floless/app 0.23.2 → 0.24.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 +671 -544
- package/dist/skills/floless-app-routines/SKILL.md +3 -1
- package/dist/skills/floless-app-steel-from-drawings/SKILL.md +5 -3
- package/dist/skills/floless-app-ui/SKILL.md +4 -4
- package/dist/web/app.css +6 -0
- package/dist/web/aware.js +12 -2
- package/dist/web/index.html +18 -2
- package/dist/web/panels.js +56 -12
- package/package.json +1 -1
package/dist/floless-server.cjs
CHANGED
|
@@ -5489,7 +5489,7 @@ var require_thread_stream = __commonJS({
|
|
|
5489
5489
|
var { version } = require_package();
|
|
5490
5490
|
var { EventEmitter: EventEmitter2 } = require("events");
|
|
5491
5491
|
var { Worker } = require("worker_threads");
|
|
5492
|
-
var { join:
|
|
5492
|
+
var { join: join25 } = 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"] || join25(__dirname, "lib", "worker.js");
|
|
5544
5544
|
const worker = new Worker(toExecute, {
|
|
5545
5545
|
...opts.workerOpts,
|
|
5546
5546
|
name: opts.workerOpts?.name || "thread-stream",
|
|
@@ -6006,9 +6006,9 @@ var require_transport = __commonJS({
|
|
|
6006
6006
|
"node_modules/pino/lib/transport.js"(exports2, module2) {
|
|
6007
6007
|
"use strict";
|
|
6008
6008
|
var { createRequire: createRequire4 } = require("module");
|
|
6009
|
-
var { existsSync:
|
|
6009
|
+
var { existsSync: existsSync23 } = require("node:fs");
|
|
6010
6010
|
var getCallers = require_caller();
|
|
6011
|
-
var { join:
|
|
6011
|
+
var { join: join25, isAbsolute: isAbsolute2, sep: sep4 } = require("node:path");
|
|
6012
6012
|
var { fileURLToPath: fileURLToPath4 } = require("node:url");
|
|
6013
6013
|
var sleep = require_atomic_sleep();
|
|
6014
6014
|
var onExit = require_on_exit_leak_free();
|
|
@@ -6080,7 +6080,7 @@ var require_transport = __commonJS({
|
|
|
6080
6080
|
return false;
|
|
6081
6081
|
}
|
|
6082
6082
|
}
|
|
6083
|
-
return isAbsolute2(path) && !
|
|
6083
|
+
return isAbsolute2(path) && !existsSync23(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"] || join25(__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"] || join25(__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 join25(__dirname, "..", "file.js");
|
|
6206
6206
|
}
|
|
6207
6207
|
let fixTarget2;
|
|
6208
6208
|
for (const filePath of callers) {
|
|
@@ -6317,14 +6317,14 @@ var require_tools = __commonJS({
|
|
|
6317
6317
|
}
|
|
6318
6318
|
return point < 32 ? JSON.stringify(str) : '"' + result + '"';
|
|
6319
6319
|
}
|
|
6320
|
-
function asJson(obj, msg,
|
|
6320
|
+
function asJson(obj, msg, num2, time) {
|
|
6321
6321
|
if (asJsonChan.hasSubscribers === false) {
|
|
6322
|
-
return _asJson.call(this, obj, msg,
|
|
6322
|
+
return _asJson.call(this, obj, msg, num2, time);
|
|
6323
6323
|
}
|
|
6324
6324
|
const store = { instance: this, arguments };
|
|
6325
|
-
return asJsonChan.traceSync(_asJson, store, this, obj, msg,
|
|
6325
|
+
return asJsonChan.traceSync(_asJson, store, this, obj, msg, num2, time);
|
|
6326
6326
|
}
|
|
6327
|
-
function _asJson(obj, msg,
|
|
6327
|
+
function _asJson(obj, msg, num2, time) {
|
|
6328
6328
|
const stringify2 = this[stringifySym];
|
|
6329
6329
|
const stringifySafe = this[stringifySafeSym];
|
|
6330
6330
|
const stringifiers = this[stringifiersSym];
|
|
@@ -6334,7 +6334,7 @@ var require_tools = __commonJS({
|
|
|
6334
6334
|
const formatters = this[formattersSym];
|
|
6335
6335
|
const messageKey = this[messageKeySym];
|
|
6336
6336
|
const errorKey = this[errorKeySym];
|
|
6337
|
-
let data = this[lsCacheSym][
|
|
6337
|
+
let data = this[lsCacheSym][num2] + time;
|
|
6338
6338
|
data = data + chindings;
|
|
6339
6339
|
let value;
|
|
6340
6340
|
if (formatters.log) {
|
|
@@ -6959,7 +6959,7 @@ var require_proto = __commonJS({
|
|
|
6959
6959
|
function defaultMixinMergeStrategy(mergeObject, mixinObject) {
|
|
6960
6960
|
return Object.assign(mixinObject, mergeObject);
|
|
6961
6961
|
}
|
|
6962
|
-
function write(_obj, msg,
|
|
6962
|
+
function write(_obj, msg, num2) {
|
|
6963
6963
|
const t = this[timeSym]();
|
|
6964
6964
|
const mixin = this[mixinSym];
|
|
6965
6965
|
const errorKey = this[errorKeySym];
|
|
@@ -6981,12 +6981,12 @@ var require_proto = __commonJS({
|
|
|
6981
6981
|
}
|
|
6982
6982
|
}
|
|
6983
6983
|
if (mixin) {
|
|
6984
|
-
obj = mixinMergeStrategy(obj, mixin(obj,
|
|
6984
|
+
obj = mixinMergeStrategy(obj, mixin(obj, num2, this));
|
|
6985
6985
|
}
|
|
6986
|
-
const s = this[asJsonSym](obj, msg,
|
|
6986
|
+
const s = this[asJsonSym](obj, msg, num2, t);
|
|
6987
6987
|
const stream = this[streamSym];
|
|
6988
6988
|
if (stream[needsMetadataGsym] === true) {
|
|
6989
|
-
stream.lastLevel =
|
|
6989
|
+
stream.lastLevel = num2;
|
|
6990
6990
|
stream.lastObj = obj;
|
|
6991
6991
|
stream.lastMsg = msg;
|
|
6992
6992
|
stream.lastTime = t.slice(this[timeSliceIndexSym]);
|
|
@@ -7182,7 +7182,7 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
7182
7182
|
return circularValue;
|
|
7183
7183
|
}
|
|
7184
7184
|
let res = "";
|
|
7185
|
-
let
|
|
7185
|
+
let join25 = ",";
|
|
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
|
+
join25 = `,
|
|
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 += join25;
|
|
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 += `${join25}"... ${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
|
+
join25 = `,
|
|
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 = join25;
|
|
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 = join25;
|
|
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 join25 = ",";
|
|
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
|
+
join25 = `,
|
|
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 += join25;
|
|
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 += `${join25}"... ${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
|
+
join25 = `,
|
|
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 = join25;
|
|
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 join26 = `,
|
|
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 += join26;
|
|
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 += `${join26}"... ${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 join25 = `,
|
|
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, join25, maximumBreadth);
|
|
7438
7438
|
keys = keys.slice(value.length);
|
|
7439
7439
|
maximumPropertiesToStringify -= value.length;
|
|
7440
|
-
separator =
|
|
7440
|
+
separator = join25;
|
|
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 = join25;
|
|
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 = join25;
|
|
7458
7458
|
}
|
|
7459
7459
|
if (separator !== "") {
|
|
7460
7460
|
res = `
|
|
@@ -8513,13 +8513,13 @@ var require_serializer = __commonJS({
|
|
|
8513
8513
|
return "" + integer;
|
|
8514
8514
|
}
|
|
8515
8515
|
asNumber(i) {
|
|
8516
|
-
const
|
|
8517
|
-
if (
|
|
8516
|
+
const num2 = Number(i);
|
|
8517
|
+
if (num2 !== num2) {
|
|
8518
8518
|
throw new Error(`The value "${i}" cannot be converted to a number.`);
|
|
8519
|
-
} else if (
|
|
8519
|
+
} else if (num2 === Infinity || num2 === -Infinity) {
|
|
8520
8520
|
return "null";
|
|
8521
8521
|
} else {
|
|
8522
|
-
return "" +
|
|
8522
|
+
return "" + num2;
|
|
8523
8523
|
}
|
|
8524
8524
|
}
|
|
8525
8525
|
asBoolean(bool) {
|
|
@@ -24673,9 +24673,9 @@ var require_semver = __commonJS({
|
|
|
24673
24673
|
} else {
|
|
24674
24674
|
this.prerelease = m[4].split(".").map((id) => {
|
|
24675
24675
|
if (/^[0-9]+$/.test(id)) {
|
|
24676
|
-
const
|
|
24677
|
-
if (
|
|
24678
|
-
return
|
|
24676
|
+
const num2 = +id;
|
|
24677
|
+
if (num2 >= 0 && num2 < MAX_SAFE_INTEGER) {
|
|
24678
|
+
return num2;
|
|
24679
24679
|
}
|
|
24680
24680
|
}
|
|
24681
24681
|
return id;
|
|
@@ -41036,24 +41036,24 @@ var require_dist5 = __commonJS({
|
|
|
41036
41036
|
var DAY = HOUR * 24;
|
|
41037
41037
|
var YEAR = DAY * 365.25;
|
|
41038
41038
|
function parse(val) {
|
|
41039
|
-
var
|
|
41040
|
-
if (arr != null && (
|
|
41041
|
-
if (arr[3] != null) return
|
|
41042
|
-
if (arr[4] != null) return
|
|
41043
|
-
if (arr[5] != null) return
|
|
41044
|
-
if (arr[6] != null) return
|
|
41045
|
-
if (arr[7] != null) return
|
|
41046
|
-
if (arr[8] != null) return
|
|
41047
|
-
return
|
|
41039
|
+
var num2, arr = val.toLowerCase().match(RGX);
|
|
41040
|
+
if (arr != null && (num2 = parseFloat(arr[1]))) {
|
|
41041
|
+
if (arr[3] != null) return num2 * SEC;
|
|
41042
|
+
if (arr[4] != null) return num2 * MIN;
|
|
41043
|
+
if (arr[5] != null) return num2 * HOUR;
|
|
41044
|
+
if (arr[6] != null) return num2 * DAY;
|
|
41045
|
+
if (arr[7] != null) return num2 * DAY * 7;
|
|
41046
|
+
if (arr[8] != null) return num2 * YEAR;
|
|
41047
|
+
return num2;
|
|
41048
41048
|
}
|
|
41049
41049
|
}
|
|
41050
41050
|
function fmt(val, pfx, str, long) {
|
|
41051
|
-
var
|
|
41052
|
-
return pfx +
|
|
41051
|
+
var num2 = (val | 0) === val ? val : ~~(val + 0.5);
|
|
41052
|
+
return pfx + num2 + (long ? " " + str + (num2 != 1 ? "s" : "") : str[0]);
|
|
41053
41053
|
}
|
|
41054
|
-
function format(
|
|
41055
|
-
var pfx =
|
|
41056
|
-
if (abs < SEC) return
|
|
41054
|
+
function format(num2, long) {
|
|
41055
|
+
var pfx = num2 < 0 ? "-" : "", abs = num2 < 0 ? -num2 : num2;
|
|
41056
|
+
if (abs < SEC) return num2 + (long ? " ms" : "ms");
|
|
41057
41057
|
if (abs < MIN) return fmt(abs / SEC, pfx, "second", long);
|
|
41058
41058
|
if (abs < HOUR) return fmt(abs / MIN, pfx, "minute", long);
|
|
41059
41059
|
if (abs < DAY) return fmt(abs / HOUR, pfx, "hour", long);
|
|
@@ -41991,7 +41991,7 @@ var require_send = __commonJS({
|
|
|
41991
41991
|
var { parseTokenList } = require_parseTokenList();
|
|
41992
41992
|
var { createHttpError } = require_createHttpError();
|
|
41993
41993
|
var extname2 = path.extname;
|
|
41994
|
-
var
|
|
41994
|
+
var join25 = 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(join25(root, path2));
|
|
42082
42082
|
} else {
|
|
42083
42083
|
if (UP_PATH_REGEXP.test(path2)) {
|
|
42084
42084
|
debug('malicious path "%s"', path2);
|
|
@@ -42194,15 +42194,15 @@ var require_send = __commonJS({
|
|
|
42194
42194
|
headers[headerName] = err.headers[headerName];
|
|
42195
42195
|
}
|
|
42196
42196
|
}
|
|
42197
|
-
const
|
|
42197
|
+
const doc2 = ERROR_RESPONSES[statusCode];
|
|
42198
42198
|
headers["Content-Type"] = "text/html; charset=utf-8";
|
|
42199
|
-
headers["Content-Length"] =
|
|
42199
|
+
headers["Content-Length"] = doc2[1];
|
|
42200
42200
|
headers["Content-Security-Policy"] = "default-src 'none'";
|
|
42201
42201
|
headers["X-Content-Type-Options"] = "nosniff";
|
|
42202
42202
|
return {
|
|
42203
42203
|
statusCode,
|
|
42204
42204
|
headers,
|
|
42205
|
-
stream: Readable3.from(
|
|
42205
|
+
stream: Readable3.from(doc2[0]),
|
|
42206
42206
|
// metadata
|
|
42207
42207
|
type: "error",
|
|
42208
42208
|
metadata: { error: createHttpError(statusCode, err) }
|
|
@@ -42341,17 +42341,17 @@ var require_send = __commonJS({
|
|
|
42341
42341
|
return sendError(403);
|
|
42342
42342
|
}
|
|
42343
42343
|
const loc = encodeURI(collapseLeadingSlashes(options.path + "/"));
|
|
42344
|
-
const
|
|
42344
|
+
const doc2 = createHtmlDocument("Redirecting", "Redirecting to " + escapeHtml(loc));
|
|
42345
42345
|
const headers = {};
|
|
42346
42346
|
headers["Content-Type"] = "text/html; charset=utf-8";
|
|
42347
|
-
headers["Content-Length"] =
|
|
42347
|
+
headers["Content-Length"] = doc2[1];
|
|
42348
42348
|
headers["Content-Security-Policy"] = "default-src 'none'";
|
|
42349
42349
|
headers["X-Content-Type-Options"] = "nosniff";
|
|
42350
42350
|
headers.Location = loc;
|
|
42351
42351
|
return {
|
|
42352
42352
|
statusCode: 301,
|
|
42353
42353
|
headers,
|
|
42354
|
-
stream: Readable3.from(
|
|
42354
|
+
stream: Readable3.from(doc2[0]),
|
|
42355
42355
|
// metadata
|
|
42356
42356
|
type: "directory",
|
|
42357
42357
|
metadata: { requestPath: options.path, path: path2 }
|
|
@@ -42361,7 +42361,7 @@ var require_send = __commonJS({
|
|
|
42361
42361
|
let err;
|
|
42362
42362
|
for (let i = 0; i < options.index.length; i++) {
|
|
42363
42363
|
const index = options.index[i];
|
|
42364
|
-
const p =
|
|
42364
|
+
const p = join25(path2, index);
|
|
42365
42365
|
const { error, stat: stat4 } = await tryStat(p);
|
|
42366
42366
|
if (error) {
|
|
42367
42367
|
err = error;
|
|
@@ -43012,7 +43012,7 @@ var require_static = __commonJS({
|
|
|
43012
43012
|
"use strict";
|
|
43013
43013
|
var path = require("node:path");
|
|
43014
43014
|
var { fileURLToPath: fileURLToPath4 } = require("node:url");
|
|
43015
|
-
var { statSync:
|
|
43015
|
+
var { statSync: statSync8 } = require("node:fs");
|
|
43016
43016
|
var { glob } = require_commonjs6();
|
|
43017
43017
|
var fp = require_plugin2();
|
|
43018
43018
|
var send = require_send2();
|
|
@@ -43375,7 +43375,7 @@ var require_static = __commonJS({
|
|
|
43375
43375
|
}
|
|
43376
43376
|
let pathStat;
|
|
43377
43377
|
try {
|
|
43378
|
-
pathStat =
|
|
43378
|
+
pathStat = statSync8(rootPath);
|
|
43379
43379
|
} catch (e) {
|
|
43380
43380
|
if (e.code === "ENOENT") {
|
|
43381
43381
|
fastify.log.warn(`"root" path "${rootPath}" must exist`);
|
|
@@ -43399,7 +43399,7 @@ var require_static = __commonJS({
|
|
|
43399
43399
|
return indexFiles.find((filename) => {
|
|
43400
43400
|
const p = path.join(root, pathname, filename);
|
|
43401
43401
|
try {
|
|
43402
|
-
const stats =
|
|
43402
|
+
const stats = statSync8(p);
|
|
43403
43403
|
return !stats.isDirectory();
|
|
43404
43404
|
} catch {
|
|
43405
43405
|
return false;
|
|
@@ -43799,13 +43799,13 @@ var require_directives = __commonJS({
|
|
|
43799
43799
|
}
|
|
43800
43800
|
return tag[0] === "!" ? tag : `!<${tag}>`;
|
|
43801
43801
|
}
|
|
43802
|
-
toString(
|
|
43802
|
+
toString(doc2) {
|
|
43803
43803
|
const lines = this.yaml.explicit ? [`%YAML ${this.yaml.version || "1.2"}`] : [];
|
|
43804
43804
|
const tagEntries = Object.entries(this.tags);
|
|
43805
43805
|
let tagNames;
|
|
43806
|
-
if (
|
|
43806
|
+
if (doc2 && tagEntries.length > 0 && identity.isNode(doc2.contents)) {
|
|
43807
43807
|
const tags = {};
|
|
43808
|
-
visit.visit(
|
|
43808
|
+
visit.visit(doc2.contents, (_key, node) => {
|
|
43809
43809
|
if (identity.isNode(node) && node.tag)
|
|
43810
43810
|
tags[node.tag] = true;
|
|
43811
43811
|
});
|
|
@@ -43815,7 +43815,7 @@ var require_directives = __commonJS({
|
|
|
43815
43815
|
for (const [handle, prefix] of tagEntries) {
|
|
43816
43816
|
if (handle === "!!" && prefix === "tag:yaml.org,2002:")
|
|
43817
43817
|
continue;
|
|
43818
|
-
if (!
|
|
43818
|
+
if (!doc2 || tagNames.some((tn) => tn.startsWith(prefix)))
|
|
43819
43819
|
lines.push(`%TAG ${handle} ${prefix}`);
|
|
43820
43820
|
}
|
|
43821
43821
|
return lines.join("\n");
|
|
@@ -43858,14 +43858,14 @@ var require_anchors = __commonJS({
|
|
|
43858
43858
|
return name;
|
|
43859
43859
|
}
|
|
43860
43860
|
}
|
|
43861
|
-
function createNodeAnchors(
|
|
43861
|
+
function createNodeAnchors(doc2, prefix) {
|
|
43862
43862
|
const aliasObjects = [];
|
|
43863
43863
|
const sourceObjects = /* @__PURE__ */ new Map();
|
|
43864
43864
|
let prevAnchors = null;
|
|
43865
43865
|
return {
|
|
43866
43866
|
onAnchor: (source) => {
|
|
43867
43867
|
aliasObjects.push(source);
|
|
43868
|
-
prevAnchors ?? (prevAnchors = anchorNames(
|
|
43868
|
+
prevAnchors ?? (prevAnchors = anchorNames(doc2));
|
|
43869
43869
|
const anchor = findNewAnchor(prefix, prevAnchors);
|
|
43870
43870
|
prevAnchors.add(anchor);
|
|
43871
43871
|
return anchor;
|
|
@@ -43996,12 +43996,12 @@ var require_Node = __commonJS({
|
|
|
43996
43996
|
return copy;
|
|
43997
43997
|
}
|
|
43998
43998
|
/** A plain JavaScript representation of this node. */
|
|
43999
|
-
toJS(
|
|
44000
|
-
if (!identity.isDocument(
|
|
43999
|
+
toJS(doc2, { mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {
|
|
44000
|
+
if (!identity.isDocument(doc2))
|
|
44001
44001
|
throw new TypeError("A document argument is required");
|
|
44002
44002
|
const ctx = {
|
|
44003
44003
|
anchors: /* @__PURE__ */ new Map(),
|
|
44004
|
-
doc,
|
|
44004
|
+
doc: doc2,
|
|
44005
44005
|
keep: true,
|
|
44006
44006
|
mapAsMap: mapAsMap === true,
|
|
44007
44007
|
mapKeyWarned: false,
|
|
@@ -44041,7 +44041,7 @@ var require_Alias = __commonJS({
|
|
|
44041
44041
|
* Resolve the value of this alias within `doc`, finding the last
|
|
44042
44042
|
* instance of the `source` anchor before this node.
|
|
44043
44043
|
*/
|
|
44044
|
-
resolve(
|
|
44044
|
+
resolve(doc2, ctx) {
|
|
44045
44045
|
if (ctx?.maxAliasCount === 0)
|
|
44046
44046
|
throw new ReferenceError("Alias resolution is disabled");
|
|
44047
44047
|
let nodes;
|
|
@@ -44049,7 +44049,7 @@ var require_Alias = __commonJS({
|
|
|
44049
44049
|
nodes = ctx.aliasResolveCache;
|
|
44050
44050
|
} else {
|
|
44051
44051
|
nodes = [];
|
|
44052
|
-
visit.visit(
|
|
44052
|
+
visit.visit(doc2, {
|
|
44053
44053
|
Node: (_key, node) => {
|
|
44054
44054
|
if (identity.isAlias(node) || identity.hasAnchor(node))
|
|
44055
44055
|
nodes.push(node);
|
|
@@ -44070,8 +44070,8 @@ var require_Alias = __commonJS({
|
|
|
44070
44070
|
toJSON(_arg, ctx) {
|
|
44071
44071
|
if (!ctx)
|
|
44072
44072
|
return { source: this.source };
|
|
44073
|
-
const { anchors: anchors2, doc, maxAliasCount } = ctx;
|
|
44074
|
-
const source = this.resolve(
|
|
44073
|
+
const { anchors: anchors2, doc: doc2, maxAliasCount } = ctx;
|
|
44074
|
+
const source = this.resolve(doc2, ctx);
|
|
44075
44075
|
if (!source) {
|
|
44076
44076
|
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
44077
44077
|
throw new ReferenceError(msg);
|
|
@@ -44088,7 +44088,7 @@ var require_Alias = __commonJS({
|
|
|
44088
44088
|
if (maxAliasCount >= 0) {
|
|
44089
44089
|
data.count += 1;
|
|
44090
44090
|
if (data.aliasCount === 0)
|
|
44091
|
-
data.aliasCount = getAliasCount(
|
|
44091
|
+
data.aliasCount = getAliasCount(doc2, source, anchors2);
|
|
44092
44092
|
if (data.count * data.aliasCount > maxAliasCount) {
|
|
44093
44093
|
const msg = "Excessive alias count indicates a resource exhaustion attack";
|
|
44094
44094
|
throw new ReferenceError(msg);
|
|
@@ -44110,22 +44110,22 @@ var require_Alias = __commonJS({
|
|
|
44110
44110
|
return src;
|
|
44111
44111
|
}
|
|
44112
44112
|
};
|
|
44113
|
-
function getAliasCount(
|
|
44113
|
+
function getAliasCount(doc2, node, anchors2) {
|
|
44114
44114
|
if (identity.isAlias(node)) {
|
|
44115
|
-
const source = node.resolve(
|
|
44115
|
+
const source = node.resolve(doc2);
|
|
44116
44116
|
const anchor = anchors2 && source && anchors2.get(source);
|
|
44117
44117
|
return anchor ? anchor.count * anchor.aliasCount : 0;
|
|
44118
44118
|
} else if (identity.isCollection(node)) {
|
|
44119
44119
|
let count = 0;
|
|
44120
44120
|
for (const item of node.items) {
|
|
44121
|
-
const c = getAliasCount(
|
|
44121
|
+
const c = getAliasCount(doc2, item, anchors2);
|
|
44122
44122
|
if (c > count)
|
|
44123
44123
|
count = c;
|
|
44124
44124
|
}
|
|
44125
44125
|
return count;
|
|
44126
44126
|
} else if (identity.isPair(node)) {
|
|
44127
|
-
const kc = getAliasCount(
|
|
44128
|
-
const vc = getAliasCount(
|
|
44127
|
+
const kc = getAliasCount(doc2, node.key, anchors2);
|
|
44128
|
+
const vc = getAliasCount(doc2, node.value, anchors2);
|
|
44129
44129
|
return Math.max(kc, vc);
|
|
44130
44130
|
}
|
|
44131
44131
|
return 1;
|
|
@@ -44826,7 +44826,7 @@ var require_stringify2 = __commonJS({
|
|
|
44826
44826
|
var identity = require_identity();
|
|
44827
44827
|
var stringifyComment = require_stringifyComment();
|
|
44828
44828
|
var stringifyString = require_stringifyString();
|
|
44829
|
-
function createStringifyContext(
|
|
44829
|
+
function createStringifyContext(doc2, options) {
|
|
44830
44830
|
const opt = Object.assign({
|
|
44831
44831
|
blockQuote: true,
|
|
44832
44832
|
commentString: stringifyComment.stringifyComment,
|
|
@@ -44846,7 +44846,7 @@ var require_stringify2 = __commonJS({
|
|
|
44846
44846
|
trailingComma: false,
|
|
44847
44847
|
trueStr: "true",
|
|
44848
44848
|
verifyAliasOrder: true
|
|
44849
|
-
},
|
|
44849
|
+
}, doc2.schema.toStringOptions, options);
|
|
44850
44850
|
let inFlow;
|
|
44851
44851
|
switch (opt.collectionStyle) {
|
|
44852
44852
|
case "block":
|
|
@@ -44860,7 +44860,7 @@ var require_stringify2 = __commonJS({
|
|
|
44860
44860
|
}
|
|
44861
44861
|
return {
|
|
44862
44862
|
anchors: /* @__PURE__ */ new Set(),
|
|
44863
|
-
doc,
|
|
44863
|
+
doc: doc2,
|
|
44864
44864
|
flowCollectionPadding: opt.flowCollectionPadding ? " " : "",
|
|
44865
44865
|
indent: "",
|
|
44866
44866
|
indentStep: typeof opt.indent === "number" ? " ".repeat(opt.indent) : " ",
|
|
@@ -44895,8 +44895,8 @@ var require_stringify2 = __commonJS({
|
|
|
44895
44895
|
}
|
|
44896
44896
|
return tagObj;
|
|
44897
44897
|
}
|
|
44898
|
-
function stringifyProps(node, tagObj, { anchors: anchors$1, doc }) {
|
|
44899
|
-
if (!
|
|
44898
|
+
function stringifyProps(node, tagObj, { anchors: anchors$1, doc: doc2 }) {
|
|
44899
|
+
if (!doc2.directives)
|
|
44900
44900
|
return "";
|
|
44901
44901
|
const props = [];
|
|
44902
44902
|
const anchor = (identity.isScalar(node) || identity.isCollection(node)) && node.anchor;
|
|
@@ -44906,7 +44906,7 @@ var require_stringify2 = __commonJS({
|
|
|
44906
44906
|
}
|
|
44907
44907
|
const tag = node.tag ?? (tagObj.default ? null : tagObj.tag);
|
|
44908
44908
|
if (tag)
|
|
44909
|
-
props.push(
|
|
44909
|
+
props.push(doc2.directives.tagString(tag));
|
|
44910
44910
|
return props.join(" ");
|
|
44911
44911
|
}
|
|
44912
44912
|
function stringify(item, ctx, onComment, onChompKeep) {
|
|
@@ -44951,7 +44951,7 @@ var require_stringifyPair = __commonJS({
|
|
|
44951
44951
|
var stringify = require_stringify2();
|
|
44952
44952
|
var stringifyComment = require_stringifyComment();
|
|
44953
44953
|
function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
|
44954
|
-
const { allNullValues, doc, indent, indentStep, options: { commentString, indentSeq, simpleKeys } } = ctx;
|
|
44954
|
+
const { allNullValues, doc: doc2, indent, indentStep, options: { commentString, indentSeq, simpleKeys } } = ctx;
|
|
44955
44955
|
let keyComment = identity.isNode(key) && key.comment || null;
|
|
44956
44956
|
if (simpleKeys) {
|
|
44957
44957
|
if (keyComment) {
|
|
@@ -45012,7 +45012,7 @@ ${indent}:`;
|
|
|
45012
45012
|
vcb = null;
|
|
45013
45013
|
valueComment = null;
|
|
45014
45014
|
if (value && typeof value === "object")
|
|
45015
|
-
value =
|
|
45015
|
+
value = doc2.createNode(value);
|
|
45016
45016
|
}
|
|
45017
45017
|
ctx.implicitKey = false;
|
|
45018
45018
|
if (!explicitKey && !keyComment && identity.isScalar(value))
|
|
@@ -45784,9 +45784,9 @@ var require_stringifyNumber = __commonJS({
|
|
|
45784
45784
|
function stringifyNumber({ format, minFractionDigits, tag, value }) {
|
|
45785
45785
|
if (typeof value === "bigint")
|
|
45786
45786
|
return String(value);
|
|
45787
|
-
const
|
|
45788
|
-
if (!isFinite(
|
|
45789
|
-
return isNaN(
|
|
45787
|
+
const num2 = typeof value === "number" ? value : Number(value);
|
|
45788
|
+
if (!isFinite(num2))
|
|
45789
|
+
return isNaN(num2) ? ".nan" : num2 < 0 ? "-.inf" : ".inf";
|
|
45790
45790
|
let n = Object.is(value, -0) ? "-0" : JSON.stringify(value);
|
|
45791
45791
|
if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^-?\d/.test(n) && !n.includes("e")) {
|
|
45792
45792
|
let i = n.indexOf(".");
|
|
@@ -45826,8 +45826,8 @@ var require_float = __commonJS({
|
|
|
45826
45826
|
test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
|
|
45827
45827
|
resolve: (str) => parseFloat(str),
|
|
45828
45828
|
stringify(node) {
|
|
45829
|
-
const
|
|
45830
|
-
return isFinite(
|
|
45829
|
+
const num2 = Number(node.value);
|
|
45830
|
+
return isFinite(num2) ? num2.toExponential() : stringifyNumber.stringifyNumber(node);
|
|
45831
45831
|
}
|
|
45832
45832
|
};
|
|
45833
45833
|
var float = {
|
|
@@ -46266,8 +46266,8 @@ var require_float2 = __commonJS({
|
|
|
46266
46266
|
test: /^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,
|
|
46267
46267
|
resolve: (str) => parseFloat(str.replace(/_/g, "")),
|
|
46268
46268
|
stringify(node) {
|
|
46269
|
-
const
|
|
46270
|
-
return isFinite(
|
|
46269
|
+
const num2 = Number(node.value);
|
|
46270
|
+
return isFinite(num2) ? num2.toExponential() : stringifyNumber.stringifyNumber(node);
|
|
46271
46271
|
}
|
|
46272
46272
|
};
|
|
46273
46273
|
var float = {
|
|
@@ -46469,23 +46469,23 @@ var require_timestamp2 = __commonJS({
|
|
|
46469
46469
|
function parseSexagesimal(str, asBigInt) {
|
|
46470
46470
|
const sign = str[0];
|
|
46471
46471
|
const parts = sign === "-" || sign === "+" ? str.substring(1) : str;
|
|
46472
|
-
const
|
|
46473
|
-
const res = parts.replace(/_/g, "").split(":").reduce((res2, p) => res2 *
|
|
46474
|
-
return sign === "-" ?
|
|
46472
|
+
const num2 = (n) => asBigInt ? BigInt(n) : Number(n);
|
|
46473
|
+
const res = parts.replace(/_/g, "").split(":").reduce((res2, p) => res2 * num2(60) + num2(p), num2(0));
|
|
46474
|
+
return sign === "-" ? num2(-1) * res : res;
|
|
46475
46475
|
}
|
|
46476
46476
|
function stringifySexagesimal(node) {
|
|
46477
46477
|
let { value } = node;
|
|
46478
|
-
let
|
|
46478
|
+
let num2 = (n) => n;
|
|
46479
46479
|
if (typeof value === "bigint")
|
|
46480
|
-
|
|
46480
|
+
num2 = (n) => BigInt(n);
|
|
46481
46481
|
else if (isNaN(value) || !isFinite(value))
|
|
46482
46482
|
return stringifyNumber.stringifyNumber(node);
|
|
46483
46483
|
let sign = "";
|
|
46484
46484
|
if (value < 0) {
|
|
46485
46485
|
sign = "-";
|
|
46486
|
-
value *=
|
|
46486
|
+
value *= num2(-1);
|
|
46487
46487
|
}
|
|
46488
|
-
const _60 =
|
|
46488
|
+
const _60 = num2(60);
|
|
46489
46489
|
const parts = [value % _60];
|
|
46490
46490
|
if (value < 60) {
|
|
46491
46491
|
parts.unshift(0);
|
|
@@ -46726,42 +46726,42 @@ var require_stringifyDocument = __commonJS({
|
|
|
46726
46726
|
var identity = require_identity();
|
|
46727
46727
|
var stringify = require_stringify2();
|
|
46728
46728
|
var stringifyComment = require_stringifyComment();
|
|
46729
|
-
function stringifyDocument(
|
|
46729
|
+
function stringifyDocument(doc2, options) {
|
|
46730
46730
|
const lines = [];
|
|
46731
46731
|
let hasDirectives = options.directives === true;
|
|
46732
|
-
if (options.directives !== false &&
|
|
46733
|
-
const dir =
|
|
46732
|
+
if (options.directives !== false && doc2.directives) {
|
|
46733
|
+
const dir = doc2.directives.toString(doc2);
|
|
46734
46734
|
if (dir) {
|
|
46735
46735
|
lines.push(dir);
|
|
46736
46736
|
hasDirectives = true;
|
|
46737
|
-
} else if (
|
|
46737
|
+
} else if (doc2.directives.docStart)
|
|
46738
46738
|
hasDirectives = true;
|
|
46739
46739
|
}
|
|
46740
46740
|
if (hasDirectives)
|
|
46741
46741
|
lines.push("---");
|
|
46742
|
-
const ctx = stringify.createStringifyContext(
|
|
46742
|
+
const ctx = stringify.createStringifyContext(doc2, options);
|
|
46743
46743
|
const { commentString } = ctx.options;
|
|
46744
|
-
if (
|
|
46744
|
+
if (doc2.commentBefore) {
|
|
46745
46745
|
if (lines.length !== 1)
|
|
46746
46746
|
lines.unshift("");
|
|
46747
|
-
const cs = commentString(
|
|
46747
|
+
const cs = commentString(doc2.commentBefore);
|
|
46748
46748
|
lines.unshift(stringifyComment.indentComment(cs, ""));
|
|
46749
46749
|
}
|
|
46750
46750
|
let chompKeep = false;
|
|
46751
46751
|
let contentComment = null;
|
|
46752
|
-
if (
|
|
46753
|
-
if (identity.isNode(
|
|
46754
|
-
if (
|
|
46752
|
+
if (doc2.contents) {
|
|
46753
|
+
if (identity.isNode(doc2.contents)) {
|
|
46754
|
+
if (doc2.contents.spaceBefore && hasDirectives)
|
|
46755
46755
|
lines.push("");
|
|
46756
|
-
if (
|
|
46757
|
-
const cs = commentString(
|
|
46756
|
+
if (doc2.contents.commentBefore) {
|
|
46757
|
+
const cs = commentString(doc2.contents.commentBefore);
|
|
46758
46758
|
lines.push(stringifyComment.indentComment(cs, ""));
|
|
46759
46759
|
}
|
|
46760
|
-
ctx.forceBlockIndent = !!
|
|
46761
|
-
contentComment =
|
|
46760
|
+
ctx.forceBlockIndent = !!doc2.comment;
|
|
46761
|
+
contentComment = doc2.contents.comment;
|
|
46762
46762
|
}
|
|
46763
46763
|
const onChompKeep = contentComment ? void 0 : () => chompKeep = true;
|
|
46764
|
-
let body = stringify.stringify(
|
|
46764
|
+
let body = stringify.stringify(doc2.contents, ctx, () => contentComment = null, onChompKeep);
|
|
46765
46765
|
if (contentComment)
|
|
46766
46766
|
body += stringifyComment.lineComment(body, "", commentString(contentComment));
|
|
46767
46767
|
if ((body[0] === "|" || body[0] === ">") && lines[lines.length - 1] === "---") {
|
|
@@ -46769,11 +46769,11 @@ var require_stringifyDocument = __commonJS({
|
|
|
46769
46769
|
} else
|
|
46770
46770
|
lines.push(body);
|
|
46771
46771
|
} else {
|
|
46772
|
-
lines.push(stringify.stringify(
|
|
46772
|
+
lines.push(stringify.stringify(doc2.contents, ctx));
|
|
46773
46773
|
}
|
|
46774
|
-
if (
|
|
46775
|
-
if (
|
|
46776
|
-
const cs = commentString(
|
|
46774
|
+
if (doc2.directives?.docEnd) {
|
|
46775
|
+
if (doc2.comment) {
|
|
46776
|
+
const cs = commentString(doc2.comment);
|
|
46777
46777
|
if (cs.includes("\n")) {
|
|
46778
46778
|
lines.push("...");
|
|
46779
46779
|
lines.push(stringifyComment.indentComment(cs, ""));
|
|
@@ -46784,7 +46784,7 @@ var require_stringifyDocument = __commonJS({
|
|
|
46784
46784
|
lines.push("...");
|
|
46785
46785
|
}
|
|
46786
46786
|
} else {
|
|
46787
|
-
let dc =
|
|
46787
|
+
let dc = doc2.comment;
|
|
46788
46788
|
if (dc && chompKeep)
|
|
46789
46789
|
dc = dc.replace(/^\n+/, "");
|
|
46790
46790
|
if (dc) {
|
|
@@ -48474,13 +48474,13 @@ var require_compose_doc = __commonJS({
|
|
|
48474
48474
|
var resolveProps = require_resolve_props();
|
|
48475
48475
|
function composeDoc(options, directives, { offset, start, value, end }, onError) {
|
|
48476
48476
|
const opts = Object.assign({ _directives: directives }, options);
|
|
48477
|
-
const
|
|
48477
|
+
const doc2 = new Document.Document(void 0, opts);
|
|
48478
48478
|
const ctx = {
|
|
48479
48479
|
atKey: false,
|
|
48480
48480
|
atRoot: true,
|
|
48481
|
-
directives:
|
|
48482
|
-
options:
|
|
48483
|
-
schema:
|
|
48481
|
+
directives: doc2.directives,
|
|
48482
|
+
options: doc2.options,
|
|
48483
|
+
schema: doc2.schema
|
|
48484
48484
|
};
|
|
48485
48485
|
const props = resolveProps.resolveProps(start, {
|
|
48486
48486
|
indicator: "doc-start",
|
|
@@ -48491,17 +48491,17 @@ var require_compose_doc = __commonJS({
|
|
|
48491
48491
|
startOnNewline: true
|
|
48492
48492
|
});
|
|
48493
48493
|
if (props.found) {
|
|
48494
|
-
|
|
48494
|
+
doc2.directives.docStart = true;
|
|
48495
48495
|
if (value && (value.type === "block-map" || value.type === "block-seq") && !props.hasNewline)
|
|
48496
48496
|
onError(props.end, "MISSING_CHAR", "Block collection cannot start on same line with directives-end marker");
|
|
48497
48497
|
}
|
|
48498
|
-
|
|
48499
|
-
const contentEnd =
|
|
48498
|
+
doc2.contents = value ? composeNode.composeNode(ctx, value, props, onError) : composeNode.composeEmptyNode(ctx, props.end, start, null, props, onError);
|
|
48499
|
+
const contentEnd = doc2.contents.range[2];
|
|
48500
48500
|
const re = resolveEnd.resolveEnd(end, contentEnd, false, onError);
|
|
48501
48501
|
if (re.comment)
|
|
48502
|
-
|
|
48503
|
-
|
|
48504
|
-
return
|
|
48502
|
+
doc2.comment = re.comment;
|
|
48503
|
+
doc2.range = [offset, contentEnd, re.offset];
|
|
48504
|
+
return doc2;
|
|
48505
48505
|
}
|
|
48506
48506
|
exports2.composeDoc = composeDoc;
|
|
48507
48507
|
}
|
|
@@ -48568,15 +48568,15 @@ var require_composer = __commonJS({
|
|
|
48568
48568
|
this.directives = new directives.Directives({ version: options.version || "1.2" });
|
|
48569
48569
|
this.options = options;
|
|
48570
48570
|
}
|
|
48571
|
-
decorate(
|
|
48571
|
+
decorate(doc2, afterDoc) {
|
|
48572
48572
|
const { comment, afterEmptyLine } = parsePrelude(this.prelude);
|
|
48573
48573
|
if (comment) {
|
|
48574
|
-
const dc =
|
|
48574
|
+
const dc = doc2.contents;
|
|
48575
48575
|
if (afterDoc) {
|
|
48576
|
-
|
|
48576
|
+
doc2.comment = doc2.comment ? `${doc2.comment}
|
|
48577
48577
|
${comment}` : comment;
|
|
48578
|
-
} else if (afterEmptyLine ||
|
|
48579
|
-
|
|
48578
|
+
} else if (afterEmptyLine || doc2.directives.docStart || !dc) {
|
|
48579
|
+
doc2.commentBefore = comment;
|
|
48580
48580
|
} else if (identity.isCollection(dc) && !dc.flow && dc.items.length > 0) {
|
|
48581
48581
|
let it = dc.items[0];
|
|
48582
48582
|
if (identity.isPair(it))
|
|
@@ -48592,12 +48592,12 @@ ${cb}` : comment;
|
|
|
48592
48592
|
}
|
|
48593
48593
|
if (afterDoc) {
|
|
48594
48594
|
for (let i = 0; i < this.errors.length; ++i)
|
|
48595
|
-
|
|
48595
|
+
doc2.errors.push(this.errors[i]);
|
|
48596
48596
|
for (let i = 0; i < this.warnings.length; ++i)
|
|
48597
|
-
|
|
48597
|
+
doc2.warnings.push(this.warnings[i]);
|
|
48598
48598
|
} else {
|
|
48599
|
-
|
|
48600
|
-
|
|
48599
|
+
doc2.errors = this.errors;
|
|
48600
|
+
doc2.warnings = this.warnings;
|
|
48601
48601
|
}
|
|
48602
48602
|
this.prelude = [];
|
|
48603
48603
|
this.errors = [];
|
|
@@ -48642,13 +48642,13 @@ ${cb}` : comment;
|
|
|
48642
48642
|
this.atDirectives = true;
|
|
48643
48643
|
break;
|
|
48644
48644
|
case "document": {
|
|
48645
|
-
const
|
|
48646
|
-
if (this.atDirectives && !
|
|
48645
|
+
const doc2 = composeDoc.composeDoc(this.options, this.directives, token, this.onError);
|
|
48646
|
+
if (this.atDirectives && !doc2.directives.docStart)
|
|
48647
48647
|
this.onError(token, "MISSING_CHAR", "Missing directives-end/doc-start indicator line");
|
|
48648
|
-
this.decorate(
|
|
48648
|
+
this.decorate(doc2, false);
|
|
48649
48649
|
if (this.doc)
|
|
48650
48650
|
yield this.doc;
|
|
48651
|
-
this.doc =
|
|
48651
|
+
this.doc = doc2;
|
|
48652
48652
|
this.atDirectives = false;
|
|
48653
48653
|
break;
|
|
48654
48654
|
}
|
|
@@ -48702,12 +48702,12 @@ ${end.comment}` : end.comment;
|
|
|
48702
48702
|
this.doc = null;
|
|
48703
48703
|
} else if (forceDoc) {
|
|
48704
48704
|
const opts = Object.assign({ _directives: this.directives }, this.options);
|
|
48705
|
-
const
|
|
48705
|
+
const doc2 = new Document.Document(void 0, opts);
|
|
48706
48706
|
if (this.atDirectives)
|
|
48707
48707
|
this.onError(endOffset, "MISSING_CHAR", "Missing directives-end indicator line");
|
|
48708
|
-
|
|
48709
|
-
this.decorate(
|
|
48710
|
-
yield
|
|
48708
|
+
doc2.range = [0, endOffset, endOffset];
|
|
48709
|
+
this.decorate(doc2, false);
|
|
48710
|
+
yield doc2;
|
|
48711
48711
|
}
|
|
48712
48712
|
}
|
|
48713
48713
|
};
|
|
@@ -50064,14 +50064,14 @@ var require_parser = __commonJS({
|
|
|
50064
50064
|
return;
|
|
50065
50065
|
case "doc-mode":
|
|
50066
50066
|
case "doc-start": {
|
|
50067
|
-
const
|
|
50067
|
+
const doc2 = {
|
|
50068
50068
|
type: "document",
|
|
50069
50069
|
offset: this.offset,
|
|
50070
50070
|
start: []
|
|
50071
50071
|
};
|
|
50072
50072
|
if (this.type === "doc-start")
|
|
50073
|
-
|
|
50074
|
-
this.stack.push(
|
|
50073
|
+
doc2.start.push(this.sourceToken);
|
|
50074
|
+
this.stack.push(doc2);
|
|
50075
50075
|
return;
|
|
50076
50076
|
}
|
|
50077
50077
|
}
|
|
@@ -50082,16 +50082,16 @@ var require_parser = __commonJS({
|
|
|
50082
50082
|
source: this.source
|
|
50083
50083
|
};
|
|
50084
50084
|
}
|
|
50085
|
-
*document(
|
|
50086
|
-
if (
|
|
50087
|
-
return yield* this.lineEnd(
|
|
50085
|
+
*document(doc2) {
|
|
50086
|
+
if (doc2.value)
|
|
50087
|
+
return yield* this.lineEnd(doc2);
|
|
50088
50088
|
switch (this.type) {
|
|
50089
50089
|
case "doc-start": {
|
|
50090
|
-
if (findNonEmptyIndex(
|
|
50090
|
+
if (findNonEmptyIndex(doc2.start) !== -1) {
|
|
50091
50091
|
yield* this.pop();
|
|
50092
50092
|
yield* this.step();
|
|
50093
50093
|
} else
|
|
50094
|
-
|
|
50094
|
+
doc2.start.push(this.sourceToken);
|
|
50095
50095
|
return;
|
|
50096
50096
|
}
|
|
50097
50097
|
case "anchor":
|
|
@@ -50099,10 +50099,10 @@ var require_parser = __commonJS({
|
|
|
50099
50099
|
case "space":
|
|
50100
50100
|
case "comment":
|
|
50101
50101
|
case "newline":
|
|
50102
|
-
|
|
50102
|
+
doc2.start.push(this.sourceToken);
|
|
50103
50103
|
return;
|
|
50104
50104
|
}
|
|
50105
|
-
const bv = this.startBlockValue(
|
|
50105
|
+
const bv = this.startBlockValue(doc2);
|
|
50106
50106
|
if (bv)
|
|
50107
50107
|
this.stack.push(bv);
|
|
50108
50108
|
else {
|
|
@@ -50641,9 +50641,9 @@ var require_public_api = __commonJS({
|
|
|
50641
50641
|
const composer$1 = new composer.Composer(options);
|
|
50642
50642
|
const docs = Array.from(composer$1.compose(parser$1.parse(source)));
|
|
50643
50643
|
if (prettyErrors && lineCounter2)
|
|
50644
|
-
for (const
|
|
50645
|
-
|
|
50646
|
-
|
|
50644
|
+
for (const doc2 of docs) {
|
|
50645
|
+
doc2.errors.forEach(errors.prettifyError(source, lineCounter2));
|
|
50646
|
+
doc2.warnings.forEach(errors.prettifyError(source, lineCounter2));
|
|
50647
50647
|
}
|
|
50648
50648
|
if (docs.length > 0)
|
|
50649
50649
|
return docs;
|
|
@@ -50653,20 +50653,20 @@ var require_public_api = __commonJS({
|
|
|
50653
50653
|
const { lineCounter: lineCounter2, prettyErrors } = parseOptions(options);
|
|
50654
50654
|
const parser$1 = new parser.Parser(lineCounter2?.addNewLine);
|
|
50655
50655
|
const composer$1 = new composer.Composer(options);
|
|
50656
|
-
let
|
|
50656
|
+
let doc2 = null;
|
|
50657
50657
|
for (const _doc of composer$1.compose(parser$1.parse(source), true, source.length)) {
|
|
50658
|
-
if (!
|
|
50659
|
-
|
|
50660
|
-
else if (
|
|
50661
|
-
|
|
50658
|
+
if (!doc2)
|
|
50659
|
+
doc2 = _doc;
|
|
50660
|
+
else if (doc2.options.logLevel !== "silent") {
|
|
50661
|
+
doc2.errors.push(new errors.YAMLParseError(_doc.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
|
|
50662
50662
|
break;
|
|
50663
50663
|
}
|
|
50664
50664
|
}
|
|
50665
50665
|
if (prettyErrors && lineCounter2) {
|
|
50666
|
-
|
|
50667
|
-
|
|
50666
|
+
doc2.errors.forEach(errors.prettifyError(source, lineCounter2));
|
|
50667
|
+
doc2.warnings.forEach(errors.prettifyError(source, lineCounter2));
|
|
50668
50668
|
}
|
|
50669
|
-
return
|
|
50669
|
+
return doc2;
|
|
50670
50670
|
}
|
|
50671
50671
|
function parse(src, reviver, options) {
|
|
50672
50672
|
let _reviver = void 0;
|
|
@@ -50675,17 +50675,17 @@ var require_public_api = __commonJS({
|
|
|
50675
50675
|
} else if (options === void 0 && reviver && typeof reviver === "object") {
|
|
50676
50676
|
options = reviver;
|
|
50677
50677
|
}
|
|
50678
|
-
const
|
|
50679
|
-
if (!
|
|
50678
|
+
const doc2 = parseDocument2(src, options);
|
|
50679
|
+
if (!doc2)
|
|
50680
50680
|
return null;
|
|
50681
|
-
|
|
50682
|
-
if (
|
|
50683
|
-
if (
|
|
50684
|
-
throw
|
|
50681
|
+
doc2.warnings.forEach((warning) => log2.warn(doc2.options.logLevel, warning));
|
|
50682
|
+
if (doc2.errors.length > 0) {
|
|
50683
|
+
if (doc2.options.logLevel !== "silent")
|
|
50684
|
+
throw doc2.errors[0];
|
|
50685
50685
|
else
|
|
50686
|
-
|
|
50686
|
+
doc2.errors = [];
|
|
50687
50687
|
}
|
|
50688
|
-
return
|
|
50688
|
+
return doc2.toJS(Object.assign({ reviver: _reviver }, options));
|
|
50689
50689
|
}
|
|
50690
50690
|
function stringify(value, replacer, options) {
|
|
50691
50691
|
let _replacer = null;
|
|
@@ -50827,9 +50827,9 @@ var import_node_readline2 = require("node:readline");
|
|
|
50827
50827
|
|
|
50828
50828
|
// index.ts
|
|
50829
50829
|
var import_node_url3 = require("node:url");
|
|
50830
|
-
var
|
|
50831
|
-
var
|
|
50832
|
-
var
|
|
50830
|
+
var import_node_path23 = require("node:path");
|
|
50831
|
+
var import_node_os17 = require("node:os");
|
|
50832
|
+
var import_node_fs24 = require("node:fs");
|
|
50833
50833
|
var import_node_child_process6 = require("node:child_process");
|
|
50834
50834
|
|
|
50835
50835
|
// log.mjs
|
|
@@ -51078,13 +51078,13 @@ function readCommandSpec(agent, command, agentsDir = AGENTS_DIR) {
|
|
|
51078
51078
|
if (!safe(agent) || !safe(command)) return null;
|
|
51079
51079
|
const manifestPath = (0, import_node_path2.join)(agentsDir, agent, "manifest.yaml");
|
|
51080
51080
|
if (!(0, import_node_fs3.existsSync)(manifestPath)) return null;
|
|
51081
|
-
let
|
|
51081
|
+
let doc2;
|
|
51082
51082
|
try {
|
|
51083
|
-
|
|
51083
|
+
doc2 = asRecord((0, import_yaml.parse)((0, import_node_fs3.readFileSync)(manifestPath, "utf8")));
|
|
51084
51084
|
} catch {
|
|
51085
51085
|
return null;
|
|
51086
51086
|
}
|
|
51087
|
-
const cmd = asRecord(asRecord(
|
|
51087
|
+
const cmd = asRecord(asRecord(doc2.commands)[command]);
|
|
51088
51088
|
if (Object.keys(cmd).length === 0) return null;
|
|
51089
51089
|
const lifecycle = typeof cmd.lifecycle === "string" ? cmd.lifecycle : "single";
|
|
51090
51090
|
const streaming = asRecord(cmd.outputs).type === "stream";
|
|
@@ -51123,13 +51123,13 @@ function readNodeSkill(agent, command, agentsDir = AGENTS_DIR) {
|
|
|
51123
51123
|
if (!safe(agent) || !safe(command)) return null;
|
|
51124
51124
|
const manifestPath = (0, import_node_path2.join)(agentsDir, agent, "manifest.yaml");
|
|
51125
51125
|
if (!(0, import_node_fs3.existsSync)(manifestPath)) return null;
|
|
51126
|
-
let
|
|
51126
|
+
let doc2;
|
|
51127
51127
|
try {
|
|
51128
|
-
|
|
51128
|
+
doc2 = asRecord((0, import_yaml.parse)((0, import_node_fs3.readFileSync)(manifestPath, "utf8")));
|
|
51129
51129
|
} catch {
|
|
51130
51130
|
return null;
|
|
51131
51131
|
}
|
|
51132
|
-
const cmd = asRecord(asRecord(
|
|
51132
|
+
const cmd = asRecord(asRecord(doc2.commands)[command]);
|
|
51133
51133
|
if (Object.keys(cmd).length === 0) return null;
|
|
51134
51134
|
const outRec = asRecord(cmd.outputs);
|
|
51135
51135
|
const outputs = typeof outRec.type === "string" ? {
|
|
@@ -51140,10 +51140,10 @@ function readNodeSkill(agent, command, agentsDir = AGENTS_DIR) {
|
|
|
51140
51140
|
} : null;
|
|
51141
51141
|
return {
|
|
51142
51142
|
agent,
|
|
51143
|
-
agentDisplayName: typeof
|
|
51144
|
-
agentDescription: firstParagraph(
|
|
51145
|
-
homepage: typeof
|
|
51146
|
-
capabilities: Object.keys(asRecord(
|
|
51143
|
+
agentDisplayName: typeof doc2["display-name"] === "string" ? doc2["display-name"] : agent,
|
|
51144
|
+
agentDescription: firstParagraph(doc2.description),
|
|
51145
|
+
homepage: typeof doc2.homepage === "string" ? doc2.homepage : null,
|
|
51146
|
+
capabilities: Object.keys(asRecord(doc2.requires)),
|
|
51147
51147
|
command,
|
|
51148
51148
|
commandDescription: firstParagraph(cmd.description),
|
|
51149
51149
|
inputs: parseManifestInputs(cmd.inputs),
|
|
@@ -51165,8 +51165,8 @@ function credentialStatus(secret) {
|
|
|
51165
51165
|
const file = (0, import_node_path2.join)(CREDENTIALS_DIR, `${secret}.json`);
|
|
51166
51166
|
if (!(0, import_node_fs3.existsSync)(file)) return { status: "disconnected", expiresAt: null };
|
|
51167
51167
|
try {
|
|
51168
|
-
const
|
|
51169
|
-
const raw =
|
|
51168
|
+
const doc2 = JSON.parse((0, import_node_fs3.readFileSync)(file, "utf8"));
|
|
51169
|
+
const raw = doc2["expires_at"] ?? doc2["expiresAt"] ?? doc2["expiry"];
|
|
51170
51170
|
if (raw != null) {
|
|
51171
51171
|
const ms = typeof raw === "number" ? raw * (raw < 1e12 ? 1e3 : 1) : Date.parse(String(raw));
|
|
51172
51172
|
if (!Number.isNaN(ms)) {
|
|
@@ -51188,13 +51188,13 @@ function listIntegrations() {
|
|
|
51188
51188
|
if (!(0, import_node_fs3.existsSync)(manifestPath)) continue;
|
|
51189
51189
|
const manifestText = (0, import_node_fs3.readFileSync)(manifestPath, "utf8");
|
|
51190
51190
|
if (!manifestText.includes("secrets:")) continue;
|
|
51191
|
-
let
|
|
51191
|
+
let doc2;
|
|
51192
51192
|
try {
|
|
51193
|
-
|
|
51193
|
+
doc2 = asRecord((0, import_yaml.parse)(manifestText));
|
|
51194
51194
|
} catch {
|
|
51195
51195
|
continue;
|
|
51196
51196
|
}
|
|
51197
|
-
const requires = asRecord(
|
|
51197
|
+
const requires = asRecord(doc2.requires);
|
|
51198
51198
|
const secrets = Array.isArray(requires.secrets) ? requires.secrets.map(String) : [];
|
|
51199
51199
|
if (!secrets.length) continue;
|
|
51200
51200
|
const network = Array.isArray(requires.network) ? requires.network.map(String) : [];
|
|
@@ -51203,8 +51203,8 @@ function listIntegrations() {
|
|
|
51203
51203
|
seen.add(secret);
|
|
51204
51204
|
out.push({
|
|
51205
51205
|
id: secret,
|
|
51206
|
-
name: typeof
|
|
51207
|
-
vendor: typeof
|
|
51206
|
+
name: typeof doc2["display-name"] === "string" ? doc2["display-name"] : agentId,
|
|
51207
|
+
vendor: typeof doc2.vendor === "string" ? doc2.vendor : null,
|
|
51208
51208
|
agent: agentId,
|
|
51209
51209
|
network,
|
|
51210
51210
|
...credentialStatus(secret)
|
|
@@ -52073,14 +52073,11 @@ var import_node_path4 = require("node:path");
|
|
|
52073
52073
|
var ROOT = process.env.FLOLESS_HOME ?? (0, import_node_path4.join)((0, import_node_os4.homedir)(), ".floless");
|
|
52074
52074
|
var uiDir = (0, import_node_path4.join)(ROOT, "ui");
|
|
52075
52075
|
var extensionsFile = (0, import_node_path4.join)(uiDir, "extensions.json");
|
|
52076
|
-
var
|
|
52076
|
+
var TIMELINE_FILE = (0, import_node_path4.join)(uiDir, "timeline.json");
|
|
52077
52077
|
var HISTORY_KEEP = 20;
|
|
52078
52078
|
function ensureUiDir() {
|
|
52079
52079
|
if (!(0, import_node_fs5.existsSync)(uiDir)) (0, import_node_fs5.mkdirSync)(uiDir, { recursive: true });
|
|
52080
52080
|
}
|
|
52081
|
-
function ensureHistoryDir() {
|
|
52082
|
-
if (!(0, import_node_fs5.existsSync)(HISTORY_DIR)) (0, import_node_fs5.mkdirSync)(HISTORY_DIR, { recursive: true });
|
|
52083
|
-
}
|
|
52084
52081
|
function readExtensionsText() {
|
|
52085
52082
|
try {
|
|
52086
52083
|
return (0, import_node_fs5.readFileSync)(extensionsFile, "utf8");
|
|
@@ -52103,6 +52100,7 @@ function descriptorPanels(d) {
|
|
|
52103
52100
|
return d.panels.filter((p) => !!p && typeof p === "object" && !Array.isArray(p));
|
|
52104
52101
|
}
|
|
52105
52102
|
function panelsCountOf(text) {
|
|
52103
|
+
if (text === null) return 0;
|
|
52106
52104
|
try {
|
|
52107
52105
|
const parsed = JSON.parse(text);
|
|
52108
52106
|
return parsed && typeof parsed === "object" && Array.isArray(parsed.panels) ? parsed.panels.length : 0;
|
|
@@ -52110,69 +52108,35 @@ function panelsCountOf(text) {
|
|
|
52110
52108
|
return 0;
|
|
52111
52109
|
}
|
|
52112
52110
|
}
|
|
52113
|
-
function
|
|
52114
|
-
|
|
52115
|
-
let name = `${base}.json`;
|
|
52116
|
-
for (let i = 2; (0, import_node_fs5.existsSync)((0, import_node_path4.join)(HISTORY_DIR, name)); i++) name = `${base}-${i}.json`;
|
|
52117
|
-
return name;
|
|
52118
|
-
}
|
|
52119
|
-
function timestampFromName(file) {
|
|
52120
|
-
const m = /^(\d{4}-\d{2}-\d{2})T(\d{2})-(\d{2})-(\d{2})-(\d{3})Z(?:-\d+)?\.json$/.exec(file);
|
|
52121
|
-
return m ? `${m[1]}T${m[2]}:${m[3]}:${m[4]}.${m[5]}Z` : null;
|
|
52122
|
-
}
|
|
52123
|
-
function historyFiles() {
|
|
52124
|
-
if (!(0, import_node_fs5.existsSync)(HISTORY_DIR)) return [];
|
|
52111
|
+
function loadTimeline() {
|
|
52112
|
+
let text;
|
|
52125
52113
|
try {
|
|
52126
|
-
|
|
52114
|
+
text = (0, import_node_fs5.readFileSync)(TIMELINE_FILE, "utf8");
|
|
52127
52115
|
} catch {
|
|
52128
|
-
return [];
|
|
52129
|
-
}
|
|
52130
|
-
}
|
|
52131
|
-
function pruneHistory() {
|
|
52132
|
-
const files = historyFiles();
|
|
52133
|
-
for (const f of files.slice(0, Math.max(0, files.length - HISTORY_KEEP))) {
|
|
52134
|
-
try {
|
|
52135
|
-
(0, import_node_fs5.rmSync)((0, import_node_path4.join)(HISTORY_DIR, f));
|
|
52136
|
-
} catch {
|
|
52137
|
-
}
|
|
52116
|
+
return { cursor: -1, entries: [] };
|
|
52138
52117
|
}
|
|
52139
|
-
|
|
52140
|
-
|
|
52141
|
-
|
|
52142
|
-
|
|
52143
|
-
|
|
52144
|
-
|
|
52145
|
-
|
|
52146
|
-
|
|
52147
|
-
|
|
52148
|
-
|
|
52149
|
-
|
|
52118
|
+
try {
|
|
52119
|
+
const parsed = JSON.parse(text);
|
|
52120
|
+
if (!parsed || typeof parsed !== "object") return { cursor: -1, entries: [] };
|
|
52121
|
+
const p = parsed;
|
|
52122
|
+
const rawEntries = Array.isArray(p.entries) ? p.entries : [];
|
|
52123
|
+
const entries = rawEntries.filter((e) => !!e && typeof e === "object").map((e) => ({
|
|
52124
|
+
content: typeof e.content === "string" ? e.content : null,
|
|
52125
|
+
ts: typeof e.ts === "string" ? e.ts : ""
|
|
52126
|
+
}));
|
|
52127
|
+
let cursor = typeof p.cursor === "number" && Number.isInteger(p.cursor) ? p.cursor : entries.length - 1;
|
|
52128
|
+
if (entries.length === 0) cursor = -1;
|
|
52129
|
+
else cursor = Math.max(0, Math.min(cursor, entries.length - 1));
|
|
52130
|
+
return { cursor, entries };
|
|
52131
|
+
} catch {
|
|
52132
|
+
return { cursor: -1, entries: [] };
|
|
52150
52133
|
}
|
|
52151
|
-
ensureHistoryDir();
|
|
52152
|
-
const path = (0, import_node_path4.join)(HISTORY_DIR, historyFileName(/* @__PURE__ */ new Date()));
|
|
52153
|
-
const tmp = `${path}.${process.pid}.tmp`;
|
|
52154
|
-
(0, import_node_fs5.writeFileSync)(tmp, text);
|
|
52155
|
-
(0, import_node_fs5.renameSync)(tmp, path);
|
|
52156
|
-
pruneHistory();
|
|
52157
|
-
return path;
|
|
52158
52134
|
}
|
|
52159
|
-
function
|
|
52160
|
-
|
|
52161
|
-
|
|
52162
|
-
|
|
52163
|
-
|
|
52164
|
-
ts = (0, import_node_fs5.statSync)((0, import_node_path4.join)(HISTORY_DIR, f)).mtime.toISOString();
|
|
52165
|
-
} catch {
|
|
52166
|
-
ts = "";
|
|
52167
|
-
}
|
|
52168
|
-
}
|
|
52169
|
-
let count = 0;
|
|
52170
|
-
try {
|
|
52171
|
-
count = panelsCountOf((0, import_node_fs5.readFileSync)((0, import_node_path4.join)(HISTORY_DIR, f), "utf8"));
|
|
52172
|
-
} catch {
|
|
52173
|
-
}
|
|
52174
|
-
return { timestamp: ts ?? "", panelsCount: count };
|
|
52175
|
-
});
|
|
52135
|
+
function saveTimeline(t) {
|
|
52136
|
+
ensureUiDir();
|
|
52137
|
+
const tmp = `${TIMELINE_FILE}.${process.pid}.tmp`;
|
|
52138
|
+
(0, import_node_fs5.writeFileSync)(tmp, JSON.stringify(t, null, 2));
|
|
52139
|
+
(0, import_node_fs5.renameSync)(tmp, TIMELINE_FILE);
|
|
52176
52140
|
}
|
|
52177
52141
|
function writeExtensionsText(text) {
|
|
52178
52142
|
ensureUiDir();
|
|
@@ -52180,34 +52144,96 @@ function writeExtensionsText(text) {
|
|
|
52180
52144
|
(0, import_node_fs5.writeFileSync)(tmp, text);
|
|
52181
52145
|
(0, import_node_fs5.renameSync)(tmp, extensionsFile);
|
|
52182
52146
|
}
|
|
52183
|
-
function
|
|
52184
|
-
|
|
52185
|
-
const files = historyFiles().reverse();
|
|
52186
|
-
let target = null;
|
|
52187
|
-
for (const f of files) {
|
|
52147
|
+
function applyState(entry2) {
|
|
52148
|
+
if (entry2.content === null) {
|
|
52188
52149
|
try {
|
|
52189
|
-
|
|
52190
|
-
if (text !== current) {
|
|
52191
|
-
target = text;
|
|
52192
|
-
break;
|
|
52193
|
-
}
|
|
52150
|
+
(0, import_node_fs5.rmSync)(extensionsFile);
|
|
52194
52151
|
} catch {
|
|
52195
52152
|
}
|
|
52153
|
+
} else {
|
|
52154
|
+
writeExtensionsText(entry2.content);
|
|
52155
|
+
}
|
|
52156
|
+
}
|
|
52157
|
+
function currentContent(t) {
|
|
52158
|
+
return t.cursor >= 0 && t.cursor < t.entries.length ? t.entries[t.cursor].content : null;
|
|
52159
|
+
}
|
|
52160
|
+
function seedTimeline() {
|
|
52161
|
+
const t = loadTimeline();
|
|
52162
|
+
if (t.entries.length > 0) return;
|
|
52163
|
+
saveTimeline({ cursor: 0, entries: [{ content: readExtensionsText(), ts: (/* @__PURE__ */ new Date()).toISOString() }] });
|
|
52164
|
+
}
|
|
52165
|
+
function recordChange(text) {
|
|
52166
|
+
const t = loadTimeline();
|
|
52167
|
+
if (t.entries.length === 0) {
|
|
52168
|
+
saveTimeline({ cursor: 0, entries: [{ content: text, ts: (/* @__PURE__ */ new Date()).toISOString() }] });
|
|
52169
|
+
return { recorded: true };
|
|
52170
|
+
}
|
|
52171
|
+
if (text === currentContent(t)) return { recorded: false };
|
|
52172
|
+
const entries = t.entries.slice(0, t.cursor + 1);
|
|
52173
|
+
entries.push({ content: text, ts: (/* @__PURE__ */ new Date()).toISOString() });
|
|
52174
|
+
let cursor = entries.length - 1;
|
|
52175
|
+
while (entries.length > HISTORY_KEEP) {
|
|
52176
|
+
entries.shift();
|
|
52177
|
+
cursor--;
|
|
52178
|
+
}
|
|
52179
|
+
saveTimeline({ cursor, entries });
|
|
52180
|
+
return { recorded: true };
|
|
52181
|
+
}
|
|
52182
|
+
function historyState() {
|
|
52183
|
+
const t = loadTimeline();
|
|
52184
|
+
const total = t.entries.length;
|
|
52185
|
+
return {
|
|
52186
|
+
cursor: total ? total - 1 - t.cursor : -1,
|
|
52187
|
+
// express the cursor in newest-first terms
|
|
52188
|
+
total,
|
|
52189
|
+
canUndo: t.cursor > 0,
|
|
52190
|
+
canRedo: t.cursor >= 0 && t.cursor < total - 1
|
|
52191
|
+
};
|
|
52192
|
+
}
|
|
52193
|
+
function listHistory() {
|
|
52194
|
+
const t = loadTimeline();
|
|
52195
|
+
return t.entries.map((e, i) => ({ timestamp: e.ts, panelsCount: panelsCountOf(e.content), current: i === t.cursor })).reverse();
|
|
52196
|
+
}
|
|
52197
|
+
function undoExtensions() {
|
|
52198
|
+
const t = loadTimeline();
|
|
52199
|
+
if (t.cursor <= 0) {
|
|
52200
|
+
return { restored: false, descriptor: readExtensions(), canUndo: false, canRedo: t.cursor >= 0 && t.cursor < t.entries.length - 1 };
|
|
52196
52201
|
}
|
|
52197
|
-
|
|
52198
|
-
|
|
52199
|
-
|
|
52200
|
-
return { restored: true, descriptor: readExtensions() };
|
|
52202
|
+
t.cursor -= 1;
|
|
52203
|
+
saveTimeline(t);
|
|
52204
|
+
applyState(t.entries[t.cursor]);
|
|
52205
|
+
return { restored: true, descriptor: readExtensions(), canUndo: t.cursor > 0, canRedo: true };
|
|
52206
|
+
}
|
|
52207
|
+
function redoExtensions() {
|
|
52208
|
+
const t = loadTimeline();
|
|
52209
|
+
if (t.cursor < 0 || t.cursor >= t.entries.length - 1) {
|
|
52210
|
+
return { restored: false, descriptor: readExtensions(), canUndo: t.cursor > 0, canRedo: false };
|
|
52211
|
+
}
|
|
52212
|
+
t.cursor += 1;
|
|
52213
|
+
saveTimeline(t);
|
|
52214
|
+
applyState(t.entries[t.cursor]);
|
|
52215
|
+
return { restored: true, descriptor: readExtensions(), canUndo: true, canRedo: t.cursor < t.entries.length - 1 };
|
|
52201
52216
|
}
|
|
52202
52217
|
function resetExtensions() {
|
|
52203
|
-
|
|
52204
|
-
|
|
52205
|
-
|
|
52206
|
-
|
|
52207
|
-
|
|
52208
|
-
|
|
52218
|
+
if (readExtensionsText() === null) {
|
|
52219
|
+
const st = historyState();
|
|
52220
|
+
return { reset: false, canUndo: st.canUndo, canRedo: st.canRedo };
|
|
52221
|
+
}
|
|
52222
|
+
const t = loadTimeline();
|
|
52223
|
+
if (t.entries.length === 0) {
|
|
52224
|
+
t.entries.push({ content: readExtensionsText(), ts: (/* @__PURE__ */ new Date()).toISOString() });
|
|
52225
|
+
t.cursor = 0;
|
|
52226
|
+
}
|
|
52227
|
+
const entries = t.entries.slice(0, t.cursor + 1);
|
|
52228
|
+
entries.push({ content: null, ts: (/* @__PURE__ */ new Date()).toISOString() });
|
|
52229
|
+
let cursor = entries.length - 1;
|
|
52230
|
+
while (entries.length > HISTORY_KEEP) {
|
|
52231
|
+
entries.shift();
|
|
52232
|
+
cursor--;
|
|
52209
52233
|
}
|
|
52210
|
-
|
|
52234
|
+
saveTimeline({ cursor, entries });
|
|
52235
|
+
applyState(entries[cursor]);
|
|
52236
|
+
return { reset: true, canUndo: cursor > 0, canRedo: false };
|
|
52211
52237
|
}
|
|
52212
52238
|
|
|
52213
52239
|
// ui-validation.ts
|
|
@@ -52729,7 +52755,7 @@ function appVersion() {
|
|
|
52729
52755
|
return resolveVersion({
|
|
52730
52756
|
isSea: isSea2(),
|
|
52731
52757
|
sqVersionXml: readSqVersionXml(),
|
|
52732
|
-
define: true ? "0.
|
|
52758
|
+
define: true ? "0.24.0" : void 0,
|
|
52733
52759
|
pkgVersion: readPkgVersion()
|
|
52734
52760
|
});
|
|
52735
52761
|
}
|
|
@@ -52739,7 +52765,7 @@ function resolveChannel(s) {
|
|
|
52739
52765
|
return "dev";
|
|
52740
52766
|
}
|
|
52741
52767
|
function appChannel() {
|
|
52742
|
-
return resolveChannel({ isSea: isSea2(), define: true ? "0.
|
|
52768
|
+
return resolveChannel({ isSea: isSea2(), define: true ? "0.24.0" : void 0 });
|
|
52743
52769
|
}
|
|
52744
52770
|
|
|
52745
52771
|
// oauth-presets.ts
|
|
@@ -52827,13 +52853,13 @@ function buildExposedCommands(inputs) {
|
|
|
52827
52853
|
};
|
|
52828
52854
|
}
|
|
52829
52855
|
function bakeFloSource(source, inputs) {
|
|
52830
|
-
const
|
|
52831
|
-
if (
|
|
52832
|
-
throw new Error(`bake: source is not valid YAML: ${
|
|
52856
|
+
const doc2 = (0, import_yaml2.parseDocument)(source);
|
|
52857
|
+
if (doc2.errors.length > 0) {
|
|
52858
|
+
throw new Error(`bake: source is not valid YAML: ${doc2.errors[0]?.message ?? "parse error"}`);
|
|
52833
52859
|
}
|
|
52834
|
-
|
|
52835
|
-
|
|
52836
|
-
return
|
|
52860
|
+
doc2.set("exposes-as-agent", true);
|
|
52861
|
+
doc2.set("exposed-commands", buildExposedCommands(inputs));
|
|
52862
|
+
return doc2.toString();
|
|
52837
52863
|
}
|
|
52838
52864
|
|
|
52839
52865
|
// app-import.ts
|
|
@@ -52909,17 +52935,98 @@ function withBadge(report, opts) {
|
|
|
52909
52935
|
return { ...report, html: injectBadge(report.html, opts) };
|
|
52910
52936
|
}
|
|
52911
52937
|
|
|
52938
|
+
// steel-report.ts
|
|
52939
|
+
var esc = (s) => String(s ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
52940
|
+
var num = (v) => typeof v === "number" ? v : Number(v) || 0;
|
|
52941
|
+
var STYLE = `<style>
|
|
52942
|
+
body{font-family:-apple-system,'Segoe UI',Roboto,sans-serif;background:#0f172a;color:#e2e8f0;padding:2.5rem;line-height:1.55}
|
|
52943
|
+
.wrap{max-width:560px;margin:0 auto;background:#111c33;border:1px solid #1e293b;border-radius:14px;padding:1.9rem 2.1rem;box-shadow:0 12px 34px rgba(2,6,23,.5)}
|
|
52944
|
+
h1{font-size:1.4rem;font-weight:800;margin:0 0 .3rem;color:#f1f5f9}
|
|
52945
|
+
.ok{color:#4ade80;font-size:.82rem;font-weight:700;margin:.15rem 0 .25rem;letter-spacing:.02em}
|
|
52946
|
+
.sub{color:#94a3b8;font-size:.92rem;margin-bottom:1.3rem}
|
|
52947
|
+
.big{font-size:2.1rem;font-weight:800;color:#60a5fa;line-height:1}
|
|
52948
|
+
.big span{font-size:1rem;font-weight:600;color:#94a3b8}
|
|
52949
|
+
table{width:100%;border-collapse:collapse;font-size:.9rem;margin:1.2rem 0}
|
|
52950
|
+
td{padding:.45rem .2rem;border-bottom:1px solid #1e293b}td:last-child{text-align:right;font-weight:700;color:#cbd5e1}
|
|
52951
|
+
thead td{color:#64748b;font-weight:600;font-size:.78rem;text-transform:uppercase;letter-spacing:.04em}thead td:last-child{text-align:right}
|
|
52952
|
+
.path{font-family:ui-monospace,Menlo,Consolas,monospace;font-size:.82rem;background:#0b1424;border:1px solid #1e293b;border-radius:7px;padding:.6rem .75rem;color:#93c5fd;word-break:break-all;margin:.6rem 0 1.1rem}
|
|
52953
|
+
.path-label{color:#94a3b8;font-size:.8rem;margin:.2rem 0 .35rem}
|
|
52954
|
+
.tools{font-size:.9rem;color:#cbd5e1}.tools b{color:#f1f5f9}
|
|
52955
|
+
</style>`;
|
|
52956
|
+
function profileRows(profiles) {
|
|
52957
|
+
if (!profiles || typeof profiles !== "object") return "";
|
|
52958
|
+
return Object.entries(profiles).map(([k, v]) => `<tr><td>${esc(k)}</td><td>${num(v)}</td></tr>`).join("");
|
|
52959
|
+
}
|
|
52960
|
+
function doc(body) {
|
|
52961
|
+
return `<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>Steel report</title>${STYLE}</head><body><div class="wrap">${body}</div></body></html>`;
|
|
52962
|
+
}
|
|
52963
|
+
function ifcCard(r) {
|
|
52964
|
+
const members = num(r.members);
|
|
52965
|
+
const columns = num(r.columns);
|
|
52966
|
+
const beams = num(r.beams);
|
|
52967
|
+
const path = String(r.path ?? "");
|
|
52968
|
+
const fname = path.split(/[\\/]/).pop() || "model.ifc";
|
|
52969
|
+
const rows = profileRows(r.profiles);
|
|
52970
|
+
return doc(
|
|
52971
|
+
`<h1>Steel exported to IFC</h1><div class="ok">✓ IFC file written</div><div class="sub">${esc(fname)}</div><div class="big">${members} <span>members · ${columns} columns · ${beams} beams</span></div>` + (rows ? `<table><thead><tr><td>Profile</td><td>Count</td></tr></thead><tbody>${rows}</tbody></table>` : "") + `<div class="path-label">Saved here — open it in Tekla / SDS2 / Revit:</div><div class="path">${esc(path)}</div><div class="tools">Open the IFC in <b>Tekla</b>, <b>SDS2</b>, <b>Revit</b> or <b>Navisworks</b> — IFC is the universal exchange format. Schematic model — confirm & detail in your tool.</div>`
|
|
52972
|
+
);
|
|
52973
|
+
}
|
|
52974
|
+
function teklaCard(r) {
|
|
52975
|
+
const created = num(r.created);
|
|
52976
|
+
const columns = num(r.columns);
|
|
52977
|
+
const beams = num(r.beams);
|
|
52978
|
+
const failed = num(r.failed);
|
|
52979
|
+
const skipped = num(r.skipped);
|
|
52980
|
+
const placeholder = num(r.placeholder);
|
|
52981
|
+
const sceneName = String(r.scene_name ?? "Steel from Drawings");
|
|
52982
|
+
const model = String(r.model ?? "Tekla model");
|
|
52983
|
+
const rows = profileRows(r.profiles);
|
|
52984
|
+
const extra = (failed > 0 ? ` · ${failed} failed` : "") + (skipped > 0 ? ` · ${skipped} skipped` : "");
|
|
52985
|
+
const note = placeholder > 0 ? `${placeholder} member(s) used a sized placeholder profile because this Tekla environment didn't have the drawing's catalogue profile \u2014 remap those. <b>Undo</b> in Tekla reverts the whole bake.` : `Native Tekla parts on the model grid \u2014 detail them as usual. <b>Undo</b> in Tekla reverts the whole bake.`;
|
|
52986
|
+
return doc(
|
|
52987
|
+
`<h1>Steel baked into Tekla</h1><div class="ok">✓ ${created} member(s) created in the live model</div><div class="sub">${esc(sceneName)} → ${esc(model)}</div><div class="big">${created} <span>members · ${columns} columns · ${beams} beams${extra}</span></div>` + (rows ? `<table><thead><tr><td>Profile</td><td>Count</td></tr></thead><tbody>${rows}</tbody></table>` : "") + `<div class="tools">${note}</div>`
|
|
52988
|
+
);
|
|
52989
|
+
}
|
|
52990
|
+
function buildSteelReportHtml(data) {
|
|
52991
|
+
if (!data || typeof data !== "object") return null;
|
|
52992
|
+
const result = data.result && typeof data.result === "object" ? data.result : null;
|
|
52993
|
+
if (result && typeof result.created === "number") return teklaCard(result);
|
|
52994
|
+
if (typeof data.members === "number" && typeof data.path === "string") return ifcCard(data);
|
|
52995
|
+
if (result && typeof result.members === "number" && typeof result.path === "string") return ifcCard(result);
|
|
52996
|
+
return null;
|
|
52997
|
+
}
|
|
52998
|
+
|
|
52912
52999
|
// report-html.ts
|
|
52913
|
-
function extractReportHtml(events) {
|
|
53000
|
+
function extractReportHtml(events, appId) {
|
|
52914
53001
|
let found = null;
|
|
53002
|
+
const steelApp = appId === "steel-to-ifc" || appId === "steel-to-tekla";
|
|
53003
|
+
let steel = null;
|
|
52915
53004
|
for (const ev of events) {
|
|
52916
53005
|
const data = ev?.data;
|
|
52917
53006
|
if (!data || typeof data !== "object") continue;
|
|
52918
53007
|
const result = data.result;
|
|
52919
53008
|
const html = typeof data.html === "string" ? data.html : result && typeof result.html === "string" ? result.html : null;
|
|
52920
|
-
if (html)
|
|
53009
|
+
if (html) {
|
|
53010
|
+
found = { nodeId: ev.node ?? null, html };
|
|
53011
|
+
} else if (steelApp) {
|
|
53012
|
+
const card = buildSteelReportHtml(data);
|
|
53013
|
+
if (card) steel = { nodeId: ev.node ?? null, html: card };
|
|
53014
|
+
}
|
|
52921
53015
|
}
|
|
52922
|
-
return found;
|
|
53016
|
+
return found ?? steel;
|
|
53017
|
+
}
|
|
53018
|
+
|
|
53019
|
+
// steel-output-path.ts
|
|
53020
|
+
var import_node_path8 = require("node:path");
|
|
53021
|
+
var import_node_os8 = require("node:os");
|
|
53022
|
+
var import_node_fs9 = require("node:fs");
|
|
53023
|
+
function steelIfcRunInputs(id, inputs) {
|
|
53024
|
+
if (id !== "steel-to-ifc") return inputs;
|
|
53025
|
+
const op = inputs?.output_path;
|
|
53026
|
+
if (op != null && op !== "" && op !== "steel-from-drawings.ifc") return inputs;
|
|
53027
|
+
const dl = (0, import_node_path8.join)((0, import_node_os8.homedir)(), "Downloads");
|
|
53028
|
+
const dir = (0, import_node_fs9.existsSync)(dl) ? dl : (0, import_node_os8.homedir)();
|
|
53029
|
+
return { ...inputs ?? {}, output_path: (0, import_node_path8.join)(dir, "steel-from-drawings.ifc") };
|
|
52923
53030
|
}
|
|
52924
53031
|
|
|
52925
53032
|
// index.ts
|
|
@@ -52967,21 +53074,21 @@ function buildPreview(m, sourceKind, sourceRef, stagedRef) {
|
|
|
52967
53074
|
}
|
|
52968
53075
|
|
|
52969
53076
|
// graft-manifest-reader.ts
|
|
52970
|
-
var
|
|
52971
|
-
var
|
|
53077
|
+
var import_node_fs10 = require("node:fs");
|
|
53078
|
+
var import_node_path9 = require("node:path");
|
|
52972
53079
|
var import_yaml3 = __toESM(require_dist6(), 1);
|
|
52973
53080
|
var asRecord2 = (v) => v && typeof v === "object" && !Array.isArray(v) ? v : {};
|
|
52974
53081
|
function readStagedManifest(agentDir) {
|
|
52975
|
-
const manifestPath = (0,
|
|
52976
|
-
if (!(0,
|
|
52977
|
-
let
|
|
53082
|
+
const manifestPath = (0, import_node_path9.join)(agentDir, "manifest.yaml");
|
|
53083
|
+
if (!(0, import_node_fs10.existsSync)(manifestPath)) return null;
|
|
53084
|
+
let doc2;
|
|
52978
53085
|
try {
|
|
52979
|
-
|
|
53086
|
+
doc2 = asRecord2((0, import_yaml3.parse)((0, import_node_fs10.readFileSync)(manifestPath, "utf8")));
|
|
52980
53087
|
} catch {
|
|
52981
53088
|
return null;
|
|
52982
53089
|
}
|
|
52983
53090
|
const commands = {};
|
|
52984
|
-
for (const [name, raw] of Object.entries(asRecord2(
|
|
53091
|
+
for (const [name, raw] of Object.entries(asRecord2(doc2.commands))) {
|
|
52985
53092
|
const c = asRecord2(raw);
|
|
52986
53093
|
const inputs = {};
|
|
52987
53094
|
for (const [inName, inRaw] of Object.entries(asRecord2(c.inputs))) {
|
|
@@ -53004,26 +53111,26 @@ function readStagedManifest(agentDir) {
|
|
|
53004
53111
|
inputs
|
|
53005
53112
|
};
|
|
53006
53113
|
}
|
|
53007
|
-
let skillCount = Array.isArray(
|
|
53114
|
+
let skillCount = Array.isArray(doc2.skills) ? doc2.skills.length : 0;
|
|
53008
53115
|
if (!skillCount) {
|
|
53009
|
-
const skillsDir = (0,
|
|
53010
|
-
if ((0,
|
|
53116
|
+
const skillsDir = (0, import_node_path9.join)(agentDir, "skills");
|
|
53117
|
+
if ((0, import_node_fs10.existsSync)(skillsDir)) {
|
|
53011
53118
|
try {
|
|
53012
|
-
skillCount = (0,
|
|
53119
|
+
skillCount = (0, import_node_fs10.readdirSync)(skillsDir).filter((f) => f.endsWith(".md")).length;
|
|
53013
53120
|
} catch {
|
|
53014
53121
|
}
|
|
53015
53122
|
}
|
|
53016
53123
|
}
|
|
53017
53124
|
return {
|
|
53018
|
-
agentId: typeof
|
|
53019
|
-
description: typeof
|
|
53125
|
+
agentId: typeof doc2.agent === "string" ? doc2.agent : "",
|
|
53126
|
+
description: typeof doc2.description === "string" ? doc2.description : "",
|
|
53020
53127
|
skillCount,
|
|
53021
53128
|
commands
|
|
53022
53129
|
};
|
|
53023
53130
|
}
|
|
53024
53131
|
|
|
53025
53132
|
// graft-stage-registry.ts
|
|
53026
|
-
var
|
|
53133
|
+
var import_node_fs11 = require("node:fs");
|
|
53027
53134
|
var TTL_MS = 30 * 60 * 1e3;
|
|
53028
53135
|
var registry = /* @__PURE__ */ new Map();
|
|
53029
53136
|
function registerStage(token, tempDir, agentId) {
|
|
@@ -53045,7 +53152,7 @@ function evict(token) {
|
|
|
53045
53152
|
clearTimeout(e.timer);
|
|
53046
53153
|
registry.delete(token);
|
|
53047
53154
|
try {
|
|
53048
|
-
(0,
|
|
53155
|
+
(0, import_node_fs11.rmSync)(e.tempDir, { recursive: true, force: true });
|
|
53049
53156
|
} catch {
|
|
53050
53157
|
}
|
|
53051
53158
|
}
|
|
@@ -53054,8 +53161,8 @@ function clearAllStages() {
|
|
|
53054
53161
|
}
|
|
53055
53162
|
|
|
53056
53163
|
// graft-commit.ts
|
|
53057
|
-
var
|
|
53058
|
-
var
|
|
53164
|
+
var import_node_fs12 = require("node:fs");
|
|
53165
|
+
var import_node_path10 = require("node:path");
|
|
53059
53166
|
var GraftCommitError = class extends Error {
|
|
53060
53167
|
constructor(message, code) {
|
|
53061
53168
|
super(message);
|
|
@@ -53065,60 +53172,60 @@ var GraftCommitError = class extends Error {
|
|
|
53065
53172
|
code;
|
|
53066
53173
|
};
|
|
53067
53174
|
function commitStaged(tempDir, agentId, targetAgentsDir, force) {
|
|
53068
|
-
const staged = (0,
|
|
53069
|
-
const target = (0,
|
|
53070
|
-
if ((0,
|
|
53175
|
+
const staged = (0, import_node_path10.join)(tempDir, "agents", agentId);
|
|
53176
|
+
const target = (0, import_node_path10.join)(targetAgentsDir, agentId);
|
|
53177
|
+
if ((0, import_node_fs12.existsSync)(target)) {
|
|
53071
53178
|
if (!force) throw new GraftCommitError(`an agent named "${agentId}" is already installed`, "collision");
|
|
53072
|
-
(0,
|
|
53179
|
+
(0, import_node_fs12.rmSync)(target, { recursive: true, force: true });
|
|
53073
53180
|
}
|
|
53074
|
-
(0,
|
|
53181
|
+
(0, import_node_fs12.mkdirSync)(targetAgentsDir, { recursive: true });
|
|
53075
53182
|
try {
|
|
53076
|
-
(0,
|
|
53183
|
+
(0, import_node_fs12.renameSync)(staged, target);
|
|
53077
53184
|
} catch {
|
|
53078
|
-
(0,
|
|
53185
|
+
(0, import_node_fs12.cpSync)(staged, target, { recursive: true });
|
|
53079
53186
|
}
|
|
53080
|
-
(0,
|
|
53187
|
+
(0, import_node_fs12.rmSync)(tempDir, { recursive: true, force: true });
|
|
53081
53188
|
return { agentId };
|
|
53082
53189
|
}
|
|
53083
53190
|
function matchAssemblies(globOrDir) {
|
|
53084
53191
|
let dir;
|
|
53085
53192
|
let pattern;
|
|
53086
|
-
if ((0,
|
|
53193
|
+
if ((0, import_node_fs12.existsSync)(globOrDir) && (0, import_node_fs12.statSync)(globOrDir).isDirectory()) {
|
|
53087
53194
|
dir = globOrDir;
|
|
53088
53195
|
pattern = "*.dll";
|
|
53089
53196
|
} else {
|
|
53090
|
-
dir = (0,
|
|
53091
|
-
pattern = (0,
|
|
53197
|
+
dir = (0, import_node_path10.dirname)(globOrDir);
|
|
53198
|
+
pattern = (0, import_node_path10.basename)(globOrDir);
|
|
53092
53199
|
}
|
|
53093
|
-
if (!dir || !(0,
|
|
53200
|
+
if (!dir || !(0, import_node_fs12.existsSync)(dir) || !(0, import_node_fs12.statSync)(dir).isDirectory()) return [];
|
|
53094
53201
|
const re = globToRegExp(pattern);
|
|
53095
|
-
return (0,
|
|
53202
|
+
return (0, import_node_fs12.readdirSync)(dir).filter((f) => re.test(f)).sort();
|
|
53096
53203
|
}
|
|
53097
53204
|
function globToRegExp(p) {
|
|
53098
|
-
const
|
|
53099
|
-
return new RegExp(`^${
|
|
53205
|
+
const esc2 = p.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*").replace(/\?/g, ".");
|
|
53206
|
+
return new RegExp(`^${esc2}$`, "i");
|
|
53100
53207
|
}
|
|
53101
53208
|
|
|
53102
53209
|
// floless-store.ts
|
|
53103
53210
|
var import_node_crypto4 = require("node:crypto");
|
|
53104
|
-
var
|
|
53105
|
-
var
|
|
53106
|
-
var
|
|
53107
|
-
var ROOT2 = process.env.FLOLESS_HOME ?? (0,
|
|
53108
|
-
var TEMPLATES_FILE = (0,
|
|
53109
|
-
var REQUESTS_DIR = (0,
|
|
53211
|
+
var import_node_fs13 = require("node:fs");
|
|
53212
|
+
var import_node_os9 = require("node:os");
|
|
53213
|
+
var import_node_path11 = require("node:path");
|
|
53214
|
+
var ROOT2 = process.env.FLOLESS_HOME ?? (0, import_node_path11.join)((0, import_node_os9.homedir)(), ".floless");
|
|
53215
|
+
var TEMPLATES_FILE = (0, import_node_path11.join)(ROOT2, "templates.json");
|
|
53216
|
+
var REQUESTS_DIR = (0, import_node_path11.join)(ROOT2, "requests");
|
|
53110
53217
|
function ensureRoot() {
|
|
53111
|
-
if (!(0,
|
|
53218
|
+
if (!(0, import_node_fs13.existsSync)(ROOT2)) (0, import_node_fs13.mkdirSync)(ROOT2, { recursive: true });
|
|
53112
53219
|
}
|
|
53113
53220
|
function withinRequestsDir(p) {
|
|
53114
|
-
const base = (0,
|
|
53115
|
-
const full = (0,
|
|
53116
|
-
return full === base || full.startsWith(base +
|
|
53221
|
+
const base = (0, import_node_path11.resolve)(REQUESTS_DIR);
|
|
53222
|
+
const full = (0, import_node_path11.resolve)(p);
|
|
53223
|
+
return full === base || full.startsWith(base + import_node_path11.sep);
|
|
53117
53224
|
}
|
|
53118
53225
|
function listTemplates() {
|
|
53119
|
-
if (!(0,
|
|
53226
|
+
if (!(0, import_node_fs13.existsSync)(TEMPLATES_FILE)) return [];
|
|
53120
53227
|
try {
|
|
53121
|
-
const parsed = JSON.parse((0,
|
|
53228
|
+
const parsed = JSON.parse((0, import_node_fs13.readFileSync)(TEMPLATES_FILE, "utf8"));
|
|
53122
53229
|
return Array.isArray(parsed) ? parsed : [];
|
|
53123
53230
|
} catch {
|
|
53124
53231
|
return [];
|
|
@@ -53127,8 +53234,8 @@ function listTemplates() {
|
|
|
53127
53234
|
function writeTemplates(list) {
|
|
53128
53235
|
ensureRoot();
|
|
53129
53236
|
const tmp = `${TEMPLATES_FILE}.${process.pid}.tmp`;
|
|
53130
|
-
(0,
|
|
53131
|
-
(0,
|
|
53237
|
+
(0, import_node_fs13.writeFileSync)(tmp, JSON.stringify(list, null, 2));
|
|
53238
|
+
(0, import_node_fs13.renameSync)(tmp, TEMPLATES_FILE);
|
|
53132
53239
|
}
|
|
53133
53240
|
function addTemplate(input) {
|
|
53134
53241
|
const list = listTemplates();
|
|
@@ -53173,13 +53280,13 @@ function updateTemplate(id, patch) {
|
|
|
53173
53280
|
}
|
|
53174
53281
|
function addRequest(req, decoded = []) {
|
|
53175
53282
|
ensureRoot();
|
|
53176
|
-
if (!(0,
|
|
53283
|
+
if (!(0, import_node_fs13.existsSync)(REQUESTS_DIR)) (0, import_node_fs13.mkdirSync)(REQUESTS_DIR, { recursive: true });
|
|
53177
53284
|
const id = (0, import_node_crypto4.randomUUID)();
|
|
53178
53285
|
const createdAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
53179
53286
|
const base = `${createdAt.replace(/[:.]/g, "-")}__${id}`;
|
|
53180
53287
|
const snapshots = decoded.map((d, i) => {
|
|
53181
|
-
const p = (0,
|
|
53182
|
-
(0,
|
|
53288
|
+
const p = (0, import_node_path11.join)(REQUESTS_DIR, `${base}__snap${i + 1}.${d.ext}`);
|
|
53289
|
+
(0, import_node_fs13.writeFileSync)(p, d.buf);
|
|
53183
53290
|
return p;
|
|
53184
53291
|
});
|
|
53185
53292
|
const full = {
|
|
@@ -53189,55 +53296,55 @@ function addRequest(req, decoded = []) {
|
|
|
53189
53296
|
...req,
|
|
53190
53297
|
...snapshots.length ? { snapshots } : {}
|
|
53191
53298
|
};
|
|
53192
|
-
(0,
|
|
53299
|
+
(0, import_node_fs13.writeFileSync)((0, import_node_path11.join)(REQUESTS_DIR, `${base}.json`), JSON.stringify(full, null, 2));
|
|
53193
53300
|
return full;
|
|
53194
53301
|
}
|
|
53195
53302
|
function listRequests() {
|
|
53196
|
-
if (!(0,
|
|
53197
|
-
return (0,
|
|
53303
|
+
if (!(0, import_node_fs13.existsSync)(REQUESTS_DIR)) return [];
|
|
53304
|
+
return (0, import_node_fs13.readdirSync)(REQUESTS_DIR).filter((f) => f.endsWith(".json")).sort().map((f) => {
|
|
53198
53305
|
try {
|
|
53199
|
-
return JSON.parse((0,
|
|
53306
|
+
return JSON.parse((0, import_node_fs13.readFileSync)((0, import_node_path11.join)(REQUESTS_DIR, f), "utf8"));
|
|
53200
53307
|
} catch {
|
|
53201
53308
|
return null;
|
|
53202
53309
|
}
|
|
53203
53310
|
}).filter((r) => r !== null);
|
|
53204
53311
|
}
|
|
53205
53312
|
function deleteRequest(id) {
|
|
53206
|
-
if (!(0,
|
|
53207
|
-
const file = (0,
|
|
53313
|
+
if (!(0, import_node_fs13.existsSync)(REQUESTS_DIR)) return false;
|
|
53314
|
+
const file = (0, import_node_fs13.readdirSync)(REQUESTS_DIR).find((f) => f.endsWith(`__${id}.json`));
|
|
53208
53315
|
if (!file) return false;
|
|
53209
53316
|
try {
|
|
53210
|
-
const parsed = JSON.parse((0,
|
|
53317
|
+
const parsed = JSON.parse((0, import_node_fs13.readFileSync)((0, import_node_path11.join)(REQUESTS_DIR, file), "utf8"));
|
|
53211
53318
|
for (const p of parsed.snapshots ?? []) {
|
|
53212
53319
|
if (!withinRequestsDir(p)) continue;
|
|
53213
53320
|
try {
|
|
53214
|
-
(0,
|
|
53321
|
+
(0, import_node_fs13.rmSync)(p);
|
|
53215
53322
|
} catch {
|
|
53216
53323
|
}
|
|
53217
53324
|
}
|
|
53218
53325
|
} catch {
|
|
53219
53326
|
}
|
|
53220
|
-
(0,
|
|
53327
|
+
(0, import_node_fs13.rmSync)((0, import_node_path11.join)(REQUESTS_DIR, file));
|
|
53221
53328
|
return true;
|
|
53222
53329
|
}
|
|
53223
53330
|
function clearRequests() {
|
|
53224
|
-
if (!(0,
|
|
53225
|
-
const allFiles = (0,
|
|
53331
|
+
if (!(0, import_node_fs13.existsSync)(REQUESTS_DIR)) return 0;
|
|
53332
|
+
const allFiles = (0, import_node_fs13.readdirSync)(REQUESTS_DIR);
|
|
53226
53333
|
const jsonFiles = allFiles.filter((f) => f.endsWith(".json"));
|
|
53227
53334
|
for (const f of allFiles) {
|
|
53228
53335
|
try {
|
|
53229
|
-
(0,
|
|
53336
|
+
(0, import_node_fs13.rmSync)((0, import_node_path11.join)(REQUESTS_DIR, f));
|
|
53230
53337
|
} catch {
|
|
53231
53338
|
}
|
|
53232
53339
|
}
|
|
53233
53340
|
return jsonFiles.length;
|
|
53234
53341
|
}
|
|
53235
53342
|
function snapshotPathFor(id, n) {
|
|
53236
|
-
if (!(0,
|
|
53237
|
-
const file = (0,
|
|
53343
|
+
if (!(0, import_node_fs13.existsSync)(REQUESTS_DIR)) return null;
|
|
53344
|
+
const file = (0, import_node_fs13.readdirSync)(REQUESTS_DIR).find((f) => f.endsWith(`__${id}.json`));
|
|
53238
53345
|
if (!file) return null;
|
|
53239
53346
|
try {
|
|
53240
|
-
const parsed = JSON.parse((0,
|
|
53347
|
+
const parsed = JSON.parse((0, import_node_fs13.readFileSync)((0, import_node_path11.join)(REQUESTS_DIR, file), "utf8"));
|
|
53241
53348
|
const cand = parsed.snapshots?.[n] ?? null;
|
|
53242
53349
|
return cand && withinRequestsDir(cand) ? cand : null;
|
|
53243
53350
|
} catch {
|
|
@@ -53274,15 +53381,15 @@ function decodeSnapshots(inputs) {
|
|
|
53274
53381
|
|
|
53275
53382
|
// visual-input-store.ts
|
|
53276
53383
|
var import_node_crypto5 = require("node:crypto");
|
|
53277
|
-
var
|
|
53278
|
-
var
|
|
53279
|
-
var
|
|
53384
|
+
var import_node_fs14 = require("node:fs");
|
|
53385
|
+
var import_node_os10 = require("node:os");
|
|
53386
|
+
var import_node_path12 = require("node:path");
|
|
53280
53387
|
var MAX_BYTES3 = 25 * 1024 * 1024;
|
|
53281
53388
|
var VisualInputError = class extends Error {
|
|
53282
53389
|
};
|
|
53283
53390
|
function inputsDir() {
|
|
53284
|
-
const root = process.env.FLOLESS_HOME ?? (0,
|
|
53285
|
-
return (0,
|
|
53391
|
+
const root = process.env.FLOLESS_HOME ?? (0, import_node_path12.join)((0, import_node_os10.homedir)(), ".floless");
|
|
53392
|
+
return (0, import_node_path12.join)(root, "inputs");
|
|
53286
53393
|
}
|
|
53287
53394
|
function sniffExt2(buf) {
|
|
53288
53395
|
if (buf.length >= 8 && buf[0] === 137 && buf[1] === 80 && buf[2] === 78 && buf[3] === 71) return "png";
|
|
@@ -53294,7 +53401,7 @@ function sniffExt2(buf) {
|
|
|
53294
53401
|
var RESERVED = /^(con|prn|aux|nul|com[1-9]|lpt[1-9])(\..*)?$/i;
|
|
53295
53402
|
function safeSegment(s) {
|
|
53296
53403
|
if (!s || s === "." || s.includes("..")) return false;
|
|
53297
|
-
if (s.includes("/") || s.includes("\\") || s.includes(
|
|
53404
|
+
if (s.includes("/") || s.includes("\\") || s.includes(import_node_path12.sep)) return false;
|
|
53298
53405
|
for (let i = 0; i < s.length; i++) {
|
|
53299
53406
|
const c = s.charCodeAt(i);
|
|
53300
53407
|
if (c < 32 || c === 58) return false;
|
|
@@ -53312,50 +53419,50 @@ function storeVisualInput(appId, dataUrl) {
|
|
|
53312
53419
|
const ext = sniffExt2(buf);
|
|
53313
53420
|
if (!ext) throw new VisualInputError("visual input must be PNG, JPEG, WebP, or PDF");
|
|
53314
53421
|
const sha2562 = (0, import_node_crypto5.createHash)("sha256").update(buf).digest("hex");
|
|
53315
|
-
const dir = (0,
|
|
53316
|
-
const path = (0,
|
|
53317
|
-
const root = (0,
|
|
53318
|
-
const target = (0,
|
|
53319
|
-
if (target !== root && !target.startsWith(root +
|
|
53422
|
+
const dir = (0, import_node_path12.join)(inputsDir(), appId);
|
|
53423
|
+
const path = (0, import_node_path12.join)(dir, `${sha2562}.${ext}`);
|
|
53424
|
+
const root = (0, import_node_path12.resolve)(inputsDir());
|
|
53425
|
+
const target = (0, import_node_path12.resolve)(path);
|
|
53426
|
+
if (target !== root && !target.startsWith(root + import_node_path12.sep)) {
|
|
53320
53427
|
throw new VisualInputError("refusing to write outside the inputs root");
|
|
53321
53428
|
}
|
|
53322
|
-
(0,
|
|
53323
|
-
if (!(0,
|
|
53429
|
+
(0, import_node_fs14.mkdirSync)(dir, { recursive: true });
|
|
53430
|
+
if (!(0, import_node_fs14.existsSync)(path)) {
|
|
53324
53431
|
const tmp = `${path}.tmp`;
|
|
53325
|
-
(0,
|
|
53326
|
-
(0,
|
|
53432
|
+
(0, import_node_fs14.writeFileSync)(tmp, buf);
|
|
53433
|
+
(0, import_node_fs14.renameSync)(tmp, path);
|
|
53327
53434
|
}
|
|
53328
|
-
return { path, ext, bytes: (0,
|
|
53435
|
+
return { path, ext, bytes: (0, import_node_fs14.statSync)(path).size, sha256: sha2562 };
|
|
53329
53436
|
}
|
|
53330
53437
|
function renameVisualInputs(oldId, newId) {
|
|
53331
53438
|
if (!safeSegment(oldId) || !safeSegment(newId)) throw new VisualInputError("invalid app id");
|
|
53332
|
-
const from = (0,
|
|
53333
|
-
if (!(0,
|
|
53334
|
-
const to = (0,
|
|
53335
|
-
if ((0,
|
|
53336
|
-
(0,
|
|
53337
|
-
(0,
|
|
53439
|
+
const from = (0, import_node_path12.join)(inputsDir(), oldId);
|
|
53440
|
+
if (!(0, import_node_fs14.existsSync)(from)) return;
|
|
53441
|
+
const to = (0, import_node_path12.join)(inputsDir(), newId);
|
|
53442
|
+
if ((0, import_node_fs14.existsSync)(to)) (0, import_node_fs14.rmSync)(to, { recursive: true, force: true });
|
|
53443
|
+
(0, import_node_fs14.mkdirSync)(inputsDir(), { recursive: true });
|
|
53444
|
+
(0, import_node_fs14.renameSync)(from, to);
|
|
53338
53445
|
}
|
|
53339
53446
|
function copyVisualInputs(srcId, newId) {
|
|
53340
53447
|
if (!safeSegment(srcId) || !safeSegment(newId)) throw new VisualInputError("invalid app id");
|
|
53341
|
-
const from = (0,
|
|
53342
|
-
if (!(0,
|
|
53343
|
-
(0,
|
|
53448
|
+
const from = (0, import_node_path12.join)(inputsDir(), srcId);
|
|
53449
|
+
if (!(0, import_node_fs14.existsSync)(from)) return;
|
|
53450
|
+
(0, import_node_fs14.cpSync)(from, (0, import_node_path12.join)(inputsDir(), newId), { recursive: true });
|
|
53344
53451
|
}
|
|
53345
53452
|
function deleteVisualInputs(id) {
|
|
53346
53453
|
if (!safeSegment(id)) throw new VisualInputError("invalid app id");
|
|
53347
|
-
const dir = (0,
|
|
53348
|
-
if ((0,
|
|
53454
|
+
const dir = (0, import_node_path12.join)(inputsDir(), id);
|
|
53455
|
+
if ((0, import_node_fs14.existsSync)(dir)) (0, import_node_fs14.rmSync)(dir, { recursive: true, force: true });
|
|
53349
53456
|
}
|
|
53350
53457
|
|
|
53351
53458
|
// app-lifecycle.ts
|
|
53352
|
-
var
|
|
53353
|
-
var
|
|
53354
|
-
var
|
|
53459
|
+
var import_node_fs17 = require("node:fs");
|
|
53460
|
+
var import_node_os12 = require("node:os");
|
|
53461
|
+
var import_node_path15 = require("node:path");
|
|
53355
53462
|
|
|
53356
53463
|
// routines.ts
|
|
53357
|
-
var
|
|
53358
|
-
var
|
|
53464
|
+
var import_node_fs16 = require("node:fs");
|
|
53465
|
+
var import_node_path14 = require("node:path");
|
|
53359
53466
|
|
|
53360
53467
|
// sse.ts
|
|
53361
53468
|
var clients = /* @__PURE__ */ new Set();
|
|
@@ -53392,11 +53499,11 @@ function clientCount() {
|
|
|
53392
53499
|
}
|
|
53393
53500
|
|
|
53394
53501
|
// trigger-sessions.ts
|
|
53395
|
-
var
|
|
53396
|
-
var
|
|
53397
|
-
var
|
|
53502
|
+
var import_node_fs15 = require("node:fs");
|
|
53503
|
+
var import_node_os11 = require("node:os");
|
|
53504
|
+
var import_node_path13 = require("node:path");
|
|
53398
53505
|
var import_yaml4 = __toESM(require_dist6(), 1);
|
|
53399
|
-
var AGENTS_DIR2 = process.env.AWARE_HOME ? (0,
|
|
53506
|
+
var AGENTS_DIR2 = process.env.AWARE_HOME ? (0, import_node_path13.join)(process.env.AWARE_HOME, "agents") : (0, import_node_path13.join)((0, import_node_os11.homedir)(), ".aware", "agents");
|
|
53400
53507
|
function summarizeFire(data) {
|
|
53401
53508
|
if (!data) return "event";
|
|
53402
53509
|
const type = typeof data.type === "string" ? data.type : "";
|
|
@@ -53413,11 +53520,11 @@ function mapTriggerState(phase) {
|
|
|
53413
53520
|
function isHostBacked(agent, agentsDir = AGENTS_DIR2) {
|
|
53414
53521
|
const safe = (n) => !n.includes("/") && !n.includes("\\") && !n.includes("..");
|
|
53415
53522
|
if (!safe(agent)) return false;
|
|
53416
|
-
const manifestPath = (0,
|
|
53417
|
-
if (!(0,
|
|
53523
|
+
const manifestPath = (0, import_node_path13.join)(agentsDir, agent, "manifest.yaml");
|
|
53524
|
+
if (!(0, import_node_fs15.existsSync)(manifestPath)) return false;
|
|
53418
53525
|
try {
|
|
53419
|
-
const
|
|
53420
|
-
const transport =
|
|
53526
|
+
const doc2 = (0, import_yaml4.parse)((0, import_node_fs15.readFileSync)(manifestPath, "utf8"));
|
|
53527
|
+
const transport = doc2?.transport;
|
|
53421
53528
|
return !!(transport && typeof transport === "object" && "cli" in transport);
|
|
53422
53529
|
} catch {
|
|
53423
53530
|
return false;
|
|
@@ -53649,6 +53756,16 @@ function cronNextFire(expr, from) {
|
|
|
53649
53756
|
function nextFireAt(spec, from) {
|
|
53650
53757
|
if (!spec || typeof spec !== "object") return null;
|
|
53651
53758
|
switch (spec.kind) {
|
|
53759
|
+
case "minutes": {
|
|
53760
|
+
const n = Math.max(1, Math.floor(spec.everyMinutes));
|
|
53761
|
+
const start = new Date(from.getFullYear(), from.getMonth(), from.getDate(), from.getHours(), from.getMinutes(), 0, 0);
|
|
53762
|
+
for (let i = 0; i <= 120; i++) {
|
|
53763
|
+
const d = new Date(start.getTime());
|
|
53764
|
+
d.setMinutes(start.getMinutes() + i);
|
|
53765
|
+
if (d.getTime() > from.getTime() && d.getMinutes() % n === 0) return d;
|
|
53766
|
+
}
|
|
53767
|
+
return null;
|
|
53768
|
+
}
|
|
53652
53769
|
case "hourly": {
|
|
53653
53770
|
const n = Math.max(1, Math.floor(spec.everyHours));
|
|
53654
53771
|
const start = new Date(from.getFullYear(), from.getMonth(), from.getDate(), from.getHours(), 0, 0, 0);
|
|
@@ -53691,7 +53808,7 @@ var RoutineError = class extends Error {
|
|
|
53691
53808
|
}
|
|
53692
53809
|
status;
|
|
53693
53810
|
};
|
|
53694
|
-
var ROUTINES_FILE = (0,
|
|
53811
|
+
var ROUTINES_FILE = (0, import_node_path14.join)(flolessRoot, "routines.json");
|
|
53695
53812
|
var routines = [];
|
|
53696
53813
|
var loaded = false;
|
|
53697
53814
|
function ensureLoaded() {
|
|
@@ -53727,10 +53844,10 @@ function sanitizeRoutine(raw) {
|
|
|
53727
53844
|
};
|
|
53728
53845
|
}
|
|
53729
53846
|
function loadFromDisk() {
|
|
53730
|
-
if (!(0,
|
|
53847
|
+
if (!(0, import_node_fs16.existsSync)(ROUTINES_FILE)) return [];
|
|
53731
53848
|
let text;
|
|
53732
53849
|
try {
|
|
53733
|
-
text = (0,
|
|
53850
|
+
text = (0, import_node_fs16.readFileSync)(ROUTINES_FILE, "utf8");
|
|
53734
53851
|
} catch {
|
|
53735
53852
|
return [];
|
|
53736
53853
|
}
|
|
@@ -53739,17 +53856,17 @@ function loadFromDisk() {
|
|
|
53739
53856
|
return Array.isArray(parsed) ? parsed.map(sanitizeRoutine).filter((r) => r !== null) : [];
|
|
53740
53857
|
} catch {
|
|
53741
53858
|
try {
|
|
53742
|
-
(0,
|
|
53859
|
+
(0, import_node_fs16.renameSync)(ROUTINES_FILE, `${ROUTINES_FILE}.corrupt-${Date.now()}`);
|
|
53743
53860
|
} catch {
|
|
53744
53861
|
}
|
|
53745
53862
|
return [];
|
|
53746
53863
|
}
|
|
53747
53864
|
}
|
|
53748
53865
|
function saveRoutines() {
|
|
53749
|
-
if (!(0,
|
|
53866
|
+
if (!(0, import_node_fs16.existsSync)(flolessRoot)) (0, import_node_fs16.mkdirSync)(flolessRoot, { recursive: true });
|
|
53750
53867
|
const tmp = `${ROUTINES_FILE}.${process.pid}.tmp`;
|
|
53751
|
-
(0,
|
|
53752
|
-
(0,
|
|
53868
|
+
(0, import_node_fs16.writeFileSync)(tmp, JSON.stringify(routines, null, 2));
|
|
53869
|
+
(0, import_node_fs16.renameSync)(tmp, ROUTINES_FILE);
|
|
53753
53870
|
}
|
|
53754
53871
|
function listRoutines() {
|
|
53755
53872
|
ensureLoaded();
|
|
@@ -53763,6 +53880,11 @@ function validateSchedule(spec) {
|
|
|
53763
53880
|
if (!spec || typeof spec !== "object") return "schedule required";
|
|
53764
53881
|
const s = spec;
|
|
53765
53882
|
switch (s.kind) {
|
|
53883
|
+
case "minutes":
|
|
53884
|
+
if (typeof s.everyMinutes !== "number" || !Number.isInteger(s.everyMinutes) || s.everyMinutes < 1 || s.everyMinutes > 30 || 60 % s.everyMinutes !== 0) {
|
|
53885
|
+
return "everyMinutes must evenly divide 60 (1, 2, 3, 4, 5, 6, 10, 12, 15, 20, or 30)";
|
|
53886
|
+
}
|
|
53887
|
+
return null;
|
|
53766
53888
|
case "hourly":
|
|
53767
53889
|
if (typeof s.everyHours !== "number" || !Number.isInteger(s.everyHours) || s.everyHours < 1 || s.everyHours > 24 || 24 % s.everyHours !== 0) {
|
|
53768
53890
|
return "everyHours must evenly divide 24 (1, 2, 3, 4, 6, 8, 12, or 24)";
|
|
@@ -54144,13 +54266,13 @@ var AppLifecycleError = class extends Error {
|
|
|
54144
54266
|
}
|
|
54145
54267
|
};
|
|
54146
54268
|
function appsDir() {
|
|
54147
|
-
return process.env.AWARE_HOME ? (0,
|
|
54269
|
+
return process.env.AWARE_HOME ? (0, import_node_path15.join)(process.env.AWARE_HOME, "apps") : (0, import_node_path15.join)((0, import_node_os12.homedir)(), ".aware", "apps");
|
|
54148
54270
|
}
|
|
54149
54271
|
function appDirPath(id) {
|
|
54150
|
-
return (0,
|
|
54272
|
+
return (0, import_node_path15.join)(appsDir(), id);
|
|
54151
54273
|
}
|
|
54152
54274
|
function appInstalled(id) {
|
|
54153
|
-
return APP_ID3.test(id) && (0,
|
|
54275
|
+
return APP_ID3.test(id) && (0, import_node_fs17.existsSync)(appDirPath(id));
|
|
54154
54276
|
}
|
|
54155
54277
|
function logCascade(what, e) {
|
|
54156
54278
|
console.error(`[app-lifecycle] cascade step failed (${what}):`, e instanceof Error ? e.message : e);
|
|
@@ -54248,9 +54370,9 @@ function isGatedAwareRoute(url, method) {
|
|
|
54248
54370
|
|
|
54249
54371
|
// autostart.mjs
|
|
54250
54372
|
var import_node_child_process3 = require("node:child_process");
|
|
54251
|
-
var
|
|
54252
|
-
var
|
|
54253
|
-
var
|
|
54373
|
+
var import_node_fs18 = require("node:fs");
|
|
54374
|
+
var import_node_os13 = require("node:os");
|
|
54375
|
+
var import_node_path16 = require("node:path");
|
|
54254
54376
|
|
|
54255
54377
|
// teardown.mjs
|
|
54256
54378
|
var RUN_KEY = "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run";
|
|
@@ -54362,8 +54484,8 @@ function removeLegacyRunKey() {
|
|
|
54362
54484
|
}
|
|
54363
54485
|
function logLine(msg) {
|
|
54364
54486
|
try {
|
|
54365
|
-
(0,
|
|
54366
|
-
(0,
|
|
54487
|
+
(0, import_node_fs18.mkdirSync)(logDir(), { recursive: true });
|
|
54488
|
+
(0, import_node_fs18.appendFileSync)(logFilePath(), `${(/* @__PURE__ */ new Date()).toISOString()} ${msg}
|
|
54367
54489
|
`);
|
|
54368
54490
|
} catch {
|
|
54369
54491
|
}
|
|
@@ -54371,8 +54493,8 @@ function logLine(msg) {
|
|
|
54371
54493
|
function registerAutostart(exePath) {
|
|
54372
54494
|
if (!isWin) return;
|
|
54373
54495
|
const xml = buildAutostartTaskXml(exePath, currentUserId());
|
|
54374
|
-
const tmp = (0,
|
|
54375
|
-
(0,
|
|
54496
|
+
const tmp = (0, import_node_path16.join)((0, import_node_os13.tmpdir)(), `floless-autostart-${process.pid}-${Date.now()}.xml`);
|
|
54497
|
+
(0, import_node_fs18.writeFileSync)(tmp, "\uFEFF" + xml, { encoding: "utf16le" });
|
|
54376
54498
|
try {
|
|
54377
54499
|
(0, import_node_child_process3.execFileSync)("schtasks", ["/Create", "/TN", TASK_NAME, "/XML", tmp, "/F"], {
|
|
54378
54500
|
stdio: ["ignore", "ignore", "ignore"],
|
|
@@ -54383,7 +54505,7 @@ function registerAutostart(exePath) {
|
|
|
54383
54505
|
throw err;
|
|
54384
54506
|
} finally {
|
|
54385
54507
|
try {
|
|
54386
|
-
(0,
|
|
54508
|
+
(0, import_node_fs18.rmSync)(tmp, { force: true });
|
|
54387
54509
|
} catch {
|
|
54388
54510
|
}
|
|
54389
54511
|
}
|
|
@@ -54418,26 +54540,26 @@ function unregisterAutostart() {
|
|
|
54418
54540
|
// updater.ts
|
|
54419
54541
|
var import_node_child_process4 = require("node:child_process");
|
|
54420
54542
|
var import_node_crypto6 = require("node:crypto");
|
|
54421
|
-
var
|
|
54543
|
+
var import_node_fs20 = require("node:fs");
|
|
54422
54544
|
var import_node_stream = require("node:stream");
|
|
54423
54545
|
var import_promises = require("node:stream/promises");
|
|
54424
|
-
var
|
|
54546
|
+
var import_node_path18 = require("node:path");
|
|
54425
54547
|
|
|
54426
54548
|
// post-update-marker.mjs
|
|
54427
|
-
var
|
|
54428
|
-
var
|
|
54429
|
-
var
|
|
54549
|
+
var import_node_fs19 = require("node:fs");
|
|
54550
|
+
var import_node_os14 = require("node:os");
|
|
54551
|
+
var import_node_path17 = require("node:path");
|
|
54430
54552
|
var FRESH_MS = 12e4;
|
|
54431
54553
|
function markerPath() {
|
|
54432
54554
|
const override = (process.env.FLOLESS_POST_UPDATE_MARKER ?? "").trim();
|
|
54433
54555
|
if (override) return override;
|
|
54434
|
-
const root = process.env.FLOLESS_HOME ?? (0,
|
|
54435
|
-
return (0,
|
|
54556
|
+
const root = process.env.FLOLESS_HOME ?? (0, import_node_path17.join)((0, import_node_os14.homedir)(), ".floless");
|
|
54557
|
+
return (0, import_node_path17.join)(root, ".post-update");
|
|
54436
54558
|
}
|
|
54437
54559
|
function legacyMarkerPath() {
|
|
54438
54560
|
if ((process.env.FLOLESS_POST_UPDATE_MARKER ?? "").trim()) return null;
|
|
54439
54561
|
try {
|
|
54440
|
-
return (0,
|
|
54562
|
+
return (0, import_node_path17.join)((0, import_node_path17.dirname)((0, import_node_path17.dirname)(process.execPath)), ".floless-post-update");
|
|
54441
54563
|
} catch {
|
|
54442
54564
|
return null;
|
|
54443
54565
|
}
|
|
@@ -54447,7 +54569,7 @@ function writePostUpdateMarker() {
|
|
|
54447
54569
|
for (const p of [markerPath(), legacyMarkerPath()]) {
|
|
54448
54570
|
if (!p) continue;
|
|
54449
54571
|
try {
|
|
54450
|
-
(0,
|
|
54572
|
+
(0, import_node_fs19.writeFileSync)(p, (/* @__PURE__ */ new Date()).toISOString());
|
|
54451
54573
|
wrote = true;
|
|
54452
54574
|
} catch {
|
|
54453
54575
|
}
|
|
@@ -54459,9 +54581,9 @@ function consumePostUpdateMarker() {
|
|
|
54459
54581
|
for (const p of [markerPath(), legacyMarkerPath()]) {
|
|
54460
54582
|
if (!p) continue;
|
|
54461
54583
|
try {
|
|
54462
|
-
if (!(0,
|
|
54463
|
-
const ageMs = Date.now() - (0,
|
|
54464
|
-
(0,
|
|
54584
|
+
if (!(0, import_node_fs19.existsSync)(p)) continue;
|
|
54585
|
+
const ageMs = Date.now() - (0, import_node_fs19.statSync)(p).mtimeMs;
|
|
54586
|
+
(0, import_node_fs19.rmSync)(p, { force: true });
|
|
54465
54587
|
if (ageMs < FRESH_MS) fresh = true;
|
|
54466
54588
|
} catch {
|
|
54467
54589
|
}
|
|
@@ -54478,13 +54600,13 @@ function currentVersion() {
|
|
|
54478
54600
|
return appVersion();
|
|
54479
54601
|
}
|
|
54480
54602
|
function installRoot() {
|
|
54481
|
-
return (0,
|
|
54603
|
+
return (0, import_node_path18.dirname)((0, import_node_path18.dirname)(process.execPath));
|
|
54482
54604
|
}
|
|
54483
54605
|
function updateExePath() {
|
|
54484
|
-
return (0,
|
|
54606
|
+
return (0, import_node_path18.join)(installRoot(), "Update.exe");
|
|
54485
54607
|
}
|
|
54486
54608
|
function packagesDir() {
|
|
54487
|
-
return (0,
|
|
54609
|
+
return (0, import_node_path18.join)(installRoot(), "packages");
|
|
54488
54610
|
}
|
|
54489
54611
|
function feedUrl() {
|
|
54490
54612
|
const env2 = (process.env.FLOLESS_UPDATE_URL ?? "").trim().replace(/\/+$/, "");
|
|
@@ -54577,22 +54699,22 @@ async function checkForUpdate() {
|
|
|
54577
54699
|
}
|
|
54578
54700
|
async function sha1OfFile(path) {
|
|
54579
54701
|
const hash = (0, import_node_crypto6.createHash)("sha1");
|
|
54580
|
-
await (0, import_promises.pipeline)((0,
|
|
54702
|
+
await (0, import_promises.pipeline)((0, import_node_fs20.createReadStream)(path), hash);
|
|
54581
54703
|
return hash.digest("hex").toUpperCase();
|
|
54582
54704
|
}
|
|
54583
54705
|
async function downloadPackage(asset) {
|
|
54584
54706
|
if (!NUPKG_NAME.test(asset.FileName)) throw new Error(`refusing suspicious package name: ${asset.FileName}`);
|
|
54585
54707
|
const want = asset.SHA1.toUpperCase();
|
|
54586
54708
|
const dir = packagesDir();
|
|
54587
|
-
(0,
|
|
54588
|
-
const dest = (0,
|
|
54589
|
-
if ((0,
|
|
54709
|
+
(0, import_node_fs20.mkdirSync)(dir, { recursive: true });
|
|
54710
|
+
const dest = (0, import_node_path18.join)(dir, asset.FileName);
|
|
54711
|
+
if ((0, import_node_fs20.existsSync)(dest) && await sha1OfFile(dest) === want) return dest;
|
|
54590
54712
|
const res = await authedFetch(`${feedUrl()}/${encodeURIComponent(asset.FileName)}`, {
|
|
54591
54713
|
redirect: "follow",
|
|
54592
54714
|
signal: AbortSignal.timeout(DOWNLOAD_TIMEOUT_MS)
|
|
54593
54715
|
});
|
|
54594
54716
|
if (!res.ok || !res.body) throw new Error(`download failed: HTTP ${res.status} for ${asset.FileName}`);
|
|
54595
|
-
await (0, import_promises.pipeline)(import_node_stream.Readable.fromWeb(res.body), (0,
|
|
54717
|
+
await (0, import_promises.pipeline)(import_node_stream.Readable.fromWeb(res.body), (0, import_node_fs20.createWriteStream)(dest));
|
|
54596
54718
|
const got = await sha1OfFile(dest);
|
|
54597
54719
|
if (got !== want) throw new Error(`SHA1 mismatch for ${asset.FileName}: feed=${want} got=${got}`);
|
|
54598
54720
|
return dest;
|
|
@@ -54601,7 +54723,7 @@ async function applyUpdate(check, opts) {
|
|
|
54601
54723
|
if (!check.supported) return { applied: false, message: check.reason ?? "auto-update not supported in this runtime" };
|
|
54602
54724
|
if (!check.updateAvailable || !check.asset) return { applied: false, message: check.reason ?? "no update available" };
|
|
54603
54725
|
const exe = updateExePath();
|
|
54604
|
-
if (!(0,
|
|
54726
|
+
if (!(0, import_node_fs20.existsSync)(exe)) {
|
|
54605
54727
|
return { applied: false, message: `Update.exe not found at ${exe} \u2014 is this a Velopack install?` };
|
|
54606
54728
|
}
|
|
54607
54729
|
const pkg = await downloadPackage(check.asset);
|
|
@@ -54810,12 +54932,12 @@ function isTraceCorrupt(events) {
|
|
|
54810
54932
|
|
|
54811
54933
|
// launch.mjs
|
|
54812
54934
|
var import_node_child_process5 = require("node:child_process");
|
|
54813
|
-
var
|
|
54935
|
+
var import_node_path19 = require("node:path");
|
|
54814
54936
|
var import_node_url = require("node:url");
|
|
54815
|
-
var
|
|
54937
|
+
var import_node_fs21 = require("node:fs");
|
|
54816
54938
|
var import_node_http = __toESM(require("node:http"), 1);
|
|
54817
54939
|
var import_node_readline = require("node:readline");
|
|
54818
|
-
var __dirname2 = (0,
|
|
54940
|
+
var __dirname2 = (0, import_node_path19.dirname)((0, import_node_url.fileURLToPath)(__import_meta_url));
|
|
54819
54941
|
var PORT = Number(process.env.PORT ?? 4317);
|
|
54820
54942
|
var HEALTH_URL = `http://127.0.0.1:${PORT}/api/health`;
|
|
54821
54943
|
var BROWSER_URL = `http://floless.localhost:${PORT}`;
|
|
@@ -54887,8 +55009,8 @@ async function waitHealthy(timeoutMs = 3e4) {
|
|
|
54887
55009
|
function resolveServerStart() {
|
|
54888
55010
|
const packaged = /flolessapp\.exe$/i.test(process.execPath);
|
|
54889
55011
|
if (packaged) return { cmd: process.execPath, args: ["--serve"], shell: false };
|
|
54890
|
-
const bundle = (0,
|
|
54891
|
-
if ((0,
|
|
55012
|
+
const bundle = (0, import_node_path19.join)(__dirname2, "dist", "floless-server.cjs");
|
|
55013
|
+
if ((0, import_node_fs21.existsSync)(bundle)) return { cmd: process.execPath, args: [bundle, "--serve"], shell: false };
|
|
54892
55014
|
return { cmd: "npm", args: ["run", "start"], shell: isWin2 };
|
|
54893
55015
|
}
|
|
54894
55016
|
function startServerDetached() {
|
|
@@ -55041,8 +55163,8 @@ function taskkillArgs(pid, { tree = true } = {}) {
|
|
|
55041
55163
|
}
|
|
55042
55164
|
function killSupervisor({ tree = true } = {}) {
|
|
55043
55165
|
if (!isWin2) return;
|
|
55044
|
-
const isNpmChannel = /^node(\.exe)?$/i.test((0,
|
|
55045
|
-
const scriptMatch = isNpmChannel ? (0,
|
|
55166
|
+
const isNpmChannel = /^node(\.exe)?$/i.test((0, import_node_path19.basename)(process.execPath));
|
|
55167
|
+
const scriptMatch = isNpmChannel ? (0, import_node_path19.basename)((0, import_node_url.fileURLToPath)(__import_meta_url)) : void 0;
|
|
55046
55168
|
const realExe = resolveRealInstallExe(process.execPath);
|
|
55047
55169
|
const exeMatch = realExe === process.execPath ? process.execPath : [process.execPath, realExe];
|
|
55048
55170
|
const pids = supervisorPidsToKill(enumerateProcesses(), process.pid, exeMatch, scriptMatch);
|
|
@@ -55207,7 +55329,7 @@ async function runAction(arg, flagArgv = [], selfVersion = null) {
|
|
|
55207
55329
|
}
|
|
55208
55330
|
await action(parseTeardownFlags(flagArgv));
|
|
55209
55331
|
}
|
|
55210
|
-
var entry = (0,
|
|
55332
|
+
var entry = (0, import_node_path19.basename)(process.argv[1] ?? "").toLowerCase();
|
|
55211
55333
|
if (entry === "launch.mjs") {
|
|
55212
55334
|
runAction(process.argv[2], process.argv.slice(3)).catch((e) => {
|
|
55213
55335
|
log(`error: ${e?.message ?? e}`);
|
|
@@ -55281,9 +55403,9 @@ function awareUpgradeBlockReason(s) {
|
|
|
55281
55403
|
}
|
|
55282
55404
|
|
|
55283
55405
|
// skill-sync.ts
|
|
55284
|
-
var
|
|
55285
|
-
var
|
|
55286
|
-
var
|
|
55406
|
+
var import_node_fs22 = require("node:fs");
|
|
55407
|
+
var import_node_os15 = require("node:os");
|
|
55408
|
+
var import_node_path20 = require("node:path");
|
|
55287
55409
|
var import_node_url2 = require("node:url");
|
|
55288
55410
|
var import_yaml5 = __toESM(require_dist6(), 1);
|
|
55289
55411
|
|
|
@@ -55312,30 +55434,30 @@ function selectShippedSkillNames(names) {
|
|
|
55312
55434
|
}
|
|
55313
55435
|
|
|
55314
55436
|
// skill-sync.ts
|
|
55315
|
-
var __dirname3 = (0,
|
|
55437
|
+
var __dirname3 = (0, import_node_path20.dirname)((0, import_node_url2.fileURLToPath)(__import_meta_url));
|
|
55316
55438
|
function bundledSkillsRoot() {
|
|
55317
55439
|
const candidates = [
|
|
55318
|
-
(0,
|
|
55319
|
-
(0,
|
|
55320
|
-
(0,
|
|
55440
|
+
(0, import_node_path20.join)(__dirname3, "skills"),
|
|
55441
|
+
(0, import_node_path20.join)((0, import_node_path20.dirname)(process.execPath), "skills"),
|
|
55442
|
+
(0, import_node_path20.join)(__dirname3, "..", ".claude", "skills")
|
|
55321
55443
|
];
|
|
55322
|
-
return candidates.find((p) => (0,
|
|
55444
|
+
return candidates.find((p) => (0, import_node_fs22.existsSync)(p)) ?? null;
|
|
55323
55445
|
}
|
|
55324
55446
|
function targetConfigDirs() {
|
|
55325
55447
|
const override = process.env.FLOLESS_SKILL_TARGETS;
|
|
55326
55448
|
if (override) {
|
|
55327
55449
|
return override.split(";").map((d) => d.trim()).filter(Boolean).map((dir) => ({ runtime: "custom", dir }));
|
|
55328
55450
|
}
|
|
55329
|
-
const home = (0,
|
|
55451
|
+
const home = (0, import_node_os15.homedir)();
|
|
55330
55452
|
return [
|
|
55331
|
-
{ runtime: "claude", dir: (0,
|
|
55332
|
-
{ runtime: "codex", dir: (0,
|
|
55333
|
-
{ runtime: "opencode", dir: (0,
|
|
55453
|
+
{ runtime: "claude", dir: (0, import_node_path20.join)(home, ".claude") },
|
|
55454
|
+
{ runtime: "codex", dir: (0, import_node_path20.join)(home, ".codex") },
|
|
55455
|
+
{ runtime: "opencode", dir: (0, import_node_path20.join)(home, ".opencode") }
|
|
55334
55456
|
];
|
|
55335
55457
|
}
|
|
55336
55458
|
function skillVersion(skillMdPath) {
|
|
55337
55459
|
try {
|
|
55338
|
-
const text = (0,
|
|
55460
|
+
const text = (0, import_node_fs22.readFileSync)(skillMdPath, "utf8");
|
|
55339
55461
|
const m = /^---\r?\n([\s\S]*?)\r?\n---/.exec(text);
|
|
55340
55462
|
if (!m || m[1] === void 0) return null;
|
|
55341
55463
|
const fm = (0, import_yaml5.parse)(m[1]);
|
|
@@ -55375,21 +55497,21 @@ function decideAction(installed, bundled) {
|
|
|
55375
55497
|
function bundledSkills(root) {
|
|
55376
55498
|
let entries = [];
|
|
55377
55499
|
try {
|
|
55378
|
-
entries = selectShippedSkillNames((0,
|
|
55500
|
+
entries = selectShippedSkillNames((0, import_node_fs22.readdirSync)(root));
|
|
55379
55501
|
} catch {
|
|
55380
55502
|
return [];
|
|
55381
55503
|
}
|
|
55382
55504
|
const out = [];
|
|
55383
55505
|
for (const name of entries) {
|
|
55384
|
-
const dir = (0,
|
|
55506
|
+
const dir = (0, import_node_path20.join)(root, name);
|
|
55385
55507
|
let isDir = false;
|
|
55386
55508
|
try {
|
|
55387
|
-
isDir = (0,
|
|
55509
|
+
isDir = (0, import_node_fs22.statSync)(dir).isDirectory();
|
|
55388
55510
|
} catch {
|
|
55389
55511
|
isDir = false;
|
|
55390
55512
|
}
|
|
55391
55513
|
if (!isDir) continue;
|
|
55392
|
-
const v = skillVersion((0,
|
|
55514
|
+
const v = skillVersion((0, import_node_path20.join)(dir, "SKILL.md"));
|
|
55393
55515
|
if (!v) continue;
|
|
55394
55516
|
out.push({ name, dir, version: v });
|
|
55395
55517
|
}
|
|
@@ -55402,17 +55524,17 @@ function syncSkills() {
|
|
|
55402
55524
|
const skills = bundledSkills(root);
|
|
55403
55525
|
if (!skills.length) return results;
|
|
55404
55526
|
for (const { runtime, dir: cfg } of targetConfigDirs()) {
|
|
55405
|
-
if (!(0,
|
|
55406
|
-
const skillsDir = (0,
|
|
55527
|
+
if (!(0, import_node_fs22.existsSync)(cfg)) continue;
|
|
55528
|
+
const skillsDir = (0, import_node_path20.join)(cfg, "skills");
|
|
55407
55529
|
for (const s of skills) {
|
|
55408
|
-
const dest = (0,
|
|
55409
|
-
const installedMd = (0,
|
|
55410
|
-
const installed = (0,
|
|
55530
|
+
const dest = (0, import_node_path20.join)(skillsDir, s.name);
|
|
55531
|
+
const installedMd = (0, import_node_path20.join)(dest, "SKILL.md");
|
|
55532
|
+
const installed = (0, import_node_fs22.existsSync)(installedMd) ? skillVersion(installedMd) : null;
|
|
55411
55533
|
const action = decideAction(installed, s.version);
|
|
55412
55534
|
if (action === "installed" || action === "updated") {
|
|
55413
55535
|
try {
|
|
55414
|
-
if (action === "updated") (0,
|
|
55415
|
-
(0,
|
|
55536
|
+
if (action === "updated") (0, import_node_fs22.rmSync)(dest, { recursive: true, force: true });
|
|
55537
|
+
(0, import_node_fs22.cpSync)(s.dir, dest, { recursive: true });
|
|
55416
55538
|
results.push({ runtime, skill: s.name, action, from: installed, to: s.version });
|
|
55417
55539
|
} catch {
|
|
55418
55540
|
}
|
|
@@ -55425,9 +55547,9 @@ function syncSkills() {
|
|
|
55425
55547
|
}
|
|
55426
55548
|
|
|
55427
55549
|
// watch.ts
|
|
55428
|
-
var
|
|
55429
|
-
var
|
|
55430
|
-
var
|
|
55550
|
+
var import_node_os16 = require("node:os");
|
|
55551
|
+
var import_node_path22 = require("node:path");
|
|
55552
|
+
var import_node_fs23 = require("node:fs");
|
|
55431
55553
|
|
|
55432
55554
|
// node_modules/chokidar/esm/index.js
|
|
55433
55555
|
var import_fs2 = require("fs");
|
|
@@ -55438,7 +55560,7 @@ var sysPath2 = __toESM(require("path"), 1);
|
|
|
55438
55560
|
// node_modules/readdirp/esm/index.js
|
|
55439
55561
|
var import_promises2 = require("node:fs/promises");
|
|
55440
55562
|
var import_node_stream2 = require("node:stream");
|
|
55441
|
-
var
|
|
55563
|
+
var import_node_path21 = require("node:path");
|
|
55442
55564
|
var EntryTypes = {
|
|
55443
55565
|
FILE_TYPE: "files",
|
|
55444
55566
|
DIR_TYPE: "directories",
|
|
@@ -55513,7 +55635,7 @@ var ReaddirpStream = class extends import_node_stream2.Readable {
|
|
|
55513
55635
|
this._wantsDir = type ? DIR_TYPES.has(type) : false;
|
|
55514
55636
|
this._wantsFile = type ? FILE_TYPES.has(type) : false;
|
|
55515
55637
|
this._wantsEverything = type === EntryTypes.EVERYTHING_TYPE;
|
|
55516
|
-
this._root = (0,
|
|
55638
|
+
this._root = (0, import_node_path21.resolve)(root);
|
|
55517
55639
|
this._isDirent = !opts.alwaysStat;
|
|
55518
55640
|
this._statsProp = this._isDirent ? "dirent" : "stats";
|
|
55519
55641
|
this._rdOptions = { encoding: "utf8", withFileTypes: this._isDirent };
|
|
@@ -55584,8 +55706,8 @@ var ReaddirpStream = class extends import_node_stream2.Readable {
|
|
|
55584
55706
|
let entry2;
|
|
55585
55707
|
const basename5 = this._isDirent ? dirent.name : dirent;
|
|
55586
55708
|
try {
|
|
55587
|
-
const fullPath = (0,
|
|
55588
|
-
entry2 = { path: (0,
|
|
55709
|
+
const fullPath = (0, import_node_path21.resolve)((0, import_node_path21.join)(path, basename5));
|
|
55710
|
+
entry2 = { path: (0, import_node_path21.relative)(this._root, fullPath), fullPath, basename: basename5 };
|
|
55589
55711
|
entry2[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
|
|
55590
55712
|
} catch (err) {
|
|
55591
55713
|
this._onError(err);
|
|
@@ -55619,7 +55741,7 @@ var ReaddirpStream = class extends import_node_stream2.Readable {
|
|
|
55619
55741
|
}
|
|
55620
55742
|
if (entryRealPathStats.isDirectory()) {
|
|
55621
55743
|
const len = entryRealPath.length;
|
|
55622
|
-
if (full.startsWith(entryRealPath) && full.substr(len, 1) ===
|
|
55744
|
+
if (full.startsWith(entryRealPath) && full.substr(len, 1) === import_node_path21.sep) {
|
|
55623
55745
|
const recursiveError = new Error(`Circular symlink detected: "${full}" points to "${entryRealPath}"`);
|
|
55624
55746
|
recursiveError.code = RECURSIVE_ERROR_CODE;
|
|
55625
55747
|
return this._onError(recursiveError);
|
|
@@ -57127,33 +57249,33 @@ function appIdFromLogPath(path) {
|
|
|
57127
57249
|
return i >= 0 && parts[i + 1] ? parts[i + 1] : null;
|
|
57128
57250
|
}
|
|
57129
57251
|
function samePath(a, b) {
|
|
57130
|
-
const ra = (0,
|
|
57131
|
-
const rb = (0,
|
|
57252
|
+
const ra = (0, import_node_path22.resolve)(a);
|
|
57253
|
+
const rb = (0, import_node_path22.resolve)(b);
|
|
57132
57254
|
return process.platform === "win32" ? ra.toLowerCase() === rb.toLowerCase() : ra === rb;
|
|
57133
57255
|
}
|
|
57134
57256
|
function underDir(path, dir) {
|
|
57135
|
-
const rp = (0,
|
|
57136
|
-
const rd = (0,
|
|
57257
|
+
const rp = (0, import_node_path22.resolve)(path);
|
|
57258
|
+
const rd = (0, import_node_path22.resolve)(dir);
|
|
57137
57259
|
const [p, d] = process.platform === "win32" ? [rp.toLowerCase(), rd.toLowerCase()] : [rp, rd];
|
|
57138
|
-
return p === d || p.startsWith(d +
|
|
57260
|
+
return p === d || p.startsWith(d + import_node_path22.sep);
|
|
57139
57261
|
}
|
|
57140
57262
|
function startWatcher() {
|
|
57141
|
-
const awareDir = process.env.AWARE_HOME ?? (0,
|
|
57142
|
-
const credentialsDir = (0,
|
|
57143
|
-
if (!(0,
|
|
57263
|
+
const awareDir = process.env.AWARE_HOME ?? (0, import_node_path22.join)((0, import_node_os16.homedir)(), ".aware");
|
|
57264
|
+
const credentialsDir = (0, import_node_path22.join)(awareDir, "credentials");
|
|
57265
|
+
if (!(0, import_node_fs23.existsSync)(credentialsDir)) {
|
|
57144
57266
|
try {
|
|
57145
|
-
(0,
|
|
57267
|
+
(0, import_node_fs23.mkdirSync)(credentialsDir, { recursive: true });
|
|
57146
57268
|
} catch {
|
|
57147
57269
|
}
|
|
57148
57270
|
}
|
|
57149
|
-
if (!(0,
|
|
57271
|
+
if (!(0, import_node_fs23.existsSync)(uiDir)) {
|
|
57150
57272
|
try {
|
|
57151
|
-
(0,
|
|
57273
|
+
(0, import_node_fs23.mkdirSync)(uiDir, { recursive: true });
|
|
57152
57274
|
} catch {
|
|
57153
57275
|
}
|
|
57154
57276
|
}
|
|
57155
|
-
const targets = ["apps", "logs", "credentials"].map((d) => (0,
|
|
57156
|
-
if ((0,
|
|
57277
|
+
const targets = ["apps", "logs", "credentials"].map((d) => (0, import_node_path22.join)(awareDir, d)).filter((p) => (0, import_node_fs23.existsSync)(p));
|
|
57278
|
+
if ((0, import_node_fs23.existsSync)(uiDir)) targets.push(uiDir);
|
|
57157
57279
|
if (targets.length === 0) {
|
|
57158
57280
|
return null;
|
|
57159
57281
|
}
|
|
@@ -57161,18 +57283,17 @@ function startWatcher() {
|
|
|
57161
57283
|
ignoreInitial: true,
|
|
57162
57284
|
awaitWriteFinish: { stabilityThreshold: 150, pollInterval: 50 }
|
|
57163
57285
|
});
|
|
57286
|
+
seedTimeline();
|
|
57164
57287
|
let lastExtContent = readExtensionsText();
|
|
57165
57288
|
const handleExtensionsChange = () => {
|
|
57166
57289
|
const next = readExtensionsText();
|
|
57167
57290
|
if (next === lastExtContent) return;
|
|
57168
|
-
if (lastExtContent !== null) {
|
|
57169
|
-
try {
|
|
57170
|
-
snapshotExtensions(lastExtContent);
|
|
57171
|
-
} catch (err) {
|
|
57172
|
-
console.warn("[floless] failed to snapshot the previous extensions.json before a change (undo for this step is lost):", err);
|
|
57173
|
-
}
|
|
57174
|
-
}
|
|
57175
57291
|
lastExtContent = next;
|
|
57292
|
+
try {
|
|
57293
|
+
recordChange(next);
|
|
57294
|
+
} catch (err) {
|
|
57295
|
+
console.warn("[floless] failed to record the extensions.json change in the undo timeline (undo for this step is lost):", err);
|
|
57296
|
+
}
|
|
57176
57297
|
broadcast({ type: "extensions-changed" });
|
|
57177
57298
|
};
|
|
57178
57299
|
watcher.on("all", (event, path) => {
|
|
@@ -57183,11 +57304,11 @@ function startWatcher() {
|
|
|
57183
57304
|
const isCredential = path.split(/[\\/]/).includes("credentials");
|
|
57184
57305
|
const kind = isCredential ? "credential" : path.endsWith(".jsonl") ? "trace" : path.endsWith(".lock") ? "lock" : path.endsWith(".flo") || path.endsWith(".app") ? "source" : "file";
|
|
57185
57306
|
broadcast({ type: "fs-change", kind, event, path });
|
|
57186
|
-
if (kind === "trace" && event !== "unlink" && (0,
|
|
57307
|
+
if (kind === "trace" && event !== "unlink" && (0, import_node_fs23.existsSync)(path)) {
|
|
57187
57308
|
const id = appIdFromLogPath(path);
|
|
57188
57309
|
if (!id) return;
|
|
57189
57310
|
try {
|
|
57190
|
-
broadcast({ type: "trace-file", id, runId: path.split(
|
|
57311
|
+
broadcast({ type: "trace-file", id, runId: path.split(import_node_path22.sep).pop()?.replace(/\.jsonl$/, "") ?? null, events: parseTrace((0, import_node_fs23.readFileSync)(path, "utf8")) });
|
|
57191
57312
|
} catch {
|
|
57192
57313
|
}
|
|
57193
57314
|
}
|
|
@@ -57196,10 +57317,10 @@ function startWatcher() {
|
|
|
57196
57317
|
}
|
|
57197
57318
|
|
|
57198
57319
|
// index.ts
|
|
57199
|
-
var __dirname4 = (0,
|
|
57200
|
-
var WEB_ROOT = [(0,
|
|
57201
|
-
(p) => (0,
|
|
57202
|
-
) ?? (0,
|
|
57320
|
+
var __dirname4 = (0, import_node_path23.dirname)((0, import_node_url3.fileURLToPath)(__import_meta_url));
|
|
57321
|
+
var WEB_ROOT = [(0, import_node_path23.join)(__dirname4, "web"), (0, import_node_path23.join)((0, import_node_path23.dirname)(process.execPath), "web"), (0, import_node_path23.join)(__dirname4, "..", "web")].find(
|
|
57322
|
+
(p) => (0, import_node_fs24.existsSync)(p)
|
|
57323
|
+
) ?? (0, import_node_path23.join)(__dirname4, "..", "web");
|
|
57203
57324
|
var PORT2 = Number(process.env.PORT ?? 4317);
|
|
57204
57325
|
var HOST = "127.0.0.1";
|
|
57205
57326
|
var crashHandlersInstalled = false;
|
|
@@ -57215,7 +57336,7 @@ function installCrashHandlers() {
|
|
|
57215
57336
|
${stack}
|
|
57216
57337
|
`;
|
|
57217
57338
|
try {
|
|
57218
|
-
(0,
|
|
57339
|
+
(0, import_node_fs24.appendFileSync)(logFilePath(), line);
|
|
57219
57340
|
} catch {
|
|
57220
57341
|
}
|
|
57221
57342
|
if (process.stderr.isTTY) process.stderr.write(line);
|
|
@@ -57246,7 +57367,7 @@ async function startServer() {
|
|
|
57246
57367
|
}
|
|
57247
57368
|
});
|
|
57248
57369
|
await app.register(import_static.default, { root: WEB_ROOT, prefix: "/" });
|
|
57249
|
-
const MIN_AWARE = "0.
|
|
57370
|
+
const MIN_AWARE = "0.70.0";
|
|
57250
57371
|
const isWin3 = process.platform === "win32";
|
|
57251
57372
|
const has = (cmd) => {
|
|
57252
57373
|
try {
|
|
@@ -57597,11 +57718,11 @@ async function startServer() {
|
|
|
57597
57718
|
if (appExists(id)) {
|
|
57598
57719
|
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 });
|
|
57599
57720
|
}
|
|
57600
|
-
const stageRoot = (0,
|
|
57721
|
+
const stageRoot = (0, import_node_fs24.mkdtempSync)((0, import_node_path23.join)((0, import_node_os17.tmpdir)(), "floless-import-"));
|
|
57601
57722
|
try {
|
|
57602
|
-
const stageDir = (0,
|
|
57603
|
-
(0,
|
|
57604
|
-
(0,
|
|
57723
|
+
const stageDir = (0, import_node_path23.join)(stageRoot, id);
|
|
57724
|
+
(0, import_node_fs24.mkdirSync)(stageDir);
|
|
57725
|
+
(0, import_node_fs24.writeFileSync)((0, import_node_path23.join)(stageDir, `${id}.flo`), content);
|
|
57605
57726
|
await aware.install(stageDir);
|
|
57606
57727
|
} catch (err) {
|
|
57607
57728
|
try {
|
|
@@ -57611,7 +57732,7 @@ async function startServer() {
|
|
|
57611
57732
|
const msg = err instanceof AwareError ? err.message : String(err?.message ?? err);
|
|
57612
57733
|
return reply.status(502).send({ ok: false, error: `import failed: ${msg}` });
|
|
57613
57734
|
} finally {
|
|
57614
|
-
(0,
|
|
57735
|
+
(0, import_node_fs24.rmSync)(stageRoot, { recursive: true, force: true });
|
|
57615
57736
|
}
|
|
57616
57737
|
broadcast({ type: "apps-changed", id });
|
|
57617
57738
|
return { ok: true, id };
|
|
@@ -57625,13 +57746,13 @@ async function startServer() {
|
|
|
57625
57746
|
}
|
|
57626
57747
|
const inputs = appData.inputs.map((i) => ({ name: i.name, type: i.type }));
|
|
57627
57748
|
const baked = bakeFloSource(appData.source.text, inputs);
|
|
57628
|
-
const tmpRoot = (0,
|
|
57629
|
-
const backupDir = (0,
|
|
57630
|
-
const bakeDir = (0,
|
|
57631
|
-
(0,
|
|
57632
|
-
(0,
|
|
57749
|
+
const tmpRoot = (0, import_node_fs24.mkdtempSync)((0, import_node_path23.join)((0, import_node_os17.tmpdir)(), "floless-bake-"));
|
|
57750
|
+
const backupDir = (0, import_node_path23.join)(tmpRoot, `${id}-backup`);
|
|
57751
|
+
const bakeDir = (0, import_node_path23.join)(tmpRoot, id);
|
|
57752
|
+
(0, import_node_fs24.cpSync)(appDir(id), backupDir, { recursive: true });
|
|
57753
|
+
(0, import_node_fs24.cpSync)(appDir(id), bakeDir, { recursive: true });
|
|
57633
57754
|
const floName = appData.source.path.split(/[\\/]/).pop();
|
|
57634
|
-
(0,
|
|
57755
|
+
(0, import_node_fs24.writeFileSync)((0, import_node_path23.join)(bakeDir, floName), baked);
|
|
57635
57756
|
let appInstalled2 = true;
|
|
57636
57757
|
try {
|
|
57637
57758
|
await aware.uninstall(id);
|
|
@@ -57653,17 +57774,17 @@ async function startServer() {
|
|
|
57653
57774
|
throw installErr;
|
|
57654
57775
|
}
|
|
57655
57776
|
try {
|
|
57656
|
-
await aware.compile((0,
|
|
57777
|
+
await aware.compile((0, import_node_path23.join)(appDir(id), floName));
|
|
57657
57778
|
} catch (compileErr) {
|
|
57658
57779
|
app.log.warn({ id, compileErr: String(compileErr) }, "bake: post-install recompile failed (app baked but may need a manual Compile)");
|
|
57659
57780
|
}
|
|
57660
57781
|
broadcast({ type: "baked", id });
|
|
57661
57782
|
return { ok: true, id, agent: id, inputs };
|
|
57662
57783
|
} finally {
|
|
57663
|
-
if (appInstalled2) (0,
|
|
57784
|
+
if (appInstalled2) (0, import_node_fs24.rmSync)(tmpRoot, { recursive: true, force: true });
|
|
57664
57785
|
}
|
|
57665
57786
|
});
|
|
57666
|
-
const graftAgentsDir = () => (0,
|
|
57787
|
+
const graftAgentsDir = () => (0, import_node_path23.join)((0, import_node_os17.homedir)(), ".aware", "agents");
|
|
57667
57788
|
app.post("/api/graft/match", async (req, reply) => {
|
|
57668
57789
|
const { glob } = req.body ?? {};
|
|
57669
57790
|
if (!glob) return reply.status(400).send({ ok: false, error: "glob required" });
|
|
@@ -57680,7 +57801,7 @@ async function startServer() {
|
|
|
57680
57801
|
if (!sourceKind || !sourceRef) {
|
|
57681
57802
|
return reply.status(400).send({ ok: false, error: "sourceKind and sourceRef required" });
|
|
57682
57803
|
}
|
|
57683
|
-
const tempHome = (0,
|
|
57804
|
+
const tempHome = (0, import_node_fs24.mkdtempSync)((0, import_node_path23.join)((0, import_node_os17.tmpdir)(), "floless-graft-"));
|
|
57684
57805
|
let result;
|
|
57685
57806
|
try {
|
|
57686
57807
|
result = await aware.build({
|
|
@@ -57693,19 +57814,19 @@ async function startServer() {
|
|
|
57693
57814
|
awareHome: tempHome
|
|
57694
57815
|
});
|
|
57695
57816
|
} catch (err) {
|
|
57696
|
-
(0,
|
|
57817
|
+
(0, import_node_fs24.rmSync)(tempHome, { recursive: true, force: true });
|
|
57697
57818
|
const msg = err instanceof AwareError ? err.message : String(err?.message ?? err);
|
|
57698
57819
|
return reply.status(422).send({ ok: false, error: msg });
|
|
57699
57820
|
}
|
|
57700
57821
|
const manifest = readStagedManifest(result.agentDir);
|
|
57701
57822
|
if (!manifest) {
|
|
57702
|
-
(0,
|
|
57823
|
+
(0, import_node_fs24.rmSync)(tempHome, { recursive: true, force: true });
|
|
57703
57824
|
return reply.status(502).send({ ok: false, error: `build produced output at ${result.agentDir} but no manifest.yaml` });
|
|
57704
57825
|
}
|
|
57705
57826
|
const token = (0, import_node_crypto7.randomUUID)();
|
|
57706
57827
|
registerStage(token, tempHome, result.agentId);
|
|
57707
57828
|
const preview = buildPreview(manifest, sourceKind, sourceRef, token);
|
|
57708
|
-
if ((0,
|
|
57829
|
+
if ((0, import_node_fs24.existsSync)((0, import_node_path23.join)(graftAgentsDir(), result.agentId))) {
|
|
57709
57830
|
preview.warnings.unshift(`An agent named "${result.agentId}" is already installed \u2014 creating it will overwrite it.`);
|
|
57710
57831
|
}
|
|
57711
57832
|
return { ok: true, preview };
|
|
@@ -57724,7 +57845,7 @@ async function startServer() {
|
|
|
57724
57845
|
registerStage(stagedRef, stage.tempDir, stage.agentId);
|
|
57725
57846
|
return reply.status(409).send({ ok: false, error: err.message, agentId: stage.agentId, collision: true });
|
|
57726
57847
|
}
|
|
57727
|
-
(0,
|
|
57848
|
+
(0, import_node_fs24.rmSync)(stage.tempDir, { recursive: true, force: true });
|
|
57728
57849
|
throw err;
|
|
57729
57850
|
}
|
|
57730
57851
|
broadcast({ type: "grafted", id: stage.agentId });
|
|
@@ -57762,9 +57883,10 @@ async function startServer() {
|
|
|
57762
57883
|
if (!id) return reply.status(400).send({ ok: false, error: "id required" });
|
|
57763
57884
|
const blocked = hostRunBlocked(appProvider(id));
|
|
57764
57885
|
if (blocked) return reply.send({ ok: false, error: blocked, blocked: true, simulate: !!simulate });
|
|
57886
|
+
const runInputs = steelIfcRunInputs(id, inputs);
|
|
57765
57887
|
let result;
|
|
57766
57888
|
try {
|
|
57767
|
-
result = await aware.run(id, { dryRun, simulate, inputs });
|
|
57889
|
+
result = await aware.run(id, { dryRun, simulate, inputs: runInputs });
|
|
57768
57890
|
} catch (err) {
|
|
57769
57891
|
if (err instanceof AwareError) {
|
|
57770
57892
|
const detail = err.detail && typeof err.detail === "object" ? err.detail : null;
|
|
@@ -57783,7 +57905,7 @@ async function startServer() {
|
|
|
57783
57905
|
broadcast({ type: "run-started", id, dryRun: !!dryRun, simulate: !!simulate, runId: result.runId });
|
|
57784
57906
|
for (const ev of events) broadcast({ type: "trace", id, event: ev });
|
|
57785
57907
|
broadcast({ type: "run-ended", id, runId: result.runId });
|
|
57786
|
-
const extracted = extractReportHtml(events);
|
|
57908
|
+
const extracted = extractReportHtml(events, id);
|
|
57787
57909
|
let report = null;
|
|
57788
57910
|
if (extracted) {
|
|
57789
57911
|
let interactive = false;
|
|
@@ -57956,11 +58078,11 @@ async function startServer() {
|
|
|
57956
58078
|
app.get("/api/requests/:id/snapshot/:n", async (req, reply) => {
|
|
57957
58079
|
const n = Number.parseInt(req.params.n, 10);
|
|
57958
58080
|
const p = Number.isInteger(n) ? snapshotPathFor(req.params.id, n) : null;
|
|
57959
|
-
if (!p || !(0,
|
|
58081
|
+
if (!p || !(0, import_node_fs24.existsSync)(p)) return reply.status(404).send({ ok: false, error: "snapshot not found" });
|
|
57960
58082
|
const ext = p.split(".").pop().toLowerCase();
|
|
57961
58083
|
reply.header("Content-Type", ext === "png" ? "image/png" : ext === "webp" ? "image/webp" : ext === "pdf" ? "application/pdf" : "image/jpeg");
|
|
57962
58084
|
reply.header("Cache-Control", "no-store");
|
|
57963
|
-
return (0,
|
|
58085
|
+
return (0, import_node_fs24.readFileSync)(p);
|
|
57964
58086
|
});
|
|
57965
58087
|
app.post(
|
|
57966
58088
|
"/api/tweak",
|
|
@@ -58079,7 +58201,7 @@ async function startServer() {
|
|
|
58079
58201
|
runId: latest.runId,
|
|
58080
58202
|
status: summarizeRun(events).status,
|
|
58081
58203
|
rows: extractRunRows(events),
|
|
58082
|
-
html: withBadge(extractReportHtml(events))?.html ?? null
|
|
58204
|
+
html: withBadge(extractReportHtml(events, ref))?.html ?? null
|
|
58083
58205
|
};
|
|
58084
58206
|
}
|
|
58085
58207
|
if (kind === "last-run-status") {
|
|
@@ -58090,7 +58212,7 @@ async function startServer() {
|
|
|
58090
58212
|
warn(`last-run-status:${ref} \u2014 trace exists but couldn't be parsed (corrupt/truncated)`);
|
|
58091
58213
|
let finishedAt2 = null;
|
|
58092
58214
|
try {
|
|
58093
|
-
finishedAt2 = (0,
|
|
58215
|
+
finishedAt2 = (0, import_node_fs24.statSync)(latest.path).mtime.toISOString();
|
|
58094
58216
|
} catch {
|
|
58095
58217
|
finishedAt2 = null;
|
|
58096
58218
|
}
|
|
@@ -58100,7 +58222,7 @@ async function startServer() {
|
|
|
58100
58222
|
let finishedAt = typeof runEnd?.ts === "string" ? runEnd.ts : null;
|
|
58101
58223
|
if (!finishedAt) {
|
|
58102
58224
|
try {
|
|
58103
|
-
finishedAt = (0,
|
|
58225
|
+
finishedAt = (0, import_node_fs24.statSync)(latest.path).mtime.toISOString();
|
|
58104
58226
|
} catch {
|
|
58105
58227
|
finishedAt = null;
|
|
58106
58228
|
}
|
|
@@ -58179,15 +58301,20 @@ async function startServer() {
|
|
|
58179
58301
|
});
|
|
58180
58302
|
app.post("/api/extensions/undo", async (_req, reply) => {
|
|
58181
58303
|
const result = undoExtensions();
|
|
58182
|
-
if (!result.restored) return reply.send({ ok: false, error: "nothing to undo" });
|
|
58183
|
-
return { ok: true, descriptor: result.descriptor };
|
|
58304
|
+
if (!result.restored) return reply.send({ ok: false, error: "nothing to undo", canUndo: result.canUndo, canRedo: result.canRedo });
|
|
58305
|
+
return { ok: true, descriptor: result.descriptor, canUndo: result.canUndo, canRedo: result.canRedo };
|
|
58306
|
+
});
|
|
58307
|
+
app.post("/api/extensions/redo", async (_req, reply) => {
|
|
58308
|
+
const result = redoExtensions();
|
|
58309
|
+
if (!result.restored) return reply.send({ ok: false, error: "nothing to redo", canUndo: result.canUndo, canRedo: result.canRedo });
|
|
58310
|
+
return { ok: true, descriptor: result.descriptor, canUndo: result.canUndo, canRedo: result.canRedo };
|
|
58184
58311
|
});
|
|
58185
58312
|
app.post("/api/extensions/reset", async (_req, reply) => {
|
|
58186
58313
|
const result = resetExtensions();
|
|
58187
|
-
if (!result.reset) return reply.send({ ok: false, error: "nothing to reset \u2014 the dashboard is already the default" });
|
|
58188
|
-
return { ok: true, descriptor: null };
|
|
58314
|
+
if (!result.reset) return reply.send({ ok: false, error: "nothing to reset \u2014 the dashboard is already the default", canUndo: result.canUndo, canRedo: result.canRedo });
|
|
58315
|
+
return { ok: true, descriptor: null, canUndo: result.canUndo, canRedo: result.canRedo };
|
|
58189
58316
|
});
|
|
58190
|
-
app.get("/api/extensions/history", async () => ({ ok: true, history: listHistory() }));
|
|
58317
|
+
app.get("/api/extensions/history", async () => ({ ok: true, history: listHistory(), ...historyState() }));
|
|
58191
58318
|
app.get("/api/events", async (_req, reply) => {
|
|
58192
58319
|
reply.hijack();
|
|
58193
58320
|
reply.raw.writeHead(200, {
|