@chosengeneration/light-code 0.140.0 → 0.143.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/cli.cjs +1356 -815
  2. package/dist/server.cjs +1324 -783
  3. package/package.json +1 -1
package/dist/server.cjs CHANGED
@@ -494,14 +494,14 @@ var require_util = __commonJS({
494
494
  }
495
495
  const port = url2.port != null ? url2.port : url2.protocol === "https:" ? 443 : 80;
496
496
  let origin = url2.origin != null ? url2.origin : `${url2.protocol}//${url2.hostname}:${port}`;
497
- let path60 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
497
+ let path61 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
498
498
  if (origin.endsWith("/")) {
499
499
  origin = origin.substring(0, origin.length - 1);
500
500
  }
501
- if (path60 && !path60.startsWith("/")) {
502
- path60 = `/${path60}`;
501
+ if (path61 && !path61.startsWith("/")) {
502
+ path61 = `/${path61}`;
503
503
  }
504
- url2 = new URL(origin + path60);
504
+ url2 = new URL(origin + path61);
505
505
  }
506
506
  return url2;
507
507
  }
@@ -2115,20 +2115,20 @@ var require_parseParams = __commonJS({
2115
2115
  var require_basename = __commonJS({
2116
2116
  "../../node_modules/.pnpm/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/utils/basename.js"(exports2, module2) {
2117
2117
  "use strict";
2118
- module2.exports = function basename(path60) {
2119
- if (typeof path60 !== "string") {
2118
+ module2.exports = function basename(path61) {
2119
+ if (typeof path61 !== "string") {
2120
2120
  return "";
2121
2121
  }
2122
- for (var i = path60.length - 1; i >= 0; --i) {
2123
- switch (path60.charCodeAt(i)) {
2122
+ for (var i = path61.length - 1; i >= 0; --i) {
2123
+ switch (path61.charCodeAt(i)) {
2124
2124
  case 47:
2125
2125
  // '/'
2126
2126
  case 92:
2127
- path60 = path60.slice(i + 1);
2128
- return path60 === ".." || path60 === "." ? "" : path60;
2127
+ path61 = path61.slice(i + 1);
2128
+ return path61 === ".." || path61 === "." ? "" : path61;
2129
2129
  }
2130
2130
  }
2131
- return path60 === ".." || path60 === "." ? "" : path60;
2131
+ return path61 === ".." || path61 === "." ? "" : path61;
2132
2132
  };
2133
2133
  }
2134
2134
  });
@@ -5158,7 +5158,7 @@ var require_request = __commonJS({
5158
5158
  }
5159
5159
  var Request = class _Request {
5160
5160
  constructor(origin, {
5161
- path: path60,
5161
+ path: path61,
5162
5162
  method,
5163
5163
  body,
5164
5164
  headers,
@@ -5172,11 +5172,11 @@ var require_request = __commonJS({
5172
5172
  throwOnError,
5173
5173
  expectContinue
5174
5174
  }, handler) {
5175
- if (typeof path60 !== "string") {
5175
+ if (typeof path61 !== "string") {
5176
5176
  throw new InvalidArgumentError("path must be a string");
5177
- } else if (path60[0] !== "/" && !(path60.startsWith("http://") || path60.startsWith("https://")) && method !== "CONNECT") {
5177
+ } else if (path61[0] !== "/" && !(path61.startsWith("http://") || path61.startsWith("https://")) && method !== "CONNECT") {
5178
5178
  throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
5179
- } else if (invalidPathRegex.exec(path60) !== null) {
5179
+ } else if (invalidPathRegex.exec(path61) !== null) {
5180
5180
  throw new InvalidArgumentError("invalid request path");
5181
5181
  }
5182
5182
  if (typeof method !== "string") {
@@ -5239,7 +5239,7 @@ var require_request = __commonJS({
5239
5239
  this.completed = false;
5240
5240
  this.aborted = false;
5241
5241
  this.upgrade = upgrade || null;
5242
- this.path = query ? util.buildURL(path60, query) : path60;
5242
+ this.path = query ? util.buildURL(path61, query) : path61;
5243
5243
  this.origin = origin;
5244
5244
  this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
5245
5245
  this.blocking = blocking == null ? false : blocking;
@@ -6247,9 +6247,9 @@ var require_RedirectHandler = __commonJS({
6247
6247
  return this.handler.onHeaders(statusCode, headers, resume, statusText);
6248
6248
  }
6249
6249
  const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
6250
- const path60 = search ? `${pathname}${search}` : pathname;
6250
+ const path61 = search ? `${pathname}${search}` : pathname;
6251
6251
  this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
6252
- this.opts.path = path60;
6252
+ this.opts.path = path61;
6253
6253
  this.opts.origin = origin;
6254
6254
  this.opts.maxRedirections = 0;
6255
6255
  this.opts.query = null;
@@ -7489,7 +7489,7 @@ var require_client = __commonJS({
7489
7489
  writeH2(client, client[kHTTP2Session], request);
7490
7490
  return;
7491
7491
  }
7492
- const { body, method, path: path60, host, upgrade, headers, blocking, reset } = request;
7492
+ const { body, method, path: path61, host, upgrade, headers, blocking, reset } = request;
7493
7493
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
7494
7494
  if (body && typeof body.read === "function") {
7495
7495
  body.read(0);
@@ -7539,7 +7539,7 @@ var require_client = __commonJS({
7539
7539
  if (blocking) {
7540
7540
  socket[kBlocking] = true;
7541
7541
  }
7542
- let header2 = `${method} ${path60} HTTP/1.1\r
7542
+ let header2 = `${method} ${path61} HTTP/1.1\r
7543
7543
  `;
7544
7544
  if (typeof host === "string") {
7545
7545
  header2 += `host: ${host}\r
@@ -7602,7 +7602,7 @@ upgrade: ${upgrade}\r
7602
7602
  return true;
7603
7603
  }
7604
7604
  function writeH2(client, session, request) {
7605
- const { body, method, path: path60, host, upgrade, expectContinue, signal, headers: reqHeaders } = request;
7605
+ const { body, method, path: path61, host, upgrade, expectContinue, signal, headers: reqHeaders } = request;
7606
7606
  let headers;
7607
7607
  if (typeof reqHeaders === "string") headers = Request[kHTTP2CopyHeaders](reqHeaders.trim());
7608
7608
  else headers = reqHeaders;
@@ -7645,7 +7645,7 @@ upgrade: ${upgrade}\r
7645
7645
  });
7646
7646
  return true;
7647
7647
  }
7648
- headers[HTTP2_HEADER_PATH] = path60;
7648
+ headers[HTTP2_HEADER_PATH] = path61;
7649
7649
  headers[HTTP2_HEADER_SCHEME] = "https";
7650
7650
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
7651
7651
  if (body && typeof body.read === "function") {
@@ -9885,20 +9885,20 @@ var require_mock_utils = __commonJS({
9885
9885
  }
9886
9886
  return true;
9887
9887
  }
9888
- function safeUrl(path60) {
9889
- if (typeof path60 !== "string") {
9890
- return path60;
9888
+ function safeUrl(path61) {
9889
+ if (typeof path61 !== "string") {
9890
+ return path61;
9891
9891
  }
9892
- const pathSegments = path60.split("?");
9892
+ const pathSegments = path61.split("?");
9893
9893
  if (pathSegments.length !== 2) {
9894
- return path60;
9894
+ return path61;
9895
9895
  }
9896
9896
  const qp = new URLSearchParams(pathSegments.pop());
9897
9897
  qp.sort();
9898
9898
  return [...pathSegments, qp.toString()].join("?");
9899
9899
  }
9900
- function matchKey(mockDispatch2, { path: path60, method, body, headers }) {
9901
- const pathMatch = matchValue(mockDispatch2.path, path60);
9900
+ function matchKey(mockDispatch2, { path: path61, method, body, headers }) {
9901
+ const pathMatch = matchValue(mockDispatch2.path, path61);
9902
9902
  const methodMatch = matchValue(mockDispatch2.method, method);
9903
9903
  const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
9904
9904
  const headersMatch = matchHeaders(mockDispatch2, headers);
@@ -9916,7 +9916,7 @@ var require_mock_utils = __commonJS({
9916
9916
  function getMockDispatch(mockDispatches, key2) {
9917
9917
  const basePath = key2.query ? buildURL(key2.path, key2.query) : key2.path;
9918
9918
  const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
9919
- let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path60 }) => matchValue(safeUrl(path60), resolvedPath));
9919
+ let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path61 }) => matchValue(safeUrl(path61), resolvedPath));
9920
9920
  if (matchedMockDispatches.length === 0) {
9921
9921
  throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
9922
9922
  }
@@ -9953,9 +9953,9 @@ var require_mock_utils = __commonJS({
9953
9953
  }
9954
9954
  }
9955
9955
  function buildKey(opts) {
9956
- const { path: path60, method, body, headers, query } = opts;
9956
+ const { path: path61, method, body, headers, query } = opts;
9957
9957
  return {
9958
- path: path60,
9958
+ path: path61,
9959
9959
  method,
9960
9960
  body,
9961
9961
  headers,
@@ -10404,10 +10404,10 @@ var require_pending_interceptors_formatter = __commonJS({
10404
10404
  }
10405
10405
  format(pendingInterceptors) {
10406
10406
  const withPrettyHeaders = pendingInterceptors.map(
10407
- ({ method, path: path60, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
10407
+ ({ method, path: path61, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
10408
10408
  Method: method,
10409
10409
  Origin: origin,
10410
- Path: path60,
10410
+ Path: path61,
10411
10411
  "Status code": statusCode,
10412
10412
  Persistent: persist ? "\u2705" : "\u274C",
10413
10413
  Invocations: timesInvoked,
@@ -15027,8 +15027,8 @@ var require_util6 = __commonJS({
15027
15027
  }
15028
15028
  }
15029
15029
  }
15030
- function validateCookiePath(path60) {
15031
- for (const char of path60) {
15030
+ function validateCookiePath(path61) {
15031
+ for (const char of path61) {
15032
15032
  const code = char.charCodeAt(0);
15033
15033
  if (code < 33 || char === ";") {
15034
15034
  throw new Error("Invalid cookie path");
@@ -16708,11 +16708,11 @@ var require_undici = __commonJS({
16708
16708
  if (typeof opts.path !== "string") {
16709
16709
  throw new InvalidArgumentError("invalid opts.path");
16710
16710
  }
16711
- let path60 = opts.path;
16711
+ let path61 = opts.path;
16712
16712
  if (!opts.path.startsWith("/")) {
16713
- path60 = `/${path60}`;
16713
+ path61 = `/${path61}`;
16714
16714
  }
16715
- url2 = new URL(util.parseOrigin(url2).origin + path60);
16715
+ url2 = new URL(util.parseOrigin(url2).origin + path61);
16716
16716
  } else {
16717
16717
  if (!opts) {
16718
16718
  opts = typeof url2 === "object" ? url2 : {};
@@ -19983,8 +19983,8 @@ var require_utils2 = __commonJS({
19983
19983
  }
19984
19984
  return ind;
19985
19985
  }
19986
- function removeDotSegments(path60) {
19987
- let input = path60;
19986
+ function removeDotSegments(path61) {
19987
+ let input = path61;
19988
19988
  const output = [];
19989
19989
  let nextSlash = -1;
19990
19990
  let len = 0;
@@ -20236,8 +20236,8 @@ var require_schemes = __commonJS({
20236
20236
  wsComponent.secure = void 0;
20237
20237
  }
20238
20238
  if (wsComponent.resourceName) {
20239
- const [path60, query] = wsComponent.resourceName.split("?");
20240
- wsComponent.path = path60 && path60 !== "/" ? path60 : void 0;
20239
+ const [path61, query] = wsComponent.resourceName.split("?");
20240
+ wsComponent.path = path61 && path61 !== "/" ? path61 : void 0;
20241
20241
  wsComponent.query = query;
20242
20242
  wsComponent.resourceName = void 0;
20243
20243
  }
@@ -23655,7 +23655,7 @@ var require_windows = __commonJS({
23655
23655
  module2.exports = isexe;
23656
23656
  isexe.sync = sync;
23657
23657
  var fs41 = require("fs");
23658
- function checkPathExt(path60, options) {
23658
+ function checkPathExt(path61, options) {
23659
23659
  var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
23660
23660
  if (!pathext) {
23661
23661
  return true;
@@ -23666,25 +23666,25 @@ var require_windows = __commonJS({
23666
23666
  }
23667
23667
  for (var i = 0; i < pathext.length; i++) {
23668
23668
  var p = pathext[i].toLowerCase();
23669
- if (p && path60.substr(-p.length).toLowerCase() === p) {
23669
+ if (p && path61.substr(-p.length).toLowerCase() === p) {
23670
23670
  return true;
23671
23671
  }
23672
23672
  }
23673
23673
  return false;
23674
23674
  }
23675
- function checkStat(stat, path60, options) {
23675
+ function checkStat(stat, path61, options) {
23676
23676
  if (!stat.isSymbolicLink() && !stat.isFile()) {
23677
23677
  return false;
23678
23678
  }
23679
- return checkPathExt(path60, options);
23679
+ return checkPathExt(path61, options);
23680
23680
  }
23681
- function isexe(path60, options, cb) {
23682
- fs41.stat(path60, function(er, stat) {
23683
- cb(er, er ? false : checkStat(stat, path60, options));
23681
+ function isexe(path61, options, cb) {
23682
+ fs41.stat(path61, function(er, stat) {
23683
+ cb(er, er ? false : checkStat(stat, path61, options));
23684
23684
  });
23685
23685
  }
23686
- function sync(path60, options) {
23687
- return checkStat(fs41.statSync(path60), path60, options);
23686
+ function sync(path61, options) {
23687
+ return checkStat(fs41.statSync(path61), path61, options);
23688
23688
  }
23689
23689
  }
23690
23690
  });
@@ -23695,13 +23695,13 @@ var require_mode = __commonJS({
23695
23695
  module2.exports = isexe;
23696
23696
  isexe.sync = sync;
23697
23697
  var fs41 = require("fs");
23698
- function isexe(path60, options, cb) {
23699
- fs41.stat(path60, function(er, stat) {
23698
+ function isexe(path61, options, cb) {
23699
+ fs41.stat(path61, function(er, stat) {
23700
23700
  cb(er, er ? false : checkStat(stat, options));
23701
23701
  });
23702
23702
  }
23703
- function sync(path60, options) {
23704
- return checkStat(fs41.statSync(path60), options);
23703
+ function sync(path61, options) {
23704
+ return checkStat(fs41.statSync(path61), options);
23705
23705
  }
23706
23706
  function checkStat(stat, options) {
23707
23707
  return stat.isFile() && checkMode(stat, options);
@@ -23734,7 +23734,7 @@ var require_isexe = __commonJS({
23734
23734
  }
23735
23735
  module2.exports = isexe;
23736
23736
  isexe.sync = sync;
23737
- function isexe(path60, options, cb) {
23737
+ function isexe(path61, options, cb) {
23738
23738
  if (typeof options === "function") {
23739
23739
  cb = options;
23740
23740
  options = {};
@@ -23744,7 +23744,7 @@ var require_isexe = __commonJS({
23744
23744
  throw new TypeError("callback not provided");
23745
23745
  }
23746
23746
  return new Promise(function(resolve, reject2) {
23747
- isexe(path60, options || {}, function(er, is) {
23747
+ isexe(path61, options || {}, function(er, is) {
23748
23748
  if (er) {
23749
23749
  reject2(er);
23750
23750
  } else {
@@ -23753,7 +23753,7 @@ var require_isexe = __commonJS({
23753
23753
  });
23754
23754
  });
23755
23755
  }
23756
- core(path60, options || {}, function(er, is) {
23756
+ core(path61, options || {}, function(er, is) {
23757
23757
  if (er) {
23758
23758
  if (er.code === "EACCES" || options && options.ignoreErrors) {
23759
23759
  er = null;
@@ -23763,9 +23763,9 @@ var require_isexe = __commonJS({
23763
23763
  cb(er, is);
23764
23764
  });
23765
23765
  }
23766
- function sync(path60, options) {
23766
+ function sync(path61, options) {
23767
23767
  try {
23768
- return core.sync(path60, options || {});
23768
+ return core.sync(path61, options || {});
23769
23769
  } catch (er) {
23770
23770
  if (options && options.ignoreErrors || er.code === "EACCES") {
23771
23771
  return false;
@@ -23781,7 +23781,7 @@ var require_isexe = __commonJS({
23781
23781
  var require_which = __commonJS({
23782
23782
  "../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports2, module2) {
23783
23783
  var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
23784
- var path60 = require("path");
23784
+ var path61 = require("path");
23785
23785
  var COLON = isWindows ? ";" : ":";
23786
23786
  var isexe = require_isexe();
23787
23787
  var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
@@ -23819,7 +23819,7 @@ var require_which = __commonJS({
23819
23819
  return opt.all && found2.length ? resolve(found2) : reject2(getNotFoundError(cmd));
23820
23820
  const ppRaw = pathEnv[i];
23821
23821
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
23822
- const pCmd = path60.join(pathPart, cmd);
23822
+ const pCmd = path61.join(pathPart, cmd);
23823
23823
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
23824
23824
  resolve(subStep(p, i, 0));
23825
23825
  });
@@ -23846,7 +23846,7 @@ var require_which = __commonJS({
23846
23846
  for (let i = 0; i < pathEnv.length; i++) {
23847
23847
  const ppRaw = pathEnv[i];
23848
23848
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
23849
- const pCmd = path60.join(pathPart, cmd);
23849
+ const pCmd = path61.join(pathPart, cmd);
23850
23850
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
23851
23851
  for (let j = 0; j < pathExt.length; j++) {
23852
23852
  const cur = p + pathExt[j];
@@ -23894,7 +23894,7 @@ var require_path_key = __commonJS({
23894
23894
  var require_resolveCommand = __commonJS({
23895
23895
  "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports2, module2) {
23896
23896
  "use strict";
23897
- var path60 = require("path");
23897
+ var path61 = require("path");
23898
23898
  var which = require_which();
23899
23899
  var getPathKey = require_path_key();
23900
23900
  function resolveCommandAttempt(parsed, withoutPathExt) {
@@ -23912,7 +23912,7 @@ var require_resolveCommand = __commonJS({
23912
23912
  try {
23913
23913
  resolved = which.sync(parsed.command, {
23914
23914
  path: env2[getPathKey({ env: env2 })],
23915
- pathExt: withoutPathExt ? path60.delimiter : void 0
23915
+ pathExt: withoutPathExt ? path61.delimiter : void 0
23916
23916
  });
23917
23917
  } catch (e) {
23918
23918
  } finally {
@@ -23921,7 +23921,7 @@ var require_resolveCommand = __commonJS({
23921
23921
  }
23922
23922
  }
23923
23923
  if (resolved) {
23924
- resolved = path60.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
23924
+ resolved = path61.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
23925
23925
  }
23926
23926
  return resolved;
23927
23927
  }
@@ -23975,8 +23975,8 @@ var require_shebang_command = __commonJS({
23975
23975
  if (!match) {
23976
23976
  return null;
23977
23977
  }
23978
- const [path60, argument] = match[0].replace(/#! ?/, "").split(" ");
23979
- const binary = path60.split("/").pop();
23978
+ const [path61, argument] = match[0].replace(/#! ?/, "").split(" ");
23979
+ const binary = path61.split("/").pop();
23980
23980
  if (binary === "env") {
23981
23981
  return argument;
23982
23982
  }
@@ -24011,7 +24011,7 @@ var require_readShebang = __commonJS({
24011
24011
  var require_parse2 = __commonJS({
24012
24012
  "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports2, module2) {
24013
24013
  "use strict";
24014
- var path60 = require("path");
24014
+ var path61 = require("path");
24015
24015
  var resolveCommand = require_resolveCommand();
24016
24016
  var escape4 = require_escape();
24017
24017
  var readShebang = require_readShebang();
@@ -24036,7 +24036,7 @@ var require_parse2 = __commonJS({
24036
24036
  const needsShell = !isExecutableRegExp.test(commandFile);
24037
24037
  if (parsed.options.forceShell || needsShell) {
24038
24038
  const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
24039
- parsed.command = path60.normalize(parsed.command);
24039
+ parsed.command = path61.normalize(parsed.command);
24040
24040
  parsed.command = escape4.command(parsed.command);
24041
24041
  parsed.args = parsed.args.map((arg) => escape4.argument(arg, needsDoubleEscapeMetaChars));
24042
24042
  const shellCommand = [parsed.command].concat(parsed.args).join(" ");
@@ -24260,7 +24260,7 @@ module.exports = __toCommonJS(server_exports);
24260
24260
  var import_promises34 = __toESM(require("node:fs/promises"), 1);
24261
24261
  var import_node_fs14 = require("node:fs");
24262
24262
  var import_node_http = require("node:http");
24263
- var import_node_path60 = __toESM(require("node:path"), 1);
24263
+ var import_node_path61 = __toESM(require("node:path"), 1);
24264
24264
 
24265
24265
  // ../../packages/core/dist/platform/http.js
24266
24266
  var import_node_crypto = require("node:crypto");
@@ -25421,10 +25421,10 @@ function mergeDefs(...defs) {
25421
25421
  function cloneDef(schema8) {
25422
25422
  return mergeDefs(schema8._zod.def);
25423
25423
  }
25424
- function getElementAtPath(obj, path60) {
25425
- if (!path60)
25424
+ function getElementAtPath(obj, path61) {
25425
+ if (!path61)
25426
25426
  return obj;
25427
- return path60.reduce((acc, key2) => acc?.[key2], obj);
25427
+ return path61.reduce((acc, key2) => acc?.[key2], obj);
25428
25428
  }
25429
25429
  function promiseAllObject(promisesObj) {
25430
25430
  const keys = Object.keys(promisesObj);
@@ -25833,11 +25833,11 @@ function explicitlyAborted(x, startIndex = 0) {
25833
25833
  }
25834
25834
  return false;
25835
25835
  }
25836
- function prefixIssues(path60, issues) {
25836
+ function prefixIssues(path61, issues) {
25837
25837
  return issues.map((iss) => {
25838
25838
  var _a3;
25839
25839
  (_a3 = iss).path ?? (_a3.path = []);
25840
- iss.path.unshift(path60);
25840
+ iss.path.unshift(path61);
25841
25841
  return iss;
25842
25842
  });
25843
25843
  }
@@ -25984,16 +25984,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
25984
25984
  }
25985
25985
  function formatError(error51, mapper = (issue2) => issue2.message) {
25986
25986
  const fieldErrors = { _errors: [] };
25987
- const processError = (error52, path60 = []) => {
25987
+ const processError = (error52, path61 = []) => {
25988
25988
  for (const issue2 of error52.issues) {
25989
25989
  if (issue2.code === "invalid_union" && issue2.errors.length) {
25990
- issue2.errors.map((issues) => processError({ issues }, [...path60, ...issue2.path]));
25990
+ issue2.errors.map((issues) => processError({ issues }, [...path61, ...issue2.path]));
25991
25991
  } else if (issue2.code === "invalid_key") {
25992
- processError({ issues: issue2.issues }, [...path60, ...issue2.path]);
25992
+ processError({ issues: issue2.issues }, [...path61, ...issue2.path]);
25993
25993
  } else if (issue2.code === "invalid_element") {
25994
- processError({ issues: issue2.issues }, [...path60, ...issue2.path]);
25994
+ processError({ issues: issue2.issues }, [...path61, ...issue2.path]);
25995
25995
  } else {
25996
- const fullpath = [...path60, ...issue2.path];
25996
+ const fullpath = [...path61, ...issue2.path];
25997
25997
  if (fullpath.length === 0) {
25998
25998
  fieldErrors._errors.push(mapper(issue2));
25999
25999
  } else {
@@ -26020,17 +26020,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
26020
26020
  }
26021
26021
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
26022
26022
  const result = { errors: [] };
26023
- const processError = (error52, path60 = []) => {
26023
+ const processError = (error52, path61 = []) => {
26024
26024
  var _a3, _b;
26025
26025
  for (const issue2 of error52.issues) {
26026
26026
  if (issue2.code === "invalid_union" && issue2.errors.length) {
26027
- issue2.errors.map((issues) => processError({ issues }, [...path60, ...issue2.path]));
26027
+ issue2.errors.map((issues) => processError({ issues }, [...path61, ...issue2.path]));
26028
26028
  } else if (issue2.code === "invalid_key") {
26029
- processError({ issues: issue2.issues }, [...path60, ...issue2.path]);
26029
+ processError({ issues: issue2.issues }, [...path61, ...issue2.path]);
26030
26030
  } else if (issue2.code === "invalid_element") {
26031
- processError({ issues: issue2.issues }, [...path60, ...issue2.path]);
26031
+ processError({ issues: issue2.issues }, [...path61, ...issue2.path]);
26032
26032
  } else {
26033
- const fullpath = [...path60, ...issue2.path];
26033
+ const fullpath = [...path61, ...issue2.path];
26034
26034
  if (fullpath.length === 0) {
26035
26035
  result.errors.push(mapper(issue2));
26036
26036
  continue;
@@ -26062,8 +26062,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
26062
26062
  }
26063
26063
  function toDotPath(_path) {
26064
26064
  const segs = [];
26065
- const path60 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
26066
- for (const seg of path60) {
26065
+ const path61 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
26066
+ for (const seg of path61) {
26067
26067
  if (typeof seg === "number")
26068
26068
  segs.push(`[${seg}]`);
26069
26069
  else if (typeof seg === "symbol")
@@ -38755,13 +38755,13 @@ function resolveRef(ref, ctx) {
38755
38755
  if (!ref.startsWith("#")) {
38756
38756
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
38757
38757
  }
38758
- const path60 = ref.slice(1).split("/").filter(Boolean);
38759
- if (path60.length === 0) {
38758
+ const path61 = ref.slice(1).split("/").filter(Boolean);
38759
+ if (path61.length === 0) {
38760
38760
  return ctx.rootSchema;
38761
38761
  }
38762
38762
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
38763
- if (path60[0] === defsKey) {
38764
- const key2 = path60[1];
38763
+ if (path61[0] === defsKey) {
38764
+ const key2 = path61[1];
38765
38765
  if (!key2 || !ctx.defs[key2]) {
38766
38766
  throw new Error(`Reference not found: ${ref}`);
38767
38767
  }
@@ -40546,7 +40546,15 @@ var configSchema = external_exports.object({
40546
40546
  * able to add a folder could offer its own add-on under a familiar name.
40547
40547
  */
40548
40548
  addons: external_exports.object({
40549
- folders: external_exports.array(external_exports.string().min(1)).max(50)
40549
+ folders: external_exports.array(external_exports.string().min(1)).max(50),
40550
+ /**
40551
+ * What the user entered on each add-on's own tab (`addons/page.ts`), by package name. Never
40552
+ * a secret: those are in secret storage under `addon:<package>:<record>:<field>`.
40553
+ */
40554
+ settings: external_exports.record(external_exports.string(), external_exports.object({
40555
+ values: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
40556
+ records: external_exports.array(external_exports.object({ id: external_exports.string().min(1).max(40), values: external_exports.record(external_exports.string(), external_exports.unknown()) })).max(500).optional()
40557
+ }))
40550
40558
  }).partial(),
40551
40559
  lsp: external_exports.object({
40552
40560
  enabled: external_exports.boolean(),
@@ -44014,8 +44022,8 @@ var SUPERSEDED_MARKER = "[Superseded: this file was read again later in the conv
44014
44022
  function readFilePath(argumentsJson) {
44015
44023
  try {
44016
44024
  const parsed = JSON.parse(argumentsJson.length > 0 ? argumentsJson : "{}");
44017
- const path60 = parsed.path;
44018
- return typeof path60 === "string" && path60.length > 0 ? path60 : void 0;
44025
+ const path61 = parsed.path;
44026
+ return typeof path61 === "string" && path61.length > 0 ? path61 : void 0;
44019
44027
  } catch {
44020
44028
  return void 0;
44021
44029
  }
@@ -44028,8 +44036,8 @@ function dropSupersededReads(messages) {
44028
44036
  for (const toolCall of message4.toolCalls ?? []) {
44029
44037
  if (toolCall.name !== "read_file")
44030
44038
  continue;
44031
- const path60 = readFilePath(toolCall.arguments);
44032
- if (path60 === void 0)
44039
+ const path61 = readFilePath(toolCall.arguments);
44040
+ if (path61 === void 0)
44033
44041
  continue;
44034
44042
  keyByCallId.set(toolCall.id, toolCall.arguments);
44035
44043
  }
@@ -46873,13 +46881,13 @@ var OpenSearchClient = class {
46873
46881
  * `_bulk`, `_delete_by_query`, index creation — is refused here rather than merely
46874
46882
  * unused, so no future edit or crafted argument can turn a read client into a writer.
46875
46883
  */
46876
- async request(path60, options = {}) {
46884
+ async request(path61, options = {}) {
46877
46885
  const method = options.method ?? "GET";
46878
- const isSearchPost = method === "POST" && /\/_search(\?|$)/.test(path60);
46886
+ const isSearchPost = method === "POST" && /\/_search(\?|$)/.test(path61);
46879
46887
  if (method !== "GET" && !isSearchPost) {
46880
- throw new OpenSearchError(`Refusing ${method} ${path60}: this client is read-only. Indexing goes through the indexer, which the user starts from Settings.`);
46888
+ throw new OpenSearchError(`Refusing ${method} ${path61}: this client is read-only. Indexing goes through the indexer, which the user starts from Settings.`);
46881
46889
  }
46882
- const url2 = `${this.base}${path60}`;
46890
+ const url2 = `${this.base}${path61}`;
46883
46891
  const request = {
46884
46892
  method,
46885
46893
  headers: this.headers()
@@ -47046,11 +47054,11 @@ function collectFields(properties, prefix, out) {
47046
47054
  return;
47047
47055
  for (const [name, raw] of Object.entries(properties)) {
47048
47056
  const field2 = raw;
47049
- const path60 = prefix.length > 0 ? `${prefix}.${name}` : name;
47057
+ const path61 = prefix.length > 0 ? `${prefix}.${name}` : name;
47050
47058
  if (typeof field2.type === "string")
47051
- out[path60] = field2.type;
47059
+ out[path61] = field2.type;
47052
47060
  if (field2.properties !== void 0)
47053
- collectFields(field2.properties, path60, out);
47061
+ collectFields(field2.properties, path61, out);
47054
47062
  }
47055
47063
  }
47056
47064
  function describeStatus(status2, url2, body) {
@@ -47069,23 +47077,23 @@ function describeStatus(status2, url2, body) {
47069
47077
  var TEXT_TYPES = /* @__PURE__ */ new Set(["text", "match_only_text", "search_as_you_type", "wildcard"]);
47070
47078
  var KEYWORD_TYPES = /* @__PURE__ */ new Set(["keyword", "constant_keyword"]);
47071
47079
  var NOISE_FIELDS = /* @__PURE__ */ new Set(["@version", "ecs", "tags", "stream", "input", "agent", "host", "event"]);
47072
- function leafName(path60) {
47073
- const parts = path60.split(".");
47074
- return parts[parts.length - 1] ?? path60;
47080
+ function leafName(path61) {
47081
+ const parts = path61.split(".");
47082
+ return parts[parts.length - 1] ?? path61;
47075
47083
  }
47076
47084
  function selectQueryFields(mapping, limit = 25) {
47077
47085
  const text = [];
47078
47086
  const keyword = [];
47079
- for (const [path60, type] of Object.entries(mapping)) {
47080
- if (NOISE_FIELDS.has(leafName(path60)) || NOISE_FIELDS.has(path60.split(".")[0] ?? ""))
47087
+ for (const [path61, type] of Object.entries(mapping)) {
47088
+ if (NOISE_FIELDS.has(leafName(path61)) || NOISE_FIELDS.has(path61.split(".")[0] ?? ""))
47081
47089
  continue;
47082
47090
  if (TEXT_TYPES.has(type)) {
47083
- text.push(path60);
47091
+ text.push(path61);
47084
47092
  } else if (KEYWORD_TYPES.has(type)) {
47085
- const parent = path60.replace(/\.keyword$/, "");
47086
- if (path60.endsWith(".keyword") && TEXT_TYPES.has(mapping[parent] ?? ""))
47093
+ const parent = path61.replace(/\.keyword$/, "");
47094
+ if (path61.endsWith(".keyword") && TEXT_TYPES.has(mapping[parent] ?? ""))
47087
47095
  continue;
47088
- keyword.push(path60);
47096
+ keyword.push(path61);
47089
47097
  }
47090
47098
  }
47091
47099
  const byDepth = (a, b) => a.split(".").length - b.split(".").length || a.localeCompare(b);
@@ -47227,8 +47235,8 @@ var OpenSearchIndexWriter = class {
47227
47235
  }
47228
47236
  return headers;
47229
47237
  }
47230
- async request(path60, method, body, signal) {
47231
- const url2 = `${this.connection.url.replace(/\/+$/, "")}${path60}`;
47238
+ async request(path61, method, body, signal) {
47239
+ const url2 = `${this.connection.url.replace(/\/+$/, "")}${path61}`;
47232
47240
  const request = { method, headers: this.headers() };
47233
47241
  if (body !== void 0) {
47234
47242
  if (typeof body === "string") {
@@ -47442,13 +47450,13 @@ var OpenSearchIndexWriter = class {
47442
47450
  for (const hit of hits) {
47443
47451
  const source = hit._source ?? {};
47444
47452
  const vector = source.vector;
47445
- const path60 = source.path;
47446
- if (typeof path60 !== "string" || !Array.isArray(vector))
47453
+ const path61 = source.path;
47454
+ if (typeof path61 !== "string" || !Array.isArray(vector))
47447
47455
  continue;
47448
47456
  documents.push({
47449
47457
  id: hit._id ?? "",
47450
47458
  text: typeof source.text === "string" ? source.text : "",
47451
- path: path60,
47459
+ path: path61,
47452
47460
  startLine: typeof source.startLine === "number" ? source.startLine : 1,
47453
47461
  endLine: typeof source.endLine === "number" ? source.endLine : 1,
47454
47462
  vector
@@ -47522,8 +47530,8 @@ var RestTransport = class {
47522
47530
  * threw would push every caller into catching and re-inspecting an error to find out
47523
47531
  * whether it was really an error. `expectOk` is there for the cases that are.
47524
47532
  */
47525
- async send(path60, method, body, signal) {
47526
- const url2 = `${this.connection.url.replace(/\/+$/, "")}${path60}`;
47533
+ async send(path61, method, body, signal) {
47534
+ const url2 = `${this.connection.url.replace(/\/+$/, "")}${path61}`;
47527
47535
  const request = { method, headers: this.headers() };
47528
47536
  if (body !== void 0)
47529
47537
  request.body = JSON.stringify(body);
@@ -47549,11 +47557,11 @@ var RestTransport = class {
47549
47557
  return { status: response.status, body: parsed };
47550
47558
  }
47551
47559
  /** Sends, and throws unless the status is 2xx. */
47552
- async expectOk(path60, method, body, signal) {
47553
- const result = await this.send(path60, method, body, signal);
47560
+ async expectOk(path61, method, body, signal) {
47561
+ const result = await this.send(path61, method, body, signal);
47554
47562
  if (result.status < 200 || result.status >= 300) {
47555
47563
  const detail = typeof result.body === "string" ? result.body : JSON.stringify(result.body ?? "");
47556
- throw new VectorStoreError(`${method} ${path60} on ${this.label} returned HTTP ${String(result.status)}. ${detail.slice(0, 300)}`, result.status);
47564
+ throw new VectorStoreError(`${method} ${path61} on ${this.label} returned HTTP ${String(result.status)}. ${detail.slice(0, 300)}`, result.status);
47557
47565
  }
47558
47566
  return result.body;
47559
47567
  }
@@ -47661,10 +47669,10 @@ var ChromaSearcher = class extends ChromaBase {
47661
47669
  const matches = [];
47662
47670
  for (let index = 0; index < ids.length; index++) {
47663
47671
  const metadata = metadatas[index] ?? {};
47664
- const path60 = typeof metadata.path === "string" ? metadata.path : void 0;
47665
- if (path60 === void 0)
47672
+ const path61 = typeof metadata.path === "string" ? metadata.path : void 0;
47673
+ if (path61 === void 0)
47666
47674
  continue;
47667
- if (prefix !== void 0 && prefix.length > 0 && !path60.startsWith(prefix))
47675
+ if (prefix !== void 0 && prefix.length > 0 && !path61.startsWith(prefix))
47668
47676
  continue;
47669
47677
  if (projectHere && typeof metadata.project === "string" && !options.project?.names.includes(metadata.project))
47670
47678
  continue;
@@ -47678,7 +47686,7 @@ var ChromaSearcher = class extends ChromaBase {
47678
47686
  */
47679
47687
  score: typeof distance === "number" ? 1 / (1 + Math.max(0, distance)) : 0,
47680
47688
  text: documents[index] ?? (typeof metadata.text === "string" ? metadata.text : ""),
47681
- path: path60
47689
+ path: path61
47682
47690
  };
47683
47691
  if (typeof metadata.startLine === "number")
47684
47692
  match.startLine = metadata.startLine;
@@ -47789,13 +47797,13 @@ var ChromaIndexWriter = class extends ChromaBase {
47789
47797
  for (let index = 0; index < ids.length; index++) {
47790
47798
  const metadata = result.metadatas?.[index] ?? {};
47791
47799
  const vector = result.embeddings?.[index];
47792
- const path60 = typeof metadata.path === "string" ? metadata.path : void 0;
47793
- if (path60 === void 0 || !Array.isArray(vector))
47800
+ const path61 = typeof metadata.path === "string" ? metadata.path : void 0;
47801
+ if (path61 === void 0 || !Array.isArray(vector))
47794
47802
  continue;
47795
47803
  documents.push({
47796
47804
  id: ids[index] ?? "",
47797
47805
  text: result.documents?.[index] ?? "",
47798
- path: path60,
47806
+ path: path61,
47799
47807
  startLine: typeof metadata.startLine === "number" ? metadata.startLine : 1,
47800
47808
  endLine: typeof metadata.endLine === "number" ? metadata.endLine : 1,
47801
47809
  vector
@@ -47812,9 +47820,9 @@ var ChromaIndexWriter = class extends ChromaBase {
47812
47820
  const result = await this.rest.expectOk(`${this.base}/collections/${found2.id}/get`, "POST", { include: ["metadatas"], limit }, options.signal);
47813
47821
  const paths = /* @__PURE__ */ new Set();
47814
47822
  for (const metadata of result.metadatas ?? []) {
47815
- const path60 = metadata?.path;
47816
- if (typeof path60 === "string")
47817
- paths.add(path60);
47823
+ const path61 = metadata?.path;
47824
+ if (typeof path61 === "string")
47825
+ paths.add(path61);
47818
47826
  }
47819
47827
  return [...paths];
47820
47828
  }
@@ -47841,14 +47849,14 @@ var MARKER_ID = "5f6d2a41-0000-5000-8000-6c69676874c0";
47841
47849
  var MARKER_MARK = "light-code";
47842
47850
  function toMatch(point) {
47843
47851
  const payload = point.payload ?? {};
47844
- const path60 = typeof payload.path === "string" ? payload.path : void 0;
47845
- if (path60 === void 0)
47852
+ const path61 = typeof payload.path === "string" ? payload.path : void 0;
47853
+ if (path61 === void 0)
47846
47854
  return void 0;
47847
47855
  const match = {
47848
47856
  id: typeof payload.chunkId === "string" ? payload.chunkId : point.id,
47849
47857
  score: typeof point.score === "number" ? point.score : 0,
47850
47858
  text: typeof payload.text === "string" ? payload.text : "",
47851
- path: path60
47859
+ path: path61
47852
47860
  };
47853
47861
  if (typeof payload.startLine === "number")
47854
47862
  match.startLine = payload.startLine;
@@ -48042,13 +48050,13 @@ var QdrantIndexWriter = class extends QdrantBase {
48042
48050
  const documents = [];
48043
48051
  for (const point of result.body.result?.points ?? []) {
48044
48052
  const payload = point.payload ?? {};
48045
- const path60 = typeof payload.path === "string" ? payload.path : void 0;
48046
- if (path60 === void 0 || !Array.isArray(point.vector))
48053
+ const path61 = typeof payload.path === "string" ? payload.path : void 0;
48054
+ if (path61 === void 0 || !Array.isArray(point.vector))
48047
48055
  continue;
48048
48056
  documents.push({
48049
48057
  id: typeof payload.chunkId === "string" ? payload.chunkId : point.id,
48050
48058
  text: typeof payload.text === "string" ? payload.text : "",
48051
- path: path60,
48059
+ path: path61,
48052
48060
  startLine: typeof payload.startLine === "number" ? payload.startLine : 1,
48053
48061
  endLine: typeof payload.endLine === "number" ? payload.endLine : 1,
48054
48062
  vector: point.vector
@@ -48075,9 +48083,9 @@ var QdrantIndexWriter = class extends QdrantBase {
48075
48083
  throw new VectorStoreError(`Could not list "${collection}" (HTTP ${String(result.status)}).`, result.status);
48076
48084
  }
48077
48085
  for (const point of result.body.result?.points ?? []) {
48078
- const path60 = point.payload?.path;
48079
- if (typeof path60 === "string")
48080
- paths.add(path60);
48086
+ const path61 = point.payload?.path;
48087
+ if (typeof path61 === "string")
48088
+ paths.add(path61);
48081
48089
  }
48082
48090
  offset = result.body.result?.next_page_offset;
48083
48091
  if (offset === void 0 || offset === null)
@@ -48611,8 +48619,8 @@ function teamSkillDocument(skill, body, vector, attribution) {
48611
48619
  vector
48612
48620
  };
48613
48621
  }
48614
- function nameFromPath(path60) {
48615
- return path60.startsWith("skill:") ? path60.slice("skill:".length) : path60;
48622
+ function nameFromPath(path61) {
48623
+ return path61.startsWith("skill:") ? path61.slice("skill:".length) : path61;
48616
48624
  }
48617
48625
  function toHit(match, self) {
48618
48626
  return {
@@ -51694,8 +51702,8 @@ function createMailCoverageTool(options) {
51694
51702
  }
51695
51703
  };
51696
51704
  }
51697
- function normaliseFolder(path60) {
51698
- return path60.toLowerCase().replace(/[\\/]+/g, "\\");
51705
+ function normaliseFolder(path61) {
51706
+ return path61.toLowerCase().replace(/[\\/]+/g, "\\");
51699
51707
  }
51700
51708
  function haystackOf(record2) {
51701
51709
  return `${record2.subject}
@@ -52191,7 +52199,7 @@ async function refreshMail(options) {
52191
52199
  const limit = options.batchLimit ?? 2e3;
52192
52200
  const previewChars = options.previewChars ?? 400;
52193
52201
  const sinceMs = Date.now() - options.days * 24 * 60 * 60 * 1e3;
52194
- const harvested = await options.harvest(options.folders.map((path60) => ({ path: path60, sinceMs })), { limit, previewChars });
52202
+ const harvested = await options.harvest(options.folders.map((path61) => ({ path: path61, sinceMs })), { limit, previewChars });
52195
52203
  const fetched = harvested.messages.map(toRecord);
52196
52204
  if (fetched.length === 0) {
52197
52205
  return { added: 0, more: false, total: known.length, embedded: 0, backfilled: 0, complete: [] };
@@ -52232,9 +52240,9 @@ async function syncMail(options) {
52232
52240
  const backfillDone = await options.store.loadBackfillState();
52233
52241
  const limit = options.batchLimit ?? 500;
52234
52242
  const previewChars = options.previewChars ?? 400;
52235
- const forwardRequests = options.folders.map((path60) => {
52236
- const mark = marks.get(path60);
52237
- return mark === void 0 ? { path: path60 } : { path: path60, sinceMs: mark.newest - 1e3 };
52243
+ const forwardRequests = options.folders.map((path61) => {
52244
+ const mark = marks.get(path61);
52245
+ return mark === void 0 ? { path: path61 } : { path: path61, sinceMs: mark.newest - 1e3 };
52238
52246
  });
52239
52247
  const forward = await options.harvest(forwardRequests, { limit, previewChars });
52240
52248
  let candidates = forward.messages.map(toRecord);
@@ -52243,15 +52251,15 @@ async function syncMail(options) {
52243
52251
  let more = forward.truncated;
52244
52252
  const remaining = limit - candidates.length;
52245
52253
  const floor = options.retentionMonths === void 0 ? void 0 : monthsBefore(options.now ?? Date.now(), options.retentionMonths);
52246
- const outstanding = options.folders.filter((path60) => marks.has(path60) && backfillDone[path60] !== true);
52247
- const atFloor = floor === void 0 ? [] : outstanding.filter((path60) => marks.get(path60).oldest <= floor);
52248
- const behind = outstanding.filter((path60) => !atFloor.includes(path60));
52254
+ const outstanding = options.folders.filter((path61) => marks.has(path61) && backfillDone[path61] !== true);
52255
+ const atFloor = floor === void 0 ? [] : outstanding.filter((path61) => marks.get(path61).oldest <= floor);
52256
+ const behind = outstanding.filter((path61) => !atFloor.includes(path61));
52249
52257
  completed.push(...atFloor);
52250
52258
  if (remaining > 0 && behind.length > 0 && options.signal?.aborted !== true) {
52251
- const backRequests = behind.map((path60) => ({
52252
- path: path60,
52259
+ const backRequests = behind.map((path61) => ({
52260
+ path: path61,
52253
52261
  // Strictly older, so the oldest held message is not fetched again every pass.
52254
- beforeMs: marks.get(path60).oldest,
52262
+ beforeMs: marks.get(path61).oldest,
52255
52263
  // And no older than retention wants. The harvest ANDs the two into one window.
52256
52264
  ...floor === void 0 ? {} : { sinceMs: floor }
52257
52265
  }));
@@ -52259,9 +52267,9 @@ async function syncMail(options) {
52259
52267
  backfilled = backward.messages.length;
52260
52268
  candidates = [...candidates, ...backward.messages.map(toRecord)];
52261
52269
  const returnedFor = new Set(backward.messages.map((message4) => message4.folder));
52262
- for (const path60 of behind) {
52263
- if (!returnedFor.has(path60))
52264
- completed.push(path60);
52270
+ for (const path61 of behind) {
52271
+ if (!returnedFor.has(path61))
52272
+ completed.push(path61);
52265
52273
  }
52266
52274
  if (backward.truncated || backfilled > 0)
52267
52275
  more = true;
@@ -52269,7 +52277,7 @@ async function syncMail(options) {
52269
52277
  if (completed.length > 0) {
52270
52278
  await options.store.saveBackfillState({
52271
52279
  ...backfillDone,
52272
- ...Object.fromEntries(completed.map((path60) => [path60, true]))
52280
+ ...Object.fromEntries(completed.map((path61) => [path61, true]))
52273
52281
  });
52274
52282
  }
52275
52283
  const fresh = withoutKnown(candidates, known);
@@ -52603,14 +52611,14 @@ function formatBytes(size) {
52603
52611
  return `${(size / (1 << 10)).toFixed(1)}KB`;
52604
52612
  return `${String(size)}B`;
52605
52613
  }
52606
- async function readTail(fs41, path60, size, count3) {
52614
+ async function readTail(fs41, path61, size, count3) {
52607
52615
  let span = Math.min(size, CHUNK);
52608
52616
  let text;
52609
52617
  let start;
52610
52618
  for (; ; ) {
52611
52619
  start = Math.max(0, size - span);
52612
52620
  const decoder = new import_node_string_decoder.StringDecoder("utf8");
52613
- text = decoder.write(await fs41.readBytesSlice(path60, start, size)) + decoder.end();
52621
+ text = decoder.write(await fs41.readBytesSlice(path61, start, size)) + decoder.end();
52614
52622
  const enough = text.split("\n").length > count3;
52615
52623
  if (enough || start === 0 || span >= size)
52616
52624
  break;
@@ -52628,7 +52636,7 @@ async function readTail(fs41, path60, size, count3) {
52628
52636
  hasMoreAfter: false
52629
52637
  };
52630
52638
  }
52631
- async function readLineWindow(fs41, path60, size, from, count3) {
52639
+ async function readLineWindow(fs41, path61, size, from, count3) {
52632
52640
  const decoder = new import_node_string_decoder.StringDecoder("utf8");
52633
52641
  const lines = [];
52634
52642
  let pending = "";
@@ -52643,7 +52651,7 @@ async function readLineWindow(fs41, path60, size, from, count3) {
52643
52651
  };
52644
52652
  scan: while (position < size) {
52645
52653
  const end = Math.min(size, position + CHUNK);
52646
- pending += decoder.write(await fs41.readBytesSlice(path60, position, end));
52654
+ pending += decoder.write(await fs41.readBytesSlice(path61, position, end));
52647
52655
  position = end;
52648
52656
  const parts = pending.split(/\r\n|\r|\n/);
52649
52657
  pending = parts.pop() ?? "";
@@ -52666,13 +52674,13 @@ async function readLineWindow(fs41, path60, size, from, count3) {
52666
52674
  hasMoreAfter: !reachedEnd || lineNumber > from + lines.length
52667
52675
  };
52668
52676
  }
52669
- async function countLines(fs41, path60, size) {
52677
+ async function countLines(fs41, path61, size) {
52670
52678
  let newlines = 0;
52671
52679
  let position = 0;
52672
52680
  let lastByte = -1;
52673
52681
  while (position < size) {
52674
52682
  const end = Math.min(size, position + CHUNK);
52675
- const buffer = await fs41.readBytesSlice(path60, position, end);
52683
+ const buffer = await fs41.readBytesSlice(path61, position, end);
52676
52684
  for (const byte of buffer)
52677
52685
  if (byte === 10)
52678
52686
  newlines += 1;
@@ -57276,8 +57284,8 @@ async function random(size) {
57276
57284
  const evenDistCutoff = Math.pow(2, 8) - Math.pow(2, 8) % mask.length;
57277
57285
  let result = "";
57278
57286
  while (result.length < size) {
57279
- const randomBytes3 = await getRandomValues(size - result.length);
57280
- for (const randomByte of randomBytes3) {
57287
+ const randomBytes4 = await getRandomValues(size - result.length);
57288
+ for (const randomByte of randomBytes4) {
57281
57289
  if (randomByte < evenDistCutoff) {
57282
57290
  result += mask[randomByte % mask.length];
57283
57291
  }
@@ -60618,13 +60626,13 @@ function buildExport(config2, selected) {
60618
60626
  if (has(config2, key2))
60619
60627
  exported[key2] = config2[key2];
60620
60628
  }
60621
- for (const path60 of section.strip ?? [])
60622
- stripPath(exported, path60);
60629
+ for (const path61 of section.strip ?? [])
60630
+ stripPath(exported, path61);
60623
60631
  }
60624
60632
  return exported;
60625
60633
  }
60626
- function stripPath(target, path60) {
60627
- const [head, ...rest] = path60.split(".");
60634
+ function stripPath(target, path61) {
60635
+ const [head, ...rest] = path61.split(".");
60628
60636
  if (head === void 0)
60629
60637
  return;
60630
60638
  const value = target[head];
@@ -60652,14 +60660,14 @@ function applyImport(existing, imported, selected) {
60652
60660
  else
60653
60661
  delete merged[key2];
60654
60662
  }
60655
- for (const path60 of section.strip ?? []) {
60656
- carryPath(existing, merged, path60);
60663
+ for (const path61 of section.strip ?? []) {
60664
+ carryPath(existing, merged, path61);
60657
60665
  }
60658
60666
  }
60659
60667
  return merged;
60660
60668
  }
60661
- function carryPath(from, to, path60) {
60662
- const [head, ...rest] = path60.split(".");
60669
+ function carryPath(from, to, path61) {
60670
+ const [head, ...rest] = path61.split(".");
60663
60671
  if (head === void 0)
60664
60672
  return;
60665
60673
  const source = from[head];
@@ -62958,7 +62966,7 @@ The conversation is longer than this model accepts, and it could not be shortene
62958
62966
  }
62959
62967
 
62960
62968
  // ../../packages/core/dist/host/bridge.js
62961
- var import_node_crypto14 = require("node:crypto");
62969
+ var import_node_crypto15 = require("node:crypto");
62962
62970
 
62963
62971
  // ../../packages/core/dist/atlassian/autosysGateway.js
62964
62972
  function withBasicCredentials(auth2, headerName, username, password) {
@@ -63499,9 +63507,308 @@ function stripAnsi(text) {
63499
63507
  // ../../packages/core/dist/jupyter/mirror.js
63500
63508
  var import_node_crypto10 = require("node:crypto");
63501
63509
  var import_promises16 = __toESM(require("node:fs/promises"), 1);
63510
+ var import_node_path30 = __toESM(require("node:path"), 1);
63511
+
63512
+ // ../../packages/core/dist/tools/nativeSearch.js
63513
+ var import_node_os4 = __toESM(require("node:os"), 1);
63502
63514
  var import_node_path29 = __toESM(require("node:path"), 1);
63515
+ var ALWAYS_SKIPPED = /* @__PURE__ */ new Set([".git", "node_modules"]);
63516
+ var DEFAULT_MAX_FILES = 5e4;
63517
+ var caseFlag = process.platform === "win32" ? "i" : "";
63518
+ function globToRegExp(glob, anchored) {
63519
+ let body = "";
63520
+ for (let index = 0; index < glob.length; index += 1) {
63521
+ const char = glob[index];
63522
+ if (char === "*") {
63523
+ if (glob[index + 1] === "*") {
63524
+ const slashAfter = glob[index + 2] === "/";
63525
+ const atSegmentStart = index === 0 || glob[index - 1] === "/";
63526
+ if (atSegmentStart && slashAfter) {
63527
+ body += "(?:.*/)?";
63528
+ index += 2;
63529
+ } else {
63530
+ body += ".*";
63531
+ index += 1;
63532
+ }
63533
+ } else {
63534
+ body += "[^/]*";
63535
+ }
63536
+ } else if (char === "?") {
63537
+ body += "[^/]";
63538
+ } else if (char === "[") {
63539
+ const close = glob.indexOf("]", index + 2);
63540
+ if (close === -1) {
63541
+ body += "\\[";
63542
+ } else {
63543
+ let inner = glob.slice(index + 1, close);
63544
+ if (inner.startsWith("!"))
63545
+ inner = `^${inner.slice(1)}`;
63546
+ body += `[${inner.replace(/\\/g, "\\\\")}]`;
63547
+ index = close;
63548
+ }
63549
+ } else if (char === "{") {
63550
+ const close = glob.indexOf("}", index);
63551
+ if (close === -1) {
63552
+ body += "\\{";
63553
+ } else {
63554
+ const options = glob.slice(index + 1, close).split(",");
63555
+ body += `(?:${options.map((option) => globToRegExp(option, true).source.slice(1, -1)).join("|")})`;
63556
+ index = close;
63557
+ }
63558
+ } else if (char === "\\" && index + 1 < glob.length) {
63559
+ body += escapeRegExp2(glob[index + 1]);
63560
+ index += 1;
63561
+ } else {
63562
+ body += escapeRegExp2(char);
63563
+ }
63564
+ }
63565
+ return new RegExp(anchored ? `^${body}$` : `^(?:.*/)?${body}$`, caseFlag);
63566
+ }
63567
+ function escapeRegExp2(text) {
63568
+ return text.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&");
63569
+ }
63570
+ function parseIgnoreFile(text, base) {
63571
+ const rules = [];
63572
+ for (const raw of text.split(/\r?\n/)) {
63573
+ let line = raw.replace(/(?<!\\)\s+$/, "");
63574
+ if (line.length === 0 || line.startsWith("#"))
63575
+ continue;
63576
+ let negate = false;
63577
+ if (line.startsWith("!")) {
63578
+ negate = true;
63579
+ line = line.slice(1);
63580
+ } else if (line.startsWith("\\!") || line.startsWith("\\#")) {
63581
+ line = line.slice(1);
63582
+ }
63583
+ let dirOnly = false;
63584
+ if (line.endsWith("/")) {
63585
+ dirOnly = true;
63586
+ line = line.slice(0, -1);
63587
+ }
63588
+ if (line.length === 0)
63589
+ continue;
63590
+ const anchored = line.includes("/");
63591
+ if (line.startsWith("/"))
63592
+ line = line.slice(1);
63593
+ rules.push({ base, regex: globToRegExp(line, anchored), negate, dirOnly });
63594
+ }
63595
+ return rules;
63596
+ }
63597
+ function isIgnored(rules, relative, isDirectory2) {
63598
+ return ignoreDecision(rules, relative, isDirectory2, false);
63599
+ }
63600
+ function ignoreDecision(rules, relative, isDirectory2, initial) {
63601
+ let ignored = initial;
63602
+ for (const rule of rules) {
63603
+ if (rule.dirOnly && !isDirectory2)
63604
+ continue;
63605
+ let scoped = relative;
63606
+ if (rule.base.length > 0) {
63607
+ if (!relative.startsWith(`${rule.base}/`))
63608
+ continue;
63609
+ scoped = relative.slice(rule.base.length + 1);
63610
+ }
63611
+ if (rule.regex.test(scoped))
63612
+ ignored = !rule.negate;
63613
+ }
63614
+ return ignored;
63615
+ }
63616
+ async function repositoryWideRules(fs41, root, globalIgnoreFile) {
63617
+ const sources = [
63618
+ globalIgnoreFile ?? import_node_path29.default.join(process.env["XDG_CONFIG_HOME"] ?? import_node_path29.default.join(import_node_os4.default.homedir(), ".config"), "git", "ignore"),
63619
+ import_node_path29.default.join(root, ".git", "info", "exclude")
63620
+ ];
63621
+ const rules = [];
63622
+ for (const source of sources) {
63623
+ try {
63624
+ rules.push(...parseIgnoreFile(await fs41.readFile(source), ""));
63625
+ } catch {
63626
+ }
63627
+ }
63628
+ return rules;
63629
+ }
63630
+ async function walkFiles(fs41, root, options) {
63631
+ const maxFiles = options.maxFiles ?? DEFAULT_MAX_FILES;
63632
+ const files = [];
63633
+ const baseRules = options.includeIgnored ? [] : await repositoryWideRules(fs41, root, options.globalIgnoreFile);
63634
+ const pending = [{ relative: "", rules: baseRules }];
63635
+ while (pending.length > 0) {
63636
+ if (options.signal?.aborted === true)
63637
+ break;
63638
+ const { relative, rules: inherited } = pending.pop();
63639
+ const absolute = relative.length > 0 ? import_node_path29.default.join(root, ...relative.split("/")) : root;
63640
+ let entries;
63641
+ try {
63642
+ entries = await fs41.readdir(absolute);
63643
+ } catch {
63644
+ continue;
63645
+ }
63646
+ let rules = inherited;
63647
+ if (!options.includeIgnored && entries.some((entry) => entry.name === ".gitignore" && !entry.isDirectory)) {
63648
+ try {
63649
+ const text = await fs41.readFile(import_node_path29.default.join(absolute, ".gitignore"));
63650
+ rules = [...inherited, ...parseIgnoreFile(text, relative)];
63651
+ } catch {
63652
+ }
63653
+ }
63654
+ const sorted = [...entries].sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
63655
+ const subdirectories = [];
63656
+ for (const entry of sorted) {
63657
+ if (ALWAYS_SKIPPED.has(entry.name))
63658
+ continue;
63659
+ const child = relative.length > 0 ? `${relative}/${entry.name}` : entry.name;
63660
+ if (!options.includeIgnored && isIgnored(rules, child, entry.isDirectory))
63661
+ continue;
63662
+ if (entry.isDirectory) {
63663
+ subdirectories.push(child);
63664
+ } else if (entry.isFile) {
63665
+ files.push(child);
63666
+ if (files.length >= maxFiles)
63667
+ return { files, truncated: true };
63668
+ }
63669
+ }
63670
+ for (const child of subdirectories.reverse())
63671
+ pending.push({ relative: child, rules });
63672
+ }
63673
+ return { files, truncated: false };
63674
+ }
63675
+ var MAX_FILE_BYTES = 5 * 1024 * 1024;
63676
+ var DEFAULT_MAX_OUTPUT = 2 * 1024 * 1024;
63677
+ function compilePattern(pattern) {
63678
+ let source = pattern;
63679
+ let flags = "";
63680
+ const inline2 = /^\(\?([a-z]+)\)/.exec(source);
63681
+ if (inline2 !== null) {
63682
+ source = source.slice(inline2[0].length);
63683
+ if (inline2[1].includes("i"))
63684
+ flags += "i";
63685
+ if (inline2[1].includes("s"))
63686
+ flags += "s";
63687
+ if (inline2[1].includes("m"))
63688
+ flags += "m";
63689
+ }
63690
+ try {
63691
+ return new RegExp(source, `${flags}u`);
63692
+ } catch {
63693
+ try {
63694
+ return new RegExp(source, flags);
63695
+ } catch (error51) {
63696
+ throw new Error(`The search pattern is not a valid regular expression: ${error51 instanceof Error ? error51.message : String(error51)}`, { cause: error51 });
63697
+ }
63698
+ }
63699
+ }
63700
+ function fileFilter(filePattern) {
63701
+ if (filePattern === void 0 || filePattern.trim().length === 0)
63702
+ return () => true;
63703
+ let glob = filePattern.trim();
63704
+ const exclude = glob.startsWith("!");
63705
+ if (exclude)
63706
+ glob = glob.slice(1);
63707
+ const anchored = glob.includes("/");
63708
+ const regex = globToRegExp(glob.startsWith("/") ? glob.slice(1) : glob, anchored);
63709
+ return (relative) => regex.test(relative) !== exclude;
63710
+ }
63711
+ async function searchFiles(fs41, root, options) {
63712
+ const regex = compilePattern(options.pattern);
63713
+ const admits = fileFilter(options.filePattern);
63714
+ const context = options.contextLines ?? 2;
63715
+ const maxOutput = options.maxOutputChars ?? DEFAULT_MAX_OUTPUT;
63716
+ const { files, truncated: walkTruncated } = await walkFiles(fs41, root, options);
63717
+ const separator = process.platform === "win32" ? "\\" : "/";
63718
+ const chunks = [];
63719
+ let size = 0;
63720
+ let firstGroup = true;
63721
+ for (const relative of files) {
63722
+ if (options.signal?.aborted === true)
63723
+ break;
63724
+ if (!admits(relative))
63725
+ continue;
63726
+ const absolute = import_node_path29.default.join(root, ...relative.split("/"));
63727
+ let bytes;
63728
+ try {
63729
+ const stat = await fs41.stat(absolute);
63730
+ if (stat.size > MAX_FILE_BYTES)
63731
+ continue;
63732
+ bytes = await fs41.readBytes(absolute);
63733
+ } catch {
63734
+ continue;
63735
+ }
63736
+ if (bytes.subarray(0, 8e3).includes(0))
63737
+ continue;
63738
+ const lines = bytes.toString("utf8").split("\n").map((line) => line.endsWith("\r") ? line.slice(0, -1) : line);
63739
+ const matched = [];
63740
+ for (let index = 0; index < lines.length; index += 1) {
63741
+ regex.lastIndex = 0;
63742
+ if (regex.test(lines[index]))
63743
+ matched.push(index);
63744
+ }
63745
+ if (matched.length === 0)
63746
+ continue;
63747
+ const shown2 = `.${separator}${relative.split("/").join(separator)}`;
63748
+ const matchSet = new Set(matched);
63749
+ let lastPrinted = -2;
63750
+ for (const hit of matched) {
63751
+ const from = Math.max(0, hit - context, lastPrinted + 1);
63752
+ const to = Math.min(lines.length - 1, hit + context);
63753
+ if (from > lastPrinted + 1 && !firstGroup)
63754
+ chunks.push("--");
63755
+ firstGroup = false;
63756
+ for (let index = from; index <= to; index += 1) {
63757
+ if (index === lines.length - 1 && lines[index] === "" && !matchSet.has(index))
63758
+ continue;
63759
+ const line = `${shown2}${matchSet.has(index) ? ":" : "-"}${index + 1}${matchSet.has(index) ? ":" : "-"}${lines[index]}`;
63760
+ chunks.push(line);
63761
+ size += line.length + 1;
63762
+ }
63763
+ lastPrinted = Math.max(lastPrinted, to);
63764
+ if (size > maxOutput) {
63765
+ return { output: chunks.join("\n"), truncated: true };
63766
+ }
63767
+ }
63768
+ }
63769
+ return { output: chunks.join("\n"), truncated: walkTruncated };
63770
+ }
63771
+
63772
+ // ../../packages/core/dist/jupyter/hubIgnore.js
63773
+ var HUBIGNORE = ".hubignore";
63774
+ var BUILT_IN_SKIPS = /* @__PURE__ */ new Set([
63775
+ ".ipynb_checkpoints",
63776
+ "__pycache__",
63777
+ ".git",
63778
+ "node_modules",
63779
+ ".venv",
63780
+ "venv",
63781
+ ".mypy_cache",
63782
+ ".pytest_cache"
63783
+ ]);
63784
+ function skippedByDefault(name) {
63785
+ if (name === HUBIGNORE)
63786
+ return false;
63787
+ return name.startsWith(".") || BUILT_IN_SKIPS.has(name);
63788
+ }
63789
+ var HubIgnore = class _HubIgnore {
63790
+ rules;
63791
+ constructor(rules = []) {
63792
+ this.rules = rules;
63793
+ }
63794
+ /** These rules plus a `.hubignore` read in the folder `base` (relative to the synced folder, `/`-separated). */
63795
+ with(text, base) {
63796
+ return new _HubIgnore([...this.rules, ...parseIgnoreFile(text, base)]);
63797
+ }
63798
+ /** Whether a path inside the synced folder (`/`-separated) is left out. */
63799
+ ignores(relative, isDirectory2) {
63800
+ const name = relative.split("/").pop() ?? relative;
63801
+ if (name === HUBIGNORE)
63802
+ return false;
63803
+ return ignoreDecision(this.rules, relative, isDirectory2, skippedByDefault(name));
63804
+ }
63805
+ get empty() {
63806
+ return this.rules.length === 0;
63807
+ }
63808
+ };
63809
+
63810
+ // ../../packages/core/dist/jupyter/mirror.js
63503
63811
  var MANIFEST = ".lightcode-hub.json";
63504
- var SKIPPED_FOLDERS = /* @__PURE__ */ new Set([".ipynb_checkpoints", "__pycache__", ".git", "node_modules", ".venv", "venv", ".mypy_cache", ".pytest_cache"]);
63505
63812
  var CONCURRENCY = 8;
63506
63813
  var HubMirror = class {
63507
63814
  client;
@@ -63527,14 +63834,14 @@ var HubMirror = class {
63527
63834
  if (this.manifest !== void 0)
63528
63835
  return this.manifest;
63529
63836
  try {
63530
- this.manifest = JSON.parse(await import_promises16.default.readFile(import_node_path29.default.join(this.root, MANIFEST), "utf8"));
63837
+ this.manifest = JSON.parse(await import_promises16.default.readFile(import_node_path30.default.join(this.root, MANIFEST), "utf8"));
63531
63838
  } catch {
63532
63839
  this.manifest = {};
63533
63840
  }
63534
63841
  return this.manifest;
63535
63842
  }
63536
63843
  async saveManifest() {
63537
- const target = import_node_path29.default.join(this.root, MANIFEST);
63844
+ const target = import_node_path30.default.join(this.root, MANIFEST);
63538
63845
  const temporary = `${target}.${String(process.pid)}.tmp`;
63539
63846
  await import_promises16.default.mkdir(this.root, { recursive: true });
63540
63847
  await import_promises16.default.writeFile(temporary, JSON.stringify(this.manifest ?? {}), "utf8");
@@ -63542,10 +63849,10 @@ var HubMirror = class {
63542
63849
  }
63543
63850
  /** The hub path for a local file, or undefined when it is not inside one of the hub folders. */
63544
63851
  remoteOf(localAbsolute) {
63545
- const relative = import_node_path29.default.relative(this.root, localAbsolute);
63546
- if (relative.startsWith("..") || import_node_path29.default.isAbsolute(relative))
63852
+ const relative = import_node_path30.default.relative(this.root, localAbsolute);
63853
+ if (relative.startsWith("..") || import_node_path30.default.isAbsolute(relative))
63547
63854
  return void 0;
63548
- const parts = relative.split(import_node_path29.default.sep);
63855
+ const parts = relative.split(import_node_path30.default.sep);
63549
63856
  const folder = this.folders.find((f) => f.local.toLowerCase() === (parts[0] ?? "").toLowerCase());
63550
63857
  if (folder === void 0)
63551
63858
  return void 0;
@@ -63564,13 +63871,13 @@ var HubMirror = class {
63564
63871
  }
63565
63872
  async pullNow(signal) {
63566
63873
  const manifest = await this.loadManifest();
63567
- const result = { fetched: [], unchanged: 0, removed: [], conflicts: [], skipped: [], failed: [] };
63874
+ const result = { fetched: [], unchanged: 0, removed: [], conflicts: [], skipped: [], ignored: [], failed: [] };
63568
63875
  const maxBytes = (this.spec.maxFileMB ?? 20) * 1024 * 1024;
63569
63876
  const seen = /* @__PURE__ */ new Set();
63570
63877
  for (const folder of this.folders) {
63571
63878
  let files;
63572
63879
  try {
63573
- files = await this.walk(folder.remote, signal);
63880
+ files = await this.walk(folder, signal);
63574
63881
  } catch (error51) {
63575
63882
  result.failed.push({ path: folder.remote || "(top folder)", problem: error51 instanceof Error ? error51.message : String(error51) });
63576
63883
  for (const key2 of Object.keys(manifest))
@@ -63582,7 +63889,7 @@ var HubMirror = class {
63582
63889
  const inside = folder.remote.length > 0 ? entry.path.slice(folder.remote.length + 1) : entry.path;
63583
63890
  const key2 = `${folder.local}/${inside}`;
63584
63891
  seen.add(key2);
63585
- const local = import_node_path29.default.join(this.root, ...key2.split("/"));
63892
+ const local = import_node_path30.default.join(this.root, ...key2.split("/"));
63586
63893
  const known = manifest[key2];
63587
63894
  const localHash = await hashFile(local);
63588
63895
  const changedHere = localHash !== void 0 && (known === void 0 || known.hash !== localHash);
@@ -63615,7 +63922,12 @@ var HubMirror = class {
63615
63922
  for (const [key2, known] of Object.entries(manifest)) {
63616
63923
  if (seen.has(key2))
63617
63924
  continue;
63618
- const local = import_node_path29.default.join(this.root, ...key2.split("/"));
63925
+ if (await this.ignoredHere(key2)) {
63926
+ delete manifest[key2];
63927
+ result.ignored.push(key2);
63928
+ continue;
63929
+ }
63930
+ const local = import_node_path30.default.join(this.root, ...key2.split("/"));
63619
63931
  const localHash = await hashFile(local);
63620
63932
  if (localHash !== void 0 && localHash !== known.hash) {
63621
63933
  result.conflicts.push(key2);
@@ -63628,24 +63940,35 @@ var HubMirror = class {
63628
63940
  await this.saveManifest();
63629
63941
  return result;
63630
63942
  }
63631
- /** Every file under a remote folder, folders listed in parallel. */
63632
- async walk(remote, signal) {
63943
+ /**
63944
+ * Every file under a remote folder that is not ignored, folders listed in parallel. An ignored
63945
+ * folder is not listed at all - which is the point for a `node_modules` of forty thousand files.
63946
+ */
63947
+ async walk(folder, signal) {
63633
63948
  const files = [];
63634
- let level = [remote];
63949
+ let level = [{ remote: folder.remote, inside: "", ignore: new HubIgnore() }];
63635
63950
  while (level.length > 0) {
63636
63951
  const next = [];
63637
- await inBatches(level, CONCURRENCY, async (folder) => {
63638
- const entries = await this.client.list(folder, signal);
63952
+ await inBatches(level, CONCURRENCY, async (dir) => {
63953
+ const entries = await this.client.list(dir.remote, signal);
63639
63954
  if (entries === void 0) {
63640
- if (folder === remote)
63641
- throw new Error(`The hub has no folder "${remote}".`);
63955
+ if (dir.remote === folder.remote)
63956
+ throw new Error(`The hub has no folder "${folder.remote}".`);
63642
63957
  return;
63643
63958
  }
63959
+ let ignore = dir.ignore;
63960
+ const rules = entries.find((entry) => entry.name === HUBIGNORE && entry.type !== "directory");
63961
+ if (rules !== void 0) {
63962
+ const local = import_node_path30.default.join(this.root, folder.local, ...dir.inside.split("/").filter((p) => p.length > 0), HUBIGNORE);
63963
+ const text = await import_promises16.default.readFile(local, "utf8").catch(async () => (await this.client.read(rules.path, signal)).bytes.toString("utf8"));
63964
+ ignore = ignore.with(text, dir.inside);
63965
+ }
63644
63966
  for (const entry of entries) {
63645
- if (entry.name.startsWith(".") || SKIPPED_FOLDERS.has(entry.name))
63967
+ const inside = dir.inside.length > 0 ? `${dir.inside}/${entry.name}` : entry.name;
63968
+ if (ignore.ignores(inside, entry.type === "directory"))
63646
63969
  continue;
63647
63970
  if (entry.type === "directory")
63648
- next.push(entry.path);
63971
+ next.push({ remote: entry.path, inside, ignore });
63649
63972
  else
63650
63973
  files.push(entry);
63651
63974
  }
@@ -63654,6 +63977,27 @@ var HubMirror = class {
63654
63977
  }
63655
63978
  return files;
63656
63979
  }
63980
+ /**
63981
+ * Whether a local key (`<folder>/<path>`) is left out by `.hubignore` - the rules in this machine's
63982
+ * copy, from the synced folder down to the file, and any folder on the way that is itself left out.
63983
+ */
63984
+ async ignoredHere(key2) {
63985
+ const [folderName, ...parts] = key2.split("/");
63986
+ const folder = this.folders.find((f) => f.local.toLowerCase() === (folderName ?? "").toLowerCase());
63987
+ if (folder === void 0 || parts.length === 0)
63988
+ return false;
63989
+ let ignore = new HubIgnore();
63990
+ for (let depth = 0; depth < parts.length; depth++) {
63991
+ const inside = parts.slice(0, depth).join("/");
63992
+ const text = await import_promises16.default.readFile(import_node_path30.default.join(this.root, folder.local, ...parts.slice(0, depth), HUBIGNORE), "utf8").catch(() => void 0);
63993
+ if (text !== void 0)
63994
+ ignore = ignore.with(text, inside);
63995
+ const here = parts.slice(0, depth + 1).join("/");
63996
+ if (ignore.ignores(here, depth < parts.length - 1))
63997
+ return true;
63998
+ }
63999
+ return false;
64000
+ }
63657
64001
  /**
63658
64002
  * Saves one local file to the hub. Refuses - and changes nothing - when the hub's copy changed
63659
64003
  * since this copy last agreed with it.
@@ -63666,7 +64010,9 @@ var HubMirror = class {
63666
64010
  if (remote === void 0)
63667
64011
  return { saved: false, message: "not inside one of the JupyterHub folders, so it stays local" };
63668
64012
  const manifest = await this.loadManifest();
63669
- const key2 = import_node_path29.default.relative(this.root, localAbsolute).split(import_node_path29.default.sep).join("/");
64013
+ const key2 = import_node_path30.default.relative(this.root, localAbsolute).split(import_node_path30.default.sep).join("/");
64014
+ if (await this.ignoredHere(key2))
64015
+ return { saved: false, ignored: true, message: `listed in ${HUBIGNORE} (or skipped by default), so it stays local` };
63670
64016
  let bytes;
63671
64017
  try {
63672
64018
  bytes = await import_promises16.default.readFile(localAbsolute);
@@ -63712,7 +64058,7 @@ var HubMirror = class {
63712
64058
  const manifest = await this.loadManifest();
63713
64059
  const file2 = await this.client.read(remote, signal);
63714
64060
  await writeWhole(localAbsolute, file2.bytes);
63715
- manifest[import_node_path29.default.relative(this.root, localAbsolute).split(import_node_path29.default.sep).join("/")] = { remote, lastModified: file2.lastModified, hash: sha(file2.bytes) };
64061
+ manifest[import_node_path30.default.relative(this.root, localAbsolute).split(import_node_path30.default.sep).join("/")] = { remote, lastModified: file2.lastModified, hash: sha(file2.bytes) };
63716
64062
  await this.saveManifest();
63717
64063
  return remote;
63718
64064
  });
@@ -63723,8 +64069,8 @@ var HubMirror = class {
63723
64069
  const changes = [];
63724
64070
  const seen = /* @__PURE__ */ new Set();
63725
64071
  for (const folder of this.folders) {
63726
- for (const local of await listLocal(import_node_path29.default.join(this.root, folder.local))) {
63727
- const key2 = import_node_path29.default.relative(this.root, local).split(import_node_path29.default.sep).join("/");
64072
+ for (const local of await listLocal(import_node_path30.default.join(this.root, folder.local), "", new HubIgnore())) {
64073
+ const key2 = import_node_path30.default.relative(this.root, local).split(import_node_path30.default.sep).join("/");
63728
64074
  seen.add(key2);
63729
64075
  const known = manifest[key2];
63730
64076
  const remote = this.remoteOf(local) ?? key2;
@@ -63735,7 +64081,7 @@ var HubMirror = class {
63735
64081
  }
63736
64082
  }
63737
64083
  for (const [key2, known] of Object.entries(manifest)) {
63738
- if (!seen.has(key2))
64084
+ if (!seen.has(key2) && !await this.ignoredHere(key2))
63739
64085
  changes.push({ local: key2, remote: known.remote, kind: "deleted" });
63740
64086
  }
63741
64087
  return changes;
@@ -63752,12 +64098,12 @@ function sha(bytes) {
63752
64098
  return (0, import_node_crypto10.createHash)("sha256").update(bytes).digest("hex");
63753
64099
  }
63754
64100
  async function writeWhole(target, bytes) {
63755
- await import_promises16.default.mkdir(import_node_path29.default.dirname(target), { recursive: true });
64101
+ await import_promises16.default.mkdir(import_node_path30.default.dirname(target), { recursive: true });
63756
64102
  const temporary = `${target}.${String(process.pid)}.part`;
63757
64103
  await import_promises16.default.writeFile(temporary, bytes);
63758
64104
  await replaceFile(temporary, target);
63759
64105
  }
63760
- async function listLocal(folder) {
64106
+ async function listLocal(folder, inside, ignore) {
63761
64107
  const found2 = [];
63762
64108
  let entries;
63763
64109
  try {
@@ -63765,12 +64111,18 @@ async function listLocal(folder) {
63765
64111
  } catch {
63766
64112
  return found2;
63767
64113
  }
64114
+ if (entries.some((entry) => entry.name === HUBIGNORE && entry.isFile())) {
64115
+ const text = await import_promises16.default.readFile(import_node_path30.default.join(folder, HUBIGNORE), "utf8").catch(() => void 0);
64116
+ if (text !== void 0)
64117
+ ignore = ignore.with(text, inside);
64118
+ }
63768
64119
  for (const entry of entries) {
63769
- if (entry.name.startsWith(".") || SKIPPED_FOLDERS.has(entry.name))
64120
+ const relative = inside.length > 0 ? `${inside}/${entry.name}` : entry.name;
64121
+ if (ignore.ignores(relative, entry.isDirectory()))
63770
64122
  continue;
63771
- const full = import_node_path29.default.join(folder, entry.name);
64123
+ const full = import_node_path30.default.join(folder, entry.name);
63772
64124
  if (entry.isDirectory())
63773
- found2.push(...await listLocal(full));
64125
+ found2.push(...await listLocal(full, relative, ignore));
63774
64126
  else if (entry.isFile() && !entry.name.endsWith(".part"))
63775
64127
  found2.push(full);
63776
64128
  }
@@ -63815,7 +64167,15 @@ function hubGuidance(runtime) {
63815
64167
  "look up a hub library's API with hub_inspect rather than guessing. The local language server cannot see those",
63816
64168
  'libraries, so "import could not be resolved" is not reported here - it says nothing about the hub.',
63817
64169
  "The git repository is on the hub too, not in this copy: run git there with hub_run shell (cwd = the folder),",
63818
- 'and after anything that changes files (pull, checkout, merge) use hub_sync "pull" to bring them here.'
64170
+ 'and after anything that changes files (pull, checkout, merge) use hub_sync "pull" to bring them here.',
64171
+ "",
64172
+ "**.hubignore** lists files and folders that are never synced, in either direction - .gitignore syntax (`dist/`,",
64173
+ "`*.log`, `/build/`, `!keep.me`), in any synced folder, applying beneath it. Dot-files, node_modules, .git,",
64174
+ "virtualenvs and Python caches are skipped already (`!.editorconfig` brings one back). When you create or set up",
64175
+ "a project whose tools generate output or caches - Angular, React, any Node or Java build - write a .hubignore in",
64176
+ "its folder FIRST, before installing or building, listing what those tools generate (for Angular: dist/,",
64177
+ ".angular/, out-tsc/, coverage/, *.log), and tell the user what you put in it. A file already synced that a new",
64178
+ "rule lists simply stops being synced; nothing is deleted on either side."
63819
64179
  ].join("\n");
63820
64180
  }
63821
64181
  function withoutMissingImports(provider) {
@@ -63834,7 +64194,7 @@ function withoutMissingImports(provider) {
63834
64194
 
63835
64195
  // ../../packages/core/dist/python/machineApprovals.js
63836
64196
  var import_promises17 = __toESM(require("node:fs/promises"), 1);
63837
- var import_node_path30 = __toESM(require("node:path"), 1);
64197
+ var import_node_path31 = __toESM(require("node:path"), 1);
63838
64198
  var FileMachineApprovals = class {
63839
64199
  file;
63840
64200
  cache;
@@ -63877,7 +64237,7 @@ var FileMachineApprovals = class {
63877
64237
  }
63878
64238
  if (!changed)
63879
64239
  return;
63880
- await import_promises17.default.mkdir(import_node_path30.default.dirname(this.file), { recursive: true });
64240
+ await import_promises17.default.mkdir(import_node_path31.default.dirname(this.file), { recursive: true });
63881
64241
  const temporary = `${this.file}.${String(process.pid)}.${String(Date.now())}.tmp`;
63882
64242
  await import_promises17.default.writeFile(temporary, JSON.stringify(ledger, null, 1), "utf8");
63883
64243
  await replaceFile(temporary, this.file);
@@ -63890,21 +64250,124 @@ var FileMachineApprovals = class {
63890
64250
 
63891
64251
  // ../../packages/core/dist/addons/discover.js
63892
64252
  var import_promises18 = __toESM(require("node:fs/promises"), 1);
63893
- var import_node_path31 = __toESM(require("node:path"), 1);
64253
+ var import_node_path32 = __toESM(require("node:path"), 1);
64254
+
64255
+ // ../../packages/core/dist/addons/page.js
64256
+ var KEY = /^[a-zA-Z][a-zA-Z0-9_]{0,40}$/;
64257
+ var addonFieldSchema = external_exports.object({
64258
+ key: external_exports.string().regex(KEY),
64259
+ label: external_exports.string().min(1).max(80),
64260
+ type: external_exports.enum(["string", "number", "boolean", "choice", "secret", "path", "text"]),
64261
+ required: external_exports.boolean().optional(),
64262
+ default: external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()]).optional(),
64263
+ options: external_exports.array(external_exports.object({ value: external_exports.string(), label: external_exports.string() })).max(30).optional(),
64264
+ placeholder: external_exports.string().max(200).optional(),
64265
+ help: external_exports.string().max(500).optional(),
64266
+ /** A pattern the value must match, with the sentence shown when it does not. */
64267
+ pattern: external_exports.string().max(200).optional(),
64268
+ patternMessage: external_exports.string().max(200).optional(),
64269
+ /** Shown only while another field of the same form has this value - auth fields by auth method. */
64270
+ showWhen: external_exports.object({ field: external_exports.string().regex(KEY), equals: external_exports.union([external_exports.string(), external_exports.array(external_exports.string())]) }).optional()
64271
+ });
64272
+ var addonPageSchema = external_exports.object({
64273
+ title: external_exports.string().min(1).max(40),
64274
+ description: external_exports.string().max(1e3).optional(),
64275
+ /** Settings of the add-on as a whole. */
64276
+ fields: external_exports.array(addonFieldSchema).max(30).optional(),
64277
+ /** A list of things the user adds - machines, sites, accounts. */
64278
+ records: external_exports.object({
64279
+ /** What one is called: "machine". */
64280
+ noun: external_exports.string().min(1).max(30),
64281
+ title: external_exports.string().min(1).max(40),
64282
+ description: external_exports.string().max(1e3).optional(),
64283
+ /** The field that names a record, unique among them: what the user and the agent call it. */
64284
+ keyField: external_exports.string().regex(KEY),
64285
+ /** One line under the name, e.g. "{username}@{host}:{port}". */
64286
+ summary: external_exports.string().max(200).optional(),
64287
+ fields: external_exports.array(addonFieldSchema).min(1).max(30),
64288
+ /**
64289
+ * Buttons on each record, each calling one of the add-on's own tools with `{ [keyField]: name }`
64290
+ * - "Test connection". Pressed by the user, about a record they are looking at, so it is not an
64291
+ * agent's tool call and asks no approval.
64292
+ */
64293
+ actions: external_exports.array(external_exports.object({ label: external_exports.string().min(1).max(40), tool: external_exports.string().regex(/^[a-zA-Z0-9_-]{1,64}$/) })).max(5).optional(),
64294
+ max: external_exports.number().int().positive().max(500).optional()
64295
+ }).optional()
64296
+ });
64297
+ function addonSecretRef(pkg, recordId, field2) {
64298
+ return `addon:${pkg}:${recordId ?? "_"}:${field2}`;
64299
+ }
64300
+ function cleanAddonValues(fields, values) {
64301
+ const out = {};
64302
+ const effective = { ...values };
64303
+ for (const field2 of fields) {
64304
+ const given = values[field2.key];
64305
+ if ((given === void 0 || given === "" || given === null) && field2.default !== void 0)
64306
+ effective[field2.key] = field2.default;
64307
+ }
64308
+ for (const field2 of fields) {
64309
+ if (field2.type === "secret")
64310
+ continue;
64311
+ const value = effective[field2.key];
64312
+ if (!isShown(field2, effective))
64313
+ continue;
64314
+ if (value === void 0 || value === "") {
64315
+ if (field2.required === true)
64316
+ return { ok: false, message: `${field2.label} is required.` };
64317
+ continue;
64318
+ }
64319
+ switch (field2.type) {
64320
+ case "number": {
64321
+ const n = typeof value === "number" ? value : Number(String(value).trim());
64322
+ if (!Number.isFinite(n))
64323
+ return { ok: false, message: `${field2.label} must be a number.` };
64324
+ out[field2.key] = n;
64325
+ break;
64326
+ }
64327
+ case "boolean":
64328
+ out[field2.key] = value === true || value === "true";
64329
+ break;
64330
+ case "choice": {
64331
+ const text = String(value);
64332
+ if (!(field2.options ?? []).some((option) => option.value === text))
64333
+ return { ok: false, message: `${field2.label}: choose one of the options.` };
64334
+ out[field2.key] = text;
64335
+ break;
64336
+ }
64337
+ default: {
64338
+ const text = String(value).trim();
64339
+ if (field2.pattern !== void 0 && !new RegExp(field2.pattern).test(text)) {
64340
+ return { ok: false, message: field2.patternMessage ?? `${field2.label} is not in the expected form.` };
64341
+ }
64342
+ out[field2.key] = text;
64343
+ }
64344
+ }
64345
+ }
64346
+ return { ok: true, values: out };
64347
+ }
64348
+ function isShown(field2, values) {
64349
+ if (field2.showWhen === void 0)
64350
+ return true;
64351
+ const current = String(values[field2.showWhen.field] ?? "");
64352
+ const wanted = field2.showWhen.equals;
64353
+ return Array.isArray(wanted) ? wanted.includes(current) : current === wanted;
64354
+ }
64355
+
64356
+ // ../../packages/core/dist/addons/discover.js
63894
64357
  function defaultAddonFolders(env2, execPath, platform) {
63895
64358
  const folders = [];
63896
64359
  const prefix = env2["npm_config_prefix"] ?? env2["NPM_CONFIG_PREFIX"];
63897
64360
  if (platform === "win32") {
63898
64361
  if (prefix !== void 0 && prefix.length > 0)
63899
- folders.push(import_node_path31.default.join(prefix, "node_modules"));
64362
+ folders.push(import_node_path32.default.join(prefix, "node_modules"));
63900
64363
  if (env2["APPDATA"] !== void 0)
63901
- folders.push(import_node_path31.default.join(env2["APPDATA"], "npm", "node_modules"));
64364
+ folders.push(import_node_path32.default.join(env2["APPDATA"], "npm", "node_modules"));
63902
64365
  } else {
63903
64366
  if (prefix !== void 0 && prefix.length > 0)
63904
- folders.push(import_node_path31.default.join(prefix, "lib", "node_modules"));
63905
- folders.push(import_node_path31.default.join(import_node_path31.default.dirname(import_node_path31.default.dirname(execPath)), "lib", "node_modules"));
64367
+ folders.push(import_node_path32.default.join(prefix, "lib", "node_modules"));
64368
+ folders.push(import_node_path32.default.join(import_node_path32.default.dirname(import_node_path32.default.dirname(execPath)), "lib", "node_modules"));
63906
64369
  }
63907
- return [...new Set(folders.map((folder) => import_node_path31.default.resolve(folder)))];
64370
+ return [...new Set(folders.map((folder) => import_node_path32.default.resolve(folder)))];
63908
64371
  }
63909
64372
  function addonServerName(pkg) {
63910
64373
  const bare = pkg.replace(/^@[^/]+\//, "").replace(/^(light-code|lightcode|fire-code)-addon-/i, "");
@@ -63914,14 +64377,14 @@ function addonServerName(pkg) {
63914
64377
  async function readAddon(dir) {
63915
64378
  let manifest;
63916
64379
  try {
63917
- manifest = JSON.parse((await import_promises18.default.readFile(import_node_path31.default.join(dir, "package.json"), "utf8")).replace(/^\uFEFF/, ""));
64380
+ manifest = JSON.parse((await import_promises18.default.readFile(import_node_path32.default.join(dir, "package.json"), "utf8")).replace(/^\uFEFF/, ""));
63918
64381
  } catch {
63919
64382
  return void 0;
63920
64383
  }
63921
64384
  const label = manifest["lightCode"]?.["addon"];
63922
64385
  if (label === void 0)
63923
64386
  return void 0;
63924
- const pkg = typeof manifest["name"] === "string" ? manifest["name"] : import_node_path31.default.basename(dir);
64387
+ const pkg = typeof manifest["name"] === "string" ? manifest["name"] : import_node_path32.default.basename(dir);
63925
64388
  const fail = (problem) => ({ dir, package: pkg, problem });
63926
64389
  if (label === null || typeof label !== "object" || Array.isArray(label)) {
63927
64390
  return fail('"lightCode.addon" in package.json must be an object, e.g. { "main": "server.js" }.');
@@ -63931,9 +64394,9 @@ async function readAddon(dir) {
63931
64394
  const mainField = typeof fields["main"] === "string" ? fields["main"] : typeof manifest["main"] === "string" ? manifest["main"] : void 0;
63932
64395
  if (mainField === void 0)
63933
64396
  return fail('No server script: set "lightCode.addon.main" to the MCP server file.');
63934
- const main = import_node_path31.default.resolve(dir, mainField);
63935
- const relative = import_node_path31.default.relative(dir, main);
63936
- if (relative.startsWith("..") || import_node_path31.default.isAbsolute(relative))
64397
+ const main = import_node_path32.default.resolve(dir, mainField);
64398
+ const relative = import_node_path32.default.relative(dir, main);
64399
+ if (relative.startsWith("..") || import_node_path32.default.isAbsolute(relative))
63937
64400
  return fail(`"${mainField}" is outside the package folder.`);
63938
64401
  try {
63939
64402
  if (!(await import_promises18.default.stat(main)).isFile())
@@ -63944,6 +64407,7 @@ async function readAddon(dir) {
63944
64407
  const args = Array.isArray(fields["args"]) ? fields["args"].filter((arg) => typeof arg === "string") : [];
63945
64408
  const displayName = typeof fields["displayName"] === "string" && fields["displayName"].trim().length > 0 ? fields["displayName"].trim() : pkg;
63946
64409
  const description = typeof fields["description"] === "string" ? fields["description"] : typeof manifest["description"] === "string" ? manifest["description"] : void 0;
64410
+ const extras = await readPageAndIcon(dir, fields);
63947
64411
  return {
63948
64412
  package: pkg,
63949
64413
  version: version2,
@@ -63952,9 +64416,64 @@ async function readAddon(dir) {
63952
64416
  dir,
63953
64417
  main,
63954
64418
  args,
63955
- server: addonServerName(pkg)
64419
+ server: addonServerName(pkg),
64420
+ ...extras
63956
64421
  };
63957
64422
  }
64423
+ var ICON_MAX_BYTES = 64 * 1024;
64424
+ async function readPageAndIcon(dir, fields) {
64425
+ const out = {};
64426
+ const inside = (relative) => {
64427
+ const full = import_node_path32.default.resolve(dir, relative);
64428
+ const rel = import_node_path32.default.relative(dir, full);
64429
+ return rel.startsWith("..") || import_node_path32.default.isAbsolute(rel) ? void 0 : full;
64430
+ };
64431
+ const problems = [];
64432
+ if (typeof fields["icon"] === "string") {
64433
+ const file2 = inside(fields["icon"]);
64434
+ try {
64435
+ if (file2 === void 0)
64436
+ throw new Error("is outside the package folder");
64437
+ const bytes = await import_promises18.default.readFile(file2);
64438
+ const text = bytes.toString("utf8");
64439
+ if (bytes.length > ICON_MAX_BYTES)
64440
+ throw new Error("is larger than 64 KB");
64441
+ if (!/^\s*(<\?xml[^>]*>\s*)?(<!--[\s\S]*?-->\s*)*<svg[\s>]/i.test(text))
64442
+ throw new Error("is not an SVG file");
64443
+ out.icon = `data:image/svg+xml;base64,${bytes.toString("base64")}`;
64444
+ } catch (error51) {
64445
+ problems.push(`icon ${String(fields["icon"])} ${error51 instanceof Error ? error51.message : String(error51)}`);
64446
+ }
64447
+ }
64448
+ let declared = fields["settings"];
64449
+ if (typeof declared === "string") {
64450
+ const file2 = inside(declared);
64451
+ try {
64452
+ if (file2 === void 0)
64453
+ throw new Error("is outside the package folder");
64454
+ declared = JSON.parse((await import_promises18.default.readFile(file2, "utf8")).replace(/^\uFEFF/, ""));
64455
+ } catch (error51) {
64456
+ problems.push(`settings ${String(fields["settings"])} ${error51 instanceof Error ? error51.message : String(error51)}`);
64457
+ declared = void 0;
64458
+ }
64459
+ }
64460
+ if (declared !== void 0) {
64461
+ const parsed = addonPageSchema.safeParse(declared);
64462
+ if (parsed.success) {
64463
+ const page = parsed.data;
64464
+ const keys = page.records?.fields.map((field2) => field2.key) ?? [];
64465
+ if (page.records !== void 0 && !keys.includes(page.records.keyField))
64466
+ problems.push(`settings: keyField "${page.records.keyField}" is not one of its fields`);
64467
+ else
64468
+ out.page = page;
64469
+ } else {
64470
+ problems.push(`settings: ${parsed.error.issues.map((issue2) => `${issue2.path.join(".")} ${issue2.message}`).join("; ")}`);
64471
+ }
64472
+ }
64473
+ if (problems.length > 0)
64474
+ out.pageProblem = problems.join(". ");
64475
+ return out;
64476
+ }
63958
64477
  async function discoverAddons(folders) {
63959
64478
  const addons = [];
63960
64479
  const problems = [];
@@ -63986,7 +64505,7 @@ async function discoverAddons(folders) {
63986
64505
  for (const entry of entries.sort()) {
63987
64506
  if (entry.startsWith("."))
63988
64507
  continue;
63989
- const full = import_node_path31.default.join(folder, entry);
64508
+ const full = import_node_path32.default.join(folder, entry);
63990
64509
  if (entry.startsWith("@")) {
63991
64510
  let scoped;
63992
64511
  try {
@@ -63995,7 +64514,7 @@ async function discoverAddons(folders) {
63995
64514
  continue;
63996
64515
  }
63997
64516
  for (const name of scoped.sort())
63998
- await consider(import_node_path31.default.join(full, name));
64517
+ await consider(import_node_path32.default.join(full, name));
63999
64518
  } else {
64000
64519
  await consider(full);
64001
64520
  }
@@ -64036,7 +64555,7 @@ function tagOf(entry) {
64036
64555
  const tag = entry?.addon;
64037
64556
  return typeof tag?.package === "string" && typeof tag.version === "string" ? { package: tag.package, version: tag.version } : void 0;
64038
64557
  }
64039
- function runnableServers(servers, addons, runtime, repositoryServers = []) {
64558
+ function runnableServers(servers, addons, runtime, repositoryServers = [], extraEnv = () => ({})) {
64040
64559
  const out = {};
64041
64560
  for (const [name, entry] of Object.entries(servers)) {
64042
64561
  const tag = tagOf(entry);
@@ -64049,27 +64568,81 @@ function runnableServers(servers, addons, runtime, repositoryServers = []) {
64049
64568
  out[name] = { ...entry, disabled: true };
64050
64569
  continue;
64051
64570
  }
64571
+ const env2 = { ...entry.env ?? {}, ...extraEnv(installed), ...runtime.electron ? { ELECTRON_RUN_AS_NODE: "1" } : {} };
64052
64572
  out[name] = {
64053
64573
  ...entry,
64054
64574
  command: runtime.execPath,
64055
64575
  args: [installed.main, ...installed.args],
64056
64576
  cwd: installed.dir,
64057
- ...runtime.electron ? { env: { ...entry.env ?? {}, ELECTRON_RUN_AS_NODE: "1" } } : {}
64577
+ ...Object.keys(env2).length > 0 ? { env: env2 } : {}
64058
64578
  };
64059
64579
  }
64060
64580
  return out;
64061
64581
  }
64062
64582
 
64583
+ // ../../packages/core/dist/addons/delivery.js
64584
+ var import_node_crypto11 = require("node:crypto");
64585
+ var import_node_path33 = __toESM(require("node:path"), 1);
64586
+ var SETTINGS_ENV = "LIGHT_CODE_ADDON_SETTINGS";
64587
+ var DATA_ENV = "LIGHT_CODE_ADDON_DATA";
64588
+ var DOWNLOADS_ENV = "LIGHT_CODE_ADDON_DOWNLOADS";
64589
+ function addonDataDir(storageDir, addon) {
64590
+ return import_node_path33.default.join(storageDir, "addons", addon.server);
64591
+ }
64592
+ function addonDownloadsDir(storageDir, addon) {
64593
+ return import_node_path33.default.join(addonDataDir(storageDir, addon), "downloads");
64594
+ }
64595
+ function secretEnvName(ref) {
64596
+ return `LC_SECRET_${(0, import_node_crypto11.createHash)("sha256").update(ref).digest("hex").slice(0, 16).toUpperCase()}`;
64597
+ }
64598
+ function deliveryFor(storageDir, addon, settings, stored) {
64599
+ const dir = addonDataDir(storageDir, addon);
64600
+ const file2 = import_node_path33.default.join(dir, "settings.json");
64601
+ const env2 = {
64602
+ [SETTINGS_ENV]: file2,
64603
+ [DATA_ENV]: dir,
64604
+ [DOWNLOADS_ENV]: addonDownloadsDir(storageDir, addon)
64605
+ };
64606
+ const secrets = {};
64607
+ const secretFields = (owner) => ((owner === "record" ? addon.page?.records?.fields : addon.page?.fields) ?? []).filter((field2) => field2.type === "secret").map((field2) => field2.key);
64608
+ const give = (recordId, field2) => {
64609
+ const ref = addonSecretRef(addon.package, recordId, field2);
64610
+ if (!stored.has(ref))
64611
+ return;
64612
+ const name = secretEnvName(ref);
64613
+ env2[name] = `\${secret:${ref}}`;
64614
+ (secrets[recordId ?? "_"] ??= {})[field2] = name;
64615
+ };
64616
+ for (const field2 of secretFields("page"))
64617
+ give(void 0, field2);
64618
+ for (const record2 of settings?.records ?? [])
64619
+ for (const field2 of secretFields("record"))
64620
+ give(record2.id, field2);
64621
+ return { file: file2, contents: { values: settings?.values ?? {}, records: settings?.records ?? [], secrets }, env: env2 };
64622
+ }
64623
+ function possibleSecretRefs(addon, settings) {
64624
+ const refs = [];
64625
+ for (const field2 of addon.page?.fields ?? [])
64626
+ if (field2.type === "secret")
64627
+ refs.push(addonSecretRef(addon.package, void 0, field2.key));
64628
+ for (const record2 of settings?.records ?? []) {
64629
+ for (const field2 of addon.page?.records?.fields ?? [])
64630
+ if (field2.type === "secret")
64631
+ refs.push(addonSecretRef(addon.package, record2.id, field2.key));
64632
+ }
64633
+ return refs;
64634
+ }
64635
+
64063
64636
  // ../../packages/core/dist/agent/codebaseInstructions.js
64064
- var import_node_crypto12 = require("node:crypto");
64637
+ var import_node_crypto13 = require("node:crypto");
64065
64638
  var import_promises19 = __toESM(require("node:fs/promises"), 1);
64066
- var import_node_path33 = __toESM(require("node:path"), 1);
64639
+ var import_node_path35 = __toESM(require("node:path"), 1);
64067
64640
 
64068
64641
  // ../../packages/core/dist/usage/events.js
64069
- var import_node_crypto11 = require("node:crypto");
64642
+ var import_node_crypto12 = require("node:crypto");
64070
64643
  var import_node_fs5 = require("node:fs");
64071
- var import_node_os4 = __toESM(require("node:os"), 1);
64072
- var import_node_path32 = __toESM(require("node:path"), 1);
64644
+ var import_node_os5 = __toESM(require("node:os"), 1);
64645
+ var import_node_path34 = __toESM(require("node:path"), 1);
64073
64646
  function isUsageEvent(value) {
64074
64647
  if (value === null || typeof value !== "object")
64075
64648
  return false;
@@ -64094,12 +64667,12 @@ function usageDay(t) {
64094
64667
  return new Date(t).toISOString().slice(0, 10);
64095
64668
  }
64096
64669
  function usageInstanceId(storageDir) {
64097
- return (0, import_node_crypto11.createHash)("sha256").update(`${import_node_os4.default.hostname()}
64098
- ${import_node_path32.default.resolve(storageDir).toLowerCase()}`).digest("hex").slice(0, 12);
64670
+ return (0, import_node_crypto12.createHash)("sha256").update(`${import_node_os5.default.hostname()}
64671
+ ${import_node_path34.default.resolve(storageDir).toLowerCase()}`).digest("hex").slice(0, 12);
64099
64672
  }
64100
64673
  async function writeFileAtomically(target, text) {
64101
- await import_node_fs5.promises.mkdir(import_node_path32.default.dirname(target), { recursive: true });
64102
- const temporary = `${target}.${(0, import_node_crypto11.randomBytes)(6).toString("hex")}.tmp`;
64674
+ await import_node_fs5.promises.mkdir(import_node_path34.default.dirname(target), { recursive: true });
64675
+ const temporary = `${target}.${(0, import_node_crypto12.randomBytes)(6).toString("hex")}.tmp`;
64103
64676
  await import_node_fs5.promises.writeFile(temporary, text, "utf8");
64104
64677
  try {
64105
64678
  await replaceFile(temporary, target);
@@ -64117,15 +64690,15 @@ var UsageLog = class {
64117
64690
  session;
64118
64691
  constructor(storageDir, session) {
64119
64692
  this.storageDir = storageDir;
64120
- this.queueDir = import_node_path32.default.join(storageDir, "usage", "queue");
64121
- this.manifestFile = import_node_path32.default.join(storageDir, "usage", "pushed.json");
64122
- this.rolledFile = import_node_path32.default.join(storageDir, "usage", "rolled.json");
64123
- this.legacyFile = import_node_path32.default.join(storageDir, "usage-events.jsonl");
64124
- this.session = session ?? (0, import_node_crypto11.randomBytes)(6).toString("hex");
64693
+ this.queueDir = import_node_path34.default.join(storageDir, "usage", "queue");
64694
+ this.manifestFile = import_node_path34.default.join(storageDir, "usage", "pushed.json");
64695
+ this.rolledFile = import_node_path34.default.join(storageDir, "usage", "rolled.json");
64696
+ this.legacyFile = import_node_path34.default.join(storageDir, "usage-events.jsonl");
64697
+ this.session = session ?? (0, import_node_crypto12.randomBytes)(6).toString("hex");
64125
64698
  }
64126
64699
  async append(event) {
64127
64700
  await import_node_fs5.promises.mkdir(this.queueDir, { recursive: true });
64128
- await import_node_fs5.promises.appendFile(import_node_path32.default.join(this.queueDir, `${usageDay(event.t)}__${this.session}.jsonl`), `${JSON.stringify(event)}
64701
+ await import_node_fs5.promises.appendFile(import_node_path34.default.join(this.queueDir, `${usageDay(event.t)}__${this.session}.jsonl`), `${JSON.stringify(event)}
64129
64702
  `, "utf8");
64130
64703
  }
64131
64704
  /**
@@ -64133,7 +64706,7 @@ var UsageLog = class {
64133
64706
  * never appended, so two sessions importing at once leave one copy rather than two.
64134
64707
  */
64135
64708
  async writeFixed(day, name, events) {
64136
- await writeFileAtomically(import_node_path32.default.join(this.queueDir, `${day}__${name}.jsonl`), events.map((event) => JSON.stringify(event)).join("\n") + (events.length > 0 ? "\n" : ""));
64709
+ await writeFileAtomically(import_node_path34.default.join(this.queueDir, `${day}__${name}.jsonl`), events.map((event) => JSON.stringify(event)).join("\n") + (events.length > 0 ? "\n" : ""));
64137
64710
  }
64138
64711
  /**
64139
64712
  * Moves a 0.156/0.157 single queue file into the per-day layout, once. Deterministic names, so two
@@ -64153,7 +64726,7 @@ var UsageLog = class {
64153
64726
  for (const [day, events] of byDay)
64154
64727
  await this.writeFixed(day, "legacy", events);
64155
64728
  await import_node_fs5.promises.rename(this.legacyFile, `${this.legacyFile}.migrated`).catch(() => void 0);
64156
- await import_node_fs5.promises.rm(import_node_path32.default.join(this.storageDir, "usage-sync.json"), { force: true }).catch(() => void 0);
64729
+ await import_node_fs5.promises.rm(import_node_path34.default.join(this.storageDir, "usage-sync.json"), { force: true }).catch(() => void 0);
64157
64730
  }
64158
64731
  /** Every day with local files, and its signature. */
64159
64732
  async days() {
@@ -64168,7 +64741,7 @@ var UsageLog = class {
64168
64741
  const match = QUEUE_FILE.exec(name);
64169
64742
  if (match === null)
64170
64743
  continue;
64171
- const size = await import_node_fs5.promises.stat(import_node_path32.default.join(this.queueDir, name)).then((stat) => stat.size).catch(() => void 0);
64744
+ const size = await import_node_fs5.promises.stat(import_node_path34.default.join(this.queueDir, name)).then((stat) => stat.size).catch(() => void 0);
64172
64745
  if (size === void 0)
64173
64746
  continue;
64174
64747
  const entry = days.get(match[1]) ?? { files: [], signature: "" };
@@ -64190,7 +64763,7 @@ var UsageLog = class {
64190
64763
  const entry = (await this.days()).get(day);
64191
64764
  if (entry === void 0)
64192
64765
  return [];
64193
- const texts = await Promise.all(entry.files.map((file2) => import_node_fs5.promises.readFile(import_node_path32.default.join(this.queueDir, file2.name), "utf8").catch(() => "")));
64766
+ const texts = await Promise.all(entry.files.map((file2) => import_node_fs5.promises.readFile(import_node_path34.default.join(this.queueDir, file2.name), "utf8").catch(() => "")));
64194
64767
  return texts.flatMap(parseUsageLines).sort((a, b) => a.t - b.t);
64195
64768
  }
64196
64769
  /** Every queued event (the last few weeks), for finding names worth looking up. */
@@ -64237,7 +64810,7 @@ var UsageLog = class {
64237
64810
  if (day >= cutoff || pushed[day] !== entry.signature)
64238
64811
  continue;
64239
64812
  for (const file2 of entry.files) {
64240
- await import_node_fs5.promises.rm(import_node_path32.default.join(this.queueDir, file2.name), { force: true }).catch(() => void 0);
64813
+ await import_node_fs5.promises.rm(import_node_path34.default.join(this.queueDir, file2.name), { force: true }).catch(() => void 0);
64241
64814
  removed++;
64242
64815
  }
64243
64816
  }
@@ -64250,14 +64823,14 @@ var CODEBASE_INSTRUCTIONS_FILE = "codebase-instructions.md";
64250
64823
  var CODEBASE_INSTRUCTIONS_LIMIT = 2e4;
64251
64824
  function codebaseInstructionsPath(options) {
64252
64825
  if (options.codebaseDir !== void 0)
64253
- return import_node_path33.default.join(options.codebaseDir, "instructions", CODEBASE_INSTRUCTIONS_FILE);
64826
+ return import_node_path35.default.join(options.codebaseDir, "instructions", CODEBASE_INSTRUCTIONS_FILE);
64254
64827
  if (options.workspaceRoot === void 0)
64255
64828
  return void 0;
64256
- const resolved = import_node_path33.default.resolve(options.workspaceRoot);
64829
+ const resolved = import_node_path35.default.resolve(options.workspaceRoot);
64257
64830
  const key2 = process.platform === "win32" ? resolved.toLowerCase() : resolved;
64258
- const digest = (0, import_node_crypto12.createHash)("sha256").update(key2).digest("hex").slice(0, 12);
64259
- const slug = import_node_path33.default.basename(resolved).toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "workspace";
64260
- return import_node_path33.default.join(options.storageDir, "codebases", `${slug}-${digest}`, CODEBASE_INSTRUCTIONS_FILE);
64831
+ const digest = (0, import_node_crypto13.createHash)("sha256").update(key2).digest("hex").slice(0, 12);
64832
+ const slug = import_node_path35.default.basename(resolved).toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "workspace";
64833
+ return import_node_path35.default.join(options.storageDir, "codebases", `${slug}-${digest}`, CODEBASE_INSTRUCTIONS_FILE);
64261
64834
  }
64262
64835
  async function readCodebaseInstructions(file2) {
64263
64836
  if (file2 === void 0)
@@ -64357,7 +64930,7 @@ async function readToolCredential(options) {
64357
64930
 
64358
64931
  // ../../packages/core/dist/jupyter/tools.js
64359
64932
  var import_promises21 = __toESM(require("node:fs/promises"), 1);
64360
- var import_node_path34 = __toESM(require("node:path"), 1);
64933
+ var import_node_path36 = __toESM(require("node:path"), 1);
64361
64934
  var RUN_DEFAULT_SECONDS = 300;
64362
64935
  var SCRIPT_PREVIEW_CHARS = 6e3;
64363
64936
  var runSchema = external_exports.object({
@@ -64467,6 +65040,8 @@ function describePull(result) {
64467
65040
  lines.push(`Changed both here and on the hub - kept as they are here, NOT replaced: ${result.conflicts.join(", ")}. Compare with hub_sync "hub_version".`);
64468
65041
  if (result.skipped.length > 0)
64469
65042
  lines.push(`Too large to copy: ${result.skipped.join(", ")}`);
65043
+ if (result.ignored.length > 0)
65044
+ lines.push(`Now listed in .hubignore, so no longer synced (left as they are here and on the hub): ${result.ignored.slice(0, 20).join(", ")}${result.ignored.length > 20 ? ", \u2026" : ""}`);
64470
65045
  for (const failure of result.failed)
64471
65046
  lines.push(`Could not fetch ${failure.path}: ${failure.problem}`);
64472
65047
  if (lines.length === 0)
@@ -64543,7 +65118,7 @@ function createHubTools(runtime) {
64543
65118
  const syncTool = {
64544
65119
  name: "hub_sync",
64545
65120
  group: "edit",
64546
- description: `Keep the workspace and the JupyterHub folders in step. Edits are saved to the hub automatically and changes there are fetched every few minutes; use this to fetch now ("pull"), save local changes made another way, such as by a shell command ("push", optionally one path), list what is not saved ("status"), read the hub's copy of a file after a refused save ("hub_version"), or replace the local file with the hub's copy ("use_hub_version" - discards the local edit; ask the user first). Never overwrites anything changed on the other side.`,
65121
+ description: `Keep the workspace and the JupyterHub folders in step. Edits are saved to the hub automatically and changes there are fetched every few minutes; use this to fetch now ("pull"), save local changes made another way, such as by a shell command ("push", optionally one path), list what is not saved ("status"), read the hub's copy of a file after a refused save ("hub_version"), or replace the local file with the hub's copy ("use_hub_version" - discards the local edit; ask the user first). Never overwrites anything changed on the other side. Files and folders listed in a .hubignore file (gitignore syntax, in any synced folder) are never synced either way.`,
64547
65122
  parametersSchema: syncSchema,
64548
65123
  async preview(params3, context) {
64549
65124
  if (params3.action === "push") {
@@ -64578,8 +65153,8 @@ ${pending.map((p) => `- ${p.local} (${p.kind}${p.kind === "deleted" ? " here; st
64578
65153
  let failed2 = false;
64579
65154
  for (const file2 of pending.files) {
64580
65155
  const result = await runtime.mirror.push(file2, context.signal);
64581
- failed2 ||= !result.saved;
64582
- lines.push(`- ${import_node_path34.default.relative(runtime.mirror.root, file2).split(import_node_path34.default.sep).join("/")}: ${result.message}`);
65156
+ failed2 ||= !result.saved && result.ignored !== true;
65157
+ lines.push(`- ${import_node_path36.default.relative(runtime.mirror.root, file2).split(import_node_path36.default.sep).join("/")}: ${result.message}`);
64583
65158
  }
64584
65159
  return { content: lines.length > 0 ? lines.join("\n") : "Nothing to save.", ...failed2 ? { isError: true } : {} };
64585
65160
  }
@@ -64618,7 +65193,7 @@ async function pendingFor(runtime, context, target) {
64618
65193
  const pending = (await runtime.mirror.pending()).filter((p) => p.kind !== "deleted");
64619
65194
  return {
64620
65195
  ok: true,
64621
- files: pending.map((p) => import_node_path34.default.join(runtime.mirror.root, ...p.local.split("/"))),
65196
+ files: pending.map((p) => import_node_path36.default.join(runtime.mirror.root, ...p.local.split("/"))),
64622
65197
  changes: pending.map((p) => `${p.local} \u2192 ${p.remote} (${p.kind})`)
64623
65198
  };
64624
65199
  }
@@ -64668,7 +65243,7 @@ if __SOURCE__:
64668
65243
  `;
64669
65244
 
64670
65245
  // ../../packages/core/dist/jupyter/hubGit.js
64671
- var import_node_path35 = __toESM(require("node:path"), 1);
65246
+ var import_node_path37 = __toESM(require("node:path"), 1);
64672
65247
  var MARKER = "__LC_HUBGIT__";
64673
65248
  var LISTED = 40;
64674
65249
  var py2 = (value) => JSON.stringify(value);
@@ -64783,7 +65358,7 @@ async function hubGitStatus(runtime, signal) {
64783
65358
  total.upstream &&= one.upstream;
64784
65359
  if (total.branch === void 0 && one.branch !== void 0)
64785
65360
  total.branch = one.branch;
64786
- const prefix = results.length > 1 ? `${import_node_path35.default.posix.basename(repo.repo)}/` : "";
65361
+ const prefix = results.length > 1 ? `${import_node_path37.default.posix.basename(repo.repo)}/` : "";
64787
65362
  for (const file2 of one.files)
64788
65363
  if (total.files.length < LISTED)
64789
65364
  total.files.push(`${file2.slice(0, 2)}${prefix}${file2.slice(2)}`);
@@ -64796,7 +65371,7 @@ async function hubGitCommitPush(runtime, message4, signal) {
64796
65371
  return { ok: false, text: "Write a commit message first." };
64797
65372
  const pending = await runtime.mirror.pending();
64798
65373
  for (const change of pending.filter((p) => p.kind !== "deleted")) {
64799
- const saved = await runtime.mirror.push(import_node_path35.default.join(runtime.mirror.root, ...change.local.split("/")), signal);
65374
+ const saved = await runtime.mirror.push(import_node_path37.default.join(runtime.mirror.root, ...change.local.split("/")), signal);
64800
65375
  if (!saved.saved)
64801
65376
  return { ok: false, text: `Nothing was committed: ${change.local} could not be saved to the hub first (${saved.message}).` };
64802
65377
  }
@@ -64809,7 +65384,7 @@ async function hubGitCommitPush(runtime, message4, signal) {
64809
65384
  const lines = [];
64810
65385
  let ok = true;
64811
65386
  for (const repo of results) {
64812
- const name = results.length > 1 ? `${import_node_path35.default.posix.basename(repo.repo)}: ` : "";
65387
+ const name = results.length > 1 ? `${import_node_path37.default.posix.basename(repo.repo)}: ` : "";
64813
65388
  const committed = repo.commit?.ok === true;
64814
65389
  const nothing = /nothing to commit/.test(`${repo.commit?.out ?? ""}${repo.commit?.err ?? ""}`);
64815
65390
  if (repo.add?.ok !== true) {
@@ -64839,7 +65414,7 @@ async function hubGitPull(runtime, signal) {
64839
65414
  const lines = [];
64840
65415
  let ok = true;
64841
65416
  for (const repo of results) {
64842
- const name = results.length > 1 ? `${import_node_path35.default.posix.basename(repo.repo)}: ` : "";
65417
+ const name = results.length > 1 ? `${import_node_path37.default.posix.basename(repo.repo)}: ` : "";
64843
65418
  const all = `${repo.pull?.out ?? ""}${repo.pull?.err ?? ""}`;
64844
65419
  if (repo.pull?.ok === true)
64845
65420
  lines.push(`${name}${/Already up.to.date/i.test(all) ? "Already up to date." : "Pulled on the hub."}`);
@@ -65021,7 +65596,7 @@ function pick2(hubs, name) {
65021
65596
 
65022
65597
  // ../../packages/core/dist/host/bridge.js
65023
65598
  var import_node_os6 = __toESM(require("node:os"), 1);
65024
- var import_node_path49 = __toESM(require("node:path"), 1);
65599
+ var import_node_path50 = __toESM(require("node:path"), 1);
65025
65600
 
65026
65601
  // ../../packages/core/dist/modes/autoGuidance.js
65027
65602
  function idiomsFor(environment) {
@@ -65117,7 +65692,7 @@ function buildAutoGuidance(environment) {
65117
65692
 
65118
65693
  // ../../packages/core/dist/migrate/folders.js
65119
65694
  var import_promises22 = __toESM(require("node:fs/promises"), 1);
65120
- var import_node_path36 = __toESM(require("node:path"), 1);
65695
+ var import_node_path38 = __toESM(require("node:path"), 1);
65121
65696
  function nameOf(entry, kind) {
65122
65697
  return kind === "skills" ? entry.replace(/\.md$/i, "") : entry.replace(/\.py$/i, "");
65123
65698
  }
@@ -65142,7 +65717,7 @@ async function namesAt(dir, kind) {
65142
65717
  if (kind === "skills") {
65143
65718
  if (entry.toLowerCase().endsWith(".md"))
65144
65719
  found2.add(nameOf(entry, kind));
65145
- else if (await isDirectory(import_node_path36.default.join(dir, entry)))
65720
+ else if (await isDirectory(import_node_path38.default.join(dir, entry)))
65146
65721
  found2.add(entry);
65147
65722
  } else if (entry.toLowerCase().endsWith(".py")) {
65148
65723
  found2.add(nameOf(entry, kind));
@@ -65154,7 +65729,7 @@ async function planMigration(options) {
65154
65729
  const { from, to, kind } = options;
65155
65730
  const copy = [];
65156
65731
  const skip = [];
65157
- if (import_node_path36.default.resolve(from) === import_node_path36.default.resolve(to))
65732
+ if (import_node_path38.default.resolve(from) === import_node_path38.default.resolve(to))
65158
65733
  return { copy, skip };
65159
65734
  const existing = await namesAt(to, kind);
65160
65735
  let entries;
@@ -65166,14 +65741,14 @@ async function planMigration(options) {
65166
65741
  for (const entry of entries) {
65167
65742
  if (entry.startsWith("."))
65168
65743
  continue;
65169
- const source = import_node_path36.default.join(from, entry);
65744
+ const source = import_node_path38.default.join(from, entry);
65170
65745
  const directory = await isDirectory(source);
65171
65746
  if (kind === "skills") {
65172
65747
  if (!directory && !entry.toLowerCase().endsWith(".md"))
65173
65748
  continue;
65174
65749
  if (directory) {
65175
65750
  try {
65176
- await import_promises22.default.stat(import_node_path36.default.join(source, "SKILL.md"));
65751
+ await import_promises22.default.stat(import_node_path38.default.join(source, "SKILL.md"));
65177
65752
  } catch {
65178
65753
  continue;
65179
65754
  }
@@ -65186,7 +65761,7 @@ async function planMigration(options) {
65186
65761
  skip.push(name);
65187
65762
  continue;
65188
65763
  }
65189
- copy.push({ name, source, destination: import_node_path36.default.join(to, entry), directory });
65764
+ copy.push({ name, source, destination: import_node_path38.default.join(to, entry), directory });
65190
65765
  }
65191
65766
  copy.sort((a, b) => a.name.localeCompare(b.name));
65192
65767
  skip.sort();
@@ -65197,7 +65772,7 @@ async function runMigration(plan2) {
65197
65772
  const failed2 = [];
65198
65773
  for (const item of plan2.copy) {
65199
65774
  try {
65200
- await import_promises22.default.mkdir(import_node_path36.default.dirname(item.destination), { recursive: true });
65775
+ await import_promises22.default.mkdir(import_node_path38.default.dirname(item.destination), { recursive: true });
65201
65776
  await import_promises22.default.cp(item.source, item.destination, {
65202
65777
  recursive: item.directory,
65203
65778
  force: false,
@@ -65224,7 +65799,7 @@ function describeMigration(result, kind) {
65224
65799
 
65225
65800
  // ../../packages/core/dist/platform/node/shell.js
65226
65801
  var import_node_fs6 = __toESM(require("node:fs"), 1);
65227
- var import_node_path37 = __toESM(require("node:path"), 1);
65802
+ var import_node_path39 = __toESM(require("node:path"), 1);
65228
65803
  function windowsExtensions(env2) {
65229
65804
  const raw = env2["PATHEXT"] ?? ".COM;.EXE;.BAT;.CMD";
65230
65805
  return raw.split(";").filter((entry) => entry.length > 0);
@@ -65238,7 +65813,7 @@ function onPath(name, env2 = process.env) {
65238
65813
  continue;
65239
65814
  for (const extension of extensions) {
65240
65815
  try {
65241
- const candidate = import_node_path37.default.join(directory, name + extension);
65816
+ const candidate = import_node_path39.default.join(directory, name + extension);
65242
65817
  if (import_node_fs6.default.statSync(candidate).isFile())
65243
65818
  return true;
65244
65819
  } catch {
@@ -65260,7 +65835,7 @@ function resolveShell(configured, env2 = process.env) {
65260
65835
  return { command: void 0, kind: "posix", label: env2["SHELL"] ?? "/bin/sh" };
65261
65836
  }
65262
65837
  function kindOf(command) {
65263
- const base = import_node_path37.default.basename(command).toLowerCase().replace(/\.exe$/, "");
65838
+ const base = import_node_path39.default.basename(command).toLowerCase().replace(/\.exe$/, "");
65264
65839
  if (base === "pwsh")
65265
65840
  return "pwsh";
65266
65841
  if (base === "powershell")
@@ -65270,7 +65845,7 @@ function kindOf(command) {
65270
65845
  return "posix";
65271
65846
  }
65272
65847
  function labelFor(command) {
65273
- const base = import_node_path37.default.basename(command).toLowerCase().replace(/\.exe$/, "");
65848
+ const base = import_node_path39.default.basename(command).toLowerCase().replace(/\.exe$/, "");
65274
65849
  if (base === "pwsh")
65275
65850
  return "PowerShell 7 (pwsh)";
65276
65851
  if (base === "powershell")
@@ -65352,7 +65927,7 @@ function fastFsCapabilities(exe, timeoutMs = 5e3) {
65352
65927
  var import_node_child_process9 = require("node:child_process");
65353
65928
 
65354
65929
  // ../../packages/core/dist/tools/readStamps.js
65355
- var import_node_path38 = __toESM(require("node:path"), 1);
65930
+ var import_node_path40 = __toESM(require("node:path"), 1);
65356
65931
  async function stamp(context, realPath) {
65357
65932
  try {
65358
65933
  const s = await context.fs.stat(realPath);
@@ -65397,14 +65972,14 @@ async function staleFilesNamedIn(context, command) {
65397
65972
  };
65398
65973
  const stale = [];
65399
65974
  for (const [key2, known] of context.readStamps) {
65400
- const relative = import_node_path38.default.relative(root, key2);
65401
- const names = [key2, relative, relative.split(import_node_path38.default.sep).join("/"), import_node_path38.default.basename(key2)].map((n) => n.toLowerCase());
65975
+ const relative = import_node_path40.default.relative(root, key2);
65976
+ const names = [key2, relative, relative.split(import_node_path40.default.sep).join("/"), import_node_path40.default.basename(key2)].map((n) => n.toLowerCase());
65402
65977
  if (!names.some(stands))
65403
65978
  continue;
65404
65979
  try {
65405
65980
  const s = await context.fs.stat(key2);
65406
65981
  if (`${String(s.mtimeMs)}:${String(s.size)}` !== known)
65407
- stale.push(relative.split(import_node_path38.default.sep).join("/"));
65982
+ stale.push(relative.split(import_node_path40.default.sep).join("/"));
65408
65983
  } catch {
65409
65984
  }
65410
65985
  }
@@ -66885,8 +67460,8 @@ var ChangeLedger = class {
66885
67460
  this.chat = chat;
66886
67461
  }
66887
67462
  /** Best effort: a ledger that cannot be written must never fail an edit that happened. */
66888
- record(path60) {
66889
- const line = JSON.stringify({ chat: this.chat, path: normalizeForComparison(path60), at: Date.now() });
67463
+ record(path61) {
67464
+ const line = JSON.stringify({ chat: this.chat, path: normalizeForComparison(path61), at: Date.now() });
66890
67465
  void (0, import_promises23.appendFile)(this.file, `${line}
66891
67466
  `).catch(() => void 0);
66892
67467
  }
@@ -66934,7 +67509,7 @@ var RecordedChanges = class extends Set {
66934
67509
  // ../../packages/core/dist/office/bridge.js
66935
67510
  var import_node_child_process11 = require("node:child_process");
66936
67511
  var import_promises24 = __toESM(require("node:fs/promises"), 1);
66937
- var import_node_path39 = __toESM(require("node:path"), 1);
67512
+ var import_node_path41 = __toESM(require("node:path"), 1);
66938
67513
 
66939
67514
  // ../../packages/core/dist/office/workerSource.js
66940
67515
  var OFFICE_WORKER_SOURCE = `# Light Code office worker.
@@ -69668,7 +70243,7 @@ var OfficeBridge = class {
69668
70243
  return this.starting;
69669
70244
  }
69670
70245
  async start() {
69671
- const target = import_node_path39.default.join(this.options.storageDir, "office-worker.ps1");
70246
+ const target = import_node_path41.default.join(this.options.storageDir, "office-worker.ps1");
69672
70247
  await import_promises24.default.mkdir(this.options.storageDir, { recursive: true });
69673
70248
  const BOM = "\uFEFF";
69674
70249
  await import_promises24.default.writeFile(target, `${BOM}${OFFICE_WORKER_SOURCE}`, "utf8");
@@ -70174,8 +70749,8 @@ function createDeleteRoleTool(access) {
70174
70749
  }
70175
70750
 
70176
70751
  // ../../packages/core/dist/rag/indexNaming.js
70177
- var import_node_crypto13 = __toESM(require("node:crypto"), 1);
70178
- var import_node_path40 = __toESM(require("node:path"), 1);
70752
+ var import_node_crypto14 = __toESM(require("node:crypto"), 1);
70753
+ var import_node_path42 = __toESM(require("node:path"), 1);
70179
70754
  var DEFAULT_INDEX_PREFIX = "light-code";
70180
70755
  var DOMAIN_OR_PATH = /[\\/]/;
70181
70756
  function normaliseOwner(owner) {
@@ -70190,15 +70765,15 @@ function ownerSlug(owner) {
70190
70765
  function deriveIndexName(input) {
70191
70766
  const prefix = input.prefix ?? DEFAULT_INDEX_PREFIX;
70192
70767
  const slug = ownerSlug(input.owner);
70193
- const root = import_node_path40.default.resolve(input.workspaceRoot).toLowerCase();
70768
+ const root = import_node_path42.default.resolve(input.workspaceRoot).toLowerCase();
70194
70769
  const identity = input.owner === void 0 ? "" : normaliseOwner(input.owner);
70195
- const digest = import_node_crypto13.default.createHash("sha256").update(`${identity}\0${root}`).digest("hex").slice(0, 16);
70770
+ const digest = import_node_crypto14.default.createHash("sha256").update(`${identity}\0${root}`).digest("hex").slice(0, 16);
70196
70771
  const base = slug === void 0 ? `${prefix}-${digest}` : `${prefix}-${slug}-${digest}`;
70197
70772
  return input.project === void 0 ? base : `${input.project}-${base}`;
70198
70773
  }
70199
70774
 
70200
70775
  // ../../packages/core/dist/tools/exportConfig.js
70201
- var import_node_path41 = __toESM(require("node:path"), 1);
70776
+ var import_node_path43 = __toESM(require("node:path"), 1);
70202
70777
  var sectionIds = SHARE_SECTIONS.map((section) => section.id);
70203
70778
  var paramsSchema11 = external_exports.object({
70204
70779
  path: external_exports.string().min(1).describe('Where to write it in the workspace, e.g. "onboarding/light-code-team.json".'),
@@ -70238,7 +70813,7 @@ function createExportConfigTool(options) {
70238
70813
  if (!resolved.ok)
70239
70814
  return { content: resolved.message, isError: true };
70240
70815
  const { json: json2, notes } = prepare(await options.loadConfig(), params3);
70241
- await context.fs.mkdir(import_node_path41.default.dirname(resolved.realPath));
70816
+ await context.fs.mkdir(import_node_path43.default.dirname(resolved.realPath));
70242
70817
  await context.fs.writeFile(resolved.realPath, json2);
70243
70818
  return { content: `Wrote ${params3.path}. ${notes}`, path: resolved.realPath };
70244
70819
  }
@@ -70407,7 +70982,7 @@ function describeAtlassianFailure(product, doing, status2, body) {
70407
70982
  }
70408
70983
 
70409
70984
  // ../../packages/core/dist/atlassian/uploads.js
70410
- var import_node_path42 = __toESM(require("node:path"), 1);
70985
+ var import_node_path44 = __toESM(require("node:path"), 1);
70411
70986
 
70412
70987
  // ../../packages/core/dist/diagrams/layout.js
70413
70988
  var NODE_HEIGHT = 52;
@@ -71049,7 +71624,7 @@ async function prepareUploads(params3, context) {
71049
71624
  const resolved = await resolveToolPath(context, attachment.path);
71050
71625
  if (!resolved.ok)
71051
71626
  return { ok: false, message: resolved.message };
71052
- const name = attachment.name ?? import_node_path42.default.basename(resolved.realPath);
71627
+ const name = attachment.name ?? import_node_path44.default.basename(resolved.realPath);
71053
71628
  const problem = claim(name);
71054
71629
  if (problem !== void 0)
71055
71630
  return { ok: false, message: problem };
@@ -71233,10 +71808,10 @@ function isSafeSegment(value) {
71233
71808
  function isSafeTagName(name) {
71234
71809
  return /^[A-Za-z0-9._/-]+$/.test(name) && !name.startsWith("-") && !name.startsWith("/") && !name.endsWith("/") && !name.endsWith(".") && !name.endsWith(".lock") && !name.includes("..") && !name.includes("//") && !name.split("/").some((part) => part.startsWith("."));
71235
71810
  }
71236
- function encodeRepoPath(path60) {
71237
- const segments = path60.replace(/\\/g, "/").split("/").filter((segment) => segment.length > 0);
71811
+ function encodeRepoPath(path61) {
71812
+ const segments = path61.replace(/\\/g, "/").split("/").filter((segment) => segment.length > 0);
71238
71813
  if (segments.length === 0 || segments.some((segment) => segment === ".." || segment === ".")) {
71239
- throw new AtlassianError(`"${path60}" is not a file path inside the repository.`);
71814
+ throw new AtlassianError(`"${path61}" is not a file path inside the repository.`);
71240
71815
  }
71241
71816
  return segments.map(encodeURIComponent).join("/");
71242
71817
  }
@@ -71321,24 +71896,24 @@ var BitbucketClient = class {
71321
71896
  * redirect was followed, the login page came back, and the file "could not be read" although
71322
71897
  * pull requests on the same repository could. `browse` is REST, so it authenticates like those.
71323
71898
  */
71324
- async file(repo, path60, ref, signal) {
71325
- const target = encodeRepoPath(path60);
71899
+ async file(repo, path61, ref, signal) {
71900
+ const target = encodeRepoPath(path61);
71326
71901
  const lines = [];
71327
71902
  let start = 0;
71328
71903
  for (let page = 0; page < MAX_FILE_PAGES; page += 1) {
71329
71904
  const query = new URLSearchParams({ start: String(start), limit: String(FILE_PAGE_LINES) });
71330
71905
  if (ref !== void 0 && ref.length > 0)
71331
71906
  query.set("at", ref);
71332
- const body = await this.rest.json(`reading ${path60}`, `${this.repoPath(repo)}/browse/${target}?${query.toString()}`, { method: "GET" }, signal);
71907
+ const body = await this.rest.json(`reading ${path61}`, `${this.repoPath(repo)}/browse/${target}?${query.toString()}`, { method: "GET" }, signal);
71333
71908
  if (body.children !== void 0) {
71334
71909
  const names = (body.children.values ?? []).map((child) => {
71335
71910
  const name = child.path?.toString ?? child.path?.name ?? "?";
71336
71911
  return child.type === "DIRECTORY" ? `${name}/` : name;
71337
71912
  });
71338
- throw new AtlassianError(`${path60} is a folder, not a file. It holds: ${names.join(", ") || "nothing"}.`);
71913
+ throw new AtlassianError(`${path61} is a folder, not a file. It holds: ${names.join(", ") || "nothing"}.`);
71339
71914
  }
71340
71915
  if (body.binary === true)
71341
- throw new AtlassianError(`${path60} is a binary file, so there is no text to read.`);
71916
+ throw new AtlassianError(`${path61} is a binary file, so there is no text to read.`);
71342
71917
  for (const line of body.lines ?? [])
71343
71918
  lines.push(line.text ?? "");
71344
71919
  if (body.isLastPage !== false || body.nextPageStart === void 0 || body.nextPageStart <= start)
@@ -71916,8 +72491,8 @@ ${text.slice(-2e4)}`);
71916
72491
  }
71917
72492
  /** Queues a build, then follows the queue item briefly to learn its number. */
71918
72493
  async startBuild(job, parameters, signal) {
71919
- const path60 = jobPath(job, this.base);
71920
- const response = await this.post(`starting ${job}`, parameters !== void 0 && Object.keys(parameters).length > 0 ? `${path60}/buildWithParameters` : `${path60}/build`, parameters ?? {}, signal);
72494
+ const path61 = jobPath(job, this.base);
72495
+ const response = await this.post(`starting ${job}`, parameters !== void 0 && Object.keys(parameters).length > 0 ? `${path61}/buildWithParameters` : `${path61}/build`, parameters ?? {}, signal);
71921
72496
  const location = response.headers["location"];
71922
72497
  const queueId = location === void 0 ? void 0 : /\/queue\/item\/(\d+)/.exec(location)?.[1];
71923
72498
  if (queueId === void 0)
@@ -72243,14 +72818,14 @@ ${client.base}${jobPath(job, client.base)}/${buildRef(params3.build)}/`
72243
72818
  };
72244
72819
  return tool;
72245
72820
  }
72246
- async function readJenkinsfile(path60, context) {
72247
- const resolved = await resolveToolPath(context, path60);
72821
+ async function readJenkinsfile(path61, context) {
72822
+ const resolved = await resolveToolPath(context, path61);
72248
72823
  if (!resolved.ok)
72249
72824
  return { ok: false, message: resolved.message };
72250
72825
  try {
72251
72826
  return { ok: true, text: await context.fs.readFile(resolved.realPath), realPath: resolved.realPath };
72252
72827
  } catch (error51) {
72253
- return { ok: false, message: `Could not read ${path60}: ${error51 instanceof Error ? error51.message : String(error51)}` };
72828
+ return { ok: false, message: `Could not read ${path61}: ${error51 instanceof Error ? error51.message : String(error51)}` };
72254
72829
  }
72255
72830
  }
72256
72831
  var checkSchema = external_exports.object({
@@ -72519,8 +73094,8 @@ var AutosysClient = class {
72519
73094
  async runInfo(pattern, signal) {
72520
73095
  if (!isAutosysName(pattern, true))
72521
73096
  throw new AtlassianError(`"${pattern}" is not a job name or pattern.`);
72522
- const path60 = pattern.includes("*") ? fill(this.paths.runInfo, { pattern }) : fill(this.paths.jobRunInfo, { job: pattern });
72523
- return asList(await this.rest.json(`reading the status of ${pattern}`, path60, { method: "GET" }, signal)).map(toRun);
73097
+ const path61 = pattern.includes("*") ? fill(this.paths.runInfo, { pattern }) : fill(this.paths.jobRunInfo, { job: pattern });
73098
+ return asList(await this.rest.json(`reading the status of ${pattern}`, path61, { method: "GET" }, signal)).map(toRun);
72524
73099
  }
72525
73100
  /** A job's log, or undefined when this server has no log endpoint (404). */
72526
73101
  async log(name, runNum, type, signal) {
@@ -74521,7 +75096,7 @@ function message2(error51) {
74521
75096
  }
74522
75097
  function filesIn(params3) {
74523
75098
  return [
74524
- ...(params3.attachments ?? []).map((path60) => ({ path: path60, inline: false })),
75099
+ ...(params3.attachments ?? []).map((path61) => ({ path: path61, inline: false })),
74525
75100
  ...(params3.inlineImages ?? []).map((image) => ({ path: image.path, inline: true }))
74526
75101
  ];
74527
75102
  }
@@ -75204,17 +75779,17 @@ var WebviewApprovalGate = class {
75204
75779
  // ../../packages/core/dist/platform/node/filesystem.js
75205
75780
  var import_promises25 = __toESM(require("node:fs/promises"), 1);
75206
75781
  var NodeFileSystem = class {
75207
- async readFile(path60) {
75208
- return import_promises25.default.readFile(path60, "utf8");
75782
+ async readFile(path61) {
75783
+ return import_promises25.default.readFile(path61, "utf8");
75209
75784
  }
75210
- async readBytes(path60) {
75211
- return import_promises25.default.readFile(path60);
75785
+ async readBytes(path61) {
75786
+ return import_promises25.default.readFile(path61);
75212
75787
  }
75213
- async readBytesSlice(path60, start, end) {
75788
+ async readBytesSlice(path61, start, end) {
75214
75789
  const length = Math.max(0, end - start);
75215
75790
  if (length === 0)
75216
75791
  return Buffer.alloc(0);
75217
- const handle = await import_promises25.default.open(path60, "r");
75792
+ const handle = await import_promises25.default.open(path61, "r");
75218
75793
  try {
75219
75794
  const buffer = Buffer.alloc(length);
75220
75795
  const { bytesRead } = await handle.read(buffer, 0, length, start);
@@ -75223,18 +75798,18 @@ var NodeFileSystem = class {
75223
75798
  await handle.close();
75224
75799
  }
75225
75800
  }
75226
- async writeFile(path60, contents) {
75227
- await import_promises25.default.writeFile(path60, contents, "utf8");
75801
+ async writeFile(path61, contents) {
75802
+ await import_promises25.default.writeFile(path61, contents, "utf8");
75228
75803
  }
75229
75804
  /** The counterpart of `readBytes`, and deliberately as bare as `writeFile` beside it. */
75230
- async writeBytes(path60, contents) {
75231
- await import_promises25.default.writeFile(path60, contents);
75805
+ async writeBytes(path61, contents) {
75806
+ await import_promises25.default.writeFile(path61, contents);
75232
75807
  }
75233
75808
  async rename(from, to) {
75234
75809
  await replaceFile(from, to);
75235
75810
  }
75236
- async stat(path60) {
75237
- const stat = await import_promises25.default.lstat(path60);
75811
+ async stat(path61) {
75812
+ const stat = await import_promises25.default.lstat(path61);
75238
75813
  return {
75239
75814
  size: stat.size,
75240
75815
  mtimeMs: stat.mtimeMs,
@@ -75243,8 +75818,8 @@ var NodeFileSystem = class {
75243
75818
  isSymbolicLink: stat.isSymbolicLink()
75244
75819
  };
75245
75820
  }
75246
- async readdir(path60) {
75247
- const entries = await import_promises25.default.readdir(path60, { withFileTypes: true });
75821
+ async readdir(path61) {
75822
+ const entries = await import_promises25.default.readdir(path61, { withFileTypes: true });
75248
75823
  return entries.map((entry) => ({
75249
75824
  name: entry.name,
75250
75825
  isFile: entry.isFile(),
@@ -75252,21 +75827,21 @@ var NodeFileSystem = class {
75252
75827
  isSymbolicLink: entry.isSymbolicLink()
75253
75828
  }));
75254
75829
  }
75255
- async exists(path60) {
75830
+ async exists(path61) {
75256
75831
  try {
75257
- await import_promises25.default.access(path60);
75832
+ await import_promises25.default.access(path61);
75258
75833
  return true;
75259
75834
  } catch {
75260
75835
  return false;
75261
75836
  }
75262
75837
  }
75263
- async mkdir(path60) {
75264
- await import_promises25.default.mkdir(path60, { recursive: true });
75838
+ async mkdir(path61) {
75839
+ await import_promises25.default.mkdir(path61, { recursive: true });
75265
75840
  }
75266
75841
  };
75267
75842
 
75268
75843
  // ../../packages/core/dist/config/project.js
75269
- var import_node_path43 = __toESM(require("node:path"), 1);
75844
+ var import_node_path45 = __toESM(require("node:path"), 1);
75270
75845
  function configuredProjectName(config2) {
75271
75846
  const name = config2?.project?.name?.trim();
75272
75847
  return name !== void 0 && name.length > 0 ? name : void 0;
@@ -75275,7 +75850,7 @@ function projectName(config2, workspaceRoot) {
75275
75850
  const configured = configuredProjectName(config2);
75276
75851
  if (configured !== void 0)
75277
75852
  return configured;
75278
- return workspaceRoot === void 0 ? void 0 : import_node_path43.default.basename(import_node_path43.default.resolve(workspaceRoot));
75853
+ return workspaceRoot === void 0 ? void 0 : import_node_path45.default.basename(import_node_path45.default.resolve(workspaceRoot));
75279
75854
  }
75280
75855
  function projectSlug(name) {
75281
75856
  if (name === void 0)
@@ -75285,7 +75860,7 @@ function projectSlug(name) {
75285
75860
  }
75286
75861
 
75287
75862
  // ../../packages/core/dist/rag/renameIndexes.js
75288
- var import_node_path44 = __toESM(require("node:path"), 1);
75863
+ var import_node_path46 = __toESM(require("node:path"), 1);
75289
75864
  var import_node_fs7 = require("node:fs");
75290
75865
  function planIndexRenames(names) {
75291
75866
  const plans = [];
@@ -75349,7 +75924,7 @@ async function copyBookkeeping(directory, from, to, storeId) {
75349
75924
  continue;
75350
75925
  const target = `${to}@${storeId}.${entry.slice(prefix.length)}`;
75351
75926
  try {
75352
- await import_node_fs7.promises.copyFile(import_node_path44.default.join(directory, entry), import_node_path44.default.join(directory, target), import_node_fs7.constants.COPYFILE_EXCL);
75927
+ await import_node_fs7.promises.copyFile(import_node_path46.default.join(directory, entry), import_node_path46.default.join(directory, target), import_node_fs7.constants.COPYFILE_EXCL);
75353
75928
  copied.push(target);
75354
75929
  } catch {
75355
75930
  }
@@ -75357,263 +75932,6 @@ async function copyBookkeeping(directory, from, to, storeId) {
75357
75932
  return copied;
75358
75933
  }
75359
75934
 
75360
- // ../../packages/core/dist/tools/nativeSearch.js
75361
- var import_node_os5 = __toESM(require("node:os"), 1);
75362
- var import_node_path45 = __toESM(require("node:path"), 1);
75363
- var ALWAYS_SKIPPED = /* @__PURE__ */ new Set([".git", "node_modules"]);
75364
- var DEFAULT_MAX_FILES = 5e4;
75365
- var caseFlag = process.platform === "win32" ? "i" : "";
75366
- function globToRegExp(glob, anchored) {
75367
- let body = "";
75368
- for (let index = 0; index < glob.length; index += 1) {
75369
- const char = glob[index];
75370
- if (char === "*") {
75371
- if (glob[index + 1] === "*") {
75372
- const slashAfter = glob[index + 2] === "/";
75373
- const atSegmentStart = index === 0 || glob[index - 1] === "/";
75374
- if (atSegmentStart && slashAfter) {
75375
- body += "(?:.*/)?";
75376
- index += 2;
75377
- } else {
75378
- body += ".*";
75379
- index += 1;
75380
- }
75381
- } else {
75382
- body += "[^/]*";
75383
- }
75384
- } else if (char === "?") {
75385
- body += "[^/]";
75386
- } else if (char === "[") {
75387
- const close = glob.indexOf("]", index + 2);
75388
- if (close === -1) {
75389
- body += "\\[";
75390
- } else {
75391
- let inner = glob.slice(index + 1, close);
75392
- if (inner.startsWith("!"))
75393
- inner = `^${inner.slice(1)}`;
75394
- body += `[${inner.replace(/\\/g, "\\\\")}]`;
75395
- index = close;
75396
- }
75397
- } else if (char === "{") {
75398
- const close = glob.indexOf("}", index);
75399
- if (close === -1) {
75400
- body += "\\{";
75401
- } else {
75402
- const options = glob.slice(index + 1, close).split(",");
75403
- body += `(?:${options.map((option) => globToRegExp(option, true).source.slice(1, -1)).join("|")})`;
75404
- index = close;
75405
- }
75406
- } else if (char === "\\" && index + 1 < glob.length) {
75407
- body += escapeRegExp2(glob[index + 1]);
75408
- index += 1;
75409
- } else {
75410
- body += escapeRegExp2(char);
75411
- }
75412
- }
75413
- return new RegExp(anchored ? `^${body}$` : `^(?:.*/)?${body}$`, caseFlag);
75414
- }
75415
- function escapeRegExp2(text) {
75416
- return text.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&");
75417
- }
75418
- function parseIgnoreFile(text, base) {
75419
- const rules = [];
75420
- for (const raw of text.split(/\r?\n/)) {
75421
- let line = raw.replace(/(?<!\\)\s+$/, "");
75422
- if (line.length === 0 || line.startsWith("#"))
75423
- continue;
75424
- let negate = false;
75425
- if (line.startsWith("!")) {
75426
- negate = true;
75427
- line = line.slice(1);
75428
- } else if (line.startsWith("\\!") || line.startsWith("\\#")) {
75429
- line = line.slice(1);
75430
- }
75431
- let dirOnly = false;
75432
- if (line.endsWith("/")) {
75433
- dirOnly = true;
75434
- line = line.slice(0, -1);
75435
- }
75436
- if (line.length === 0)
75437
- continue;
75438
- const anchored = line.includes("/");
75439
- if (line.startsWith("/"))
75440
- line = line.slice(1);
75441
- rules.push({ base, regex: globToRegExp(line, anchored), negate, dirOnly });
75442
- }
75443
- return rules;
75444
- }
75445
- function isIgnored(rules, relative, isDirectory2) {
75446
- let ignored = false;
75447
- for (const rule of rules) {
75448
- if (rule.dirOnly && !isDirectory2)
75449
- continue;
75450
- let scoped = relative;
75451
- if (rule.base.length > 0) {
75452
- if (!relative.startsWith(`${rule.base}/`))
75453
- continue;
75454
- scoped = relative.slice(rule.base.length + 1);
75455
- }
75456
- if (rule.regex.test(scoped))
75457
- ignored = !rule.negate;
75458
- }
75459
- return ignored;
75460
- }
75461
- async function repositoryWideRules(fs41, root, globalIgnoreFile) {
75462
- const sources = [
75463
- globalIgnoreFile ?? import_node_path45.default.join(process.env["XDG_CONFIG_HOME"] ?? import_node_path45.default.join(import_node_os5.default.homedir(), ".config"), "git", "ignore"),
75464
- import_node_path45.default.join(root, ".git", "info", "exclude")
75465
- ];
75466
- const rules = [];
75467
- for (const source of sources) {
75468
- try {
75469
- rules.push(...parseIgnoreFile(await fs41.readFile(source), ""));
75470
- } catch {
75471
- }
75472
- }
75473
- return rules;
75474
- }
75475
- async function walkFiles(fs41, root, options) {
75476
- const maxFiles = options.maxFiles ?? DEFAULT_MAX_FILES;
75477
- const files = [];
75478
- const baseRules = options.includeIgnored ? [] : await repositoryWideRules(fs41, root, options.globalIgnoreFile);
75479
- const pending = [{ relative: "", rules: baseRules }];
75480
- while (pending.length > 0) {
75481
- if (options.signal?.aborted === true)
75482
- break;
75483
- const { relative, rules: inherited } = pending.pop();
75484
- const absolute = relative.length > 0 ? import_node_path45.default.join(root, ...relative.split("/")) : root;
75485
- let entries;
75486
- try {
75487
- entries = await fs41.readdir(absolute);
75488
- } catch {
75489
- continue;
75490
- }
75491
- let rules = inherited;
75492
- if (!options.includeIgnored && entries.some((entry) => entry.name === ".gitignore" && !entry.isDirectory)) {
75493
- try {
75494
- const text = await fs41.readFile(import_node_path45.default.join(absolute, ".gitignore"));
75495
- rules = [...inherited, ...parseIgnoreFile(text, relative)];
75496
- } catch {
75497
- }
75498
- }
75499
- const sorted = [...entries].sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
75500
- const subdirectories = [];
75501
- for (const entry of sorted) {
75502
- if (ALWAYS_SKIPPED.has(entry.name))
75503
- continue;
75504
- const child = relative.length > 0 ? `${relative}/${entry.name}` : entry.name;
75505
- if (!options.includeIgnored && isIgnored(rules, child, entry.isDirectory))
75506
- continue;
75507
- if (entry.isDirectory) {
75508
- subdirectories.push(child);
75509
- } else if (entry.isFile) {
75510
- files.push(child);
75511
- if (files.length >= maxFiles)
75512
- return { files, truncated: true };
75513
- }
75514
- }
75515
- for (const child of subdirectories.reverse())
75516
- pending.push({ relative: child, rules });
75517
- }
75518
- return { files, truncated: false };
75519
- }
75520
- var MAX_FILE_BYTES = 5 * 1024 * 1024;
75521
- var DEFAULT_MAX_OUTPUT = 2 * 1024 * 1024;
75522
- function compilePattern(pattern) {
75523
- let source = pattern;
75524
- let flags = "";
75525
- const inline2 = /^\(\?([a-z]+)\)/.exec(source);
75526
- if (inline2 !== null) {
75527
- source = source.slice(inline2[0].length);
75528
- if (inline2[1].includes("i"))
75529
- flags += "i";
75530
- if (inline2[1].includes("s"))
75531
- flags += "s";
75532
- if (inline2[1].includes("m"))
75533
- flags += "m";
75534
- }
75535
- try {
75536
- return new RegExp(source, `${flags}u`);
75537
- } catch {
75538
- try {
75539
- return new RegExp(source, flags);
75540
- } catch (error51) {
75541
- throw new Error(`The search pattern is not a valid regular expression: ${error51 instanceof Error ? error51.message : String(error51)}`, { cause: error51 });
75542
- }
75543
- }
75544
- }
75545
- function fileFilter(filePattern) {
75546
- if (filePattern === void 0 || filePattern.trim().length === 0)
75547
- return () => true;
75548
- let glob = filePattern.trim();
75549
- const exclude = glob.startsWith("!");
75550
- if (exclude)
75551
- glob = glob.slice(1);
75552
- const anchored = glob.includes("/");
75553
- const regex = globToRegExp(glob.startsWith("/") ? glob.slice(1) : glob, anchored);
75554
- return (relative) => regex.test(relative) !== exclude;
75555
- }
75556
- async function searchFiles(fs41, root, options) {
75557
- const regex = compilePattern(options.pattern);
75558
- const admits = fileFilter(options.filePattern);
75559
- const context = options.contextLines ?? 2;
75560
- const maxOutput = options.maxOutputChars ?? DEFAULT_MAX_OUTPUT;
75561
- const { files, truncated: walkTruncated } = await walkFiles(fs41, root, options);
75562
- const separator = process.platform === "win32" ? "\\" : "/";
75563
- const chunks = [];
75564
- let size = 0;
75565
- let firstGroup = true;
75566
- for (const relative of files) {
75567
- if (options.signal?.aborted === true)
75568
- break;
75569
- if (!admits(relative))
75570
- continue;
75571
- const absolute = import_node_path45.default.join(root, ...relative.split("/"));
75572
- let bytes;
75573
- try {
75574
- const stat = await fs41.stat(absolute);
75575
- if (stat.size > MAX_FILE_BYTES)
75576
- continue;
75577
- bytes = await fs41.readBytes(absolute);
75578
- } catch {
75579
- continue;
75580
- }
75581
- if (bytes.subarray(0, 8e3).includes(0))
75582
- continue;
75583
- const lines = bytes.toString("utf8").split("\n").map((line) => line.endsWith("\r") ? line.slice(0, -1) : line);
75584
- const matched = [];
75585
- for (let index = 0; index < lines.length; index += 1) {
75586
- regex.lastIndex = 0;
75587
- if (regex.test(lines[index]))
75588
- matched.push(index);
75589
- }
75590
- if (matched.length === 0)
75591
- continue;
75592
- const shown2 = `.${separator}${relative.split("/").join(separator)}`;
75593
- const matchSet = new Set(matched);
75594
- let lastPrinted = -2;
75595
- for (const hit of matched) {
75596
- const from = Math.max(0, hit - context, lastPrinted + 1);
75597
- const to = Math.min(lines.length - 1, hit + context);
75598
- if (from > lastPrinted + 1 && !firstGroup)
75599
- chunks.push("--");
75600
- firstGroup = false;
75601
- for (let index = from; index <= to; index += 1) {
75602
- if (index === lines.length - 1 && lines[index] === "" && !matchSet.has(index))
75603
- continue;
75604
- const line = `${shown2}${matchSet.has(index) ? ":" : "-"}${index + 1}${matchSet.has(index) ? ":" : "-"}${lines[index]}`;
75605
- chunks.push(line);
75606
- size += line.length + 1;
75607
- }
75608
- lastPrinted = Math.max(lastPrinted, to);
75609
- if (size > maxOutput) {
75610
- return { output: chunks.join("\n"), truncated: true };
75611
- }
75612
- }
75613
- }
75614
- return { output: chunks.join("\n"), truncated: walkTruncated };
75615
- }
75616
-
75617
75935
  // ../../packages/core/dist/platform/node/terminal.js
75618
75936
  var import_node_child_process13 = require("node:child_process");
75619
75937
  var NodeTerminalProcess = class {
@@ -75693,7 +76011,7 @@ var NodeTerminal = class {
75693
76011
 
75694
76012
  // ../../packages/core/dist/platform/node/taskStore.js
75695
76013
  var import_promises26 = __toESM(require("node:fs/promises"), 1);
75696
- var import_node_path46 = __toESM(require("node:path"), 1);
76014
+ var import_node_path47 = __toESM(require("node:path"), 1);
75697
76015
 
75698
76016
  // ../../packages/core/dist/history/types.js
75699
76017
  function taskSummary(task) {
@@ -75716,7 +76034,7 @@ var JsonTaskStore = class {
75716
76034
  constructor(globalStoragePath, truncationStore, logger) {
75717
76035
  this.truncationStore = truncationStore;
75718
76036
  this.logger = logger;
75719
- this.directory = import_node_path46.default.join(globalStoragePath, "tasks");
76037
+ this.directory = import_node_path47.default.join(globalStoragePath, "tasks");
75720
76038
  }
75721
76039
  async list(workspaceRoot) {
75722
76040
  const index = await this.readIndex();
@@ -75765,11 +76083,11 @@ var JsonTaskStore = class {
75765
76083
  await this.writeIndex(index.filter((entry) => entry.id !== id));
75766
76084
  }
75767
76085
  fileFor(id) {
75768
- return import_node_path46.default.join(this.directory, `${id}.json`);
76086
+ return import_node_path47.default.join(this.directory, `${id}.json`);
75769
76087
  }
75770
76088
  async readIndex() {
75771
76089
  try {
75772
- const raw = await import_promises26.default.readFile(import_node_path46.default.join(this.directory, INDEX_FILE), "utf8");
76090
+ const raw = await import_promises26.default.readFile(import_node_path47.default.join(this.directory, INDEX_FILE), "utf8");
75773
76091
  const parsed = JSON.parse(raw);
75774
76092
  if (Array.isArray(parsed))
75775
76093
  return parsed.filter(isIndexEntry);
@@ -75804,7 +76122,7 @@ var JsonTaskStore = class {
75804
76122
  }
75805
76123
  async writeIndex(entries) {
75806
76124
  await import_promises26.default.mkdir(this.directory, { recursive: true });
75807
- const target = import_node_path46.default.join(this.directory, INDEX_FILE);
76125
+ const target = import_node_path47.default.join(this.directory, INDEX_FILE);
75808
76126
  const temporary = `${target}.tmp`;
75809
76127
  await import_promises26.default.writeFile(temporary, JSON.stringify(entries, null, 2), "utf8");
75810
76128
  await replaceFile(temporary, target);
@@ -75836,7 +76154,7 @@ function parseTask(raw) {
75836
76154
 
75837
76155
  // ../../packages/core/dist/usage/store.js
75838
76156
  var import_node_fs8 = require("node:fs");
75839
- var import_node_path47 = __toESM(require("node:path"), 1);
76157
+ var import_node_path48 = __toESM(require("node:path"), 1);
75840
76158
 
75841
76159
  // ../../packages/core/dist/s3/keys.js
75842
76160
  function normalisePrefix(prefix) {
@@ -75969,7 +76287,7 @@ var FolderShardStore = class {
75969
76287
  await this.ask({ action: "write", user: shardSegment(shard.user), day: shard.day, instance: shard.instance, events });
75970
76288
  return;
75971
76289
  }
75972
- await this.writeAtomically(import_node_path47.default.join(this.root, shardSegment(shard.user), `${shard.day}__${shard.instance}.jsonl`), shardText(events));
76290
+ await this.writeAtomically(import_node_path48.default.join(this.root, shardSegment(shard.user), `${shard.day}__${shard.instance}.jsonl`), shardText(events));
75973
76291
  }
75974
76292
  async read(fromDay, toDay) {
75975
76293
  this.lastProblems = [];
@@ -75989,8 +76307,8 @@ var FolderShardStore = class {
75989
76307
  }
75990
76308
  const files = await this.listFiles();
75991
76309
  const wanted = selectShards(files, fromDay, toDay);
75992
- const texts = await pooled(wanted, 8, (file2) => import_node_fs8.promises.readFile(import_node_path47.default.join(this.root, file2.user, file2.name), "utf8").catch((error51) => {
75993
- this.lastProblems.push(`${import_node_path47.default.join(this.root, file2.user, file2.name)}: ${error51 instanceof Error ? error51.message : String(error51)}`);
76310
+ const texts = await pooled(wanted, 8, (file2) => import_node_fs8.promises.readFile(import_node_path48.default.join(this.root, file2.user, file2.name), "utf8").catch((error51) => {
76311
+ this.lastProblems.push(`${import_node_path48.default.join(this.root, file2.user, file2.name)}: ${error51 instanceof Error ? error51.message : String(error51)}`);
75994
76312
  return "";
75995
76313
  }));
75996
76314
  return texts.flatMap(parseUsageLines);
@@ -76007,7 +76325,7 @@ var FolderShardStore = class {
76007
76325
  }
76008
76326
  const files = [];
76009
76327
  for (const user of users) {
76010
- const folder = import_node_path47.default.join(this.root, user);
76328
+ const folder = import_node_path48.default.join(this.root, user);
76011
76329
  let names;
76012
76330
  try {
76013
76331
  names = await import_node_fs8.promises.readdir(folder);
@@ -76026,7 +76344,7 @@ var FolderShardStore = class {
76026
76344
  }
76027
76345
  async readShard(shard) {
76028
76346
  try {
76029
- return parseUsageLines(await import_node_fs8.promises.readFile(import_node_path47.default.join(this.root, shardSegment(shard.user), shardFileName(shard)), "utf8"));
76347
+ return parseUsageLines(await import_node_fs8.promises.readFile(import_node_path48.default.join(this.root, shardSegment(shard.user), shardFileName(shard)), "utf8"));
76030
76348
  } catch (error51) {
76031
76349
  if (error51.code === "ENOENT")
76032
76350
  return void 0;
@@ -76034,10 +76352,10 @@ var FolderShardStore = class {
76034
76352
  }
76035
76353
  }
76036
76354
  async putMonth(shard, events) {
76037
- await this.writeAtomically(import_node_path47.default.join(this.root, shardSegment(shard.user), shardFileName(shard)), shardText(events));
76355
+ await this.writeAtomically(import_node_path48.default.join(this.root, shardSegment(shard.user), shardFileName(shard)), shardText(events));
76038
76356
  }
76039
76357
  async removeShard(shard) {
76040
- await import_node_fs8.promises.rm(import_node_path47.default.join(this.root, shardSegment(shard.user), shardFileName(shard)), { force: true });
76358
+ await import_node_fs8.promises.rm(import_node_path48.default.join(this.root, shardSegment(shard.user), shardFileName(shard)), { force: true });
76041
76359
  }
76042
76360
  async putProfile(user, profile) {
76043
76361
  this.profilesFromRead = void 0;
@@ -76045,7 +76363,7 @@ var FolderShardStore = class {
76045
76363
  await this.ask({ action: "writeProfile", user: shardSegment(user), profile: cleanProfile(profile) });
76046
76364
  return;
76047
76365
  }
76048
- await this.writeAtomically(import_node_path47.default.join(this.root, "_profiles", `${shardSegment(user)}.json`), JSON.stringify(cleanProfile(profile)));
76366
+ await this.writeAtomically(import_node_path48.default.join(this.root, "_profiles", `${shardSegment(user)}.json`), JSON.stringify(cleanProfile(profile)));
76049
76367
  }
76050
76368
  async readProfiles() {
76051
76369
  if (this.profilesFromRead !== void 0)
@@ -76054,13 +76372,13 @@ var FolderShardStore = class {
76054
76372
  await this.read("9999-12-31", "9999-12-31");
76055
76373
  return this.profilesFromRead ?? {};
76056
76374
  }
76057
- const folder = import_node_path47.default.join(this.root, "_profiles");
76375
+ const folder = import_node_path48.default.join(this.root, "_profiles");
76058
76376
  const profiles = {};
76059
76377
  for (const name of await import_node_fs8.promises.readdir(folder).catch(() => [])) {
76060
76378
  if (!name.endsWith(".json"))
76061
76379
  continue;
76062
76380
  try {
76063
- profiles[name.slice(0, -5)] = cleanProfile(JSON.parse(await import_node_fs8.promises.readFile(import_node_path47.default.join(folder, name), "utf8")));
76381
+ profiles[name.slice(0, -5)] = cleanProfile(JSON.parse(await import_node_fs8.promises.readFile(import_node_path48.default.join(folder, name), "utf8")));
76064
76382
  } catch {
76065
76383
  }
76066
76384
  }
@@ -76809,7 +77127,7 @@ function usageCollectionOn(config2, choice) {
76809
77127
 
76810
77128
  // ../../packages/core/dist/usage/backfill.js
76811
77129
  var import_node_fs9 = require("node:fs");
76812
- var import_node_path48 = __toESM(require("node:path"), 1);
77130
+ var import_node_path49 = __toESM(require("node:path"), 1);
76813
77131
  function comparablePath(value) {
76814
77132
  return value.replace(/\\/g, "/").replace(/\/+$/, "").toLowerCase();
76815
77133
  }
@@ -76819,7 +77137,7 @@ function eventsFromTask(task, context) {
76819
77137
  return [];
76820
77138
  const created = typeof task.createdAt === "number" && task.createdAt <= updated ? task.createdAt : updated;
76821
77139
  const root = typeof task.workspaceRoot === "string" ? task.workspaceRoot : void 0;
76822
- const project = root !== void 0 && context.workspaceRoot !== void 0 && comparablePath(root) === comparablePath(context.workspaceRoot) ? context.project : root !== void 0 ? import_node_path48.default.basename(root.replace(/\\/g, "/")) : void 0;
77140
+ const project = root !== void 0 && context.workspaceRoot !== void 0 && comparablePath(root) === comparablePath(context.workspaceRoot) ? context.project : root !== void 0 ? import_node_path49.default.basename(root.replace(/\\/g, "/")) : void 0;
76823
77141
  const skillsByPath = new Map(context.skills.map((skill) => [comparablePath(skill.filePath), skill]));
76824
77142
  const skip = new Set(context.skip);
76825
77143
  const calls = [];
@@ -76856,7 +77174,7 @@ function eventsFromTask(task, context) {
76856
77174
  let skill;
76857
77175
  if (call.name === "read_file" && typeof call.args["path"] === "string") {
76858
77176
  const requested2 = call.args["path"];
76859
- const absolute = import_node_path48.default.isAbsolute(requested2) || /^[A-Za-z]:[\\/]/.test(requested2) || root === void 0 ? requested2 : import_node_path48.default.join(root, requested2);
77177
+ const absolute = import_node_path49.default.isAbsolute(requested2) || /^[A-Za-z]:[\\/]/.test(requested2) || root === void 0 ? requested2 : import_node_path49.default.join(root, requested2);
76860
77178
  skill = skillsByPath.get(comparablePath(absolute));
76861
77179
  }
76862
77180
  if (call.name === "use_skill_file" && typeof call.args["skill"] === "string") {
@@ -76901,7 +77219,7 @@ async function backfillFromTasks(tasksDir, context, helper) {
76901
77219
  let unreadable = 0;
76902
77220
  for (const name of names) {
76903
77221
  try {
76904
- events.push(...eventsFromTask(JSON.parse(await import_node_fs9.promises.readFile(import_node_path48.default.join(tasksDir, name), "utf8")), context));
77222
+ events.push(...eventsFromTask(JSON.parse(await import_node_fs9.promises.readFile(import_node_path49.default.join(tasksDir, name), "utf8")), context));
76905
77223
  } catch {
76906
77224
  unreadable++;
76907
77225
  }
@@ -76909,13 +77227,13 @@ async function backfillFromTasks(tasksDir, context, helper) {
76909
77227
  return { events, tasks: names.length, unreadable, via: "node" };
76910
77228
  }
76911
77229
  async function backfillOnce(options) {
76912
- const doneFile = import_node_path48.default.join(options.usageDir, "backfill.json");
77230
+ const doneFile = import_node_path49.default.join(options.usageDir, "backfill.json");
76913
77231
  for (const file2 of [doneFile, ...options.legacyDoneFile !== void 0 ? [options.legacyDoneFile] : []]) {
76914
77232
  if (await import_node_fs9.promises.stat(file2).then(() => true, () => false))
76915
77233
  return { ran: false };
76916
77234
  }
76917
77235
  await import_node_fs9.promises.mkdir(options.usageDir, { recursive: true });
76918
- const startFile = import_node_path48.default.join(options.usageDir, "backfill-start.json");
77236
+ const startFile = import_node_path49.default.join(options.usageDir, "backfill-start.json");
76919
77237
  let before;
76920
77238
  try {
76921
77239
  before = (options.now ?? Date.now)();
@@ -77324,14 +77642,14 @@ function wireChatBridge(services) {
77324
77642
  let cachedSecretValues = [];
77325
77643
  const droppedFilesRoot2 = droppedFilesRoot();
77326
77644
  const mailAttachmentsRoot2 = mailAttachmentsRoot();
77327
- const droppedFilesDir = import_node_path49.default.join(droppedFilesRoot2, (0, import_node_crypto14.randomUUID)().slice(0, 8));
77328
- const truncationStore = new RecordingTruncationStore(new DiskTruncationStore(import_node_path49.default.join(storageDir, "tool-results"), () => cachedSecretValues));
77645
+ const droppedFilesDir = import_node_path50.default.join(droppedFilesRoot2, (0, import_node_crypto15.randomUUID)().slice(0, 8));
77646
+ const truncationStore = new RecordingTruncationStore(new DiskTruncationStore(import_node_path50.default.join(storageDir, "tool-results"), () => cachedSecretValues));
77329
77647
  const taskStore = new JsonTaskStore(storageDir, truncationStore, logger);
77330
77648
  const manifestsRoot = services.codebaseDir ?? storageDir;
77331
77649
  const codebaseInstructionsFile = codebaseInstructionsPath({ codebaseDir: services.codebaseDir, storageDir, workspaceRoot });
77332
77650
  if (services.codebaseDir !== void 0) {
77333
- const shared = import_node_path49.default.join(services.codebaseDir, "index-manifests");
77334
- void import_promises27.default.access(shared).catch(() => import_promises27.default.cp(import_node_path49.default.join(storageDir, "index-manifests"), shared, { recursive: true, errorOnExist: false, force: false })).catch(() => void 0);
77651
+ const shared = import_node_path50.default.join(services.codebaseDir, "index-manifests");
77652
+ void import_promises27.default.access(shared).catch(() => import_promises27.default.cp(import_node_path50.default.join(storageDir, "index-manifests"), shared, { recursive: true, errorOnExist: false, force: false })).catch(() => void 0);
77335
77653
  }
77336
77654
  const python = new PythonManager({
77337
77655
  workspaceRoot,
@@ -77457,7 +77775,7 @@ ${preview.text}` } : {}
77457
77775
  void postDatasetStatus();
77458
77776
  }
77459
77777
  });
77460
- const defaultSkillsDir = workspaceRoot !== void 0 ? import_node_path49.default.join(workspaceRoot, ".lightcode", "skills") : void 0;
77778
+ const defaultSkillsDir = workspaceRoot !== void 0 ? import_node_path50.default.join(workspaceRoot, ".lightcode", "skills") : void 0;
77461
77779
  let skillsDir = defaultSkillsDir;
77462
77780
  let localSkillsDir = defaultSkillsDir;
77463
77781
  let extraSkillDirs = [];
@@ -77480,9 +77798,9 @@ ${preview.text}` } : {}
77480
77798
  const trimmed = entry.trim();
77481
77799
  if (trimmed.length === 0)
77482
77800
  return void 0;
77483
- if (import_node_path49.default.isAbsolute(trimmed))
77484
- return import_node_path49.default.resolve(trimmed);
77485
- return workspaceRoot === void 0 ? void 0 : import_node_path49.default.resolve(workspaceRoot, trimmed);
77801
+ if (import_node_path50.default.isAbsolute(trimmed))
77802
+ return import_node_path50.default.resolve(trimmed);
77803
+ return workspaceRoot === void 0 ? void 0 : import_node_path50.default.resolve(workspaceRoot, trimmed);
77486
77804
  }
77487
77805
  function skillSearchPath() {
77488
77806
  return [skillsDir, ...extraSkillDirs].filter((dir) => dir !== void 0);
@@ -77514,7 +77832,7 @@ ${preview.text}` } : {}
77514
77832
  function watchSkillFolders() {
77515
77833
  stopWatchingSkills();
77516
77834
  const dirs = skillSearchPath();
77517
- for (const dir of [...dirs, ...dirs.map((entry) => import_node_path49.default.dirname(entry))]) {
77835
+ for (const dir of [...dirs, ...dirs.map((entry) => import_node_path50.default.dirname(entry))]) {
77518
77836
  try {
77519
77837
  skillWatchers.push(
77520
77838
  // Recursive, because a skill may be a folder with SKILL.md inside — a non-recursive
@@ -77585,7 +77903,7 @@ ${preview.text}` } : {}
77585
77903
  await openInPanelEditor(filePath);
77586
77904
  return;
77587
77905
  }
77588
- const real = await confineToAny(import_node_path49.default.resolve(filePath), roots);
77906
+ const real = await confineToAny(import_node_path50.default.resolve(filePath), roots);
77589
77907
  await ui.openFile?.(real);
77590
77908
  } catch (error51) {
77591
77909
  post({ type: "error", message: error51 instanceof Error ? error51.message : String(error51) });
@@ -77596,9 +77914,9 @@ ${preview.text}` } : {}
77596
77914
  python.toolsDirectory(),
77597
77915
  ...skillsDir === void 0 ? [] : [skillsDir],
77598
77916
  ...extraSkillDirs.filter((dir) => dir !== void 0),
77599
- import_node_path49.default.join(storageDir, "reports"),
77917
+ import_node_path50.default.join(storageDir, "reports"),
77600
77918
  // Its own folder: nothing else lives there.
77601
- ...codebaseInstructionsFile === void 0 ? [] : [import_node_path49.default.dirname(codebaseInstructionsFile)]
77919
+ ...codebaseInstructionsFile === void 0 ? [] : [import_node_path50.default.dirname(codebaseInstructionsFile)]
77602
77920
  ].filter((dir) => dir.length > 0);
77603
77921
  }
77604
77922
  function mostlyCrlf(text) {
@@ -77607,17 +77925,17 @@ ${preview.text}` } : {}
77607
77925
  }
77608
77926
  const EDITOR_MAX_BYTES = 2 * 1024 * 1024;
77609
77927
  async function openInPanelEditor(filePath) {
77610
- const real = await confineToAny(import_node_path49.default.resolve(filePath), managedRoots());
77928
+ const real = await confineToAny(import_node_path50.default.resolve(filePath), managedRoots());
77611
77929
  const stat = await import_promises27.default.stat(real);
77612
77930
  if (stat.size > EDITOR_MAX_BYTES)
77613
- throw new Error(`${import_node_path49.default.basename(real)} is too large to edit here (${String(Math.round(stat.size / 1024))} KB).`);
77931
+ throw new Error(`${import_node_path50.default.basename(real)} is too large to edit here (${String(Math.round(stat.size / 1024))} KB).`);
77614
77932
  const raw = await import_promises27.default.readFile(real, "utf8");
77615
77933
  const crlf = mostlyCrlf(raw);
77616
- post({ type: "editorFile", path: real, name: import_node_path49.default.basename(real), content: raw.split("\r\n").join("\n"), mtimeMs: stat.mtimeMs, eol: crlf ? "crlf" : "lf" });
77934
+ post({ type: "editorFile", path: real, name: import_node_path50.default.basename(real), content: raw.split("\r\n").join("\n"), mtimeMs: stat.mtimeMs, eol: crlf ? "crlf" : "lf" });
77617
77935
  }
77618
77936
  async function handleSaveEditorFile(filePath, content, mtimeMs) {
77619
77937
  try {
77620
- const real = await confineToAny(import_node_path49.default.resolve(filePath), managedRoots());
77938
+ const real = await confineToAny(import_node_path50.default.resolve(filePath), managedRoots());
77621
77939
  const current = await import_promises27.default.stat(real).catch(() => void 0);
77622
77940
  if (current !== void 0 && Math.abs(current.mtimeMs - mtimeMs) > 1) {
77623
77941
  post({
@@ -77625,7 +77943,7 @@ ${preview.text}` } : {}
77625
77943
  path: real,
77626
77944
  ok: false,
77627
77945
  conflict: true,
77628
- message: `${import_node_path49.default.basename(real)} was changed on disk after you opened it. Copy your text, close the editor, and open it again to see the new version.`
77946
+ message: `${import_node_path50.default.basename(real)} was changed on disk after you opened it. Copy your text, close the editor, and open it again to see the new version.`
77629
77947
  });
77630
77948
  return;
77631
77949
  }
@@ -77649,7 +77967,7 @@ ${preview.text}` } : {}
77649
77967
  await handleOpenManagedFile(existing.filePath);
77650
77968
  return;
77651
77969
  }
77652
- const target = import_node_path49.default.join(skillsDir, "standing-instructions.md");
77970
+ const target = import_node_path50.default.join(skillsDir, "standing-instructions.md");
77653
77971
  try {
77654
77972
  await import_promises27.default.mkdir(skillsDir, { recursive: true });
77655
77973
  await import_promises27.default.writeFile(target, STANDING_SKILL_TEMPLATE, { encoding: "utf8", flag: "wx" });
@@ -77669,7 +77987,7 @@ ${preview.text}` } : {}
77669
77987
  return;
77670
77988
  }
77671
77989
  try {
77672
- await import_promises27.default.mkdir(import_node_path49.default.dirname(codebaseInstructionsFile), { recursive: true });
77990
+ await import_promises27.default.mkdir(import_node_path50.default.dirname(codebaseInstructionsFile), { recursive: true });
77673
77991
  await import_promises27.default.writeFile(codebaseInstructionsFile, "", { encoding: "utf8", flag: "wx" });
77674
77992
  } catch (error51) {
77675
77993
  if (error51.code !== "EEXIST") {
@@ -77686,11 +78004,11 @@ ${preview.text}` } : {}
77686
78004
  return;
77687
78005
  if (!isValidToolName(name))
77688
78006
  throw new Error(`"${name}" is not a valid tool name.`);
77689
- const ownCopy = import_node_path49.default.join(dir, toolFileName(name));
78007
+ const ownCopy = import_node_path50.default.join(dir, toolFileName(name));
77690
78008
  if (filePath !== void 0) {
77691
- const same2 = (a, b) => normalizeForComparison(import_node_path49.default.resolve(a)) === normalizeForComparison(import_node_path49.default.resolve(b));
78009
+ const same2 = (a, b) => normalizeForComparison(import_node_path50.default.resolve(a)) === normalizeForComparison(import_node_path50.default.resolve(b));
77692
78010
  if (!same2(filePath, ownCopy)) {
77693
- const fromBucket = mirroredToolsDirs.some((mirror) => same2(import_node_path49.default.dirname(filePath), mirror));
78011
+ const fromBucket = mirroredToolsDirs.some((mirror) => same2(import_node_path50.default.dirname(filePath), mirror));
77694
78012
  throw new Error(fromBucket ? `"${name}" at ${filePath} comes from a bucket folder, so deleting it here would be undone by the next sync. Decline it to hide this version, or remove it from the bucket to remove it for everyone.` : `${filePath} is not in the tools folder this machine writes to (${dir}), so it was not deleted.`);
77695
78013
  }
77696
78014
  }
@@ -77716,7 +78034,7 @@ ${preview.text}` } : {}
77716
78034
  let dir;
77717
78035
  let filePath = "";
77718
78036
  for (const candidate of python.toolDirectories()) {
77719
- const attempt = import_node_path49.default.join(candidate, toolFileName(name));
78037
+ const attempt = import_node_path50.default.join(candidate, toolFileName(name));
77720
78038
  if (await onDisk(attempt)) {
77721
78039
  dir = candidate;
77722
78040
  filePath = attempt;
@@ -77747,7 +78065,7 @@ ${preview.text}` } : {}
77747
78065
  function samePath(a, b) {
77748
78066
  if (a === void 0 || b === void 0)
77749
78067
  return false;
77750
- const norm2 = (value) => process.platform === "win32" ? import_node_path49.default.resolve(value).toLowerCase() : import_node_path49.default.resolve(value);
78068
+ const norm2 = (value) => process.platform === "win32" ? import_node_path50.default.resolve(value).toLowerCase() : import_node_path50.default.resolve(value);
77751
78069
  return norm2(a) === norm2(b);
77752
78070
  }
77753
78071
  function publishFolder(kind, mirrors) {
@@ -77852,7 +78170,7 @@ ${preview.text}` } : {}
77852
78170
  target,
77853
78171
  ...mirror.prefix !== void 0 ? { prefix: mirror.prefix } : {},
77854
78172
  relative: entry,
77855
- contents: await import_promises27.default.readFile(import_node_path49.default.join(dir, entry))
78173
+ contents: await import_promises27.default.readFile(import_node_path50.default.join(dir, entry))
77856
78174
  });
77857
78175
  uploaded += 1;
77858
78176
  } catch (error51) {
@@ -77874,7 +78192,7 @@ ${preview.text}` } : {}
77874
78192
  if (!isValidToolName(name))
77875
78193
  throw new Error(`"${name}" is not a valid tool name.`);
77876
78194
  for (const candidate of python.toolDirectories()) {
77877
- const attempt = import_node_path49.default.join(candidate, toolFileName(name));
78195
+ const attempt = import_node_path50.default.join(candidate, toolFileName(name));
77878
78196
  try {
77879
78197
  post({ type: "pythonToolSource", name, source: await import_promises27.default.readFile(attempt, "utf8") });
77880
78198
  return;
@@ -77927,7 +78245,7 @@ ${preview.text}` } : {}
77927
78245
  continue;
77928
78246
  for (const candidate of python.toolDirectories()) {
77929
78247
  try {
77930
- const source = await import_promises27.default.readFile(import_node_path49.default.join(candidate, toolFileName(name)), "utf8");
78248
+ const source = await import_promises27.default.readFile(import_node_path50.default.join(candidate, toolFileName(name)), "utf8");
77931
78249
  declined[name] = hashSource(source);
77932
78250
  recorded += 1;
77933
78251
  break;
@@ -77985,7 +78303,7 @@ ${preview.text}` } : {}
77985
78303
  let dir;
77986
78304
  let filePath = "";
77987
78305
  for (const candidate of python.toolDirectories()) {
77988
- const attempt = import_node_path49.default.join(candidate, toolFileName(name));
78306
+ const attempt = import_node_path50.default.join(candidate, toolFileName(name));
77989
78307
  if (await onDisk(attempt)) {
77990
78308
  dir = candidate;
77991
78309
  filePath = attempt;
@@ -78011,7 +78329,7 @@ ${preview.text}` } : {}
78011
78329
  function mirrorForDir(sourceDir) {
78012
78330
  if (sourceDir === void 0)
78013
78331
  return void 0;
78014
- const wanted = import_node_path49.default.resolve(sourceDir).toLowerCase();
78332
+ const wanted = import_node_path50.default.resolve(sourceDir).toLowerCase();
78015
78333
  for (const mirror of cachedSkillMirrors) {
78016
78334
  if (mirror.enabled !== true)
78017
78335
  continue;
@@ -78021,7 +78339,7 @@ ${preview.text}` } : {}
78021
78339
  kind: "skills",
78022
78340
  ...mirror.prefix !== void 0 ? { prefix: mirror.prefix } : {}
78023
78341
  });
78024
- if (import_node_path49.default.resolve(localDir).toLowerCase() === wanted)
78342
+ if (import_node_path50.default.resolve(localDir).toLowerCase() === wanted)
78025
78343
  return { mirror, localDir };
78026
78344
  }
78027
78345
  return void 0;
@@ -78086,8 +78404,8 @@ ${preview.text}` } : {}
78086
78404
  });
78087
78405
  let localProblem;
78088
78406
  try {
78089
- await import_promises27.default.rm(import_node_path49.default.join(found2.localDir, `${name}.md`), { force: true });
78090
- await import_promises27.default.rm(import_node_path49.default.join(found2.localDir, name), { recursive: true, force: true });
78407
+ await import_promises27.default.rm(import_node_path50.default.join(found2.localDir, `${name}.md`), { force: true });
78408
+ await import_promises27.default.rm(import_node_path50.default.join(found2.localDir, name), { recursive: true, force: true });
78091
78409
  } catch (error51) {
78092
78410
  localProblem = error51 instanceof Error ? error51.message : String(error51);
78093
78411
  }
@@ -78120,7 +78438,7 @@ ${preview.text}` } : {}
78120
78438
  if (existing !== void 0 && existing.sourceDir !== void 0 && existing.sourceDir !== skillsDir) {
78121
78439
  throw new Error(`"${name}" lives in ${existing.sourceDir}, which is a read-only skills folder. Delete the file there, or remove the folder in Settings.`);
78122
78440
  }
78123
- await import_promises27.default.rm(import_node_path49.default.join(skillsDir, skillFileName(name)), { force: true });
78441
+ await import_promises27.default.rm(import_node_path50.default.join(skillsDir, skillFileName(name)), { force: true });
78124
78442
  await postSkills();
78125
78443
  } catch (error51) {
78126
78444
  post({ type: "error", message: error51 instanceof Error ? error51.message : String(error51) });
@@ -78300,7 +78618,7 @@ ${preview.text}` } : {}
78300
78618
  let scheduleToolAccess;
78301
78619
  const approvalsKey = workspaceRoot ?? "__no_workspace__";
78302
78620
  function comparableApprovalsKey(key2) {
78303
- return key2 === "__no_workspace__" ? key2 : normalizeForComparison(import_node_path49.default.resolve(key2));
78621
+ return key2 === "__no_workspace__" ? key2 : normalizeForComparison(import_node_path50.default.resolve(key2));
78304
78622
  }
78305
78623
  function approvalsFrom(stored) {
78306
78624
  if (stored === void 0)
@@ -78511,7 +78829,7 @@ ${preview.text}` } : {}
78511
78829
  ...taskExpertEstimate === void 0 ? {} : { estimate: taskExpertEstimate }
78512
78830
  });
78513
78831
  }
78514
- const expertEventsPath = import_node_path49.default.join(storageDir, "expert-events.jsonl");
78832
+ const expertEventsPath = import_node_path50.default.join(storageDir, "expert-events.jsonl");
78515
78833
  let expertEvents;
78516
78834
  let juniorTurnWithoutExpert = false;
78517
78835
  async function loadExpertEvents() {
@@ -78539,7 +78857,7 @@ ${preview.text}` } : {}
78539
78857
  try {
78540
78858
  const events = await loadExpertEvents();
78541
78859
  events.push(event);
78542
- await import_promises27.default.mkdir(import_node_path49.default.dirname(expertEventsPath), { recursive: true });
78860
+ await import_promises27.default.mkdir(import_node_path50.default.dirname(expertEventsPath), { recursive: true });
78543
78861
  await import_promises27.default.appendFile(expertEventsPath, `${JSON.stringify(event)}
78544
78862
  `, "utf8");
78545
78863
  } catch (error51) {
@@ -78813,8 +79131,8 @@ ${preview.text}` } : {}
78813
79131
  function contextMentionPath(file2) {
78814
79132
  if (workspaceRoot === void 0)
78815
79133
  return file2;
78816
- const relative = import_node_path49.default.relative(workspaceRoot, file2);
78817
- return relative.length > 0 && !relative.startsWith("..") && !import_node_path49.default.isAbsolute(relative) ? relative.split(import_node_path49.default.sep).join("/") : file2;
79134
+ const relative = import_node_path50.default.relative(workspaceRoot, file2);
79135
+ return relative.length > 0 && !relative.startsWith("..") && !import_node_path50.default.isAbsolute(relative) ? relative.split(import_node_path50.default.sep).join("/") : file2;
78818
79136
  }
78819
79137
  function hostCapabilities() {
78820
79138
  return {
@@ -79312,9 +79630,10 @@ ${preview.text}` } : {}
79312
79630
  }
79313
79631
  let installedAddons = [];
79314
79632
  let addonProblems = [];
79633
+ const addonRoot = services.codebaseDir ?? storageDir;
79315
79634
  function addonFolders(config2) {
79316
79635
  return {
79317
- configured: (config2.addons?.folders ?? []).map((folder) => import_node_path49.default.resolve(folder)),
79636
+ configured: (config2.addons?.folders ?? []).map((folder) => import_node_path50.default.resolve(folder)),
79318
79637
  defaults: defaultAddonFolders(process.env, process.execPath, process.platform)
79319
79638
  };
79320
79639
  }
@@ -79325,8 +79644,159 @@ ${preview.text}` } : {}
79325
79644
  addonProblems = found2.problems;
79326
79645
  }
79327
79646
  async function configureMcp(servers) {
79328
- const { workspaceMcpServers } = await configManager.load();
79329
- await mcp.configure(runnableServers(servers, installedAddons, { execPath: process.execPath, electron: process.versions["electron"] !== void 0 }, workspaceMcpServers));
79647
+ const { config: config2, workspaceMcpServers } = await configManager.load();
79648
+ const delivered = /* @__PURE__ */ new Map();
79649
+ for (const addon of installedAddons) {
79650
+ if (addon.page === void 0)
79651
+ continue;
79652
+ const settings = config2.addons?.settings?.[addon.package];
79653
+ const stored = /* @__PURE__ */ new Set();
79654
+ for (const ref of possibleSecretRefs(addon, settings))
79655
+ if (await secrets.get(ref) !== void 0)
79656
+ stored.add(ref);
79657
+ const delivery = deliveryFor(addonRoot, addon, settings, stored);
79658
+ try {
79659
+ await writeFileAtomically(delivery.file, JSON.stringify(delivery.contents, null, 2));
79660
+ await import_promises27.default.mkdir(addonDownloadsDir(addonRoot, addon), { recursive: true });
79661
+ delivered.set(addon.package, delivery.env);
79662
+ } catch (error51) {
79663
+ logger.warn(`Could not write the settings for add-on ${addon.package}: ${error51 instanceof Error ? error51.message : String(error51)}`);
79664
+ }
79665
+ }
79666
+ await mcp.configure(runnableServers(servers, installedAddons, { execPath: process.execPath, electron: process.versions["electron"] !== void 0 }, workspaceMcpServers, (addon) => delivered.get(addon.package) ?? {}));
79667
+ }
79668
+ async function postAddonPage(pkg, extra = {}) {
79669
+ const { config: config2 } = await configManager.load();
79670
+ const addon = installedAddons.find((candidate) => candidate.package === pkg);
79671
+ if (addon?.page === void 0) {
79672
+ post({ type: "addonPage", package: pkg, error: `${pkg} is not installed, or has no settings of its own.` });
79673
+ return;
79674
+ }
79675
+ const settings = config2.addons?.settings?.[pkg];
79676
+ const isSet = async (recordId, fields) => {
79677
+ const set2 = [];
79678
+ for (const field2 of fields) {
79679
+ if (field2.type === "secret" && await secrets.get(addonSecretRef(pkg, recordId, field2.key)) !== void 0)
79680
+ set2.push(field2.key);
79681
+ }
79682
+ return set2;
79683
+ };
79684
+ post({
79685
+ type: "addonPage",
79686
+ package: pkg,
79687
+ ...extra,
79688
+ view: {
79689
+ package: pkg,
79690
+ displayName: addon.displayName,
79691
+ ...addon.icon !== void 0 ? { icon: addon.icon } : {},
79692
+ page: addon.page,
79693
+ state: addonState(addon, config2.mcpServers ?? {}),
79694
+ values: settings?.values ?? {},
79695
+ secretsSet: await isSet(void 0, addon.page.fields ?? []),
79696
+ records: await Promise.all((settings?.records ?? []).map(async (record2) => ({ ...record2, secretsSet: await isSet(record2.id, addon.page?.records?.fields ?? []) })))
79697
+ }
79698
+ });
79699
+ }
79700
+ async function storeAddonSettings(addon, next) {
79701
+ const { config: config2 } = await configManager.load();
79702
+ const all = { ...config2.addons?.settings ?? {}, [addon.package]: next };
79703
+ await configManager.save("user", { addons: { ...config2.addons ?? {}, settings: all } });
79704
+ const reloaded = (await configManager.load()).config;
79705
+ await configureMcp(reloaded.mcpServers ?? {});
79706
+ if (mcp.states_().some((server) => server.name === addon.server && server.status === "ready")) {
79707
+ await mcp.restart(addon.server).catch(() => void 0);
79708
+ }
79709
+ }
79710
+ async function writeAddonSecrets(pkg, recordId, fields, given, clear = []) {
79711
+ for (const field2 of fields) {
79712
+ if (field2.type !== "secret")
79713
+ continue;
79714
+ const ref = addonSecretRef(pkg, recordId, field2.key);
79715
+ const value = given[field2.key];
79716
+ if (typeof value === "string" && value.length > 0)
79717
+ await secrets.set(ref, value);
79718
+ else if (clear.includes(field2.key))
79719
+ await secrets.delete(ref);
79720
+ }
79721
+ }
79722
+ async function handleSaveAddonRecord(message4) {
79723
+ const addon = installedAddons.find((candidate) => candidate.package === message4.package);
79724
+ const spec = addon?.page?.records;
79725
+ if (addon === void 0 || spec === void 0)
79726
+ return postAddonPage(message4.package, { error: "This add-on keeps no list." });
79727
+ const cleaned = cleanAddonValues(spec.fields, message4.values);
79728
+ if (!cleaned.ok)
79729
+ return postAddonPage(message4.package, { error: cleaned.message });
79730
+ const { config: config2 } = await configManager.load();
79731
+ const current = config2.addons?.settings?.[addon.package] ?? {};
79732
+ const records = [...current.records ?? []];
79733
+ const name = String(cleaned.values[spec.keyField] ?? "");
79734
+ const clash = records.find((record2) => record2.id !== message4.id && String(record2.values[spec.keyField] ?? "").toLowerCase() === name.toLowerCase());
79735
+ if (clash !== void 0)
79736
+ return postAddonPage(message4.package, { error: `There is already a ${spec.noun} called "${name}".` });
79737
+ let id = message4.id;
79738
+ if (id === void 0) {
79739
+ if (records.length >= (spec.max ?? 500))
79740
+ return postAddonPage(message4.package, { error: `No more than ${String(spec.max ?? 500)} ${spec.noun}s.` });
79741
+ id = (0, import_node_crypto15.randomBytes)(6).toString("hex");
79742
+ records.push({ id, values: cleaned.values });
79743
+ } else {
79744
+ const at = records.findIndex((record2) => record2.id === id);
79745
+ if (at < 0)
79746
+ return postAddonPage(message4.package, { error: `That ${spec.noun} no longer exists.` });
79747
+ records[at] = { id, values: cleaned.values };
79748
+ }
79749
+ await writeAddonSecrets(addon.package, id, spec.fields, message4.secrets, message4.clearSecrets);
79750
+ await storeAddonSettings(addon, { ...current, records });
79751
+ await postAddonPage(message4.package, { saved: true });
79752
+ }
79753
+ async function handleDeleteAddonRecord(pkg, id) {
79754
+ const addon = installedAddons.find((candidate) => candidate.package === pkg);
79755
+ const spec = addon?.page?.records;
79756
+ if (addon === void 0 || spec === void 0)
79757
+ return postAddonPage(pkg);
79758
+ const { config: config2 } = await configManager.load();
79759
+ const current = config2.addons?.settings?.[pkg] ?? {};
79760
+ await writeAddonSecrets(pkg, id, spec.fields, {}, spec.fields.map((field2) => field2.key));
79761
+ await storeAddonSettings(addon, { ...current, records: (current.records ?? []).filter((record2) => record2.id !== id) });
79762
+ await postAddonPage(pkg, { saved: true });
79763
+ }
79764
+ async function handleSaveAddonValues(message4) {
79765
+ const addon = installedAddons.find((candidate) => candidate.package === message4.package);
79766
+ const fields = addon?.page?.fields;
79767
+ if (addon === void 0 || fields === void 0)
79768
+ return postAddonPage(message4.package);
79769
+ const cleaned = cleanAddonValues(fields, message4.values);
79770
+ if (!cleaned.ok)
79771
+ return postAddonPage(message4.package, { error: cleaned.message });
79772
+ const { config: config2 } = await configManager.load();
79773
+ await writeAddonSecrets(addon.package, void 0, fields, message4.secrets, message4.clearSecrets);
79774
+ await storeAddonSettings(addon, { ...config2.addons?.settings?.[addon.package] ?? {}, values: cleaned.values });
79775
+ await postAddonPage(message4.package, { saved: true });
79776
+ }
79777
+ async function handleRunAddonAction(pkg, id, tool) {
79778
+ const reply = (ok, text) => post({ type: "addonActionResult", package: pkg, id, tool, ok, text });
79779
+ const addon = installedAddons.find((candidate) => candidate.package === pkg);
79780
+ const spec = addon?.page?.records;
79781
+ if (addon === void 0 || spec === void 0 || !(spec.actions ?? []).some((action) => action.tool === tool))
79782
+ return reply(false, "That button is not one this add-on declares.");
79783
+ const { config: config2 } = await configManager.load();
79784
+ if (addonState(addon, config2.mcpServers ?? {}) !== "enabled")
79785
+ return reply(false, `Enable ${addon.displayName} first (Settings \u2192 MCP \u2192 Add-ons).`);
79786
+ const record2 = (config2.addons?.settings?.[pkg]?.records ?? []).find((candidate) => candidate.id === id);
79787
+ if (record2 === void 0)
79788
+ return reply(false, `That ${spec.noun} no longer exists.`);
79789
+ await mcp.ensureConnected();
79790
+ const target = mcp.enabledTools().find((candidate) => candidate.name === `${addon.server}__${tool}`);
79791
+ if (target === void 0)
79792
+ return reply(false, `${addon.displayName} is not running, or offers no "${tool}". See its log in Settings \u2192 MCP.`);
79793
+ try {
79794
+ const result = await target.execute({ [spec.keyField]: record2.values[spec.keyField] }, { workspaceRoot, readFiles: /* @__PURE__ */ new Set() });
79795
+ const text = typeof result === "string" ? result : "content" in result ? String(result.content) : JSON.stringify(result);
79796
+ reply(!(typeof result === "object" && "isError" in result && result.isError === true), text.slice(0, 4e3));
79797
+ } catch (error51) {
79798
+ reply(false, error51 instanceof Error ? error51.message : String(error51));
79799
+ }
79330
79800
  }
79331
79801
  async function syncMcpFromConfig(config2) {
79332
79802
  const servers = config2.mcpServers ?? {};
@@ -79351,7 +79821,10 @@ ${preview.text}` } : {}
79351
79821
  main: addon.main,
79352
79822
  server: addon.server,
79353
79823
  state,
79354
- ...state === "updated" && enabled !== void 0 ? { enabledVersion: enabled } : {}
79824
+ ...state === "updated" && enabled !== void 0 ? { enabledVersion: enabled } : {},
79825
+ ...addon.page !== void 0 ? { pageTitle: addon.page.title } : {},
79826
+ ...addon.icon !== void 0 ? { icon: addon.icon } : {},
79827
+ ...addon.pageProblem !== void 0 ? { pageProblem: addon.pageProblem } : {}
79355
79828
  };
79356
79829
  });
79357
79830
  post({
@@ -79407,7 +79880,7 @@ ${preview.text}` } : {}
79407
79880
  }
79408
79881
  async function handleSaveAddonFolders(folders) {
79409
79882
  const cleaned = [...new Set(folders.map((folder) => folder.trim()).filter((folder) => folder.length > 0))];
79410
- const relative = cleaned.find((folder) => !import_node_path49.default.isAbsolute(folder));
79883
+ const relative = cleaned.find((folder) => !import_node_path50.default.isAbsolute(folder));
79411
79884
  if (relative !== void 0) {
79412
79885
  await postAddons(`"${relative}" is not a full path. Add-on folders are full paths, such as C:\\addons.`);
79413
79886
  return;
@@ -79418,7 +79891,7 @@ ${preview.text}` } : {}
79418
79891
  postMcp();
79419
79892
  await postAddons();
79420
79893
  }
79421
- const shadowGit = workspaceRoot !== void 0 ? new ShadowGit(workspaceRoot, import_node_path49.default.join(storageDir, "checkpoints", "shadow.git"), services.codebaseDir !== void 0 ? import_node_path49.default.join(services.codebaseDir, "checkpoint-objects") : void 0) : void 0;
79894
+ const shadowGit = workspaceRoot !== void 0 ? new ShadowGit(workspaceRoot, import_node_path50.default.join(storageDir, "checkpoints", "shadow.git"), services.codebaseDir !== void 0 ? import_node_path50.default.join(services.codebaseDir, "checkpoint-objects") : void 0) : void 0;
79422
79895
  async function postProfiles() {
79423
79896
  const { config: config2 } = await configManager.load();
79424
79897
  const profiles = await Promise.all((config2.profiles ?? []).map((profile) => toSummary(profile, secrets)));
@@ -79475,7 +79948,7 @@ ${preview.text}` } : {}
79475
79948
  if (workspaceRoot === void 0 || conversation.isEmpty())
79476
79949
  return;
79477
79950
  if (activeTaskId === void 0) {
79478
- await setActiveTaskId((0, import_node_crypto14.randomUUID)());
79951
+ await setActiveTaskId((0, import_node_crypto15.randomUUID)());
79479
79952
  activeTaskCreatedAt = Date.now();
79480
79953
  truncationStore.startTask();
79481
79954
  }
@@ -79808,6 +80281,8 @@ ${preview.text}` } : {}
79808
80281
  ...hub !== void 0 ? {
79809
80282
  afterEdit: async (realPath) => {
79810
80283
  const saved = await hub.mirror.push(realPath, activeAbortController?.signal);
80284
+ if (saved.ignored === true)
80285
+ return `JupyterHub: not synced - ${saved.message}.`;
79811
80286
  return saved.saved ? `JupyterHub: ${saved.message}.` : `JupyterHub: NOT saved to the hub - ${saved.message}`;
79812
80287
  }
79813
80288
  } : {},
@@ -79818,7 +80293,9 @@ ${preview.text}` } : {}
79818
80293
  ...cachedReadRoots,
79819
80294
  ...(services.siblings ?? []).map((s) => s.path),
79820
80295
  droppedFilesRoot2,
79821
- mailAttachmentsRoot2
80296
+ mailAttachmentsRoot2,
80297
+ // What an add-on fetched for investigation (a file from a Linux machine, say) is read without asking.
80298
+ ...installedAddons.map((addon) => addonDownloadsDir(addonRoot, addon))
79822
80299
  ],
79823
80300
  ...services.fileReach === "anywhere" ? { reach: "anywhere" } : {},
79824
80301
  // Resolved per turn by the host, so an edit applies to the next command rather than
@@ -80231,7 +80708,7 @@ ${direction}` : attachMentions(text, mentions);
80231
80708
  try {
80232
80709
  const { config: config2 } = await configManager.load();
80233
80710
  const profiles = config2.profiles ?? [];
80234
- const id = input.id ?? (0, import_node_crypto14.randomUUID)();
80711
+ const id = input.id ?? (0, import_node_crypto15.randomUUID)();
80235
80712
  const existing = profiles.find((p) => p.id === id);
80236
80713
  const auth2 = await buildAuthFromInput(input, id);
80237
80714
  const saved = {
@@ -80269,7 +80746,7 @@ ${direction}` : attachMentions(text, mentions);
80269
80746
  post({ type: "error", message: `Profile "${id}" no longer exists.` });
80270
80747
  return;
80271
80748
  }
80272
- const newId = (0, import_node_crypto14.randomUUID)();
80749
+ const newId = (0, import_node_crypto15.randomUUID)();
80273
80750
  async function copySecret(fromRef, toRef) {
80274
80751
  if (fromRef === void 0)
80275
80752
  return false;
@@ -81086,7 +81563,7 @@ ${redact(shown2, cachedSecretValues)}` }
81086
81563
  return { mode: cachedSearchScope, author: cachedAttribution.author };
81087
81564
  }
81088
81565
  function currentProjectNames() {
81089
- const names = [cachedAttribution.project, workspaceRoot !== void 0 ? import_node_path49.default.basename(workspaceRoot) : void 0];
81566
+ const names = [cachedAttribution.project, workspaceRoot !== void 0 ? import_node_path50.default.basename(workspaceRoot) : void 0];
81090
81567
  return names.filter((name) => name !== void 0 && name.length > 0);
81091
81568
  }
81092
81569
  function indexProject(config2) {
@@ -81189,8 +81666,8 @@ ${redact(shown2, cachedSecretValues)}` }
81189
81666
  limit: limits.limit,
81190
81667
  previewChars: limits.previewChars
81191
81668
  });
81192
- for (const path60 of answer.skipped ?? [])
81193
- skipped.add(path60);
81669
+ for (const path61 of answer.skipped ?? [])
81670
+ skipped.add(path61);
81194
81671
  return { messages: answer.messages, truncated: answer.truncated };
81195
81672
  },
81196
81673
  ...embedder !== void 0 && search !== void 0 && collection !== void 0 ? {
@@ -81489,9 +81966,9 @@ ${redact(shown2, cachedSecretValues)}` }
81489
81966
  });
81490
81967
  const all = result.folders.map((entry) => entry.path);
81491
81968
  const wanted = new Set(chosen);
81492
- for (const path60 of all) {
81493
- if (chosen.some((root) => path60 === root || path60.startsWith(`${root}\\`)))
81494
- wanted.add(path60);
81969
+ for (const path61 of all) {
81970
+ if (chosen.some((root) => path61 === root || path61.startsWith(`${root}\\`)))
81971
+ wanted.add(path61);
81495
81972
  }
81496
81973
  return [...wanted];
81497
81974
  } catch {
@@ -81499,7 +81976,7 @@ ${redact(shown2, cachedSecretValues)}` }
81499
81976
  }
81500
81977
  }
81501
81978
  async function handleRequestOutlookFolders(depth, force = false) {
81502
- const cachePath = import_node_path49.default.join(storageDir, "outlook-folders.json");
81979
+ const cachePath = import_node_path50.default.join(storageDir, "outlook-folders.json");
81503
81980
  let served = false;
81504
81981
  try {
81505
81982
  const cached2 = JSON.parse(await import_promises27.default.readFile(cachePath, "utf8"));
@@ -81519,7 +81996,7 @@ ${redact(shown2, cachedSecretValues)}` }
81519
81996
  const scannedAt = Date.now();
81520
81997
  post({ type: "outlookFolders", folders: result.folders, scannedAt });
81521
81998
  try {
81522
- await import_promises27.default.mkdir(import_node_path49.default.dirname(cachePath), { recursive: true });
81999
+ await import_promises27.default.mkdir(import_node_path50.default.dirname(cachePath), { recursive: true });
81523
82000
  await import_promises27.default.writeFile(cachePath, JSON.stringify({ scannedAt, folders: result.folders }), "utf8");
81524
82001
  } catch {
81525
82002
  }
@@ -81764,7 +82241,7 @@ ${redact(shown2, cachedSecretValues)}` }
81764
82241
  if (auth2.clientId === void 0 || auth2.clientSecretRef === void 0) {
81765
82242
  throw new AtlassianError("AutoSys uses the API gateway but the client id or secret is missing. Settings \u2192 DevOps \u2192 AutoSys \u2192 API gateway: enter both and save.");
81766
82243
  }
81767
- const key2 = JSON.stringify({ auth: auth2, baseUrl: config2.autosys?.baseUrl, tls: tls2 === void 0 ? 0 : (0, import_node_crypto14.createHash)("sha256").update(JSON.stringify(tls2)).digest("hex") });
82244
+ const key2 = JSON.stringify({ auth: auth2, baseUrl: config2.autosys?.baseUrl, tls: tls2 === void 0 ? 0 : (0, import_node_crypto15.createHash)("sha256").update(JSON.stringify(tls2)).digest("hex") });
81768
82245
  if (autosysGateway?.key === key2)
81769
82246
  return autosysGateway.strategy;
81770
82247
  const secretRef = auth2.clientSecretRef;
@@ -82185,7 +82662,7 @@ ${redact(shown2, cachedSecretValues)}` }
82185
82662
  approvalStamps.set("machine", stamp2);
82186
82663
  }
82187
82664
  for (const dir of python.toolDirectories()) {
82188
- const file2 = import_node_path49.default.join(dir, REGISTRY_FILE);
82665
+ const file2 = import_node_path50.default.join(dir, REGISTRY_FILE);
82189
82666
  const stamp2 = await import_promises27.default.stat(file2).then((stat) => stat.mtimeMs, () => 0);
82190
82667
  if (approvalStamps.has(file2) && approvalStamps.get(file2) !== stamp2)
82191
82668
  changed = true;
@@ -82276,7 +82753,7 @@ ${redact(shown2, cachedSecretValues)}` }
82276
82753
  return;
82277
82754
  }
82278
82755
  const folder = skill.filePath.slice(0, skill.filePath.length - "SKILL.md".length);
82279
- const bytes = await import_promises27.default.readFile(import_node_path49.default.join(folder, SKILL_IMAGE_DIR, image));
82756
+ const bytes = await import_promises27.default.readFile(import_node_path50.default.join(folder, SKILL_IMAGE_DIR, image));
82280
82757
  const dataUri = skillImageDataUri(image, bytes);
82281
82758
  post({
82282
82759
  type: "skillImage",
@@ -82604,13 +83081,13 @@ ${redact(shown2, cachedSecretValues)}` }
82604
83081
  }
82605
83082
  function docsFingerprintPath(index, storeId, kind) {
82606
83083
  const suffix = kind === void 0 ? "docs" : `docs.${kind}`;
82607
- return import_node_path49.default.join(manifestsRoot, "index-manifests", `${manifestKey(index, storeId)}.${suffix}.json`);
83084
+ return import_node_path50.default.join(manifestsRoot, "index-manifests", `${manifestKey(index, storeId)}.${suffix}.json`);
82608
83085
  }
82609
83086
  function manifestKey(index, storeId) {
82610
83087
  return `${index}@${storeId}`;
82611
83088
  }
82612
83089
  function manifestPath(index, storeId) {
82613
- return import_node_path49.default.join(manifestsRoot, "index-manifests", `${manifestKey(index, storeId)}.json`);
83090
+ return import_node_path50.default.join(manifestsRoot, "index-manifests", `${manifestKey(index, storeId)}.json`);
82614
83091
  }
82615
83092
  async function readDocsFingerprint(index, storeId, kind) {
82616
83093
  try {
@@ -82640,7 +83117,7 @@ ${redact(shown2, cachedSecretValues)}` }
82640
83117
  });
82641
83118
  const wanted = options.kind;
82642
83119
  const entries = wanted === void 0 ? all : all.filter((entry) => entry.kind === wanted);
82643
- const fingerprint = (0, import_node_crypto14.createHash)("sha256").update(`${wanted ?? "all"}:${embedder.model}:${String(embedder.dimensions)}`).update(entries.map((entry) => `${entry.id}\0${entry.text}`).join("")).digest("hex");
83120
+ const fingerprint = (0, import_node_crypto15.createHash)("sha256").update(`${wanted ?? "all"}:${embedder.model}:${String(embedder.dimensions)}`).update(entries.map((entry) => `${entry.id}\0${entry.text}`).join("")).digest("hex");
82644
83121
  if (!options.force && fingerprint === await readDocsFingerprint(index, search.id, wanted)) {
82645
83122
  return { unchanged: true, index, indexed: entries.length };
82646
83123
  }
@@ -82674,7 +83151,7 @@ ${redact(shown2, cachedSecretValues)}` }
82674
83151
  }
82675
83152
  options.report?.("Writing", { done: 0, total: documents.length });
82676
83153
  await writer.upsert(index, documents);
82677
- await import_promises27.default.mkdir(import_node_path49.default.dirname(docsFingerprintPath(index, search.id, wanted)), {
83154
+ await import_promises27.default.mkdir(import_node_path50.default.dirname(docsFingerprintPath(index, search.id, wanted)), {
82678
83155
  recursive: true
82679
83156
  });
82680
83157
  await import_promises27.default.writeFile(docsFingerprintPath(index, search.id, wanted), JSON.stringify({ fingerprint, indexedAt: Date.now(), count: documents.length }), "utf8");
@@ -82864,7 +83341,7 @@ ${redact(shown2, cachedSecretValues)}` }
82864
83341
  });
82865
83342
  if (manifest !== void 0) {
82866
83343
  const targetPath = manifestPath(index, target.id);
82867
- await import_promises27.default.mkdir(import_node_path49.default.dirname(targetPath), { recursive: true });
83344
+ await import_promises27.default.mkdir(import_node_path50.default.dirname(targetPath), { recursive: true });
82868
83345
  await import_promises27.default.writeFile(targetPath, JSON.stringify(manifest), "utf8");
82869
83346
  }
82870
83347
  post({ type: "storeSync", running: false, copied: result.copied, fromLabel: source.label });
@@ -82913,7 +83390,7 @@ ${redact(shown2, cachedSecretValues)}` }
82913
83390
  type: "project",
82914
83391
  hasWorkspace: workspaceRoot !== void 0,
82915
83392
  ...configured !== void 0 ? { configured } : {},
82916
- ...workspaceRoot !== void 0 ? { folder: import_node_path49.default.basename(workspaceRoot) } : {},
83393
+ ...workspaceRoot !== void 0 ? { folder: import_node_path50.default.basename(workspaceRoot) } : {},
82917
83394
  ...author !== void 0 ? { author } : {},
82918
83395
  ...index !== void 0 ? { indexName: index } : {},
82919
83396
  ...ownerConfigured !== void 0 && ownerConfigured.length > 0 ? { ownerConfigured } : {},
@@ -83053,8 +83530,8 @@ ${redact(shown2, cachedSecretValues)}` }
83053
83530
  if (workspaceRoot === void 0)
83054
83531
  return found2;
83055
83532
  const root = workspaceRoot;
83056
- const relative = import_node_path49.default.relative(root, folder);
83057
- if (relative.startsWith("..") || import_node_path49.default.isAbsolute(relative))
83533
+ const relative = import_node_path50.default.relative(root, folder);
83534
+ if (relative.startsWith("..") || import_node_path50.default.isAbsolute(relative))
83058
83535
  return found2;
83059
83536
  const output = await new Promise((resolve) => {
83060
83537
  const child = (0, import_node_child_process14.spawn)("git", ["-c", "core.quotePath=false", "log", "--diff-filter=A", "--relative", "--format=@@%an", "--name-only", "--", relative.length > 0 ? relative : "."], {
@@ -83071,7 +83548,7 @@ ${redact(shown2, cachedSecretValues)}` }
83071
83548
  if (line.startsWith("@@"))
83072
83549
  author = line.slice(2).trim();
83073
83550
  else if (line.trim().length > 0 && author !== void 0 && author.length > 0) {
83074
- found2.set(normalizeForComparison(import_node_path49.default.resolve(root, line.trim())), author);
83551
+ found2.set(normalizeForComparison(import_node_path50.default.resolve(root, line.trim())), author);
83075
83552
  }
83076
83553
  }
83077
83554
  return found2;
@@ -83115,7 +83592,7 @@ ${redact(shown2, cachedSecretValues)}` }
83115
83592
  },
83116
83593
  source,
83117
83594
  folder,
83118
- relative: import_node_path49.default.relative(folder, filePath).split(import_node_path49.default.sep).join("/")
83595
+ relative: import_node_path50.default.relative(folder, filePath).split(import_node_path50.default.sep).join("/")
83119
83596
  });
83120
83597
  };
83121
83598
  for (const folder of skillFolders) {
@@ -83133,7 +83610,7 @@ ${redact(shown2, cachedSecretValues)}` }
83133
83610
  const name = entry.slice(0, -3);
83134
83611
  if (!isValidToolName(name))
83135
83612
  continue;
83136
- await consider("tool", name, import_node_path49.default.join(folder, entry), folder, location);
83613
+ await consider("tool", name, import_node_path50.default.join(folder, entry), folder, location);
83137
83614
  }
83138
83615
  }
83139
83616
  const readOnly = skills.filter((skill) => skill.sourceDir !== void 0 && !skillFolders.some((folder) => samePath(folder, skill.sourceDir))).length;
@@ -83165,7 +83642,7 @@ ${redact(shown2, cachedSecretValues)}` }
83165
83642
  } catch {
83166
83643
  }
83167
83644
  }
83168
- const gitAuthor = gitAuthors.get(normalizeForComparison(import_node_path49.default.resolve(candidate.entry.filePath)));
83645
+ const gitAuthor = gitAuthors.get(normalizeForComparison(import_node_path50.default.resolve(candidate.entry.filePath)));
83169
83646
  if (gitAuthor !== void 0) {
83170
83647
  candidate.entry.suggestion = { author: gitAuthor, source: "git: the commit that added this file" };
83171
83648
  }
@@ -83274,7 +83751,7 @@ ${redact(shown2, cachedSecretValues)}` }
83274
83751
  aliases: plan2.kind === "codebase" ? codebaseAliases(config2) : plan2.kind === "skills" ? skillAliases(config2) : [],
83275
83752
  onProgress: (count3) => post({ type: "indexRenames", running: true, plans, store, current: plan2.to, copied: count3 })
83276
83753
  });
83277
- await copyBookkeeping(import_node_path49.default.join(manifestsRoot, "index-manifests"), plan2.from, plan2.to, search.id);
83754
+ await copyBookkeeping(import_node_path50.default.join(manifestsRoot, "index-manifests"), plan2.from, plan2.to, search.id);
83278
83755
  done.push({ ...plan2, copied });
83279
83756
  }
83280
83757
  post({ type: "indexRenames", running: false, plans: [], store, done });
@@ -83304,7 +83781,7 @@ ${redact(shown2, cachedSecretValues)}` }
83304
83781
  project: projectName(config2, workspaceRoot),
83305
83782
  aliases: codebaseAliases(config2)
83306
83783
  });
83307
- await copyBookkeeping(import_node_path49.default.join(manifestsRoot, "index-manifests"), legacy, current, search.id);
83784
+ await copyBookkeeping(import_node_path50.default.join(manifestsRoot, "index-manifests"), legacy, current, search.id);
83308
83785
  post({ type: "indexRenames", running: false, plans: [], done: [{ kind: "codebase", from: legacy, to: current, copied }] });
83309
83786
  logger.info(`copied ${String(copied)} chunks from ${legacy} to ${current} rather than re-embedding them`);
83310
83787
  }
@@ -83470,7 +83947,7 @@ ${redact(shown2, cachedSecretValues)}` }
83470
83947
  denylist,
83471
83948
  manifest,
83472
83949
  saveManifest: async (next) => {
83473
- await import_promises27.default.mkdir(import_node_path49.default.dirname(manifestFile), { recursive: true });
83950
+ await import_promises27.default.mkdir(import_node_path50.default.dirname(manifestFile), { recursive: true });
83474
83951
  await import_promises27.default.writeFile(manifestFile, JSON.stringify(next), "utf8");
83475
83952
  },
83476
83953
  ...isIgnored2 !== void 0 ? { isIgnored: isIgnored2 } : {},
@@ -83517,9 +83994,9 @@ ${redact(shown2, cachedSecretValues)}` }
83517
83994
  }
83518
83995
  const usageLog = new UsageLog(storageDir);
83519
83996
  const usageInstance = usageInstanceId(storageDir);
83520
- const usageProfileFile = import_node_path49.default.join(storageDir, "usage-profile.json");
83521
- const legacyBackfillFile = import_node_path49.default.join(storageDir, "usage-backfill.json");
83522
- const usageDir = import_node_path49.default.join(storageDir, "usage");
83997
+ const usageProfileFile = import_node_path50.default.join(storageDir, "usage-profile.json");
83998
+ const legacyBackfillFile = import_node_path50.default.join(storageDir, "usage-backfill.json");
83999
+ const usageDir = import_node_path50.default.join(storageDir, "usage");
83523
84000
  const toolStartedAt = /* @__PURE__ */ new Map();
83524
84001
  let usagePushTimer;
83525
84002
  let usagePushing;
@@ -83537,7 +84014,7 @@ ${redact(shown2, cachedSecretValues)}` }
83537
84014
  return (request) => runFastFs(exe, request);
83538
84015
  }
83539
84016
  function skillAtPath(requested2) {
83540
- const absolute = import_node_path49.default.isAbsolute(requested2) ? requested2 : workspaceRoot === void 0 ? void 0 : import_node_path49.default.resolve(workspaceRoot, requested2);
84017
+ const absolute = import_node_path50.default.isAbsolute(requested2) ? requested2 : workspaceRoot === void 0 ? void 0 : import_node_path50.default.resolve(workspaceRoot, requested2);
83541
84018
  if (absolute === void 0)
83542
84019
  return void 0;
83543
84020
  return skills.find((skill) => samePath(skill.filePath, absolute));
@@ -83610,7 +84087,7 @@ ${redact(shown2, cachedSecretValues)}` }
83610
84087
  const folder = chosen.path?.trim();
83611
84088
  if (folder === void 0 || folder.length === 0)
83612
84089
  return { problem: "The shared folder has no path." };
83613
- if (!import_node_path49.default.isAbsolute(folder))
84090
+ if (!import_node_path50.default.isAbsolute(folder))
83614
84091
  return { problem: `"${folder}" is not an absolute path. Use the full path of a folder everybody can reach, such as a network share.` };
83615
84092
  const helper = usageHelper();
83616
84093
  return { store: new FolderShardStore(folder, ...helper !== void 0 ? [helper] : []), target };
@@ -83639,7 +84116,7 @@ ${redact(shown2, cachedSecretValues)}` }
83639
84116
  }
83640
84117
  async function readUsageBackfill() {
83641
84118
  try {
83642
- const text = await import_promises27.default.readFile(import_node_path49.default.join(usageDir, "backfill.json"), "utf8").catch(() => import_promises27.default.readFile(legacyBackfillFile, "utf8"));
84119
+ const text = await import_promises27.default.readFile(import_node_path50.default.join(usageDir, "backfill.json"), "utf8").catch(() => import_promises27.default.readFile(legacyBackfillFile, "utf8"));
83643
84120
  const saved = JSON.parse(text);
83644
84121
  if (typeof saved.at !== "number")
83645
84122
  return void 0;
@@ -83655,7 +84132,7 @@ ${redact(shown2, cachedSecretValues)}` }
83655
84132
  legacyDoneFile: legacyBackfillFile,
83656
84133
  run: async (before) => {
83657
84134
  const status2 = python.status();
83658
- return backfillFromTasks(import_node_path49.default.join(storageDir, "tasks"), {
84135
+ return backfillFromTasks(import_node_path50.default.join(storageDir, "tasks"), {
83659
84136
  user: cachedAttribution.author ?? "unknown",
83660
84137
  project: cachedAttribution.project,
83661
84138
  workspaceRoot,
@@ -83753,7 +84230,7 @@ ${redact(shown2, cachedSecretValues)}` }
83753
84230
  try {
83754
84231
  const text = (await import_promises27.default.readFile(file2, "utf8")).replace(/\r\n/g, "\n");
83755
84232
  const meaningful = text.split("\n").filter((line) => !/^(author|project|version|updated)\s*:/i.test(line) && !/^__(author|project|version|updated)__\s*=/.test(line)).join("\n").trim();
83756
- return (0, import_node_crypto14.createHash)("sha256").update(meaningful).digest("hex").slice(0, 16);
84233
+ return (0, import_node_crypto15.createHash)("sha256").update(meaningful).digest("hex").slice(0, 16);
83757
84234
  } catch {
83758
84235
  return void 0;
83759
84236
  }
@@ -83828,14 +84305,14 @@ ${redact(shown2, cachedSecretValues)}` }
83828
84305
  kind: "tool",
83829
84306
  name: issue2.name,
83830
84307
  filePath: issue2.filePath,
83831
- deletable: samePath(import_node_path49.default.dirname(issue2.filePath), status2.toolsDir),
83832
- location: where(import_node_path49.default.dirname(issue2.filePath), status2.toolsDir),
84308
+ deletable: samePath(import_node_path50.default.dirname(issue2.filePath), status2.toolsDir),
84309
+ location: where(import_node_path50.default.dirname(issue2.filePath), status2.toolsDir),
83833
84310
  issue: issue2.kind === "unapproved" ? "waiting for approval" : issue2.kind === "hash-mismatch" ? "changed since approval" : issue2.detail.split("\n")[0] ?? "not loaded"
83834
84311
  });
83835
84312
  }
83836
84313
  return items;
83837
84314
  }
83838
- const usageDirectoryFile = import_node_path49.default.join(storageDir, "usage-directory.json");
84315
+ const usageDirectoryFile = import_node_path50.default.join(storageDir, "usage-directory.json");
83839
84316
  let directoryRunning;
83840
84317
  async function readDirectoryCache() {
83841
84318
  try {
@@ -84167,7 +84644,7 @@ ${redact(shown2, cachedSecretValues)}` }
84167
84644
  let indexedFiles = 0;
84168
84645
  if (index !== void 0) {
84169
84646
  try {
84170
- const manifest = JSON.parse(await import_promises27.default.readFile(import_node_path49.default.join(manifestsRoot, "index-manifests", `${index}.json`), "utf8"));
84647
+ const manifest = JSON.parse(await import_promises27.default.readFile(import_node_path50.default.join(manifestsRoot, "index-manifests", `${index}.json`), "utf8"));
84171
84648
  indexedFiles = Object.keys(manifest.files ?? {}).length;
84172
84649
  } catch {
84173
84650
  }
@@ -84439,7 +84916,7 @@ ${redact(shown2, cachedSecretValues)}` }
84439
84916
  return;
84440
84917
  }
84441
84918
  const { config: config2 } = await configManager.load();
84442
- const id = input.id ?? (0, import_node_crypto14.randomUUID)();
84919
+ const id = input.id ?? (0, import_node_crypto15.randomUUID)();
84443
84920
  if (input.username !== void 0 && input.username.length > 0)
84444
84921
  await secrets.set(searchUserRefFor(id), input.username);
84445
84922
  if (input.password !== void 0 && input.password.length > 0)
@@ -84735,7 +85212,7 @@ ${redact(shown2, cachedSecretValues)}` }
84735
85212
  if (changeLedger !== void 0) {
84736
85213
  const shared = await changeLedger.othersSince(targets, taskCheckpoint.createdAt);
84737
85214
  if (shared.size > 0) {
84738
- const shown2 = (file2) => import_node_path49.default.relative(workspaceRoot ?? "", file2).split(import_node_path49.default.sep).join("/");
85215
+ const shown2 = (file2) => import_node_path50.default.relative(workspaceRoot ?? "", file2).split(import_node_path50.default.sep).join("/");
84739
85216
  const detail = [...shared].map(([file2, chats]) => `${shown2(file2)} (${chats.join(", ")})`).join("; ");
84740
85217
  const all = await ui.showActionMessage(`Another chat also changed ${String(shared.size)} of these files after this chat started: ${detail}. Rolling them back would undo that chat's changes too.`, "Roll those back too", "warning");
84741
85218
  if (!all) {
@@ -84933,7 +85410,7 @@ ${redact(shown2, cachedSecretValues)}` }
84933
85410
  const pathRequest = pendingPathApprovals.get(id);
84934
85411
  userGate.resolve(id, "approve");
84935
85412
  if (pathRequest !== void 0) {
84936
- const folder = import_node_path49.default.dirname(pathRequest);
85413
+ const folder = import_node_path50.default.dirname(pathRequest);
84937
85414
  sessionPathGrants.add(normalizeForComparison(pathRequest));
84938
85415
  if (scope === "folder" && !cachedReadRoots.includes(folder)) {
84939
85416
  const { config: config2 } = await configManager.load();
@@ -85173,10 +85650,10 @@ ${redact(shown2, cachedSecretValues)}` }
85173
85650
  });
85174
85651
  return;
85175
85652
  }
85176
- let dir = import_node_path49.default.dirname(import_node_path49.default.resolve(scriptPath));
85653
+ let dir = import_node_path50.default.dirname(import_node_path50.default.resolve(scriptPath));
85177
85654
  for (let depth = 0; depth < 3; depth++) {
85178
85655
  for (const name of VENV_DIR_NAMES) {
85179
- const candidate = import_node_path49.default.join(dir, name);
85656
+ const candidate = import_node_path50.default.join(dir, name);
85180
85657
  const found2 = await search(candidate);
85181
85658
  if (found2 !== void 0) {
85182
85659
  post({
@@ -85188,7 +85665,7 @@ ${redact(shown2, cachedSecretValues)}` }
85188
85665
  return;
85189
85666
  }
85190
85667
  }
85191
- const parent = import_node_path49.default.dirname(dir);
85668
+ const parent = import_node_path50.default.dirname(dir);
85192
85669
  if (parent === dir)
85193
85670
  break;
85194
85671
  dir = parent;
@@ -85506,6 +85983,16 @@ ${redact(shown2, cachedSecretValues)}` }
85506
85983
  reportFailure("handleClearCodebaseIndex", handleClearCodebaseIndex());
85507
85984
  } else if (message4.type === "openStandingSkill") {
85508
85985
  reportFailure("handleOpenStandingSkill", handleOpenStandingSkill());
85986
+ } else if (message4.type === "requestAddonPage") {
85987
+ reportFailure("postAddonPage", postAddonPage(message4.package));
85988
+ } else if (message4.type === "saveAddonRecord") {
85989
+ reportFailure("handleSaveAddonRecord", handleSaveAddonRecord(message4));
85990
+ } else if (message4.type === "deleteAddonRecord") {
85991
+ reportFailure("handleDeleteAddonRecord", handleDeleteAddonRecord(message4.package, message4.id));
85992
+ } else if (message4.type === "saveAddonValues") {
85993
+ reportFailure("handleSaveAddonValues", handleSaveAddonValues(message4));
85994
+ } else if (message4.type === "runAddonAction") {
85995
+ reportFailure("handleRunAddonAction", handleRunAddonAction(message4.package, message4.id, message4.tool));
85509
85996
  } else if (message4.type === "requestAddons") {
85510
85997
  reportFailure("postAddons", postAddons());
85511
85998
  } else if (message4.type === "enableAddon") {
@@ -86019,11 +86506,11 @@ Could not be drawn: ${entry.message}`);
86019
86506
  let lastReportPath;
86020
86507
  async function saveReport(title, contents) {
86021
86508
  try {
86022
- const directory = import_node_path49.default.join(storageDir, "reports");
86509
+ const directory = import_node_path50.default.join(storageDir, "reports");
86023
86510
  await import_promises27.default.mkdir(directory, { recursive: true });
86024
86511
  const stamp2 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
86025
86512
  const slug = title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60);
86026
- const target = import_node_path49.default.join(directory, `${stamp2}${slug.length > 0 ? `-${slug}` : ""}.md`);
86513
+ const target = import_node_path50.default.join(directory, `${stamp2}${slug.length > 0 ? `-${slug}` : ""}.md`);
86027
86514
  await import_promises27.default.writeFile(target, `# ${title}
86028
86515
 
86029
86516
  ${contents}
@@ -86039,7 +86526,7 @@ ${contents}
86039
86526
  const keep = 100;
86040
86527
  const entries = (await import_promises27.default.readdir(directory)).filter((name) => name.endsWith(".md")).sort();
86041
86528
  for (const name of entries.slice(0, Math.max(0, entries.length - keep))) {
86042
- await import_promises27.default.rm(import_node_path49.default.join(directory, name), { force: true });
86529
+ await import_promises27.default.rm(import_node_path50.default.join(directory, name), { force: true });
86043
86530
  }
86044
86531
  }
86045
86532
  let scheduleTimer;
@@ -86112,7 +86599,7 @@ ${contents}
86112
86599
  async function handleSaveSchedule(schedule) {
86113
86600
  try {
86114
86601
  const schedules = await loadSchedules();
86115
- const id = schedule.id.length > 0 ? schedule.id : (0, import_node_crypto14.createHash)("sha256").update(`${schedule.name}:${String(Date.now())}`).digest("hex").slice(0, 12);
86602
+ const id = schedule.id.length > 0 ? schedule.id : (0, import_node_crypto15.createHash)("sha256").update(`${schedule.name}:${String(Date.now())}`).digest("hex").slice(0, 12);
86116
86603
  const armed = { ...schedule, id, nextRunAt: nextFireTime(schedule, Date.now()) };
86117
86604
  await saveSchedules({ ...schedules, [id]: armed });
86118
86605
  } catch (error51) {
@@ -86121,7 +86608,7 @@ ${contents}
86121
86608
  }
86122
86609
  async function createScheduleFromProposal(proposal) {
86123
86610
  const schedules = await loadSchedules();
86124
- const id = (0, import_node_crypto14.createHash)("sha256").update(`${proposal.name}:${String(Date.now())}`).digest("hex").slice(0, 12);
86611
+ const id = (0, import_node_crypto15.createHash)("sha256").update(`${proposal.name}:${String(Date.now())}`).digest("hex").slice(0, 12);
86125
86612
  const schedule = {
86126
86613
  id,
86127
86614
  name: proposal.name,
@@ -86152,10 +86639,10 @@ ${contents}
86152
86639
  }
86153
86640
  const CLAIM_STALE_MS = 60 * 60 * 1e3;
86154
86641
  async function claimSchedule(id) {
86155
- const claimPath = import_node_path49.default.join(storageDir, "schedule-claims", `${id}.json`);
86642
+ const claimPath = import_node_path50.default.join(storageDir, "schedule-claims", `${id}.json`);
86156
86643
  const mine = JSON.stringify({ pid: process.pid, at: Date.now() });
86157
86644
  try {
86158
- await import_promises27.default.mkdir(import_node_path49.default.dirname(claimPath), { recursive: true });
86645
+ await import_promises27.default.mkdir(import_node_path50.default.dirname(claimPath), { recursive: true });
86159
86646
  await import_promises27.default.writeFile(claimPath, mine, { encoding: "utf8", flag: "wx" });
86160
86647
  return true;
86161
86648
  } catch (error51) {
@@ -86180,7 +86667,7 @@ ${contents}
86180
86667
  }
86181
86668
  }
86182
86669
  async function releaseSchedule(id) {
86183
- await import_promises27.default.rm(import_node_path49.default.join(storageDir, "schedule-claims", `${id}.json`), { force: true }).catch(() => void 0);
86670
+ await import_promises27.default.rm(import_node_path50.default.join(storageDir, "schedule-claims", `${id}.json`), { force: true }).catch(() => void 0);
86184
86671
  }
86185
86672
  async function runSchedule(id, reason) {
86186
86673
  if (reason === "due" && !await claimSchedule(id))
@@ -86848,11 +87335,11 @@ function createShowDiagramTool() {
86848
87335
 
86849
87336
  // ../../packages/core/dist/lsp/manager.js
86850
87337
  var import_promises28 = __toESM(require("node:fs/promises"), 1);
86851
- var import_node_path51 = __toESM(require("node:path"), 1);
87338
+ var import_node_path52 = __toESM(require("node:path"), 1);
86852
87339
 
86853
87340
  // ../../packages/core/dist/lsp/catalog.js
86854
87341
  var import_node_fs11 = require("node:fs");
86855
- var import_node_path50 = __toESM(require("node:path"), 1);
87342
+ var import_node_path51 = __toESM(require("node:path"), 1);
86856
87343
  var c = (command, ...args) => ({ command, args });
86857
87344
  var LSP_LANGUAGES = [
86858
87345
  { id: "python", label: "Python", extensions: ["py", "pyi"], candidates: [c("pyright-langserver", "--stdio"), c("basedpyright-langserver", "--stdio"), c("pylsp"), c("jedi-language-server")] },
@@ -86900,16 +87387,16 @@ var LSP_LANGUAGES = [
86900
87387
  { id: "sql", label: "SQL", extensions: ["sql"], candidates: [c("sql-language-server", "up", "--method", "stdio")] }
86901
87388
  ];
86902
87389
  function languageFor(file2) {
86903
- const ext = import_node_path50.default.extname(file2).slice(1).toLowerCase();
87390
+ const ext = import_node_path51.default.extname(file2).slice(1).toLowerCase();
86904
87391
  return LSP_LANGUAGES.find((l) => l.extensions.includes(ext));
86905
87392
  }
86906
87393
  function languageIdFor(language, file2) {
86907
- const ext = import_node_path50.default.extname(file2).slice(1).toLowerCase();
87394
+ const ext = import_node_path51.default.extname(file2).slice(1).toLowerCase();
86908
87395
  return language.languageIdFor?.(ext) ?? language.id;
86909
87396
  }
86910
87397
  var found = /* @__PURE__ */ new Map();
86911
87398
  function findOnPath(command, env2 = process.env) {
86912
- if (import_node_path50.default.isAbsolute(command))
87399
+ if (import_node_path51.default.isAbsolute(command))
86913
87400
  return (0, import_node_fs11.existsSync)(command) ? command : void 0;
86914
87401
  if (env2 !== process.env)
86915
87402
  return searchPath(command, env2);
@@ -86921,11 +87408,11 @@ function findOnPath(command, env2 = process.env) {
86921
87408
  return value;
86922
87409
  }
86923
87410
  function searchPath(command, env2) {
86924
- const dirs = (env2.PATH ?? env2.Path ?? "").split(import_node_path50.default.delimiter).filter((d) => d.length > 0);
87411
+ const dirs = (env2.PATH ?? env2.Path ?? "").split(import_node_path51.default.delimiter).filter((d) => d.length > 0);
86925
87412
  const exts = process.platform === "win32" ? ["", ...(env2.PATHEXT ?? ".EXE;.CMD;.BAT").toLowerCase().split(";")] : [""];
86926
87413
  for (const dir of dirs) {
86927
87414
  for (const ext of exts) {
86928
- const candidate = import_node_path50.default.join(dir, command + ext);
87415
+ const candidate = import_node_path51.default.join(dir, command + ext);
86929
87416
  if ((0, import_node_fs11.existsSync)(candidate) && (process.platform !== "win32" || ext !== "" || /\.(exe|cmd|bat)$/i.test(candidate)))
86930
87417
  return candidate;
86931
87418
  }
@@ -87157,7 +87644,7 @@ var LspManager = class {
87157
87644
  return void 0;
87158
87645
  const args = [...found2.candidate.args];
87159
87646
  if (language.id === "java" && !args.includes("-data"))
87160
- args.push("-data", import_node_path51.default.join(this.storageDir, "jdtls-workspace"));
87647
+ args.push("-data", import_node_path52.default.join(this.storageDir, "jdtls-workspace"));
87161
87648
  try {
87162
87649
  client = new LspClient(found2.executable, args, this.root, this.log);
87163
87650
  this.clients.set(language.id, client);
@@ -87178,7 +87665,7 @@ var LspManager = class {
87178
87665
  this.failed.set(language.id, client.lastError ?? "stopped");
87179
87666
  return void 0;
87180
87667
  }
87181
- return { server: import_node_path51.default.basename(client.executable).replace(/\.(exe|cmd|bat)$/i, ""), diagnostics: diagnostics ?? [] };
87668
+ return { server: import_node_path52.default.basename(client.executable).replace(/\.(exe|cmd|bat)$/i, ""), diagnostics: diagnostics ?? [] };
87182
87669
  } catch (error51) {
87183
87670
  this.failed.set(language.id, error51 instanceof Error ? error51.message : String(error51));
87184
87671
  client.dispose();
@@ -89174,7 +89661,19 @@ desktops of the same person; importing the file is how a second machine is set u
89174
89661
  "hub_browse",
89175
89662
  "browse the hub",
89176
89663
  "other codebase hub",
89177
- "files on the hub"
89664
+ "files on the hub",
89665
+ "hubignore",
89666
+ ".hubignore",
89667
+ "ignore files",
89668
+ "do not sync",
89669
+ "not synced",
89670
+ "exclude from sync",
89671
+ "skip folder",
89672
+ "node_modules",
89673
+ "dist folder",
89674
+ "angular",
89675
+ "build output",
89676
+ "sync ignore"
89178
89677
  ],
89179
89678
  body: `
89180
89679
  **Add codebase \u2192 On JupyterHub** (Fire Code): the hub's address, your hub user name, the folders on
@@ -89184,6 +89683,14 @@ on the hub's Token page (\`<hub>/hub/token\`). The token is saved encrypted in C
89184
89683
  a kernel (e.g. python3). Right-click the codebase \u2192 JupyterHub settings\u2026 changes them later.
89185
89684
  Your hub server must be running; if it is not, the agent says so - start it from the hub's home page.
89186
89685
 
89686
+ **\`.hubignore\`** lists files and folders that are never synced, either way - \`.gitignore\` syntax
89687
+ (\`dist/\`, \`*.log\`, \`/build/\`, \`!keep.me\`), in any synced folder, applying beneath it. Dot-files and
89688
+ dot-folders, \`node_modules\`, \`.git\`, virtualenvs and Python caches are skipped already; \`!.editorconfig\`
89689
+ brings one back. The \`.hubignore\` file itself is synced, so the hub and other machines follow it too.
89690
+ A file synced before a rule listed it just stops being synced - nothing is deleted on either side. For
89691
+ an Angular project: \`dist/\`, \`.angular/\`, \`out-tsc/\`, \`coverage/\`, \`*.log\`. The agent writes one
89692
+ when it sets up such a project, before installing or building, and says what it put in it.
89693
+
89187
89694
  **How it works**: Fire Code keeps a copy of the folders on this computer, so reading and searching
89188
89695
  are as fast as for any local codebase (and the Rust search tools apply). Changes on the hub are
89189
89696
  fetched when the agent starts and every 5 minutes; \`hub_sync\` "pull" fetches now. Every edit the
@@ -89491,7 +89998,23 @@ Settings \u2192 Export source code saves the whole repository as a zip that buil
89491
89998
  "fire code addon",
89492
89999
  "addon for light code",
89493
90000
  "light code addon",
89494
- "addon tools"
90001
+ "addon tools",
90002
+ "linux",
90003
+ "linux machine",
90004
+ "linux server",
90005
+ "ssh",
90006
+ "putty",
90007
+ "plink",
90008
+ "pageant",
90009
+ "remote server",
90010
+ "connect to a server",
90011
+ "run a command on a server",
90012
+ "download a log",
90013
+ "jump host",
90014
+ "bastion",
90015
+ "host key",
90016
+ "addon tab",
90017
+ "linux tab"
89495
90018
  ],
89496
90019
  body: `
89497
90020
  **An add-on is an npm package that runs an MCP server**, labelled in its \`package.json\`:
@@ -89522,6 +90045,24 @@ can never switch an add-on on. \`addons.folders\` is user-scope only.
89522
90045
 
89523
90046
  **Add-ons run as you and can do anything you can.** Only install ones you trust. They run with the
89524
90047
  editor's own Node inside VS Code, so no Node install is needed there; Fire Code uses its Node.
90048
+
90049
+ **An add-on can bring its own settings tab**, with its own icon - it appears in Settings only while
90050
+ the add-on is installed. The add-on describes the fields in \`package.json\`
90051
+ (\`lightCode.addon.settings\`: a title, its own fields, and a list such as "machines" with buttons like
90052
+ Test connection); Light Code draws the form. What you enter is kept in your settings, passwords in
90053
+ secret storage, and the add-on receives them when it starts - saving the tab restarts it.
90054
+
90055
+ **The Linux add-on** (\`npm i -g @chosengeneration/light-code-addon-linux\`): enable it in Settings \u2192
90056
+ MCP \u2192 Add-ons, then add machines on its **Linux** tab, each with a short label (\`prod-web-1\`), host, user
90057
+ and sign-in (Pageant - the default - the Windows OpenSSH agent, a key file, or a password), and press
90058
+ Test connection. The assistant can then list the machines, **run read-only commands** (\`df -h\`, \`tail\`,
90059
+ \`grep\`, \`ps\`, \`journalctl\`, \`systemctl status\`, \`docker ps\`... joined with \`|\`; nothing that writes,
90060
+ chains or never ends is sent) and **download a file** to read here. SSH runs inside Node - no plink, no
90061
+ ssh.exe, no new program - with one sign-in per machine reused, and a refused sign-in never retried, so
90062
+ it does not set off security monitoring or lock an account. Host keys are trusted the first time and
90063
+ checked after; a changed key is refused until you press Forget host key. A machine behind a bastion:
90064
+ add the bastion too and put its label in *Connect through*. Newer PuTTY keys (.ppk version 3): load
90065
+ them into Pageant, or export an OpenSSH key from PuTTYgen.
89525
90066
  `
89526
90067
  },
89527
90068
  {
@@ -90398,7 +90939,7 @@ function createLightCodeHelpTool() {
90398
90939
 
90399
90940
  // ../../packages/core/dist/tools/listFiles.js
90400
90941
  var import_node_child_process16 = require("node:child_process");
90401
- var import_node_path52 = __toESM(require("node:path"), 1);
90942
+ var import_node_path53 = __toESM(require("node:path"), 1);
90402
90943
 
90403
90944
  // ../../packages/core/dist/tools/ripgrepError.js
90404
90945
  function ripgrepDidNotStart(error51) {
@@ -90479,7 +91020,7 @@ var listFilesTool = {
90479
91020
  });
90480
91021
  if (files.length === 0)
90481
91022
  return noFiles;
90482
- const listed = files.map((file2) => file2.split("/").join(import_node_path52.default.sep)).join("\n");
91023
+ const listed = files.map((file2) => file2.split("/").join(import_node_path53.default.sep)).join("\n");
90483
91024
  return { content: truncated ? `${listed}
90484
91025
  (listing cut short \u2014 list a narrower folder)` : listed };
90485
91026
  }
@@ -90707,7 +91248,7 @@ var searchFilesTool = {
90707
91248
  };
90708
91249
 
90709
91250
  // ../../packages/core/dist/tools/writeToFile.js
90710
- var import_node_path53 = __toESM(require("node:path"), 1);
91251
+ var import_node_path54 = __toESM(require("node:path"), 1);
90711
91252
  var paramsSchema23 = external_exports.object({
90712
91253
  path: external_exports.string().min(1).describe("Path to the file, relative to the workspace root."),
90713
91254
  content: external_exports.string().describe("Full file content to write.")
@@ -90735,7 +91276,7 @@ var writeToFileTool = {
90735
91276
  return { content: changed, isError: true, path: params3.path };
90736
91277
  }
90737
91278
  if (!exists2) {
90738
- await context.fs.mkdir(import_node_path53.default.dirname(resolved.realPath));
91279
+ await context.fs.mkdir(import_node_path54.default.dirname(resolved.realPath));
90739
91280
  }
90740
91281
  await context.fs.writeFile(resolved.realPath, params3.content);
90741
91282
  await recordWrite(context, resolved.realPath);
@@ -90837,14 +91378,14 @@ function createDefaultToolRegistry() {
90837
91378
 
90838
91379
  // ../../packages/core/dist/dataset/store.js
90839
91380
  var import_promises29 = __toESM(require("node:fs/promises"), 1);
90840
- var import_node_path54 = __toESM(require("node:path"), 1);
91381
+ var import_node_path55 = __toESM(require("node:path"), 1);
90841
91382
  var DatasetStore = class {
90842
91383
  filePath;
90843
91384
  statePath;
90844
91385
  constructor(storageDir, datasetId) {
90845
91386
  const safe = datasetId.replace(/[^A-Za-z0-9._-]/g, "_");
90846
- this.filePath = import_node_path54.default.join(storageDir, "datasets", `${safe}.jsonl`);
90847
- this.statePath = import_node_path54.default.join(storageDir, "datasets", `${safe}.state.json`);
91387
+ this.filePath = import_node_path55.default.join(storageDir, "datasets", `${safe}.jsonl`);
91388
+ this.statePath = import_node_path55.default.join(storageDir, "datasets", `${safe}.state.json`);
90848
91389
  }
90849
91390
  /** Every record. A malformed line is skipped — one bad line costs one record, not the corpus. */
90850
91391
  async load() {
@@ -90872,7 +91413,7 @@ var DatasetStore = class {
90872
91413
  async append(records) {
90873
91414
  if (records.length === 0)
90874
91415
  return;
90875
- await import_promises29.default.mkdir(import_node_path54.default.dirname(this.filePath), { recursive: true });
91416
+ await import_promises29.default.mkdir(import_node_path55.default.dirname(this.filePath), { recursive: true });
90876
91417
  await import_promises29.default.writeFile(this.filePath, "", { flag: "a" });
90877
91418
  const lines = records.map((record2) => JSON.stringify(record2)).join("\n");
90878
91419
  await import_promises29.default.appendFile(this.filePath, `${lines}
@@ -90880,7 +91421,7 @@ var DatasetStore = class {
90880
91421
  }
90881
91422
  /** Rewrites with exactly these. Temp-and-rename, so an interrupted prune leaves the old file. */
90882
91423
  async replace(records) {
90883
- await import_promises29.default.mkdir(import_node_path54.default.dirname(this.filePath), { recursive: true });
91424
+ await import_promises29.default.mkdir(import_node_path55.default.dirname(this.filePath), { recursive: true });
90884
91425
  const temporary = `${this.filePath}.tmp`;
90885
91426
  const body = records.map((record2) => JSON.stringify(record2)).join("\n");
90886
91427
  await import_promises29.default.writeFile(temporary, records.length === 0 ? "" : `${body}
@@ -90934,7 +91475,7 @@ var DatasetStore = class {
90934
91475
  }
90935
91476
  }
90936
91477
  async recordSync(at) {
90937
- await import_promises29.default.mkdir(import_node_path54.default.dirname(this.statePath), { recursive: true });
91478
+ await import_promises29.default.mkdir(import_node_path55.default.dirname(this.statePath), { recursive: true });
90938
91479
  const temporary = `${this.statePath}.tmp`;
90939
91480
  await import_promises29.default.writeFile(temporary, JSON.stringify({ lastSyncedAt: at }), "utf8");
90940
91481
  await replaceFile(temporary, this.statePath);
@@ -91271,8 +91812,8 @@ That is a fault in the tool itself, or the source is unreachable from here. Fix
91271
91812
  }
91272
91813
 
91273
91814
  // ../../packages/core/dist/s3/sigv4.js
91274
- var import_node_crypto15 = require("node:crypto");
91275
- var EMPTY_PAYLOAD_SHA256 = (0, import_node_crypto15.createHash)("sha256").update("").digest("hex");
91815
+ var import_node_crypto16 = require("node:crypto");
91816
+ var EMPTY_PAYLOAD_SHA256 = (0, import_node_crypto16.createHash)("sha256").update("").digest("hex");
91276
91817
  function encodeSegment(segment) {
91277
91818
  return encodeURIComponent(segment).replace(/[!'()*]/g, (character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`);
91278
91819
  }
@@ -91296,10 +91837,10 @@ function amzDate(now) {
91296
91837
  return `${now.toISOString().replace(/[-:]/g, "").slice(0, 15)}Z`;
91297
91838
  }
91298
91839
  function signingKey(secretAccessKey, date5, region, service) {
91299
- const dateKey = (0, import_node_crypto15.createHmac)("sha256", `AWS4${secretAccessKey}`).update(date5).digest();
91300
- const regionKey = (0, import_node_crypto15.createHmac)("sha256", dateKey).update(region).digest();
91301
- const serviceKey = (0, import_node_crypto15.createHmac)("sha256", regionKey).update(service).digest();
91302
- return (0, import_node_crypto15.createHmac)("sha256", serviceKey).update("aws4_request").digest();
91840
+ const dateKey = (0, import_node_crypto16.createHmac)("sha256", `AWS4${secretAccessKey}`).update(date5).digest();
91841
+ const regionKey = (0, import_node_crypto16.createHmac)("sha256", dateKey).update(region).digest();
91842
+ const serviceKey = (0, import_node_crypto16.createHmac)("sha256", regionKey).update(service).digest();
91843
+ return (0, import_node_crypto16.createHmac)("sha256", serviceKey).update("aws4_request").digest();
91303
91844
  }
91304
91845
  function signRequest(input) {
91305
91846
  const service = input.service ?? "s3";
@@ -91308,7 +91849,7 @@ function signRequest(input) {
91308
91849
  const date5 = timestamp.slice(0, 8);
91309
91850
  const url2 = new URL(input.url);
91310
91851
  const body = input.body ?? Buffer.alloc(0);
91311
- const payloadHash = (0, import_node_crypto15.createHash)("sha256").update(body).digest("hex");
91852
+ const payloadHash = (0, import_node_crypto16.createHash)("sha256").update(body).digest("hex");
91312
91853
  const headers = {
91313
91854
  ...input.headers,
91314
91855
  host: url2.host,
@@ -91332,9 +91873,9 @@ function signRequest(input) {
91332
91873
  "AWS4-HMAC-SHA256",
91333
91874
  timestamp,
91334
91875
  scope,
91335
- (0, import_node_crypto15.createHash)("sha256").update(canonicalRequest).digest("hex")
91876
+ (0, import_node_crypto16.createHash)("sha256").update(canonicalRequest).digest("hex")
91336
91877
  ].join("\n");
91337
- const signature = (0, import_node_crypto15.createHmac)("sha256", signingKey(input.secretAccessKey, date5, input.region, service)).update(stringToSign).digest("hex");
91878
+ const signature = (0, import_node_crypto16.createHmac)("sha256", signingKey(input.secretAccessKey, date5, input.region, service)).update(stringToSign).digest("hex");
91338
91879
  return {
91339
91880
  headers: {
91340
91881
  ...headers,
@@ -91364,8 +91905,8 @@ var S3Client = class {
91364
91905
  const host = inPath ? origin.host : `${bucket}.${origin.host}`;
91365
91906
  const mount = origin.pathname === "/" ? "" : origin.pathname.replace(/\/+$/, "");
91366
91907
  const prefix = inPath ? `${mount}/${bucket}` : mount;
91367
- const path60 = key2 === "" ? "" : `/${key2.split("/").map((part) => encodeURIComponent(part)).join("/")}`;
91368
- const url2 = new URL(`${origin.protocol}//${host}${prefix}${path60}`);
91908
+ const path61 = key2 === "" ? "" : `/${key2.split("/").map((part) => encodeURIComponent(part)).join("/")}`;
91909
+ const url2 = new URL(`${origin.protocol}//${host}${prefix}${path61}`);
91369
91910
  for (const [name, value] of Object.entries(call.query ?? {}))
91370
91911
  url2.searchParams.set(name, value);
91371
91912
  return url2.toString();
@@ -91855,15 +92396,15 @@ function createS3Tools(targets) {
91855
92396
  }
91856
92397
 
91857
92398
  // ../../packages/core/dist/s3/localFolder.js
91858
- var import_node_crypto16 = require("node:crypto");
92399
+ var import_node_crypto17 = require("node:crypto");
91859
92400
  function mirrorFolder(options) {
91860
92401
  const connection = safeSegment(options.connectionId);
91861
- const digest = (0, import_node_crypto16.createHash)("sha256").update((options.prefix ?? "").trim().toLowerCase()).digest("hex").slice(0, 8);
92402
+ const digest = (0, import_node_crypto17.createHash)("sha256").update((options.prefix ?? "").trim().toLowerCase()).digest("hex").slice(0, 8);
91862
92403
  return join2(options.storageDir, "s3", connection, `${options.kind}-${digest}`);
91863
92404
  }
91864
92405
  function safeSegment(id) {
91865
92406
  const cleaned = id.replace(/[^a-zA-Z0-9._-]/g, "-").replace(/-+/g, "-").replace(/^[-.]+|[-.]+$/g, "").slice(0, 40);
91866
- const suffix = (0, import_node_crypto16.createHash)("sha256").update(id).digest("hex").slice(0, 6);
92407
+ const suffix = (0, import_node_crypto17.createHash)("sha256").update(id).digest("hex").slice(0, 6);
91867
92408
  return `${cleaned === "" ? "connection" : cleaned}-${suffix}`;
91868
92409
  }
91869
92410
  function join2(...parts) {
@@ -91950,13 +92491,13 @@ function reachableOrigins(hosts, extra = []) {
91950
92491
  }
91951
92492
 
91952
92493
  // src/identity.ts
91953
- var import_node_crypto17 = __toESM(require("node:crypto"), 1);
92494
+ var import_node_crypto18 = __toESM(require("node:crypto"), 1);
91954
92495
  var SingleUserIdentity = class _SingleUserIdentity {
91955
92496
  describe;
91956
92497
  static PRINCIPAL = { id: "local", displayName: "Local user" };
91957
92498
  principal;
91958
92499
  /** Long-lived, minted per server run, only ever sent in an `Authorization` header. */
91959
- sessionToken = import_node_crypto17.default.randomBytes(32).toString("base64url");
92500
+ sessionToken = import_node_crypto18.default.randomBytes(32).toString("base64url");
91960
92501
  /**
91961
92502
  * Single-use and short-lived, because it travels in the launch URL's fragment where it
91962
92503
  * can end up in shell history or a terminal scrollback (§14).
@@ -91966,7 +92507,7 @@ var SingleUserIdentity = class _SingleUserIdentity {
91966
92507
  * raises it, and what that costs is stated where it is set: a longer window is a longer time in
91967
92508
  * which somebody reading that scrollback can use it before you do.
91968
92509
  */
91969
- handoffToken = import_node_crypto17.default.randomBytes(32).toString("base64url");
92510
+ handoffToken = import_node_crypto18.default.randomBytes(32).toString("base64url");
91970
92511
  handoffExpiresAt;
91971
92512
  handoffSeconds;
91972
92513
  /**
@@ -91996,7 +92537,7 @@ var SingleUserIdentity = class _SingleUserIdentity {
91996
92537
  * which is the same person it was printed to in the first place.
91997
92538
  */
91998
92539
  remintHandoff() {
91999
- this.handoffToken = import_node_crypto17.default.randomBytes(32).toString("base64url");
92540
+ this.handoffToken = import_node_crypto18.default.randomBytes(32).toString("base64url");
92000
92541
  this.handoffExpiresAt = Date.now() + this.handoffSeconds * 1e3;
92001
92542
  return this.handoffToken;
92002
92543
  }
@@ -92035,10 +92576,10 @@ function timingSafeEquals(a, b) {
92035
92576
  const left = Buffer.from(a);
92036
92577
  const right = Buffer.from(b);
92037
92578
  if (left.length !== right.length) return false;
92038
- return import_node_crypto17.default.timingSafeEqual(left, right);
92579
+ return import_node_crypto18.default.timingSafeEqual(left, right);
92039
92580
  }
92040
92581
  function storageKeyFor(principal) {
92041
- return import_node_crypto17.default.createHash("sha256").update(principal.id).digest("hex").slice(0, 32);
92582
+ return import_node_crypto18.default.createHash("sha256").update(principal.id).digest("hex").slice(0, 32);
92042
92583
  }
92043
92584
  var OpenIdentity = class _OpenIdentity {
92044
92585
  describe = "single user, no token (--no-token)";
@@ -92307,22 +92848,22 @@ async function readJsonBody(request, maxBytes = 32 * 1024 * 1024) {
92307
92848
 
92308
92849
  // src/fileSecretStore.ts
92309
92850
  var import_promises30 = __toESM(require("node:fs/promises"), 1);
92310
- var import_node_path55 = __toESM(require("node:path"), 1);
92851
+ var import_node_path56 = __toESM(require("node:path"), 1);
92311
92852
 
92312
92853
  // src/vaultCrypto.ts
92313
- var import_node_crypto18 = require("node:crypto");
92854
+ var import_node_crypto19 = require("node:crypto");
92314
92855
  function isVaultEnvelope(value) {
92315
92856
  const v = value;
92316
92857
  return typeof v === "object" && v !== null && v.sunVault === 1 && typeof v.iv === "string" && typeof v.tag === "string" && typeof v.data === "string";
92317
92858
  }
92318
92859
  function sealSecrets(secrets, key2) {
92319
- const iv = (0, import_node_crypto18.randomBytes)(12);
92320
- const cipher = (0, import_node_crypto18.createCipheriv)("aes-256-gcm", key2, iv);
92860
+ const iv = (0, import_node_crypto19.randomBytes)(12);
92861
+ const cipher = (0, import_node_crypto19.createCipheriv)("aes-256-gcm", key2, iv);
92321
92862
  const data = Buffer.concat([cipher.update(JSON.stringify(secrets), "utf8"), cipher.final()]);
92322
92863
  return { sunVault: 1, iv: iv.toString("base64"), tag: cipher.getAuthTag().toString("base64"), data: data.toString("base64") };
92323
92864
  }
92324
92865
  function openSecrets(envelope, key2) {
92325
- const decipher = (0, import_node_crypto18.createDecipheriv)("aes-256-gcm", key2, Buffer.from(envelope.iv, "base64"));
92866
+ const decipher = (0, import_node_crypto19.createDecipheriv)("aes-256-gcm", key2, Buffer.from(envelope.iv, "base64"));
92326
92867
  decipher.setAuthTag(Buffer.from(envelope.tag, "base64"));
92327
92868
  const plain = Buffer.concat([decipher.update(Buffer.from(envelope.data, "base64")), decipher.final()]);
92328
92869
  const parsed = JSON.parse(plain.toString("utf8"));
@@ -92405,7 +92946,7 @@ var FileSecretStore = class {
92405
92946
  );
92406
92947
  }
92407
92948
  mutate(secrets);
92408
- await import_promises30.default.mkdir(import_node_path55.default.dirname(this.filePath), { recursive: true });
92949
+ await import_promises30.default.mkdir(import_node_path56.default.dirname(this.filePath), { recursive: true });
92409
92950
  const temp = `${this.filePath}.${process.pid}.tmp`;
92410
92951
  const body = this.key === void 0 ? secrets : sealSecrets(secrets, this.key);
92411
92952
  await import_promises30.default.writeFile(temp, JSON.stringify(body, null, 2), { encoding: "utf8", mode: 384 });
@@ -92440,9 +92981,9 @@ var FileSecretStore = class {
92440
92981
  };
92441
92982
 
92442
92983
  // src/reviewQueue.ts
92443
- var import_node_crypto19 = __toESM(require("node:crypto"), 1);
92984
+ var import_node_crypto20 = __toESM(require("node:crypto"), 1);
92444
92985
  var import_promises31 = __toESM(require("node:fs/promises"), 1);
92445
- var import_node_path56 = __toESM(require("node:path"), 1);
92986
+ var import_node_path57 = __toESM(require("node:path"), 1);
92446
92987
  var ReviewQueue = class {
92447
92988
  constructor(filePath) {
92448
92989
  this.filePath = filePath;
@@ -92461,7 +93002,7 @@ var ReviewQueue = class {
92461
93002
  }
92462
93003
  async persist(items) {
92463
93004
  this.cache = items;
92464
- await import_promises31.default.mkdir(import_node_path56.default.dirname(this.filePath), { recursive: true });
93005
+ await import_promises31.default.mkdir(import_node_path57.default.dirname(this.filePath), { recursive: true });
92465
93006
  const temporary = `${this.filePath}.tmp`;
92466
93007
  await import_promises31.default.writeFile(temporary, JSON.stringify(items, null, 2), { encoding: "utf8", mode: 384 });
92467
93008
  await replaceFile(temporary, this.filePath);
@@ -92479,7 +93020,7 @@ var ReviewQueue = class {
92479
93020
  );
92480
93021
  const queued = {
92481
93022
  ...request,
92482
- id: import_node_crypto19.default.randomUUID(),
93023
+ id: import_node_crypto20.default.randomUUID(),
92483
93024
  submittedAt: Date.now(),
92484
93025
  status: "pending"
92485
93026
  };
@@ -92703,7 +93244,7 @@ var RoutedSecretStore = class {
92703
93244
  // src/userVariables.ts
92704
93245
  var import_promises32 = __toESM(require("node:fs/promises"), 1);
92705
93246
  var import_node_fs12 = require("node:fs");
92706
- var import_node_path57 = __toESM(require("node:path"), 1);
93247
+ var import_node_path58 = __toESM(require("node:path"), 1);
92707
93248
  var UserVariableStore = class {
92708
93249
  constructor(filePath) {
92709
93250
  this.filePath = filePath;
@@ -92718,7 +93259,7 @@ var UserVariableStore = class {
92718
93259
  }
92719
93260
  async save(variables) {
92720
93261
  const parsed = sessionVariablesSchema.parse(variables);
92721
- await import_promises32.default.mkdir(import_node_path57.default.dirname(this.filePath), { recursive: true });
93262
+ await import_promises32.default.mkdir(import_node_path58.default.dirname(this.filePath), { recursive: true });
92722
93263
  const temporary = `${this.filePath}.tmp`;
92723
93264
  await import_promises32.default.writeFile(temporary, JSON.stringify({ variables: parsed }, null, 2), {
92724
93265
  encoding: "utf8",
@@ -92729,10 +93270,10 @@ var UserVariableStore = class {
92729
93270
  }
92730
93271
  };
92731
93272
  function userVariableStoreFor(dataDir, principal) {
92732
- return new UserVariableStore(userVariablesPath(import_node_path57.default.join(dataDir, "users", storageKeyFor(principal))));
93273
+ return new UserVariableStore(userVariablesPath(import_node_path58.default.join(dataDir, "users", storageKeyFor(principal))));
92733
93274
  }
92734
93275
  function userVariablesPath(userDir) {
92735
- return import_node_path57.default.join(userDir, "variables.json");
93276
+ return import_node_path58.default.join(userDir, "variables.json");
92736
93277
  }
92737
93278
  function readVariablesFile(filePath) {
92738
93279
  try {
@@ -92762,11 +93303,11 @@ function hostedUser(env2 = process.env) {
92762
93303
  // src/session.ts
92763
93304
  var import_node_fs13 = require("node:fs");
92764
93305
  var import_promises33 = __toESM(require("node:fs/promises"), 1);
92765
- var import_node_path59 = __toESM(require("node:path"), 1);
93306
+ var import_node_path60 = __toESM(require("node:path"), 1);
92766
93307
 
92767
93308
  // src/credentialTool.ts
92768
93309
  var import_node_child_process18 = require("node:child_process");
92769
- var import_node_path58 = __toESM(require("node:path"), 1);
93310
+ var import_node_path59 = __toESM(require("node:path"), 1);
92770
93311
  var CREDENTIAL_PREFIX2 = "tool:";
92771
93312
  var WRAPPER = [
92772
93313
  "import importlib.util, json, sys",
@@ -92786,7 +93327,7 @@ async function fetchCredential(options, reference) {
92786
93327
  if (name.length === 0) return { problem: "A credential reference needs a name: tool:<name>." };
92787
93328
  const budget = options.timeoutMs ?? 3e4;
92788
93329
  const run3 = await new Promise((resolve) => {
92789
- const child = (0, import_node_child_process18.spawn)(options.interpreter, ["-c", WRAPPER, import_node_path58.default.resolve(options.file), name], {
93330
+ const child = (0, import_node_child_process18.spawn)(options.interpreter, ["-c", WRAPPER, import_node_path59.default.resolve(options.file), name], {
92790
93331
  windowsHide: true,
92791
93332
  // The environment this was started in, as with the identity function: the libraries that
92792
93333
  // hold credentials are configured through it, and nothing here is model-authored.
@@ -92982,7 +93523,7 @@ var FileConfigStore = class {
92982
93523
  const filePath = this.pathFor(scope);
92983
93524
  if (filePath === void 0)
92984
93525
  throw new Error(`Cannot write ${scope} config: no workspace is open`);
92985
- await import_promises33.default.mkdir(import_node_path59.default.dirname(filePath), { recursive: true });
93526
+ await import_promises33.default.mkdir(import_node_path60.default.dirname(filePath), { recursive: true });
92986
93527
  const temporary = `${filePath}.${process.pid.toString(36)}.tmp`;
92987
93528
  await import_promises33.default.writeFile(temporary, contents, { encoding: "utf8", mode: 384 });
92988
93529
  await replaceFile(temporary, filePath);
@@ -93019,8 +93560,8 @@ var FileConfigStore = class {
93019
93560
  };
93020
93561
  let watcher;
93021
93562
  try {
93022
- watcher = (0, import_node_fs13.watch)(import_node_path59.default.dirname(filePath), (_event, filename) => {
93023
- if (filename === import_node_path59.default.basename(filePath)) onChange();
93563
+ watcher = (0, import_node_fs13.watch)(import_node_path60.default.dirname(filePath), (_event, filename) => {
93564
+ if (filename === import_node_path60.default.basename(filePath)) onChange();
93024
93565
  });
93025
93566
  } catch {
93026
93567
  }
@@ -93048,7 +93589,7 @@ var FileWorkspaceState = class {
93048
93589
  async set(key2, value) {
93049
93590
  if (value === void 0) delete this.values[key2];
93050
93591
  else this.values[key2] = value;
93051
- await import_promises33.default.mkdir(import_node_path59.default.dirname(this.filePath), { recursive: true });
93592
+ await import_promises33.default.mkdir(import_node_path60.default.dirname(this.filePath), { recursive: true });
93052
93593
  await import_promises33.default.writeFile(this.filePath, JSON.stringify(this.values, null, 2), {
93053
93594
  encoding: "utf8",
93054
93595
  mode: 384
@@ -93097,7 +93638,7 @@ function createBrowserUi(workspaceRoot, post, fastFs) {
93097
93638
  openFile: async (filePath) => {
93098
93639
  try {
93099
93640
  post(
93100
- [`[info] ${import_node_path59.default.basename(filePath)}`, "", await import_promises33.default.readFile(filePath, "utf8")].join("\n")
93641
+ [`[info] ${import_node_path60.default.basename(filePath)}`, "", await import_promises33.default.readFile(filePath, "utf8")].join("\n")
93101
93642
  );
93102
93643
  } catch (error51) {
93103
93644
  post(`[warning] Could not read ${filePath}: ${String(error51)}`);
@@ -93139,7 +93680,7 @@ function createBrowserUi(workspaceRoot, post, fastFs) {
93139
93680
  for (const entry of entries) {
93140
93681
  if (found2.length >= limit) return;
93141
93682
  if (entry.name.startsWith(".") && entry.name !== ".env") continue;
93142
- const full = import_node_path59.default.join(dir, entry.name);
93683
+ const full = import_node_path60.default.join(dir, entry.name);
93143
93684
  if (entry.isDirectory()) {
93144
93685
  if (!skip.has(entry.name)) await walk(full, level + 1);
93145
93686
  } else if (depth !== void 0 && level !== depth) {
@@ -93175,11 +93716,11 @@ var SHARED_COLLECTIONS = [
93175
93716
  { key: "mcpServers" }
93176
93717
  ];
93177
93718
  async function createSession(options) {
93178
- const userDir = import_node_path59.default.join(options.dataDir, "users", storageKeyFor(options.principal));
93719
+ const userDir = import_node_path60.default.join(options.dataDir, "users", storageKeyFor(options.principal));
93179
93720
  await import_promises33.default.mkdir(userDir, { recursive: true, mode: 448 });
93180
93721
  const variableStore = new UserVariableStore(userVariablesPath(userDir));
93181
93722
  const userVariables = () => variableStore.read();
93182
- const workspaceState = new FileWorkspaceState(import_node_path59.default.join(userDir, "workspace-state.json"));
93723
+ const workspaceState = new FileWorkspaceState(import_node_path60.default.join(userDir, "workspace-state.json"));
93183
93724
  await workspaceState.load();
93184
93725
  const services = {
93185
93726
  /*
@@ -93267,16 +93808,16 @@ async function createSession(options) {
93267
93808
  */
93268
93809
  secrets: new CredentialPointerStore(
93269
93810
  withCredentialTool(
93270
- options.sharedSecrets === void 0 ? new FileSecretStore(options.secretsFile ?? import_node_path59.default.join(userDir, "secrets.json"), options.secretsKey) : new RoutedSecretStore(
93271
- new FileSecretStore(options.secretsFile ?? import_node_path59.default.join(userDir, "secrets.json"), options.secretsKey),
93811
+ options.sharedSecrets === void 0 ? new FileSecretStore(options.secretsFile ?? import_node_path60.default.join(userDir, "secrets.json"), options.secretsKey) : new RoutedSecretStore(
93812
+ new FileSecretStore(options.secretsFile ?? import_node_path60.default.join(userDir, "secrets.json"), options.secretsKey),
93272
93813
  options.sharedSecrets
93273
93814
  ),
93274
93815
  options
93275
93816
  )
93276
93817
  ),
93277
93818
  configStore: withSharedEntries(
93278
- options.sharedProfiles === void 0 ? new FileConfigStore(options.configFile ?? import_node_path59.default.join(userDir, "config.json"), options.workspaceRoot) : new SharedProfileConfigStore(
93279
- new FileConfigStore(options.configFile ?? import_node_path59.default.join(userDir, "config.json"), options.workspaceRoot),
93819
+ options.sharedProfiles === void 0 ? new FileConfigStore(options.configFile ?? import_node_path60.default.join(userDir, "config.json"), options.workspaceRoot) : new SharedProfileConfigStore(
93820
+ new FileConfigStore(options.configFile ?? import_node_path60.default.join(userDir, "config.json"), options.workspaceRoot),
93280
93821
  options.sharedProfiles
93281
93822
  ),
93282
93823
  options
@@ -93394,8 +93935,8 @@ async function startServer(options) {
93394
93935
  ));
93395
93936
  const roles = options.roles ?? SINGLE_USER_POLICY;
93396
93937
  const sharedStore = options.sharedConfig;
93397
- const sharedSecretStore = new FileSecretStore(import_node_path60.default.join(options.dataDir, "shared-secrets.json"));
93398
- const reviews = new ReviewQueue(import_node_path60.default.join(options.dataDir, "reviews.json"));
93938
+ const sharedSecretStore = new FileSecretStore(import_node_path61.default.join(options.dataDir, "shared-secrets.json"));
93939
+ const reviews = new ReviewQueue(import_node_path61.default.join(options.dataDir, "reviews.json"));
93399
93940
  let sharedCache = {
93400
93941
  variables: [],
93401
93942
  adminIds: [],
@@ -93771,14 +94312,14 @@ async function startServer(options) {
93771
94312
  return "No workspace is open, so there is nowhere to write it.";
93772
94313
  try {
93773
94314
  if (item.kind === "skill") {
93774
- const dir2 = import_node_path60.default.join(options.workspaceRoot, ".lightcode", "skills");
94315
+ const dir2 = import_node_path61.default.join(options.workspaceRoot, ".lightcode", "skills");
93775
94316
  await import_promises34.default.mkdir(dir2, { recursive: true });
93776
- await import_promises34.default.writeFile(import_node_path60.default.join(dir2, `${item.name}.md`), item.content, "utf8");
94317
+ await import_promises34.default.writeFile(import_node_path61.default.join(dir2, `${item.name}.md`), item.content, "utf8");
93777
94318
  return void 0;
93778
94319
  }
93779
- const dir = import_node_path60.default.join(options.workspaceRoot, ".lightcode", "tools");
94320
+ const dir = import_node_path61.default.join(options.workspaceRoot, ".lightcode", "tools");
93780
94321
  await import_promises34.default.mkdir(dir, { recursive: true });
93781
- await import_promises34.default.writeFile(import_node_path60.default.join(dir, `${item.name}.py`), item.content, "utf8");
94322
+ await import_promises34.default.writeFile(import_node_path61.default.join(dir, `${item.name}.py`), item.content, "utf8");
93782
94323
  return void 0;
93783
94324
  } catch (error51) {
93784
94325
  return error51 instanceof Error ? error51.message : String(error51);
@@ -93927,7 +94468,7 @@ async function startServer(options) {
93927
94468
  return;
93928
94469
  }
93929
94470
  response.writeHead(200, {
93930
- "Content-Type": CONTENT_TYPES2[import_node_path60.default.extname(asset)] ?? "application/octet-stream",
94471
+ "Content-Type": CONTENT_TYPES2[import_node_path61.default.extname(asset)] ?? "application/octet-stream",
93931
94472
  ...securityHeaders()
93932
94473
  });
93933
94474
  response.end(body);