@locusai/cli 0.5.0 → 0.6.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/bin/agent/worker.js +18220 -17875
  2. package/bin/locus.js +2061 -1410
  3. package/package.json +2 -2
package/bin/locus.js CHANGED
@@ -56,8 +56,8 @@ var require_array = __commonJS((exports) => {
56
56
  var require_errno = __commonJS((exports) => {
57
57
  Object.defineProperty(exports, "__esModule", { value: true });
58
58
  exports.isEnoentCodeError = undefined;
59
- function isEnoentCodeError(error) {
60
- return error.code === "ENOENT";
59
+ function isEnoentCodeError(error48) {
60
+ return error48.code === "ENOENT";
61
61
  }
62
62
  exports.isEnoentCodeError = isEnoentCodeError;
63
63
  });
@@ -284,11 +284,11 @@ var require_is_glob = __commonJS((exports, module) => {
284
284
  if (isExtglob(str)) {
285
285
  return true;
286
286
  }
287
- var check = strictCheck;
287
+ var check2 = strictCheck;
288
288
  if (options && options.strict === false) {
289
- check = relaxedCheck;
289
+ check2 = relaxedCheck;
290
290
  }
291
- return check(str);
291
+ return check2(str);
292
292
  };
293
293
  });
294
294
 
@@ -600,15 +600,15 @@ var require_to_regex_range = __commonJS((exports, module) => {
600
600
  }
601
601
  return tokens;
602
602
  }
603
- function filterPatterns(arr, comparison, prefix, intersection, options) {
603
+ function filterPatterns(arr, comparison, prefix, intersection2, options) {
604
604
  let result = [];
605
605
  for (let ele of arr) {
606
- let { string } = ele;
607
- if (!intersection && !contains(comparison, "string", string)) {
608
- result.push(prefix + string);
606
+ let { string: string4 } = ele;
607
+ if (!intersection2 && !contains(comparison, "string", string4)) {
608
+ result.push(prefix + string4);
609
609
  }
610
- if (intersection && contains(comparison, "string", string)) {
611
- result.push(prefix + string);
610
+ if (intersection2 && contains(comparison, "string", string4)) {
611
+ result.push(prefix + string4);
612
612
  }
613
613
  }
614
614
  return result;
@@ -628,8 +628,8 @@ var require_to_regex_range = __commonJS((exports, module) => {
628
628
  function countNines(min, len) {
629
629
  return Number(String(min).slice(0, -len) + "9".repeat(len));
630
630
  }
631
- function countZeros(integer, zeros) {
632
- return integer - integer % Math.pow(10, zeros);
631
+ function countZeros(integer2, zeros) {
632
+ return integer2 - integer2 % Math.pow(10, zeros);
633
633
  }
634
634
  function toQuantifier(digits) {
635
635
  let [start = 0, stop = ""] = digits;
@@ -677,8 +677,8 @@ var require_fill_range = __commonJS((exports, module) => {
677
677
  */
678
678
  var util = __require("util");
679
679
  var toRegexRange = require_to_regex_range();
680
- var isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
681
- var transform = (toNumber) => {
680
+ var isObject2 = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
681
+ var transform2 = (toNumber) => {
682
682
  return (value) => toNumber === true ? Number(value) : String(value);
683
683
  };
684
684
  var isValidValue = (value) => {
@@ -799,7 +799,7 @@ var require_fill_range = __commonJS((exports, module) => {
799
799
  let padded = zeros(startString) || zeros(endString) || zeros(stepString);
800
800
  let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
801
801
  let toNumber = padded === false && stringify(start, end, options) === false;
802
- let format = options.transform || transform(toNumber);
802
+ let format = options.transform || transform2(toNumber);
803
803
  if (options.toRegex && step === 1) {
804
804
  return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options);
805
805
  }
@@ -856,7 +856,7 @@ var require_fill_range = __commonJS((exports, module) => {
856
856
  if (typeof step === "function") {
857
857
  return fill(start, end, 1, { transform: step });
858
858
  }
859
- if (isObject(step)) {
859
+ if (isObject2(step)) {
860
860
  return fill(start, end, 0, step);
861
861
  }
862
862
  let opts = { ...options };
@@ -864,7 +864,7 @@ var require_fill_range = __commonJS((exports, module) => {
864
864
  opts.wrap = true;
865
865
  step = step || opts.step || 1;
866
866
  if (!isNumber(step)) {
867
- if (step != null && !isObject(step))
867
+ if (step != null && !isObject2(step))
868
868
  return invalidStep(step, opts);
869
869
  return fill(start, end, 1, step);
870
870
  }
@@ -1091,7 +1091,7 @@ var require_parse = __commonJS((exports, module) => {
1091
1091
  CHAR_NO_BREAK_SPACE,
1092
1092
  CHAR_ZERO_WIDTH_NOBREAK_SPACE
1093
1093
  } = require_constants();
1094
- var parse = (input, options = {}) => {
1094
+ var parse5 = (input, options = {}) => {
1095
1095
  if (typeof input !== "string") {
1096
1096
  throw new TypeError("Expected a string");
1097
1097
  }
@@ -1295,7 +1295,7 @@ var require_parse = __commonJS((exports, module) => {
1295
1295
  push({ type: "eos" });
1296
1296
  return ast;
1297
1297
  };
1298
- module.exports = parse;
1298
+ module.exports = parse5;
1299
1299
  });
1300
1300
 
1301
1301
  // ../../node_modules/braces/index.js
@@ -1303,7 +1303,7 @@ var require_braces = __commonJS((exports, module) => {
1303
1303
  var stringify = require_stringify();
1304
1304
  var compile = require_compile();
1305
1305
  var expand = require_expand();
1306
- var parse = require_parse();
1306
+ var parse5 = require_parse();
1307
1307
  var braces = (input, options = {}) => {
1308
1308
  let output = [];
1309
1309
  if (Array.isArray(input)) {
@@ -1323,7 +1323,7 @@ var require_braces = __commonJS((exports, module) => {
1323
1323
  }
1324
1324
  return output;
1325
1325
  };
1326
- braces.parse = (input, options = {}) => parse(input, options);
1326
+ braces.parse = (input, options = {}) => parse5(input, options);
1327
1327
  braces.stringify = (input, options = {}) => {
1328
1328
  if (typeof input === "string") {
1329
1329
  return stringify(braces.parse(input, options), options);
@@ -1900,7 +1900,7 @@ var require_parse2 = __commonJS((exports, module) => {
1900
1900
  var syntaxError = (type, char) => {
1901
1901
  return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
1902
1902
  };
1903
- var parse = (input, options) => {
1903
+ var parse5 = (input, options) => {
1904
1904
  if (typeof input !== "string") {
1905
1905
  throw new TypeError("Expected a string");
1906
1906
  }
@@ -2050,7 +2050,7 @@ var require_parse2 = __commonJS((exports, module) => {
2050
2050
  output = token.close = `)$))${extglobStar}`;
2051
2051
  }
2052
2052
  if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
2053
- const expression = parse(rest, { ...options, fastpaths: false }).output;
2053
+ const expression = parse5(rest, { ...options, fastpaths: false }).output;
2054
2054
  output = token.close = `)${expression})${extglobStar})`;
2055
2055
  }
2056
2056
  if (token.prev.type === "bos") {
@@ -2062,14 +2062,14 @@ var require_parse2 = __commonJS((exports, module) => {
2062
2062
  };
2063
2063
  if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
2064
2064
  let backslashes = false;
2065
- let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
2065
+ let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc2, chars, first, rest, index) => {
2066
2066
  if (first === "\\") {
2067
2067
  backslashes = true;
2068
2068
  return m;
2069
2069
  }
2070
2070
  if (first === "?") {
2071
- if (esc) {
2072
- return esc + first + (rest ? QMARK.repeat(rest.length) : "");
2071
+ if (esc2) {
2072
+ return esc2 + first + (rest ? QMARK.repeat(rest.length) : "");
2073
2073
  }
2074
2074
  if (index === 0) {
2075
2075
  return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
@@ -2080,12 +2080,12 @@ var require_parse2 = __commonJS((exports, module) => {
2080
2080
  return DOT_LITERAL.repeat(chars.length);
2081
2081
  }
2082
2082
  if (first === "*") {
2083
- if (esc) {
2084
- return esc + first + (rest ? star : "");
2083
+ if (esc2) {
2084
+ return esc2 + first + (rest ? star : "");
2085
2085
  }
2086
2086
  return star;
2087
2087
  }
2088
- return esc ? m : `\\${m}`;
2088
+ return esc2 ? m : `\\${m}`;
2089
2089
  });
2090
2090
  if (backslashes === true) {
2091
2091
  if (opts.unescape === true) {
@@ -2579,7 +2579,7 @@ var require_parse2 = __commonJS((exports, module) => {
2579
2579
  }
2580
2580
  return state;
2581
2581
  };
2582
- parse.fastpaths = (input, options) => {
2582
+ parse5.fastpaths = (input, options) => {
2583
2583
  const opts = { ...options };
2584
2584
  const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
2585
2585
  const len = input.length;
@@ -2648,17 +2648,17 @@ var require_parse2 = __commonJS((exports, module) => {
2648
2648
  }
2649
2649
  return source;
2650
2650
  };
2651
- module.exports = parse;
2651
+ module.exports = parse5;
2652
2652
  });
2653
2653
 
2654
2654
  // ../../node_modules/picomatch/lib/picomatch.js
2655
2655
  var require_picomatch = __commonJS((exports, module) => {
2656
2656
  var path = __require("path");
2657
2657
  var scan = require_scan();
2658
- var parse = require_parse2();
2658
+ var parse5 = require_parse2();
2659
2659
  var utils = require_utils2();
2660
2660
  var constants = require_constants2();
2661
- var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
2661
+ var isObject2 = (val) => val && typeof val === "object" && !Array.isArray(val);
2662
2662
  var picomatch = (glob, options, returnState = false) => {
2663
2663
  if (Array.isArray(glob)) {
2664
2664
  const fns = glob.map((input) => picomatch(input, options, returnState));
@@ -2672,7 +2672,7 @@ var require_picomatch = __commonJS((exports, module) => {
2672
2672
  };
2673
2673
  return arrayMatcher;
2674
2674
  }
2675
- const isState = isObject(glob) && glob.tokens && glob.input;
2675
+ const isState = isObject2(glob) && glob.tokens && glob.input;
2676
2676
  if (glob === "" || typeof glob !== "string" && !isState) {
2677
2677
  throw new TypeError("Expected pattern to be a non-empty string");
2678
2678
  }
@@ -2745,7 +2745,7 @@ var require_picomatch = __commonJS((exports, module) => {
2745
2745
  picomatch.parse = (pattern, options) => {
2746
2746
  if (Array.isArray(pattern))
2747
2747
  return pattern.map((p) => picomatch.parse(p, options));
2748
- return parse(pattern, { ...options, fastpaths: false });
2748
+ return parse5(pattern, { ...options, fastpaths: false });
2749
2749
  };
2750
2750
  picomatch.scan = (input, options) => scan(input, options);
2751
2751
  picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
@@ -2771,10 +2771,10 @@ var require_picomatch = __commonJS((exports, module) => {
2771
2771
  }
2772
2772
  let parsed = { negated: false, fastpaths: true };
2773
2773
  if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
2774
- parsed.output = parse.fastpaths(input, options);
2774
+ parsed.output = parse5.fastpaths(input, options);
2775
2775
  }
2776
2776
  if (!parsed.output) {
2777
- parsed = parse(input, options);
2777
+ parsed = parse5(input, options);
2778
2778
  }
2779
2779
  return picomatch.compileRe(parsed, options, returnOutput, returnState);
2780
2780
  };
@@ -2806,7 +2806,7 @@ var require_micromatch = __commonJS((exports, module) => {
2806
2806
  var micromatch = (list, patterns, options) => {
2807
2807
  patterns = [].concat(patterns);
2808
2808
  list = [].concat(list);
2809
- let omit = new Set;
2809
+ let omit2 = new Set;
2810
2810
  let keep = new Set;
2811
2811
  let items = new Set;
2812
2812
  let negatives = 0;
@@ -2827,15 +2827,15 @@ var require_micromatch = __commonJS((exports, module) => {
2827
2827
  if (!match)
2828
2828
  continue;
2829
2829
  if (negated) {
2830
- omit.add(matched.output);
2830
+ omit2.add(matched.output);
2831
2831
  } else {
2832
- omit.delete(matched.output);
2832
+ omit2.delete(matched.output);
2833
2833
  keep.add(matched.output);
2834
2834
  }
2835
2835
  }
2836
2836
  }
2837
2837
  let result = negatives === patterns.length ? [...items] : [...keep];
2838
- let matches = result.filter((item) => !omit.has(item));
2838
+ let matches = result.filter((item) => !omit2.has(item));
2839
2839
  if (options && matches.length === 0) {
2840
2840
  if (options.failglob === true) {
2841
2841
  throw new Error(`No matches found for "${patterns.join(", ")}"`);
@@ -3171,7 +3171,7 @@ var require_merge2 = __commonJS((exports, module) => {
3171
3171
  merging = false;
3172
3172
  mergeStream();
3173
3173
  }
3174
- function pipe(stream) {
3174
+ function pipe2(stream) {
3175
3175
  function onend() {
3176
3176
  stream.removeListener("merge2UnpipeEnd", onend);
3177
3177
  stream.removeListener("end", onend);
@@ -3195,7 +3195,7 @@ var require_merge2 = __commonJS((exports, module) => {
3195
3195
  stream.resume();
3196
3196
  }
3197
3197
  for (let i = 0;i < streams.length; i++) {
3198
- pipe(streams[i]);
3198
+ pipe2(streams[i]);
3199
3199
  }
3200
3200
  next();
3201
3201
  }
@@ -3239,16 +3239,16 @@ var require_stream = __commonJS((exports) => {
3239
3239
  Object.defineProperty(exports, "__esModule", { value: true });
3240
3240
  exports.merge = undefined;
3241
3241
  var merge2 = require_merge2();
3242
- function merge(streams) {
3242
+ function merge3(streams) {
3243
3243
  const mergedStream = merge2(streams);
3244
3244
  streams.forEach((stream) => {
3245
- stream.once("error", (error) => mergedStream.emit("error", error));
3245
+ stream.once("error", (error48) => mergedStream.emit("error", error48));
3246
3246
  });
3247
3247
  mergedStream.once("close", () => propagateCloseEventToSources(streams));
3248
3248
  mergedStream.once("end", () => propagateCloseEventToSources(streams));
3249
3249
  return mergedStream;
3250
3250
  }
3251
- exports.merge = merge;
3251
+ exports.merge = merge3;
3252
3252
  function propagateCloseEventToSources(streams) {
3253
3253
  streams.forEach((stream) => stream.emit("close"));
3254
3254
  }
@@ -3272,8 +3272,8 @@ var require_string = __commonJS((exports) => {
3272
3272
  var require_utils3 = __commonJS((exports) => {
3273
3273
  Object.defineProperty(exports, "__esModule", { value: true });
3274
3274
  exports.string = exports.stream = exports.pattern = exports.path = exports.fs = exports.errno = exports.array = undefined;
3275
- var array = require_array();
3276
- exports.array = array;
3275
+ var array2 = require_array();
3276
+ exports.array = array2;
3277
3277
  var errno = require_errno();
3278
3278
  exports.errno = errno;
3279
3279
  var fs = require_fs();
@@ -3284,8 +3284,8 @@ var require_utils3 = __commonJS((exports) => {
3284
3284
  exports.pattern = pattern;
3285
3285
  var stream = require_stream();
3286
3286
  exports.stream = stream;
3287
- var string = require_string();
3288
- exports.string = string;
3287
+ var string4 = require_string();
3288
+ exports.string = string4;
3289
3289
  });
3290
3290
 
3291
3291
  // ../../node_modules/fast-glob/out/managers/tasks.js
@@ -3402,8 +3402,8 @@ var require_async = __commonJS((exports) => {
3402
3402
  });
3403
3403
  }
3404
3404
  exports.read = read;
3405
- function callFailureCallback(callback, error) {
3406
- callback(error);
3405
+ function callFailureCallback(callback, error48) {
3406
+ callback(error48);
3407
3407
  }
3408
3408
  function callSuccessCallback(callback, result) {
3409
3409
  callback(null, result);
@@ -3425,11 +3425,11 @@ var require_sync = __commonJS((exports) => {
3425
3425
  stat.isSymbolicLink = () => true;
3426
3426
  }
3427
3427
  return stat;
3428
- } catch (error) {
3428
+ } catch (error48) {
3429
3429
  if (!settings.throwErrorOnBrokenSymbolicLink) {
3430
3430
  return lstat;
3431
3431
  }
3432
- throw error;
3432
+ throw error48;
3433
3433
  }
3434
3434
  }
3435
3435
  exports.read = read;
@@ -3507,8 +3507,8 @@ var require_out = __commonJS((exports) => {
3507
3507
  // ../../node_modules/queue-microtask/index.js
3508
3508
  var require_queue_microtask = __commonJS((exports, module) => {
3509
3509
  /*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
3510
- var promise;
3511
- module.exports = typeof queueMicrotask === "function" ? queueMicrotask.bind(typeof window !== "undefined" ? window : global) : (cb) => (promise || (promise = Promise.resolve())).then(cb).catch((err) => setTimeout(() => {
3510
+ var promise2;
3511
+ module.exports = typeof queueMicrotask === "function" ? queueMicrotask.bind(typeof window !== "undefined" ? window : global) : (cb) => (promise2 || (promise2 = Promise.resolve())).then(cb).catch((err) => setTimeout(() => {
3512
3512
  throw err;
3513
3513
  }, 0));
3514
3514
  });
@@ -3555,8 +3555,8 @@ var require_run_parallel = __commonJS((exports, module) => {
3555
3555
  });
3556
3556
  });
3557
3557
  } else {
3558
- tasks.forEach(function(task, i) {
3559
- task(function(err, result) {
3558
+ tasks.forEach(function(task2, i) {
3559
+ task2(function(err, result) {
3560
3560
  each(i, err, result);
3561
3561
  });
3562
3562
  });
@@ -3634,7 +3634,7 @@ var require_async2 = __commonJS((exports) => {
3634
3634
  var rpl = require_run_parallel();
3635
3635
  var constants_1 = require_constants3();
3636
3636
  var utils = require_utils4();
3637
- var common = require_common();
3637
+ var common2 = require_common();
3638
3638
  function read(directory, settings, callback) {
3639
3639
  if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
3640
3640
  readdirWithFileTypes(directory, settings, callback);
@@ -3652,7 +3652,7 @@ var require_async2 = __commonJS((exports) => {
3652
3652
  const entries = dirents.map((dirent) => ({
3653
3653
  dirent,
3654
3654
  name: dirent.name,
3655
- path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
3655
+ path: common2.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
3656
3656
  }));
3657
3657
  if (!settings.followSymbolicLinks) {
3658
3658
  callSuccessCallback(callback, entries);
@@ -3696,11 +3696,11 @@ var require_async2 = __commonJS((exports) => {
3696
3696
  return;
3697
3697
  }
3698
3698
  const tasks = names.map((name) => {
3699
- const path = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
3699
+ const path = common2.joinPathSegments(directory, name, settings.pathSegmentSeparator);
3700
3700
  return (done) => {
3701
- fsStat.stat(path, settings.fsStatSettings, (error, stats) => {
3702
- if (error !== null) {
3703
- done(error);
3701
+ fsStat.stat(path, settings.fsStatSettings, (error48, stats) => {
3702
+ if (error48 !== null) {
3703
+ done(error48);
3704
3704
  return;
3705
3705
  }
3706
3706
  const entry = {
@@ -3725,8 +3725,8 @@ var require_async2 = __commonJS((exports) => {
3725
3725
  });
3726
3726
  }
3727
3727
  exports.readdir = readdir;
3728
- function callFailureCallback(callback, error) {
3729
- callback(error);
3728
+ function callFailureCallback(callback, error48) {
3729
+ callback(error48);
3730
3730
  }
3731
3731
  function callSuccessCallback(callback, result) {
3732
3732
  callback(null, result);
@@ -3740,7 +3740,7 @@ var require_sync2 = __commonJS((exports) => {
3740
3740
  var fsStat = require_out();
3741
3741
  var constants_1 = require_constants3();
3742
3742
  var utils = require_utils4();
3743
- var common = require_common();
3743
+ var common2 = require_common();
3744
3744
  function read(directory, settings) {
3745
3745
  if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
3746
3746
  return readdirWithFileTypes(directory, settings);
@@ -3754,15 +3754,15 @@ var require_sync2 = __commonJS((exports) => {
3754
3754
  const entry = {
3755
3755
  dirent,
3756
3756
  name: dirent.name,
3757
- path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
3757
+ path: common2.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
3758
3758
  };
3759
3759
  if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) {
3760
3760
  try {
3761
3761
  const stats = settings.fs.statSync(entry.path);
3762
3762
  entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
3763
- } catch (error) {
3763
+ } catch (error48) {
3764
3764
  if (settings.throwErrorOnBrokenSymbolicLink) {
3765
- throw error;
3765
+ throw error48;
3766
3766
  }
3767
3767
  }
3768
3768
  }
@@ -3773,7 +3773,7 @@ var require_sync2 = __commonJS((exports) => {
3773
3773
  function readdir(directory, settings) {
3774
3774
  const names = settings.fs.readdirSync(directory);
3775
3775
  return names.map((name) => {
3776
- const entryPath = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
3776
+ const entryPath = common2.joinPathSegments(directory, name, settings.pathSegmentSeparator);
3777
3777
  const stats = fsStat.statSync(entryPath, settings.fsStatSettings);
3778
3778
  const entry = {
3779
3779
  name,
@@ -3943,7 +3943,7 @@ var require_queue = __commonJS((exports, module) => {
3943
3943
  empty: noop2,
3944
3944
  kill,
3945
3945
  killAndDrain,
3946
- error,
3946
+ error: error48,
3947
3947
  abort
3948
3948
  };
3949
3949
  return self2;
@@ -4086,7 +4086,7 @@ var require_queue = __commonJS((exports, module) => {
4086
4086
  }
4087
4087
  self2.drain = noop2;
4088
4088
  }
4089
- function error(handler) {
4089
+ function error48(handler) {
4090
4090
  errorHandler = handler;
4091
4091
  }
4092
4092
  }
@@ -4183,11 +4183,11 @@ var require_queue = __commonJS((exports, module) => {
4183
4183
  var require_common2 = __commonJS((exports) => {
4184
4184
  Object.defineProperty(exports, "__esModule", { value: true });
4185
4185
  exports.joinPathSegments = exports.replacePathSegmentSeparator = exports.isAppliedFilter = exports.isFatalError = undefined;
4186
- function isFatalError(settings, error) {
4186
+ function isFatalError(settings, error48) {
4187
4187
  if (settings.errorFilter === null) {
4188
4188
  return true;
4189
4189
  }
4190
- return !settings.errorFilter(error);
4190
+ return !settings.errorFilter(error48);
4191
4191
  }
4192
4192
  exports.isFatalError = isFatalError;
4193
4193
  function isAppliedFilter(filter, value) {
@@ -4213,13 +4213,13 @@ var require_common2 = __commonJS((exports) => {
4213
4213
  // ../../node_modules/@nodelib/fs.walk/out/readers/reader.js
4214
4214
  var require_reader = __commonJS((exports) => {
4215
4215
  Object.defineProperty(exports, "__esModule", { value: true });
4216
- var common = require_common2();
4216
+ var common2 = require_common2();
4217
4217
 
4218
4218
  class Reader {
4219
4219
  constructor(_root, _settings) {
4220
4220
  this._root = _root;
4221
4221
  this._settings = _settings;
4222
- this._root = common.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator);
4222
+ this._root = common2.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator);
4223
4223
  }
4224
4224
  }
4225
4225
  exports.default = Reader;
@@ -4231,7 +4231,7 @@ var require_async3 = __commonJS((exports) => {
4231
4231
  var events_1 = __require("events");
4232
4232
  var fsScandir = require_out2();
4233
4233
  var fastq = require_queue();
4234
- var common = require_common2();
4234
+ var common2 = require_common2();
4235
4235
  var reader_1 = require_reader();
4236
4236
 
4237
4237
  class AsyncReader extends reader_1.default {
@@ -4278,16 +4278,16 @@ var require_async3 = __commonJS((exports) => {
4278
4278
  }
4279
4279
  _pushToQueue(directory, base) {
4280
4280
  const queueItem = { directory, base };
4281
- this._queue.push(queueItem, (error) => {
4282
- if (error !== null) {
4283
- this._handleError(error);
4281
+ this._queue.push(queueItem, (error48) => {
4282
+ if (error48 !== null) {
4283
+ this._handleError(error48);
4284
4284
  }
4285
4285
  });
4286
4286
  }
4287
4287
  _worker(item, done) {
4288
- this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => {
4289
- if (error !== null) {
4290
- done(error, undefined);
4288
+ this._scandir(item.directory, this._settings.fsScandirSettings, (error48, entries) => {
4289
+ if (error48 !== null) {
4290
+ done(error48, undefined);
4291
4291
  return;
4292
4292
  }
4293
4293
  for (const entry of entries) {
@@ -4296,13 +4296,13 @@ var require_async3 = __commonJS((exports) => {
4296
4296
  done(null, undefined);
4297
4297
  });
4298
4298
  }
4299
- _handleError(error) {
4300
- if (this._isDestroyed || !common.isFatalError(this._settings, error)) {
4299
+ _handleError(error48) {
4300
+ if (this._isDestroyed || !common2.isFatalError(this._settings, error48)) {
4301
4301
  return;
4302
4302
  }
4303
4303
  this._isFatalError = true;
4304
4304
  this._isDestroyed = true;
4305
- this._emitter.emit("error", error);
4305
+ this._emitter.emit("error", error48);
4306
4306
  }
4307
4307
  _handleEntry(entry, base) {
4308
4308
  if (this._isDestroyed || this._isFatalError) {
@@ -4310,12 +4310,12 @@ var require_async3 = __commonJS((exports) => {
4310
4310
  }
4311
4311
  const fullpath = entry.path;
4312
4312
  if (base !== undefined) {
4313
- entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
4313
+ entry.path = common2.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
4314
4314
  }
4315
- if (common.isAppliedFilter(this._settings.entryFilter, entry)) {
4315
+ if (common2.isAppliedFilter(this._settings.entryFilter, entry)) {
4316
4316
  this._emitEntry(entry);
4317
4317
  }
4318
- if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) {
4318
+ if (entry.dirent.isDirectory() && common2.isAppliedFilter(this._settings.deepFilter, entry)) {
4319
4319
  this._pushToQueue(fullpath, base === undefined ? undefined : entry.path);
4320
4320
  }
4321
4321
  }
@@ -4339,8 +4339,8 @@ var require_async4 = __commonJS((exports) => {
4339
4339
  this._storage = [];
4340
4340
  }
4341
4341
  read(callback) {
4342
- this._reader.onError((error) => {
4343
- callFailureCallback(callback, error);
4342
+ this._reader.onError((error48) => {
4343
+ callFailureCallback(callback, error48);
4344
4344
  });
4345
4345
  this._reader.onEntry((entry) => {
4346
4346
  this._storage.push(entry);
@@ -4352,8 +4352,8 @@ var require_async4 = __commonJS((exports) => {
4352
4352
  }
4353
4353
  }
4354
4354
  exports.default = AsyncProvider;
4355
- function callFailureCallback(callback, error) {
4356
- callback(error);
4355
+ function callFailureCallback(callback, error48) {
4356
+ callback(error48);
4357
4357
  }
4358
4358
  function callSuccessCallback(callback, entries) {
4359
4359
  callback(null, entries);
@@ -4382,8 +4382,8 @@ var require_stream2 = __commonJS((exports) => {
4382
4382
  });
4383
4383
  }
4384
4384
  read() {
4385
- this._reader.onError((error) => {
4386
- this._stream.emit("error", error);
4385
+ this._reader.onError((error48) => {
4386
+ this._stream.emit("error", error48);
4387
4387
  });
4388
4388
  this._reader.onEntry((entry) => {
4389
4389
  this._stream.push(entry);
@@ -4402,7 +4402,7 @@ var require_stream2 = __commonJS((exports) => {
4402
4402
  var require_sync3 = __commonJS((exports) => {
4403
4403
  Object.defineProperty(exports, "__esModule", { value: true });
4404
4404
  var fsScandir = require_out2();
4405
- var common = require_common2();
4405
+ var common2 = require_common2();
4406
4406
  var reader_1 = require_reader();
4407
4407
 
4408
4408
  class SyncReader extends reader_1.default {
@@ -4431,25 +4431,25 @@ var require_sync3 = __commonJS((exports) => {
4431
4431
  for (const entry of entries) {
4432
4432
  this._handleEntry(entry, base);
4433
4433
  }
4434
- } catch (error) {
4435
- this._handleError(error);
4434
+ } catch (error48) {
4435
+ this._handleError(error48);
4436
4436
  }
4437
4437
  }
4438
- _handleError(error) {
4439
- if (!common.isFatalError(this._settings, error)) {
4438
+ _handleError(error48) {
4439
+ if (!common2.isFatalError(this._settings, error48)) {
4440
4440
  return;
4441
4441
  }
4442
- throw error;
4442
+ throw error48;
4443
4443
  }
4444
4444
  _handleEntry(entry, base) {
4445
4445
  const fullpath = entry.path;
4446
4446
  if (base !== undefined) {
4447
- entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
4447
+ entry.path = common2.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
4448
4448
  }
4449
- if (common.isAppliedFilter(this._settings.entryFilter, entry)) {
4449
+ if (common2.isAppliedFilter(this._settings.entryFilter, entry)) {
4450
4450
  this._pushToStorage(entry);
4451
4451
  }
4452
- if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) {
4452
+ if (entry.dirent.isDirectory() && common2.isAppliedFilter(this._settings.deepFilter, entry)) {
4453
4453
  this._pushToQueue(fullpath, base === undefined ? undefined : entry.path);
4454
4454
  }
4455
4455
  }
@@ -4575,8 +4575,8 @@ var require_reader2 = __commonJS((exports) => {
4575
4575
  }
4576
4576
  return entry;
4577
4577
  }
4578
- _isFatalError(error) {
4579
- return !utils.errno.isEnoentCodeError(error) && !this._settings.suppressErrors;
4578
+ _isFatalError(error48) {
4579
+ return !utils.errno.isEnoentCodeError(error48) && !this._settings.suppressErrors;
4580
4580
  }
4581
4581
  }
4582
4582
  exports.default = Reader;
@@ -4619,17 +4619,17 @@ var require_stream3 = __commonJS((exports) => {
4619
4619
  return stream;
4620
4620
  }
4621
4621
  _getEntry(filepath, pattern, options) {
4622
- return this._getStat(filepath).then((stats) => this._makeEntry(stats, pattern)).catch((error) => {
4623
- if (options.errorFilter(error)) {
4622
+ return this._getStat(filepath).then((stats) => this._makeEntry(stats, pattern)).catch((error48) => {
4623
+ if (options.errorFilter(error48)) {
4624
4624
  return null;
4625
4625
  }
4626
- throw error;
4626
+ throw error48;
4627
4627
  });
4628
4628
  }
4629
4629
  _getStat(filepath) {
4630
4630
  return new Promise((resolve, reject) => {
4631
- this._stat(filepath, this._fsStatSettings, (error, stats) => {
4632
- return error === null ? resolve(stats) : reject(error);
4631
+ this._stat(filepath, this._fsStatSettings, (error48, stats) => {
4632
+ return error48 === null ? resolve(stats) : reject(error48);
4633
4633
  });
4634
4634
  });
4635
4635
  }
@@ -4652,11 +4652,11 @@ var require_async5 = __commonJS((exports) => {
4652
4652
  }
4653
4653
  dynamic(root, options) {
4654
4654
  return new Promise((resolve, reject) => {
4655
- this._walkAsync(root, options, (error, entries) => {
4656
- if (error === null) {
4655
+ this._walkAsync(root, options, (error48, entries) => {
4656
+ if (error48 === null) {
4657
4657
  resolve(entries);
4658
4658
  } else {
4659
- reject(error);
4659
+ reject(error48);
4660
4660
  }
4661
4661
  });
4662
4662
  });
@@ -4917,10 +4917,10 @@ var require_error = __commonJS((exports) => {
4917
4917
  this._settings = _settings;
4918
4918
  }
4919
4919
  getFilter() {
4920
- return (error) => this._isNonFatalError(error);
4920
+ return (error48) => this._isNonFatalError(error48);
4921
4921
  }
4922
- _isNonFatalError(error) {
4923
- return utils.errno.isEnoentCodeError(error) || this._settings.suppressErrors;
4922
+ _isNonFatalError(error48) {
4923
+ return utils.errno.isEnoentCodeError(error48) || this._settings.suppressErrors;
4924
4924
  }
4925
4925
  }
4926
4926
  exports.default = ErrorFilter;
@@ -4973,17 +4973,17 @@ var require_provider = __commonJS((exports) => {
4973
4973
  this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions());
4974
4974
  this.entryTransformer = new entry_2.default(this._settings);
4975
4975
  }
4976
- _getRootDirectory(task) {
4977
- return path.resolve(this._settings.cwd, task.base);
4976
+ _getRootDirectory(task2) {
4977
+ return path.resolve(this._settings.cwd, task2.base);
4978
4978
  }
4979
- _getReaderOptions(task) {
4980
- const basePath = task.base === "." ? "" : task.base;
4979
+ _getReaderOptions(task2) {
4980
+ const basePath = task2.base === "." ? "" : task2.base;
4981
4981
  return {
4982
4982
  basePath,
4983
4983
  pathSegmentSeparator: "/",
4984
4984
  concurrency: this._settings.concurrency,
4985
- deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative),
4986
- entryFilter: this.entryFilter.getFilter(task.positive, task.negative),
4985
+ deepFilter: this.deepFilter.getFilter(basePath, task2.positive, task2.negative),
4986
+ entryFilter: this.entryFilter.getFilter(task2.positive, task2.negative),
4987
4987
  errorFilter: this.errorFilter.getFilter(),
4988
4988
  followSymbolicLinks: this._settings.followSymbolicLinks,
4989
4989
  fs: this._settings.fs,
@@ -5019,17 +5019,17 @@ var require_async6 = __commonJS((exports) => {
5019
5019
  super(...arguments);
5020
5020
  this._reader = new async_1.default(this._settings);
5021
5021
  }
5022
- async read(task) {
5023
- const root = this._getRootDirectory(task);
5024
- const options = this._getReaderOptions(task);
5025
- const entries = await this.api(root, task, options);
5022
+ async read(task2) {
5023
+ const root = this._getRootDirectory(task2);
5024
+ const options = this._getReaderOptions(task2);
5025
+ const entries = await this.api(root, task2, options);
5026
5026
  return entries.map((entry) => options.transform(entry));
5027
5027
  }
5028
- api(root, task, options) {
5029
- if (task.dynamic) {
5028
+ api(root, task2, options) {
5029
+ if (task2.dynamic) {
5030
5030
  return this._reader.dynamic(root, options);
5031
5031
  }
5032
- return this._reader.static(task.patterns, options);
5032
+ return this._reader.static(task2.patterns, options);
5033
5033
  }
5034
5034
  }
5035
5035
  exports.default = ProviderAsync;
@@ -5047,20 +5047,20 @@ var require_stream4 = __commonJS((exports) => {
5047
5047
  super(...arguments);
5048
5048
  this._reader = new stream_2.default(this._settings);
5049
5049
  }
5050
- read(task) {
5051
- const root = this._getRootDirectory(task);
5052
- const options = this._getReaderOptions(task);
5053
- const source = this.api(root, task, options);
5050
+ read(task2) {
5051
+ const root = this._getRootDirectory(task2);
5052
+ const options = this._getReaderOptions(task2);
5053
+ const source = this.api(root, task2, options);
5054
5054
  const destination = new stream_1.Readable({ objectMode: true, read: () => {} });
5055
- source.once("error", (error) => destination.emit("error", error)).on("data", (entry) => destination.emit("data", options.transform(entry))).once("end", () => destination.emit("end"));
5055
+ source.once("error", (error48) => destination.emit("error", error48)).on("data", (entry) => destination.emit("data", options.transform(entry))).once("end", () => destination.emit("end"));
5056
5056
  destination.once("close", () => source.destroy());
5057
5057
  return destination;
5058
5058
  }
5059
- api(root, task, options) {
5060
- if (task.dynamic) {
5059
+ api(root, task2, options) {
5060
+ if (task2.dynamic) {
5061
5061
  return this._reader.dynamic(root, options);
5062
5062
  }
5063
- return this._reader.static(task.patterns, options);
5063
+ return this._reader.static(task2.patterns, options);
5064
5064
  }
5065
5065
  }
5066
5066
  exports.default = ProviderStream;
@@ -5098,11 +5098,11 @@ var require_sync5 = __commonJS((exports) => {
5098
5098
  try {
5099
5099
  const stats = this._getStat(filepath);
5100
5100
  return this._makeEntry(stats, pattern);
5101
- } catch (error) {
5102
- if (options.errorFilter(error)) {
5101
+ } catch (error48) {
5102
+ if (options.errorFilter(error48)) {
5103
5103
  return null;
5104
5104
  }
5105
- throw error;
5105
+ throw error48;
5106
5106
  }
5107
5107
  }
5108
5108
  _getStat(filepath) {
@@ -5123,17 +5123,17 @@ var require_sync6 = __commonJS((exports) => {
5123
5123
  super(...arguments);
5124
5124
  this._reader = new sync_1.default(this._settings);
5125
5125
  }
5126
- read(task) {
5127
- const root = this._getRootDirectory(task);
5128
- const options = this._getReaderOptions(task);
5129
- const entries = this.api(root, task, options);
5126
+ read(task2) {
5127
+ const root = this._getRootDirectory(task2);
5128
+ const options = this._getReaderOptions(task2);
5129
+ const entries = this.api(root, task2, options);
5130
5130
  return entries.map(options.transform);
5131
5131
  }
5132
- api(root, task, options) {
5133
- if (task.dynamic) {
5132
+ api(root, task2, options) {
5133
+ if (task2.dynamic) {
5134
5134
  return this._reader.dynamic(root, options);
5135
5135
  }
5136
- return this._reader.static(task.patterns, options);
5136
+ return this._reader.static(task2.patterns, options);
5137
5137
  }
5138
5138
  }
5139
5139
  exports.default = ProviderSync;
@@ -5317,8 +5317,8 @@ var require_ignore = __commonJS((exports, module) => {
5317
5317
  TMP_KEY_IGNORE = Symbol.for("node-ignore");
5318
5318
  }
5319
5319
  var KEY_IGNORE = TMP_KEY_IGNORE;
5320
- var define = (object, key, value) => {
5321
- Object.defineProperty(object, key, { value });
5320
+ var define = (object2, key, value) => {
5321
+ Object.defineProperty(object2, key, { value });
5322
5322
  return value;
5323
5323
  };
5324
5324
  var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
@@ -14402,17 +14402,6 @@ var require_db = __commonJS((exports, module) => {
14402
14402
  };
14403
14403
  });
14404
14404
 
14405
- // ../../node_modules/form-data/node_modules/mime-types/node_modules/mime-db/index.js
14406
- var require_mime_db = __commonJS((exports, module) => {
14407
- /*!
14408
- * mime-db
14409
- * Copyright(c) 2014 Jonathan Ong
14410
- * Copyright(c) 2015-2022 Douglas Christopher Wilson
14411
- * MIT Licensed
14412
- */
14413
- module.exports = require_db();
14414
- });
14415
-
14416
14405
  // ../../node_modules/form-data/node_modules/mime-types/index.js
14417
14406
  var require_mime_types = __commonJS((exports) => {
14418
14407
  /*!
@@ -14421,7 +14410,7 @@ var require_mime_types = __commonJS((exports) => {
14421
14410
  * Copyright(c) 2015 Douglas Christopher Wilson
14422
14411
  * MIT Licensed
14423
14412
  */
14424
- var db = require_mime_db();
14413
+ var db = require_db();
14425
14414
  var extname = __require("path").extname;
14426
14415
  var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
14427
14416
  var TEXT_TYPE_REGEXP = /^text\//i;
@@ -14768,7 +14757,7 @@ var require_round = __commonJS((exports, module) => {
14768
14757
 
14769
14758
  // ../../node_modules/math-intrinsics/isNaN.js
14770
14759
  var require_isNaN = __commonJS((exports, module) => {
14771
- module.exports = Number.isNaN || function isNaN(a) {
14760
+ module.exports = Number.isNaN || function isNaN2(a) {
14772
14761
  return a !== a;
14773
14762
  };
14774
14763
  });
@@ -14902,7 +14891,7 @@ var require_implementation = __commonJS((exports, module) => {
14902
14891
  var toStr = Object.prototype.toString;
14903
14892
  var max = Math.max;
14904
14893
  var funcType = "[object Function]";
14905
- var concatty = function concatty(a, b) {
14894
+ var concatty = function concatty2(a, b) {
14906
14895
  var arr = [];
14907
14896
  for (var i = 0;i < a.length; i += 1) {
14908
14897
  arr[i] = a[i];
@@ -14912,7 +14901,7 @@ var require_implementation = __commonJS((exports, module) => {
14912
14901
  }
14913
14902
  return arr;
14914
14903
  };
14915
- var slicy = function slicy(arrLike, offset) {
14904
+ var slicy = function slicy2(arrLike, offset) {
14916
14905
  var arr = [];
14917
14906
  for (var i = offset || 0, j = 0;i < arrLike.length; i += 1, j += 1) {
14918
14907
  arr[j] = arrLike[i];
@@ -14929,7 +14918,7 @@ var require_implementation = __commonJS((exports, module) => {
14929
14918
  }
14930
14919
  return str;
14931
14920
  };
14932
- module.exports = function bind(that) {
14921
+ module.exports = function bind2(that) {
14933
14922
  var target = this;
14934
14923
  if (typeof target !== "function" || toStr.apply(target) !== funcType) {
14935
14924
  throw new TypeError(ERROR_MESSAGE + target);
@@ -14953,7 +14942,7 @@ var require_implementation = __commonJS((exports, module) => {
14953
14942
  }
14954
14943
  bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
14955
14944
  if (target.prototype) {
14956
- var Empty = function Empty() {};
14945
+ var Empty = function Empty2() {};
14957
14946
  Empty.prototype = target.prototype;
14958
14947
  bound.prototype = new Empty;
14959
14948
  Empty.prototype = null;
@@ -15192,7 +15181,7 @@ var require_get_intrinsic = __commonJS((exports, module) => {
15192
15181
  }
15193
15182
  }
15194
15183
  var errorProto;
15195
- var doEval = function doEval(name) {
15184
+ var doEval = function doEval2(name) {
15196
15185
  var value;
15197
15186
  if (name === "%AsyncFunction%") {
15198
15187
  value = getEvalledConstructor("async function () {}");
@@ -15201,12 +15190,12 @@ var require_get_intrinsic = __commonJS((exports, module) => {
15201
15190
  } else if (name === "%AsyncGeneratorFunction%") {
15202
15191
  value = getEvalledConstructor("async function* () {}");
15203
15192
  } else if (name === "%AsyncGenerator%") {
15204
- var fn = doEval("%AsyncGeneratorFunction%");
15193
+ var fn = doEval2("%AsyncGeneratorFunction%");
15205
15194
  if (fn) {
15206
15195
  value = fn.prototype;
15207
15196
  }
15208
15197
  } else if (name === "%AsyncIteratorPrototype%") {
15209
- var gen = doEval("%AsyncGenerator%");
15198
+ var gen = doEval2("%AsyncGenerator%");
15210
15199
  if (gen && getProto) {
15211
15200
  value = getProto(gen.prototype);
15212
15201
  }
@@ -15277,7 +15266,7 @@ var require_get_intrinsic = __commonJS((exports, module) => {
15277
15266
  var $exec = bind2.call($call, RegExp.prototype.exec);
15278
15267
  var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
15279
15268
  var reEscapeChar = /\\(\\)?/g;
15280
- var stringToPath = function stringToPath(string4) {
15269
+ var stringToPath = function stringToPath2(string4) {
15281
15270
  var first = $strSlice(string4, 0, 1);
15282
15271
  var last = $strSlice(string4, -1);
15283
15272
  if (first === "%" && last !== "%") {
@@ -15291,7 +15280,7 @@ var require_get_intrinsic = __commonJS((exports, module) => {
15291
15280
  });
15292
15281
  return result;
15293
15282
  };
15294
- var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
15283
+ var getBaseIntrinsic = function getBaseIntrinsic2(name, allowMissing) {
15295
15284
  var intrinsicName = name;
15296
15285
  var alias;
15297
15286
  if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
@@ -17025,7 +17014,7 @@ var require_follow_redirects = __commonJS((exports, module) => {
17025
17014
 
17026
17015
  // src/cli.ts
17027
17016
  import { existsSync as existsSync7, readFileSync as readFileSync6 } from "node:fs";
17028
- import { dirname as dirname3, join as join7 } from "node:path";
17017
+ import { dirname as dirname3, join as join8 } from "node:path";
17029
17018
  import { fileURLToPath as fileURLToPath3 } from "node:url";
17030
17019
  import { parseArgs } from "node:util";
17031
17020
 
@@ -17035,1025 +17024,251 @@ import {
17035
17024
  mkdirSync,
17036
17025
  readdirSync,
17037
17026
  readFileSync,
17038
- statSync
17027
+ statSync,
17028
+ writeFileSync
17039
17029
  } from "node:fs";
17040
17030
  import { join as join2 } from "node:path";
17041
17031
 
17042
- // ../sdk/src/core/config.ts
17043
- import { join } from "node:path";
17044
- var PROVIDER = {
17045
- CLAUDE: "claude",
17046
- CODEX: "codex"
17047
- };
17048
- var DEFAULT_MODEL = {
17049
- [PROVIDER.CLAUDE]: "sonnet",
17050
- [PROVIDER.CODEX]: "gpt-5.1-codex-mini"
17051
- };
17052
- var LOCUS_CONFIG = {
17053
- dir: ".locus",
17054
- configFile: "config.json",
17055
- indexFile: "codebase-index.json",
17056
- contextFile: "CLAUDE.md",
17057
- artifactsDir: "artifacts"
17058
- };
17059
- function getLocusPath(projectPath, fileName) {
17060
- if (fileName === "contextFile") {
17061
- return join(projectPath, LOCUS_CONFIG.contextFile);
17062
- }
17063
- return join(projectPath, LOCUS_CONFIG.dir, LOCUS_CONFIG[fileName]);
17064
- }
17065
-
17066
- // ../sdk/src/agent/artifact-syncer.ts
17067
- class ArtifactSyncer {
17068
- deps;
17069
- constructor(deps) {
17070
- this.deps = deps;
17071
- }
17072
- async getOrCreateArtifactsGroup() {
17073
- try {
17074
- const groups = await this.deps.client.docs.listGroups(this.deps.workspaceId);
17075
- const artifactsGroup = groups.find((g) => g.name === "Artifacts");
17076
- if (artifactsGroup) {
17077
- return artifactsGroup.id;
17078
- }
17079
- const newGroup = await this.deps.client.docs.createGroup(this.deps.workspaceId, {
17080
- name: "Artifacts",
17081
- order: 999
17082
- });
17083
- this.deps.log("Created 'Artifacts' group for agent-generated docs", "info");
17084
- return newGroup.id;
17085
- } catch (error) {
17086
- this.deps.log(`Failed to get/create Artifacts group: ${error}`, "error");
17087
- throw error;
17088
- }
17089
- }
17090
- async sync() {
17091
- const artifactsDir = getLocusPath(this.deps.projectPath, "artifactsDir");
17092
- if (!existsSync(artifactsDir)) {
17093
- mkdirSync(artifactsDir, { recursive: true });
17094
- return;
17095
- }
17096
- try {
17097
- const files = readdirSync(artifactsDir);
17098
- if (files.length === 0)
17099
- return;
17100
- this.deps.log(`Syncing ${files.length} artifacts to server...`, "info");
17101
- const artifactsGroupId = await this.getOrCreateArtifactsGroup();
17102
- const existingDocs = await this.deps.client.docs.list(this.deps.workspaceId);
17103
- for (const file of files) {
17104
- const filePath = join2(artifactsDir, file);
17105
- if (statSync(filePath).isFile()) {
17106
- const content = readFileSync(filePath, "utf-8");
17107
- const title = file.replace(/\.md$/, "").trim();
17108
- if (!title)
17109
- continue;
17110
- const existing = existingDocs.find((d) => d.title === title);
17111
- if (existing) {
17112
- if (existing.content !== content || existing.groupId !== artifactsGroupId) {
17113
- await this.deps.client.docs.update(existing.id, this.deps.workspaceId, { content, groupId: artifactsGroupId });
17114
- this.deps.log(`Updated artifact: ${file}`, "success");
17115
- }
17116
- } else {
17117
- await this.deps.client.docs.create(this.deps.workspaceId, {
17118
- title,
17119
- content,
17120
- groupId: artifactsGroupId
17121
- });
17122
- this.deps.log(`Created artifact: ${file}`, "success");
17123
- }
17124
- }
17125
- }
17126
- } catch (error) {
17127
- this.deps.log(`Failed to sync artifacts: ${error}`, "error");
17128
- }
17129
- }
17130
- }
17131
- // ../sdk/src/core/indexer.ts
17132
- import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync } from "node:fs";
17133
- import { dirname, join as join3 } from "node:path";
17134
-
17135
- // ../../node_modules/globby/index.js
17136
- import process3 from "node:process";
17137
- import fs3 from "node:fs";
17138
- import nodePath from "node:path";
17139
-
17140
- // ../../node_modules/@sindresorhus/merge-streams/index.js
17141
- import { on, once } from "node:events";
17142
- import { PassThrough as PassThroughStream } from "node:stream";
17143
- import { finished } from "node:stream/promises";
17144
- function mergeStreams(streams) {
17145
- if (!Array.isArray(streams)) {
17146
- throw new TypeError(`Expected an array, got \`${typeof streams}\`.`);
17147
- }
17148
- for (const stream of streams) {
17149
- validateStream(stream);
17150
- }
17151
- const objectMode = streams.some(({ readableObjectMode }) => readableObjectMode);
17152
- const highWaterMark = getHighWaterMark(streams, objectMode);
17153
- const passThroughStream = new MergedStream({
17154
- objectMode,
17155
- writableHighWaterMark: highWaterMark,
17156
- readableHighWaterMark: highWaterMark
17157
- });
17158
- for (const stream of streams) {
17159
- passThroughStream.add(stream);
17160
- }
17161
- if (streams.length === 0) {
17162
- endStream(passThroughStream);
17163
- }
17164
- return passThroughStream;
17165
- }
17166
- var getHighWaterMark = (streams, objectMode) => {
17167
- if (streams.length === 0) {
17168
- return 16384;
17169
- }
17170
- const highWaterMarks = streams.filter(({ readableObjectMode }) => readableObjectMode === objectMode).map(({ readableHighWaterMark }) => readableHighWaterMark);
17171
- return Math.max(...highWaterMarks);
17172
- };
17173
-
17174
- class MergedStream extends PassThroughStream {
17175
- #streams = new Set([]);
17176
- #ended = new Set([]);
17177
- #aborted = new Set([]);
17178
- #onFinished;
17179
- add(stream) {
17180
- validateStream(stream);
17181
- if (this.#streams.has(stream)) {
17182
- return;
17183
- }
17184
- this.#streams.add(stream);
17185
- this.#onFinished ??= onMergedStreamFinished(this, this.#streams);
17186
- endWhenStreamsDone({
17187
- passThroughStream: this,
17188
- stream,
17189
- streams: this.#streams,
17190
- ended: this.#ended,
17191
- aborted: this.#aborted,
17192
- onFinished: this.#onFinished
17193
- });
17194
- stream.pipe(this, { end: false });
17195
- }
17196
- remove(stream) {
17197
- validateStream(stream);
17198
- if (!this.#streams.has(stream)) {
17199
- return false;
17200
- }
17201
- stream.unpipe(this);
17202
- return true;
17203
- }
17204
- }
17205
- var onMergedStreamFinished = async (passThroughStream, streams) => {
17206
- updateMaxListeners(passThroughStream, PASSTHROUGH_LISTENERS_COUNT);
17207
- const controller = new AbortController;
17208
- try {
17209
- await Promise.race([
17210
- onMergedStreamEnd(passThroughStream, controller),
17211
- onInputStreamsUnpipe(passThroughStream, streams, controller)
17212
- ]);
17213
- } finally {
17214
- controller.abort();
17215
- updateMaxListeners(passThroughStream, -PASSTHROUGH_LISTENERS_COUNT);
17216
- }
17217
- };
17218
- var onMergedStreamEnd = async (passThroughStream, { signal }) => {
17219
- await finished(passThroughStream, { signal, cleanup: true });
17220
- };
17221
- var onInputStreamsUnpipe = async (passThroughStream, streams, { signal }) => {
17222
- for await (const [unpipedStream] of on(passThroughStream, "unpipe", { signal })) {
17223
- if (streams.has(unpipedStream)) {
17224
- unpipedStream.emit(unpipeEvent);
17225
- }
17226
- }
17227
- };
17228
- var validateStream = (stream) => {
17229
- if (typeof stream?.pipe !== "function") {
17230
- throw new TypeError(`Expected a readable stream, got: \`${typeof stream}\`.`);
17231
- }
17232
- };
17233
- var endWhenStreamsDone = async ({ passThroughStream, stream, streams, ended, aborted, onFinished }) => {
17234
- updateMaxListeners(passThroughStream, PASSTHROUGH_LISTENERS_PER_STREAM);
17235
- const controller = new AbortController;
17236
- try {
17237
- await Promise.race([
17238
- afterMergedStreamFinished(onFinished, stream),
17239
- onInputStreamEnd({ passThroughStream, stream, streams, ended, aborted, controller }),
17240
- onInputStreamUnpipe({ stream, streams, ended, aborted, controller })
17241
- ]);
17242
- } finally {
17243
- controller.abort();
17244
- updateMaxListeners(passThroughStream, -PASSTHROUGH_LISTENERS_PER_STREAM);
17245
- }
17246
- if (streams.size === ended.size + aborted.size) {
17247
- if (ended.size === 0 && aborted.size > 0) {
17248
- abortStream(passThroughStream);
17249
- } else {
17250
- endStream(passThroughStream);
17251
- }
17252
- }
17253
- };
17254
- var isAbortError = (error) => error?.code === "ERR_STREAM_PREMATURE_CLOSE";
17255
- var afterMergedStreamFinished = async (onFinished, stream) => {
17256
- try {
17257
- await onFinished;
17258
- abortStream(stream);
17259
- } catch (error) {
17260
- if (isAbortError(error)) {
17261
- abortStream(stream);
17262
- } else {
17263
- errorStream(stream, error);
17264
- }
17265
- }
17266
- };
17267
- var onInputStreamEnd = async ({ passThroughStream, stream, streams, ended, aborted, controller: { signal } }) => {
17268
- try {
17269
- await finished(stream, { signal, cleanup: true, readable: true, writable: false });
17270
- if (streams.has(stream)) {
17271
- ended.add(stream);
17272
- }
17273
- } catch (error) {
17274
- if (signal.aborted || !streams.has(stream)) {
17275
- return;
17276
- }
17277
- if (isAbortError(error)) {
17278
- aborted.add(stream);
17279
- } else {
17280
- errorStream(passThroughStream, error);
17281
- }
17282
- }
17283
- };
17284
- var onInputStreamUnpipe = async ({ stream, streams, ended, aborted, controller: { signal } }) => {
17285
- await once(stream, unpipeEvent, { signal });
17286
- streams.delete(stream);
17287
- ended.delete(stream);
17288
- aborted.delete(stream);
17289
- };
17290
- var unpipeEvent = Symbol("unpipe");
17291
- var endStream = (stream) => {
17292
- if (stream.writable) {
17293
- stream.end();
17294
- }
17295
- };
17296
- var abortStream = (stream) => {
17297
- if (stream.readable || stream.writable) {
17298
- stream.destroy();
17299
- }
17300
- };
17301
- var errorStream = (stream, error) => {
17302
- if (!stream.destroyed) {
17303
- stream.once("error", noop);
17304
- stream.destroy(error);
17305
- }
17306
- };
17307
- var noop = () => {};
17308
- var updateMaxListeners = (passThroughStream, increment) => {
17309
- const maxListeners = passThroughStream.getMaxListeners();
17310
- if (maxListeners !== 0 && maxListeners !== Number.POSITIVE_INFINITY) {
17311
- passThroughStream.setMaxListeners(maxListeners + increment);
17312
- }
17313
- };
17314
- var PASSTHROUGH_LISTENERS_COUNT = 2;
17315
- var PASSTHROUGH_LISTENERS_PER_STREAM = 1;
17316
-
17317
- // ../../node_modules/globby/index.js
17318
- var import_fast_glob2 = __toESM(require_out4(), 1);
17319
-
17320
- // ../../node_modules/path-type/index.js
17321
- import fs from "node:fs";
17322
- import fsPromises from "node:fs/promises";
17323
- async function isType(fsStatType, statsMethodName, filePath) {
17324
- if (typeof filePath !== "string") {
17325
- throw new TypeError(`Expected a string, got ${typeof filePath}`);
17326
- }
17327
- try {
17328
- const stats = await fsPromises[fsStatType](filePath);
17329
- return stats[statsMethodName]();
17330
- } catch (error) {
17331
- if (error.code === "ENOENT") {
17332
- return false;
17333
- }
17334
- throw error;
17335
- }
17336
- }
17337
- function isTypeSync(fsStatType, statsMethodName, filePath) {
17338
- if (typeof filePath !== "string") {
17339
- throw new TypeError(`Expected a string, got ${typeof filePath}`);
17340
- }
17341
- try {
17342
- return fs[fsStatType](filePath)[statsMethodName]();
17343
- } catch (error) {
17344
- if (error.code === "ENOENT") {
17345
- return false;
17346
- }
17347
- throw error;
17348
- }
17349
- }
17350
- var isFile = isType.bind(undefined, "stat", "isFile");
17351
- var isDirectory = isType.bind(undefined, "stat", "isDirectory");
17352
- var isSymlink = isType.bind(undefined, "lstat", "isSymbolicLink");
17353
- var isFileSync = isTypeSync.bind(undefined, "statSync", "isFile");
17354
- var isDirectorySync = isTypeSync.bind(undefined, "statSync", "isDirectory");
17355
- var isSymlinkSync = isTypeSync.bind(undefined, "lstatSync", "isSymbolicLink");
17356
-
17357
- // ../../node_modules/unicorn-magic/node.js
17358
- import { promisify } from "node:util";
17359
- import { execFile as execFileCallback, execFileSync as execFileSyncOriginal } from "node:child_process";
17360
- import { fileURLToPath } from "node:url";
17361
- var execFileOriginal = promisify(execFileCallback);
17362
- function toPath(urlOrPath) {
17363
- return urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
17364
- }
17365
- var TEN_MEGABYTES_IN_BYTES = 10 * 1024 * 1024;
17366
-
17367
- // ../../node_modules/globby/ignore.js
17368
- var import_fast_glob = __toESM(require_out4(), 1);
17369
- var import_ignore = __toESM(require_ignore(), 1);
17370
- import process2 from "node:process";
17371
- import fs2 from "node:fs";
17372
- import fsPromises2 from "node:fs/promises";
17373
- import path from "node:path";
17374
-
17375
- // ../../node_modules/globby/node_modules/slash/index.js
17376
- function slash(path) {
17377
- const isExtendedLengthPath = path.startsWith("\\\\?\\");
17378
- if (isExtendedLengthPath) {
17379
- return path;
17380
- }
17381
- return path.replace(/\\/g, "/");
17382
- }
17383
-
17384
- // ../../node_modules/globby/utilities.js
17385
- var isNegativePattern = (pattern) => pattern[0] === "!";
17386
-
17387
- // ../../node_modules/globby/ignore.js
17388
- var defaultIgnoredDirectories = [
17389
- "**/node_modules",
17390
- "**/flow-typed",
17391
- "**/coverage",
17392
- "**/.git"
17393
- ];
17394
- var ignoreFilesGlobOptions = {
17395
- absolute: true,
17396
- dot: true
17397
- };
17398
- var GITIGNORE_FILES_PATTERN = "**/.gitignore";
17399
- var applyBaseToPattern = (pattern, base) => isNegativePattern(pattern) ? "!" + path.posix.join(base, pattern.slice(1)) : path.posix.join(base, pattern);
17400
- var parseIgnoreFile = (file, cwd) => {
17401
- const base = slash(path.relative(cwd, path.dirname(file.filePath)));
17402
- return file.content.split(/\r?\n/).filter((line) => line && !line.startsWith("#")).map((pattern) => applyBaseToPattern(pattern, base));
17403
- };
17404
- var toRelativePath = (fileOrDirectory, cwd) => {
17405
- cwd = slash(cwd);
17406
- if (path.isAbsolute(fileOrDirectory)) {
17407
- if (slash(fileOrDirectory).startsWith(cwd)) {
17408
- return path.relative(cwd, fileOrDirectory);
17409
- }
17410
- throw new Error(`Path ${fileOrDirectory} is not in cwd ${cwd}`);
17411
- }
17412
- return fileOrDirectory;
17413
- };
17414
- var getIsIgnoredPredicate = (files, cwd) => {
17415
- const patterns = files.flatMap((file) => parseIgnoreFile(file, cwd));
17416
- const ignores = import_ignore.default().add(patterns);
17417
- return (fileOrDirectory) => {
17418
- fileOrDirectory = toPath(fileOrDirectory);
17419
- fileOrDirectory = toRelativePath(fileOrDirectory, cwd);
17420
- return fileOrDirectory ? ignores.ignores(slash(fileOrDirectory)) : false;
17421
- };
17422
- };
17423
- var normalizeOptions = (options = {}) => ({
17424
- cwd: toPath(options.cwd) ?? process2.cwd(),
17425
- suppressErrors: Boolean(options.suppressErrors),
17426
- deep: typeof options.deep === "number" ? options.deep : Number.POSITIVE_INFINITY,
17427
- ignore: [...options.ignore ?? [], ...defaultIgnoredDirectories]
17428
- });
17429
- var isIgnoredByIgnoreFiles = async (patterns, options) => {
17430
- const { cwd, suppressErrors, deep, ignore } = normalizeOptions(options);
17431
- const paths = await import_fast_glob.default(patterns, {
17432
- cwd,
17433
- suppressErrors,
17434
- deep,
17435
- ignore,
17436
- ...ignoreFilesGlobOptions
17437
- });
17438
- const files = await Promise.all(paths.map(async (filePath) => ({
17439
- filePath,
17440
- content: await fsPromises2.readFile(filePath, "utf8")
17441
- })));
17442
- return getIsIgnoredPredicate(files, cwd);
17443
- };
17444
- var isIgnoredByIgnoreFilesSync = (patterns, options) => {
17445
- const { cwd, suppressErrors, deep, ignore } = normalizeOptions(options);
17446
- const paths = import_fast_glob.default.sync(patterns, {
17447
- cwd,
17448
- suppressErrors,
17449
- deep,
17450
- ignore,
17451
- ...ignoreFilesGlobOptions
17452
- });
17453
- const files = paths.map((filePath) => ({
17454
- filePath,
17455
- content: fs2.readFileSync(filePath, "utf8")
17456
- }));
17457
- return getIsIgnoredPredicate(files, cwd);
17458
- };
17459
-
17460
- // ../../node_modules/globby/index.js
17461
- var assertPatternsInput = (patterns) => {
17462
- if (patterns.some((pattern) => typeof pattern !== "string")) {
17463
- throw new TypeError("Patterns must be a string or an array of strings");
17464
- }
17465
- };
17466
- var normalizePathForDirectoryGlob = (filePath, cwd) => {
17467
- const path2 = isNegativePattern(filePath) ? filePath.slice(1) : filePath;
17468
- return nodePath.isAbsolute(path2) ? path2 : nodePath.join(cwd, path2);
17469
- };
17470
- var getDirectoryGlob = ({ directoryPath, files, extensions }) => {
17471
- const extensionGlob = extensions?.length > 0 ? `.${extensions.length > 1 ? `{${extensions.join(",")}}` : extensions[0]}` : "";
17472
- return files ? files.map((file) => nodePath.posix.join(directoryPath, `**/${nodePath.extname(file) ? file : `${file}${extensionGlob}`}`)) : [nodePath.posix.join(directoryPath, `**${extensionGlob ? `/*${extensionGlob}` : ""}`)];
17473
- };
17474
- var directoryToGlob = async (directoryPaths, {
17475
- cwd = process3.cwd(),
17476
- files,
17477
- extensions
17478
- } = {}) => {
17479
- const globs = await Promise.all(directoryPaths.map(async (directoryPath) => await isDirectory(normalizePathForDirectoryGlob(directoryPath, cwd)) ? getDirectoryGlob({ directoryPath, files, extensions }) : directoryPath));
17480
- return globs.flat();
17481
- };
17482
- var directoryToGlobSync = (directoryPaths, {
17483
- cwd = process3.cwd(),
17484
- files,
17485
- extensions
17486
- } = {}) => directoryPaths.flatMap((directoryPath) => isDirectorySync(normalizePathForDirectoryGlob(directoryPath, cwd)) ? getDirectoryGlob({ directoryPath, files, extensions }) : directoryPath);
17487
- var toPatternsArray = (patterns) => {
17488
- patterns = [...new Set([patterns].flat())];
17489
- assertPatternsInput(patterns);
17490
- return patterns;
17491
- };
17492
- var checkCwdOption = (cwd) => {
17493
- if (!cwd) {
17494
- return;
17495
- }
17496
- let stat;
17497
- try {
17498
- stat = fs3.statSync(cwd);
17499
- } catch {
17500
- return;
17501
- }
17502
- if (!stat.isDirectory()) {
17503
- throw new Error("The `cwd` option must be a path to a directory");
17504
- }
17505
- };
17506
- var normalizeOptions2 = (options = {}) => {
17507
- options = {
17508
- ...options,
17509
- ignore: options.ignore ?? [],
17510
- expandDirectories: options.expandDirectories ?? true,
17511
- cwd: toPath(options.cwd)
17512
- };
17513
- checkCwdOption(options.cwd);
17514
- return options;
17515
- };
17516
- var normalizeArguments = (function_) => async (patterns, options) => function_(toPatternsArray(patterns), normalizeOptions2(options));
17517
- var normalizeArgumentsSync = (function_) => (patterns, options) => function_(toPatternsArray(patterns), normalizeOptions2(options));
17518
- var getIgnoreFilesPatterns = (options) => {
17519
- const { ignoreFiles, gitignore } = options;
17520
- const patterns = ignoreFiles ? toPatternsArray(ignoreFiles) : [];
17521
- if (gitignore) {
17522
- patterns.push(GITIGNORE_FILES_PATTERN);
17523
- }
17524
- return patterns;
17525
- };
17526
- var getFilter = async (options) => {
17527
- const ignoreFilesPatterns = getIgnoreFilesPatterns(options);
17528
- return createFilterFunction(ignoreFilesPatterns.length > 0 && await isIgnoredByIgnoreFiles(ignoreFilesPatterns, options));
17529
- };
17530
- var getFilterSync = (options) => {
17531
- const ignoreFilesPatterns = getIgnoreFilesPatterns(options);
17532
- return createFilterFunction(ignoreFilesPatterns.length > 0 && isIgnoredByIgnoreFilesSync(ignoreFilesPatterns, options));
17533
- };
17534
- var createFilterFunction = (isIgnored) => {
17535
- const seen = new Set;
17536
- return (fastGlobResult) => {
17537
- const pathKey = nodePath.normalize(fastGlobResult.path ?? fastGlobResult);
17538
- if (seen.has(pathKey) || isIgnored && isIgnored(pathKey)) {
17539
- return false;
17540
- }
17541
- seen.add(pathKey);
17542
- return true;
17543
- };
17544
- };
17545
- var unionFastGlobResults = (results, filter) => results.flat().filter((fastGlobResult) => filter(fastGlobResult));
17546
- var convertNegativePatterns = (patterns, options) => {
17547
- const tasks = [];
17548
- while (patterns.length > 0) {
17549
- const index = patterns.findIndex((pattern) => isNegativePattern(pattern));
17550
- if (index === -1) {
17551
- tasks.push({ patterns, options });
17552
- break;
17553
- }
17554
- const ignorePattern = patterns[index].slice(1);
17555
- for (const task of tasks) {
17556
- task.options.ignore.push(ignorePattern);
17557
- }
17558
- if (index !== 0) {
17559
- tasks.push({
17560
- patterns: patterns.slice(0, index),
17561
- options: {
17562
- ...options,
17563
- ignore: [
17564
- ...options.ignore,
17565
- ignorePattern
17566
- ]
17567
- }
17568
- });
17569
- }
17570
- patterns = patterns.slice(index + 1);
17571
- }
17572
- return tasks;
17573
- };
17574
- var normalizeExpandDirectoriesOption = (options, cwd) => ({
17575
- ...cwd ? { cwd } : {},
17576
- ...Array.isArray(options) ? { files: options } : options
17577
- });
17578
- var generateTasks = async (patterns, options) => {
17579
- const globTasks = convertNegativePatterns(patterns, options);
17580
- const { cwd, expandDirectories } = options;
17581
- if (!expandDirectories) {
17582
- return globTasks;
17583
- }
17584
- const directoryToGlobOptions = normalizeExpandDirectoriesOption(expandDirectories, cwd);
17585
- return Promise.all(globTasks.map(async (task) => {
17586
- let { patterns: patterns2, options: options2 } = task;
17587
- [
17588
- patterns2,
17589
- options2.ignore
17590
- ] = await Promise.all([
17591
- directoryToGlob(patterns2, directoryToGlobOptions),
17592
- directoryToGlob(options2.ignore, { cwd })
17593
- ]);
17594
- return { patterns: patterns2, options: options2 };
17595
- }));
17596
- };
17597
- var generateTasksSync = (patterns, options) => {
17598
- const globTasks = convertNegativePatterns(patterns, options);
17599
- const { cwd, expandDirectories } = options;
17600
- if (!expandDirectories) {
17601
- return globTasks;
17602
- }
17603
- const directoryToGlobSyncOptions = normalizeExpandDirectoriesOption(expandDirectories, cwd);
17604
- return globTasks.map((task) => {
17605
- let { patterns: patterns2, options: options2 } = task;
17606
- patterns2 = directoryToGlobSync(patterns2, directoryToGlobSyncOptions);
17607
- options2.ignore = directoryToGlobSync(options2.ignore, { cwd });
17608
- return { patterns: patterns2, options: options2 };
17609
- });
17610
- };
17611
- var globby = normalizeArguments(async (patterns, options) => {
17612
- const [
17613
- tasks,
17614
- filter
17615
- ] = await Promise.all([
17616
- generateTasks(patterns, options),
17617
- getFilter(options)
17618
- ]);
17619
- const results = await Promise.all(tasks.map((task) => import_fast_glob2.default(task.patterns, task.options)));
17620
- return unionFastGlobResults(results, filter);
17621
- });
17622
- var globbySync = normalizeArgumentsSync((patterns, options) => {
17623
- const tasks = generateTasksSync(patterns, options);
17624
- const filter = getFilterSync(options);
17625
- const results = tasks.map((task) => import_fast_glob2.default.sync(task.patterns, task.options));
17626
- return unionFastGlobResults(results, filter);
17627
- });
17628
- var globbyStream = normalizeArgumentsSync((patterns, options) => {
17629
- const tasks = generateTasksSync(patterns, options);
17630
- const filter = getFilterSync(options);
17631
- const streams = tasks.map((task) => import_fast_glob2.default.stream(task.patterns, task.options));
17632
- const stream = mergeStreams(streams).filter((fastGlobResult) => filter(fastGlobResult));
17633
- return stream;
17634
- });
17635
- var isDynamicPattern = normalizeArgumentsSync((patterns, options) => patterns.some((pattern) => import_fast_glob2.default.isDynamicPattern(pattern, options)));
17636
- var generateGlobTasks = normalizeArguments(generateTasks);
17637
- var generateGlobTasksSync = normalizeArgumentsSync(generateTasksSync);
17638
-
17639
- // ../sdk/src/core/indexer.ts
17640
- class CodebaseIndexer {
17641
- projectPath;
17642
- indexPath;
17643
- constructor(projectPath) {
17644
- this.projectPath = projectPath;
17645
- this.indexPath = join3(projectPath, ".locus", "codebase-index.json");
17646
- }
17647
- async index(onProgress, treeSummarizer) {
17648
- if (!treeSummarizer) {
17649
- throw new Error("A treeSummarizer is required for this indexing method.");
17650
- }
17651
- if (onProgress)
17652
- onProgress("Generating file tree...");
17653
- const gitmodulesPath = join3(this.projectPath, ".gitmodules");
17654
- const submoduleIgnores = [];
17655
- if (existsSync2(gitmodulesPath)) {
17656
- try {
17657
- const content = readFileSync2(gitmodulesPath, "utf-8");
17658
- const lines = content.split(`
17659
- `);
17660
- for (const line of lines) {
17661
- const match = line.match(/^\s*path\s*=\s*(.*)$/);
17662
- const path2 = match?.[1]?.trim();
17663
- if (path2) {
17664
- submoduleIgnores.push(`${path2}/**`);
17665
- submoduleIgnores.push(`**/${path2}/**`);
17666
- }
17667
- }
17668
- } catch {}
17669
- }
17670
- const files = await globby(["**/*"], {
17671
- cwd: this.projectPath,
17672
- gitignore: true,
17673
- ignore: [
17674
- ...submoduleIgnores,
17675
- "**/node_modules/**",
17676
- "**/dist/**",
17677
- "**/build/**",
17678
- "**/target/**",
17679
- "**/bin/**",
17680
- "**/obj/**",
17681
- "**/.next/**",
17682
- "**/.svelte-kit/**",
17683
- "**/.nuxt/**",
17684
- "**/.cache/**",
17685
- "**/out/**",
17686
- "**/__tests__/**",
17687
- "**/coverage/**",
17688
- "**/*.test.*",
17689
- "**/*.spec.*",
17690
- "**/*.d.ts",
17691
- "**/tsconfig.tsbuildinfo",
17692
- "**/.locus/*.json",
17693
- "**/.locus/*.md",
17694
- "**/.locus/!(artifacts)/**",
17695
- "**/.git/**",
17696
- "**/.svn/**",
17697
- "**/.hg/**",
17698
- "**/.vscode/**",
17699
- "**/.idea/**",
17700
- "**/.DS_Store",
17701
- "**/bun.lock",
17702
- "**/package-lock.json",
17703
- "**/yarn.lock",
17704
- "**/pnpm-lock.yaml",
17705
- "**/Cargo.lock",
17706
- "**/go.sum",
17707
- "**/poetry.lock",
17708
- "**/*.{png,jpg,jpeg,gif,svg,ico,mp4,webm,wav,mp3,woff,woff2,eot,ttf,otf,pdf,zip,tar.gz,rar}"
17709
- ]
17710
- });
17711
- const treeString = files.join(`
17712
- `);
17713
- if (onProgress)
17714
- onProgress("AI is analyzing codebase structure...");
17715
- const index = await treeSummarizer(treeString);
17716
- index.lastIndexed = new Date().toISOString();
17717
- return index;
17718
- }
17719
- loadIndex() {
17720
- if (existsSync2(this.indexPath)) {
17721
- try {
17722
- return JSON.parse(readFileSync2(this.indexPath, "utf-8"));
17723
- } catch {
17724
- return null;
17725
- }
17726
- }
17727
- return null;
17728
- }
17729
- saveIndex(index) {
17730
- const dir = dirname(this.indexPath);
17731
- if (!existsSync2(dir)) {
17732
- mkdirSync2(dir, { recursive: true });
17733
- }
17734
- writeFileSync(this.indexPath, JSON.stringify(index, null, 2));
17735
- }
17736
- }
17737
-
17738
- // ../sdk/src/agent/codebase-indexer-service.ts
17739
- class CodebaseIndexerService {
17740
- deps;
17741
- indexer;
17742
- constructor(deps) {
17743
- this.deps = deps;
17744
- this.indexer = new CodebaseIndexer(deps.projectPath);
17745
- }
17746
- async reindex() {
17747
- try {
17748
- this.deps.log("Reindexing codebase...", "info");
17749
- const index = await this.indexer.index((msg) => this.deps.log(msg, "info"), async (tree) => {
17750
- const prompt = `You are a codebase analysis expert. Analyze the file tree and extract:
17751
- 1. Key symbols (classes, functions, types) and their locations
17752
- 2. Responsibilities of each directory/file
17753
- 3. Overall project structure
17754
-
17755
- Analyze this file tree and provide a JSON response with:
17756
- - "symbols": object mapping symbol names to file paths (array)
17757
- - "responsibilities": object mapping paths to brief descriptions
17758
-
17759
- File tree:
17760
- ${tree}
17761
-
17762
- Return ONLY valid JSON, no markdown formatting.`;
17763
- const response = await this.deps.aiRunner.run(prompt, true);
17764
- const jsonMatch = response.match(/\{[\s\S]*\}/);
17765
- if (jsonMatch) {
17766
- return JSON.parse(jsonMatch[0]);
17767
- }
17768
- return { symbols: {}, responsibilities: {}, lastIndexed: "" };
17769
- });
17770
- this.indexer.saveIndex(index);
17771
- this.deps.log("Codebase reindexed successfully", "success");
17772
- } catch (error) {
17773
- this.deps.log(`Failed to reindex codebase: ${error}`, "error");
17774
- }
17775
- }
17776
- }
17777
- // ../sdk/src/agent/sprint-planner.ts
17778
- class SprintPlanner {
17779
- deps;
17780
- constructor(deps) {
17781
- this.deps = deps;
17782
- }
17783
- async planSprint(sprint, tasks) {
17784
- this.deps.log(`Planning sprint: ${sprint.name}`, "info");
17785
- try {
17786
- const taskList = tasks.map((t) => `- [${t.id}] ${t.title}: ${t.description || "No description"}`).join(`
17787
- `);
17788
- const planningPrompt = `# Sprint Planning: ${sprint.name}
17789
-
17790
- You are an expert project manager and lead engineer. You need to create a mindmap and execution plan for the following tasks in this sprint.
17791
-
17792
- ## Tasks
17793
- ${taskList}
17794
-
17795
- ## Instructions
17796
- 1. Analyze dependencies between these tasks.
17797
- 2. Prioritize them for the most efficient execution.
17798
- 3. Create a mindmap (in Markdown or Mermaid format) that visualizes the sprint structure.
17799
- 4. Output your final plan. The plan should clearly state the order of execution.
17800
-
17801
- **IMPORTANT**:
17802
- - Do NOT create any files on the filesystem during this planning phase.
17803
- - Avoid using absolute local paths (e.g., /Users/...) in your output. Use relative paths starting from the project root if necessary.
17804
- - Your output will be saved as the official sprint mindmap on the server.`;
17805
- const plan = await this.deps.aiRunner.run(planningPrompt, true);
17806
- this.deps.log("Sprint mindmap generated and posted to server.", "success");
17807
- return plan;
17808
- } catch (error) {
17809
- this.deps.log(`Sprint planning failed: ${error}`, "error");
17810
- return sprint.mindmap || "";
17811
- }
17812
- }
17813
- }
17814
- // ../sdk/src/core/prompt-builder.ts
17815
- import { existsSync as existsSync3, readFileSync as readFileSync3 } from "node:fs";
17816
-
17817
- // ../../node_modules/zod/v4/classic/external.js
17818
- var exports_external = {};
17819
- __export(exports_external, {
17820
- xor: () => xor,
17821
- xid: () => xid2,
17822
- void: () => _void2,
17823
- uuidv7: () => uuidv7,
17824
- uuidv6: () => uuidv6,
17825
- uuidv4: () => uuidv4,
17826
- uuid: () => uuid2,
17827
- util: () => exports_util,
17828
- url: () => url,
17829
- uppercase: () => _uppercase,
17830
- unknown: () => unknown,
17831
- union: () => union,
17832
- undefined: () => _undefined3,
17833
- ulid: () => ulid2,
17834
- uint64: () => uint64,
17835
- uint32: () => uint32,
17836
- tuple: () => tuple,
17837
- trim: () => _trim,
17838
- treeifyError: () => treeifyError,
17839
- transform: () => transform,
17840
- toUpperCase: () => _toUpperCase,
17841
- toLowerCase: () => _toLowerCase,
17842
- toJSONSchema: () => toJSONSchema,
17843
- templateLiteral: () => templateLiteral,
17844
- symbol: () => symbol,
17845
- superRefine: () => superRefine,
17846
- success: () => success,
17847
- stringbool: () => stringbool,
17848
- stringFormat: () => stringFormat,
17849
- string: () => string2,
17850
- strictObject: () => strictObject,
17851
- startsWith: () => _startsWith,
17852
- slugify: () => _slugify,
17853
- size: () => _size,
17854
- setErrorMap: () => setErrorMap,
17855
- set: () => set,
17856
- safeParseAsync: () => safeParseAsync2,
17857
- safeParse: () => safeParse2,
17858
- safeEncodeAsync: () => safeEncodeAsync2,
17859
- safeEncode: () => safeEncode2,
17860
- safeDecodeAsync: () => safeDecodeAsync2,
17861
- safeDecode: () => safeDecode2,
17862
- registry: () => registry,
17863
- regexes: () => exports_regexes,
17864
- regex: () => _regex,
17865
- refine: () => refine,
17866
- record: () => record,
17867
- readonly: () => readonly,
17868
- property: () => _property,
17869
- promise: () => promise,
17870
- prettifyError: () => prettifyError,
17871
- preprocess: () => preprocess,
17872
- prefault: () => prefault,
17873
- positive: () => _positive,
17874
- pipe: () => pipe,
17875
- partialRecord: () => partialRecord,
17876
- parseAsync: () => parseAsync2,
17877
- parse: () => parse3,
17878
- overwrite: () => _overwrite,
17879
- optional: () => optional,
17880
- object: () => object,
17881
- number: () => number2,
17882
- nullish: () => nullish2,
17883
- nullable: () => nullable,
17884
- null: () => _null3,
17885
- normalize: () => _normalize,
17886
- nonpositive: () => _nonpositive,
17887
- nonoptional: () => nonoptional,
17888
- nonnegative: () => _nonnegative,
17889
- never: () => never,
17890
- negative: () => _negative,
17891
- nativeEnum: () => nativeEnum,
17892
- nanoid: () => nanoid2,
17893
- nan: () => nan,
17894
- multipleOf: () => _multipleOf,
17895
- minSize: () => _minSize,
17896
- minLength: () => _minLength,
17897
- mime: () => _mime,
17898
- meta: () => meta2,
17899
- maxSize: () => _maxSize,
17900
- maxLength: () => _maxLength,
17901
- map: () => map,
17902
- mac: () => mac2,
17903
- lte: () => _lte,
17904
- lt: () => _lt,
17905
- lowercase: () => _lowercase,
17906
- looseRecord: () => looseRecord,
17907
- looseObject: () => looseObject,
17908
- locales: () => exports_locales,
17909
- literal: () => literal,
17910
- length: () => _length,
17911
- lazy: () => lazy,
17912
- ksuid: () => ksuid2,
17913
- keyof: () => keyof,
17914
- jwt: () => jwt,
17915
- json: () => json,
17916
- iso: () => exports_iso,
17917
- ipv6: () => ipv62,
17918
- ipv4: () => ipv42,
17919
- intersection: () => intersection,
17920
- int64: () => int64,
17921
- int32: () => int32,
17922
- int: () => int,
17923
- instanceof: () => _instanceof,
17924
- includes: () => _includes,
17925
- httpUrl: () => httpUrl,
17926
- hostname: () => hostname2,
17927
- hex: () => hex2,
17928
- hash: () => hash,
17929
- guid: () => guid2,
17930
- gte: () => _gte,
17931
- gt: () => _gt,
17932
- globalRegistry: () => globalRegistry,
17933
- getErrorMap: () => getErrorMap,
17934
- function: () => _function,
17935
- fromJSONSchema: () => fromJSONSchema,
17936
- formatError: () => formatError,
17937
- float64: () => float64,
17938
- float32: () => float32,
17939
- flattenError: () => flattenError,
17940
- file: () => file,
17941
- exactOptional: () => exactOptional,
17942
- enum: () => _enum2,
17943
- endsWith: () => _endsWith,
17944
- encodeAsync: () => encodeAsync2,
17945
- encode: () => encode2,
17946
- emoji: () => emoji2,
17947
- email: () => email2,
17948
- e164: () => e1642,
17949
- discriminatedUnion: () => discriminatedUnion,
17950
- describe: () => describe2,
17951
- decodeAsync: () => decodeAsync2,
17952
- decode: () => decode2,
17953
- date: () => date3,
17954
- custom: () => custom,
17955
- cuid2: () => cuid22,
17956
- cuid: () => cuid3,
17957
- core: () => exports_core2,
17958
- config: () => config,
17959
- coerce: () => exports_coerce,
17960
- codec: () => codec,
17961
- clone: () => clone,
17962
- cidrv6: () => cidrv62,
17963
- cidrv4: () => cidrv42,
17964
- check: () => check,
17965
- catch: () => _catch2,
17966
- boolean: () => boolean2,
17967
- bigint: () => bigint2,
17968
- base64url: () => base64url2,
17969
- base64: () => base642,
17970
- array: () => array,
17971
- any: () => any,
17972
- _function: () => _function,
17973
- _default: () => _default2,
17974
- _ZodString: () => _ZodString,
17975
- ZodXor: () => ZodXor,
17976
- ZodXID: () => ZodXID,
17977
- ZodVoid: () => ZodVoid,
17978
- ZodUnknown: () => ZodUnknown,
17979
- ZodUnion: () => ZodUnion,
17980
- ZodUndefined: () => ZodUndefined,
17981
- ZodUUID: () => ZodUUID,
17982
- ZodURL: () => ZodURL,
17983
- ZodULID: () => ZodULID,
17984
- ZodType: () => ZodType,
17985
- ZodTuple: () => ZodTuple,
17986
- ZodTransform: () => ZodTransform,
17987
- ZodTemplateLiteral: () => ZodTemplateLiteral,
17988
- ZodSymbol: () => ZodSymbol,
17989
- ZodSuccess: () => ZodSuccess,
17990
- ZodStringFormat: () => ZodStringFormat,
17991
- ZodString: () => ZodString,
17992
- ZodSet: () => ZodSet,
17993
- ZodRecord: () => ZodRecord,
17994
- ZodRealError: () => ZodRealError,
17995
- ZodReadonly: () => ZodReadonly,
17996
- ZodPromise: () => ZodPromise,
17997
- ZodPrefault: () => ZodPrefault,
17998
- ZodPipe: () => ZodPipe,
17999
- ZodOptional: () => ZodOptional,
18000
- ZodObject: () => ZodObject,
18001
- ZodNumberFormat: () => ZodNumberFormat,
18002
- ZodNumber: () => ZodNumber,
18003
- ZodNullable: () => ZodNullable,
18004
- ZodNull: () => ZodNull,
18005
- ZodNonOptional: () => ZodNonOptional,
18006
- ZodNever: () => ZodNever,
18007
- ZodNanoID: () => ZodNanoID,
18008
- ZodNaN: () => ZodNaN,
18009
- ZodMap: () => ZodMap,
18010
- ZodMAC: () => ZodMAC,
18011
- ZodLiteral: () => ZodLiteral,
18012
- ZodLazy: () => ZodLazy,
18013
- ZodKSUID: () => ZodKSUID,
18014
- ZodJWT: () => ZodJWT,
18015
- ZodIssueCode: () => ZodIssueCode,
18016
- ZodIntersection: () => ZodIntersection,
18017
- ZodISOTime: () => ZodISOTime,
18018
- ZodISODuration: () => ZodISODuration,
18019
- ZodISODateTime: () => ZodISODateTime,
18020
- ZodISODate: () => ZodISODate,
18021
- ZodIPv6: () => ZodIPv6,
18022
- ZodIPv4: () => ZodIPv4,
18023
- ZodGUID: () => ZodGUID,
18024
- ZodFunction: () => ZodFunction,
18025
- ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
18026
- ZodFile: () => ZodFile,
18027
- ZodExactOptional: () => ZodExactOptional,
18028
- ZodError: () => ZodError,
18029
- ZodEnum: () => ZodEnum,
18030
- ZodEmoji: () => ZodEmoji,
18031
- ZodEmail: () => ZodEmail,
18032
- ZodE164: () => ZodE164,
18033
- ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
18034
- ZodDefault: () => ZodDefault,
18035
- ZodDate: () => ZodDate,
18036
- ZodCustomStringFormat: () => ZodCustomStringFormat,
18037
- ZodCustom: () => ZodCustom,
18038
- ZodCodec: () => ZodCodec,
18039
- ZodCatch: () => ZodCatch,
18040
- ZodCUID2: () => ZodCUID2,
18041
- ZodCUID: () => ZodCUID,
18042
- ZodCIDRv6: () => ZodCIDRv6,
18043
- ZodCIDRv4: () => ZodCIDRv4,
18044
- ZodBoolean: () => ZodBoolean,
18045
- ZodBigIntFormat: () => ZodBigIntFormat,
18046
- ZodBigInt: () => ZodBigInt,
18047
- ZodBase64URL: () => ZodBase64URL,
18048
- ZodBase64: () => ZodBase64,
18049
- ZodArray: () => ZodArray,
18050
- ZodAny: () => ZodAny,
18051
- TimePrecision: () => TimePrecision,
18052
- NEVER: () => NEVER,
18053
- $output: () => $output,
18054
- $input: () => $input,
18055
- $brand: () => $brand
18056
- });
17032
+ // ../../node_modules/zod/v4/classic/external.js
17033
+ var exports_external = {};
17034
+ __export(exports_external, {
17035
+ xor: () => xor,
17036
+ xid: () => xid2,
17037
+ void: () => _void2,
17038
+ uuidv7: () => uuidv7,
17039
+ uuidv6: () => uuidv6,
17040
+ uuidv4: () => uuidv4,
17041
+ uuid: () => uuid2,
17042
+ util: () => exports_util,
17043
+ url: () => url,
17044
+ uppercase: () => _uppercase,
17045
+ unknown: () => unknown,
17046
+ union: () => union,
17047
+ undefined: () => _undefined3,
17048
+ ulid: () => ulid2,
17049
+ uint64: () => uint64,
17050
+ uint32: () => uint32,
17051
+ tuple: () => tuple,
17052
+ trim: () => _trim,
17053
+ treeifyError: () => treeifyError,
17054
+ transform: () => transform,
17055
+ toUpperCase: () => _toUpperCase,
17056
+ toLowerCase: () => _toLowerCase,
17057
+ toJSONSchema: () => toJSONSchema,
17058
+ templateLiteral: () => templateLiteral,
17059
+ symbol: () => symbol,
17060
+ superRefine: () => superRefine,
17061
+ success: () => success,
17062
+ stringbool: () => stringbool,
17063
+ stringFormat: () => stringFormat,
17064
+ string: () => string2,
17065
+ strictObject: () => strictObject,
17066
+ startsWith: () => _startsWith,
17067
+ slugify: () => _slugify,
17068
+ size: () => _size,
17069
+ setErrorMap: () => setErrorMap,
17070
+ set: () => set,
17071
+ safeParseAsync: () => safeParseAsync2,
17072
+ safeParse: () => safeParse2,
17073
+ safeEncodeAsync: () => safeEncodeAsync2,
17074
+ safeEncode: () => safeEncode2,
17075
+ safeDecodeAsync: () => safeDecodeAsync2,
17076
+ safeDecode: () => safeDecode2,
17077
+ registry: () => registry,
17078
+ regexes: () => exports_regexes,
17079
+ regex: () => _regex,
17080
+ refine: () => refine,
17081
+ record: () => record,
17082
+ readonly: () => readonly,
17083
+ property: () => _property,
17084
+ promise: () => promise,
17085
+ prettifyError: () => prettifyError,
17086
+ preprocess: () => preprocess,
17087
+ prefault: () => prefault,
17088
+ positive: () => _positive,
17089
+ pipe: () => pipe,
17090
+ partialRecord: () => partialRecord,
17091
+ parseAsync: () => parseAsync2,
17092
+ parse: () => parse3,
17093
+ overwrite: () => _overwrite,
17094
+ optional: () => optional,
17095
+ object: () => object,
17096
+ number: () => number2,
17097
+ nullish: () => nullish2,
17098
+ nullable: () => nullable,
17099
+ null: () => _null3,
17100
+ normalize: () => _normalize,
17101
+ nonpositive: () => _nonpositive,
17102
+ nonoptional: () => nonoptional,
17103
+ nonnegative: () => _nonnegative,
17104
+ never: () => never,
17105
+ negative: () => _negative,
17106
+ nativeEnum: () => nativeEnum,
17107
+ nanoid: () => nanoid2,
17108
+ nan: () => nan,
17109
+ multipleOf: () => _multipleOf,
17110
+ minSize: () => _minSize,
17111
+ minLength: () => _minLength,
17112
+ mime: () => _mime,
17113
+ meta: () => meta2,
17114
+ maxSize: () => _maxSize,
17115
+ maxLength: () => _maxLength,
17116
+ map: () => map,
17117
+ mac: () => mac2,
17118
+ lte: () => _lte,
17119
+ lt: () => _lt,
17120
+ lowercase: () => _lowercase,
17121
+ looseRecord: () => looseRecord,
17122
+ looseObject: () => looseObject,
17123
+ locales: () => exports_locales,
17124
+ literal: () => literal,
17125
+ length: () => _length,
17126
+ lazy: () => lazy,
17127
+ ksuid: () => ksuid2,
17128
+ keyof: () => keyof,
17129
+ jwt: () => jwt,
17130
+ json: () => json,
17131
+ iso: () => exports_iso,
17132
+ ipv6: () => ipv62,
17133
+ ipv4: () => ipv42,
17134
+ intersection: () => intersection,
17135
+ int64: () => int64,
17136
+ int32: () => int32,
17137
+ int: () => int,
17138
+ instanceof: () => _instanceof,
17139
+ includes: () => _includes,
17140
+ httpUrl: () => httpUrl,
17141
+ hostname: () => hostname2,
17142
+ hex: () => hex2,
17143
+ hash: () => hash,
17144
+ guid: () => guid2,
17145
+ gte: () => _gte,
17146
+ gt: () => _gt,
17147
+ globalRegistry: () => globalRegistry,
17148
+ getErrorMap: () => getErrorMap,
17149
+ function: () => _function,
17150
+ fromJSONSchema: () => fromJSONSchema,
17151
+ formatError: () => formatError,
17152
+ float64: () => float64,
17153
+ float32: () => float32,
17154
+ flattenError: () => flattenError,
17155
+ file: () => file,
17156
+ exactOptional: () => exactOptional,
17157
+ enum: () => _enum2,
17158
+ endsWith: () => _endsWith,
17159
+ encodeAsync: () => encodeAsync2,
17160
+ encode: () => encode2,
17161
+ emoji: () => emoji2,
17162
+ email: () => email2,
17163
+ e164: () => e1642,
17164
+ discriminatedUnion: () => discriminatedUnion,
17165
+ describe: () => describe2,
17166
+ decodeAsync: () => decodeAsync2,
17167
+ decode: () => decode2,
17168
+ date: () => date3,
17169
+ custom: () => custom,
17170
+ cuid2: () => cuid22,
17171
+ cuid: () => cuid3,
17172
+ core: () => exports_core2,
17173
+ config: () => config,
17174
+ coerce: () => exports_coerce,
17175
+ codec: () => codec,
17176
+ clone: () => clone,
17177
+ cidrv6: () => cidrv62,
17178
+ cidrv4: () => cidrv42,
17179
+ check: () => check,
17180
+ catch: () => _catch2,
17181
+ boolean: () => boolean2,
17182
+ bigint: () => bigint2,
17183
+ base64url: () => base64url2,
17184
+ base64: () => base642,
17185
+ array: () => array,
17186
+ any: () => any,
17187
+ _function: () => _function,
17188
+ _default: () => _default2,
17189
+ _ZodString: () => _ZodString,
17190
+ ZodXor: () => ZodXor,
17191
+ ZodXID: () => ZodXID,
17192
+ ZodVoid: () => ZodVoid,
17193
+ ZodUnknown: () => ZodUnknown,
17194
+ ZodUnion: () => ZodUnion,
17195
+ ZodUndefined: () => ZodUndefined,
17196
+ ZodUUID: () => ZodUUID,
17197
+ ZodURL: () => ZodURL,
17198
+ ZodULID: () => ZodULID,
17199
+ ZodType: () => ZodType,
17200
+ ZodTuple: () => ZodTuple,
17201
+ ZodTransform: () => ZodTransform,
17202
+ ZodTemplateLiteral: () => ZodTemplateLiteral,
17203
+ ZodSymbol: () => ZodSymbol,
17204
+ ZodSuccess: () => ZodSuccess,
17205
+ ZodStringFormat: () => ZodStringFormat,
17206
+ ZodString: () => ZodString,
17207
+ ZodSet: () => ZodSet,
17208
+ ZodRecord: () => ZodRecord,
17209
+ ZodRealError: () => ZodRealError,
17210
+ ZodReadonly: () => ZodReadonly,
17211
+ ZodPromise: () => ZodPromise,
17212
+ ZodPrefault: () => ZodPrefault,
17213
+ ZodPipe: () => ZodPipe,
17214
+ ZodOptional: () => ZodOptional,
17215
+ ZodObject: () => ZodObject,
17216
+ ZodNumberFormat: () => ZodNumberFormat,
17217
+ ZodNumber: () => ZodNumber,
17218
+ ZodNullable: () => ZodNullable,
17219
+ ZodNull: () => ZodNull,
17220
+ ZodNonOptional: () => ZodNonOptional,
17221
+ ZodNever: () => ZodNever,
17222
+ ZodNanoID: () => ZodNanoID,
17223
+ ZodNaN: () => ZodNaN,
17224
+ ZodMap: () => ZodMap,
17225
+ ZodMAC: () => ZodMAC,
17226
+ ZodLiteral: () => ZodLiteral,
17227
+ ZodLazy: () => ZodLazy,
17228
+ ZodKSUID: () => ZodKSUID,
17229
+ ZodJWT: () => ZodJWT,
17230
+ ZodIssueCode: () => ZodIssueCode,
17231
+ ZodIntersection: () => ZodIntersection,
17232
+ ZodISOTime: () => ZodISOTime,
17233
+ ZodISODuration: () => ZodISODuration,
17234
+ ZodISODateTime: () => ZodISODateTime,
17235
+ ZodISODate: () => ZodISODate,
17236
+ ZodIPv6: () => ZodIPv6,
17237
+ ZodIPv4: () => ZodIPv4,
17238
+ ZodGUID: () => ZodGUID,
17239
+ ZodFunction: () => ZodFunction,
17240
+ ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
17241
+ ZodFile: () => ZodFile,
17242
+ ZodExactOptional: () => ZodExactOptional,
17243
+ ZodError: () => ZodError,
17244
+ ZodEnum: () => ZodEnum,
17245
+ ZodEmoji: () => ZodEmoji,
17246
+ ZodEmail: () => ZodEmail,
17247
+ ZodE164: () => ZodE164,
17248
+ ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
17249
+ ZodDefault: () => ZodDefault,
17250
+ ZodDate: () => ZodDate,
17251
+ ZodCustomStringFormat: () => ZodCustomStringFormat,
17252
+ ZodCustom: () => ZodCustom,
17253
+ ZodCodec: () => ZodCodec,
17254
+ ZodCatch: () => ZodCatch,
17255
+ ZodCUID2: () => ZodCUID2,
17256
+ ZodCUID: () => ZodCUID,
17257
+ ZodCIDRv6: () => ZodCIDRv6,
17258
+ ZodCIDRv4: () => ZodCIDRv4,
17259
+ ZodBoolean: () => ZodBoolean,
17260
+ ZodBigIntFormat: () => ZodBigIntFormat,
17261
+ ZodBigInt: () => ZodBigInt,
17262
+ ZodBase64URL: () => ZodBase64URL,
17263
+ ZodBase64: () => ZodBase64,
17264
+ ZodArray: () => ZodArray,
17265
+ ZodAny: () => ZodAny,
17266
+ TimePrecision: () => TimePrecision,
17267
+ NEVER: () => NEVER,
17268
+ $output: () => $output,
17269
+ $input: () => $input,
17270
+ $brand: () => $brand
17271
+ });
18057
17272
 
18058
17273
  // ../../node_modules/zod/v4/core/index.js
18059
17274
  var exports_core2 = {};
@@ -18071,7 +17286,7 @@ __export(exports_core2, {
18071
17286
  safeDecode: () => safeDecode,
18072
17287
  registry: () => registry,
18073
17288
  regexes: () => exports_regexes,
18074
- process: () => process4,
17289
+ process: () => process2,
18075
17290
  prettifyError: () => prettifyError,
18076
17291
  parseAsync: () => parseAsync,
18077
17292
  parse: () => parse,
@@ -18579,10 +17794,10 @@ function mergeDefs(...defs) {
18579
17794
  function cloneDef(schema) {
18580
17795
  return mergeDefs(schema._zod.def);
18581
17796
  }
18582
- function getElementAtPath(obj, path2) {
18583
- if (!path2)
17797
+ function getElementAtPath(obj, path) {
17798
+ if (!path)
18584
17799
  return obj;
18585
- return path2.reduce((acc, key) => acc?.[key], obj);
17800
+ return path.reduce((acc, key) => acc?.[key], obj);
18586
17801
  }
18587
17802
  function promiseAllObject(promisesObj) {
18588
17803
  const keys = Object.keys(promisesObj);
@@ -18963,11 +18178,11 @@ function aborted(x, startIndex = 0) {
18963
18178
  }
18964
18179
  return false;
18965
18180
  }
18966
- function prefixIssues(path2, issues) {
18181
+ function prefixIssues(path, issues) {
18967
18182
  return issues.map((iss) => {
18968
18183
  var _a;
18969
18184
  (_a = iss).path ?? (_a.path = []);
18970
- iss.path.unshift(path2);
18185
+ iss.path.unshift(path);
18971
18186
  return iss;
18972
18187
  });
18973
18188
  }
@@ -19150,7 +18365,7 @@ function formatError(error, mapper = (issue2) => issue2.message) {
19150
18365
  }
19151
18366
  function treeifyError(error, mapper = (issue2) => issue2.message) {
19152
18367
  const result = { errors: [] };
19153
- const processError = (error2, path2 = []) => {
18368
+ const processError = (error2, path = []) => {
19154
18369
  var _a, _b;
19155
18370
  for (const issue2 of error2.issues) {
19156
18371
  if (issue2.code === "invalid_union" && issue2.errors.length) {
@@ -19160,7 +18375,7 @@ function treeifyError(error, mapper = (issue2) => issue2.message) {
19160
18375
  } else if (issue2.code === "invalid_element") {
19161
18376
  processError({ issues: issue2.issues }, issue2.path);
19162
18377
  } else {
19163
- const fullpath = [...path2, ...issue2.path];
18378
+ const fullpath = [...path, ...issue2.path];
19164
18379
  if (fullpath.length === 0) {
19165
18380
  result.errors.push(mapper(issue2));
19166
18381
  continue;
@@ -19192,8 +18407,8 @@ function treeifyError(error, mapper = (issue2) => issue2.message) {
19192
18407
  }
19193
18408
  function toDotPath(_path) {
19194
18409
  const segs = [];
19195
- const path2 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
19196
- for (const seg of path2) {
18410
+ const path = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
18411
+ for (const seg of path) {
19197
18412
  if (typeof seg === "number")
19198
18413
  segs.push(`[${seg}]`);
19199
18414
  else if (typeof seg === "symbol")
@@ -28535,7 +27750,7 @@ function initializeContext(params) {
28535
27750
  external: params?.external ?? undefined
28536
27751
  };
28537
27752
  }
28538
- function process4(schema, ctx, _params = { path: [], schemaPath: [] }) {
27753
+ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
28539
27754
  var _a2;
28540
27755
  const def = schema._zod.def;
28541
27756
  const seen = ctx.seen.get(schema);
@@ -28572,7 +27787,7 @@ function process4(schema, ctx, _params = { path: [], schemaPath: [] }) {
28572
27787
  if (parent) {
28573
27788
  if (!result.ref)
28574
27789
  result.ref = parent;
28575
- process4(parent, ctx, params);
27790
+ process2(parent, ctx, params);
28576
27791
  ctx.seen.get(parent).isParent = true;
28577
27792
  }
28578
27793
  }
@@ -28848,14 +28063,14 @@ function isTransforming(_schema, _ctx) {
28848
28063
  }
28849
28064
  var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
28850
28065
  const ctx = initializeContext({ ...params, processors });
28851
- process4(schema, ctx);
28066
+ process2(schema, ctx);
28852
28067
  extractDefs(ctx, schema);
28853
28068
  return finalize(ctx, schema);
28854
28069
  };
28855
28070
  var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
28856
28071
  const { libraryOptions, target } = params ?? {};
28857
28072
  const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
28858
- process4(schema, ctx);
28073
+ process2(schema, ctx);
28859
28074
  extractDefs(ctx, schema);
28860
28075
  return finalize(ctx, schema);
28861
28076
  };
@@ -29106,7 +28321,7 @@ var arrayProcessor = (schema, ctx, _json, params) => {
29106
28321
  if (typeof maximum === "number")
29107
28322
  json.maxItems = maximum;
29108
28323
  json.type = "array";
29109
- json.items = process4(def.element, ctx, { ...params, path: [...params.path, "items"] });
28324
+ json.items = process2(def.element, ctx, { ...params, path: [...params.path, "items"] });
29110
28325
  };
29111
28326
  var objectProcessor = (schema, ctx, _json, params) => {
29112
28327
  const json = _json;
@@ -29115,7 +28330,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
29115
28330
  json.properties = {};
29116
28331
  const shape = def.shape;
29117
28332
  for (const key in shape) {
29118
- json.properties[key] = process4(shape[key], ctx, {
28333
+ json.properties[key] = process2(shape[key], ctx, {
29119
28334
  ...params,
29120
28335
  path: [...params.path, "properties", key]
29121
28336
  });
@@ -29138,7 +28353,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
29138
28353
  if (ctx.io === "output")
29139
28354
  json.additionalProperties = false;
29140
28355
  } else if (def.catchall) {
29141
- json.additionalProperties = process4(def.catchall, ctx, {
28356
+ json.additionalProperties = process2(def.catchall, ctx, {
29142
28357
  ...params,
29143
28358
  path: [...params.path, "additionalProperties"]
29144
28359
  });
@@ -29147,7 +28362,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
29147
28362
  var unionProcessor = (schema, ctx, json, params) => {
29148
28363
  const def = schema._zod.def;
29149
28364
  const isExclusive = def.inclusive === false;
29150
- const options = def.options.map((x, i) => process4(x, ctx, {
28365
+ const options = def.options.map((x, i) => process2(x, ctx, {
29151
28366
  ...params,
29152
28367
  path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
29153
28368
  }));
@@ -29159,11 +28374,11 @@ var unionProcessor = (schema, ctx, json, params) => {
29159
28374
  };
29160
28375
  var intersectionProcessor = (schema, ctx, json, params) => {
29161
28376
  const def = schema._zod.def;
29162
- const a = process4(def.left, ctx, {
28377
+ const a = process2(def.left, ctx, {
29163
28378
  ...params,
29164
28379
  path: [...params.path, "allOf", 0]
29165
28380
  });
29166
- const b = process4(def.right, ctx, {
28381
+ const b = process2(def.right, ctx, {
29167
28382
  ...params,
29168
28383
  path: [...params.path, "allOf", 1]
29169
28384
  });
@@ -29180,11 +28395,11 @@ var tupleProcessor = (schema, ctx, _json, params) => {
29180
28395
  json.type = "array";
29181
28396
  const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
29182
28397
  const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
29183
- const prefixItems = def.items.map((x, i) => process4(x, ctx, {
28398
+ const prefixItems = def.items.map((x, i) => process2(x, ctx, {
29184
28399
  ...params,
29185
28400
  path: [...params.path, prefixPath, i]
29186
28401
  }));
29187
- const rest = def.rest ? process4(def.rest, ctx, {
28402
+ const rest = def.rest ? process2(def.rest, ctx, {
29188
28403
  ...params,
29189
28404
  path: [...params.path, restPath, ...ctx.target === "openapi-3.0" ? [def.items.length] : []]
29190
28405
  }) : null;
@@ -29224,7 +28439,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
29224
28439
  const keyBag = keyType._zod.bag;
29225
28440
  const patterns = keyBag?.patterns;
29226
28441
  if (def.mode === "loose" && patterns && patterns.size > 0) {
29227
- const valueSchema = process4(def.valueType, ctx, {
28442
+ const valueSchema = process2(def.valueType, ctx, {
29228
28443
  ...params,
29229
28444
  path: [...params.path, "patternProperties", "*"]
29230
28445
  });
@@ -29234,12 +28449,12 @@ var recordProcessor = (schema, ctx, _json, params) => {
29234
28449
  }
29235
28450
  } else {
29236
28451
  if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
29237
- json.propertyNames = process4(def.keyType, ctx, {
28452
+ json.propertyNames = process2(def.keyType, ctx, {
29238
28453
  ...params,
29239
28454
  path: [...params.path, "propertyNames"]
29240
28455
  });
29241
28456
  }
29242
- json.additionalProperties = process4(def.valueType, ctx, {
28457
+ json.additionalProperties = process2(def.valueType, ctx, {
29243
28458
  ...params,
29244
28459
  path: [...params.path, "additionalProperties"]
29245
28460
  });
@@ -29254,7 +28469,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
29254
28469
  };
29255
28470
  var nullableProcessor = (schema, ctx, json, params) => {
29256
28471
  const def = schema._zod.def;
29257
- const inner = process4(def.innerType, ctx, params);
28472
+ const inner = process2(def.innerType, ctx, params);
29258
28473
  const seen = ctx.seen.get(schema);
29259
28474
  if (ctx.target === "openapi-3.0") {
29260
28475
  seen.ref = def.innerType;
@@ -29265,20 +28480,20 @@ var nullableProcessor = (schema, ctx, json, params) => {
29265
28480
  };
29266
28481
  var nonoptionalProcessor = (schema, ctx, _json, params) => {
29267
28482
  const def = schema._zod.def;
29268
- process4(def.innerType, ctx, params);
28483
+ process2(def.innerType, ctx, params);
29269
28484
  const seen = ctx.seen.get(schema);
29270
28485
  seen.ref = def.innerType;
29271
28486
  };
29272
28487
  var defaultProcessor = (schema, ctx, json, params) => {
29273
28488
  const def = schema._zod.def;
29274
- process4(def.innerType, ctx, params);
28489
+ process2(def.innerType, ctx, params);
29275
28490
  const seen = ctx.seen.get(schema);
29276
28491
  seen.ref = def.innerType;
29277
28492
  json.default = JSON.parse(JSON.stringify(def.defaultValue));
29278
28493
  };
29279
28494
  var prefaultProcessor = (schema, ctx, json, params) => {
29280
28495
  const def = schema._zod.def;
29281
- process4(def.innerType, ctx, params);
28496
+ process2(def.innerType, ctx, params);
29282
28497
  const seen = ctx.seen.get(schema);
29283
28498
  seen.ref = def.innerType;
29284
28499
  if (ctx.io === "input")
@@ -29286,7 +28501,7 @@ var prefaultProcessor = (schema, ctx, json, params) => {
29286
28501
  };
29287
28502
  var catchProcessor = (schema, ctx, json, params) => {
29288
28503
  const def = schema._zod.def;
29289
- process4(def.innerType, ctx, params);
28504
+ process2(def.innerType, ctx, params);
29290
28505
  const seen = ctx.seen.get(schema);
29291
28506
  seen.ref = def.innerType;
29292
28507
  let catchValue;
@@ -29300,32 +28515,32 @@ var catchProcessor = (schema, ctx, json, params) => {
29300
28515
  var pipeProcessor = (schema, ctx, _json, params) => {
29301
28516
  const def = schema._zod.def;
29302
28517
  const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
29303
- process4(innerType, ctx, params);
28518
+ process2(innerType, ctx, params);
29304
28519
  const seen = ctx.seen.get(schema);
29305
28520
  seen.ref = innerType;
29306
28521
  };
29307
28522
  var readonlyProcessor = (schema, ctx, json, params) => {
29308
28523
  const def = schema._zod.def;
29309
- process4(def.innerType, ctx, params);
28524
+ process2(def.innerType, ctx, params);
29310
28525
  const seen = ctx.seen.get(schema);
29311
28526
  seen.ref = def.innerType;
29312
28527
  json.readOnly = true;
29313
28528
  };
29314
28529
  var promiseProcessor = (schema, ctx, _json, params) => {
29315
28530
  const def = schema._zod.def;
29316
- process4(def.innerType, ctx, params);
28531
+ process2(def.innerType, ctx, params);
29317
28532
  const seen = ctx.seen.get(schema);
29318
28533
  seen.ref = def.innerType;
29319
28534
  };
29320
28535
  var optionalProcessor = (schema, ctx, _json, params) => {
29321
28536
  const def = schema._zod.def;
29322
- process4(def.innerType, ctx, params);
28537
+ process2(def.innerType, ctx, params);
29323
28538
  const seen = ctx.seen.get(schema);
29324
28539
  seen.ref = def.innerType;
29325
28540
  };
29326
28541
  var lazyProcessor = (schema, ctx, _json, params) => {
29327
28542
  const innerType = schema._zod.innerType;
29328
- process4(innerType, ctx, params);
28543
+ process2(innerType, ctx, params);
29329
28544
  const seen = ctx.seen.get(schema);
29330
28545
  seen.ref = innerType;
29331
28546
  };
@@ -29377,7 +28592,7 @@ function toJSONSchema(input, params) {
29377
28592
  const defs = {};
29378
28593
  for (const entry of registry2._idmap.entries()) {
29379
28594
  const [_, schema] = entry;
29380
- process4(schema, ctx2);
28595
+ process2(schema, ctx2);
29381
28596
  }
29382
28597
  const schemas = {};
29383
28598
  const external = {
@@ -29400,7 +28615,7 @@ function toJSONSchema(input, params) {
29400
28615
  return { schemas };
29401
28616
  }
29402
28617
  const ctx = initializeContext({ ...params, processors: allProcessors });
29403
- process4(input, ctx);
28618
+ process2(input, ctx);
29404
28619
  extractDefs(ctx, input);
29405
28620
  return finalize(ctx, input);
29406
28621
  }
@@ -29446,7 +28661,7 @@ class JSONSchemaGenerator {
29446
28661
  });
29447
28662
  }
29448
28663
  process(schema, _params = { path: [], schemaPath: [] }) {
29449
- return process4(schema, this.ctx, _params);
28664
+ return process2(schema, this.ctx, _params);
29450
28665
  }
29451
28666
  emit(schema, _params) {
29452
28667
  if (_params) {
@@ -30940,13 +30155,13 @@ function resolveRef(ref, ctx) {
30940
30155
  if (!ref.startsWith("#")) {
30941
30156
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
30942
30157
  }
30943
- const path2 = ref.slice(1).split("/").filter(Boolean);
30944
- if (path2.length === 0) {
30158
+ const path = ref.slice(1).split("/").filter(Boolean);
30159
+ if (path.length === 0) {
30945
30160
  return ctx.rootSchema;
30946
30161
  }
30947
30162
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
30948
- if (path2[0] === defsKey) {
30949
- const key = path2[1];
30163
+ if (path[0] === defsKey) {
30164
+ const key = path[1];
30950
30165
  if (!key || !ctx.defs[key]) {
30951
30166
  throw new Error(`Reference not found: ${ref}`);
30952
30167
  }
@@ -31348,7 +30563,7 @@ function date4(params) {
31348
30563
  config(en_default());
31349
30564
  // ../shared/src/common.ts
31350
30565
  var BaseEntitySchema = exports_external.object({
31351
- id: exports_external.string().uuid(),
30566
+ id: exports_external.uuid(),
31352
30567
  createdAt: exports_external.union([exports_external.date(), exports_external.number()]),
31353
30568
  updatedAt: exports_external.union([exports_external.date(), exports_external.number()])
31354
30569
  });
@@ -31444,16 +30659,17 @@ var EventType;
31444
30659
  EventType2["MEMBER_INVITED"] = "MEMBER_INVITED";
31445
30660
  EventType2["SPRINT_CREATED"] = "SPRINT_CREATED";
31446
30661
  EventType2["SPRINT_STATUS_CHANGED"] = "SPRINT_STATUS_CHANGED";
30662
+ EventType2["SPRINT_DELETED"] = "SPRINT_DELETED";
31447
30663
  EventType2["CHECKLIST_INITIALIZED"] = "CHECKLIST_INITIALIZED";
31448
30664
  })(EventType ||= {});
31449
30665
  // ../shared/src/models/activity.ts
31450
30666
  var CommentSchema = BaseEntitySchema.extend({
31451
- taskId: exports_external.string().uuid(),
30667
+ taskId: exports_external.uuid(),
31452
30668
  author: exports_external.string().min(1),
31453
30669
  text: exports_external.string().min(1)
31454
30670
  });
31455
30671
  var ArtifactSchema = BaseEntitySchema.extend({
31456
- taskId: exports_external.string().uuid(),
30672
+ taskId: exports_external.uuid(),
31457
30673
  type: exports_external.string().min(1),
31458
30674
  title: exports_external.string().min(1),
31459
30675
  contentText: exports_external.string().optional(),
@@ -31470,8 +30686,8 @@ var TaskDeletedPayloadSchema = exports_external.object({
31470
30686
  });
31471
30687
  var StatusChangedPayloadSchema = exports_external.object({
31472
30688
  title: exports_external.string(),
31473
- oldStatus: exports_external.nativeEnum(TaskStatus),
31474
- newStatus: exports_external.nativeEnum(TaskStatus)
30689
+ oldStatus: exports_external.enum(TaskStatus),
30690
+ newStatus: exports_external.enum(TaskStatus)
31475
30691
  });
31476
30692
  var CommentAddedPayloadSchema = exports_external.object({
31477
30693
  title: exports_external.string(),
@@ -31490,13 +30706,13 @@ var MemberInvitedPayloadSchema = exports_external.object({
31490
30706
  });
31491
30707
  var SprintCreatedPayloadSchema = exports_external.object({
31492
30708
  name: exports_external.string(),
31493
- sprintId: exports_external.string().uuid()
30709
+ sprintId: exports_external.uuid()
31494
30710
  });
31495
30711
  var SprintStatusChangedPayloadSchema = exports_external.object({
31496
30712
  name: exports_external.string(),
31497
- sprintId: exports_external.string().uuid(),
31498
- oldStatus: exports_external.nativeEnum(SprintStatus),
31499
- newStatus: exports_external.nativeEnum(SprintStatus)
30713
+ sprintId: exports_external.uuid(),
30714
+ oldStatus: exports_external.enum(SprintStatus),
30715
+ newStatus: exports_external.enum(SprintStatus)
31500
30716
  });
31501
30717
  var ChecklistInitializedPayloadSchema = exports_external.object({
31502
30718
  itemCount: exports_external.number()
@@ -31559,9 +30775,9 @@ var EventPayloadSchema = exports_external.discriminatedUnion("type", [
31559
30775
  var EventSchema = exports_external.object({
31560
30776
  id: exports_external.string(),
31561
30777
  workspaceId: exports_external.string(),
31562
- taskId: exports_external.string().uuid().optional().nullable(),
30778
+ taskId: exports_external.uuid().optional().nullable(),
31563
30779
  userId: exports_external.string().optional().nullable(),
31564
- type: exports_external.nativeEnum(EventType),
30780
+ type: exports_external.enum(EventType),
31565
30781
  payload: exports_external.record(exports_external.string(), exports_external.unknown()),
31566
30782
  createdAt: exports_external.union([exports_external.date(), exports_external.number()])
31567
30783
  });
@@ -31595,14 +30811,14 @@ var ArtifactsResponseSchema = exports_external.object({
31595
30811
  artifacts: exports_external.array(ArtifactSchema)
31596
30812
  });
31597
30813
  var CreateArtifactSchema = exports_external.object({
31598
- taskId: exports_external.string().uuid(),
30814
+ taskId: exports_external.uuid(),
31599
30815
  type: exports_external.string().min(1),
31600
30816
  title: exports_external.string().min(1),
31601
30817
  contentText: exports_external.string().optional()
31602
30818
  });
31603
30819
  var ReportCiResultSchema = exports_external.object({
31604
- workspaceId: exports_external.string().uuid(),
31605
- taskId: exports_external.string().uuid().optional(),
30820
+ workspaceId: exports_external.uuid(),
30821
+ taskId: exports_external.uuid().optional(),
31606
30822
  preset: exports_external.string(),
31607
30823
  ok: exports_external.boolean(),
31608
30824
  summary: exports_external.string(),
@@ -31619,14 +30835,53 @@ var LockSchema = exports_external.object({
31619
30835
  var UnlockSchema = exports_external.object({
31620
30836
  agentId: exports_external.string().min(1)
31621
30837
  });
30838
+ // ../shared/src/models/ai.ts
30839
+ var AIRoleSchema = exports_external.enum(["user", "assistant", "system"]);
30840
+ var AIArtifactSchema = exports_external.object({
30841
+ id: exports_external.string(),
30842
+ type: exports_external.enum(["code", "document", "sprint", "task_list", "task"]),
30843
+ title: exports_external.string(),
30844
+ content: exports_external.string(),
30845
+ language: exports_external.string().optional(),
30846
+ metadata: exports_external.record(exports_external.string(), exports_external.any()).optional()
30847
+ });
30848
+ var SuggestedActionSchema = exports_external.object({
30849
+ label: exports_external.string(),
30850
+ type: exports_external.enum([
30851
+ "create_task",
30852
+ "create_doc",
30853
+ "chat_suggestion",
30854
+ "start_sprint",
30855
+ "plan_sprint"
30856
+ ]),
30857
+ payload: exports_external.any()
30858
+ });
30859
+ var AIMessageSchema = exports_external.object({
30860
+ id: exports_external.string(),
30861
+ role: AIRoleSchema,
30862
+ content: exports_external.string(),
30863
+ timestamp: exports_external.union([exports_external.string(), exports_external.number()]).or(exports_external.date()).or(exports_external.any()).optional().transform((val) => val ? new Date(val) : new Date),
30864
+ thoughtProcess: exports_external.string().optional(),
30865
+ artifacts: exports_external.array(AIArtifactSchema).optional(),
30866
+ suggestedActions: exports_external.array(SuggestedActionSchema).optional()
30867
+ });
30868
+ var ChatRequestSchema = exports_external.object({
30869
+ message: exports_external.string().min(1, "Message is required"),
30870
+ sessionId: exports_external.string().optional()
30871
+ });
30872
+ var ChatResponseSchema = exports_external.object({
30873
+ message: AIMessageSchema,
30874
+ sessionId: exports_external.string(),
30875
+ history: exports_external.array(AIMessageSchema).optional()
30876
+ });
31622
30877
  // ../shared/src/models/user.ts
31623
30878
  var UserSchema = BaseEntitySchema.extend({
31624
30879
  email: exports_external.string().email(),
31625
30880
  name: exports_external.string().min(1),
31626
30881
  avatarUrl: exports_external.string().url().nullable().optional(),
31627
- role: exports_external.nativeEnum(UserRole),
31628
- orgId: exports_external.string().uuid().optional().nullable(),
31629
- workspaceId: exports_external.string().uuid().optional().nullable(),
30882
+ role: exports_external.enum(UserRole),
30883
+ orgId: exports_external.uuid().optional().nullable(),
30884
+ workspaceId: exports_external.uuid().optional().nullable(),
31630
30885
  companyName: exports_external.string().optional(),
31631
30886
  userRole: exports_external.string().optional(),
31632
30887
  teamSize: exports_external.string().optional(),
@@ -31647,18 +30902,18 @@ var UpdateUserSchema = UserSchema.partial().omit({
31647
30902
  // ../shared/src/models/auth.ts
31648
30903
  var JwtAuthUserSchema = exports_external.object({
31649
30904
  authType: exports_external.literal("jwt"),
31650
- id: exports_external.string().uuid(),
30905
+ id: exports_external.uuid(),
31651
30906
  email: exports_external.string().email(),
31652
30907
  name: exports_external.string(),
31653
- role: exports_external.nativeEnum(UserRole),
31654
- orgId: exports_external.string().uuid().nullable().optional(),
31655
- workspaceId: exports_external.string().uuid().nullable().optional()
30908
+ role: exports_external.enum(UserRole),
30909
+ orgId: exports_external.uuid().nullable().optional(),
30910
+ workspaceId: exports_external.uuid().nullable().optional()
31656
30911
  });
31657
30912
  var ApiKeyAuthUserSchema = exports_external.object({
31658
30913
  authType: exports_external.literal("api_key"),
31659
- apiKeyId: exports_external.string().uuid(),
30914
+ apiKeyId: exports_external.uuid(),
31660
30915
  apiKeyName: exports_external.string(),
31661
- orgId: exports_external.string().uuid()
30916
+ orgId: exports_external.uuid()
31662
30917
  });
31663
30918
  var AuthenticatedUserSchema = exports_external.discriminatedUnion("authType", [
31664
30919
  JwtAuthUserSchema,
@@ -31690,7 +30945,7 @@ var JWTPayloadSchema = exports_external.object({
31690
30945
  email: exports_external.string().email(),
31691
30946
  name: exports_external.string(),
31692
30947
  role: exports_external.string(),
31693
- orgId: exports_external.string().uuid().optional(),
30948
+ orgId: exports_external.uuid().optional(),
31694
30949
  iat: exports_external.number(),
31695
30950
  exp: exports_external.number()
31696
30951
  });
@@ -31699,8 +30954,8 @@ var AuthContextSchema = exports_external.object({
31699
30954
  email: exports_external.string().email(),
31700
30955
  name: exports_external.string(),
31701
30956
  role: exports_external.string(),
31702
- orgId: exports_external.string().uuid().optional(),
31703
- workspaceId: exports_external.string().uuid().optional(),
30957
+ orgId: exports_external.uuid().optional(),
30958
+ workspaceId: exports_external.uuid().optional(),
31704
30959
  authType: exports_external.enum(["jwt", "api_key", "local"])
31705
30960
  });
31706
30961
  var APIKeySchema = exports_external.object({
@@ -31731,8 +30986,8 @@ var CreateApiKeySchema = exports_external.object({
31731
30986
  });
31732
30987
  // ../shared/src/models/ci.ts
31733
30988
  var RecordCiSchema = exports_external.object({
31734
- taskId: exports_external.string().uuid(),
31735
- workspaceId: exports_external.string().uuid(),
30989
+ taskId: exports_external.uuid(),
30990
+ workspaceId: exports_external.uuid(),
31736
30991
  result: exports_external.object({
31737
30992
  ok: exports_external.boolean(),
31738
30993
  summary: exports_external.string(),
@@ -31747,25 +31002,36 @@ var RecordCiSchema = exports_external.object({
31747
31002
  });
31748
31003
  // ../shared/src/models/doc.ts
31749
31004
  var DocGroupSchemaForDoc = exports_external.object({
31750
- id: exports_external.string().uuid(),
31005
+ id: exports_external.uuid(),
31751
31006
  name: exports_external.string()
31752
31007
  });
31008
+ var DocType;
31009
+ ((DocType2) => {
31010
+ DocType2["GENERAL"] = "GENERAL";
31011
+ DocType2["PRD"] = "PRD";
31012
+ DocType2["TECH_SPEC"] = "TECH_SPEC";
31013
+ DocType2["ADR"] = "ADR";
31014
+ DocType2["API_DESIGN"] = "API_DESIGN";
31015
+ })(DocType ||= {});
31753
31016
  var DocSchema = BaseEntitySchema.extend({
31754
- workspaceId: exports_external.string().uuid(),
31755
- groupId: exports_external.string().uuid().nullable().optional(),
31017
+ workspaceId: exports_external.uuid(),
31018
+ groupId: exports_external.uuid().nullable().optional(),
31756
31019
  title: exports_external.string().min(1, "Title is required"),
31757
31020
  content: exports_external.string().default(""),
31021
+ type: exports_external.enum(DocType).default("GENERAL" /* GENERAL */),
31758
31022
  group: DocGroupSchemaForDoc.nullable().optional()
31759
31023
  });
31760
31024
  var CreateDocSchema = exports_external.object({
31761
31025
  title: exports_external.string().min(1, "Title is required"),
31762
31026
  content: exports_external.string().optional(),
31763
- groupId: exports_external.string().uuid().optional()
31027
+ type: exports_external.enum(DocType).optional().default("GENERAL" /* GENERAL */),
31028
+ groupId: exports_external.string().optional()
31764
31029
  });
31765
31030
  var UpdateDocSchema = exports_external.object({
31766
31031
  title: exports_external.string().min(1).optional(),
31767
31032
  content: exports_external.string().optional(),
31768
- groupId: exports_external.string().uuid().nullable().optional()
31033
+ type: exports_external.enum(DocType).optional(),
31034
+ groupId: exports_external.string().nullable().optional()
31769
31035
  });
31770
31036
  var DocResponseSchema = exports_external.object({
31771
31037
  doc: DocSchema
@@ -31781,7 +31047,7 @@ var DocQuerySchema = exports_external.object({
31781
31047
  });
31782
31048
  // ../shared/src/models/doc-group.ts
31783
31049
  var DocGroupSchema = BaseEntitySchema.extend({
31784
- workspaceId: exports_external.string().uuid(),
31050
+ workspaceId: exports_external.uuid(),
31785
31051
  name: exports_external.string().min(1, "Name is required"),
31786
31052
  order: exports_external.number().default(0)
31787
31053
  });
@@ -31806,16 +31072,16 @@ var DocGroupIdParamSchema = exports_external.object({
31806
31072
  var InvitationSchema = BaseEntitySchema.extend({
31807
31073
  orgId: exports_external.string().uuid("Invalid Organization ID"),
31808
31074
  email: exports_external.string().email("Invalid email address"),
31809
- role: exports_external.nativeEnum(MembershipRole),
31075
+ role: exports_external.enum(MembershipRole),
31810
31076
  token: exports_external.string(),
31811
31077
  expiresAt: exports_external.number(),
31812
31078
  acceptedAt: exports_external.number().nullable().optional(),
31813
- invitedBy: exports_external.string().uuid()
31079
+ invitedBy: exports_external.uuid()
31814
31080
  });
31815
31081
  var CreateInvitationSchema = exports_external.object({
31816
31082
  orgId: exports_external.string().uuid("Invalid Organization ID"),
31817
31083
  email: exports_external.string().email("Invalid email address"),
31818
- role: exports_external.nativeEnum(MembershipRole).default("MEMBER" /* MEMBER */)
31084
+ role: exports_external.enum(MembershipRole).default("MEMBER" /* MEMBER */)
31819
31085
  });
31820
31086
  var AcceptInvitationSchema = exports_external.object({
31821
31087
  token: exports_external.string().min(1, "Invitation token is required"),
@@ -31839,10 +31105,10 @@ var InvitationsResponseSchema = exports_external.object({
31839
31105
  });
31840
31106
  var AcceptInvitationResponseSchema = exports_external.object({
31841
31107
  membership: exports_external.object({
31842
- id: exports_external.string().uuid(),
31843
- userId: exports_external.string().uuid(),
31844
- orgId: exports_external.string().uuid(),
31845
- role: exports_external.nativeEnum(MembershipRole),
31108
+ id: exports_external.uuid(),
31109
+ userId: exports_external.uuid(),
31110
+ orgId: exports_external.uuid(),
31111
+ role: exports_external.enum(MembershipRole),
31846
31112
  createdAt: exports_external.number()
31847
31113
  })
31848
31114
  });
@@ -31865,13 +31131,13 @@ var AddMemberSchema = exports_external.object({
31865
31131
  role: exports_external.enum(["ADMIN", "MEMBER"]).default("MEMBER")
31866
31132
  });
31867
31133
  var MembershipWithUserSchema = exports_external.object({
31868
- id: exports_external.string().uuid(),
31869
- userId: exports_external.string().uuid(),
31870
- orgId: exports_external.string().uuid(),
31134
+ id: exports_external.uuid(),
31135
+ userId: exports_external.uuid(),
31136
+ orgId: exports_external.uuid(),
31871
31137
  role: exports_external.string(),
31872
31138
  createdAt: exports_external.number(),
31873
31139
  user: exports_external.object({
31874
- id: exports_external.string().uuid(),
31140
+ id: exports_external.uuid(),
31875
31141
  email: exports_external.string().email(),
31876
31142
  name: exports_external.string(),
31877
31143
  avatarUrl: exports_external.string().url().nullable().optional()
@@ -31897,9 +31163,9 @@ var MembershipResponseSchema = exports_external.object({
31897
31163
  });
31898
31164
  // ../shared/src/models/sprint.ts
31899
31165
  var SprintSchema = BaseEntitySchema.extend({
31900
- workspaceId: exports_external.string().uuid().nullable().optional(),
31166
+ workspaceId: exports_external.uuid().nullable().optional(),
31901
31167
  name: exports_external.string().min(1, "Name is required").max(100),
31902
- status: exports_external.nativeEnum(SprintStatus),
31168
+ status: exports_external.enum(SprintStatus),
31903
31169
  startDate: exports_external.union([exports_external.date(), exports_external.number()]).nullable().optional(),
31904
31170
  endDate: exports_external.union([exports_external.date(), exports_external.number()]).nullable().optional(),
31905
31171
  mindmap: exports_external.string().nullable().optional(),
@@ -31907,18 +31173,22 @@ var SprintSchema = BaseEntitySchema.extend({
31907
31173
  });
31908
31174
  var CreateSprintSchema = exports_external.object({
31909
31175
  name: exports_external.string().min(1, "Name is required").max(100),
31910
- startDate: exports_external.union([exports_external.coerce.date(), exports_external.number()]).optional(),
31911
- endDate: exports_external.union([exports_external.coerce.date(), exports_external.number()]).optional()
31176
+ startDate: exports_external.union([exports_external.string(), exports_external.number()]).optional(),
31177
+ endDate: exports_external.union([exports_external.string(), exports_external.number()]).optional(),
31178
+ taskIds: exports_external.array(exports_external.string()).optional()
31912
31179
  });
31913
31180
  var UpdateSprintSchema = SprintSchema.partial().omit({
31914
31181
  id: true,
31915
31182
  createdAt: true,
31916
- updatedAt: true
31183
+ updatedAt: true,
31184
+ startDate: true,
31185
+ endDate: true,
31186
+ mindmapUpdatedAt: true
31917
31187
  }).extend({
31918
31188
  name: exports_external.string().min(1).max(100).optional(),
31919
- startDate: exports_external.union([exports_external.coerce.date(), exports_external.number()]).optional().nullable(),
31920
- endDate: exports_external.union([exports_external.coerce.date(), exports_external.number()]).optional().nullable(),
31921
- mindmapUpdatedAt: exports_external.union([exports_external.coerce.date(), exports_external.number()]).optional().nullable()
31189
+ startDate: exports_external.union([exports_external.string(), exports_external.number()]).optional().nullable(),
31190
+ endDate: exports_external.union([exports_external.string(), exports_external.number()]).optional().nullable(),
31191
+ mindmapUpdatedAt: exports_external.union([exports_external.string(), exports_external.number()]).optional().nullable()
31922
31192
  });
31923
31193
  var SprintIdParamSchema = exports_external.object({
31924
31194
  id: exports_external.string().uuid("Invalid Sprint ID")
@@ -31937,45 +31207,50 @@ var AcceptanceItemSchema = exports_external.object({
31937
31207
  done: exports_external.boolean()
31938
31208
  });
31939
31209
  var TaskSchema = BaseEntitySchema.extend({
31940
- workspaceId: exports_external.string().uuid().nullable().optional(),
31210
+ workspaceId: exports_external.uuid().nullable().optional(),
31941
31211
  title: exports_external.string().min(1, "Title is required").max(200),
31942
- description: exports_external.string().default(""),
31943
- status: exports_external.nativeEnum(TaskStatus).default("BACKLOG" /* BACKLOG */),
31944
- priority: exports_external.nativeEnum(TaskPriority).default("MEDIUM" /* MEDIUM */),
31945
- labels: exports_external.array(exports_external.string()).default([]),
31946
- assigneeRole: exports_external.nativeEnum(AssigneeRole).nullable().optional(),
31212
+ description: exports_external.string(),
31213
+ status: exports_external.enum(TaskStatus),
31214
+ priority: exports_external.enum(TaskPriority),
31215
+ labels: exports_external.array(exports_external.string()),
31216
+ assigneeRole: exports_external.enum(AssigneeRole).nullable().optional(),
31947
31217
  assignedTo: exports_external.string().nullable().optional(),
31948
- sprintId: exports_external.string().uuid().nullable().optional(),
31949
- parentId: exports_external.string().uuid().nullable().optional(),
31950
- dueDate: exports_external.union([exports_external.date(), exports_external.number()]).nullable().optional(),
31951
- acceptanceChecklist: exports_external.array(AcceptanceItemSchema).default([]),
31218
+ sprintId: exports_external.uuid().nullable().optional(),
31219
+ parentId: exports_external.uuid().nullable().optional(),
31220
+ dueDate: exports_external.union([exports_external.string(), exports_external.number()]).nullable().optional(),
31221
+ acceptanceChecklist: exports_external.array(AcceptanceItemSchema),
31952
31222
  comments: exports_external.array(CommentSchema).optional(),
31953
31223
  activityLog: exports_external.array(EventSchema).optional(),
31954
- docs: exports_external.array(DocSchema).default([])
31224
+ docs: exports_external.array(DocSchema)
31955
31225
  });
31956
31226
  var CreateTaskSchema = exports_external.object({
31957
31227
  title: exports_external.string().min(1, "Title is required").max(200),
31958
31228
  description: exports_external.string().optional().default(""),
31959
- status: exports_external.nativeEnum(TaskStatus).optional().default("BACKLOG" /* BACKLOG */),
31960
- priority: exports_external.nativeEnum(TaskPriority).optional().default("MEDIUM" /* MEDIUM */),
31229
+ status: exports_external.enum(TaskStatus).optional().default("BACKLOG" /* BACKLOG */),
31230
+ priority: exports_external.enum(TaskPriority).optional().default("MEDIUM" /* MEDIUM */),
31961
31231
  labels: exports_external.array(exports_external.string()).optional().default([]),
31962
- assigneeRole: exports_external.nativeEnum(AssigneeRole).optional(),
31232
+ assigneeRole: exports_external.enum(AssigneeRole).optional(),
31963
31233
  assignedTo: exports_external.string().nullable().optional(),
31964
- dueDate: exports_external.union([exports_external.date(), exports_external.number()]).nullable().optional(),
31965
- parentId: exports_external.string().uuid().nullable().optional(),
31966
- sprintId: exports_external.string().uuid().nullable().optional(),
31234
+ dueDate: exports_external.union([exports_external.string(), exports_external.number()]).nullable().optional(),
31235
+ parentId: exports_external.string().nullable().optional(),
31236
+ sprintId: exports_external.string().nullable().optional(),
31967
31237
  acceptanceChecklist: exports_external.array(AcceptanceItemSchema).optional(),
31968
- docIds: exports_external.array(exports_external.string().uuid()).optional()
31238
+ docIds: exports_external.array(exports_external.string()).optional()
31969
31239
  });
31970
31240
  var UpdateTaskSchema = TaskSchema.partial().omit({
31971
31241
  id: true,
31972
31242
  workspaceId: true,
31973
31243
  createdAt: true,
31974
- updatedAt: true
31244
+ updatedAt: true,
31245
+ dueDate: true,
31246
+ comments: true,
31247
+ activityLog: true,
31248
+ docs: true
31975
31249
  }).extend({
31976
31250
  title: exports_external.string().min(1).max(200).optional(),
31251
+ dueDate: exports_external.union([exports_external.string(), exports_external.number()]).optional().nullable(),
31977
31252
  acceptanceChecklist: exports_external.array(AcceptanceItemSchema).optional(),
31978
- docIds: exports_external.array(exports_external.string().uuid()).optional()
31253
+ docIds: exports_external.array(exports_external.string()).optional()
31979
31254
  });
31980
31255
  var AddCommentSchema = exports_external.object({
31981
31256
  author: exports_external.string().min(1, "Author is required"),
@@ -31983,7 +31258,7 @@ var AddCommentSchema = exports_external.object({
31983
31258
  });
31984
31259
  var DispatchTaskSchema = exports_external.object({
31985
31260
  workerId: exports_external.string().optional(),
31986
- sprintId: exports_external.string().uuid().optional().nullable()
31261
+ sprintId: exports_external.uuid().optional().nullable()
31987
31262
  });
31988
31263
  var TaskIdParamSchema = exports_external.object({
31989
31264
  id: exports_external.string().uuid("Invalid Task ID")
@@ -32002,7 +31277,7 @@ var ChecklistItemSchema = exports_external.object({
32002
31277
  done: exports_external.boolean()
32003
31278
  });
32004
31279
  var WorkspaceSchema = BaseEntitySchema.extend({
32005
- orgId: exports_external.string().uuid(),
31280
+ orgId: exports_external.uuid(),
32006
31281
  name: exports_external.string().min(1, "Name is required").max(100),
32007
31282
  defaultChecklist: exports_external.array(ChecklistItemSchema).nullable().optional()
32008
31283
  });
@@ -32026,27 +31301,911 @@ var WorkspaceAndUserParamSchema = exports_external.object({
32026
31301
  workspaceId: exports_external.string().uuid("Invalid Workspace ID"),
32027
31302
  userId: exports_external.string().uuid("Invalid User ID")
32028
31303
  });
32029
- var WorkspaceResponseSchema = exports_external.object({
32030
- workspace: WorkspaceSchema
31304
+ var WorkspaceResponseSchema = exports_external.object({
31305
+ workspace: WorkspaceSchema
31306
+ });
31307
+ var WorkspacesResponseSchema = exports_external.object({
31308
+ workspaces: exports_external.array(WorkspaceSchema)
31309
+ });
31310
+ var WorkspaceStatsSchema = exports_external.object({
31311
+ workspaceName: exports_external.string(),
31312
+ taskCounts: exports_external.record(exports_external.string(), exports_external.number()),
31313
+ memberCount: exports_external.number()
31314
+ });
31315
+ var WorkspaceStatsResponseSchema = exports_external.object({
31316
+ stats: WorkspaceStatsSchema
31317
+ });
31318
+ // ../sdk/src/core/config.ts
31319
+ import { join } from "node:path";
31320
+ var PROVIDER = {
31321
+ CLAUDE: "claude",
31322
+ CODEX: "codex"
31323
+ };
31324
+ var DEFAULT_MODEL = {
31325
+ [PROVIDER.CLAUDE]: "sonnet",
31326
+ [PROVIDER.CODEX]: "gpt-5.1-codex-mini"
31327
+ };
31328
+ var LOCUS_CONFIG = {
31329
+ dir: ".locus",
31330
+ configFile: "config.json",
31331
+ indexFile: "codebase-index.json",
31332
+ contextFile: "CLAUDE.md",
31333
+ artifactsDir: "artifacts",
31334
+ documentsDir: "documents",
31335
+ agentSkillsDir: ".agent/skills"
31336
+ };
31337
+ function getLocusPath(projectPath, fileName) {
31338
+ if (fileName === "contextFile") {
31339
+ return join(projectPath, LOCUS_CONFIG.contextFile);
31340
+ }
31341
+ return join(projectPath, LOCUS_CONFIG.dir, LOCUS_CONFIG[fileName]);
31342
+ }
31343
+
31344
+ // ../sdk/src/agent/artifact-syncer.ts
31345
+ class ArtifactSyncer {
31346
+ deps;
31347
+ constructor(deps) {
31348
+ this.deps = deps;
31349
+ }
31350
+ async getOrCreateArtifactsGroup() {
31351
+ try {
31352
+ const groups = await this.deps.client.docs.listGroups(this.deps.workspaceId);
31353
+ const artifactsGroup = groups.find((g) => g.name === "Artifacts");
31354
+ if (artifactsGroup) {
31355
+ return artifactsGroup.id;
31356
+ }
31357
+ const newGroup = await this.deps.client.docs.createGroup(this.deps.workspaceId, {
31358
+ name: "Artifacts",
31359
+ order: 999
31360
+ });
31361
+ this.deps.log("Created 'Artifacts' group for agent-generated docs", "info");
31362
+ return newGroup.id;
31363
+ } catch (error48) {
31364
+ this.deps.log(`Failed to get/create Artifacts group: ${error48}`, "error");
31365
+ throw error48;
31366
+ }
31367
+ }
31368
+ async sync() {
31369
+ const artifactsDir = getLocusPath(this.deps.projectPath, "artifactsDir");
31370
+ if (!existsSync(artifactsDir)) {
31371
+ mkdirSync(artifactsDir, { recursive: true });
31372
+ return;
31373
+ }
31374
+ try {
31375
+ const files = readdirSync(artifactsDir);
31376
+ this.deps.log(`Syncing ${files.length} artifacts to server...`, "info");
31377
+ const groups = await this.deps.client.docs.listGroups(this.deps.workspaceId);
31378
+ const groupMap = new Map(groups.map((g) => [g.id, g.name]));
31379
+ let artifactsGroupId = groups.find((g) => g.name === "Artifacts")?.id;
31380
+ if (!artifactsGroupId) {
31381
+ artifactsGroupId = await this.getOrCreateArtifactsGroup();
31382
+ }
31383
+ const existingDocs = await this.deps.client.docs.list(this.deps.workspaceId);
31384
+ for (const file2 of files) {
31385
+ const filePath = join2(artifactsDir, file2);
31386
+ if (statSync(filePath).isFile()) {
31387
+ const content = readFileSync(filePath, "utf-8");
31388
+ const title = file2.replace(/\.md$/, "").trim();
31389
+ if (!title)
31390
+ continue;
31391
+ const existing = existingDocs.find((d) => d.title === title);
31392
+ if (existing) {
31393
+ if (existing.content !== content || existing.groupId !== artifactsGroupId) {
31394
+ await this.deps.client.docs.update(existing.id, this.deps.workspaceId, { content, groupId: artifactsGroupId });
31395
+ this.deps.log(`Updated artifact: ${file2}`, "success");
31396
+ }
31397
+ } else {
31398
+ await this.deps.client.docs.create(this.deps.workspaceId, {
31399
+ title,
31400
+ content,
31401
+ groupId: artifactsGroupId,
31402
+ type: "GENERAL" /* GENERAL */
31403
+ });
31404
+ this.deps.log(`Created artifact: ${file2}`, "success");
31405
+ }
31406
+ }
31407
+ }
31408
+ for (const doc3 of existingDocs) {
31409
+ if (doc3.groupId === artifactsGroupId) {
31410
+ const fileName = `${doc3.title}.md`;
31411
+ const filePath = join2(artifactsDir, fileName);
31412
+ if (!existsSync(filePath)) {
31413
+ writeFileSync(filePath, doc3.content || "");
31414
+ this.deps.log(`Fetched artifact: ${fileName}`, "success");
31415
+ }
31416
+ } else {
31417
+ const documentsDir = getLocusPath(this.deps.projectPath, "documentsDir");
31418
+ const groupName = groupMap.get(doc3.groupId || "") || "General";
31419
+ const groupDir = join2(documentsDir, groupName);
31420
+ if (!existsSync(groupDir)) {
31421
+ mkdirSync(groupDir, { recursive: true });
31422
+ }
31423
+ const fileName = `${doc3.title}.md`;
31424
+ const filePath = join2(groupDir, fileName);
31425
+ if (!existsSync(filePath) || readFileSync(filePath, "utf-8") !== doc3.content) {
31426
+ writeFileSync(filePath, doc3.content || "");
31427
+ }
31428
+ }
31429
+ }
31430
+ } catch (error48) {
31431
+ this.deps.log(`Failed to sync artifacts: ${error48}`, "error");
31432
+ }
31433
+ }
31434
+ }
31435
+ // ../sdk/src/core/indexer.ts
31436
+ import { createHash } from "node:crypto";
31437
+ import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
31438
+ import { dirname, join as join3 } from "node:path";
31439
+
31440
+ // ../../node_modules/globby/index.js
31441
+ import process4 from "node:process";
31442
+ import fs3 from "node:fs";
31443
+ import nodePath from "node:path";
31444
+
31445
+ // ../../node_modules/@sindresorhus/merge-streams/index.js
31446
+ import { on, once } from "node:events";
31447
+ import { PassThrough as PassThroughStream } from "node:stream";
31448
+ import { finished } from "node:stream/promises";
31449
+ function mergeStreams(streams) {
31450
+ if (!Array.isArray(streams)) {
31451
+ throw new TypeError(`Expected an array, got \`${typeof streams}\`.`);
31452
+ }
31453
+ for (const stream of streams) {
31454
+ validateStream(stream);
31455
+ }
31456
+ const objectMode = streams.some(({ readableObjectMode }) => readableObjectMode);
31457
+ const highWaterMark = getHighWaterMark(streams, objectMode);
31458
+ const passThroughStream = new MergedStream({
31459
+ objectMode,
31460
+ writableHighWaterMark: highWaterMark,
31461
+ readableHighWaterMark: highWaterMark
31462
+ });
31463
+ for (const stream of streams) {
31464
+ passThroughStream.add(stream);
31465
+ }
31466
+ if (streams.length === 0) {
31467
+ endStream(passThroughStream);
31468
+ }
31469
+ return passThroughStream;
31470
+ }
31471
+ var getHighWaterMark = (streams, objectMode) => {
31472
+ if (streams.length === 0) {
31473
+ return 16384;
31474
+ }
31475
+ const highWaterMarks = streams.filter(({ readableObjectMode }) => readableObjectMode === objectMode).map(({ readableHighWaterMark }) => readableHighWaterMark);
31476
+ return Math.max(...highWaterMarks);
31477
+ };
31478
+
31479
+ class MergedStream extends PassThroughStream {
31480
+ #streams = new Set([]);
31481
+ #ended = new Set([]);
31482
+ #aborted = new Set([]);
31483
+ #onFinished;
31484
+ add(stream) {
31485
+ validateStream(stream);
31486
+ if (this.#streams.has(stream)) {
31487
+ return;
31488
+ }
31489
+ this.#streams.add(stream);
31490
+ this.#onFinished ??= onMergedStreamFinished(this, this.#streams);
31491
+ endWhenStreamsDone({
31492
+ passThroughStream: this,
31493
+ stream,
31494
+ streams: this.#streams,
31495
+ ended: this.#ended,
31496
+ aborted: this.#aborted,
31497
+ onFinished: this.#onFinished
31498
+ });
31499
+ stream.pipe(this, { end: false });
31500
+ }
31501
+ remove(stream) {
31502
+ validateStream(stream);
31503
+ if (!this.#streams.has(stream)) {
31504
+ return false;
31505
+ }
31506
+ stream.unpipe(this);
31507
+ return true;
31508
+ }
31509
+ }
31510
+ var onMergedStreamFinished = async (passThroughStream, streams) => {
31511
+ updateMaxListeners(passThroughStream, PASSTHROUGH_LISTENERS_COUNT);
31512
+ const controller = new AbortController;
31513
+ try {
31514
+ await Promise.race([
31515
+ onMergedStreamEnd(passThroughStream, controller),
31516
+ onInputStreamsUnpipe(passThroughStream, streams, controller)
31517
+ ]);
31518
+ } finally {
31519
+ controller.abort();
31520
+ updateMaxListeners(passThroughStream, -PASSTHROUGH_LISTENERS_COUNT);
31521
+ }
31522
+ };
31523
+ var onMergedStreamEnd = async (passThroughStream, { signal }) => {
31524
+ await finished(passThroughStream, { signal, cleanup: true });
31525
+ };
31526
+ var onInputStreamsUnpipe = async (passThroughStream, streams, { signal }) => {
31527
+ for await (const [unpipedStream] of on(passThroughStream, "unpipe", { signal })) {
31528
+ if (streams.has(unpipedStream)) {
31529
+ unpipedStream.emit(unpipeEvent);
31530
+ }
31531
+ }
31532
+ };
31533
+ var validateStream = (stream) => {
31534
+ if (typeof stream?.pipe !== "function") {
31535
+ throw new TypeError(`Expected a readable stream, got: \`${typeof stream}\`.`);
31536
+ }
31537
+ };
31538
+ var endWhenStreamsDone = async ({ passThroughStream, stream, streams, ended, aborted: aborted2, onFinished }) => {
31539
+ updateMaxListeners(passThroughStream, PASSTHROUGH_LISTENERS_PER_STREAM);
31540
+ const controller = new AbortController;
31541
+ try {
31542
+ await Promise.race([
31543
+ afterMergedStreamFinished(onFinished, stream),
31544
+ onInputStreamEnd({ passThroughStream, stream, streams, ended, aborted: aborted2, controller }),
31545
+ onInputStreamUnpipe({ stream, streams, ended, aborted: aborted2, controller })
31546
+ ]);
31547
+ } finally {
31548
+ controller.abort();
31549
+ updateMaxListeners(passThroughStream, -PASSTHROUGH_LISTENERS_PER_STREAM);
31550
+ }
31551
+ if (streams.size === ended.size + aborted2.size) {
31552
+ if (ended.size === 0 && aborted2.size > 0) {
31553
+ abortStream(passThroughStream);
31554
+ } else {
31555
+ endStream(passThroughStream);
31556
+ }
31557
+ }
31558
+ };
31559
+ var isAbortError = (error48) => error48?.code === "ERR_STREAM_PREMATURE_CLOSE";
31560
+ var afterMergedStreamFinished = async (onFinished, stream) => {
31561
+ try {
31562
+ await onFinished;
31563
+ abortStream(stream);
31564
+ } catch (error48) {
31565
+ if (isAbortError(error48)) {
31566
+ abortStream(stream);
31567
+ } else {
31568
+ errorStream(stream, error48);
31569
+ }
31570
+ }
31571
+ };
31572
+ var onInputStreamEnd = async ({ passThroughStream, stream, streams, ended, aborted: aborted2, controller: { signal } }) => {
31573
+ try {
31574
+ await finished(stream, { signal, cleanup: true, readable: true, writable: false });
31575
+ if (streams.has(stream)) {
31576
+ ended.add(stream);
31577
+ }
31578
+ } catch (error48) {
31579
+ if (signal.aborted || !streams.has(stream)) {
31580
+ return;
31581
+ }
31582
+ if (isAbortError(error48)) {
31583
+ aborted2.add(stream);
31584
+ } else {
31585
+ errorStream(passThroughStream, error48);
31586
+ }
31587
+ }
31588
+ };
31589
+ var onInputStreamUnpipe = async ({ stream, streams, ended, aborted: aborted2, controller: { signal } }) => {
31590
+ await once(stream, unpipeEvent, { signal });
31591
+ streams.delete(stream);
31592
+ ended.delete(stream);
31593
+ aborted2.delete(stream);
31594
+ };
31595
+ var unpipeEvent = Symbol("unpipe");
31596
+ var endStream = (stream) => {
31597
+ if (stream.writable) {
31598
+ stream.end();
31599
+ }
31600
+ };
31601
+ var abortStream = (stream) => {
31602
+ if (stream.readable || stream.writable) {
31603
+ stream.destroy();
31604
+ }
31605
+ };
31606
+ var errorStream = (stream, error48) => {
31607
+ if (!stream.destroyed) {
31608
+ stream.once("error", noop);
31609
+ stream.destroy(error48);
31610
+ }
31611
+ };
31612
+ var noop = () => {};
31613
+ var updateMaxListeners = (passThroughStream, increment) => {
31614
+ const maxListeners = passThroughStream.getMaxListeners();
31615
+ if (maxListeners !== 0 && maxListeners !== Number.POSITIVE_INFINITY) {
31616
+ passThroughStream.setMaxListeners(maxListeners + increment);
31617
+ }
31618
+ };
31619
+ var PASSTHROUGH_LISTENERS_COUNT = 2;
31620
+ var PASSTHROUGH_LISTENERS_PER_STREAM = 1;
31621
+
31622
+ // ../../node_modules/globby/index.js
31623
+ var import_fast_glob2 = __toESM(require_out4(), 1);
31624
+
31625
+ // ../../node_modules/path-type/index.js
31626
+ import fs from "node:fs";
31627
+ import fsPromises from "node:fs/promises";
31628
+ async function isType(fsStatType, statsMethodName, filePath) {
31629
+ if (typeof filePath !== "string") {
31630
+ throw new TypeError(`Expected a string, got ${typeof filePath}`);
31631
+ }
31632
+ try {
31633
+ const stats = await fsPromises[fsStatType](filePath);
31634
+ return stats[statsMethodName]();
31635
+ } catch (error48) {
31636
+ if (error48.code === "ENOENT") {
31637
+ return false;
31638
+ }
31639
+ throw error48;
31640
+ }
31641
+ }
31642
+ function isTypeSync(fsStatType, statsMethodName, filePath) {
31643
+ if (typeof filePath !== "string") {
31644
+ throw new TypeError(`Expected a string, got ${typeof filePath}`);
31645
+ }
31646
+ try {
31647
+ return fs[fsStatType](filePath)[statsMethodName]();
31648
+ } catch (error48) {
31649
+ if (error48.code === "ENOENT") {
31650
+ return false;
31651
+ }
31652
+ throw error48;
31653
+ }
31654
+ }
31655
+ var isFile = isType.bind(undefined, "stat", "isFile");
31656
+ var isDirectory = isType.bind(undefined, "stat", "isDirectory");
31657
+ var isSymlink = isType.bind(undefined, "lstat", "isSymbolicLink");
31658
+ var isFileSync = isTypeSync.bind(undefined, "statSync", "isFile");
31659
+ var isDirectorySync = isTypeSync.bind(undefined, "statSync", "isDirectory");
31660
+ var isSymlinkSync = isTypeSync.bind(undefined, "lstatSync", "isSymbolicLink");
31661
+
31662
+ // ../../node_modules/unicorn-magic/node.js
31663
+ import { promisify } from "node:util";
31664
+ import { execFile as execFileCallback, execFileSync as execFileSyncOriginal } from "node:child_process";
31665
+ import { fileURLToPath } from "node:url";
31666
+ var execFileOriginal = promisify(execFileCallback);
31667
+ function toPath(urlOrPath) {
31668
+ return urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
31669
+ }
31670
+ var TEN_MEGABYTES_IN_BYTES = 10 * 1024 * 1024;
31671
+
31672
+ // ../../node_modules/globby/ignore.js
31673
+ var import_fast_glob = __toESM(require_out4(), 1);
31674
+ var import_ignore = __toESM(require_ignore(), 1);
31675
+ import process3 from "node:process";
31676
+ import fs2 from "node:fs";
31677
+ import fsPromises2 from "node:fs/promises";
31678
+ import path from "node:path";
31679
+
31680
+ // ../../node_modules/globby/node_modules/slash/index.js
31681
+ function slash(path) {
31682
+ const isExtendedLengthPath = path.startsWith("\\\\?\\");
31683
+ if (isExtendedLengthPath) {
31684
+ return path;
31685
+ }
31686
+ return path.replace(/\\/g, "/");
31687
+ }
31688
+
31689
+ // ../../node_modules/globby/utilities.js
31690
+ var isNegativePattern = (pattern) => pattern[0] === "!";
31691
+
31692
+ // ../../node_modules/globby/ignore.js
31693
+ var defaultIgnoredDirectories = [
31694
+ "**/node_modules",
31695
+ "**/flow-typed",
31696
+ "**/coverage",
31697
+ "**/.git"
31698
+ ];
31699
+ var ignoreFilesGlobOptions = {
31700
+ absolute: true,
31701
+ dot: true
31702
+ };
31703
+ var GITIGNORE_FILES_PATTERN = "**/.gitignore";
31704
+ var applyBaseToPattern = (pattern, base) => isNegativePattern(pattern) ? "!" + path.posix.join(base, pattern.slice(1)) : path.posix.join(base, pattern);
31705
+ var parseIgnoreFile = (file2, cwd) => {
31706
+ const base = slash(path.relative(cwd, path.dirname(file2.filePath)));
31707
+ return file2.content.split(/\r?\n/).filter((line) => line && !line.startsWith("#")).map((pattern) => applyBaseToPattern(pattern, base));
31708
+ };
31709
+ var toRelativePath = (fileOrDirectory, cwd) => {
31710
+ cwd = slash(cwd);
31711
+ if (path.isAbsolute(fileOrDirectory)) {
31712
+ if (slash(fileOrDirectory).startsWith(cwd)) {
31713
+ return path.relative(cwd, fileOrDirectory);
31714
+ }
31715
+ throw new Error(`Path ${fileOrDirectory} is not in cwd ${cwd}`);
31716
+ }
31717
+ return fileOrDirectory;
31718
+ };
31719
+ var getIsIgnoredPredicate = (files, cwd) => {
31720
+ const patterns = files.flatMap((file2) => parseIgnoreFile(file2, cwd));
31721
+ const ignores = import_ignore.default().add(patterns);
31722
+ return (fileOrDirectory) => {
31723
+ fileOrDirectory = toPath(fileOrDirectory);
31724
+ fileOrDirectory = toRelativePath(fileOrDirectory, cwd);
31725
+ return fileOrDirectory ? ignores.ignores(slash(fileOrDirectory)) : false;
31726
+ };
31727
+ };
31728
+ var normalizeOptions = (options = {}) => ({
31729
+ cwd: toPath(options.cwd) ?? process3.cwd(),
31730
+ suppressErrors: Boolean(options.suppressErrors),
31731
+ deep: typeof options.deep === "number" ? options.deep : Number.POSITIVE_INFINITY,
31732
+ ignore: [...options.ignore ?? [], ...defaultIgnoredDirectories]
31733
+ });
31734
+ var isIgnoredByIgnoreFiles = async (patterns, options) => {
31735
+ const { cwd, suppressErrors, deep, ignore } = normalizeOptions(options);
31736
+ const paths = await import_fast_glob.default(patterns, {
31737
+ cwd,
31738
+ suppressErrors,
31739
+ deep,
31740
+ ignore,
31741
+ ...ignoreFilesGlobOptions
31742
+ });
31743
+ const files = await Promise.all(paths.map(async (filePath) => ({
31744
+ filePath,
31745
+ content: await fsPromises2.readFile(filePath, "utf8")
31746
+ })));
31747
+ return getIsIgnoredPredicate(files, cwd);
31748
+ };
31749
+ var isIgnoredByIgnoreFilesSync = (patterns, options) => {
31750
+ const { cwd, suppressErrors, deep, ignore } = normalizeOptions(options);
31751
+ const paths = import_fast_glob.default.sync(patterns, {
31752
+ cwd,
31753
+ suppressErrors,
31754
+ deep,
31755
+ ignore,
31756
+ ...ignoreFilesGlobOptions
31757
+ });
31758
+ const files = paths.map((filePath) => ({
31759
+ filePath,
31760
+ content: fs2.readFileSync(filePath, "utf8")
31761
+ }));
31762
+ return getIsIgnoredPredicate(files, cwd);
31763
+ };
31764
+
31765
+ // ../../node_modules/globby/index.js
31766
+ var assertPatternsInput = (patterns) => {
31767
+ if (patterns.some((pattern) => typeof pattern !== "string")) {
31768
+ throw new TypeError("Patterns must be a string or an array of strings");
31769
+ }
31770
+ };
31771
+ var normalizePathForDirectoryGlob = (filePath, cwd) => {
31772
+ const path2 = isNegativePattern(filePath) ? filePath.slice(1) : filePath;
31773
+ return nodePath.isAbsolute(path2) ? path2 : nodePath.join(cwd, path2);
31774
+ };
31775
+ var getDirectoryGlob = ({ directoryPath, files, extensions }) => {
31776
+ const extensionGlob = extensions?.length > 0 ? `.${extensions.length > 1 ? `{${extensions.join(",")}}` : extensions[0]}` : "";
31777
+ return files ? files.map((file2) => nodePath.posix.join(directoryPath, `**/${nodePath.extname(file2) ? file2 : `${file2}${extensionGlob}`}`)) : [nodePath.posix.join(directoryPath, `**${extensionGlob ? `/*${extensionGlob}` : ""}`)];
31778
+ };
31779
+ var directoryToGlob = async (directoryPaths, {
31780
+ cwd = process4.cwd(),
31781
+ files,
31782
+ extensions
31783
+ } = {}) => {
31784
+ const globs = await Promise.all(directoryPaths.map(async (directoryPath) => await isDirectory(normalizePathForDirectoryGlob(directoryPath, cwd)) ? getDirectoryGlob({ directoryPath, files, extensions }) : directoryPath));
31785
+ return globs.flat();
31786
+ };
31787
+ var directoryToGlobSync = (directoryPaths, {
31788
+ cwd = process4.cwd(),
31789
+ files,
31790
+ extensions
31791
+ } = {}) => directoryPaths.flatMap((directoryPath) => isDirectorySync(normalizePathForDirectoryGlob(directoryPath, cwd)) ? getDirectoryGlob({ directoryPath, files, extensions }) : directoryPath);
31792
+ var toPatternsArray = (patterns) => {
31793
+ patterns = [...new Set([patterns].flat())];
31794
+ assertPatternsInput(patterns);
31795
+ return patterns;
31796
+ };
31797
+ var checkCwdOption = (cwd) => {
31798
+ if (!cwd) {
31799
+ return;
31800
+ }
31801
+ let stat;
31802
+ try {
31803
+ stat = fs3.statSync(cwd);
31804
+ } catch {
31805
+ return;
31806
+ }
31807
+ if (!stat.isDirectory()) {
31808
+ throw new Error("The `cwd` option must be a path to a directory");
31809
+ }
31810
+ };
31811
+ var normalizeOptions2 = (options = {}) => {
31812
+ options = {
31813
+ ...options,
31814
+ ignore: options.ignore ?? [],
31815
+ expandDirectories: options.expandDirectories ?? true,
31816
+ cwd: toPath(options.cwd)
31817
+ };
31818
+ checkCwdOption(options.cwd);
31819
+ return options;
31820
+ };
31821
+ var normalizeArguments = (function_) => async (patterns, options) => function_(toPatternsArray(patterns), normalizeOptions2(options));
31822
+ var normalizeArgumentsSync = (function_) => (patterns, options) => function_(toPatternsArray(patterns), normalizeOptions2(options));
31823
+ var getIgnoreFilesPatterns = (options) => {
31824
+ const { ignoreFiles, gitignore } = options;
31825
+ const patterns = ignoreFiles ? toPatternsArray(ignoreFiles) : [];
31826
+ if (gitignore) {
31827
+ patterns.push(GITIGNORE_FILES_PATTERN);
31828
+ }
31829
+ return patterns;
31830
+ };
31831
+ var getFilter = async (options) => {
31832
+ const ignoreFilesPatterns = getIgnoreFilesPatterns(options);
31833
+ return createFilterFunction(ignoreFilesPatterns.length > 0 && await isIgnoredByIgnoreFiles(ignoreFilesPatterns, options));
31834
+ };
31835
+ var getFilterSync = (options) => {
31836
+ const ignoreFilesPatterns = getIgnoreFilesPatterns(options);
31837
+ return createFilterFunction(ignoreFilesPatterns.length > 0 && isIgnoredByIgnoreFilesSync(ignoreFilesPatterns, options));
31838
+ };
31839
+ var createFilterFunction = (isIgnored) => {
31840
+ const seen = new Set;
31841
+ return (fastGlobResult) => {
31842
+ const pathKey = nodePath.normalize(fastGlobResult.path ?? fastGlobResult);
31843
+ if (seen.has(pathKey) || isIgnored && isIgnored(pathKey)) {
31844
+ return false;
31845
+ }
31846
+ seen.add(pathKey);
31847
+ return true;
31848
+ };
31849
+ };
31850
+ var unionFastGlobResults = (results, filter) => results.flat().filter((fastGlobResult) => filter(fastGlobResult));
31851
+ var convertNegativePatterns = (patterns, options) => {
31852
+ const tasks = [];
31853
+ while (patterns.length > 0) {
31854
+ const index = patterns.findIndex((pattern) => isNegativePattern(pattern));
31855
+ if (index === -1) {
31856
+ tasks.push({ patterns, options });
31857
+ break;
31858
+ }
31859
+ const ignorePattern = patterns[index].slice(1);
31860
+ for (const task2 of tasks) {
31861
+ task2.options.ignore.push(ignorePattern);
31862
+ }
31863
+ if (index !== 0) {
31864
+ tasks.push({
31865
+ patterns: patterns.slice(0, index),
31866
+ options: {
31867
+ ...options,
31868
+ ignore: [
31869
+ ...options.ignore,
31870
+ ignorePattern
31871
+ ]
31872
+ }
31873
+ });
31874
+ }
31875
+ patterns = patterns.slice(index + 1);
31876
+ }
31877
+ return tasks;
31878
+ };
31879
+ var normalizeExpandDirectoriesOption = (options, cwd) => ({
31880
+ ...cwd ? { cwd } : {},
31881
+ ...Array.isArray(options) ? { files: options } : options
32031
31882
  });
32032
- var WorkspacesResponseSchema = exports_external.object({
32033
- workspaces: exports_external.array(WorkspaceSchema)
31883
+ var generateTasks = async (patterns, options) => {
31884
+ const globTasks = convertNegativePatterns(patterns, options);
31885
+ const { cwd, expandDirectories } = options;
31886
+ if (!expandDirectories) {
31887
+ return globTasks;
31888
+ }
31889
+ const directoryToGlobOptions = normalizeExpandDirectoriesOption(expandDirectories, cwd);
31890
+ return Promise.all(globTasks.map(async (task2) => {
31891
+ let { patterns: patterns2, options: options2 } = task2;
31892
+ [
31893
+ patterns2,
31894
+ options2.ignore
31895
+ ] = await Promise.all([
31896
+ directoryToGlob(patterns2, directoryToGlobOptions),
31897
+ directoryToGlob(options2.ignore, { cwd })
31898
+ ]);
31899
+ return { patterns: patterns2, options: options2 };
31900
+ }));
31901
+ };
31902
+ var generateTasksSync = (patterns, options) => {
31903
+ const globTasks = convertNegativePatterns(patterns, options);
31904
+ const { cwd, expandDirectories } = options;
31905
+ if (!expandDirectories) {
31906
+ return globTasks;
31907
+ }
31908
+ const directoryToGlobSyncOptions = normalizeExpandDirectoriesOption(expandDirectories, cwd);
31909
+ return globTasks.map((task2) => {
31910
+ let { patterns: patterns2, options: options2 } = task2;
31911
+ patterns2 = directoryToGlobSync(patterns2, directoryToGlobSyncOptions);
31912
+ options2.ignore = directoryToGlobSync(options2.ignore, { cwd });
31913
+ return { patterns: patterns2, options: options2 };
31914
+ });
31915
+ };
31916
+ var globby = normalizeArguments(async (patterns, options) => {
31917
+ const [
31918
+ tasks,
31919
+ filter
31920
+ ] = await Promise.all([
31921
+ generateTasks(patterns, options),
31922
+ getFilter(options)
31923
+ ]);
31924
+ const results = await Promise.all(tasks.map((task2) => import_fast_glob2.default(task2.patterns, task2.options)));
31925
+ return unionFastGlobResults(results, filter);
32034
31926
  });
32035
- var WorkspaceStatsSchema = exports_external.object({
32036
- workspaceName: exports_external.string(),
32037
- taskCounts: exports_external.record(exports_external.string(), exports_external.number()),
32038
- memberCount: exports_external.number()
31927
+ var globbySync = normalizeArgumentsSync((patterns, options) => {
31928
+ const tasks = generateTasksSync(patterns, options);
31929
+ const filter = getFilterSync(options);
31930
+ const results = tasks.map((task2) => import_fast_glob2.default.sync(task2.patterns, task2.options));
31931
+ return unionFastGlobResults(results, filter);
32039
31932
  });
32040
- var WorkspaceStatsResponseSchema = exports_external.object({
32041
- stats: WorkspaceStatsSchema
31933
+ var globbyStream = normalizeArgumentsSync((patterns, options) => {
31934
+ const tasks = generateTasksSync(patterns, options);
31935
+ const filter = getFilterSync(options);
31936
+ const streams = tasks.map((task2) => import_fast_glob2.default.stream(task2.patterns, task2.options));
31937
+ const stream = mergeStreams(streams).filter((fastGlobResult) => filter(fastGlobResult));
31938
+ return stream;
32042
31939
  });
31940
+ var isDynamicPattern = normalizeArgumentsSync((patterns, options) => patterns.some((pattern) => import_fast_glob2.default.isDynamicPattern(pattern, options)));
31941
+ var generateGlobTasks = normalizeArguments(generateTasks);
31942
+ var generateGlobTasksSync = normalizeArgumentsSync(generateTasksSync);
31943
+
31944
+ // ../sdk/src/core/indexer.ts
31945
+ class CodebaseIndexer {
31946
+ projectPath;
31947
+ indexPath;
31948
+ fullReindexRatioThreshold = 0.2;
31949
+ constructor(projectPath) {
31950
+ this.projectPath = projectPath;
31951
+ this.indexPath = join3(projectPath, ".locus", "codebase-index.json");
31952
+ }
31953
+ async index(onProgress, treeSummarizer, force = false) {
31954
+ if (!treeSummarizer) {
31955
+ throw new Error("A treeSummarizer is required for this indexing method.");
31956
+ }
31957
+ onProgress?.("Generating file tree...");
31958
+ const currentFiles = await this.getFileTree();
31959
+ const treeString = currentFiles.join(`
31960
+ `);
31961
+ const newTreeHash = this.hashTree(treeString);
31962
+ const existingIndex = this.loadIndex();
31963
+ if (!force && existingIndex?.treeHash === newTreeHash) {
31964
+ onProgress?.("No file changes detected, skipping reindex");
31965
+ return null;
31966
+ }
31967
+ const currentHashes = this.computeFileHashes(currentFiles);
31968
+ const existingHashes = existingIndex?.fileHashes;
31969
+ const canIncremental = !force && existingIndex && existingHashes;
31970
+ if (canIncremental) {
31971
+ onProgress?.("Performing incremental update");
31972
+ const { added, deleted, modified } = this.diffFiles(currentHashes, existingHashes);
31973
+ const changedFiles = [...added, ...modified];
31974
+ const totalChanges = changedFiles.length + deleted.length;
31975
+ const existingFileCount = Object.keys(existingHashes).length;
31976
+ onProgress?.(`File changes detected: ${changedFiles.length} changed, ${added.length} added, ${deleted.length} deleted`);
31977
+ if (existingFileCount > 0) {
31978
+ const changeRatio = totalChanges / existingFileCount;
31979
+ if (changeRatio <= this.fullReindexRatioThreshold && changedFiles.length > 0) {
31980
+ onProgress?.(`Reindexing ${changedFiles.length} changed files and merging with existing index`);
31981
+ const incrementalIndex = await treeSummarizer(changedFiles.join(`
31982
+ `));
31983
+ const updatedIndex = this.cloneIndex(existingIndex);
31984
+ this.removeFilesFromIndex(updatedIndex, [...deleted, ...modified]);
31985
+ return this.mergeIndex(updatedIndex, incrementalIndex, currentHashes, newTreeHash);
31986
+ }
31987
+ if (changedFiles.length === 0 && deleted.length > 0) {
31988
+ onProgress?.(`Removing ${deleted.length} deleted files from index`);
31989
+ const updatedIndex = this.cloneIndex(existingIndex);
31990
+ this.removeFilesFromIndex(updatedIndex, deleted);
31991
+ return this.applyIndexMetadata(updatedIndex, currentHashes, newTreeHash);
31992
+ }
31993
+ if (changedFiles.length === 0 && deleted.length === 0) {
31994
+ onProgress?.("No actual file changes, updating hashes only");
31995
+ const updatedIndex = this.cloneIndex(existingIndex);
31996
+ return this.applyIndexMetadata(updatedIndex, currentHashes, newTreeHash);
31997
+ }
31998
+ onProgress?.(`Too many changes (${(changeRatio * 100).toFixed(1)}%), performing full reindex`);
31999
+ }
32000
+ }
32001
+ onProgress?.("AI is analyzing codebase structure...");
32002
+ const index = await treeSummarizer(treeString);
32003
+ return this.applyIndexMetadata(index, currentHashes, newTreeHash);
32004
+ }
32005
+ async getFileTree() {
32006
+ const gitmodulesPath = join3(this.projectPath, ".gitmodules");
32007
+ const submoduleIgnores = [];
32008
+ if (existsSync2(gitmodulesPath)) {
32009
+ try {
32010
+ const content = readFileSync2(gitmodulesPath, "utf-8");
32011
+ const lines = content.split(`
32012
+ `);
32013
+ for (const line of lines) {
32014
+ const match = line.match(/^\s*path\s*=\s*(.*)$/);
32015
+ const path2 = match?.[1]?.trim();
32016
+ if (path2) {
32017
+ submoduleIgnores.push(`${path2}/**`);
32018
+ submoduleIgnores.push(`**/${path2}/**`);
32019
+ }
32020
+ }
32021
+ } catch {}
32022
+ }
32023
+ return globby(["**/*"], {
32024
+ cwd: this.projectPath,
32025
+ gitignore: true,
32026
+ ignore: [
32027
+ ...submoduleIgnores,
32028
+ "**/node_modules/**",
32029
+ "**/dist/**",
32030
+ "**/build/**",
32031
+ "**/target/**",
32032
+ "**/bin/**",
32033
+ "**/obj/**",
32034
+ "**/.next/**",
32035
+ "**/.svelte-kit/**",
32036
+ "**/.nuxt/**",
32037
+ "**/.cache/**",
32038
+ "**/out/**",
32039
+ "**/__tests__/**",
32040
+ "**/coverage/**",
32041
+ "**/*.test.*",
32042
+ "**/*.spec.*",
32043
+ "**/*.d.ts",
32044
+ "**/tsconfig.tsbuildinfo",
32045
+ "**/.locus/*.json",
32046
+ "**/.locus/*.md",
32047
+ "**/.locus/!(artifacts)/**",
32048
+ "**/.git/**",
32049
+ "**/.svn/**",
32050
+ "**/.hg/**",
32051
+ "**/.vscode/**",
32052
+ "**/.idea/**",
32053
+ "**/.DS_Store",
32054
+ "**/bun.lock",
32055
+ "**/package-lock.json",
32056
+ "**/yarn.lock",
32057
+ "**/pnpm-lock.yaml",
32058
+ "**/Cargo.lock",
32059
+ "**/go.sum",
32060
+ "**/poetry.lock",
32061
+ "**/*.{png,jpg,jpeg,gif,svg,ico,mp4,webm,wav,mp3,woff,woff2,eot,ttf,otf,pdf,zip,tar.gz,rar}"
32062
+ ]
32063
+ });
32064
+ }
32065
+ loadIndex() {
32066
+ if (existsSync2(this.indexPath)) {
32067
+ try {
32068
+ return JSON.parse(readFileSync2(this.indexPath, "utf-8"));
32069
+ } catch {
32070
+ return null;
32071
+ }
32072
+ }
32073
+ return null;
32074
+ }
32075
+ saveIndex(index) {
32076
+ const dir = dirname(this.indexPath);
32077
+ if (!existsSync2(dir)) {
32078
+ mkdirSync2(dir, { recursive: true });
32079
+ }
32080
+ writeFileSync2(this.indexPath, JSON.stringify(index, null, 2));
32081
+ }
32082
+ cloneIndex(index) {
32083
+ return JSON.parse(JSON.stringify(index));
32084
+ }
32085
+ applyIndexMetadata(index, fileHashes, treeHash) {
32086
+ index.lastIndexed = new Date().toISOString();
32087
+ index.treeHash = treeHash;
32088
+ index.fileHashes = fileHashes;
32089
+ return index;
32090
+ }
32091
+ hashTree(tree) {
32092
+ return createHash("sha256").update(tree).digest("hex");
32093
+ }
32094
+ hashFile(filePath) {
32095
+ try {
32096
+ const content = readFileSync2(join3(this.projectPath, filePath), "utf-8");
32097
+ return createHash("sha256").update(content).digest("hex").slice(0, 16);
32098
+ } catch {
32099
+ return null;
32100
+ }
32101
+ }
32102
+ computeFileHashes(files) {
32103
+ const hashes = {};
32104
+ for (const file2 of files) {
32105
+ const hash2 = this.hashFile(file2);
32106
+ if (hash2 !== null) {
32107
+ hashes[file2] = hash2;
32108
+ }
32109
+ }
32110
+ return hashes;
32111
+ }
32112
+ diffFiles(currentHashes, existingHashes) {
32113
+ const currentFiles = Object.keys(currentHashes);
32114
+ const existingFiles = Object.keys(existingHashes);
32115
+ const existingSet = new Set(existingFiles);
32116
+ const currentSet = new Set(currentFiles);
32117
+ const added = currentFiles.filter((f) => !existingSet.has(f));
32118
+ const deleted = existingFiles.filter((f) => !currentSet.has(f));
32119
+ const modified = currentFiles.filter((f) => existingSet.has(f) && currentHashes[f] !== existingHashes[f]);
32120
+ return { added, deleted, modified };
32121
+ }
32122
+ removeFilesFromIndex(index, files) {
32123
+ const fileSet = new Set(files);
32124
+ for (const file2 of files) {
32125
+ delete index.responsibilities[file2];
32126
+ }
32127
+ for (const [symbol2, paths] of Object.entries(index.symbols)) {
32128
+ index.symbols[symbol2] = paths.filter((p) => !fileSet.has(p));
32129
+ if (index.symbols[symbol2].length === 0) {
32130
+ delete index.symbols[symbol2];
32131
+ }
32132
+ }
32133
+ }
32134
+ mergeIndex(existing, incremental, newHashes, newTreeHash) {
32135
+ const mergedSymbols = { ...existing.symbols };
32136
+ for (const [symbol2, paths] of Object.entries(incremental.symbols)) {
32137
+ if (mergedSymbols[symbol2]) {
32138
+ mergedSymbols[symbol2] = [
32139
+ ...new Set([...mergedSymbols[symbol2], ...paths])
32140
+ ];
32141
+ } else {
32142
+ mergedSymbols[symbol2] = paths;
32143
+ }
32144
+ }
32145
+ const merged = {
32146
+ symbols: mergedSymbols,
32147
+ responsibilities: {
32148
+ ...existing.responsibilities,
32149
+ ...incremental.responsibilities
32150
+ },
32151
+ lastIndexed: ""
32152
+ };
32153
+ return this.applyIndexMetadata(merged, newHashes, newTreeHash);
32154
+ }
32155
+ }
32156
+
32157
+ // ../sdk/src/agent/codebase-indexer-service.ts
32158
+ class CodebaseIndexerService {
32159
+ deps;
32160
+ indexer;
32161
+ constructor(deps) {
32162
+ this.deps = deps;
32163
+ this.indexer = new CodebaseIndexer(deps.projectPath);
32164
+ }
32165
+ async reindex(force = false) {
32166
+ try {
32167
+ const index = await this.indexer.index((msg) => this.deps.log(msg, "info"), async (tree) => {
32168
+ const prompt = `You are a codebase analysis expert. Analyze the file tree and extract:
32169
+ 1. Key symbols (classes, functions, types) and their locations
32170
+ 2. Responsibilities of each directory/file
32171
+ 3. Overall project structure
32172
+
32173
+ Analyze this file tree and provide a JSON response with:
32174
+ - "symbols": object mapping symbol names to file paths (array)
32175
+ - "responsibilities": object mapping paths to brief descriptions
32176
+
32177
+ File tree:
32178
+ ${tree}
32179
+
32180
+ Return ONLY valid JSON, no markdown formatting.`;
32181
+ const response = await this.deps.aiRunner.run(prompt, true);
32182
+ const jsonMatch = response.match(/\{[\s\S]*\}/);
32183
+ if (jsonMatch) {
32184
+ return JSON.parse(jsonMatch[0]);
32185
+ }
32186
+ return { symbols: {}, responsibilities: {}, lastIndexed: "" };
32187
+ }, force);
32188
+ if (index === null) {
32189
+ this.deps.log("No changes detected, skipping reindex", "info");
32190
+ return;
32191
+ }
32192
+ this.indexer.saveIndex(index);
32193
+ this.deps.log("Codebase reindexed successfully", "success");
32194
+ } catch (error48) {
32195
+ this.deps.log(`Failed to reindex codebase: ${error48}`, "error");
32196
+ }
32197
+ }
32198
+ }
32043
32199
  // ../sdk/src/core/prompt-builder.ts
32200
+ import { existsSync as existsSync3, readdirSync as readdirSync2, readFileSync as readFileSync3, statSync as statSync2 } from "node:fs";
32201
+ import { homedir } from "node:os";
32202
+ import { join as join4 } from "node:path";
32044
32203
  class PromptBuilder {
32045
32204
  projectPath;
32046
32205
  constructor(projectPath) {
32047
32206
  this.projectPath = projectPath;
32048
32207
  }
32049
- async build(task2) {
32208
+ async build(task2, options = {}) {
32050
32209
  let prompt = `# Task: ${task2.title}
32051
32210
 
32052
32211
  `;
@@ -32061,18 +32220,81 @@ You are acting as a ${roleText}.
32061
32220
  ${task2.description || "No description provided."}
32062
32221
 
32063
32222
  `;
32223
+ const projectConfig = this.getProjectConfig();
32224
+ if (projectConfig) {
32225
+ prompt += `## Project Metadata
32226
+ `;
32227
+ prompt += `- Version: ${projectConfig.version || "Unknown"}
32228
+ `;
32229
+ prompt += `- Created At: ${projectConfig.createdAt || "Unknown"}
32230
+
32231
+ `;
32232
+ }
32233
+ let serverContext = null;
32234
+ if (options.taskContext) {
32235
+ try {
32236
+ serverContext = JSON.parse(options.taskContext);
32237
+ } catch {
32238
+ serverContext = { context: options.taskContext };
32239
+ }
32240
+ }
32064
32241
  const contextPath = getLocusPath(this.projectPath, "contextFile");
32242
+ let hasLocalContext = false;
32065
32243
  if (existsSync3(contextPath)) {
32066
32244
  try {
32067
32245
  const context = readFileSync3(contextPath, "utf-8");
32068
- prompt += `## Project Context (from CLAUDE.md)
32246
+ if (context.trim().length > 20) {
32247
+ prompt += `## Project Context (Local)
32069
32248
  ${context}
32070
32249
 
32071
32250
  `;
32251
+ hasLocalContext = true;
32252
+ }
32072
32253
  } catch (err) {
32073
32254
  console.warn(`Warning: Could not read context file: ${err}`);
32074
32255
  }
32075
32256
  }
32257
+ if (!hasLocalContext) {
32258
+ const fallback = this.getFallbackContext();
32259
+ if (fallback) {
32260
+ prompt += `## Project Context (README Fallback)
32261
+ ${fallback}
32262
+
32263
+ `;
32264
+ }
32265
+ }
32266
+ if (serverContext) {
32267
+ prompt += `## Project Context (Server)
32268
+ `;
32269
+ if (serverContext.project) {
32270
+ prompt += `- Project: ${serverContext.project.name || "Unknown"}
32271
+ `;
32272
+ if (!hasLocalContext && serverContext.project.techStack?.length) {
32273
+ prompt += `- Tech Stack: ${serverContext.project.techStack.join(", ")}
32274
+ `;
32275
+ }
32276
+ }
32277
+ if (serverContext.context) {
32278
+ prompt += `
32279
+ ${serverContext.context}
32280
+ `;
32281
+ }
32282
+ prompt += `
32283
+ `;
32284
+ }
32285
+ prompt += this.getProjectStructure();
32286
+ prompt += this.getSkillsInfo();
32287
+ prompt += `## Project Knowledge Base
32288
+ `;
32289
+ prompt += `You have access to the following documentation directories for context:
32290
+ `;
32291
+ prompt += `- Artifacts: \`.locus/artifacts\`
32292
+ `;
32293
+ prompt += `- Documents: \`.locus/documents\`
32294
+ `;
32295
+ prompt += `If you need more information about the project strategies, plans, or architecture, please read files in these directories.
32296
+
32297
+ `;
32076
32298
  const indexPath = getLocusPath(this.projectPath, "indexFile");
32077
32299
  if (existsSync3(indexPath)) {
32078
32300
  prompt += `## Codebase Overview
@@ -32081,11 +32303,19 @@ There is an index file in the .locus/codebase-index.json and if you need you can
32081
32303
  `;
32082
32304
  }
32083
32305
  if (task2.docs && task2.docs.length > 0) {
32084
- prompt += `## Attached Documents
32306
+ prompt += `## Attached Documents (Summarized)
32307
+ `;
32308
+ prompt += `> Full content available on server. Rely on Task Description for specific requirements.
32309
+
32085
32310
  `;
32086
32311
  for (const doc3 of task2.docs) {
32087
- prompt += `### ${doc3.title}
32088
- ${doc3.content || "(No content)"}
32312
+ const content = doc3.content || "";
32313
+ const limit = 800;
32314
+ const preview = content.slice(0, limit);
32315
+ const isTruncated = content.length > limit;
32316
+ prompt += `### Doc: ${doc3.title}
32317
+ ${preview}${isTruncated ? `
32318
+ ...(truncated)...` : ""}
32089
32319
 
32090
32320
  `;
32091
32321
  }
@@ -32101,7 +32331,7 @@ ${doc3.content || "(No content)"}
32101
32331
  `;
32102
32332
  }
32103
32333
  if (task2.comments && task2.comments.length > 0) {
32104
- const comments = task2.comments.slice(0, 5);
32334
+ const comments = task2.comments.slice(0, 3);
32105
32335
  prompt += `## Task History & Feedback
32106
32336
  `;
32107
32337
  prompt += `Review the following comments for context or rejection feedback:
@@ -32123,6 +32353,108 @@ ${comment.text}
32123
32353
  `;
32124
32354
  return prompt;
32125
32355
  }
32356
+ getProjectConfig() {
32357
+ const configPath = getLocusPath(this.projectPath, "configFile");
32358
+ if (existsSync3(configPath)) {
32359
+ try {
32360
+ return JSON.parse(readFileSync3(configPath, "utf-8"));
32361
+ } catch {
32362
+ return null;
32363
+ }
32364
+ }
32365
+ return null;
32366
+ }
32367
+ getFallbackContext() {
32368
+ const readmePath = join4(this.projectPath, "README.md");
32369
+ if (existsSync3(readmePath)) {
32370
+ try {
32371
+ const content = readFileSync3(readmePath, "utf-8");
32372
+ const limit = 1000;
32373
+ return content.slice(0, limit) + (content.length > limit ? `
32374
+ ...(truncated)...` : "");
32375
+ } catch {
32376
+ return "";
32377
+ }
32378
+ }
32379
+ return "";
32380
+ }
32381
+ getProjectStructure() {
32382
+ try {
32383
+ const entries = readdirSync2(this.projectPath);
32384
+ const folders = entries.filter((e) => {
32385
+ if (e.startsWith(".") || e === "node_modules")
32386
+ return false;
32387
+ try {
32388
+ return statSync2(join4(this.projectPath, e)).isDirectory();
32389
+ } catch {
32390
+ return false;
32391
+ }
32392
+ });
32393
+ if (folders.length === 0)
32394
+ return "";
32395
+ let structure = `## Project Structure
32396
+ `;
32397
+ structure += `Key directories in this project:
32398
+ `;
32399
+ for (const folder of folders) {
32400
+ structure += `- \`${folder}/\`
32401
+ `;
32402
+ }
32403
+ return `${structure}
32404
+ `;
32405
+ } catch {
32406
+ return "";
32407
+ }
32408
+ }
32409
+ getSkillsInfo() {
32410
+ const projectSkillsDirs = [
32411
+ LOCUS_CONFIG.agentSkillsDir,
32412
+ ".cursor/skills",
32413
+ ".claude/skills",
32414
+ ".codex/skills",
32415
+ ".gemini/skills"
32416
+ ];
32417
+ const globalHome = homedir();
32418
+ const globalSkillsDirs = [
32419
+ join4(globalHome, ".cursor/skills"),
32420
+ join4(globalHome, ".claude/skills"),
32421
+ join4(globalHome, ".codex/skills"),
32422
+ join4(globalHome, ".gemini/skills")
32423
+ ];
32424
+ const allSkillNames = new Set;
32425
+ for (const relativePath of projectSkillsDirs) {
32426
+ const fullPath = join4(this.projectPath, relativePath);
32427
+ this.scanSkillsInDirectory(fullPath, allSkillNames);
32428
+ }
32429
+ for (const fullPath of globalSkillsDirs) {
32430
+ this.scanSkillsInDirectory(fullPath, allSkillNames);
32431
+ }
32432
+ const uniqueSkills = Array.from(allSkillNames).sort();
32433
+ if (uniqueSkills.length === 0)
32434
+ return "";
32435
+ return `## Available Agent Skills
32436
+ ` + `The project has the following specialized skills available (from project or global locations):
32437
+ ` + uniqueSkills.map((s) => `- ${s}`).join(`
32438
+ `) + `
32439
+
32440
+ `;
32441
+ }
32442
+ scanSkillsInDirectory(dirPath, skillSet) {
32443
+ if (!existsSync3(dirPath))
32444
+ return;
32445
+ try {
32446
+ const entries = readdirSync2(dirPath).filter((name) => {
32447
+ try {
32448
+ return statSync2(join4(dirPath, name)).isDirectory();
32449
+ } catch {
32450
+ return false;
32451
+ }
32452
+ });
32453
+ for (const entry of entries) {
32454
+ skillSet.add(entry);
32455
+ }
32456
+ } catch {}
32457
+ }
32126
32458
  roleToText(role) {
32127
32459
  if (!role) {
32128
32460
  return null;
@@ -32152,18 +32484,11 @@ class TaskExecutor {
32152
32484
  this.deps = deps;
32153
32485
  this.promptBuilder = new PromptBuilder(deps.projectPath);
32154
32486
  }
32155
- updateSprintPlan(sprintPlan) {
32156
- this.deps.sprintPlan = sprintPlan;
32157
- }
32158
- async execute(task2) {
32487
+ async execute(task2, context) {
32159
32488
  this.deps.log(`Executing: ${task2.title}`, "info");
32160
- let basePrompt = await this.promptBuilder.build(task2);
32161
- if (this.deps.sprintPlan) {
32162
- basePrompt = `## Sprint Context
32163
- ${this.deps.sprintPlan}
32164
-
32165
- ${basePrompt}`;
32166
- }
32489
+ const basePrompt = await this.promptBuilder.build(task2, {
32490
+ taskContext: context
32491
+ });
32167
32492
  try {
32168
32493
  let plan = null;
32169
32494
  if (this.deps.skipPlanning) {
@@ -32363,12 +32688,8 @@ class ClaudeRunner {
32363
32688
  return null;
32364
32689
  }
32365
32690
  handleEvent(event) {
32366
- const { type, delta, content_block } = event;
32367
- if (type === "content_block_delta" && delta) {
32368
- if (delta.type === "text_delta" && delta.text) {
32369
- this.log?.(delta.text, "info");
32370
- }
32371
- } else if (type === "content_block_start" && content_block) {
32691
+ const { type, content_block } = event;
32692
+ if (type === "content_block_start" && content_block) {
32372
32693
  if (content_block.type === "tool_use" && content_block.name) {
32373
32694
  this.log?.(`
32374
32695
 
@@ -32389,7 +32710,7 @@ import { spawn as spawn2 } from "node:child_process";
32389
32710
  import { randomUUID } from "node:crypto";
32390
32711
  import { existsSync as existsSync4, readFileSync as readFileSync4, unlinkSync } from "node:fs";
32391
32712
  import { tmpdir } from "node:os";
32392
- import { join as join4 } from "node:path";
32713
+ import { join as join5 } from "node:path";
32393
32714
  class CodexRunner {
32394
32715
  projectPath;
32395
32716
  model;
@@ -32418,7 +32739,7 @@ class CodexRunner {
32418
32739
  }
32419
32740
  executeRun(prompt) {
32420
32741
  return new Promise((resolve2, reject) => {
32421
- const outputPath = join4(tmpdir(), `locus-codex-${randomUUID()}.txt`);
32742
+ const outputPath = join5(tmpdir(), `locus-codex-${randomUUID()}.txt`);
32422
32743
  const args = this.buildArgs(outputPath);
32423
32744
  const codex = spawn2("codex", args, {
32424
32745
  cwd: this.projectPath,
@@ -32455,7 +32776,13 @@ class CodexRunner {
32455
32776
  });
32456
32777
  }
32457
32778
  buildArgs(outputPath) {
32458
- const args = ["exec", "--full-auto", "--output-last-message", outputPath];
32779
+ const args = [
32780
+ "exec",
32781
+ "--full-auto",
32782
+ "--skip-git-repo-check",
32783
+ "--output-last-message",
32784
+ outputPath
32785
+ ];
32459
32786
  if (this.model) {
32460
32787
  args.push("--model", this.model);
32461
32788
  }
@@ -33701,7 +34028,7 @@ function transformData(fns, response) {
33701
34028
  const context = response || config2;
33702
34029
  const headers = AxiosHeaders_default.from(context.headers);
33703
34030
  let data = context.data;
33704
- utils_default.forEach(fns, function transform(fn) {
34031
+ utils_default.forEach(fns, function transform2(fn) {
33705
34032
  data = fn.call(config2, data, headers.normalize(), response ? response.status : undefined);
33706
34033
  });
33707
34034
  headers.normalize();
@@ -35934,6 +36261,28 @@ class BaseModule {
35934
36261
  }
35935
36262
  }
35936
36263
 
36264
+ // ../sdk/src/modules/ai.ts
36265
+ class AIModule extends BaseModule {
36266
+ async chat(workspaceId, body) {
36267
+ const { data } = await this.api.post(`/ai/${workspaceId}/chat`, body);
36268
+ return data;
36269
+ }
36270
+ async listSessions(workspaceId) {
36271
+ const { data } = await this.api.get(`/ai/${workspaceId}/sessions`);
36272
+ return data;
36273
+ }
36274
+ async getSession(workspaceId, sessionId) {
36275
+ const { data } = await this.api.get(`/ai/${workspaceId}/session/${sessionId}`);
36276
+ return data;
36277
+ }
36278
+ getChatStreamUrl(workspaceId, sessionId) {
36279
+ return `${this.api.defaults.baseURL}/ai/${workspaceId}/chat/stream?sessionId=${sessionId}`;
36280
+ }
36281
+ async deleteSession(workspaceId, sessionId) {
36282
+ await this.api.delete(`/ai/${workspaceId}/session/${sessionId}`);
36283
+ }
36284
+ }
36285
+
35937
36286
  // ../sdk/src/modules/auth.ts
35938
36287
  class AuthModule extends BaseModule {
35939
36288
  async getMe() {
@@ -36097,6 +36446,10 @@ class SprintsModule extends BaseModule {
36097
36446
  const { data } = await this.api.post(`/workspaces/${workspaceId}/sprints/${id}/complete`);
36098
36447
  return data.sprint;
36099
36448
  }
36449
+ async triggerAIPlanning(id, workspaceId) {
36450
+ const { data } = await this.api.post(`/workspaces/${workspaceId}/sprints/${id}/trigger-ai-planning`);
36451
+ return data.sprint;
36452
+ }
36100
36453
  }
36101
36454
 
36102
36455
  // ../sdk/src/modules/tasks.ts
@@ -36142,6 +36495,16 @@ class TasksModule extends BaseModule {
36142
36495
  const { data } = await this.api.post(`/workspaces/${workspaceId}/tasks/${id}/comment`, body);
36143
36496
  return data.comment;
36144
36497
  }
36498
+ async batchUpdate(ids, workspaceId, updates) {
36499
+ await this.api.patch(`/workspaces/${workspaceId}/tasks/batch`, {
36500
+ ids,
36501
+ updates
36502
+ });
36503
+ }
36504
+ async getContext(id, workspaceId) {
36505
+ const { data } = await this.api.get(`/workspaces/${workspaceId}/tasks/${id}/context`);
36506
+ return data;
36507
+ }
36145
36508
  }
36146
36509
 
36147
36510
  // ../sdk/src/modules/workspaces.ts
@@ -36195,6 +36558,7 @@ class LocusClient {
36195
36558
  api;
36196
36559
  emitter;
36197
36560
  auth;
36561
+ ai;
36198
36562
  tasks;
36199
36563
  sprints;
36200
36564
  workspaces;
@@ -36206,7 +36570,7 @@ class LocusClient {
36206
36570
  this.emitter = new LocusEmitter;
36207
36571
  this.api = axios_default.create({
36208
36572
  baseURL: config2.baseUrl,
36209
- timeout: config2.timeout || 1e4,
36573
+ timeout: config2.timeout || 60000,
36210
36574
  headers: {
36211
36575
  "Content-Type": "application/json",
36212
36576
  ...config2.token ? { Authorization: `Bearer ${config2.token}` } : {}
@@ -36214,6 +36578,7 @@ class LocusClient {
36214
36578
  });
36215
36579
  this.setupInterceptors();
36216
36580
  this.auth = new AuthModule(this.api, this.emitter);
36581
+ this.ai = new AIModule(this.api, this.emitter);
36217
36582
  this.tasks = new TasksModule(this.api, this.emitter);
36218
36583
  this.sprints = new SprintsModule(this.api, this.emitter);
36219
36584
  this.workspaces = new WorkspacesModule(this.api, this.emitter);
@@ -36297,16 +36662,14 @@ class AgentWorker {
36297
36662
  config;
36298
36663
  client;
36299
36664
  aiRunner;
36300
- sprintPlanner;
36301
36665
  indexerService;
36302
36666
  artifactSyncer;
36303
36667
  taskExecutor;
36304
36668
  consecutiveEmpty = 0;
36305
- maxEmpty = 5;
36669
+ maxEmpty = 60;
36306
36670
  maxTasks = 50;
36307
36671
  tasksCompleted = 0;
36308
36672
  pollInterval = 1e4;
36309
- sprintPlan = null;
36310
36673
  constructor(config2) {
36311
36674
  this.config = config2;
36312
36675
  const projectPath = config2.projectPath || process.cwd();
@@ -36327,10 +36690,6 @@ class AgentWorker {
36327
36690
  model: config2.model,
36328
36691
  log
36329
36692
  });
36330
- this.sprintPlanner = new SprintPlanner({
36331
- aiRunner: this.aiRunner,
36332
- log
36333
- });
36334
36693
  this.indexerService = new CodebaseIndexerService({
36335
36694
  aiRunner: this.aiRunner,
36336
36695
  projectPath,
@@ -36345,7 +36704,6 @@ class AgentWorker {
36345
36704
  this.taskExecutor = new TaskExecutor({
36346
36705
  aiRunner: this.aiRunner,
36347
36706
  projectPath,
36348
- sprintPlan: null,
36349
36707
  skipPlanning: config2.skipPlanning,
36350
36708
  log
36351
36709
  });
@@ -36384,8 +36742,13 @@ class AgentWorker {
36384
36742
  }
36385
36743
  async executeTask(task2) {
36386
36744
  const fullTask = await this.client.tasks.getById(task2.id, this.config.workspaceId);
36387
- this.taskExecutor.updateSprintPlan(this.sprintPlan);
36388
- const result = await this.taskExecutor.execute(fullTask);
36745
+ let context = "";
36746
+ try {
36747
+ context = await this.client.tasks.getContext(task2.id, this.config.workspaceId);
36748
+ } catch (err) {
36749
+ this.log(`Failed to fetch task context: ${err}`, "warn");
36750
+ }
36751
+ const result = await this.taskExecutor.execute(fullTask, context);
36389
36752
  await this.indexerService.reindex();
36390
36753
  return result;
36391
36754
  }
@@ -36393,35 +36756,12 @@ class AgentWorker {
36393
36756
  this.log(`Agent started in ${this.config.projectPath || process.cwd()}`, "success");
36394
36757
  const sprint2 = await this.getActiveSprint();
36395
36758
  if (sprint2) {
36396
- this.log(`Found active sprint: ${sprint2.name} (${sprint2.id})`, "info");
36397
- const tasks2 = await this.client.tasks.list(this.config.workspaceId, {
36398
- sprintId: sprint2.id
36399
- });
36400
- const activeTasks = tasks2.filter((t) => t.status === "BACKLOG" /* BACKLOG */ || t.status === "IN_PROGRESS" /* IN_PROGRESS */);
36401
- this.log(`Sprint tasks found: ${activeTasks.length}`, "info");
36402
- if (activeTasks.length <= 1) {
36403
- this.log("Skipping mindmap generation (only one task in sprint).", "info");
36404
- this.sprintPlan = null;
36405
- } else {
36406
- const latestTaskCreation = activeTasks.reduce((latest, task2) => {
36407
- const taskDate = new Date(task2.createdAt);
36408
- return taskDate > latest ? taskDate : latest;
36409
- }, new Date(0));
36410
- const mindmapDate = sprint2.mindmapUpdatedAt ? new Date(sprint2.mindmapUpdatedAt) : new Date(0);
36411
- const needsPlanning = !sprint2.mindmap || sprint2.mindmap.trim() === "" || latestTaskCreation > mindmapDate;
36412
- if (needsPlanning) {
36413
- if (sprint2.mindmap && latestTaskCreation > mindmapDate) {
36414
- this.log("New tasks have been added to the sprint since last mindmap. Regenerating...", "warn");
36415
- }
36416
- this.sprintPlan = await this.sprintPlanner.planSprint(sprint2, tasks2);
36417
- await this.client.sprints.update(sprint2.id, this.config.workspaceId, {
36418
- mindmap: this.sprintPlan,
36419
- mindmapUpdatedAt: new Date
36420
- });
36421
- } else {
36422
- this.log("Using existing sprint mindmap.", "info");
36423
- this.sprintPlan = sprint2.mindmap ?? null;
36424
- }
36759
+ this.log(`Active sprint found: ${sprint2.name}. Ensuring plan is up to date...`, "info");
36760
+ try {
36761
+ await this.client.sprints.triggerAIPlanning(sprint2.id, this.config.workspaceId);
36762
+ this.log(`Sprint plan sync checked on server.`, "success");
36763
+ } catch (err) {
36764
+ this.log(`Sprint planning sync failed (non-critical): ${err instanceof Error ? err.message : String(err)}`, "warn");
36425
36765
  }
36426
36766
  } else {
36427
36767
  this.log("No active sprint found for planning.", "warn");
@@ -36441,7 +36781,11 @@ class AgentWorker {
36441
36781
  this.consecutiveEmpty = 0;
36442
36782
  this.log(`Claimed: ${task2.title}`, "success");
36443
36783
  const result = await this.executeTask(task2);
36444
- await this.artifactSyncer.sync();
36784
+ try {
36785
+ await this.artifactSyncer.sync();
36786
+ } catch (err) {
36787
+ this.log(`Artifact sync failed: ${err}`, "error");
36788
+ }
36445
36789
  if (result.success) {
36446
36790
  this.log(`Completed: ${task2.title}`, "success");
36447
36791
  await this.client.tasks.update(task2.id, this.config.workspaceId, {
@@ -36478,7 +36822,7 @@ if (process.argv[1]?.includes("agent-worker") || process.argv[1]?.includes("work
36478
36822
  config2.workspaceId = args[++i];
36479
36823
  else if (arg === "--sprint-id")
36480
36824
  config2.sprintId = args[++i];
36481
- else if (arg === "--api-base")
36825
+ else if (arg === "--api-url")
36482
36826
  config2.apiBase = args[++i];
36483
36827
  else if (arg === "--api-key")
36484
36828
  config2.apiKey = args[++i];
@@ -36507,7 +36851,7 @@ if (process.argv[1]?.includes("agent-worker") || process.argv[1]?.includes("work
36507
36851
  // ../sdk/src/orchestrator.ts
36508
36852
  import { spawn as spawn3 } from "node:child_process";
36509
36853
  import { existsSync as existsSync5 } from "node:fs";
36510
- import { dirname as dirname2, join as join5 } from "node:path";
36854
+ import { dirname as dirname2, join as join6 } from "node:path";
36511
36855
  import { fileURLToPath as fileURLToPath2 } from "node:url";
36512
36856
  import { EventEmitter as EventEmitter3 } from "events";
36513
36857
  class AgentOrchestrator extends EventEmitter3 {
@@ -36603,7 +36947,7 @@ ${c.success("✅ Orchestrator finished")}`);
36603
36947
  const potentialPaths = [];
36604
36948
  const currentModulePath = fileURLToPath2(import.meta.url);
36605
36949
  const currentModuleDir = dirname2(currentModulePath);
36606
- potentialPaths.push(join5(currentModuleDir, "agent", "worker.js"), join5(currentModuleDir, "worker.js"), join5(currentModuleDir, "agent", "worker.ts"));
36950
+ potentialPaths.push(join6(currentModuleDir, "agent", "worker.js"), join6(currentModuleDir, "worker.js"), join6(currentModuleDir, "agent", "worker.ts"));
36607
36951
  const workerPath = potentialPaths.find((p) => existsSync5(p));
36608
36952
  if (!workerPath) {
36609
36953
  throw new Error(`Worker file not found. Checked: ${potentialPaths.join(", ")}. ` + `Make sure the SDK is properly built and installed.`);
@@ -36613,7 +36957,7 @@ ${c.success("✅ Orchestrator finished")}`);
36613
36957
  agentId,
36614
36958
  "--workspace-id",
36615
36959
  this.config.workspaceId,
36616
- "--api-base",
36960
+ "--api-url",
36617
36961
  this.config.apiBase,
36618
36962
  "--api-key",
36619
36963
  this.config.apiKey,
@@ -36784,22 +37128,311 @@ ${summary}`
36784
37128
  }
36785
37129
  }
36786
37130
  // src/config-manager.ts
36787
- import { existsSync as existsSync6, mkdirSync as mkdirSync3, readFileSync as readFileSync5, writeFileSync as writeFileSync2 } from "node:fs";
36788
- import { join as join6 } from "node:path";
37131
+ import { existsSync as existsSync6, mkdirSync as mkdirSync3, readFileSync as readFileSync5, writeFileSync as writeFileSync3 } from "node:fs";
37132
+ import { join as join7 } from "node:path";
37133
+
37134
+ // src/templates/skills.ts
37135
+ var DEFAULT_SKILLS = [
37136
+ {
37137
+ name: "locus-expert",
37138
+ content: `---
37139
+ name: locus-expert
37140
+ description: Expertise in Locus-specific configuration, commands, and workflows.
37141
+ ---
37142
+ # Locus Expert Skill
37143
+
37144
+ Use this skill to help manage Locus in this project.
37145
+
37146
+ ## Locus Commands
37147
+ - \`locus init\`: Initialize Locus.
37148
+ - \`locus index\`: Index the codebase for AI context.
37149
+ - \`locus run\`: Start an agent to work on tasks.
37150
+
37151
+ ## Configuration
37152
+ - \`.locus/config.json\`: Main project configuration.
37153
+ - \`CLAUDE.md\`: AI context and preferences.
37154
+ `
37155
+ },
37156
+ {
37157
+ name: "project-navigator",
37158
+ content: `---
37159
+ name: project-navigator
37160
+ description: General guidelines for efficient codebase exploration and navigation.
37161
+ ---
37162
+ # Project Navigator Skill
37163
+
37164
+ Use this skill to explore and understand the codebase efficiently.
37165
+
37166
+ ## Navigation Tips
37167
+ - Start by exploring the root directory to understand the project structure.
37168
+ - Look for \`README.md\` and documentation files.
37169
+ - Identify the main entry points of the application.
37170
+ - Use \`grep\` or search tools to find relevant code sections.
37171
+ `
37172
+ },
37173
+ {
37174
+ name: "frontend-expert",
37175
+ content: `---
37176
+ name: frontend-expert
37177
+ description: Specialized instructions for modern frontend development (React, Next.js, CSS).
37178
+ ---
37179
+ # Frontend Expert Skill
37180
+
37181
+ Guidance for building premium, high-performance web interfaces.
37182
+
37183
+ ## Core Best Practices
37184
+ - Use semantic HTML and accessible ARIA attributes.
37185
+ - Prioritize responsive design and mobile-first approach.
37186
+ - Use Vanilla CSS or TailwindCSS as per project guidelines.
37187
+ - Focus on micro-animations and smooth transitions.
37188
+
37189
+ ## Testing
37190
+ - Use Playwright or Cypress for E2E tests.
37191
+ - Use React Testing Library for component testing.
37192
+ `
37193
+ },
37194
+ {
37195
+ name: "backend-expert",
37196
+ content: `---
37197
+ name: backend-expert
37198
+ description: Expertise in API design, database modeling, and server-side logic.
37199
+ ---
37200
+ # Backend Expert Skill
37201
+
37202
+ Guidance for building scalable, secure, and robust backend systems.
37203
+
37204
+ ## API Standards
37205
+ - Follow RESTful principles or GraphQL best practices.
37206
+ - Use clear versioning and consistent error handling.
37207
+ - Document APIs with Swagger/OpenAPI.
37208
+
37209
+ ## Database
37210
+ - Design efficient schemas and indexes.
37211
+ - Use migrations for all schema changes.
37212
+ - Handle transactions and concurrency correctly.
37213
+ `
37214
+ },
37215
+ {
37216
+ name: "testing-champion",
37217
+ content: `---
37218
+ name: testing-champion
37219
+ description: Driving project quality through comprehensive testing strategies.
37220
+ ---
37221
+ # Testing Champion Skill
37222
+
37223
+ Guidelines for ensuring project reliability and preventing regressions.
37224
+
37225
+ ## Test Pyramid
37226
+ - **Unit Tests**: Test individual functions and logic in isolation.
37227
+ - **Integration Tests**: Test interactions between different modules.
37228
+ - **E2E Tests**: Test critical user flows from end to end.
37229
+
37230
+ ## Requirements
37231
+ - Maintain high test coverage for critical paths.
37232
+ - Write descriptive test cases.
37233
+ - Run tests in CI before merging.
37234
+ `
37235
+ },
37236
+ {
37237
+ name: "devops-wizard",
37238
+ content: `---
37239
+ name: devops-wizard
37240
+ description: Expertise in CI/CD, deployment, and infrastructure management.
37241
+ ---
37242
+ # DevOps Wizard Skill
37243
+
37244
+ Guidance for maintaining high availability and smooth delivery pipelines.
37245
+
37246
+ ## CI/CD
37247
+ - Automate builds, tests, and deployments via GitHub Actions/GitLab CI.
37248
+ - Use staging environments for verification before production.
37249
+
37250
+ ## Infrastructure
37251
+ - Use Infrastructure as Code (Terraform, Pulumi).
37252
+ - Monitor system health and performance (Prometheus, Grafana).
37253
+ - Handle secrets securely via vault/secrets manager.
37254
+ `
37255
+ },
37256
+ {
37257
+ name: "security-sentinel",
37258
+ content: `---
37259
+ name: security-sentinel
37260
+ description: Specialized knowledge in web security, vulnerability assessment, and safe coding.
37261
+ ---
37262
+ # Security Sentinel Skill
37263
+
37264
+ Guidance for protecting the application and user data.
37265
+
37266
+ ## Safe Practices
37267
+ - Sanitize all user inputs to prevent XSS and SQL injection.
37268
+ - Implement proper Authentication and Authorization (RBAC).
37269
+ - Use HTTPS and security headers.
37270
+ - Regularly audit dependencies for vulnerabilities.
37271
+ `
37272
+ },
37273
+ {
37274
+ name: "performance-master",
37275
+ content: `---
37276
+ name: performance-master
37277
+ description: Deep focus on optimization, profiling, and efficient resource usage.
37278
+ ---
37279
+ # Performance Master Skill
37280
+
37281
+ Tactics for ensuring the application is fast and responsive.
37282
+
37283
+ ## Optimization Areas
37284
+ - **Frontend**: Reduce bundle size, optimize images, use lazy loading.
37285
+ - **Backend**: Implement caching strategies, optimize queries, profile CPU/Memory usage.
37286
+ - **Network**: Reduce latency and minimize round trips.
37287
+ `
37288
+ },
37289
+ {
37290
+ name: "docs-wordsmith",
37291
+ content: `---
37292
+ name: docs-wordsmith
37293
+ description: Expertise in technical writing and maintaining clear project documentation.
37294
+ ---
37295
+ # Docs Wordsmith Skill
37296
+
37297
+ Guidelines for keeping documentation clear, concise, and up to date.
37298
+
37299
+ ## Principles
37300
+ - Always update documentation when changing core logic.
37301
+ - Use clear headings and consistent terminology.
37302
+ - Provide examples for complex features.
37303
+ - Keep README.md helpful for new contributors.
37304
+ `
37305
+ },
37306
+ {
37307
+ name: "nextjs-optimizer",
37308
+ content: `---
37309
+ name: nextjs-optimizer
37310
+ description: Specialized guidance for Next.js performance and architecture.
37311
+ ---
37312
+ # Next.js Optimizer Skill
37313
+
37314
+ Expert instructions for high-performance Next.js applications.
37315
+
37316
+ ## Performance
37317
+ - Use Server Components by default.
37318
+ - Optimize images with next/image.
37319
+ - Implement Partial Prerendering (PPR) where applicable.
37320
+ - Monitor Core Web Vitals.
37321
+
37322
+ ## Architecture
37323
+ - Use App Router patterns.
37324
+ - Implement server actions for mutations.
37325
+ - Manage cache keys and revalidation carefully.
37326
+ `
37327
+ },
37328
+ {
37329
+ name: "zustand-specialist",
37330
+ content: `---
37331
+ name: zustand-specialist
37332
+ description: State management patterns and best practices using Zustand.
37333
+ ---
37334
+ # Zustand Specialist Skill
37335
+
37336
+ Guidance for efficient state management with Zustand.
37337
+
37338
+ ## Patterns
37339
+ - Slice pattern for organizing large stores.
37340
+ - Use selectors for atomic updates.
37341
+ - Keep stores focused and decoupled.
37342
+ - Handle persistence and hydration correctly.
37343
+ `
37344
+ },
37345
+ {
37346
+ name: "drizzle-guide",
37347
+ content: `---
37348
+ name: drizzle-guide
37349
+ description: Database schema design and query optimization with Drizzle ORM.
37350
+ ---
37351
+ # Drizzle Guide Skill
37352
+
37353
+ Best practices for Drizzle ORM and database management.
37354
+
37355
+ ## Schema Design
37356
+ - Define clear types and relationships.
37357
+ - Use migrations for all changes.
37358
+ - Implement indexes for frequently queried columns.
37359
+
37360
+ ## Querying
37361
+ - Optimize for performance (batching, joins).
37362
+ - Use transaction API for atomic operations.
37363
+ - Ensure type safety across the application.
37364
+ `
37365
+ },
37366
+ {
37367
+ name: "playwright-automation",
37368
+ content: `---
37369
+ name: playwright-automation
37370
+ description: Automation and E2E testing best practices using Playwright.
37371
+ ---
37372
+ # Playwright Automation Skill
37373
+
37374
+ Guidance for building reliable browser-based tests.
37375
+
37376
+ ## Best Practices
37377
+ - Use locators instead of selectors.
37378
+ - Implement page object models for cleaner tests.
37379
+ - Run tests in parallel to save time.
37380
+ - Capture trace files and videos for debugging.
37381
+ `
37382
+ },
37383
+ {
37384
+ name: "i18n-coordinator",
37385
+ content: `---
37386
+ name: i18n-coordinator
37387
+ description: Managing internationalization and localization workflows.
37388
+ ---
37389
+ # i18n Coordinator Skill
37390
+
37391
+ Guidance for globalizing your application.
37392
+
37393
+ ## Workflow
37394
+ - Use a central translation service (e.g., react-i18next).
37395
+ - Never hardcode user-facing strings.
37396
+ - Support RTL (Right-to-Left) layouts if needed.
37397
+ - Ensure dynamic content is properly translated.
37398
+ `
37399
+ },
37400
+ {
37401
+ name: "project-overview",
37402
+ content: `---
37403
+ name: project-overview
37404
+ description: High-level architectural map and project organization guidance.
37405
+ ---
37406
+ # Project Overview Skill
37407
+
37408
+ Guidance for understanding and maintaining the overall project architecture.
37409
+
37410
+ ## Structure
37411
+ - Maintain a clear dependency graph.
37412
+ - Document the responsibility of each folder/package.
37413
+ - Keep boundaries between components clean.
37414
+ - Ensure the codebase follows established patterns consistently.
37415
+ `
37416
+ }
37417
+ ];
37418
+
37419
+ // src/config-manager.ts
36789
37420
  class ConfigManager {
36790
37421
  projectPath;
36791
37422
  constructor(projectPath) {
36792
37423
  this.projectPath = projectPath;
36793
37424
  }
36794
37425
  async init(version2) {
36795
- const locusConfigDir = join6(this.projectPath, LOCUS_CONFIG.dir);
37426
+ const locusConfigDir = join7(this.projectPath, LOCUS_CONFIG.dir);
36796
37427
  const locusConfigPath = getLocusPath(this.projectPath, "configFile");
36797
37428
  const claudeMdPath = getLocusPath(this.projectPath, "contextFile");
36798
37429
  if (!existsSync6(claudeMdPath)) {
36799
37430
  const template = `# Locus Project Context
36800
37431
 
37432
+ # Workflow
37433
+ - Run lint and typecheck before completion
36801
37434
  `;
36802
- writeFileSync2(claudeMdPath, template);
37435
+ writeFileSync3(claudeMdPath, template);
36803
37436
  }
36804
37437
  if (!existsSync6(locusConfigDir)) {
36805
37438
  mkdirSync3(locusConfigDir, { recursive: true });
@@ -36810,7 +37443,27 @@ class ConfigManager {
36810
37443
  createdAt: new Date().toISOString(),
36811
37444
  projectPath: "."
36812
37445
  };
36813
- writeFileSync2(locusConfigPath, JSON.stringify(config2, null, 2));
37446
+ writeFileSync3(locusConfigPath, JSON.stringify(config2, null, 2));
37447
+ }
37448
+ const skillLocations = [
37449
+ LOCUS_CONFIG.agentSkillsDir,
37450
+ ".cursor/skills",
37451
+ ".claude/skills",
37452
+ ".codex/skills",
37453
+ ".gemini/skills"
37454
+ ];
37455
+ for (const location of skillLocations) {
37456
+ const skillsDir = join7(this.projectPath, location);
37457
+ if (!existsSync6(skillsDir)) {
37458
+ mkdirSync3(skillsDir, { recursive: true });
37459
+ }
37460
+ for (const skill of DEFAULT_SKILLS) {
37461
+ const skillPath = join7(skillsDir, skill.name);
37462
+ if (!existsSync6(skillPath)) {
37463
+ mkdirSync3(skillPath, { recursive: true });
37464
+ writeFileSync3(join7(skillPath, "SKILL.md"), skill.content);
37465
+ }
37466
+ }
36814
37467
  }
36815
37468
  }
36816
37469
  loadConfig() {
@@ -36825,7 +37478,7 @@ class ConfigManager {
36825
37478
  if (config2 && config2.version !== version2) {
36826
37479
  config2.version = version2;
36827
37480
  const path2 = getLocusPath(this.projectPath, "configFile");
36828
- writeFileSync2(path2, JSON.stringify(config2, null, 2));
37481
+ writeFileSync3(path2, JSON.stringify(config2, null, 2));
36829
37482
  }
36830
37483
  }
36831
37484
  }
@@ -36859,7 +37512,7 @@ function getVersion() {
36859
37512
  try {
36860
37513
  const __filename2 = fileURLToPath3(import.meta.url);
36861
37514
  const __dirname2 = dirname3(__filename2);
36862
- const packagePath = join7(__dirname2, "..", "package.json");
37515
+ const packagePath = join8(__dirname2, "..", "package.json");
36863
37516
  if (existsSync7(packagePath)) {
36864
37517
  const pkg = JSON.parse(readFileSync6(packagePath, "utf-8"));
36865
37518
  return pkg.version || "0.0.0";
@@ -36878,8 +37531,8 @@ function printBanner() {
36878
37531
  `));
36879
37532
  }
36880
37533
  function isProjectInitialized(projectPath) {
36881
- const locusDir = join7(projectPath, LOCUS_CONFIG.dir);
36882
- const configPath = join7(locusDir, LOCUS_CONFIG.configFile);
37534
+ const locusDir = join8(projectPath, LOCUS_CONFIG.dir);
37535
+ const configPath = join8(locusDir, LOCUS_CONFIG.configFile);
36883
37536
  return existsSync7(locusDir) && existsSync7(configPath);
36884
37537
  }
36885
37538
  function requireInitialization(projectPath, command) {
@@ -36923,9 +37576,9 @@ async function runCommand(args) {
36923
37576
  const projectPath = values.dir || process.cwd();
36924
37577
  requireInitialization(projectPath, "run");
36925
37578
  new ConfigManager(projectPath).updateVersion(VERSION2);
36926
- const apiKey = values["api-key"] || process.env.LOCUS_API_KEY;
36927
- const workspaceId = values.workspace || process.env.LOCUS_WORKSPACE_ID;
36928
- const provider = resolveProvider2(values.provider || process.env.LOCUS_AI_PROVIDER);
37579
+ const apiKey = values["api-key"];
37580
+ const workspaceId = values.workspace;
37581
+ const provider = resolveProvider2(values.provider);
36929
37582
  const model = values.model || DEFAULT_MODEL[provider];
36930
37583
  if (!apiKey || !workspaceId) {
36931
37584
  console.error(c.error("Error: --api-key and --workspace are required"));
@@ -36969,7 +37622,7 @@ async function indexCommand(args) {
36969
37622
  const projectPath = values.dir || process.cwd();
36970
37623
  requireInitialization(projectPath, "index");
36971
37624
  new ConfigManager(projectPath).updateVersion(VERSION2);
36972
- const provider = resolveProvider2(values.provider || process.env.LOCUS_AI_PROVIDER);
37625
+ const provider = resolveProvider2(values.provider);
36973
37626
  const model = values.model || DEFAULT_MODEL[provider];
36974
37627
  const aiRunner = createAiRunner(provider, {
36975
37628
  projectPath,
@@ -36979,7 +37632,9 @@ async function indexCommand(args) {
36979
37632
  const indexer = new CodebaseIndexer(projectPath);
36980
37633
  console.log(`${c.primary("\uD83D\uDD0D Indexing codebase in")} ${c.bold(projectPath)}...`);
36981
37634
  const index = await indexer.index((msg) => console.log(` ${c.dim(msg)}`), (tree) => summarizer.summarize(tree));
36982
- indexer.saveIndex(index);
37635
+ if (index) {
37636
+ indexer.saveIndex(index);
37637
+ }
36983
37638
  console.log(c.success("✅ Indexing complete!"));
36984
37639
  }
36985
37640
  async function initCommand() {
@@ -36988,7 +37643,7 @@ async function initCommand() {
36988
37643
  console.log(`
36989
37644
  ${c.info("ℹ️ Locus is already initialized in this directory.")}
36990
37645
 
36991
- Configuration found at: ${c.bold(join7(projectPath, LOCUS_CONFIG.dir))}
37646
+ Configuration found at: ${c.bold(join8(projectPath, LOCUS_CONFIG.dir))}
36992
37647
 
36993
37648
  If you want to reinitialize, please remove the .locus directory first.
36994
37649
  `);
@@ -37002,6 +37657,7 @@ Created:
37002
37657
  \uD83D\uDCC1 ${c.dim(".locus/")} - Locus configuration directory
37003
37658
  \uD83D\uDCC4 ${c.dim(".locus/config.json")} - Project configuration
37004
37659
  \uD83D\uDCDD ${c.dim("CLAUDE.md")} - AI context file
37660
+ \uD83D\uDCC1 ${c.dim(".agent/skills/")} - Agent skills (Frontend, Backend, DevOps, etc.)
37005
37661
 
37006
37662
  Next steps:
37007
37663
  1. Run '${c.primary("locus index")}' to index your codebase
@@ -37043,11 +37699,6 @@ Examples:
37043
37699
  locus index
37044
37700
  locus run --api-key YOUR_KEY --workspace WORKSPACE_ID
37045
37701
 
37046
- Environment Variables:
37047
- LOCUS_API_KEY API key for authentication
37048
- LOCUS_WORKSPACE_ID Workspace ID
37049
- LOCUS_AI_PROVIDER AI provider: claude or codex
37050
-
37051
37702
  For more information, visit: https://locusai.dev/docs
37052
37703
  `);
37053
37704
  }