haansi 0.1.101 → 0.1.103

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 (2) hide show
  1. package/dist/haansi.js +1174 -453
  2. package/package.json +1 -1
package/dist/haansi.js CHANGED
@@ -95,7 +95,7 @@ var require_package = __commonJS({
95
95
  "package.json"(exports2, module2) {
96
96
  module2.exports = {
97
97
  name: "haansi",
98
- version: "0.1.101",
98
+ version: "0.1.103",
99
99
  description: "Haansi CLI - Session collector and MCP server for Claude Code & OpenAI Codex",
100
100
  bin: {
101
101
  haansi: "./dist/haansi.js"
@@ -3063,21 +3063,21 @@ var require_wink_porter2_stemmer = __commonJS({
3063
3063
  return s;
3064
3064
  };
3065
3065
  var stem2 = function(word) {
3066
- var str = word.toLowerCase();
3067
- if (str.length < 3) return str;
3068
- if (exceptions1[str]) return exceptions1[str];
3069
- str = prelude(str);
3070
- str = step1a(str);
3071
- if (!rgxException2.test(str)) {
3072
- str = step1b(str);
3073
- str = step1c(str);
3074
- str = step2(str);
3075
- str = step3(str);
3076
- str = step4(str);
3077
- str = step5(str);
3078
- }
3079
- str = str.replace(/3/g, "y");
3080
- return str;
3066
+ var str2 = word.toLowerCase();
3067
+ if (str2.length < 3) return str2;
3068
+ if (exceptions1[str2]) return exceptions1[str2];
3069
+ str2 = prelude(str2);
3070
+ str2 = step1a(str2);
3071
+ if (!rgxException2.test(str2)) {
3072
+ str2 = step1b(str2);
3073
+ str2 = step1c(str2);
3074
+ str2 = step2(str2);
3075
+ str2 = step3(str2);
3076
+ str2 = step4(str2);
3077
+ str2 = step5(str2);
3078
+ }
3079
+ str2 = str2.replace(/3/g, "y");
3080
+ return str2;
3081
3081
  };
3082
3082
  module2.exports = stem2;
3083
3083
  }
@@ -3991,13 +3991,13 @@ var require_ms = __commonJS({
3991
3991
  "val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
3992
3992
  );
3993
3993
  };
3994
- function parse4(str) {
3995
- str = String(str);
3996
- if (str.length > 100) {
3994
+ function parse4(str2) {
3995
+ str2 = String(str2);
3996
+ if (str2.length > 100) {
3997
3997
  return;
3998
3998
  }
3999
3999
  var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
4000
- str
4000
+ str2
4001
4001
  );
4002
4002
  if (!match) {
4003
4003
  return;
@@ -10189,21 +10189,21 @@ var require_lib = __commonJS({
10189
10189
  3793,
10190
10190
  7920
10191
10191
  ];
10192
- var toUTF8Array = function toUTF8Array2(str) {
10192
+ var toUTF8Array = function toUTF8Array2(str2) {
10193
10193
  var char;
10194
10194
  var i = 0;
10195
10195
  var p = 0;
10196
10196
  var utf82 = [];
10197
- var len = str.length;
10197
+ var len = str2.length;
10198
10198
  for (; i < len; i++) {
10199
- char = str.charCodeAt(i);
10199
+ char = str2.charCodeAt(i);
10200
10200
  if (char < 128) {
10201
10201
  utf82[p++] = char;
10202
10202
  } else if (char < 2048) {
10203
10203
  utf82[p++] = char >> 6 | 192;
10204
10204
  utf82[p++] = char & 63 | 128;
10205
- } else if ((char & 64512) === 55296 && i + 1 < str.length && (str.charCodeAt(i + 1) & 64512) === 56320) {
10206
- char = 65536 + ((char & 1023) << 10) + (str.charCodeAt(++i) & 1023);
10205
+ } else if ((char & 64512) === 55296 && i + 1 < str2.length && (str2.charCodeAt(i + 1) & 64512) === 56320) {
10206
+ char = 65536 + ((char & 1023) << 10) + (str2.charCodeAt(++i) & 1023);
10207
10207
  utf82[p++] = char >> 18 | 240;
10208
10208
  utf82[p++] = char >> 12 & 63 | 128;
10209
10209
  utf82[p++] = char >> 6 & 63 | 128;
@@ -10216,13 +10216,13 @@ var require_lib = __commonJS({
10216
10216
  }
10217
10217
  return utf82;
10218
10218
  };
10219
- var generate = module2.exports = function generate2(str) {
10219
+ var generate = module2.exports = function generate2(str2) {
10220
10220
  var char;
10221
10221
  var i = 0;
10222
10222
  var start = -1;
10223
10223
  var result = 0;
10224
10224
  var resultHash = 0;
10225
- var utf82 = typeof str === "string" ? toUTF8Array(str) : str;
10225
+ var utf82 = typeof str2 === "string" ? toUTF8Array(str2) : str2;
10226
10226
  var len = utf82.length;
10227
10227
  while (i < len) {
10228
10228
  char = utf82[i++];
@@ -11111,7 +11111,7 @@ var require_node = __commonJS({
11111
11111
  var { formatters } = module2.exports;
11112
11112
  formatters.o = function(v) {
11113
11113
  this.inspectOpts.colors = this.useColors;
11114
- return util2.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
11114
+ return util2.inspect(v, this.inspectOpts).split("\n").map((str2) => str2.trim()).join(" ");
11115
11115
  };
11116
11116
  formatters.O = function(v) {
11117
11117
  this.inspectOpts.colors = this.useColors;
@@ -11167,9 +11167,9 @@ var require_debug2 = __commonJS({
11167
11167
  }
11168
11168
  }
11169
11169
  exports2.getStringValue = getStringValue;
11170
- function genRedactedString(str, maxLen) {
11171
- const { length } = str;
11172
- return length <= maxLen ? str : str.slice(0, maxLen) + ' ... <REDACTED full-length="' + length + '">';
11170
+ function genRedactedString(str2, maxLen) {
11171
+ const { length } = str2;
11172
+ return length <= maxLen ? str2 : str2.slice(0, maxLen) + ' ... <REDACTED full-length="' + length + '">';
11173
11173
  }
11174
11174
  exports2.genRedactedString = genRedactedString;
11175
11175
  function genDebugFunction(namespace) {
@@ -11179,9 +11179,9 @@ var require_debug2 = __commonJS({
11179
11179
  return;
11180
11180
  }
11181
11181
  for (let i = 1; i < args.length; i++) {
11182
- const str = getStringValue(args[i]);
11183
- if (typeof str === "string" && str.length > MAX_ARGUMENT_LENGTH) {
11184
- args[i] = genRedactedString(str, MAX_ARGUMENT_LENGTH);
11182
+ const str2 = getStringValue(args[i]);
11183
+ if (typeof str2 === "string" && str2.length > MAX_ARGUMENT_LENGTH) {
11184
+ args[i] = genRedactedString(str2, MAX_ARGUMENT_LENGTH);
11185
11185
  }
11186
11186
  }
11187
11187
  return fn.apply(null, args);
@@ -20969,20 +20969,20 @@ var require_utils3 = __commonJS({
20969
20969
  }
20970
20970
  return config6;
20971
20971
  }
20972
- var escapeIdentifier2 = function(str) {
20973
- return '"' + str.replace(/"/g, '""') + '"';
20972
+ var escapeIdentifier2 = function(str2) {
20973
+ return '"' + str2.replace(/"/g, '""') + '"';
20974
20974
  };
20975
- var escapeLiteral2 = function(str) {
20975
+ var escapeLiteral2 = function(str2) {
20976
20976
  let hasBackslash = false;
20977
20977
  let escaped = "'";
20978
- if (str == null) {
20978
+ if (str2 == null) {
20979
20979
  return "''";
20980
20980
  }
20981
- if (typeof str !== "string") {
20981
+ if (typeof str2 !== "string") {
20982
20982
  return "''";
20983
20983
  }
20984
- for (let i = 0; i < str.length; i++) {
20985
- const c = str[i];
20984
+ for (let i = 0; i < str2.length; i++) {
20985
+ const c = str2[i];
20986
20986
  if (c === "'") {
20987
20987
  escaped += c + c;
20988
20988
  } else if (c === "\\") {
@@ -21431,22 +21431,22 @@ var require_pg_connection_string = __commonJS({
21431
21431
  "../../node_modules/pg-connection-string/index.js"(exports2, module2) {
21432
21432
  "use strict";
21433
21433
  var { emitWarning } = require("node:process");
21434
- function parse4(str, options = {}) {
21435
- if (str.charAt(0) === "/") {
21436
- const config7 = str.split(" ");
21434
+ function parse4(str2, options = {}) {
21435
+ if (str2.charAt(0) === "/") {
21436
+ const config7 = str2.split(" ");
21437
21437
  return { host: config7[0], database: config7[1] };
21438
21438
  }
21439
21439
  const config6 = {};
21440
21440
  let result;
21441
21441
  let dummyHost = false;
21442
- if (/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(str)) {
21443
- str = encodeURI(str).replace(/%25(\d\d)/g, "%$1");
21442
+ if (/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(str2)) {
21443
+ str2 = encodeURI(str2).replace(/%25(\d\d)/g, "%$1");
21444
21444
  }
21445
21445
  try {
21446
21446
  try {
21447
- result = new URL(str, "postgres://base");
21447
+ result = new URL(str2, "postgres://base");
21448
21448
  } catch (e) {
21449
- result = new URL(str.replace("@/", "@___DUMMY___/"), "postgres://base");
21449
+ result = new URL(str2.replace("@/", "@___DUMMY___/"), "postgres://base");
21450
21450
  dummyHost = true;
21451
21451
  }
21452
21452
  } catch (err2) {
@@ -21589,8 +21589,8 @@ var require_pg_connection_string = __commonJS({
21589
21589
  }, {});
21590
21590
  return poolConfig;
21591
21591
  }
21592
- function parseIntoClientConfig(str) {
21593
- return toClientConfig(parse4(str));
21592
+ function parseIntoClientConfig(str2) {
21593
+ return toClientConfig(parse4(str2));
21594
21594
  }
21595
21595
  function deprecatedSslModeWarning(sslmode) {
21596
21596
  if (!deprecatedSslModeWarning.warned) {
@@ -23883,11 +23883,11 @@ var require_client = __commonJS({
23883
23883
  // escapeIdentifier and escapeLiteral moved to utility functions & exported
23884
23884
  // on PG
23885
23885
  // re-exported here for backwards compatibility
23886
- escapeIdentifier(str) {
23887
- return utils.escapeIdentifier(str);
23886
+ escapeIdentifier(str2) {
23887
+ return utils.escapeIdentifier(str2);
23888
23888
  }
23889
- escapeLiteral(str) {
23890
- return utils.escapeLiteral(str);
23889
+ escapeLiteral(str2) {
23890
+ return utils.escapeLiteral(str2);
23891
23891
  }
23892
23892
  _pulseQueryQueue() {
23893
23893
  if (this.readyForQuery === true) {
@@ -26109,6 +26109,38 @@ var init_src5 = __esm({
26109
26109
  }
26110
26110
  });
26111
26111
 
26112
+ // ../../packages/@company/db/src/keyword-terms.ts
26113
+ var COMMON_WORDS;
26114
+ var init_keyword_terms = __esm({
26115
+ "../../packages/@company/db/src/keyword-terms.ts"() {
26116
+ "use strict";
26117
+ COMMON_WORDS = new Set(
26118
+ `a about above after again against all also am an and any are aren't as at be
26119
+ because been before being below between both but by can can't cannot could
26120
+ couldn't did didn't do does doesn't doing don't down during each few for from
26121
+ further had hadn't has hasn't have haven't having he her here hers herself him
26122
+ himself his how i if in into is isn't it it's its itself just let's me more most
26123
+ mustn't my myself no nor not of off on once only or other ought our ours
26124
+ ourselves out over own same shan't she should shouldn't so some such than that
26125
+ the their theirs them themselves then there these they this those through to
26126
+ too under until up very was wasn't we were weren't what when where which while
26127
+ who whom why will with won't would wouldn't you your yours yourself yourselves
26128
+ able across actually already always another anything around away back become
26129
+ being best better came come comes coming currently does done else even ever
26130
+ every everything example fail fails failed failing find fine fix fixed fixes
26131
+ fixing get gets getting give given go goes going gone got happen happens help
26132
+ however instead issue issues keep know last later like likely longer look looks
26133
+ lot make makes making many may maybe might much must need needed needs never
26134
+ new now often one ones please possible pretty probably problem problems put
26135
+ rather really right run runs running said say see seem seems seen several
26136
+ since something sometimes somewhere still sure take thing things think though
26137
+ three try trying two use used uses using want wants way ways well whether
26138
+ within without work works working yet get post put patch delete head options
26139
+ etc via per vs ok okay yes error errors exception warning test tests`.split(/\s+/).filter(Boolean)
26140
+ );
26141
+ }
26142
+ });
26143
+
26112
26144
  // ../../packages/@company/db/src/search-vector-write.ts
26113
26145
  var KNOWLEDGE_ARTIFACT_VECTOR_NULLS, PROCESS_REGISTRY_VECTOR_NULLS;
26114
26146
  var init_search_vector_write = __esm({
@@ -26117,6 +26149,7 @@ var init_search_vector_write = __esm({
26117
26149
  init_src5();
26118
26150
  init_src4();
26119
26151
  init_org_context();
26152
+ init_keyword_terms();
26120
26153
  KNOWLEDGE_ARTIFACT_VECTOR_NULLS = (KNOWLEDGE_ARTIFACTS_SEARCH_VECTOR.weights ?? []).map(() => null);
26121
26154
  PROCESS_REGISTRY_VECTOR_NULLS = (PROCESS_REGISTRY_SEARCH_VECTOR.weights ?? []).map(() => null);
26122
26155
  }
@@ -27955,6 +27988,7 @@ var init_src6 = __esm({
27955
27988
  init_org_context();
27956
27989
  init_admin_pools();
27957
27990
  init_search_vector_write();
27991
+ init_keyword_terms();
27958
27992
  init_org_purge();
27959
27993
  init_org_orphan_scan();
27960
27994
  init_integration_purge();
@@ -29363,8 +29397,8 @@ var require_convert_expression = __commonJS({
29363
29397
  }
29364
29398
  return expressions;
29365
29399
  }
29366
- function removeSpaces(str) {
29367
- return str.replace(/\s{2,}/g, " ").trim();
29400
+ function removeSpaces(str2) {
29401
+ return str2.replace(/\s{2,}/g, " ").trim();
29368
29402
  }
29369
29403
  function normalizeIntegers(expressions) {
29370
29404
  for (let i = 0; i < expressions.length; i++) {
@@ -29701,11 +29735,11 @@ var init_parse = __esm({
29701
29735
  });
29702
29736
 
29703
29737
  // ../../node_modules/node-cron/node_modules/uuid/dist/esm-node/v35.js
29704
- function stringToBytes(str) {
29705
- str = unescape(encodeURIComponent(str));
29738
+ function stringToBytes(str2) {
29739
+ str2 = unescape(encodeURIComponent(str2));
29706
29740
  const bytes = [];
29707
- for (let i = 0; i < str.length; ++i) {
29708
- bytes.push(str.charCodeAt(i));
29741
+ for (let i = 0; i < str2.length; ++i) {
29742
+ bytes.push(str2.charCodeAt(i));
29709
29743
  }
29710
29744
  return bytes;
29711
29745
  }
@@ -34483,14 +34517,14 @@ function promiseAllObject(promisesObj) {
34483
34517
  }
34484
34518
  function randomString(length = 10) {
34485
34519
  const chars = "abcdefghijklmnopqrstuvwxyz";
34486
- let str = "";
34520
+ let str2 = "";
34487
34521
  for (let i = 0; i < length; i++) {
34488
- str += chars[Math.floor(Math.random() * chars.length)];
34522
+ str2 += chars[Math.floor(Math.random() * chars.length)];
34489
34523
  }
34490
- return str;
34524
+ return str2;
34491
34525
  }
34492
- function esc(str) {
34493
- return JSON.stringify(str);
34526
+ function esc(str2) {
34527
+ return JSON.stringify(str2);
34494
34528
  }
34495
34529
  function slugify(input) {
34496
34530
  return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
@@ -34530,8 +34564,8 @@ function numKeys(data) {
34530
34564
  }
34531
34565
  return keyCount;
34532
34566
  }
34533
- function escapeRegex(str) {
34534
- return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
34567
+ function escapeRegex(str2) {
34568
+ return str2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
34535
34569
  }
34536
34570
  function clone(inst, def, params) {
34537
34571
  const cl = new inst._zod.constr(def ?? inst._zod.def);
@@ -39113,13 +39147,13 @@ function _file(Class2, params) {
39113
39147
  }
39114
39148
  // @__NO_SIDE_EFFECTS__
39115
39149
  function _custom(Class2, fn, _params) {
39116
- const norm = normalizeParams(_params);
39117
- norm.abort ?? (norm.abort = true);
39150
+ const norm2 = normalizeParams(_params);
39151
+ norm2.abort ?? (norm2.abort = true);
39118
39152
  const schema = new Class2({
39119
39153
  type: "custom",
39120
39154
  check: "custom",
39121
39155
  fn,
39122
- ...norm
39156
+ ...norm2
39123
39157
  });
39124
39158
  return schema;
39125
39159
  }
@@ -46149,7 +46183,7 @@ var require_code = __commonJS({
46149
46183
  }
46150
46184
  exports2._ = _;
46151
46185
  var plus = new _Code("+");
46152
- function str(strs, ...args) {
46186
+ function str2(strs, ...args) {
46153
46187
  const expr = [safeStringify(strs[0])];
46154
46188
  let i = 0;
46155
46189
  while (i < args.length) {
@@ -46160,7 +46194,7 @@ var require_code = __commonJS({
46160
46194
  optimize(expr);
46161
46195
  return new _Code(expr);
46162
46196
  }
46163
- exports2.str = str;
46197
+ exports2.str = str2;
46164
46198
  function addCodeArg(code, arg) {
46165
46199
  if (arg instanceof _Code)
46166
46200
  code.push(...arg._items);
@@ -46203,7 +46237,7 @@ var require_code = __commonJS({
46203
46237
  return;
46204
46238
  }
46205
46239
  function strConcat(c1, c2) {
46206
- return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str`${c1}${c2}`;
46240
+ return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str2`${c1}${c2}`;
46207
46241
  }
46208
46242
  exports2.strConcat = strConcat;
46209
46243
  function interpolate(x) {
@@ -47165,22 +47199,22 @@ var require_util2 = __commonJS({
47165
47199
  return (0, codegen_1._)`${topSchemaRef}${schemaPath}${(0, codegen_1.getProperty)(keyword)}`;
47166
47200
  }
47167
47201
  exports2.schemaRefOrVal = schemaRefOrVal;
47168
- function unescapeFragment(str) {
47169
- return unescapeJsonPointer(decodeURIComponent(str));
47202
+ function unescapeFragment(str2) {
47203
+ return unescapeJsonPointer(decodeURIComponent(str2));
47170
47204
  }
47171
47205
  exports2.unescapeFragment = unescapeFragment;
47172
- function escapeFragment(str) {
47173
- return encodeURIComponent(escapeJsonPointer(str));
47206
+ function escapeFragment(str2) {
47207
+ return encodeURIComponent(escapeJsonPointer(str2));
47174
47208
  }
47175
47209
  exports2.escapeFragment = escapeFragment;
47176
- function escapeJsonPointer(str) {
47177
- if (typeof str == "number")
47178
- return `${str}`;
47179
- return str.replace(/~/g, "~0").replace(/\//g, "~1");
47210
+ function escapeJsonPointer(str2) {
47211
+ if (typeof str2 == "number")
47212
+ return `${str2}`;
47213
+ return str2.replace(/~/g, "~0").replace(/\//g, "~1");
47180
47214
  }
47181
47215
  exports2.escapeJsonPointer = escapeJsonPointer;
47182
- function unescapeJsonPointer(str) {
47183
- return str.replace(/~1/g, "/").replace(/~0/g, "~");
47216
+ function unescapeJsonPointer(str2) {
47217
+ return str2.replace(/~1/g, "/").replace(/~0/g, "~");
47184
47218
  }
47185
47219
  exports2.unescapeJsonPointer = unescapeJsonPointer;
47186
47220
  function eachItem(xs, f) {
@@ -48205,8 +48239,8 @@ var require_json_schema_traverse = __commonJS({
48205
48239
  post(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
48206
48240
  }
48207
48241
  }
48208
- function escapeJsonPtr(str) {
48209
- return str.replace(/~/g, "~0").replace(/\//g, "~1");
48242
+ function escapeJsonPtr(str2) {
48243
+ return str2.replace(/~/g, "~0").replace(/\//g, "~1");
48210
48244
  }
48211
48245
  }
48212
48246
  });
@@ -49267,10 +49301,10 @@ var require_utils5 = __commonJS({
49267
49301
  return { host, isIPV6: false };
49268
49302
  }
49269
49303
  }
49270
- function findToken(str, token2) {
49304
+ function findToken(str2, token2) {
49271
49305
  let ind = 0;
49272
- for (let i = 0; i < str.length; i++) {
49273
- if (str[i] === token2) ind++;
49306
+ for (let i = 0; i < str2.length; i++) {
49307
+ if (str2[i] === token2) ind++;
49274
49308
  }
49275
49309
  return ind;
49276
49310
  }
@@ -49923,7 +49957,7 @@ var require_core = __commonJS({
49923
49957
  var util_1 = require_util2();
49924
49958
  var $dataRefSchema = require_data();
49925
49959
  var uri_1 = require_uri();
49926
- var defaultRegExp = (str, flags) => new RegExp(str, flags);
49960
+ var defaultRegExp = (str2, flags) => new RegExp(str2, flags);
49927
49961
  defaultRegExp.code = "new RegExp";
49928
49962
  var META_IGNORE_OPTIONS = ["removeAdditional", "useDefaults", "coerceTypes"];
49929
49963
  var EXT_SCOPE_NAMES = /* @__PURE__ */ new Set([
@@ -50718,16 +50752,16 @@ var require_ucs2length = __commonJS({
50718
50752
  "../service-capture/node_modules/ajv/dist/runtime/ucs2length.js"(exports2) {
50719
50753
  "use strict";
50720
50754
  Object.defineProperty(exports2, "__esModule", { value: true });
50721
- function ucs2length(str) {
50722
- const len = str.length;
50755
+ function ucs2length(str2) {
50756
+ const len = str2.length;
50723
50757
  let length = 0;
50724
50758
  let pos = 0;
50725
50759
  let value;
50726
50760
  while (pos < len) {
50727
50761
  length++;
50728
- value = str.charCodeAt(pos++);
50762
+ value = str2.charCodeAt(pos++);
50729
50763
  if (value >= 55296 && value <= 56319 && pos < len) {
50730
- value = str.charCodeAt(pos);
50764
+ value = str2.charCodeAt(pos);
50731
50765
  if ((value & 64512) === 56320)
50732
50766
  pos++;
50733
50767
  }
@@ -52610,8 +52644,8 @@ var require_formats = __commonJS({
52610
52644
  }
52611
52645
  var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
52612
52646
  var DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
52613
- function date4(str) {
52614
- const matches = DATE.exec(str);
52647
+ function date4(str2) {
52648
+ const matches = DATE.exec(str2);
52615
52649
  if (!matches)
52616
52650
  return false;
52617
52651
  const year = +matches[1];
@@ -52630,8 +52664,8 @@ var require_formats = __commonJS({
52630
52664
  }
52631
52665
  var TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;
52632
52666
  function getTime(strictTimeZone) {
52633
- return function time3(str) {
52634
- const matches = TIME.exec(str);
52667
+ return function time3(str2) {
52668
+ const matches = TIME.exec(str2);
52635
52669
  if (!matches)
52636
52670
  return false;
52637
52671
  const hr = +matches[1];
@@ -52677,8 +52711,8 @@ var require_formats = __commonJS({
52677
52711
  var DATE_TIME_SEPARATOR = /t|\s/i;
52678
52712
  function getDateTime(strictTimeZone) {
52679
52713
  const time3 = getTime(strictTimeZone);
52680
- return function date_time(str) {
52681
- const dateTime = str.split(DATE_TIME_SEPARATOR);
52714
+ return function date_time(str2) {
52715
+ const dateTime = str2.split(DATE_TIME_SEPARATOR);
52682
52716
  return dateTime.length === 2 && date4(dateTime[0]) && time3(dateTime[1]);
52683
52717
  };
52684
52718
  }
@@ -52703,13 +52737,13 @@ var require_formats = __commonJS({
52703
52737
  }
52704
52738
  var NOT_URI_FRAGMENT = /\/|:/;
52705
52739
  var URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
52706
- function uri(str) {
52707
- return NOT_URI_FRAGMENT.test(str) && URI.test(str);
52740
+ function uri(str2) {
52741
+ return NOT_URI_FRAGMENT.test(str2) && URI.test(str2);
52708
52742
  }
52709
52743
  var BYTE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;
52710
- function byte(str) {
52744
+ function byte(str2) {
52711
52745
  BYTE.lastIndex = 0;
52712
- return BYTE.test(str);
52746
+ return BYTE.test(str2);
52713
52747
  }
52714
52748
  var MIN_INT32 = -(2 ** 31);
52715
52749
  var MAX_INT32 = 2 ** 31 - 1;
@@ -52723,11 +52757,11 @@ var require_formats = __commonJS({
52723
52757
  return true;
52724
52758
  }
52725
52759
  var Z_ANCHOR = /[^\\]\\Z/;
52726
- function regex(str) {
52727
- if (Z_ANCHOR.test(str))
52760
+ function regex(str2) {
52761
+ if (Z_ANCHOR.test(str2))
52728
52762
  return false;
52729
52763
  try {
52730
- new RegExp(str);
52764
+ new RegExp(str2);
52731
52765
  return true;
52732
52766
  } catch (e) {
52733
52767
  return false;
@@ -52804,7 +52838,7 @@ var require_code3 = __commonJS({
52804
52838
  }
52805
52839
  exports2._ = _;
52806
52840
  var plus = new _Code("+");
52807
- function str(strs, ...args) {
52841
+ function str2(strs, ...args) {
52808
52842
  const expr = [safeStringify(strs[0])];
52809
52843
  let i = 0;
52810
52844
  while (i < args.length) {
@@ -52815,7 +52849,7 @@ var require_code3 = __commonJS({
52815
52849
  optimize(expr);
52816
52850
  return new _Code(expr);
52817
52851
  }
52818
- exports2.str = str;
52852
+ exports2.str = str2;
52819
52853
  function addCodeArg(code, arg) {
52820
52854
  if (arg instanceof _Code)
52821
52855
  code.push(...arg._items);
@@ -52858,7 +52892,7 @@ var require_code3 = __commonJS({
52858
52892
  return;
52859
52893
  }
52860
52894
  function strConcat(c1, c2) {
52861
- return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str`${c1}${c2}`;
52895
+ return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str2`${c1}${c2}`;
52862
52896
  }
52863
52897
  exports2.strConcat = strConcat;
52864
52898
  function interpolate(x) {
@@ -53820,22 +53854,22 @@ var require_util3 = __commonJS({
53820
53854
  return (0, codegen_1._)`${topSchemaRef}${schemaPath}${(0, codegen_1.getProperty)(keyword)}`;
53821
53855
  }
53822
53856
  exports2.schemaRefOrVal = schemaRefOrVal;
53823
- function unescapeFragment(str) {
53824
- return unescapeJsonPointer(decodeURIComponent(str));
53857
+ function unescapeFragment(str2) {
53858
+ return unescapeJsonPointer(decodeURIComponent(str2));
53825
53859
  }
53826
53860
  exports2.unescapeFragment = unescapeFragment;
53827
- function escapeFragment(str) {
53828
- return encodeURIComponent(escapeJsonPointer(str));
53861
+ function escapeFragment(str2) {
53862
+ return encodeURIComponent(escapeJsonPointer(str2));
53829
53863
  }
53830
53864
  exports2.escapeFragment = escapeFragment;
53831
- function escapeJsonPointer(str) {
53832
- if (typeof str == "number")
53833
- return `${str}`;
53834
- return str.replace(/~/g, "~0").replace(/\//g, "~1");
53865
+ function escapeJsonPointer(str2) {
53866
+ if (typeof str2 == "number")
53867
+ return `${str2}`;
53868
+ return str2.replace(/~/g, "~0").replace(/\//g, "~1");
53835
53869
  }
53836
53870
  exports2.escapeJsonPointer = escapeJsonPointer;
53837
- function unescapeJsonPointer(str) {
53838
- return str.replace(/~1/g, "/").replace(/~0/g, "~");
53871
+ function unescapeJsonPointer(str2) {
53872
+ return str2.replace(/~1/g, "/").replace(/~0/g, "~");
53839
53873
  }
53840
53874
  exports2.unescapeJsonPointer = unescapeJsonPointer;
53841
53875
  function eachItem(xs, f) {
@@ -54825,8 +54859,8 @@ var require_json_schema_traverse2 = __commonJS({
54825
54859
  post(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
54826
54860
  }
54827
54861
  }
54828
- function escapeJsonPtr(str) {
54829
- return str.replace(/~/g, "~0").replace(/\//g, "~1");
54862
+ function escapeJsonPtr(str2) {
54863
+ return str2.replace(/~/g, "~0").replace(/\//g, "~1");
54830
54864
  }
54831
54865
  }
54832
54866
  });
@@ -55821,7 +55855,7 @@ var require_core3 = __commonJS({
55821
55855
  var util_1 = require_util3();
55822
55856
  var $dataRefSchema = require_data2();
55823
55857
  var uri_1 = require_uri2();
55824
- var defaultRegExp = (str, flags) => new RegExp(str, flags);
55858
+ var defaultRegExp = (str2, flags) => new RegExp(str2, flags);
55825
55859
  defaultRegExp.code = "new RegExp";
55826
55860
  var META_IGNORE_OPTIONS = ["removeAdditional", "useDefaults", "coerceTypes"];
55827
55861
  var EXT_SCOPE_NAMES = /* @__PURE__ */ new Set([
@@ -56616,16 +56650,16 @@ var require_ucs2length2 = __commonJS({
56616
56650
  "../../node_modules/ajv-formats/node_modules/ajv/dist/runtime/ucs2length.js"(exports2) {
56617
56651
  "use strict";
56618
56652
  Object.defineProperty(exports2, "__esModule", { value: true });
56619
- function ucs2length(str) {
56620
- const len = str.length;
56653
+ function ucs2length(str2) {
56654
+ const len = str2.length;
56621
56655
  let length = 0;
56622
56656
  let pos = 0;
56623
56657
  let value;
56624
56658
  while (pos < len) {
56625
56659
  length++;
56626
- value = str.charCodeAt(pos++);
56660
+ value = str2.charCodeAt(pos++);
56627
56661
  if (value >= 55296 && value <= 56319 && pos < len) {
56628
- value = str.charCodeAt(pos);
56662
+ value = str2.charCodeAt(pos);
56629
56663
  if ((value & 64512) === 56320)
56630
56664
  pos++;
56631
56665
  }
@@ -60133,14 +60167,82 @@ var init_stdio2 = __esm({
60133
60167
  }
60134
60168
  });
60135
60169
 
60170
+ // ../service-capture/agent-sessions/search-solutions-tool.ts
60171
+ function searchSolutionsTool(contextSchema2) {
60172
+ return {
60173
+ name: "search_solutions",
60174
+ description: "Search previously solved similar questions from your organization's knowledge base. Finds how bugs were fixed, what patterns were used, and past resolutions to similar problems. Results are ranked by a composite of relevance, quality, recency, and verification status. For a failing test, pass its name in failing_tests and the error line in error. Pass the files you expect to change, or that the failure runs through, in files.",
60175
+ inputSchema: {
60176
+ type: "object",
60177
+ properties: {
60178
+ query: {
60179
+ type: "string",
60180
+ description: "Natural-language description of the problem or solution to search for"
60181
+ },
60182
+ top_k: {
60183
+ type: "number",
60184
+ description: "Number of results to return (default: 5, max: 20)"
60185
+ },
60186
+ failing_tests: stringList(
60187
+ "Optional. Names of the failing tests, as the test runner prints them"
60188
+ ),
60189
+ error: {
60190
+ type: "string",
60191
+ description: "Optional. The error line, e.g. the assertion or exception message"
60192
+ },
60193
+ files: stringList(
60194
+ "Optional. File paths you expect to change, or that the failure runs through"
60195
+ ),
60196
+ names: stringList(
60197
+ "Optional. Identifiers involved: functions, classes, routes, config keys"
60198
+ ),
60199
+ _context: contextSchema2
60200
+ },
60201
+ required: ["query"]
60202
+ }
60203
+ };
60204
+ }
60205
+ function clipList(value) {
60206
+ const items = Array.isArray(value) ? value : value === void 0 ? [] : [value];
60207
+ return items.filter((v) => typeof v === "string").map((v) => v.trim().slice(0, MAX_HINT_ITEM_CHARS)).filter(Boolean).slice(0, MAX_HINT_ITEMS);
60208
+ }
60209
+ function searchSolutionsPath(args) {
60210
+ const k = Math.min(Math.max(1, Number(args.top_k ?? 5) || 5), 20);
60211
+ const params = new URLSearchParams();
60212
+ params.set("q", String(args.query ?? ""));
60213
+ params.set("top_k", String(k));
60214
+ for (const t of clipList(args.failing_tests))
60215
+ params.append("failing_tests", t);
60216
+ if (typeof args.error === "string" && args.error.trim()) {
60217
+ params.set("error", args.error.trim().slice(0, MAX_HINT_ERROR_CHARS));
60218
+ }
60219
+ for (const f of clipList(args.files)) params.append("files", f);
60220
+ for (const n of clipList(args.names)) params.append("names", n);
60221
+ return `/memory/solutions/search?${params.toString()}`;
60222
+ }
60223
+ var MAX_HINT_ITEMS, MAX_HINT_ITEM_CHARS, MAX_HINT_ERROR_CHARS, stringList;
60224
+ var init_search_solutions_tool = __esm({
60225
+ "../service-capture/agent-sessions/search-solutions-tool.ts"() {
60226
+ "use strict";
60227
+ MAX_HINT_ITEMS = 10;
60228
+ MAX_HINT_ITEM_CHARS = 300;
60229
+ MAX_HINT_ERROR_CHARS = 1e3;
60230
+ stringList = (description) => ({
60231
+ type: "array",
60232
+ items: { type: "string" },
60233
+ description
60234
+ });
60235
+ }
60236
+ });
60237
+
60136
60238
  // ../../node_modules/depd/index.js
60137
60239
  var require_depd = __commonJS({
60138
60240
  "../../node_modules/depd/index.js"(exports2, module2) {
60139
60241
  var relative4 = require("path").relative;
60140
60242
  module2.exports = depd;
60141
60243
  var basePath = process.cwd();
60142
- function containsNamespace(str, namespace) {
60143
- var vals = str.split(/[ ,]+/);
60244
+ function containsNamespace(str2, namespace) {
60245
+ var vals = str2.split(/[ ,]+/);
60144
60246
  var ns = String(namespace).toLowerCase();
60145
60247
  for (var i = 0; i < vals.length; i++) {
60146
60248
  var val = vals[i];
@@ -60167,21 +60269,21 @@ var require_depd = __commonJS({
60167
60269
  return descriptor;
60168
60270
  }
60169
60271
  function createArgumentsString(arity) {
60170
- var str = "";
60272
+ var str2 = "";
60171
60273
  for (var i = 0; i < arity; i++) {
60172
- str += ", arg" + i;
60274
+ str2 += ", arg" + i;
60173
60275
  }
60174
- return str.substr(2);
60276
+ return str2.substr(2);
60175
60277
  }
60176
60278
  function createStackString(stack) {
60177
- var str = this.name + ": " + this.namespace;
60279
+ var str2 = this.name + ": " + this.namespace;
60178
60280
  if (this.message) {
60179
- str += " deprecated " + this.message;
60281
+ str2 += " deprecated " + this.message;
60180
60282
  }
60181
60283
  for (var i = 0; i < stack.length; i++) {
60182
- str += "\n at " + stack[i].toString();
60284
+ str2 += "\n at " + stack[i].toString();
60183
60285
  }
60184
- return str;
60286
+ return str2;
60185
60287
  }
60186
60288
  function depd(namespace) {
60187
60289
  if (!namespace) {
@@ -60210,15 +60312,15 @@ var require_depd = __commonJS({
60210
60312
  if (process.noDeprecation) {
60211
60313
  return true;
60212
60314
  }
60213
- var str = process.env.NO_DEPRECATION || "";
60214
- return containsNamespace(str, namespace);
60315
+ var str2 = process.env.NO_DEPRECATION || "";
60316
+ return containsNamespace(str2, namespace);
60215
60317
  }
60216
60318
  function istraced(namespace) {
60217
60319
  if (process.traceDeprecation) {
60218
60320
  return true;
60219
60321
  }
60220
- var str = process.env.TRACE_DEPRECATION || "";
60221
- return containsNamespace(str, namespace);
60322
+ var str2 = process.env.TRACE_DEPRECATION || "";
60323
+ return containsNamespace(str2, namespace);
60222
60324
  }
60223
60325
  function log(message, site) {
60224
60326
  var haslisteners = eehaslisteners(process, "deprecation");
@@ -60652,8 +60754,8 @@ var require_toidentifier = __commonJS({
60652
60754
  "../../node_modules/toidentifier/index.js"(exports2, module2) {
60653
60755
  "use strict";
60654
60756
  module2.exports = toIdentifier;
60655
- function toIdentifier(str) {
60656
- return str.split(" ").map(function(token2) {
60757
+ function toIdentifier(str2) {
60758
+ return str2.split(" ").map(function(token2) {
60657
60759
  return token2.slice(0, 1).toUpperCase() + token2.slice(1);
60658
60760
  }).join("").replace(/[^ _0-9a-z]/gi, "");
60659
60761
  }
@@ -60877,16 +60979,16 @@ var require_bytes = __commonJS({
60877
60979
  }
60878
60980
  }
60879
60981
  var val = value / map2[unit.toLowerCase()];
60880
- var str = val.toFixed(decimalPlaces);
60982
+ var str2 = val.toFixed(decimalPlaces);
60881
60983
  if (!fixedDecimals) {
60882
- str = str.replace(formatDecimalsRegExp, "$1");
60984
+ str2 = str2.replace(formatDecimalsRegExp, "$1");
60883
60985
  }
60884
60986
  if (thousandsSeparator) {
60885
- str = str.split(".").map(function(s, i) {
60987
+ str2 = str2.split(".").map(function(s, i) {
60886
60988
  return i === 0 ? s.replace(formatThousandsRegExp, thousandsSeparator) : s;
60887
60989
  }).join(".");
60888
60990
  }
60889
- return str + unitSeparator + unit;
60991
+ return str2 + unitSeparator + unit;
60890
60992
  }
60891
60993
  function parse4(val) {
60892
60994
  if (typeof val === "number" && !isNaN(val)) {
@@ -60991,12 +61093,12 @@ var require_bom_handling = __commonJS({
60991
61093
  this.encoder = encoder;
60992
61094
  this.addBOM = true;
60993
61095
  }
60994
- PrependBOMWrapper.prototype.write = function(str) {
61096
+ PrependBOMWrapper.prototype.write = function(str2) {
60995
61097
  if (this.addBOM) {
60996
- str = BOMChar + str;
61098
+ str2 = BOMChar + str2;
60997
61099
  this.addBOM = false;
60998
61100
  }
60999
- return this.encoder.write(str);
61101
+ return this.encoder.write(str2);
61000
61102
  };
61001
61103
  PrependBOMWrapper.prototype.end = function() {
61002
61104
  return this.encoder.end();
@@ -61095,31 +61197,31 @@ var require_internal = __commonJS({
61095
61197
  function InternalEncoder(options, codec2) {
61096
61198
  this.enc = codec2.enc;
61097
61199
  }
61098
- InternalEncoder.prototype.write = function(str) {
61099
- return Buffer2.from(str, this.enc);
61200
+ InternalEncoder.prototype.write = function(str2) {
61201
+ return Buffer2.from(str2, this.enc);
61100
61202
  };
61101
61203
  InternalEncoder.prototype.end = function() {
61102
61204
  };
61103
61205
  function InternalEncoderBase64(options, codec2) {
61104
61206
  this.prevStr = "";
61105
61207
  }
61106
- InternalEncoderBase64.prototype.write = function(str) {
61107
- str = this.prevStr + str;
61108
- var completeQuads = str.length - str.length % 4;
61109
- this.prevStr = str.slice(completeQuads);
61110
- str = str.slice(0, completeQuads);
61111
- return Buffer2.from(str, "base64");
61208
+ InternalEncoderBase64.prototype.write = function(str2) {
61209
+ str2 = this.prevStr + str2;
61210
+ var completeQuads = str2.length - str2.length % 4;
61211
+ this.prevStr = str2.slice(completeQuads);
61212
+ str2 = str2.slice(0, completeQuads);
61213
+ return Buffer2.from(str2, "base64");
61112
61214
  };
61113
61215
  InternalEncoderBase64.prototype.end = function() {
61114
61216
  return Buffer2.from(this.prevStr, "base64");
61115
61217
  };
61116
61218
  function InternalEncoderCesu8(options, codec2) {
61117
61219
  }
61118
- InternalEncoderCesu8.prototype.write = function(str) {
61119
- var buf = Buffer2.alloc(str.length * 3);
61220
+ InternalEncoderCesu8.prototype.write = function(str2) {
61221
+ var buf = Buffer2.alloc(str2.length * 3);
61120
61222
  var bufIdx = 0;
61121
- for (var i = 0; i < str.length; i++) {
61122
- var charCode = str.charCodeAt(i);
61223
+ for (var i = 0; i < str2.length; i++) {
61224
+ var charCode = str2.charCodeAt(i);
61123
61225
  if (charCode < 128) {
61124
61226
  buf[bufIdx++] = charCode;
61125
61227
  } else if (charCode < 2048) {
@@ -61200,25 +61302,25 @@ var require_internal = __commonJS({
61200
61302
  function InternalEncoderUtf8(options, codec2) {
61201
61303
  this.highSurrogate = "";
61202
61304
  }
61203
- InternalEncoderUtf8.prototype.write = function(str) {
61305
+ InternalEncoderUtf8.prototype.write = function(str2) {
61204
61306
  if (this.highSurrogate) {
61205
- str = this.highSurrogate + str;
61307
+ str2 = this.highSurrogate + str2;
61206
61308
  this.highSurrogate = "";
61207
61309
  }
61208
- if (str.length > 0) {
61209
- var charCode = str.charCodeAt(str.length - 1);
61310
+ if (str2.length > 0) {
61311
+ var charCode = str2.charCodeAt(str2.length - 1);
61210
61312
  if (charCode >= 55296 && charCode < 56320) {
61211
- this.highSurrogate = str[str.length - 1];
61212
- str = str.slice(0, str.length - 1);
61313
+ this.highSurrogate = str2[str2.length - 1];
61314
+ str2 = str2.slice(0, str2.length - 1);
61213
61315
  }
61214
61316
  }
61215
- return Buffer2.from(str, this.enc);
61317
+ return Buffer2.from(str2, this.enc);
61216
61318
  };
61217
61319
  InternalEncoderUtf8.prototype.end = function() {
61218
61320
  if (this.highSurrogate) {
61219
- var str = this.highSurrogate;
61321
+ var str2 = this.highSurrogate;
61220
61322
  this.highSurrogate = "";
61221
- return Buffer2.from(str, this.enc);
61323
+ return Buffer2.from(str2, this.enc);
61222
61324
  }
61223
61325
  };
61224
61326
  }
@@ -61245,8 +61347,8 @@ var require_utf32 = __commonJS({
61245
61347
  this.isLE = codec2.isLE;
61246
61348
  this.highSurrogate = 0;
61247
61349
  }
61248
- Utf32Encoder.prototype.write = function(str) {
61249
- var src = Buffer2.from(str, "ucs2");
61350
+ Utf32Encoder.prototype.write = function(str2) {
61351
+ var src = Buffer2.from(str2, "ucs2");
61250
61352
  var dst = Buffer2.alloc(src.length * 2);
61251
61353
  var write32 = this.isLE ? dst.writeUInt32LE : dst.writeUInt32BE;
61252
61354
  var offset = 0;
@@ -61367,8 +61469,8 @@ var require_utf32 = __commonJS({
61367
61469
  }
61368
61470
  this.encoder = codec2.iconv.getEncoder(options.defaultEncoding || "utf-32le", options);
61369
61471
  }
61370
- Utf32AutoEncoder.prototype.write = function(str) {
61371
- return this.encoder.write(str);
61472
+ Utf32AutoEncoder.prototype.write = function(str2) {
61473
+ return this.encoder.write(str2);
61372
61474
  };
61373
61475
  Utf32AutoEncoder.prototype.end = function() {
61374
61476
  return this.encoder.end();
@@ -61468,8 +61570,8 @@ var require_utf16 = __commonJS({
61468
61570
  Utf16BECodec.prototype.bomAware = true;
61469
61571
  function Utf16BEEncoder() {
61470
61572
  }
61471
- Utf16BEEncoder.prototype.write = function(str) {
61472
- var buf = Buffer2.from(str, "ucs2");
61573
+ Utf16BEEncoder.prototype.write = function(str2) {
61574
+ var buf = Buffer2.from(str2, "ucs2");
61473
61575
  for (var i = 0; i < buf.length; i += 2) {
61474
61576
  var tmp = buf[i];
61475
61577
  buf[i] = buf[i + 1];
@@ -61518,8 +61620,8 @@ var require_utf16 = __commonJS({
61518
61620
  }
61519
61621
  this.encoder = codec2.iconv.getEncoder("utf-16le", options);
61520
61622
  }
61521
- Utf16Encoder.prototype.write = function(str) {
61522
- return this.encoder.write(str);
61623
+ Utf16Encoder.prototype.write = function(str2) {
61624
+ return this.encoder.write(str2);
61523
61625
  };
61524
61626
  Utf16Encoder.prototype.end = function() {
61525
61627
  return this.encoder.end();
@@ -61615,8 +61717,8 @@ var require_utf7 = __commonJS({
61615
61717
  function Utf7Encoder(options, codec2) {
61616
61718
  this.iconv = codec2.iconv;
61617
61719
  }
61618
- Utf7Encoder.prototype.write = function(str) {
61619
- return Buffer2.from(str.replace(nonDirectChars, function(chunk) {
61720
+ Utf7Encoder.prototype.write = function(str2) {
61721
+ return Buffer2.from(str2.replace(nonDirectChars, function(chunk) {
61620
61722
  return "+" + (chunk === "+" ? "" : this.iconv.encode(chunk, "utf16-be").toString("base64").replace(/=+$/, "")) + "-";
61621
61723
  }.bind(this)));
61622
61724
  };
@@ -61700,14 +61802,14 @@ var require_utf7 = __commonJS({
61700
61802
  this.base64Accum = Buffer2.alloc(6);
61701
61803
  this.base64AccumIdx = 0;
61702
61804
  }
61703
- Utf7IMAPEncoder.prototype.write = function(str) {
61805
+ Utf7IMAPEncoder.prototype.write = function(str2) {
61704
61806
  var inBase64 = this.inBase64;
61705
61807
  var base64Accum = this.base64Accum;
61706
61808
  var base64AccumIdx = this.base64AccumIdx;
61707
- var buf = Buffer2.alloc(str.length * 5 + 10);
61809
+ var buf = Buffer2.alloc(str2.length * 5 + 10);
61708
61810
  var bufIdx = 0;
61709
- for (var i2 = 0; i2 < str.length; i2++) {
61710
- var uChar = str.charCodeAt(i2);
61811
+ for (var i2 = 0; i2 < str2.length; i2++) {
61812
+ var uChar = str2.charCodeAt(i2);
61711
61813
  if (uChar >= 32 && uChar <= 126) {
61712
61814
  if (inBase64) {
61713
61815
  if (base64AccumIdx > 0) {
@@ -61848,10 +61950,10 @@ var require_sbcs_codec = __commonJS({
61848
61950
  function SBCSEncoder(options, codec2) {
61849
61951
  this.encodeBuf = codec2.encodeBuf;
61850
61952
  }
61851
- SBCSEncoder.prototype.write = function(str) {
61852
- var buf = Buffer2.alloc(str.length);
61853
- for (var i = 0; i < str.length; i++) {
61854
- buf[i] = this.encodeBuf[str.charCodeAt(i)];
61953
+ SBCSEncoder.prototype.write = function(str2) {
61954
+ var buf = Buffer2.alloc(str2.length);
61955
+ for (var i = 0; i < str2.length; i++) {
61956
+ buf[i] = this.encodeBuf[str2.charCodeAt(i)];
61855
61957
  }
61856
61958
  return buf;
61857
61959
  };
@@ -62725,8 +62827,8 @@ var require_dbcs_codec = __commonJS({
62725
62827
  this.defaultCharSingleByte = codec2.defCharSB;
62726
62828
  this.gb18030 = codec2.gb18030;
62727
62829
  }
62728
- DBCSEncoder.prototype.write = function(str) {
62729
- var newBuf = Buffer2.alloc(str.length * (this.gb18030 ? 4 : 3));
62830
+ DBCSEncoder.prototype.write = function(str2) {
62831
+ var newBuf = Buffer2.alloc(str2.length * (this.gb18030 ? 4 : 3));
62730
62832
  var leadSurrogate = this.leadSurrogate;
62731
62833
  var seqObj = this.seqObj;
62732
62834
  var nextChar = -1;
@@ -62734,8 +62836,8 @@ var require_dbcs_codec = __commonJS({
62734
62836
  var j = 0;
62735
62837
  while (true) {
62736
62838
  if (nextChar === -1) {
62737
- if (i2 == str.length) break;
62738
- var uCode = str.charCodeAt(i2++);
62839
+ if (i2 == str2.length) break;
62840
+ var uCode = str2.charCodeAt(i2++);
62739
62841
  } else {
62740
62842
  var uCode = nextChar;
62741
62843
  nextChar = -1;
@@ -64573,10 +64675,10 @@ var require_lib4 = __commonJS({
64573
64675
  module2.exports.encodings = null;
64574
64676
  module2.exports.defaultCharUnicode = "\uFFFD";
64575
64677
  module2.exports.defaultCharSingleByte = "?";
64576
- module2.exports.encode = function encode3(str, encoding, options) {
64577
- str = "" + (str || "");
64678
+ module2.exports.encode = function encode3(str2, encoding, options) {
64679
+ str2 = "" + (str2 || "");
64578
64680
  var encoder = module2.exports.getEncoder(encoding, options);
64579
- var res = encoder.write(str);
64681
+ var res = encoder.write(str2);
64580
64682
  var trail = encoder.end();
64581
64683
  return trail && trail.length > 0 ? Buffer2.concat([res, trail]) : res;
64582
64684
  };
@@ -65170,14 +65272,14 @@ var require_content_type = __commonJS({
65170
65272
  return header;
65171
65273
  }
65172
65274
  function qstring(val) {
65173
- var str = String(val);
65174
- if (TOKEN_REGEXP.test(str)) {
65175
- return str;
65275
+ var str2 = String(val);
65276
+ if (TOKEN_REGEXP.test(str2)) {
65277
+ return str2;
65176
65278
  }
65177
- if (str.length > 0 && !TEXT_REGEXP.test(str)) {
65279
+ if (str2.length > 0 && !TEXT_REGEXP.test(str2)) {
65178
65280
  throw new TypeError("invalid parameter value");
65179
65281
  }
65180
- return '"' + str.replace(QUOTE_REGEXP, "\\$1") + '"';
65282
+ return '"' + str2.replace(QUOTE_REGEXP, "\\$1") + '"';
65181
65283
  }
65182
65284
  function ContentType(type) {
65183
65285
  this.parameters = /* @__PURE__ */ Object.create(null);
@@ -74617,11 +74719,11 @@ var require_mime_types = __commonJS({
74617
74719
  }
74618
74720
  return false;
74619
74721
  }
74620
- function contentType(str) {
74621
- if (!str || typeof str !== "string") {
74722
+ function contentType(str2) {
74723
+ if (!str2 || typeof str2 !== "string") {
74622
74724
  return false;
74623
74725
  }
74624
- var mime = str.indexOf("/") === -1 ? exports2.lookup(str) : str;
74726
+ var mime = str2.indexOf("/") === -1 ? exports2.lookup(str2) : str2;
74625
74727
  if (!mime) {
74626
74728
  return false;
74627
74729
  }
@@ -75002,14 +75104,14 @@ var require_read = __commonJS({
75002
75104
  return;
75003
75105
  }
75004
75106
  }
75005
- var str = body;
75107
+ var str2 = body;
75006
75108
  try {
75007
75109
  debug("parse body");
75008
- str = typeof body !== "string" && encoding !== null ? iconv.decode(body, encoding) : body;
75009
- req.body = parse4(str, encoding);
75110
+ str2 = typeof body !== "string" && encoding !== null ? iconv.decode(body, encoding) : body;
75111
+ req.body = parse4(str2, encoding);
75010
75112
  } catch (err2) {
75011
75113
  next(createError(400, err2, {
75012
- body: str,
75114
+ body: str2,
75013
75115
  type: err2.type || "entity.parse.failed"
75014
75116
  }));
75015
75117
  return;
@@ -75109,11 +75211,11 @@ var require_json = __commonJS({
75109
75211
  read(req, res, next, parse4, debug, readOptions);
75110
75212
  };
75111
75213
  }
75112
- function createStrictSyntaxError(str, char) {
75113
- var index = str.indexOf(char);
75214
+ function createStrictSyntaxError(str2, char) {
75215
+ var index = str2.indexOf(char);
75114
75216
  var partial2 = "";
75115
75217
  if (index !== -1) {
75116
- partial2 = str.substring(0, index) + JSON_SYNTAX_CHAR.repeat(str.length - index);
75218
+ partial2 = str2.substring(0, index) + JSON_SYNTAX_CHAR.repeat(str2.length - index);
75117
75219
  }
75118
75220
  try {
75119
75221
  JSON.parse(partial2);
@@ -75121,14 +75223,14 @@ var require_json = __commonJS({
75121
75223
  } catch (e) {
75122
75224
  return normalizeJsonSyntaxError(e, {
75123
75225
  message: e.message.replace(JSON_SYNTAX_REGEXP, function(placeholder) {
75124
- return str.substring(index, index + placeholder.length);
75226
+ return str2.substring(index, index + placeholder.length);
75125
75227
  }),
75126
75228
  stack: e.stack
75127
75229
  });
75128
75230
  }
75129
75231
  }
75130
- function firstchar(str) {
75131
- var match = FIRST_CHAR_REGEXP.exec(str);
75232
+ function firstchar(str2) {
75233
+ var match = FIRST_CHAR_REGEXP.exec(str2);
75132
75234
  return match ? match[1] : void 0;
75133
75235
  }
75134
75236
  function normalizeJsonSyntaxError(error2, obj) {
@@ -75239,20 +75341,20 @@ var require_object_inspect = __commonJS({
75239
75341
  var gPO = (typeof Reflect === "function" ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(O) {
75240
75342
  return O.__proto__;
75241
75343
  } : null);
75242
- function addNumericSeparator(num, str) {
75243
- if (num === Infinity || num === -Infinity || num !== num || num && num > -1e3 && num < 1e3 || $test.call(/e/, str)) {
75244
- return str;
75344
+ function addNumericSeparator(num, str2) {
75345
+ if (num === Infinity || num === -Infinity || num !== num || num && num > -1e3 && num < 1e3 || $test.call(/e/, str2)) {
75346
+ return str2;
75245
75347
  }
75246
75348
  var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
75247
75349
  if (typeof num === "number") {
75248
75350
  var int2 = num < 0 ? -$floor(-num) : $floor(num);
75249
75351
  if (int2 !== num) {
75250
75352
  var intStr = String(int2);
75251
- var dec = $slice.call(str, intStr.length + 1);
75353
+ var dec = $slice.call(str2, intStr.length + 1);
75252
75354
  return $replace.call(intStr, sepRegex, "$&_") + "." + $replace.call($replace.call(dec, /([0-9]{3})/g, "$&_"), /_$/, "");
75253
75355
  }
75254
75356
  }
75255
- return $replace.call(str, sepRegex, "$&_");
75357
+ return $replace.call(str2, sepRegex, "$&_");
75256
75358
  }
75257
75359
  var utilInspect = require_util_inspect();
75258
75360
  var inspectCustom = utilInspect.custom;
@@ -75302,8 +75404,8 @@ var require_object_inspect = __commonJS({
75302
75404
  if (obj === 0) {
75303
75405
  return Infinity / obj > 0 ? "0" : "-0";
75304
75406
  }
75305
- var str = String(obj);
75306
- return numericSeparator ? addNumericSeparator(obj, str) : str;
75407
+ var str2 = String(obj);
75408
+ return numericSeparator ? addNumericSeparator(obj, str2) : str2;
75307
75409
  }
75308
75410
  if (typeof obj === "bigint") {
75309
75411
  var bigIntStr = String(obj) + "n";
@@ -75623,15 +75725,15 @@ var require_object_inspect = __commonJS({
75623
75725
  }
75624
75726
  return typeof x.nodeName === "string" && typeof x.getAttribute === "function";
75625
75727
  }
75626
- function inspectString(str, opts) {
75627
- if (str.length > opts.maxStringLength) {
75628
- var remaining = str.length - opts.maxStringLength;
75728
+ function inspectString(str2, opts) {
75729
+ if (str2.length > opts.maxStringLength) {
75730
+ var remaining = str2.length - opts.maxStringLength;
75629
75731
  var trailer = "... " + remaining + " more character" + (remaining > 1 ? "s" : "");
75630
- return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer;
75732
+ return inspectString($slice.call(str2, 0, opts.maxStringLength), opts) + trailer;
75631
75733
  }
75632
75734
  var quoteRE = quoteREs[opts.quoteStyle || "single"];
75633
75735
  quoteRE.lastIndex = 0;
75634
- var s = $replace.call($replace.call(str, quoteRE, "\\$1"), /[\x00-\x1f]/g, lowbyte);
75736
+ var s = $replace.call($replace.call(str2, quoteRE, "\\$1"), /[\x00-\x1f]/g, lowbyte);
75635
75737
  return wrapQuotes(s, "single", opts);
75636
75738
  }
75637
75739
  function lowbyte(c) {
@@ -75648,8 +75750,8 @@ var require_object_inspect = __commonJS({
75648
75750
  }
75649
75751
  return "\\x" + (n < 16 ? "0" : "") + $toUpperCase.call(n.toString(16));
75650
75752
  }
75651
- function markBoxed(str) {
75652
- return "Object(" + str + ")";
75753
+ function markBoxed(str2) {
75754
+ return "Object(" + str2 + ")";
75653
75755
  }
75654
75756
  function weakCollectionOf(type) {
75655
75757
  return type + " { ? }";
@@ -76115,14 +76217,14 @@ var require_implementation = __commonJS({
76115
76217
  return arr;
76116
76218
  };
76117
76219
  var joiny = function(arr, joiner) {
76118
- var str = "";
76220
+ var str2 = "";
76119
76221
  for (var i = 0; i < arr.length; i += 1) {
76120
- str += arr[i];
76222
+ str2 += arr[i];
76121
76223
  if (i + 1 < arr.length) {
76122
- str += joiner;
76224
+ str2 += joiner;
76123
76225
  }
76124
76226
  }
76125
- return str;
76227
+ return str2;
76126
76228
  };
76127
76229
  module2.exports = function bind(that) {
76128
76230
  var target = this;
@@ -76957,8 +77059,8 @@ var require_utils7 = __commonJS({
76957
77059
  return acc;
76958
77060
  }, target);
76959
77061
  };
76960
- var decode3 = function(str, defaultDecoder, charset) {
76961
- var strWithoutPlus = str.replace(/\+/g, " ");
77062
+ var decode3 = function(str2, defaultDecoder, charset) {
77063
+ var strWithoutPlus = str2.replace(/\+/g, " ");
76962
77064
  if (charset === "iso-8859-1") {
76963
77065
  return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
76964
77066
  }
@@ -76969,15 +77071,15 @@ var require_utils7 = __commonJS({
76969
77071
  }
76970
77072
  };
76971
77073
  var limit = 1024;
76972
- var encode3 = function encode4(str, defaultEncoder, charset, kind, format) {
76973
- if (str.length === 0) {
76974
- return str;
77074
+ var encode3 = function encode4(str2, defaultEncoder, charset, kind, format) {
77075
+ if (str2.length === 0) {
77076
+ return str2;
76975
77077
  }
76976
- var string3 = str;
76977
- if (typeof str === "symbol") {
76978
- string3 = Symbol.prototype.toString.call(str);
76979
- } else if (typeof str !== "string") {
76980
- string3 = String(str);
77078
+ var string3 = str2;
77079
+ if (typeof str2 === "symbol") {
77080
+ string3 = Symbol.prototype.toString.call(str2);
77081
+ } else if (typeof str2 !== "string") {
77082
+ string3 = String(str2);
76981
77083
  }
76982
77084
  if (charset === "iso-8859-1") {
76983
77085
  return escape(string3).replace(/%u[0-9a-f]{4}/gi, function($0) {
@@ -77394,8 +77496,8 @@ var require_parse2 = __commonJS({
77394
77496
  strictNullHandling: false,
77395
77497
  throwOnLimitExceeded: false
77396
77498
  };
77397
- var interpretNumericEntities = function(str) {
77398
- return str.replace(/&#(\d+);/g, function($0, numberStr) {
77499
+ var interpretNumericEntities = function(str2) {
77500
+ return str2.replace(/&#(\d+);/g, function($0, numberStr) {
77399
77501
  return String.fromCharCode(parseInt(numberStr, 10));
77400
77502
  });
77401
77503
  };
@@ -77410,9 +77512,9 @@ var require_parse2 = __commonJS({
77410
77512
  };
77411
77513
  var isoSentinel = "utf8=%26%2310003%3B";
77412
77514
  var charsetSentinel = "utf8=%E2%9C%93";
77413
- var parseValues = function parseQueryStringValues(str, options) {
77515
+ var parseValues = function parseQueryStringValues(str2, options) {
77414
77516
  var obj = { __proto__: null };
77415
- var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, "") : str;
77517
+ var cleanStr = options.ignoreQueryPrefix ? str2.replace(/^\?/, "") : str2;
77416
77518
  cleanStr = cleanStr.replace(/%5B/gi, "[").replace(/%5D/gi, "]");
77417
77519
  var limit = options.parameterLimit === Infinity ? void 0 : options.parameterLimit;
77418
77520
  var parts = cleanStr.split(
@@ -77628,17 +77730,17 @@ var require_parse2 = __commonJS({
77628
77730
  throwOnLimitExceeded: typeof opts.throwOnLimitExceeded === "boolean" ? opts.throwOnLimitExceeded : false
77629
77731
  };
77630
77732
  };
77631
- module2.exports = function(str, opts) {
77733
+ module2.exports = function(str2, opts) {
77632
77734
  var options = normalizeParseOptions(opts);
77633
- if (str === "" || str === null || typeof str === "undefined") {
77735
+ if (str2 === "" || str2 === null || typeof str2 === "undefined") {
77634
77736
  return options.plainObjects ? { __proto__: null } : {};
77635
77737
  }
77636
- var tempObj = typeof str === "string" ? parseValues(str, options) : str;
77738
+ var tempObj = typeof str2 === "string" ? parseValues(str2, options) : str2;
77637
77739
  var obj = options.plainObjects ? { __proto__: null } : {};
77638
77740
  var keys = Object.keys(tempObj);
77639
77741
  for (var i = 0; i < keys.length; ++i) {
77640
77742
  var key = keys[i];
77641
- var newObj = parseKeys(key, tempObj[key], options, typeof str === "string");
77743
+ var newObj = parseKeys(key, tempObj[key], options, typeof str2 === "string");
77642
77744
  obj = utils.merge(obj, newObj, options);
77643
77745
  }
77644
77746
  if (options.allowSparse === true) {
@@ -77828,17 +77930,17 @@ var require_escape_html = __commonJS({
77828
77930
  var matchHtmlRegExp = /["'&<>]/;
77829
77931
  module2.exports = escapeHtml;
77830
77932
  function escapeHtml(string3) {
77831
- var str = "" + string3;
77832
- var match = matchHtmlRegExp.exec(str);
77933
+ var str2 = "" + string3;
77934
+ var match = matchHtmlRegExp.exec(str2);
77833
77935
  if (!match) {
77834
- return str;
77936
+ return str2;
77835
77937
  }
77836
77938
  var escape2;
77837
77939
  var html = "";
77838
77940
  var index = 0;
77839
77941
  var lastIndex = 0;
77840
- for (index = match.index; index < str.length; index++) {
77841
- switch (str.charCodeAt(index)) {
77942
+ for (index = match.index; index < str2.length; index++) {
77943
+ switch (str2.charCodeAt(index)) {
77842
77944
  case 34:
77843
77945
  escape2 = "&quot;";
77844
77946
  break;
@@ -77858,12 +77960,12 @@ var require_escape_html = __commonJS({
77858
77960
  continue;
77859
77961
  }
77860
77962
  if (lastIndex !== index) {
77861
- html += str.substring(lastIndex, index);
77963
+ html += str2.substring(lastIndex, index);
77862
77964
  }
77863
77965
  lastIndex = index + 1;
77864
77966
  html += escape2;
77865
77967
  }
77866
- return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
77968
+ return lastIndex !== index ? html + str2.substring(lastIndex, index) : html;
77867
77969
  }
77868
77970
  }
77869
77971
  });
@@ -77903,20 +78005,20 @@ var require_parseurl = __commonJS({
77903
78005
  parsed._raw = url3;
77904
78006
  return req._parsedOriginalUrl = parsed;
77905
78007
  }
77906
- function fastparse(str) {
77907
- if (typeof str !== "string" || str.charCodeAt(0) !== 47) {
77908
- return parse4(str);
78008
+ function fastparse(str2) {
78009
+ if (typeof str2 !== "string" || str2.charCodeAt(0) !== 47) {
78010
+ return parse4(str2);
77909
78011
  }
77910
- var pathname = str;
78012
+ var pathname = str2;
77911
78013
  var query = null;
77912
78014
  var search = null;
77913
- for (var i = 1; i < str.length; i++) {
77914
- switch (str.charCodeAt(i)) {
78015
+ for (var i = 1; i < str2.length; i++) {
78016
+ switch (str2.charCodeAt(i)) {
77915
78017
  case 63:
77916
78018
  if (search === null) {
77917
- pathname = str.substring(0, i);
77918
- query = str.substring(i + 1);
77919
- search = str.substring(i);
78019
+ pathname = str2.substring(0, i);
78020
+ query = str2.substring(i + 1);
78021
+ search = str2.substring(i);
77920
78022
  }
77921
78023
  break;
77922
78024
  case 9:
@@ -77933,12 +78035,12 @@ var require_parseurl = __commonJS({
77933
78035
  /* # */
77934
78036
  case 160:
77935
78037
  case 65279:
77936
- return parse4(str);
78038
+ return parse4(str2);
77937
78039
  }
77938
78040
  }
77939
78041
  var url3 = Url !== void 0 ? new Url() : {};
77940
- url3.path = str;
77941
- url3.href = str;
78042
+ url3.path = str2;
78043
+ url3.href = str2;
77942
78044
  url3.pathname = pathname;
77943
78045
  if (search !== null) {
77944
78046
  url3.query = query;
@@ -78951,11 +79053,11 @@ var require_proxy_addr = __commonJS({
78951
79053
  }
78952
79054
  function parseipNotation(note) {
78953
79055
  var pos = note.lastIndexOf("/");
78954
- var str = pos !== -1 ? note.substring(0, pos) : note;
78955
- if (!isip(str)) {
78956
- throw new TypeError("invalid IP address: " + str);
79056
+ var str2 = pos !== -1 ? note.substring(0, pos) : note;
79057
+ if (!isip(str2)) {
79058
+ throw new TypeError("invalid IP address: " + str2);
78957
79059
  }
78958
- var ip = parseip(str);
79060
+ var ip = parseip(str2);
78959
79061
  if (pos === -1 && ip.kind() === "ipv6" && ip.isIPv4MappedAddress()) {
78960
79062
  ip = ip.toIPv4Address();
78961
79063
  }
@@ -79064,22 +79166,22 @@ var require_utils8 = __commonJS({
79064
79166
  exports2.normalizeTypes = function(types2) {
79065
79167
  return types2.map(exports2.normalizeType);
79066
79168
  };
79067
- function acceptParams(str) {
79068
- var length = str.length;
79069
- var colonIndex = str.indexOf(";");
79169
+ function acceptParams(str2) {
79170
+ var length = str2.length;
79171
+ var colonIndex = str2.indexOf(";");
79070
79172
  var index = colonIndex === -1 ? length : colonIndex;
79071
- var ret = { value: str.slice(0, index).trim(), quality: 1, params: {} };
79173
+ var ret = { value: str2.slice(0, index).trim(), quality: 1, params: {} };
79072
79174
  while (index < length) {
79073
- var splitIndex = str.indexOf("=", index);
79175
+ var splitIndex = str2.indexOf("=", index);
79074
79176
  if (splitIndex === -1) break;
79075
- var colonIndex = str.indexOf(";", index);
79177
+ var colonIndex = str2.indexOf(";", index);
79076
79178
  var endIndex = colonIndex === -1 ? length : colonIndex;
79077
79179
  if (splitIndex > endIndex) {
79078
- index = str.lastIndexOf(";", splitIndex - 1) + 1;
79180
+ index = str2.lastIndexOf(";", splitIndex - 1) + 1;
79079
79181
  continue;
79080
79182
  }
79081
- var key = str.slice(index, splitIndex).trim();
79082
- var value = str.slice(splitIndex + 1, endIndex).trim();
79183
+ var key = str2.slice(index, splitIndex).trim();
79184
+ var value = str2.slice(splitIndex + 1, endIndex).trim();
79083
79185
  if (key === "q") {
79084
79186
  ret.quality = parseFloat(value);
79085
79187
  } else {
@@ -79162,8 +79264,8 @@ var require_utils8 = __commonJS({
79162
79264
  return etag(buf, options);
79163
79265
  };
79164
79266
  }
79165
- function parseExtendedQueryString(str) {
79166
- return qs.parse(str, {
79267
+ function parseExtendedQueryString(str2) {
79268
+ return qs.parse(str2, {
79167
79269
  allowPrototypes: true
79168
79270
  });
79169
79271
  }
@@ -79283,11 +79385,11 @@ var require_dist3 = __commonJS({
79283
79385
  "?": "?",
79284
79386
  "!": "!"
79285
79387
  };
79286
- function escapeText(str) {
79287
- return str.replace(/[{}()\[\]+?!:*\\]/g, "\\$&");
79388
+ function escapeText(str2) {
79389
+ return str2.replace(/[{}()\[\]+?!:*\\]/g, "\\$&");
79288
79390
  }
79289
- function escape2(str) {
79290
- return str.replace(/[.+*?^${}()[\]|/\\]/g, "\\$&");
79391
+ function escape2(str2) {
79392
+ return str2.replace(/[.+*?^${}()[\]|/\\]/g, "\\$&");
79291
79393
  }
79292
79394
  var TokenData = class {
79293
79395
  constructor(tokens, originalPath) {
@@ -79307,9 +79409,9 @@ var require_dist3 = __commonJS({
79307
79409
  }
79308
79410
  };
79309
79411
  exports2.PathError = PathError;
79310
- function parse4(str, options = {}) {
79412
+ function parse4(str2, options = {}) {
79311
79413
  const { encodePath = NOOP_VALUE } = options;
79312
- const chars = [...str];
79414
+ const chars = [...str2];
79313
79415
  const tokens = [];
79314
79416
  let index = 0;
79315
79417
  let pos = 0;
@@ -79332,11 +79434,11 @@ var require_dist3 = __commonJS({
79332
79434
  value += chars[index];
79333
79435
  }
79334
79436
  if (quoteStart) {
79335
- throw new PathError(`Unterminated quote at index ${quoteStart}`, str);
79437
+ throw new PathError(`Unterminated quote at index ${quoteStart}`, str2);
79336
79438
  }
79337
79439
  }
79338
79440
  if (!value) {
79339
- throw new PathError(`Missing parameter name at index ${index}`, str);
79441
+ throw new PathError(`Missing parameter name at index ${index}`, str2);
79340
79442
  }
79341
79443
  return value;
79342
79444
  }
@@ -79389,11 +79491,11 @@ var require_dist3 = __commonJS({
79389
79491
  });
79390
79492
  continue;
79391
79493
  }
79392
- throw new PathError(`Unexpected ${token2.type} at index ${token2.index}, expected ${endType}`, str);
79494
+ throw new PathError(`Unexpected ${token2.type} at index ${token2.index}, expected ${endType}`, str2);
79393
79495
  }
79394
79496
  return output;
79395
79497
  }
79396
- return new TokenData(consumeUntil("end"), str);
79498
+ return new TokenData(consumeUntil("end"), str2);
79397
79499
  }
79398
79500
  function compile(path2, options = {}) {
79399
79501
  const { encode: encode3 = encodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
@@ -80557,8 +80659,8 @@ var require_charset = __commonJS({
80557
80659
  accepts.length = j;
80558
80660
  return accepts;
80559
80661
  }
80560
- function parseCharset(str, i) {
80561
- var match = simpleCharsetRegExp.exec(str);
80662
+ function parseCharset(str2, i) {
80663
+ var match = simpleCharsetRegExp.exec(str2);
80562
80664
  if (!match) return null;
80563
80665
  var charset = match[1];
80564
80666
  var q = 1;
@@ -80655,8 +80757,8 @@ var require_encoding = __commonJS({
80655
80757
  accepts.length = j;
80656
80758
  return accepts;
80657
80759
  }
80658
- function parseEncoding(str, i) {
80659
- var match = simpleEncodingRegExp.exec(str);
80760
+ function parseEncoding(str2, i) {
80761
+ var match = simpleEncodingRegExp.exec(str2);
80660
80762
  if (!match) return null;
80661
80763
  var encoding = match[1];
80662
80764
  var q = 1;
@@ -80757,8 +80859,8 @@ var require_language = __commonJS({
80757
80859
  accepts.length = j;
80758
80860
  return accepts;
80759
80861
  }
80760
- function parseLanguage(str, i) {
80761
- var match = simpleLanguageRegExp.exec(str);
80862
+ function parseLanguage(str2, i) {
80863
+ var match = simpleLanguageRegExp.exec(str2);
80762
80864
  if (!match) return null;
80763
80865
  var prefix = match[1];
80764
80866
  var suffix = match[2];
@@ -80852,8 +80954,8 @@ var require_mediaType = __commonJS({
80852
80954
  accepts.length = j;
80853
80955
  return accepts;
80854
80956
  }
80855
- function parseMediaType(str, i) {
80856
- var match = simpleMediaTypeRegExp.exec(str);
80957
+ function parseMediaType(str2, i) {
80958
+ var match = simpleMediaTypeRegExp.exec(str2);
80857
80959
  if (!match) return null;
80858
80960
  var params = /* @__PURE__ */ Object.create(null);
80859
80961
  var q = 1;
@@ -80954,15 +81056,15 @@ var require_mediaType = __commonJS({
80954
81056
  }
80955
81057
  return count4;
80956
81058
  }
80957
- function splitKeyValuePair(str) {
80958
- var index = str.indexOf("=");
81059
+ function splitKeyValuePair(str2) {
81060
+ var index = str2.indexOf("=");
80959
81061
  var key;
80960
81062
  var val;
80961
81063
  if (index === -1) {
80962
- key = str;
81064
+ key = str2;
80963
81065
  } else {
80964
- key = str.slice(0, index);
80965
- val = str.slice(index + 1);
81066
+ key = str2.slice(0, index);
81067
+ val = str2.slice(index + 1);
80966
81068
  }
80967
81069
  return [key, val];
80968
81070
  }
@@ -80978,8 +81080,8 @@ var require_mediaType = __commonJS({
80978
81080
  accepts.length = j + 1;
80979
81081
  return accepts;
80980
81082
  }
80981
- function splitParameters(str) {
80982
- var parameters = str.split(";");
81083
+ function splitParameters(str2) {
81084
+ var parameters = str2.split(";");
80983
81085
  for (var i = 1, j = 0; i < parameters.length; i++) {
80984
81086
  if (quoteCount(parameters[j]) % 2 == 0) {
80985
81087
  parameters[++j] = parameters[i];
@@ -81179,19 +81281,19 @@ var require_fresh = __commonJS({
81179
81281
  var timestamp = date4 && Date.parse(date4);
81180
81282
  return typeof timestamp === "number" ? timestamp : NaN;
81181
81283
  }
81182
- function parseTokenList(str) {
81284
+ function parseTokenList(str2) {
81183
81285
  var end = 0;
81184
81286
  var list2 = [];
81185
81287
  var start = 0;
81186
- for (var i = 0, len = str.length; i < len; i++) {
81187
- switch (str.charCodeAt(i)) {
81288
+ for (var i = 0, len = str2.length; i < len; i++) {
81289
+ switch (str2.charCodeAt(i)) {
81188
81290
  case 32:
81189
81291
  if (start === end) {
81190
81292
  start = end = i + 1;
81191
81293
  }
81192
81294
  break;
81193
81295
  case 44:
81194
- list2.push(str.substring(start, end));
81296
+ list2.push(str2.substring(start, end));
81195
81297
  start = end = i + 1;
81196
81298
  break;
81197
81299
  default:
@@ -81199,7 +81301,7 @@ var require_fresh = __commonJS({
81199
81301
  break;
81200
81302
  }
81201
81303
  }
81202
- list2.push(str.substring(start, end));
81304
+ list2.push(str2.substring(start, end));
81203
81305
  return list2;
81204
81306
  }
81205
81307
  }
@@ -81210,17 +81312,17 @@ var require_range_parser = __commonJS({
81210
81312
  "../../node_modules/range-parser/index.js"(exports2, module2) {
81211
81313
  "use strict";
81212
81314
  module2.exports = rangeParser;
81213
- function rangeParser(size, str, options) {
81214
- if (typeof str !== "string") {
81315
+ function rangeParser(size, str2, options) {
81316
+ if (typeof str2 !== "string") {
81215
81317
  throw new TypeError("argument str must be a string");
81216
81318
  }
81217
- var index = str.indexOf("=");
81319
+ var index = str2.indexOf("=");
81218
81320
  if (index === -1) {
81219
81321
  return -2;
81220
81322
  }
81221
- var arr = str.slice(index + 1).split(",");
81323
+ var arr = str2.slice(index + 1).split(",");
81222
81324
  var ranges = [];
81223
- ranges.type = str.slice(0, index);
81325
+ ranges.type = str2.slice(0, index);
81224
81326
  for (var i = 0; i < arr.length; i++) {
81225
81327
  var range = arr[i].split("-");
81226
81328
  var start = parseInt(range[0], 10);
@@ -81505,8 +81607,8 @@ var require_content_disposition = __commonJS({
81505
81607
  }
81506
81608
  return string3;
81507
81609
  }
81508
- function decodefield(str) {
81509
- var match = EXT_VALUE_REGEXP.exec(str);
81610
+ function decodefield(str2) {
81611
+ var match = EXT_VALUE_REGEXP.exec(str2);
81510
81612
  if (!match) {
81511
81613
  throw new TypeError("invalid extended field value");
81512
81614
  }
@@ -81575,19 +81677,19 @@ var require_content_disposition = __commonJS({
81575
81677
  }
81576
81678
  return new ContentDisposition(type, params);
81577
81679
  }
81578
- function pdecode(str, hex3) {
81680
+ function pdecode(str2, hex3) {
81579
81681
  return String.fromCharCode(parseInt(hex3, 16));
81580
81682
  }
81581
81683
  function pencode(char) {
81582
81684
  return "%" + String(char).charCodeAt(0).toString(16).toUpperCase();
81583
81685
  }
81584
81686
  function qstring(val) {
81585
- var str = String(val);
81586
- return '"' + str.replace(QUOTE_REGEXP, "\\$1") + '"';
81687
+ var str2 = String(val);
81688
+ return '"' + str2.replace(QUOTE_REGEXP, "\\$1") + '"';
81587
81689
  }
81588
81690
  function ustring(val) {
81589
- var str = String(val);
81590
- var encoded = encodeURIComponent(str).replace(ENCODE_URL_ATTR_CHAR_REGEXP, pencode);
81691
+ var str2 = String(val);
81692
+ var encoded = encodeURIComponent(str2).replace(ENCODE_URL_ATTR_CHAR_REGEXP, pencode);
81591
81693
  return "UTF-8''" + encoded;
81592
81694
  }
81593
81695
  function ContentDisposition(type, parameters) {
@@ -81627,54 +81729,54 @@ var require_cookie = __commonJS({
81627
81729
  var cookieValueRegExp = /^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/;
81628
81730
  var domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
81629
81731
  var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
81630
- function parse4(str, opt) {
81631
- if (typeof str !== "string") {
81732
+ function parse4(str2, opt) {
81733
+ if (typeof str2 !== "string") {
81632
81734
  throw new TypeError("argument str must be a string");
81633
81735
  }
81634
81736
  var obj = {};
81635
- var len = str.length;
81737
+ var len = str2.length;
81636
81738
  if (len < 2) return obj;
81637
81739
  var dec = opt && opt.decode || decode3;
81638
81740
  var index = 0;
81639
81741
  var eqIdx = 0;
81640
81742
  var endIdx = 0;
81641
81743
  do {
81642
- eqIdx = str.indexOf("=", index);
81744
+ eqIdx = str2.indexOf("=", index);
81643
81745
  if (eqIdx === -1) break;
81644
- endIdx = str.indexOf(";", index);
81746
+ endIdx = str2.indexOf(";", index);
81645
81747
  if (endIdx === -1) {
81646
81748
  endIdx = len;
81647
81749
  } else if (eqIdx > endIdx) {
81648
- index = str.lastIndexOf(";", eqIdx - 1) + 1;
81750
+ index = str2.lastIndexOf(";", eqIdx - 1) + 1;
81649
81751
  continue;
81650
81752
  }
81651
- var keyStartIdx = startIndex(str, index, eqIdx);
81652
- var keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
81653
- var key = str.slice(keyStartIdx, keyEndIdx);
81753
+ var keyStartIdx = startIndex(str2, index, eqIdx);
81754
+ var keyEndIdx = endIndex(str2, eqIdx, keyStartIdx);
81755
+ var key = str2.slice(keyStartIdx, keyEndIdx);
81654
81756
  if (!__hasOwnProperty.call(obj, key)) {
81655
- var valStartIdx = startIndex(str, eqIdx + 1, endIdx);
81656
- var valEndIdx = endIndex(str, endIdx, valStartIdx);
81657
- if (str.charCodeAt(valStartIdx) === 34 && str.charCodeAt(valEndIdx - 1) === 34) {
81757
+ var valStartIdx = startIndex(str2, eqIdx + 1, endIdx);
81758
+ var valEndIdx = endIndex(str2, endIdx, valStartIdx);
81759
+ if (str2.charCodeAt(valStartIdx) === 34 && str2.charCodeAt(valEndIdx - 1) === 34) {
81658
81760
  valStartIdx++;
81659
81761
  valEndIdx--;
81660
81762
  }
81661
- var val = str.slice(valStartIdx, valEndIdx);
81763
+ var val = str2.slice(valStartIdx, valEndIdx);
81662
81764
  obj[key] = tryDecode(val, dec);
81663
81765
  }
81664
81766
  index = endIdx + 1;
81665
81767
  } while (index < len);
81666
81768
  return obj;
81667
81769
  }
81668
- function startIndex(str, index, max2) {
81770
+ function startIndex(str2, index, max2) {
81669
81771
  do {
81670
- var code = str.charCodeAt(index);
81772
+ var code = str2.charCodeAt(index);
81671
81773
  if (code !== 32 && code !== 9) return index;
81672
81774
  } while (++index < max2);
81673
81775
  return max2;
81674
81776
  }
81675
- function endIndex(str, index, min) {
81777
+ function endIndex(str2, index, min) {
81676
81778
  while (index > min) {
81677
- var code = str.charCodeAt(--index);
81779
+ var code = str2.charCodeAt(--index);
81678
81780
  if (code !== 32 && code !== 9) return index + 1;
81679
81781
  }
81680
81782
  return min;
@@ -81691,54 +81793,54 @@ var require_cookie = __commonJS({
81691
81793
  if (!cookieValueRegExp.test(value)) {
81692
81794
  throw new TypeError("argument val is invalid");
81693
81795
  }
81694
- var str = name + "=" + value;
81695
- if (!opt) return str;
81796
+ var str2 = name + "=" + value;
81797
+ if (!opt) return str2;
81696
81798
  if (null != opt.maxAge) {
81697
81799
  var maxAge = Math.floor(opt.maxAge);
81698
81800
  if (!isFinite(maxAge)) {
81699
81801
  throw new TypeError("option maxAge is invalid");
81700
81802
  }
81701
- str += "; Max-Age=" + maxAge;
81803
+ str2 += "; Max-Age=" + maxAge;
81702
81804
  }
81703
81805
  if (opt.domain) {
81704
81806
  if (!domainValueRegExp.test(opt.domain)) {
81705
81807
  throw new TypeError("option domain is invalid");
81706
81808
  }
81707
- str += "; Domain=" + opt.domain;
81809
+ str2 += "; Domain=" + opt.domain;
81708
81810
  }
81709
81811
  if (opt.path) {
81710
81812
  if (!pathValueRegExp.test(opt.path)) {
81711
81813
  throw new TypeError("option path is invalid");
81712
81814
  }
81713
- str += "; Path=" + opt.path;
81815
+ str2 += "; Path=" + opt.path;
81714
81816
  }
81715
81817
  if (opt.expires) {
81716
81818
  var expires = opt.expires;
81717
81819
  if (!isDate(expires) || isNaN(expires.valueOf())) {
81718
81820
  throw new TypeError("option expires is invalid");
81719
81821
  }
81720
- str += "; Expires=" + expires.toUTCString();
81822
+ str2 += "; Expires=" + expires.toUTCString();
81721
81823
  }
81722
81824
  if (opt.httpOnly) {
81723
- str += "; HttpOnly";
81825
+ str2 += "; HttpOnly";
81724
81826
  }
81725
81827
  if (opt.secure) {
81726
- str += "; Secure";
81828
+ str2 += "; Secure";
81727
81829
  }
81728
81830
  if (opt.partitioned) {
81729
- str += "; Partitioned";
81831
+ str2 += "; Partitioned";
81730
81832
  }
81731
81833
  if (opt.priority) {
81732
81834
  var priority = typeof opt.priority === "string" ? opt.priority.toLowerCase() : opt.priority;
81733
81835
  switch (priority) {
81734
81836
  case "low":
81735
- str += "; Priority=Low";
81837
+ str2 += "; Priority=Low";
81736
81838
  break;
81737
81839
  case "medium":
81738
- str += "; Priority=Medium";
81840
+ str2 += "; Priority=Medium";
81739
81841
  break;
81740
81842
  case "high":
81741
- str += "; Priority=High";
81843
+ str2 += "; Priority=High";
81742
81844
  break;
81743
81845
  default:
81744
81846
  throw new TypeError("option priority is invalid");
@@ -81748,34 +81850,34 @@ var require_cookie = __commonJS({
81748
81850
  var sameSite = typeof opt.sameSite === "string" ? opt.sameSite.toLowerCase() : opt.sameSite;
81749
81851
  switch (sameSite) {
81750
81852
  case true:
81751
- str += "; SameSite=Strict";
81853
+ str2 += "; SameSite=Strict";
81752
81854
  break;
81753
81855
  case "lax":
81754
- str += "; SameSite=Lax";
81856
+ str2 += "; SameSite=Lax";
81755
81857
  break;
81756
81858
  case "strict":
81757
- str += "; SameSite=Strict";
81859
+ str2 += "; SameSite=Strict";
81758
81860
  break;
81759
81861
  case "none":
81760
- str += "; SameSite=None";
81862
+ str2 += "; SameSite=None";
81761
81863
  break;
81762
81864
  default:
81763
81865
  throw new TypeError("option sameSite is invalid");
81764
81866
  }
81765
81867
  }
81766
- return str;
81868
+ return str2;
81767
81869
  }
81768
- function decode3(str) {
81769
- return str.indexOf("%") !== -1 ? decodeURIComponent(str) : str;
81870
+ function decode3(str2) {
81871
+ return str2.indexOf("%") !== -1 ? decodeURIComponent(str2) : str2;
81770
81872
  }
81771
81873
  function isDate(val) {
81772
81874
  return __toString.call(val) === "[object Date]";
81773
81875
  }
81774
- function tryDecode(str, decode4) {
81876
+ function tryDecode(str2, decode4) {
81775
81877
  try {
81776
- return decode4(str);
81878
+ return decode4(str2);
81777
81879
  } catch (e) {
81778
- return str;
81880
+ return str2;
81779
81881
  }
81780
81882
  }
81781
81883
  }
@@ -82174,13 +82276,13 @@ var require_send = __commonJS({
82174
82276
  res.removeHeader(header);
82175
82277
  }
82176
82278
  }
82177
- function collapseLeadingSlashes(str) {
82178
- for (var i = 0; i < str.length; i++) {
82179
- if (str[i] !== "/") {
82279
+ function collapseLeadingSlashes(str2) {
82280
+ for (var i = 0; i < str2.length; i++) {
82281
+ if (str2[i] !== "/") {
82180
82282
  break;
82181
82283
  }
82182
82284
  }
82183
- return i > 1 ? "/" + str.substr(i) : str;
82285
+ return i > 1 ? "/" + str2.substr(i) : str2;
82184
82286
  }
82185
82287
  function containsDotFile(parts) {
82186
82288
  for (var i = 0; i < parts.length; i++) {
@@ -82227,12 +82329,12 @@ var require_send = __commonJS({
82227
82329
  var timestamp = date4 && Date.parse(date4);
82228
82330
  return typeof timestamp === "number" ? timestamp : NaN;
82229
82331
  }
82230
- function parseTokenList(str) {
82332
+ function parseTokenList(str2) {
82231
82333
  var end = 0;
82232
82334
  var list2 = [];
82233
82335
  var start = 0;
82234
- for (var i = 0, len = str.length; i < len; i++) {
82235
- switch (str.charCodeAt(i)) {
82336
+ for (var i = 0, len = str2.length; i < len; i++) {
82337
+ switch (str2.charCodeAt(i)) {
82236
82338
  case 32:
82237
82339
  if (start === end) {
82238
82340
  start = end = i + 1;
@@ -82240,7 +82342,7 @@ var require_send = __commonJS({
82240
82342
  break;
82241
82343
  case 44:
82242
82344
  if (start !== end) {
82243
- list2.push(str.substring(start, end));
82345
+ list2.push(str2.substring(start, end));
82244
82346
  }
82245
82347
  start = end = i + 1;
82246
82348
  break;
@@ -82250,7 +82352,7 @@ var require_send = __commonJS({
82250
82352
  }
82251
82353
  }
82252
82354
  if (start !== end) {
82253
- list2.push(str.substring(start, end));
82355
+ list2.push(str2.substring(start, end));
82254
82356
  }
82255
82357
  return list2;
82256
82358
  }
@@ -82714,9 +82816,9 @@ var require_response = __commonJS({
82714
82816
  opts = {};
82715
82817
  }
82716
82818
  opts._locals = self.locals;
82717
- done = done || function(err2, str) {
82819
+ done = done || function(err2, str2) {
82718
82820
  if (err2) return req.next(err2);
82719
- self.send(str);
82821
+ self.send(str2);
82720
82822
  };
82721
82823
  app.render(view, opts, done);
82722
82824
  };
@@ -82872,13 +82974,13 @@ var require_serve_static = __commonJS({
82872
82974
  stream.pipe(res);
82873
82975
  };
82874
82976
  }
82875
- function collapseLeadingSlashes(str) {
82876
- for (var i = 0; i < str.length; i++) {
82877
- if (str.charCodeAt(i) !== 47) {
82977
+ function collapseLeadingSlashes(str2) {
82978
+ for (var i = 0; i < str2.length; i++) {
82979
+ if (str2.charCodeAt(i) !== 47) {
82878
82980
  break;
82879
82981
  }
82880
82982
  }
82881
- return i > 1 ? "/" + str.substr(i) : str;
82983
+ return i > 1 ? "/" + str2.substr(i) : str2;
82882
82984
  }
82883
82985
  function createHtmlDocument(title, body) {
82884
82986
  return '<!DOCTYPE html>\n<html lang="en">\n<head>\n<meta charset="utf-8">\n<title>' + title + "</title>\n</head>\n<body>\n<pre>" + body + "</pre>\n</body>\n</html>\n";
@@ -84298,6 +84400,7 @@ var init_mcp_server2 = __esm({
84298
84400
  init_mcp();
84299
84401
  init_stdio2();
84300
84402
  init_entrypoint();
84403
+ init_search_solutions_tool();
84301
84404
  init_types4();
84302
84405
  (0, import_dotenv3.config)({ path: (0, import_path5.resolve)(__dirname, "../../../.env") });
84303
84406
  DEFAULT_API_URL3 = SERVICE_URL_DEFAULTS.haansiApiBaseUrl;
@@ -84334,25 +84437,7 @@ var init_mcp_server2 = __esm({
84334
84437
  server = mcpServer.server;
84335
84438
  server.setRequestHandler(ListToolsRequestSchema, async () => ({
84336
84439
  tools: [
84337
- {
84338
- name: "search_solutions",
84339
- description: "Search previously solved similar questions from your organization's knowledge base. Finds how bugs were fixed, what patterns were used, and past resolutions to similar problems. Results are ranked by a composite of relevance, quality, recency, and verification status.",
84340
- inputSchema: {
84341
- type: "object",
84342
- properties: {
84343
- query: {
84344
- type: "string",
84345
- description: "Natural-language description of the problem or solution to search for"
84346
- },
84347
- top_k: {
84348
- type: "number",
84349
- description: "Number of results to return (default: 5, max: 20)"
84350
- },
84351
- _context: contextSchema
84352
- },
84353
- required: ["query"]
84354
- }
84355
- },
84440
+ searchSolutionsTool(contextSchema),
84356
84441
  {
84357
84442
  name: "list_recent_solutions",
84358
84443
  description: "List the most recently added distilled paths from the knowledge base.",
@@ -84461,12 +84546,8 @@ var init_mcp_server2 = __esm({
84461
84546
  try {
84462
84547
  switch (name) {
84463
84548
  case "search_solutions": {
84464
- const {
84465
- query,
84466
- top_k = 5,
84467
- _context
84468
- } = args;
84469
- const k = Math.min(Math.max(1, top_k), 20);
84549
+ const searchArgs = args;
84550
+ const { _context } = searchArgs;
84470
84551
  const extraHeaders = {};
84471
84552
  if (_context?.userId) {
84472
84553
  extraHeaders["X-Session-User-Id"] = String(_context.userId);
@@ -84474,10 +84555,9 @@ var init_mcp_server2 = __esm({
84474
84555
  if (_context?.orgId) {
84475
84556
  extraHeaders["X-Session-Org-Id"] = String(_context.orgId);
84476
84557
  }
84477
- const data = await apiGet2(
84478
- `/memory/solutions/search?q=${encodeURIComponent(query)}&top_k=${k}`,
84479
- { extraHeaders }
84480
- );
84558
+ const data = await apiGet2(searchSolutionsPath(searchArgs), {
84559
+ extraHeaders
84560
+ });
84481
84561
  if (!data.results || data.results.length === 0) {
84482
84562
  return {
84483
84563
  content: [
@@ -87923,6 +88003,46 @@ var init_replay_relevance = __esm({
87923
88003
  }
87924
88004
  });
87925
88005
 
88006
+ // src/commands/replay-codex.ts
88007
+ function codexConfigOf(mcpJson) {
88008
+ let servers = {};
88009
+ try {
88010
+ const parsed = JSON.parse(mcpJson);
88011
+ if (parsed.mcpServers && typeof parsed.mcpServers === "object" && !Array.isArray(parsed.mcpServers))
88012
+ servers = parsed.mcpServers;
88013
+ } catch {
88014
+ servers = {};
88015
+ }
88016
+ const blocks = [];
88017
+ for (const [name, raw] of Object.entries(servers)) {
88018
+ if (!raw || typeof raw !== "object") continue;
88019
+ const s = raw;
88020
+ const lines = [`[mcp_servers.${str(name)}]`];
88021
+ if (typeof s.url === "string") {
88022
+ lines.push(`url = ${str(s.url)}`);
88023
+ if (s.headers && Object.keys(s.headers).length)
88024
+ lines.push(`http_headers = ${inlineTable(s.headers)}`);
88025
+ } else if (typeof s.command === "string") {
88026
+ lines.push(`command = ${str(s.command)}`);
88027
+ if (s.args?.length)
88028
+ lines.push(`args = [${s.args.map((a) => str(String(a))).join(", ")}]`);
88029
+ if (s.env && Object.keys(s.env).length)
88030
+ lines.push(`env = ${inlineTable(s.env)}`);
88031
+ } else continue;
88032
+ blocks.push(lines.join("\n"));
88033
+ }
88034
+ return blocks.length ? `${blocks.join("\n\n")}
88035
+ ` : "";
88036
+ }
88037
+ var str, inlineTable;
88038
+ var init_replay_codex = __esm({
88039
+ "src/commands/replay-codex.ts"() {
88040
+ "use strict";
88041
+ str = (v) => JSON.stringify(v);
88042
+ inlineTable = (o) => `{ ${Object.entries(o).map(([k, v]) => `${str(k)} = ${str(v)}`).join(", ")} }`;
88043
+ }
88044
+ });
88045
+
87926
88046
  // src/commands/replay-interface.ts
87927
88047
  function importsOf(source) {
87928
88048
  const text = stripComments(source);
@@ -87985,6 +88105,11 @@ async function firstAt(show, sha, paths) {
87985
88105
  }
87986
88106
  return null;
87987
88107
  }
88108
+ function isTestSupport(path2) {
88109
+ return /(^|\/)(__tests__|__mocks__|__fixtures__|fixtures?|test-utils?)\//.test(
88110
+ path2
88111
+ );
88112
+ }
87988
88113
  async function testInterfaceOf(show, task) {
87989
88114
  const tests = new Set(task.testFiles);
87990
88115
  const byPath = /* @__PURE__ */ new Map();
@@ -87996,10 +88121,7 @@ async function testInterfaceOf(show, task) {
87996
88121
  const candidates = candidatesFor(file2, imp.spec);
87997
88122
  const atTarget = await firstAt(show, task.targetSha, candidates);
87998
88123
  if (!atTarget || tests.has(atTarget.path)) continue;
87999
- if (/(^|\/)(__tests__|__mocks__|__fixtures__|fixtures?|test-utils?)\//.test(
88000
- atTarget.path
88001
- ))
88002
- continue;
88124
+ if (isTestSupport(atTarget.path)) continue;
88003
88125
  const atBase = await show(task.baseSha, atTarget.path);
88004
88126
  const names = imp.names.filter(
88005
88127
  (n) => atBase === null || !exportsName(atBase, n)
@@ -88024,20 +88146,37 @@ async function testInterfaceOf(show, task) {
88024
88146
  return { ...e, names };
88025
88147
  });
88026
88148
  }
88149
+ function fencedTs(text) {
88150
+ const longest = Math.max(
88151
+ 0,
88152
+ ...(text.match(/`+/g) ?? []).map((run3) => run3.length)
88153
+ );
88154
+ const fence = "`".repeat(Math.max(3, longest + 1));
88155
+ return [`${fence}ts`, ...text.split("\n"), fence];
88156
+ }
88027
88157
  function interfaceSection(entries) {
88028
88158
  if (entries.length === 0) return [];
88029
88159
  return [
88030
88160
  "## What the tests use",
88031
88161
  "",
88032
- "The task's tests import these from the code, and they do not exist yet. Create them at these paths with these names; how they work is up to you.",
88162
+ "The task's tests import these from the code, and they do not exist yet. Create them at these paths with these names, declared as shown where a declaration is given; how they work is up to you.",
88033
88163
  "",
88034
- ...entries.map((e) => {
88164
+ ...entries.flatMap((e) => {
88035
88165
  const what = [
88036
88166
  ...e.defaultExport ? ["a default export"] : [],
88037
88167
  ...e.names.map((n) => `\`${n}\``)
88038
88168
  ];
88039
88169
  const where = `\`${e.path}\`${e.newFile ? " (a new file)" : ""}`;
88040
- return `- ${where}${what.length ? `: ${what.join(", ")}` : ""}`;
88170
+ const declared = e.names.filter((n) => e.signatures?.[n]);
88171
+ return [
88172
+ `- ${where}${what.length ? `: ${what.join(", ")}` : ""}`,
88173
+ // As the target declares each: its shape, never its body.
88174
+ ...declared.flatMap((n) => [
88175
+ "",
88176
+ ...fencedTs(e.signatures[n]).map((l) => ` ${l}`)
88177
+ ]),
88178
+ ...declared.length ? [""] : []
88179
+ ];
88041
88180
  }),
88042
88181
  ""
88043
88182
  ];
@@ -88056,6 +88195,494 @@ var init_replay_interface = __esm({
88056
88195
  }
88057
88196
  });
88058
88197
 
88198
+ // src/commands/replay-failure-paths.ts
88199
+ function isAppFile(path2) {
88200
+ return SOURCE.test(path2) && !TEST_FILE.test(path2) && !isTestSupport(path2) && !/(^|\/)(node_modules|dist|build|coverage|\.next)\//.test(path2);
88201
+ }
88202
+ function stackFramesOf(output) {
88203
+ const out = [];
88204
+ const seen = /* @__PURE__ */ new Set();
88205
+ for (const raw of output.split("\n")) {
88206
+ const line = relativePaths(raw);
88207
+ for (const m of line.matchAll(FRAME)) {
88208
+ const path2 = m[1].replace(/^\.\//, "");
88209
+ const n = Number(m[2]);
88210
+ if (!n || path2.split("/").includes("..") || !isAppFile(path2)) continue;
88211
+ const key = `${path2}:${n}`;
88212
+ if (seen.has(key)) continue;
88213
+ seen.add(key);
88214
+ out.push({ path: path2, line: n });
88215
+ if (out.length >= MAX_FRAMES) return out;
88216
+ }
88217
+ }
88218
+ return out;
88219
+ }
88220
+ async function resolveFrames(show, baseSha, frames) {
88221
+ const out = [];
88222
+ for (const f of frames) {
88223
+ const parts = f.path.replace(/^\/+/, "").split("/");
88224
+ const tries = f.path.startsWith("/") ? parts.slice(1, ABSOLUTE_TRIES + 1).map((_, i) => parts.slice(i + 1).join("/")) : [f.path];
88225
+ for (const p of tries) {
88226
+ if (!p || !isAppFile(p)) continue;
88227
+ if (await show(baseSha, p).catch(() => null) !== null) {
88228
+ if (!out.some((o) => o.path === p && o.line === f.line))
88229
+ out.push({ path: p, line: f.line });
88230
+ break;
88231
+ }
88232
+ }
88233
+ }
88234
+ return out;
88235
+ }
88236
+ function boundedGit(git, max2 = MAX_GIT_CALLS) {
88237
+ let calls = 0;
88238
+ return async (args) => {
88239
+ if (calls >= max2) return { code: 1, output: "" };
88240
+ calls += 1;
88241
+ try {
88242
+ return await git(args);
88243
+ } catch {
88244
+ return { code: 1, output: "" };
88245
+ }
88246
+ };
88247
+ }
88248
+ async function filesOfCommit(git, sha) {
88249
+ const out = await git(["show", "--name-only", "--format=", sha]);
88250
+ if (out.code !== 0) return [];
88251
+ return out.output.split("\n").map((l) => l.trim()).filter((l) => l && isAppFile(l)).slice(0, FILES_PER_COMMIT);
88252
+ }
88253
+ async function filesOfCommits(git, commits) {
88254
+ const out = [];
88255
+ for (const sha of commits.slice(0, MAX_COMMITS)) {
88256
+ for (const f of await filesOfCommit(git, sha))
88257
+ if (!out.includes(f)) out.push(f);
88258
+ if (out.length >= MAX_WHERE_PATHS) break;
88259
+ }
88260
+ return out.slice(0, MAX_WHERE_PATHS);
88261
+ }
88262
+ async function blamedPaths(git, baseSha, frames) {
88263
+ const commits = [];
88264
+ for (const f of frames.slice(0, MAX_FRAMES)) {
88265
+ const out = await git([
88266
+ "blame",
88267
+ "-L",
88268
+ `${f.line},${f.line}`,
88269
+ "--porcelain",
88270
+ baseSha,
88271
+ "--",
88272
+ f.path
88273
+ ]);
88274
+ if (out.code !== 0) continue;
88275
+ const sha = out.output.split(/\s/)[0] ?? "";
88276
+ if (SHA2.test(sha) && !/^0+$/.test(sha) && !commits.includes(sha))
88277
+ commits.push(sha);
88278
+ }
88279
+ const files = await filesOfCommits(git, commits);
88280
+ return [.../* @__PURE__ */ new Set([...frames.map((f) => f.path), ...files])].slice(
88281
+ 0,
88282
+ MAX_WHERE_PATHS
88283
+ );
88284
+ }
88285
+ async function historyPaths(git, baseSha, files) {
88286
+ const commits = /* @__PURE__ */ new Map();
88287
+ for (const file2 of files.slice(0, MAX_HISTORY_FILES)) {
88288
+ const out = await git([
88289
+ "log",
88290
+ "-n",
88291
+ String(COMMITS_PER_FILE),
88292
+ "--format=%H %ct",
88293
+ baseSha,
88294
+ "--",
88295
+ file2
88296
+ ]);
88297
+ if (out.code !== 0) continue;
88298
+ for (const line of out.output.split("\n")) {
88299
+ const [sha, at] = line.trim().split(/\s+/);
88300
+ if (sha && SHA2.test(sha) && !commits.has(sha))
88301
+ commits.set(sha, Number(at) || 0);
88302
+ }
88303
+ }
88304
+ const newest = [...commits.entries()].sort((a, b) => b[1] - a[1]).map(([sha]) => sha);
88305
+ return filesOfCommits(git, newest);
88306
+ }
88307
+ function packageCandidates(spec2) {
88308
+ const m = /^(@[\w.-]+\/[\w.-]+)(?:\/(.+))?$/.exec(spec2);
88309
+ if (!m) return [];
88310
+ const [, pkg, sub] = m;
88311
+ const stems = sub ? [`packages/${pkg}/src/${sub}`, `packages/${pkg}/${sub}`] : [`packages/${pkg}/src/index`, `packages/${pkg}/index`];
88312
+ return stems.flatMap((s) => [
88313
+ `${s}.ts`,
88314
+ `${s}.tsx`,
88315
+ `${s}.js`,
88316
+ `${s}/index.ts`
88317
+ ]);
88318
+ }
88319
+ function packageSpecsOf(source) {
88320
+ const text = source.replace(/\/\*[\s\S]*?\*\//g, " ").replace(/(^|[^:])\/\/.*$/gm, "$1");
88321
+ const out = [];
88322
+ for (const m of text.matchAll(
88323
+ /(?:\bfrom\s*|\b(?:vi|jest)\.(?:mock|doMock)\(\s*|\bimport\(\s*)["'](@[^"'\s]+)["']/g
88324
+ ))
88325
+ if (!out.includes(m[1])) out.push(m[1]);
88326
+ return out;
88327
+ }
88328
+ var MAX_FRAMES, COMMITS_PER_FILE, MAX_HISTORY_FILES, MAX_COMMITS, FILES_PER_COMMIT, MAX_WHERE_PATHS, MAX_GIT_CALLS, ABSOLUTE_TRIES, SOURCE, TEST_FILE, SHA2, FRAME;
88329
+ var init_replay_failure_paths = __esm({
88330
+ "src/commands/replay-failure-paths.ts"() {
88331
+ "use strict";
88332
+ init_replay_errors();
88333
+ init_replay_interface();
88334
+ MAX_FRAMES = 10;
88335
+ COMMITS_PER_FILE = 3;
88336
+ MAX_HISTORY_FILES = 16;
88337
+ MAX_COMMITS = 4;
88338
+ FILES_PER_COMMIT = 4;
88339
+ MAX_WHERE_PATHS = 6;
88340
+ MAX_GIT_CALLS = 40;
88341
+ ABSOLUTE_TRIES = 6;
88342
+ SOURCE = /\.(?:[cm]?[jt]sx?|py|go)$/;
88343
+ TEST_FILE = /(?:\.(?:test|spec)\.[cm]?[jt]sx?|_test\.go|(?:^|\/)test_[^/]*\.py|_test\.py)$/;
88344
+ SHA2 = /^[0-9a-f]{40}$/;
88345
+ FRAME = /(?:file:\/\/)?((?:\/|\.{0,2}\/)?(?:[\w.@+-]+\/)*[\w.@+-]+\.(?:[cm]?[jt]sx?|py|go)):(\d+)(?::\d+)?/g;
88346
+ }
88347
+ });
88348
+
88349
+ // src/commands/replay-spec.ts
88350
+ function stringAt(text, i) {
88351
+ const quote = text[i];
88352
+ if (quote !== "'" && quote !== '"' && quote !== "`") return null;
88353
+ let value = "";
88354
+ for (let j = i + 1; j < text.length; j++) {
88355
+ const c = text[j];
88356
+ if (c === "\\" && j + 1 < text.length) {
88357
+ value += text[j + 1];
88358
+ j += 1;
88359
+ } else if (c === quote) return { value, end: j + 1 };
88360
+ else if (quote !== "`" && c === "\n") return null;
88361
+ else value += c;
88362
+ }
88363
+ return null;
88364
+ }
88365
+ function skipGroup(text, i) {
88366
+ const open = text[i];
88367
+ const close = open === "(" ? ")" : open === "[" ? "]" : null;
88368
+ if (!close) return -1;
88369
+ let depth = 0;
88370
+ for (let j = i; j < text.length; j++) {
88371
+ const c = text[j];
88372
+ if (c === "'" || c === '"' || c === "`") {
88373
+ const s = stringAt(text, j);
88374
+ if (!s) return -1;
88375
+ j = s.end - 1;
88376
+ } else if (c === "(" || c === "[" || c === "{") depth += 1;
88377
+ else if (c === ")" || c === "]" || c === "}") {
88378
+ depth -= 1;
88379
+ if (depth === 0) return c === close ? j + 1 : -1;
88380
+ }
88381
+ }
88382
+ return -1;
88383
+ }
88384
+ function testCallAt(text, i) {
88385
+ CALL.lastIndex = i;
88386
+ const m = CALL.exec(text);
88387
+ if (!m) return null;
88388
+ let j = CALL.lastIndex;
88389
+ if (/[\w$]/.test(text[j] ?? "")) return null;
88390
+ const mods = m[2];
88391
+ if (/\.(?:each|skipIf|runIf|for)\b/.test(mods)) {
88392
+ while (/\s/.test(text[j] ?? "")) j++;
88393
+ if (text[j] === "`") {
88394
+ const s2 = stringAt(text, j);
88395
+ if (!s2) return null;
88396
+ j = s2.end;
88397
+ } else {
88398
+ j = skipGroup(text, j);
88399
+ if (j < 0) return null;
88400
+ }
88401
+ }
88402
+ while (/\s/.test(text[j] ?? "")) j++;
88403
+ if (text[j] !== "(") return null;
88404
+ j++;
88405
+ while (/\s/.test(text[j] ?? "")) j++;
88406
+ const s = stringAt(text, j);
88407
+ if (!s) return null;
88408
+ const suite = m[1] === "describe" || m[1] === "suite" || m[1] === "context";
88409
+ return { suite, title: s.value.replace(/\s+/g, " ").trim(), end: s.end };
88410
+ }
88411
+ function testTitlesOf(source) {
88412
+ const out = [];
88413
+ const stack = [];
88414
+ let depth = 0;
88415
+ const text = source;
88416
+ for (let i = 0; i < text.length; i++) {
88417
+ const c = text[i];
88418
+ const next = text[i + 1];
88419
+ if (c === "/" && next === "/") {
88420
+ const nl = text.indexOf("\n", i);
88421
+ i = nl < 0 ? text.length : nl;
88422
+ } else if (c === "/" && next === "*") {
88423
+ const close = text.indexOf("*/", i + 2);
88424
+ i = close < 0 ? text.length : close + 1;
88425
+ } else if (c === "'" || c === '"' || c === "`") {
88426
+ const s = stringAt(text, i);
88427
+ if (s) i = s.end - 1;
88428
+ } else if (c === "{") depth += 1;
88429
+ else if (c === "}") {
88430
+ depth -= 1;
88431
+ while (stack.length && depth <= stack[stack.length - 1].depth)
88432
+ stack.pop();
88433
+ } else if (/[a-z]/.test(c) && !/[\w$.]/.test(text[i - 1] ?? "")) {
88434
+ const call = testCallAt(text, i);
88435
+ if (!call) continue;
88436
+ if (call.suite) stack.push({ title: call.title, depth });
88437
+ else if (call.title)
88438
+ out.push([...stack.map((s) => s.title), call.title].join(" \u203A "));
88439
+ i = call.end - 1;
88440
+ }
88441
+ }
88442
+ return out;
88443
+ }
88444
+ async function targetTestTitles(show, task) {
88445
+ const out = [];
88446
+ for (const file2 of task.testFiles) {
88447
+ if (!JS_SOURCE.test(file2)) continue;
88448
+ const source = await show(task.targetSha, file2);
88449
+ if (source === null) continue;
88450
+ for (const t of testTitlesOf(source)) out.push(`${file2} \u203A ${t}`);
88451
+ }
88452
+ return out;
88453
+ }
88454
+ function cappedTitles(titles) {
88455
+ const shown = [];
88456
+ let chars = 0;
88457
+ for (const t of titles) {
88458
+ if (shown.length >= MAX_TITLES || chars + t.length > MAX_TITLE_CHARS) break;
88459
+ shown.push(t);
88460
+ chars += t.length;
88461
+ }
88462
+ return { shown, more: titles.length - shown.length };
88463
+ }
88464
+ function typeEnd(text, i, stops, bodyBrace) {
88465
+ let depth = 0;
88466
+ let expectType = true;
88467
+ for (let j = i; j < text.length; j++) {
88468
+ const c = text[j];
88469
+ if (c === "'" || c === '"' || c === "`") {
88470
+ const s = stringAt(text, j);
88471
+ if (s) j = s.end - 1;
88472
+ expectType = false;
88473
+ continue;
88474
+ }
88475
+ if (c === "=" && text[j + 1] === ">") {
88476
+ j += 1;
88477
+ expectType = true;
88478
+ continue;
88479
+ }
88480
+ if (depth === 0 && stops.includes(c)) return j;
88481
+ if (c === "{" && depth === 0 && bodyBrace && !expectType) return j;
88482
+ if ("([<{".includes(c)) {
88483
+ depth += 1;
88484
+ expectType = true;
88485
+ } else if (")]>}".includes(c)) {
88486
+ depth -= 1;
88487
+ expectType = false;
88488
+ if (depth < 0) return j;
88489
+ } else if (/[:|&,?]/.test(c)) expectType = true;
88490
+ else if (!/\s/.test(c)) expectType = false;
88491
+ }
88492
+ return text.length;
88493
+ }
88494
+ function capped(text) {
88495
+ const lines = text.trim().split("\n").map((l) => l.replace(/\s+$/, ""));
88496
+ let out = lines.slice(0, MAX_SIGNATURE_LINES).join("\n");
88497
+ let cut2 = lines.length > MAX_SIGNATURE_LINES;
88498
+ if (out.length > MAX_SIGNATURE_CHARS) {
88499
+ out = out.slice(0, MAX_SIGNATURE_CHARS);
88500
+ cut2 = true;
88501
+ }
88502
+ return cut2 ? `${out.trimEnd()}
88503
+ \u2026` : out;
88504
+ }
88505
+ function signatureOf(source, name) {
88506
+ const text = STRIP_COMMENTS(source);
88507
+ const n = name.replace(/\$/g, "\\$");
88508
+ const lead = String.raw`(?:^|\n)[ \t]*((?:export\s+)?(?:declare\s+)?(?:default\s+)?(?:abstract\s+)?(?:async\s+)?)`;
88509
+ const fn = new RegExp(`${lead}(function\\*?\\s+${n})\\b`).exec(text);
88510
+ if (fn) {
88511
+ const start = fn.index + fn[0].length - fn[2].length - fn[1].length;
88512
+ const end = typeEnd(text, fn.index + fn[0].length, ";", true);
88513
+ return capped(text.slice(start, end));
88514
+ }
88515
+ const cls = new RegExp(`${lead}(class\\s+${n})\\b`).exec(text);
88516
+ if (cls) {
88517
+ const start = cls.index + cls[0].length - cls[2].length - cls[1].length;
88518
+ const brace = text.indexOf("{", cls.index + cls[0].length);
88519
+ return capped(text.slice(start, brace < 0 ? text.length : brace));
88520
+ }
88521
+ const decl = new RegExp(`${lead}((?:interface|enum)\\s+${n})\\b`).exec(text);
88522
+ if (decl) {
88523
+ const start = decl.index + decl[0].length - decl[2].length - decl[1].length;
88524
+ const brace = text.indexOf("{", decl.index + decl[0].length);
88525
+ if (brace < 0 || /;|\n\s*(?:export|interface|type|const|function|class|enum)\b/.test(
88526
+ text.slice(decl.index + decl[0].length, brace)
88527
+ ))
88528
+ return null;
88529
+ let depth = 0;
88530
+ let end = text.length;
88531
+ for (let j = brace; j < text.length; j++) {
88532
+ if (text[j] === "{") depth += 1;
88533
+ else if (text[j] === "}" && --depth === 0) {
88534
+ end = j + 1;
88535
+ break;
88536
+ }
88537
+ }
88538
+ return capped(text.slice(start, end));
88539
+ }
88540
+ const type = new RegExp(`${lead}(type\\s+${n})\\b`).exec(text);
88541
+ if (type) {
88542
+ const start = type.index + type[0].length - type[2].length - type[1].length;
88543
+ const end = typeEnd(text, type.index + type[0].length, ";", false);
88544
+ return capped(text.slice(start, end));
88545
+ }
88546
+ const v = new RegExp(`${lead}((?:const|let|var)\\s+${n})\\b`).exec(text);
88547
+ if (v) {
88548
+ const start = v.index + v[0].length - v[2].length - v[1].length;
88549
+ const after = v.index + v[0].length;
88550
+ const rest = text.slice(after);
88551
+ if (/^\s*:/.test(rest)) {
88552
+ const end = typeEnd(text, after, "=;", false);
88553
+ return capped(text.slice(start, end));
88554
+ }
88555
+ const arrow = /^\s*=\s*(?:async\s+)?(?:<[^>]*>\s*)?(?=\()/.exec(rest);
88556
+ if (!arrow) return null;
88557
+ const close = skipGroup(text, after + arrow[0].length);
88558
+ if (close < 0) return null;
88559
+ const ret = /^\s*(?::[^=;{]*?)?\s*=>/.exec(text.slice(close));
88560
+ return ret ? capped(text.slice(start, close + ret[0].length)) : null;
88561
+ }
88562
+ return null;
88563
+ }
88564
+ async function withSignatures(show, targetSha, entries) {
88565
+ const out = [];
88566
+ for (const e of entries) {
88567
+ const source = e.names.length ? await show(targetSha, e.path) : null;
88568
+ const signatures = {};
88569
+ for (const n of e.names) {
88570
+ const sig = source === null ? null : signatureOf(source, n);
88571
+ if (sig) signatures[n] = sig;
88572
+ }
88573
+ out.push(Object.keys(signatures).length ? { ...e, signatures } : e);
88574
+ }
88575
+ return out;
88576
+ }
88577
+ function fileOfTest(name) {
88578
+ const file2 = name.split(" \u203A ")[0]?.trim() ?? "";
88579
+ return /\.[cm]?[jt]sx?$|\.py$|_test\.go$/.test(file2) && !/\s/.test(file2) ? file2 : null;
88580
+ }
88581
+ function titleOfTest(name) {
88582
+ const parts = name.split(" \u203A ");
88583
+ return (fileOfTest(name) ? parts.slice(1) : parts).join(" \u203A ").trim();
88584
+ }
88585
+ function mockedSpecsOf(source) {
88586
+ const out = [];
88587
+ for (const m of STRIP_COMMENTS(source).matchAll(
88588
+ /\b(?:vi|jest)\.(?:mock|doMock)\(\s*["'](\.[^"']*)["']/g
88589
+ ))
88590
+ if (!out.includes(m[1])) out.push(m[1]);
88591
+ return out;
88592
+ }
88593
+ async function hopOf(show, baseSha, from, skip) {
88594
+ const out = [];
88595
+ for (const file2 of from) {
88596
+ if (out.length >= MAX_HOP_MODULES) break;
88597
+ if (!JS_SOURCE.test(file2)) continue;
88598
+ const source = await show(baseSha, file2).catch(() => null);
88599
+ if (source === null) continue;
88600
+ const reexports = [
88601
+ ...STRIP_COMMENTS(source).matchAll(
88602
+ /\bexport\s+(?:type\s+)?(?:\*(?:\s+as\s+[\w$]+)?|\{[^}]*\})\s*from\s*["'](\.[^"']+)["']/g
88603
+ )
88604
+ ].map((m) => m[1]);
88605
+ const relative4 = [
88606
+ .../* @__PURE__ */ new Set([
88607
+ ...importsOf(source).map((i) => i.spec),
88608
+ ...mockedSpecsOf(source),
88609
+ ...reexports
88610
+ ])
88611
+ ].map((spec2) => candidatesFor(file2, spec2));
88612
+ const packages = packageSpecsOf(source).map(packageCandidates);
88613
+ for (const candidates of [...relative4, ...packages]) {
88614
+ if (out.length >= MAX_HOP_MODULES) break;
88615
+ if (!candidates.length) continue;
88616
+ const at = await firstAt(show, baseSha, candidates).catch(() => null);
88617
+ if (!at || skip.has(at.path) || TEST_FILE2.test(at.path) || isTestSupport(at.path) || out.includes(at.path))
88618
+ continue;
88619
+ out.push(at.path);
88620
+ }
88621
+ }
88622
+ return out;
88623
+ }
88624
+ async function failingPathsOf(show, task, git) {
88625
+ const named = [
88626
+ ...new Set(task.tests.map(fileOfTest).filter((f) => !!f))
88627
+ ];
88628
+ const files = [...new Set(named.length ? named : task.testFiles)];
88629
+ const tests = /* @__PURE__ */ new Set([...files, ...task.testFiles]);
88630
+ const direct = await hopOf(show, task.baseSha, files, tests);
88631
+ const second = await hopOf(
88632
+ show,
88633
+ task.baseSha,
88634
+ direct,
88635
+ /* @__PURE__ */ new Set([...tests, ...direct])
88636
+ );
88637
+ let where = [];
88638
+ if (git) {
88639
+ const run3 = boundedGit(git);
88640
+ const frames = await resolveFrames(
88641
+ show,
88642
+ task.baseSha,
88643
+ stackFramesOf(task.output ?? "")
88644
+ );
88645
+ where = frames.length ? await blamedPaths(run3, task.baseSha, frames) : await historyPaths(run3, task.baseSha, [...files, ...direct, ...second]);
88646
+ }
88647
+ return [.../* @__PURE__ */ new Set([...files, ...where, ...direct, ...second])].slice(
88648
+ 0,
88649
+ MAX_FAILING_PATHS
88650
+ );
88651
+ }
88652
+ function errorLineOf(output) {
88653
+ for (const line of output.split("\n")) {
88654
+ const m = /\b\w*(?:Error|Exception)\b:?\s*(.+)$/.exec(line) ?? /\b(expected .+)$/i.exec(line);
88655
+ if (!m) continue;
88656
+ const key = norm(m[1]).slice(0, 120);
88657
+ if (key.length >= 12) return key;
88658
+ }
88659
+ return null;
88660
+ }
88661
+ function baseNameOf(path2) {
88662
+ const parts = path2.split("/");
88663
+ const name = (parts.pop() ?? path2).replace(/\.[cm]?[jt]sx?$/, "").replace(/\.(?:test|spec)$/, "");
88664
+ return name === "index" && parts.length ? parts[parts.length - 1] : name;
88665
+ }
88666
+ var MAX_TITLES, MAX_TITLE_CHARS, MAX_SIGNATURE_LINES, MAX_SIGNATURE_CHARS, MAX_FAILING_PATHS, JS_SOURCE, TEST_FILE2, CALL, STRIP_COMMENTS, MAX_HOP_MODULES, norm;
88667
+ var init_replay_spec = __esm({
88668
+ "src/commands/replay-spec.ts"() {
88669
+ "use strict";
88670
+ init_replay_interface();
88671
+ init_replay_failure_paths();
88672
+ MAX_TITLES = 40;
88673
+ MAX_TITLE_CHARS = 4e3;
88674
+ MAX_SIGNATURE_LINES = 15;
88675
+ MAX_SIGNATURE_CHARS = 600;
88676
+ MAX_FAILING_PATHS = 12;
88677
+ JS_SOURCE = /\.[cm]?[jt]sx?$/;
88678
+ TEST_FILE2 = /\.(?:test|spec)\.[cm]?[jt]sx?$/;
88679
+ CALL = /(describe|suite|context|it|test)((?:\.[A-Za-z]+)*)/y;
88680
+ STRIP_COMMENTS = (source) => source.replace(/\/\*[\s\S]*?\*\//g, " ").replace(/(^|[^:])\/\/.*$/gm, "$1");
88681
+ MAX_HOP_MODULES = 24;
88682
+ norm = (s) => s.replace(/\s+/g, " ").trim();
88683
+ }
88684
+ });
88685
+
88059
88686
  // src/commands/replay-context.ts
88060
88687
  function stateOf(knowledge) {
88061
88688
  if (knowledge === "returned") return "found";
@@ -88063,7 +88690,8 @@ function stateOf(knowledge) {
88063
88690
  }
88064
88691
  function needsCheck(task) {
88065
88692
  const c = task.context;
88066
- return !c || c.state === null || c.stale;
88693
+ if (!c || c.state === null || c.stale) return true;
88694
+ return c.checkVersion !== void 0 && c.checkVersion !== CONTEXT_CHECK_VERSION;
88067
88695
  }
88068
88696
  function pathsIn(text) {
88069
88697
  const found = text.match(/(?<![\w./-])(?:[\w.-]+\/)+[\w.-]*[\w-](?:\.[a-z0-9]+)?/gi) ?? [];
@@ -88078,22 +88706,42 @@ function pathsIn(text) {
88078
88706
  function visibleAsk(task) {
88079
88707
  const failing = task.kind === "recovery" ? task.failing : null;
88080
88708
  const problem = flat2(task.card.problem);
88709
+ const head = problem.slice(0, HEAD_CHARS).trim();
88081
88710
  const cardText = [
88082
88711
  task.card.problem,
88083
88712
  task.card.acceptance,
88084
88713
  task.card.area ?? ""
88085
88714
  ].join("\n");
88086
- const iface = task.testInterface ?? [];
88087
- const paths = [
88088
- .../* @__PURE__ */ new Set([...iface.map((e) => e.path), ...pathsIn(cardText)])
88089
- ].slice(0, MAX_PATHS);
88090
- const names = iface.flatMap((e) => e.names);
88091
- const queries = [
88092
- problem,
88093
- flat2(`${task.card.area ?? ""} ${flat2(task.card.acceptance)}`),
88094
- failing?.tests.length ? flat2(failing.tests.join(" ")) : "",
88095
- names.length ? names.join(" ") : ""
88096
- ].map((q) => q.slice(0, QUERY_CHARS2).trim()).filter((q, i, all) => q !== "" && all.indexOf(q) === i);
88715
+ let paths;
88716
+ let queries;
88717
+ if (failing?.tests.length) {
88718
+ const named = failing.tests.map(fileOfTest).filter((f) => !!f);
88719
+ paths = [
88720
+ .../* @__PURE__ */ new Set([
88721
+ ...task.failingPaths?.length ? task.failingPaths : named.length ? named : task.testFiles,
88722
+ ...pathsIn(cardText)
88723
+ ])
88724
+ ].slice(0, MAX_FAILING_PATHS);
88725
+ const files = [...new Set(paths.map(baseNameOf))];
88726
+ queries = [
88727
+ ...failing.tests.slice(0, FAILING_QUERIES).map(titleOfTest),
88728
+ errorLineOf(failing.output) ?? "",
88729
+ files.slice(0, 6).join(" ")
88730
+ ];
88731
+ } else {
88732
+ const iface = task.testInterface ?? [];
88733
+ paths = [
88734
+ .../* @__PURE__ */ new Set([...iface.map((e) => e.path), ...pathsIn(cardText)])
88735
+ ].slice(0, MAX_PATHS);
88736
+ const names = iface.flatMap((e) => e.names);
88737
+ queries = [
88738
+ head,
88739
+ ...(task.kind !== "recovery" ? task.testTitles ?? [] : []).slice(0, TITLE_QUERIES).map(titleOfTest),
88740
+ names.join(" ")
88741
+ ];
88742
+ }
88743
+ queries = queries.map((q) => flat2(q).slice(0, QUERY_CHARS2).trim()).filter((q, i, all) => q !== "" && all.indexOf(q) === i).slice(0, MAX_QUERIES);
88744
+ if (!queries.length && head) queries = [head];
88097
88745
  const error2 = failing ? [
88098
88746
  ...failing.tests,
88099
88747
  ...failing.output ? [failing.output.slice(0, ERROR_CHARS)] : []
@@ -88149,7 +88797,8 @@ async function checkContext(deps, input) {
88149
88797
  inputsFingerprint: task.inputsFingerprint,
88150
88798
  state,
88151
88799
  relevantIds: judged.relevantIds,
88152
- judgeTag: judged.judgeTag
88800
+ judgeTag: judged.judgeTag,
88801
+ checkVersion: CONTEXT_CHECK_VERSION
88153
88802
  };
88154
88803
  }
88155
88804
  async function gateOnContext(deps, tasks, options) {
@@ -88222,16 +88871,22 @@ async function gateOnContext(deps, tasks, options) {
88222
88871
  }
88223
88872
  return { replay: replay2, noContext, unknown: unknown2 };
88224
88873
  }
88225
- var QUERY_CHARS2, ERROR_CHARS, MAX_PATHS, CONTEXT_REPORT_CHUNK, flat2;
88874
+ var CONTEXT_CHECK_VERSION, QUERY_CHARS2, ERROR_CHARS, MAX_PATHS, HEAD_CHARS, MAX_QUERIES, FAILING_QUERIES, TITLE_QUERIES, CONTEXT_REPORT_CHUNK, flat2;
88226
88875
  var init_replay_context = __esm({
88227
88876
  "src/commands/replay-context.ts"() {
88228
88877
  "use strict";
88229
88878
  init_replay_relevance();
88230
88879
  init_replay_diff();
88231
88880
  init_replay_scale();
88881
+ init_replay_spec();
88882
+ CONTEXT_CHECK_VERSION = 2;
88232
88883
  QUERY_CHARS2 = 200;
88233
88884
  ERROR_CHARS = 1e3;
88234
88885
  MAX_PATHS = 20;
88886
+ HEAD_CHARS = 120;
88887
+ MAX_QUERIES = 5;
88888
+ FAILING_QUERIES = 3;
88889
+ TITLE_QUERIES = 2;
88235
88890
  CONTEXT_REPORT_CHUNK = 100;
88236
88891
  flat2 = (text) => text.replace(/\s+/g, " ").trim();
88237
88892
  }
@@ -88243,6 +88898,7 @@ __export(replay_tasks_exports, {
88243
88898
  BUG_FIX_DONE: () => BUG_FIX_DONE,
88244
88899
  CODE_ONLY_LINE: () => CODE_ONLY_LINE,
88245
88900
  FEATURE_MIN_FILE_RECALL: () => FEATURE_MIN_FILE_RECALL,
88901
+ HAANSI_HINTS: () => HAANSI_HINTS,
88246
88902
  HAANSI_LINE: () => HAANSI_LINE,
88247
88903
  areaOf: () => areaOf,
88248
88904
  cardPrompt: () => cardPrompt,
@@ -88256,7 +88912,8 @@ __export(replay_tasks_exports, {
88256
88912
  mcpConfig: () => mcpConfig,
88257
88913
  overlapOf: () => overlapOf,
88258
88914
  reportBatches: () => reportBatches,
88259
- runStoredReplays: () => runStoredReplays
88915
+ runStoredReplays: () => runStoredReplays,
88916
+ titlesSection: () => titlesSection
88260
88917
  });
88261
88918
  function reportBatches(results, size = (r) => JSON.stringify(r).length) {
88262
88919
  const batches = [];
@@ -88287,7 +88944,18 @@ function listItem(name) {
88287
88944
  const flat3 = name.replace(/[\u0000-\u001f\u007f]+/g, " ").trim();
88288
88945
  return `- \`${flat3.replace(/`/g, "'")}\``;
88289
88946
  }
88290
- function haansiSection(tools) {
88947
+ function titlesSection(titles) {
88948
+ if (titles.length === 0) return [];
88949
+ const { shown, more } = cappedTitles(titles);
88950
+ return [
88951
+ "These tests pass (the target's tests, by title):",
88952
+ "",
88953
+ ...shown.map(listItem),
88954
+ ...more ? [`- +${more} more`] : [],
88955
+ ""
88956
+ ];
88957
+ }
88958
+ function haansiSection(tools, hint = null) {
88291
88959
  return [
88292
88960
  "## Your organization's knowledge (Haansi)",
88293
88961
  "",
@@ -88295,6 +88963,7 @@ function haansiSection(tools) {
88295
88963
  "",
88296
88964
  "Start here, before you read or change any code: search them for this problem (search_solutions with the problem and its error, match_playbook and search_skills for a team playbook, get_prior_attempts with the files you expect to change), and read what applies. Search again when you get stuck.",
88297
88965
  "",
88966
+ ...hint ? [HAANSI_HINTS[hint], ""] : [],
88298
88967
  ...tools.flatMap((s) => [
88299
88968
  `- ${toolLine(s.server)}`,
88300
88969
  ...s.tools.map(
@@ -88327,11 +88996,16 @@ function cardPrompt(task, feedback, arm = "baseline", tools = []) {
88327
88996
  "## Done when",
88328
88997
  "",
88329
88998
  ...failing?.tests.length ? [BUG_FIX_DONE, ""] : [],
88999
+ // A feature's own tests, by title: what a ticket's spec would say.
89000
+ ...task.kind !== "recovery" ? titlesSection(task.testTitles ?? []) : [],
88330
89001
  task.card.acceptance,
88331
89002
  ...task.card.area ? ["", "## Part of the code", "", task.card.area] : [],
88332
89003
  "",
88333
89004
  ...interfaceSection(task.testInterface ?? []),
88334
- ...arm === "haansi" ? tools.length ? haansiSection(tools) : [HAANSI_LINE, ""] : [],
89005
+ ...arm === "haansi" ? tools.length ? haansiSection(
89006
+ tools,
89007
+ failing?.tests.length ? "bug-fix" : task.kind !== "recovery" && task.testInterface?.length ? "feature" : null
89008
+ ) : [HAANSI_LINE, ""] : [],
88335
89009
  ...feedback ? [FEEDBACK_HEADER, "", "```", feedback, "```", ""] : [],
88336
89010
  CODE_ONLY_LINE,
88337
89011
  "",
@@ -88454,7 +89128,14 @@ async function runStoredReplays(options, deps) {
88454
89128
  `Shard ${options.shard.index}/${options.shard.count}: ${mine.length} of ${set2.tasks.length} task(s).`
88455
89129
  );
88456
89130
  const { states } = await runCalibration(
88457
- calibrateTaskOptions(options, { setupCmd, testCmd }),
89131
+ // With the context gate, --limit caps the tasks replayed (found ones),
89132
+ // not the ones calibrated: calibrating only the first n left the rest
89133
+ // "not valid" and the gate often found none among those n. Calibration
89134
+ // runs tests only, no model. Without the gate, the first n as before.
89135
+ calibrateTaskOptions(
89136
+ { ...options, limit: options.anyContext ? options.limit : null },
89137
+ { setupCmd, testCmd }
89138
+ ),
88458
89139
  { ...deps, report: deps.reportCalibration },
88459
89140
  { ...set2, tasks: mine }
88460
89141
  );
@@ -88486,11 +89167,31 @@ async function runStoredReplays(options, deps) {
88486
89167
  };
88487
89168
  const interfaceOf = async (task) => {
88488
89169
  if (task.testInterface !== void 0) return;
88489
- task.testInterface = !testNamesOf(task).length && task.baseSha && task.targetSha ? await testInterfaceOf(deps.showFile, {
89170
+ const named = testNamesOf(task);
89171
+ task.testInterface = !named.length && task.baseSha && task.targetSha ? await testInterfaceOf(deps.showFile, {
88490
89172
  baseSha: task.baseSha,
88491
89173
  targetSha: task.targetSha,
88492
89174
  testFiles: task.testFiles
88493
- }).catch(() => []) : [];
89175
+ }).then(
89176
+ (entries) => withSignatures(deps.showFile, task.targetSha, entries)
89177
+ ).catch(() => []) : [];
89178
+ if (task.kind !== "recovery" && task.targetSha)
89179
+ task.testTitles = await targetTestTitles(deps.showFile, {
89180
+ targetSha: task.targetSha,
89181
+ testFiles: task.testFiles
89182
+ }).catch(() => []);
89183
+ if (named.length && task.baseSha)
89184
+ task.failingPaths = await failingPathsOf(
89185
+ deps.showFile,
89186
+ {
89187
+ baseSha: task.baseSha,
89188
+ tests: named,
89189
+ testFiles: task.testFiles,
89190
+ output: task.failing?.output ?? ""
89191
+ },
89192
+ // Failure-tolerant itself: a read or git error skips that source.
89193
+ (args) => (deps.gitStdout ?? deps.git)(args, deps.repoDir)
89194
+ );
88494
89195
  };
88495
89196
  let noContext = 0;
88496
89197
  let contextUnknown = 0;
@@ -88606,21 +89307,32 @@ async function runStoredReplays(options, deps) {
88606
89307
  }
88607
89308
  const armTools = session && deps.listTools ? haansiTools ??= await deps.listTools(session).catch(() => []) : [];
88608
89309
  const configPath = `${deps.workDir()}/${task.taskId}-${arm}.mcp.json`;
88609
- deps.writeFile(configPath, mcpConfig(arm, session));
88610
- const r = await replayArm(
88611
- deps,
88612
- { ...options, setupCmd, testCmd },
88613
- asTask,
88614
- arm,
88615
- (feedback) => cardPrompt(task, feedback, arm, armTools),
88616
- async (dir) => {
88617
- changed = await changedFiles(deps, dir, task.baseSha);
88618
- agentDiff = await agentDiffOf(deps, dir, task.baseSha);
88619
- if (arm === "haansi") change = judgeChange(agentDiff);
88620
- },
88621
- { HAANSI_REPLAY_MCP_CONFIG: configPath }
88622
- );
88623
- deps.removeFile(configPath);
89310
+ const config6 = mcpConfig(arm, session);
89311
+ deps.writeFile(configPath, config6);
89312
+ const codexHome2 = `${deps.workDir()}/${task.taskId}-${arm}.codex`;
89313
+ deps.writeFile(`${codexHome2}/config.toml`, codexConfigOf(config6));
89314
+ let r;
89315
+ try {
89316
+ r = await replayArm(
89317
+ deps,
89318
+ { ...options, setupCmd, testCmd },
89319
+ asTask,
89320
+ arm,
89321
+ (feedback) => cardPrompt(task, feedback, arm, armTools),
89322
+ async (dir) => {
89323
+ changed = await changedFiles(deps, dir, task.baseSha);
89324
+ agentDiff = await agentDiffOf(deps, dir, task.baseSha);
89325
+ if (arm === "haansi") change = judgeChange(agentDiff);
89326
+ },
89327
+ {
89328
+ HAANSI_REPLAY_MCP_CONFIG: configPath,
89329
+ HAANSI_REPLAY_CODEX_HOME: codexHome2
89330
+ }
89331
+ );
89332
+ } finally {
89333
+ deps.removeFile(configPath);
89334
+ deps.removeDir(codexHome2);
89335
+ }
88624
89336
  let haansi = null;
88625
89337
  if (session) {
88626
89338
  const { calls } = await deps.getCalls(session.sessionId);
@@ -88755,7 +89467,7 @@ function haansiText(use) {
88755
89467
  if (!use.used || use.calls === 0 && !handed) return base;
88756
89468
  return use.used === "not_used" ? `${base}, not used` : `${base}, ${use.used === "partly" ? "partly " : ""}used${use.usedItems ? ` (${use.usedItems})` : ""}`;
88757
89469
  }
88758
- var import_node_crypto6, FEEDBACK_HEADER, REPORT_CHUNK2, REPORT_CHARS, HAANSI_LINE, BUG_FIX_DONE, CODE_ONLY_LINE, toolLine, FEATURE_MIN_FILE_RECALL, share2, pct;
89470
+ var import_node_crypto6, FEEDBACK_HEADER, REPORT_CHUNK2, REPORT_CHARS, HAANSI_LINE, BUG_FIX_DONE, CODE_ONLY_LINE, toolLine, HAANSI_HINTS, FEATURE_MIN_FILE_RECALL, share2, pct;
88759
89471
  var init_replay_tasks = __esm({
88760
89472
  "src/commands/replay-tasks.ts"() {
88761
89473
  "use strict";
@@ -88768,7 +89480,9 @@ var init_replay_tasks = __esm({
88768
89480
  init_replay_judge();
88769
89481
  init_replay();
88770
89482
  init_replay_scale();
89483
+ init_replay_codex();
88771
89484
  init_replay_interface();
89485
+ init_replay_spec();
88772
89486
  init_replay_context();
88773
89487
  FEEDBACK_HEADER = "Your previous attempt did not pass the tests. Their output ends with:";
88774
89488
  REPORT_CHUNK2 = 200;
@@ -88780,6 +89494,10 @@ var init_replay_tasks = __esm({
88780
89494
  // eslint-disable-next-line no-control-regex
88781
89495
  text.replace(/[\u0000-\u001f\u007f`]+/g, " ").trim()
88782
89496
  );
89497
+ HAANSI_HINTS = {
89498
+ "bug-fix": "For a failing test, search with its name and the error line, and ask get_prior_attempts with the failing test files and the files they import.",
89499
+ feature: "Ask with the modules and names under 'What the tests use'."
89500
+ };
88783
89501
  FEATURE_MIN_FILE_RECALL = 0.5;
88784
89502
  share2 = (part, whole) => whole === 0 ? null : Math.round(part / whole * 1e3) / 1e3;
88785
89503
  pct = (v) => v === null ? "n/a" : `${Math.round(v * 100)}%`;
@@ -89040,7 +89758,7 @@ async function replayArm(deps, options, task, arm, promptOf, inspect, agentEnv =
89040
89758
  const down = haansiServersDown(agent.output);
89041
89759
  if (down === null)
89042
89760
  deps.log(
89043
- `\u2026 ${label}: the agent did not report its MCP servers (use --output-format stream-json --verbose to check them)`
89761
+ `\u2026 ${label}: the agent did not report its MCP servers (Claude Code reports them with --output-format stream-json --verbose)`
89044
89762
  );
89045
89763
  else if (down.length)
89046
89764
  throw new Error(
@@ -89445,8 +90163,11 @@ it instead of running the setup again; not with --container.
89445
90163
 
89446
90164
  Only tasks Haansi holds relevant context for are replayed. Before any agent
89447
90165
  runs, each valid task is checked: Haansi is searched with only what the agent
89448
- sees at the task's start (its card, a bug fix's failing tests, what its tests
89449
- import, the paths the card names), and the relevance judge (your agent
90166
+ sees at the task's start (a bug fix's failing tests, their error line, the
90167
+ files they are and import, and the files changed by the commits that wrote
90168
+ the lines its stack frames name, or by those files' own last commits before
90169
+ the start; a feature's problem, its tests' titles and the
90170
+ names they use; the paths the card names), and the relevance judge (your agent
89450
90171
  command, once per task checked) says whether anything relevant came back.
89451
90172
  A task with nothing relevant Haansi can return is skipped, and checked again
89452
90173
  once the organization gains new Haansi content. --any-context replays every