@chosengeneration/light-code 0.188.0 → 0.189.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 +736 -627
  2. package/dist/server.cjs +698 -589
  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 path67 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
497
+ let path68 = 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 (path67 && !path67.startsWith("/")) {
502
- path67 = `/${path67}`;
501
+ if (path68 && !path68.startsWith("/")) {
502
+ path68 = `/${path68}`;
503
503
  }
504
- url2 = new URL(origin + path67);
504
+ url2 = new URL(origin + path68);
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(path67) {
2119
- if (typeof path67 !== "string") {
2118
+ module2.exports = function basename(path68) {
2119
+ if (typeof path68 !== "string") {
2120
2120
  return "";
2121
2121
  }
2122
- for (var i = path67.length - 1; i >= 0; --i) {
2123
- switch (path67.charCodeAt(i)) {
2122
+ for (var i = path68.length - 1; i >= 0; --i) {
2123
+ switch (path68.charCodeAt(i)) {
2124
2124
  case 47:
2125
2125
  // '/'
2126
2126
  case 92:
2127
- path67 = path67.slice(i + 1);
2128
- return path67 === ".." || path67 === "." ? "" : path67;
2127
+ path68 = path68.slice(i + 1);
2128
+ return path68 === ".." || path68 === "." ? "" : path68;
2129
2129
  }
2130
2130
  }
2131
- return path67 === ".." || path67 === "." ? "" : path67;
2131
+ return path68 === ".." || path68 === "." ? "" : path68;
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: path67,
5161
+ path: path68,
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 path67 !== "string") {
5175
+ if (typeof path68 !== "string") {
5176
5176
  throw new InvalidArgumentError("path must be a string");
5177
- } else if (path67[0] !== "/" && !(path67.startsWith("http://") || path67.startsWith("https://")) && method !== "CONNECT") {
5177
+ } else if (path68[0] !== "/" && !(path68.startsWith("http://") || path68.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(path67) !== null) {
5179
+ } else if (invalidPathRegex.exec(path68) !== 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(path67, query) : path67;
5242
+ this.path = query ? util.buildURL(path68, query) : path68;
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 path67 = search ? `${pathname}${search}` : pathname;
6250
+ const path68 = search ? `${pathname}${search}` : pathname;
6251
6251
  this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
6252
- this.opts.path = path67;
6252
+ this.opts.path = path68;
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], request2);
7490
7490
  return;
7491
7491
  }
7492
- const { body, method, path: path67, host, upgrade, headers, blocking, reset } = request2;
7492
+ const { body, method, path: path68, host, upgrade, headers, blocking, reset } = request2;
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} ${path67} HTTP/1.1\r
7542
+ let header2 = `${method} ${path68} 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, request2) {
7605
- const { body, method, path: path67, host, upgrade, expectContinue, signal, headers: reqHeaders } = request2;
7605
+ const { body, method, path: path68, host, upgrade, expectContinue, signal, headers: reqHeaders } = request2;
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] = path67;
7648
+ headers[HTTP2_HEADER_PATH] = path68;
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(path67) {
9889
- if (typeof path67 !== "string") {
9890
- return path67;
9888
+ function safeUrl(path68) {
9889
+ if (typeof path68 !== "string") {
9890
+ return path68;
9891
9891
  }
9892
- const pathSegments = path67.split("?");
9892
+ const pathSegments = path68.split("?");
9893
9893
  if (pathSegments.length !== 2) {
9894
- return path67;
9894
+ return path68;
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: path67, method, body, headers }) {
9901
- const pathMatch = matchValue(mockDispatch2.path, path67);
9900
+ function matchKey(mockDispatch2, { path: path68, method, body, headers }) {
9901
+ const pathMatch = matchValue(mockDispatch2.path, path68);
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, key3) {
9917
9917
  const basePath = key3.query ? buildURL(key3.path, key3.query) : key3.path;
9918
9918
  const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
9919
- let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path67 }) => matchValue(safeUrl(path67), resolvedPath));
9919
+ let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path68 }) => matchValue(safeUrl(path68), 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: path67, method, body, headers, query } = opts;
9956
+ const { path: path68, method, body, headers, query } = opts;
9957
9957
  return {
9958
- path: path67,
9958
+ path: path68,
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: path67, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
10407
+ ({ method, path: path68, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
10408
10408
  Method: method,
10409
10409
  Origin: origin,
10410
- Path: path67,
10410
+ Path: path68,
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(path67) {
15031
- for (const char of path67) {
15030
+ function validateCookiePath(path68) {
15031
+ for (const char of path68) {
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 path67 = opts.path;
16711
+ let path68 = opts.path;
16712
16712
  if (!opts.path.startsWith("/")) {
16713
- path67 = `/${path67}`;
16713
+ path68 = `/${path68}`;
16714
16714
  }
16715
- url2 = new URL(util.parseOrigin(url2).origin + path67);
16715
+ url2 = new URL(util.parseOrigin(url2).origin + path68);
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(path67) {
19987
- let input = path67;
19986
+ function removeDotSegments(path68) {
19987
+ let input = path68;
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 [path67, query] = wsComponent.resourceName.split("?");
20240
- wsComponent.path = path67 && path67 !== "/" ? path67 : void 0;
20239
+ const [path68, query] = wsComponent.resourceName.split("?");
20240
+ wsComponent.path = path68 && path68 !== "/" ? path68 : void 0;
20241
20241
  wsComponent.query = query;
20242
20242
  wsComponent.resourceName = void 0;
20243
20243
  }
@@ -23636,12 +23636,12 @@ var require_dist = __commonJS({
23636
23636
  throw new Error(`Unknown format "${name}"`);
23637
23637
  return f;
23638
23638
  };
23639
- function addFormats(ajv, list2, fs47, exportName) {
23639
+ function addFormats(ajv, list2, fs48, exportName) {
23640
23640
  var _a3;
23641
23641
  var _b;
23642
23642
  (_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
23643
23643
  for (const f of list2)
23644
- ajv.addFormat(f, fs47[f]);
23644
+ ajv.addFormat(f, fs48[f]);
23645
23645
  }
23646
23646
  module2.exports = exports2 = formatsPlugin;
23647
23647
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -23654,8 +23654,8 @@ var require_windows = __commonJS({
23654
23654
  "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports2, module2) {
23655
23655
  module2.exports = isexe;
23656
23656
  isexe.sync = sync;
23657
- var fs47 = require("fs");
23658
- function checkPathExt(path67, options) {
23657
+ var fs48 = require("fs");
23658
+ function checkPathExt(path68, 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 && path67.substr(-p.length).toLowerCase() === p) {
23669
+ if (p && path68.substr(-p.length).toLowerCase() === p) {
23670
23670
  return true;
23671
23671
  }
23672
23672
  }
23673
23673
  return false;
23674
23674
  }
23675
- function checkStat(stat, path67, options) {
23675
+ function checkStat(stat, path68, options) {
23676
23676
  if (!stat.isSymbolicLink() && !stat.isFile()) {
23677
23677
  return false;
23678
23678
  }
23679
- return checkPathExt(path67, options);
23679
+ return checkPathExt(path68, options);
23680
23680
  }
23681
- function isexe(path67, options, cb) {
23682
- fs47.stat(path67, function(er, stat) {
23683
- cb(er, er ? false : checkStat(stat, path67, options));
23681
+ function isexe(path68, options, cb) {
23682
+ fs48.stat(path68, function(er, stat) {
23683
+ cb(er, er ? false : checkStat(stat, path68, options));
23684
23684
  });
23685
23685
  }
23686
- function sync(path67, options) {
23687
- return checkStat(fs47.statSync(path67), path67, options);
23686
+ function sync(path68, options) {
23687
+ return checkStat(fs48.statSync(path68), path68, options);
23688
23688
  }
23689
23689
  }
23690
23690
  });
@@ -23694,14 +23694,14 @@ var require_mode = __commonJS({
23694
23694
  "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports2, module2) {
23695
23695
  module2.exports = isexe;
23696
23696
  isexe.sync = sync;
23697
- var fs47 = require("fs");
23698
- function isexe(path67, options, cb) {
23699
- fs47.stat(path67, function(er, stat) {
23697
+ var fs48 = require("fs");
23698
+ function isexe(path68, options, cb) {
23699
+ fs48.stat(path68, function(er, stat) {
23700
23700
  cb(er, er ? false : checkStat(stat, options));
23701
23701
  });
23702
23702
  }
23703
- function sync(path67, options) {
23704
- return checkStat(fs47.statSync(path67), options);
23703
+ function sync(path68, options) {
23704
+ return checkStat(fs48.statSync(path68), options);
23705
23705
  }
23706
23706
  function checkStat(stat, options) {
23707
23707
  return stat.isFile() && checkMode(stat, options);
@@ -23725,7 +23725,7 @@ var require_mode = __commonJS({
23725
23725
  // ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
23726
23726
  var require_isexe = __commonJS({
23727
23727
  "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports2, module2) {
23728
- var fs47 = require("fs");
23728
+ var fs48 = require("fs");
23729
23729
  var core;
23730
23730
  if (process.platform === "win32" || global.TESTING_WINDOWS) {
23731
23731
  core = require_windows();
@@ -23734,7 +23734,7 @@ var require_isexe = __commonJS({
23734
23734
  }
23735
23735
  module2.exports = isexe;
23736
23736
  isexe.sync = sync;
23737
- function isexe(path67, options, cb) {
23737
+ function isexe(path68, 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(path67, options || {}, function(er, is) {
23747
+ isexe(path68, 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(path67, options || {}, function(er, is) {
23756
+ core(path68, 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(path67, options) {
23766
+ function sync(path68, options) {
23767
23767
  try {
23768
- return core.sync(path67, options || {});
23768
+ return core.sync(path68, 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 path67 = require("path");
23784
+ var path68 = 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 = path67.join(pathPart, cmd);
23822
+ const pCmd = path68.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 = path67.join(pathPart, cmd);
23849
+ const pCmd = path68.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 path67 = require("path");
23897
+ var path68 = 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 ? path67.delimiter : void 0
23915
+ pathExt: withoutPathExt ? path68.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 = path67.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
23924
+ resolved = path68.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 [path67, argument] = match[0].replace(/#! ?/, "").split(" ");
23979
- const binary = path67.split("/").pop();
23978
+ const [path68, argument] = match[0].replace(/#! ?/, "").split(" ");
23979
+ const binary = path68.split("/").pop();
23980
23980
  if (binary === "env") {
23981
23981
  return argument;
23982
23982
  }
@@ -23989,16 +23989,16 @@ var require_shebang_command = __commonJS({
23989
23989
  var require_readShebang = __commonJS({
23990
23990
  "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js"(exports2, module2) {
23991
23991
  "use strict";
23992
- var fs47 = require("fs");
23992
+ var fs48 = require("fs");
23993
23993
  var shebangCommand = require_shebang_command();
23994
23994
  function readShebang(command) {
23995
23995
  const size = 150;
23996
23996
  const buffer = Buffer.alloc(size);
23997
23997
  let fd;
23998
23998
  try {
23999
- fd = fs47.openSync(command, "r");
24000
- fs47.readSync(fd, buffer, 0, size, 0);
24001
- fs47.closeSync(fd);
23999
+ fd = fs48.openSync(command, "r");
24000
+ fs48.readSync(fd, buffer, 0, size, 0);
24001
+ fs48.closeSync(fd);
24002
24002
  } catch (e) {
24003
24003
  }
24004
24004
  return shebangCommand(buffer.toString());
@@ -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 path67 = require("path");
24014
+ var path68 = 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 = path67.normalize(parsed.command);
24039
+ parsed.command = path68.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(" ");
@@ -24258,9 +24258,9 @@ __export(server_exports, {
24258
24258
  });
24259
24259
  module.exports = __toCommonJS(server_exports);
24260
24260
  var import_promises38 = __toESM(require("node:fs/promises"), 1);
24261
- var import_node_fs18 = require("node:fs");
24261
+ var import_node_fs19 = require("node:fs");
24262
24262
  var import_node_http = require("node:http");
24263
- var import_node_path67 = __toESM(require("node:path"), 1);
24263
+ var import_node_path68 = __toESM(require("node:path"), 1);
24264
24264
 
24265
24265
  // ../../packages/core/dist/platform/http.js
24266
24266
  var import_node_crypto = require("node:crypto");
@@ -25428,10 +25428,10 @@ function mergeDefs(...defs) {
25428
25428
  function cloneDef(schema12) {
25429
25429
  return mergeDefs(schema12._zod.def);
25430
25430
  }
25431
- function getElementAtPath(obj, path67) {
25432
- if (!path67)
25431
+ function getElementAtPath(obj, path68) {
25432
+ if (!path68)
25433
25433
  return obj;
25434
- return path67.reduce((acc, key3) => acc?.[key3], obj);
25434
+ return path68.reduce((acc, key3) => acc?.[key3], obj);
25435
25435
  }
25436
25436
  function promiseAllObject(promisesObj) {
25437
25437
  const keys = Object.keys(promisesObj);
@@ -25840,11 +25840,11 @@ function explicitlyAborted(x, startIndex = 0) {
25840
25840
  }
25841
25841
  return false;
25842
25842
  }
25843
- function prefixIssues(path67, issues) {
25843
+ function prefixIssues(path68, issues) {
25844
25844
  return issues.map((iss) => {
25845
25845
  var _a3;
25846
25846
  (_a3 = iss).path ?? (_a3.path = []);
25847
- iss.path.unshift(path67);
25847
+ iss.path.unshift(path68);
25848
25848
  return iss;
25849
25849
  });
25850
25850
  }
@@ -25991,16 +25991,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
25991
25991
  }
25992
25992
  function formatError(error51, mapper = (issue2) => issue2.message) {
25993
25993
  const fieldErrors = { _errors: [] };
25994
- const processError = (error52, path67 = []) => {
25994
+ const processError = (error52, path68 = []) => {
25995
25995
  for (const issue2 of error52.issues) {
25996
25996
  if (issue2.code === "invalid_union" && issue2.errors.length) {
25997
- issue2.errors.map((issues) => processError({ issues }, [...path67, ...issue2.path]));
25997
+ issue2.errors.map((issues) => processError({ issues }, [...path68, ...issue2.path]));
25998
25998
  } else if (issue2.code === "invalid_key") {
25999
- processError({ issues: issue2.issues }, [...path67, ...issue2.path]);
25999
+ processError({ issues: issue2.issues }, [...path68, ...issue2.path]);
26000
26000
  } else if (issue2.code === "invalid_element") {
26001
- processError({ issues: issue2.issues }, [...path67, ...issue2.path]);
26001
+ processError({ issues: issue2.issues }, [...path68, ...issue2.path]);
26002
26002
  } else {
26003
- const fullpath = [...path67, ...issue2.path];
26003
+ const fullpath = [...path68, ...issue2.path];
26004
26004
  if (fullpath.length === 0) {
26005
26005
  fieldErrors._errors.push(mapper(issue2));
26006
26006
  } else {
@@ -26027,17 +26027,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
26027
26027
  }
26028
26028
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
26029
26029
  const result = { errors: [] };
26030
- const processError = (error52, path67 = []) => {
26030
+ const processError = (error52, path68 = []) => {
26031
26031
  var _a3, _b;
26032
26032
  for (const issue2 of error52.issues) {
26033
26033
  if (issue2.code === "invalid_union" && issue2.errors.length) {
26034
- issue2.errors.map((issues) => processError({ issues }, [...path67, ...issue2.path]));
26034
+ issue2.errors.map((issues) => processError({ issues }, [...path68, ...issue2.path]));
26035
26035
  } else if (issue2.code === "invalid_key") {
26036
- processError({ issues: issue2.issues }, [...path67, ...issue2.path]);
26036
+ processError({ issues: issue2.issues }, [...path68, ...issue2.path]);
26037
26037
  } else if (issue2.code === "invalid_element") {
26038
- processError({ issues: issue2.issues }, [...path67, ...issue2.path]);
26038
+ processError({ issues: issue2.issues }, [...path68, ...issue2.path]);
26039
26039
  } else {
26040
- const fullpath = [...path67, ...issue2.path];
26040
+ const fullpath = [...path68, ...issue2.path];
26041
26041
  if (fullpath.length === 0) {
26042
26042
  result.errors.push(mapper(issue2));
26043
26043
  continue;
@@ -26069,8 +26069,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
26069
26069
  }
26070
26070
  function toDotPath(_path) {
26071
26071
  const segs = [];
26072
- const path67 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
26073
- for (const seg of path67) {
26072
+ const path68 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
26073
+ for (const seg of path68) {
26074
26074
  if (typeof seg === "number")
26075
26075
  segs.push(`[${seg}]`);
26076
26076
  else if (typeof seg === "symbol")
@@ -38762,13 +38762,13 @@ function resolveRef(ref, ctx) {
38762
38762
  if (!ref.startsWith("#")) {
38763
38763
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
38764
38764
  }
38765
- const path67 = ref.slice(1).split("/").filter(Boolean);
38766
- if (path67.length === 0) {
38765
+ const path68 = ref.slice(1).split("/").filter(Boolean);
38766
+ if (path68.length === 0) {
38767
38767
  return ctx.rootSchema;
38768
38768
  }
38769
38769
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
38770
- if (path67[0] === defsKey) {
38771
- const key3 = path67[1];
38770
+ if (path68[0] === defsKey) {
38771
+ const key3 = path68[1];
38772
38772
  if (!key3 || !ctx.defs[key3]) {
38773
38773
  throw new Error(`Reference not found: ${ref}`);
38774
38774
  }
@@ -39589,7 +39589,7 @@ function describeStrategy(strategy, roleName) {
39589
39589
  if (boxes.length > 0) {
39590
39590
  lines2.push("", "A connector leaving a box is followed only once every step inside it has answered. A connector into a box gives every step inside what arrives along it.");
39591
39591
  }
39592
- lines2.push("", "How to follow it:", "- Before doing anything else in a task, propose a plan with update_plan that carries out every step above in order, naming the role for each step and writing each back-and-forth as one step with its condition and its maximum rounds. Then follow the plan.", "- Give each specialist what it needs from the earlier steps: it does not see this conversation, only what you send it. A step's own instructions from the user reach it with every question; plan the steps that have none.", "- Connectors with no contract: before starting, propose what should pass along them with set_strategy_contracts (the user approves it). Light Code checks every required item after each answer, asks the specialist again for what is missing, and tells you if it is still missing - pass on what arrived, and say what did not.", "- In a back-and-forth, Light Code counts the rounds and tells you after each answer where the loop stands; it refuses a round past the maximum. If the maximum is reached without the condition, stop and tell the user what is still open rather than working around it.", "- A question from the user that is not part of the strategy is answered normally.");
39592
+ lines2.push("", "How to follow it:", "- This strategy applies to every piece of work asked for in this chat, not only the first. Before doing anything else for a request - including a new topic after an earlier one is finished - propose a plan with update_plan that carries out every step above in order for that request, naming the role for each step and writing each back-and-forth as one step with its condition and its maximum rounds. Then follow the plan. A new plan for a new topic starts the loops afresh; do not reuse an earlier topic's plan or skip the specialists because they were consulted before.", "- Give each specialist what it needs from the earlier steps: it does not see this conversation, only what you send it. A step's own instructions from the user reach it with every question; plan the steps that have none.", "- Connectors with no contract: before starting, propose what should pass along them with set_strategy_contracts (the user approves it). Light Code checks every required item after each answer, asks the specialist again for what is missing, and tells you if it is still missing - pass on what arrived, and say what did not.", "- In a back-and-forth, Light Code counts the rounds and tells you after each answer where the loop stands; it refuses a round past the maximum. If the maximum is reached without the condition, stop and tell the user what is still open rather than working around it.", "- A question from the user that is not part of the strategy is answered normally.");
39593
39593
  return lines2.join("\n");
39594
39594
  }
39595
39595
  function readVerdict(answer) {
@@ -43612,8 +43612,8 @@ function restoreArguments(argumentsJson, reshaped) {
43612
43612
  restoreAt(args, entry.path, entry.kind);
43613
43613
  return JSON.stringify(args);
43614
43614
  }
43615
- function restoreAt(value, path67, kind) {
43616
- if (path67.length === 0) {
43615
+ function restoreAt(value, path68, kind) {
43616
+ if (path68.length === 0) {
43617
43617
  if (typeof value !== "string")
43618
43618
  return value;
43619
43619
  if (kind === "number") {
@@ -43626,7 +43626,7 @@ function restoreAt(value, path67, kind) {
43626
43626
  return value;
43627
43627
  }
43628
43628
  }
43629
- const [head, ...rest] = path67;
43629
+ const [head, ...rest] = path68;
43630
43630
  if (head === "[]") {
43631
43631
  if (Array.isArray(value))
43632
43632
  for (let i = 0; i < value.length; i += 1)
@@ -43639,16 +43639,16 @@ function restoreAt(value, path67, kind) {
43639
43639
  }
43640
43640
  var SCALARS = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean"]);
43641
43641
  var MAX_DEPTH = 12;
43642
- function convert(schema12, root, path67, found2, depth, isRoot = false) {
43642
+ function convert(schema12, root, path68, found2, depth, isRoot = false) {
43643
43643
  if (!isRecord2(schema12))
43644
43644
  return { type: "string" };
43645
43645
  if (depth > MAX_DEPTH)
43646
- return asJsonString(schema12, path67, found2, "nested too deeply to describe here");
43646
+ return asJsonString(schema12, path68, found2, "nested too deeply to describe here");
43647
43647
  let node = { ...schema12 };
43648
43648
  if (typeof node.$ref === "string") {
43649
43649
  const target = resolveRef2(node.$ref, root);
43650
43650
  if (target === void 0)
43651
- return asJsonString(node, path67, found2, "a structured value");
43651
+ return asJsonString(node, path68, found2, "a structured value");
43652
43652
  const { $ref: _ref, ...siblings } = node;
43653
43653
  void _ref;
43654
43654
  node = { ...target, ...siblings };
@@ -43664,7 +43664,7 @@ function convert(schema12, root, path67, found2, depth, isRoot = false) {
43664
43664
  const merged = { ...branches[0] };
43665
43665
  if (describedBase !== void 0 && merged.description === void 0)
43666
43666
  merged.description = describedBase;
43667
- const converted = convert(merged, root, path67, found2, depth + 1);
43667
+ const converted = convert(merged, root, path68, found2, depth + 1);
43668
43668
  if (nullable2)
43669
43669
  converted.nullable = true;
43670
43670
  return converted;
@@ -43672,16 +43672,16 @@ function convert(schema12, root, path67, found2, depth, isRoot = false) {
43672
43672
  const allEnums = branches.every((branch) => Array.isArray(branch.enum) || branch.const !== void 0);
43673
43673
  if (allEnums) {
43674
43674
  const values = branches.flatMap((branch) => Array.isArray(branch.enum) ? branch.enum : [branch.const]);
43675
- return convert({ ...withoutUnion(node), enum: values, ...nullable2 ? { nullable: true } : {} }, root, path67, found2, depth + 1);
43675
+ return convert({ ...withoutUnion(node), enum: values, ...nullable2 ? { nullable: true } : {} }, root, path68, found2, depth + 1);
43676
43676
  }
43677
43677
  const allScalars = branches.every((branch) => typeof branch.type === "string" && SCALARS.has(branch.type));
43678
43678
  if (allScalars) {
43679
43679
  const types = branches.map((branch) => branch.type);
43680
43680
  const chosen = types.includes("string") ? "string" : types[0];
43681
43681
  const note = `Accepts ${types.join(" or ")}.`;
43682
- return convert({ ...withoutUnion(node), type: chosen, description: join(baseDescription(node), note), ...nullable2 ? { nullable: true } : {} }, root, path67, found2, depth + 1);
43682
+ return convert({ ...withoutUnion(node), type: chosen, description: join(baseDescription(node), note), ...nullable2 ? { nullable: true } : {} }, root, path68, found2, depth + 1);
43683
43683
  }
43684
- return asJsonString(node, path67, found2, describeUnion(branches));
43684
+ return asJsonString(node, path68, found2, describeUnion(branches));
43685
43685
  }
43686
43686
  const type = node.type;
43687
43687
  const notes = describeDropped(node);
@@ -43693,10 +43693,10 @@ function convert(schema12, root, path67, found2, depth, isRoot = false) {
43693
43693
  const properties = isRecord2(node.properties) ? node.properties : {};
43694
43694
  const names = Object.keys(properties);
43695
43695
  if (names.length === 0 && !isRoot)
43696
- return asJsonString(node, path67, found2, "an object with any keys");
43696
+ return asJsonString(node, path68, found2, "an object with any keys");
43697
43697
  const converted = {};
43698
43698
  for (const name of names)
43699
- converted[name] = convert(properties[name], root, [...path67, name], found2, depth + 1);
43699
+ converted[name] = convert(properties[name], root, [...path68, name], found2, depth + 1);
43700
43700
  out.properties = converted;
43701
43701
  if (Array.isArray(node.required)) {
43702
43702
  const required2 = node.required.filter((name) => typeof name === "string" && name in converted);
@@ -43704,9 +43704,9 @@ function convert(schema12, root, path67, found2, depth, isRoot = false) {
43704
43704
  out.required = required2;
43705
43705
  }
43706
43706
  } else if (type === "array") {
43707
- out.items = node.items === void 0 ? { type: "string" } : convert(node.items, root, [...path67, "[]"], found2, depth + 1);
43707
+ out.items = node.items === void 0 ? { type: "string" } : convert(node.items, root, [...path68, "[]"], found2, depth + 1);
43708
43708
  } else if (type === void 0 && node.enum === void 0) {
43709
- return asJsonString(node, path67, found2, "any JSON value");
43709
+ return asJsonString(node, path68, found2, "any JSON value");
43710
43710
  }
43711
43711
  if (Array.isArray(node.enum)) {
43712
43712
  const values = node.enum.filter((value) => value !== null);
@@ -43716,7 +43716,7 @@ function convert(schema12, root, path67, found2, depth, isRoot = false) {
43716
43716
  } else if (values.every((value) => typeof value === "number")) {
43717
43717
  out.type = "string";
43718
43718
  out.enum = values.map(String);
43719
- found2.push({ path: path67, kind: "number" });
43719
+ found2.push({ path: path68, kind: "number" });
43720
43720
  } else {
43721
43721
  notes.push(`One of: ${values.map((value) => JSON.stringify(value)).join(", ")}.`);
43722
43722
  }
@@ -43730,8 +43730,8 @@ function convert(schema12, root, path67, found2, depth, isRoot = false) {
43730
43730
  out.description = description;
43731
43731
  return out;
43732
43732
  }
43733
- function asJsonString(node, path67, found2, what) {
43734
- found2.push({ path: path67, kind: "json" });
43733
+ function asJsonString(node, path68, found2, what) {
43734
+ found2.push({ path: path68, kind: "json" });
43735
43735
  const example = exampleFor(node);
43736
43736
  return {
43737
43737
  type: "string",
@@ -45110,8 +45110,8 @@ var SUPERSEDED_MARKER = "[Superseded: this file was read again later in the conv
45110
45110
  function readFilePath(argumentsJson) {
45111
45111
  try {
45112
45112
  const parsed = JSON.parse(argumentsJson.length > 0 ? argumentsJson : "{}");
45113
- const path67 = parsed.path;
45114
- return typeof path67 === "string" && path67.length > 0 ? path67 : void 0;
45113
+ const path68 = parsed.path;
45114
+ return typeof path68 === "string" && path68.length > 0 ? path68 : void 0;
45115
45115
  } catch {
45116
45116
  return void 0;
45117
45117
  }
@@ -45124,8 +45124,8 @@ function dropSupersededReads(messages) {
45124
45124
  for (const toolCall of message6.toolCalls ?? []) {
45125
45125
  if (toolCall.name !== "read_file")
45126
45126
  continue;
45127
- const path67 = readFilePath(toolCall.arguments);
45128
- if (path67 === void 0)
45127
+ const path68 = readFilePath(toolCall.arguments);
45128
+ if (path68 === void 0)
45129
45129
  continue;
45130
45130
  keyByCallId.set(toolCall.id, toolCall.arguments);
45131
45131
  }
@@ -46133,6 +46133,18 @@ function pruneProgress(plan3, progress) {
46133
46133
  kept[id] = entry;
46134
46134
  return kept;
46135
46135
  }
46136
+ function startsNewWork(previousPlan, previousProgress, nextPlan) {
46137
+ const before = parseCheckpoints(previousPlan);
46138
+ const after = parseCheckpoints(nextPlan);
46139
+ if (after.length === 0)
46140
+ return false;
46141
+ if (before.length === 0)
46142
+ return true;
46143
+ if (before.every((step) => previousProgress?.[step.id]?.status === "done"))
46144
+ return true;
46145
+ const kept = new Set(before.map((step) => step.id));
46146
+ return !after.some((step) => kept.has(step.id));
46147
+ }
46136
46148
  function markCheckpoint(plan3, progress, index, status2) {
46137
46149
  const checkpoint = parseCheckpoints(plan3).find((candidate) => candidate.index === index);
46138
46150
  if (checkpoint === void 0)
@@ -48234,13 +48246,13 @@ var OpenSearchClient = class {
48234
48246
  * `_bulk`, `_delete_by_query`, index creation — is refused here rather than merely
48235
48247
  * unused, so no future edit or crafted argument can turn a read client into a writer.
48236
48248
  */
48237
- async request(path67, options = {}) {
48249
+ async request(path68, options = {}) {
48238
48250
  const method = options.method ?? "GET";
48239
- const isSearchPost = method === "POST" && /\/_search(\?|$)/.test(path67);
48251
+ const isSearchPost = method === "POST" && /\/_search(\?|$)/.test(path68);
48240
48252
  if (method !== "GET" && !isSearchPost) {
48241
- throw new OpenSearchError(`Refusing ${method} ${path67}: this client is read-only. Indexing goes through the indexer, which the user starts from Settings.`);
48253
+ throw new OpenSearchError(`Refusing ${method} ${path68}: this client is read-only. Indexing goes through the indexer, which the user starts from Settings.`);
48242
48254
  }
48243
- const url2 = `${this.base}${path67}`;
48255
+ const url2 = `${this.base}${path68}`;
48244
48256
  const request2 = {
48245
48257
  method,
48246
48258
  headers: this.headers()
@@ -48407,11 +48419,11 @@ function collectFields(properties, prefix, out) {
48407
48419
  return;
48408
48420
  for (const [name, raw] of Object.entries(properties)) {
48409
48421
  const field2 = raw;
48410
- const path67 = prefix.length > 0 ? `${prefix}.${name}` : name;
48422
+ const path68 = prefix.length > 0 ? `${prefix}.${name}` : name;
48411
48423
  if (typeof field2.type === "string")
48412
- out[path67] = field2.type;
48424
+ out[path68] = field2.type;
48413
48425
  if (field2.properties !== void 0)
48414
- collectFields(field2.properties, path67, out);
48426
+ collectFields(field2.properties, path68, out);
48415
48427
  }
48416
48428
  }
48417
48429
  function describeStatus(status2, url2, body) {
@@ -48430,23 +48442,23 @@ function describeStatus(status2, url2, body) {
48430
48442
  var TEXT_TYPES = /* @__PURE__ */ new Set(["text", "match_only_text", "search_as_you_type", "wildcard"]);
48431
48443
  var KEYWORD_TYPES = /* @__PURE__ */ new Set(["keyword", "constant_keyword"]);
48432
48444
  var NOISE_FIELDS = /* @__PURE__ */ new Set(["@version", "ecs", "tags", "stream", "input", "agent", "host", "event"]);
48433
- function leafName(path67) {
48434
- const parts = path67.split(".");
48435
- return parts[parts.length - 1] ?? path67;
48445
+ function leafName(path68) {
48446
+ const parts = path68.split(".");
48447
+ return parts[parts.length - 1] ?? path68;
48436
48448
  }
48437
48449
  function selectQueryFields(mapping, limit = 25) {
48438
48450
  const text2 = [];
48439
48451
  const keyword = [];
48440
- for (const [path67, type] of Object.entries(mapping)) {
48441
- if (NOISE_FIELDS.has(leafName(path67)) || NOISE_FIELDS.has(path67.split(".")[0] ?? ""))
48452
+ for (const [path68, type] of Object.entries(mapping)) {
48453
+ if (NOISE_FIELDS.has(leafName(path68)) || NOISE_FIELDS.has(path68.split(".")[0] ?? ""))
48442
48454
  continue;
48443
48455
  if (TEXT_TYPES.has(type)) {
48444
- text2.push(path67);
48456
+ text2.push(path68);
48445
48457
  } else if (KEYWORD_TYPES.has(type)) {
48446
- const parent = path67.replace(/\.keyword$/, "");
48447
- if (path67.endsWith(".keyword") && TEXT_TYPES.has(mapping[parent] ?? ""))
48458
+ const parent = path68.replace(/\.keyword$/, "");
48459
+ if (path68.endsWith(".keyword") && TEXT_TYPES.has(mapping[parent] ?? ""))
48448
48460
  continue;
48449
- keyword.push(path67);
48461
+ keyword.push(path68);
48450
48462
  }
48451
48463
  }
48452
48464
  const byDepth = (a, b) => a.split(".").length - b.split(".").length || a.localeCompare(b);
@@ -48588,8 +48600,8 @@ var OpenSearchIndexWriter = class {
48588
48600
  }
48589
48601
  return headers;
48590
48602
  }
48591
- async request(path67, method, body, signal) {
48592
- const url2 = `${this.connection.url.replace(/\/+$/, "")}${path67}`;
48603
+ async request(path68, method, body, signal) {
48604
+ const url2 = `${this.connection.url.replace(/\/+$/, "")}${path68}`;
48593
48605
  const request2 = { method, headers: this.headers() };
48594
48606
  if (body !== void 0) {
48595
48607
  if (typeof body === "string") {
@@ -48803,13 +48815,13 @@ var OpenSearchIndexWriter = class {
48803
48815
  for (const hit of hits) {
48804
48816
  const source = hit._source ?? {};
48805
48817
  const vector = source.vector;
48806
- const path67 = source.path;
48807
- if (typeof path67 !== "string" || !Array.isArray(vector))
48818
+ const path68 = source.path;
48819
+ if (typeof path68 !== "string" || !Array.isArray(vector))
48808
48820
  continue;
48809
48821
  documents.push({
48810
48822
  id: hit._id ?? "",
48811
48823
  text: typeof source.text === "string" ? source.text : "",
48812
- path: path67,
48824
+ path: path68,
48813
48825
  startLine: typeof source.startLine === "number" ? source.startLine : 1,
48814
48826
  endLine: typeof source.endLine === "number" ? source.endLine : 1,
48815
48827
  vector
@@ -48885,8 +48897,8 @@ var RestTransport = class {
48885
48897
  * threw would push every caller into catching and re-inspecting an error to find out
48886
48898
  * whether it was really an error. `expectOk` is there for the cases that are.
48887
48899
  */
48888
- async send(path67, method, body, signal) {
48889
- const url2 = `${this.connection.url.replace(/\/+$/, "")}${path67}`;
48900
+ async send(path68, method, body, signal) {
48901
+ const url2 = `${this.connection.url.replace(/\/+$/, "")}${path68}`;
48890
48902
  const request2 = { method, headers: this.headers() };
48891
48903
  if (body !== void 0)
48892
48904
  request2.body = JSON.stringify(body);
@@ -48912,11 +48924,11 @@ var RestTransport = class {
48912
48924
  return { status: response.status, body: parsed };
48913
48925
  }
48914
48926
  /** Sends, and throws unless the status is 2xx. */
48915
- async expectOk(path67, method, body, signal) {
48916
- const result = await this.send(path67, method, body, signal);
48927
+ async expectOk(path68, method, body, signal) {
48928
+ const result = await this.send(path68, method, body, signal);
48917
48929
  if (result.status < 200 || result.status >= 300) {
48918
48930
  const detail = typeof result.body === "string" ? result.body : JSON.stringify(result.body ?? "");
48919
- throw new VectorStoreError(`${method} ${path67} on ${this.label} returned HTTP ${String(result.status)}. ${detail.slice(0, 300)}` + this.explain(result.body), result.status);
48931
+ throw new VectorStoreError(`${method} ${path68} on ${this.label} returned HTTP ${String(result.status)}. ${detail.slice(0, 300)}` + this.explain(result.body), result.status);
48920
48932
  }
48921
48933
  return result.body;
48922
48934
  }
@@ -49102,10 +49114,10 @@ var ChromaSearcher = class extends ChromaBase {
49102
49114
  const matches = [];
49103
49115
  for (let index = 0; index < ids.length; index++) {
49104
49116
  const metadata = metadatas[index] ?? {};
49105
- const path67 = typeof metadata.path === "string" ? metadata.path : void 0;
49106
- if (path67 === void 0)
49117
+ const path68 = typeof metadata.path === "string" ? metadata.path : void 0;
49118
+ if (path68 === void 0)
49107
49119
  continue;
49108
- if (prefix !== void 0 && prefix.length > 0 && !path67.startsWith(prefix))
49120
+ if (prefix !== void 0 && prefix.length > 0 && !path68.startsWith(prefix))
49109
49121
  continue;
49110
49122
  if (projectHere && typeof metadata.project === "string" && !options.project?.names.includes(metadata.project))
49111
49123
  continue;
@@ -49119,7 +49131,7 @@ var ChromaSearcher = class extends ChromaBase {
49119
49131
  */
49120
49132
  score: typeof distance === "number" ? 1 / (1 + Math.max(0, distance)) : 0,
49121
49133
  text: documents[index] ?? (typeof metadata.text === "string" ? metadata.text : ""),
49122
- path: path67
49134
+ path: path68
49123
49135
  };
49124
49136
  if (typeof metadata.startLine === "number")
49125
49137
  match.startLine = metadata.startLine;
@@ -49230,13 +49242,13 @@ var ChromaIndexWriter = class extends ChromaBase {
49230
49242
  for (let index = 0; index < ids.length; index++) {
49231
49243
  const metadata = result.metadatas?.[index] ?? {};
49232
49244
  const vector = result.embeddings?.[index];
49233
- const path67 = typeof metadata.path === "string" ? metadata.path : void 0;
49234
- if (path67 === void 0 || !Array.isArray(vector))
49245
+ const path68 = typeof metadata.path === "string" ? metadata.path : void 0;
49246
+ if (path68 === void 0 || !Array.isArray(vector))
49235
49247
  continue;
49236
49248
  documents.push({
49237
49249
  id: ids[index] ?? "",
49238
49250
  text: result.documents?.[index] ?? "",
49239
- path: path67,
49251
+ path: path68,
49240
49252
  startLine: typeof metadata.startLine === "number" ? metadata.startLine : 1,
49241
49253
  endLine: typeof metadata.endLine === "number" ? metadata.endLine : 1,
49242
49254
  vector
@@ -49253,9 +49265,9 @@ var ChromaIndexWriter = class extends ChromaBase {
49253
49265
  const result = await this.rest.expectOk(`${this.base}/collections/${found2.id}/get`, "POST", { include: ["metadatas"], limit }, options.signal);
49254
49266
  const paths = /* @__PURE__ */ new Set();
49255
49267
  for (const metadata of result.metadatas ?? []) {
49256
- const path67 = metadata?.path;
49257
- if (typeof path67 === "string")
49258
- paths.add(path67);
49268
+ const path68 = metadata?.path;
49269
+ if (typeof path68 === "string")
49270
+ paths.add(path68);
49259
49271
  }
49260
49272
  return [...paths];
49261
49273
  }
@@ -49282,14 +49294,14 @@ var MARKER_ID = "5f6d2a41-0000-5000-8000-6c69676874c0";
49282
49294
  var MARKER_MARK = "light-code";
49283
49295
  function toMatch(point) {
49284
49296
  const payload = point.payload ?? {};
49285
- const path67 = typeof payload.path === "string" ? payload.path : void 0;
49286
- if (path67 === void 0)
49297
+ const path68 = typeof payload.path === "string" ? payload.path : void 0;
49298
+ if (path68 === void 0)
49287
49299
  return void 0;
49288
49300
  const match = {
49289
49301
  id: typeof payload.chunkId === "string" ? payload.chunkId : point.id,
49290
49302
  score: typeof point.score === "number" ? point.score : 0,
49291
49303
  text: typeof payload.text === "string" ? payload.text : "",
49292
- path: path67
49304
+ path: path68
49293
49305
  };
49294
49306
  if (typeof payload.startLine === "number")
49295
49307
  match.startLine = payload.startLine;
@@ -49483,13 +49495,13 @@ var QdrantIndexWriter = class extends QdrantBase {
49483
49495
  const documents = [];
49484
49496
  for (const point of result.body.result?.points ?? []) {
49485
49497
  const payload = point.payload ?? {};
49486
- const path67 = typeof payload.path === "string" ? payload.path : void 0;
49487
- if (path67 === void 0 || !Array.isArray(point.vector))
49498
+ const path68 = typeof payload.path === "string" ? payload.path : void 0;
49499
+ if (path68 === void 0 || !Array.isArray(point.vector))
49488
49500
  continue;
49489
49501
  documents.push({
49490
49502
  id: typeof payload.chunkId === "string" ? payload.chunkId : point.id,
49491
49503
  text: typeof payload.text === "string" ? payload.text : "",
49492
- path: path67,
49504
+ path: path68,
49493
49505
  startLine: typeof payload.startLine === "number" ? payload.startLine : 1,
49494
49506
  endLine: typeof payload.endLine === "number" ? payload.endLine : 1,
49495
49507
  vector: point.vector
@@ -49516,9 +49528,9 @@ var QdrantIndexWriter = class extends QdrantBase {
49516
49528
  throw new VectorStoreError(`Could not list "${collection}" (HTTP ${String(result.status)}).` + wrongServerHint("qdrant", result.body, this.rest.label), result.status);
49517
49529
  }
49518
49530
  for (const point of result.body.result?.points ?? []) {
49519
- const path67 = point.payload?.path;
49520
- if (typeof path67 === "string")
49521
- paths.add(path67);
49531
+ const path68 = point.payload?.path;
49532
+ if (typeof path68 === "string")
49533
+ paths.add(path68);
49522
49534
  }
49523
49535
  offset = result.body.result?.next_page_offset;
49524
49536
  if (offset === void 0 || offset === null)
@@ -50052,8 +50064,8 @@ function teamSkillDocument(skill, body, vector, attribution) {
50052
50064
  vector
50053
50065
  };
50054
50066
  }
50055
- function nameFromPath(path67) {
50056
- return path67.startsWith("skill:") ? path67.slice("skill:".length) : path67;
50067
+ function nameFromPath(path68) {
50068
+ return path68.startsWith("skill:") ? path68.slice("skill:".length) : path68;
50057
50069
  }
50058
50070
  function toHit(match, self) {
50059
50071
  return {
@@ -53139,8 +53151,8 @@ function createMailCoverageTool(options) {
53139
53151
  }
53140
53152
  };
53141
53153
  }
53142
- function normaliseFolder(path67) {
53143
- return path67.toLowerCase().replace(/[\\/]+/g, "\\");
53154
+ function normaliseFolder(path68) {
53155
+ return path68.toLowerCase().replace(/[\\/]+/g, "\\");
53144
53156
  }
53145
53157
  function haystackOf(record2) {
53146
53158
  return `${record2.subject}
@@ -53636,7 +53648,7 @@ async function refreshMail(options) {
53636
53648
  const limit = options.batchLimit ?? 2e3;
53637
53649
  const previewChars = options.previewChars ?? 400;
53638
53650
  const sinceMs = Date.now() - options.days * 24 * 60 * 60 * 1e3;
53639
- const harvested = await options.harvest(options.folders.map((path67) => ({ path: path67, sinceMs })), { limit, previewChars });
53651
+ const harvested = await options.harvest(options.folders.map((path68) => ({ path: path68, sinceMs })), { limit, previewChars });
53640
53652
  const fetched = harvested.messages.map(toRecord);
53641
53653
  if (fetched.length === 0) {
53642
53654
  return { added: 0, more: false, total: known.length, embedded: 0, backfilled: 0, complete: [] };
@@ -53677,9 +53689,9 @@ async function syncMail(options) {
53677
53689
  const backfillDone = await options.store.loadBackfillState();
53678
53690
  const limit = options.batchLimit ?? 500;
53679
53691
  const previewChars = options.previewChars ?? 400;
53680
- const forwardRequests = options.folders.map((path67) => {
53681
- const mark = marks.get(path67);
53682
- return mark === void 0 ? { path: path67 } : { path: path67, sinceMs: mark.newest - 1e3 };
53692
+ const forwardRequests = options.folders.map((path68) => {
53693
+ const mark = marks.get(path68);
53694
+ return mark === void 0 ? { path: path68 } : { path: path68, sinceMs: mark.newest - 1e3 };
53683
53695
  });
53684
53696
  const forward = await options.harvest(forwardRequests, { limit, previewChars });
53685
53697
  let candidates = forward.messages.map(toRecord);
@@ -53688,15 +53700,15 @@ async function syncMail(options) {
53688
53700
  let more = forward.truncated;
53689
53701
  const remaining = limit - candidates.length;
53690
53702
  const floor = options.retentionMonths === void 0 ? void 0 : monthsBefore(options.now ?? Date.now(), options.retentionMonths);
53691
- const outstanding = options.folders.filter((path67) => marks.has(path67) && backfillDone[path67] !== true);
53692
- const atFloor = floor === void 0 ? [] : outstanding.filter((path67) => marks.get(path67).oldest <= floor);
53693
- const behind = outstanding.filter((path67) => !atFloor.includes(path67));
53703
+ const outstanding = options.folders.filter((path68) => marks.has(path68) && backfillDone[path68] !== true);
53704
+ const atFloor = floor === void 0 ? [] : outstanding.filter((path68) => marks.get(path68).oldest <= floor);
53705
+ const behind = outstanding.filter((path68) => !atFloor.includes(path68));
53694
53706
  completed.push(...atFloor);
53695
53707
  if (remaining > 0 && behind.length > 0 && options.signal?.aborted !== true) {
53696
- const backRequests = behind.map((path67) => ({
53697
- path: path67,
53708
+ const backRequests = behind.map((path68) => ({
53709
+ path: path68,
53698
53710
  // Strictly older, so the oldest held message is not fetched again every pass.
53699
- beforeMs: marks.get(path67).oldest,
53711
+ beforeMs: marks.get(path68).oldest,
53700
53712
  // And no older than retention wants. The harvest ANDs the two into one window.
53701
53713
  ...floor === void 0 ? {} : { sinceMs: floor }
53702
53714
  }));
@@ -53704,9 +53716,9 @@ async function syncMail(options) {
53704
53716
  backfilled = backward.messages.length;
53705
53717
  candidates = [...candidates, ...backward.messages.map(toRecord)];
53706
53718
  const returnedFor = new Set(backward.messages.map((message6) => message6.folder));
53707
- for (const path67 of behind) {
53708
- if (!returnedFor.has(path67))
53709
- completed.push(path67);
53719
+ for (const path68 of behind) {
53720
+ if (!returnedFor.has(path68))
53721
+ completed.push(path68);
53710
53722
  }
53711
53723
  if (backward.truncated || backfilled > 0)
53712
53724
  more = true;
@@ -53714,7 +53726,7 @@ async function syncMail(options) {
53714
53726
  if (completed.length > 0) {
53715
53727
  await options.store.saveBackfillState({
53716
53728
  ...backfillDone,
53717
- ...Object.fromEntries(completed.map((path67) => [path67, true]))
53729
+ ...Object.fromEntries(completed.map((path68) => [path68, true]))
53718
53730
  });
53719
53731
  }
53720
53732
  const fresh = withoutKnown(candidates, known);
@@ -54061,14 +54073,14 @@ function formatBytes(size) {
54061
54073
  return `${(size / (1 << 10)).toFixed(1)}KB`;
54062
54074
  return `${String(size)}B`;
54063
54075
  }
54064
- async function readTail(fs47, path67, size, count3) {
54076
+ async function readTail(fs48, path68, size, count3) {
54065
54077
  let span = Math.min(size, CHUNK);
54066
54078
  let text2;
54067
54079
  let start;
54068
54080
  for (; ; ) {
54069
54081
  start = Math.max(0, size - span);
54070
54082
  const decoder2 = new import_node_string_decoder.StringDecoder("utf8");
54071
- text2 = decoder2.write(await fs47.readBytesSlice(path67, start, size)) + decoder2.end();
54083
+ text2 = decoder2.write(await fs48.readBytesSlice(path68, start, size)) + decoder2.end();
54072
54084
  const enough = text2.split("\n").length > count3;
54073
54085
  if (enough || start === 0 || span >= size)
54074
54086
  break;
@@ -54086,7 +54098,7 @@ async function readTail(fs47, path67, size, count3) {
54086
54098
  hasMoreAfter: false
54087
54099
  };
54088
54100
  }
54089
- async function readLineWindow(fs47, path67, size, from, count3) {
54101
+ async function readLineWindow(fs48, path68, size, from, count3) {
54090
54102
  const decoder2 = new import_node_string_decoder.StringDecoder("utf8");
54091
54103
  const lines2 = [];
54092
54104
  let pending = "";
@@ -54101,7 +54113,7 @@ async function readLineWindow(fs47, path67, size, from, count3) {
54101
54113
  };
54102
54114
  scan: while (position < size) {
54103
54115
  const end = Math.min(size, position + CHUNK);
54104
- pending += decoder2.write(await fs47.readBytesSlice(path67, position, end));
54116
+ pending += decoder2.write(await fs48.readBytesSlice(path68, position, end));
54105
54117
  position = end;
54106
54118
  const parts = pending.split(/\r\n|\r|\n/);
54107
54119
  pending = parts.pop() ?? "";
@@ -54124,13 +54136,13 @@ async function readLineWindow(fs47, path67, size, from, count3) {
54124
54136
  hasMoreAfter: !reachedEnd || lineNumber > from + lines2.length
54125
54137
  };
54126
54138
  }
54127
- async function countLines(fs47, path67, size) {
54139
+ async function countLines(fs48, path68, size) {
54128
54140
  let newlines = 0;
54129
54141
  let position = 0;
54130
54142
  let lastByte = -1;
54131
54143
  while (position < size) {
54132
54144
  const end = Math.min(size, position + CHUNK);
54133
- const buffer = await fs47.readBytesSlice(path67, position, end);
54145
+ const buffer = await fs48.readBytesSlice(path68, position, end);
54134
54146
  for (const byte of buffer)
54135
54147
  if (byte === 10)
54136
54148
  newlines += 1;
@@ -61590,13 +61602,13 @@ function appendSkillImages(body, images) {
61590
61602
  const trimmed = body.replace(/\s+$/, "");
61591
61603
  return [trimmed, "", "## Images", "", ...missing.map(renderSkillImage)].join("\n");
61592
61604
  }
61593
- async function listSkillImages(skillFilePath, fs47) {
61605
+ async function listSkillImages(skillFilePath, fs48) {
61594
61606
  const asPosix = skillFilePath.split(String.fromCharCode(92)).join("/");
61595
61607
  if (!asPosix.toLowerCase().endsWith("/skill.md"))
61596
61608
  return [];
61597
61609
  const dir = `${skillFilePath.slice(0, skillFilePath.length - "SKILL.md".length)}${SKILL_IMAGE_DIR}`;
61598
61610
  try {
61599
- const entries = await fs47.readdir(dir);
61611
+ const entries = await fs48.readdir(dir);
61600
61612
  return entries.filter((entry) => !entry.isDirectory && skillImageType(entry.name) !== void 0).map((entry) => entry.name).sort();
61601
61613
  } catch {
61602
61614
  return [];
@@ -61646,12 +61658,12 @@ function skillFilesDir(skillFilePath) {
61646
61658
  return void 0;
61647
61659
  return `${skillFilePath.slice(0, skillFilePath.length - "SKILL.md".length)}${SKILL_FILE_DIR}`;
61648
61660
  }
61649
- async function listSkillFiles(skillFilePath, fs47) {
61661
+ async function listSkillFiles(skillFilePath, fs48) {
61650
61662
  const dir = skillFilesDir(skillFilePath);
61651
61663
  if (dir === void 0)
61652
61664
  return [];
61653
61665
  try {
61654
- const entries = await fs47.readdir(dir);
61666
+ const entries = await fs48.readdir(dir);
61655
61667
  return entries.filter((entry) => !entry.isDirectory).map((entry) => entry.name).sort();
61656
61668
  } catch {
61657
61669
  return [];
@@ -62306,9 +62318,9 @@ function secretRefsFor(section, config2) {
62306
62318
  }
62307
62319
  return refs;
62308
62320
  }
62309
- function getPath2(source, path67) {
62321
+ function getPath2(source, path68) {
62310
62322
  let value = source;
62311
- for (const part of path67.split(".")) {
62323
+ for (const part of path68.split(".")) {
62312
62324
  if (typeof value !== "object" || value === null)
62313
62325
  return void 0;
62314
62326
  value = value[part];
@@ -62322,8 +62334,8 @@ function hasValue(value) {
62322
62334
  return Object.keys(value).length > 0;
62323
62335
  return true;
62324
62336
  }
62325
- function setPath(target, path67, value) {
62326
- const [head, ...rest] = path67.split(".");
62337
+ function setPath(target, path68, value) {
62338
+ const [head, ...rest] = path68.split(".");
62327
62339
  if (head === void 0)
62328
62340
  return;
62329
62341
  if (rest.length === 0) {
@@ -62343,8 +62355,8 @@ function setPath(target, path67, value) {
62343
62355
  var NESTED_PATHS = SHARE_SECTIONS.flatMap((section) => section.nested ?? []);
62344
62356
  function withoutNested(config2) {
62345
62357
  const copy = { ...config2 };
62346
- for (const path67 of NESTED_PATHS)
62347
- setPath(copy, path67, void 0);
62358
+ for (const path68 of NESTED_PATHS)
62359
+ setPath(copy, path68, void 0);
62348
62360
  return copy;
62349
62361
  }
62350
62362
  function describeSections(config2) {
@@ -62353,7 +62365,7 @@ function describeSections(config2) {
62353
62365
  id: section.id,
62354
62366
  label: section.label,
62355
62367
  description: section.description,
62356
- present: section.keys.some((key3) => has(owned, key3)) || (section.nested ?? []).some((path67) => hasValue(getPath2(config2, path67))),
62368
+ present: section.keys.some((key3) => has(owned, key3)) || (section.nested ?? []).some((path68) => hasValue(getPath2(config2, path68))),
62357
62369
  detail: detailFor(section, config2),
62358
62370
  secretRefs: secretRefsFor(section, config2),
62359
62371
  ...section.machineSpecific === true ? { machineSpecific: true } : {},
@@ -62374,18 +62386,18 @@ function buildExport(config2, selected) {
62374
62386
  if (has(config2, key3))
62375
62387
  exported[key3] = config2[key3];
62376
62388
  }
62377
- for (const path67 of section.nested ?? []) {
62378
- const value = getPath2(config2, path67);
62389
+ for (const path68 of section.nested ?? []) {
62390
+ const value = getPath2(config2, path68);
62379
62391
  if (hasValue(value))
62380
- setPath(exported, path67, value);
62392
+ setPath(exported, path68, value);
62381
62393
  }
62382
- for (const path67 of section.strip ?? [])
62383
- stripPath(exported, path67);
62394
+ for (const path68 of section.strip ?? [])
62395
+ stripPath(exported, path68);
62384
62396
  }
62385
62397
  return exported;
62386
62398
  }
62387
- function stripPath(target, path67) {
62388
- const [head, ...rest] = path67.split(".");
62399
+ function stripPath(target, path68) {
62400
+ const [head, ...rest] = path68.split(".");
62389
62401
  if (head === void 0)
62390
62402
  return;
62391
62403
  const value = target[head];
@@ -62413,22 +62425,22 @@ function applyImport(existing, imported, selected) {
62413
62425
  else
62414
62426
  delete merged[key3];
62415
62427
  }
62416
- for (const path67 of section.strip ?? []) {
62417
- carryPath(existing, merged, path67);
62428
+ for (const path68 of section.strip ?? []) {
62429
+ carryPath(existing, merged, path68);
62418
62430
  }
62419
62431
  }
62420
62432
  for (const section of SHARE_SECTIONS) {
62421
62433
  if (!chosen.has(section.id))
62422
62434
  continue;
62423
- for (const path67 of section.nested ?? []) {
62424
- const value = getPath2(imported, path67);
62425
- setPath(merged, path67, hasValue(value) ? value : void 0);
62435
+ for (const path68 of section.nested ?? []) {
62436
+ const value = getPath2(imported, path68);
62437
+ setPath(merged, path68, hasValue(value) ? value : void 0);
62426
62438
  }
62427
62439
  }
62428
62440
  return merged;
62429
62441
  }
62430
- function carryPath(from, to, path67) {
62431
- const [head, ...rest] = path67.split(".");
62442
+ function carryPath(from, to, path68) {
62443
+ const [head, ...rest] = path68.split(".");
62432
62444
  if (head === void 0)
62433
62445
  return;
62434
62446
  const source = from[head];
@@ -64881,7 +64893,7 @@ The conversation is longer than this model accepts, and it could not be shortene
64881
64893
  }
64882
64894
 
64883
64895
  // ../../packages/core/dist/host/bridge.js
64884
- var import_node_crypto20 = require("node:crypto");
64896
+ var import_node_crypto21 = require("node:crypto");
64885
64897
 
64886
64898
  // ../../packages/core/dist/atlassian/autosysGateway.js
64887
64899
  function withBasicCredentials(auth2, headerName, username, password) {
@@ -65006,7 +65018,7 @@ function gatewayFromSettings(input, stored) {
65006
65018
  }
65007
65019
 
65008
65020
  // ../../packages/core/dist/host/bridge.js
65009
- var import_node_fs13 = require("node:fs");
65021
+ var import_node_fs14 = require("node:fs");
65010
65022
  var import_node_child_process19 = require("node:child_process");
65011
65023
  var import_promises31 = __toESM(require("node:fs/promises"), 1);
65012
65024
 
@@ -65790,7 +65802,7 @@ function ignoreDecision(rules, relative, isDirectory2, initial) {
65790
65802
  }
65791
65803
  return ignored;
65792
65804
  }
65793
- async function repositoryWideRules(fs47, root, globalIgnoreFile) {
65805
+ async function repositoryWideRules(fs48, root, globalIgnoreFile) {
65794
65806
  const sources = [
65795
65807
  globalIgnoreFile ?? import_node_path29.default.join(process.env["XDG_CONFIG_HOME"] ?? import_node_path29.default.join(import_node_os4.default.homedir(), ".config"), "git", "ignore"),
65796
65808
  import_node_path29.default.join(root, ".git", "info", "exclude")
@@ -65798,16 +65810,16 @@ async function repositoryWideRules(fs47, root, globalIgnoreFile) {
65798
65810
  const rules = [];
65799
65811
  for (const source of sources) {
65800
65812
  try {
65801
- rules.push(...parseIgnoreFile(await fs47.readFile(source), ""));
65813
+ rules.push(...parseIgnoreFile(await fs48.readFile(source), ""));
65802
65814
  } catch {
65803
65815
  }
65804
65816
  }
65805
65817
  return rules;
65806
65818
  }
65807
- async function walkFiles(fs47, root, options) {
65819
+ async function walkFiles(fs48, root, options) {
65808
65820
  const maxFiles = options.maxFiles ?? DEFAULT_MAX_FILES;
65809
65821
  const files = [];
65810
- const baseRules = options.includeIgnored ? [] : await repositoryWideRules(fs47, root, options.globalIgnoreFile);
65822
+ const baseRules = options.includeIgnored ? [] : await repositoryWideRules(fs48, root, options.globalIgnoreFile);
65811
65823
  const pending = [{ relative: "", rules: baseRules }];
65812
65824
  while (pending.length > 0) {
65813
65825
  if (options.signal?.aborted === true)
@@ -65816,14 +65828,14 @@ async function walkFiles(fs47, root, options) {
65816
65828
  const absolute = relative.length > 0 ? import_node_path29.default.join(root, ...relative.split("/")) : root;
65817
65829
  let entries;
65818
65830
  try {
65819
- entries = await fs47.readdir(absolute);
65831
+ entries = await fs48.readdir(absolute);
65820
65832
  } catch {
65821
65833
  continue;
65822
65834
  }
65823
65835
  let rules = inherited;
65824
65836
  if (!options.includeIgnored && entries.some((entry) => entry.name === ".gitignore" && !entry.isDirectory)) {
65825
65837
  try {
65826
- const text2 = await fs47.readFile(import_node_path29.default.join(absolute, ".gitignore"));
65838
+ const text2 = await fs48.readFile(import_node_path29.default.join(absolute, ".gitignore"));
65827
65839
  rules = [...inherited, ...parseIgnoreFile(text2, relative)];
65828
65840
  } catch {
65829
65841
  }
@@ -65885,12 +65897,12 @@ function fileFilter(filePattern) {
65885
65897
  const regex = globToRegExp(glob.startsWith("/") ? glob.slice(1) : glob, anchored);
65886
65898
  return (relative) => regex.test(relative) !== exclude;
65887
65899
  }
65888
- async function searchFiles(fs47, root, options) {
65900
+ async function searchFiles(fs48, root, options) {
65889
65901
  const regex = compilePattern(options.pattern);
65890
65902
  const admits = fileFilter(options.filePattern);
65891
65903
  const context = options.contextLines ?? 2;
65892
65904
  const maxOutput = options.maxOutputChars ?? DEFAULT_MAX_OUTPUT;
65893
- const { files, truncated: walkTruncated } = await walkFiles(fs47, root, options);
65905
+ const { files, truncated: walkTruncated } = await walkFiles(fs48, root, options);
65894
65906
  const separator = process.platform === "win32" ? "\\" : "/";
65895
65907
  const chunks = [];
65896
65908
  let size = 0;
@@ -65903,10 +65915,10 @@ async function searchFiles(fs47, root, options) {
65903
65915
  const absolute = import_node_path29.default.join(root, ...relative.split("/"));
65904
65916
  let bytes;
65905
65917
  try {
65906
- const stat = await fs47.stat(absolute);
65918
+ const stat = await fs48.stat(absolute);
65907
65919
  if (stat.size > MAX_FILE_BYTES)
65908
65920
  continue;
65909
- bytes = await fs47.readBytes(absolute);
65921
+ bytes = await fs48.readBytes(absolute);
65910
65922
  } catch {
65911
65923
  continue;
65912
65924
  }
@@ -67936,8 +67948,8 @@ function pick2(hubs, name) {
67936
67948
 
67937
67949
  // ../../packages/core/dist/host/bridge.js
67938
67950
  var import_node_os7 = __toESM(require("node:os"), 1);
67939
- var import_node_fs14 = require("node:fs");
67940
- var import_node_path56 = __toESM(require("node:path"), 1);
67951
+ var import_node_fs15 = require("node:fs");
67952
+ var import_node_path57 = __toESM(require("node:path"), 1);
67941
67953
 
67942
67954
  // ../../packages/core/dist/modes/autoGuidance.js
67943
67955
  function idiomsFor(environment) {
@@ -70096,8 +70108,8 @@ var ChangeLedger = class {
70096
70108
  this.chat = chat;
70097
70109
  }
70098
70110
  /** Best effort: a ledger that cannot be written must never fail an edit that happened. */
70099
- record(path67) {
70100
- const line = JSON.stringify({ chat: this.chat, path: normalizeForComparison(path67), at: Date.now() });
70111
+ record(path68) {
70112
+ const line = JSON.stringify({ chat: this.chat, path: normalizeForComparison(path68), at: Date.now() });
70101
70113
  void (0, import_promises24.appendFile)(this.file, `${line}
70102
70114
  `).catch(() => void 0);
70103
70115
  }
@@ -75104,10 +75116,10 @@ function isSafeSegment(value) {
75104
75116
  function isSafeTagName(name) {
75105
75117
  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("."));
75106
75118
  }
75107
- function encodeRepoPath(path67) {
75108
- const segments = path67.replace(/\\/g, "/").split("/").filter((segment) => segment.length > 0);
75119
+ function encodeRepoPath(path68) {
75120
+ const segments = path68.replace(/\\/g, "/").split("/").filter((segment) => segment.length > 0);
75109
75121
  if (segments.length === 0 || segments.some((segment) => segment === ".." || segment === ".")) {
75110
- throw new AtlassianError(`"${path67}" is not a file path inside the repository.`);
75122
+ throw new AtlassianError(`"${path68}" is not a file path inside the repository.`);
75111
75123
  }
75112
75124
  return segments.map(encodeURIComponent).join("/");
75113
75125
  }
@@ -75192,24 +75204,24 @@ var BitbucketClient = class {
75192
75204
  * redirect was followed, the login page came back, and the file "could not be read" although
75193
75205
  * pull requests on the same repository could. `browse` is REST, so it authenticates like those.
75194
75206
  */
75195
- async file(repo, path67, ref, signal) {
75196
- const target = encodeRepoPath(path67);
75207
+ async file(repo, path68, ref, signal) {
75208
+ const target = encodeRepoPath(path68);
75197
75209
  const lines2 = [];
75198
75210
  let start = 0;
75199
75211
  for (let page = 0; page < MAX_FILE_PAGES; page += 1) {
75200
75212
  const query = new URLSearchParams({ start: String(start), limit: String(FILE_PAGE_LINES) });
75201
75213
  if (ref !== void 0 && ref.length > 0)
75202
75214
  query.set("at", ref);
75203
- const body = await this.rest.json(`reading ${path67}`, `${this.repoPath(repo)}/browse/${target}?${query.toString()}`, { method: "GET" }, signal);
75215
+ const body = await this.rest.json(`reading ${path68}`, `${this.repoPath(repo)}/browse/${target}?${query.toString()}`, { method: "GET" }, signal);
75204
75216
  if (body.children !== void 0) {
75205
75217
  const names = (body.children.values ?? []).map((child) => {
75206
75218
  const name = child.path?.toString ?? child.path?.name ?? "?";
75207
75219
  return child.type === "DIRECTORY" ? `${name}/` : name;
75208
75220
  });
75209
- throw new AtlassianError(`${path67} is a folder, not a file. It holds: ${names.join(", ") || "nothing"}.`);
75221
+ throw new AtlassianError(`${path68} is a folder, not a file. It holds: ${names.join(", ") || "nothing"}.`);
75210
75222
  }
75211
75223
  if (body.binary === true)
75212
- throw new AtlassianError(`${path67} is a binary file, so there is no text to read.`);
75224
+ throw new AtlassianError(`${path68} is a binary file, so there is no text to read.`);
75213
75225
  for (const line of body.lines ?? [])
75214
75226
  lines2.push(line.text ?? "");
75215
75227
  if (body.isLastPage !== false || body.nextPageStart === void 0 || body.nextPageStart <= start)
@@ -75320,9 +75332,9 @@ var BitbucketClient = class {
75320
75332
  return out;
75321
75333
  }
75322
75334
  /** A file's bytes at `at`, or undefined when it is not there. */
75323
- async readBytes(repo, path67, at, signal) {
75335
+ async readBytes(repo, path68, at, signal) {
75324
75336
  try {
75325
- return await this.rest.bytes(`reading ${path67}`, `${this.repoPath(repo)}/raw/${encodeRepoPath(path67)}?${new URLSearchParams({ at }).toString()}`, signal);
75337
+ return await this.rest.bytes(`reading ${path68}`, `${this.repoPath(repo)}/raw/${encodeRepoPath(path68)}?${new URLSearchParams({ at }).toString()}`, signal);
75326
75338
  } catch (error51) {
75327
75339
  if (error51 instanceof AtlassianError && error51.status === 404)
75328
75340
  return void 0;
@@ -76146,8 +76158,8 @@ ${text2.slice(-2e4)}`);
76146
76158
  }
76147
76159
  /** Queues a build, then follows the queue item briefly to learn its number. */
76148
76160
  async startBuild(job, parameters, signal) {
76149
- const path67 = jobPath(job, this.base);
76150
- const response = await this.post(`starting ${job}`, parameters !== void 0 && Object.keys(parameters).length > 0 ? `${path67}/buildWithParameters` : `${path67}/build`, parameters ?? {}, signal);
76161
+ const path68 = jobPath(job, this.base);
76162
+ const response = await this.post(`starting ${job}`, parameters !== void 0 && Object.keys(parameters).length > 0 ? `${path68}/buildWithParameters` : `${path68}/build`, parameters ?? {}, signal);
76151
76163
  const location = response.headers["location"];
76152
76164
  const queueId = location === void 0 ? void 0 : /\/queue\/item\/(\d+)/.exec(location)?.[1];
76153
76165
  if (queueId === void 0)
@@ -76184,10 +76196,10 @@ ${text2.slice(-2e4)}`);
76184
76196
  }
76185
76197
  /** Creates a job from a whole config.xml, in the folder its name gives (`folder/sub/new-job`). */
76186
76198
  async createJob(job, xml, signal) {
76187
- const path67 = jobPath(job, this.base);
76188
- const cut = path67.lastIndexOf("/job/");
76189
- const parent = path67.slice(0, cut);
76190
- const name = decodeURIComponent(path67.slice(cut + "/job/".length));
76199
+ const path68 = jobPath(job, this.base);
76200
+ const cut = path68.lastIndexOf("/job/");
76201
+ const parent = path68.slice(0, cut);
76202
+ const name = decodeURIComponent(path68.slice(cut + "/job/".length));
76191
76203
  await this.postBody(`creating ${job}`, `${parent}/createItem?${new URLSearchParams({ name }).toString()}`, xml, "application/xml", signal);
76192
76204
  }
76193
76205
  /** Replaces a job's config.xml. */
@@ -76500,14 +76512,14 @@ ${client.base}${jobPath(job, client.base)}/${buildRef(params3.build)}/`
76500
76512
  };
76501
76513
  return tool;
76502
76514
  }
76503
- async function readJenkinsfile(path67, context) {
76504
- const resolved = await resolveToolPath(context, path67);
76515
+ async function readJenkinsfile(path68, context) {
76516
+ const resolved = await resolveToolPath(context, path68);
76505
76517
  if (!resolved.ok)
76506
76518
  return { ok: false, message: resolved.message };
76507
76519
  try {
76508
76520
  return { ok: true, text: await context.fs.readFile(resolved.realPath), realPath: resolved.realPath };
76509
76521
  } catch (error51) {
76510
- return { ok: false, message: `Could not read ${path67}: ${error51 instanceof Error ? error51.message : String(error51)}` };
76522
+ return { ok: false, message: `Could not read ${path68}: ${error51 instanceof Error ? error51.message : String(error51)}` };
76511
76523
  }
76512
76524
  }
76513
76525
  var checkSchema = external_exports.object({
@@ -77283,9 +77295,9 @@ var AutosysClient = class _AutosysClient {
77283
77295
  * Something this server may not offer at the documented address: undefined for a 404, so a tool can
77284
77296
  * say which setting (`autosys.paths`) points elsewhere, rather than reporting "found nothing".
77285
77297
  */
77286
- async optional(doing, path67, signal) {
77298
+ async optional(doing, path68, signal) {
77287
77299
  try {
77288
- return asList(await this.rest.json(doing, path67, { method: "GET" }, signal));
77300
+ return asList(await this.rest.json(doing, path68, { method: "GET" }, signal));
77289
77301
  } catch (error51) {
77290
77302
  if (error51 instanceof AtlassianError && error51.status === 404)
77291
77303
  return void 0;
@@ -78588,13 +78600,13 @@ var MonitorHistoryStore = class {
78588
78600
  if (!isSafeIndexName(index))
78589
78601
  throw new MonitorHistoryError(`"${index}" is not a usable index name (lowercase letters, digits, - and _).`);
78590
78602
  }
78591
- async send(method, path67, body) {
78603
+ async send(method, path68, body) {
78592
78604
  const headers = { "Content-Type": "application/json" };
78593
78605
  const { username, password } = this.connection;
78594
78606
  if (username !== void 0 && username.length > 0) {
78595
78607
  headers.Authorization = `Basic ${Buffer.from(`${username}:${password ?? ""}`).toString("base64")}`;
78596
78608
  }
78597
- const url2 = `${this.connection.url.replace(/\/+$/, "")}/${encodeURIComponent(this.index)}${path67}`;
78609
+ const url2 = `${this.connection.url.replace(/\/+$/, "")}/${encodeURIComponent(this.index)}${path68}`;
78598
78610
  const request2 = { method, headers };
78599
78611
  if (body !== void 0)
78600
78612
  request2.body = JSON.stringify(body);
@@ -82233,7 +82245,7 @@ function message4(error51) {
82233
82245
  }
82234
82246
  function filesIn(params3) {
82235
82247
  return [
82236
- ...(params3.attachments ?? []).map((path67) => ({ path: path67, inline: false })),
82248
+ ...(params3.attachments ?? []).map((path68) => ({ path: path68, inline: false })),
82237
82249
  ...(params3.inlineImages ?? []).map((image) => ({ path: image.path, inline: true }))
82238
82250
  ];
82239
82251
  }
@@ -82941,6 +82953,50 @@ function mcpToolCacheFile(dir) {
82941
82953
  return import_node_path49.default.join(dir, MCP_TOOL_CACHE_FILE);
82942
82954
  }
82943
82955
 
82956
+ // ../../packages/core/dist/agent/chatSteering.js
82957
+ var import_node_crypto17 = require("node:crypto");
82958
+ var import_node_fs9 = require("node:fs");
82959
+ var import_node_path50 = __toESM(require("node:path"), 1);
82960
+ function pendingSteeringFile(storageDir, workspaceRoot) {
82961
+ const key3 = (0, import_node_crypto17.createHash)("sha256").update(process.platform === "win32" ? import_node_path50.default.resolve(workspaceRoot).toLowerCase() : import_node_path50.default.resolve(workspaceRoot)).digest("hex").slice(0, 16);
82962
+ return import_node_path50.default.join(storageDir, "pending-chat", `${key3}.json`);
82963
+ }
82964
+ async function writePendingSteering(file2, steering) {
82965
+ if (steering.plan === void 0 && steering.strategy === void 0) {
82966
+ await clearPendingSteering(file2);
82967
+ return;
82968
+ }
82969
+ await writeFileAtomically(file2, JSON.stringify({ version: 1, ...steering }));
82970
+ }
82971
+ async function clearPendingSteering(file2) {
82972
+ await import_node_fs9.promises.rm(file2, { force: true }).catch(() => void 0);
82973
+ }
82974
+ async function readPendingSteering(file2) {
82975
+ let raw;
82976
+ try {
82977
+ raw = JSON.parse(await import_node_fs9.promises.readFile(file2, "utf8"));
82978
+ } catch {
82979
+ return void 0;
82980
+ }
82981
+ if (raw === null || typeof raw !== "object")
82982
+ return void 0;
82983
+ const value = raw;
82984
+ const out = {};
82985
+ if (typeof value["plan"] === "string" && value["plan"].trim().length > 0)
82986
+ out.plan = value["plan"];
82987
+ if (value["planProgress"] !== null && typeof value["planProgress"] === "object")
82988
+ out.planProgress = value["planProgress"];
82989
+ const strategy = strategySchema.safeParse(value["strategy"]);
82990
+ if (strategy.success) {
82991
+ out.strategy = strategy.data;
82992
+ if (value["strategyProgress"] !== null && typeof value["strategyProgress"] === "object")
82993
+ out.strategyProgress = value["strategyProgress"];
82994
+ if (Array.isArray(value["strategyExchanges"]))
82995
+ out.strategyExchanges = value["strategyExchanges"];
82996
+ }
82997
+ return out.plan === void 0 && out.strategy === void 0 ? void 0 : out;
82998
+ }
82999
+
82944
83000
  // ../../packages/core/dist/host/approvalGate.js
82945
83001
  var WebviewApprovalGate = class {
82946
83002
  post;
@@ -82991,17 +83047,17 @@ var WebviewApprovalGate = class {
82991
83047
  // ../../packages/core/dist/platform/node/filesystem.js
82992
83048
  var import_promises29 = __toESM(require("node:fs/promises"), 1);
82993
83049
  var NodeFileSystem = class {
82994
- async readFile(path67) {
82995
- return import_promises29.default.readFile(path67, "utf8");
83050
+ async readFile(path68) {
83051
+ return import_promises29.default.readFile(path68, "utf8");
82996
83052
  }
82997
- async readBytes(path67) {
82998
- return import_promises29.default.readFile(path67);
83053
+ async readBytes(path68) {
83054
+ return import_promises29.default.readFile(path68);
82999
83055
  }
83000
- async readBytesSlice(path67, start, end) {
83056
+ async readBytesSlice(path68, start, end) {
83001
83057
  const length = Math.max(0, end - start);
83002
83058
  if (length === 0)
83003
83059
  return Buffer.alloc(0);
83004
- const handle = await import_promises29.default.open(path67, "r");
83060
+ const handle = await import_promises29.default.open(path68, "r");
83005
83061
  try {
83006
83062
  const buffer = Buffer.alloc(length);
83007
83063
  const { bytesRead } = await handle.read(buffer, 0, length, start);
@@ -83010,18 +83066,18 @@ var NodeFileSystem = class {
83010
83066
  await handle.close();
83011
83067
  }
83012
83068
  }
83013
- async writeFile(path67, contents) {
83014
- await import_promises29.default.writeFile(path67, contents, "utf8");
83069
+ async writeFile(path68, contents) {
83070
+ await import_promises29.default.writeFile(path68, contents, "utf8");
83015
83071
  }
83016
83072
  /** The counterpart of `readBytes`, and deliberately as bare as `writeFile` beside it. */
83017
- async writeBytes(path67, contents) {
83018
- await import_promises29.default.writeFile(path67, contents);
83073
+ async writeBytes(path68, contents) {
83074
+ await import_promises29.default.writeFile(path68, contents);
83019
83075
  }
83020
83076
  async rename(from, to) {
83021
83077
  await replaceFile(from, to);
83022
83078
  }
83023
- async stat(path67) {
83024
- const stat = await import_promises29.default.lstat(path67);
83079
+ async stat(path68) {
83080
+ const stat = await import_promises29.default.lstat(path68);
83025
83081
  return {
83026
83082
  size: stat.size,
83027
83083
  mtimeMs: stat.mtimeMs,
@@ -83030,8 +83086,8 @@ var NodeFileSystem = class {
83030
83086
  isSymbolicLink: stat.isSymbolicLink()
83031
83087
  };
83032
83088
  }
83033
- async readdir(path67) {
83034
- const entries = await import_promises29.default.readdir(path67, { withFileTypes: true });
83089
+ async readdir(path68) {
83090
+ const entries = await import_promises29.default.readdir(path68, { withFileTypes: true });
83035
83091
  return entries.map((entry) => ({
83036
83092
  name: entry.name,
83037
83093
  isFile: entry.isFile(),
@@ -83039,21 +83095,21 @@ var NodeFileSystem = class {
83039
83095
  isSymbolicLink: entry.isSymbolicLink()
83040
83096
  }));
83041
83097
  }
83042
- async exists(path67) {
83098
+ async exists(path68) {
83043
83099
  try {
83044
- await import_promises29.default.access(path67);
83100
+ await import_promises29.default.access(path68);
83045
83101
  return true;
83046
83102
  } catch {
83047
83103
  return false;
83048
83104
  }
83049
83105
  }
83050
- async mkdir(path67) {
83051
- await import_promises29.default.mkdir(path67, { recursive: true });
83106
+ async mkdir(path68) {
83107
+ await import_promises29.default.mkdir(path68, { recursive: true });
83052
83108
  }
83053
83109
  };
83054
83110
 
83055
83111
  // ../../packages/core/dist/config/project.js
83056
- var import_node_path50 = __toESM(require("node:path"), 1);
83112
+ var import_node_path51 = __toESM(require("node:path"), 1);
83057
83113
  function configuredProjectName(config2) {
83058
83114
  const name = config2?.project?.name?.trim();
83059
83115
  return name !== void 0 && name.length > 0 ? name : void 0;
@@ -83062,7 +83118,7 @@ function projectName(config2, workspaceRoot) {
83062
83118
  const configured = configuredProjectName(config2);
83063
83119
  if (configured !== void 0)
83064
83120
  return configured;
83065
- return workspaceRoot === void 0 ? void 0 : import_node_path50.default.basename(import_node_path50.default.resolve(workspaceRoot));
83121
+ return workspaceRoot === void 0 ? void 0 : import_node_path51.default.basename(import_node_path51.default.resolve(workspaceRoot));
83066
83122
  }
83067
83123
  function projectSlug(name) {
83068
83124
  if (name === void 0)
@@ -83072,8 +83128,8 @@ function projectSlug(name) {
83072
83128
  }
83073
83129
 
83074
83130
  // ../../packages/core/dist/rag/renameIndexes.js
83075
- var import_node_path51 = __toESM(require("node:path"), 1);
83076
- var import_node_fs9 = require("node:fs");
83131
+ var import_node_path52 = __toESM(require("node:path"), 1);
83132
+ var import_node_fs10 = require("node:fs");
83077
83133
  function planIndexRenames(names) {
83078
83134
  const plans = [];
83079
83135
  for (const kind of ["codebase", "docs", "skills"]) {
@@ -83125,7 +83181,7 @@ async function copyIndex(options) {
83125
83181
  async function copyBookkeeping(directory, from, to, storeId) {
83126
83182
  let entries;
83127
83183
  try {
83128
- entries = await import_node_fs9.promises.readdir(directory);
83184
+ entries = await import_node_fs10.promises.readdir(directory);
83129
83185
  } catch {
83130
83186
  return [];
83131
83187
  }
@@ -83136,7 +83192,7 @@ async function copyBookkeeping(directory, from, to, storeId) {
83136
83192
  continue;
83137
83193
  const target = `${to}@${storeId}.${entry.slice(prefix.length)}`;
83138
83194
  try {
83139
- await import_node_fs9.promises.copyFile(import_node_path51.default.join(directory, entry), import_node_path51.default.join(directory, target), import_node_fs9.constants.COPYFILE_EXCL);
83195
+ await import_node_fs10.promises.copyFile(import_node_path52.default.join(directory, entry), import_node_path52.default.join(directory, target), import_node_fs10.constants.COPYFILE_EXCL);
83140
83196
  copied.push(target);
83141
83197
  } catch {
83142
83198
  }
@@ -83225,7 +83281,7 @@ var NodeTerminal = class {
83225
83281
 
83226
83282
  // ../../packages/core/dist/platform/node/taskStore.js
83227
83283
  var import_promises30 = __toESM(require("node:fs/promises"), 1);
83228
- var import_node_path52 = __toESM(require("node:path"), 1);
83284
+ var import_node_path53 = __toESM(require("node:path"), 1);
83229
83285
 
83230
83286
  // ../../packages/core/dist/history/types.js
83231
83287
  function taskSummary(task) {
@@ -83248,7 +83304,7 @@ var JsonTaskStore = class {
83248
83304
  constructor(globalStoragePath, truncationStore, logger) {
83249
83305
  this.truncationStore = truncationStore;
83250
83306
  this.logger = logger;
83251
- this.directory = import_node_path52.default.join(globalStoragePath, "tasks");
83307
+ this.directory = import_node_path53.default.join(globalStoragePath, "tasks");
83252
83308
  }
83253
83309
  async list(workspaceRoot) {
83254
83310
  const index = await this.readIndex();
@@ -83297,11 +83353,11 @@ var JsonTaskStore = class {
83297
83353
  await this.writeIndex(index.filter((entry) => entry.id !== id));
83298
83354
  }
83299
83355
  fileFor(id) {
83300
- return import_node_path52.default.join(this.directory, `${id}.json`);
83356
+ return import_node_path53.default.join(this.directory, `${id}.json`);
83301
83357
  }
83302
83358
  async readIndex() {
83303
83359
  try {
83304
- const raw = await import_promises30.default.readFile(import_node_path52.default.join(this.directory, INDEX_FILE), "utf8");
83360
+ const raw = await import_promises30.default.readFile(import_node_path53.default.join(this.directory, INDEX_FILE), "utf8");
83305
83361
  const parsed = JSON.parse(raw);
83306
83362
  if (Array.isArray(parsed))
83307
83363
  return parsed.filter(isIndexEntry);
@@ -83336,7 +83392,7 @@ var JsonTaskStore = class {
83336
83392
  }
83337
83393
  async writeIndex(entries) {
83338
83394
  await import_promises30.default.mkdir(this.directory, { recursive: true });
83339
- const target = import_node_path52.default.join(this.directory, INDEX_FILE);
83395
+ const target = import_node_path53.default.join(this.directory, INDEX_FILE);
83340
83396
  const temporary = `${target}.tmp`;
83341
83397
  await import_promises30.default.writeFile(temporary, JSON.stringify(entries, null, 2), "utf8");
83342
83398
  await replaceFile(temporary, target);
@@ -83380,8 +83436,8 @@ function isRecord3(value) {
83380
83436
  }
83381
83437
 
83382
83438
  // ../../packages/core/dist/usage/store.js
83383
- var import_node_fs10 = require("node:fs");
83384
- var import_node_path53 = __toESM(require("node:path"), 1);
83439
+ var import_node_fs11 = require("node:fs");
83440
+ var import_node_path54 = __toESM(require("node:path"), 1);
83385
83441
 
83386
83442
  // ../../packages/core/dist/s3/keys.js
83387
83443
  function normalisePrefix(prefix) {
@@ -83514,7 +83570,7 @@ var FolderShardStore = class {
83514
83570
  await this.ask({ action: "write", user: shardSegment(shard.user), day: shard.day, instance: shard.instance, events });
83515
83571
  return;
83516
83572
  }
83517
- await this.writeAtomically(import_node_path53.default.join(this.root, shardSegment(shard.user), `${shard.day}__${shard.instance}.jsonl`), shardText(events));
83573
+ await this.writeAtomically(import_node_path54.default.join(this.root, shardSegment(shard.user), `${shard.day}__${shard.instance}.jsonl`), shardText(events));
83518
83574
  }
83519
83575
  async read(fromDay, toDay) {
83520
83576
  this.lastProblems = [];
@@ -83534,8 +83590,8 @@ var FolderShardStore = class {
83534
83590
  }
83535
83591
  const files = await this.listFiles();
83536
83592
  const wanted = selectShards(files, fromDay, toDay);
83537
- const texts = await pooled(wanted, 8, (file2) => import_node_fs10.promises.readFile(import_node_path53.default.join(this.root, file2.user, file2.name), "utf8").catch((error51) => {
83538
- this.lastProblems.push(`${import_node_path53.default.join(this.root, file2.user, file2.name)}: ${error51 instanceof Error ? error51.message : String(error51)}`);
83593
+ const texts = await pooled(wanted, 8, (file2) => import_node_fs11.promises.readFile(import_node_path54.default.join(this.root, file2.user, file2.name), "utf8").catch((error51) => {
83594
+ this.lastProblems.push(`${import_node_path54.default.join(this.root, file2.user, file2.name)}: ${error51 instanceof Error ? error51.message : String(error51)}`);
83539
83595
  return "";
83540
83596
  }));
83541
83597
  return texts.flatMap(parseUsageLines);
@@ -83544,7 +83600,7 @@ var FolderShardStore = class {
83544
83600
  async listFiles() {
83545
83601
  let users;
83546
83602
  try {
83547
- users = (await import_node_fs10.promises.readdir(this.root, { withFileTypes: true })).filter((entry) => entry.isDirectory() && entry.name !== "_profiles").map((entry) => entry.name);
83603
+ users = (await import_node_fs11.promises.readdir(this.root, { withFileTypes: true })).filter((entry) => entry.isDirectory() && entry.name !== "_profiles").map((entry) => entry.name);
83548
83604
  } catch (error51) {
83549
83605
  if (error51.code === "ENOENT")
83550
83606
  return [];
@@ -83552,10 +83608,10 @@ var FolderShardStore = class {
83552
83608
  }
83553
83609
  const files = [];
83554
83610
  for (const user of users) {
83555
- const folder = import_node_path53.default.join(this.root, user);
83611
+ const folder = import_node_path54.default.join(this.root, user);
83556
83612
  let names;
83557
83613
  try {
83558
- names = await import_node_fs10.promises.readdir(folder);
83614
+ names = await import_node_fs11.promises.readdir(folder);
83559
83615
  } catch (error51) {
83560
83616
  names = [];
83561
83617
  this.lastProblems.push(`${folder}: ${error51 instanceof Error ? error51.message : String(error51)}`);
@@ -83571,7 +83627,7 @@ var FolderShardStore = class {
83571
83627
  }
83572
83628
  async readShard(shard) {
83573
83629
  try {
83574
- return parseUsageLines(await import_node_fs10.promises.readFile(import_node_path53.default.join(this.root, shardSegment(shard.user), shardFileName(shard)), "utf8"));
83630
+ return parseUsageLines(await import_node_fs11.promises.readFile(import_node_path54.default.join(this.root, shardSegment(shard.user), shardFileName(shard)), "utf8"));
83575
83631
  } catch (error51) {
83576
83632
  if (error51.code === "ENOENT")
83577
83633
  return void 0;
@@ -83579,10 +83635,10 @@ var FolderShardStore = class {
83579
83635
  }
83580
83636
  }
83581
83637
  async putMonth(shard, events) {
83582
- await this.writeAtomically(import_node_path53.default.join(this.root, shardSegment(shard.user), shardFileName(shard)), shardText(events));
83638
+ await this.writeAtomically(import_node_path54.default.join(this.root, shardSegment(shard.user), shardFileName(shard)), shardText(events));
83583
83639
  }
83584
83640
  async removeShard(shard) {
83585
- await import_node_fs10.promises.rm(import_node_path53.default.join(this.root, shardSegment(shard.user), shardFileName(shard)), { force: true });
83641
+ await import_node_fs11.promises.rm(import_node_path54.default.join(this.root, shardSegment(shard.user), shardFileName(shard)), { force: true });
83586
83642
  }
83587
83643
  async putProfile(user, profile) {
83588
83644
  this.profilesFromRead = void 0;
@@ -83590,7 +83646,7 @@ var FolderShardStore = class {
83590
83646
  await this.ask({ action: "writeProfile", user: shardSegment(user), profile: cleanProfile(profile) });
83591
83647
  return;
83592
83648
  }
83593
- await this.writeAtomically(import_node_path53.default.join(this.root, "_profiles", `${shardSegment(user)}.json`), JSON.stringify(cleanProfile(profile)));
83649
+ await this.writeAtomically(import_node_path54.default.join(this.root, "_profiles", `${shardSegment(user)}.json`), JSON.stringify(cleanProfile(profile)));
83594
83650
  }
83595
83651
  async readProfiles() {
83596
83652
  if (this.profilesFromRead !== void 0)
@@ -83599,13 +83655,13 @@ var FolderShardStore = class {
83599
83655
  await this.read("9999-12-31", "9999-12-31");
83600
83656
  return this.profilesFromRead ?? {};
83601
83657
  }
83602
- const folder = import_node_path53.default.join(this.root, "_profiles");
83658
+ const folder = import_node_path54.default.join(this.root, "_profiles");
83603
83659
  const profiles = {};
83604
- for (const name of await import_node_fs10.promises.readdir(folder).catch(() => [])) {
83660
+ for (const name of await import_node_fs11.promises.readdir(folder).catch(() => [])) {
83605
83661
  if (!name.endsWith(".json"))
83606
83662
  continue;
83607
83663
  try {
83608
- profiles[name.slice(0, -5)] = cleanProfile(JSON.parse(await import_node_fs10.promises.readFile(import_node_path53.default.join(folder, name), "utf8")));
83664
+ profiles[name.slice(0, -5)] = cleanProfile(JSON.parse(await import_node_fs11.promises.readFile(import_node_path54.default.join(folder, name), "utf8")));
83609
83665
  } catch {
83610
83666
  }
83611
83667
  }
@@ -84420,8 +84476,8 @@ function usageCollectionOn(config2, choice) {
84420
84476
  }
84421
84477
 
84422
84478
  // ../../packages/core/dist/usage/backfill.js
84423
- var import_node_fs11 = require("node:fs");
84424
- var import_node_path54 = __toESM(require("node:path"), 1);
84479
+ var import_node_fs12 = require("node:fs");
84480
+ var import_node_path55 = __toESM(require("node:path"), 1);
84425
84481
  function comparablePath(value) {
84426
84482
  return value.replace(/\\/g, "/").replace(/\/+$/, "").toLowerCase();
84427
84483
  }
@@ -84431,7 +84487,7 @@ function eventsFromTask(task, context) {
84431
84487
  return [];
84432
84488
  const created = typeof task.createdAt === "number" && task.createdAt <= updated ? task.createdAt : updated;
84433
84489
  const root = typeof task.workspaceRoot === "string" ? task.workspaceRoot : void 0;
84434
- const project = root !== void 0 && context.workspaceRoot !== void 0 && comparablePath(root) === comparablePath(context.workspaceRoot) ? context.project : root !== void 0 ? import_node_path54.default.basename(root.replace(/\\/g, "/")) : void 0;
84490
+ const project = root !== void 0 && context.workspaceRoot !== void 0 && comparablePath(root) === comparablePath(context.workspaceRoot) ? context.project : root !== void 0 ? import_node_path55.default.basename(root.replace(/\\/g, "/")) : void 0;
84435
84491
  const skillsByPath = new Map(context.skills.map((skill) => [comparablePath(skill.filePath), skill]));
84436
84492
  const skip = new Set(context.skip);
84437
84493
  const calls = [];
@@ -84468,7 +84524,7 @@ function eventsFromTask(task, context) {
84468
84524
  let skill;
84469
84525
  if (call.name === "read_file" && typeof call.args["path"] === "string") {
84470
84526
  const requested2 = call.args["path"];
84471
- const absolute = import_node_path54.default.isAbsolute(requested2) || /^[A-Za-z]:[\\/]/.test(requested2) || root === void 0 ? requested2 : import_node_path54.default.join(root, requested2);
84527
+ const absolute = import_node_path55.default.isAbsolute(requested2) || /^[A-Za-z]:[\\/]/.test(requested2) || root === void 0 ? requested2 : import_node_path55.default.join(root, requested2);
84472
84528
  skill = skillsByPath.get(comparablePath(absolute));
84473
84529
  }
84474
84530
  if (call.name === "use_skill_file" && typeof call.args["skill"] === "string") {
@@ -84505,7 +84561,7 @@ async function backfillFromTasks(tasksDir, context, helper) {
84505
84561
  }
84506
84562
  let names;
84507
84563
  try {
84508
- names = (await import_node_fs11.promises.readdir(tasksDir)).filter((name) => name.endsWith(".json") && name !== "index.json");
84564
+ names = (await import_node_fs12.promises.readdir(tasksDir)).filter((name) => name.endsWith(".json") && name !== "index.json");
84509
84565
  } catch {
84510
84566
  return { events: [], tasks: 0, unreadable: 0, via: "node" };
84511
84567
  }
@@ -84513,7 +84569,7 @@ async function backfillFromTasks(tasksDir, context, helper) {
84513
84569
  let unreadable = 0;
84514
84570
  for (const name of names) {
84515
84571
  try {
84516
- events.push(...eventsFromTask(JSON.parse(await import_node_fs11.promises.readFile(import_node_path54.default.join(tasksDir, name), "utf8")), context));
84572
+ events.push(...eventsFromTask(JSON.parse(await import_node_fs12.promises.readFile(import_node_path55.default.join(tasksDir, name), "utf8")), context));
84517
84573
  } catch {
84518
84574
  unreadable++;
84519
84575
  }
@@ -84521,24 +84577,24 @@ async function backfillFromTasks(tasksDir, context, helper) {
84521
84577
  return { events, tasks: names.length, unreadable, via: "node" };
84522
84578
  }
84523
84579
  async function backfillOnce(options) {
84524
- const doneFile = import_node_path54.default.join(options.usageDir, "backfill.json");
84580
+ const doneFile = import_node_path55.default.join(options.usageDir, "backfill.json");
84525
84581
  for (const file2 of [doneFile, ...options.legacyDoneFile !== void 0 ? [options.legacyDoneFile] : []]) {
84526
- if (await import_node_fs11.promises.stat(file2).then(() => true, () => false))
84582
+ if (await import_node_fs12.promises.stat(file2).then(() => true, () => false))
84527
84583
  return { ran: false };
84528
84584
  }
84529
- await import_node_fs11.promises.mkdir(options.usageDir, { recursive: true });
84530
- const startFile = import_node_path54.default.join(options.usageDir, "backfill-start.json");
84585
+ await import_node_fs12.promises.mkdir(options.usageDir, { recursive: true });
84586
+ const startFile = import_node_path55.default.join(options.usageDir, "backfill-start.json");
84531
84587
  let before;
84532
84588
  try {
84533
84589
  before = (options.now ?? Date.now)();
84534
- await import_node_fs11.promises.writeFile(startFile, JSON.stringify({ before }), { encoding: "utf8", flag: "wx" });
84590
+ await import_node_fs12.promises.writeFile(startFile, JSON.stringify({ before }), { encoding: "utf8", flag: "wx" });
84535
84591
  } catch (error51) {
84536
84592
  if (error51.code !== "EEXIST")
84537
84593
  throw error51;
84538
84594
  let claimed;
84539
84595
  for (let attempt = 0; attempt < 40 && claimed === void 0; attempt++) {
84540
84596
  try {
84541
- const parsed = JSON.parse(await import_node_fs11.promises.readFile(startFile, "utf8"));
84597
+ const parsed = JSON.parse(await import_node_fs12.promises.readFile(startFile, "utf8"));
84542
84598
  if (typeof parsed.before === "number")
84543
84599
  claimed = parsed.before;
84544
84600
  } catch {
@@ -84833,7 +84889,7 @@ async function lookupDirectory(names, options = {}) {
84833
84889
  }
84834
84890
 
84835
84891
  // ../../packages/core/dist/observers/auditIndex.js
84836
- var import_node_crypto17 = require("node:crypto");
84892
+ var import_node_crypto18 = require("node:crypto");
84837
84893
  var MAPPING2 = {
84838
84894
  mappings: {
84839
84895
  dynamic: false,
@@ -84881,7 +84937,7 @@ function recordText(record2) {
84881
84937
  return parts.join("\n").slice(0, 2e4);
84882
84938
  }
84883
84939
  function recordId(record2) {
84884
- return (0, import_node_crypto17.createHash)("sha256").update(JSON.stringify(record2)).digest("hex").slice(0, 32);
84940
+ return (0, import_node_crypto18.createHash)("sha256").update(JSON.stringify(record2)).digest("hex").slice(0, 32);
84885
84941
  }
84886
84942
  var AuditIndex = class {
84887
84943
  http;
@@ -84895,13 +84951,13 @@ var AuditIndex = class {
84895
84951
  if (!isSafeIndexName(index))
84896
84952
  throw new Error(`"${index}" is not a usable index name (lowercase letters, digits, - and _).`);
84897
84953
  }
84898
- async send(method, path67, body, contentType2 = "application/json") {
84954
+ async send(method, path68, body, contentType2 = "application/json") {
84899
84955
  const headers = { "Content-Type": contentType2 };
84900
84956
  const { username, password } = this.connection;
84901
84957
  if (username !== void 0 && username.length > 0) {
84902
84958
  headers.Authorization = `Basic ${Buffer.from(`${username}:${password ?? ""}`).toString("base64")}`;
84903
84959
  }
84904
- const url2 = `${this.connection.url.replace(/\/+$/, "")}/${encodeURIComponent(this.index)}${path67}`;
84960
+ const url2 = `${this.connection.url.replace(/\/+$/, "")}/${encodeURIComponent(this.index)}${path68}`;
84905
84961
  const request2 = { method, headers };
84906
84962
  if (body !== void 0)
84907
84963
  request2.body = body;
@@ -84995,20 +85051,20 @@ var AuditIndex = class {
84995
85051
  };
84996
85052
 
84997
85053
  // ../../packages/core/dist/observers/journal.js
84998
- var import_node_crypto18 = require("node:crypto");
84999
- var import_node_fs12 = require("node:fs");
85000
- var import_node_path55 = __toESM(require("node:path"), 1);
85054
+ var import_node_crypto19 = require("node:crypto");
85055
+ var import_node_fs13 = require("node:fs");
85056
+ var import_node_path56 = __toESM(require("node:path"), 1);
85001
85057
  function auditRoot(storageDir) {
85002
- return import_node_path55.default.join(storageDir, "audit");
85058
+ return import_node_path56.default.join(storageDir, "audit");
85003
85059
  }
85004
85060
  function workspaceAuditFolder(workspace) {
85005
- const resolved = import_node_path55.default.resolve(workspace);
85061
+ const resolved = import_node_path56.default.resolve(workspace);
85006
85062
  const key3 = process.platform === "win32" ? resolved.toLowerCase() : resolved;
85007
- const base = import_node_path55.default.basename(key3).replace(/[^A-Za-z0-9._-]+/g, "-").slice(0, 40) || "workspace";
85008
- return `${base}-${(0, import_node_crypto18.createHash)("sha256").update(key3).digest("hex").slice(0, 10)}`;
85063
+ const base = import_node_path56.default.basename(key3).replace(/[^A-Za-z0-9._-]+/g, "-").slice(0, 40) || "workspace";
85064
+ return `${base}-${(0, import_node_crypto19.createHash)("sha256").update(key3).digest("hex").slice(0, 10)}`;
85009
85065
  }
85010
85066
  function newSessionId() {
85011
- return `${Date.now().toString(36)}-${(0, import_node_crypto18.randomBytes)(4).toString("hex")}`;
85067
+ return `${Date.now().toString(36)}-${(0, import_node_crypto19.randomBytes)(4).toString("hex")}`;
85012
85068
  }
85013
85069
  function day(at) {
85014
85070
  const d = new Date(at);
@@ -85020,17 +85076,17 @@ var AuditJournal = class {
85020
85076
  folder;
85021
85077
  constructor(storageDir, workspace, session) {
85022
85078
  this.session = session;
85023
- this.folder = import_node_path55.default.join(auditRoot(storageDir), workspaceAuditFolder(workspace));
85079
+ this.folder = import_node_path56.default.join(auditRoot(storageDir), workspaceAuditFolder(workspace));
85024
85080
  }
85025
85081
  /** Appends in order; a failure is reported to `onError` and never blocks the next record. */
85026
85082
  append(record2, onError) {
85027
85083
  const line = `${JSON.stringify(record2)}
85028
85084
  `;
85029
- const file2 = import_node_path55.default.join(this.folder, `${day(record2.at)}__${this.session}.jsonl`);
85085
+ const file2 = import_node_path56.default.join(this.folder, `${day(record2.at)}__${this.session}.jsonl`);
85030
85086
  this.chain = this.chain.then(async () => {
85031
85087
  try {
85032
- await import_node_fs12.promises.mkdir(this.folder, { recursive: true });
85033
- await import_node_fs12.promises.appendFile(file2, line, "utf8");
85088
+ await import_node_fs13.promises.mkdir(this.folder, { recursive: true });
85089
+ await import_node_fs13.promises.appendFile(file2, line, "utf8");
85034
85090
  } catch (error51) {
85035
85091
  onError(error51);
85036
85092
  }
@@ -85046,11 +85102,11 @@ async function pruneAudit(storageDir, days, now = Date.now()) {
85046
85102
  const cutoff = day(now - days * 864e5);
85047
85103
  let removed = 0;
85048
85104
  const root = auditRoot(storageDir);
85049
- for (const folder of await import_node_fs12.promises.readdir(root).catch(() => [])) {
85050
- for (const name of await import_node_fs12.promises.readdir(import_node_path55.default.join(root, folder)).catch(() => [])) {
85105
+ for (const folder of await import_node_fs13.promises.readdir(root).catch(() => [])) {
85106
+ for (const name of await import_node_fs13.promises.readdir(import_node_path56.default.join(root, folder)).catch(() => [])) {
85051
85107
  const fileDay = /^(\d{4}-\d{2}-\d{2})__/.exec(name)?.[1];
85052
85108
  if (fileDay !== void 0 && fileDay < cutoff) {
85053
- await import_node_fs12.promises.rm(import_node_path55.default.join(root, folder, name), { force: true }).then(() => removed += 1, () => void 0);
85109
+ await import_node_fs13.promises.rm(import_node_path56.default.join(root, folder, name), { force: true }).then(() => removed += 1, () => void 0);
85054
85110
  }
85055
85111
  }
85056
85112
  }
@@ -85058,12 +85114,12 @@ async function pruneAudit(storageDir, days, now = Date.now()) {
85058
85114
  }
85059
85115
  async function readAudit(storageDir, workspace, query) {
85060
85116
  const root = auditRoot(storageDir);
85061
- const folders = query.allWorkspaces === true || workspace === void 0 ? await import_node_fs12.promises.readdir(root).catch(() => []) : [workspaceAuditFolder(workspace)];
85117
+ const folders = query.allWorkspaces === true || workspace === void 0 ? await import_node_fs13.promises.readdir(root).catch(() => []) : [workspaceAuditFolder(workspace)];
85062
85118
  const fromDay = query.from !== void 0 ? day(query.from) : void 0;
85063
85119
  const untilDay = query.until !== void 0 ? day(query.until) : void 0;
85064
85120
  const files = [];
85065
85121
  for (const folder of folders) {
85066
- for (const name of await import_node_fs12.promises.readdir(import_node_path55.default.join(root, folder)).catch(() => [])) {
85122
+ for (const name of await import_node_fs13.promises.readdir(import_node_path56.default.join(root, folder)).catch(() => [])) {
85067
85123
  const fileDay = /^(\d{4}-\d{2}-\d{2})__(.+)\.jsonl$/.exec(name);
85068
85124
  if (fileDay === null)
85069
85125
  continue;
@@ -85073,7 +85129,7 @@ async function readAudit(storageDir, workspace, query) {
85073
85129
  continue;
85074
85130
  if (query.session !== void 0 && fileDay[2] !== query.session)
85075
85131
  continue;
85076
- files.push(import_node_path55.default.join(root, folder, name));
85132
+ files.push(import_node_path56.default.join(root, folder, name));
85077
85133
  }
85078
85134
  }
85079
85135
  const needle = query.contains?.toLowerCase();
@@ -85083,7 +85139,7 @@ async function readAudit(storageDir, workspace, query) {
85083
85139
  for (const file2 of files) {
85084
85140
  let text2;
85085
85141
  try {
85086
- text2 = await import_node_fs12.promises.readFile(file2, "utf8");
85142
+ text2 = await import_node_fs13.promises.readFile(file2, "utf8");
85087
85143
  } catch (error51) {
85088
85144
  unreadable.push(`${file2}: ${error51 instanceof Error ? error51.message : String(error51)}`);
85089
85145
  continue;
@@ -86099,7 +86155,7 @@ Not in the strategy, so left alone: ${unknown2.join(", ")}` : "")
86099
86155
  }
86100
86156
 
86101
86157
  // ../../packages/core/dist/team/admins.js
86102
- var import_node_crypto19 = require("node:crypto");
86158
+ var import_node_crypto20 = require("node:crypto");
86103
86159
  var import_node_os6 = __toESM(require("node:os"), 1);
86104
86160
  function windowsUserId() {
86105
86161
  return normaliseUserId(import_node_os6.default.userInfo().username);
@@ -86169,13 +86225,13 @@ var TeamStore = class {
86169
86225
  if (!isSafeIndexName(index))
86170
86226
  throw new TeamStoreError(`"${index}" is not a usable index name (lowercase letters, digits, - and _).`);
86171
86227
  }
86172
- async send(method, path67, body) {
86228
+ async send(method, path68, body) {
86173
86229
  const headers = { "Content-Type": "application/json" };
86174
86230
  const { username, password } = this.connection;
86175
86231
  if (username !== void 0 && username.length > 0) {
86176
86232
  headers.Authorization = `Basic ${Buffer.from(`${username}:${password ?? ""}`).toString("base64")}`;
86177
86233
  }
86178
- const url2 = `${this.connection.url.replace(/\/+$/, "")}/${encodeURIComponent(this.index)}${path67}`;
86234
+ const url2 = `${this.connection.url.replace(/\/+$/, "")}/${encodeURIComponent(this.index)}${path68}`;
86179
86235
  const request2 = { method, headers };
86180
86236
  if (body !== void 0)
86181
86237
  request2.body = JSON.stringify(body);
@@ -86279,7 +86335,7 @@ var TeamStore = class {
86279
86335
  }
86280
86336
  async submit(review) {
86281
86337
  await this.ensureIndex();
86282
- const id = `review:${(0, import_node_crypto19.randomUUID)()}`;
86338
+ const id = `review:${(0, import_node_crypto20.randomUUID)()}`;
86283
86339
  const { status: status2, json: json2 } = await this.send("PUT", `/_create/${encodeURIComponent(id)}?refresh=true`, {
86284
86340
  type: "review",
86285
86341
  kind: review.kind,
@@ -86452,8 +86508,8 @@ function wireChatBridge(services) {
86452
86508
  const workspaceBranch = workspaceRoot !== void 0 ? currentBranchOf(workspaceRoot) : void 0;
86453
86509
  const machineApprovals = services.machineApprovalsFile !== void 0 ? new FileMachineApprovals(services.machineApprovalsFile) : void 0;
86454
86510
  const mirrorRoot = services.mirrorRoot ?? storageDir;
86455
- const personalSkillsDir = services.personalDir !== void 0 ? import_node_path56.default.join(services.personalDir, "skills") : void 0;
86456
- const personalToolsDir = services.personalDir !== void 0 ? import_node_path56.default.join(services.personalDir, "tools") : void 0;
86511
+ const personalSkillsDir = services.personalDir !== void 0 ? import_node_path57.default.join(services.personalDir, "skills") : void 0;
86512
+ const personalToolsDir = services.personalDir !== void 0 ? import_node_path57.default.join(services.personalDir, "tools") : void 0;
86457
86513
  const logger = new Logger({ level: "debug", sink: services.logSink });
86458
86514
  let fastFsOps;
86459
86515
  const fastFsAnswered = services.fastFs === void 0 ? Promise.resolve(void 0) : fastFsCapabilities(services.fastFs).then((answer) => {
@@ -86475,14 +86531,14 @@ function wireChatBridge(services) {
86475
86531
  let cachedSecretValues = [];
86476
86532
  const droppedFilesRoot2 = droppedFilesRoot();
86477
86533
  const mailAttachmentsRoot2 = mailAttachmentsRoot();
86478
- const droppedFilesDir = import_node_path56.default.join(droppedFilesRoot2, (0, import_node_crypto20.randomUUID)().slice(0, 8));
86479
- const truncationStore = new RecordingTruncationStore(new DiskTruncationStore(import_node_path56.default.join(storageDir, "tool-results"), () => cachedSecretValues));
86534
+ const droppedFilesDir = import_node_path57.default.join(droppedFilesRoot2, (0, import_node_crypto21.randomUUID)().slice(0, 8));
86535
+ const truncationStore = new RecordingTruncationStore(new DiskTruncationStore(import_node_path57.default.join(storageDir, "tool-results"), () => cachedSecretValues));
86480
86536
  const taskStore = new JsonTaskStore(storageDir, truncationStore, logger);
86481
86537
  const manifestsRoot = services.codebaseDir ?? storageDir;
86482
86538
  const codebaseInstructionsFile = codebaseInstructionsPath({ codebaseDir: services.codebaseDir, storageDir, workspaceRoot: projectRoot });
86483
86539
  if (services.codebaseDir !== void 0) {
86484
- const shared = import_node_path56.default.join(services.codebaseDir, "index-manifests");
86485
- void import_promises31.default.access(shared).catch(() => import_promises31.default.cp(import_node_path56.default.join(storageDir, "index-manifests"), shared, { recursive: true, errorOnExist: false, force: false })).catch(() => void 0);
86540
+ const shared = import_node_path57.default.join(services.codebaseDir, "index-manifests");
86541
+ void import_promises31.default.access(shared).catch(() => import_promises31.default.cp(import_node_path57.default.join(storageDir, "index-manifests"), shared, { recursive: true, errorOnExist: false, force: false })).catch(() => void 0);
86486
86542
  }
86487
86543
  const python = new PythonManager({
86488
86544
  workspaceRoot,
@@ -86660,7 +86716,7 @@ ${preview.text}` } : {}
86660
86716
  }
86661
86717
  return gitCheck.answer;
86662
86718
  }
86663
- const defaultSkillsDir = workspaceRoot !== void 0 ? import_node_path56.default.join(workspaceRoot, ".lightcode", "skills") : void 0;
86719
+ const defaultSkillsDir = workspaceRoot !== void 0 ? import_node_path57.default.join(workspaceRoot, ".lightcode", "skills") : void 0;
86664
86720
  let skillsDir = defaultSkillsDir;
86665
86721
  let localSkillsDir = defaultSkillsDir;
86666
86722
  let extraSkillDirs = [];
@@ -86683,9 +86739,9 @@ ${preview.text}` } : {}
86683
86739
  const trimmed = entry.trim();
86684
86740
  if (trimmed.length === 0)
86685
86741
  return void 0;
86686
- if (import_node_path56.default.isAbsolute(trimmed))
86687
- return import_node_path56.default.resolve(trimmed);
86688
- return workspaceRoot === void 0 ? void 0 : import_node_path56.default.resolve(workspaceRoot, trimmed);
86742
+ if (import_node_path57.default.isAbsolute(trimmed))
86743
+ return import_node_path57.default.resolve(trimmed);
86744
+ return workspaceRoot === void 0 ? void 0 : import_node_path57.default.resolve(workspaceRoot, trimmed);
86689
86745
  }
86690
86746
  function skillSearchPath() {
86691
86747
  return [skillsDir, ...extraSkillDirs].filter((dir) => dir !== void 0);
@@ -86722,12 +86778,12 @@ ${preview.text}` } : {}
86722
86778
  function watchSkillFolders() {
86723
86779
  stopWatchingSkills();
86724
86780
  const dirs = skillSearchPath();
86725
- for (const dir of [...dirs, ...dirs.map((entry) => import_node_path56.default.dirname(entry))]) {
86781
+ for (const dir of [...dirs, ...dirs.map((entry) => import_node_path57.default.dirname(entry))]) {
86726
86782
  try {
86727
86783
  skillWatchers.push(
86728
86784
  // Recursive, because a skill may be a folder with SKILL.md inside — a non-recursive
86729
86785
  // watch sees the folder appear and then never hears about the file written into it.
86730
- (0, import_node_fs13.watch)(dir, { recursive: true }, () => {
86786
+ (0, import_node_fs14.watch)(dir, { recursive: true }, () => {
86731
86787
  if (skillWatchTimer !== void 0)
86732
86788
  clearTimeout(skillWatchTimer);
86733
86789
  skillWatchTimer = setTimeout(() => {
@@ -86799,7 +86855,7 @@ ${preview.text}` } : {}
86799
86855
  await openInPanelEditor(filePath);
86800
86856
  return;
86801
86857
  }
86802
- const real = await confineToAny(import_node_path56.default.resolve(filePath), roots);
86858
+ const real = await confineToAny(import_node_path57.default.resolve(filePath), roots);
86803
86859
  await ui.openFile?.(real);
86804
86860
  } catch (error51) {
86805
86861
  post({ type: "error", message: error51 instanceof Error ? error51.message : String(error51) });
@@ -86810,9 +86866,9 @@ ${preview.text}` } : {}
86810
86866
  python.toolsDirectory(),
86811
86867
  ...skillsDir === void 0 ? [] : [skillsDir],
86812
86868
  ...extraSkillDirs.filter((dir) => dir !== void 0),
86813
- import_node_path56.default.join(storageDir, "reports"),
86869
+ import_node_path57.default.join(storageDir, "reports"),
86814
86870
  // Its own folder: nothing else lives there.
86815
- ...codebaseInstructionsFile === void 0 ? [] : [import_node_path56.default.dirname(codebaseInstructionsFile)]
86871
+ ...codebaseInstructionsFile === void 0 ? [] : [import_node_path57.default.dirname(codebaseInstructionsFile)]
86816
86872
  ].filter((dir) => dir.length > 0);
86817
86873
  }
86818
86874
  function mostlyCrlf(text2) {
@@ -86821,17 +86877,17 @@ ${preview.text}` } : {}
86821
86877
  }
86822
86878
  const EDITOR_MAX_BYTES = 2 * 1024 * 1024;
86823
86879
  async function openInPanelEditor(filePath) {
86824
- const real = await confineToAny(import_node_path56.default.resolve(filePath), managedRoots());
86880
+ const real = await confineToAny(import_node_path57.default.resolve(filePath), managedRoots());
86825
86881
  const stat = await import_promises31.default.stat(real);
86826
86882
  if (stat.size > EDITOR_MAX_BYTES)
86827
- throw new Error(`${import_node_path56.default.basename(real)} is too large to edit here (${String(Math.round(stat.size / 1024))} KB).`);
86883
+ throw new Error(`${import_node_path57.default.basename(real)} is too large to edit here (${String(Math.round(stat.size / 1024))} KB).`);
86828
86884
  const raw = await import_promises31.default.readFile(real, "utf8");
86829
86885
  const crlf = mostlyCrlf(raw);
86830
- post({ type: "editorFile", path: real, name: import_node_path56.default.basename(real), content: raw.split("\r\n").join("\n"), mtimeMs: stat.mtimeMs, eol: crlf ? "crlf" : "lf" });
86886
+ post({ type: "editorFile", path: real, name: import_node_path57.default.basename(real), content: raw.split("\r\n").join("\n"), mtimeMs: stat.mtimeMs, eol: crlf ? "crlf" : "lf" });
86831
86887
  }
86832
86888
  async function handleSaveEditorFile(filePath, content, mtimeMs) {
86833
86889
  try {
86834
- const real = await confineToAny(import_node_path56.default.resolve(filePath), managedRoots());
86890
+ const real = await confineToAny(import_node_path57.default.resolve(filePath), managedRoots());
86835
86891
  const current = await import_promises31.default.stat(real).catch(() => void 0);
86836
86892
  if (current !== void 0 && Math.abs(current.mtimeMs - mtimeMs) > 1) {
86837
86893
  post({
@@ -86839,7 +86895,7 @@ ${preview.text}` } : {}
86839
86895
  path: real,
86840
86896
  ok: false,
86841
86897
  conflict: true,
86842
- message: `${import_node_path56.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.`
86898
+ message: `${import_node_path57.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.`
86843
86899
  });
86844
86900
  return;
86845
86901
  }
@@ -86863,7 +86919,7 @@ ${preview.text}` } : {}
86863
86919
  await handleOpenManagedFile(existing.filePath);
86864
86920
  return;
86865
86921
  }
86866
- const target = import_node_path56.default.join(skillsDir, "standing-instructions.md");
86922
+ const target = import_node_path57.default.join(skillsDir, "standing-instructions.md");
86867
86923
  try {
86868
86924
  await import_promises31.default.mkdir(skillsDir, { recursive: true });
86869
86925
  await import_promises31.default.writeFile(target, STANDING_SKILL_TEMPLATE, { encoding: "utf8", flag: "wx" });
@@ -86883,7 +86939,7 @@ ${preview.text}` } : {}
86883
86939
  return;
86884
86940
  }
86885
86941
  try {
86886
- await import_promises31.default.mkdir(import_node_path56.default.dirname(codebaseInstructionsFile), { recursive: true });
86942
+ await import_promises31.default.mkdir(import_node_path57.default.dirname(codebaseInstructionsFile), { recursive: true });
86887
86943
  await import_promises31.default.writeFile(codebaseInstructionsFile, "", { encoding: "utf8", flag: "wx" });
86888
86944
  } catch (error51) {
86889
86945
  if (error51.code !== "EEXIST") {
@@ -86900,11 +86956,11 @@ ${preview.text}` } : {}
86900
86956
  return;
86901
86957
  if (!isValidToolName(name))
86902
86958
  throw new Error(`"${name}" is not a valid tool name.`);
86903
- const ownCopy = import_node_path56.default.join(dir, toolFileName(name));
86959
+ const ownCopy = import_node_path57.default.join(dir, toolFileName(name));
86904
86960
  if (filePath !== void 0) {
86905
- const same2 = (a, b) => normalizeForComparison(import_node_path56.default.resolve(a)) === normalizeForComparison(import_node_path56.default.resolve(b));
86961
+ const same2 = (a, b) => normalizeForComparison(import_node_path57.default.resolve(a)) === normalizeForComparison(import_node_path57.default.resolve(b));
86906
86962
  if (!same2(filePath, ownCopy)) {
86907
- const fromBucket = mirroredToolsDirs.some((mirror) => same2(import_node_path56.default.dirname(filePath), mirror));
86963
+ const fromBucket = mirroredToolsDirs.some((mirror) => same2(import_node_path57.default.dirname(filePath), mirror));
86908
86964
  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.`);
86909
86965
  }
86910
86966
  }
@@ -86930,7 +86986,7 @@ ${preview.text}` } : {}
86930
86986
  let dir;
86931
86987
  let filePath = "";
86932
86988
  for (const candidate of python.toolDirectories()) {
86933
- const attempt = import_node_path56.default.join(candidate, toolFileName(name));
86989
+ const attempt = import_node_path57.default.join(candidate, toolFileName(name));
86934
86990
  if (await onDisk(attempt)) {
86935
86991
  dir = candidate;
86936
86992
  filePath = attempt;
@@ -86961,7 +87017,7 @@ ${preview.text}` } : {}
86961
87017
  function samePath(a, b) {
86962
87018
  if (a === void 0 || b === void 0)
86963
87019
  return false;
86964
- const norm2 = (value) => process.platform === "win32" ? import_node_path56.default.resolve(value).toLowerCase() : import_node_path56.default.resolve(value);
87020
+ const norm2 = (value) => process.platform === "win32" ? import_node_path57.default.resolve(value).toLowerCase() : import_node_path57.default.resolve(value);
86965
87021
  return norm2(a) === norm2(b);
86966
87022
  }
86967
87023
  function publishFolder(kind, mirrors) {
@@ -87070,7 +87126,7 @@ ${preview.text}` } : {}
87070
87126
  target,
87071
87127
  ...mirror.prefix !== void 0 ? { prefix: mirror.prefix } : {},
87072
87128
  relative: entry,
87073
- contents: await import_promises31.default.readFile(import_node_path56.default.join(dir, entry))
87129
+ contents: await import_promises31.default.readFile(import_node_path57.default.join(dir, entry))
87074
87130
  });
87075
87131
  uploaded += 1;
87076
87132
  } catch (error51) {
@@ -87092,7 +87148,7 @@ ${preview.text}` } : {}
87092
87148
  if (!isValidToolName(name))
87093
87149
  throw new Error(`"${name}" is not a valid tool name.`);
87094
87150
  for (const candidate of python.toolDirectories()) {
87095
- const attempt = import_node_path56.default.join(candidate, toolFileName(name));
87151
+ const attempt = import_node_path57.default.join(candidate, toolFileName(name));
87096
87152
  try {
87097
87153
  post({ type: "pythonToolSource", name, source: await import_promises31.default.readFile(attempt, "utf8") });
87098
87154
  return;
@@ -87145,7 +87201,7 @@ ${preview.text}` } : {}
87145
87201
  continue;
87146
87202
  for (const candidate of python.toolDirectories()) {
87147
87203
  try {
87148
- const source = await import_promises31.default.readFile(import_node_path56.default.join(candidate, toolFileName(name)), "utf8");
87204
+ const source = await import_promises31.default.readFile(import_node_path57.default.join(candidate, toolFileName(name)), "utf8");
87149
87205
  declined[name] = hashSource(source);
87150
87206
  recorded += 1;
87151
87207
  break;
@@ -87203,7 +87259,7 @@ ${preview.text}` } : {}
87203
87259
  let dir;
87204
87260
  let filePath = "";
87205
87261
  for (const candidate of python.toolDirectories()) {
87206
- const attempt = import_node_path56.default.join(candidate, toolFileName(name));
87262
+ const attempt = import_node_path57.default.join(candidate, toolFileName(name));
87207
87263
  if (await onDisk(attempt)) {
87208
87264
  dir = candidate;
87209
87265
  filePath = attempt;
@@ -87229,7 +87285,7 @@ ${preview.text}` } : {}
87229
87285
  function mirrorForDir(sourceDir) {
87230
87286
  if (sourceDir === void 0)
87231
87287
  return void 0;
87232
- const wanted = import_node_path56.default.resolve(sourceDir).toLowerCase();
87288
+ const wanted = import_node_path57.default.resolve(sourceDir).toLowerCase();
87233
87289
  for (const mirror of cachedSkillMirrors) {
87234
87290
  if (mirror.enabled !== true)
87235
87291
  continue;
@@ -87239,7 +87295,7 @@ ${preview.text}` } : {}
87239
87295
  kind: "skills",
87240
87296
  ...mirror.prefix !== void 0 ? { prefix: mirror.prefix } : {}
87241
87297
  });
87242
- if (import_node_path56.default.resolve(localDir).toLowerCase() === wanted)
87298
+ if (import_node_path57.default.resolve(localDir).toLowerCase() === wanted)
87243
87299
  return { mirror, localDir };
87244
87300
  }
87245
87301
  return void 0;
@@ -87304,8 +87360,8 @@ ${preview.text}` } : {}
87304
87360
  });
87305
87361
  let localProblem;
87306
87362
  try {
87307
- await import_promises31.default.rm(import_node_path56.default.join(found2.localDir, `${name}.md`), { force: true });
87308
- await import_promises31.default.rm(import_node_path56.default.join(found2.localDir, name), { recursive: true, force: true });
87363
+ await import_promises31.default.rm(import_node_path57.default.join(found2.localDir, `${name}.md`), { force: true });
87364
+ await import_promises31.default.rm(import_node_path57.default.join(found2.localDir, name), { recursive: true, force: true });
87309
87365
  } catch (error51) {
87310
87366
  localProblem = error51 instanceof Error ? error51.message : String(error51);
87311
87367
  }
@@ -87340,7 +87396,7 @@ ${preview.text}` } : {}
87340
87396
  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.`);
87341
87397
  }
87342
87398
  const from = existing?.sourceDir !== void 0 && samePath(existing.sourceDir, personalSkillsDir) ? existing.sourceDir : skillsDir;
87343
- await import_promises31.default.rm(import_node_path56.default.join(from, skillFileName(name)), { force: true });
87399
+ await import_promises31.default.rm(import_node_path57.default.join(from, skillFileName(name)), { force: true });
87344
87400
  await postSkills();
87345
87401
  } catch (error51) {
87346
87402
  post({ type: "error", message: error51 instanceof Error ? error51.message : String(error51) });
@@ -87416,7 +87472,13 @@ ${preview.text}` } : {}
87416
87472
  }
87417
87473
  async function applyPlan(next) {
87418
87474
  const trimmed = next?.slice(0, PLAN_LIMIT).trim();
87419
- activePlan = trimmed !== void 0 && trimmed.length > 0 ? trimmed : void 0;
87475
+ const nextPlan = trimmed !== void 0 && trimmed.length > 0 ? trimmed : void 0;
87476
+ if (activeStrategy !== void 0 && startsNewWork(activePlan, activePlanProgress, nextPlan)) {
87477
+ strategyProgress = {};
87478
+ strategyLastRole = void 0;
87479
+ void postStrategies();
87480
+ }
87481
+ activePlan = nextPlan;
87420
87482
  activePlanProgress = pruneProgress(activePlan, activePlanProgress);
87421
87483
  await persistActiveTask();
87422
87484
  post({ type: "plan", plan: activePlan ?? "" });
@@ -87525,7 +87587,7 @@ ${preview.text}` } : {}
87525
87587
  let scheduleToolAccess;
87526
87588
  const approvalsKey = projectRoot ?? "__no_workspace__";
87527
87589
  function comparableApprovalsKey(key3) {
87528
- return key3 === "__no_workspace__" ? key3 : normalizeForComparison(import_node_path56.default.resolve(key3));
87590
+ return key3 === "__no_workspace__" ? key3 : normalizeForComparison(import_node_path57.default.resolve(key3));
87529
87591
  }
87530
87592
  function approvalsFrom(stored) {
87531
87593
  if (stored === void 0)
@@ -87739,7 +87801,7 @@ ${preview.text}` } : {}
87739
87801
  ...taskExpertEstimate === void 0 ? {} : { estimate: taskExpertEstimate }
87740
87802
  });
87741
87803
  }
87742
- const expertEventsPath = import_node_path56.default.join(storageDir, "expert-events.jsonl");
87804
+ const expertEventsPath = import_node_path57.default.join(storageDir, "expert-events.jsonl");
87743
87805
  let expertEvents;
87744
87806
  let juniorTurnWithoutExpert = false;
87745
87807
  async function loadExpertEvents() {
@@ -87767,7 +87829,7 @@ ${preview.text}` } : {}
87767
87829
  try {
87768
87830
  const events = await loadExpertEvents();
87769
87831
  events.push(event);
87770
- await import_promises31.default.mkdir(import_node_path56.default.dirname(expertEventsPath), { recursive: true });
87832
+ await import_promises31.default.mkdir(import_node_path57.default.dirname(expertEventsPath), { recursive: true });
87771
87833
  await import_promises31.default.appendFile(expertEventsPath, `${JSON.stringify(event)}
87772
87834
  `, "utf8");
87773
87835
  } catch (error51) {
@@ -88055,15 +88117,15 @@ ${preview.text}` } : {}
88055
88117
  function contextMentionPath(file2) {
88056
88118
  if (workspaceRoot === void 0)
88057
88119
  return file2;
88058
- const relative = import_node_path56.default.relative(workspaceRoot, file2);
88059
- return relative.length > 0 && !relative.startsWith("..") && !import_node_path56.default.isAbsolute(relative) ? relative.split(import_node_path56.default.sep).join("/") : file2;
88120
+ const relative = import_node_path57.default.relative(workspaceRoot, file2);
88121
+ return relative.length > 0 && !relative.startsWith("..") && !import_node_path57.default.isAbsolute(relative) ? relative.split(import_node_path57.default.sep).join("/") : file2;
88060
88122
  }
88061
88123
  function hostCapabilities() {
88062
88124
  return {
88063
88125
  // The branch this window or tab works on, shown under the chat's name; and the repository, when this
88064
88126
  // folder is one of its branch folders (git/worktrees.ts).
88065
88127
  ...workspaceBranch !== void 0 ? { workspaceBranch } : {},
88066
- ...projectRoot !== void 0 && workspaceRoot !== void 0 && projectRoot !== workspaceRoot ? { branchFolderOf: import_node_path56.default.basename(projectRoot) } : {},
88128
+ ...projectRoot !== void 0 && workspaceRoot !== void 0 && projectRoot !== workspaceRoot ? { branchFolderOf: import_node_path57.default.basename(projectRoot) } : {},
88067
88129
  // The GitHub Copilot preset, offered only where VS Code's models can be reached.
88068
88130
  hostModels: services.languageModels !== void 0,
88069
88131
  nativeGuide: ui.openWalkthrough !== void 0,
@@ -88629,14 +88691,14 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
88629
88691
  }
88630
88692
  function readUserNpmrc() {
88631
88693
  try {
88632
- return (0, import_node_fs14.readFileSync)(process.env["NPM_CONFIG_USERCONFIG"] ?? import_node_path56.default.join(import_node_os7.default.homedir(), ".npmrc"), "utf8");
88694
+ return (0, import_node_fs15.readFileSync)(process.env["NPM_CONFIG_USERCONFIG"] ?? import_node_path57.default.join(import_node_os7.default.homedir(), ".npmrc"), "utf8");
88633
88695
  } catch {
88634
88696
  return void 0;
88635
88697
  }
88636
88698
  }
88637
88699
  function addonFolders(config2) {
88638
88700
  return {
88639
- configured: (config2.addons?.folders ?? []).map((folder) => import_node_path56.default.resolve(folder)),
88701
+ configured: (config2.addons?.folders ?? []).map((folder) => import_node_path57.default.resolve(folder)),
88640
88702
  defaults: defaultAddonFolders(process.env, process.execPath, process.platform, readUserNpmrc())
88641
88703
  };
88642
88704
  }
@@ -88748,7 +88810,7 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
88748
88810
  if (id === void 0) {
88749
88811
  if (records.length >= (spec.max ?? 500))
88750
88812
  return postAddonPage(message6.package, { error: `No more than ${String(spec.max ?? 500)} ${spec.noun}s.` });
88751
- id = (0, import_node_crypto20.randomBytes)(6).toString("hex");
88813
+ id = (0, import_node_crypto21.randomBytes)(6).toString("hex");
88752
88814
  records.push({ id, values: cleaned.values });
88753
88815
  } else {
88754
88816
  const at = records.findIndex((record2) => record2.id === id);
@@ -88917,7 +88979,7 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
88917
88979
  }
88918
88980
  async function handleSaveAddonFolders(folders) {
88919
88981
  const cleaned = [...new Set(folders.map((folder) => folder.trim()).filter((folder) => folder.length > 0))];
88920
- const relative = cleaned.find((folder) => !import_node_path56.default.isAbsolute(folder));
88982
+ const relative = cleaned.find((folder) => !import_node_path57.default.isAbsolute(folder));
88921
88983
  if (relative !== void 0) {
88922
88984
  await postAddons(`"${relative}" is not a full path. Add-on folders are full paths, such as C:\\addons.`);
88923
88985
  return;
@@ -88928,7 +88990,7 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
88928
88990
  postMcp();
88929
88991
  await postAddons();
88930
88992
  }
88931
- const shadowGit = workspaceRoot !== void 0 ? new ShadowGit(workspaceRoot, import_node_path56.default.join(storageDir, "checkpoints", "shadow.git"), services.codebaseDir !== void 0 ? import_node_path56.default.join(services.codebaseDir, "checkpoint-objects") : void 0) : void 0;
88993
+ const shadowGit = workspaceRoot !== void 0 ? new ShadowGit(workspaceRoot, import_node_path57.default.join(storageDir, "checkpoints", "shadow.git"), services.codebaseDir !== void 0 ? import_node_path57.default.join(services.codebaseDir, "checkpoint-objects") : void 0) : void 0;
88932
88994
  async function postProfiles() {
88933
88995
  const { config: config2 } = await configManager.load();
88934
88996
  const profiles = await Promise.all((config2.profiles ?? []).map((profile) => toSummary(profile, secrets)));
@@ -88966,7 +89028,7 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
88966
89028
  let warning;
88967
89029
  if (tls2.cert !== void 0 && tls2.key !== void 0) {
88968
89030
  out.cert = tls2.cert.toString("utf8");
88969
- const key3 = (0, import_node_crypto20.createPrivateKey)(tls2.passphrase !== void 0 ? { key: tls2.key, passphrase: tls2.passphrase } : { key: tls2.key });
89031
+ const key3 = (0, import_node_crypto21.createPrivateKey)(tls2.passphrase !== void 0 ? { key: tls2.key, passphrase: tls2.passphrase } : { key: tls2.key });
88970
89032
  out.key = key3.export({ type: "pkcs8", format: "pem" }).toString();
88971
89033
  } else if (tls2.pfx !== void 0) {
88972
89034
  warning = "The client certificate is a .pfx, which the observer process cannot present; it connects without one. If the gateway requires it, use a PEM certificate and key.";
@@ -89097,7 +89159,7 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
89097
89159
  await observerHub.configure(settings);
89098
89160
  if (restart)
89099
89161
  await observerHub.restart();
89100
- auditRecordExists = settings.auditor.enabled || (0, import_node_fs14.existsSync)(observerHub.journalFolder);
89162
+ auditRecordExists = settings.auditor.enabled || (0, import_node_fs15.existsSync)(observerHub.journalFolder);
89101
89163
  if (settings.auditor.enabled && !auditPruned) {
89102
89164
  auditPruned = true;
89103
89165
  void pruneAudit(storageDir, o.auditor?.retentionDays ?? 90).then((n) => {
@@ -89142,7 +89204,7 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
89142
89204
  return;
89143
89205
  }
89144
89206
  if (ui.openFile !== void 0)
89145
- await ui.openFile(import_node_path56.default.join(folder, newest));
89207
+ await ui.openFile(import_node_path57.default.join(folder, newest));
89146
89208
  else
89147
89209
  ui.showInfo(`The audit journal is in ${folder} (newest: ${newest}).`);
89148
89210
  }
@@ -89180,7 +89242,7 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
89180
89242
  async function handleOpenArtifact(relative, how) {
89181
89243
  if (workspaceRoot === void 0)
89182
89244
  return;
89183
- const absolute = await confine(import_node_path56.default.resolve(workspaceRoot, relative), workspaceRoot);
89245
+ const absolute = await confine(import_node_path57.default.resolve(workspaceRoot, relative), workspaceRoot);
89184
89246
  if (await denylist.isDenied(absolute)) {
89185
89247
  ui.showWarning(`${relative} is on the deny list, so it is not opened.`);
89186
89248
  return;
@@ -89293,7 +89355,7 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
89293
89355
  return { ok: true, message: `Saved in ${file2}; it reaches colleagues through this project's own sharing.` };
89294
89356
  }
89295
89357
  const enabled = cachedToolMirrors.filter((each) => each.enabled === true);
89296
- const index = mirroredToolsDirs.findIndex((dir) => samePath(import_node_path56.default.dirname(file2), dir));
89358
+ const index = mirroredToolsDirs.findIndex((dir) => samePath(import_node_path57.default.dirname(file2), dir));
89297
89359
  try {
89298
89360
  await writeFileAtomically(file2, review.content);
89299
89361
  const mirror = index >= 0 ? enabled[index] : void 0;
@@ -89301,7 +89363,7 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
89301
89363
  const target = targetById(cachedS3, mirror.connectionId);
89302
89364
  if (target === void 0 || target.readOnly === true)
89303
89365
  return { ok: false, message: `${target?.label ?? mirror.connectionId} is read-only here, so the approved tool cannot be published from this computer.` };
89304
- await uploadToS3({ target, ...mirror.prefix !== void 0 ? { prefix: mirror.prefix } : {}, relative: import_node_path56.default.basename(file2), contents: Buffer.from(review.content, "utf8") });
89366
+ await uploadToS3({ target, ...mirror.prefix !== void 0 ? { prefix: mirror.prefix } : {}, relative: import_node_path57.default.basename(file2), contents: Buffer.from(review.content, "utf8") });
89305
89367
  return { ok: true, message: `Uploaded to the bucket ${target.label}; colleagues get it at their next sync and approve its code once, as for any tool.` };
89306
89368
  }
89307
89369
  scheduleTeamRepoPush();
@@ -89433,7 +89495,7 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
89433
89495
  const roleProcesses = /* @__PURE__ */ new Map();
89434
89496
  async function roleProcessFor(agent, profile, config2, exe, system, tools) {
89435
89497
  const definitions = toToolDefinitions([...tools]);
89436
- const key3 = JSON.stringify([profile.id, profile.baseUrl, profile.model, profile.maxTokens ?? null, (0, import_node_crypto20.createHash)("sha256").update(system).digest("hex"), definitions.map((d) => d.name)]);
89498
+ const key3 = JSON.stringify([profile.id, profile.baseUrl, profile.model, profile.maxTokens ?? null, (0, import_node_crypto21.createHash)("sha256").update(system).digest("hex"), definitions.map((d) => d.name)]);
89437
89499
  const existing = roleProcesses.get(agent.role);
89438
89500
  if (existing !== void 0 && existing.key === key3)
89439
89501
  return existing.process;
@@ -89582,8 +89644,8 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
89582
89644
  persistTimer.unref?.();
89583
89645
  }
89584
89646
  function composerDraftFile() {
89585
- const id = (0, import_node_crypto20.createHash)("sha256").update((workspaceRoot ?? "").toLowerCase()).digest("hex").slice(0, 16);
89586
- return import_node_path56.default.join(storageDir, "drafts", `${id}.txt`);
89647
+ const id = (0, import_node_crypto21.createHash)("sha256").update((workspaceRoot ?? "").toLowerCase()).digest("hex").slice(0, 16);
89648
+ return import_node_path57.default.join(storageDir, "drafts", `${id}.txt`);
89587
89649
  }
89588
89650
  let draftWrites = Promise.resolve();
89589
89651
  function saveComposerDraft(text2) {
@@ -89596,10 +89658,20 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
89596
89658
  return import_promises31.default.readFile(composerDraftFile(), "utf8").catch(() => "");
89597
89659
  }
89598
89660
  async function persistActiveTask() {
89599
- if (workspaceRoot === void 0 || conversation.isEmpty())
89661
+ if (workspaceRoot === void 0)
89662
+ return;
89663
+ const pending = pendingSteeringPath();
89664
+ if (conversation.isEmpty()) {
89665
+ if (pending !== void 0 && backgroundRun !== true) {
89666
+ await writePendingSteering(pending, {
89667
+ ...activePlan !== void 0 ? { plan: activePlan, planProgress: activePlanProgress } : {},
89668
+ ...activeStrategy !== void 0 ? { strategy: activeStrategy, strategyProgress, strategyExchanges } : {}
89669
+ }).catch((error51) => logger.warn(`Could not keep this chat's plan and strategy: ${describeFailure2(error51, true)}`));
89670
+ }
89600
89671
  return;
89672
+ }
89601
89673
  if (activeTaskId === void 0) {
89602
- await setActiveTaskId((0, import_node_crypto20.randomUUID)());
89674
+ await setActiveTaskId((0, import_node_crypto21.randomUUID)());
89603
89675
  activeTaskCreatedAt = Date.now();
89604
89676
  truncationStore.startTask();
89605
89677
  }
@@ -89621,6 +89693,8 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
89621
89693
  };
89622
89694
  try {
89623
89695
  await taskStore.save(redactTask(task, await knownSecretValues()));
89696
+ if (pending !== void 0 && backgroundRun !== true)
89697
+ await clearPendingSteering(pending);
89624
89698
  } catch (error51) {
89625
89699
  logger.warn("could not save task history", String(error51));
89626
89700
  }
@@ -89656,20 +89730,27 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
89656
89730
  void _resumes;
89657
89731
  void taskStore.save(settled).catch(() => void 0);
89658
89732
  }
89659
- activePlan = task.plan;
89660
- activePlanProgress = pruneProgress(activePlan, task.planProgress);
89661
- activeStrategy = task.strategy;
89662
- strategyProgress = task.strategyProgress ?? {};
89663
- strategyExchanges = task.strategyExchanges ?? [];
89664
- strategyLastRole = void 0;
89665
- stopRoleProcesses();
89733
+ adoptSteering(task);
89666
89734
  await setActiveTaskId(task.id);
89667
89735
  post({ type: "taskRestored", taskId: task.id, entries: toTranscript(task.messages) });
89736
+ postSteering();
89737
+ await postTasks();
89738
+ }
89739
+ function adoptSteering(source) {
89740
+ activePlan = source.plan;
89741
+ activePlanProgress = pruneProgress(activePlan, source.planProgress);
89742
+ activeStrategy = source.strategy;
89743
+ strategyProgress = source.strategyProgress ?? {};
89744
+ strategyExchanges = source.strategyExchanges ?? [];
89745
+ strategyLastRole = void 0;
89746
+ stopRoleProcesses();
89747
+ }
89748
+ function postSteering() {
89668
89749
  post({ type: "plan", plan: activePlan ?? "" });
89669
89750
  postPlanProgress();
89670
89751
  void postStrategies();
89671
- await postTasks();
89672
89752
  }
89753
+ const pendingSteeringPath = () => workspaceRoot === void 0 ? void 0 : pendingSteeringFile(storageDir, workspaceRoot);
89673
89754
  async function startNewTask() {
89674
89755
  conversation.reset();
89675
89756
  crashResumes = 0;
@@ -89690,6 +89771,9 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
89690
89771
  strategyLastRole = void 0;
89691
89772
  stopRoleProcesses();
89692
89773
  await setActiveTaskId(void 0);
89774
+ const pending = pendingSteeringPath();
89775
+ if (pending !== void 0 && backgroundRun !== true)
89776
+ await clearPendingSteering(pending);
89693
89777
  post({ type: "taskRestored", taskId: void 0, entries: [] });
89694
89778
  post({ type: "plan", plan: "" });
89695
89779
  postPlanProgress();
@@ -89823,14 +89907,23 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
89823
89907
  await postTasks();
89824
89908
  }
89825
89909
  async function restoreActiveTaskOnLoad() {
89826
- if (activeTaskId === void 0) {
89910
+ const restoreEmptyChat = async () => {
89827
89911
  post({ type: "taskRestored", taskId: void 0, entries: [] });
89912
+ const pending = pendingSteeringPath();
89913
+ const steering = pending === void 0 ? void 0 : await readPendingSteering(pending);
89914
+ if (steering === void 0 || !conversation.isEmpty() || activeTaskId !== void 0 || activeStrategy !== void 0 || activePlan !== void 0)
89915
+ return;
89916
+ adoptSteering(steering);
89917
+ postSteering();
89918
+ };
89919
+ if (activeTaskId === void 0) {
89920
+ await restoreEmptyChat();
89828
89921
  return;
89829
89922
  }
89830
89923
  const task = await taskStore.load(activeTaskId);
89831
89924
  if (task === void 0 || task.workspaceRoot !== workspaceRoot) {
89832
89925
  await setActiveTaskId(void 0);
89833
- post({ type: "taskRestored", taskId: void 0, entries: [] });
89926
+ await restoreEmptyChat();
89834
89927
  return;
89835
89928
  }
89836
89929
  conversation.restore(task.messages);
@@ -89838,7 +89931,9 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
89838
89931
  truncationStore.startTask(task.resultHandles);
89839
89932
  restoredInterruptedTurn = task.turnRunning === true;
89840
89933
  crashResumes = typeof task.crashResumes === "number" ? task.crashResumes : 0;
89934
+ adoptSteering(task);
89841
89935
  post({ type: "taskRestored", taskId: task.id, entries: toTranscript(task.messages) });
89936
+ postSteering();
89842
89937
  }
89843
89938
  async function resumeInterruptedTurn() {
89844
89939
  const decision = resumeDecision({ asked: services.resumeInterrupted === true, turnWasRunning: restoredInterruptedTurn, resumesSoFar: crashResumes });
@@ -90080,7 +90175,7 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
90080
90175
  ...schedule === void 0 ? { requestForm } : {},
90081
90176
  // A skill read with the user's defaults for its placeholders carries them (`skills/defaults.ts`).
90082
90177
  annotateRead: (realPath) => {
90083
- const fold = (value) => process.platform === "win32" ? import_node_path56.default.resolve(value).toLowerCase() : import_node_path56.default.resolve(value);
90178
+ const fold = (value) => process.platform === "win32" ? import_node_path57.default.resolve(value).toLowerCase() : import_node_path57.default.resolve(value);
90084
90179
  const skill = skills.find((each) => fold(each.filePath) === fold(realPath));
90085
90180
  return skill === void 0 ? void 0 : skillDefaultsReadNote(skill.name, config2.skillDefaults?.[skill.name]);
90086
90181
  },
@@ -90539,7 +90634,7 @@ ${direction}` : attachMentions(text2, mentions);
90539
90634
  try {
90540
90635
  const { config: config2 } = await configManager.load();
90541
90636
  const profiles = config2.profiles ?? [];
90542
- const id = input.id ?? (0, import_node_crypto20.randomUUID)();
90637
+ const id = input.id ?? (0, import_node_crypto21.randomUUID)();
90543
90638
  const existing = profiles.find((p) => p.id === id);
90544
90639
  const auth2 = await buildAuthFromInput(input, id);
90545
90640
  const saved = {
@@ -90577,7 +90672,7 @@ ${direction}` : attachMentions(text2, mentions);
90577
90672
  post({ type: "error", message: `Profile "${id}" no longer exists.` });
90578
90673
  return;
90579
90674
  }
90580
- const newId = (0, import_node_crypto20.randomUUID)();
90675
+ const newId = (0, import_node_crypto21.randomUUID)();
90581
90676
  async function copySecret(fromRef, toRef) {
90582
90677
  if (fromRef === void 0)
90583
90678
  return false;
@@ -91388,7 +91483,7 @@ ${redact(shown2, cachedSecretValues)}` }
91388
91483
  return { mode: cachedSearchScope, author: cachedAttribution.author };
91389
91484
  }
91390
91485
  function currentProjectNames() {
91391
- const names = [cachedAttribution.project, workspaceRoot !== void 0 ? import_node_path56.default.basename(workspaceRoot) : void 0];
91486
+ const names = [cachedAttribution.project, workspaceRoot !== void 0 ? import_node_path57.default.basename(workspaceRoot) : void 0];
91392
91487
  return names.filter((name) => name !== void 0 && name.length > 0);
91393
91488
  }
91394
91489
  function indexProject(config2) {
@@ -91491,8 +91586,8 @@ ${redact(shown2, cachedSecretValues)}` }
91491
91586
  limit: limits.limit,
91492
91587
  previewChars: limits.previewChars
91493
91588
  });
91494
- for (const path67 of answer.skipped ?? [])
91495
- skipped2.add(path67);
91589
+ for (const path68 of answer.skipped ?? [])
91590
+ skipped2.add(path68);
91496
91591
  return { messages: answer.messages, truncated: answer.truncated };
91497
91592
  },
91498
91593
  ...embedder !== void 0 && search !== void 0 && collection !== void 0 ? {
@@ -91791,9 +91886,9 @@ ${redact(shown2, cachedSecretValues)}` }
91791
91886
  });
91792
91887
  const all = result.folders.map((entry) => entry.path);
91793
91888
  const wanted = new Set(chosen);
91794
- for (const path67 of all) {
91795
- if (chosen.some((root) => path67 === root || path67.startsWith(`${root}\\`)))
91796
- wanted.add(path67);
91889
+ for (const path68 of all) {
91890
+ if (chosen.some((root) => path68 === root || path68.startsWith(`${root}\\`)))
91891
+ wanted.add(path68);
91797
91892
  }
91798
91893
  return [...wanted];
91799
91894
  } catch {
@@ -91801,7 +91896,7 @@ ${redact(shown2, cachedSecretValues)}` }
91801
91896
  }
91802
91897
  }
91803
91898
  async function handleRequestOutlookFolders(depth, force = false) {
91804
- const cachePath = import_node_path56.default.join(storageDir, "outlook-folders.json");
91899
+ const cachePath = import_node_path57.default.join(storageDir, "outlook-folders.json");
91805
91900
  let served = false;
91806
91901
  try {
91807
91902
  const cached2 = JSON.parse(await import_promises31.default.readFile(cachePath, "utf8"));
@@ -91821,7 +91916,7 @@ ${redact(shown2, cachedSecretValues)}` }
91821
91916
  const scannedAt = Date.now();
91822
91917
  post({ type: "outlookFolders", folders: result.folders, scannedAt });
91823
91918
  try {
91824
- await import_promises31.default.mkdir(import_node_path56.default.dirname(cachePath), { recursive: true });
91919
+ await import_promises31.default.mkdir(import_node_path57.default.dirname(cachePath), { recursive: true });
91825
91920
  await import_promises31.default.writeFile(cachePath, JSON.stringify({ scannedAt, folders: result.folders }), "utf8");
91826
91921
  } catch {
91827
91922
  }
@@ -92066,7 +92161,7 @@ ${redact(shown2, cachedSecretValues)}` }
92066
92161
  if (auth2.clientId === void 0 || auth2.clientSecretRef === void 0) {
92067
92162
  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.");
92068
92163
  }
92069
- const key3 = JSON.stringify({ auth: auth2, baseUrl: config2.autosys?.baseUrl, tls: tls2 === void 0 ? 0 : (0, import_node_crypto20.createHash)("sha256").update(JSON.stringify(tls2)).digest("hex") });
92164
+ const key3 = JSON.stringify({ auth: auth2, baseUrl: config2.autosys?.baseUrl, tls: tls2 === void 0 ? 0 : (0, import_node_crypto21.createHash)("sha256").update(JSON.stringify(tls2)).digest("hex") });
92070
92165
  const testing = http !== httpClient;
92071
92166
  if (!testing && autosysGateway?.key === key3)
92072
92167
  return autosysGateway.strategy;
@@ -92738,13 +92833,13 @@ ${redact(shown2, cachedSecretValues)}` }
92738
92833
  return { reason: "Off." };
92739
92834
  if (!isSafeSegment(settings.project) || !isSafeSegment(settings.repo))
92740
92835
  return { reason: "Enter the project key and repository slug." };
92741
- const digest = (0, import_node_crypto20.createHash)("sha256").update(JSON.stringify([bitbucket.baseUrl, settings.project, settings.repo, settings.branch, settings.folder]).toLowerCase()).digest("hex").slice(0, 12);
92742
- const root = import_node_path56.default.join(mirrorRoot, "teamrepo", `${settings.project}-${settings.repo}-${digest}`.toLowerCase());
92836
+ const digest = (0, import_node_crypto21.createHash)("sha256").update(JSON.stringify([bitbucket.baseUrl, settings.project, settings.repo, settings.branch, settings.folder]).toLowerCase()).digest("hex").slice(0, 12);
92837
+ const root = import_node_path57.default.join(mirrorRoot, "teamrepo", `${settings.project}-${settings.repo}-${digest}`.toLowerCase());
92743
92838
  return {
92744
- dirs: { skills: import_node_path56.default.join(root, "skills"), tools: import_node_path56.default.join(root, "tools") },
92839
+ dirs: { skills: import_node_path57.default.join(root, "skills"), tools: import_node_path57.default.join(root, "tools") },
92745
92840
  // Where new skills and tools are saved while the repository is on - see loadSettings and pythonFolders.
92746
- own: { skills: import_node_path56.default.join(root, "saved-here", "skills"), tools: import_node_path56.default.join(root, "saved-here", "tools") },
92747
- stateFile: import_node_path56.default.join(root, TEAM_REPO_STATE_FILE),
92841
+ own: { skills: import_node_path57.default.join(root, "saved-here", "skills"), tools: import_node_path57.default.join(root, "saved-here", "tools") },
92842
+ stateFile: import_node_path57.default.join(root, TEAM_REPO_STATE_FILE),
92748
92843
  settings
92749
92844
  };
92750
92845
  }
@@ -92787,14 +92882,14 @@ ${redact(shown2, cachedSecretValues)}` }
92787
92882
  const config2 = await loadSettings();
92788
92883
  const plan3 = teamRepoPlan(config2);
92789
92884
  if (!("reason" in plan3)) {
92790
- const norm2 = (value) => process.platform === "win32" ? import_node_path56.default.resolve(value).toLowerCase() : import_node_path56.default.resolve(value);
92885
+ const norm2 = (value) => process.platform === "win32" ? import_node_path57.default.resolve(value).toLowerCase() : import_node_path57.default.resolve(value);
92791
92886
  const folders = [
92792
92887
  ...[plan3.dirs.skills, plan3.own.skills, ...skillSearchPath()].map((dir) => [dir, "skills"]),
92793
92888
  ...[plan3.dirs.tools, plan3.own.tools, ...python.toolDirectories()].map((dir) => [dir, "tools"])
92794
92889
  ];
92795
- const holder = folders.find(([dir]) => norm2(file2).startsWith(norm2(dir) + import_node_path56.default.sep));
92890
+ const holder = folders.find(([dir]) => norm2(file2).startsWith(norm2(dir) + import_node_path57.default.sep));
92796
92891
  if (holder !== void 0) {
92797
- const relative = import_node_path56.default.relative(import_node_path56.default.resolve(holder[0]), import_node_path56.default.resolve(file2)).split(import_node_path56.default.sep).join("/");
92892
+ const relative = import_node_path57.default.relative(import_node_path57.default.resolve(holder[0]), import_node_path57.default.resolve(file2)).split(import_node_path57.default.sep).join("/");
92798
92893
  const where = repoPathFor(plan3.settings.folder, holder[1], relative);
92799
92894
  try {
92800
92895
  const client = await bitbucketClient();
@@ -92826,21 +92921,21 @@ ${redact(shown2, cachedSecretValues)}` }
92826
92921
  const has2 = async (target) => import_promises31.default.stat(target).then(() => true, () => false);
92827
92922
  if (kind === "skill") {
92828
92923
  for (const dir of unique([skillsDir, localSkillsDir, personalSkillsDir, ...mirroredSkillsDirs])) {
92829
- if (await has2(import_node_path56.default.join(dir, skillFileName(name))))
92830
- plan3.local.push(import_node_path56.default.join(dir, skillFileName(name)));
92831
- if (await has2(import_node_path56.default.join(dir, name, "SKILL.md")))
92832
- plan3.local.push(import_node_path56.default.join(dir, name));
92924
+ if (await has2(import_node_path57.default.join(dir, skillFileName(name))))
92925
+ plan3.local.push(import_node_path57.default.join(dir, skillFileName(name)));
92926
+ if (await has2(import_node_path57.default.join(dir, name, "SKILL.md")))
92927
+ plan3.local.push(import_node_path57.default.join(dir, name));
92833
92928
  }
92834
92929
  for (const extra of config2.skills?.paths ?? []) {
92835
92930
  const dir = resolveSkillDir(extra);
92836
- if (dir !== void 0 && (await has2(import_node_path56.default.join(dir, skillFileName(name))) || await has2(import_node_path56.default.join(dir, name, "SKILL.md")))) {
92931
+ if (dir !== void 0 && (await has2(import_node_path57.default.join(dir, skillFileName(name))) || await has2(import_node_path57.default.join(dir, name, "SKILL.md")))) {
92837
92932
  plan3.notes.push(`Also in ${dir}, a folder you added in Settings -> Skills - not removed; delete it there.`);
92838
92933
  }
92839
92934
  }
92840
92935
  } else {
92841
92936
  for (const dir of unique([pythonFolders(config2).toolsDir, localToolsDir(config2), personalToolsDir, ...mirroredToolsDirs])) {
92842
- if (await has2(import_node_path56.default.join(dir, toolFileName(name))))
92843
- plan3.local.push(import_node_path56.default.join(dir, toolFileName(name)));
92937
+ if (await has2(import_node_path57.default.join(dir, toolFileName(name))))
92938
+ plan3.local.push(import_node_path57.default.join(dir, toolFileName(name)));
92844
92939
  }
92845
92940
  }
92846
92941
  const mirrors = (kind === "skill" ? cachedSkillMirrors : cachedToolMirrors).filter((mirror) => mirror.enabled === true);
@@ -92938,7 +93033,7 @@ ${redact(shown2, cachedSecretValues)}` }
92938
93033
  try {
92939
93034
  await import_promises31.default.rm(entry, { recursive: true, force: true });
92940
93035
  if (kind === "tool")
92941
- await forgetTool(import_node_path56.default.dirname(entry), name).catch(() => void 0);
93036
+ await forgetTool(import_node_path57.default.dirname(entry), name).catch(() => void 0);
92942
93037
  } catch (error51) {
92943
93038
  localProblems.push(`${entry} (${error51 instanceof Error ? error51.message : String(error51)})`);
92944
93039
  }
@@ -92964,24 +93059,24 @@ ${redact(shown2, cachedSecretValues)}` }
92964
93059
  }
92965
93060
  async function writeTeamMonitorSkill(file2, content) {
92966
93061
  const config2 = await loadSettings();
92967
- const norm2 = (value) => process.platform === "win32" ? import_node_path56.default.resolve(value).toLowerCase() : import_node_path56.default.resolve(value);
93062
+ const norm2 = (value) => process.platform === "win32" ? import_node_path57.default.resolve(value).toLowerCase() : import_node_path57.default.resolve(value);
92968
93063
  const inside = (dir) => {
92969
93064
  const target = norm2(file2);
92970
93065
  const root = norm2(dir);
92971
- return target.startsWith(root + import_node_path56.default.sep) ? import_node_path56.default.relative(import_node_path56.default.resolve(dir), import_node_path56.default.resolve(file2)) : void 0;
93066
+ return target.startsWith(root + import_node_path57.default.sep) ? import_node_path57.default.relative(import_node_path57.default.resolve(dir), import_node_path57.default.resolve(file2)) : void 0;
92972
93067
  };
92973
93068
  const saveIn = async (dir, relative) => {
92974
- const destination = import_node_path56.default.join(dir, relative);
93069
+ const destination = import_node_path57.default.join(dir, relative);
92975
93070
  const enabled = cachedSkillMirrors.filter((each) => each.enabled === true);
92976
93071
  const mirror = enabled.find((_, i) => samePath(mirroredSkillsDirs[i], dir));
92977
93072
  const target = mirror !== void 0 ? targetById(cachedS3, mirror.connectionId) : void 0;
92978
93073
  if (mirror !== void 0 && (target === void 0 || target.readOnly === true)) {
92979
93074
  throw new Error(`${target?.label ?? mirror.connectionId} is read-only here, so this team monitor cannot be changed from this computer - ask whoever owns that bucket.`);
92980
93075
  }
92981
- await import_promises31.default.mkdir(import_node_path56.default.dirname(destination), { recursive: true });
93076
+ await import_promises31.default.mkdir(import_node_path57.default.dirname(destination), { recursive: true });
92982
93077
  await writeFileAtomically(destination, content);
92983
93078
  if (mirror !== void 0 && target !== void 0) {
92984
- await uploadToS3({ target, ...mirror.prefix !== void 0 ? { prefix: mirror.prefix } : {}, relative: relative.split(import_node_path56.default.sep).join("/"), contents: Buffer.from(content, "utf8") });
93079
+ await uploadToS3({ target, ...mirror.prefix !== void 0 ? { prefix: mirror.prefix } : {}, relative: relative.split(import_node_path57.default.sep).join("/"), contents: Buffer.from(content, "utf8") });
92985
93080
  return `uploaded to the bucket ${target.label}`;
92986
93081
  }
92987
93082
  return `saved in ${dir}`;
@@ -93003,7 +93098,7 @@ ${redact(shown2, cachedSecretValues)}` }
93003
93098
  throw new Error("There is no folder to save skills in, so the change cannot reach the team repository.");
93004
93099
  const where = await saveIn(skillsDir, relative);
93005
93100
  await handleTeamRepoSync("a monitor changed on the dashboard");
93006
- const problem = teamRepoStatus?.error ?? teamRepoStatus?.conflicts.find((c2) => c2.path.endsWith(relative.split(import_node_path56.default.sep).join("/")))?.reason;
93101
+ const problem = teamRepoStatus?.error ?? teamRepoStatus?.conflicts.find((c2) => c2.path.endsWith(relative.split(import_node_path57.default.sep).join("/")))?.reason;
93007
93102
  if (problem !== void 0) {
93008
93103
  return { ok: false, message: `Saved here (${where}), but not committed to the team repository: ${problem}. Nothing was overwritten - see Settings \u2192 DevOps \u2192 Team repository.` };
93009
93104
  }
@@ -93033,8 +93128,8 @@ ${redact(shown2, cachedSecretValues)}` }
93033
93128
  function isPersonalSkill(skill) {
93034
93129
  if (personalSkillsDir === void 0)
93035
93130
  return false;
93036
- const norm2 = (value) => process.platform === "win32" ? import_node_path56.default.resolve(value).toLowerCase() : import_node_path56.default.resolve(value);
93037
- return norm2(skill.filePath).startsWith(norm2(personalSkillsDir) + import_node_path56.default.sep);
93131
+ const norm2 = (value) => process.platform === "win32" ? import_node_path57.default.resolve(value).toLowerCase() : import_node_path57.default.resolve(value);
93132
+ return norm2(skill.filePath).startsWith(norm2(personalSkillsDir) + import_node_path57.default.sep);
93038
93133
  }
93039
93134
  function bucketFolderLabels(config2) {
93040
93135
  const label = (kind, mirror) => {
@@ -93282,7 +93377,7 @@ ${redact(shown2, cachedSecretValues)}` }
93282
93377
  }
93283
93378
  const command = config2.branches?.setupCommand?.trim();
93284
93379
  if (command !== void 0 && command.length > 0) {
93285
- const label = workspaceBranch ?? import_node_path56.default.basename(workspaceRoot);
93380
+ const label = workspaceBranch ?? import_node_path57.default.basename(workspaceRoot);
93286
93381
  if (ui.runInTerminal !== void 0) {
93287
93382
  ui.runInTerminal({ name: `Set up ${label}`, command, cwd: workspaceRoot, env: branchEnv });
93288
93383
  parts.push(`running "${command}" in a terminal`);
@@ -93356,7 +93451,7 @@ ${last}` : ""}`);
93356
93451
  approvalStamps.set("machine", stamp2);
93357
93452
  }
93358
93453
  for (const dir of python.toolDirectories()) {
93359
- const file2 = import_node_path56.default.join(dir, REGISTRY_FILE);
93454
+ const file2 = import_node_path57.default.join(dir, REGISTRY_FILE);
93360
93455
  const stamp2 = await import_promises31.default.stat(file2).then((stat) => stat.mtimeMs, () => 0);
93361
93456
  if (approvalStamps.has(file2) && approvalStamps.get(file2) !== stamp2)
93362
93457
  changed = true;
@@ -93458,7 +93553,7 @@ ${last}` : ""}`);
93458
93553
  return;
93459
93554
  }
93460
93555
  const folder = skill.filePath.slice(0, skill.filePath.length - "SKILL.md".length);
93461
- const bytes = await import_promises31.default.readFile(import_node_path56.default.join(folder, SKILL_IMAGE_DIR, image));
93556
+ const bytes = await import_promises31.default.readFile(import_node_path57.default.join(folder, SKILL_IMAGE_DIR, image));
93462
93557
  const dataUri = skillImageDataUri(image, bytes);
93463
93558
  post({
93464
93559
  type: "skillImage",
@@ -93824,13 +93919,13 @@ ${last}` : ""}`);
93824
93919
  }
93825
93920
  function docsFingerprintPath(index, storeId, kind) {
93826
93921
  const suffix = kind === void 0 ? "docs" : `docs.${kind}`;
93827
- return import_node_path56.default.join(manifestsRoot, "index-manifests", `${manifestKey(index, storeId)}.${suffix}.json`);
93922
+ return import_node_path57.default.join(manifestsRoot, "index-manifests", `${manifestKey(index, storeId)}.${suffix}.json`);
93828
93923
  }
93829
93924
  function manifestKey(index, storeId) {
93830
93925
  return `${index}@${storeId}`;
93831
93926
  }
93832
93927
  function manifestPath(index, storeId) {
93833
- return import_node_path56.default.join(manifestsRoot, "index-manifests", `${manifestKey(index, storeId)}.json`);
93928
+ return import_node_path57.default.join(manifestsRoot, "index-manifests", `${manifestKey(index, storeId)}.json`);
93834
93929
  }
93835
93930
  async function readDocsFingerprint(index, storeId, kind) {
93836
93931
  try {
@@ -93860,7 +93955,7 @@ ${last}` : ""}`);
93860
93955
  });
93861
93956
  const wanted = options.kind;
93862
93957
  const entries = wanted === void 0 ? all : all.filter((entry) => entry.kind === wanted);
93863
- const fingerprint = (0, import_node_crypto20.createHash)("sha256").update(`${wanted ?? "all"}:${embedder.model}:${String(embedder.dimensions)}`).update(entries.map((entry) => `${entry.id}\0${entry.text}`).join("")).digest("hex");
93958
+ const fingerprint = (0, import_node_crypto21.createHash)("sha256").update(`${wanted ?? "all"}:${embedder.model}:${String(embedder.dimensions)}`).update(entries.map((entry) => `${entry.id}\0${entry.text}`).join("")).digest("hex");
93864
93959
  if (!options.force && fingerprint === await readDocsFingerprint(index, search.id, wanted)) {
93865
93960
  return { unchanged: true, index, indexed: entries.length };
93866
93961
  }
@@ -93894,7 +93989,7 @@ ${last}` : ""}`);
93894
93989
  }
93895
93990
  options.report?.("Writing", { done: 0, total: documents.length });
93896
93991
  await writer.upsert(index, documents);
93897
- await import_promises31.default.mkdir(import_node_path56.default.dirname(docsFingerprintPath(index, search.id, wanted)), {
93992
+ await import_promises31.default.mkdir(import_node_path57.default.dirname(docsFingerprintPath(index, search.id, wanted)), {
93898
93993
  recursive: true
93899
93994
  });
93900
93995
  await import_promises31.default.writeFile(docsFingerprintPath(index, search.id, wanted), JSON.stringify({ fingerprint, indexedAt: Date.now(), count: documents.length }), "utf8");
@@ -94084,7 +94179,7 @@ ${last}` : ""}`);
94084
94179
  });
94085
94180
  if (manifest !== void 0) {
94086
94181
  const targetPath = manifestPath(index, target.id);
94087
- await import_promises31.default.mkdir(import_node_path56.default.dirname(targetPath), { recursive: true });
94182
+ await import_promises31.default.mkdir(import_node_path57.default.dirname(targetPath), { recursive: true });
94088
94183
  await import_promises31.default.writeFile(targetPath, JSON.stringify(manifest), "utf8");
94089
94184
  }
94090
94185
  post({ type: "storeSync", running: false, copied: result.copied, fromLabel: source.label });
@@ -94133,7 +94228,7 @@ ${last}` : ""}`);
94133
94228
  type: "project",
94134
94229
  hasWorkspace: workspaceRoot !== void 0,
94135
94230
  ...configured !== void 0 ? { configured } : {},
94136
- ...workspaceRoot !== void 0 ? { folder: import_node_path56.default.basename(workspaceRoot) } : {},
94231
+ ...workspaceRoot !== void 0 ? { folder: import_node_path57.default.basename(workspaceRoot) } : {},
94137
94232
  ...author !== void 0 ? { author } : {},
94138
94233
  ...index !== void 0 ? { indexName: index } : {},
94139
94234
  ...ownerConfigured !== void 0 && ownerConfigured.length > 0 ? { ownerConfigured } : {},
@@ -94273,8 +94368,8 @@ ${last}` : ""}`);
94273
94368
  if (workspaceRoot === void 0)
94274
94369
  return found2;
94275
94370
  const root = workspaceRoot;
94276
- const relative = import_node_path56.default.relative(root, folder);
94277
- if (relative.startsWith("..") || import_node_path56.default.isAbsolute(relative))
94371
+ const relative = import_node_path57.default.relative(root, folder);
94372
+ if (relative.startsWith("..") || import_node_path57.default.isAbsolute(relative))
94278
94373
  return found2;
94279
94374
  const output = await new Promise((resolve) => {
94280
94375
  const child = (0, import_node_child_process19.spawn)("git", ["-c", "core.quotePath=false", "log", "--diff-filter=A", "--relative", "--format=@@%an", "--name-only", "--", relative.length > 0 ? relative : "."], {
@@ -94291,7 +94386,7 @@ ${last}` : ""}`);
94291
94386
  if (line.startsWith("@@"))
94292
94387
  author = line.slice(2).trim();
94293
94388
  else if (line.trim().length > 0 && author !== void 0 && author.length > 0) {
94294
- found2.set(normalizeForComparison(import_node_path56.default.resolve(root, line.trim())), author);
94389
+ found2.set(normalizeForComparison(import_node_path57.default.resolve(root, line.trim())), author);
94295
94390
  }
94296
94391
  }
94297
94392
  return found2;
@@ -94335,7 +94430,7 @@ ${last}` : ""}`);
94335
94430
  },
94336
94431
  source,
94337
94432
  folder,
94338
- relative: import_node_path56.default.relative(folder, filePath).split(import_node_path56.default.sep).join("/")
94433
+ relative: import_node_path57.default.relative(folder, filePath).split(import_node_path57.default.sep).join("/")
94339
94434
  });
94340
94435
  };
94341
94436
  for (const folder of skillFolders) {
@@ -94353,7 +94448,7 @@ ${last}` : ""}`);
94353
94448
  const name = entry.slice(0, -3);
94354
94449
  if (!isValidToolName(name))
94355
94450
  continue;
94356
- await consider("tool", name, import_node_path56.default.join(folder, entry), folder, location);
94451
+ await consider("tool", name, import_node_path57.default.join(folder, entry), folder, location);
94357
94452
  }
94358
94453
  }
94359
94454
  const readOnly = skills.filter((skill) => skill.sourceDir !== void 0 && !skillFolders.some((folder) => samePath(folder, skill.sourceDir))).length;
@@ -94385,7 +94480,7 @@ ${last}` : ""}`);
94385
94480
  } catch {
94386
94481
  }
94387
94482
  }
94388
- const gitAuthor = gitAuthors.get(normalizeForComparison(import_node_path56.default.resolve(candidate.entry.filePath)));
94483
+ const gitAuthor = gitAuthors.get(normalizeForComparison(import_node_path57.default.resolve(candidate.entry.filePath)));
94389
94484
  if (gitAuthor !== void 0) {
94390
94485
  candidate.entry.suggestion = { author: gitAuthor, source: "git: the commit that added this file" };
94391
94486
  }
@@ -94494,7 +94589,7 @@ ${last}` : ""}`);
94494
94589
  aliases: plan3.kind === "codebase" ? codebaseAliases(config2) : plan3.kind === "skills" ? skillAliases(config2) : [],
94495
94590
  onProgress: (count3) => post({ type: "indexRenames", running: true, plans, store, current: plan3.to, copied: count3 })
94496
94591
  });
94497
- await copyBookkeeping(import_node_path56.default.join(manifestsRoot, "index-manifests"), plan3.from, plan3.to, search.id);
94592
+ await copyBookkeeping(import_node_path57.default.join(manifestsRoot, "index-manifests"), plan3.from, plan3.to, search.id);
94498
94593
  done.push({ ...plan3, copied });
94499
94594
  }
94500
94595
  post({ type: "indexRenames", running: false, plans: [], store, done });
@@ -94524,7 +94619,7 @@ ${last}` : ""}`);
94524
94619
  project: projectName(config2, workspaceRoot),
94525
94620
  aliases: codebaseAliases(config2)
94526
94621
  });
94527
- await copyBookkeeping(import_node_path56.default.join(manifestsRoot, "index-manifests"), legacy, current, search.id);
94622
+ await copyBookkeeping(import_node_path57.default.join(manifestsRoot, "index-manifests"), legacy, current, search.id);
94528
94623
  post({ type: "indexRenames", running: false, plans: [], done: [{ kind: "codebase", from: legacy, to: current, copied }] });
94529
94624
  logger.info(`copied ${String(copied)} chunks from ${legacy} to ${current} rather than re-embedding them`);
94530
94625
  }
@@ -94690,7 +94785,7 @@ ${last}` : ""}`);
94690
94785
  denylist,
94691
94786
  manifest,
94692
94787
  saveManifest: async (next) => {
94693
- await import_promises31.default.mkdir(import_node_path56.default.dirname(manifestFile), { recursive: true });
94788
+ await import_promises31.default.mkdir(import_node_path57.default.dirname(manifestFile), { recursive: true });
94694
94789
  await import_promises31.default.writeFile(manifestFile, JSON.stringify(next), "utf8");
94695
94790
  },
94696
94791
  ...isIgnored2 !== void 0 ? { isIgnored: isIgnored2 } : {},
@@ -94776,9 +94871,9 @@ ${last}` : ""}`);
94776
94871
  }
94777
94872
  const usageLog = new UsageLog(storageDir);
94778
94873
  const usageInstance = usageInstanceId(storageDir);
94779
- const usageProfileFile = import_node_path56.default.join(storageDir, "usage-profile.json");
94780
- const legacyBackfillFile = import_node_path56.default.join(storageDir, "usage-backfill.json");
94781
- const usageDir = import_node_path56.default.join(storageDir, "usage");
94874
+ const usageProfileFile = import_node_path57.default.join(storageDir, "usage-profile.json");
94875
+ const legacyBackfillFile = import_node_path57.default.join(storageDir, "usage-backfill.json");
94876
+ const usageDir = import_node_path57.default.join(storageDir, "usage");
94782
94877
  const toolStartedAt = /* @__PURE__ */ new Map();
94783
94878
  let usagePushTimer;
94784
94879
  let usagePushing;
@@ -94796,7 +94891,7 @@ ${last}` : ""}`);
94796
94891
  return (request2) => runFastFs(exe, request2);
94797
94892
  }
94798
94893
  function skillAtPath(requested2) {
94799
- const absolute = import_node_path56.default.isAbsolute(requested2) ? requested2 : workspaceRoot === void 0 ? void 0 : import_node_path56.default.resolve(workspaceRoot, requested2);
94894
+ const absolute = import_node_path57.default.isAbsolute(requested2) ? requested2 : workspaceRoot === void 0 ? void 0 : import_node_path57.default.resolve(workspaceRoot, requested2);
94800
94895
  if (absolute === void 0)
94801
94896
  return void 0;
94802
94897
  return skills.find((skill) => samePath(skill.filePath, absolute));
@@ -94886,7 +94981,7 @@ ${last}` : ""}`);
94886
94981
  const folder = chosen.path?.trim();
94887
94982
  if (folder === void 0 || folder.length === 0)
94888
94983
  return { problem: "The shared folder has no path." };
94889
- if (!import_node_path56.default.isAbsolute(folder))
94984
+ if (!import_node_path57.default.isAbsolute(folder))
94890
94985
  return { problem: `"${folder}" is not an absolute path. Use the full path of a folder everybody can reach, such as a network share.` };
94891
94986
  const helper = usageHelper();
94892
94987
  return { store: new FolderShardStore(folder, ...helper !== void 0 ? [helper] : []), target };
@@ -94915,7 +95010,7 @@ ${last}` : ""}`);
94915
95010
  }
94916
95011
  async function readUsageBackfill() {
94917
95012
  try {
94918
- const text2 = await import_promises31.default.readFile(import_node_path56.default.join(usageDir, "backfill.json"), "utf8").catch(() => import_promises31.default.readFile(legacyBackfillFile, "utf8"));
95013
+ const text2 = await import_promises31.default.readFile(import_node_path57.default.join(usageDir, "backfill.json"), "utf8").catch(() => import_promises31.default.readFile(legacyBackfillFile, "utf8"));
94919
95014
  const saved = JSON.parse(text2);
94920
95015
  if (typeof saved.at !== "number")
94921
95016
  return void 0;
@@ -94931,7 +95026,7 @@ ${last}` : ""}`);
94931
95026
  legacyDoneFile: legacyBackfillFile,
94932
95027
  run: async (before) => {
94933
95028
  const status2 = python.status();
94934
- return backfillFromTasks(import_node_path56.default.join(storageDir, "tasks"), {
95029
+ return backfillFromTasks(import_node_path57.default.join(storageDir, "tasks"), {
94935
95030
  user: cachedAttribution.author ?? "unknown",
94936
95031
  project: cachedAttribution.project,
94937
95032
  workspaceRoot,
@@ -95029,7 +95124,7 @@ ${last}` : ""}`);
95029
95124
  try {
95030
95125
  const text2 = (await import_promises31.default.readFile(file2, "utf8")).replace(/\r\n/g, "\n");
95031
95126
  const meaningful = text2.split("\n").filter((line) => !/^(author|project|version|updated)\s*:/i.test(line) && !/^__(author|project|version|updated)__\s*=/.test(line)).join("\n").trim();
95032
- return (0, import_node_crypto20.createHash)("sha256").update(meaningful).digest("hex").slice(0, 16);
95127
+ return (0, import_node_crypto21.createHash)("sha256").update(meaningful).digest("hex").slice(0, 16);
95033
95128
  } catch {
95034
95129
  return void 0;
95035
95130
  }
@@ -95104,14 +95199,14 @@ ${last}` : ""}`);
95104
95199
  kind: "tool",
95105
95200
  name: issue2.name,
95106
95201
  filePath: issue2.filePath,
95107
- deletable: samePath(import_node_path56.default.dirname(issue2.filePath), status2.toolsDir),
95108
- location: where(import_node_path56.default.dirname(issue2.filePath), status2.toolsDir),
95202
+ deletable: samePath(import_node_path57.default.dirname(issue2.filePath), status2.toolsDir),
95203
+ location: where(import_node_path57.default.dirname(issue2.filePath), status2.toolsDir),
95109
95204
  issue: issue2.kind === "unapproved" ? "waiting for approval" : issue2.kind === "hash-mismatch" ? "changed since approval" : issue2.detail.split("\n")[0] ?? "not loaded"
95110
95205
  });
95111
95206
  }
95112
95207
  return items;
95113
95208
  }
95114
- const usageDirectoryFile = import_node_path56.default.join(storageDir, "usage-directory.json");
95209
+ const usageDirectoryFile = import_node_path57.default.join(storageDir, "usage-directory.json");
95115
95210
  let directoryRunning;
95116
95211
  async function readDirectoryCache() {
95117
95212
  try {
@@ -95446,7 +95541,7 @@ ${last}` : ""}`);
95446
95541
  let indexedFiles = 0;
95447
95542
  if (index !== void 0) {
95448
95543
  try {
95449
- const manifest = JSON.parse(await import_promises31.default.readFile(import_node_path56.default.join(manifestsRoot, "index-manifests", `${index}.json`), "utf8"));
95544
+ const manifest = JSON.parse(await import_promises31.default.readFile(import_node_path57.default.join(manifestsRoot, "index-manifests", `${index}.json`), "utf8"));
95450
95545
  indexedFiles = Object.keys(manifest.files ?? {}).length;
95451
95546
  } catch {
95452
95547
  }
@@ -95722,7 +95817,7 @@ ${last}` : ""}`);
95722
95817
  return;
95723
95818
  }
95724
95819
  const { config: config2 } = await configManager.load();
95725
- const id = input.id ?? (0, import_node_crypto20.randomUUID)();
95820
+ const id = input.id ?? (0, import_node_crypto21.randomUUID)();
95726
95821
  if (input.username !== void 0 && input.username.length > 0)
95727
95822
  await secrets.set(searchUserRefFor(id), input.username);
95728
95823
  if (input.password !== void 0 && input.password.length > 0)
@@ -95926,11 +96021,11 @@ ${last}` : ""}`);
95926
96021
  answer({ error: bytes.length === 0 ? "There was nothing to save." : "That file is too large to save from here." });
95927
96022
  return;
95928
96023
  }
95929
- const safeName = [...import_node_path56.default.basename(name)].map((c2) => c2.charCodeAt(0) < 32 || '<>:"/\\|?*'.includes(c2) ? "-" : c2).join("") || "file";
95930
- const extension = import_node_path56.default.extname(safeName).slice(1);
96024
+ const safeName = [...import_node_path57.default.basename(name)].map((c2) => c2.charCodeAt(0) < 32 || '<>:"/\\|?*'.includes(c2) ? "-" : c2).join("") || "file";
96025
+ const extension = import_node_path57.default.extname(safeName).slice(1);
95931
96026
  try {
95932
96027
  const target = await ui.showSaveDialog({
95933
- defaultName: workspaceRoot !== void 0 ? import_node_path56.default.join(workspaceRoot, safeName) : safeName,
96028
+ defaultName: workspaceRoot !== void 0 ? import_node_path57.default.join(workspaceRoot, safeName) : safeName,
95934
96029
  ...extension.length > 0 ? { extensions: [extension] } : {}
95935
96030
  });
95936
96031
  if (target === void 0) {
@@ -96011,8 +96106,8 @@ ${last}` : ""}`);
96011
96106
  continue;
96012
96107
  for (const key3 of section.keys)
96013
96108
  patch[key3] = key3 === "profiles" && merged.profiles !== void 0 ? reconciled : merged[key3];
96014
- for (const path67 of section.nested ?? []) {
96015
- const head = path67.split(".")[0];
96109
+ for (const path68 of section.nested ?? []) {
96110
+ const head = path68.split(".")[0];
96016
96111
  patch[head] = merged[head];
96017
96112
  }
96018
96113
  }
@@ -96056,7 +96151,7 @@ ${last}` : ""}`);
96056
96151
  if (changeLedger !== void 0) {
96057
96152
  const shared = await changeLedger.othersSince(targets, taskCheckpoint.createdAt);
96058
96153
  if (shared.size > 0) {
96059
- const shown2 = (file2) => import_node_path56.default.relative(workspaceRoot ?? "", file2).split(import_node_path56.default.sep).join("/");
96154
+ const shown2 = (file2) => import_node_path57.default.relative(workspaceRoot ?? "", file2).split(import_node_path57.default.sep).join("/");
96060
96155
  const detail = [...shared].map(([file2, chats]) => `${shown2(file2)} (${chats.join(", ")})`).join("; ");
96061
96156
  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");
96062
96157
  if (!all) {
@@ -96346,7 +96441,7 @@ ${notes.join("\n")}` } : answer;
96346
96441
  const pathRequest = pendingPathApprovals.get(id);
96347
96442
  userGate.resolve(id, "approve");
96348
96443
  if (pathRequest !== void 0) {
96349
- const folder = import_node_path56.default.dirname(pathRequest);
96444
+ const folder = import_node_path57.default.dirname(pathRequest);
96350
96445
  sessionPathGrants.add(normalizeForComparison(pathRequest));
96351
96446
  if (scope === "folder" && !cachedReadRoots.includes(folder)) {
96352
96447
  const { config: config2 } = await configManager.load();
@@ -96586,10 +96681,10 @@ ${notes.join("\n")}` } : answer;
96586
96681
  });
96587
96682
  return;
96588
96683
  }
96589
- let dir = import_node_path56.default.dirname(import_node_path56.default.resolve(scriptPath));
96684
+ let dir = import_node_path57.default.dirname(import_node_path57.default.resolve(scriptPath));
96590
96685
  for (let depth = 0; depth < 3; depth++) {
96591
96686
  for (const name of VENV_DIR_NAMES) {
96592
- const candidate = import_node_path56.default.join(dir, name);
96687
+ const candidate = import_node_path57.default.join(dir, name);
96593
96688
  const found2 = await search(candidate);
96594
96689
  if (found2 !== void 0) {
96595
96690
  post({
@@ -96601,7 +96696,7 @@ ${notes.join("\n")}` } : answer;
96601
96696
  return;
96602
96697
  }
96603
96698
  }
96604
- const parent = import_node_path56.default.dirname(dir);
96699
+ const parent = import_node_path57.default.dirname(dir);
96605
96700
  if (parent === dir)
96606
96701
  break;
96607
96702
  dir = parent;
@@ -97547,11 +97642,11 @@ ${entry.content}`);
97547
97642
  let lastReportPath;
97548
97643
  async function saveReport(title, contents) {
97549
97644
  try {
97550
- const directory = import_node_path56.default.join(storageDir, "reports");
97645
+ const directory = import_node_path57.default.join(storageDir, "reports");
97551
97646
  await import_promises31.default.mkdir(directory, { recursive: true });
97552
97647
  const stamp2 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
97553
97648
  const slug = title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60);
97554
- const target = import_node_path56.default.join(directory, `${stamp2}${slug.length > 0 ? `-${slug}` : ""}.md`);
97649
+ const target = import_node_path57.default.join(directory, `${stamp2}${slug.length > 0 ? `-${slug}` : ""}.md`);
97555
97650
  await import_promises31.default.writeFile(target, `# ${title}
97556
97651
 
97557
97652
  ${contents}
@@ -97567,7 +97662,7 @@ ${contents}
97567
97662
  const keep = 100;
97568
97663
  const entries = (await import_promises31.default.readdir(directory)).filter((name) => name.endsWith(".md")).sort();
97569
97664
  for (const name of entries.slice(0, Math.max(0, entries.length - keep))) {
97570
- await import_promises31.default.rm(import_node_path56.default.join(directory, name), { force: true });
97665
+ await import_promises31.default.rm(import_node_path57.default.join(directory, name), { force: true });
97571
97666
  }
97572
97667
  }
97573
97668
  let scheduleTimer;
@@ -97640,7 +97735,7 @@ ${contents}
97640
97735
  async function handleSaveSchedule(schedule) {
97641
97736
  try {
97642
97737
  const schedules = await loadSchedules();
97643
- const id = schedule.id.length > 0 ? schedule.id : (0, import_node_crypto20.createHash)("sha256").update(`${schedule.name}:${String(Date.now())}`).digest("hex").slice(0, 12);
97738
+ const id = schedule.id.length > 0 ? schedule.id : (0, import_node_crypto21.createHash)("sha256").update(`${schedule.name}:${String(Date.now())}`).digest("hex").slice(0, 12);
97644
97739
  const armed = { ...schedule, id, nextRunAt: nextFireTime(schedule, Date.now()) };
97645
97740
  await saveSchedules({ ...schedules, [id]: armed });
97646
97741
  } catch (error51) {
@@ -97649,7 +97744,7 @@ ${contents}
97649
97744
  }
97650
97745
  async function createScheduleFromProposal(proposal) {
97651
97746
  const schedules = await loadSchedules();
97652
- const id = (0, import_node_crypto20.createHash)("sha256").update(`${proposal.name}:${String(Date.now())}`).digest("hex").slice(0, 12);
97747
+ const id = (0, import_node_crypto21.createHash)("sha256").update(`${proposal.name}:${String(Date.now())}`).digest("hex").slice(0, 12);
97653
97748
  const schedule = {
97654
97749
  id,
97655
97750
  name: proposal.name,
@@ -97680,10 +97775,10 @@ ${contents}
97680
97775
  }
97681
97776
  const CLAIM_STALE_MS = 60 * 60 * 1e3;
97682
97777
  async function claimSchedule(id) {
97683
- const claimPath = import_node_path56.default.join(storageDir, "schedule-claims", `${id}.json`);
97778
+ const claimPath = import_node_path57.default.join(storageDir, "schedule-claims", `${id}.json`);
97684
97779
  const mine = JSON.stringify({ pid: process.pid, at: Date.now() });
97685
97780
  try {
97686
- await import_promises31.default.mkdir(import_node_path56.default.dirname(claimPath), { recursive: true });
97781
+ await import_promises31.default.mkdir(import_node_path57.default.dirname(claimPath), { recursive: true });
97687
97782
  await import_promises31.default.writeFile(claimPath, mine, { encoding: "utf8", flag: "wx" });
97688
97783
  return true;
97689
97784
  } catch (error51) {
@@ -97708,7 +97803,7 @@ ${contents}
97708
97803
  }
97709
97804
  }
97710
97805
  async function releaseSchedule(id) {
97711
- await import_promises31.default.rm(import_node_path56.default.join(storageDir, "schedule-claims", `${id}.json`), { force: true }).catch(() => void 0);
97806
+ await import_promises31.default.rm(import_node_path57.default.join(storageDir, "schedule-claims", `${id}.json`), { force: true }).catch(() => void 0);
97712
97807
  }
97713
97808
  async function runSchedule(id, reason) {
97714
97809
  if (reason === "due" && !await claimSchedule(id))
@@ -98403,11 +98498,11 @@ function createShowDiagramTool() {
98403
98498
 
98404
98499
  // ../../packages/core/dist/lsp/manager.js
98405
98500
  var import_promises32 = __toESM(require("node:fs/promises"), 1);
98406
- var import_node_path58 = __toESM(require("node:path"), 1);
98501
+ var import_node_path59 = __toESM(require("node:path"), 1);
98407
98502
 
98408
98503
  // ../../packages/core/dist/lsp/catalog.js
98409
- var import_node_fs15 = require("node:fs");
98410
- var import_node_path57 = __toESM(require("node:path"), 1);
98504
+ var import_node_fs16 = require("node:fs");
98505
+ var import_node_path58 = __toESM(require("node:path"), 1);
98411
98506
  var c = (command, ...args) => ({ command, args });
98412
98507
  var LSP_LANGUAGES = [
98413
98508
  { id: "python", label: "Python", extensions: ["py", "pyi"], candidates: [c("pyright-langserver", "--stdio"), c("basedpyright-langserver", "--stdio"), c("pylsp"), c("jedi-language-server")] },
@@ -98455,17 +98550,17 @@ var LSP_LANGUAGES = [
98455
98550
  { id: "sql", label: "SQL", extensions: ["sql"], candidates: [c("sql-language-server", "up", "--method", "stdio")] }
98456
98551
  ];
98457
98552
  function languageFor(file2) {
98458
- const ext = import_node_path57.default.extname(file2).slice(1).toLowerCase();
98553
+ const ext = import_node_path58.default.extname(file2).slice(1).toLowerCase();
98459
98554
  return LSP_LANGUAGES.find((l) => l.extensions.includes(ext));
98460
98555
  }
98461
98556
  function languageIdFor(language, file2) {
98462
- const ext = import_node_path57.default.extname(file2).slice(1).toLowerCase();
98557
+ const ext = import_node_path58.default.extname(file2).slice(1).toLowerCase();
98463
98558
  return language.languageIdFor?.(ext) ?? language.id;
98464
98559
  }
98465
98560
  var found = /* @__PURE__ */ new Map();
98466
98561
  function findOnPath(command, env2 = process.env) {
98467
- if (import_node_path57.default.isAbsolute(command))
98468
- return (0, import_node_fs15.existsSync)(command) ? command : void 0;
98562
+ if (import_node_path58.default.isAbsolute(command))
98563
+ return (0, import_node_fs16.existsSync)(command) ? command : void 0;
98469
98564
  if (env2 !== process.env)
98470
98565
  return searchPath(command, env2);
98471
98566
  const hit = found.get(command);
@@ -98476,12 +98571,12 @@ function findOnPath(command, env2 = process.env) {
98476
98571
  return value;
98477
98572
  }
98478
98573
  function searchPath(command, env2) {
98479
- const dirs = (env2.PATH ?? env2.Path ?? "").split(import_node_path57.default.delimiter).filter((d) => d.length > 0);
98574
+ const dirs = (env2.PATH ?? env2.Path ?? "").split(import_node_path58.default.delimiter).filter((d) => d.length > 0);
98480
98575
  const exts = process.platform === "win32" ? ["", ...(env2.PATHEXT ?? ".EXE;.CMD;.BAT").toLowerCase().split(";")] : [""];
98481
98576
  for (const dir of dirs) {
98482
98577
  for (const ext of exts) {
98483
- const candidate = import_node_path57.default.join(dir, command + ext);
98484
- if ((0, import_node_fs15.existsSync)(candidate) && (process.platform !== "win32" || ext !== "" || /\.(exe|cmd|bat)$/i.test(candidate)))
98578
+ const candidate = import_node_path58.default.join(dir, command + ext);
98579
+ if ((0, import_node_fs16.existsSync)(candidate) && (process.platform !== "win32" || ext !== "" || /\.(exe|cmd|bat)$/i.test(candidate)))
98485
98580
  return candidate;
98486
98581
  }
98487
98582
  }
@@ -98713,7 +98808,7 @@ var LspManager = class {
98713
98808
  return void 0;
98714
98809
  const args = [...found2.candidate.args];
98715
98810
  if (language.id === "java" && !args.includes("-data"))
98716
- args.push("-data", import_node_path58.default.join(this.storageDir, "jdtls-workspace"));
98811
+ args.push("-data", import_node_path59.default.join(this.storageDir, "jdtls-workspace"));
98717
98812
  try {
98718
98813
  client = new LspClient(found2.executable, args, this.root, this.log);
98719
98814
  this.clients.set(language.id, client);
@@ -98734,7 +98829,7 @@ var LspManager = class {
98734
98829
  this.failed.set(language.id, client.lastError ?? "stopped");
98735
98830
  return void 0;
98736
98831
  }
98737
- return { server: import_node_path58.default.basename(client.executable).replace(/\.(exe|cmd|bat)$/i, ""), diagnostics: diagnostics ?? [] };
98832
+ return { server: import_node_path59.default.basename(client.executable).replace(/\.(exe|cmd|bat)$/i, ""), diagnostics: diagnostics ?? [] };
98738
98833
  } catch (error51) {
98739
98834
  this.failed.set(language.id, error51 instanceof Error ? error51.message : String(error51));
98740
98835
  client.dispose();
@@ -102283,6 +102378,12 @@ morning, by which time a toast is long gone. The run log keeps a Report button.
102283
102378
  "parallel",
102284
102379
  "parallel box",
102285
102380
  "contract",
102381
+ "strategy per chat",
102382
+ "different strategy",
102383
+ "strategy lost",
102384
+ "keep the strategy",
102385
+ "new topic",
102386
+ "strategy after restart",
102286
102387
  "connect a box",
102287
102388
  "box to an agent",
102288
102389
  "group of agents",
@@ -102356,6 +102457,14 @@ once. If several of them need your approval at once, the prompts come one at a t
102356
102457
  connectors between them, else as drawn. A box of either kind can be switched on the right ("Run at the same time" or
102357
102458
  "Run as a group").
102358
102459
 
102460
+ **A strategy belongs to its chat.** Each chat keeps its own strategy, or none: choosing one with **Save and use in
102461
+ this chat** sets it for that chat only, and a new chat starts with none until you pick one. It is saved with the chat
102462
+ and comes back whenever the chat does - reopened from History, after the window reloads, when a Fire Code chat wakes
102463
+ from sleep or restarts after a crash - and it is kept even if you chose it before sending anything. **New chat with a
102464
+ handoff** carries it into the new chat. **Stop using** in the Strategy window takes it off the chat. Every request in
102465
+ the chat follows it, not only the first: for a new topic the agent proposes a new plan that goes through the strategy
102466
+ again, and the back-and-forth loops start afresh for it, with their full number of rounds.
102467
+
102359
102468
  **Connecting a box.** A box is one step of the flow: connect it like a step, from its own dot on the right edge or with
102360
102469
  **Connect to...** when it is selected, to a step or to another box - and connect a step or a box into it. A connector
102361
102470
  out of a box is followed only once every step inside has answered; a connector into a box gives every step inside what
@@ -103364,7 +103473,7 @@ function createLightCodeHelpTool() {
103364
103473
 
103365
103474
  // ../../packages/core/dist/tools/listFiles.js
103366
103475
  var import_node_child_process21 = require("node:child_process");
103367
- var import_node_path59 = __toESM(require("node:path"), 1);
103476
+ var import_node_path60 = __toESM(require("node:path"), 1);
103368
103477
 
103369
103478
  // ../../packages/core/dist/tools/ripgrepError.js
103370
103479
  function ripgrepDidNotStart(error51) {
@@ -103445,7 +103554,7 @@ var listFilesTool = {
103445
103554
  });
103446
103555
  if (files.length === 0)
103447
103556
  return noFiles;
103448
- const listed = files.map((file2) => file2.split("/").join(import_node_path59.default.sep)).join("\n");
103557
+ const listed = files.map((file2) => file2.split("/").join(import_node_path60.default.sep)).join("\n");
103449
103558
  return { content: truncated ? `${listed}
103450
103559
  (listing cut short \u2014 list a narrower folder)` : listed };
103451
103560
  }
@@ -103513,10 +103622,10 @@ function readSmall(raw, params3) {
103513
103622
  const end = params3.limit !== void 0 ? start + params3.limit : lines2.length;
103514
103623
  return number4(lines2.slice(start, end), start + 1);
103515
103624
  }
103516
- async function readLarge(fs47, realPath, params3, size) {
103625
+ async function readLarge(fs48, realPath, params3, size) {
103517
103626
  const human = formatBytes(size);
103518
103627
  if (params3.tail !== void 0) {
103519
- const part = await readTail(fs47, realPath, size, params3.tail);
103628
+ const part = await readTail(fs48, realPath, size, params3.tail);
103520
103629
  return [
103521
103630
  `${human} file \u2014 last ${String(part.lines.length)} lines.`,
103522
103631
  /*
@@ -103531,7 +103640,7 @@ async function readLarge(fs47, realPath, params3, size) {
103531
103640
  }
103532
103641
  if (params3.offset !== void 0) {
103533
103642
  const limit = params3.limit ?? DEFAULT_LARGE_LIMIT;
103534
- const part = await readLineWindow(fs47, realPath, size, params3.offset, limit);
103643
+ const part = await readLineWindow(fs48, realPath, size, params3.offset, limit);
103535
103644
  const shown2 = part.lines.length;
103536
103645
  return [
103537
103646
  `${human} file \u2014 lines ${String(params3.offset)}\u2013${String(params3.offset + shown2 - 1)}${part.hasMoreAfter ? ", more follows" : " (end of file)"}.`,
@@ -103539,7 +103648,7 @@ async function readLarge(fs47, realPath, params3, size) {
103539
103648
  number4(part.lines, params3.offset)
103540
103649
  ].join("\n");
103541
103650
  }
103542
- const total = await countLines(fs47, realPath, size);
103651
+ const total = await countLines(fs48, realPath, size);
103543
103652
  return [
103544
103653
  `${realPathName(realPath)} is ${human} (${total.toLocaleString()} lines) \u2014 too large to read at once.`,
103545
103654
  "",
@@ -103674,7 +103783,7 @@ var searchFilesTool = {
103674
103783
  };
103675
103784
 
103676
103785
  // ../../packages/core/dist/tools/writeToFile.js
103677
- var import_node_path60 = __toESM(require("node:path"), 1);
103786
+ var import_node_path61 = __toESM(require("node:path"), 1);
103678
103787
  var paramsSchema23 = external_exports.object({
103679
103788
  path: external_exports.string().min(1).describe("Path to the file, relative to the workspace root."),
103680
103789
  content: external_exports.string().describe("Full file content to write.")
@@ -103702,7 +103811,7 @@ var writeToFileTool = {
103702
103811
  return { content: changed, isError: true, path: params3.path };
103703
103812
  }
103704
103813
  if (!exists2) {
103705
- await context.fs.mkdir(import_node_path60.default.dirname(resolved.realPath));
103814
+ await context.fs.mkdir(import_node_path61.default.dirname(resolved.realPath));
103706
103815
  }
103707
103816
  await context.fs.writeFile(resolved.realPath, params3.content);
103708
103817
  await recordWrite(context, resolved.realPath);
@@ -103804,14 +103913,14 @@ function createDefaultToolRegistry() {
103804
103913
 
103805
103914
  // ../../packages/core/dist/dataset/store.js
103806
103915
  var import_promises33 = __toESM(require("node:fs/promises"), 1);
103807
- var import_node_path61 = __toESM(require("node:path"), 1);
103916
+ var import_node_path62 = __toESM(require("node:path"), 1);
103808
103917
  var DatasetStore = class {
103809
103918
  filePath;
103810
103919
  statePath;
103811
103920
  constructor(storageDir, datasetId) {
103812
103921
  const safe = datasetId.replace(/[^A-Za-z0-9._-]/g, "_");
103813
- this.filePath = import_node_path61.default.join(storageDir, "datasets", `${safe}.jsonl`);
103814
- this.statePath = import_node_path61.default.join(storageDir, "datasets", `${safe}.state.json`);
103922
+ this.filePath = import_node_path62.default.join(storageDir, "datasets", `${safe}.jsonl`);
103923
+ this.statePath = import_node_path62.default.join(storageDir, "datasets", `${safe}.state.json`);
103815
103924
  }
103816
103925
  /** Every record. A malformed line is skipped — one bad line costs one record, not the corpus. */
103817
103926
  async load() {
@@ -103839,7 +103948,7 @@ var DatasetStore = class {
103839
103948
  async append(records) {
103840
103949
  if (records.length === 0)
103841
103950
  return;
103842
- await import_promises33.default.mkdir(import_node_path61.default.dirname(this.filePath), { recursive: true });
103951
+ await import_promises33.default.mkdir(import_node_path62.default.dirname(this.filePath), { recursive: true });
103843
103952
  await import_promises33.default.writeFile(this.filePath, "", { flag: "a" });
103844
103953
  const lines2 = records.map((record2) => JSON.stringify(record2)).join("\n");
103845
103954
  await import_promises33.default.appendFile(this.filePath, `${lines2}
@@ -103847,7 +103956,7 @@ var DatasetStore = class {
103847
103956
  }
103848
103957
  /** Rewrites with exactly these. Temp-and-rename, so an interrupted prune leaves the old file. */
103849
103958
  async replace(records) {
103850
- await import_promises33.default.mkdir(import_node_path61.default.dirname(this.filePath), { recursive: true });
103959
+ await import_promises33.default.mkdir(import_node_path62.default.dirname(this.filePath), { recursive: true });
103851
103960
  const temporary = `${this.filePath}.tmp`;
103852
103961
  const body = records.map((record2) => JSON.stringify(record2)).join("\n");
103853
103962
  await import_promises33.default.writeFile(temporary, records.length === 0 ? "" : `${body}
@@ -103901,7 +104010,7 @@ var DatasetStore = class {
103901
104010
  }
103902
104011
  }
103903
104012
  async recordSync(at) {
103904
- await import_promises33.default.mkdir(import_node_path61.default.dirname(this.statePath), { recursive: true });
104013
+ await import_promises33.default.mkdir(import_node_path62.default.dirname(this.statePath), { recursive: true });
103905
104014
  const temporary = `${this.statePath}.tmp`;
103906
104015
  await import_promises33.default.writeFile(temporary, JSON.stringify({ lastSyncedAt: at }), "utf8");
103907
104016
  await replaceFile(temporary, this.statePath);
@@ -104240,8 +104349,8 @@ That is a fault in the tool itself, or the source is unreachable from here. Fix
104240
104349
  }
104241
104350
 
104242
104351
  // ../../packages/core/dist/s3/sigv4.js
104243
- var import_node_crypto21 = require("node:crypto");
104244
- var EMPTY_PAYLOAD_SHA256 = (0, import_node_crypto21.createHash)("sha256").update("").digest("hex");
104352
+ var import_node_crypto22 = require("node:crypto");
104353
+ var EMPTY_PAYLOAD_SHA256 = (0, import_node_crypto22.createHash)("sha256").update("").digest("hex");
104245
104354
  function encodeSegment(segment) {
104246
104355
  return encodeURIComponent(segment).replace(/[!'()*]/g, (character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`);
104247
104356
  }
@@ -104265,10 +104374,10 @@ function amzDate(now) {
104265
104374
  return `${now.toISOString().replace(/[-:]/g, "").slice(0, 15)}Z`;
104266
104375
  }
104267
104376
  function signingKey(secretAccessKey, date5, region, service) {
104268
- const dateKey = (0, import_node_crypto21.createHmac)("sha256", `AWS4${secretAccessKey}`).update(date5).digest();
104269
- const regionKey = (0, import_node_crypto21.createHmac)("sha256", dateKey).update(region).digest();
104270
- const serviceKey = (0, import_node_crypto21.createHmac)("sha256", regionKey).update(service).digest();
104271
- return (0, import_node_crypto21.createHmac)("sha256", serviceKey).update("aws4_request").digest();
104377
+ const dateKey = (0, import_node_crypto22.createHmac)("sha256", `AWS4${secretAccessKey}`).update(date5).digest();
104378
+ const regionKey = (0, import_node_crypto22.createHmac)("sha256", dateKey).update(region).digest();
104379
+ const serviceKey = (0, import_node_crypto22.createHmac)("sha256", regionKey).update(service).digest();
104380
+ return (0, import_node_crypto22.createHmac)("sha256", serviceKey).update("aws4_request").digest();
104272
104381
  }
104273
104382
  function signRequest(input) {
104274
104383
  const service = input.service ?? "s3";
@@ -104277,7 +104386,7 @@ function signRequest(input) {
104277
104386
  const date5 = timestamp.slice(0, 8);
104278
104387
  const url2 = new URL(input.url);
104279
104388
  const body = input.body ?? Buffer.alloc(0);
104280
- const payloadHash = (0, import_node_crypto21.createHash)("sha256").update(body).digest("hex");
104389
+ const payloadHash = (0, import_node_crypto22.createHash)("sha256").update(body).digest("hex");
104281
104390
  const headers = {
104282
104391
  ...input.headers,
104283
104392
  host: url2.host,
@@ -104301,9 +104410,9 @@ function signRequest(input) {
104301
104410
  "AWS4-HMAC-SHA256",
104302
104411
  timestamp,
104303
104412
  scope,
104304
- (0, import_node_crypto21.createHash)("sha256").update(canonicalRequest).digest("hex")
104413
+ (0, import_node_crypto22.createHash)("sha256").update(canonicalRequest).digest("hex")
104305
104414
  ].join("\n");
104306
- const signature = (0, import_node_crypto21.createHmac)("sha256", signingKey(input.secretAccessKey, date5, input.region, service)).update(stringToSign).digest("hex");
104415
+ const signature = (0, import_node_crypto22.createHmac)("sha256", signingKey(input.secretAccessKey, date5, input.region, service)).update(stringToSign).digest("hex");
104307
104416
  return {
104308
104417
  headers: {
104309
104418
  ...headers,
@@ -104333,8 +104442,8 @@ var S3Client = class {
104333
104442
  const host = inPath ? origin.host : `${bucket}.${origin.host}`;
104334
104443
  const mount = origin.pathname === "/" ? "" : origin.pathname.replace(/\/+$/, "");
104335
104444
  const prefix = inPath ? `${mount}/${bucket}` : mount;
104336
- const path67 = key3 === "" ? "" : `/${key3.split("/").map((part) => encodeURIComponent(part)).join("/")}`;
104337
- const url2 = new URL(`${origin.protocol}//${host}${prefix}${path67}`);
104445
+ const path68 = key3 === "" ? "" : `/${key3.split("/").map((part) => encodeURIComponent(part)).join("/")}`;
104446
+ const url2 = new URL(`${origin.protocol}//${host}${prefix}${path68}`);
104338
104447
  for (const [name, value] of Object.entries(call.query ?? {}))
104339
104448
  url2.searchParams.set(name, value);
104340
104449
  return url2.toString();
@@ -104601,9 +104710,9 @@ async function syncFromS3(options) {
104601
104710
  return result;
104602
104711
  }
104603
104712
  var MANIFEST_NAME = ".lightcode-sync.json";
104604
- async function readManifest(fs47, manifestPath) {
104713
+ async function readManifest(fs48, manifestPath) {
104605
104714
  try {
104606
- const parsed = JSON.parse((await fs47.readBytes(manifestPath)).toString("utf8"));
104715
+ const parsed = JSON.parse((await fs48.readBytes(manifestPath)).toString("utf8"));
104607
104716
  return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? parsed : {};
104608
104717
  } catch {
104609
104718
  return {};
@@ -104621,14 +104730,14 @@ function join2(dir, relative) {
104621
104730
  const left = dir.replace(/[\\/]+$/, "");
104622
104731
  return `${left}/${relative}`;
104623
104732
  }
104624
- async function writeWhole3(fs47, target, bytes) {
104625
- if (fs47.rename === void 0) {
104626
- await fs47.writeBytes(target, bytes);
104733
+ async function writeWhole3(fs48, target, bytes) {
104734
+ if (fs48.rename === void 0) {
104735
+ await fs48.writeBytes(target, bytes);
104627
104736
  return;
104628
104737
  }
104629
104738
  const temporary = `${target}.${String(process.pid)}.${String(Date.now())}.part`;
104630
- await fs47.writeBytes(temporary, bytes);
104631
- await fs47.rename(temporary, target);
104739
+ await fs48.writeBytes(temporary, bytes);
104740
+ await fs48.rename(temporary, target);
104632
104741
  }
104633
104742
  function dirname(filePath) {
104634
104743
  const cut = filePath.lastIndexOf("/");
@@ -104824,15 +104933,15 @@ function createS3Tools(targets) {
104824
104933
  }
104825
104934
 
104826
104935
  // ../../packages/core/dist/s3/localFolder.js
104827
- var import_node_crypto22 = require("node:crypto");
104936
+ var import_node_crypto23 = require("node:crypto");
104828
104937
  function mirrorFolder(options) {
104829
104938
  const connection = safeSegment(options.connectionId);
104830
- const digest = (0, import_node_crypto22.createHash)("sha256").update((options.prefix ?? "").trim().toLowerCase()).digest("hex").slice(0, 8);
104939
+ const digest = (0, import_node_crypto23.createHash)("sha256").update((options.prefix ?? "").trim().toLowerCase()).digest("hex").slice(0, 8);
104831
104940
  return join3(options.storageDir, "s3", connection, `${options.kind}-${digest}`);
104832
104941
  }
104833
104942
  function safeSegment(id) {
104834
104943
  const cleaned = id.replace(/[^a-zA-Z0-9._-]/g, "-").replace(/-+/g, "-").replace(/^[-.]+|[-.]+$/g, "").slice(0, 40);
104835
- const suffix = (0, import_node_crypto22.createHash)("sha256").update(id).digest("hex").slice(0, 6);
104944
+ const suffix = (0, import_node_crypto23.createHash)("sha256").update(id).digest("hex").slice(0, 6);
104836
104945
  return `${cleaned === "" ? "connection" : cleaned}-${suffix}`;
104837
104946
  }
104838
104947
  function join3(...parts) {
@@ -104949,13 +105058,13 @@ function reachableOrigins(hosts, extra = []) {
104949
105058
  }
104950
105059
 
104951
105060
  // src/identity.ts
104952
- var import_node_crypto23 = __toESM(require("node:crypto"), 1);
105061
+ var import_node_crypto24 = __toESM(require("node:crypto"), 1);
104953
105062
  var SingleUserIdentity = class _SingleUserIdentity {
104954
105063
  describe;
104955
105064
  static PRINCIPAL = { id: "local", displayName: "Local user" };
104956
105065
  principal;
104957
105066
  /** Long-lived, minted per server run, only ever sent in an `Authorization` header. */
104958
- sessionToken = import_node_crypto23.default.randomBytes(32).toString("base64url");
105067
+ sessionToken = import_node_crypto24.default.randomBytes(32).toString("base64url");
104959
105068
  /**
104960
105069
  * Single-use and short-lived, because it travels in the launch URL's fragment where it
104961
105070
  * can end up in shell history or a terminal scrollback (§14).
@@ -104965,7 +105074,7 @@ var SingleUserIdentity = class _SingleUserIdentity {
104965
105074
  * raises it, and what that costs is stated where it is set: a longer window is a longer time in
104966
105075
  * which somebody reading that scrollback can use it before you do.
104967
105076
  */
104968
- handoffToken = import_node_crypto23.default.randomBytes(32).toString("base64url");
105077
+ handoffToken = import_node_crypto24.default.randomBytes(32).toString("base64url");
104969
105078
  handoffExpiresAt;
104970
105079
  handoffSeconds;
104971
105080
  /**
@@ -104999,7 +105108,7 @@ var SingleUserIdentity = class _SingleUserIdentity {
104999
105108
  * which is the same person it was printed to in the first place.
105000
105109
  */
105001
105110
  remintHandoff() {
105002
- this.handoffToken = import_node_crypto23.default.randomBytes(32).toString("base64url");
105111
+ this.handoffToken = import_node_crypto24.default.randomBytes(32).toString("base64url");
105003
105112
  this.handoffExpiresAt = Date.now() + this.handoffSeconds * 1e3;
105004
105113
  return this.handoffToken;
105005
105114
  }
@@ -105038,10 +105147,10 @@ function timingSafeEquals(a, b) {
105038
105147
  const left = Buffer.from(a);
105039
105148
  const right = Buffer.from(b);
105040
105149
  if (left.length !== right.length) return false;
105041
- return import_node_crypto23.default.timingSafeEqual(left, right);
105150
+ return import_node_crypto24.default.timingSafeEqual(left, right);
105042
105151
  }
105043
105152
  function storageKeyFor(principal) {
105044
- return import_node_crypto23.default.createHash("sha256").update(principal.id).digest("hex").slice(0, 32);
105153
+ return import_node_crypto24.default.createHash("sha256").update(principal.id).digest("hex").slice(0, 32);
105045
105154
  }
105046
105155
  var OpenIdentity = class _OpenIdentity {
105047
105156
  describe = "single user, no token (--no-token)";
@@ -105312,22 +105421,22 @@ async function readJsonBody(request2, maxBytes = 32 * 1024 * 1024) {
105312
105421
 
105313
105422
  // src/fileSecretStore.ts
105314
105423
  var import_promises34 = __toESM(require("node:fs/promises"), 1);
105315
- var import_node_path62 = __toESM(require("node:path"), 1);
105424
+ var import_node_path63 = __toESM(require("node:path"), 1);
105316
105425
 
105317
105426
  // src/vaultCrypto.ts
105318
- var import_node_crypto24 = require("node:crypto");
105427
+ var import_node_crypto25 = require("node:crypto");
105319
105428
  function isVaultEnvelope(value) {
105320
105429
  const v = value;
105321
105430
  return typeof v === "object" && v !== null && v.sunVault === 1 && typeof v.iv === "string" && typeof v.tag === "string" && typeof v.data === "string";
105322
105431
  }
105323
105432
  function sealSecrets(secrets, key3) {
105324
- const iv = (0, import_node_crypto24.randomBytes)(12);
105325
- const cipher = (0, import_node_crypto24.createCipheriv)("aes-256-gcm", key3, iv);
105433
+ const iv = (0, import_node_crypto25.randomBytes)(12);
105434
+ const cipher = (0, import_node_crypto25.createCipheriv)("aes-256-gcm", key3, iv);
105326
105435
  const data = Buffer.concat([cipher.update(JSON.stringify(secrets), "utf8"), cipher.final()]);
105327
105436
  return { sunVault: 1, iv: iv.toString("base64"), tag: cipher.getAuthTag().toString("base64"), data: data.toString("base64") };
105328
105437
  }
105329
105438
  function openSecrets(envelope, key3) {
105330
- const decipher = (0, import_node_crypto24.createDecipheriv)("aes-256-gcm", key3, Buffer.from(envelope.iv, "base64"));
105439
+ const decipher = (0, import_node_crypto25.createDecipheriv)("aes-256-gcm", key3, Buffer.from(envelope.iv, "base64"));
105331
105440
  decipher.setAuthTag(Buffer.from(envelope.tag, "base64"));
105332
105441
  const plain = Buffer.concat([decipher.update(Buffer.from(envelope.data, "base64")), decipher.final()]);
105333
105442
  const parsed = JSON.parse(plain.toString("utf8"));
@@ -105410,7 +105519,7 @@ var FileSecretStore = class {
105410
105519
  );
105411
105520
  }
105412
105521
  mutate(secrets);
105413
- await import_promises34.default.mkdir(import_node_path62.default.dirname(this.filePath), { recursive: true });
105522
+ await import_promises34.default.mkdir(import_node_path63.default.dirname(this.filePath), { recursive: true });
105414
105523
  const temp = `${this.filePath}.${process.pid}.tmp`;
105415
105524
  const body = this.key === void 0 ? secrets : sealSecrets(secrets, this.key);
105416
105525
  await import_promises34.default.writeFile(temp, JSON.stringify(body, null, 2), { encoding: "utf8", mode: 384 });
@@ -105445,9 +105554,9 @@ var FileSecretStore = class {
105445
105554
  };
105446
105555
 
105447
105556
  // src/reviewQueue.ts
105448
- var import_node_crypto25 = __toESM(require("node:crypto"), 1);
105557
+ var import_node_crypto26 = __toESM(require("node:crypto"), 1);
105449
105558
  var import_promises35 = __toESM(require("node:fs/promises"), 1);
105450
- var import_node_path63 = __toESM(require("node:path"), 1);
105559
+ var import_node_path64 = __toESM(require("node:path"), 1);
105451
105560
  var ReviewQueue = class {
105452
105561
  constructor(filePath) {
105453
105562
  this.filePath = filePath;
@@ -105466,7 +105575,7 @@ var ReviewQueue = class {
105466
105575
  }
105467
105576
  async persist(items) {
105468
105577
  this.cache = items;
105469
- await import_promises35.default.mkdir(import_node_path63.default.dirname(this.filePath), { recursive: true });
105578
+ await import_promises35.default.mkdir(import_node_path64.default.dirname(this.filePath), { recursive: true });
105470
105579
  const temporary = `${this.filePath}.tmp`;
105471
105580
  await import_promises35.default.writeFile(temporary, JSON.stringify(items, null, 2), { encoding: "utf8", mode: 384 });
105472
105581
  await replaceFile(temporary, this.filePath);
@@ -105484,7 +105593,7 @@ var ReviewQueue = class {
105484
105593
  );
105485
105594
  const queued = {
105486
105595
  ...request2,
105487
- id: import_node_crypto25.default.randomUUID(),
105596
+ id: import_node_crypto26.default.randomUUID(),
105488
105597
  submittedAt: Date.now(),
105489
105598
  status: "pending"
105490
105599
  };
@@ -105707,8 +105816,8 @@ var RoutedSecretStore = class {
105707
105816
 
105708
105817
  // src/userVariables.ts
105709
105818
  var import_promises36 = __toESM(require("node:fs/promises"), 1);
105710
- var import_node_fs16 = require("node:fs");
105711
- var import_node_path64 = __toESM(require("node:path"), 1);
105819
+ var import_node_fs17 = require("node:fs");
105820
+ var import_node_path65 = __toESM(require("node:path"), 1);
105712
105821
  var UserVariableStore = class {
105713
105822
  constructor(filePath) {
105714
105823
  this.filePath = filePath;
@@ -105723,7 +105832,7 @@ var UserVariableStore = class {
105723
105832
  }
105724
105833
  async save(variables) {
105725
105834
  const parsed = sessionVariablesSchema.parse(variables);
105726
- await import_promises36.default.mkdir(import_node_path64.default.dirname(this.filePath), { recursive: true });
105835
+ await import_promises36.default.mkdir(import_node_path65.default.dirname(this.filePath), { recursive: true });
105727
105836
  const temporary = `${this.filePath}.tmp`;
105728
105837
  await import_promises36.default.writeFile(temporary, JSON.stringify({ variables: parsed }, null, 2), {
105729
105838
  encoding: "utf8",
@@ -105734,14 +105843,14 @@ var UserVariableStore = class {
105734
105843
  }
105735
105844
  };
105736
105845
  function userVariableStoreFor(dataDir, principal) {
105737
- return new UserVariableStore(userVariablesPath(import_node_path64.default.join(dataDir, "users", storageKeyFor(principal))));
105846
+ return new UserVariableStore(userVariablesPath(import_node_path65.default.join(dataDir, "users", storageKeyFor(principal))));
105738
105847
  }
105739
105848
  function userVariablesPath(userDir) {
105740
- return import_node_path64.default.join(userDir, "variables.json");
105849
+ return import_node_path65.default.join(userDir, "variables.json");
105741
105850
  }
105742
105851
  function readVariablesFile(filePath) {
105743
105852
  try {
105744
- const raw = JSON.parse((0, import_node_fs16.readFileSync)(filePath, "utf8"));
105853
+ const raw = JSON.parse((0, import_node_fs17.readFileSync)(filePath, "utf8"));
105745
105854
  const parsed = sessionVariablesSchema.safeParse(raw["variables"]);
105746
105855
  return parsed.success ? parsed.data : [];
105747
105856
  } catch {
@@ -105765,13 +105874,13 @@ function hostedUser(env2 = process.env) {
105765
105874
  }
105766
105875
 
105767
105876
  // src/session.ts
105768
- var import_node_fs17 = require("node:fs");
105877
+ var import_node_fs18 = require("node:fs");
105769
105878
  var import_promises37 = __toESM(require("node:fs/promises"), 1);
105770
- var import_node_path66 = __toESM(require("node:path"), 1);
105879
+ var import_node_path67 = __toESM(require("node:path"), 1);
105771
105880
 
105772
105881
  // src/credentialTool.ts
105773
105882
  var import_node_child_process23 = require("node:child_process");
105774
- var import_node_path65 = __toESM(require("node:path"), 1);
105883
+ var import_node_path66 = __toESM(require("node:path"), 1);
105775
105884
  var CREDENTIAL_PREFIX2 = "tool:";
105776
105885
  var WRAPPER = [
105777
105886
  "import importlib.util, json, sys",
@@ -105791,7 +105900,7 @@ async function fetchCredential(options, reference) {
105791
105900
  if (name.length === 0) return { problem: "A credential reference needs a name: tool:<name>." };
105792
105901
  const budget = options.timeoutMs ?? 3e4;
105793
105902
  const run3 = await new Promise((resolve) => {
105794
- const child = (0, import_node_child_process23.spawn)(options.interpreter, ["-c", WRAPPER, import_node_path65.default.resolve(options.file), name], {
105903
+ const child = (0, import_node_child_process23.spawn)(options.interpreter, ["-c", WRAPPER, import_node_path66.default.resolve(options.file), name], {
105795
105904
  windowsHide: true,
105796
105905
  // The environment this was started in, as with the identity function: the libraries that
105797
105906
  // hold credentials are configured through it, and nothing here is model-authored.
@@ -105987,7 +106096,7 @@ var FileConfigStore = class {
105987
106096
  const filePath = this.pathFor(scope);
105988
106097
  if (filePath === void 0)
105989
106098
  throw new Error(`Cannot write ${scope} config: no workspace is open`);
105990
- await import_promises37.default.mkdir(import_node_path66.default.dirname(filePath), { recursive: true });
106099
+ await import_promises37.default.mkdir(import_node_path67.default.dirname(filePath), { recursive: true });
105991
106100
  const temporary = `${filePath}.${process.pid.toString(36)}.tmp`;
105992
106101
  await import_promises37.default.writeFile(temporary, contents, { encoding: "utf8", mode: 384 });
105993
106102
  await replaceFile(temporary, filePath);
@@ -106024,8 +106133,8 @@ var FileConfigStore = class {
106024
106133
  };
106025
106134
  let watcher;
106026
106135
  try {
106027
- watcher = (0, import_node_fs17.watch)(import_node_path66.default.dirname(filePath), (_event, filename) => {
106028
- if (filename === import_node_path66.default.basename(filePath)) onChange();
106136
+ watcher = (0, import_node_fs18.watch)(import_node_path67.default.dirname(filePath), (_event, filename) => {
106137
+ if (filename === import_node_path67.default.basename(filePath)) onChange();
106029
106138
  });
106030
106139
  } catch {
106031
106140
  }
@@ -106053,7 +106162,7 @@ var FileWorkspaceState = class {
106053
106162
  async set(key3, value) {
106054
106163
  if (value === void 0) delete this.values[key3];
106055
106164
  else this.values[key3] = value;
106056
- await import_promises37.default.mkdir(import_node_path66.default.dirname(this.filePath), { recursive: true });
106165
+ await import_promises37.default.mkdir(import_node_path67.default.dirname(this.filePath), { recursive: true });
106057
106166
  await import_promises37.default.writeFile(this.filePath, JSON.stringify(this.values, null, 2), {
106058
106167
  encoding: "utf8",
106059
106168
  mode: 384
@@ -106103,7 +106212,7 @@ function createBrowserUi(workspaceRoot, post, fastFs, shared) {
106103
106212
  openFile: async (filePath) => {
106104
106213
  try {
106105
106214
  post(
106106
- [`[info] ${import_node_path66.default.basename(filePath)}`, "", await import_promises37.default.readFile(filePath, "utf8")].join("\n")
106215
+ [`[info] ${import_node_path67.default.basename(filePath)}`, "", await import_promises37.default.readFile(filePath, "utf8")].join("\n")
106107
106216
  );
106108
106217
  } catch (error51) {
106109
106218
  post(`[warning] Could not read ${filePath}: ${String(error51)}`);
@@ -106147,7 +106256,7 @@ function createBrowserUi(workspaceRoot, post, fastFs, shared) {
106147
106256
  for (const entry of entries) {
106148
106257
  if (found2.length >= limit) return;
106149
106258
  if (entry.name.startsWith(".") && entry.name !== ".env") continue;
106150
- const full = import_node_path66.default.join(dir, entry.name);
106259
+ const full = import_node_path67.default.join(dir, entry.name);
106151
106260
  if (entry.isDirectory()) {
106152
106261
  if (skip.has(entry.name)) continue;
106153
106262
  if (mode === "folders" && (needle.length === 0 || entry.name.toLowerCase().includes(needle))) found2.push(full);
@@ -106185,11 +106294,11 @@ var SHARED_COLLECTIONS = [
106185
106294
  { key: "mcpServers" }
106186
106295
  ];
106187
106296
  async function createSession(options) {
106188
- const userDir = import_node_path66.default.join(options.dataDir, "users", storageKeyFor(options.principal));
106297
+ const userDir = import_node_path67.default.join(options.dataDir, "users", storageKeyFor(options.principal));
106189
106298
  await import_promises37.default.mkdir(userDir, { recursive: true, mode: 448 });
106190
106299
  const variableStore = new UserVariableStore(userVariablesPath(userDir));
106191
106300
  const userVariables = () => variableStore.read();
106192
- const workspaceState = new FileWorkspaceState(import_node_path66.default.join(userDir, "workspace-state.json"));
106301
+ const workspaceState = new FileWorkspaceState(import_node_path67.default.join(userDir, "workspace-state.json"));
106193
106302
  await workspaceState.load();
106194
106303
  const services = {
106195
106304
  /*
@@ -106284,16 +106393,16 @@ async function createSession(options) {
106284
106393
  */
106285
106394
  secrets: new CredentialPointerStore(
106286
106395
  withCredentialTool(
106287
- options.sharedSecrets === void 0 ? new FileSecretStore(options.secretsFile ?? import_node_path66.default.join(userDir, "secrets.json"), options.secretsKey) : new RoutedSecretStore(
106288
- new FileSecretStore(options.secretsFile ?? import_node_path66.default.join(userDir, "secrets.json"), options.secretsKey),
106396
+ options.sharedSecrets === void 0 ? new FileSecretStore(options.secretsFile ?? import_node_path67.default.join(userDir, "secrets.json"), options.secretsKey) : new RoutedSecretStore(
106397
+ new FileSecretStore(options.secretsFile ?? import_node_path67.default.join(userDir, "secrets.json"), options.secretsKey),
106289
106398
  options.sharedSecrets
106290
106399
  ),
106291
106400
  options
106292
106401
  )
106293
106402
  ),
106294
106403
  configStore: withSharedEntries(
106295
- options.sharedProfiles === void 0 ? new FileConfigStore(options.configFile ?? import_node_path66.default.join(userDir, "config.json"), options.workspaceRoot) : new SharedProfileConfigStore(
106296
- new FileConfigStore(options.configFile ?? import_node_path66.default.join(userDir, "config.json"), options.workspaceRoot),
106404
+ options.sharedProfiles === void 0 ? new FileConfigStore(options.configFile ?? import_node_path67.default.join(userDir, "config.json"), options.workspaceRoot) : new SharedProfileConfigStore(
106405
+ new FileConfigStore(options.configFile ?? import_node_path67.default.join(userDir, "config.json"), options.workspaceRoot),
106297
106406
  options.sharedProfiles
106298
106407
  ),
106299
106408
  options
@@ -106411,8 +106520,8 @@ async function startServer(options) {
106411
106520
  ));
106412
106521
  const roles = options.roles ?? SINGLE_USER_POLICY;
106413
106522
  const sharedStore = options.sharedConfig;
106414
- const sharedSecretStore = new FileSecretStore(import_node_path67.default.join(options.dataDir, "shared-secrets.json"));
106415
- const reviews = new ReviewQueue(import_node_path67.default.join(options.dataDir, "reviews.json"));
106523
+ const sharedSecretStore = new FileSecretStore(import_node_path68.default.join(options.dataDir, "shared-secrets.json"));
106524
+ const reviews = new ReviewQueue(import_node_path68.default.join(options.dataDir, "reviews.json"));
106416
106525
  let sharedCache = {
106417
106526
  variables: [],
106418
106527
  adminIds: [],
@@ -106793,14 +106902,14 @@ async function startServer(options) {
106793
106902
  return "No workspace is open, so there is nowhere to write it.";
106794
106903
  try {
106795
106904
  if (item2.kind === "skill") {
106796
- const dir2 = import_node_path67.default.join(options.workspaceRoot, ".lightcode", "skills");
106905
+ const dir2 = import_node_path68.default.join(options.workspaceRoot, ".lightcode", "skills");
106797
106906
  await import_promises38.default.mkdir(dir2, { recursive: true });
106798
- await import_promises38.default.writeFile(import_node_path67.default.join(dir2, `${item2.name}.md`), item2.content, "utf8");
106907
+ await import_promises38.default.writeFile(import_node_path68.default.join(dir2, `${item2.name}.md`), item2.content, "utf8");
106799
106908
  return void 0;
106800
106909
  }
106801
- const dir = import_node_path67.default.join(options.workspaceRoot, ".lightcode", "tools");
106910
+ const dir = import_node_path68.default.join(options.workspaceRoot, ".lightcode", "tools");
106802
106911
  await import_promises38.default.mkdir(dir, { recursive: true });
106803
- await import_promises38.default.writeFile(import_node_path67.default.join(dir, `${item2.name}.py`), item2.content, "utf8");
106912
+ await import_promises38.default.writeFile(import_node_path68.default.join(dir, `${item2.name}.py`), item2.content, "utf8");
106804
106913
  return void 0;
106805
106914
  } catch (error51) {
106806
106915
  return error51 instanceof Error ? error51.message : String(error51);
@@ -106839,7 +106948,7 @@ async function startServer(options) {
106839
106948
  connection.transport.post({ type: "credentials", credentials: await readCredentials() });
106840
106949
  }
106841
106950
  if (options.credentialsFile !== void 0) {
106842
- (0, import_node_fs18.watchFile)(options.credentialsFile, { interval: 1500 }, () => {
106951
+ (0, import_node_fs19.watchFile)(options.credentialsFile, { interval: 1500 }, () => {
106843
106952
  for (const connection of connections.values()) void postCredentials(connection);
106844
106953
  });
106845
106954
  }
@@ -106949,7 +107058,7 @@ async function startServer(options) {
106949
107058
  return;
106950
107059
  }
106951
107060
  response.writeHead(200, {
106952
- "Content-Type": CONTENT_TYPES2[import_node_path67.default.extname(asset)] ?? "application/octet-stream",
107061
+ "Content-Type": CONTENT_TYPES2[import_node_path68.default.extname(asset)] ?? "application/octet-stream",
106953
107062
  ...securityHeaders()
106954
107063
  });
106955
107064
  response.end(body);