@floless/app 0.16.2 → 0.18.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.
@@ -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(resolve5, reject) {
297
+ var p = new Promise(function(resolve6, reject) {
298
298
  pushCb(value, function(err, result) {
299
299
  if (err) {
300
300
  reject(err);
301
301
  return;
302
302
  }
303
- resolve5(result);
303
+ resolve6(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(resolve5, reject) {
310
+ var p = new Promise(function(resolve6, reject) {
311
311
  unshiftCb(value, function(err, result) {
312
312
  if (err) {
313
313
  reject(err);
314
314
  return;
315
315
  }
316
- resolve5(result);
316
+ resolve6(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(resolve5) {
323
+ var p = new Promise(function(resolve6) {
324
324
  process.nextTick(function() {
325
325
  if (queue2.idle()) {
326
- resolve5();
326
+ resolve6();
327
327
  } else {
328
328
  var previousDrain = queue2.drain;
329
329
  queue2.drain = function() {
330
330
  if (typeof previousDrain === "function") previousDrain();
331
- resolve5();
331
+ resolve6();
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((resolve5, reject) => {
675
- obj.resolve = resolve5;
674
+ obj.promise = new Promise((resolve6, reject) => {
675
+ obj.resolve = resolve6;
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 (resolve5, reject) => {
944
+ return (resolve6, reject) => {
945
945
  const p = this._loadRegistered();
946
946
  return p.then(() => {
947
947
  this[kThenifyDoNotWrap] = true;
948
- return resolve5(this._server);
948
+ return resolve6(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((resolve5, reject) => {
1085
+ return new Promise((resolve6, reject) => {
1086
1086
  this.close((err) => {
1087
1087
  if (err) {
1088
1088
  return reject(err);
1089
1089
  }
1090
- resolve5();
1090
+ resolve6();
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(resolve5, reject) {
1237
+ promise = new Promise(function(resolve6, reject) {
1238
1238
  func = function(err) {
1239
1239
  if (err) {
1240
1240
  return reject(err);
1241
1241
  }
1242
- resolve5();
1242
+ resolve6();
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((resolve5, reject) => {
1262
+ return new Promise((resolve6, 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
- resolve5(relativeContext);
1270
+ resolve6(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((resolve5, reject) => {
2546
- res = resolve5;
2545
+ const promise = new Promise((resolve6, reject) => {
2546
+ res = resolve6;
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: resolve5 } = PonyPromise.withResolvers();
2645
+ const { promise, resolve: resolve6 } = PonyPromise.withResolvers();
2646
2646
  if (host === "localhost") {
2647
2647
  multipleBindings.call(this, server, httpHandler, options, listenOptions, () => {
2648
2648
  this[kState].listening = true;
2649
- resolve5(address);
2649
+ resolve6(address);
2650
2650
  onListenHookRunner(this);
2651
2651
  });
2652
2652
  } else {
2653
- resolve5(address);
2653
+ resolve6(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: resolve5, reject } = PonyPromise.withResolvers();
2780
+ const { promise, resolve: resolve6, 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
- resolve5(logServerAddress.call(
2789
+ resolve6(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: join22 } = require("path");
5492
+ var { join: join23 } = 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"] || join22(__dirname, "lib", "worker.js");
5543
+ const toExecute = bundlerOverrides["thread-stream-worker"] || join23(__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: existsSync20 } = require("node:fs");
6009
+ var { existsSync: existsSync21 } = require("node:fs");
6010
6010
  var getCallers = require_caller();
6011
- var { join: join22, isAbsolute: isAbsolute2, sep: sep3 } = require("node:path");
6011
+ var { join: join23, isAbsolute: isAbsolute2, sep: sep4 } = require("node:path");
6012
6012
  var { fileURLToPath: fileURLToPath4 } = require("node:url");
6013
6013
  var sleep = require_atomic_sleep();
6014
6014
  var onExit = require_on_exit_leak_free();
@@ -6080,7 +6080,7 @@ var require_transport = __commonJS({
6080
6080
  return false;
6081
6081
  }
6082
6082
  }
6083
- return isAbsolute2(path) && !existsSync20(path);
6083
+ return isAbsolute2(path) && !existsSync21(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"] || join22(__dirname, "worker.js");
6164
+ target = bundlerOverrides["pino-worker"] || join23(__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"] || join22(__dirname, "worker.js");
6182
+ target = bundlerOverrides["pino-worker"] || join23(__dirname, "worker.js");
6183
6183
  options.pipelines = [pipeline2.map((dest) => {
6184
6184
  return {
6185
6185
  ...dest,
@@ -6202,12 +6202,12 @@ var require_transport = __commonJS({
6202
6202
  return origin;
6203
6203
  }
6204
6204
  if (origin === "pino/file") {
6205
- return join22(__dirname, "..", "file.js");
6205
+ return join23(__dirname, "..", "file.js");
6206
6206
  }
6207
6207
  let fixTarget2;
6208
6208
  for (const filePath of callers) {
6209
6209
  try {
6210
- const context = filePath === "node:repl" ? process.cwd() + sep3 : filePath;
6210
+ const context = filePath === "node:repl" ? process.cwd() + sep4 : filePath;
6211
6211
  fixTarget2 = createRequire4(context).resolve(origin);
6212
6212
  break;
6213
6213
  } catch (err) {
@@ -7182,7 +7182,7 @@ var require_safe_stable_stringify = __commonJS({
7182
7182
  return circularValue;
7183
7183
  }
7184
7184
  let res = "";
7185
- let join22 = ",";
7185
+ let join23 = ",";
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
- join22 = `,
7199
+ join23 = `,
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 += join22;
7207
+ res += join23;
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 += `${join22}"... ${getItemCount(removedKeys)} not stringified"`;
7213
+ res += `${join23}"... ${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
- join22 = `,
7234
+ join23 = `,
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 = join22;
7248
+ separator = join23;
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 = join22;
7254
+ separator = join23;
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 join22 = ",";
7295
+ let join23 = ",";
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
- join22 = `,
7308
+ join23 = `,
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 += join22;
7316
+ res += join23;
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 += `${join22}"... ${getItemCount(removedKeys)} not stringified"`;
7322
+ res += `${join23}"... ${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
- join22 = `,
7335
+ join23 = `,
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 = join22;
7344
+ separator = join23;
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 join23 = `,
7402
+ const join24 = `,
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 += join23;
7409
+ res2 += join24;
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 += `${join23}"... ${getItemCount(removedKeys)} not stringified"`;
7415
+ res2 += `${join24}"... ${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 join22 = `,
7431
+ const join23 = `,
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, join22, maximumBreadth);
7437
+ res += stringifyTypedArray(value, join23, maximumBreadth);
7438
7438
  keys = keys.slice(value.length);
7439
7439
  maximumPropertiesToStringify -= value.length;
7440
- separator = join22;
7440
+ separator = join23;
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 = join22;
7451
+ separator = join23;
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 = join22;
7457
+ separator = join23;
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 = resolve5.call(this, root, ref);
15312
+ let _sch = resolve6.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 resolve5(root, ref) {
15339
+ function resolve6(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 resolve5(baseURI, relativeURI, options) {
15970
+ function resolve6(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: resolve5,
16228
+ resolve: resolve6,
16229
16229
  resolveComponent,
16230
16230
  equal,
16231
16231
  serialize,
@@ -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((resolve5, reject) => {
33575
+ return new Promise((resolve6, reject) => {
33576
33576
  const req = new RequestConstructor(options);
33577
- const res = new Response(req, resolve5, reject);
33577
+ const res = new Response(req, resolve6, 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((resolve5, reject) => {
37709
+ return new Promise((resolve6, reject) => {
37710
37710
  this.on(DESTROYED, () => reject(new Error("stream destroyed")));
37711
37711
  this.on("error", (er) => reject(er));
37712
- this.on("end", () => resolve5());
37712
+ this.on("end", () => resolve6());
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 resolve5;
37736
+ let resolve6;
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
- resolve5({ value, done: !!this[EOF] });
37750
+ resolve6({ 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
- resolve5({ done: true, value: void 0 });
37757
+ resolve6({ 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
- resolve5 = res2;
37762
+ resolve6 = 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 resolve5 = () => {
38782
+ let resolve6 = () => {
38783
38783
  };
38784
- this.#asyncReaddirInFlight = new Promise((res) => resolve5 = res);
38784
+ this.#asyncReaddirInFlight = new Promise((res) => resolve6 = 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
- resolve5();
38797
+ resolve6();
38798
38798
  }
38799
38799
  return children.slice(0, children.provisional);
38800
38800
  }
@@ -39027,7 +39027,7 @@ var require_commonjs5 = __commonJS({
39027
39027
  *
39028
39028
  * @internal
39029
39029
  */
39030
- constructor(cwd = process.cwd(), pathImpl, sep3, { nocase, childrenCacheSize = 16 * 1024, fs = defaultFS } = {}) {
39030
+ constructor(cwd = process.cwd(), pathImpl, sep4, { nocase, childrenCacheSize = 16 * 1024, fs = defaultFS } = {}) {
39031
39031
  this.#fs = fsFromOption(fs);
39032
39032
  if (cwd instanceof URL || cwd.startsWith("file://")) {
39033
39033
  cwd = (0, node_url_1.fileURLToPath)(cwd);
@@ -39038,7 +39038,7 @@ var require_commonjs5 = __commonJS({
39038
39038
  this.#resolveCache = new ResolveCache();
39039
39039
  this.#resolvePosixCache = new ResolveCache();
39040
39040
  this.#children = new ChildrenCache(childrenCacheSize);
39041
- const split = cwdPath.substring(this.rootPath.length).split(sep3);
39041
+ const split = cwdPath.substring(this.rootPath.length).split(sep4);
39042
39042
  if (split.length === 1 && !split[0]) {
39043
39043
  split.pop();
39044
39044
  }
@@ -41991,10 +41991,10 @@ var require_send = __commonJS({
41991
41991
  var { parseTokenList } = require_parseTokenList();
41992
41992
  var { createHttpError } = require_createHttpError();
41993
41993
  var extname2 = path.extname;
41994
- var join22 = path.join;
41994
+ var join23 = path.join;
41995
41995
  var normalize2 = path.normalize;
41996
- var resolve5 = path.resolve;
41997
- var sep3 = path.sep;
41996
+ var resolve6 = path.resolve;
41997
+ var sep4 = path.sep;
41998
41998
  var Readable3 = stream.Readable;
41999
41999
  var BYTES_RANGE_REGEXP = /^ *bytes=/;
42000
42000
  var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
@@ -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 ? resolve5(options.root) : null;
42043
+ const root = options.root ? resolve6(options.root) : null;
42044
42044
  const highWaterMark = Number.isSafeInteger(options.highWaterMark) && options.highWaterMark > 0 ? options.highWaterMark : null;
42045
42045
  return {
42046
42046
  acceptRanges,
@@ -42071,21 +42071,21 @@ var require_send = __commonJS({
42071
42071
  let parts;
42072
42072
  if (root !== null) {
42073
42073
  if (path2) {
42074
- path2 = normalize2("." + sep3 + path2);
42074
+ path2 = normalize2("." + sep4 + path2);
42075
42075
  }
42076
42076
  if (UP_PATH_REGEXP.test(path2)) {
42077
42077
  debug('malicious path "%s"', path2);
42078
42078
  return { statusCode: 403 };
42079
42079
  }
42080
- parts = path2.split(sep3);
42081
- path2 = normalize2(join22(root, path2));
42080
+ parts = path2.split(sep4);
42081
+ path2 = normalize2(join23(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
- parts = normalize2(path2).split(sep3);
42088
- path2 = resolve5(path2);
42087
+ parts = normalize2(path2).split(sep4);
42088
+ path2 = resolve6(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((resolve6) => {
42184
+ return new Promise((resolve7) => {
42185
42185
  fs.stat(path2, function onstat(error, stat4) {
42186
- resolve6({ error, stat: stat4 });
42186
+ resolve7({ 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 = join22(path2, index);
42364
+ const p = join23(path2, index);
42365
42365
  const { error, stat: stat4 } = await tryStat(p);
42366
42366
  if (error) {
42367
42367
  err = error;
@@ -42377,7 +42377,7 @@ var require_send = __commonJS({
42377
42377
  }
42378
42378
  async function sendFile(request, path2, options) {
42379
42379
  const { error, stat: stat4 } = await tryStat(path2);
42380
- if (error && error.code === "ENOENT" && !extname2(path2) && path2[path2.length - 1] !== sep3) {
42380
+ if (error && error.code === "ENOENT" && !extname2(path2) && path2[path2.length - 1] !== sep4) {
42381
42381
  let err = error;
42382
42382
  for (let i = 0; i < options.extensions.length; i++) {
42383
42383
  const extension = options.extensions[i];
@@ -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: statSync8 } = require("node:fs");
43015
+ var { statSync: statSync9 } = 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 = statSync8(rootPath);
43378
+ pathStat = statSync9(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 = statSync8(p);
43402
+ const stats = statSync9(p);
43403
43403
  return !stats.isDirectory();
43404
43404
  } catch {
43405
43405
  return false;
@@ -47402,10 +47402,10 @@ var require_resolve_block_map = __commonJS({
47402
47402
  let offset = bm.offset;
47403
47403
  let commentEnd = null;
47404
47404
  for (const collItem of bm.items) {
47405
- const { start, key, sep: sep3, value } = collItem;
47405
+ const { start, key, sep: sep4, value } = collItem;
47406
47406
  const keyProps = resolveProps.resolveProps(start, {
47407
47407
  indicator: "explicit-key-ind",
47408
- next: key ?? sep3?.[0],
47408
+ next: key ?? sep4?.[0],
47409
47409
  offset,
47410
47410
  onError,
47411
47411
  parentIndent: bm.indent,
@@ -47419,7 +47419,7 @@ var require_resolve_block_map = __commonJS({
47419
47419
  else if ("indent" in key && key.indent !== bm.indent)
47420
47420
  onError(offset, "BAD_INDENT", startColMsg);
47421
47421
  }
47422
- if (!keyProps.anchor && !keyProps.tag && !sep3) {
47422
+ if (!keyProps.anchor && !keyProps.tag && !sep4) {
47423
47423
  commentEnd = keyProps.end;
47424
47424
  if (keyProps.comment) {
47425
47425
  if (map.comment)
@@ -47443,7 +47443,7 @@ var require_resolve_block_map = __commonJS({
47443
47443
  ctx.atKey = false;
47444
47444
  if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
47445
47445
  onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
47446
- const valueProps = resolveProps.resolveProps(sep3 ?? [], {
47446
+ const valueProps = resolveProps.resolveProps(sep4 ?? [], {
47447
47447
  indicator: "map-value-ind",
47448
47448
  next: value,
47449
47449
  offset: keyNode.range[2],
@@ -47459,7 +47459,7 @@ var require_resolve_block_map = __commonJS({
47459
47459
  if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
47460
47460
  onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
47461
47461
  }
47462
- const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep3, null, valueProps, onError);
47462
+ const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep4, null, valueProps, onError);
47463
47463
  if (ctx.schema.compat)
47464
47464
  utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
47465
47465
  offset = valueNode.range[2];
@@ -47550,7 +47550,7 @@ var require_resolve_end = __commonJS({
47550
47550
  let comment = "";
47551
47551
  if (end) {
47552
47552
  let hasSpace = false;
47553
- let sep3 = "";
47553
+ let sep4 = "";
47554
47554
  for (const token of end) {
47555
47555
  const { source, type } = token;
47556
47556
  switch (type) {
@@ -47564,13 +47564,13 @@ var require_resolve_end = __commonJS({
47564
47564
  if (!comment)
47565
47565
  comment = cb;
47566
47566
  else
47567
- comment += sep3 + cb;
47568
- sep3 = "";
47567
+ comment += sep4 + cb;
47568
+ sep4 = "";
47569
47569
  break;
47570
47570
  }
47571
47571
  case "newline":
47572
47572
  if (comment)
47573
- sep3 += source;
47573
+ sep4 += source;
47574
47574
  hasSpace = true;
47575
47575
  break;
47576
47576
  default:
@@ -47613,18 +47613,18 @@ var require_resolve_flow_collection = __commonJS({
47613
47613
  let offset = fc.offset + fc.start.source.length;
47614
47614
  for (let i = 0; i < fc.items.length; ++i) {
47615
47615
  const collItem = fc.items[i];
47616
- const { start, key, sep: sep3, value } = collItem;
47616
+ const { start, key, sep: sep4, value } = collItem;
47617
47617
  const props = resolveProps.resolveProps(start, {
47618
47618
  flow: fcName,
47619
47619
  indicator: "explicit-key-ind",
47620
- next: key ?? sep3?.[0],
47620
+ next: key ?? sep4?.[0],
47621
47621
  offset,
47622
47622
  onError,
47623
47623
  parentIndent: fc.indent,
47624
47624
  startOnNewline: false
47625
47625
  });
47626
47626
  if (!props.found) {
47627
- if (!props.anchor && !props.tag && !sep3 && !value) {
47627
+ if (!props.anchor && !props.tag && !sep4 && !value) {
47628
47628
  if (i === 0 && props.comma)
47629
47629
  onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
47630
47630
  else if (i < fc.items.length - 1)
@@ -47678,8 +47678,8 @@ var require_resolve_flow_collection = __commonJS({
47678
47678
  }
47679
47679
  }
47680
47680
  }
47681
- if (!isMap && !sep3 && !props.found) {
47682
- const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep3, null, props, onError);
47681
+ if (!isMap && !sep4 && !props.found) {
47682
+ const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep4, null, props, onError);
47683
47683
  coll.items.push(valueNode);
47684
47684
  offset = valueNode.range[2];
47685
47685
  if (isBlock(value))
@@ -47691,7 +47691,7 @@ var require_resolve_flow_collection = __commonJS({
47691
47691
  if (isBlock(key))
47692
47692
  onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
47693
47693
  ctx.atKey = false;
47694
- const valueProps = resolveProps.resolveProps(sep3 ?? [], {
47694
+ const valueProps = resolveProps.resolveProps(sep4 ?? [], {
47695
47695
  flow: fcName,
47696
47696
  indicator: "map-value-ind",
47697
47697
  next: value,
@@ -47702,8 +47702,8 @@ var require_resolve_flow_collection = __commonJS({
47702
47702
  });
47703
47703
  if (valueProps.found) {
47704
47704
  if (!isMap && !props.found && ctx.options.strict) {
47705
- if (sep3)
47706
- for (const st of sep3) {
47705
+ if (sep4)
47706
+ for (const st of sep4) {
47707
47707
  if (st === valueProps.found)
47708
47708
  break;
47709
47709
  if (st.type === "newline") {
@@ -47720,7 +47720,7 @@ var require_resolve_flow_collection = __commonJS({
47720
47720
  else
47721
47721
  onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
47722
47722
  }
47723
- const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep3, null, valueProps, onError) : null;
47723
+ const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep4, null, valueProps, onError) : null;
47724
47724
  if (valueNode) {
47725
47725
  if (isBlock(value))
47726
47726
  onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
@@ -47900,7 +47900,7 @@ var require_resolve_block_scalar = __commonJS({
47900
47900
  chompStart = i + 1;
47901
47901
  }
47902
47902
  let value = "";
47903
- let sep3 = "";
47903
+ let sep4 = "";
47904
47904
  let prevMoreIndented = false;
47905
47905
  for (let i = 0; i < contentStart; ++i)
47906
47906
  value += lines[i][0].slice(trimIndent) + "\n";
@@ -47917,24 +47917,24 @@ var require_resolve_block_scalar = __commonJS({
47917
47917
  indent = "";
47918
47918
  }
47919
47919
  if (type === Scalar.Scalar.BLOCK_LITERAL) {
47920
- value += sep3 + indent.slice(trimIndent) + content;
47921
- sep3 = "\n";
47920
+ value += sep4 + indent.slice(trimIndent) + content;
47921
+ sep4 = "\n";
47922
47922
  } else if (indent.length > trimIndent || content[0] === " ") {
47923
- if (sep3 === " ")
47924
- sep3 = "\n";
47925
- else if (!prevMoreIndented && sep3 === "\n")
47926
- sep3 = "\n\n";
47927
- value += sep3 + indent.slice(trimIndent) + content;
47928
- sep3 = "\n";
47923
+ if (sep4 === " ")
47924
+ sep4 = "\n";
47925
+ else if (!prevMoreIndented && sep4 === "\n")
47926
+ sep4 = "\n\n";
47927
+ value += sep4 + indent.slice(trimIndent) + content;
47928
+ sep4 = "\n";
47929
47929
  prevMoreIndented = true;
47930
47930
  } else if (content === "") {
47931
- if (sep3 === "\n")
47931
+ if (sep4 === "\n")
47932
47932
  value += "\n";
47933
47933
  else
47934
- sep3 = "\n";
47934
+ sep4 = "\n";
47935
47935
  } else {
47936
- value += sep3 + content;
47937
- sep3 = " ";
47936
+ value += sep4 + content;
47937
+ sep4 = " ";
47938
47938
  prevMoreIndented = false;
47939
47939
  }
47940
47940
  }
@@ -48116,25 +48116,25 @@ var require_resolve_flow_scalar = __commonJS({
48116
48116
  if (!match)
48117
48117
  return source;
48118
48118
  let res = match[1];
48119
- let sep3 = " ";
48119
+ let sep4 = " ";
48120
48120
  let pos = first.lastIndex;
48121
48121
  line.lastIndex = pos;
48122
48122
  while (match = line.exec(source)) {
48123
48123
  if (match[1] === "") {
48124
- if (sep3 === "\n")
48125
- res += sep3;
48124
+ if (sep4 === "\n")
48125
+ res += sep4;
48126
48126
  else
48127
- sep3 = "\n";
48127
+ sep4 = "\n";
48128
48128
  } else {
48129
- res += sep3 + match[1];
48130
- sep3 = " ";
48129
+ res += sep4 + match[1];
48130
+ sep4 = " ";
48131
48131
  }
48132
48132
  pos = line.lastIndex;
48133
48133
  }
48134
48134
  const last = /[ \t]*(.*)/sy;
48135
48135
  last.lastIndex = pos;
48136
48136
  match = last.exec(source);
48137
- return res + sep3 + (match?.[1] ?? "");
48137
+ return res + sep4 + (match?.[1] ?? "");
48138
48138
  }
48139
48139
  function doubleQuotedValue(source, onError) {
48140
48140
  let res = "";
@@ -48944,14 +48944,14 @@ var require_cst_stringify = __commonJS({
48944
48944
  }
48945
48945
  }
48946
48946
  }
48947
- function stringifyItem({ start, key, sep: sep3, value }) {
48947
+ function stringifyItem({ start, key, sep: sep4, value }) {
48948
48948
  let res = "";
48949
48949
  for (const st of start)
48950
48950
  res += st.source;
48951
48951
  if (key)
48952
48952
  res += stringifyToken(key);
48953
- if (sep3)
48954
- for (const st of sep3)
48953
+ if (sep4)
48954
+ for (const st of sep4)
48955
48955
  res += st.source;
48956
48956
  if (value)
48957
48957
  res += stringifyToken(value);
@@ -50118,18 +50118,18 @@ var require_parser = __commonJS({
50118
50118
  if (this.type === "map-value-ind") {
50119
50119
  const prev = getPrevProps(this.peek(2));
50120
50120
  const start = getFirstKeyStartProps(prev);
50121
- let sep3;
50121
+ let sep4;
50122
50122
  if (scalar.end) {
50123
- sep3 = scalar.end;
50124
- sep3.push(this.sourceToken);
50123
+ sep4 = scalar.end;
50124
+ sep4.push(this.sourceToken);
50125
50125
  delete scalar.end;
50126
50126
  } else
50127
- sep3 = [this.sourceToken];
50127
+ sep4 = [this.sourceToken];
50128
50128
  const map = {
50129
50129
  type: "block-map",
50130
50130
  offset: scalar.offset,
50131
50131
  indent: scalar.indent,
50132
- items: [{ start, key: scalar, sep: sep3 }]
50132
+ items: [{ start, key: scalar, sep: sep4 }]
50133
50133
  };
50134
50134
  this.onKeyLine = true;
50135
50135
  this.stack[this.stack.length - 1] = map;
@@ -50282,15 +50282,15 @@ var require_parser = __commonJS({
50282
50282
  } else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
50283
50283
  const start2 = getFirstKeyStartProps(it.start);
50284
50284
  const key = it.key;
50285
- const sep3 = it.sep;
50286
- sep3.push(this.sourceToken);
50285
+ const sep4 = it.sep;
50286
+ sep4.push(this.sourceToken);
50287
50287
  delete it.key;
50288
50288
  delete it.sep;
50289
50289
  this.stack.push({
50290
50290
  type: "block-map",
50291
50291
  offset: this.offset,
50292
50292
  indent: this.indent,
50293
- items: [{ start: start2, key, sep: sep3 }]
50293
+ items: [{ start: start2, key, sep: sep4 }]
50294
50294
  });
50295
50295
  } else if (start.length > 0) {
50296
50296
  it.sep = it.sep.concat(start, this.sourceToken);
@@ -50484,13 +50484,13 @@ var require_parser = __commonJS({
50484
50484
  const prev = getPrevProps(parent);
50485
50485
  const start = getFirstKeyStartProps(prev);
50486
50486
  fixFlowSeqItems(fc);
50487
- const sep3 = fc.end.splice(1, fc.end.length);
50488
- sep3.push(this.sourceToken);
50487
+ const sep4 = fc.end.splice(1, fc.end.length);
50488
+ sep4.push(this.sourceToken);
50489
50489
  const map = {
50490
50490
  type: "block-map",
50491
50491
  offset: fc.offset,
50492
50492
  indent: fc.indent,
50493
- items: [{ start, key: fc, sep: sep3 }]
50493
+ items: [{ start, key: fc, sep: sep4 }]
50494
50494
  };
50495
50495
  this.onKeyLine = true;
50496
50496
  this.stack[this.stack.length - 1] = map;
@@ -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 import_node_path20 = require("node:path");
50831
- var import_node_os14 = require("node:os");
50832
- var import_node_fs21 = require("node:fs");
50830
+ var import_node_path21 = require("node:path");
50831
+ var import_node_os15 = require("node:os");
50832
+ var import_node_fs22 = require("node:fs");
50833
50833
  var import_node_child_process6 = require("node:child_process");
50834
50834
 
50835
50835
  // log.mjs
@@ -50899,6 +50899,13 @@ function normalizeNote(n) {
50899
50899
  const kind = /defaulting to write-mode|not installed/i.test(text) ? "warn" : "info";
50900
50900
  return { kind, text };
50901
50901
  }
50902
+ function isVisualInput(i) {
50903
+ return i.widget === "file" || i.type === "image" || i.type === "file";
50904
+ }
50905
+ function findRebakeInput(inputs) {
50906
+ const hit = inputs.find((i) => isVisualInput(i) && i.readStrategy === "bake");
50907
+ return hit ? hit.name : null;
50908
+ }
50902
50909
  var AppNotFoundError = class extends Error {
50903
50910
  constructor(id) {
50904
50911
  super(`app not found: ${id}`);
@@ -50913,6 +50920,10 @@ function appDir(id) {
50913
50920
  if (!(0, import_node_fs3.existsSync)(dir)) throw new AppNotFoundError(id);
50914
50921
  return dir;
50915
50922
  }
50923
+ function appExists(id) {
50924
+ if (id.includes("/") || id.includes("\\") || id.includes("..")) return false;
50925
+ return (0, import_node_fs3.existsSync)((0, import_node_path2.join)(APPS_DIR, id));
50926
+ }
50916
50927
  function firstWithExt(dir, ext) {
50917
50928
  const hit = (0, import_node_fs3.readdirSync)(dir).find((f) => f.toLowerCase().endsWith(ext));
50918
50929
  return hit ? (0, import_node_path2.join)(dir, hit) : null;
@@ -50989,6 +51000,7 @@ function readApp(id) {
50989
51000
  command,
50990
51001
  kind: locked && typeof locked.kind === "string" ? locked.kind : "agent",
50991
51002
  mode: lockMode === "write" || lockMode === "read" ? lockMode : "unknown",
51003
+ runtimeModel: !!locked && locked["runtime-model"] === true,
50992
51004
  inputs: asRecord(locked?.inputs),
50993
51005
  config: asRecord(n.config),
50994
51006
  notes: notes2,
@@ -51011,11 +51023,15 @@ function readApp(id) {
51011
51023
  const inputsDecl = asRecord(src.inputs);
51012
51024
  const inputs = Object.entries(inputsDecl).map(([name, spec]) => {
51013
51025
  const s = asRecord(spec);
51026
+ const rs = typeof s["read-strategy"] === "string" ? s["read-strategy"] : null;
51014
51027
  return {
51015
51028
  name,
51016
51029
  type: typeof s.type === "string" ? s.type : "string",
51017
51030
  default: "default" in s ? s.default : null,
51018
- description: typeof s.description === "string" ? s.description : ""
51031
+ description: typeof s.description === "string" ? s.description : "",
51032
+ widget: typeof s.widget === "string" ? s.widget : null,
51033
+ accept: Array.isArray(s.accept) ? s.accept.map(String) : [],
51034
+ readStrategy: rs === "parse" || rs === "bake" || rs === "rebake" || rs === "vision" ? rs : null
51019
51035
  };
51020
51036
  });
51021
51037
  const notes = nodes.flatMap((n) => n.notes.map((nt) => ({ nodeId: n.id, kind: nt.kind, text: nt.text })));
@@ -51037,7 +51053,8 @@ function readApp(id) {
51037
51053
  runState,
51038
51054
  runnable: runState === "ready",
51039
51055
  triggerSource: detectTriggerSource(nodes, connections, readCommandSpec),
51040
- baked: src["exposes-as-agent"] === true
51056
+ baked: src["exposes-as-agent"] === true,
51057
+ rebakeInput: findRebakeInput(inputs)
51041
51058
  };
51042
51059
  }
51043
51060
  function sourceNodeId(nodes, connections) {
@@ -51289,7 +51306,7 @@ function runRaw(args, onSpawn) {
51289
51306
  if (bad !== void 0) throw new AwareError(`refusing to pass unsafe argument to shell: ${bad}`);
51290
51307
  }
51291
51308
  const argv = [...preArgs, ...args];
51292
- return new Promise((resolve5, reject) => {
51309
+ return new Promise((resolve6, reject) => {
51293
51310
  const child = (0, import_node_child_process.spawn)(bin, argv, { shell: invoker.shell, windowsHide: true });
51294
51311
  onSpawn?.(child);
51295
51312
  let stdout = "";
@@ -51307,7 +51324,7 @@ function runRaw(args, onSpawn) {
51307
51324
  });
51308
51325
  child.on("close", (code) => {
51309
51326
  clearTimeout(timer);
51310
- resolve5({ code: code ?? -1, stdout, stderr });
51327
+ resolve6({ code: code ?? -1, stdout, stderr });
51311
51328
  });
51312
51329
  });
51313
51330
  }
@@ -51321,7 +51338,7 @@ function runRawWithEnv(args, env2, timeoutMs) {
51321
51338
  }
51322
51339
  const argv = [...preArgs, ...args];
51323
51340
  const limit = timeoutMs ?? RUN_TIMEOUT_MS;
51324
- return new Promise((resolve5, reject) => {
51341
+ return new Promise((resolve6, reject) => {
51325
51342
  const child = (0, import_node_child_process.spawn)(bin, argv, { shell: invoker.shell, windowsHide: true, env: env2 ?? process.env });
51326
51343
  let stdout = "";
51327
51344
  let stderr = "";
@@ -51338,7 +51355,7 @@ function runRawWithEnv(args, env2, timeoutMs) {
51338
51355
  });
51339
51356
  child.on("close", (code) => {
51340
51357
  clearTimeout(timer);
51341
- resolve5({ code: code ?? -1, stdout, stderr });
51358
+ resolve6({ code: code ?? -1, stdout, stderr });
51342
51359
  });
51343
51360
  });
51344
51361
  }
@@ -51388,7 +51405,7 @@ async function execTekla(code, opts = {}) {
51388
51405
  args: opts.args ?? {}
51389
51406
  });
51390
51407
  const timeoutMs = opts.debug ? 15 * 6e4 : RUN_TIMEOUT_MS;
51391
- return new Promise((resolve5, reject) => {
51408
+ return new Promise((resolve6, reject) => {
51392
51409
  const child = (0, import_node_child_process.spawn)(bin, ["exec", "--version", version, "--json-stdin"], { windowsHide: true });
51393
51410
  let stdout = "";
51394
51411
  let stderr = "";
@@ -51416,7 +51433,7 @@ async function execTekla(code, opts = {}) {
51416
51433
  })
51417
51434
  );
51418
51435
  }
51419
- resolve5(parsed);
51436
+ resolve6(parsed);
51420
51437
  });
51421
51438
  child.stdin.write(payload);
51422
51439
  child.stdin.end();
@@ -51714,7 +51731,7 @@ function connectDeviceCode(id, onEvent) {
51714
51731
  if (!bin) throw new AwareError("aware CLI invoker not resolved");
51715
51732
  inFlightConnects.get(id)?.();
51716
51733
  const argv = [...preArgs, "connect", id, "--device-code", "--json"];
51717
- return new Promise((resolve5, reject) => {
51734
+ return new Promise((resolve6, reject) => {
51718
51735
  const child = (0, import_node_child_process.spawn)(bin, argv, { shell: invoker.shell, windowsHide: true });
51719
51736
  let buf = "";
51720
51737
  let gotPrompt = false;
@@ -51740,7 +51757,7 @@ function connectDeviceCode(id, onEvent) {
51740
51757
  }
51741
51758
  if (!gotPrompt && obj.phase === "prompt" && typeof obj.user_code === "string") {
51742
51759
  gotPrompt = true;
51743
- resolve5({ prompt: obj, cancel });
51760
+ resolve6({ prompt: obj, cancel });
51744
51761
  } else {
51745
51762
  onEvent(obj);
51746
51763
  }
@@ -52666,7 +52683,7 @@ function appVersion() {
52666
52683
  return resolveVersion({
52667
52684
  isSea: isSea2(),
52668
52685
  sqVersionXml: readSqVersionXml(),
52669
- define: true ? "0.16.2" : void 0,
52686
+ define: true ? "0.18.0" : void 0,
52670
52687
  pkgVersion: readPkgVersion()
52671
52688
  });
52672
52689
  }
@@ -52676,7 +52693,7 @@ function resolveChannel(s) {
52676
52693
  return "dev";
52677
52694
  }
52678
52695
  function appChannel() {
52679
- return resolveChannel({ isSea: isSea2(), define: true ? "0.16.2" : void 0 });
52696
+ return resolveChannel({ isSea: isSea2(), define: true ? "0.18.0" : void 0 });
52680
52697
  }
52681
52698
 
52682
52699
  // oauth-presets.ts
@@ -52739,10 +52756,10 @@ function ensureManagedProfile(id) {
52739
52756
  return "written";
52740
52757
  }
52741
52758
  function isPortBindable(port, host = "127.0.0.1") {
52742
- return new Promise((resolve5) => {
52759
+ return new Promise((resolve6) => {
52743
52760
  const srv = import_node_net.default.createServer();
52744
- srv.once("error", () => resolve5(false));
52745
- srv.listen(port, host, () => srv.close(() => resolve5(true)));
52761
+ srv.once("error", () => resolve6(false));
52762
+ srv.listen(port, host, () => srv.close(() => resolve6(true)));
52746
52763
  });
52747
52764
  }
52748
52765
 
@@ -52773,6 +52790,40 @@ function bakeFloSource(source, inputs) {
52773
52790
  return doc.toString();
52774
52791
  }
52775
52792
 
52793
+ // app-import.ts
52794
+ var APP_ID2 = /^[a-z0-9][a-z0-9._-]*$/i;
52795
+ var SOURCE_EXT2 = /\.(flo|app|flow|aware)$/i;
52796
+ var ImportError = class extends Error {
52797
+ code;
52798
+ constructor(message, code) {
52799
+ super(message);
52800
+ this.name = "ImportError";
52801
+ this.code = code;
52802
+ }
52803
+ };
52804
+ function assertImportable(content, filename) {
52805
+ if (filename && !SOURCE_EXT2.test(filename)) {
52806
+ throw new ImportError("that file isn't a .flo workflow \u2014 drop a .flo file to import", "not-flo");
52807
+ }
52808
+ if (!content || !content.trim()) {
52809
+ throw new ImportError("that file is empty", "invalid");
52810
+ }
52811
+ if (!/^nodes:/m.test(content)) {
52812
+ throw new ImportError("that file doesn't look like a valid workflow \u2014 it may be truncated", "invalid");
52813
+ }
52814
+ }
52815
+ function deriveAppId(content) {
52816
+ const m = content.match(/^app:[ \t]*["']?([^"'\r\n]+?)["']?[ \t]*$/m);
52817
+ if (!m) {
52818
+ throw new ImportError("that file doesn't look like a workflow \u2014 no top-level 'app:' name", "invalid");
52819
+ }
52820
+ const id = (m[1] ?? "").trim();
52821
+ if (!APP_ID2.test(id)) {
52822
+ throw new ImportError(`"${id}" isn't a valid workflow id`, "invalid");
52823
+ }
52824
+ return id;
52825
+ }
52826
+
52776
52827
  // report-badge.ts
52777
52828
  var BADGE_MARKER = "fla-credit";
52778
52829
  var DEFAULT_URL = "https://floless.io/made-with-floless?utm_source=report_badge";
@@ -52826,7 +52877,7 @@ function extractReportHtml(events) {
52826
52877
  }
52827
52878
 
52828
52879
  // index.ts
52829
- var import_node_crypto6 = require("node:crypto");
52880
+ var import_node_crypto7 = require("node:crypto");
52830
52881
 
52831
52882
  // graft.ts
52832
52883
  var TEKLA_MARKER = "Recipe: Tekla model plug-in";
@@ -53063,6 +53114,17 @@ function deleteTemplate(id) {
53063
53114
  function getTemplate(id) {
53064
53115
  return listTemplates().find((t) => t.id === id) ?? null;
53065
53116
  }
53117
+ function updateTemplate(id, patch) {
53118
+ const list = listTemplates();
53119
+ const cur = list.find((t) => t.id === id);
53120
+ if (!cur) return null;
53121
+ const name = patch.name?.trim();
53122
+ const category = patch.category?.trim();
53123
+ cur.name = name || cur.name;
53124
+ cur.category = category || cur.category;
53125
+ writeTemplates(list);
53126
+ return cur;
53127
+ }
53066
53128
  function addRequest(req, decoded = []) {
53067
53129
  ensureRoot();
53068
53130
  if (!(0, import_node_fs12.existsSync)(REQUESTS_DIR)) (0, import_node_fs12.mkdirSync)(REQUESTS_DIR, { recursive: true });
@@ -53162,9 +53224,65 @@ function decodeSnapshots(inputs) {
53162
53224
  });
53163
53225
  }
53164
53226
 
53227
+ // visual-input-store.ts
53228
+ var import_node_crypto5 = require("node:crypto");
53229
+ var import_node_fs13 = require("node:fs");
53230
+ var import_node_os9 = require("node:os");
53231
+ var import_node_path11 = require("node:path");
53232
+ var MAX_BYTES3 = 25 * 1024 * 1024;
53233
+ var VisualInputError = class extends Error {
53234
+ };
53235
+ function inputsDir() {
53236
+ const root = process.env.FLOLESS_HOME ?? (0, import_node_path11.join)((0, import_node_os9.homedir)(), ".floless");
53237
+ return (0, import_node_path11.join)(root, "inputs");
53238
+ }
53239
+ function sniffExt2(buf) {
53240
+ if (buf.length >= 8 && buf[0] === 137 && buf[1] === 80 && buf[2] === 78 && buf[3] === 71) return "png";
53241
+ if (buf.length >= 3 && buf[0] === 255 && buf[1] === 216 && buf[2] === 255) return "jpg";
53242
+ if (buf.length >= 12 && buf.toString("ascii", 0, 4) === "RIFF" && buf.toString("ascii", 8, 12) === "WEBP") return "webp";
53243
+ if (buf.length >= 5 && buf.toString("ascii", 0, 5) === "%PDF-") return "pdf";
53244
+ return null;
53245
+ }
53246
+ var RESERVED = /^(con|prn|aux|nul|com[1-9]|lpt[1-9])(\..*)?$/i;
53247
+ function safeSegment(s) {
53248
+ if (!s || s === "." || s.includes("..")) return false;
53249
+ if (s.includes("/") || s.includes("\\") || s.includes(import_node_path11.sep)) return false;
53250
+ for (let i = 0; i < s.length; i++) {
53251
+ const c = s.charCodeAt(i);
53252
+ if (c < 32 || c === 58) return false;
53253
+ }
53254
+ if (/[. ]$/.test(s)) return false;
53255
+ return !RESERVED.test(s);
53256
+ }
53257
+ function storeVisualInput(appId, dataUrl) {
53258
+ if (!safeSegment(appId)) throw new VisualInputError("invalid app id");
53259
+ const m = /^data:([\w/+.-]+);base64,(.*)$/s.exec(dataUrl || "");
53260
+ if (!m) throw new VisualInputError("visual input must be a base64 data URL");
53261
+ const buf = Buffer.from(m[2] ?? "", "base64");
53262
+ if (buf.length === 0) throw new VisualInputError("empty visual input");
53263
+ if (buf.length > MAX_BYTES3) throw new VisualInputError("visual input too large (max 25 MB)");
53264
+ const ext = sniffExt2(buf);
53265
+ if (!ext) throw new VisualInputError("visual input must be PNG, JPEG, WebP, or PDF");
53266
+ const sha2562 = (0, import_node_crypto5.createHash)("sha256").update(buf).digest("hex");
53267
+ const dir = (0, import_node_path11.join)(inputsDir(), appId);
53268
+ const path = (0, import_node_path11.join)(dir, `${sha2562}.${ext}`);
53269
+ const root = (0, import_node_path11.resolve)(inputsDir());
53270
+ const target = (0, import_node_path11.resolve)(path);
53271
+ if (target !== root && !target.startsWith(root + import_node_path11.sep)) {
53272
+ throw new VisualInputError("refusing to write outside the inputs root");
53273
+ }
53274
+ (0, import_node_fs13.mkdirSync)(dir, { recursive: true });
53275
+ if (!(0, import_node_fs13.existsSync)(path)) {
53276
+ const tmp = `${path}.tmp`;
53277
+ (0, import_node_fs13.writeFileSync)(tmp, buf);
53278
+ (0, import_node_fs13.renameSync)(tmp, path);
53279
+ }
53280
+ return { path, ext, bytes: (0, import_node_fs13.statSync)(path).size, sha256: sha2562 };
53281
+ }
53282
+
53165
53283
  // routines.ts
53166
- var import_node_fs14 = require("node:fs");
53167
- var import_node_path12 = require("node:path");
53284
+ var import_node_fs15 = require("node:fs");
53285
+ var import_node_path13 = require("node:path");
53168
53286
 
53169
53287
  // sse.ts
53170
53288
  var clients = /* @__PURE__ */ new Set();
@@ -53201,11 +53319,11 @@ function clientCount() {
53201
53319
  }
53202
53320
 
53203
53321
  // trigger-sessions.ts
53204
- var import_node_fs13 = require("node:fs");
53205
- var import_node_os9 = require("node:os");
53206
- var import_node_path11 = require("node:path");
53322
+ var import_node_fs14 = require("node:fs");
53323
+ var import_node_os10 = require("node:os");
53324
+ var import_node_path12 = require("node:path");
53207
53325
  var import_yaml4 = __toESM(require_dist6(), 1);
53208
- 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");
53326
+ var AGENTS_DIR2 = process.env.AWARE_HOME ? (0, import_node_path12.join)(process.env.AWARE_HOME, "agents") : (0, import_node_path12.join)((0, import_node_os10.homedir)(), ".aware", "agents");
53209
53327
  function summarizeFire(data) {
53210
53328
  if (!data) return "event";
53211
53329
  const type = typeof data.type === "string" ? data.type : "";
@@ -53222,10 +53340,10 @@ function mapTriggerState(phase) {
53222
53340
  function isHostBacked(agent, agentsDir = AGENTS_DIR2) {
53223
53341
  const safe = (n) => !n.includes("/") && !n.includes("\\") && !n.includes("..");
53224
53342
  if (!safe(agent)) return false;
53225
- const manifestPath = (0, import_node_path11.join)(agentsDir, agent, "manifest.yaml");
53226
- if (!(0, import_node_fs13.existsSync)(manifestPath)) return false;
53343
+ const manifestPath = (0, import_node_path12.join)(agentsDir, agent, "manifest.yaml");
53344
+ if (!(0, import_node_fs14.existsSync)(manifestPath)) return false;
53227
53345
  try {
53228
- const doc = (0, import_yaml4.parse)((0, import_node_fs13.readFileSync)(manifestPath, "utf8"));
53346
+ const doc = (0, import_yaml4.parse)((0, import_node_fs14.readFileSync)(manifestPath, "utf8"));
53229
53347
  const transport = doc?.transport;
53230
53348
  return !!(transport && typeof transport === "object" && "cli" in transport);
53231
53349
  } catch {
@@ -53500,7 +53618,7 @@ var RoutineError = class extends Error {
53500
53618
  }
53501
53619
  status;
53502
53620
  };
53503
- var ROUTINES_FILE = (0, import_node_path12.join)(flolessRoot, "routines.json");
53621
+ var ROUTINES_FILE = (0, import_node_path13.join)(flolessRoot, "routines.json");
53504
53622
  var routines = [];
53505
53623
  var loaded = false;
53506
53624
  function ensureLoaded() {
@@ -53536,10 +53654,10 @@ function sanitizeRoutine(raw) {
53536
53654
  };
53537
53655
  }
53538
53656
  function loadFromDisk() {
53539
- if (!(0, import_node_fs14.existsSync)(ROUTINES_FILE)) return [];
53657
+ if (!(0, import_node_fs15.existsSync)(ROUTINES_FILE)) return [];
53540
53658
  let text;
53541
53659
  try {
53542
- text = (0, import_node_fs14.readFileSync)(ROUTINES_FILE, "utf8");
53660
+ text = (0, import_node_fs15.readFileSync)(ROUTINES_FILE, "utf8");
53543
53661
  } catch {
53544
53662
  return [];
53545
53663
  }
@@ -53548,17 +53666,17 @@ function loadFromDisk() {
53548
53666
  return Array.isArray(parsed) ? parsed.map(sanitizeRoutine).filter((r) => r !== null) : [];
53549
53667
  } catch {
53550
53668
  try {
53551
- (0, import_node_fs14.renameSync)(ROUTINES_FILE, `${ROUTINES_FILE}.corrupt-${Date.now()}`);
53669
+ (0, import_node_fs15.renameSync)(ROUTINES_FILE, `${ROUTINES_FILE}.corrupt-${Date.now()}`);
53552
53670
  } catch {
53553
53671
  }
53554
53672
  return [];
53555
53673
  }
53556
53674
  }
53557
53675
  function saveRoutines() {
53558
- if (!(0, import_node_fs14.existsSync)(flolessRoot)) (0, import_node_fs14.mkdirSync)(flolessRoot, { recursive: true });
53676
+ if (!(0, import_node_fs15.existsSync)(flolessRoot)) (0, import_node_fs15.mkdirSync)(flolessRoot, { recursive: true });
53559
53677
  const tmp = `${ROUTINES_FILE}.${process.pid}.tmp`;
53560
- (0, import_node_fs14.writeFileSync)(tmp, JSON.stringify(routines, null, 2));
53561
- (0, import_node_fs14.renameSync)(tmp, ROUTINES_FILE);
53678
+ (0, import_node_fs15.writeFileSync)(tmp, JSON.stringify(routines, null, 2));
53679
+ (0, import_node_fs15.renameSync)(tmp, ROUTINES_FILE);
53562
53680
  }
53563
53681
  function listRoutines() {
53564
53682
  ensureLoaded();
@@ -53950,9 +54068,9 @@ function isGatedAwareRoute(url, method) {
53950
54068
 
53951
54069
  // autostart.mjs
53952
54070
  var import_node_child_process3 = require("node:child_process");
53953
- var import_node_fs15 = require("node:fs");
53954
- var import_node_os10 = require("node:os");
53955
- var import_node_path13 = require("node:path");
54071
+ var import_node_fs16 = require("node:fs");
54072
+ var import_node_os11 = require("node:os");
54073
+ var import_node_path14 = require("node:path");
53956
54074
 
53957
54075
  // teardown.mjs
53958
54076
  var RUN_KEY = "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run";
@@ -54064,8 +54182,8 @@ function removeLegacyRunKey() {
54064
54182
  }
54065
54183
  function logLine(msg) {
54066
54184
  try {
54067
- (0, import_node_fs15.mkdirSync)(logDir(), { recursive: true });
54068
- (0, import_node_fs15.appendFileSync)(logFilePath(), `${(/* @__PURE__ */ new Date()).toISOString()} ${msg}
54185
+ (0, import_node_fs16.mkdirSync)(logDir(), { recursive: true });
54186
+ (0, import_node_fs16.appendFileSync)(logFilePath(), `${(/* @__PURE__ */ new Date()).toISOString()} ${msg}
54069
54187
  `);
54070
54188
  } catch {
54071
54189
  }
@@ -54073,8 +54191,8 @@ function logLine(msg) {
54073
54191
  function registerAutostart(exePath) {
54074
54192
  if (!isWin) return;
54075
54193
  const xml = buildAutostartTaskXml(exePath, currentUserId());
54076
- const tmp = (0, import_node_path13.join)((0, import_node_os10.tmpdir)(), `floless-autostart-${process.pid}-${Date.now()}.xml`);
54077
- (0, import_node_fs15.writeFileSync)(tmp, "\uFEFF" + xml, { encoding: "utf16le" });
54194
+ const tmp = (0, import_node_path14.join)((0, import_node_os11.tmpdir)(), `floless-autostart-${process.pid}-${Date.now()}.xml`);
54195
+ (0, import_node_fs16.writeFileSync)(tmp, "\uFEFF" + xml, { encoding: "utf16le" });
54078
54196
  try {
54079
54197
  (0, import_node_child_process3.execFileSync)("schtasks", ["/Create", "/TN", TASK_NAME, "/XML", tmp, "/F"], {
54080
54198
  stdio: ["ignore", "ignore", "ignore"],
@@ -54085,7 +54203,7 @@ function registerAutostart(exePath) {
54085
54203
  throw err;
54086
54204
  } finally {
54087
54205
  try {
54088
- (0, import_node_fs15.rmSync)(tmp, { force: true });
54206
+ (0, import_node_fs16.rmSync)(tmp, { force: true });
54089
54207
  } catch {
54090
54208
  }
54091
54209
  }
@@ -54119,27 +54237,27 @@ function unregisterAutostart() {
54119
54237
 
54120
54238
  // updater.ts
54121
54239
  var import_node_child_process4 = require("node:child_process");
54122
- var import_node_crypto5 = require("node:crypto");
54123
- var import_node_fs17 = require("node:fs");
54240
+ var import_node_crypto6 = require("node:crypto");
54241
+ var import_node_fs18 = require("node:fs");
54124
54242
  var import_node_stream = require("node:stream");
54125
54243
  var import_promises = require("node:stream/promises");
54126
- var import_node_path15 = require("node:path");
54244
+ var import_node_path16 = require("node:path");
54127
54245
 
54128
54246
  // post-update-marker.mjs
54129
- var import_node_fs16 = require("node:fs");
54130
- var import_node_os11 = require("node:os");
54131
- var import_node_path14 = require("node:path");
54247
+ var import_node_fs17 = require("node:fs");
54248
+ var import_node_os12 = require("node:os");
54249
+ var import_node_path15 = require("node:path");
54132
54250
  var FRESH_MS = 12e4;
54133
54251
  function markerPath() {
54134
54252
  const override = (process.env.FLOLESS_POST_UPDATE_MARKER ?? "").trim();
54135
54253
  if (override) return override;
54136
- const root = process.env.FLOLESS_HOME ?? (0, import_node_path14.join)((0, import_node_os11.homedir)(), ".floless");
54137
- return (0, import_node_path14.join)(root, ".post-update");
54254
+ const root = process.env.FLOLESS_HOME ?? (0, import_node_path15.join)((0, import_node_os12.homedir)(), ".floless");
54255
+ return (0, import_node_path15.join)(root, ".post-update");
54138
54256
  }
54139
54257
  function legacyMarkerPath() {
54140
54258
  if ((process.env.FLOLESS_POST_UPDATE_MARKER ?? "").trim()) return null;
54141
54259
  try {
54142
- return (0, import_node_path14.join)((0, import_node_path14.dirname)((0, import_node_path14.dirname)(process.execPath)), ".floless-post-update");
54260
+ return (0, import_node_path15.join)((0, import_node_path15.dirname)((0, import_node_path15.dirname)(process.execPath)), ".floless-post-update");
54143
54261
  } catch {
54144
54262
  return null;
54145
54263
  }
@@ -54149,7 +54267,7 @@ function writePostUpdateMarker() {
54149
54267
  for (const p of [markerPath(), legacyMarkerPath()]) {
54150
54268
  if (!p) continue;
54151
54269
  try {
54152
- (0, import_node_fs16.writeFileSync)(p, (/* @__PURE__ */ new Date()).toISOString());
54270
+ (0, import_node_fs17.writeFileSync)(p, (/* @__PURE__ */ new Date()).toISOString());
54153
54271
  wrote = true;
54154
54272
  } catch {
54155
54273
  }
@@ -54161,9 +54279,9 @@ function consumePostUpdateMarker() {
54161
54279
  for (const p of [markerPath(), legacyMarkerPath()]) {
54162
54280
  if (!p) continue;
54163
54281
  try {
54164
- if (!(0, import_node_fs16.existsSync)(p)) continue;
54165
- const ageMs = Date.now() - (0, import_node_fs16.statSync)(p).mtimeMs;
54166
- (0, import_node_fs16.rmSync)(p, { force: true });
54282
+ if (!(0, import_node_fs17.existsSync)(p)) continue;
54283
+ const ageMs = Date.now() - (0, import_node_fs17.statSync)(p).mtimeMs;
54284
+ (0, import_node_fs17.rmSync)(p, { force: true });
54167
54285
  if (ageMs < FRESH_MS) fresh = true;
54168
54286
  } catch {
54169
54287
  }
@@ -54180,13 +54298,13 @@ function currentVersion() {
54180
54298
  return appVersion();
54181
54299
  }
54182
54300
  function installRoot() {
54183
- return (0, import_node_path15.dirname)((0, import_node_path15.dirname)(process.execPath));
54301
+ return (0, import_node_path16.dirname)((0, import_node_path16.dirname)(process.execPath));
54184
54302
  }
54185
54303
  function updateExePath() {
54186
- return (0, import_node_path15.join)(installRoot(), "Update.exe");
54304
+ return (0, import_node_path16.join)(installRoot(), "Update.exe");
54187
54305
  }
54188
54306
  function packagesDir() {
54189
- return (0, import_node_path15.join)(installRoot(), "packages");
54307
+ return (0, import_node_path16.join)(installRoot(), "packages");
54190
54308
  }
54191
54309
  function feedUrl() {
54192
54310
  const env2 = (process.env.FLOLESS_UPDATE_URL ?? "").trim().replace(/\/+$/, "");
@@ -54278,23 +54396,23 @@ async function checkForUpdate() {
54278
54396
  return { supported: true, currentVersion: cur, updateAvailable: true, targetVersion: latest.Version, asset: latest };
54279
54397
  }
54280
54398
  async function sha1OfFile(path) {
54281
- const hash = (0, import_node_crypto5.createHash)("sha1");
54282
- await (0, import_promises.pipeline)((0, import_node_fs17.createReadStream)(path), hash);
54399
+ const hash = (0, import_node_crypto6.createHash)("sha1");
54400
+ await (0, import_promises.pipeline)((0, import_node_fs18.createReadStream)(path), hash);
54283
54401
  return hash.digest("hex").toUpperCase();
54284
54402
  }
54285
54403
  async function downloadPackage(asset) {
54286
54404
  if (!NUPKG_NAME.test(asset.FileName)) throw new Error(`refusing suspicious package name: ${asset.FileName}`);
54287
54405
  const want = asset.SHA1.toUpperCase();
54288
54406
  const dir = packagesDir();
54289
- (0, import_node_fs17.mkdirSync)(dir, { recursive: true });
54290
- const dest = (0, import_node_path15.join)(dir, asset.FileName);
54291
- if ((0, import_node_fs17.existsSync)(dest) && await sha1OfFile(dest) === want) return dest;
54407
+ (0, import_node_fs18.mkdirSync)(dir, { recursive: true });
54408
+ const dest = (0, import_node_path16.join)(dir, asset.FileName);
54409
+ if ((0, import_node_fs18.existsSync)(dest) && await sha1OfFile(dest) === want) return dest;
54292
54410
  const res = await authedFetch(`${feedUrl()}/${encodeURIComponent(asset.FileName)}`, {
54293
54411
  redirect: "follow",
54294
54412
  signal: AbortSignal.timeout(DOWNLOAD_TIMEOUT_MS)
54295
54413
  });
54296
54414
  if (!res.ok || !res.body) throw new Error(`download failed: HTTP ${res.status} for ${asset.FileName}`);
54297
- await (0, import_promises.pipeline)(import_node_stream.Readable.fromWeb(res.body), (0, import_node_fs17.createWriteStream)(dest));
54415
+ await (0, import_promises.pipeline)(import_node_stream.Readable.fromWeb(res.body), (0, import_node_fs18.createWriteStream)(dest));
54298
54416
  const got = await sha1OfFile(dest);
54299
54417
  if (got !== want) throw new Error(`SHA1 mismatch for ${asset.FileName}: feed=${want} got=${got}`);
54300
54418
  return dest;
@@ -54303,12 +54421,12 @@ async function applyUpdate(check, opts) {
54303
54421
  if (!check.supported) return { applied: false, message: check.reason ?? "auto-update not supported in this runtime" };
54304
54422
  if (!check.updateAvailable || !check.asset) return { applied: false, message: check.reason ?? "no update available" };
54305
54423
  const exe = updateExePath();
54306
- if (!(0, import_node_fs17.existsSync)(exe)) {
54424
+ if (!(0, import_node_fs18.existsSync)(exe)) {
54307
54425
  return { applied: false, message: `Update.exe not found at ${exe} \u2014 is this a Velopack install?` };
54308
54426
  }
54309
54427
  const pkg = await downloadPackage(check.asset);
54310
54428
  if (opts?.onBeforeApply) await opts.onBeforeApply();
54311
- await new Promise((resolve5, reject) => {
54429
+ await new Promise((resolve6, reject) => {
54312
54430
  const child = (0, import_node_child_process4.spawn)(exe, ["apply", "--package", pkg, "--waitPid", String(process.pid)], {
54313
54431
  cwd: installRoot(),
54314
54432
  detached: true,
@@ -54318,7 +54436,7 @@ async function applyUpdate(check, opts) {
54318
54436
  child.once("error", reject);
54319
54437
  child.once("spawn", () => {
54320
54438
  child.unref();
54321
- resolve5();
54439
+ resolve6();
54322
54440
  });
54323
54441
  });
54324
54442
  writePostUpdateMarker();
@@ -54512,12 +54630,12 @@ function isTraceCorrupt(events) {
54512
54630
 
54513
54631
  // launch.mjs
54514
54632
  var import_node_child_process5 = require("node:child_process");
54515
- var import_node_path16 = require("node:path");
54633
+ var import_node_path17 = require("node:path");
54516
54634
  var import_node_url = require("node:url");
54517
- var import_node_fs18 = require("node:fs");
54635
+ var import_node_fs19 = require("node:fs");
54518
54636
  var import_node_http = __toESM(require("node:http"), 1);
54519
54637
  var import_node_readline = require("node:readline");
54520
- var __dirname2 = (0, import_node_path16.dirname)((0, import_node_url.fileURLToPath)(__import_meta_url));
54638
+ var __dirname2 = (0, import_node_path17.dirname)((0, import_node_url.fileURLToPath)(__import_meta_url));
54521
54639
  var PORT = Number(process.env.PORT ?? 4317);
54522
54640
  var HEALTH_URL = `http://127.0.0.1:${PORT}/api/health`;
54523
54641
  var BROWSER_URL = `http://floless.localhost:${PORT}`;
@@ -54530,20 +54648,20 @@ var log = (m) => {
54530
54648
  }
54531
54649
  };
54532
54650
  function ping() {
54533
- return new Promise((resolve5) => {
54651
+ return new Promise((resolve6) => {
54534
54652
  const req = import_node_http.default.get(HEALTH_URL, { timeout: 1500 }, (res) => {
54535
54653
  res.resume();
54536
- resolve5(res.statusCode === 200);
54654
+ resolve6(res.statusCode === 200);
54537
54655
  });
54538
- req.on("error", () => resolve5(false));
54656
+ req.on("error", () => resolve6(false));
54539
54657
  req.on("timeout", () => {
54540
54658
  req.destroy();
54541
- resolve5(false);
54659
+ resolve6(false);
54542
54660
  });
54543
54661
  });
54544
54662
  }
54545
54663
  function probeVersion() {
54546
- return new Promise((resolve5) => {
54664
+ return new Promise((resolve6) => {
54547
54665
  const req = import_node_http.default.get(HEALTH_URL, { timeout: 1500 }, (res) => {
54548
54666
  let body = "";
54549
54667
  res.on("data", (c) => {
@@ -54551,16 +54669,16 @@ function probeVersion() {
54551
54669
  });
54552
54670
  res.on("end", () => {
54553
54671
  try {
54554
- resolve5(JSON.parse(body).appVersion || null);
54672
+ resolve6(JSON.parse(body).appVersion || null);
54555
54673
  } catch {
54556
- resolve5(null);
54674
+ resolve6(null);
54557
54675
  }
54558
54676
  });
54559
54677
  });
54560
- req.on("error", () => resolve5(null));
54678
+ req.on("error", () => resolve6(null));
54561
54679
  req.on("timeout", () => {
54562
54680
  req.destroy();
54563
- resolve5(null);
54681
+ resolve6(null);
54564
54682
  });
54565
54683
  });
54566
54684
  }
@@ -54589,8 +54707,8 @@ async function waitHealthy(timeoutMs = 3e4) {
54589
54707
  function resolveServerStart() {
54590
54708
  const packaged = /flolessapp\.exe$/i.test(process.execPath);
54591
54709
  if (packaged) return { cmd: process.execPath, args: ["--serve"], shell: false };
54592
- const bundle = (0, import_node_path16.join)(__dirname2, "dist", "floless-server.cjs");
54593
- if ((0, import_node_fs18.existsSync)(bundle)) return { cmd: process.execPath, args: [bundle, "--serve"], shell: false };
54710
+ const bundle = (0, import_node_path17.join)(__dirname2, "dist", "floless-server.cjs");
54711
+ if ((0, import_node_fs19.existsSync)(bundle)) return { cmd: process.execPath, args: [bundle, "--serve"], shell: false };
54594
54712
  return { cmd: "npm", args: ["run", "start"], shell: isWin2 };
54595
54713
  }
54596
54714
  function startServerDetached() {
@@ -54743,8 +54861,8 @@ function taskkillArgs(pid, { tree = true } = {}) {
54743
54861
  }
54744
54862
  function killSupervisor({ tree = true } = {}) {
54745
54863
  if (!isWin2) return;
54746
- const isNpmChannel = /^node(\.exe)?$/i.test((0, import_node_path16.basename)(process.execPath));
54747
- const scriptMatch = isNpmChannel ? (0, import_node_path16.basename)((0, import_node_url.fileURLToPath)(__import_meta_url)) : void 0;
54864
+ const isNpmChannel = /^node(\.exe)?$/i.test((0, import_node_path17.basename)(process.execPath));
54865
+ const scriptMatch = isNpmChannel ? (0, import_node_path17.basename)((0, import_node_url.fileURLToPath)(__import_meta_url)) : void 0;
54748
54866
  const realExe = resolveRealInstallExe(process.execPath);
54749
54867
  const exeMatch = realExe === process.execPath ? process.execPath : [process.execPath, realExe];
54750
54868
  const pids = supervisorPidsToKill(enumerateProcesses(), process.pid, exeMatch, scriptMatch);
@@ -54777,15 +54895,15 @@ async function cmdRestart() {
54777
54895
  await cmdOpen();
54778
54896
  }
54779
54897
  function apiJson(path, method = "GET") {
54780
- return new Promise((resolve5, reject) => {
54898
+ return new Promise((resolve6, reject) => {
54781
54899
  const req = import_node_http.default.request(`http://127.0.0.1:${PORT}${path}`, { method, timeout: 5e3 }, (res) => {
54782
54900
  let body = "";
54783
54901
  res.on("data", (c) => body += c);
54784
54902
  res.on("end", () => {
54785
54903
  try {
54786
- resolve5(JSON.parse(body || "{}"));
54904
+ resolve6(JSON.parse(body || "{}"));
54787
54905
  } catch {
54788
- resolve5({});
54906
+ resolve6({});
54789
54907
  }
54790
54908
  });
54791
54909
  });
@@ -54851,11 +54969,11 @@ function removeRegistryFootprint() {
54851
54969
  }
54852
54970
  }
54853
54971
  function promptYesNo(question) {
54854
- return new Promise((resolve5) => {
54972
+ return new Promise((resolve6) => {
54855
54973
  const rl = (0, import_node_readline.createInterface)({ input: process.stdin, output: process.stdout });
54856
54974
  rl.question(`${question} `, (answer) => {
54857
54975
  rl.close();
54858
- resolve5(/^y(es)?$/i.test((answer ?? "").trim()));
54976
+ resolve6(/^y(es)?$/i.test((answer ?? "").trim()));
54859
54977
  });
54860
54978
  });
54861
54979
  }
@@ -54909,7 +55027,7 @@ async function runAction(arg, flagArgv = [], selfVersion = null) {
54909
55027
  }
54910
55028
  await action(parseTeardownFlags(flagArgv));
54911
55029
  }
54912
- var entry = (0, import_node_path16.basename)(process.argv[1] ?? "").toLowerCase();
55030
+ var entry = (0, import_node_path17.basename)(process.argv[1] ?? "").toLowerCase();
54913
55031
  if (entry === "launch.mjs") {
54914
55032
  runAction(process.argv[2], process.argv.slice(3)).catch((e) => {
54915
55033
  log(`error: ${e?.message ?? e}`);
@@ -54983,9 +55101,9 @@ function awareUpgradeBlockReason(s) {
54983
55101
  }
54984
55102
 
54985
55103
  // skill-sync.ts
54986
- var import_node_fs19 = require("node:fs");
54987
- var import_node_os12 = require("node:os");
54988
- var import_node_path17 = require("node:path");
55104
+ var import_node_fs20 = require("node:fs");
55105
+ var import_node_os13 = require("node:os");
55106
+ var import_node_path18 = require("node:path");
54989
55107
  var import_node_url2 = require("node:url");
54990
55108
  var import_yaml5 = __toESM(require_dist6(), 1);
54991
55109
 
@@ -54995,6 +55113,8 @@ var PRODUCT_SKILLS = [
54995
55113
  // drive the floless.app CLI / desktop bridge from the user's AI
54996
55114
  "floless-app-onboarding",
54997
55115
  // guided, re-runnable tour of AWARE + floless.app for new users
55116
+ "floless-app-rebake",
55117
+ // re-read & re-bake a baked Visual Input (B3) after the user swaps the drawing
54998
55118
  "floless-app-report-issue",
54999
55119
  // file a diagnosed bug/idea/question to the private log via the floless.io relay
55000
55120
  "floless-app-routines",
@@ -55010,30 +55130,30 @@ function selectShippedSkillNames(names) {
55010
55130
  }
55011
55131
 
55012
55132
  // skill-sync.ts
55013
- var __dirname3 = (0, import_node_path17.dirname)((0, import_node_url2.fileURLToPath)(__import_meta_url));
55133
+ var __dirname3 = (0, import_node_path18.dirname)((0, import_node_url2.fileURLToPath)(__import_meta_url));
55014
55134
  function bundledSkillsRoot() {
55015
55135
  const candidates = [
55016
- (0, import_node_path17.join)(__dirname3, "skills"),
55017
- (0, import_node_path17.join)((0, import_node_path17.dirname)(process.execPath), "skills"),
55018
- (0, import_node_path17.join)(__dirname3, "..", ".claude", "skills")
55136
+ (0, import_node_path18.join)(__dirname3, "skills"),
55137
+ (0, import_node_path18.join)((0, import_node_path18.dirname)(process.execPath), "skills"),
55138
+ (0, import_node_path18.join)(__dirname3, "..", ".claude", "skills")
55019
55139
  ];
55020
- return candidates.find((p) => (0, import_node_fs19.existsSync)(p)) ?? null;
55140
+ return candidates.find((p) => (0, import_node_fs20.existsSync)(p)) ?? null;
55021
55141
  }
55022
55142
  function targetConfigDirs() {
55023
55143
  const override = process.env.FLOLESS_SKILL_TARGETS;
55024
55144
  if (override) {
55025
55145
  return override.split(";").map((d) => d.trim()).filter(Boolean).map((dir) => ({ runtime: "custom", dir }));
55026
55146
  }
55027
- const home = (0, import_node_os12.homedir)();
55147
+ const home = (0, import_node_os13.homedir)();
55028
55148
  return [
55029
- { runtime: "claude", dir: (0, import_node_path17.join)(home, ".claude") },
55030
- { runtime: "codex", dir: (0, import_node_path17.join)(home, ".codex") },
55031
- { runtime: "opencode", dir: (0, import_node_path17.join)(home, ".opencode") }
55149
+ { runtime: "claude", dir: (0, import_node_path18.join)(home, ".claude") },
55150
+ { runtime: "codex", dir: (0, import_node_path18.join)(home, ".codex") },
55151
+ { runtime: "opencode", dir: (0, import_node_path18.join)(home, ".opencode") }
55032
55152
  ];
55033
55153
  }
55034
55154
  function skillVersion(skillMdPath) {
55035
55155
  try {
55036
- const text = (0, import_node_fs19.readFileSync)(skillMdPath, "utf8");
55156
+ const text = (0, import_node_fs20.readFileSync)(skillMdPath, "utf8");
55037
55157
  const m = /^---\r?\n([\s\S]*?)\r?\n---/.exec(text);
55038
55158
  if (!m || m[1] === void 0) return null;
55039
55159
  const fm = (0, import_yaml5.parse)(m[1]);
@@ -55073,21 +55193,21 @@ function decideAction(installed, bundled) {
55073
55193
  function bundledSkills(root) {
55074
55194
  let entries = [];
55075
55195
  try {
55076
- entries = selectShippedSkillNames((0, import_node_fs19.readdirSync)(root));
55196
+ entries = selectShippedSkillNames((0, import_node_fs20.readdirSync)(root));
55077
55197
  } catch {
55078
55198
  return [];
55079
55199
  }
55080
55200
  const out = [];
55081
55201
  for (const name of entries) {
55082
- const dir = (0, import_node_path17.join)(root, name);
55202
+ const dir = (0, import_node_path18.join)(root, name);
55083
55203
  let isDir = false;
55084
55204
  try {
55085
- isDir = (0, import_node_fs19.statSync)(dir).isDirectory();
55205
+ isDir = (0, import_node_fs20.statSync)(dir).isDirectory();
55086
55206
  } catch {
55087
55207
  isDir = false;
55088
55208
  }
55089
55209
  if (!isDir) continue;
55090
- const v = skillVersion((0, import_node_path17.join)(dir, "SKILL.md"));
55210
+ const v = skillVersion((0, import_node_path18.join)(dir, "SKILL.md"));
55091
55211
  if (!v) continue;
55092
55212
  out.push({ name, dir, version: v });
55093
55213
  }
@@ -55100,17 +55220,17 @@ function syncSkills() {
55100
55220
  const skills = bundledSkills(root);
55101
55221
  if (!skills.length) return results;
55102
55222
  for (const { runtime, dir: cfg } of targetConfigDirs()) {
55103
- if (!(0, import_node_fs19.existsSync)(cfg)) continue;
55104
- const skillsDir = (0, import_node_path17.join)(cfg, "skills");
55223
+ if (!(0, import_node_fs20.existsSync)(cfg)) continue;
55224
+ const skillsDir = (0, import_node_path18.join)(cfg, "skills");
55105
55225
  for (const s of skills) {
55106
- const dest = (0, import_node_path17.join)(skillsDir, s.name);
55107
- const installedMd = (0, import_node_path17.join)(dest, "SKILL.md");
55108
- const installed = (0, import_node_fs19.existsSync)(installedMd) ? skillVersion(installedMd) : null;
55226
+ const dest = (0, import_node_path18.join)(skillsDir, s.name);
55227
+ const installedMd = (0, import_node_path18.join)(dest, "SKILL.md");
55228
+ const installed = (0, import_node_fs20.existsSync)(installedMd) ? skillVersion(installedMd) : null;
55109
55229
  const action = decideAction(installed, s.version);
55110
55230
  if (action === "installed" || action === "updated") {
55111
55231
  try {
55112
- if (action === "updated") (0, import_node_fs19.rmSync)(dest, { recursive: true, force: true });
55113
- (0, import_node_fs19.cpSync)(s.dir, dest, { recursive: true });
55232
+ if (action === "updated") (0, import_node_fs20.rmSync)(dest, { recursive: true, force: true });
55233
+ (0, import_node_fs20.cpSync)(s.dir, dest, { recursive: true });
55114
55234
  results.push({ runtime, skill: s.name, action, from: installed, to: s.version });
55115
55235
  } catch {
55116
55236
  }
@@ -55123,9 +55243,9 @@ function syncSkills() {
55123
55243
  }
55124
55244
 
55125
55245
  // watch.ts
55126
- var import_node_os13 = require("node:os");
55127
- var import_node_path19 = require("node:path");
55128
- var import_node_fs20 = require("node:fs");
55246
+ var import_node_os14 = require("node:os");
55247
+ var import_node_path20 = require("node:path");
55248
+ var import_node_fs21 = require("node:fs");
55129
55249
 
55130
55250
  // node_modules/chokidar/esm/index.js
55131
55251
  var import_fs2 = require("fs");
@@ -55136,7 +55256,7 @@ var sysPath2 = __toESM(require("path"), 1);
55136
55256
  // node_modules/readdirp/esm/index.js
55137
55257
  var import_promises2 = require("node:fs/promises");
55138
55258
  var import_node_stream2 = require("node:stream");
55139
- var import_node_path18 = require("node:path");
55259
+ var import_node_path19 = require("node:path");
55140
55260
  var EntryTypes = {
55141
55261
  FILE_TYPE: "files",
55142
55262
  DIR_TYPE: "directories",
@@ -55211,7 +55331,7 @@ var ReaddirpStream = class extends import_node_stream2.Readable {
55211
55331
  this._wantsDir = type ? DIR_TYPES.has(type) : false;
55212
55332
  this._wantsFile = type ? FILE_TYPES.has(type) : false;
55213
55333
  this._wantsEverything = type === EntryTypes.EVERYTHING_TYPE;
55214
- this._root = (0, import_node_path18.resolve)(root);
55334
+ this._root = (0, import_node_path19.resolve)(root);
55215
55335
  this._isDirent = !opts.alwaysStat;
55216
55336
  this._statsProp = this._isDirent ? "dirent" : "stats";
55217
55337
  this._rdOptions = { encoding: "utf8", withFileTypes: this._isDirent };
@@ -55282,8 +55402,8 @@ var ReaddirpStream = class extends import_node_stream2.Readable {
55282
55402
  let entry2;
55283
55403
  const basename5 = this._isDirent ? dirent.name : dirent;
55284
55404
  try {
55285
- const fullPath = (0, import_node_path18.resolve)((0, import_node_path18.join)(path, basename5));
55286
- entry2 = { path: (0, import_node_path18.relative)(this._root, fullPath), fullPath, basename: basename5 };
55405
+ const fullPath = (0, import_node_path19.resolve)((0, import_node_path19.join)(path, basename5));
55406
+ entry2 = { path: (0, import_node_path19.relative)(this._root, fullPath), fullPath, basename: basename5 };
55287
55407
  entry2[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
55288
55408
  } catch (err) {
55289
55409
  this._onError(err);
@@ -55317,7 +55437,7 @@ var ReaddirpStream = class extends import_node_stream2.Readable {
55317
55437
  }
55318
55438
  if (entryRealPathStats.isDirectory()) {
55319
55439
  const len = entryRealPath.length;
55320
- if (full.startsWith(entryRealPath) && full.substr(len, 1) === import_node_path18.sep) {
55440
+ if (full.startsWith(entryRealPath) && full.substr(len, 1) === import_node_path19.sep) {
55321
55441
  const recursiveError = new Error(`Circular symlink detected: "${full}" points to "${entryRealPath}"`);
55322
55442
  recursiveError.code = RECURSIVE_ERROR_CODE;
55323
55443
  return this._onError(recursiveError);
@@ -55981,7 +56101,7 @@ var NodeFsHandler = class {
55981
56101
  this._addToNodeFs(path, initialAdd, wh, depth + 1);
55982
56102
  }
55983
56103
  }).on(EV.ERROR, this._boundHandleError);
55984
- return new Promise((resolve5, reject) => {
56104
+ return new Promise((resolve6, reject) => {
55985
56105
  if (!stream)
55986
56106
  return reject();
55987
56107
  stream.once(STR_END, () => {
@@ -55990,7 +56110,7 @@ var NodeFsHandler = class {
55990
56110
  return;
55991
56111
  }
55992
56112
  const wasThrottled = throttler ? throttler.clear() : false;
55993
- resolve5(void 0);
56113
+ resolve6(void 0);
55994
56114
  previous.getChildren().filter((item) => {
55995
56115
  return item !== directory && !current.has(item);
55996
56116
  }).forEach((item) => {
@@ -56825,33 +56945,33 @@ function appIdFromLogPath(path) {
56825
56945
  return i >= 0 && parts[i + 1] ? parts[i + 1] : null;
56826
56946
  }
56827
56947
  function samePath(a, b) {
56828
- const ra = (0, import_node_path19.resolve)(a);
56829
- const rb = (0, import_node_path19.resolve)(b);
56948
+ const ra = (0, import_node_path20.resolve)(a);
56949
+ const rb = (0, import_node_path20.resolve)(b);
56830
56950
  return process.platform === "win32" ? ra.toLowerCase() === rb.toLowerCase() : ra === rb;
56831
56951
  }
56832
56952
  function underDir(path, dir) {
56833
- const rp = (0, import_node_path19.resolve)(path);
56834
- const rd = (0, import_node_path19.resolve)(dir);
56953
+ const rp = (0, import_node_path20.resolve)(path);
56954
+ const rd = (0, import_node_path20.resolve)(dir);
56835
56955
  const [p, d] = process.platform === "win32" ? [rp.toLowerCase(), rd.toLowerCase()] : [rp, rd];
56836
- return p === d || p.startsWith(d + import_node_path19.sep);
56956
+ return p === d || p.startsWith(d + import_node_path20.sep);
56837
56957
  }
56838
56958
  function startWatcher() {
56839
- const awareDir = process.env.AWARE_HOME ?? (0, import_node_path19.join)((0, import_node_os13.homedir)(), ".aware");
56840
- const credentialsDir = (0, import_node_path19.join)(awareDir, "credentials");
56841
- if (!(0, import_node_fs20.existsSync)(credentialsDir)) {
56959
+ const awareDir = process.env.AWARE_HOME ?? (0, import_node_path20.join)((0, import_node_os14.homedir)(), ".aware");
56960
+ const credentialsDir = (0, import_node_path20.join)(awareDir, "credentials");
56961
+ if (!(0, import_node_fs21.existsSync)(credentialsDir)) {
56842
56962
  try {
56843
- (0, import_node_fs20.mkdirSync)(credentialsDir, { recursive: true });
56963
+ (0, import_node_fs21.mkdirSync)(credentialsDir, { recursive: true });
56844
56964
  } catch {
56845
56965
  }
56846
56966
  }
56847
- if (!(0, import_node_fs20.existsSync)(uiDir)) {
56967
+ if (!(0, import_node_fs21.existsSync)(uiDir)) {
56848
56968
  try {
56849
- (0, import_node_fs20.mkdirSync)(uiDir, { recursive: true });
56969
+ (0, import_node_fs21.mkdirSync)(uiDir, { recursive: true });
56850
56970
  } catch {
56851
56971
  }
56852
56972
  }
56853
- const targets = ["apps", "logs", "credentials"].map((d) => (0, import_node_path19.join)(awareDir, d)).filter((p) => (0, import_node_fs20.existsSync)(p));
56854
- if ((0, import_node_fs20.existsSync)(uiDir)) targets.push(uiDir);
56973
+ const targets = ["apps", "logs", "credentials"].map((d) => (0, import_node_path20.join)(awareDir, d)).filter((p) => (0, import_node_fs21.existsSync)(p));
56974
+ if ((0, import_node_fs21.existsSync)(uiDir)) targets.push(uiDir);
56855
56975
  if (targets.length === 0) {
56856
56976
  return null;
56857
56977
  }
@@ -56881,11 +57001,11 @@ function startWatcher() {
56881
57001
  const isCredential = path.split(/[\\/]/).includes("credentials");
56882
57002
  const kind = isCredential ? "credential" : path.endsWith(".jsonl") ? "trace" : path.endsWith(".lock") ? "lock" : path.endsWith(".flo") || path.endsWith(".app") ? "source" : "file";
56883
57003
  broadcast({ type: "fs-change", kind, event, path });
56884
- if (kind === "trace" && event !== "unlink" && (0, import_node_fs20.existsSync)(path)) {
57004
+ if (kind === "trace" && event !== "unlink" && (0, import_node_fs21.existsSync)(path)) {
56885
57005
  const id = appIdFromLogPath(path);
56886
57006
  if (!id) return;
56887
57007
  try {
56888
- broadcast({ type: "trace-file", id, runId: path.split(import_node_path19.sep).pop()?.replace(/\.jsonl$/, "") ?? null, events: parseTrace((0, import_node_fs20.readFileSync)(path, "utf8")) });
57008
+ broadcast({ type: "trace-file", id, runId: path.split(import_node_path20.sep).pop()?.replace(/\.jsonl$/, "") ?? null, events: parseTrace((0, import_node_fs21.readFileSync)(path, "utf8")) });
56889
57009
  } catch {
56890
57010
  }
56891
57011
  }
@@ -56894,10 +57014,10 @@ function startWatcher() {
56894
57014
  }
56895
57015
 
56896
57016
  // index.ts
56897
- var __dirname4 = (0, import_node_path20.dirname)((0, import_node_url3.fileURLToPath)(__import_meta_url));
56898
- var WEB_ROOT = [(0, import_node_path20.join)(__dirname4, "web"), (0, import_node_path20.join)((0, import_node_path20.dirname)(process.execPath), "web"), (0, import_node_path20.join)(__dirname4, "..", "web")].find(
56899
- (p) => (0, import_node_fs21.existsSync)(p)
56900
- ) ?? (0, import_node_path20.join)(__dirname4, "..", "web");
57017
+ var __dirname4 = (0, import_node_path21.dirname)((0, import_node_url3.fileURLToPath)(__import_meta_url));
57018
+ var WEB_ROOT = [(0, import_node_path21.join)(__dirname4, "web"), (0, import_node_path21.join)((0, import_node_path21.dirname)(process.execPath), "web"), (0, import_node_path21.join)(__dirname4, "..", "web")].find(
57019
+ (p) => (0, import_node_fs22.existsSync)(p)
57020
+ ) ?? (0, import_node_path21.join)(__dirname4, "..", "web");
56901
57021
  var PORT2 = Number(process.env.PORT ?? 4317);
56902
57022
  var HOST = "127.0.0.1";
56903
57023
  var crashHandlersInstalled = false;
@@ -56913,7 +57033,7 @@ function installCrashHandlers() {
56913
57033
  ${stack}
56914
57034
  `;
56915
57035
  try {
56916
- (0, import_node_fs21.appendFileSync)(logFilePath(), line);
57036
+ (0, import_node_fs22.appendFileSync)(logFilePath(), line);
56917
57037
  } catch {
56918
57038
  }
56919
57039
  if (process.stderr.isTTY) process.stderr.write(line);
@@ -56956,7 +57076,7 @@ async function startServer() {
56956
57076
  };
56957
57077
  function installAwareGlobal(spec, onLine = () => {
56958
57078
  }) {
56959
- return new Promise((resolve5, reject) => {
57079
+ return new Promise((resolve6, reject) => {
56960
57080
  const child = (0, import_node_child_process6.spawn)("npm", ["i", "-g", `@aware-aeco/cli@${spec}`], { shell: isWin3, windowsHide: true });
56961
57081
  let stderrTail = "";
56962
57082
  let combinedTail = "";
@@ -56973,7 +57093,7 @@ async function startServer() {
56973
57093
  onLine(s.trimEnd());
56974
57094
  });
56975
57095
  child.on("error", (e) => reject(e));
56976
- child.on("close", (code) => code === 0 ? resolve5() : reject(new Error(`npm exited ${code}: ${stderrTail || combinedTail}`)));
57096
+ child.on("close", (code) => code === 0 ? resolve6() : reject(new Error(`npm exited ${code}: ${stderrTail || combinedTail}`)));
56977
57097
  });
56978
57098
  }
56979
57099
  const bootstrapDeps = {
@@ -57249,6 +57369,39 @@ async function startServer() {
57249
57369
  broadcast({ type: "compiled", id: id ?? null, lockPath: result.lockPath });
57250
57370
  return { ok: true, result };
57251
57371
  });
57372
+ app.post("/api/import", async (req, reply) => {
57373
+ const { filename, content } = req.body ?? {};
57374
+ if (typeof content !== "string") return reply.status(400).send({ ok: false, error: "no file content", code: "invalid" });
57375
+ let id;
57376
+ try {
57377
+ assertImportable(content, filename);
57378
+ id = deriveAppId(content);
57379
+ } catch (err) {
57380
+ if (err instanceof ImportError) return reply.status(400).send({ ok: false, error: err.message, code: err.code });
57381
+ throw err;
57382
+ }
57383
+ if (appExists(id)) {
57384
+ return reply.status(409).send({ ok: false, error: `a workflow named "${id}" is already installed \u2014 remove it first, or rename the file's app: id`, code: "exists", id });
57385
+ }
57386
+ const stageRoot = (0, import_node_fs22.mkdtempSync)((0, import_node_path21.join)((0, import_node_os15.tmpdir)(), "floless-import-"));
57387
+ try {
57388
+ const stageDir = (0, import_node_path21.join)(stageRoot, id);
57389
+ (0, import_node_fs22.mkdirSync)(stageDir);
57390
+ (0, import_node_fs22.writeFileSync)((0, import_node_path21.join)(stageDir, `${id}.flo`), content);
57391
+ await aware.install(stageDir);
57392
+ } catch (err) {
57393
+ try {
57394
+ await aware.uninstall(id);
57395
+ } catch {
57396
+ }
57397
+ const msg = err instanceof AwareError ? err.message : String(err?.message ?? err);
57398
+ return reply.status(502).send({ ok: false, error: `import failed: ${msg}` });
57399
+ } finally {
57400
+ (0, import_node_fs22.rmSync)(stageRoot, { recursive: true, force: true });
57401
+ }
57402
+ broadcast({ type: "apps-changed", id });
57403
+ return { ok: true, id };
57404
+ });
57252
57405
  app.post("/api/bake", async (req, reply) => {
57253
57406
  const { id } = req.body ?? {};
57254
57407
  if (!id) return reply.status(400).send({ ok: false, error: "id required" });
@@ -57258,13 +57411,13 @@ async function startServer() {
57258
57411
  }
57259
57412
  const inputs = appData.inputs.map((i) => ({ name: i.name, type: i.type }));
57260
57413
  const baked = bakeFloSource(appData.source.text, inputs);
57261
- const tmpRoot = (0, import_node_fs21.mkdtempSync)((0, import_node_path20.join)((0, import_node_os14.tmpdir)(), "floless-bake-"));
57262
- const backupDir = (0, import_node_path20.join)(tmpRoot, `${id}-backup`);
57263
- const bakeDir = (0, import_node_path20.join)(tmpRoot, id);
57264
- (0, import_node_fs21.cpSync)(appDir(id), backupDir, { recursive: true });
57265
- (0, import_node_fs21.cpSync)(appDir(id), bakeDir, { recursive: true });
57414
+ const tmpRoot = (0, import_node_fs22.mkdtempSync)((0, import_node_path21.join)((0, import_node_os15.tmpdir)(), "floless-bake-"));
57415
+ const backupDir = (0, import_node_path21.join)(tmpRoot, `${id}-backup`);
57416
+ const bakeDir = (0, import_node_path21.join)(tmpRoot, id);
57417
+ (0, import_node_fs22.cpSync)(appDir(id), backupDir, { recursive: true });
57418
+ (0, import_node_fs22.cpSync)(appDir(id), bakeDir, { recursive: true });
57266
57419
  const floName = appData.source.path.split(/[\\/]/).pop();
57267
- (0, import_node_fs21.writeFileSync)((0, import_node_path20.join)(bakeDir, floName), baked);
57420
+ (0, import_node_fs22.writeFileSync)((0, import_node_path21.join)(bakeDir, floName), baked);
57268
57421
  let appInstalled = true;
57269
57422
  try {
57270
57423
  await aware.uninstall(id);
@@ -57286,17 +57439,17 @@ async function startServer() {
57286
57439
  throw installErr;
57287
57440
  }
57288
57441
  try {
57289
- await aware.compile((0, import_node_path20.join)(appDir(id), floName));
57442
+ await aware.compile((0, import_node_path21.join)(appDir(id), floName));
57290
57443
  } catch (compileErr) {
57291
57444
  app.log.warn({ id, compileErr: String(compileErr) }, "bake: post-install recompile failed (app baked but may need a manual Compile)");
57292
57445
  }
57293
57446
  broadcast({ type: "baked", id });
57294
57447
  return { ok: true, id, agent: id, inputs };
57295
57448
  } finally {
57296
- if (appInstalled) (0, import_node_fs21.rmSync)(tmpRoot, { recursive: true, force: true });
57449
+ if (appInstalled) (0, import_node_fs22.rmSync)(tmpRoot, { recursive: true, force: true });
57297
57450
  }
57298
57451
  });
57299
- const graftAgentsDir = () => (0, import_node_path20.join)((0, import_node_os14.homedir)(), ".aware", "agents");
57452
+ const graftAgentsDir = () => (0, import_node_path21.join)((0, import_node_os15.homedir)(), ".aware", "agents");
57300
57453
  app.post("/api/graft/match", async (req, reply) => {
57301
57454
  const { glob } = req.body ?? {};
57302
57455
  if (!glob) return reply.status(400).send({ ok: false, error: "glob required" });
@@ -57313,7 +57466,7 @@ async function startServer() {
57313
57466
  if (!sourceKind || !sourceRef) {
57314
57467
  return reply.status(400).send({ ok: false, error: "sourceKind and sourceRef required" });
57315
57468
  }
57316
- const tempHome = (0, import_node_fs21.mkdtempSync)((0, import_node_path20.join)((0, import_node_os14.tmpdir)(), "floless-graft-"));
57469
+ const tempHome = (0, import_node_fs22.mkdtempSync)((0, import_node_path21.join)((0, import_node_os15.tmpdir)(), "floless-graft-"));
57317
57470
  let result;
57318
57471
  try {
57319
57472
  result = await aware.build({
@@ -57326,19 +57479,19 @@ async function startServer() {
57326
57479
  awareHome: tempHome
57327
57480
  });
57328
57481
  } catch (err) {
57329
- (0, import_node_fs21.rmSync)(tempHome, { recursive: true, force: true });
57482
+ (0, import_node_fs22.rmSync)(tempHome, { recursive: true, force: true });
57330
57483
  const msg = err instanceof AwareError ? err.message : String(err?.message ?? err);
57331
57484
  return reply.status(422).send({ ok: false, error: msg });
57332
57485
  }
57333
57486
  const manifest = readStagedManifest(result.agentDir);
57334
57487
  if (!manifest) {
57335
- (0, import_node_fs21.rmSync)(tempHome, { recursive: true, force: true });
57488
+ (0, import_node_fs22.rmSync)(tempHome, { recursive: true, force: true });
57336
57489
  return reply.status(502).send({ ok: false, error: `build produced output at ${result.agentDir} but no manifest.yaml` });
57337
57490
  }
57338
- const token = (0, import_node_crypto6.randomUUID)();
57491
+ const token = (0, import_node_crypto7.randomUUID)();
57339
57492
  registerStage(token, tempHome, result.agentId);
57340
57493
  const preview = buildPreview(manifest, sourceKind, sourceRef, token);
57341
- if ((0, import_node_fs21.existsSync)((0, import_node_path20.join)(graftAgentsDir(), result.agentId))) {
57494
+ if ((0, import_node_fs22.existsSync)((0, import_node_path21.join)(graftAgentsDir(), result.agentId))) {
57342
57495
  preview.warnings.unshift(`An agent named "${result.agentId}" is already installed \u2014 creating it will overwrite it.`);
57343
57496
  }
57344
57497
  return { ok: true, preview };
@@ -57357,7 +57510,7 @@ async function startServer() {
57357
57510
  registerStage(stagedRef, stage.tempDir, stage.agentId);
57358
57511
  return reply.status(409).send({ ok: false, error: err.message, agentId: stage.agentId, collision: true });
57359
57512
  }
57360
- (0, import_node_fs21.rmSync)(stage.tempDir, { recursive: true, force: true });
57513
+ (0, import_node_fs22.rmSync)(stage.tempDir, { recursive: true, force: true });
57361
57514
  throw err;
57362
57515
  }
57363
57516
  broadcast({ type: "grafted", id: stage.agentId });
@@ -57558,6 +57711,19 @@ async function startServer() {
57558
57711
  return { ok: true, template: tpl };
57559
57712
  }
57560
57713
  );
57714
+ app.patch(
57715
+ "/api/templates/:id",
57716
+ async (req, reply) => {
57717
+ const { name, category } = req.body ?? {};
57718
+ if ((name == null || !name.trim()) && (category == null || !category.trim())) {
57719
+ return reply.status(400).send({ ok: false, error: "name or category required" });
57720
+ }
57721
+ const tpl = updateTemplate(req.params.id, { name, category });
57722
+ if (!tpl) return reply.status(404).send({ ok: false, error: "template not found" });
57723
+ broadcast({ type: "templates-changed" });
57724
+ return { ok: true, template: tpl };
57725
+ }
57726
+ );
57561
57727
  app.delete("/api/templates/:id", async (req, reply) => {
57562
57728
  if (!deleteTemplate(req.params.id)) return reply.status(404).send({ ok: false, error: "template not found" });
57563
57729
  broadcast({ type: "templates-changed" });
@@ -57567,11 +57733,11 @@ async function startServer() {
57567
57733
  app.get("/api/requests/:id/snapshot/:n", async (req, reply) => {
57568
57734
  const n = Number.parseInt(req.params.n, 10);
57569
57735
  const p = Number.isInteger(n) ? snapshotPathFor(req.params.id, n) : null;
57570
- if (!p || !(0, import_node_fs21.existsSync)(p)) return reply.status(404).send({ ok: false, error: "snapshot not found" });
57736
+ if (!p || !(0, import_node_fs22.existsSync)(p)) return reply.status(404).send({ ok: false, error: "snapshot not found" });
57571
57737
  const ext = p.split(".").pop().toLowerCase();
57572
57738
  reply.header("Content-Type", ext === "png" ? "image/png" : ext === "webp" ? "image/webp" : "image/jpeg");
57573
57739
  reply.header("Cache-Control", "no-store");
57574
- return (0, import_node_fs21.readFileSync)(p);
57740
+ return (0, import_node_fs22.readFileSync)(p);
57575
57741
  });
57576
57742
  app.post(
57577
57743
  "/api/tweak",
@@ -57592,6 +57758,42 @@ async function startServer() {
57592
57758
  return { ok: true, request };
57593
57759
  }
57594
57760
  );
57761
+ const REBAKE_INSTRUCTION = "Re-read the attached drawing and re-bake the extracted values into this app's config.yaml (the literals the deterministic run uses), then `aware app compile` the app and tell me to approve the new lock. Do not change node logic \u2014 only the baked config values.";
57762
+ app.post(
57763
+ "/api/rebake",
57764
+ { bodyLimit: 25 * 1024 * 1024 },
57765
+ async (req, reply) => {
57766
+ const { appId, inputName, instruction, snapshots } = req.body ?? {};
57767
+ if (!appId) return reply.status(400).send({ ok: false, error: "appId required" });
57768
+ let decoded;
57769
+ try {
57770
+ decoded = decodeSnapshots(snapshots);
57771
+ } catch (e) {
57772
+ return reply.status(400).send({ ok: false, error: e instanceof Error ? e.message : "bad snapshot" });
57773
+ }
57774
+ const request = addRequest(
57775
+ { type: "rebake", appId, ...inputName ? { inputName } : {}, instruction: instruction || REBAKE_INSTRUCTION },
57776
+ decoded
57777
+ );
57778
+ broadcast({ type: "request-added", request });
57779
+ return { ok: true, request };
57780
+ }
57781
+ );
57782
+ app.post(
57783
+ "/api/visual-input",
57784
+ { bodyLimit: 25 * 1024 * 1024 },
57785
+ async (req, reply) => {
57786
+ const { appId, dataUrl } = req.body ?? {};
57787
+ if (!appId || !dataUrl) return reply.status(400).send({ ok: false, error: "appId and dataUrl required" });
57788
+ try {
57789
+ const stored = storeVisualInput(appId, dataUrl);
57790
+ return { ok: true, path: stored.path, ext: stored.ext, bytes: stored.bytes };
57791
+ } catch (e) {
57792
+ if (e instanceof VisualInputError) return reply.status(400).send({ ok: false, error: e.message });
57793
+ throw e;
57794
+ }
57795
+ }
57796
+ );
57595
57797
  app.post("/api/use-template", async (req, reply) => {
57596
57798
  const { appId, templateId } = req.body ?? {};
57597
57799
  if (!appId || !templateId) return reply.status(400).send({ ok: false, error: "appId and templateId required" });
@@ -57636,10 +57838,10 @@ async function startServer() {
57636
57838
  const EXT_TRACE_MAX_BYTES = 5 * 1024 * 1024;
57637
57839
  function resolveExtensionSource(source, warn = () => {
57638
57840
  }) {
57639
- const sep3 = source.indexOf(":");
57640
- if (sep3 <= 0) return void 0;
57641
- const kind = source.slice(0, sep3);
57642
- const ref = source.slice(sep3 + 1);
57841
+ const sep4 = source.indexOf(":");
57842
+ if (sep4 <= 0) return void 0;
57843
+ const kind = source.slice(0, sep4);
57844
+ const ref = source.slice(sep4 + 1);
57643
57845
  if (!EXT_SOURCE_REF.test(ref)) return void 0;
57644
57846
  if (kind === "last-run-output") {
57645
57847
  const latest = readLatestTrace(ref, void 0, EXT_TRACE_MAX_BYTES);
@@ -57665,7 +57867,7 @@ async function startServer() {
57665
57867
  warn(`last-run-status:${ref} \u2014 trace exists but couldn't be parsed (corrupt/truncated)`);
57666
57868
  let finishedAt2 = null;
57667
57869
  try {
57668
- finishedAt2 = (0, import_node_fs21.statSync)(latest.path).mtime.toISOString();
57870
+ finishedAt2 = (0, import_node_fs22.statSync)(latest.path).mtime.toISOString();
57669
57871
  } catch {
57670
57872
  finishedAt2 = null;
57671
57873
  }
@@ -57675,7 +57877,7 @@ async function startServer() {
57675
57877
  let finishedAt = typeof runEnd?.ts === "string" ? runEnd.ts : null;
57676
57878
  if (!finishedAt) {
57677
57879
  try {
57678
- finishedAt = (0, import_node_fs21.statSync)(latest.path).mtime.toISOString();
57880
+ finishedAt = (0, import_node_fs22.statSync)(latest.path).mtime.toISOString();
57679
57881
  } catch {
57680
57882
  finishedAt = null;
57681
57883
  }
@@ -57828,11 +58030,11 @@ function unregisterProtocol() {
57828
58030
 
57829
58031
  // main.ts
57830
58032
  function promptYesNo2(question) {
57831
- return new Promise((resolve5) => {
58033
+ return new Promise((resolve6) => {
57832
58034
  const rl = (0, import_node_readline2.createInterface)({ input: process.stdin, output: process.stdout });
57833
58035
  rl.question(`${question} `, (answer) => {
57834
58036
  rl.close();
57835
- resolve5(/^y(es)?$/i.test((answer ?? "").trim()));
58037
+ resolve6(/^y(es)?$/i.test((answer ?? "").trim()));
57836
58038
  });
57837
58039
  });
57838
58040
  }