@floless/app 0.11.0 → 0.12.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 +757 -328
- package/dist/skills/floless-app-ui/SKILL.md +131 -0
- package/dist/web/app.css +164 -0
- package/dist/web/aware.js +40 -3
- package/dist/web/index.html +46 -3
- package/dist/web/panels.js +660 -0
- package/package.json +1 -1
package/dist/floless-server.cjs
CHANGED
|
@@ -294,41 +294,41 @@ var require_queue = __commonJS({
|
|
|
294
294
|
queue2.drained = drained;
|
|
295
295
|
return queue2;
|
|
296
296
|
function push(value) {
|
|
297
|
-
var p = new Promise(function(
|
|
297
|
+
var p = new Promise(function(resolve5, reject) {
|
|
298
298
|
pushCb(value, function(err, result) {
|
|
299
299
|
if (err) {
|
|
300
300
|
reject(err);
|
|
301
301
|
return;
|
|
302
302
|
}
|
|
303
|
-
|
|
303
|
+
resolve5(result);
|
|
304
304
|
});
|
|
305
305
|
});
|
|
306
306
|
p.catch(noop);
|
|
307
307
|
return p;
|
|
308
308
|
}
|
|
309
309
|
function unshift(value) {
|
|
310
|
-
var p = new Promise(function(
|
|
310
|
+
var p = new Promise(function(resolve5, reject) {
|
|
311
311
|
unshiftCb(value, function(err, result) {
|
|
312
312
|
if (err) {
|
|
313
313
|
reject(err);
|
|
314
314
|
return;
|
|
315
315
|
}
|
|
316
|
-
|
|
316
|
+
resolve5(result);
|
|
317
317
|
});
|
|
318
318
|
});
|
|
319
319
|
p.catch(noop);
|
|
320
320
|
return p;
|
|
321
321
|
}
|
|
322
322
|
function drained() {
|
|
323
|
-
var p = new Promise(function(
|
|
323
|
+
var p = new Promise(function(resolve5) {
|
|
324
324
|
process.nextTick(function() {
|
|
325
325
|
if (queue2.idle()) {
|
|
326
|
-
|
|
326
|
+
resolve5();
|
|
327
327
|
} else {
|
|
328
328
|
var previousDrain = queue2.drain;
|
|
329
329
|
queue2.drain = function() {
|
|
330
330
|
if (typeof previousDrain === "function") previousDrain();
|
|
331
|
-
|
|
331
|
+
resolve5();
|
|
332
332
|
queue2.drain = previousDrain;
|
|
333
333
|
};
|
|
334
334
|
}
|
|
@@ -671,8 +671,8 @@ var require_create_promise = __commonJS({
|
|
|
671
671
|
reject: null,
|
|
672
672
|
promise: null
|
|
673
673
|
};
|
|
674
|
-
obj.promise = new Promise((
|
|
675
|
-
obj.resolve =
|
|
674
|
+
obj.promise = new Promise((resolve5, reject) => {
|
|
675
|
+
obj.resolve = resolve5;
|
|
676
676
|
obj.reject = reject;
|
|
677
677
|
});
|
|
678
678
|
return obj;
|
|
@@ -941,11 +941,11 @@ var require_thenify = __commonJS({
|
|
|
941
941
|
return;
|
|
942
942
|
}
|
|
943
943
|
debug("thenify");
|
|
944
|
-
return (
|
|
944
|
+
return (resolve5, reject) => {
|
|
945
945
|
const p = this._loadRegistered();
|
|
946
946
|
return p.then(() => {
|
|
947
947
|
this[kThenifyDoNotWrap] = true;
|
|
948
|
-
return
|
|
948
|
+
return resolve5(this._server);
|
|
949
949
|
}, reject);
|
|
950
950
|
};
|
|
951
951
|
}
|
|
@@ -1082,12 +1082,12 @@ var require_boot = __commonJS({
|
|
|
1082
1082
|
inherits(Boot, EE);
|
|
1083
1083
|
if ("asyncDispose" in Symbol) {
|
|
1084
1084
|
Boot.prototype[Symbol.asyncDispose] = function() {
|
|
1085
|
-
return new Promise((
|
|
1085
|
+
return new Promise((resolve5, reject) => {
|
|
1086
1086
|
this.close((err) => {
|
|
1087
1087
|
if (err) {
|
|
1088
1088
|
return reject(err);
|
|
1089
1089
|
}
|
|
1090
|
-
|
|
1090
|
+
resolve5();
|
|
1091
1091
|
});
|
|
1092
1092
|
});
|
|
1093
1093
|
};
|
|
@@ -1234,12 +1234,12 @@ var require_boot = __commonJS({
|
|
|
1234
1234
|
throw new AVV_ERR_CALLBACK_NOT_FN("close", typeof func);
|
|
1235
1235
|
}
|
|
1236
1236
|
} else {
|
|
1237
|
-
promise = new Promise(function(
|
|
1237
|
+
promise = new Promise(function(resolve5, reject) {
|
|
1238
1238
|
func = function(err) {
|
|
1239
1239
|
if (err) {
|
|
1240
1240
|
return reject(err);
|
|
1241
1241
|
}
|
|
1242
|
-
|
|
1242
|
+
resolve5();
|
|
1243
1243
|
};
|
|
1244
1244
|
});
|
|
1245
1245
|
}
|
|
@@ -1259,7 +1259,7 @@ var require_boot = __commonJS({
|
|
|
1259
1259
|
queueMicrotask(this.start.bind(this));
|
|
1260
1260
|
return;
|
|
1261
1261
|
}
|
|
1262
|
-
return new Promise((
|
|
1262
|
+
return new Promise((resolve5, reject) => {
|
|
1263
1263
|
this._readyQ.push(readyPromiseCB);
|
|
1264
1264
|
this.start();
|
|
1265
1265
|
const relativeContext = this._current[0].server;
|
|
@@ -1267,7 +1267,7 @@ var require_boot = __commonJS({
|
|
|
1267
1267
|
if (err) {
|
|
1268
1268
|
reject(err);
|
|
1269
1269
|
} else {
|
|
1270
|
-
|
|
1270
|
+
resolve5(relativeContext);
|
|
1271
1271
|
}
|
|
1272
1272
|
process.nextTick(done);
|
|
1273
1273
|
}
|
|
@@ -2542,8 +2542,8 @@ var require_promise = __commonJS({
|
|
|
2542
2542
|
var { kTestInternals } = require_symbols2();
|
|
2543
2543
|
function withResolvers() {
|
|
2544
2544
|
let res, rej;
|
|
2545
|
-
const promise = new Promise((
|
|
2546
|
-
res =
|
|
2545
|
+
const promise = new Promise((resolve5, reject) => {
|
|
2546
|
+
res = resolve5;
|
|
2547
2547
|
rej = reject;
|
|
2548
2548
|
});
|
|
2549
2549
|
return { promise, resolve: res, reject: rej };
|
|
@@ -2642,15 +2642,15 @@ var require_server = __commonJS({
|
|
|
2642
2642
|
if (cb === void 0) {
|
|
2643
2643
|
const listening = listenPromise.call(this, server, listenOptions);
|
|
2644
2644
|
return listening.then((address) => {
|
|
2645
|
-
const { promise, resolve:
|
|
2645
|
+
const { promise, resolve: resolve5 } = PonyPromise.withResolvers();
|
|
2646
2646
|
if (host === "localhost") {
|
|
2647
2647
|
multipleBindings.call(this, server, httpHandler, options, listenOptions, () => {
|
|
2648
2648
|
this[kState].listening = true;
|
|
2649
|
-
|
|
2649
|
+
resolve5(address);
|
|
2650
2650
|
onListenHookRunner(this);
|
|
2651
2651
|
});
|
|
2652
2652
|
} else {
|
|
2653
|
-
|
|
2653
|
+
resolve5(address);
|
|
2654
2654
|
onListenHookRunner(this);
|
|
2655
2655
|
}
|
|
2656
2656
|
return promise;
|
|
@@ -2777,7 +2777,7 @@ var require_server = __commonJS({
|
|
|
2777
2777
|
}
|
|
2778
2778
|
return this.ready().then(() => {
|
|
2779
2779
|
if (this[kState].aborted) return;
|
|
2780
|
-
const { promise, resolve:
|
|
2780
|
+
const { promise, resolve: resolve5, reject } = PonyPromise.withResolvers();
|
|
2781
2781
|
const errEventHandler = (err) => {
|
|
2782
2782
|
cleanup();
|
|
2783
2783
|
this[kState].listening = false;
|
|
@@ -2786,7 +2786,7 @@ var require_server = __commonJS({
|
|
|
2786
2786
|
const listeningEventHandler = () => {
|
|
2787
2787
|
cleanup();
|
|
2788
2788
|
this[kState].listening = true;
|
|
2789
|
-
|
|
2789
|
+
resolve5(logServerAddress.call(
|
|
2790
2790
|
this,
|
|
2791
2791
|
server,
|
|
2792
2792
|
listenOptions.listenTextResolver || defaultResolveServerListeningText
|
|
@@ -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: join21 } = 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"] || join21(__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: existsSync19 } = require("node:fs");
|
|
6010
6010
|
var getCallers = require_caller();
|
|
6011
|
-
var { join:
|
|
6011
|
+
var { join: join21, isAbsolute: isAbsolute2, sep: sep3 } = 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) && !existsSync19(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"] || join21(__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"] || join21(__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 join21(__dirname, "..", "file.js");
|
|
6206
6206
|
}
|
|
6207
6207
|
let fixTarget2;
|
|
6208
6208
|
for (const filePath of callers) {
|
|
@@ -7182,7 +7182,7 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
7182
7182
|
return circularValue;
|
|
7183
7183
|
}
|
|
7184
7184
|
let res = "";
|
|
7185
|
-
let
|
|
7185
|
+
let join21 = ",";
|
|
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
|
+
join21 = `,
|
|
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 += join21;
|
|
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 += `${join21}"... ${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
|
+
join21 = `,
|
|
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 = join21;
|
|
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 = join21;
|
|
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 join21 = ",";
|
|
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
|
+
join21 = `,
|
|
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 += join21;
|
|
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 += `${join21}"... ${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
|
+
join21 = `,
|
|
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 = join21;
|
|
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 join22 = `,
|
|
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 += join22;
|
|
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 += `${join22}"... ${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 join21 = `,
|
|
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, join21, maximumBreadth);
|
|
7438
7438
|
keys = keys.slice(value.length);
|
|
7439
7439
|
maximumPropertiesToStringify -= value.length;
|
|
7440
|
-
separator =
|
|
7440
|
+
separator = join21;
|
|
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 = join21;
|
|
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 = join21;
|
|
7458
7458
|
}
|
|
7459
7459
|
if (separator !== "") {
|
|
7460
7460
|
res = `
|
|
@@ -15309,7 +15309,7 @@ var require_compile = __commonJS({
|
|
|
15309
15309
|
const schOrFunc = root.refs[ref];
|
|
15310
15310
|
if (schOrFunc)
|
|
15311
15311
|
return schOrFunc;
|
|
15312
|
-
let _sch =
|
|
15312
|
+
let _sch = resolve5.call(this, root, ref);
|
|
15313
15313
|
if (_sch === void 0) {
|
|
15314
15314
|
const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref];
|
|
15315
15315
|
const { schemaId } = this.opts;
|
|
@@ -15336,7 +15336,7 @@ var require_compile = __commonJS({
|
|
|
15336
15336
|
function sameSchemaEnv(s1, s2) {
|
|
15337
15337
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
15338
15338
|
}
|
|
15339
|
-
function
|
|
15339
|
+
function resolve5(root, ref) {
|
|
15340
15340
|
let sch;
|
|
15341
15341
|
while (typeof (sch = this.refs[ref]) == "string")
|
|
15342
15342
|
ref = sch;
|
|
@@ -15967,7 +15967,7 @@ var require_fast_uri = __commonJS({
|
|
|
15967
15967
|
}
|
|
15968
15968
|
return uri;
|
|
15969
15969
|
}
|
|
15970
|
-
function
|
|
15970
|
+
function resolve5(baseURI, relativeURI, options) {
|
|
15971
15971
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
15972
15972
|
const resolved = resolveComponent(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
15973
15973
|
schemelessOptions.skipEscape = true;
|
|
@@ -16225,7 +16225,7 @@ var require_fast_uri = __commonJS({
|
|
|
16225
16225
|
var fastUri = {
|
|
16226
16226
|
SCHEMES,
|
|
16227
16227
|
normalize: normalize2,
|
|
16228
|
-
resolve:
|
|
16228
|
+
resolve: resolve5,
|
|
16229
16229
|
resolveComponent,
|
|
16230
16230
|
equal,
|
|
16231
16231
|
serialize,
|
|
@@ -32061,7 +32061,7 @@ var require_parse_url = __commonJS({
|
|
|
32061
32061
|
var require_form_data = __commonJS({
|
|
32062
32062
|
"node_modules/light-my-request/lib/form-data.js"(exports2, module2) {
|
|
32063
32063
|
"use strict";
|
|
32064
|
-
var { randomUUID:
|
|
32064
|
+
var { randomUUID: randomUUID5 } = require("node:crypto");
|
|
32065
32065
|
var { Readable: Readable3 } = require("node:stream");
|
|
32066
32066
|
var textEncoder;
|
|
32067
32067
|
function isFormDataLike(payload) {
|
|
@@ -32069,7 +32069,7 @@ var require_form_data = __commonJS({
|
|
|
32069
32069
|
}
|
|
32070
32070
|
function formDataToStream(formdata) {
|
|
32071
32071
|
textEncoder = textEncoder ?? new TextEncoder();
|
|
32072
|
-
const boundary = `----formdata-${
|
|
32072
|
+
const boundary = `----formdata-${randomUUID5()}`;
|
|
32073
32073
|
const prefix = `--${boundary}\r
|
|
32074
32074
|
Content-Disposition: form-data`;
|
|
32075
32075
|
const escape2 = (str) => str.replace(/\n/g, "%0A").replace(/\r/g, "%0D").replace(/"/g, "%22");
|
|
@@ -33572,9 +33572,9 @@ var require_light_my_request = __commonJS({
|
|
|
33572
33572
|
const res = new Response(req, callback);
|
|
33573
33573
|
return makeRequest(dispatchFunc, server, req, res);
|
|
33574
33574
|
} else {
|
|
33575
|
-
return new Promise((
|
|
33575
|
+
return new Promise((resolve5, reject) => {
|
|
33576
33576
|
const req = new RequestConstructor(options);
|
|
33577
|
-
const res = new Response(req,
|
|
33577
|
+
const res = new Response(req, resolve5, reject);
|
|
33578
33578
|
makeRequest(dispatchFunc, server, req, res);
|
|
33579
33579
|
});
|
|
33580
33580
|
}
|
|
@@ -37706,10 +37706,10 @@ var require_commonjs4 = __commonJS({
|
|
|
37706
37706
|
* Return a void Promise that resolves once the stream ends.
|
|
37707
37707
|
*/
|
|
37708
37708
|
async promise() {
|
|
37709
|
-
return new Promise((
|
|
37709
|
+
return new Promise((resolve5, reject) => {
|
|
37710
37710
|
this.on(DESTROYED, () => reject(new Error("stream destroyed")));
|
|
37711
37711
|
this.on("error", (er) => reject(er));
|
|
37712
|
-
this.on("end", () =>
|
|
37712
|
+
this.on("end", () => resolve5());
|
|
37713
37713
|
});
|
|
37714
37714
|
}
|
|
37715
37715
|
/**
|
|
@@ -37733,7 +37733,7 @@ var require_commonjs4 = __commonJS({
|
|
|
37733
37733
|
return Promise.resolve({ done: false, value: res });
|
|
37734
37734
|
if (this[EOF])
|
|
37735
37735
|
return stop();
|
|
37736
|
-
let
|
|
37736
|
+
let resolve5;
|
|
37737
37737
|
let reject;
|
|
37738
37738
|
const onerr = (er) => {
|
|
37739
37739
|
this.off("data", ondata);
|
|
@@ -37747,19 +37747,19 @@ var require_commonjs4 = __commonJS({
|
|
|
37747
37747
|
this.off("end", onend);
|
|
37748
37748
|
this.off(DESTROYED, ondestroy);
|
|
37749
37749
|
this.pause();
|
|
37750
|
-
|
|
37750
|
+
resolve5({ value, done: !!this[EOF] });
|
|
37751
37751
|
};
|
|
37752
37752
|
const onend = () => {
|
|
37753
37753
|
this.off("error", onerr);
|
|
37754
37754
|
this.off("data", ondata);
|
|
37755
37755
|
this.off(DESTROYED, ondestroy);
|
|
37756
37756
|
stop();
|
|
37757
|
-
|
|
37757
|
+
resolve5({ done: true, value: void 0 });
|
|
37758
37758
|
};
|
|
37759
37759
|
const ondestroy = () => onerr(new Error("stream destroyed"));
|
|
37760
37760
|
return new Promise((res2, rej) => {
|
|
37761
37761
|
reject = rej;
|
|
37762
|
-
|
|
37762
|
+
resolve5 = res2;
|
|
37763
37763
|
this.once(DESTROYED, ondestroy);
|
|
37764
37764
|
this.once("error", onerr);
|
|
37765
37765
|
this.once("end", onend);
|
|
@@ -38779,9 +38779,9 @@ var require_commonjs5 = __commonJS({
|
|
|
38779
38779
|
if (this.#asyncReaddirInFlight) {
|
|
38780
38780
|
await this.#asyncReaddirInFlight;
|
|
38781
38781
|
} else {
|
|
38782
|
-
let
|
|
38782
|
+
let resolve5 = () => {
|
|
38783
38783
|
};
|
|
38784
|
-
this.#asyncReaddirInFlight = new Promise((res) =>
|
|
38784
|
+
this.#asyncReaddirInFlight = new Promise((res) => resolve5 = res);
|
|
38785
38785
|
try {
|
|
38786
38786
|
for (const e of await this.#fs.promises.readdir(fullpath, {
|
|
38787
38787
|
withFileTypes: true
|
|
@@ -38794,7 +38794,7 @@ var require_commonjs5 = __commonJS({
|
|
|
38794
38794
|
children.provisional = 0;
|
|
38795
38795
|
}
|
|
38796
38796
|
this.#asyncReaddirInFlight = void 0;
|
|
38797
|
-
|
|
38797
|
+
resolve5();
|
|
38798
38798
|
}
|
|
38799
38799
|
return children.slice(0, children.provisional);
|
|
38800
38800
|
}
|
|
@@ -41991,9 +41991,9 @@ 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 join21 = path.join;
|
|
41995
41995
|
var normalize2 = path.normalize;
|
|
41996
|
-
var
|
|
41996
|
+
var resolve5 = path.resolve;
|
|
41997
41997
|
var sep3 = path.sep;
|
|
41998
41998
|
var Readable3 = stream.Readable;
|
|
41999
41999
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
@@ -42040,7 +42040,7 @@ var require_send = __commonJS({
|
|
|
42040
42040
|
const lastModified = options.lastModified !== void 0 ? Boolean(options.lastModified) : true;
|
|
42041
42041
|
const maxage = normalizeMaxAge(options.maxAge ?? options.maxage);
|
|
42042
42042
|
const maxContentRangeChunkSize = options.maxContentRangeChunkSize !== void 0 ? Number(options.maxContentRangeChunkSize) : null;
|
|
42043
|
-
const root = options.root ?
|
|
42043
|
+
const root = options.root ? resolve5(options.root) : null;
|
|
42044
42044
|
const highWaterMark = Number.isSafeInteger(options.highWaterMark) && options.highWaterMark > 0 ? options.highWaterMark : null;
|
|
42045
42045
|
return {
|
|
42046
42046
|
acceptRanges,
|
|
@@ -42078,14 +42078,14 @@ var require_send = __commonJS({
|
|
|
42078
42078
|
return { statusCode: 403 };
|
|
42079
42079
|
}
|
|
42080
42080
|
parts = path2.split(sep3);
|
|
42081
|
-
path2 = normalize2(
|
|
42081
|
+
path2 = normalize2(join21(root, path2));
|
|
42082
42082
|
} else {
|
|
42083
42083
|
if (UP_PATH_REGEXP.test(path2)) {
|
|
42084
42084
|
debug('malicious path "%s"', path2);
|
|
42085
42085
|
return { statusCode: 403 };
|
|
42086
42086
|
}
|
|
42087
42087
|
parts = normalize2(path2).split(sep3);
|
|
42088
|
-
path2 =
|
|
42088
|
+
path2 = resolve5(path2);
|
|
42089
42089
|
}
|
|
42090
42090
|
return { path: path2, parts };
|
|
42091
42091
|
}
|
|
@@ -42181,9 +42181,9 @@ var require_send = __commonJS({
|
|
|
42181
42181
|
);
|
|
42182
42182
|
}
|
|
42183
42183
|
function tryStat(path2) {
|
|
42184
|
-
return new Promise((
|
|
42184
|
+
return new Promise((resolve6) => {
|
|
42185
42185
|
fs.stat(path2, function onstat(error, stat4) {
|
|
42186
|
-
|
|
42186
|
+
resolve6({ error, stat: stat4 });
|
|
42187
42187
|
});
|
|
42188
42188
|
});
|
|
42189
42189
|
}
|
|
@@ -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 = join21(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: statSync7 } = 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 = statSync7(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 = statSync7(p);
|
|
43403
43403
|
return !stats.isDirectory();
|
|
43404
43404
|
} catch {
|
|
43405
43405
|
return false;
|
|
@@ -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_path19 = require("node:path");
|
|
50831
|
+
var import_node_os13 = require("node:os");
|
|
50832
|
+
var import_node_fs20 = require("node:fs");
|
|
50833
50833
|
var import_node_child_process6 = require("node:child_process");
|
|
50834
50834
|
|
|
50835
50835
|
// log.mjs
|
|
@@ -50878,6 +50878,7 @@ var import_node_child_process = require("node:child_process");
|
|
|
50878
50878
|
var import_node_fs4 = require("node:fs");
|
|
50879
50879
|
var import_node_path3 = require("node:path");
|
|
50880
50880
|
var import_node_os3 = require("node:os");
|
|
50881
|
+
var import_node_crypto2 = require("node:crypto");
|
|
50881
50882
|
var import_node_module = require("node:module");
|
|
50882
50883
|
|
|
50883
50884
|
// app-reader.ts
|
|
@@ -51183,6 +51184,12 @@ var AwareError = class extends Error {
|
|
|
51183
51184
|
}
|
|
51184
51185
|
detail;
|
|
51185
51186
|
};
|
|
51187
|
+
var AwareUnsupportedError = class extends AwareError {
|
|
51188
|
+
constructor(message, detail) {
|
|
51189
|
+
super(message, detail);
|
|
51190
|
+
this.name = "AwareUnsupportedError";
|
|
51191
|
+
}
|
|
51192
|
+
};
|
|
51186
51193
|
function resolveInvoker() {
|
|
51187
51194
|
const envDir = process.env.AWARE_CLI_DIR;
|
|
51188
51195
|
if (envDir && (0, import_node_fs4.existsSync)((0, import_node_path3.join)(envDir, "scripts/bin/aware.js"))) {
|
|
@@ -51225,7 +51232,7 @@ function runRaw(args, onSpawn) {
|
|
|
51225
51232
|
if (bad !== void 0) throw new AwareError(`refusing to pass unsafe argument to shell: ${bad}`);
|
|
51226
51233
|
}
|
|
51227
51234
|
const argv = [...preArgs, ...args];
|
|
51228
|
-
return new Promise((
|
|
51235
|
+
return new Promise((resolve5, reject) => {
|
|
51229
51236
|
const child = (0, import_node_child_process.spawn)(bin, argv, { shell: invoker.shell, windowsHide: true });
|
|
51230
51237
|
onSpawn?.(child);
|
|
51231
51238
|
let stdout = "";
|
|
@@ -51243,7 +51250,7 @@ function runRaw(args, onSpawn) {
|
|
|
51243
51250
|
});
|
|
51244
51251
|
child.on("close", (code) => {
|
|
51245
51252
|
clearTimeout(timer);
|
|
51246
|
-
|
|
51253
|
+
resolve5({ code: code ?? -1, stdout, stderr });
|
|
51247
51254
|
});
|
|
51248
51255
|
});
|
|
51249
51256
|
}
|
|
@@ -51257,7 +51264,7 @@ function runRawWithEnv(args, env2, timeoutMs) {
|
|
|
51257
51264
|
}
|
|
51258
51265
|
const argv = [...preArgs, ...args];
|
|
51259
51266
|
const limit = timeoutMs ?? RUN_TIMEOUT_MS;
|
|
51260
|
-
return new Promise((
|
|
51267
|
+
return new Promise((resolve5, reject) => {
|
|
51261
51268
|
const child = (0, import_node_child_process.spawn)(bin, argv, { shell: invoker.shell, windowsHide: true, env: env2 ?? process.env });
|
|
51262
51269
|
let stdout = "";
|
|
51263
51270
|
let stderr = "";
|
|
@@ -51274,7 +51281,7 @@ function runRawWithEnv(args, env2, timeoutMs) {
|
|
|
51274
51281
|
});
|
|
51275
51282
|
child.on("close", (code) => {
|
|
51276
51283
|
clearTimeout(timer);
|
|
51277
|
-
|
|
51284
|
+
resolve5({ code: code ?? -1, stdout, stderr });
|
|
51278
51285
|
});
|
|
51279
51286
|
});
|
|
51280
51287
|
}
|
|
@@ -51324,7 +51331,7 @@ async function execTekla(code, opts = {}) {
|
|
|
51324
51331
|
args: opts.args ?? {}
|
|
51325
51332
|
});
|
|
51326
51333
|
const timeoutMs = opts.debug ? 15 * 6e4 : RUN_TIMEOUT_MS;
|
|
51327
|
-
return new Promise((
|
|
51334
|
+
return new Promise((resolve5, reject) => {
|
|
51328
51335
|
const child = (0, import_node_child_process.spawn)(bin, ["exec", "--version", version, "--json-stdin"], { windowsHide: true });
|
|
51329
51336
|
let stdout = "";
|
|
51330
51337
|
let stderr = "";
|
|
@@ -51352,7 +51359,7 @@ async function execTekla(code, opts = {}) {
|
|
|
51352
51359
|
})
|
|
51353
51360
|
);
|
|
51354
51361
|
}
|
|
51355
|
-
|
|
51362
|
+
resolve5(parsed);
|
|
51356
51363
|
});
|
|
51357
51364
|
child.stdin.write(payload);
|
|
51358
51365
|
child.stdin.end();
|
|
@@ -51423,17 +51430,31 @@ function latestTracePath(id, logsRoot = LOGS_DIR) {
|
|
|
51423
51430
|
}
|
|
51424
51431
|
return best ? best.path : null;
|
|
51425
51432
|
}
|
|
51426
|
-
function
|
|
51433
|
+
function readTail(path, maxBytes) {
|
|
51434
|
+
const size = (0, import_node_fs4.statSync)(path).size;
|
|
51435
|
+
if (size <= maxBytes) return { text: (0, import_node_fs4.readFileSync)(path, "utf8"), truncated: false };
|
|
51436
|
+
const fd = (0, import_node_fs4.openSync)(path, "r");
|
|
51437
|
+
try {
|
|
51438
|
+
const buf = Buffer.alloc(maxBytes);
|
|
51439
|
+
const read = (0, import_node_fs4.readSync)(fd, buf, 0, maxBytes, size - maxBytes);
|
|
51440
|
+
const nl = buf.indexOf(10, 0);
|
|
51441
|
+
const start = nl >= 0 && nl + 1 <= read ? nl + 1 : 0;
|
|
51442
|
+
return { text: buf.subarray(start, read).toString("utf8"), truncated: true };
|
|
51443
|
+
} finally {
|
|
51444
|
+
(0, import_node_fs4.closeSync)(fd);
|
|
51445
|
+
}
|
|
51446
|
+
}
|
|
51447
|
+
function readLatestTrace(id, logsRoot = LOGS_DIR, maxBytes) {
|
|
51427
51448
|
const p = latestTracePath(id, logsRoot);
|
|
51428
51449
|
if (!p) return null;
|
|
51429
|
-
let
|
|
51450
|
+
let read;
|
|
51430
51451
|
try {
|
|
51431
|
-
|
|
51452
|
+
read = maxBytes && maxBytes > 0 ? readTail(p, maxBytes) : { text: (0, import_node_fs4.readFileSync)(p, "utf8"), truncated: false };
|
|
51432
51453
|
} catch {
|
|
51433
51454
|
return null;
|
|
51434
51455
|
}
|
|
51435
51456
|
const runId = p.split(/[\\/]/).pop()?.replace(/\.jsonl$/, "") ?? "";
|
|
51436
|
-
return { runId, path: p, text };
|
|
51457
|
+
return { runId, path: p, text: read.text, truncated: read.truncated };
|
|
51437
51458
|
}
|
|
51438
51459
|
function startTrigger(id, opts = {}) {
|
|
51439
51460
|
assertId(id);
|
|
@@ -51611,6 +51632,19 @@ function parseAgentInstallOutput(stdout) {
|
|
|
51611
51632
|
function isAgentInstalled(agents, id) {
|
|
51612
51633
|
return agents.some((a) => a.id === id);
|
|
51613
51634
|
}
|
|
51635
|
+
function agentInvokeArgv(agent, command, inputsRef) {
|
|
51636
|
+
assertId(agent);
|
|
51637
|
+
if (!APP_ID.test(command)) throw new AwareError(`invalid agent command: ${JSON.stringify(command)}`);
|
|
51638
|
+
const args = ["agent", "invoke", agent, command];
|
|
51639
|
+
if (inputsRef !== void 0) args.push("--inputs", inputsRef);
|
|
51640
|
+
return args;
|
|
51641
|
+
}
|
|
51642
|
+
function isInvokeUnsupported(detail) {
|
|
51643
|
+
if (!detail || typeof detail !== "object") return false;
|
|
51644
|
+
const d = detail;
|
|
51645
|
+
const text = [d.stdout, d.stderr].filter((s) => typeof s === "string").join("\n");
|
|
51646
|
+
return /unrecognized subcommand|unknown subcommand/i.test(text);
|
|
51647
|
+
}
|
|
51614
51648
|
var inFlightConnects = /* @__PURE__ */ new Map();
|
|
51615
51649
|
function cancelAllConnects() {
|
|
51616
51650
|
for (const cancel of inFlightConnects.values()) cancel();
|
|
@@ -51623,7 +51657,7 @@ function connectDeviceCode(id, onEvent) {
|
|
|
51623
51657
|
if (!bin) throw new AwareError("aware CLI invoker not resolved");
|
|
51624
51658
|
inFlightConnects.get(id)?.();
|
|
51625
51659
|
const argv = [...preArgs, "connect", id, "--device-code", "--json"];
|
|
51626
|
-
return new Promise((
|
|
51660
|
+
return new Promise((resolve5, reject) => {
|
|
51627
51661
|
const child = (0, import_node_child_process.spawn)(bin, argv, { shell: invoker.shell, windowsHide: true });
|
|
51628
51662
|
let buf = "";
|
|
51629
51663
|
let gotPrompt = false;
|
|
@@ -51649,7 +51683,7 @@ function connectDeviceCode(id, onEvent) {
|
|
|
51649
51683
|
}
|
|
51650
51684
|
if (!gotPrompt && obj.phase === "prompt" && typeof obj.user_code === "string") {
|
|
51651
51685
|
gotPrompt = true;
|
|
51652
|
-
|
|
51686
|
+
resolve5({ prompt: obj, cancel });
|
|
51653
51687
|
} else {
|
|
51654
51688
|
onEvent(obj);
|
|
51655
51689
|
}
|
|
@@ -51733,6 +51767,43 @@ var aware = {
|
|
|
51733
51767
|
const { data } = await runJson(["agent", "describe", assertId(id)]);
|
|
51734
51768
|
return data;
|
|
51735
51769
|
},
|
|
51770
|
+
/**
|
|
51771
|
+
* Invoke a BUILTIN agent command directly (`aware agent invoke <agent> <command>
|
|
51772
|
+
* --inputs @file --json`, CLI ≥ 0.63) and return the envelope's `data` — e.g.
|
|
51773
|
+
* `agentInvoke('ui','validate',{descriptor})` for Custom Panels validation.
|
|
51774
|
+
* Inputs always travel via a temp file (`--inputs @path`): inline JSON would trip
|
|
51775
|
+
* the shell-injection guard on the bare-PATH Windows fallback (quotes/braces are
|
|
51776
|
+
* SHELL_META) and a large descriptor could blow cmd.exe's argv limit. Throws
|
|
51777
|
+
* AwareUnsupportedError on a pre-0.63 CLI so callers can degrade ("update AWARE").
|
|
51778
|
+
*/
|
|
51779
|
+
async agentInvoke(agent, command, inputs) {
|
|
51780
|
+
let inputsFile = null;
|
|
51781
|
+
try {
|
|
51782
|
+
let ref;
|
|
51783
|
+
if (inputs !== void 0) {
|
|
51784
|
+
inputsFile = (0, import_node_path3.join)((0, import_node_os3.tmpdir)(), `floless-agent-inputs-${(0, import_node_crypto2.randomUUID)()}.json`);
|
|
51785
|
+
(0, import_node_fs4.writeFileSync)(inputsFile, JSON.stringify(inputs));
|
|
51786
|
+
ref = `@${inputsFile}`;
|
|
51787
|
+
}
|
|
51788
|
+
const { data } = await runJson(agentInvokeArgv(agent, command, ref));
|
|
51789
|
+
return data;
|
|
51790
|
+
} catch (err) {
|
|
51791
|
+
if (err instanceof AwareError && isInvokeUnsupported(err.detail)) {
|
|
51792
|
+
throw new AwareUnsupportedError(
|
|
51793
|
+
`aware CLI does not support \`agent invoke\` (needs \u2265 0.63) \u2014 update AWARE`,
|
|
51794
|
+
err.detail
|
|
51795
|
+
);
|
|
51796
|
+
}
|
|
51797
|
+
throw err;
|
|
51798
|
+
} finally {
|
|
51799
|
+
if (inputsFile) {
|
|
51800
|
+
try {
|
|
51801
|
+
(0, import_node_fs4.rmSync)(inputsFile);
|
|
51802
|
+
} catch {
|
|
51803
|
+
}
|
|
51804
|
+
}
|
|
51805
|
+
}
|
|
51806
|
+
},
|
|
51736
51807
|
/**
|
|
51737
51808
|
* Graft: build an agent from a foreign source (`aware build agent --from-*`).
|
|
51738
51809
|
* When `awareHome` is set the spawn writes into that staging dir (AWARE_HOME is
|
|
@@ -51875,6 +51946,170 @@ var aware = {
|
|
|
51875
51946
|
connectList
|
|
51876
51947
|
};
|
|
51877
51948
|
|
|
51949
|
+
// extensions-store.ts
|
|
51950
|
+
var import_node_fs5 = require("node:fs");
|
|
51951
|
+
var import_node_os4 = require("node:os");
|
|
51952
|
+
var import_node_path4 = require("node:path");
|
|
51953
|
+
var ROOT = process.env.FLOLESS_HOME ?? (0, import_node_path4.join)((0, import_node_os4.homedir)(), ".floless");
|
|
51954
|
+
var uiDir = (0, import_node_path4.join)(ROOT, "ui");
|
|
51955
|
+
var extensionsFile = (0, import_node_path4.join)(uiDir, "extensions.json");
|
|
51956
|
+
var HISTORY_DIR = (0, import_node_path4.join)(uiDir, "history");
|
|
51957
|
+
var HISTORY_KEEP = 20;
|
|
51958
|
+
function ensureUiDir() {
|
|
51959
|
+
if (!(0, import_node_fs5.existsSync)(uiDir)) (0, import_node_fs5.mkdirSync)(uiDir, { recursive: true });
|
|
51960
|
+
}
|
|
51961
|
+
function ensureHistoryDir() {
|
|
51962
|
+
if (!(0, import_node_fs5.existsSync)(HISTORY_DIR)) (0, import_node_fs5.mkdirSync)(HISTORY_DIR, { recursive: true });
|
|
51963
|
+
}
|
|
51964
|
+
function readExtensionsText() {
|
|
51965
|
+
try {
|
|
51966
|
+
return (0, import_node_fs5.readFileSync)(extensionsFile, "utf8");
|
|
51967
|
+
} catch {
|
|
51968
|
+
return null;
|
|
51969
|
+
}
|
|
51970
|
+
}
|
|
51971
|
+
function readExtensions() {
|
|
51972
|
+
const text = readExtensionsText();
|
|
51973
|
+
if (text === null) return null;
|
|
51974
|
+
try {
|
|
51975
|
+
const parsed = JSON.parse(text);
|
|
51976
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
51977
|
+
} catch {
|
|
51978
|
+
return null;
|
|
51979
|
+
}
|
|
51980
|
+
}
|
|
51981
|
+
function descriptorPanels(d) {
|
|
51982
|
+
if (!d || !Array.isArray(d.panels)) return [];
|
|
51983
|
+
return d.panels.filter((p) => !!p && typeof p === "object" && !Array.isArray(p));
|
|
51984
|
+
}
|
|
51985
|
+
function panelsCountOf(text) {
|
|
51986
|
+
try {
|
|
51987
|
+
const parsed = JSON.parse(text);
|
|
51988
|
+
return parsed && typeof parsed === "object" && Array.isArray(parsed.panels) ? parsed.panels.length : 0;
|
|
51989
|
+
} catch {
|
|
51990
|
+
return 0;
|
|
51991
|
+
}
|
|
51992
|
+
}
|
|
51993
|
+
function historyFileName(now) {
|
|
51994
|
+
const base = now.toISOString().replace(/[:.]/g, "-");
|
|
51995
|
+
let name = `${base}.json`;
|
|
51996
|
+
for (let i = 2; (0, import_node_fs5.existsSync)((0, import_node_path4.join)(HISTORY_DIR, name)); i++) name = `${base}-${i}.json`;
|
|
51997
|
+
return name;
|
|
51998
|
+
}
|
|
51999
|
+
function timestampFromName(file) {
|
|
52000
|
+
const m = /^(\d{4}-\d{2}-\d{2})T(\d{2})-(\d{2})-(\d{2})-(\d{3})Z(?:-\d+)?\.json$/.exec(file);
|
|
52001
|
+
return m ? `${m[1]}T${m[2]}:${m[3]}:${m[4]}.${m[5]}Z` : null;
|
|
52002
|
+
}
|
|
52003
|
+
function historyFiles() {
|
|
52004
|
+
if (!(0, import_node_fs5.existsSync)(HISTORY_DIR)) return [];
|
|
52005
|
+
try {
|
|
52006
|
+
return (0, import_node_fs5.readdirSync)(HISTORY_DIR).filter((f) => f.endsWith(".json")).sort();
|
|
52007
|
+
} catch {
|
|
52008
|
+
return [];
|
|
52009
|
+
}
|
|
52010
|
+
}
|
|
52011
|
+
function pruneHistory() {
|
|
52012
|
+
const files = historyFiles();
|
|
52013
|
+
for (const f of files.slice(0, Math.max(0, files.length - HISTORY_KEEP))) {
|
|
52014
|
+
try {
|
|
52015
|
+
(0, import_node_fs5.rmSync)((0, import_node_path4.join)(HISTORY_DIR, f));
|
|
52016
|
+
} catch {
|
|
52017
|
+
}
|
|
52018
|
+
}
|
|
52019
|
+
}
|
|
52020
|
+
function snapshotExtensions(content) {
|
|
52021
|
+
const text = content !== void 0 ? content : readExtensionsText();
|
|
52022
|
+
if (text === null) return null;
|
|
52023
|
+
const files = historyFiles();
|
|
52024
|
+
const newest = files[files.length - 1];
|
|
52025
|
+
if (newest) {
|
|
52026
|
+
try {
|
|
52027
|
+
if ((0, import_node_fs5.readFileSync)((0, import_node_path4.join)(HISTORY_DIR, newest), "utf8") === text) return (0, import_node_path4.join)(HISTORY_DIR, newest);
|
|
52028
|
+
} catch {
|
|
52029
|
+
}
|
|
52030
|
+
}
|
|
52031
|
+
ensureHistoryDir();
|
|
52032
|
+
const path = (0, import_node_path4.join)(HISTORY_DIR, historyFileName(/* @__PURE__ */ new Date()));
|
|
52033
|
+
const tmp = `${path}.${process.pid}.tmp`;
|
|
52034
|
+
(0, import_node_fs5.writeFileSync)(tmp, text);
|
|
52035
|
+
(0, import_node_fs5.renameSync)(tmp, path);
|
|
52036
|
+
pruneHistory();
|
|
52037
|
+
return path;
|
|
52038
|
+
}
|
|
52039
|
+
function listHistory() {
|
|
52040
|
+
return historyFiles().reverse().map((f) => {
|
|
52041
|
+
let ts = timestampFromName(f);
|
|
52042
|
+
if (!ts) {
|
|
52043
|
+
try {
|
|
52044
|
+
ts = (0, import_node_fs5.statSync)((0, import_node_path4.join)(HISTORY_DIR, f)).mtime.toISOString();
|
|
52045
|
+
} catch {
|
|
52046
|
+
ts = "";
|
|
52047
|
+
}
|
|
52048
|
+
}
|
|
52049
|
+
let count = 0;
|
|
52050
|
+
try {
|
|
52051
|
+
count = panelsCountOf((0, import_node_fs5.readFileSync)((0, import_node_path4.join)(HISTORY_DIR, f), "utf8"));
|
|
52052
|
+
} catch {
|
|
52053
|
+
}
|
|
52054
|
+
return { timestamp: ts ?? "", panelsCount: count };
|
|
52055
|
+
});
|
|
52056
|
+
}
|
|
52057
|
+
function writeExtensionsText(text) {
|
|
52058
|
+
ensureUiDir();
|
|
52059
|
+
const tmp = `${extensionsFile}.${process.pid}.tmp`;
|
|
52060
|
+
(0, import_node_fs5.writeFileSync)(tmp, text);
|
|
52061
|
+
(0, import_node_fs5.renameSync)(tmp, extensionsFile);
|
|
52062
|
+
}
|
|
52063
|
+
function undoExtensions() {
|
|
52064
|
+
const current = readExtensionsText();
|
|
52065
|
+
const files = historyFiles().reverse();
|
|
52066
|
+
let target = null;
|
|
52067
|
+
for (const f of files) {
|
|
52068
|
+
try {
|
|
52069
|
+
const text = (0, import_node_fs5.readFileSync)((0, import_node_path4.join)(HISTORY_DIR, f), "utf8");
|
|
52070
|
+
if (text !== current) {
|
|
52071
|
+
target = text;
|
|
52072
|
+
break;
|
|
52073
|
+
}
|
|
52074
|
+
} catch {
|
|
52075
|
+
}
|
|
52076
|
+
}
|
|
52077
|
+
if (target === null) return { restored: false, descriptor: readExtensions() };
|
|
52078
|
+
if (current !== null) snapshotExtensions(current);
|
|
52079
|
+
writeExtensionsText(target);
|
|
52080
|
+
return { restored: true, descriptor: readExtensions() };
|
|
52081
|
+
}
|
|
52082
|
+
function resetExtensions() {
|
|
52083
|
+
const current = readExtensionsText();
|
|
52084
|
+
if (current === null) return { reset: false };
|
|
52085
|
+
snapshotExtensions(current);
|
|
52086
|
+
try {
|
|
52087
|
+
(0, import_node_fs5.rmSync)(extensionsFile);
|
|
52088
|
+
} catch {
|
|
52089
|
+
}
|
|
52090
|
+
return { reset: true };
|
|
52091
|
+
}
|
|
52092
|
+
|
|
52093
|
+
// ui-validation.ts
|
|
52094
|
+
function isUiAgentMissing(err) {
|
|
52095
|
+
if (!(err instanceof AwareError)) return /not installed/i.test(String(err));
|
|
52096
|
+
const detail = err.detail ?? {};
|
|
52097
|
+
const stdout = typeof detail.stdout === "string" ? detail.stdout : "";
|
|
52098
|
+
const stderr = typeof detail.stderr === "string" ? detail.stderr : "";
|
|
52099
|
+
const text = `${err.message} ${stdout} ${stderr}`;
|
|
52100
|
+
return /not installed/i.test(text);
|
|
52101
|
+
}
|
|
52102
|
+
function classifyValidateError(err) {
|
|
52103
|
+
if (err instanceof AwareUnsupportedError) {
|
|
52104
|
+
return { valid: null, note: "aware CLI without ui agent \u2014 update AWARE" };
|
|
52105
|
+
}
|
|
52106
|
+
if (isUiAgentMissing(err)) {
|
|
52107
|
+
return { valid: null, note: "AWARE ui agent is installing \u2014 this validates itself in a moment", installing: true };
|
|
52108
|
+
}
|
|
52109
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
52110
|
+
return { valid: false, errors: [`Validation failed: ${msg}`], unexpected: true };
|
|
52111
|
+
}
|
|
52112
|
+
|
|
51878
52113
|
// bootstrap.ts
|
|
51879
52114
|
var VERSION_RE = /^\d+(\.\d+)*(-[0-9A-Za-z.-]+)?$/;
|
|
51880
52115
|
function isValidVersion(v) {
|
|
@@ -51960,13 +52195,13 @@ function runBootstrap(deps) {
|
|
|
51960
52195
|
}
|
|
51961
52196
|
|
|
51962
52197
|
// licensing.ts
|
|
51963
|
-
var
|
|
51964
|
-
var
|
|
51965
|
-
var
|
|
52198
|
+
var import_node_fs6 = require("node:fs");
|
|
52199
|
+
var import_node_path5 = require("node:path");
|
|
52200
|
+
var import_node_os5 = require("node:os");
|
|
51966
52201
|
var import_node_child_process2 = require("node:child_process");
|
|
51967
|
-
var
|
|
52202
|
+
var import_node_crypto3 = require("node:crypto");
|
|
51968
52203
|
var import_node_module2 = require("node:module");
|
|
51969
|
-
var
|
|
52204
|
+
var import_node_os6 = require("node:os");
|
|
51970
52205
|
var ENVS = {
|
|
51971
52206
|
production: { apiBase: "https://api.floless.io/api", webBase: "https://floless.io" },
|
|
51972
52207
|
staging: { apiBase: "https://api.stage.floless.io/api", webBase: "https://stage.floless.io" }
|
|
@@ -52002,26 +52237,26 @@ function isSea() {
|
|
|
52002
52237
|
}
|
|
52003
52238
|
function storeDir() {
|
|
52004
52239
|
if (process.env.FLOLESS_LICENSE_DIR) return process.env.FLOLESS_LICENSE_DIR;
|
|
52005
|
-
if (isSea() && process.env.LOCALAPPDATA) return (0,
|
|
52006
|
-
return (0,
|
|
52240
|
+
if (isSea() && process.env.LOCALAPPDATA) return (0, import_node_path5.join)(process.env.LOCALAPPDATA, "FlolessApp-data");
|
|
52241
|
+
return (0, import_node_path5.join)((0, import_node_os5.homedir)(), ".aware");
|
|
52007
52242
|
}
|
|
52008
|
-
var tokenPath = () => (0,
|
|
52009
|
-
var cachePath = () => (0,
|
|
52243
|
+
var tokenPath = () => (0, import_node_path5.join)(storeDir(), "floless-license.json");
|
|
52244
|
+
var cachePath = () => (0, import_node_path5.join)(storeDir(), "floless-license-cache.json");
|
|
52010
52245
|
var _migrated = false;
|
|
52011
52246
|
function migrateLegacyStore() {
|
|
52012
52247
|
if (_migrated) return;
|
|
52013
52248
|
_migrated = true;
|
|
52014
52249
|
if (process.env.FLOLESS_LICENSE_DIR || !(isSea() && process.env.LOCALAPPDATA)) return;
|
|
52015
|
-
const oldDir = (0,
|
|
52250
|
+
const oldDir = (0, import_node_path5.join)(process.env.LOCALAPPDATA, "FlolessApp");
|
|
52016
52251
|
const newDir = storeDir();
|
|
52017
52252
|
if (oldDir === newDir) return;
|
|
52018
52253
|
for (const f of ["floless-license.json", "floless-license-cache.json", "floless-install-id"]) {
|
|
52019
52254
|
try {
|
|
52020
|
-
const oldP = (0,
|
|
52021
|
-
const newP = (0,
|
|
52022
|
-
if ((0,
|
|
52023
|
-
(0,
|
|
52024
|
-
(0,
|
|
52255
|
+
const oldP = (0, import_node_path5.join)(oldDir, f);
|
|
52256
|
+
const newP = (0, import_node_path5.join)(newDir, f);
|
|
52257
|
+
if ((0, import_node_fs6.existsSync)(oldP) && !(0, import_node_fs6.existsSync)(newP)) {
|
|
52258
|
+
(0, import_node_fs6.mkdirSync)(newDir, { recursive: true });
|
|
52259
|
+
(0, import_node_fs6.copyFileSync)(oldP, newP);
|
|
52025
52260
|
}
|
|
52026
52261
|
} catch {
|
|
52027
52262
|
}
|
|
@@ -52029,16 +52264,16 @@ function migrateLegacyStore() {
|
|
|
52029
52264
|
}
|
|
52030
52265
|
function readJson(path) {
|
|
52031
52266
|
try {
|
|
52032
|
-
return (0,
|
|
52267
|
+
return (0, import_node_fs6.existsSync)(path) ? JSON.parse((0, import_node_fs6.readFileSync)(path, "utf8")) : null;
|
|
52033
52268
|
} catch {
|
|
52034
52269
|
return null;
|
|
52035
52270
|
}
|
|
52036
52271
|
}
|
|
52037
52272
|
function writeJson(path, value) {
|
|
52038
|
-
(0,
|
|
52039
|
-
(0,
|
|
52273
|
+
(0, import_node_fs6.mkdirSync)(storeDir(), { recursive: true });
|
|
52274
|
+
(0, import_node_fs6.writeFileSync)(path, JSON.stringify(value, null, 2), "utf8");
|
|
52040
52275
|
try {
|
|
52041
|
-
(0,
|
|
52276
|
+
(0, import_node_fs6.chmodSync)(path, 384);
|
|
52042
52277
|
} catch {
|
|
52043
52278
|
}
|
|
52044
52279
|
}
|
|
@@ -52177,7 +52412,7 @@ async function ensureSeat(token) {
|
|
|
52177
52412
|
const res = await fetch(`${env().apiBase}/seats/claim`, {
|
|
52178
52413
|
method: "POST",
|
|
52179
52414
|
headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json" },
|
|
52180
|
-
body: JSON.stringify({ device_fingerprint: installId(), device_name: (0,
|
|
52415
|
+
body: JSON.stringify({ device_fingerprint: installId(), device_name: (0, import_node_os6.hostname)(), os_version: `${process.platform} ${process.arch}` })
|
|
52181
52416
|
});
|
|
52182
52417
|
if (!res.ok) return;
|
|
52183
52418
|
const b = await res.json();
|
|
@@ -52198,7 +52433,7 @@ async function seatHeartbeat() {
|
|
|
52198
52433
|
try {
|
|
52199
52434
|
const token = await ensureFreshToken().catch(() => null);
|
|
52200
52435
|
if (!token) return;
|
|
52201
|
-
const hmac = (0,
|
|
52436
|
+
const hmac = (0, import_node_crypto3.createHmac)("sha256", seat.hmacSecret).update(seat.nonce).digest("hex");
|
|
52202
52437
|
let res;
|
|
52203
52438
|
try {
|
|
52204
52439
|
res = await fetch(`${env().apiBase}/seats/heartbeat`, {
|
|
@@ -52268,7 +52503,7 @@ function logout() {
|
|
|
52268
52503
|
resetSeat();
|
|
52269
52504
|
for (const p of [tokenPath(), cachePath()]) {
|
|
52270
52505
|
try {
|
|
52271
|
-
(0,
|
|
52506
|
+
(0, import_node_fs6.rmSync)(p, { force: true });
|
|
52272
52507
|
} catch {
|
|
52273
52508
|
}
|
|
52274
52509
|
}
|
|
@@ -52292,7 +52527,7 @@ function openBrowser(url) {
|
|
|
52292
52527
|
(0, import_node_child_process2.spawn)(cmd, args, opts).unref();
|
|
52293
52528
|
}
|
|
52294
52529
|
async function startLogin() {
|
|
52295
|
-
const sessionId = (0,
|
|
52530
|
+
const sessionId = (0, import_node_crypto3.randomUUID)();
|
|
52296
52531
|
const loginUrl = `${env().webBase}/login?desktop=true&session=${sessionId}&app=floless`;
|
|
52297
52532
|
openBrowser(loginUrl);
|
|
52298
52533
|
void pollDesktopStatus(sessionId).catch(() => {
|
|
@@ -52325,20 +52560,20 @@ async function pollDesktopStatus(sessionId, timeoutMs = 18e4) {
|
|
|
52325
52560
|
return false;
|
|
52326
52561
|
}
|
|
52327
52562
|
function installId() {
|
|
52328
|
-
const p = (0,
|
|
52563
|
+
const p = (0, import_node_path5.join)(storeDir(), "floless-install-id");
|
|
52329
52564
|
const existing = readJson(p);
|
|
52330
52565
|
if (typeof existing === "string" && existing.length >= 80 && existing.length <= 100) {
|
|
52331
52566
|
return existing;
|
|
52332
52567
|
}
|
|
52333
|
-
const id = (0,
|
|
52568
|
+
const id = (0, import_node_crypto3.createHash)("sha512").update((0, import_node_crypto3.randomUUID)()).digest("base64");
|
|
52334
52569
|
writeJson(p, id);
|
|
52335
52570
|
return id;
|
|
52336
52571
|
}
|
|
52337
52572
|
|
|
52338
52573
|
// version.ts
|
|
52339
52574
|
var import_node_module3 = require("node:module");
|
|
52340
|
-
var
|
|
52341
|
-
var
|
|
52575
|
+
var import_node_path6 = require("node:path");
|
|
52576
|
+
var import_node_fs7 = require("node:fs");
|
|
52342
52577
|
function resolveVersion(s) {
|
|
52343
52578
|
if (s.isSea) {
|
|
52344
52579
|
const m = s.sqVersionXml?.match(/<version>([^<]+)<\/version>/);
|
|
@@ -52357,8 +52592,8 @@ function isSea2() {
|
|
|
52357
52592
|
}
|
|
52358
52593
|
function readSqVersionXml() {
|
|
52359
52594
|
try {
|
|
52360
|
-
const sq = (0,
|
|
52361
|
-
return (0,
|
|
52595
|
+
const sq = (0, import_node_path6.join)((0, import_node_path6.dirname)(process.execPath), "sq.version");
|
|
52596
|
+
return (0, import_node_fs7.existsSync)(sq) ? (0, import_node_fs7.readFileSync)(sq, "utf8") : null;
|
|
52362
52597
|
} catch {
|
|
52363
52598
|
return null;
|
|
52364
52599
|
}
|
|
@@ -52374,7 +52609,7 @@ function appVersion() {
|
|
|
52374
52609
|
return resolveVersion({
|
|
52375
52610
|
isSea: isSea2(),
|
|
52376
52611
|
sqVersionXml: readSqVersionXml(),
|
|
52377
|
-
define: true ? "0.
|
|
52612
|
+
define: true ? "0.12.0" : void 0,
|
|
52378
52613
|
pkgVersion: readPkgVersion()
|
|
52379
52614
|
});
|
|
52380
52615
|
}
|
|
@@ -52384,14 +52619,14 @@ function resolveChannel(s) {
|
|
|
52384
52619
|
return "dev";
|
|
52385
52620
|
}
|
|
52386
52621
|
function appChannel() {
|
|
52387
|
-
return resolveChannel({ isSea: isSea2(), define: true ? "0.
|
|
52622
|
+
return resolveChannel({ isSea: isSea2(), define: true ? "0.12.0" : void 0 });
|
|
52388
52623
|
}
|
|
52389
52624
|
|
|
52390
52625
|
// oauth-presets.ts
|
|
52391
|
-
var
|
|
52392
|
-
var
|
|
52626
|
+
var import_node_os7 = require("node:os");
|
|
52627
|
+
var import_node_path7 = require("node:path");
|
|
52393
52628
|
var import_node_net = __toESM(require("node:net"), 1);
|
|
52394
|
-
var
|
|
52629
|
+
var import_node_fs8 = require("node:fs");
|
|
52395
52630
|
var MANAGED_HEADER = "# managed by floless.app - do not edit";
|
|
52396
52631
|
var OAUTH_PRESETS = {
|
|
52397
52632
|
"trimble-connect": {
|
|
@@ -52421,7 +52656,7 @@ function managedProfileYaml(preset) {
|
|
|
52421
52656
|
].join("\n");
|
|
52422
52657
|
}
|
|
52423
52658
|
function oauthDir() {
|
|
52424
|
-
return process.env.AWARE_HOME ? (0,
|
|
52659
|
+
return process.env.AWARE_HOME ? (0, import_node_path7.join)(process.env.AWARE_HOME, "oauth") : (0, import_node_path7.join)((0, import_node_os7.homedir)(), ".aware", "oauth");
|
|
52425
52660
|
}
|
|
52426
52661
|
function isUpgradableLegacyProfile(existing, preset) {
|
|
52427
52662
|
if (existing.startsWith(MANAGED_HEADER)) return false;
|
|
@@ -52435,22 +52670,22 @@ function ensureManagedProfile(id) {
|
|
|
52435
52670
|
const preset = OAUTH_PRESETS[id];
|
|
52436
52671
|
if (!preset) return "not-managed";
|
|
52437
52672
|
const dir = oauthDir();
|
|
52438
|
-
const file = (0,
|
|
52439
|
-
const existing = (0,
|
|
52673
|
+
const file = (0, import_node_path7.join)(dir, `${id}.yaml`);
|
|
52674
|
+
const existing = (0, import_node_fs8.existsSync)(file) ? (0, import_node_fs8.readFileSync)(file, "utf8") : null;
|
|
52440
52675
|
if (existing !== null && !existing.startsWith(MANAGED_HEADER) && !isUpgradableLegacyProfile(existing, preset)) {
|
|
52441
52676
|
return "skipped";
|
|
52442
52677
|
}
|
|
52443
52678
|
const desired = managedProfileYaml(preset);
|
|
52444
52679
|
if (existing === desired) return "unchanged";
|
|
52445
|
-
(0,
|
|
52446
|
-
(0,
|
|
52680
|
+
(0, import_node_fs8.mkdirSync)(dir, { recursive: true });
|
|
52681
|
+
(0, import_node_fs8.writeFileSync)(file, desired, "utf8");
|
|
52447
52682
|
return "written";
|
|
52448
52683
|
}
|
|
52449
52684
|
function isPortBindable(port, host = "127.0.0.1") {
|
|
52450
|
-
return new Promise((
|
|
52685
|
+
return new Promise((resolve5) => {
|
|
52451
52686
|
const srv = import_node_net.default.createServer();
|
|
52452
|
-
srv.once("error", () =>
|
|
52453
|
-
srv.listen(port, host, () => srv.close(() =>
|
|
52687
|
+
srv.once("error", () => resolve5(false));
|
|
52688
|
+
srv.listen(port, host, () => srv.close(() => resolve5(true)));
|
|
52454
52689
|
});
|
|
52455
52690
|
}
|
|
52456
52691
|
|
|
@@ -52521,7 +52756,7 @@ function withBadge(report, opts) {
|
|
|
52521
52756
|
}
|
|
52522
52757
|
|
|
52523
52758
|
// index.ts
|
|
52524
|
-
var
|
|
52759
|
+
var import_node_crypto6 = require("node:crypto");
|
|
52525
52760
|
|
|
52526
52761
|
// graft.ts
|
|
52527
52762
|
var TEKLA_MARKER = "Recipe: Tekla model plug-in";
|
|
@@ -52565,16 +52800,16 @@ function buildPreview(m, sourceKind, sourceRef, stagedRef) {
|
|
|
52565
52800
|
}
|
|
52566
52801
|
|
|
52567
52802
|
// graft-manifest-reader.ts
|
|
52568
|
-
var
|
|
52569
|
-
var
|
|
52803
|
+
var import_node_fs9 = require("node:fs");
|
|
52804
|
+
var import_node_path8 = require("node:path");
|
|
52570
52805
|
var import_yaml3 = __toESM(require_dist6(), 1);
|
|
52571
52806
|
var asRecord2 = (v) => v && typeof v === "object" && !Array.isArray(v) ? v : {};
|
|
52572
52807
|
function readStagedManifest(agentDir) {
|
|
52573
|
-
const manifestPath = (0,
|
|
52574
|
-
if (!(0,
|
|
52808
|
+
const manifestPath = (0, import_node_path8.join)(agentDir, "manifest.yaml");
|
|
52809
|
+
if (!(0, import_node_fs9.existsSync)(manifestPath)) return null;
|
|
52575
52810
|
let doc;
|
|
52576
52811
|
try {
|
|
52577
|
-
doc = asRecord2((0, import_yaml3.parse)((0,
|
|
52812
|
+
doc = asRecord2((0, import_yaml3.parse)((0, import_node_fs9.readFileSync)(manifestPath, "utf8")));
|
|
52578
52813
|
} catch {
|
|
52579
52814
|
return null;
|
|
52580
52815
|
}
|
|
@@ -52604,10 +52839,10 @@ function readStagedManifest(agentDir) {
|
|
|
52604
52839
|
}
|
|
52605
52840
|
let skillCount = Array.isArray(doc.skills) ? doc.skills.length : 0;
|
|
52606
52841
|
if (!skillCount) {
|
|
52607
|
-
const skillsDir = (0,
|
|
52608
|
-
if ((0,
|
|
52842
|
+
const skillsDir = (0, import_node_path8.join)(agentDir, "skills");
|
|
52843
|
+
if ((0, import_node_fs9.existsSync)(skillsDir)) {
|
|
52609
52844
|
try {
|
|
52610
|
-
skillCount = (0,
|
|
52845
|
+
skillCount = (0, import_node_fs9.readdirSync)(skillsDir).filter((f) => f.endsWith(".md")).length;
|
|
52611
52846
|
} catch {
|
|
52612
52847
|
}
|
|
52613
52848
|
}
|
|
@@ -52621,7 +52856,7 @@ function readStagedManifest(agentDir) {
|
|
|
52621
52856
|
}
|
|
52622
52857
|
|
|
52623
52858
|
// graft-stage-registry.ts
|
|
52624
|
-
var
|
|
52859
|
+
var import_node_fs10 = require("node:fs");
|
|
52625
52860
|
var TTL_MS = 30 * 60 * 1e3;
|
|
52626
52861
|
var registry = /* @__PURE__ */ new Map();
|
|
52627
52862
|
function registerStage(token, tempDir, agentId) {
|
|
@@ -52643,7 +52878,7 @@ function evict(token) {
|
|
|
52643
52878
|
clearTimeout(e.timer);
|
|
52644
52879
|
registry.delete(token);
|
|
52645
52880
|
try {
|
|
52646
|
-
(0,
|
|
52881
|
+
(0, import_node_fs10.rmSync)(e.tempDir, { recursive: true, force: true });
|
|
52647
52882
|
} catch {
|
|
52648
52883
|
}
|
|
52649
52884
|
}
|
|
@@ -52652,8 +52887,8 @@ function clearAllStages() {
|
|
|
52652
52887
|
}
|
|
52653
52888
|
|
|
52654
52889
|
// graft-commit.ts
|
|
52655
|
-
var
|
|
52656
|
-
var
|
|
52890
|
+
var import_node_fs11 = require("node:fs");
|
|
52891
|
+
var import_node_path9 = require("node:path");
|
|
52657
52892
|
var GraftCommitError = class extends Error {
|
|
52658
52893
|
constructor(message, code) {
|
|
52659
52894
|
super(message);
|
|
@@ -52663,34 +52898,34 @@ var GraftCommitError = class extends Error {
|
|
|
52663
52898
|
code;
|
|
52664
52899
|
};
|
|
52665
52900
|
function commitStaged(tempDir, agentId, targetAgentsDir, force) {
|
|
52666
|
-
const staged = (0,
|
|
52667
|
-
const target = (0,
|
|
52668
|
-
if ((0,
|
|
52901
|
+
const staged = (0, import_node_path9.join)(tempDir, "agents", agentId);
|
|
52902
|
+
const target = (0, import_node_path9.join)(targetAgentsDir, agentId);
|
|
52903
|
+
if ((0, import_node_fs11.existsSync)(target)) {
|
|
52669
52904
|
if (!force) throw new GraftCommitError(`an agent named "${agentId}" is already installed`, "collision");
|
|
52670
|
-
(0,
|
|
52905
|
+
(0, import_node_fs11.rmSync)(target, { recursive: true, force: true });
|
|
52671
52906
|
}
|
|
52672
|
-
(0,
|
|
52907
|
+
(0, import_node_fs11.mkdirSync)(targetAgentsDir, { recursive: true });
|
|
52673
52908
|
try {
|
|
52674
|
-
(0,
|
|
52909
|
+
(0, import_node_fs11.renameSync)(staged, target);
|
|
52675
52910
|
} catch {
|
|
52676
|
-
(0,
|
|
52911
|
+
(0, import_node_fs11.cpSync)(staged, target, { recursive: true });
|
|
52677
52912
|
}
|
|
52678
|
-
(0,
|
|
52913
|
+
(0, import_node_fs11.rmSync)(tempDir, { recursive: true, force: true });
|
|
52679
52914
|
return { agentId };
|
|
52680
52915
|
}
|
|
52681
52916
|
function matchAssemblies(globOrDir) {
|
|
52682
52917
|
let dir;
|
|
52683
52918
|
let pattern;
|
|
52684
|
-
if ((0,
|
|
52919
|
+
if ((0, import_node_fs11.existsSync)(globOrDir) && (0, import_node_fs11.statSync)(globOrDir).isDirectory()) {
|
|
52685
52920
|
dir = globOrDir;
|
|
52686
52921
|
pattern = "*.dll";
|
|
52687
52922
|
} else {
|
|
52688
|
-
dir = (0,
|
|
52689
|
-
pattern = (0,
|
|
52923
|
+
dir = (0, import_node_path9.dirname)(globOrDir);
|
|
52924
|
+
pattern = (0, import_node_path9.basename)(globOrDir);
|
|
52690
52925
|
}
|
|
52691
|
-
if (!dir || !(0,
|
|
52926
|
+
if (!dir || !(0, import_node_fs11.existsSync)(dir) || !(0, import_node_fs11.statSync)(dir).isDirectory()) return [];
|
|
52692
52927
|
const re = globToRegExp(pattern);
|
|
52693
|
-
return (0,
|
|
52928
|
+
return (0, import_node_fs11.readdirSync)(dir).filter((f) => re.test(f)).sort();
|
|
52694
52929
|
}
|
|
52695
52930
|
function globToRegExp(p) {
|
|
52696
52931
|
const esc = p.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*").replace(/\?/g, ".");
|
|
@@ -52698,25 +52933,25 @@ function globToRegExp(p) {
|
|
|
52698
52933
|
}
|
|
52699
52934
|
|
|
52700
52935
|
// floless-store.ts
|
|
52701
|
-
var
|
|
52702
|
-
var
|
|
52703
|
-
var
|
|
52704
|
-
var
|
|
52705
|
-
var
|
|
52706
|
-
var TEMPLATES_FILE = (0,
|
|
52707
|
-
var REQUESTS_DIR = (0,
|
|
52936
|
+
var import_node_crypto4 = require("node:crypto");
|
|
52937
|
+
var import_node_fs12 = require("node:fs");
|
|
52938
|
+
var import_node_os8 = require("node:os");
|
|
52939
|
+
var import_node_path10 = require("node:path");
|
|
52940
|
+
var ROOT2 = process.env.FLOLESS_HOME ?? (0, import_node_path10.join)((0, import_node_os8.homedir)(), ".floless");
|
|
52941
|
+
var TEMPLATES_FILE = (0, import_node_path10.join)(ROOT2, "templates.json");
|
|
52942
|
+
var REQUESTS_DIR = (0, import_node_path10.join)(ROOT2, "requests");
|
|
52708
52943
|
function ensureRoot() {
|
|
52709
|
-
if (!(0,
|
|
52944
|
+
if (!(0, import_node_fs12.existsSync)(ROOT2)) (0, import_node_fs12.mkdirSync)(ROOT2, { recursive: true });
|
|
52710
52945
|
}
|
|
52711
52946
|
function withinRequestsDir(p) {
|
|
52712
|
-
const base = (0,
|
|
52713
|
-
const full = (0,
|
|
52714
|
-
return full === base || full.startsWith(base +
|
|
52947
|
+
const base = (0, import_node_path10.resolve)(REQUESTS_DIR);
|
|
52948
|
+
const full = (0, import_node_path10.resolve)(p);
|
|
52949
|
+
return full === base || full.startsWith(base + import_node_path10.sep);
|
|
52715
52950
|
}
|
|
52716
52951
|
function listTemplates() {
|
|
52717
|
-
if (!(0,
|
|
52952
|
+
if (!(0, import_node_fs12.existsSync)(TEMPLATES_FILE)) return [];
|
|
52718
52953
|
try {
|
|
52719
|
-
const parsed = JSON.parse((0,
|
|
52954
|
+
const parsed = JSON.parse((0, import_node_fs12.readFileSync)(TEMPLATES_FILE, "utf8"));
|
|
52720
52955
|
return Array.isArray(parsed) ? parsed : [];
|
|
52721
52956
|
} catch {
|
|
52722
52957
|
return [];
|
|
@@ -52725,12 +52960,12 @@ function listTemplates() {
|
|
|
52725
52960
|
function writeTemplates(list) {
|
|
52726
52961
|
ensureRoot();
|
|
52727
52962
|
const tmp = `${TEMPLATES_FILE}.${process.pid}.tmp`;
|
|
52728
|
-
(0,
|
|
52729
|
-
(0,
|
|
52963
|
+
(0, import_node_fs12.writeFileSync)(tmp, JSON.stringify(list, null, 2));
|
|
52964
|
+
(0, import_node_fs12.renameSync)(tmp, TEMPLATES_FILE);
|
|
52730
52965
|
}
|
|
52731
52966
|
function addTemplate(input) {
|
|
52732
52967
|
const tpl = {
|
|
52733
|
-
id: (0,
|
|
52968
|
+
id: (0, import_node_crypto4.randomUUID)(),
|
|
52734
52969
|
name: input.name.trim(),
|
|
52735
52970
|
category: (input.category || "Uncategorized").trim(),
|
|
52736
52971
|
node: input.node,
|
|
@@ -52754,13 +52989,13 @@ function getTemplate(id) {
|
|
|
52754
52989
|
}
|
|
52755
52990
|
function addRequest(req, decoded = []) {
|
|
52756
52991
|
ensureRoot();
|
|
52757
|
-
if (!(0,
|
|
52758
|
-
const id = (0,
|
|
52992
|
+
if (!(0, import_node_fs12.existsSync)(REQUESTS_DIR)) (0, import_node_fs12.mkdirSync)(REQUESTS_DIR, { recursive: true });
|
|
52993
|
+
const id = (0, import_node_crypto4.randomUUID)();
|
|
52759
52994
|
const createdAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
52760
52995
|
const base = `${createdAt.replace(/[:.]/g, "-")}__${id}`;
|
|
52761
52996
|
const snapshots = decoded.map((d, i) => {
|
|
52762
|
-
const p = (0,
|
|
52763
|
-
(0,
|
|
52997
|
+
const p = (0, import_node_path10.join)(REQUESTS_DIR, `${base}__snap${i + 1}.${d.ext}`);
|
|
52998
|
+
(0, import_node_fs12.writeFileSync)(p, d.buf);
|
|
52764
52999
|
return p;
|
|
52765
53000
|
});
|
|
52766
53001
|
const full = {
|
|
@@ -52770,62 +53005,62 @@ function addRequest(req, decoded = []) {
|
|
|
52770
53005
|
...req,
|
|
52771
53006
|
...snapshots.length ? { snapshots } : {}
|
|
52772
53007
|
};
|
|
52773
|
-
(0,
|
|
53008
|
+
(0, import_node_fs12.writeFileSync)((0, import_node_path10.join)(REQUESTS_DIR, `${base}.json`), JSON.stringify(full, null, 2));
|
|
52774
53009
|
return full;
|
|
52775
53010
|
}
|
|
52776
53011
|
function listRequests() {
|
|
52777
|
-
if (!(0,
|
|
52778
|
-
return (0,
|
|
53012
|
+
if (!(0, import_node_fs12.existsSync)(REQUESTS_DIR)) return [];
|
|
53013
|
+
return (0, import_node_fs12.readdirSync)(REQUESTS_DIR).filter((f) => f.endsWith(".json")).sort().map((f) => {
|
|
52779
53014
|
try {
|
|
52780
|
-
return JSON.parse((0,
|
|
53015
|
+
return JSON.parse((0, import_node_fs12.readFileSync)((0, import_node_path10.join)(REQUESTS_DIR, f), "utf8"));
|
|
52781
53016
|
} catch {
|
|
52782
53017
|
return null;
|
|
52783
53018
|
}
|
|
52784
53019
|
}).filter((r) => r !== null);
|
|
52785
53020
|
}
|
|
52786
53021
|
function deleteRequest(id) {
|
|
52787
|
-
if (!(0,
|
|
52788
|
-
const file = (0,
|
|
53022
|
+
if (!(0, import_node_fs12.existsSync)(REQUESTS_DIR)) return false;
|
|
53023
|
+
const file = (0, import_node_fs12.readdirSync)(REQUESTS_DIR).find((f) => f.endsWith(`__${id}.json`));
|
|
52789
53024
|
if (!file) return false;
|
|
52790
53025
|
try {
|
|
52791
|
-
const parsed = JSON.parse((0,
|
|
53026
|
+
const parsed = JSON.parse((0, import_node_fs12.readFileSync)((0, import_node_path10.join)(REQUESTS_DIR, file), "utf8"));
|
|
52792
53027
|
for (const p of parsed.snapshots ?? []) {
|
|
52793
53028
|
if (!withinRequestsDir(p)) continue;
|
|
52794
53029
|
try {
|
|
52795
|
-
(0,
|
|
53030
|
+
(0, import_node_fs12.rmSync)(p);
|
|
52796
53031
|
} catch {
|
|
52797
53032
|
}
|
|
52798
53033
|
}
|
|
52799
53034
|
} catch {
|
|
52800
53035
|
}
|
|
52801
|
-
(0,
|
|
53036
|
+
(0, import_node_fs12.rmSync)((0, import_node_path10.join)(REQUESTS_DIR, file));
|
|
52802
53037
|
return true;
|
|
52803
53038
|
}
|
|
52804
53039
|
function clearRequests() {
|
|
52805
|
-
if (!(0,
|
|
52806
|
-
const allFiles = (0,
|
|
53040
|
+
if (!(0, import_node_fs12.existsSync)(REQUESTS_DIR)) return 0;
|
|
53041
|
+
const allFiles = (0, import_node_fs12.readdirSync)(REQUESTS_DIR);
|
|
52807
53042
|
const jsonFiles = allFiles.filter((f) => f.endsWith(".json"));
|
|
52808
53043
|
for (const f of allFiles) {
|
|
52809
53044
|
try {
|
|
52810
|
-
(0,
|
|
53045
|
+
(0, import_node_fs12.rmSync)((0, import_node_path10.join)(REQUESTS_DIR, f));
|
|
52811
53046
|
} catch {
|
|
52812
53047
|
}
|
|
52813
53048
|
}
|
|
52814
53049
|
return jsonFiles.length;
|
|
52815
53050
|
}
|
|
52816
53051
|
function snapshotPathFor(id, n) {
|
|
52817
|
-
if (!(0,
|
|
52818
|
-
const file = (0,
|
|
53052
|
+
if (!(0, import_node_fs12.existsSync)(REQUESTS_DIR)) return null;
|
|
53053
|
+
const file = (0, import_node_fs12.readdirSync)(REQUESTS_DIR).find((f) => f.endsWith(`__${id}.json`));
|
|
52819
53054
|
if (!file) return null;
|
|
52820
53055
|
try {
|
|
52821
|
-
const parsed = JSON.parse((0,
|
|
53056
|
+
const parsed = JSON.parse((0, import_node_fs12.readFileSync)((0, import_node_path10.join)(REQUESTS_DIR, file), "utf8"));
|
|
52822
53057
|
const cand = parsed.snapshots?.[n] ?? null;
|
|
52823
53058
|
return cand && withinRequestsDir(cand) ? cand : null;
|
|
52824
53059
|
} catch {
|
|
52825
53060
|
return null;
|
|
52826
53061
|
}
|
|
52827
53062
|
}
|
|
52828
|
-
var flolessRoot =
|
|
53063
|
+
var flolessRoot = ROOT2;
|
|
52829
53064
|
var SnapshotError = class extends Error {
|
|
52830
53065
|
};
|
|
52831
53066
|
var MAX_SNAPSHOTS = 8;
|
|
@@ -52852,8 +53087,8 @@ function decodeSnapshots(inputs) {
|
|
|
52852
53087
|
}
|
|
52853
53088
|
|
|
52854
53089
|
// routines.ts
|
|
52855
|
-
var
|
|
52856
|
-
var
|
|
53090
|
+
var import_node_fs14 = require("node:fs");
|
|
53091
|
+
var import_node_path12 = require("node:path");
|
|
52857
53092
|
|
|
52858
53093
|
// sse.ts
|
|
52859
53094
|
var clients = /* @__PURE__ */ new Set();
|
|
@@ -52890,11 +53125,11 @@ function clientCount() {
|
|
|
52890
53125
|
}
|
|
52891
53126
|
|
|
52892
53127
|
// trigger-sessions.ts
|
|
52893
|
-
var
|
|
52894
|
-
var
|
|
52895
|
-
var
|
|
53128
|
+
var import_node_fs13 = require("node:fs");
|
|
53129
|
+
var import_node_os9 = require("node:os");
|
|
53130
|
+
var import_node_path11 = require("node:path");
|
|
52896
53131
|
var import_yaml4 = __toESM(require_dist6(), 1);
|
|
52897
|
-
var AGENTS_DIR2 = process.env.AWARE_HOME ? (0,
|
|
53132
|
+
var AGENTS_DIR2 = process.env.AWARE_HOME ? (0, import_node_path11.join)(process.env.AWARE_HOME, "agents") : (0, import_node_path11.join)((0, import_node_os9.homedir)(), ".aware", "agents");
|
|
52898
53133
|
function summarizeFire(data) {
|
|
52899
53134
|
if (!data) return "event";
|
|
52900
53135
|
const type = typeof data.type === "string" ? data.type : "";
|
|
@@ -52911,10 +53146,10 @@ function mapTriggerState(phase) {
|
|
|
52911
53146
|
function isHostBacked(agent, agentsDir = AGENTS_DIR2) {
|
|
52912
53147
|
const safe = (n) => !n.includes("/") && !n.includes("\\") && !n.includes("..");
|
|
52913
53148
|
if (!safe(agent)) return false;
|
|
52914
|
-
const manifestPath = (0,
|
|
52915
|
-
if (!(0,
|
|
53149
|
+
const manifestPath = (0, import_node_path11.join)(agentsDir, agent, "manifest.yaml");
|
|
53150
|
+
if (!(0, import_node_fs13.existsSync)(manifestPath)) return false;
|
|
52916
53151
|
try {
|
|
52917
|
-
const doc = (0, import_yaml4.parse)((0,
|
|
53152
|
+
const doc = (0, import_yaml4.parse)((0, import_node_fs13.readFileSync)(manifestPath, "utf8"));
|
|
52918
53153
|
const transport = doc?.transport;
|
|
52919
53154
|
return !!(transport && typeof transport === "object" && "cli" in transport);
|
|
52920
53155
|
} catch {
|
|
@@ -53173,7 +53408,7 @@ var RoutineError = class extends Error {
|
|
|
53173
53408
|
}
|
|
53174
53409
|
status;
|
|
53175
53410
|
};
|
|
53176
|
-
var ROUTINES_FILE = (0,
|
|
53411
|
+
var ROUTINES_FILE = (0, import_node_path12.join)(flolessRoot, "routines.json");
|
|
53177
53412
|
var routines = [];
|
|
53178
53413
|
var loaded = false;
|
|
53179
53414
|
function ensureLoaded() {
|
|
@@ -53209,10 +53444,10 @@ function sanitizeRoutine(raw) {
|
|
|
53209
53444
|
};
|
|
53210
53445
|
}
|
|
53211
53446
|
function loadFromDisk() {
|
|
53212
|
-
if (!(0,
|
|
53447
|
+
if (!(0, import_node_fs14.existsSync)(ROUTINES_FILE)) return [];
|
|
53213
53448
|
let text;
|
|
53214
53449
|
try {
|
|
53215
|
-
text = (0,
|
|
53450
|
+
text = (0, import_node_fs14.readFileSync)(ROUTINES_FILE, "utf8");
|
|
53216
53451
|
} catch {
|
|
53217
53452
|
return [];
|
|
53218
53453
|
}
|
|
@@ -53221,17 +53456,17 @@ function loadFromDisk() {
|
|
|
53221
53456
|
return Array.isArray(parsed) ? parsed.map(sanitizeRoutine).filter((r) => r !== null) : [];
|
|
53222
53457
|
} catch {
|
|
53223
53458
|
try {
|
|
53224
|
-
(0,
|
|
53459
|
+
(0, import_node_fs14.renameSync)(ROUTINES_FILE, `${ROUTINES_FILE}.corrupt-${Date.now()}`);
|
|
53225
53460
|
} catch {
|
|
53226
53461
|
}
|
|
53227
53462
|
return [];
|
|
53228
53463
|
}
|
|
53229
53464
|
}
|
|
53230
53465
|
function saveRoutines() {
|
|
53231
|
-
if (!(0,
|
|
53466
|
+
if (!(0, import_node_fs14.existsSync)(flolessRoot)) (0, import_node_fs14.mkdirSync)(flolessRoot, { recursive: true });
|
|
53232
53467
|
const tmp = `${ROUTINES_FILE}.${process.pid}.tmp`;
|
|
53233
|
-
(0,
|
|
53234
|
-
(0,
|
|
53468
|
+
(0, import_node_fs14.writeFileSync)(tmp, JSON.stringify(routines, null, 2));
|
|
53469
|
+
(0, import_node_fs14.renameSync)(tmp, ROUTINES_FILE);
|
|
53235
53470
|
}
|
|
53236
53471
|
function listRoutines() {
|
|
53237
53472
|
ensureLoaded();
|
|
@@ -53621,9 +53856,9 @@ function isGatedAwareRoute(url, method) {
|
|
|
53621
53856
|
|
|
53622
53857
|
// autostart.mjs
|
|
53623
53858
|
var import_node_child_process3 = require("node:child_process");
|
|
53624
|
-
var
|
|
53625
|
-
var
|
|
53626
|
-
var
|
|
53859
|
+
var import_node_fs15 = require("node:fs");
|
|
53860
|
+
var import_node_os10 = require("node:os");
|
|
53861
|
+
var import_node_path13 = require("node:path");
|
|
53627
53862
|
|
|
53628
53863
|
// teardown.mjs
|
|
53629
53864
|
var RUN_KEY = "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run";
|
|
@@ -53735,8 +53970,8 @@ function removeLegacyRunKey() {
|
|
|
53735
53970
|
}
|
|
53736
53971
|
function logLine(msg) {
|
|
53737
53972
|
try {
|
|
53738
|
-
(0,
|
|
53739
|
-
(0,
|
|
53973
|
+
(0, import_node_fs15.mkdirSync)(logDir(), { recursive: true });
|
|
53974
|
+
(0, import_node_fs15.appendFileSync)(logFilePath(), `${(/* @__PURE__ */ new Date()).toISOString()} ${msg}
|
|
53740
53975
|
`);
|
|
53741
53976
|
} catch {
|
|
53742
53977
|
}
|
|
@@ -53744,8 +53979,8 @@ function logLine(msg) {
|
|
|
53744
53979
|
function registerAutostart(exePath) {
|
|
53745
53980
|
if (!isWin) return;
|
|
53746
53981
|
const xml = buildAutostartTaskXml(exePath, currentUserId());
|
|
53747
|
-
const tmp = (0,
|
|
53748
|
-
(0,
|
|
53982
|
+
const tmp = (0, import_node_path13.join)((0, import_node_os10.tmpdir)(), `floless-autostart-${process.pid}-${Date.now()}.xml`);
|
|
53983
|
+
(0, import_node_fs15.writeFileSync)(tmp, "\uFEFF" + xml, { encoding: "utf16le" });
|
|
53749
53984
|
try {
|
|
53750
53985
|
(0, import_node_child_process3.execFileSync)("schtasks", ["/Create", "/TN", TASK_NAME, "/XML", tmp, "/F"], {
|
|
53751
53986
|
stdio: ["ignore", "ignore", "ignore"],
|
|
@@ -53756,7 +53991,7 @@ function registerAutostart(exePath) {
|
|
|
53756
53991
|
throw err;
|
|
53757
53992
|
} finally {
|
|
53758
53993
|
try {
|
|
53759
|
-
(0,
|
|
53994
|
+
(0, import_node_fs15.rmSync)(tmp, { force: true });
|
|
53760
53995
|
} catch {
|
|
53761
53996
|
}
|
|
53762
53997
|
}
|
|
@@ -53790,11 +54025,11 @@ function unregisterAutostart() {
|
|
|
53790
54025
|
|
|
53791
54026
|
// updater.ts
|
|
53792
54027
|
var import_node_child_process4 = require("node:child_process");
|
|
53793
|
-
var
|
|
53794
|
-
var
|
|
54028
|
+
var import_node_crypto5 = require("node:crypto");
|
|
54029
|
+
var import_node_fs16 = require("node:fs");
|
|
53795
54030
|
var import_node_stream = require("node:stream");
|
|
53796
54031
|
var import_promises = require("node:stream/promises");
|
|
53797
|
-
var
|
|
54032
|
+
var import_node_path14 = require("node:path");
|
|
53798
54033
|
var CHANNEL = "win";
|
|
53799
54034
|
var FEED_TIMEOUT_MS = 15e3;
|
|
53800
54035
|
var DOWNLOAD_TIMEOUT_MS = 3e5;
|
|
@@ -53803,13 +54038,13 @@ function currentVersion() {
|
|
|
53803
54038
|
return appVersion();
|
|
53804
54039
|
}
|
|
53805
54040
|
function installRoot() {
|
|
53806
|
-
return (0,
|
|
54041
|
+
return (0, import_node_path14.dirname)((0, import_node_path14.dirname)(process.execPath));
|
|
53807
54042
|
}
|
|
53808
54043
|
function updateExePath() {
|
|
53809
|
-
return (0,
|
|
54044
|
+
return (0, import_node_path14.join)(installRoot(), "Update.exe");
|
|
53810
54045
|
}
|
|
53811
54046
|
function packagesDir() {
|
|
53812
|
-
return (0,
|
|
54047
|
+
return (0, import_node_path14.join)(installRoot(), "packages");
|
|
53813
54048
|
}
|
|
53814
54049
|
function feedUrl() {
|
|
53815
54050
|
const env2 = (process.env.FLOLESS_UPDATE_URL ?? "").trim().replace(/\/+$/, "");
|
|
@@ -53901,23 +54136,23 @@ async function checkForUpdate() {
|
|
|
53901
54136
|
return { supported: true, currentVersion: cur, updateAvailable: true, targetVersion: latest.Version, asset: latest };
|
|
53902
54137
|
}
|
|
53903
54138
|
async function sha1OfFile(path) {
|
|
53904
|
-
const hash = (0,
|
|
53905
|
-
await (0, import_promises.pipeline)((0,
|
|
54139
|
+
const hash = (0, import_node_crypto5.createHash)("sha1");
|
|
54140
|
+
await (0, import_promises.pipeline)((0, import_node_fs16.createReadStream)(path), hash);
|
|
53906
54141
|
return hash.digest("hex").toUpperCase();
|
|
53907
54142
|
}
|
|
53908
54143
|
async function downloadPackage(asset) {
|
|
53909
54144
|
if (!NUPKG_NAME.test(asset.FileName)) throw new Error(`refusing suspicious package name: ${asset.FileName}`);
|
|
53910
54145
|
const want = asset.SHA1.toUpperCase();
|
|
53911
54146
|
const dir = packagesDir();
|
|
53912
|
-
(0,
|
|
53913
|
-
const dest = (0,
|
|
53914
|
-
if ((0,
|
|
54147
|
+
(0, import_node_fs16.mkdirSync)(dir, { recursive: true });
|
|
54148
|
+
const dest = (0, import_node_path14.join)(dir, asset.FileName);
|
|
54149
|
+
if ((0, import_node_fs16.existsSync)(dest) && await sha1OfFile(dest) === want) return dest;
|
|
53915
54150
|
const res = await authedFetch(`${feedUrl()}/${encodeURIComponent(asset.FileName)}`, {
|
|
53916
54151
|
redirect: "follow",
|
|
53917
54152
|
signal: AbortSignal.timeout(DOWNLOAD_TIMEOUT_MS)
|
|
53918
54153
|
});
|
|
53919
54154
|
if (!res.ok || !res.body) throw new Error(`download failed: HTTP ${res.status} for ${asset.FileName}`);
|
|
53920
|
-
await (0, import_promises.pipeline)(import_node_stream.Readable.fromWeb(res.body), (0,
|
|
54155
|
+
await (0, import_promises.pipeline)(import_node_stream.Readable.fromWeb(res.body), (0, import_node_fs16.createWriteStream)(dest));
|
|
53921
54156
|
const got = await sha1OfFile(dest);
|
|
53922
54157
|
if (got !== want) throw new Error(`SHA1 mismatch for ${asset.FileName}: feed=${want} got=${got}`);
|
|
53923
54158
|
return dest;
|
|
@@ -53926,12 +54161,12 @@ async function applyUpdate(check, opts) {
|
|
|
53926
54161
|
if (!check.supported) return { applied: false, message: check.reason ?? "auto-update not supported in this runtime" };
|
|
53927
54162
|
if (!check.updateAvailable || !check.asset) return { applied: false, message: check.reason ?? "no update available" };
|
|
53928
54163
|
const exe = updateExePath();
|
|
53929
|
-
if (!(0,
|
|
54164
|
+
if (!(0, import_node_fs16.existsSync)(exe)) {
|
|
53930
54165
|
return { applied: false, message: `Update.exe not found at ${exe} \u2014 is this a Velopack install?` };
|
|
53931
54166
|
}
|
|
53932
54167
|
const pkg = await downloadPackage(check.asset);
|
|
53933
54168
|
if (opts?.onBeforeApply) await opts.onBeforeApply();
|
|
53934
|
-
await new Promise((
|
|
54169
|
+
await new Promise((resolve5, reject) => {
|
|
53935
54170
|
const child = (0, import_node_child_process4.spawn)(exe, ["apply", "--package", pkg, "--waitPid", String(process.pid)], {
|
|
53936
54171
|
cwd: installRoot(),
|
|
53937
54172
|
detached: true,
|
|
@@ -53941,7 +54176,7 @@ async function applyUpdate(check, opts) {
|
|
|
53941
54176
|
child.once("error", reject);
|
|
53942
54177
|
child.once("spawn", () => {
|
|
53943
54178
|
child.unref();
|
|
53944
|
-
|
|
54179
|
+
resolve5();
|
|
53945
54180
|
});
|
|
53946
54181
|
});
|
|
53947
54182
|
return { applied: true, message: `updating to v${check.targetVersion}\u2026 the app will relaunch` };
|
|
@@ -54127,15 +54362,19 @@ function summarizeRun(events) {
|
|
|
54127
54362
|
}
|
|
54128
54363
|
return { status, errorNodeId, errorMessage };
|
|
54129
54364
|
}
|
|
54365
|
+
function isTraceCorrupt(events) {
|
|
54366
|
+
if (!events.length) return false;
|
|
54367
|
+
return events.every((e) => e.kind === "unparsed");
|
|
54368
|
+
}
|
|
54130
54369
|
|
|
54131
54370
|
// launch.mjs
|
|
54132
54371
|
var import_node_child_process5 = require("node:child_process");
|
|
54133
|
-
var
|
|
54372
|
+
var import_node_path15 = require("node:path");
|
|
54134
54373
|
var import_node_url = require("node:url");
|
|
54135
|
-
var
|
|
54374
|
+
var import_node_fs17 = require("node:fs");
|
|
54136
54375
|
var import_node_http = __toESM(require("node:http"), 1);
|
|
54137
54376
|
var import_node_readline = require("node:readline");
|
|
54138
|
-
var __dirname2 = (0,
|
|
54377
|
+
var __dirname2 = (0, import_node_path15.dirname)((0, import_node_url.fileURLToPath)(__import_meta_url));
|
|
54139
54378
|
var PORT = Number(process.env.PORT ?? 4317);
|
|
54140
54379
|
var HEALTH_URL = `http://127.0.0.1:${PORT}/api/health`;
|
|
54141
54380
|
var BROWSER_URL = `http://floless.localhost:${PORT}`;
|
|
@@ -54148,20 +54387,20 @@ var log = (m) => {
|
|
|
54148
54387
|
}
|
|
54149
54388
|
};
|
|
54150
54389
|
function ping() {
|
|
54151
|
-
return new Promise((
|
|
54390
|
+
return new Promise((resolve5) => {
|
|
54152
54391
|
const req = import_node_http.default.get(HEALTH_URL, { timeout: 1500 }, (res) => {
|
|
54153
54392
|
res.resume();
|
|
54154
|
-
|
|
54393
|
+
resolve5(res.statusCode === 200);
|
|
54155
54394
|
});
|
|
54156
|
-
req.on("error", () =>
|
|
54395
|
+
req.on("error", () => resolve5(false));
|
|
54157
54396
|
req.on("timeout", () => {
|
|
54158
54397
|
req.destroy();
|
|
54159
|
-
|
|
54398
|
+
resolve5(false);
|
|
54160
54399
|
});
|
|
54161
54400
|
});
|
|
54162
54401
|
}
|
|
54163
54402
|
function probeVersion() {
|
|
54164
|
-
return new Promise((
|
|
54403
|
+
return new Promise((resolve5) => {
|
|
54165
54404
|
const req = import_node_http.default.get(HEALTH_URL, { timeout: 1500 }, (res) => {
|
|
54166
54405
|
let body = "";
|
|
54167
54406
|
res.on("data", (c) => {
|
|
@@ -54169,16 +54408,16 @@ function probeVersion() {
|
|
|
54169
54408
|
});
|
|
54170
54409
|
res.on("end", () => {
|
|
54171
54410
|
try {
|
|
54172
|
-
|
|
54411
|
+
resolve5(JSON.parse(body).appVersion || null);
|
|
54173
54412
|
} catch {
|
|
54174
|
-
|
|
54413
|
+
resolve5(null);
|
|
54175
54414
|
}
|
|
54176
54415
|
});
|
|
54177
54416
|
});
|
|
54178
|
-
req.on("error", () =>
|
|
54417
|
+
req.on("error", () => resolve5(null));
|
|
54179
54418
|
req.on("timeout", () => {
|
|
54180
54419
|
req.destroy();
|
|
54181
|
-
|
|
54420
|
+
resolve5(null);
|
|
54182
54421
|
});
|
|
54183
54422
|
});
|
|
54184
54423
|
}
|
|
@@ -54207,8 +54446,8 @@ async function waitHealthy(timeoutMs = 3e4) {
|
|
|
54207
54446
|
function resolveServerStart() {
|
|
54208
54447
|
const packaged = /flolessapp\.exe$/i.test(process.execPath);
|
|
54209
54448
|
if (packaged) return { cmd: process.execPath, args: ["--serve"], shell: false };
|
|
54210
|
-
const bundle = (0,
|
|
54211
|
-
if ((0,
|
|
54449
|
+
const bundle = (0, import_node_path15.join)(__dirname2, "dist", "floless-server.cjs");
|
|
54450
|
+
if ((0, import_node_fs17.existsSync)(bundle)) return { cmd: process.execPath, args: [bundle, "--serve"], shell: false };
|
|
54212
54451
|
return { cmd: "npm", args: ["run", "start"], shell: isWin2 };
|
|
54213
54452
|
}
|
|
54214
54453
|
function startServerDetached() {
|
|
@@ -54356,8 +54595,8 @@ function taskkillArgs(pid, { tree = true } = {}) {
|
|
|
54356
54595
|
}
|
|
54357
54596
|
function killSupervisor({ tree = true } = {}) {
|
|
54358
54597
|
if (!isWin2) return;
|
|
54359
|
-
const isNpmChannel = /^node(\.exe)?$/i.test((0,
|
|
54360
|
-
const scriptMatch = isNpmChannel ? (0,
|
|
54598
|
+
const isNpmChannel = /^node(\.exe)?$/i.test((0, import_node_path15.basename)(process.execPath));
|
|
54599
|
+
const scriptMatch = isNpmChannel ? (0, import_node_path15.basename)((0, import_node_url.fileURLToPath)(__import_meta_url)) : void 0;
|
|
54361
54600
|
const realExe = resolveRealInstallExe(process.execPath);
|
|
54362
54601
|
const exeMatch = realExe === process.execPath ? process.execPath : [process.execPath, realExe];
|
|
54363
54602
|
const pids = supervisorPidsToKill(enumerateProcesses(), process.pid, exeMatch, scriptMatch);
|
|
@@ -54390,15 +54629,15 @@ async function cmdRestart() {
|
|
|
54390
54629
|
await cmdOpen();
|
|
54391
54630
|
}
|
|
54392
54631
|
function apiJson(path, method = "GET") {
|
|
54393
|
-
return new Promise((
|
|
54632
|
+
return new Promise((resolve5, reject) => {
|
|
54394
54633
|
const req = import_node_http.default.request(`http://127.0.0.1:${PORT}${path}`, { method, timeout: 5e3 }, (res) => {
|
|
54395
54634
|
let body = "";
|
|
54396
54635
|
res.on("data", (c) => body += c);
|
|
54397
54636
|
res.on("end", () => {
|
|
54398
54637
|
try {
|
|
54399
|
-
|
|
54638
|
+
resolve5(JSON.parse(body || "{}"));
|
|
54400
54639
|
} catch {
|
|
54401
|
-
|
|
54640
|
+
resolve5({});
|
|
54402
54641
|
}
|
|
54403
54642
|
});
|
|
54404
54643
|
});
|
|
@@ -54464,11 +54703,11 @@ function removeRegistryFootprint() {
|
|
|
54464
54703
|
}
|
|
54465
54704
|
}
|
|
54466
54705
|
function promptYesNo(question) {
|
|
54467
|
-
return new Promise((
|
|
54706
|
+
return new Promise((resolve5) => {
|
|
54468
54707
|
const rl = (0, import_node_readline.createInterface)({ input: process.stdin, output: process.stdout });
|
|
54469
54708
|
rl.question(`${question} `, (answer) => {
|
|
54470
54709
|
rl.close();
|
|
54471
|
-
|
|
54710
|
+
resolve5(/^y(es)?$/i.test((answer ?? "").trim()));
|
|
54472
54711
|
});
|
|
54473
54712
|
});
|
|
54474
54713
|
}
|
|
@@ -54522,7 +54761,7 @@ async function runAction(arg, flagArgv = [], selfVersion = null) {
|
|
|
54522
54761
|
}
|
|
54523
54762
|
await action(parseTeardownFlags(flagArgv));
|
|
54524
54763
|
}
|
|
54525
|
-
var entry = (0,
|
|
54764
|
+
var entry = (0, import_node_path15.basename)(process.argv[1] ?? "").toLowerCase();
|
|
54526
54765
|
if (entry === "launch.mjs") {
|
|
54527
54766
|
runAction(process.argv[2], process.argv.slice(3)).catch((e) => {
|
|
54528
54767
|
log(`error: ${e?.message ?? e}`);
|
|
@@ -54596,9 +54835,9 @@ function awareUpgradeBlockReason(s) {
|
|
|
54596
54835
|
}
|
|
54597
54836
|
|
|
54598
54837
|
// skill-sync.ts
|
|
54599
|
-
var
|
|
54600
|
-
var
|
|
54601
|
-
var
|
|
54838
|
+
var import_node_fs18 = require("node:fs");
|
|
54839
|
+
var import_node_os11 = require("node:os");
|
|
54840
|
+
var import_node_path16 = require("node:path");
|
|
54602
54841
|
var import_node_url2 = require("node:url");
|
|
54603
54842
|
var import_yaml5 = __toESM(require_dist6(), 1);
|
|
54604
54843
|
|
|
@@ -54612,6 +54851,8 @@ var PRODUCT_SKILLS = [
|
|
|
54612
54851
|
// file a diagnosed bug/idea/question to the private log via the floless.io relay
|
|
54613
54852
|
"floless-app-routines",
|
|
54614
54853
|
// author event-driven ("on trigger") routines
|
|
54854
|
+
"floless-app-ui",
|
|
54855
|
+
// compose Custom Panels (~/.floless/ui/extensions.json) for the Dashboard
|
|
54615
54856
|
"floless-app-workflows"
|
|
54616
54857
|
// author/run .flo workflows
|
|
54617
54858
|
];
|
|
@@ -54621,30 +54862,30 @@ function selectShippedSkillNames(names) {
|
|
|
54621
54862
|
}
|
|
54622
54863
|
|
|
54623
54864
|
// skill-sync.ts
|
|
54624
|
-
var __dirname3 = (0,
|
|
54865
|
+
var __dirname3 = (0, import_node_path16.dirname)((0, import_node_url2.fileURLToPath)(__import_meta_url));
|
|
54625
54866
|
function bundledSkillsRoot() {
|
|
54626
54867
|
const candidates = [
|
|
54627
|
-
(0,
|
|
54628
|
-
(0,
|
|
54629
|
-
(0,
|
|
54868
|
+
(0, import_node_path16.join)(__dirname3, "skills"),
|
|
54869
|
+
(0, import_node_path16.join)((0, import_node_path16.dirname)(process.execPath), "skills"),
|
|
54870
|
+
(0, import_node_path16.join)(__dirname3, "..", ".claude", "skills")
|
|
54630
54871
|
];
|
|
54631
|
-
return candidates.find((p) => (0,
|
|
54872
|
+
return candidates.find((p) => (0, import_node_fs18.existsSync)(p)) ?? null;
|
|
54632
54873
|
}
|
|
54633
54874
|
function targetConfigDirs() {
|
|
54634
54875
|
const override = process.env.FLOLESS_SKILL_TARGETS;
|
|
54635
54876
|
if (override) {
|
|
54636
54877
|
return override.split(";").map((d) => d.trim()).filter(Boolean).map((dir) => ({ runtime: "custom", dir }));
|
|
54637
54878
|
}
|
|
54638
|
-
const home = (0,
|
|
54879
|
+
const home = (0, import_node_os11.homedir)();
|
|
54639
54880
|
return [
|
|
54640
|
-
{ runtime: "claude", dir: (0,
|
|
54641
|
-
{ runtime: "codex", dir: (0,
|
|
54642
|
-
{ runtime: "opencode", dir: (0,
|
|
54881
|
+
{ runtime: "claude", dir: (0, import_node_path16.join)(home, ".claude") },
|
|
54882
|
+
{ runtime: "codex", dir: (0, import_node_path16.join)(home, ".codex") },
|
|
54883
|
+
{ runtime: "opencode", dir: (0, import_node_path16.join)(home, ".opencode") }
|
|
54643
54884
|
];
|
|
54644
54885
|
}
|
|
54645
54886
|
function skillVersion(skillMdPath) {
|
|
54646
54887
|
try {
|
|
54647
|
-
const text = (0,
|
|
54888
|
+
const text = (0, import_node_fs18.readFileSync)(skillMdPath, "utf8");
|
|
54648
54889
|
const m = /^---\r?\n([\s\S]*?)\r?\n---/.exec(text);
|
|
54649
54890
|
if (!m || m[1] === void 0) return null;
|
|
54650
54891
|
const fm = (0, import_yaml5.parse)(m[1]);
|
|
@@ -54684,21 +54925,21 @@ function decideAction(installed, bundled) {
|
|
|
54684
54925
|
function bundledSkills(root) {
|
|
54685
54926
|
let entries = [];
|
|
54686
54927
|
try {
|
|
54687
|
-
entries = selectShippedSkillNames((0,
|
|
54928
|
+
entries = selectShippedSkillNames((0, import_node_fs18.readdirSync)(root));
|
|
54688
54929
|
} catch {
|
|
54689
54930
|
return [];
|
|
54690
54931
|
}
|
|
54691
54932
|
const out = [];
|
|
54692
54933
|
for (const name of entries) {
|
|
54693
|
-
const dir = (0,
|
|
54934
|
+
const dir = (0, import_node_path16.join)(root, name);
|
|
54694
54935
|
let isDir = false;
|
|
54695
54936
|
try {
|
|
54696
|
-
isDir = (0,
|
|
54937
|
+
isDir = (0, import_node_fs18.statSync)(dir).isDirectory();
|
|
54697
54938
|
} catch {
|
|
54698
54939
|
isDir = false;
|
|
54699
54940
|
}
|
|
54700
54941
|
if (!isDir) continue;
|
|
54701
|
-
const v = skillVersion((0,
|
|
54942
|
+
const v = skillVersion((0, import_node_path16.join)(dir, "SKILL.md"));
|
|
54702
54943
|
if (!v) continue;
|
|
54703
54944
|
out.push({ name, dir, version: v });
|
|
54704
54945
|
}
|
|
@@ -54711,17 +54952,17 @@ function syncSkills() {
|
|
|
54711
54952
|
const skills = bundledSkills(root);
|
|
54712
54953
|
if (!skills.length) return results;
|
|
54713
54954
|
for (const { runtime, dir: cfg } of targetConfigDirs()) {
|
|
54714
|
-
if (!(0,
|
|
54715
|
-
const skillsDir = (0,
|
|
54955
|
+
if (!(0, import_node_fs18.existsSync)(cfg)) continue;
|
|
54956
|
+
const skillsDir = (0, import_node_path16.join)(cfg, "skills");
|
|
54716
54957
|
for (const s of skills) {
|
|
54717
|
-
const dest = (0,
|
|
54718
|
-
const installedMd = (0,
|
|
54719
|
-
const installed = (0,
|
|
54958
|
+
const dest = (0, import_node_path16.join)(skillsDir, s.name);
|
|
54959
|
+
const installedMd = (0, import_node_path16.join)(dest, "SKILL.md");
|
|
54960
|
+
const installed = (0, import_node_fs18.existsSync)(installedMd) ? skillVersion(installedMd) : null;
|
|
54720
54961
|
const action = decideAction(installed, s.version);
|
|
54721
54962
|
if (action === "installed" || action === "updated") {
|
|
54722
54963
|
try {
|
|
54723
|
-
if (action === "updated") (0,
|
|
54724
|
-
(0,
|
|
54964
|
+
if (action === "updated") (0, import_node_fs18.rmSync)(dest, { recursive: true, force: true });
|
|
54965
|
+
(0, import_node_fs18.cpSync)(s.dir, dest, { recursive: true });
|
|
54725
54966
|
results.push({ runtime, skill: s.name, action, from: installed, to: s.version });
|
|
54726
54967
|
} catch {
|
|
54727
54968
|
}
|
|
@@ -54734,9 +54975,9 @@ function syncSkills() {
|
|
|
54734
54975
|
}
|
|
54735
54976
|
|
|
54736
54977
|
// watch.ts
|
|
54737
|
-
var
|
|
54738
|
-
var
|
|
54739
|
-
var
|
|
54978
|
+
var import_node_os12 = require("node:os");
|
|
54979
|
+
var import_node_path18 = require("node:path");
|
|
54980
|
+
var import_node_fs19 = require("node:fs");
|
|
54740
54981
|
|
|
54741
54982
|
// node_modules/chokidar/esm/index.js
|
|
54742
54983
|
var import_fs2 = require("fs");
|
|
@@ -54747,7 +54988,7 @@ var sysPath2 = __toESM(require("path"), 1);
|
|
|
54747
54988
|
// node_modules/readdirp/esm/index.js
|
|
54748
54989
|
var import_promises2 = require("node:fs/promises");
|
|
54749
54990
|
var import_node_stream2 = require("node:stream");
|
|
54750
|
-
var
|
|
54991
|
+
var import_node_path17 = require("node:path");
|
|
54751
54992
|
var EntryTypes = {
|
|
54752
54993
|
FILE_TYPE: "files",
|
|
54753
54994
|
DIR_TYPE: "directories",
|
|
@@ -54822,7 +55063,7 @@ var ReaddirpStream = class extends import_node_stream2.Readable {
|
|
|
54822
55063
|
this._wantsDir = type ? DIR_TYPES.has(type) : false;
|
|
54823
55064
|
this._wantsFile = type ? FILE_TYPES.has(type) : false;
|
|
54824
55065
|
this._wantsEverything = type === EntryTypes.EVERYTHING_TYPE;
|
|
54825
|
-
this._root = (0,
|
|
55066
|
+
this._root = (0, import_node_path17.resolve)(root);
|
|
54826
55067
|
this._isDirent = !opts.alwaysStat;
|
|
54827
55068
|
this._statsProp = this._isDirent ? "dirent" : "stats";
|
|
54828
55069
|
this._rdOptions = { encoding: "utf8", withFileTypes: this._isDirent };
|
|
@@ -54893,8 +55134,8 @@ var ReaddirpStream = class extends import_node_stream2.Readable {
|
|
|
54893
55134
|
let entry2;
|
|
54894
55135
|
const basename5 = this._isDirent ? dirent.name : dirent;
|
|
54895
55136
|
try {
|
|
54896
|
-
const fullPath = (0,
|
|
54897
|
-
entry2 = { path: (0,
|
|
55137
|
+
const fullPath = (0, import_node_path17.resolve)((0, import_node_path17.join)(path, basename5));
|
|
55138
|
+
entry2 = { path: (0, import_node_path17.relative)(this._root, fullPath), fullPath, basename: basename5 };
|
|
54898
55139
|
entry2[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
|
|
54899
55140
|
} catch (err) {
|
|
54900
55141
|
this._onError(err);
|
|
@@ -54928,7 +55169,7 @@ var ReaddirpStream = class extends import_node_stream2.Readable {
|
|
|
54928
55169
|
}
|
|
54929
55170
|
if (entryRealPathStats.isDirectory()) {
|
|
54930
55171
|
const len = entryRealPath.length;
|
|
54931
|
-
if (full.startsWith(entryRealPath) && full.substr(len, 1) ===
|
|
55172
|
+
if (full.startsWith(entryRealPath) && full.substr(len, 1) === import_node_path17.sep) {
|
|
54932
55173
|
const recursiveError = new Error(`Circular symlink detected: "${full}" points to "${entryRealPath}"`);
|
|
54933
55174
|
recursiveError.code = RECURSIVE_ERROR_CODE;
|
|
54934
55175
|
return this._onError(recursiveError);
|
|
@@ -55592,7 +55833,7 @@ var NodeFsHandler = class {
|
|
|
55592
55833
|
this._addToNodeFs(path, initialAdd, wh, depth + 1);
|
|
55593
55834
|
}
|
|
55594
55835
|
}).on(EV.ERROR, this._boundHandleError);
|
|
55595
|
-
return new Promise((
|
|
55836
|
+
return new Promise((resolve5, reject) => {
|
|
55596
55837
|
if (!stream)
|
|
55597
55838
|
return reject();
|
|
55598
55839
|
stream.once(STR_END, () => {
|
|
@@ -55601,7 +55842,7 @@ var NodeFsHandler = class {
|
|
|
55601
55842
|
return;
|
|
55602
55843
|
}
|
|
55603
55844
|
const wasThrottled = throttler ? throttler.clear() : false;
|
|
55604
|
-
|
|
55845
|
+
resolve5(void 0);
|
|
55605
55846
|
previous.getChildren().filter((item) => {
|
|
55606
55847
|
return item !== directory && !current.has(item);
|
|
55607
55848
|
}).forEach((item) => {
|
|
@@ -56435,16 +56676,34 @@ function appIdFromLogPath(path) {
|
|
|
56435
56676
|
const i = parts.lastIndexOf("logs");
|
|
56436
56677
|
return i >= 0 && parts[i + 1] ? parts[i + 1] : null;
|
|
56437
56678
|
}
|
|
56679
|
+
function samePath(a, b) {
|
|
56680
|
+
const ra = (0, import_node_path18.resolve)(a);
|
|
56681
|
+
const rb = (0, import_node_path18.resolve)(b);
|
|
56682
|
+
return process.platform === "win32" ? ra.toLowerCase() === rb.toLowerCase() : ra === rb;
|
|
56683
|
+
}
|
|
56684
|
+
function underDir(path, dir) {
|
|
56685
|
+
const rp = (0, import_node_path18.resolve)(path);
|
|
56686
|
+
const rd = (0, import_node_path18.resolve)(dir);
|
|
56687
|
+
const [p, d] = process.platform === "win32" ? [rp.toLowerCase(), rd.toLowerCase()] : [rp, rd];
|
|
56688
|
+
return p === d || p.startsWith(d + import_node_path18.sep);
|
|
56689
|
+
}
|
|
56438
56690
|
function startWatcher() {
|
|
56439
|
-
const awareDir = process.env.AWARE_HOME ?? (0,
|
|
56440
|
-
const credentialsDir = (0,
|
|
56441
|
-
if (!(0,
|
|
56691
|
+
const awareDir = process.env.AWARE_HOME ?? (0, import_node_path18.join)((0, import_node_os12.homedir)(), ".aware");
|
|
56692
|
+
const credentialsDir = (0, import_node_path18.join)(awareDir, "credentials");
|
|
56693
|
+
if (!(0, import_node_fs19.existsSync)(credentialsDir)) {
|
|
56694
|
+
try {
|
|
56695
|
+
(0, import_node_fs19.mkdirSync)(credentialsDir, { recursive: true });
|
|
56696
|
+
} catch {
|
|
56697
|
+
}
|
|
56698
|
+
}
|
|
56699
|
+
if (!(0, import_node_fs19.existsSync)(uiDir)) {
|
|
56442
56700
|
try {
|
|
56443
|
-
(0,
|
|
56701
|
+
(0, import_node_fs19.mkdirSync)(uiDir, { recursive: true });
|
|
56444
56702
|
} catch {
|
|
56445
56703
|
}
|
|
56446
56704
|
}
|
|
56447
|
-
const targets = ["apps", "logs", "credentials"].map((d) => (0,
|
|
56705
|
+
const targets = ["apps", "logs", "credentials"].map((d) => (0, import_node_path18.join)(awareDir, d)).filter((p) => (0, import_node_fs19.existsSync)(p));
|
|
56706
|
+
if ((0, import_node_fs19.existsSync)(uiDir)) targets.push(uiDir);
|
|
56448
56707
|
if (targets.length === 0) {
|
|
56449
56708
|
return null;
|
|
56450
56709
|
}
|
|
@@ -56452,15 +56711,33 @@ function startWatcher() {
|
|
|
56452
56711
|
ignoreInitial: true,
|
|
56453
56712
|
awaitWriteFinish: { stabilityThreshold: 150, pollInterval: 50 }
|
|
56454
56713
|
});
|
|
56714
|
+
let lastExtContent = readExtensionsText();
|
|
56715
|
+
const handleExtensionsChange = () => {
|
|
56716
|
+
const next = readExtensionsText();
|
|
56717
|
+
if (next === lastExtContent) return;
|
|
56718
|
+
if (lastExtContent !== null) {
|
|
56719
|
+
try {
|
|
56720
|
+
snapshotExtensions(lastExtContent);
|
|
56721
|
+
} catch (err) {
|
|
56722
|
+
console.warn("[floless] failed to snapshot the previous extensions.json before a change (undo for this step is lost):", err);
|
|
56723
|
+
}
|
|
56724
|
+
}
|
|
56725
|
+
lastExtContent = next;
|
|
56726
|
+
broadcast({ type: "extensions-changed" });
|
|
56727
|
+
};
|
|
56455
56728
|
watcher.on("all", (event, path) => {
|
|
56729
|
+
if (underDir(path, uiDir)) {
|
|
56730
|
+
if (samePath(path, extensionsFile)) handleExtensionsChange();
|
|
56731
|
+
return;
|
|
56732
|
+
}
|
|
56456
56733
|
const isCredential = path.split(/[\\/]/).includes("credentials");
|
|
56457
56734
|
const kind = isCredential ? "credential" : path.endsWith(".jsonl") ? "trace" : path.endsWith(".lock") ? "lock" : path.endsWith(".flo") || path.endsWith(".app") ? "source" : "file";
|
|
56458
56735
|
broadcast({ type: "fs-change", kind, event, path });
|
|
56459
|
-
if (kind === "trace" && event !== "unlink" && (0,
|
|
56736
|
+
if (kind === "trace" && event !== "unlink" && (0, import_node_fs19.existsSync)(path)) {
|
|
56460
56737
|
const id = appIdFromLogPath(path);
|
|
56461
56738
|
if (!id) return;
|
|
56462
56739
|
try {
|
|
56463
|
-
broadcast({ type: "trace-file", id, runId: path.split(
|
|
56740
|
+
broadcast({ type: "trace-file", id, runId: path.split(import_node_path18.sep).pop()?.replace(/\.jsonl$/, "") ?? null, events: parseTrace((0, import_node_fs19.readFileSync)(path, "utf8")) });
|
|
56464
56741
|
} catch {
|
|
56465
56742
|
}
|
|
56466
56743
|
}
|
|
@@ -56469,10 +56746,10 @@ function startWatcher() {
|
|
|
56469
56746
|
}
|
|
56470
56747
|
|
|
56471
56748
|
// index.ts
|
|
56472
|
-
var __dirname4 = (0,
|
|
56473
|
-
var WEB_ROOT = [(0,
|
|
56474
|
-
(p) => (0,
|
|
56475
|
-
) ?? (0,
|
|
56749
|
+
var __dirname4 = (0, import_node_path19.dirname)((0, import_node_url3.fileURLToPath)(__import_meta_url));
|
|
56750
|
+
var WEB_ROOT = [(0, import_node_path19.join)(__dirname4, "web"), (0, import_node_path19.join)((0, import_node_path19.dirname)(process.execPath), "web"), (0, import_node_path19.join)(__dirname4, "..", "web")].find(
|
|
56751
|
+
(p) => (0, import_node_fs20.existsSync)(p)
|
|
56752
|
+
) ?? (0, import_node_path19.join)(__dirname4, "..", "web");
|
|
56476
56753
|
var PORT2 = Number(process.env.PORT ?? 4317);
|
|
56477
56754
|
var HOST = "127.0.0.1";
|
|
56478
56755
|
function extractReportHtml(events) {
|
|
@@ -56499,7 +56776,7 @@ function installCrashHandlers() {
|
|
|
56499
56776
|
${stack}
|
|
56500
56777
|
`;
|
|
56501
56778
|
try {
|
|
56502
|
-
(0,
|
|
56779
|
+
(0, import_node_fs20.appendFileSync)(logFilePath(), line);
|
|
56503
56780
|
} catch {
|
|
56504
56781
|
}
|
|
56505
56782
|
if (process.stderr.isTTY) process.stderr.write(line);
|
|
@@ -56542,7 +56819,7 @@ async function startServer() {
|
|
|
56542
56819
|
};
|
|
56543
56820
|
function installAwareGlobal(spec, onLine = () => {
|
|
56544
56821
|
}) {
|
|
56545
|
-
return new Promise((
|
|
56822
|
+
return new Promise((resolve5, reject) => {
|
|
56546
56823
|
const child = (0, import_node_child_process6.spawn)("npm", ["i", "-g", `@aware-aeco/cli@${spec}`], { shell: isWin3, windowsHide: true });
|
|
56547
56824
|
let stderrTail = "";
|
|
56548
56825
|
let combinedTail = "";
|
|
@@ -56559,7 +56836,7 @@ async function startServer() {
|
|
|
56559
56836
|
onLine(s.trimEnd());
|
|
56560
56837
|
});
|
|
56561
56838
|
child.on("error", (e) => reject(e));
|
|
56562
|
-
child.on("close", (code) => code === 0 ?
|
|
56839
|
+
child.on("close", (code) => code === 0 ? resolve5() : reject(new Error(`npm exited ${code}: ${stderrTail || combinedTail}`)));
|
|
56563
56840
|
});
|
|
56564
56841
|
}
|
|
56565
56842
|
const bootstrapDeps = {
|
|
@@ -56844,13 +57121,13 @@ async function startServer() {
|
|
|
56844
57121
|
}
|
|
56845
57122
|
const inputs = appData.inputs.map((i) => ({ name: i.name, type: i.type }));
|
|
56846
57123
|
const baked = bakeFloSource(appData.source.text, inputs);
|
|
56847
|
-
const tmpRoot = (0,
|
|
56848
|
-
const backupDir = (0,
|
|
56849
|
-
const bakeDir = (0,
|
|
56850
|
-
(0,
|
|
56851
|
-
(0,
|
|
57124
|
+
const tmpRoot = (0, import_node_fs20.mkdtempSync)((0, import_node_path19.join)((0, import_node_os13.tmpdir)(), "floless-bake-"));
|
|
57125
|
+
const backupDir = (0, import_node_path19.join)(tmpRoot, `${id}-backup`);
|
|
57126
|
+
const bakeDir = (0, import_node_path19.join)(tmpRoot, id);
|
|
57127
|
+
(0, import_node_fs20.cpSync)(appDir(id), backupDir, { recursive: true });
|
|
57128
|
+
(0, import_node_fs20.cpSync)(appDir(id), bakeDir, { recursive: true });
|
|
56852
57129
|
const floName = appData.source.path.split(/[\\/]/).pop();
|
|
56853
|
-
(0,
|
|
57130
|
+
(0, import_node_fs20.writeFileSync)((0, import_node_path19.join)(bakeDir, floName), baked);
|
|
56854
57131
|
let appInstalled = true;
|
|
56855
57132
|
try {
|
|
56856
57133
|
await aware.uninstall(id);
|
|
@@ -56872,17 +57149,17 @@ async function startServer() {
|
|
|
56872
57149
|
throw installErr;
|
|
56873
57150
|
}
|
|
56874
57151
|
try {
|
|
56875
|
-
await aware.compile((0,
|
|
57152
|
+
await aware.compile((0, import_node_path19.join)(appDir(id), floName));
|
|
56876
57153
|
} catch (compileErr) {
|
|
56877
57154
|
app.log.warn({ id, compileErr: String(compileErr) }, "bake: post-install recompile failed (app baked but may need a manual Compile)");
|
|
56878
57155
|
}
|
|
56879
57156
|
broadcast({ type: "baked", id });
|
|
56880
57157
|
return { ok: true, id, agent: id, inputs };
|
|
56881
57158
|
} finally {
|
|
56882
|
-
if (appInstalled) (0,
|
|
57159
|
+
if (appInstalled) (0, import_node_fs20.rmSync)(tmpRoot, { recursive: true, force: true });
|
|
56883
57160
|
}
|
|
56884
57161
|
});
|
|
56885
|
-
const graftAgentsDir = () => (0,
|
|
57162
|
+
const graftAgentsDir = () => (0, import_node_path19.join)((0, import_node_os13.homedir)(), ".aware", "agents");
|
|
56886
57163
|
app.post("/api/graft/match", async (req, reply) => {
|
|
56887
57164
|
const { glob } = req.body ?? {};
|
|
56888
57165
|
if (!glob) return reply.status(400).send({ ok: false, error: "glob required" });
|
|
@@ -56899,7 +57176,7 @@ async function startServer() {
|
|
|
56899
57176
|
if (!sourceKind || !sourceRef) {
|
|
56900
57177
|
return reply.status(400).send({ ok: false, error: "sourceKind and sourceRef required" });
|
|
56901
57178
|
}
|
|
56902
|
-
const tempHome = (0,
|
|
57179
|
+
const tempHome = (0, import_node_fs20.mkdtempSync)((0, import_node_path19.join)((0, import_node_os13.tmpdir)(), "floless-graft-"));
|
|
56903
57180
|
let result;
|
|
56904
57181
|
try {
|
|
56905
57182
|
result = await aware.build({
|
|
@@ -56912,19 +57189,19 @@ async function startServer() {
|
|
|
56912
57189
|
awareHome: tempHome
|
|
56913
57190
|
});
|
|
56914
57191
|
} catch (err) {
|
|
56915
|
-
(0,
|
|
57192
|
+
(0, import_node_fs20.rmSync)(tempHome, { recursive: true, force: true });
|
|
56916
57193
|
const msg = err instanceof AwareError ? err.message : String(err?.message ?? err);
|
|
56917
57194
|
return reply.status(422).send({ ok: false, error: msg });
|
|
56918
57195
|
}
|
|
56919
57196
|
const manifest = readStagedManifest(result.agentDir);
|
|
56920
57197
|
if (!manifest) {
|
|
56921
|
-
(0,
|
|
57198
|
+
(0, import_node_fs20.rmSync)(tempHome, { recursive: true, force: true });
|
|
56922
57199
|
return reply.status(502).send({ ok: false, error: `build produced output at ${result.agentDir} but no manifest.yaml` });
|
|
56923
57200
|
}
|
|
56924
|
-
const token = (0,
|
|
57201
|
+
const token = (0, import_node_crypto6.randomUUID)();
|
|
56925
57202
|
registerStage(token, tempHome, result.agentId);
|
|
56926
57203
|
const preview = buildPreview(manifest, sourceKind, sourceRef, token);
|
|
56927
|
-
if ((0,
|
|
57204
|
+
if ((0, import_node_fs20.existsSync)((0, import_node_path19.join)(graftAgentsDir(), result.agentId))) {
|
|
56928
57205
|
preview.warnings.unshift(`An agent named "${result.agentId}" is already installed \u2014 creating it will overwrite it.`);
|
|
56929
57206
|
}
|
|
56930
57207
|
return { ok: true, preview };
|
|
@@ -56943,7 +57220,7 @@ async function startServer() {
|
|
|
56943
57220
|
registerStage(stagedRef, stage.tempDir, stage.agentId);
|
|
56944
57221
|
return reply.status(409).send({ ok: false, error: err.message, agentId: stage.agentId, collision: true });
|
|
56945
57222
|
}
|
|
56946
|
-
(0,
|
|
57223
|
+
(0, import_node_fs20.rmSync)(stage.tempDir, { recursive: true, force: true });
|
|
56947
57224
|
throw err;
|
|
56948
57225
|
}
|
|
56949
57226
|
broadcast({ type: "grafted", id: stage.agentId });
|
|
@@ -57117,11 +57394,11 @@ async function startServer() {
|
|
|
57117
57394
|
app.get("/api/requests/:id/snapshot/:n", async (req, reply) => {
|
|
57118
57395
|
const n = Number.parseInt(req.params.n, 10);
|
|
57119
57396
|
const p = Number.isInteger(n) ? snapshotPathFor(req.params.id, n) : null;
|
|
57120
|
-
if (!p || !(0,
|
|
57397
|
+
if (!p || !(0, import_node_fs20.existsSync)(p)) return reply.status(404).send({ ok: false, error: "snapshot not found" });
|
|
57121
57398
|
const ext = p.split(".").pop().toLowerCase();
|
|
57122
57399
|
reply.header("Content-Type", ext === "png" ? "image/png" : ext === "webp" ? "image/webp" : "image/jpeg");
|
|
57123
57400
|
reply.header("Cache-Control", "no-store");
|
|
57124
|
-
return (0,
|
|
57401
|
+
return (0, import_node_fs20.readFileSync)(p);
|
|
57125
57402
|
});
|
|
57126
57403
|
app.post(
|
|
57127
57404
|
"/api/tweak",
|
|
@@ -57161,6 +57438,158 @@ async function startServer() {
|
|
|
57161
57438
|
broadcast({ type: "requests-changed" });
|
|
57162
57439
|
return { ok: true, cleared };
|
|
57163
57440
|
});
|
|
57441
|
+
const EXT_SOURCE_REF = /^[A-Za-z0-9._-]+$/;
|
|
57442
|
+
function pickRows(v) {
|
|
57443
|
+
const isRowArray = (x) => Array.isArray(x) && x.length > 0 && x.every((r) => !!r && typeof r === "object" && !Array.isArray(r));
|
|
57444
|
+
if (isRowArray(v)) return v;
|
|
57445
|
+
if (v && typeof v === "object") {
|
|
57446
|
+
for (const key of ["rows", "items", "data"]) {
|
|
57447
|
+
const inner = v[key];
|
|
57448
|
+
if (isRowArray(inner)) return inner;
|
|
57449
|
+
}
|
|
57450
|
+
}
|
|
57451
|
+
return null;
|
|
57452
|
+
}
|
|
57453
|
+
function extractRunRows(events) {
|
|
57454
|
+
let rows = null;
|
|
57455
|
+
for (const ev of events) {
|
|
57456
|
+
const data = ev.data;
|
|
57457
|
+
if (!data || typeof data !== "object") continue;
|
|
57458
|
+
const found = pickRows(data.result ?? data);
|
|
57459
|
+
if (found) rows = found;
|
|
57460
|
+
}
|
|
57461
|
+
return rows;
|
|
57462
|
+
}
|
|
57463
|
+
const EXT_TRACE_MAX_BYTES = 5 * 1024 * 1024;
|
|
57464
|
+
function resolveExtensionSource(source, warn = () => {
|
|
57465
|
+
}) {
|
|
57466
|
+
const sep3 = source.indexOf(":");
|
|
57467
|
+
if (sep3 <= 0) return void 0;
|
|
57468
|
+
const kind = source.slice(0, sep3);
|
|
57469
|
+
const ref = source.slice(sep3 + 1);
|
|
57470
|
+
if (!EXT_SOURCE_REF.test(ref)) return void 0;
|
|
57471
|
+
if (kind === "last-run-output") {
|
|
57472
|
+
const latest = readLatestTrace(ref, void 0, EXT_TRACE_MAX_BYTES);
|
|
57473
|
+
if (!latest) return void 0;
|
|
57474
|
+
const events = parseTrace(latest.text);
|
|
57475
|
+
if (!latest.truncated && isTraceCorrupt(events)) {
|
|
57476
|
+
warn(`last-run-output:${ref} \u2014 trace exists but couldn't be parsed (corrupt/truncated)`);
|
|
57477
|
+
return { appId: ref, runId: latest.runId, status: "unknown", rows: null, html: null, traceUnreadable: true };
|
|
57478
|
+
}
|
|
57479
|
+
return {
|
|
57480
|
+
appId: ref,
|
|
57481
|
+
runId: latest.runId,
|
|
57482
|
+
status: summarizeRun(events).status,
|
|
57483
|
+
rows: extractRunRows(events),
|
|
57484
|
+
html: withBadge(extractReportHtml(events))?.html ?? null
|
|
57485
|
+
};
|
|
57486
|
+
}
|
|
57487
|
+
if (kind === "last-run-status") {
|
|
57488
|
+
const latest = readLatestTrace(ref, void 0, EXT_TRACE_MAX_BYTES);
|
|
57489
|
+
if (!latest) return { appId: ref, status: "none", finishedAt: null, runId: null };
|
|
57490
|
+
const events = parseTrace(latest.text);
|
|
57491
|
+
if (!latest.truncated && isTraceCorrupt(events)) {
|
|
57492
|
+
warn(`last-run-status:${ref} \u2014 trace exists but couldn't be parsed (corrupt/truncated)`);
|
|
57493
|
+
let finishedAt2 = null;
|
|
57494
|
+
try {
|
|
57495
|
+
finishedAt2 = (0, import_node_fs20.statSync)(latest.path).mtime.toISOString();
|
|
57496
|
+
} catch {
|
|
57497
|
+
finishedAt2 = null;
|
|
57498
|
+
}
|
|
57499
|
+
return { appId: ref, status: "unknown", finishedAt: finishedAt2, runId: latest.runId, traceUnreadable: true };
|
|
57500
|
+
}
|
|
57501
|
+
const runEnd = [...events].reverse().find((e) => e.kind === "run-end");
|
|
57502
|
+
let finishedAt = typeof runEnd?.ts === "string" ? runEnd.ts : null;
|
|
57503
|
+
if (!finishedAt) {
|
|
57504
|
+
try {
|
|
57505
|
+
finishedAt = (0, import_node_fs20.statSync)(latest.path).mtime.toISOString();
|
|
57506
|
+
} catch {
|
|
57507
|
+
finishedAt = null;
|
|
57508
|
+
}
|
|
57509
|
+
}
|
|
57510
|
+
return { appId: ref, status: summarizeRun(events).status, finishedAt, runId: latest.runId };
|
|
57511
|
+
}
|
|
57512
|
+
if (kind === "routine-status") {
|
|
57513
|
+
const routines2 = listRoutines();
|
|
57514
|
+
const r = routines2.find((x) => x.id === ref) ?? routines2.find((x) => x.workflow === ref);
|
|
57515
|
+
if (!r) return void 0;
|
|
57516
|
+
return {
|
|
57517
|
+
id: r.id,
|
|
57518
|
+
name: r.name,
|
|
57519
|
+
workflow: r.workflow,
|
|
57520
|
+
kind: r.kind,
|
|
57521
|
+
enabled: r.enabled,
|
|
57522
|
+
nextFireAt: r.nextFireAt,
|
|
57523
|
+
lastRun: r.lastRun,
|
|
57524
|
+
broken: r.broken ?? null
|
|
57525
|
+
};
|
|
57526
|
+
}
|
|
57527
|
+
return void 0;
|
|
57528
|
+
}
|
|
57529
|
+
let uiAgentInstallKicked = false;
|
|
57530
|
+
let validationCache = null;
|
|
57531
|
+
app.get("/api/extensions", async () => {
|
|
57532
|
+
const descriptor = readExtensions();
|
|
57533
|
+
let validation = null;
|
|
57534
|
+
if (descriptor !== null) {
|
|
57535
|
+
const cacheKey = JSON.stringify(descriptor);
|
|
57536
|
+
if (validationCache && validationCache.key === cacheKey) {
|
|
57537
|
+
return finishExtensions(descriptor, validationCache.result);
|
|
57538
|
+
}
|
|
57539
|
+
try {
|
|
57540
|
+
validation = await aware.agentInvoke("ui", "validate", { descriptor }) ?? null;
|
|
57541
|
+
if (validation) validationCache = { key: cacheKey, result: validation };
|
|
57542
|
+
} catch (err) {
|
|
57543
|
+
const mapped = classifyValidateError(err);
|
|
57544
|
+
if (mapped.installing && !uiAgentInstallKicked) {
|
|
57545
|
+
uiAgentInstallKicked = true;
|
|
57546
|
+
aware.ensureAgentInstalled("ui").then(() => broadcast({ type: "extensions-changed" })).catch((e) => app.log.warn({ err: String(e) }, "ui agent auto-install failed"));
|
|
57547
|
+
}
|
|
57548
|
+
if (mapped.unexpected) app.log.warn({ err: String(err) }, "ui validate failed unexpectedly");
|
|
57549
|
+
validation = mapped;
|
|
57550
|
+
if (!mapped.installing && !mapped.unexpected) validationCache = { key: cacheKey, result: validation };
|
|
57551
|
+
}
|
|
57552
|
+
}
|
|
57553
|
+
return finishExtensions(descriptor, validation);
|
|
57554
|
+
});
|
|
57555
|
+
function finishExtensions(descriptor, validation) {
|
|
57556
|
+
const data = {};
|
|
57557
|
+
for (const panel of descriptorPanels(descriptor)) {
|
|
57558
|
+
const blocks = Array.isArray(panel.blocks) ? panel.blocks : [];
|
|
57559
|
+
for (const block of blocks) {
|
|
57560
|
+
if (!block || typeof block !== "object") continue;
|
|
57561
|
+
const b = block;
|
|
57562
|
+
if (b.type !== "table" && b.type !== "report") continue;
|
|
57563
|
+
const src = b.source;
|
|
57564
|
+
if (typeof src !== "string" || src in data) continue;
|
|
57565
|
+
try {
|
|
57566
|
+
const payload = resolveExtensionSource(src, (msg) => app.log.warn(msg));
|
|
57567
|
+
if (payload !== void 0) data[src] = payload;
|
|
57568
|
+
} catch {
|
|
57569
|
+
}
|
|
57570
|
+
}
|
|
57571
|
+
}
|
|
57572
|
+
return { ok: true, descriptor, validation, data };
|
|
57573
|
+
}
|
|
57574
|
+
app.post("/api/extensions/customize", async (req, reply) => {
|
|
57575
|
+
const instruction = typeof req.body?.instruction === "string" ? req.body.instruction.trim() : "";
|
|
57576
|
+
if (!instruction) return reply.status(400).send({ ok: false, error: "instruction required" });
|
|
57577
|
+
const panelId = typeof req.body?.panelId === "string" && req.body.panelId.trim() ? req.body.panelId.trim() : void 0;
|
|
57578
|
+
const request = addRequest({ type: "ui-customize", instruction, ...panelId ? { panelId } : {} });
|
|
57579
|
+
broadcast({ type: "request-added", request });
|
|
57580
|
+
return { ok: true, request };
|
|
57581
|
+
});
|
|
57582
|
+
app.post("/api/extensions/undo", async (_req, reply) => {
|
|
57583
|
+
const result = undoExtensions();
|
|
57584
|
+
if (!result.restored) return reply.send({ ok: false, error: "nothing to undo" });
|
|
57585
|
+
return { ok: true, descriptor: result.descriptor };
|
|
57586
|
+
});
|
|
57587
|
+
app.post("/api/extensions/reset", async (_req, reply) => {
|
|
57588
|
+
const result = resetExtensions();
|
|
57589
|
+
if (!result.reset) return reply.send({ ok: false, error: "nothing to reset \u2014 the dashboard is already the default" });
|
|
57590
|
+
return { ok: true, descriptor: null };
|
|
57591
|
+
});
|
|
57592
|
+
app.get("/api/extensions/history", async () => ({ ok: true, history: listHistory() }));
|
|
57164
57593
|
app.get("/api/events", async (_req, reply) => {
|
|
57165
57594
|
reply.hijack();
|
|
57166
57595
|
reply.raw.writeHead(200, {
|
|
@@ -57226,11 +57655,11 @@ function unregisterProtocol() {
|
|
|
57226
57655
|
|
|
57227
57656
|
// main.ts
|
|
57228
57657
|
function promptYesNo2(question) {
|
|
57229
|
-
return new Promise((
|
|
57658
|
+
return new Promise((resolve5) => {
|
|
57230
57659
|
const rl = (0, import_node_readline2.createInterface)({ input: process.stdin, output: process.stdout });
|
|
57231
57660
|
rl.question(`${question} `, (answer) => {
|
|
57232
57661
|
rl.close();
|
|
57233
|
-
|
|
57662
|
+
resolve5(/^y(es)?$/i.test((answer ?? "").trim()));
|
|
57234
57663
|
});
|
|
57235
57664
|
});
|
|
57236
57665
|
}
|