clauder-hub 0.1.19 → 0.1.21

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.
Files changed (26) hide show
  1. package/package.json +1 -1
  2. package/server/dist/index.js +878 -578
  3. package/web/dist/assets/{MonacoEditor-F_ZgRGGt.js → MonacoEditor-BTVIBYvB.js} +3 -3
  4. package/web/dist/assets/{cssMode-DBhyCd0X.js → cssMode-C586Sf_r.js} +1 -1
  5. package/web/dist/assets/{freemarker2-CD30JI-K.js → freemarker2-C-cc3Gll.js} +1 -1
  6. package/web/dist/assets/{handlebars-CrVV4_mK.js → handlebars-DvIHaXiS.js} +1 -1
  7. package/web/dist/assets/{html-Bfe2eAe1.js → html-B6mVPILf.js} +1 -1
  8. package/web/dist/assets/{htmlMode-DoOJFt62.js → htmlMode-DdTtdH0Z.js} +1 -1
  9. package/web/dist/assets/{index-RzRaOMgG.js → index-BQk7iZCf.js} +1 -1
  10. package/web/dist/assets/index-BRBOC-HN.css +32 -0
  11. package/web/dist/assets/index-D7vjfqSK.js +640 -0
  12. package/web/dist/assets/{javascript-C43JYjgB.js → javascript-B_oWtDTg.js} +1 -1
  13. package/web/dist/assets/{jsonMode-DnYHCxH8.js → jsonMode-qce5w2Wk.js} +1 -1
  14. package/web/dist/assets/{liquid-BWmioas6.js → liquid-7IWcrKEP.js} +1 -1
  15. package/web/dist/assets/{lspLanguageFeatures-C40s-86R.js → lspLanguageFeatures-CmmvUFJp.js} +1 -1
  16. package/web/dist/assets/{mdx-Ds2ff-68.js → mdx-C7aHCLPx.js} +1 -1
  17. package/web/dist/assets/{python-BMT7eQL4.js → python-DM5DwMK7.js} +1 -1
  18. package/web/dist/assets/{razor-ClzP2hyU.js → razor-B7mgUEn8.js} +1 -1
  19. package/web/dist/assets/{tsMode-BaAHnSPR.js → tsMode-DxSLItWY.js} +1 -1
  20. package/web/dist/assets/{typescript-AWjavLb_.js → typescript-ByJ-uQZm.js} +1 -1
  21. package/web/dist/assets/{workers-D82kkn_x.js → workers-CJj-afeH.js} +1 -1
  22. package/web/dist/assets/{xml-COVjqCbe.js → xml-qEcmYLej.js} +1 -1
  23. package/web/dist/assets/{yaml-BNVB9coa.js → yaml-DJRPJYdB.js} +1 -1
  24. package/web/dist/index.html +2 -2
  25. package/web/dist/assets/index-BpTziG8o.js +0 -630
  26. package/web/dist/assets/index-Dt3TWUGi.css +0 -32
@@ -1659,8 +1659,8 @@ var require_node = __commonJS({
1659
1659
  }
1660
1660
  break;
1661
1661
  case "FILE":
1662
- var fs16 = __require("fs");
1663
- stream2 = new fs16.SyncWriteStream(fd2, { autoClose: false });
1662
+ var fs17 = __require("fs");
1663
+ stream2 = new fs17.SyncWriteStream(fd2, { autoClose: false });
1664
1664
  stream2._type = "fs";
1665
1665
  break;
1666
1666
  case "PIPE":
@@ -14462,11 +14462,11 @@ var require_mime_types = __commonJS({
14462
14462
  }
14463
14463
  return exts[0];
14464
14464
  }
14465
- function lookup(path17) {
14466
- if (!path17 || typeof path17 !== "string") {
14465
+ function lookup(path18) {
14466
+ if (!path18 || typeof path18 !== "string") {
14467
14467
  return false;
14468
14468
  }
14469
- var extension3 = extname("x." + path17).toLowerCase().substr(1);
14469
+ var extension3 = extname("x." + path18).toLowerCase().substr(1);
14470
14470
  if (!extension3) {
14471
14471
  return false;
14472
14472
  }
@@ -18251,7 +18251,7 @@ var require_path_to_regexp = __commonJS({
18251
18251
  "../../../../../../../../../../Source code/git-transfer/goldynlabs/clauder-hub/node_modules/path-to-regexp/index.js"(exports, module) {
18252
18252
  module.exports = pathToRegexp;
18253
18253
  var MATCHING_GROUP_REGEXP = /\\.|\((?:\?<(.*?)>)?(?!\?)/g;
18254
- function pathToRegexp(path17, keys, options) {
18254
+ function pathToRegexp(path18, keys, options) {
18255
18255
  options = options || {};
18256
18256
  keys = keys || [];
18257
18257
  var strict = options.strict;
@@ -18265,8 +18265,8 @@ var require_path_to_regexp = __commonJS({
18265
18265
  var pos = 0;
18266
18266
  var backtrack = "";
18267
18267
  var m2;
18268
- if (path17 instanceof RegExp) {
18269
- while (m2 = MATCHING_GROUP_REGEXP.exec(path17.source)) {
18268
+ if (path18 instanceof RegExp) {
18269
+ while (m2 = MATCHING_GROUP_REGEXP.exec(path18.source)) {
18270
18270
  if (m2[0][0] === "\\") continue;
18271
18271
  keys.push({
18272
18272
  name: m2[1] || name++,
@@ -18274,18 +18274,18 @@ var require_path_to_regexp = __commonJS({
18274
18274
  offset: m2.index
18275
18275
  });
18276
18276
  }
18277
- return path17;
18277
+ return path18;
18278
18278
  }
18279
- if (Array.isArray(path17)) {
18280
- path17 = path17.map(function(value) {
18279
+ if (Array.isArray(path18)) {
18280
+ path18 = path18.map(function(value) {
18281
18281
  return pathToRegexp(value, keys, options).source;
18282
18282
  });
18283
- return new RegExp(path17.join("|"), flags);
18283
+ return new RegExp(path18.join("|"), flags);
18284
18284
  }
18285
- if (typeof path17 !== "string") {
18285
+ if (typeof path18 !== "string") {
18286
18286
  throw new TypeError("path must be a string, array of strings, or regular expression");
18287
18287
  }
18288
- path17 = path17.replace(
18288
+ path18 = path18.replace(
18289
18289
  /\\.|(\/)?(\.)?:(\w+)(\(.*?\))?(\*)?(\?)?|[.*]|\/\(/g,
18290
18290
  function(match, slash, format, key, capture, star, optional, offset) {
18291
18291
  if (match[0] === "\\") {
@@ -18302,7 +18302,7 @@ var require_path_to_regexp = __commonJS({
18302
18302
  if (slash || format) {
18303
18303
  backtrack = "";
18304
18304
  } else {
18305
- backtrack += path17.slice(pos, offset);
18305
+ backtrack += path18.slice(pos, offset);
18306
18306
  }
18307
18307
  pos = offset + match.length;
18308
18308
  if (match === "*") {
@@ -18332,7 +18332,7 @@ var require_path_to_regexp = __commonJS({
18332
18332
  return result;
18333
18333
  }
18334
18334
  );
18335
- while (m2 = MATCHING_GROUP_REGEXP.exec(path17)) {
18335
+ while (m2 = MATCHING_GROUP_REGEXP.exec(path18)) {
18336
18336
  if (m2[0][0] === "\\") continue;
18337
18337
  if (keysOffset + i === keys.length || keys[keysOffset + i].offset > m2.index) {
18338
18338
  keys.splice(keysOffset + i, 0, {
@@ -18344,13 +18344,13 @@ var require_path_to_regexp = __commonJS({
18344
18344
  }
18345
18345
  i++;
18346
18346
  }
18347
- path17 += strict ? "" : path17[path17.length - 1] === "/" ? "?" : "/?";
18347
+ path18 += strict ? "" : path18[path18.length - 1] === "/" ? "?" : "/?";
18348
18348
  if (end) {
18349
- path17 += "$";
18350
- } else if (path17[path17.length - 1] !== "/") {
18351
- path17 += lookahead ? "(?=/|$)" : "(?:/|$)";
18349
+ path18 += "$";
18350
+ } else if (path18[path18.length - 1] !== "/") {
18351
+ path18 += lookahead ? "(?=/|$)" : "(?:/|$)";
18352
18352
  }
18353
- return new RegExp("^" + path17, flags);
18353
+ return new RegExp("^" + path18, flags);
18354
18354
  }
18355
18355
  }
18356
18356
  });
@@ -18363,19 +18363,19 @@ var require_layer = __commonJS({
18363
18363
  var debug = require_src()("express:router:layer");
18364
18364
  var hasOwnProperty = Object.prototype.hasOwnProperty;
18365
18365
  module.exports = Layer;
18366
- function Layer(path17, options, fn) {
18366
+ function Layer(path18, options, fn) {
18367
18367
  if (!(this instanceof Layer)) {
18368
- return new Layer(path17, options, fn);
18368
+ return new Layer(path18, options, fn);
18369
18369
  }
18370
- debug("new %o", path17);
18370
+ debug("new %o", path18);
18371
18371
  var opts = options || {};
18372
18372
  this.handle = fn;
18373
18373
  this.name = fn.name || "<anonymous>";
18374
18374
  this.params = void 0;
18375
18375
  this.path = void 0;
18376
- this.regexp = pathRegexp(path17, this.keys = [], opts);
18377
- this.regexp.fast_star = path17 === "*";
18378
- this.regexp.fast_slash = path17 === "/" && opts.end === false;
18376
+ this.regexp = pathRegexp(path18, this.keys = [], opts);
18377
+ this.regexp.fast_star = path18 === "*";
18378
+ this.regexp.fast_slash = path18 === "/" && opts.end === false;
18379
18379
  }
18380
18380
  Layer.prototype.handle_error = function handle_error(error, req, res, next) {
18381
18381
  var fn = this.handle;
@@ -18399,20 +18399,20 @@ var require_layer = __commonJS({
18399
18399
  next(err);
18400
18400
  }
18401
18401
  };
18402
- Layer.prototype.match = function match(path17) {
18402
+ Layer.prototype.match = function match(path18) {
18403
18403
  var match2;
18404
- if (path17 != null) {
18404
+ if (path18 != null) {
18405
18405
  if (this.regexp.fast_slash) {
18406
18406
  this.params = {};
18407
18407
  this.path = "";
18408
18408
  return true;
18409
18409
  }
18410
18410
  if (this.regexp.fast_star) {
18411
- this.params = { "0": decode_param(path17) };
18412
- this.path = path17;
18411
+ this.params = { "0": decode_param(path18) };
18412
+ this.path = path18;
18413
18413
  return true;
18414
18414
  }
18415
- match2 = this.regexp.exec(path17);
18415
+ match2 = this.regexp.exec(path18);
18416
18416
  }
18417
18417
  if (!match2) {
18418
18418
  this.params = void 0;
@@ -18505,10 +18505,10 @@ var require_route = __commonJS({
18505
18505
  var slice = Array.prototype.slice;
18506
18506
  var toString = Object.prototype.toString;
18507
18507
  module.exports = Route;
18508
- function Route(path17) {
18509
- this.path = path17;
18508
+ function Route(path18) {
18509
+ this.path = path18;
18510
18510
  this.stack = [];
18511
- debug("new %o", path17);
18511
+ debug("new %o", path18);
18512
18512
  this.methods = {};
18513
18513
  }
18514
18514
  Route.prototype._handles_method = function _handles_method(method) {
@@ -18720,8 +18720,8 @@ var require_router = __commonJS({
18720
18720
  if (++sync > 100) {
18721
18721
  return setImmediate(next, err);
18722
18722
  }
18723
- var path17 = getPathname(req);
18724
- if (path17 == null) {
18723
+ var path18 = getPathname(req);
18724
+ if (path18 == null) {
18725
18725
  return done(layerError);
18726
18726
  }
18727
18727
  var layer;
@@ -18729,7 +18729,7 @@ var require_router = __commonJS({
18729
18729
  var route;
18730
18730
  while (match !== true && idx < stack.length) {
18731
18731
  layer = stack[idx++];
18732
- match = matchLayer(layer, path17);
18732
+ match = matchLayer(layer, path18);
18733
18733
  route = layer.route;
18734
18734
  if (typeof match !== "boolean") {
18735
18735
  layerError = layerError || match;
@@ -18767,18 +18767,18 @@ var require_router = __commonJS({
18767
18767
  } else if (route) {
18768
18768
  layer.handle_request(req, res, next);
18769
18769
  } else {
18770
- trim_prefix(layer, layerError, layerPath, path17);
18770
+ trim_prefix(layer, layerError, layerPath, path18);
18771
18771
  }
18772
18772
  sync = 0;
18773
18773
  });
18774
18774
  }
18775
- function trim_prefix(layer, layerError, layerPath, path17) {
18775
+ function trim_prefix(layer, layerError, layerPath, path18) {
18776
18776
  if (layerPath.length !== 0) {
18777
- if (layerPath !== path17.slice(0, layerPath.length)) {
18777
+ if (layerPath !== path18.slice(0, layerPath.length)) {
18778
18778
  next(layerError);
18779
18779
  return;
18780
18780
  }
18781
- var c = path17[layerPath.length];
18781
+ var c = path18[layerPath.length];
18782
18782
  if (c && c !== "/" && c !== ".") return next(layerError);
18783
18783
  debug("trim prefix (%s) from url %s", layerPath, req.url);
18784
18784
  removed = layerPath;
@@ -18856,7 +18856,7 @@ var require_router = __commonJS({
18856
18856
  };
18857
18857
  proto.use = function use(fn) {
18858
18858
  var offset = 0;
18859
- var path17 = "/";
18859
+ var path18 = "/";
18860
18860
  if (typeof fn !== "function") {
18861
18861
  var arg = fn;
18862
18862
  while (Array.isArray(arg) && arg.length !== 0) {
@@ -18864,7 +18864,7 @@ var require_router = __commonJS({
18864
18864
  }
18865
18865
  if (typeof arg !== "function") {
18866
18866
  offset = 1;
18867
- path17 = fn;
18867
+ path18 = fn;
18868
18868
  }
18869
18869
  }
18870
18870
  var callbacks = flatten(slice.call(arguments, offset));
@@ -18876,8 +18876,8 @@ var require_router = __commonJS({
18876
18876
  if (typeof fn !== "function") {
18877
18877
  throw new TypeError("Router.use() requires a middleware function but got a " + gettype(fn));
18878
18878
  }
18879
- debug("use %o %s", path17, fn.name || "<anonymous>");
18880
- var layer = new Layer(path17, {
18879
+ debug("use %o %s", path18, fn.name || "<anonymous>");
18880
+ var layer = new Layer(path18, {
18881
18881
  sensitive: this.caseSensitive,
18882
18882
  strict: false,
18883
18883
  end: false
@@ -18887,9 +18887,9 @@ var require_router = __commonJS({
18887
18887
  }
18888
18888
  return this;
18889
18889
  };
18890
- proto.route = function route(path17) {
18891
- var route2 = new Route(path17);
18892
- var layer = new Layer(path17, {
18890
+ proto.route = function route(path18) {
18891
+ var route2 = new Route(path18);
18892
+ var layer = new Layer(path18, {
18893
18893
  sensitive: this.caseSensitive,
18894
18894
  strict: this.strict,
18895
18895
  end: true
@@ -18899,8 +18899,8 @@ var require_router = __commonJS({
18899
18899
  return route2;
18900
18900
  };
18901
18901
  methods.concat("all").forEach(function(method) {
18902
- proto[method] = function(path17) {
18903
- var route = this.route(path17);
18902
+ proto[method] = function(path18) {
18903
+ var route = this.route(path18);
18904
18904
  route[method].apply(route, slice.call(arguments, 1));
18905
18905
  return this;
18906
18906
  };
@@ -18936,9 +18936,9 @@ var require_router = __commonJS({
18936
18936
  }
18937
18937
  return toString.call(obj).replace(objectRegExp, "$1");
18938
18938
  }
18939
- function matchLayer(layer, path17) {
18939
+ function matchLayer(layer, path18) {
18940
18940
  try {
18941
- return layer.match(path17);
18941
+ return layer.match(path18);
18942
18942
  } catch (err) {
18943
18943
  return err;
18944
18944
  }
@@ -19056,13 +19056,13 @@ var require_view = __commonJS({
19056
19056
  "../../../../../../../../../../Source code/git-transfer/goldynlabs/clauder-hub/node_modules/express/lib/view.js"(exports, module) {
19057
19057
  "use strict";
19058
19058
  var debug = require_src()("express:view");
19059
- var path17 = __require("path");
19060
- var fs16 = __require("fs");
19061
- var dirname = path17.dirname;
19062
- var basename = path17.basename;
19063
- var extname = path17.extname;
19064
- var join = path17.join;
19065
- var resolve = path17.resolve;
19059
+ var path18 = __require("path");
19060
+ var fs17 = __require("fs");
19061
+ var dirname = path18.dirname;
19062
+ var basename = path18.basename;
19063
+ var extname = path18.extname;
19064
+ var join = path18.join;
19065
+ var resolve = path18.resolve;
19066
19066
  module.exports = View;
19067
19067
  function View(name, options) {
19068
19068
  var opts = options || {};
@@ -19091,17 +19091,17 @@ var require_view = __commonJS({
19091
19091
  this.path = this.lookup(fileName);
19092
19092
  }
19093
19093
  View.prototype.lookup = function lookup(name) {
19094
- var path18;
19094
+ var path19;
19095
19095
  var roots2 = [].concat(this.root);
19096
19096
  debug('lookup "%s"', name);
19097
- for (var i = 0; i < roots2.length && !path18; i++) {
19097
+ for (var i = 0; i < roots2.length && !path19; i++) {
19098
19098
  var root2 = roots2[i];
19099
19099
  var loc = resolve(root2, name);
19100
19100
  var dir = dirname(loc);
19101
19101
  var file = basename(loc);
19102
- path18 = this.resolve(dir, file);
19102
+ path19 = this.resolve(dir, file);
19103
19103
  }
19104
- return path18;
19104
+ return path19;
19105
19105
  };
19106
19106
  View.prototype.render = function render2(options, callback) {
19107
19107
  debug('render "%s"', this.path);
@@ -19109,21 +19109,21 @@ var require_view = __commonJS({
19109
19109
  };
19110
19110
  View.prototype.resolve = function resolve2(dir, file) {
19111
19111
  var ext = this.ext;
19112
- var path18 = join(dir, file);
19113
- var stat = tryStat(path18);
19112
+ var path19 = join(dir, file);
19113
+ var stat = tryStat(path19);
19114
19114
  if (stat && stat.isFile()) {
19115
- return path18;
19115
+ return path19;
19116
19116
  }
19117
- path18 = join(dir, basename(file, ext), "index" + ext);
19118
- stat = tryStat(path18);
19117
+ path19 = join(dir, basename(file, ext), "index" + ext);
19118
+ stat = tryStat(path19);
19119
19119
  if (stat && stat.isFile()) {
19120
- return path18;
19120
+ return path19;
19121
19121
  }
19122
19122
  };
19123
- function tryStat(path18) {
19124
- debug('stat "%s"', path18);
19123
+ function tryStat(path19) {
19124
+ debug('stat "%s"', path19);
19125
19125
  try {
19126
- return fs16.statSync(path18);
19126
+ return fs17.statSync(path19);
19127
19127
  } catch (e) {
19128
19128
  return void 0;
19129
19129
  }
@@ -19357,14 +19357,14 @@ var require_etag = __commonJS({
19357
19357
  "../../../../../../../../../../Source code/git-transfer/goldynlabs/clauder-hub/node_modules/etag/index.js"(exports, module) {
19358
19358
  "use strict";
19359
19359
  module.exports = etag;
19360
- var crypto2 = __require("crypto");
19360
+ var crypto3 = __require("crypto");
19361
19361
  var Stats = __require("fs").Stats;
19362
19362
  var toString = Object.prototype.toString;
19363
19363
  function entitytag(entity) {
19364
19364
  if (entity.length === 0) {
19365
19365
  return '"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"';
19366
19366
  }
19367
- var hash = crypto2.createHash("sha1").update(entity, "utf8").digest("base64").substring(0, 27);
19367
+ var hash = crypto3.createHash("sha1").update(entity, "utf8").digest("base64").substring(0, 27);
19368
19368
  var len = typeof entity === "string" ? Buffer.byteLength(entity, "utf8") : entity.length;
19369
19369
  return '"' + len.toString(16) + "-" + hash + '"';
19370
19370
  }
@@ -19477,8 +19477,8 @@ var require_types = __commonJS({
19477
19477
  // ../../../../../../../../../../Source code/git-transfer/goldynlabs/clauder-hub/node_modules/mime/mime.js
19478
19478
  var require_mime = __commonJS({
19479
19479
  "../../../../../../../../../../Source code/git-transfer/goldynlabs/clauder-hub/node_modules/mime/mime.js"(exports, module) {
19480
- var path17 = __require("path");
19481
- var fs16 = __require("fs");
19480
+ var path18 = __require("path");
19481
+ var fs17 = __require("fs");
19482
19482
  function Mime() {
19483
19483
  this.types = /* @__PURE__ */ Object.create(null);
19484
19484
  this.extensions = /* @__PURE__ */ Object.create(null);
@@ -19499,7 +19499,7 @@ var require_mime = __commonJS({
19499
19499
  };
19500
19500
  Mime.prototype.load = function(file) {
19501
19501
  this._loading = file;
19502
- var map = {}, content = fs16.readFileSync(file, "ascii"), lines2 = content.split(/[\r\n]+/);
19502
+ var map = {}, content = fs17.readFileSync(file, "ascii"), lines2 = content.split(/[\r\n]+/);
19503
19503
  lines2.forEach(function(line) {
19504
19504
  var fields = line.replace(/\s*#.*|^\s*|\s*$/g, "").split(/\s+/);
19505
19505
  map[fields.shift()] = fields;
@@ -19507,8 +19507,8 @@ var require_mime = __commonJS({
19507
19507
  this.define(map);
19508
19508
  this._loading = null;
19509
19509
  };
19510
- Mime.prototype.lookup = function(path18, fallback) {
19511
- var ext = path18.replace(/^.*[\.\/\\]/, "").toLowerCase();
19510
+ Mime.prototype.lookup = function(path19, fallback) {
19511
+ var ext = path19.replace(/^.*[\.\/\\]/, "").toLowerCase();
19512
19512
  return this.types[ext] || fallback || this.default_type;
19513
19513
  };
19514
19514
  Mime.prototype.extension = function(mimeType) {
@@ -19737,33 +19737,33 @@ var require_send = __commonJS({
19737
19737
  var escapeHtml2 = require_escape_html();
19738
19738
  var etag = require_etag();
19739
19739
  var fresh = require_fresh();
19740
- var fs16 = __require("fs");
19740
+ var fs17 = __require("fs");
19741
19741
  var mime = require_mime();
19742
19742
  var ms = require_ms2();
19743
19743
  var onFinished = require_on_finished();
19744
19744
  var parseRange = require_range_parser();
19745
- var path17 = __require("path");
19745
+ var path18 = __require("path");
19746
19746
  var statuses = require_statuses();
19747
19747
  var Stream = __require("stream");
19748
19748
  var util = __require("util");
19749
- var extname = path17.extname;
19750
- var join = path17.join;
19751
- var normalize = path17.normalize;
19752
- var resolve = path17.resolve;
19753
- var sep = path17.sep;
19749
+ var extname = path18.extname;
19750
+ var join = path18.join;
19751
+ var normalize = path18.normalize;
19752
+ var resolve = path18.resolve;
19753
+ var sep = path18.sep;
19754
19754
  var BYTES_RANGE_REGEXP = /^ *bytes=/;
19755
19755
  var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
19756
19756
  var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
19757
19757
  module.exports = send;
19758
19758
  module.exports.mime = mime;
19759
- function send(req, path18, options) {
19760
- return new SendStream(req, path18, options);
19759
+ function send(req, path19, options) {
19760
+ return new SendStream(req, path19, options);
19761
19761
  }
19762
- function SendStream(req, path18, options) {
19762
+ function SendStream(req, path19, options) {
19763
19763
  Stream.call(this);
19764
19764
  var opts = options || {};
19765
19765
  this.options = opts;
19766
- this.path = path18;
19766
+ this.path = path19;
19767
19767
  this.req = req;
19768
19768
  this._acceptRanges = opts.acceptRanges !== void 0 ? Boolean(opts.acceptRanges) : true;
19769
19769
  this._cacheControl = opts.cacheControl !== void 0 ? Boolean(opts.cacheControl) : true;
@@ -19809,8 +19809,8 @@ var require_send = __commonJS({
19809
19809
  this._index = index2;
19810
19810
  return this;
19811
19811
  }, "send.index: pass index as option");
19812
- SendStream.prototype.root = function root2(path18) {
19813
- this._root = resolve(String(path18));
19812
+ SendStream.prototype.root = function root2(path19) {
19813
+ this._root = resolve(String(path19));
19814
19814
  debug("root %s", this._root);
19815
19815
  return this;
19816
19816
  };
@@ -19923,10 +19923,10 @@ var require_send = __commonJS({
19923
19923
  var lastModified = this.res.getHeader("Last-Modified");
19924
19924
  return parseHttpDate(lastModified) <= parseHttpDate(ifRange);
19925
19925
  };
19926
- SendStream.prototype.redirect = function redirect(path18) {
19926
+ SendStream.prototype.redirect = function redirect(path19) {
19927
19927
  var res = this.res;
19928
19928
  if (hasListeners(this, "directory")) {
19929
- this.emit("directory", res, path18);
19929
+ this.emit("directory", res, path19);
19930
19930
  return;
19931
19931
  }
19932
19932
  if (this.hasTrailingSlash()) {
@@ -19946,42 +19946,42 @@ var require_send = __commonJS({
19946
19946
  SendStream.prototype.pipe = function pipe(res) {
19947
19947
  var root2 = this._root;
19948
19948
  this.res = res;
19949
- var path18 = decode(this.path);
19950
- if (path18 === -1) {
19949
+ var path19 = decode(this.path);
19950
+ if (path19 === -1) {
19951
19951
  this.error(400);
19952
19952
  return res;
19953
19953
  }
19954
- if (~path18.indexOf("\0")) {
19954
+ if (~path19.indexOf("\0")) {
19955
19955
  this.error(400);
19956
19956
  return res;
19957
19957
  }
19958
19958
  var parts;
19959
19959
  if (root2 !== null) {
19960
- if (path18) {
19961
- path18 = normalize("." + sep + path18);
19960
+ if (path19) {
19961
+ path19 = normalize("." + sep + path19);
19962
19962
  }
19963
- if (UP_PATH_REGEXP.test(path18)) {
19964
- debug('malicious path "%s"', path18);
19963
+ if (UP_PATH_REGEXP.test(path19)) {
19964
+ debug('malicious path "%s"', path19);
19965
19965
  this.error(403);
19966
19966
  return res;
19967
19967
  }
19968
- parts = path18.split(sep);
19969
- path18 = normalize(join(root2, path18));
19968
+ parts = path19.split(sep);
19969
+ path19 = normalize(join(root2, path19));
19970
19970
  } else {
19971
- if (UP_PATH_REGEXP.test(path18)) {
19972
- debug('malicious path "%s"', path18);
19971
+ if (UP_PATH_REGEXP.test(path19)) {
19972
+ debug('malicious path "%s"', path19);
19973
19973
  this.error(403);
19974
19974
  return res;
19975
19975
  }
19976
- parts = normalize(path18).split(sep);
19977
- path18 = resolve(path18);
19976
+ parts = normalize(path19).split(sep);
19977
+ path19 = resolve(path19);
19978
19978
  }
19979
19979
  if (containsDotFile(parts)) {
19980
19980
  var access = this._dotfiles;
19981
19981
  if (access === void 0) {
19982
19982
  access = parts[parts.length - 1][0] === "." ? this._hidden ? "allow" : "ignore" : "allow";
19983
19983
  }
19984
- debug('%s dotfile "%s"', access, path18);
19984
+ debug('%s dotfile "%s"', access, path19);
19985
19985
  switch (access) {
19986
19986
  case "allow":
19987
19987
  break;
@@ -19995,13 +19995,13 @@ var require_send = __commonJS({
19995
19995
  }
19996
19996
  }
19997
19997
  if (this._index.length && this.hasTrailingSlash()) {
19998
- this.sendIndex(path18);
19998
+ this.sendIndex(path19);
19999
19999
  return res;
20000
20000
  }
20001
- this.sendFile(path18);
20001
+ this.sendFile(path19);
20002
20002
  return res;
20003
20003
  };
20004
- SendStream.prototype.send = function send2(path18, stat) {
20004
+ SendStream.prototype.send = function send2(path19, stat) {
20005
20005
  var len = stat.size;
20006
20006
  var options = this.options;
20007
20007
  var opts = {};
@@ -20013,9 +20013,9 @@ var require_send = __commonJS({
20013
20013
  this.headersAlreadySent();
20014
20014
  return;
20015
20015
  }
20016
- debug('pipe "%s"', path18);
20017
- this.setHeader(path18, stat);
20018
- this.type(path18);
20016
+ debug('pipe "%s"', path19);
20017
+ this.setHeader(path19, stat);
20018
+ this.type(path19);
20019
20019
  if (this.isConditionalGET()) {
20020
20020
  if (this.isPreconditionFailure()) {
20021
20021
  this.error(412);
@@ -20064,28 +20064,28 @@ var require_send = __commonJS({
20064
20064
  res.end();
20065
20065
  return;
20066
20066
  }
20067
- this.stream(path18, opts);
20067
+ this.stream(path19, opts);
20068
20068
  };
20069
- SendStream.prototype.sendFile = function sendFile(path18) {
20069
+ SendStream.prototype.sendFile = function sendFile(path19) {
20070
20070
  var i = 0;
20071
20071
  var self = this;
20072
- debug('stat "%s"', path18);
20073
- fs16.stat(path18, function onstat(err, stat) {
20074
- if (err && err.code === "ENOENT" && !extname(path18) && path18[path18.length - 1] !== sep) {
20072
+ debug('stat "%s"', path19);
20073
+ fs17.stat(path19, function onstat(err, stat) {
20074
+ if (err && err.code === "ENOENT" && !extname(path19) && path19[path19.length - 1] !== sep) {
20075
20075
  return next(err);
20076
20076
  }
20077
20077
  if (err) return self.onStatError(err);
20078
- if (stat.isDirectory()) return self.redirect(path18);
20079
- self.emit("file", path18, stat);
20080
- self.send(path18, stat);
20078
+ if (stat.isDirectory()) return self.redirect(path19);
20079
+ self.emit("file", path19, stat);
20080
+ self.send(path19, stat);
20081
20081
  });
20082
20082
  function next(err) {
20083
20083
  if (self._extensions.length <= i) {
20084
20084
  return err ? self.onStatError(err) : self.error(404);
20085
20085
  }
20086
- var p2 = path18 + "." + self._extensions[i++];
20086
+ var p2 = path19 + "." + self._extensions[i++];
20087
20087
  debug('stat "%s"', p2);
20088
- fs16.stat(p2, function(err2, stat) {
20088
+ fs17.stat(p2, function(err2, stat) {
20089
20089
  if (err2) return next(err2);
20090
20090
  if (stat.isDirectory()) return next();
20091
20091
  self.emit("file", p2, stat);
@@ -20093,7 +20093,7 @@ var require_send = __commonJS({
20093
20093
  });
20094
20094
  }
20095
20095
  };
20096
- SendStream.prototype.sendIndex = function sendIndex(path18) {
20096
+ SendStream.prototype.sendIndex = function sendIndex(path19) {
20097
20097
  var i = -1;
20098
20098
  var self = this;
20099
20099
  function next(err) {
@@ -20101,9 +20101,9 @@ var require_send = __commonJS({
20101
20101
  if (err) return self.onStatError(err);
20102
20102
  return self.error(404);
20103
20103
  }
20104
- var p2 = join(path18, self._index[i]);
20104
+ var p2 = join(path19, self._index[i]);
20105
20105
  debug('stat "%s"', p2);
20106
- fs16.stat(p2, function(err2, stat) {
20106
+ fs17.stat(p2, function(err2, stat) {
20107
20107
  if (err2) return next(err2);
20108
20108
  if (stat.isDirectory()) return next();
20109
20109
  self.emit("file", p2, stat);
@@ -20112,10 +20112,10 @@ var require_send = __commonJS({
20112
20112
  }
20113
20113
  next();
20114
20114
  };
20115
- SendStream.prototype.stream = function stream(path18, options) {
20115
+ SendStream.prototype.stream = function stream(path19, options) {
20116
20116
  var self = this;
20117
20117
  var res = this.res;
20118
- var stream2 = fs16.createReadStream(path18, options);
20118
+ var stream2 = fs17.createReadStream(path19, options);
20119
20119
  this.emit("stream", stream2);
20120
20120
  stream2.pipe(res);
20121
20121
  function cleanup() {
@@ -20130,10 +20130,10 @@ var require_send = __commonJS({
20130
20130
  self.emit("end");
20131
20131
  });
20132
20132
  };
20133
- SendStream.prototype.type = function type(path18) {
20133
+ SendStream.prototype.type = function type(path19) {
20134
20134
  var res = this.res;
20135
20135
  if (res.getHeader("Content-Type")) return;
20136
- var type2 = mime.lookup(path18);
20136
+ var type2 = mime.lookup(path19);
20137
20137
  if (!type2) {
20138
20138
  debug("no content-type");
20139
20139
  return;
@@ -20142,9 +20142,9 @@ var require_send = __commonJS({
20142
20142
  debug("content-type %s", type2);
20143
20143
  res.setHeader("Content-Type", type2 + (charset ? "; charset=" + charset : ""));
20144
20144
  };
20145
- SendStream.prototype.setHeader = function setHeader(path18, stat) {
20145
+ SendStream.prototype.setHeader = function setHeader(path19, stat) {
20146
20146
  var res = this.res;
20147
- this.emit("headers", res, path18, stat);
20147
+ this.emit("headers", res, path19, stat);
20148
20148
  if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
20149
20149
  debug("accept ranges");
20150
20150
  res.setHeader("Accept-Ranges", "bytes");
@@ -20203,9 +20203,9 @@ var require_send = __commonJS({
20203
20203
  }
20204
20204
  return err instanceof Error ? createError(status2, err, { expose: false }) : createError(status2, err);
20205
20205
  }
20206
- function decode(path18) {
20206
+ function decode(path19) {
20207
20207
  try {
20208
- return decodeURIComponent(path18);
20208
+ return decodeURIComponent(path19);
20209
20209
  } catch (err) {
20210
20210
  return -1;
20211
20211
  }
@@ -21130,10 +21130,10 @@ var require_utils2 = __commonJS({
21130
21130
  var querystring = __require("querystring");
21131
21131
  exports.etag = createETagGenerator({ weak: false });
21132
21132
  exports.wetag = createETagGenerator({ weak: true });
21133
- exports.isAbsolute = function(path17) {
21134
- if ("/" === path17[0]) return true;
21135
- if (":" === path17[1] && ("\\" === path17[2] || "/" === path17[2])) return true;
21136
- if ("\\\\" === path17.substring(0, 2)) return true;
21133
+ exports.isAbsolute = function(path18) {
21134
+ if ("/" === path18[0]) return true;
21135
+ if (":" === path18[1] && ("\\" === path18[2] || "/" === path18[2])) return true;
21136
+ if ("\\\\" === path18.substring(0, 2)) return true;
21137
21137
  };
21138
21138
  exports.flatten = deprecate.function(
21139
21139
  flatten,
@@ -21345,7 +21345,7 @@ var require_application = __commonJS({
21345
21345
  };
21346
21346
  app2.use = function use(fn) {
21347
21347
  var offset = 0;
21348
- var path17 = "/";
21348
+ var path18 = "/";
21349
21349
  if (typeof fn !== "function") {
21350
21350
  var arg = fn;
21351
21351
  while (Array.isArray(arg) && arg.length !== 0) {
@@ -21353,7 +21353,7 @@ var require_application = __commonJS({
21353
21353
  }
21354
21354
  if (typeof arg !== "function") {
21355
21355
  offset = 1;
21356
- path17 = fn;
21356
+ path18 = fn;
21357
21357
  }
21358
21358
  }
21359
21359
  var fns = flatten(slice.call(arguments, offset));
@@ -21364,12 +21364,12 @@ var require_application = __commonJS({
21364
21364
  var router = this._router;
21365
21365
  fns.forEach(function(fn2) {
21366
21366
  if (!fn2 || !fn2.handle || !fn2.set) {
21367
- return router.use(path17, fn2);
21367
+ return router.use(path18, fn2);
21368
21368
  }
21369
- debug(".use app under %s", path17);
21370
- fn2.mountpath = path17;
21369
+ debug(".use app under %s", path18);
21370
+ fn2.mountpath = path18;
21371
21371
  fn2.parent = this;
21372
- router.use(path17, function mounted_app(req, res, next) {
21372
+ router.use(path18, function mounted_app(req, res, next) {
21373
21373
  var orig = req.app;
21374
21374
  fn2.handle(req, res, function(err) {
21375
21375
  setPrototypeOf(req, orig.request);
@@ -21381,9 +21381,9 @@ var require_application = __commonJS({
21381
21381
  }, this);
21382
21382
  return this;
21383
21383
  };
21384
- app2.route = function route(path17) {
21384
+ app2.route = function route(path18) {
21385
21385
  this.lazyrouter();
21386
- return this._router.route(path17);
21386
+ return this._router.route(path18);
21387
21387
  };
21388
21388
  app2.engine = function engine(ext, fn) {
21389
21389
  if (typeof fn !== "function") {
@@ -21434,7 +21434,7 @@ var require_application = __commonJS({
21434
21434
  }
21435
21435
  return this;
21436
21436
  };
21437
- app2.path = function path17() {
21437
+ app2.path = function path18() {
21438
21438
  return this.parent ? this.parent.path() + this.mountpath : "";
21439
21439
  };
21440
21440
  app2.enabled = function enabled(setting) {
@@ -21450,19 +21450,19 @@ var require_application = __commonJS({
21450
21450
  return this.set(setting, false);
21451
21451
  };
21452
21452
  methods.forEach(function(method) {
21453
- app2[method] = function(path17) {
21453
+ app2[method] = function(path18) {
21454
21454
  if (method === "get" && arguments.length === 1) {
21455
- return this.set(path17);
21455
+ return this.set(path18);
21456
21456
  }
21457
21457
  this.lazyrouter();
21458
- var route = this._router.route(path17);
21458
+ var route = this._router.route(path18);
21459
21459
  route[method].apply(route, slice.call(arguments, 1));
21460
21460
  return this;
21461
21461
  };
21462
21462
  });
21463
- app2.all = function all(path17) {
21463
+ app2.all = function all(path18) {
21464
21464
  this.lazyrouter();
21465
- var route = this._router.route(path17);
21465
+ var route = this._router.route(path18);
21466
21466
  var args = slice.call(arguments, 1);
21467
21467
  for (var i = 0; i < methods.length; i++) {
21468
21468
  route[methods[i]].apply(route, args);
@@ -21476,7 +21476,7 @@ var require_application = __commonJS({
21476
21476
  var engines = this.engines;
21477
21477
  var opts = options;
21478
21478
  var renderOptions = {};
21479
- var view;
21479
+ var view2;
21480
21480
  if (typeof options === "function") {
21481
21481
  done = options;
21482
21482
  opts = {};
@@ -21490,26 +21490,26 @@ var require_application = __commonJS({
21490
21490
  renderOptions.cache = this.enabled("view cache");
21491
21491
  }
21492
21492
  if (renderOptions.cache) {
21493
- view = cache3[name];
21493
+ view2 = cache3[name];
21494
21494
  }
21495
- if (!view) {
21495
+ if (!view2) {
21496
21496
  var View2 = this.get("view");
21497
- view = new View2(name, {
21497
+ view2 = new View2(name, {
21498
21498
  defaultEngine: this.get("view engine"),
21499
21499
  root: this.get("views"),
21500
21500
  engines
21501
21501
  });
21502
- if (!view.path) {
21503
- var dirs = Array.isArray(view.root) && view.root.length > 1 ? 'directories "' + view.root.slice(0, -1).join('", "') + '" or "' + view.root[view.root.length - 1] + '"' : 'directory "' + view.root + '"';
21502
+ if (!view2.path) {
21503
+ var dirs = Array.isArray(view2.root) && view2.root.length > 1 ? 'directories "' + view2.root.slice(0, -1).join('", "') + '" or "' + view2.root[view2.root.length - 1] + '"' : 'directory "' + view2.root + '"';
21504
21504
  var err = new Error('Failed to lookup view "' + name + '" in views ' + dirs);
21505
- err.view = view;
21505
+ err.view = view2;
21506
21506
  return done(err);
21507
21507
  }
21508
21508
  if (renderOptions.cache) {
21509
- cache3[name] = view;
21509
+ cache3[name] = view2;
21510
21510
  }
21511
21511
  }
21512
- tryRender(view, renderOptions, done);
21512
+ tryRender(view2, renderOptions, done);
21513
21513
  };
21514
21514
  app2.listen = function listen2() {
21515
21515
  var server2 = http.createServer(this);
@@ -21518,9 +21518,9 @@ var require_application = __commonJS({
21518
21518
  function logerror(err) {
21519
21519
  if (this.get("env") !== "test") console.error(err.stack || err.toString());
21520
21520
  }
21521
- function tryRender(view, options, callback) {
21521
+ function tryRender(view2, options, callback) {
21522
21522
  try {
21523
- view.render(options, callback);
21523
+ view2.render(options, callback);
21524
21524
  } catch (err) {
21525
21525
  callback(err);
21526
21526
  }
@@ -22221,7 +22221,7 @@ var require_request = __commonJS({
22221
22221
  var subdomains2 = !isIP(hostname) ? hostname.split(".").reverse() : [hostname];
22222
22222
  return subdomains2.slice(offset);
22223
22223
  });
22224
- defineGetter(req, "path", function path17() {
22224
+ defineGetter(req, "path", function path18() {
22225
22225
  return parse(this).pathname;
22226
22226
  });
22227
22227
  defineGetter(req, "hostname", function hostname() {
@@ -22273,11 +22273,11 @@ var require_request = __commonJS({
22273
22273
  // ../../../../../../../../../../Source code/git-transfer/goldynlabs/clauder-hub/node_modules/cookie-signature/index.js
22274
22274
  var require_cookie_signature = __commonJS({
22275
22275
  "../../../../../../../../../../Source code/git-transfer/goldynlabs/clauder-hub/node_modules/cookie-signature/index.js"(exports) {
22276
- var crypto2 = __require("crypto");
22276
+ var crypto3 = __require("crypto");
22277
22277
  exports.sign = function(val, secret) {
22278
22278
  if ("string" !== typeof val) throw new TypeError("Cookie value must be provided as a string.");
22279
22279
  if (null == secret) throw new TypeError("Secret key must be provided.");
22280
- return val + "." + crypto2.createHmac("sha256", secret).update(val).digest("base64").replace(/\=+$/, "");
22280
+ return val + "." + crypto3.createHmac("sha256", secret).update(val).digest("base64").replace(/\=+$/, "");
22281
22281
  };
22282
22282
  exports.unsign = function(val, secret) {
22283
22283
  if ("string" !== typeof val) throw new TypeError("Signed cookie string must be provided.");
@@ -22286,7 +22286,7 @@ var require_cookie_signature = __commonJS({
22286
22286
  return sha1(mac) == sha1(val) ? str : false;
22287
22287
  };
22288
22288
  function sha1(str) {
22289
- return crypto2.createHash("sha1").update(str).digest("hex");
22289
+ return crypto3.createHash("sha1").update(str).digest("hex");
22290
22290
  }
22291
22291
  }
22292
22292
  });
@@ -22470,7 +22470,7 @@ var require_response = __commonJS({
22470
22470
  var http = __require("http");
22471
22471
  var isAbsolute = require_utils2().isAbsolute;
22472
22472
  var onFinished = require_on_finished();
22473
- var path17 = __require("path");
22473
+ var path18 = __require("path");
22474
22474
  var statuses = require_statuses();
22475
22475
  var merge = require_utils_merge();
22476
22476
  var sign = require_cookie_signature().sign;
@@ -22479,9 +22479,9 @@ var require_response = __commonJS({
22479
22479
  var setCharset = require_utils2().setCharset;
22480
22480
  var cookie = require_cookie();
22481
22481
  var send = require_send();
22482
- var extname = path17.extname;
22482
+ var extname = path18.extname;
22483
22483
  var mime = send.mime;
22484
- var resolve = path17.resolve;
22484
+ var resolve = path18.resolve;
22485
22485
  var vary = require_vary();
22486
22486
  var res = Object.create(http.ServerResponse.prototype);
22487
22487
  module.exports = res;
@@ -22658,26 +22658,26 @@ var require_response = __commonJS({
22658
22658
  this.type("txt");
22659
22659
  return this.send(body);
22660
22660
  };
22661
- res.sendFile = function sendFile(path18, options, callback) {
22661
+ res.sendFile = function sendFile(path19, options, callback) {
22662
22662
  var done = callback;
22663
22663
  var req = this.req;
22664
22664
  var res2 = this;
22665
22665
  var next = req.next;
22666
22666
  var opts = options || {};
22667
- if (!path18) {
22667
+ if (!path19) {
22668
22668
  throw new TypeError("path argument is required to res.sendFile");
22669
22669
  }
22670
- if (typeof path18 !== "string") {
22670
+ if (typeof path19 !== "string") {
22671
22671
  throw new TypeError("path must be a string to res.sendFile");
22672
22672
  }
22673
22673
  if (typeof options === "function") {
22674
22674
  done = options;
22675
22675
  opts = {};
22676
22676
  }
22677
- if (!opts.root && !isAbsolute(path18)) {
22677
+ if (!opts.root && !isAbsolute(path19)) {
22678
22678
  throw new TypeError("path must be absolute or specify root to res.sendFile");
22679
22679
  }
22680
- var pathname = encodeURI(path18);
22680
+ var pathname = encodeURI(path19);
22681
22681
  var file = send(req, pathname, opts);
22682
22682
  sendfile(res2, file, opts, function(err) {
22683
22683
  if (done) return done(err);
@@ -22687,7 +22687,7 @@ var require_response = __commonJS({
22687
22687
  }
22688
22688
  });
22689
22689
  };
22690
- res.sendfile = function(path18, options, callback) {
22690
+ res.sendfile = function(path19, options, callback) {
22691
22691
  var done = callback;
22692
22692
  var req = this.req;
22693
22693
  var res2 = this;
@@ -22697,7 +22697,7 @@ var require_response = __commonJS({
22697
22697
  done = options;
22698
22698
  opts = {};
22699
22699
  }
22700
- var file = send(req, path18, opts);
22700
+ var file = send(req, path19, opts);
22701
22701
  sendfile(res2, file, opts, function(err) {
22702
22702
  if (done) return done(err);
22703
22703
  if (err && err.code === "EISDIR") return next();
@@ -22710,7 +22710,7 @@ var require_response = __commonJS({
22710
22710
  res.sendfile,
22711
22711
  "res.sendfile: Use res.sendFile instead"
22712
22712
  );
22713
- res.download = function download(path18, filename, options, callback) {
22713
+ res.download = function download(path19, filename, options, callback) {
22714
22714
  var done = callback;
22715
22715
  var name = filename;
22716
22716
  var opts = options || null;
@@ -22727,7 +22727,7 @@ var require_response = __commonJS({
22727
22727
  opts = filename;
22728
22728
  }
22729
22729
  var headers = {
22730
- "Content-Disposition": contentDisposition(name || path18)
22730
+ "Content-Disposition": contentDisposition(name || path19)
22731
22731
  };
22732
22732
  if (opts && opts.headers) {
22733
22733
  var keys = Object.keys(opts.headers);
@@ -22740,7 +22740,7 @@ var require_response = __commonJS({
22740
22740
  }
22741
22741
  opts = Object.create(opts);
22742
22742
  opts.headers = headers;
22743
- var fullPath = !opts.root ? resolve(path18) : path18;
22743
+ var fullPath = !opts.root ? resolve(path19) : path19;
22744
22744
  return this.sendFile(fullPath, opts, done);
22745
22745
  };
22746
22746
  res.contentType = res.type = function contentType(type) {
@@ -22895,7 +22895,7 @@ var require_response = __commonJS({
22895
22895
  vary(this, field);
22896
22896
  return this;
22897
22897
  };
22898
- res.render = function render2(view, options, callback) {
22898
+ res.render = function render2(view2, options, callback) {
22899
22899
  var app2 = this.req.app;
22900
22900
  var done = callback;
22901
22901
  var opts = options || {};
@@ -22910,7 +22910,7 @@ var require_response = __commonJS({
22910
22910
  if (err) return req.next(err);
22911
22911
  self.send(str);
22912
22912
  };
22913
- app2.render(view, opts, done);
22913
+ app2.render(view2, opts, done);
22914
22914
  };
22915
22915
  function sendfile(res2, file, options, callback) {
22916
22916
  var done = false;
@@ -23041,11 +23041,11 @@ var require_serve_static = __commonJS({
23041
23041
  }
23042
23042
  var forwardError = !fallthrough;
23043
23043
  var originalUrl = parseUrl.original(req);
23044
- var path17 = parseUrl(req).pathname;
23045
- if (path17 === "/" && originalUrl.pathname.substr(-1) !== "/") {
23046
- path17 = "";
23044
+ var path18 = parseUrl(req).pathname;
23045
+ if (path18 === "/" && originalUrl.pathname.substr(-1) !== "/") {
23046
+ path18 = "";
23047
23047
  }
23048
- var stream = send(req, path17, opts);
23048
+ var stream = send(req, path18, opts);
23049
23049
  stream.on("directory", onDirectory);
23050
23050
  if (setHeaders) {
23051
23051
  stream.on("headers", setHeaders);
@@ -23225,14 +23225,14 @@ var require_buffer_util = __commonJS({
23225
23225
  }
23226
23226
  return target2;
23227
23227
  }
23228
- function _mask(source, mask, output, offset, length) {
23228
+ function _mask(source, mask2, output, offset, length) {
23229
23229
  for (let i = 0; i < length; i++) {
23230
- output[offset + i] = source[i] ^ mask[i & 3];
23230
+ output[offset + i] = source[i] ^ mask2[i & 3];
23231
23231
  }
23232
23232
  }
23233
- function _unmask(buffer, mask) {
23233
+ function _unmask(buffer, mask2) {
23234
23234
  for (let i = 0; i < buffer.length; i++) {
23235
- buffer[i] ^= mask[i & 3];
23235
+ buffer[i] ^= mask2[i & 3];
23236
23236
  }
23237
23237
  }
23238
23238
  function toArrayBuffer(buf) {
@@ -23265,13 +23265,13 @@ var require_buffer_util = __commonJS({
23265
23265
  if (!process.env.WS_NO_BUFFER_UTIL) {
23266
23266
  try {
23267
23267
  const bufferUtil = __require("bufferutil");
23268
- module.exports.mask = function(source, mask, output, offset, length) {
23269
- if (length < 48) _mask(source, mask, output, offset, length);
23270
- else bufferUtil.mask(source, mask, output, offset, length);
23268
+ module.exports.mask = function(source, mask2, output, offset, length) {
23269
+ if (length < 48) _mask(source, mask2, output, offset, length);
23270
+ else bufferUtil.mask(source, mask2, output, offset, length);
23271
23271
  };
23272
- module.exports.unmask = function(buffer, mask) {
23273
- if (buffer.length < 32) _unmask(buffer, mask);
23274
- else bufferUtil.unmask(buffer, mask);
23272
+ module.exports.unmask = function(buffer, mask2) {
23273
+ if (buffer.length < 32) _unmask(buffer, mask2);
23274
+ else bufferUtil.unmask(buffer, mask2);
23275
23275
  };
23276
23276
  } catch (e) {
23277
23277
  }
@@ -24603,14 +24603,14 @@ var require_sender = __commonJS({
24603
24603
  * @public
24604
24604
  */
24605
24605
  static frame(data, options) {
24606
- let mask;
24606
+ let mask2;
24607
24607
  let merge = false;
24608
24608
  let offset = 2;
24609
24609
  let skipMasking = false;
24610
24610
  if (options.mask) {
24611
- mask = options.maskBuffer || maskBuffer;
24611
+ mask2 = options.maskBuffer || maskBuffer;
24612
24612
  if (options.generateMask) {
24613
- options.generateMask(mask);
24613
+ options.generateMask(mask2);
24614
24614
  } else {
24615
24615
  if (randomPoolPointer === RANDOM_POOL_SIZE) {
24616
24616
  if (randomPool === void 0) {
@@ -24619,12 +24619,12 @@ var require_sender = __commonJS({
24619
24619
  randomFillSync(randomPool, 0, RANDOM_POOL_SIZE);
24620
24620
  randomPoolPointer = 0;
24621
24621
  }
24622
- mask[0] = randomPool[randomPoolPointer++];
24623
- mask[1] = randomPool[randomPoolPointer++];
24624
- mask[2] = randomPool[randomPoolPointer++];
24625
- mask[3] = randomPool[randomPoolPointer++];
24622
+ mask2[0] = randomPool[randomPoolPointer++];
24623
+ mask2[1] = randomPool[randomPoolPointer++];
24624
+ mask2[2] = randomPool[randomPoolPointer++];
24625
+ mask2[3] = randomPool[randomPoolPointer++];
24626
24626
  }
24627
- skipMasking = (mask[0] | mask[1] | mask[2] | mask[3]) === 0;
24627
+ skipMasking = (mask2[0] | mask2[1] | mask2[2] | mask2[3]) === 0;
24628
24628
  offset = 6;
24629
24629
  }
24630
24630
  let dataLength;
@@ -24659,16 +24659,16 @@ var require_sender = __commonJS({
24659
24659
  }
24660
24660
  if (!options.mask) return [target2, data];
24661
24661
  target2[1] |= 128;
24662
- target2[offset - 4] = mask[0];
24663
- target2[offset - 3] = mask[1];
24664
- target2[offset - 2] = mask[2];
24665
- target2[offset - 1] = mask[3];
24662
+ target2[offset - 4] = mask2[0];
24663
+ target2[offset - 3] = mask2[1];
24664
+ target2[offset - 2] = mask2[2];
24665
+ target2[offset - 1] = mask2[3];
24666
24666
  if (skipMasking) return [target2, data];
24667
24667
  if (merge) {
24668
- applyMask(data, mask, target2, offset, dataLength);
24668
+ applyMask(data, mask2, target2, offset, dataLength);
24669
24669
  return [target2];
24670
24670
  }
24671
- applyMask(data, mask, data, 0, dataLength);
24671
+ applyMask(data, mask2, data, 0, dataLength);
24672
24672
  return [target2, data];
24673
24673
  }
24674
24674
  /**
@@ -24680,7 +24680,7 @@ var require_sender = __commonJS({
24680
24680
  * @param {Function} [cb] Callback
24681
24681
  * @public
24682
24682
  */
24683
- close(code, data, mask, cb) {
24683
+ close(code, data, mask2, cb) {
24684
24684
  let buf;
24685
24685
  if (code === void 0) {
24686
24686
  buf = EMPTY_BUFFER;
@@ -24708,7 +24708,7 @@ var require_sender = __commonJS({
24708
24708
  [kByteLength]: buf.length,
24709
24709
  fin: true,
24710
24710
  generateMask: this._generateMask,
24711
- mask,
24711
+ mask: mask2,
24712
24712
  maskBuffer: this._maskBuffer,
24713
24713
  opcode: 8,
24714
24714
  readOnly: false,
@@ -24728,7 +24728,7 @@ var require_sender = __commonJS({
24728
24728
  * @param {Function} [cb] Callback
24729
24729
  * @public
24730
24730
  */
24731
- ping(data, mask, cb) {
24731
+ ping(data, mask2, cb) {
24732
24732
  let byteLength;
24733
24733
  let readOnly;
24734
24734
  if (typeof data === "string") {
@@ -24749,7 +24749,7 @@ var require_sender = __commonJS({
24749
24749
  [kByteLength]: byteLength,
24750
24750
  fin: true,
24751
24751
  generateMask: this._generateMask,
24752
- mask,
24752
+ mask: mask2,
24753
24753
  maskBuffer: this._maskBuffer,
24754
24754
  opcode: 9,
24755
24755
  readOnly,
@@ -24775,7 +24775,7 @@ var require_sender = __commonJS({
24775
24775
  * @param {Function} [cb] Callback
24776
24776
  * @public
24777
24777
  */
24778
- pong(data, mask, cb) {
24778
+ pong(data, mask2, cb) {
24779
24779
  let byteLength;
24780
24780
  let readOnly;
24781
24781
  if (typeof data === "string") {
@@ -24796,7 +24796,7 @@ var require_sender = __commonJS({
24796
24796
  [kByteLength]: byteLength,
24797
24797
  fin: true,
24798
24798
  generateMask: this._generateMask,
24799
- mask,
24799
+ mask: mask2,
24800
24800
  maskBuffer: this._maskBuffer,
24801
24801
  opcode: 10,
24802
24802
  readOnly,
@@ -25719,24 +25719,24 @@ var require_websocket = __commonJS({
25719
25719
  * @param {Function} [cb] Callback which is executed when the ping is sent
25720
25720
  * @public
25721
25721
  */
25722
- ping(data, mask, cb) {
25722
+ ping(data, mask2, cb) {
25723
25723
  if (this.readyState === _WebSocket.CONNECTING) {
25724
25724
  throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
25725
25725
  }
25726
25726
  if (typeof data === "function") {
25727
25727
  cb = data;
25728
- data = mask = void 0;
25729
- } else if (typeof mask === "function") {
25730
- cb = mask;
25731
- mask = void 0;
25728
+ data = mask2 = void 0;
25729
+ } else if (typeof mask2 === "function") {
25730
+ cb = mask2;
25731
+ mask2 = void 0;
25732
25732
  }
25733
25733
  if (typeof data === "number") data = data.toString();
25734
25734
  if (this.readyState !== _WebSocket.OPEN) {
25735
25735
  sendAfterClose(this, data, cb);
25736
25736
  return;
25737
25737
  }
25738
- if (mask === void 0) mask = !this._isServer;
25739
- this._sender.ping(data || EMPTY_BUFFER, mask, cb);
25738
+ if (mask2 === void 0) mask2 = !this._isServer;
25739
+ this._sender.ping(data || EMPTY_BUFFER, mask2, cb);
25740
25740
  }
25741
25741
  /**
25742
25742
  * Send a pong.
@@ -25746,24 +25746,24 @@ var require_websocket = __commonJS({
25746
25746
  * @param {Function} [cb] Callback which is executed when the pong is sent
25747
25747
  * @public
25748
25748
  */
25749
- pong(data, mask, cb) {
25749
+ pong(data, mask2, cb) {
25750
25750
  if (this.readyState === _WebSocket.CONNECTING) {
25751
25751
  throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
25752
25752
  }
25753
25753
  if (typeof data === "function") {
25754
25754
  cb = data;
25755
- data = mask = void 0;
25756
- } else if (typeof mask === "function") {
25757
- cb = mask;
25758
- mask = void 0;
25755
+ data = mask2 = void 0;
25756
+ } else if (typeof mask2 === "function") {
25757
+ cb = mask2;
25758
+ mask2 = void 0;
25759
25759
  }
25760
25760
  if (typeof data === "number") data = data.toString();
25761
25761
  if (this.readyState !== _WebSocket.OPEN) {
25762
25762
  sendAfterClose(this, data, cb);
25763
25763
  return;
25764
25764
  }
25765
- if (mask === void 0) mask = !this._isServer;
25766
- this._sender.pong(data || EMPTY_BUFFER, mask, cb);
25765
+ if (mask2 === void 0) mask2 = !this._isServer;
25766
+ this._sender.pong(data || EMPTY_BUFFER, mask2, cb);
25767
25767
  }
25768
25768
  /**
25769
25769
  * Resume the socket.
@@ -27772,26 +27772,26 @@ var require_ignore = __commonJS({
27772
27772
  const index = body.indexOf(SLASH);
27773
27773
  return index < 0 || index === body.length - 1;
27774
27774
  };
27775
- var basenameOf = (path17) => {
27776
- const end = path17.length - 1;
27777
- const index = path17.lastIndexOf(
27775
+ var basenameOf = (path18) => {
27776
+ const end = path18.length - 1;
27777
+ const index = path18.lastIndexOf(
27778
27778
  SLASH,
27779
- path17[end] === SLASH ? end - 1 : end
27779
+ path18[end] === SLASH ? end - 1 : end
27780
27780
  );
27781
- return index < 0 ? path17 : path17.slice(index + 1);
27781
+ return index < 0 ? path18 : path18.slice(index + 1);
27782
27782
  };
27783
- var parentOf = (path17) => {
27784
- if (path17.charCodeAt(0) === SLASH_CODE || path17.indexOf(DOUBLE_SLASH) >= 0) {
27785
- const slices = path17.split(SLASH).filter(Boolean);
27783
+ var parentOf = (path18) => {
27784
+ if (path18.charCodeAt(0) === SLASH_CODE || path18.indexOf(DOUBLE_SLASH) >= 0) {
27785
+ const slices = path18.split(SLASH).filter(Boolean);
27786
27786
  slices.pop();
27787
27787
  return slices.length ? slices.join(SLASH) + SLASH : EMPTY;
27788
27788
  }
27789
- const end = path17.length - 1;
27790
- const cut = path17.lastIndexOf(
27789
+ const end = path18.length - 1;
27790
+ const cut = path18.lastIndexOf(
27791
27791
  SLASH,
27792
- path17.charCodeAt(end) === SLASH_CODE ? end - 1 : end
27792
+ path18.charCodeAt(end) === SLASH_CODE ? end - 1 : end
27793
27793
  );
27794
- return cut < 0 ? EMPTY : path17.slice(0, cut + 1);
27794
+ return cut < 0 ? EMPTY : path18.slice(0, cut + 1);
27795
27795
  };
27796
27796
  var isString = (subject) => typeof subject === "string";
27797
27797
  var checkPattern = (pattern) => pattern && isString(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern);
@@ -27926,7 +27926,7 @@ var require_ignore = __commonJS({
27926
27926
  // Match the literal 'abc/' for `checkIgnore`, last rule wins. Only a rule
27927
27927
  // ending in a wildcard can match it (see `checkSourceOf`), so the rest
27928
27928
  // are left out once, rather than tested or compiled for every path.
27929
- testLiteral(path17) {
27929
+ testLiteral(path18) {
27930
27930
  const rules = this._literalRules || (this._literalRules = this._rules.filter(
27931
27931
  ({ body }) => body[body.length - (body[body.length - 1] === SLASH ? 2 : 1)] === "*"
27932
27932
  ));
@@ -27935,7 +27935,7 @@ var require_ignore = __commonJS({
27935
27935
  let matchedRule;
27936
27936
  for (let index = rules.length - 1; index >= 0; index--) {
27937
27937
  const rule = rules[index];
27938
- if (rule.checkRegex.test(path17)) {
27938
+ if (rule.checkRegex.test(path18)) {
27939
27939
  ignored = !rule.negative;
27940
27940
  unignored = rule.negative;
27941
27941
  matchedRule = rule.negative ? UNDEFINED : rule;
@@ -27955,15 +27955,15 @@ var require_ignore = __commonJS({
27955
27955
  //
27956
27956
  // - mode `string` either `MODE_IGNORE` or `MODE_CHECK_IGNORE`
27957
27957
  // @returns {TestResult}
27958
- test(path17, mode) {
27958
+ test(path18, mode) {
27959
27959
  const rules = this._rules;
27960
27960
  const { length } = rules;
27961
27961
  const shortcut = this._basenameCount * 2 >= length;
27962
- const basename = shortcut ? basenameOf(path17) : path17;
27962
+ const basename = shortcut ? basenameOf(path18) : path18;
27963
27963
  for (let index = length - 1; index >= 0; index--) {
27964
27964
  const rule = rules[index];
27965
27965
  if (rule[mode].test(
27966
- shortcut && rule._basenameOnly ? basename : path17
27966
+ shortcut && rule._basenameOnly ? basename : path18
27967
27967
  )) {
27968
27968
  const { negative } = rule;
27969
27969
  const ret = {
@@ -27985,17 +27985,17 @@ var require_ignore = __commonJS({
27985
27985
  var throwError = (message, Ctor) => {
27986
27986
  throw new Ctor(message);
27987
27987
  };
27988
- var checkPath = (path17, originalPath, doThrow) => {
27989
- if (!isString(path17)) {
27988
+ var checkPath = (path18, originalPath, doThrow) => {
27989
+ if (!isString(path18)) {
27990
27990
  return doThrow(
27991
27991
  `path must be a string, but got \`${originalPath}\``,
27992
27992
  TypeError
27993
27993
  );
27994
27994
  }
27995
- if (!path17) {
27995
+ if (!path18) {
27996
27996
  return doThrow(`path must not be empty`, TypeError);
27997
27997
  }
27998
- if (checkPath.isNotRelative(path17)) {
27998
+ if (checkPath.isNotRelative(path18)) {
27999
27999
  const r = "`path.relative()`d";
28000
28000
  return doThrow(
28001
28001
  `path should be a ${r} string, but got "${originalPath}"`,
@@ -28004,25 +28004,25 @@ var require_ignore = __commonJS({
28004
28004
  }
28005
28005
  return true;
28006
28006
  };
28007
- var isNotRelative = (path17) => {
28008
- const first = path17.charCodeAt(0);
28007
+ var isNotRelative = (path18) => {
28008
+ const first = path18.charCodeAt(0);
28009
28009
  if (first === SLASH_CODE) {
28010
28010
  return true;
28011
28011
  }
28012
28012
  if (first !== DOT_CODE) {
28013
28013
  return false;
28014
28014
  }
28015
- if (path17.length === 1) {
28015
+ if (path18.length === 1) {
28016
28016
  return true;
28017
28017
  }
28018
- const second = path17.charCodeAt(1);
28018
+ const second = path18.charCodeAt(1);
28019
28019
  if (second === SLASH_CODE) {
28020
28020
  return true;
28021
28021
  }
28022
28022
  if (second !== DOT_CODE) {
28023
28023
  return false;
28024
28024
  }
28025
- return path17.length === 2 || path17.charCodeAt(2) === SLASH_CODE;
28025
+ return path18.length === 2 || path18.charCodeAt(2) === SLASH_CODE;
28026
28026
  };
28027
28027
  checkPath.isNotRelative = isNotRelative;
28028
28028
  checkPath.convert = (p2) => p2;
@@ -28053,54 +28053,54 @@ var require_ignore = __commonJS({
28053
28053
  }
28054
28054
  // @returns {TestResult}
28055
28055
  _test(originalPath, cache3) {
28056
- const path17 = originalPath && checkPath.convert(originalPath);
28056
+ const path18 = originalPath && checkPath.convert(originalPath);
28057
28057
  checkPath(
28058
- path17,
28058
+ path18,
28059
28059
  originalPath,
28060
28060
  this._strictPathCheck ? throwError : RETURN_FALSE
28061
28061
  );
28062
- return this._t(path17, cache3);
28062
+ return this._t(path18, cache3);
28063
28063
  }
28064
- checkIgnore(path17) {
28065
- if (path17.charCodeAt(path17.length - 1) !== SLASH_CODE) {
28066
- return this.test(path17);
28064
+ checkIgnore(path18) {
28065
+ if (path18.charCodeAt(path18.length - 1) !== SLASH_CODE) {
28066
+ return this.test(path18);
28067
28067
  }
28068
- const dir = this._t(path17, this._testCache);
28068
+ const dir = this._t(path18, this._testCache);
28069
28069
  if (dir.ignored) {
28070
28070
  return dir;
28071
28071
  }
28072
- const literal = this._rules.testLiteral(path17);
28072
+ const literal = this._rules.testLiteral(path18);
28073
28073
  return literal.ignored || literal.unignored ? literal : dir;
28074
28074
  }
28075
- _t(path17, cache3) {
28076
- if (path17 in cache3) {
28077
- return cache3[path17];
28075
+ _t(path18, cache3) {
28076
+ if (path18 in cache3) {
28077
+ return cache3[path18];
28078
28078
  }
28079
- const parentPath = parentOf(path17);
28079
+ const parentPath = parentOf(path18);
28080
28080
  const parent = parentPath ? this._t(parentPath, cache3) : UNDEFINED;
28081
- return cache3[path17] = parent && parent.ignored ? parent : this._rules.test(path17, MODE_IGNORE);
28081
+ return cache3[path18] = parent && parent.ignored ? parent : this._rules.test(path18, MODE_IGNORE);
28082
28082
  }
28083
- ignores(path17) {
28084
- return this._test(path17, this._ignoreCache).ignored;
28083
+ ignores(path18) {
28084
+ return this._test(path18, this._ignoreCache).ignored;
28085
28085
  }
28086
28086
  createFilter() {
28087
- return (path17) => !this.ignores(path17);
28087
+ return (path18) => !this.ignores(path18);
28088
28088
  }
28089
28089
  filter(paths) {
28090
28090
  return makeArray(paths).filter(this.createFilter());
28091
28091
  }
28092
28092
  // @returns {TestResult}
28093
- test(path17) {
28094
- return this._test(path17, this._testCache);
28093
+ test(path18) {
28094
+ return this._test(path18, this._testCache);
28095
28095
  }
28096
28096
  };
28097
28097
  var factory = (options) => new Ignore(options);
28098
- var isPathValid = (path17) => checkPath(path17 && checkPath.convert(path17), path17, RETURN_FALSE);
28098
+ var isPathValid = (path18) => checkPath(path18 && checkPath.convert(path18), path18, RETURN_FALSE);
28099
28099
  var setupWindows = () => {
28100
28100
  const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
28101
28101
  checkPath.convert = makePosix;
28102
28102
  const REGEX_TEST_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
28103
- checkPath.isNotRelative = (path17) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path17) || isNotRelative(path17);
28103
+ checkPath.isNotRelative = (path18) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path18) || isNotRelative(path18);
28104
28104
  };
28105
28105
  if (
28106
28106
  // Detect `process` so that it can run in browsers.
@@ -28142,16 +28142,16 @@ var init_url_alphabet = __esm({
28142
28142
  });
28143
28143
 
28144
28144
  // ../../../../../../../../../../Source code/git-transfer/goldynlabs/clauder-hub/node_modules/nanoid/index.js
28145
- import { webcrypto as crypto } from "node:crypto";
28145
+ import { webcrypto as crypto2 } from "node:crypto";
28146
28146
  function fillPool(bytes) {
28147
28147
  if (bytes < 0) throw new RangeError("Wrong ID size");
28148
28148
  try {
28149
28149
  if (!pool || pool.length < bytes) {
28150
28150
  pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
28151
- crypto.getRandomValues(pool);
28151
+ crypto2.getRandomValues(pool);
28152
28152
  poolOffset = 0;
28153
28153
  } else if (poolOffset + bytes > pool.length) {
28154
- crypto.getRandomValues(pool);
28154
+ crypto2.getRandomValues(pool);
28155
28155
  poolOffset = 0;
28156
28156
  }
28157
28157
  } catch (e) {
@@ -28561,6 +28561,14 @@ Finish what is missing, then send the done block again.`
28561
28561
  placeholders: [],
28562
28562
  text: "I want to add an MCP server to this project. Ask me which one, then tell me what you need from me and add it once I confirm."
28563
28563
  },
28564
+ {
28565
+ key: "typed.fromForm",
28566
+ label: "First message of a hub task opened from a form",
28567
+ audience: "claude-typed",
28568
+ description: "Typed into the hub task opened by a form's Set up with Claude, so it carries on from what was filled in.",
28569
+ placeholders: [],
28570
+ text: 'I started this on the form; what I filled in is under "Started from the form" in your instructions. Carry on from there: tell me what is missing or looks wrong, then save it once I confirm.'
28571
+ },
28564
28572
  {
28565
28573
  key: "typed.findFolders",
28566
28574
  label: "Finding a folder for /addproject",
@@ -28738,7 +28746,7 @@ Reply to this message to talk to the session. Its questions come here too.`
28738
28746
  audience: "channel",
28739
28747
  description: "Sent when a run was queued from the channel.",
28740
28748
  placeholders: ["position"],
28741
- text: "Queued, number {{position}} in line. Runs go one at a time; its questions and its result come here."
28749
+ text: "Queued, number {{position}} in line. Runs take turns; its questions and its result come here."
28742
28750
  },
28743
28751
  {
28744
28752
  key: "channel.globalHelp",
@@ -28801,14 +28809,14 @@ Working on: {{current}}`
28801
28809
 
28802
28810
  // server/src/smallModel.ts
28803
28811
  import { spawn as spawn2 } from "node:child_process";
28804
- import fs6 from "node:fs";
28805
- import path7 from "node:path";
28812
+ import fs7 from "node:fs";
28813
+ import path8 from "node:path";
28806
28814
  function askSmallModel(prompt, timeoutMs = 45e3) {
28807
28815
  const claude2 = findClaudeCode();
28808
28816
  if (!claude2 || claudeStatus()?.problem) return Promise.resolve(null);
28809
28817
  return new Promise((resolve) => {
28810
- const cwd = path7.join(hubHome, "global");
28811
- fs6.mkdirSync(cwd, { recursive: true });
28818
+ const cwd = path8.join(hubHome, "global");
28819
+ fs7.mkdirSync(cwd, { recursive: true });
28812
28820
  const child = spawn2(claude2, ["-p", "--model", "haiku", "--tools", "", "--no-session-persistence", "--strict-mcp-config", "--output-format", "text"], {
28813
28821
  cwd,
28814
28822
  windowsHide: true,
@@ -32562,8 +32570,8 @@ var init_claudeSettings = __esm({
32562
32570
  });
32563
32571
 
32564
32572
  // server/src/transcripts.ts
32565
- import fs7 from "node:fs";
32566
- import path8 from "node:path";
32573
+ import fs8 from "node:fs";
32574
+ import path9 from "node:path";
32567
32575
  function summarise(name, input) {
32568
32576
  if (!input || typeof input !== "object") return "";
32569
32577
  const pick = name === "Skill" ? input.skill : name === "Agent" || name === "Task" ? `${input.subagent_type ?? "agent"}: ${input.description ?? ""}` : input.command ?? input.file_path ?? input.pattern ?? input.url ?? input.query ?? input.description ?? input.prompt;
@@ -32574,7 +32582,7 @@ function summarise(name, input) {
32574
32582
  function refresh(file, acc) {
32575
32583
  let stat;
32576
32584
  try {
32577
- stat = fs7.statSync(file);
32585
+ stat = fs8.statSync(file);
32578
32586
  } catch {
32579
32587
  return false;
32580
32588
  }
@@ -32583,18 +32591,18 @@ function refresh(file, acc) {
32583
32591
  acc.size = stat.size;
32584
32592
  acc.mtimeMs = stat.mtimeMs;
32585
32593
  if (stat.size === acc.offset) return true;
32586
- const fd = fs7.openSync(file, "r");
32594
+ const fd = fs8.openSync(file, "r");
32587
32595
  try {
32588
32596
  const length = stat.size - acc.offset;
32589
32597
  const buffer = Buffer.alloc(length);
32590
- fs7.readSync(fd, buffer, 0, length, acc.offset);
32598
+ fs8.readSync(fd, buffer, 0, length, acc.offset);
32591
32599
  acc.offset = stat.size;
32592
32600
  const text = acc.partial + buffer.toString("utf8");
32593
32601
  const lines2 = text.split("\n");
32594
32602
  acc.partial = lines2.pop() ?? "";
32595
32603
  for (const line of lines2) if (line.trim()) acc.feed(line);
32596
32604
  } finally {
32597
- fs7.closeSync(fd);
32605
+ fs8.closeSync(fd);
32598
32606
  }
32599
32607
  return true;
32600
32608
  }
@@ -32626,10 +32634,10 @@ function skillsOf(calls, commands) {
32626
32634
  return skills;
32627
32635
  }
32628
32636
  function refreshSubagents(state) {
32629
- const dir = path8.join(transcriptsDir(), state.id, "subagents");
32637
+ const dir = path9.join(transcriptsDir(), state.id, "subagents");
32630
32638
  let names;
32631
32639
  try {
32632
- names = fs7.readdirSync(dir);
32640
+ names = fs8.readdirSync(dir);
32633
32641
  } catch {
32634
32642
  return false;
32635
32643
  }
@@ -32644,12 +32652,12 @@ function refreshSubagents(state) {
32644
32652
  }
32645
32653
  if (!sub.metaLoaded) {
32646
32654
  try {
32647
- sub.meta = JSON.parse(fs7.readFileSync(path8.join(dir, `agent-${agentId}.meta.json`), "utf8"));
32655
+ sub.meta = JSON.parse(fs8.readFileSync(path9.join(dir, `agent-${agentId}.meta.json`), "utf8"));
32648
32656
  sub.metaLoaded = true;
32649
32657
  } catch {
32650
32658
  }
32651
32659
  }
32652
- if (refresh(path8.join(dir, name), sub.acc)) changed2 = true;
32660
+ if (refresh(path9.join(dir, name), sub.acc)) changed2 = true;
32653
32661
  }
32654
32662
  return changed2;
32655
32663
  }
@@ -32659,8 +32667,8 @@ function forgetTranscript(id) {
32659
32667
  function stateOf(id) {
32660
32668
  let state = sessions.get(stateKey(id));
32661
32669
  if (!state) {
32662
- const file = path8.join(transcriptsDir(), `${id}.jsonl`);
32663
- if (!fs7.existsSync(file)) return null;
32670
+ const file = path9.join(transcriptsDir(), `${id}.jsonl`);
32671
+ if (!fs8.existsSync(file)) return null;
32664
32672
  state = { id, file, acc: new TranscriptAccumulator(), subagents: /* @__PURE__ */ new Map() };
32665
32673
  sessions.set(stateKey(id), state);
32666
32674
  }
@@ -32702,7 +32710,7 @@ function allUsages(state) {
32702
32710
  function listTranscripts() {
32703
32711
  let names;
32704
32712
  try {
32705
- names = fs7.readdirSync(transcriptsDir());
32713
+ names = fs8.readdirSync(transcriptsDir());
32706
32714
  } catch {
32707
32715
  return [];
32708
32716
  }
@@ -32770,7 +32778,7 @@ function lastToolResultAt(id) {
32770
32778
  }
32771
32779
  function transcriptMtime(id) {
32772
32780
  try {
32773
- return fs7.statSync(path8.join(transcriptsDir(), `${id}.jsonl`)).mtimeMs;
32781
+ return fs8.statSync(path9.join(transcriptsDir(), `${id}.jsonl`)).mtimeMs;
32774
32782
  } catch {
32775
32783
  return 0;
32776
32784
  }
@@ -32780,7 +32788,7 @@ function startTranscriptWatcher(intervalMs = 1500) {
32780
32788
  const tick = () => {
32781
32789
  let names;
32782
32790
  try {
32783
- names = fs7.readdirSync(transcriptsDir());
32791
+ names = fs8.readdirSync(transcriptsDir());
32784
32792
  } catch {
32785
32793
  return;
32786
32794
  }
@@ -32790,13 +32798,13 @@ function startTranscriptWatcher(intervalMs = 1500) {
32790
32798
  const id = name.slice(0, -".jsonl".length);
32791
32799
  let stamp = 0;
32792
32800
  try {
32793
- stamp = fs7.statSync(path8.join(transcriptsDir(), name)).mtimeMs;
32801
+ stamp = fs8.statSync(path9.join(transcriptsDir(), name)).mtimeMs;
32794
32802
  } catch {
32795
32803
  continue;
32796
32804
  }
32797
32805
  try {
32798
- for (const sub of fs7.readdirSync(path8.join(transcriptsDir(), id, "subagents"))) {
32799
- if (sub.endsWith(".jsonl")) stamp = Math.max(stamp, fs7.statSync(path8.join(transcriptsDir(), id, "subagents", sub)).mtimeMs);
32806
+ for (const sub of fs8.readdirSync(path9.join(transcriptsDir(), id, "subagents"))) {
32807
+ if (sub.endsWith(".jsonl")) stamp = Math.max(stamp, fs8.statSync(path9.join(transcriptsDir(), id, "subagents", sub)).mtimeMs);
32800
32808
  }
32801
32809
  } catch {
32802
32810
  }
@@ -32945,14 +32953,14 @@ var init_transcripts = __esm({
32945
32953
  });
32946
32954
 
32947
32955
  // server/src/sessionFiles.ts
32948
- import fs8 from "node:fs";
32949
- import os3 from "node:os";
32950
- import path9 from "node:path";
32956
+ import fs9 from "node:fs";
32957
+ import os4 from "node:os";
32958
+ import path10 from "node:path";
32951
32959
  function checkId(id) {
32952
32960
  if (!UUID.test(id)) throw new Error("Not a session id.");
32953
32961
  }
32954
32962
  function transcriptFile(id) {
32955
- return path9.join(transcriptsDir(), `${id}.jsonl`);
32963
+ return path10.join(transcriptsDir(), `${id}.jsonl`);
32956
32964
  }
32957
32965
  function setSessionTitle(id, title) {
32958
32966
  checkId(id);
@@ -32960,31 +32968,31 @@ function setSessionTitle(id, title) {
32960
32968
  if (!name) throw new Error("The name is empty.");
32961
32969
  if (name.length > 200) throw new Error("Keep the name under 200 characters.");
32962
32970
  const file = transcriptFile(id);
32963
- if (!fs8.existsSync(file)) throw new Error("This session has no transcript yet; give it a moment to start.");
32964
- const size = fs8.statSync(file).size;
32971
+ if (!fs9.existsSync(file)) throw new Error("This session has no transcript yet; give it a moment to start.");
32972
+ const size = fs9.statSync(file).size;
32965
32973
  let lead = "";
32966
32974
  if (size > 0) {
32967
- const fd = fs8.openSync(file, "r");
32975
+ const fd = fs9.openSync(file, "r");
32968
32976
  const last = Buffer.alloc(1);
32969
- fs8.readSync(fd, last, 0, 1, size - 1);
32970
- fs8.closeSync(fd);
32977
+ fs9.readSync(fd, last, 0, 1, size - 1);
32978
+ fs9.closeSync(fd);
32971
32979
  if (last.toString() !== "\n") lead = "\n";
32972
32980
  }
32973
- fs8.appendFileSync(file, `${lead}${JSON.stringify({ type: "custom-title", customTitle: name, sessionId: id })}
32981
+ fs9.appendFileSync(file, `${lead}${JSON.stringify({ type: "custom-title", customTitle: name, sessionId: id })}
32974
32982
  `, "utf8");
32975
32983
  broadcast("sessions", { sessionId: id });
32976
32984
  }
32977
32985
  function sizeOf(target2) {
32978
- const stat = fs8.statSync(target2);
32986
+ const stat = fs9.statSync(target2);
32979
32987
  if (!stat.isDirectory()) return stat.size;
32980
- return fs8.readdirSync(target2).reduce((total, name) => total + sizeOf(path9.join(target2, name)), 0);
32988
+ return fs9.readdirSync(target2).reduce((total, name) => total + sizeOf(path10.join(target2, name)), 0);
32981
32989
  }
32982
32990
  function tempDirOf(id) {
32983
- const base = process.env.CLAUDE_CODE_TMPDIR ?? os3.tmpdir();
32991
+ const base = process.env.CLAUDE_CODE_TMPDIR ?? os4.tmpdir();
32984
32992
  const uid = typeof process.getuid === "function" ? process.getuid() : null;
32985
- const roots2 = [path9.join(base, "claude"), ...uid !== null ? [path9.join(base, `claude-${uid}`)] : []];
32986
- const candidates2 = roots2.map((root2) => path9.join(root2, projectSlug(projectRoot()), id));
32987
- return candidates2.find((candidate) => fs8.existsSync(candidate)) ?? candidates2[0];
32993
+ const roots2 = [path10.join(base, "claude"), ...uid !== null ? [path10.join(base, `claude-${uid}`)] : []];
32994
+ const candidates2 = roots2.map((root2) => path10.join(root2, projectSlug(projectRoot()), id));
32995
+ return candidates2.find((candidate) => fs9.existsSync(candidate)) ?? candidates2[0];
32988
32996
  }
32989
32997
  function sessionDiskBytes(id) {
32990
32998
  if (!UUID.test(id)) return null;
@@ -33004,17 +33012,17 @@ function deletionPlan(id) {
33004
33012
  checkId(id);
33005
33013
  const candidates2 = [
33006
33014
  [transcriptFile(id), "transcript"],
33007
- [path9.join(transcriptsDir(), id), "subagent transcripts and tool output"],
33008
- [path9.join(claudeHome, "file-history", id), "file snapshots used to rewind"],
33009
- [path9.join(claudeHome, "session-env", id), "session environment"]
33015
+ [path10.join(transcriptsDir(), id), "subagent transcripts and tool output"],
33016
+ [path10.join(claudeHome, "file-history", id), "file snapshots used to rewind"],
33017
+ [path10.join(claudeHome, "session-env", id), "session environment"]
33010
33018
  ];
33011
- const files = candidates2.filter(([target2]) => fs8.existsSync(target2)).map(([target2, what]) => ({ path: target2, bytes: sizeOf(target2), what }));
33019
+ const files = candidates2.filter(([target2]) => fs9.existsSync(target2)).map(([target2, what]) => ({ path: target2, bytes: sizeOf(target2), what }));
33012
33020
  const temp = tempDirOf(id);
33013
33021
  return {
33014
33022
  sessionId: id,
33015
33023
  files,
33016
33024
  totalBytes: files.reduce((total, item) => total + item.bytes, 0),
33017
- temp: fs8.existsSync(temp) ? { path: temp, bytes: sizeOf(temp) } : null
33025
+ temp: fs9.existsSync(temp) ? { path: temp, bytes: sizeOf(temp) } : null
33018
33026
  };
33019
33027
  }
33020
33028
  async function deleteSession(id, options = {}) {
@@ -33026,8 +33034,8 @@ async function deleteSession(id, options = {}) {
33026
33034
  if (terminalForSession(id)) throw new Error("The session did not stop in time; nothing was deleted. Try again.");
33027
33035
  }
33028
33036
  const plan = deletionPlan(id);
33029
- for (const item of plan.files) fs8.rmSync(item.path, { recursive: true, force: true });
33030
- if (options.clearTemp !== false && plan.temp) fs8.rmSync(plan.temp.path, { recursive: true, force: true });
33037
+ for (const item of plan.files) fs9.rmSync(item.path, { recursive: true, force: true });
33038
+ if (options.clearTemp !== false && plan.temp) fs9.rmSync(plan.temp.path, { recursive: true, force: true });
33031
33039
  db.transaction(() => {
33032
33040
  for (const table of ["interactions", "mcp_suggestions", "channel_refs", "channel_threads", "sessions"]) {
33033
33041
  db.prepare(`DELETE FROM ${table} WHERE ${table === "sessions" ? "id" : "session_id"} = ?`).run(id);
@@ -33054,12 +33062,12 @@ var init_sessionFiles = __esm({
33054
33062
  });
33055
33063
 
33056
33064
  // server/src/inventory.ts
33057
- import fs9 from "node:fs";
33058
- import os4 from "node:os";
33059
- import path10 from "node:path";
33060
- function readJson(file) {
33065
+ import fs10 from "node:fs";
33066
+ import os5 from "node:os";
33067
+ import path11 from "node:path";
33068
+ function readJson2(file) {
33061
33069
  try {
33062
- return JSON.parse(fs9.readFileSync(file, "utf8"));
33070
+ return JSON.parse(fs10.readFileSync(file, "utf8"));
33063
33071
  } catch {
33064
33072
  return null;
33065
33073
  }
@@ -33083,19 +33091,19 @@ function frontMatter(text) {
33083
33091
  function definition(file, fallbackName, scope, plugin) {
33084
33092
  let text;
33085
33093
  try {
33086
- text = fs9.readFileSync(file, "utf8");
33094
+ text = fs10.readFileSync(file, "utf8");
33087
33095
  } catch {
33088
33096
  return null;
33089
33097
  }
33090
- const meta = frontMatter(text);
33091
- const name = meta.name || fallbackName;
33098
+ const meta2 = frontMatter(text);
33099
+ const name = meta2.name || fallbackName;
33092
33100
  return {
33093
33101
  name: plugin ? `${plugin.split("@")[0]}:${name}` : name,
33094
- description: meta.description ?? "",
33102
+ description: meta2.description ?? "",
33095
33103
  scope,
33096
33104
  plugin,
33097
33105
  path: file,
33098
- model: meta.model || void 0
33106
+ model: meta2.model || void 0
33099
33107
  };
33100
33108
  }
33101
33109
  function markdownFiles(dir, depth = 3) {
@@ -33103,12 +33111,12 @@ function markdownFiles(dir, depth = 3) {
33103
33111
  const walk = (current, left) => {
33104
33112
  let entries;
33105
33113
  try {
33106
- entries = fs9.readdirSync(current, { withFileTypes: true });
33114
+ entries = fs10.readdirSync(current, { withFileTypes: true });
33107
33115
  } catch {
33108
33116
  return;
33109
33117
  }
33110
33118
  for (const entry of entries) {
33111
- const full = path10.join(current, entry.name);
33119
+ const full = path11.join(current, entry.name);
33112
33120
  if (entry.isDirectory() && left > 0) walk(full, left - 1);
33113
33121
  else if (entry.isFile() && entry.name.endsWith(".md")) found.push(full);
33114
33122
  }
@@ -33117,19 +33125,19 @@ function markdownFiles(dir, depth = 3) {
33117
33125
  return found;
33118
33126
  }
33119
33127
  function agentsIn(dir, scope, plugin) {
33120
- return markdownFiles(dir, 1).map((file) => definition(file, path10.basename(file, ".md"), scope, plugin)).filter((item) => item !== null);
33128
+ return markdownFiles(dir, 1).map((file) => definition(file, path11.basename(file, ".md"), scope, plugin)).filter((item) => item !== null);
33121
33129
  }
33122
33130
  function skillsIn(dir, scope, plugin) {
33123
33131
  let entries;
33124
33132
  try {
33125
- entries = fs9.readdirSync(dir, { withFileTypes: true });
33133
+ entries = fs10.readdirSync(dir, { withFileTypes: true });
33126
33134
  } catch {
33127
33135
  return [];
33128
33136
  }
33129
- return entries.filter((entry) => entry.isDirectory()).map((entry) => definition(path10.join(dir, entry.name, "SKILL.md"), entry.name, scope, plugin)).filter((item) => item !== null);
33137
+ return entries.filter((entry) => entry.isDirectory()).map((entry) => definition(path11.join(dir, entry.name, "SKILL.md"), entry.name, scope, plugin)).filter((item) => item !== null);
33130
33138
  }
33131
33139
  function commandsIn(dir, scope, plugin) {
33132
- return markdownFiles(dir, 2).map((file) => definition(file, path10.relative(dir, file).replace(/\.md$/, "").replace(/[\\/]/g, ":"), scope, plugin)).filter((item) => item !== null);
33140
+ return markdownFiles(dir, 2).map((file) => definition(file, path11.relative(dir, file).replace(/\.md$/, "").replace(/[\\/]/g, ":"), scope, plugin)).filter((item) => item !== null);
33133
33141
  }
33134
33142
  function mcpFrom(servers, scope, source, plugin) {
33135
33143
  if (!servers || typeof servers !== "object") return [];
@@ -33173,14 +33181,14 @@ function localProjectConfig(global3) {
33173
33181
  return null;
33174
33182
  }
33175
33183
  function readInventory() {
33176
- const userSettingsFile = path10.join(claudeHome, "settings.json");
33177
- const projectSettingsFile = path10.join(projectRoot(), ".claude", "settings.json");
33178
- const localSettingsFile = path10.join(projectRoot(), ".claude", "settings.local.json");
33179
- const userSettings = readJson(userSettingsFile);
33180
- const projectSettings = readJson(projectSettingsFile);
33181
- const localSettings = readJson(localSettingsFile);
33182
- const globalConfigFile = path10.join(os4.homedir(), ".claude.json");
33183
- const globalConfig = readJson(globalConfigFile);
33184
+ const userSettingsFile = path11.join(claudeHome, "settings.json");
33185
+ const projectSettingsFile = path11.join(projectRoot(), ".claude", "settings.json");
33186
+ const localSettingsFile = path11.join(projectRoot(), ".claude", "settings.local.json");
33187
+ const userSettings = readJson2(userSettingsFile);
33188
+ const projectSettings = readJson2(projectSettingsFile);
33189
+ const localSettings = readJson2(localSettingsFile);
33190
+ const globalConfigFile = path11.join(os5.homedir(), ".claude.json");
33191
+ const globalConfig = readJson2(globalConfigFile);
33184
33192
  const local = localProjectConfig(globalConfig);
33185
33193
  const enabled = {
33186
33194
  ...userSettings?.enabledPlugins ?? {},
@@ -33188,7 +33196,7 @@ function readInventory() {
33188
33196
  ...localSettings?.enabledPlugins ?? {}
33189
33197
  };
33190
33198
  const plugins = [];
33191
- const installed = readJson(path10.join(claudeHome, "plugins", "installed_plugins.json"));
33199
+ const installed = readJson2(path11.join(claudeHome, "plugins", "installed_plugins.json"));
33192
33200
  for (const [id, installs] of Object.entries(installed?.plugins ?? {})) {
33193
33201
  const install = Array.isArray(installs) ? installs[installs.length - 1] : null;
33194
33202
  if (!install?.installPath) continue;
@@ -33202,21 +33210,21 @@ function readInventory() {
33202
33210
  });
33203
33211
  }
33204
33212
  const agents = [
33205
- ...agentsIn(path10.join(claudeHome, "agents"), "user"),
33206
- ...agentsIn(path10.join(projectRoot(), ".claude", "agents"), "project"),
33213
+ ...agentsIn(path11.join(claudeHome, "agents"), "user"),
33214
+ ...agentsIn(path11.join(projectRoot(), ".claude", "agents"), "project"),
33207
33215
  // No file behind these, so no path: they can be turned off, not edited.
33208
33216
  ...BUILT_IN_AGENTS.map(([name, description]) => ({ name, description, scope: "built-in", path: "" }))
33209
33217
  ];
33210
- const skills = [...skillsIn(path10.join(claudeHome, "skills"), "user"), ...skillsIn(path10.join(projectRoot(), ".claude", "skills"), "project")];
33218
+ const skills = [...skillsIn(path11.join(claudeHome, "skills"), "user"), ...skillsIn(path11.join(projectRoot(), ".claude", "skills"), "project")];
33211
33219
  const commands = [
33212
- ...commandsIn(path10.join(claudeHome, "commands"), "user"),
33213
- ...commandsIn(path10.join(projectRoot(), ".claude", "commands"), "project")
33220
+ ...commandsIn(path11.join(claudeHome, "commands"), "user"),
33221
+ ...commandsIn(path11.join(projectRoot(), ".claude", "commands"), "project")
33214
33222
  ];
33215
33223
  const disabledJson = new Set(local?.disabledMcpjsonServers ?? []);
33216
33224
  const mcpServers = [
33217
33225
  ...mcpFrom(globalConfig?.mcpServers, "user", globalConfigFile),
33218
33226
  ...mcpFrom(local?.mcpServers, "local", globalConfigFile),
33219
- ...mcpFrom(readJson(path10.join(projectRoot(), ".mcp.json"))?.mcpServers, "project", path10.join(projectRoot(), ".mcp.json")).map(
33227
+ ...mcpFrom(readJson2(path11.join(projectRoot(), ".mcp.json"))?.mcpServers, "project", path11.join(projectRoot(), ".mcp.json")).map(
33220
33228
  (server2) => ({ ...server2, disabled: disabledJson.has(server2.name) })
33221
33229
  )
33222
33230
  ];
@@ -33226,28 +33234,28 @@ function readInventory() {
33226
33234
  ...hooksFrom(localSettings, "local", localSettingsFile)
33227
33235
  ];
33228
33236
  for (const plugin of plugins.filter((item) => item.enabled)) {
33229
- agents.push(...agentsIn(path10.join(plugin.path, "agents"), "plugin", plugin.id));
33230
- skills.push(...skillsIn(path10.join(plugin.path, "skills"), "plugin", plugin.id));
33231
- commands.push(...commandsIn(path10.join(plugin.path, "commands"), "plugin", plugin.id));
33232
- const pluginMcp = readJson(path10.join(plugin.path, ".mcp.json"));
33233
- mcpServers.push(...mcpFrom(pluginMcp?.mcpServers ?? pluginMcp, "plugin", path10.join(plugin.path, ".mcp.json"), plugin.id));
33234
- hooks.push(...hooksFrom(readJson(path10.join(plugin.path, "hooks", "hooks.json")), "plugin", path10.join(plugin.path, "hooks", "hooks.json"), plugin.id));
33237
+ agents.push(...agentsIn(path11.join(plugin.path, "agents"), "plugin", plugin.id));
33238
+ skills.push(...skillsIn(path11.join(plugin.path, "skills"), "plugin", plugin.id));
33239
+ commands.push(...commandsIn(path11.join(plugin.path, "commands"), "plugin", plugin.id));
33240
+ const pluginMcp = readJson2(path11.join(plugin.path, ".mcp.json"));
33241
+ mcpServers.push(...mcpFrom(pluginMcp?.mcpServers ?? pluginMcp, "plugin", path11.join(plugin.path, ".mcp.json"), plugin.id));
33242
+ hooks.push(...hooksFrom(readJson2(path11.join(plugin.path, "hooks", "hooks.json")), "plugin", path11.join(plugin.path, "hooks", "hooks.json"), plugin.id));
33235
33243
  }
33236
33244
  return { agents, skills, commands, mcpServers, hooks, plugins };
33237
33245
  }
33238
33246
  function memoryFiles() {
33239
33247
  const files = [];
33240
33248
  const add = (file, label, group, scope, always = false) => {
33241
- const exists = fs9.existsSync(file);
33249
+ const exists = fs10.existsSync(file);
33242
33250
  if (exists || always) files.push({ path: file, label, group, scope, exists });
33243
33251
  };
33244
- add(path10.join(claudeHome, "CLAUDE.md"), "~/.claude/CLAUDE.md", "memory", "user", true);
33245
- add(path10.join(projectRoot(), "CLAUDE.md"), "CLAUDE.md", "memory", "project", true);
33246
- add(path10.join(projectRoot(), ".claude", "CLAUDE.md"), ".claude/CLAUDE.md", "memory", "project");
33247
- add(path10.join(projectRoot(), "CLAUDE.local.md"), "CLAUDE.local.md", "memory", "local");
33248
- for (const file of markdownFiles(path10.join(claudeHome, "rules"))) add(file, `~/.claude/rules/${path10.relative(path10.join(claudeHome, "rules"), file)}`, "rules", "user");
33249
- for (const file of markdownFiles(path10.join(projectRoot(), ".claude", "rules"))) add(file, `.claude/rules/${path10.relative(path10.join(projectRoot(), ".claude", "rules"), file)}`, "rules", "project");
33250
- for (const file of markdownFiles(path10.join(transcriptsDir(), "memory"), 1)) add(file, `memory/${path10.basename(file)}`, "auto-memory", "local");
33252
+ add(path11.join(claudeHome, "CLAUDE.md"), "~/.claude/CLAUDE.md", "memory", "user", true);
33253
+ add(path11.join(projectRoot(), "CLAUDE.md"), "CLAUDE.md", "memory", "project", true);
33254
+ add(path11.join(projectRoot(), ".claude", "CLAUDE.md"), ".claude/CLAUDE.md", "memory", "project");
33255
+ add(path11.join(projectRoot(), "CLAUDE.local.md"), "CLAUDE.local.md", "memory", "local");
33256
+ for (const file of markdownFiles(path11.join(claudeHome, "rules"))) add(file, `~/.claude/rules/${path11.relative(path11.join(claudeHome, "rules"), file)}`, "rules", "user");
33257
+ for (const file of markdownFiles(path11.join(projectRoot(), ".claude", "rules"))) add(file, `.claude/rules/${path11.relative(path11.join(projectRoot(), ".claude", "rules"), file)}`, "rules", "project");
33258
+ for (const file of markdownFiles(path11.join(transcriptsDir(), "memory"), 1)) add(file, `memory/${path11.basename(file)}`, "auto-memory", "local");
33251
33259
  const inventory = readInventory();
33252
33260
  for (const agent of inventory.agents.filter((item) => item.scope !== "plugin" && item.path)) add(agent.path, `agent: ${agent.name}`, "agent", agent.scope);
33253
33261
  for (const skill of inventory.skills.filter((item) => item.scope !== "plugin")) add(skill.path, `skill: ${skill.name}`, "skill", skill.scope);
@@ -33255,13 +33263,13 @@ function memoryFiles() {
33255
33263
  return files.map((file) => ({ ...file, label: file.label.replace(/\\/g, "/") }));
33256
33264
  }
33257
33265
  function isMemoryFile(file) {
33258
- const wanted = path10.resolve(file).toLowerCase();
33259
- return memoryFiles().some((item) => path10.resolve(item.path).toLowerCase() === wanted);
33266
+ const wanted = path11.resolve(file).toLowerCase();
33267
+ return memoryFiles().some((item) => path11.resolve(item.path).toLowerCase() === wanted);
33260
33268
  }
33261
33269
  function isDefinitionFile(file) {
33262
- const wanted = path10.resolve(file).toLowerCase();
33270
+ const wanted = path11.resolve(file).toLowerCase();
33263
33271
  const inventory = readInventory();
33264
- return [...inventory.agents, ...inventory.skills, ...inventory.commands].some((item) => item.path && path10.resolve(item.path).toLowerCase() === wanted);
33272
+ return [...inventory.agents, ...inventory.skills, ...inventory.commands].some((item) => item.path && path11.resolve(item.path).toLowerCase() === wanted);
33265
33273
  }
33266
33274
  var BUILT_IN_AGENTS;
33267
33275
  var init_inventory = __esm({
@@ -34151,56 +34159,76 @@ function advanceSoon(ms) {
34151
34159
  }
34152
34160
  }, ms);
34153
34161
  }
34162
+ function maxRuns() {
34163
+ const row = db.prepare("SELECT value FROM settings WHERE key = 'maxRuns'").get();
34164
+ const n2 = Number(row?.value);
34165
+ return Number.isInteger(n2) && n2 >= 1 ? Math.min(n2, MAX_RUNS_LIMIT) : 1;
34166
+ }
34167
+ function setMaxRuns(value) {
34168
+ const n2 = Number(value);
34169
+ if (!Number.isInteger(n2) || n2 < 1 || n2 > MAX_RUNS_LIMIT) throw new Error(`Runs at a time is a whole number from 1 to ${MAX_RUNS_LIMIT}.`);
34170
+ db.prepare("INSERT INTO settings (key, value, updated_at) VALUES ('maxRuns', ?, ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value, updated_at = excluded.updated_at").run(String(n2), now());
34171
+ broadcast("runs", {});
34172
+ advance();
34173
+ return n2;
34174
+ }
34154
34175
  function advance() {
34155
34176
  if (advancing) return;
34156
34177
  advancing = true;
34157
34178
  try {
34158
- const running = db.prepare("SELECT id FROM runs WHERE status = 'running' LIMIT 1").get();
34159
- if (running) return;
34160
- const next = db.prepare(`SELECT * FROM runs WHERE status = 'queued' ORDER BY ${IN_LINE} LIMIT 1`).get();
34161
- if (!next) return;
34162
- const job = next.job_id ? getJob(next.job_id) : null;
34163
- try {
34164
- const terminal = next.resume && next.session_id ? startSession({ resumeId: next.session_id, prompt: promptText("typed.resumeRun"), runId: next.id, permissionMode: claudeSettings().runPermissionMode }) : startSession({
34165
- prompt: next.prompt,
34166
- origin: next.source === "manual" ? "queue" : next.source,
34167
- runId: next.id,
34168
- category: next.category || "auto",
34169
- // Unattended runs use their own mode from Claude settings; "" leaves it to the user's settings.
34170
- permissionMode: claudeSettings().runPermissionMode,
34171
- // A job's own preset; without one, startSession falls back to the default preset.
34172
- toolset: job?.presetId ? getPreset(job.presetId)?.toolset : void 0,
34173
- name: job ? `${job.name} ${(/* @__PURE__ */ new Date()).toISOString().slice(0, 16).replace("T", " ")}` : void 0
34174
- });
34175
- db.prepare("UPDATE runs SET status = 'running', session_id = ?, started_at = ? WHERE id = ?").run(terminal.sessionId, now(), next.id);
34176
- } catch (error) {
34177
- if (error instanceof ClaudeMissing) {
34178
- if (!waitingForClaude.has(currentProject().id)) {
34179
- waitingForClaude.add(currentProject().id);
34180
- console.error("[queue] waiting for Claude Code:", error.message);
34181
- const retry = bindProject(() => {
34182
- waitingForClaude.delete(currentProject().id);
34183
- advance();
34184
- });
34185
- setTimeout(() => {
34186
- try {
34187
- retry();
34188
- } catch (failure) {
34189
- console.error("[queue]", failure.message);
34190
- }
34191
- }, 6e4);
34192
- }
34193
- return;
34194
- }
34195
- console.error("[queue] could not start a run:", error.message);
34196
- db.prepare("UPDATE runs SET status = 'exited', finished_at = ? WHERE id = ?").run(now(), next.id);
34197
- advanceSoon(1e3);
34179
+ while (startNext()) {
34198
34180
  }
34199
- broadcast("runs", {});
34200
34181
  } finally {
34201
34182
  advancing = false;
34202
34183
  }
34203
34184
  }
34185
+ function startNext() {
34186
+ const running = db.prepare("SELECT COUNT(*) AS n FROM runs WHERE status = 'running'").get().n;
34187
+ if (running >= maxRuns()) return false;
34188
+ const next = db.prepare(`SELECT * FROM runs WHERE status = 'queued' ORDER BY ${IN_LINE} LIMIT 1`).get();
34189
+ if (!next) return false;
34190
+ const job = next.job_id ? getJob(next.job_id) : null;
34191
+ try {
34192
+ const terminal = next.resume && next.session_id ? startSession({ resumeId: next.session_id, prompt: promptText("typed.resumeRun"), runId: next.id, permissionMode: claudeSettings().runPermissionMode }) : startSession({
34193
+ prompt: next.prompt,
34194
+ origin: next.source === "manual" ? "queue" : next.source,
34195
+ runId: next.id,
34196
+ category: next.category || "auto",
34197
+ // Unattended runs use their own mode from Claude settings; "" leaves it to the user's settings.
34198
+ permissionMode: claudeSettings().runPermissionMode,
34199
+ // A job's own preset; without one, startSession falls back to the default preset.
34200
+ toolset: job?.presetId ? getPreset(job.presetId)?.toolset : void 0,
34201
+ name: job ? `${job.name} ${(/* @__PURE__ */ new Date()).toISOString().slice(0, 16).replace("T", " ")}` : void 0
34202
+ });
34203
+ db.prepare("UPDATE runs SET status = 'running', session_id = ?, started_at = ? WHERE id = ?").run(terminal.sessionId, now(), next.id);
34204
+ broadcast("runs", {});
34205
+ return true;
34206
+ } catch (error) {
34207
+ if (error instanceof ClaudeMissing) {
34208
+ if (!waitingForClaude.has(currentProject().id)) {
34209
+ waitingForClaude.add(currentProject().id);
34210
+ console.error("[queue] waiting for Claude Code:", error.message);
34211
+ const retry = bindProject(() => {
34212
+ waitingForClaude.delete(currentProject().id);
34213
+ advance();
34214
+ });
34215
+ setTimeout(() => {
34216
+ try {
34217
+ retry();
34218
+ } catch (failure) {
34219
+ console.error("[queue]", failure.message);
34220
+ }
34221
+ }, 6e4);
34222
+ }
34223
+ return false;
34224
+ }
34225
+ console.error("[queue] could not start a run:", error.message);
34226
+ db.prepare("UPDATE runs SET status = 'exited', finished_at = ? WHERE id = ?").run(now(), next.id);
34227
+ broadcast("runs", {});
34228
+ advanceSoon(1e3);
34229
+ return false;
34230
+ }
34231
+ }
34204
34232
  function watchRunExits() {
34205
34233
  onTerminalExit((terminal) => {
34206
34234
  if (terminal.restarting) return;
@@ -34216,7 +34244,7 @@ function recoverRuns() {
34216
34244
  db.prepare("UPDATE interactions SET status = 'closed', answered_by = 'hub restart' WHERE status = 'open'").run();
34217
34245
  return stranded;
34218
34246
  }
34219
- var crons, cronKey, toJob, PARAM_TYPES, RESERVED, toRun, IN_LINE, advancing, waitingForClaude;
34247
+ var crons, cronKey, toJob, PARAM_TYPES, RESERVED, toRun, IN_LINE, advancing, waitingForClaude, MAX_RUNS_LIMIT;
34220
34248
  var init_jobs = __esm({
34221
34249
  "server/src/jobs.ts"() {
34222
34250
  "use strict";
@@ -34268,6 +34296,7 @@ var init_jobs = __esm({
34268
34296
  IN_LINE = "COALESCE(queued_at, created_at)";
34269
34297
  advancing = false;
34270
34298
  waitingForClaude = /* @__PURE__ */ new Set();
34299
+ MAX_RUNS_LIMIT = 10;
34271
34300
  }
34272
34301
  });
34273
34302
 
@@ -34338,7 +34367,7 @@ function definitionOf(purpose) {
34338
34367
  case "edit-job":
34339
34368
  return {
34340
34369
  title: purpose.kind === "create-job" ? "Create a job" : "Edit a job",
34341
- summary: `A job starts an unattended Claude session in this project on a cron schedule or when its webhook is called. Runs go through one queue, one at a time, with permission mode "default"; their questions reach the person's channels.`,
34370
+ summary: `A job starts an unattended Claude session in this project on a cron schedule or when its webhook is called. Runs go through one queue, as many at a time as the project allows (1 unless changed), with permission mode "default"; their questions reach the person's channels.`,
34342
34371
  params: JOB_PARAMS,
34343
34372
  samples: [
34344
34373
  { name: "Triage Jira bugs", kind: "cron", schedule: "0 9 * * 1-5", prompt: "Look up the Jira bugs assigned to the team that were created since yesterday. For each one you can reproduce, fix it on its own branch and open a PR.", category: "bugfix", presetId: null, enabled: true },
@@ -34467,6 +34496,18 @@ function purposeNote(purpose, hub) {
34467
34496
  const definition2 = definitionOf(purpose);
34468
34497
  const lines2 = [`# Purpose: ${definition2.title}`, "", scopeApi(definition2.summary), "", `The hub runs at ${hub}.`, ""];
34469
34498
  lines2.push(...sectionLines(definition2, currentValue(purpose), "##"));
34499
+ if (purpose.draft) {
34500
+ lines2.push(
34501
+ "## Started from the form",
34502
+ "",
34503
+ "The person began on the form and handed it over with these values. Start from them; ask only for what is missing, unclear or invalid. A secret field is never passed on: ask for it if it is needed.",
34504
+ "",
34505
+ "```json",
34506
+ JSON.stringify(purpose.draft, null, 2),
34507
+ "```",
34508
+ ""
34509
+ );
34510
+ }
34470
34511
  if (purpose.kind === "hub") {
34471
34512
  for (const section of HUB_SECTIONS) {
34472
34513
  const inner = definitionOf(section.purpose);
@@ -34563,8 +34604,8 @@ JSON`;
34563
34604
 
34564
34605
  // server/src/sessions.ts
34565
34606
  import { randomUUID } from "node:crypto";
34566
- import fs10 from "node:fs";
34567
- import path11 from "node:path";
34607
+ import fs11 from "node:fs";
34608
+ import path12 from "node:path";
34568
34609
  function getSessionRow(id) {
34569
34610
  return db.prepare("SELECT * FROM sessions WHERE id = ?").get(id) ?? null;
34570
34611
  }
@@ -34667,11 +34708,11 @@ function startSession(options) {
34667
34708
  const category = options.category !== void 0 ? options.category || null : existing?.category ?? null;
34668
34709
  const token = nanoid(24);
34669
34710
  const toolset = options.toolset ? normaliseToolset(options.toolset) : existing?.toolset ? normaliseToolset(JSON.parse(existing.toolset)) : defaultToolset();
34670
- const settingsFile = path11.join(runDir, `${token}.settings.json`);
34671
- const promptFile = path11.join(runDir, `${token}.prompt.md`);
34672
- fs10.writeFileSync(settingsFile, JSON.stringify({ ...toolsetSettings(toolset), ...hookSettings(token) }, null, 2), "utf8");
34711
+ const settingsFile = path12.join(runDir, `${token}.settings.json`);
34712
+ const promptFile = path12.join(runDir, `${token}.prompt.md`);
34713
+ fs11.writeFileSync(settingsFile, JSON.stringify({ ...toolsetSettings(toolset), ...hookSettings(token) }, null, 2), "utf8");
34673
34714
  const purpose = options.purpose ?? (existing?.purpose ? JSON.parse(existing.purpose) : null);
34674
- fs10.writeFileSync(promptFile, systemPromptFor(category, purpose, existing ? sessionSetup(sessionId) : null), "utf8");
34715
+ fs11.writeFileSync(promptFile, systemPromptFor(category, purpose, existing ? sessionSetup(sessionId) : null), "utf8");
34675
34716
  const args = ["--settings", settingsFile, "--append-system-prompt-file", promptFile];
34676
34717
  args.push(...options.resumeId ? ["--resume", options.resumeId] : ["--session-id", sessionId]);
34677
34718
  if (options.name) args.push("--name", options.name);
@@ -34744,7 +34785,7 @@ function terminalByToken(token) {
34744
34785
  return allTerminals().find((terminal) => terminal.token === token);
34745
34786
  }
34746
34787
  function cleanRunFiles(token) {
34747
- for (const suffix of [".settings.json", ".prompt.md"]) fs10.rmSync(path11.join(runDir, `${token}${suffix}`), { force: true });
34788
+ for (const suffix of [".settings.json", ".prompt.md"]) fs11.rmSync(path12.join(runDir, `${token}${suffix}`), { force: true });
34748
34789
  }
34749
34790
  function purposeOf(row) {
34750
34791
  const purpose = parseJson(row?.purpose, null);
@@ -34761,7 +34802,7 @@ function listSessions() {
34761
34802
  const quiet = new Set(quietSessions());
34762
34803
  const views = [];
34763
34804
  const seen = /* @__PURE__ */ new Set();
34764
- const view = (id, summary) => {
34805
+ const view2 = (id, summary) => {
34765
34806
  const row = rows.get(id);
34766
34807
  const terminal = terminals2.get(id);
34767
34808
  const status2 = terminal ? row?.status === "done" ? "done" : open.get(id) ? "waiting" : terminal.busy === false ? "idle" : "running" : row ? row.status === "done" ? "done" : "exited" : "external";
@@ -34787,10 +34828,10 @@ function listSessions() {
34787
34828
  for (const summary of listTranscripts()) {
34788
34829
  seen.add(summary.id);
34789
34830
  if (!summary.turns && !rows.has(summary.id) && !terminals2.has(summary.id)) continue;
34790
- views.push(view(summary.id, summary));
34831
+ views.push(view2(summary.id, summary));
34791
34832
  }
34792
34833
  for (const terminal of terminals2.values()) {
34793
- if (!seen.has(terminal.sessionId)) views.unshift(view(terminal.sessionId, { startedAt: terminal.startedAt, lastAt: terminal.startedAt }));
34834
+ if (!seen.has(terminal.sessionId)) views.unshift(view2(terminal.sessionId, { startedAt: terminal.startedAt, lastAt: terminal.startedAt }));
34794
34835
  }
34795
34836
  return views;
34796
34837
  }
@@ -34869,7 +34910,7 @@ function pickable() {
34869
34910
  const rest = sessions2.filter((session) => !live2.includes(session)).slice(0, 5);
34870
34911
  return [...live2, ...rest];
34871
34912
  }
34872
- function find(channelId, arg) {
34913
+ function find2(channelId, arg) {
34873
34914
  const sessions2 = listSessions();
34874
34915
  const wanted = arg.trim().toLowerCase();
34875
34916
  if (!wanted) return null;
@@ -35118,19 +35159,19 @@ async function runCommand(channelId, input, from, options = {}) {
35118
35159
  case "sessions":
35119
35160
  return sessionPicker(channelId, "\u{1F4AC} Sessions: pick one", "session", pickable(), `No sessions yet. ${p2}new starts one.`);
35120
35161
  case "session": {
35121
- const session = find(channelId, arg);
35162
+ const session = find2(channelId, arg);
35122
35163
  if (!session) return arg ? sessionGuess(channelId, from, "session", arg, p2) : `No such session. ${p2}sessions lists them.`;
35123
35164
  focus(channelId, session.id, from);
35124
35165
  return sessionCard(session);
35125
35166
  }
35126
35167
  case "summary": {
35127
35168
  if (!arg) return sessionPicker(channelId, "\u{1F4DD} Summary of which session?", "summary", pickable(), "No sessions yet.");
35128
- const session = find(channelId, arg);
35169
+ const session = find2(channelId, arg);
35129
35170
  return session ? summaryCard(session) : sessionGuess(channelId, from, "summary", arg, p2);
35130
35171
  }
35131
35172
  case "stop": {
35132
35173
  if (!arg) return sessionPicker(channelId, "\u23F9 Stop which session?", "stop", pickable().filter((session2) => session2.live), "No session is running.");
35133
- const session = find(channelId, arg);
35174
+ const session = find2(channelId, arg);
35134
35175
  if (!session) return sessionGuess(channelId, from, "stop", arg, p2);
35135
35176
  if (!session.live) return `${session.title} is not running.`;
35136
35177
  return {
@@ -35145,7 +35186,7 @@ async function runCommand(channelId, input, from, options = {}) {
35145
35186
  };
35146
35187
  }
35147
35188
  case "stop!": {
35148
- const session = find(channelId, arg);
35189
+ const session = find2(channelId, arg);
35149
35190
  const terminal = session ? terminalForSession(session.id) : void 0;
35150
35191
  if (!session || !terminal) return "That session is not running any more.";
35151
35192
  killTerminal(terminal);
@@ -35956,8 +35997,8 @@ __export(projects_exports, {
35956
35997
  touchProject: () => touchProject
35957
35998
  });
35958
35999
  import Database2 from "better-sqlite3";
35959
- import fs11 from "node:fs";
35960
- import path12 from "node:path";
36000
+ import fs12 from "node:fs";
36001
+ import path13 from "node:path";
35961
36002
  function listProjects() {
35962
36003
  return globalDb.prepare("SELECT * FROM projects ORDER BY opened_at DESC").all().map(toInfo);
35963
36004
  }
@@ -35974,15 +36015,15 @@ function globalProject() {
35974
36015
  }
35975
36016
  function bootGlobal() {
35976
36017
  if (global2) return global2.project;
35977
- const root2 = path12.join(hubHome, GLOBAL_ID);
35978
- fs11.mkdirSync(root2, { recursive: true });
36018
+ const root2 = path13.join(hubHome, GLOBAL_ID);
36019
+ fs12.mkdirSync(root2, { recursive: true });
35979
36020
  const project = {
35980
36021
  id: GLOBAL_ID,
35981
36022
  name: "Global",
35982
36023
  root: root2,
35983
- transcriptsDir: path12.join(claudeHome, "projects", projectSlug(root2)),
36024
+ transcriptsDir: path13.join(claudeHome, "projects", projectSlug(root2)),
35984
36025
  dataDir: root2,
35985
- db: openProjectDb(path12.join(root2, "hub.db"))
36026
+ db: openProjectDb(path13.join(root2, "hub.db"))
35986
36027
  };
35987
36028
  const stops = withProject(project, () => {
35988
36029
  recoverRuns();
@@ -35999,7 +36040,7 @@ function freeId(name, root2) {
35999
36040
  const taken = new Set(globalDb.prepare("SELECT id FROM projects").all().map((row) => row.id));
36000
36041
  const free = (id) => {
36001
36042
  if (taken.has(id) || RESERVED2.has(id)) return false;
36002
- if (!fs11.existsSync(path12.join(projectsDir, id))) return true;
36043
+ if (!fs12.existsSync(path13.join(projectsDir, id))) return true;
36003
36044
  const owner = ownerOf(id);
36004
36045
  return owner !== null && samePath(owner, root2);
36005
36046
  };
@@ -36007,8 +36048,8 @@ function freeId(name, root2) {
36007
36048
  for (let n2 = 2; ; n2++) if (free(`${base}-${n2}`)) return `${base}-${n2}`;
36008
36049
  }
36009
36050
  function importOldDatabase(root2, file) {
36010
- const old = path12.join(root2, ".clauder-hub", "data", "hub.db");
36011
- if (!fs11.existsSync(old) || fs11.existsSync(file)) return;
36051
+ const old = path13.join(root2, ".clauder-hub", "data", "hub.db");
36052
+ if (!fs12.existsSync(old) || fs12.existsSync(file)) return;
36012
36053
  const source = new Database2(old, { readonly: true, fileMustExist: true });
36013
36054
  try {
36014
36055
  source.prepare("VACUUM INTO ?").run(file);
@@ -36017,7 +36058,7 @@ function importOldDatabase(root2, file) {
36017
36058
  for (const row of overrides) insert.run(row.key, row.text, row.updated_at);
36018
36059
  console.log(` imported : ${old}`);
36019
36060
  } catch (error) {
36020
- fs11.rmSync(file, { force: true });
36061
+ fs12.rmSync(file, { force: true });
36021
36062
  console.error(`[projects] could not import ${old}:`, error.message);
36022
36063
  } finally {
36023
36064
  source.close();
@@ -36026,16 +36067,16 @@ function importOldDatabase(root2, file) {
36026
36067
  function boot(row) {
36027
36068
  const running = live.get(row.id);
36028
36069
  if (running) return running.project;
36029
- const dataDir = path12.join(projectsDir, row.id);
36030
- fs11.mkdirSync(dataDir, { recursive: true });
36031
- if (ownerOf(row.id) === null) fs11.writeFileSync(path12.join(dataDir, OWNER_FILE), row.root, "utf8");
36032
- const file = path12.join(dataDir, "hub.db");
36070
+ const dataDir = path13.join(projectsDir, row.id);
36071
+ fs12.mkdirSync(dataDir, { recursive: true });
36072
+ if (ownerOf(row.id) === null) fs12.writeFileSync(path13.join(dataDir, OWNER_FILE), row.root, "utf8");
36073
+ const file = path13.join(dataDir, "hub.db");
36033
36074
  importOldDatabase(row.root, file);
36034
36075
  const project = {
36035
36076
  id: row.id,
36036
36077
  name: row.name,
36037
36078
  root: row.root,
36038
- transcriptsDir: path12.join(claudeHome, "projects", projectSlug(row.root)),
36079
+ transcriptsDir: path13.join(claudeHome, "projects", projectSlug(row.root)),
36039
36080
  dataDir,
36040
36081
  db: openProjectDb(file)
36041
36082
  };
@@ -36063,7 +36104,7 @@ function boot(row) {
36063
36104
  }
36064
36105
  function bootProjects() {
36065
36106
  for (const row of globalDb.prepare("SELECT * FROM projects").all()) {
36066
- if (!fs11.existsSync(row.root)) continue;
36107
+ if (!fs12.existsSync(row.root)) continue;
36067
36108
  try {
36068
36109
  boot(row);
36069
36110
  } catch (error) {
@@ -36074,13 +36115,13 @@ function bootProjects() {
36074
36115
  }
36075
36116
  function addProject(input) {
36076
36117
  if (typeof input !== "string" || !input.trim()) throw new Error("Send the folder's full path.");
36077
- const typed = path12.resolve(input.trim());
36078
- if (!fs11.existsSync(typed) || !fs11.statSync(typed).isDirectory()) throw new Error(`${typed} is not a folder.`);
36079
- const root2 = fs11.realpathSync.native(typed);
36118
+ const typed = path13.resolve(input.trim());
36119
+ if (!fs12.existsSync(typed) || !fs12.statSync(typed).isDirectory()) throw new Error(`${typed} is not a folder.`);
36120
+ const root2 = fs12.realpathSync.native(typed);
36080
36121
  const rows = globalDb.prepare("SELECT * FROM projects").all();
36081
36122
  let row = rows.find((item) => samePath(item.root, root2));
36082
36123
  if (!row) {
36083
- const name = path12.basename(root2) || root2;
36124
+ const name = path13.basename(root2) || root2;
36084
36125
  row = { id: freeId(name, root2), root: root2, name, added_at: now(), opened_at: now() };
36085
36126
  boot(row);
36086
36127
  globalDb.prepare("INSERT INTO projects (id, root, name, added_at, opened_at) VALUES (?, ?, ?, ?, ?)").run(row.id, row.root, row.name, row.added_at, row.opened_at);
@@ -36131,13 +36172,13 @@ var init_projects = __esm({
36131
36172
  init_terminals();
36132
36173
  init_transcripts();
36133
36174
  live = /* @__PURE__ */ new Map();
36134
- toInfo = (row) => ({ id: row.id, name: row.name, root: row.root, addedAt: row.added_at, openedAt: row.opened_at, exists: fs11.existsSync(row.root) });
36175
+ toInfo = (row) => ({ id: row.id, name: row.name, root: row.root, addedAt: row.added_at, openedAt: row.opened_at, exists: fs12.existsSync(row.root) });
36135
36176
  global2 = null;
36136
36177
  samePath = (a, b2) => process.platform === "linux" ? a === b2 : a.toLowerCase() === b2.toLowerCase();
36137
36178
  OWNER_FILE = "root.txt";
36138
36179
  ownerOf = (id) => {
36139
36180
  try {
36140
- return fs11.readFileSync(path12.join(projectsDir, id, OWNER_FILE), "utf8").trim();
36181
+ return fs12.readFileSync(path13.join(projectsDir, id, OWNER_FILE), "utf8").trim();
36141
36182
  } catch {
36142
36183
  return null;
36143
36184
  }
@@ -36151,29 +36192,29 @@ var folderFinder_exports = {};
36151
36192
  __export(folderFinder_exports, {
36152
36193
  findFolders: () => findFolders
36153
36194
  });
36154
- import fs12 from "node:fs";
36155
- import os5 from "node:os";
36156
- import path13 from "node:path";
36195
+ import fs13 from "node:fs";
36196
+ import os6 from "node:os";
36197
+ import path14 from "node:path";
36157
36198
  function isProject(dir, entries) {
36158
36199
  return entries.some((entry) => MARKERS.includes(entry.name) || entry.isFile() && PROJECT_FILE.test(entry.name));
36159
36200
  }
36160
36201
  function roots() {
36161
- const home = os5.homedir();
36202
+ const home = os6.homedir();
36162
36203
  const found = /* @__PURE__ */ new Set();
36163
36204
  for (const project of allContexts()) {
36164
36205
  if (isGlobal(project)) continue;
36165
- found.add(path13.dirname(project.root));
36166
- found.add(path13.dirname(path13.dirname(project.root)));
36206
+ found.add(path14.dirname(project.root));
36207
+ found.add(path14.dirname(path14.dirname(project.root)));
36167
36208
  }
36168
- for (const dir of CODE_DIRS) found.add(path13.join(home, dir));
36209
+ for (const dir of CODE_DIRS) found.add(path14.join(home, dir));
36169
36210
  if (process.platform === "win32") {
36170
36211
  for (const letter of "CDEFG") {
36171
36212
  const drive = `${letter}:\\`;
36172
- if (!fs12.existsSync(drive)) continue;
36173
- for (const dir of CODE_DIRS) found.add(path13.join(drive, dir));
36213
+ if (!fs13.existsSync(drive)) continue;
36214
+ for (const dir of CODE_DIRS) found.add(path14.join(drive, dir));
36174
36215
  }
36175
36216
  }
36176
- const real = [...found].filter((dir) => dir !== path13.parse(dir).root && fs12.existsSync(dir)).map((dir) => fs12.realpathSync.native(dir));
36217
+ const real = [...found].filter((dir) => dir !== path14.parse(dir).root && fs13.existsSync(dir)).map((dir) => fs13.realpathSync.native(dir));
36177
36218
  return [...new Set(real)];
36178
36219
  }
36179
36220
  function scan() {
@@ -36185,22 +36226,22 @@ function scan() {
36185
36226
  visited += 1;
36186
36227
  let entries;
36187
36228
  try {
36188
- entries = fs12.readdirSync(dir, { withFileTypes: true });
36229
+ entries = fs13.readdirSync(dir, { withFileTypes: true });
36189
36230
  } catch {
36190
36231
  return;
36191
36232
  }
36192
36233
  if (depth > 0 && isProject(dir, entries)) {
36193
36234
  let mtimeMs = 0;
36194
36235
  try {
36195
- mtimeMs = fs12.statSync(dir).mtimeMs;
36236
+ mtimeMs = fs13.statSync(dir).mtimeMs;
36196
36237
  } catch {
36197
36238
  }
36198
- folders.set(dir.toLowerCase(), { path: dir, name: path13.basename(dir), mtimeMs });
36239
+ folders.set(dir.toLowerCase(), { path: dir, name: path14.basename(dir), mtimeMs });
36199
36240
  return;
36200
36241
  }
36201
36242
  for (const entry of entries) {
36202
36243
  if (!entry.isDirectory() || entry.name.startsWith(".") || SKIP.has(entry.name.toLowerCase())) continue;
36203
- walk(path13.join(dir, entry.name), depth + 1);
36244
+ walk(path14.join(dir, entry.name), depth + 1);
36204
36245
  }
36205
36246
  };
36206
36247
  for (const root2 of roots()) walk(root2, 0);
@@ -36250,7 +36291,7 @@ var init_folderFinder = __esm({
36250
36291
  MARKERS = [".git", "package.json", "pyproject.toml", "requirements.txt", "go.mod", "Cargo.toml", "pom.xml", "build.gradle", "composer.json", "Gemfile", "CLAUDE.md", ".claude"];
36251
36292
  PROJECT_FILE = /\.(sln|csproj)$/i;
36252
36293
  SKIP = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "out", "bin", "obj", "target", "vendor", "venv", ".venv", "__pycache__", "appdata", "library", "application data", "$recycle.bin", "program files", "program files (x86)", "windows", "programdata"]);
36253
- CODE_DIRS = ["source", "src", "repos", "projects", "code", "dev", "work", "git", "github", "workspace", "documents", "desktop", path13.join("source", "repos"), "source code"];
36294
+ CODE_DIRS = ["source", "src", "repos", "projects", "code", "dev", "work", "git", "github", "workspace", "documents", "desktop", path14.join("source", "repos"), "source code"];
36254
36295
  cache2 = null;
36255
36296
  CACHE_MS = 5 * 6e4;
36256
36297
  }
@@ -37191,14 +37232,14 @@ var init_interactions = __esm({
37191
37232
 
37192
37233
  // server/src/index.ts
37193
37234
  var import_cors = __toESM(require_lib(), 1);
37194
- var import_express4 = __toESM(require_express2(), 1);
37235
+ var import_express5 = __toESM(require_express2(), 1);
37195
37236
  init_wrapper();
37196
37237
  init_claudeCode();
37197
37238
  init_context();
37198
37239
  init_db();
37199
- import fs15 from "node:fs";
37240
+ import fs16 from "node:fs";
37200
37241
  import net from "node:net";
37201
- import path16 from "node:path";
37242
+ import path17 from "node:path";
37202
37243
  import { fileURLToPath as fileURLToPath2 } from "node:url";
37203
37244
 
37204
37245
  // server/src/devtools.ts
@@ -37284,21 +37325,273 @@ devRoutes.post("/drop", import_express.default.raw({ type: () => true, limit: "1
37284
37325
  }
37285
37326
  });
37286
37327
 
37287
- // server/src/fileRoutes.ts
37328
+ // server/src/variables.ts
37288
37329
  var import_express2 = __toESM(require_express2(), 1);
37330
+ init_db();
37331
+ init_paths();
37332
+ import crypto from "node:crypto";
37333
+ import fs4 from "node:fs";
37334
+ import os3 from "node:os";
37335
+ import path5 from "node:path";
37336
+ var variableRoutes = import_express2.default.Router();
37337
+ globalDb.exec(`
37338
+ CREATE TABLE IF NOT EXISTS variable_meta (
37339
+ id TEXT PRIMARY KEY, -- hash of the file and the place in it
37340
+ expires_at TEXT, -- noted by the person
37341
+ check_json TEXT, -- the last Check: { at, ok, detail, expiresAt }
37342
+ updated_at TEXT NOT NULL
37343
+ );
37344
+ `);
37345
+ function readJson(file) {
37346
+ try {
37347
+ return JSON.parse(fs4.readFileSync(file, "utf8"));
37348
+ } catch {
37349
+ return null;
37350
+ }
37351
+ }
37352
+ var idOf = (file, keys) => crypto.createHash("sha1").update(`${path5.resolve(file).toLowerCase()}\0${keys.join("\0")}`).digest("hex").slice(0, 16);
37353
+ function localProjectKey(config) {
37354
+ const wanted = [projectRoot(), projectRoot().replace(/\\/g, "/")].map((item) => item.toLowerCase());
37355
+ return Object.keys(config?.projects ?? {}).find((key) => wanted.includes(key.toLowerCase())) ?? null;
37356
+ }
37357
+ function locate() {
37358
+ const found = [];
37359
+ const add = (file, keys, scope, where, server2, value) => {
37360
+ if (typeof value !== "string") return;
37361
+ found.push({ id: idOf(file, keys), name: keys[keys.length - 1], file, keys, scope, where, server: server2, value });
37362
+ };
37363
+ const servers = (file, base, scope, list) => {
37364
+ for (const [server2, config] of Object.entries(list ?? {})) {
37365
+ for (const [name, value] of Object.entries(config?.env ?? {})) add(file, [...base, server2, "env", name], scope, `MCP server ${server2}, env`, server2, value);
37366
+ for (const [name, value] of Object.entries(config?.headers ?? {})) add(file, [...base, server2, "headers", name], scope, `MCP server ${server2}, header`, server2, value);
37367
+ }
37368
+ };
37369
+ const mcpJson = path5.join(projectRoot(), ".mcp.json");
37370
+ servers(mcpJson, ["mcpServers"], "project", readJson(mcpJson)?.mcpServers);
37371
+ const globalFile = path5.join(os3.homedir(), ".claude.json");
37372
+ const global3 = readJson(globalFile);
37373
+ servers(globalFile, ["mcpServers"], "user", global3?.mcpServers);
37374
+ const key = localProjectKey(global3);
37375
+ if (key) servers(globalFile, ["projects", key, "mcpServers"], "local", global3.projects[key]?.mcpServers);
37376
+ const settings = [
37377
+ [path5.join(claudeHome, "settings.json"), "user"],
37378
+ [path5.join(projectRoot(), ".claude", "settings.json"), "project"],
37379
+ [path5.join(projectRoot(), ".claude", "settings.local.json"), "local"]
37380
+ ];
37381
+ for (const [file, scope] of settings) {
37382
+ for (const [name, value] of Object.entries(readJson(file)?.env ?? {})) add(file, ["env", name], scope, "settings env", null, value);
37383
+ }
37384
+ return found;
37385
+ }
37386
+ var SECRET_NAME = /token|secret|password|passwd|pass\b|api[_-]?key|apikey|auth|credential|bearer|cookie|private|_key$|^key$/i;
37387
+ var REFERENCE = /^\$\{([A-Za-z_][A-Za-z0-9_]*)(?::-[^}]*)?\}$/;
37388
+ var tokenPart = (value) => value.replace(/^(bearer|token|basic)\s+/i, "").trim();
37389
+ function kindOf(value) {
37390
+ const token = tokenPart(value);
37391
+ if (/^eyJ[\w-]+\.eyJ[\w-]+\.[\w-]*$/.test(token)) return "jwt";
37392
+ if (/^(ghp_|github_pat_|gho_|ghu_|ghs_)/.test(token)) return "github";
37393
+ if (/^xox[abpe]-/.test(token)) return "slack";
37394
+ if (/^xapp-/.test(token)) return "slack-app";
37395
+ if (/^npm_/.test(token)) return "npm";
37396
+ if (/^sk-ant-/.test(token)) return "anthropic";
37397
+ if (/^sk-/.test(token)) return "openai";
37398
+ if (/^ATATT/.test(token)) return "atlassian";
37399
+ return null;
37400
+ }
37401
+ function jwtExpiry(value) {
37402
+ try {
37403
+ const payload = JSON.parse(Buffer.from(tokenPart(value).split(".")[1], "base64url").toString("utf8"));
37404
+ return typeof payload.exp === "number" ? new Date(payload.exp * 1e3).toISOString() : null;
37405
+ } catch {
37406
+ return null;
37407
+ }
37408
+ }
37409
+ var mask = (value) => value.length <= 10 ? "\u2022".repeat(Math.max(4, value.length)) : `${value.slice(0, 4)}${"\u2022".repeat(6)}${value.slice(-2)}`;
37410
+ function resolveReference(name, all) {
37411
+ if (process.env[name]) return process.env[name];
37412
+ return all.find((item) => item.where === "settings env" && item.name === name)?.value ?? null;
37413
+ }
37414
+ function meta(id) {
37415
+ const row = globalDb.prepare("SELECT expires_at, check_json FROM variable_meta WHERE id = ?").get(id);
37416
+ return { expiresAt: row?.expires_at ?? null, check: parseJson(row?.check_json, null) };
37417
+ }
37418
+ function saveMeta(id, patch) {
37419
+ const current = meta(id);
37420
+ globalDb.prepare(
37421
+ `INSERT INTO variable_meta (id, expires_at, check_json, updated_at) VALUES (?, ?, ?, ?)
37422
+ ON CONFLICT(id) DO UPDATE SET expires_at = excluded.expires_at, check_json = excluded.check_json, updated_at = excluded.updated_at`
37423
+ ).run(id, patch.expiresAt !== void 0 ? patch.expiresAt : current.expiresAt, JSON.stringify(patch.check ?? current.check), now());
37424
+ }
37425
+ var CHECKABLE = ["github", "slack", "npm"];
37426
+ function view(item, all) {
37427
+ const reference = REFERENCE.exec(item.value)?.[1] ?? null;
37428
+ const actual = reference ? resolveReference(reference, all) : item.value;
37429
+ const kind = actual ? kindOf(actual) : null;
37430
+ const secret = Boolean(kind) || SECRET_NAME.test(item.name);
37431
+ const stored = meta(item.id);
37432
+ const fromToken = kind === "jwt" && actual ? jwtExpiry(actual) : null;
37433
+ const expiresAt = fromToken ?? stored.check?.expiresAt ?? stored.expiresAt;
37434
+ return {
37435
+ id: item.id,
37436
+ name: item.name,
37437
+ file: item.file,
37438
+ scope: item.scope,
37439
+ where: item.where,
37440
+ server: item.server,
37441
+ shown: reference ? item.value : secret ? mask(item.value) : item.value,
37442
+ secret,
37443
+ reference,
37444
+ resolved: reference ? actual !== null : null,
37445
+ kind,
37446
+ expiresAt,
37447
+ expirySource: fromToken ? "token" : stored.check?.expiresAt ? "check" : stored.expiresAt ? "noted" : null,
37448
+ check: stored.check,
37449
+ checkable: Boolean(actual) && CHECKABLE.includes(kind),
37450
+ // A reference is set where it is defined, not here: writing a value over it would put the secret into the file.
37451
+ editable: !reference
37452
+ };
37453
+ }
37454
+ function listVariables() {
37455
+ const all = locate();
37456
+ return all.map((item) => view(item, all));
37457
+ }
37458
+ function find(id) {
37459
+ const all = locate();
37460
+ const item = all.find((entry) => entry.id === id);
37461
+ if (!item) throw new Error("That variable is no longer in its file.");
37462
+ return { item, all };
37463
+ }
37464
+ function actualValue(item, all) {
37465
+ const reference = REFERENCE.exec(item.value)?.[1];
37466
+ return reference ? resolveReference(reference, all) : item.value;
37467
+ }
37468
+ function writeVariable(id, value) {
37469
+ const { item } = find(id);
37470
+ if (REFERENCE.test(item.value)) throw new Error(`It refers to \${${REFERENCE.exec(item.value)[1]}}; change it where that is set.`);
37471
+ const text = fs4.readFileSync(item.file, "utf8");
37472
+ const data = JSON.parse(text);
37473
+ let node = data;
37474
+ for (const key of item.keys.slice(0, -1)) {
37475
+ node = node?.[key];
37476
+ if (!node || typeof node !== "object") throw new Error("The file changed; reload and try again.");
37477
+ }
37478
+ const last = item.keys[item.keys.length - 1];
37479
+ if (typeof node[last] !== "string") throw new Error("The file changed; reload and try again.");
37480
+ node[last] = value;
37481
+ const indent = /^([ \t]+)"/m.exec(text)?.[1] ?? " ";
37482
+ const eol = text.includes("\r\n") ? "\r\n" : "\n";
37483
+ let out = JSON.stringify(data, null, indent).replace(/\n/g, eol);
37484
+ if (/\r?\n$/.test(text)) out += eol;
37485
+ const temp = `${item.file}.${process.pid}.tmp`;
37486
+ fs4.writeFileSync(temp, out, "utf8");
37487
+ try {
37488
+ fs4.renameSync(temp, item.file);
37489
+ } catch {
37490
+ fs4.writeFileSync(item.file, out, "utf8");
37491
+ fs4.rmSync(temp, { force: true });
37492
+ }
37493
+ globalDb.prepare("UPDATE variable_meta SET check_json = NULL, updated_at = ? WHERE id = ?").run(now(), id);
37494
+ return listVariables().find((entry) => entry.id === id) ?? view({ ...item, value }, []);
37495
+ }
37496
+ async function checkToken(kind, value) {
37497
+ const token = tokenPart(value);
37498
+ const at = (/* @__PURE__ */ new Date()).toISOString();
37499
+ const signal = AbortSignal.timeout(1e4);
37500
+ if (kind === "github") {
37501
+ const response = await fetch("https://api.github.com/user", { headers: { authorization: `token ${token}`, "user-agent": "clauder-hub", accept: "application/vnd.github+json" }, signal });
37502
+ const header = response.headers.get("github-authentication-token-expiration");
37503
+ const expiresAt = header ? new Date(header.replace(" UTC", "Z").replace(" ", "T")).toISOString() : null;
37504
+ if (!response.ok) return { at, ok: false, detail: `GitHub answered ${response.status}: the token is not accepted.`, expiresAt };
37505
+ const user = await response.json().catch(() => ({}));
37506
+ return { at, ok: true, detail: `Works as ${user.login ?? "a GitHub user"}${expiresAt ? "" : "; it does not expire"}.`, expiresAt };
37507
+ }
37508
+ if (kind === "slack") {
37509
+ const response = await fetch("https://slack.com/api/auth.test", { method: "POST", headers: { authorization: `Bearer ${token}` }, signal });
37510
+ const body = await response.json().catch(() => ({}));
37511
+ return body.ok ? { at, ok: true, detail: `Works for ${body.user ?? "a user"} in ${body.team ?? "the workspace"}.`, expiresAt: null } : { at, ok: false, detail: `Slack says ${body.error ?? response.status}.`, expiresAt: null };
37512
+ }
37513
+ if (kind === "npm") {
37514
+ const response = await fetch("https://registry.npmjs.org/-/whoami", { headers: { authorization: `Bearer ${token}` }, signal });
37515
+ const body = await response.json().catch(() => ({}));
37516
+ return response.ok ? { at, ok: true, detail: `Works as ${body.username ?? "an npm user"}.`, expiresAt: null } : { at, ok: false, detail: `npm answered ${response.status}: the token is not accepted.`, expiresAt: null };
37517
+ }
37518
+ throw new Error("This kind of token cannot be checked.");
37519
+ }
37520
+ function samePage(req, res) {
37521
+ const site = req.get("sec-fetch-site");
37522
+ if (site && site !== "same-origin" && site !== "none") {
37523
+ res.status(403).json({ error: "Not from this page." });
37524
+ return false;
37525
+ }
37526
+ return true;
37527
+ }
37528
+ var fail = (res, error) => res.status(400).json({ error: error.message });
37529
+ variableRoutes.get("/variables", (_req, res) => {
37530
+ try {
37531
+ res.json(listVariables());
37532
+ } catch (error) {
37533
+ fail(res, error);
37534
+ }
37535
+ });
37536
+ variableRoutes.get("/variables/:id/value", (req, res) => {
37537
+ if (!samePage(req, res)) return;
37538
+ try {
37539
+ const { item, all } = find(req.params.id);
37540
+ res.json({ value: actualValue(item, all) });
37541
+ } catch (error) {
37542
+ fail(res, error);
37543
+ }
37544
+ });
37545
+ variableRoutes.put("/variables/:id", import_express2.default.json(), (req, res) => {
37546
+ if (!samePage(req, res)) return;
37547
+ const value = req.body?.value;
37548
+ if (typeof value !== "string") return void res.status(400).json({ error: "A value is needed." });
37549
+ try {
37550
+ res.json(writeVariable(req.params.id, value));
37551
+ } catch (error) {
37552
+ fail(res, error);
37553
+ }
37554
+ });
37555
+ variableRoutes.put("/variables/:id/expiry", import_express2.default.json(), (req, res) => {
37556
+ const date = req.body?.expiresAt;
37557
+ if (date !== null && (typeof date !== "string" || Number.isNaN(Date.parse(date)))) return void res.status(400).json({ error: "A date, or null to clear it." });
37558
+ try {
37559
+ find(req.params.id);
37560
+ saveMeta(req.params.id, { expiresAt: date ? new Date(date).toISOString() : null });
37561
+ res.json(listVariables().find((entry) => entry.id === req.params.id));
37562
+ } catch (error) {
37563
+ fail(res, error);
37564
+ }
37565
+ });
37566
+ variableRoutes.post("/variables/:id/check", async (req, res) => {
37567
+ if (!samePage(req, res)) return;
37568
+ try {
37569
+ const { item, all } = find(req.params.id);
37570
+ const value = actualValue(item, all);
37571
+ if (!value) throw new Error("It has no value here to check.");
37572
+ const check3 = await checkToken(kindOf(value), value);
37573
+ saveMeta(item.id, { check: check3 });
37574
+ res.json(listVariables().find((entry) => entry.id === item.id));
37575
+ } catch (error) {
37576
+ fail(res, error);
37577
+ }
37578
+ });
37579
+
37580
+ // server/src/fileRoutes.ts
37581
+ var import_express3 = __toESM(require_express2(), 1);
37289
37582
 
37290
37583
  // server/src/blame.ts
37291
37584
  import { execFile as execFile3 } from "node:child_process";
37292
- import fs5 from "node:fs";
37293
- import path6 from "node:path";
37585
+ import fs6 from "node:fs";
37586
+ import path7 from "node:path";
37294
37587
 
37295
37588
  // server/src/files.ts
37296
37589
  var import_ignore = __toESM(require_ignore(), 1);
37297
37590
  init_events();
37298
37591
  init_paths();
37299
37592
  import { spawn } from "node:child_process";
37300
- import fs4 from "node:fs";
37301
- import path5 from "node:path";
37593
+ import fs5 from "node:fs";
37594
+ import path6 from "node:path";
37302
37595
  var MAX_TEXT_BYTES = 2 * 1024 * 1024;
37303
37596
  var FileError = class extends Error {
37304
37597
  constructor(message, status2 = 400) {
@@ -37309,17 +37602,17 @@ var FileError = class extends Error {
37309
37602
  };
37310
37603
  function realRoot() {
37311
37604
  try {
37312
- return fs4.realpathSync(projectRoot());
37605
+ return fs5.realpathSync(projectRoot());
37313
37606
  } catch {
37314
37607
  return projectRoot();
37315
37608
  }
37316
37609
  }
37317
37610
  function inside(root2, target2) {
37318
- const relative = path5.relative(root2, target2);
37319
- return relative === "" || !relative.startsWith("..") && !path5.isAbsolute(relative);
37611
+ const relative = path6.relative(root2, target2);
37612
+ return relative === "" || !relative.startsWith("..") && !path6.isAbsolute(relative);
37320
37613
  }
37321
37614
  function toRel(absolute) {
37322
- return path5.relative(projectRoot(), absolute).split(path5.sep).join("/");
37615
+ return path6.relative(projectRoot(), absolute).split(path6.sep).join("/");
37323
37616
  }
37324
37617
  function resolvePath(input) {
37325
37618
  if (typeof input !== "string") throw new FileError("A path is required.");
@@ -37329,13 +37622,13 @@ function resolvePath(input) {
37329
37622
  if (process.platform === "win32" && clean.includes(":")) throw new FileError("Invalid path.");
37330
37623
  const segments = clean.split("/").filter((segment) => segment !== "" && segment !== ".");
37331
37624
  if (segments.some((segment) => segment === "..")) throw new FileError("Paths may not leave the project.");
37332
- const absolute = path5.resolve(projectRoot(), ...segments);
37625
+ const absolute = path6.resolve(projectRoot(), ...segments);
37333
37626
  if (!inside(projectRoot(), absolute)) throw new FileError("Paths may not leave the project.");
37334
37627
  let probe = absolute;
37335
- while (!fs4.existsSync(probe) && inside(projectRoot(), path5.dirname(probe)) && probe !== projectRoot()) probe = path5.dirname(probe);
37628
+ while (!fs5.existsSync(probe) && inside(projectRoot(), path6.dirname(probe)) && probe !== projectRoot()) probe = path6.dirname(probe);
37336
37629
  let real;
37337
37630
  try {
37338
- real = fs4.realpathSync(probe);
37631
+ real = fs5.realpathSync(probe);
37339
37632
  } catch {
37340
37633
  throw new FileError("That path cannot be resolved.");
37341
37634
  }
@@ -37350,10 +37643,10 @@ function refuseRoot(absolute) {
37350
37643
  }
37351
37644
  var gitignores = /* @__PURE__ */ new Map();
37352
37645
  function rulesIn(dir) {
37353
- const file = path5.join(dir, ".gitignore");
37646
+ const file = path6.join(dir, ".gitignore");
37354
37647
  let mtimeMs;
37355
37648
  try {
37356
- mtimeMs = fs4.statSync(file).mtimeMs;
37649
+ mtimeMs = fs5.statSync(file).mtimeMs;
37357
37650
  } catch {
37358
37651
  gitignores.delete(file);
37359
37652
  return null;
@@ -37362,7 +37655,7 @@ function rulesIn(dir) {
37362
37655
  if (cached2?.mtimeMs === mtimeMs) return cached2.rules;
37363
37656
  let rules = null;
37364
37657
  try {
37365
- rules = (0, import_ignore.default)().add(fs4.readFileSync(file, "utf8"));
37658
+ rules = (0, import_ignore.default)().add(fs5.readFileSync(file, "utf8"));
37366
37659
  } catch {
37367
37660
  }
37368
37661
  gitignores.set(file, { mtimeMs, rules });
@@ -37373,7 +37666,7 @@ function ignoredBy(rel, isDir) {
37373
37666
  if (segments.includes(".git")) return true;
37374
37667
  let ignored = false;
37375
37668
  for (let depth = 0; depth < segments.length; depth += 1) {
37376
- const rules = rulesIn(path5.join(projectRoot(), ...segments.slice(0, depth)));
37669
+ const rules = rulesIn(path6.join(projectRoot(), ...segments.slice(0, depth)));
37377
37670
  if (!rules) continue;
37378
37671
  const local = segments.slice(depth).join("/") + (isDir ? "/" : "");
37379
37672
  const result = rules.test(local);
@@ -37394,17 +37687,17 @@ function listFolder(relInput, showIgnored) {
37394
37687
  if (parentIgnored && !showIgnored) return { path: rel, entries: [] };
37395
37688
  let dirents;
37396
37689
  try {
37397
- dirents = fs4.readdirSync(absolute, { withFileTypes: true });
37690
+ dirents = fs5.readdirSync(absolute, { withFileTypes: true });
37398
37691
  } catch {
37399
37692
  throw new FileError("No such folder.", 404);
37400
37693
  }
37401
37694
  const entries = [];
37402
37695
  for (const dirent of dirents) {
37403
- const full = path5.join(absolute, dirent.name);
37696
+ const full = path6.join(absolute, dirent.name);
37404
37697
  let stat;
37405
37698
  try {
37406
- if (dirent.isSymbolicLink() && !inside(realRoot(), fs4.realpathSync(full))) continue;
37407
- stat = fs4.statSync(full);
37699
+ if (dirent.isSymbolicLink() && !inside(realRoot(), fs5.realpathSync(full))) continue;
37700
+ stat = fs5.statSync(full);
37408
37701
  } catch {
37409
37702
  continue;
37410
37703
  }
@@ -37422,13 +37715,13 @@ function readText(relInput) {
37422
37715
  const rel = toRel(absolute);
37423
37716
  let stat;
37424
37717
  try {
37425
- stat = fs4.statSync(absolute);
37718
+ stat = fs5.statSync(absolute);
37426
37719
  } catch {
37427
37720
  throw new FileError("No such file.", 404);
37428
37721
  }
37429
37722
  if (!stat.isFile()) throw new FileError("That is not a file.");
37430
37723
  if (stat.size > MAX_TEXT_BYTES) return { path: rel, kind: "too-large", size: stat.size, mtimeMs: stat.mtimeMs };
37431
- const bytes = fs4.readFileSync(absolute);
37724
+ const bytes = fs5.readFileSync(absolute);
37432
37725
  if (bytes.subarray(0, 8e3).includes(0)) return { path: rel, kind: "binary", size: stat.size, mtimeMs: stat.mtimeMs };
37433
37726
  return { path: rel, kind: "text", content: bytes.toString("utf8"), size: stat.size, mtimeMs: stat.mtimeMs };
37434
37727
  }
@@ -37436,7 +37729,7 @@ function statFile(relInput) {
37436
37729
  const absolute = resolvePath(relInput);
37437
37730
  const rel = toRel(absolute);
37438
37731
  try {
37439
- const stat = fs4.statSync(absolute);
37732
+ const stat = fs5.statSync(absolute);
37440
37733
  return { path: rel, exists: stat.isFile(), mtimeMs: stat.mtimeMs, size: stat.size };
37441
37734
  } catch {
37442
37735
  return { path: rel, exists: false, mtimeMs: 0, size: 0 };
@@ -37456,7 +37749,7 @@ function writeText(relInput, contentInput, expectedMtimeMs) {
37456
37749
  const content = checkContent(contentInput);
37457
37750
  let stat;
37458
37751
  try {
37459
- stat = fs4.statSync(absolute);
37752
+ stat = fs5.statSync(absolute);
37460
37753
  } catch {
37461
37754
  throw new FileError("No such file.", 404);
37462
37755
  }
@@ -37464,8 +37757,8 @@ function writeText(relInput, contentInput, expectedMtimeMs) {
37464
37757
  if (typeof expectedMtimeMs === "number" && Math.abs(stat.mtimeMs - expectedMtimeMs) > 1) {
37465
37758
  throw new FileError("The file changed on disk since it was opened.", 409);
37466
37759
  }
37467
- fs4.writeFileSync(absolute, content, "utf8");
37468
- const after = fs4.statSync(absolute);
37760
+ fs5.writeFileSync(absolute, content, "utf8");
37761
+ const after = fs5.statSync(absolute);
37469
37762
  changed(absolute);
37470
37763
  return { path: toRel(absolute), size: after.size, mtimeMs: after.mtimeMs };
37471
37764
  }
@@ -37474,9 +37767,9 @@ function createFile(relInput, contentInput = "") {
37474
37767
  refuseRoot(absolute);
37475
37768
  refuseGit(absolute);
37476
37769
  const content = checkContent(contentInput);
37477
- if (!fs4.existsSync(path5.dirname(absolute))) throw new FileError("The folder does not exist.");
37770
+ if (!fs5.existsSync(path6.dirname(absolute))) throw new FileError("The folder does not exist.");
37478
37771
  try {
37479
- fs4.writeFileSync(absolute, content, { encoding: "utf8", flag: "wx" });
37772
+ fs5.writeFileSync(absolute, content, { encoding: "utf8", flag: "wx" });
37480
37773
  } catch (error) {
37481
37774
  if (error.code === "EEXIST") throw new FileError("Something with that name already exists.", 409);
37482
37775
  throw error;
@@ -37488,9 +37781,9 @@ function createFolder(relInput) {
37488
37781
  const absolute = resolvePath(relInput);
37489
37782
  refuseRoot(absolute);
37490
37783
  refuseGit(absolute);
37491
- if (fs4.existsSync(absolute)) throw new FileError("Something with that name already exists.", 409);
37492
- if (!fs4.existsSync(path5.dirname(absolute))) throw new FileError("The folder does not exist.");
37493
- fs4.mkdirSync(absolute);
37784
+ if (fs5.existsSync(absolute)) throw new FileError("Something with that name already exists.", 409);
37785
+ if (!fs5.existsSync(path6.dirname(absolute))) throw new FileError("The folder does not exist.");
37786
+ fs5.mkdirSync(absolute);
37494
37787
  changed(absolute);
37495
37788
  return { path: toRel(absolute) };
37496
37789
  }
@@ -37501,12 +37794,12 @@ function renamePath(fromInput, toInput) {
37501
37794
  refuseRoot(absolute);
37502
37795
  refuseGit(absolute);
37503
37796
  }
37504
- if (!fs4.existsSync(from)) throw new FileError("No such file or folder.", 404);
37505
- const caseOnly = from !== to && from.toLowerCase() === to.toLowerCase() && fs4.existsSync(to) && fs4.statSync(from).ino === fs4.statSync(to).ino;
37506
- if (fs4.existsSync(to) && !caseOnly) throw new FileError("Something with that name already exists.", 409);
37797
+ if (!fs5.existsSync(from)) throw new FileError("No such file or folder.", 404);
37798
+ const caseOnly = from !== to && from.toLowerCase() === to.toLowerCase() && fs5.existsSync(to) && fs5.statSync(from).ino === fs5.statSync(to).ino;
37799
+ if (fs5.existsSync(to) && !caseOnly) throw new FileError("Something with that name already exists.", 409);
37507
37800
  if (inside(from, to) && !caseOnly) throw new FileError("A folder cannot move into itself.");
37508
- if (!fs4.existsSync(path5.dirname(to))) throw new FileError("The target folder does not exist.");
37509
- fs4.renameSync(from, to);
37801
+ if (!fs5.existsSync(path6.dirname(to))) throw new FileError("The target folder does not exist.");
37802
+ fs5.renameSync(from, to);
37510
37803
  changed(from, to);
37511
37804
  return { path: toRel(to) };
37512
37805
  }
@@ -37515,16 +37808,16 @@ function copyPath(fromInput, folderInput) {
37515
37808
  const folder = resolvePath(folderInput ?? "");
37516
37809
  refuseRoot(from);
37517
37810
  refuseGit(folder);
37518
- if (!fs4.existsSync(from)) throw new FileError("No such file or folder.", 404);
37519
- if (!fs4.existsSync(folder) || !fs4.statSync(folder).isDirectory()) throw new FileError("Paste into a folder.");
37811
+ if (!fs5.existsSync(from)) throw new FileError("No such file or folder.", 404);
37812
+ if (!fs5.existsSync(folder) || !fs5.statSync(folder).isDirectory()) throw new FileError("Paste into a folder.");
37520
37813
  if (inside(from, folder)) throw new FileError("A folder cannot be copied into itself.");
37521
- const name = path5.basename(from);
37522
- const isDir = fs4.statSync(from).isDirectory();
37814
+ const name = path6.basename(from);
37815
+ const isDir = fs5.statSync(from).isDirectory();
37523
37816
  const dot = isDir ? -1 : name.lastIndexOf(".");
37524
37817
  const [stem, extension2] = dot > 0 ? [name.slice(0, dot), name.slice(dot)] : [name, ""];
37525
- let target2 = path5.join(folder, name);
37526
- for (let n2 = 1; fs4.existsSync(target2); n2 += 1) target2 = path5.join(folder, `${stem} copy${n2 > 1 ? ` ${n2}` : ""}${extension2}`);
37527
- fs4.cpSync(from, target2, { recursive: true, errorOnExist: true, force: false });
37818
+ let target2 = path6.join(folder, name);
37819
+ for (let n2 = 1; fs5.existsSync(target2); n2 += 1) target2 = path6.join(folder, `${stem} copy${n2 > 1 ? ` ${n2}` : ""}${extension2}`);
37820
+ fs5.cpSync(from, target2, { recursive: true, errorOnExist: true, force: false });
37528
37821
  changed(target2);
37529
37822
  return { path: toRel(target2) };
37530
37823
  }
@@ -37551,7 +37844,7 @@ for ($i = 0; $i -lt 30; $i++) {
37551
37844
  `;
37552
37845
  function revealPath(relInput) {
37553
37846
  const absolute = resolvePath(relInput);
37554
- if (!fs4.existsSync(absolute)) throw new FileError("No such file or folder.", 404);
37847
+ if (!fs5.existsSync(absolute)) throw new FileError("No such file or folder.", 404);
37555
37848
  if (process.platform === "linux" && !process.env.DISPLAY && !process.env.WAYLAND_DISPLAY) {
37556
37849
  throw new FileError("There is no desktop session on the machine running the hub, so no file manager to open.", 409);
37557
37850
  }
@@ -37564,9 +37857,9 @@ function revealPath(relInput) {
37564
37857
  ...options,
37565
37858
  detached: false,
37566
37859
  windowsHide: true,
37567
- env: { ...process.env, CLAUDER_REVEAL: absolute, CLAUDER_REVEAL_DIR: path5.dirname(absolute) }
37860
+ env: { ...process.env, CLAUDER_REVEAL: absolute, CLAUDER_REVEAL_DIR: path6.dirname(absolute) }
37568
37861
  })
37569
- ) : process.platform === "darwin" ? spawn("open", ["-R", absolute], options) : spawn("xdg-open", [fs4.statSync(absolute).isDirectory() ? absolute : path5.dirname(absolute)], options);
37862
+ ) : process.platform === "darwin" ? spawn("open", ["-R", absolute], options) : spawn("xdg-open", [fs5.statSync(absolute).isDirectory() ? absolute : path6.dirname(absolute)], options);
37570
37863
  return new Promise((resolve, reject) => {
37571
37864
  child.once("error", (error) => reject(new FileError(`Could not open the file manager: ${error.message}`, 409)));
37572
37865
  child.once("spawn", () => {
@@ -37577,7 +37870,7 @@ function revealPath(relInput) {
37577
37870
  }
37578
37871
  function copyFileToClipboard(relInput) {
37579
37872
  const absolute = resolvePath(relInput);
37580
- if (!fs4.existsSync(absolute)) throw new FileError("No such file or folder.", 404);
37873
+ if (!fs5.existsSync(absolute)) throw new FileError("No such file or folder.", 404);
37581
37874
  const run4 = (command, args, env = process.env) => new Promise((resolve, reject) => {
37582
37875
  const child = spawn(command, args, { windowsHide: true, env, stdio: ["ignore", "ignore", "pipe"] });
37583
37876
  let errorText = "";
@@ -37614,11 +37907,11 @@ function deletePath(relInput) {
37614
37907
  refuseRoot(absolute);
37615
37908
  refuseGit(absolute);
37616
37909
  try {
37617
- fs4.lstatSync(absolute);
37910
+ fs5.lstatSync(absolute);
37618
37911
  } catch {
37619
37912
  throw new FileError("No such file or folder.", 404);
37620
37913
  }
37621
- fs4.rmSync(absolute, { recursive: true, force: false });
37914
+ fs5.rmSync(absolute, { recursive: true, force: false });
37622
37915
  changed(absolute);
37623
37916
  return { path: toRel(absolute) };
37624
37917
  }
@@ -37661,10 +37954,10 @@ function parsePorcelain(text) {
37661
37954
  }
37662
37955
  async function blameFile(relInput) {
37663
37956
  const absolute = resolvePath(relInput);
37664
- const rel = path6.relative(projectRoot(), absolute).split(path6.sep).join("/");
37957
+ const rel = path7.relative(projectRoot(), absolute).split(path7.sep).join("/");
37665
37958
  let stat;
37666
37959
  try {
37667
- stat = fs5.statSync(absolute);
37960
+ stat = fs6.statSync(absolute);
37668
37961
  } catch {
37669
37962
  throw new FileError("No such file.", 404);
37670
37963
  }
@@ -37703,7 +37996,7 @@ async function commitDetails(sha) {
37703
37996
  }
37704
37997
 
37705
37998
  // server/src/fileRoutes.ts
37706
- var fileRoutes = import_express2.default.Router();
37999
+ var fileRoutes = import_express3.default.Router();
37707
38000
  var wrap = (handler) => (req, res) => {
37708
38001
  try {
37709
38002
  res.json(handler(req));
@@ -37752,25 +38045,25 @@ init_paths();
37752
38045
  init_projects();
37753
38046
 
37754
38047
  // server/src/routes.ts
37755
- var import_express3 = __toESM(require_express2(), 1);
38048
+ var import_express4 = __toESM(require_express2(), 1);
37756
38049
  init_categories();
37757
38050
  init_channels();
37758
38051
  init_claudeCode();
37759
- import fs14 from "node:fs";
37760
- import os6 from "node:os";
37761
- import path15 from "node:path";
38052
+ import fs15 from "node:fs";
38053
+ import os7 from "node:os";
38054
+ import path16 from "node:path";
37762
38055
 
37763
38056
  // server/src/fileIcons.ts
37764
- import fs13 from "node:fs";
38057
+ import fs14 from "node:fs";
37765
38058
  import nodeModule from "node:module";
37766
- import path14 from "node:path";
38059
+ import path15 from "node:path";
37767
38060
  var resolveFrom = nodeModule.createRequire(import.meta.url);
37768
- var root = path14.dirname(resolveFrom.resolve("material-icon-theme/package.json"));
37769
- var iconsDir = path14.join(root, "icons");
38061
+ var root = path15.dirname(resolveFrom.resolve("material-icon-theme/package.json"));
38062
+ var iconsDir = path15.join(root, "icons");
37770
38063
  var manifest = null;
37771
38064
  function iconManifest() {
37772
38065
  if (!manifest) {
37773
- const full = JSON.parse(fs13.readFileSync(path14.join(root, "dist", "material-icons.json"), "utf8"));
38066
+ const full = JSON.parse(fs14.readFileSync(path15.join(root, "dist", "material-icons.json"), "utf8"));
37774
38067
  manifest = {
37775
38068
  file: full.file,
37776
38069
  folder: full.folder,
@@ -37785,8 +38078,8 @@ function iconManifest() {
37785
38078
  }
37786
38079
  function iconFile(name) {
37787
38080
  if (!/^[\w.-]+$/.test(name)) return null;
37788
- const file = path14.join(iconsDir, `${name}.svg`);
37789
- return fs13.existsSync(file) ? file : null;
38081
+ const file = path15.join(iconsDir, `${name}.svg`);
38082
+ return fs14.existsSync(file) ? file : null;
37790
38083
  }
37791
38084
 
37792
38085
  // server/src/routes.ts
@@ -37938,8 +38231,8 @@ init_purposes();
37938
38231
  init_sessionFiles();
37939
38232
  init_toolset();
37940
38233
  init_transcripts();
37941
- var api = import_express3.default.Router();
37942
- var hubApi = import_express3.default.Router();
38234
+ var api = import_express4.default.Router();
38235
+ var hubApi = import_express4.default.Router();
37943
38236
  var wrap2 = (handler) => async (req, res) => {
37944
38237
  try {
37945
38238
  const result = await handler(req, res);
@@ -38062,15 +38355,15 @@ hubApi.delete("/projects/:id", wrap2((req) => removeProject(req.params.id)));
38062
38355
  hubApi.get(
38063
38356
  "/folders",
38064
38357
  wrap2((req) => {
38065
- const target2 = path15.resolve(String(req.query.path || os6.homedir()));
38066
- if (!fs14.existsSync(target2) || !fs14.statSync(target2).isDirectory()) throw new Error(`${target2} is not a folder.`);
38067
- const folders = fs14.readdirSync(target2, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => {
38068
- const full = path15.join(target2, entry.name);
38069
- return { name: entry.name, path: full, git: fs14.existsSync(path15.join(full, ".git")) };
38358
+ const target2 = path16.resolve(String(req.query.path || os7.homedir()));
38359
+ if (!fs15.existsSync(target2) || !fs15.statSync(target2).isDirectory()) throw new Error(`${target2} is not a folder.`);
38360
+ const folders = fs15.readdirSync(target2, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => {
38361
+ const full = path16.join(target2, entry.name);
38362
+ return { name: entry.name, path: full, git: fs15.existsSync(path16.join(full, ".git")) };
38070
38363
  }).sort((a, b2) => a.name.localeCompare(b2.name, void 0, { sensitivity: "base" }));
38071
- const parent = path15.dirname(target2);
38072
- const drives = process.platform === "win32" ? "CDEFGHIJKLMNOPQRSTUVWXYZ".split("").map((letter) => `${letter}:\\`).filter((drive) => fs14.existsSync(drive)) : ["/"];
38073
- return { path: target2, parent: parent === target2 ? null : parent, home: os6.homedir(), drives, folders };
38364
+ const parent = path16.dirname(target2);
38365
+ const drives = process.platform === "win32" ? "CDEFGHIJKLMNOPQRSTUVWXYZ".split("").map((letter) => `${letter}:\\`).filter((drive) => fs15.existsSync(drive)) : ["/"];
38366
+ return { path: target2, parent: parent === target2 ? null : parent, home: os7.homedir(), drives, folders };
38074
38367
  })
38075
38368
  );
38076
38369
  hubApi.get("/file-icons/manifest", wrap2(() => iconManifest()));
@@ -38080,10 +38373,10 @@ hubApi.get("/file-icons/:name.svg", (req, res) => {
38080
38373
  res.sendFile(file, { maxAge: "7d" });
38081
38374
  });
38082
38375
  var localFile = (value) => {
38083
- const file = typeof value === "string" ? path15.normalize(value) : "";
38084
- if (!path15.isAbsolute(file) || process.platform === "win32" && !/^[A-Za-z]:\\/.test(file)) return null;
38376
+ const file = typeof value === "string" ? path16.normalize(value) : "";
38377
+ if (!path16.isAbsolute(file) || process.platform === "win32" && !/^[A-Za-z]:\\/.test(file)) return null;
38085
38378
  try {
38086
- return fs14.statSync(file).isFile() ? file : null;
38379
+ return fs15.statSync(file).isFile() ? file : null;
38087
38380
  } catch {
38088
38381
  return null;
38089
38382
  }
@@ -38120,19 +38413,19 @@ api.get(
38120
38413
  "/sessions/:id",
38121
38414
  wrap2((req) => {
38122
38415
  const id = req.params.id;
38123
- const view = listSessions().find((item) => item.id === id);
38124
- if (!view) throw new Error("No such session.");
38416
+ const view2 = listSessions().find((item) => item.id === id);
38417
+ if (!view2) throw new Error("No such session.");
38125
38418
  const terminal = terminalForSession(id);
38126
- const promptFile = terminal ? path15.join(runDir, `${terminal.token}.prompt.md`) : null;
38419
+ const promptFile = terminal ? path16.join(runDir, `${terminal.token}.prompt.md`) : null;
38127
38420
  return {
38128
- session: view,
38421
+ session: view2,
38129
38422
  detail: transcriptDetail(id),
38130
38423
  interactions: withPresentation(listInteractions({ sessionId: id, limit: 50 })),
38131
38424
  toolset: sessionToolset(id),
38132
38425
  setup: sessionSetup(id),
38133
38426
  // Built fresh each time, so an edit session shows the item as it stands now.
38134
- purposeNote: view.purpose ? purposeNote(view.purpose, hubUrl()) : null,
38135
- systemPrompt: promptFile && fs14.existsSync(promptFile) ? fs14.readFileSync(promptFile, "utf8") : view.origin === "external" ? null : systemPromptFor(getSessionRow(id)?.category ?? null, view.purpose, sessionSetup(id))
38427
+ purposeNote: view2.purpose ? purposeNote(view2.purpose, hubUrl()) : null,
38428
+ systemPrompt: promptFile && fs15.existsSync(promptFile) ? fs15.readFileSync(promptFile, "utf8") : view2.origin === "external" ? null : systemPromptFor(getSessionRow(id)?.category ?? null, view2.purpose, sessionSetup(id))
38136
38429
  };
38137
38430
  })
38138
38431
  );
@@ -38147,12 +38440,16 @@ api.post(
38147
38440
  api.post(
38148
38441
  "/purpose-sessions",
38149
38442
  wrap2((req) => {
38150
- const { kind, targetId, cols, rows } = req.body ?? {};
38151
- const purpose = { kind, ...targetId ? { targetId: String(targetId) } : {} };
38443
+ const { kind, targetId, draft, cols, rows } = req.body ?? {};
38444
+ const purpose = {
38445
+ kind,
38446
+ ...targetId ? { targetId: String(targetId) } : {},
38447
+ ...draft && typeof draft === "object" && !Array.isArray(draft) ? { draft } : {}
38448
+ };
38152
38449
  if (!isPurpose(purpose)) throw new Error("Unknown purpose.");
38153
38450
  if (kind.startsWith("edit-") && !purpose.targetId) throw new Error("Editing needs the id of what is edited.");
38154
38451
  const entry = kind === "add-mcp" ? catalogEntry(purpose.targetId) : null;
38155
- const prompt = kind !== "add-mcp" ? void 0 : entry ? renderPrompt("typed.addMcp", { server: entry.name }) : renderPrompt("typed.addAnyMcp", {});
38452
+ const prompt = kind === "add-mcp" ? entry ? renderPrompt("typed.addMcp", { server: entry.name }) : renderPrompt("typed.addAnyMcp", {}) : purpose.draft ? renderPrompt("typed.fromForm", {}) : void 0;
38156
38453
  const terminal = startSession({ purpose, prompt, name: `Hub: ${purposeTitle(purpose)}`, origin: "manual", cols, rows });
38157
38454
  return { sessionId: terminal.sessionId, terminalId: terminal.id };
38158
38455
  })
@@ -38289,7 +38586,7 @@ api.get(
38289
38586
  const file = String(req.query.path ?? "");
38290
38587
  const writable = isMemoryFile(file);
38291
38588
  if (!writable && !isDefinitionFile(file)) throw new Error("Not one of the files the hub manages.");
38292
- return { path: file, content: fs14.existsSync(file) ? fs14.readFileSync(file, "utf8") : "", writable };
38589
+ return { path: file, content: fs15.existsSync(file) ? fs15.readFileSync(file, "utf8") : "", writable };
38293
38590
  })
38294
38591
  );
38295
38592
  api.put(
@@ -38299,8 +38596,8 @@ api.put(
38299
38596
  const content = req.body?.content;
38300
38597
  if (!isMemoryFile(file)) throw new Error("Not one of the files the hub manages.");
38301
38598
  if (typeof content !== "string") throw new Error("No content.");
38302
- fs14.mkdirSync(path15.dirname(file), { recursive: true });
38303
- fs14.writeFileSync(file, content, "utf8");
38599
+ fs15.mkdirSync(path16.dirname(file), { recursive: true });
38600
+ fs15.writeFileSync(file, content, "utf8");
38304
38601
  return { path: file, content };
38305
38602
  })
38306
38603
  );
@@ -38346,6 +38643,8 @@ api.post(
38346
38643
  })
38347
38644
  );
38348
38645
  api.get("/runs", wrap2(() => listRuns()));
38646
+ api.get("/queue-settings", wrap2(() => ({ maxRuns: maxRuns(), limit: MAX_RUNS_LIMIT })));
38647
+ api.put("/queue-settings", wrap2((req) => ({ maxRuns: setMaxRuns(req.body?.maxRuns), limit: MAX_RUNS_LIMIT })));
38349
38648
  api.post("/runs/:id/stop", wrap2((req) => stopRun(req.params.id)));
38350
38649
  api.post("/runs/:id/resume", wrap2((req) => resumeRun(req.params.id)));
38351
38650
  api.post("/runs", wrap2((req) => enqueue({ source: "manual", prompt: String(req.body?.prompt ?? ""), category: req.body?.category || "auto" })));
@@ -38369,8 +38668,8 @@ hubApi.post("/hooks/:token", (req, res) => {
38369
38668
  if (!project) return;
38370
38669
  withProject(project, () => handleHook(req.params.token, req.body)).catch((error) => console.error("[hook]", error));
38371
38670
  });
38372
- function inProjectWith(find2) {
38373
- return allProjects().find((project) => withProject(project, () => Boolean(find2()))) ?? null;
38671
+ function inProjectWith(find3) {
38672
+ return allProjects().find((project) => withProject(project, () => Boolean(find3()))) ?? null;
38374
38673
  }
38375
38674
  hubApi.post("/trigger/:id", (req, res, next) => {
38376
38675
  const project = inProjectWith(() => getJob(req.params.id));
@@ -38389,10 +38688,10 @@ init_terminals();
38389
38688
  var port = Number(process.env.PORT ?? 4329);
38390
38689
  var requested = process.env.CLAUDER_HUB_PROJECT;
38391
38690
  ensureLayout();
38392
- var lockFile = path16.join(hubHome, "hub.lock");
38691
+ var lockFile = path17.join(hubHome, "hub.lock");
38393
38692
  var readLock = () => {
38394
38693
  try {
38395
- return JSON.parse(fs15.readFileSync(lockFile, "utf8"));
38694
+ return JSON.parse(fs16.readFileSync(lockFile, "utf8"));
38396
38695
  } catch {
38397
38696
  return null;
38398
38697
  }
@@ -38408,13 +38707,13 @@ var alive = (pid) => {
38408
38707
  function takeLock() {
38409
38708
  for (let attempt = 0; attempt < 2; attempt++) {
38410
38709
  try {
38411
- fs15.writeFileSync(lockFile, JSON.stringify({ pid: process.pid, port: null }), { flag: "wx" });
38710
+ fs16.writeFileSync(lockFile, JSON.stringify({ pid: process.pid, port: null }), { flag: "wx" });
38412
38711
  return true;
38413
38712
  } catch (error) {
38414
38713
  if (error.code !== "EEXIST") throw error;
38415
38714
  const lock = readLock();
38416
38715
  if (lock && alive(lock.pid)) return false;
38417
- fs15.rmSync(lockFile, { force: true });
38716
+ fs16.rmSync(lockFile, { force: true });
38418
38717
  }
38419
38718
  }
38420
38719
  return false;
@@ -38448,7 +38747,7 @@ var listening = (port2) => new Promise((resolve) => {
38448
38747
  });
38449
38748
  var leftover = readLock();
38450
38749
  if (leftover?.port && alive(leftover.pid) && !await listening(leftover.port) && readLock()?.pid === leftover.pid) {
38451
- fs15.rmSync(lockFile, { force: true });
38750
+ fs16.rmSync(lockFile, { force: true });
38452
38751
  }
38453
38752
  if (!takeLock() && !await otherHubPort().then((found) => found === null && takeLock())) {
38454
38753
  const otherPort = await otherHubPort();
@@ -38480,9 +38779,9 @@ if (!takeLock() && !await otherHubPort().then((found) => found === null && takeL
38480
38779
  process.exit(0);
38481
38780
  }
38482
38781
  var releaseLock = () => {
38483
- if (readLock()?.pid === process.pid) fs15.rmSync(lockFile, { force: true });
38782
+ if (readLock()?.pid === process.pid) fs16.rmSync(lockFile, { force: true });
38484
38783
  };
38485
- var app = (0, import_express4.default)();
38784
+ var app = (0, import_express5.default)();
38486
38785
  var webPort = process.env.WEB_PORT ?? "4328";
38487
38786
  function allowedOrigin(origin, host) {
38488
38787
  if (!origin) return true;
@@ -38503,8 +38802,8 @@ if (process.env.CLAUDER_HUB_DEV) {
38503
38802
  const allowed = /* @__PURE__ */ new Set([`http://localhost:${webPort}`, `http://127.0.0.1:${webPort}`]);
38504
38803
  app.use((0, import_cors.default)({ origin: (origin, callback) => callback(null, !origin || allowed.has(origin)) }));
38505
38804
  }
38506
- app.use(import_express4.default.json({ limit: "10mb" }));
38507
- var scoped = import_express4.default.Router({ mergeParams: true });
38805
+ app.use(import_express5.default.json({ limit: "10mb" }));
38806
+ var scoped = import_express5.default.Router({ mergeParams: true });
38508
38807
  scoped.use((req, res, next) => {
38509
38808
  const project = getProject(req.params.projectId);
38510
38809
  if (!project) return void res.status(404).json({ error: "No such project in this hub." });
@@ -38512,13 +38811,14 @@ scoped.use((req, res, next) => {
38512
38811
  });
38513
38812
  scoped.use("/files", fileRoutes);
38514
38813
  scoped.use(devRoutes);
38814
+ scoped.use(variableRoutes);
38515
38815
  scoped.use(api);
38516
38816
  app.use("/api/p/:projectId", scoped);
38517
38817
  app.use("/api", hubApi);
38518
- var webDist = path16.join(path16.dirname(fileURLToPath2(import.meta.url)), "..", "..", "web", "dist");
38519
- if (fs15.existsSync(webDist)) {
38520
- app.use(import_express4.default.static(webDist));
38521
- app.get("*", (_req, res) => res.sendFile(path16.join(webDist, "index.html")));
38818
+ var webDist = path17.join(path17.dirname(fileURLToPath2(import.meta.url)), "..", "..", "web", "dist");
38819
+ if (fs16.existsSync(webDist)) {
38820
+ app.use(import_express5.default.static(webDist));
38821
+ app.get("*", (_req, res) => res.sendFile(path17.join(webDist, "index.html")));
38522
38822
  }
38523
38823
  app.use((error, req, res, _next) => {
38524
38824
  console.error(`[server] ${req.method} ${req.originalUrl}:`, error?.stack ?? error);
@@ -38547,7 +38847,7 @@ var { server, port: actualPort } = await listen(port, process.env.CLAUDER_HUB_ST
38547
38847
  process.exit(1);
38548
38848
  });
38549
38849
  setHubPort(actualPort);
38550
- fs15.writeFileSync(lockFile, JSON.stringify({ pid: process.pid, port: actualPort }), "utf8");
38850
+ fs16.writeFileSync(lockFile, JSON.stringify({ pid: process.pid, port: actualPort }), "utf8");
38551
38851
  var sockets = new import_websocket_server.default({ noServer: true });
38552
38852
  server.on("upgrade", (req, socket, head) => {
38553
38853
  const match = /^\/api\/terminals\/([\w-]+)/.exec(req.url ?? "");