asmgr 0.4.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +58 -8
  2. package/dist/asmgr.mjs +1231 -668
  3. package/package.json +2 -2
package/dist/asmgr.mjs CHANGED
@@ -3214,9 +3214,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
3214
3214
  helpWidth: context.helpWidth,
3215
3215
  outputHasColors: context.hasColors
3216
3216
  });
3217
- const text9 = helper.formatHelp(this, helper);
3218
- if (context.hasColors) return text9;
3219
- return this._outputConfiguration.stripColor(text9);
3217
+ const text10 = helper.formatHelp(this, helper);
3218
+ if (context.hasColors) return text10;
3219
+ return this._outputConfiguration.stripColor(text10);
3220
3220
  }
3221
3221
  /**
3222
3222
  * @typedef HelpContext
@@ -3376,7 +3376,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
3376
3376
  * @param {(string | Function)} text - string to add, or a function returning a string
3377
3377
  * @return {Command} `this` command for chaining
3378
3378
  */
3379
- addHelpText(position4, text9) {
3379
+ addHelpText(position4, text10) {
3380
3380
  const allowedValues = ["beforeAll", "before", "after", "afterAll"];
3381
3381
  if (!allowedValues.includes(position4)) {
3382
3382
  throw new Error(`Unexpected value for position to addHelpText.
@@ -3385,10 +3385,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
3385
3385
  const helpEvent = `${position4}Help`;
3386
3386
  this.on(helpEvent, (context) => {
3387
3387
  let helpStr;
3388
- if (typeof text9 === "function") {
3389
- helpStr = text9({ error: context.error, command: context.command });
3388
+ if (typeof text10 === "function") {
3389
+ helpStr = text10({ error: context.error, command: context.command });
3390
3390
  } else {
3391
- helpStr = text9;
3391
+ helpStr = text10;
3392
3392
  }
3393
3393
  if (helpStr) {
3394
3394
  context.write(`${helpStr}
@@ -4340,21 +4340,21 @@ var require_react_development = __commonJS({
4340
4340
  );
4341
4341
  actScopeDepth = prevActScopeDepth;
4342
4342
  }
4343
- function recursivelyFlushAsyncActWork(returnValue, resolve10, reject) {
4343
+ function recursivelyFlushAsyncActWork(returnValue, resolve13, reject) {
4344
4344
  var queue = ReactSharedInternals.actQueue;
4345
4345
  if (null !== queue)
4346
4346
  if (0 !== queue.length)
4347
4347
  try {
4348
4348
  flushActQueue(queue);
4349
4349
  enqueueTask(function() {
4350
- return recursivelyFlushAsyncActWork(returnValue, resolve10, reject);
4350
+ return recursivelyFlushAsyncActWork(returnValue, resolve13, reject);
4351
4351
  });
4352
4352
  return;
4353
4353
  } catch (error) {
4354
4354
  ReactSharedInternals.thrownErrors.push(error);
4355
4355
  }
4356
4356
  else ReactSharedInternals.actQueue = null;
4357
- 0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve10(returnValue);
4357
+ 0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve13(returnValue);
4358
4358
  }
4359
4359
  function flushActQueue(queue) {
4360
4360
  if (!isFlushing) {
@@ -4541,7 +4541,7 @@ var require_react_development = __commonJS({
4541
4541
  ));
4542
4542
  });
4543
4543
  return {
4544
- then: function(resolve10, reject) {
4544
+ then: function(resolve13, reject) {
4545
4545
  didAwaitActCall = true;
4546
4546
  thenable.then(
4547
4547
  function(returnValue) {
@@ -4551,7 +4551,7 @@ var require_react_development = __commonJS({
4551
4551
  flushActQueue(queue), enqueueTask(function() {
4552
4552
  return recursivelyFlushAsyncActWork(
4553
4553
  returnValue,
4554
- resolve10,
4554
+ resolve13,
4555
4555
  reject
4556
4556
  );
4557
4557
  });
@@ -4565,7 +4565,7 @@ var require_react_development = __commonJS({
4565
4565
  ReactSharedInternals.thrownErrors.length = 0;
4566
4566
  reject(_thrownError);
4567
4567
  }
4568
- } else resolve10(returnValue);
4568
+ } else resolve13(returnValue);
4569
4569
  },
4570
4570
  function(error) {
4571
4571
  popActScope(prevActQueue, prevActScopeDepth);
@@ -4587,15 +4587,15 @@ var require_react_development = __commonJS({
4587
4587
  if (0 < ReactSharedInternals.thrownErrors.length)
4588
4588
  throw callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
4589
4589
  return {
4590
- then: function(resolve10, reject) {
4590
+ then: function(resolve13, reject) {
4591
4591
  didAwaitActCall = true;
4592
4592
  0 === prevActScopeDepth ? (ReactSharedInternals.actQueue = queue, enqueueTask(function() {
4593
4593
  return recursivelyFlushAsyncActWork(
4594
4594
  returnValue$jscomp$0,
4595
- resolve10,
4595
+ resolve13,
4596
4596
  reject
4597
4597
  );
4598
- })) : resolve10(returnValue$jscomp$0);
4598
+ })) : resolve13(returnValue$jscomp$0);
4599
4599
  }
4600
4600
  };
4601
4601
  };
@@ -5482,15 +5482,15 @@ var require_react_dom_server_legacy_node_production = __commonJS({
5482
5482
  ["xHeight", "x-height"]
5483
5483
  ]);
5484
5484
  var matchHtmlRegExp = /["'&<>]/;
5485
- function escapeTextForBrowser(text9) {
5486
- if ("boolean" === typeof text9 || "number" === typeof text9 || "bigint" === typeof text9)
5487
- return "" + text9;
5488
- text9 = "" + text9;
5489
- var match = matchHtmlRegExp.exec(text9);
5485
+ function escapeTextForBrowser(text10) {
5486
+ if ("boolean" === typeof text10 || "number" === typeof text10 || "bigint" === typeof text10)
5487
+ return "" + text10;
5488
+ text10 = "" + text10;
5489
+ var match = matchHtmlRegExp.exec(text10);
5490
5490
  if (match) {
5491
5491
  var html7 = "", index2, lastIndex = 0;
5492
- for (index2 = match.index; index2 < text9.length; index2++) {
5493
- switch (text9.charCodeAt(index2)) {
5492
+ for (index2 = match.index; index2 < text10.length; index2++) {
5493
+ switch (text10.charCodeAt(index2)) {
5494
5494
  case 34:
5495
5495
  match = "&quot;";
5496
5496
  break;
@@ -5509,13 +5509,13 @@ var require_react_dom_server_legacy_node_production = __commonJS({
5509
5509
  default:
5510
5510
  continue;
5511
5511
  }
5512
- lastIndex !== index2 && (html7 += text9.slice(lastIndex, index2));
5512
+ lastIndex !== index2 && (html7 += text10.slice(lastIndex, index2));
5513
5513
  lastIndex = index2 + 1;
5514
5514
  html7 += match;
5515
5515
  }
5516
- text9 = lastIndex !== index2 ? html7 + text9.slice(lastIndex, index2) : html7;
5516
+ text10 = lastIndex !== index2 ? html7 + text10.slice(lastIndex, index2) : html7;
5517
5517
  }
5518
- return text9;
5518
+ return text10;
5519
5519
  }
5520
5520
  var uppercasePattern = /([A-Z])/g;
5521
5521
  var msPattern = /^ms-/;
@@ -7485,10 +7485,10 @@ var require_react_dom_server_legacy_node_production = __commonJS({
7485
7485
  generateStaticMarkup
7486
7486
  };
7487
7487
  }
7488
- function pushTextInstance(target, text9, renderState, textEmbedded) {
7488
+ function pushTextInstance(target, text10, renderState, textEmbedded) {
7489
7489
  if (renderState.generateStaticMarkup)
7490
- return target.push(escapeTextForBrowser(text9)), false;
7491
- "" === text9 ? target = textEmbedded : (textEmbedded && target.push("<!-- -->"), target.push(escapeTextForBrowser(text9)), target = true);
7490
+ return target.push(escapeTextForBrowser(text10)), false;
7491
+ "" === text10 ? target = textEmbedded : (textEmbedded && target.push("<!-- -->"), target.push(escapeTextForBrowser(text10)), target = true);
7492
7492
  return target;
7493
7493
  }
7494
7494
  function pushSegmentFinale(target, renderState, lastPushedText, textEmbedded) {
@@ -10450,15 +10450,15 @@ var require_react_dom_server_node_production = __commonJS({
10450
10450
  ["xHeight", "x-height"]
10451
10451
  ]);
10452
10452
  var matchHtmlRegExp = /["'&<>]/;
10453
- function escapeTextForBrowser(text9) {
10454
- if ("boolean" === typeof text9 || "number" === typeof text9 || "bigint" === typeof text9)
10455
- return "" + text9;
10456
- text9 = "" + text9;
10457
- var match = matchHtmlRegExp.exec(text9);
10453
+ function escapeTextForBrowser(text10) {
10454
+ if ("boolean" === typeof text10 || "number" === typeof text10 || "bigint" === typeof text10)
10455
+ return "" + text10;
10456
+ text10 = "" + text10;
10457
+ var match = matchHtmlRegExp.exec(text10);
10458
10458
  if (match) {
10459
10459
  var html7 = "", index2, lastIndex = 0;
10460
- for (index2 = match.index; index2 < text9.length; index2++) {
10461
- switch (text9.charCodeAt(index2)) {
10460
+ for (index2 = match.index; index2 < text10.length; index2++) {
10461
+ switch (text10.charCodeAt(index2)) {
10462
10462
  case 34:
10463
10463
  match = "&quot;";
10464
10464
  break;
@@ -10477,13 +10477,13 @@ var require_react_dom_server_node_production = __commonJS({
10477
10477
  default:
10478
10478
  continue;
10479
10479
  }
10480
- lastIndex !== index2 && (html7 += text9.slice(lastIndex, index2));
10480
+ lastIndex !== index2 && (html7 += text10.slice(lastIndex, index2));
10481
10481
  lastIndex = index2 + 1;
10482
10482
  html7 += match;
10483
10483
  }
10484
- text9 = lastIndex !== index2 ? html7 + text9.slice(lastIndex, index2) : html7;
10484
+ text10 = lastIndex !== index2 ? html7 + text10.slice(lastIndex, index2) : html7;
10485
10485
  }
10486
- return text9;
10486
+ return text10;
10487
10487
  }
10488
10488
  var uppercasePattern = /([A-Z])/g;
10489
10489
  var msPattern = /^ms-/;
@@ -10758,10 +10758,10 @@ var require_react_dom_server_node_production = __commonJS({
10758
10758
  );
10759
10759
  }
10760
10760
  var textSeparator = stringToPrecomputedChunk("<!-- -->");
10761
- function pushTextInstance(target, text9, renderState, textEmbedded) {
10762
- if ("" === text9) return textEmbedded;
10761
+ function pushTextInstance(target, text10, renderState, textEmbedded) {
10762
+ if ("" === text10) return textEmbedded;
10763
10763
  textEmbedded && target.push(textSeparator);
10764
- target.push(escapeTextForBrowser(text9));
10764
+ target.push(escapeTextForBrowser(text10));
10765
10765
  return true;
10766
10766
  }
10767
10767
  var styleNameCache = /* @__PURE__ */ new Map();
@@ -15684,7 +15684,7 @@ var require_react_dom_server_node_production = __commonJS({
15684
15684
  };
15685
15685
  }
15686
15686
  exports.prerender = function(children, options) {
15687
- return new Promise(function(resolve10, reject) {
15687
+ return new Promise(function(resolve13, reject) {
15688
15688
  var onHeaders = options ? options.onHeaders : void 0, onHeadersImpl;
15689
15689
  onHeaders && (onHeadersImpl = function(headersDescriptor) {
15690
15690
  onHeaders(new Headers(headersDescriptor));
@@ -15727,7 +15727,7 @@ var require_react_dom_server_node_production = __commonJS({
15727
15727
  { highWaterMark: 0 }
15728
15728
  );
15729
15729
  stream2 = { postponed: getPostponedState(request), prelude: stream2 };
15730
- resolve10(stream2);
15730
+ resolve13(stream2);
15731
15731
  },
15732
15732
  void 0,
15733
15733
  void 0,
@@ -15749,7 +15749,7 @@ var require_react_dom_server_node_production = __commonJS({
15749
15749
  });
15750
15750
  };
15751
15751
  exports.prerenderToNodeStream = function(children, options) {
15752
- return new Promise(function(resolve10, reject) {
15752
+ return new Promise(function(resolve13, reject) {
15753
15753
  var resumableState = createResumableState(
15754
15754
  options ? options.identifierPrefix : void 0,
15755
15755
  options ? options.unstable_externalRuntimeSrc : void 0,
@@ -15780,7 +15780,7 @@ var require_react_dom_server_node_production = __commonJS({
15780
15780
  postponed: getPostponedState(request),
15781
15781
  prelude: readable
15782
15782
  };
15783
- resolve10(readable);
15783
+ resolve13(readable);
15784
15784
  },
15785
15785
  void 0,
15786
15786
  void 0,
@@ -15836,7 +15836,7 @@ var require_react_dom_server_node_production = __commonJS({
15836
15836
  };
15837
15837
  };
15838
15838
  exports.renderToReadableStream = function(children, options) {
15839
- return new Promise(function(resolve10, reject) {
15839
+ return new Promise(function(resolve13, reject) {
15840
15840
  var onFatalError, onAllReady, allReady = new Promise(function(res, rej) {
15841
15841
  onAllReady = res;
15842
15842
  onFatalError = rej;
@@ -15885,7 +15885,7 @@ var require_react_dom_server_node_production = __commonJS({
15885
15885
  { highWaterMark: 0 }
15886
15886
  );
15887
15887
  stream2.allReady = allReady;
15888
- resolve10(stream2);
15888
+ resolve13(stream2);
15889
15889
  },
15890
15890
  function(error) {
15891
15891
  allReady.catch(function() {
@@ -15911,7 +15911,7 @@ var require_react_dom_server_node_production = __commonJS({
15911
15911
  });
15912
15912
  };
15913
15913
  exports.resume = function(children, postponedState, options) {
15914
- return new Promise(function(resolve10, reject) {
15914
+ return new Promise(function(resolve13, reject) {
15915
15915
  var onFatalError, onAllReady, allReady = new Promise(function(res, rej) {
15916
15916
  onAllReady = res;
15917
15917
  onFatalError = rej;
@@ -15948,7 +15948,7 @@ var require_react_dom_server_node_production = __commonJS({
15948
15948
  { highWaterMark: 0 }
15949
15949
  );
15950
15950
  stream2.allReady = allReady;
15951
- resolve10(stream2);
15951
+ resolve13(stream2);
15952
15952
  },
15953
15953
  function(error) {
15954
15954
  allReady.catch(function() {
@@ -15973,7 +15973,7 @@ var require_react_dom_server_node_production = __commonJS({
15973
15973
  });
15974
15974
  };
15975
15975
  exports.resumeAndPrerender = function(children, postponedState, options) {
15976
- return new Promise(function(resolve10, reject) {
15976
+ return new Promise(function(resolve13, reject) {
15977
15977
  var request = resumeAndPrerenderRequest(
15978
15978
  children,
15979
15979
  postponedState,
@@ -16004,7 +16004,7 @@ var require_react_dom_server_node_production = __commonJS({
16004
16004
  { highWaterMark: 0 }
16005
16005
  );
16006
16006
  stream2 = { postponed: getPostponedState(request), prelude: stream2 };
16007
- resolve10(stream2);
16007
+ resolve13(stream2);
16008
16008
  },
16009
16009
  void 0,
16010
16010
  void 0,
@@ -16026,7 +16026,7 @@ var require_react_dom_server_node_production = __commonJS({
16026
16026
  });
16027
16027
  };
16028
16028
  exports.resumeAndPrerenderToNodeStream = function(children, postponedState, options) {
16029
- return new Promise(function(resolve10, reject) {
16029
+ return new Promise(function(resolve13, reject) {
16030
16030
  var request = resumeAndPrerenderRequest(
16031
16031
  children,
16032
16032
  postponedState,
@@ -16046,7 +16046,7 @@ var require_react_dom_server_node_production = __commonJS({
16046
16046
  }
16047
16047
  }), writable = createFakeWritableFromReadable(readable);
16048
16048
  readable = { postponed: getPostponedState(request), prelude: readable };
16049
- resolve10(readable);
16049
+ resolve13(readable);
16050
16050
  },
16051
16051
  void 0,
16052
16052
  void 0,
@@ -16566,16 +16566,16 @@ var require_react_dom_server_legacy_node_development = __commonJS({
16566
16566
  return character.toUpperCase();
16567
16567
  });
16568
16568
  }
16569
- function escapeTextForBrowser(text9) {
16570
- if ("boolean" === typeof text9 || "number" === typeof text9 || "bigint" === typeof text9)
16571
- return "" + text9;
16572
- checkHtmlStringCoercion(text9);
16573
- text9 = "" + text9;
16574
- var match = matchHtmlRegExp.exec(text9);
16569
+ function escapeTextForBrowser(text10) {
16570
+ if ("boolean" === typeof text10 || "number" === typeof text10 || "bigint" === typeof text10)
16571
+ return "" + text10;
16572
+ checkHtmlStringCoercion(text10);
16573
+ text10 = "" + text10;
16574
+ var match = matchHtmlRegExp.exec(text10);
16575
16575
  if (match) {
16576
16576
  var html7 = "", index2, lastIndex = 0;
16577
- for (index2 = match.index; index2 < text9.length; index2++) {
16578
- switch (text9.charCodeAt(index2)) {
16577
+ for (index2 = match.index; index2 < text10.length; index2++) {
16578
+ switch (text10.charCodeAt(index2)) {
16579
16579
  case 34:
16580
16580
  match = "&quot;";
16581
16581
  break;
@@ -16594,13 +16594,13 @@ var require_react_dom_server_legacy_node_development = __commonJS({
16594
16594
  default:
16595
16595
  continue;
16596
16596
  }
16597
- lastIndex !== index2 && (html7 += text9.slice(lastIndex, index2));
16597
+ lastIndex !== index2 && (html7 += text10.slice(lastIndex, index2));
16598
16598
  lastIndex = index2 + 1;
16599
16599
  html7 += match;
16600
16600
  }
16601
- text9 = lastIndex !== index2 ? html7 + text9.slice(lastIndex, index2) : html7;
16601
+ text10 = lastIndex !== index2 ? html7 + text10.slice(lastIndex, index2) : html7;
16602
16602
  }
16603
- return text9;
16603
+ return text10;
16604
16604
  }
16605
16605
  function sanitizeURL(url) {
16606
16606
  return isJavaScriptProtocol.test("" + url) ? "javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')" : url;
@@ -18732,10 +18732,10 @@ var require_react_dom_server_legacy_node_development = __commonJS({
18732
18732
  generateStaticMarkup
18733
18733
  };
18734
18734
  }
18735
- function pushTextInstance(target, text9, renderState, textEmbedded) {
18735
+ function pushTextInstance(target, text10, renderState, textEmbedded) {
18736
18736
  if (renderState.generateStaticMarkup)
18737
- return target.push(escapeTextForBrowser(text9)), false;
18738
- "" === text9 ? target = textEmbedded : (textEmbedded && target.push("<!-- -->"), target.push(escapeTextForBrowser(text9)), target = true);
18737
+ return target.push(escapeTextForBrowser(text10)), false;
18738
+ "" === text10 ? target = textEmbedded : (textEmbedded && target.push("<!-- -->"), target.push(escapeTextForBrowser(text10)), target = true);
18739
18739
  return target;
18740
18740
  }
18741
18741
  function pushSegmentFinale(target, renderState, lastPushedText, textEmbedded) {
@@ -23702,16 +23702,16 @@ var require_react_dom_server_node_development = __commonJS({
23702
23702
  return character.toUpperCase();
23703
23703
  });
23704
23704
  }
23705
- function escapeTextForBrowser(text9) {
23706
- if ("boolean" === typeof text9 || "number" === typeof text9 || "bigint" === typeof text9)
23707
- return "" + text9;
23708
- checkHtmlStringCoercion(text9);
23709
- text9 = "" + text9;
23710
- var match = matchHtmlRegExp.exec(text9);
23705
+ function escapeTextForBrowser(text10) {
23706
+ if ("boolean" === typeof text10 || "number" === typeof text10 || "bigint" === typeof text10)
23707
+ return "" + text10;
23708
+ checkHtmlStringCoercion(text10);
23709
+ text10 = "" + text10;
23710
+ var match = matchHtmlRegExp.exec(text10);
23711
23711
  if (match) {
23712
23712
  var html7 = "", index2, lastIndex = 0;
23713
- for (index2 = match.index; index2 < text9.length; index2++) {
23714
- switch (text9.charCodeAt(index2)) {
23713
+ for (index2 = match.index; index2 < text10.length; index2++) {
23714
+ switch (text10.charCodeAt(index2)) {
23715
23715
  case 34:
23716
23716
  match = "&quot;";
23717
23717
  break;
@@ -23730,13 +23730,13 @@ var require_react_dom_server_node_development = __commonJS({
23730
23730
  default:
23731
23731
  continue;
23732
23732
  }
23733
- lastIndex !== index2 && (html7 += text9.slice(lastIndex, index2));
23733
+ lastIndex !== index2 && (html7 += text10.slice(lastIndex, index2));
23734
23734
  lastIndex = index2 + 1;
23735
23735
  html7 += match;
23736
23736
  }
23737
- text9 = lastIndex !== index2 ? html7 + text9.slice(lastIndex, index2) : html7;
23737
+ text10 = lastIndex !== index2 ? html7 + text10.slice(lastIndex, index2) : html7;
23738
23738
  }
23739
- return text9;
23739
+ return text10;
23740
23740
  }
23741
23741
  function sanitizeURL(url) {
23742
23742
  return isJavaScriptProtocol.test("" + url) ? "javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')" : url;
@@ -24010,10 +24010,10 @@ var require_react_dom_server_node_development = __commonJS({
24010
24010
  resumableState
24011
24011
  );
24012
24012
  }
24013
- function pushTextInstance(target, text9, renderState, textEmbedded) {
24014
- if ("" === text9) return textEmbedded;
24013
+ function pushTextInstance(target, text10, renderState, textEmbedded) {
24014
+ if ("" === text10) return textEmbedded;
24015
24015
  textEmbedded && target.push(textSeparator);
24016
- target.push(escapeTextForBrowser(text9));
24016
+ target.push(escapeTextForBrowser(text10));
24017
24017
  return true;
24018
24018
  }
24019
24019
  function pushStyleAttribute(target, style2) {
@@ -30673,7 +30673,7 @@ var require_react_dom_server_node_development = __commonJS({
30673
30673
  ensureCorrectIsomorphicReactVersion();
30674
30674
  ensureCorrectIsomorphicReactVersion();
30675
30675
  exports.prerender = function(children, options) {
30676
- return new Promise(function(resolve10, reject) {
30676
+ return new Promise(function(resolve13, reject) {
30677
30677
  var onHeaders = options ? options.onHeaders : void 0, onHeadersImpl;
30678
30678
  onHeaders && (onHeadersImpl = function(headersDescriptor) {
30679
30679
  onHeaders(new Headers(headersDescriptor));
@@ -30721,7 +30721,7 @@ var require_react_dom_server_node_development = __commonJS({
30721
30721
  postponed: getPostponedState(request),
30722
30722
  prelude: stream2
30723
30723
  };
30724
- resolve10(stream2);
30724
+ resolve13(stream2);
30725
30725
  },
30726
30726
  void 0,
30727
30727
  void 0,
@@ -30743,7 +30743,7 @@ var require_react_dom_server_node_development = __commonJS({
30743
30743
  });
30744
30744
  };
30745
30745
  exports.prerenderToNodeStream = function(children, options) {
30746
- return new Promise(function(resolve10, reject) {
30746
+ return new Promise(function(resolve13, reject) {
30747
30747
  var resumableState = createResumableState(
30748
30748
  options ? options.identifierPrefix : void 0,
30749
30749
  options ? options.unstable_externalRuntimeSrc : void 0,
@@ -30774,7 +30774,7 @@ var require_react_dom_server_node_development = __commonJS({
30774
30774
  postponed: getPostponedState(request),
30775
30775
  prelude: readable
30776
30776
  };
30777
- resolve10(readable);
30777
+ resolve13(readable);
30778
30778
  },
30779
30779
  void 0,
30780
30780
  void 0,
@@ -30830,7 +30830,7 @@ var require_react_dom_server_node_development = __commonJS({
30830
30830
  };
30831
30831
  };
30832
30832
  exports.renderToReadableStream = function(children, options) {
30833
- return new Promise(function(resolve10, reject) {
30833
+ return new Promise(function(resolve13, reject) {
30834
30834
  var onFatalError, onAllReady, allReady = new Promise(function(res, rej) {
30835
30835
  onAllReady = res;
30836
30836
  onFatalError = rej;
@@ -30879,7 +30879,7 @@ var require_react_dom_server_node_development = __commonJS({
30879
30879
  { highWaterMark: 0 }
30880
30880
  );
30881
30881
  stream2.allReady = allReady;
30882
- resolve10(stream2);
30882
+ resolve13(stream2);
30883
30883
  },
30884
30884
  function(error) {
30885
30885
  allReady.catch(function() {
@@ -30905,7 +30905,7 @@ var require_react_dom_server_node_development = __commonJS({
30905
30905
  });
30906
30906
  };
30907
30907
  exports.resume = function(children, postponedState, options) {
30908
- return new Promise(function(resolve10, reject) {
30908
+ return new Promise(function(resolve13, reject) {
30909
30909
  var onFatalError, onAllReady, allReady = new Promise(function(res, rej) {
30910
30910
  onAllReady = res;
30911
30911
  onFatalError = rej;
@@ -30942,7 +30942,7 @@ var require_react_dom_server_node_development = __commonJS({
30942
30942
  { highWaterMark: 0 }
30943
30943
  );
30944
30944
  stream2.allReady = allReady;
30945
- resolve10(stream2);
30945
+ resolve13(stream2);
30946
30946
  },
30947
30947
  function(error) {
30948
30948
  allReady.catch(function() {
@@ -30967,7 +30967,7 @@ var require_react_dom_server_node_development = __commonJS({
30967
30967
  });
30968
30968
  };
30969
30969
  exports.resumeAndPrerender = function(children, postponedState, options) {
30970
- return new Promise(function(resolve10, reject) {
30970
+ return new Promise(function(resolve13, reject) {
30971
30971
  var request = resumeAndPrerenderRequest(
30972
30972
  children,
30973
30973
  postponedState,
@@ -31000,7 +31000,7 @@ var require_react_dom_server_node_development = __commonJS({
31000
31000
  { highWaterMark: 0 }
31001
31001
  );
31002
31002
  stream2 = { postponed: getPostponedState(request), prelude: stream2 };
31003
- resolve10(stream2);
31003
+ resolve13(stream2);
31004
31004
  },
31005
31005
  void 0,
31006
31006
  void 0,
@@ -31022,7 +31022,7 @@ var require_react_dom_server_node_development = __commonJS({
31022
31022
  });
31023
31023
  };
31024
31024
  exports.resumeAndPrerenderToNodeStream = function(children, postponedState, options) {
31025
- return new Promise(function(resolve10, reject) {
31025
+ return new Promise(function(resolve13, reject) {
31026
31026
  var request = resumeAndPrerenderRequest(
31027
31027
  children,
31028
31028
  postponedState,
@@ -31045,7 +31045,7 @@ var require_react_dom_server_node_development = __commonJS({
31045
31045
  postponed: getPostponedState(request),
31046
31046
  prelude: readable
31047
31047
  };
31048
- resolve10(readable);
31048
+ resolve13(readable);
31049
31049
  },
31050
31050
  void 0,
31051
31051
  void 0,
@@ -33517,12 +33517,12 @@ function mergeObjects(target, ...sources) {
33517
33517
  });
33518
33518
  return target;
33519
33519
  }
33520
- function basename8(path3) {
33520
+ function basename9(path3) {
33521
33521
  const idx = ~path3.lastIndexOf("/") || ~path3.lastIndexOf("\\");
33522
33522
  if (idx === 0) {
33523
33523
  return path3;
33524
33524
  } else if (~idx === path3.length - 1) {
33525
- return basename8(path3.substring(0, path3.length - 1));
33525
+ return basename9(path3.substring(0, path3.length - 1));
33526
33526
  } else {
33527
33527
  return path3.substr(~idx + 1);
33528
33528
  }
@@ -34982,7 +34982,7 @@ var init_dist2 = __esm({
34982
34982
  this._contentNameIsCapturing = RegexSource.hasCaptures(this._contentName);
34983
34983
  }
34984
34984
  get debugName() {
34985
- const location2 = this.$location ? `${basename8(this.$location.filename)}:${this.$location.line}` : "unknown";
34985
+ const location2 = this.$location ? `${basename9(this.$location.filename)}:${this.$location.line}` : "unknown";
34986
34986
  return `${this.constructor.name}#${this.id} @ ${location2}`;
34987
34987
  }
34988
34988
  getName(lineText, captureIndices) {
@@ -37076,7 +37076,7 @@ function explainThemeScopesFull(themeSelectors, scopes) {
37076
37076
  function matchesOne(selector, scope) {
37077
37077
  return selector === scope || scope.substring(0, selector.length) === selector && scope[selector.length] === ".";
37078
37078
  }
37079
- function matches(selectors, scope, parentScopes) {
37079
+ function matches2(selectors, scope, parentScopes) {
37080
37080
  if (!matchesOne(selectors.at(-1), scope)) return false;
37081
37081
  let selectorParentIndex = selectors.length - 2;
37082
37082
  let parentIndex = parentScopes.length - 1;
@@ -37089,7 +37089,7 @@ function matches(selectors, scope, parentScopes) {
37089
37089
  }
37090
37090
  function explainThemeScope(themeSettingsSelectors, scope, parentScopes) {
37091
37091
  const result = [];
37092
- for (const { selectors, settings } of themeSettingsSelectors) for (const selectorPieces of selectors) if (matches(selectorPieces, scope, parentScopes)) {
37092
+ for (const { selectors, settings } of themeSettingsSelectors) for (const selectorPieces of selectors) if (matches2(selectorPieces, scope, parentScopes)) {
37093
37093
  result.push(settings);
37094
37094
  break;
37095
37095
  }
@@ -38325,7 +38325,7 @@ var init_element = __esm({
38325
38325
  });
38326
38326
 
38327
38327
  // node_modules/.pnpm/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/handle/text.js
38328
- function text8(node2, _3, parent, state) {
38328
+ function text9(node2, _3, parent, state) {
38329
38329
  return parent && parent.type === "element" && (parent.tagName === "script" || parent.tagName === "style") ? node2.value : stringifyEntities(
38330
38330
  node2.value,
38331
38331
  Object.assign({}, state.settings.characterReferences, {
@@ -38343,7 +38343,7 @@ var init_text = __esm({
38343
38343
 
38344
38344
  // node_modules/.pnpm/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/handle/raw.js
38345
38345
  function raw(node2, index2, parent, state) {
38346
- return state.settings.allowDangerousHtml ? node2.value : text8(node2, index2, parent, state);
38346
+ return state.settings.allowDangerousHtml ? node2.value : text9(node2, index2, parent, state);
38347
38347
  }
38348
38348
  var init_raw = __esm({
38349
38349
  "node_modules/.pnpm/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/handle/raw.js"() {
@@ -38384,7 +38384,7 @@ var init_handle = __esm({
38384
38384
  handle2 = zwitch("type", {
38385
38385
  invalid,
38386
38386
  unknown,
38387
- handlers: { comment, doctype, element: element4, raw, root: root4, text: text8 }
38387
+ handlers: { comment, doctype, element: element4, raw, root: root4, text: text9 }
38388
38388
  });
38389
38389
  }
38390
38390
  });
@@ -38653,16 +38653,16 @@ function transformerDecorations() {
38653
38653
  if (lines.length !== ctx.converter.lines.length) throw new ShikiError(`Number of lines in code element (${lines.length}) does not match the number of lines in the source (${ctx.converter.lines.length}). Failed to apply decorations.`);
38654
38654
  function applyLineSection(line, start2, end, decoration) {
38655
38655
  const lineEl = lines[line];
38656
- let text9 = "";
38656
+ let text10 = "";
38657
38657
  let startIndex = -1;
38658
38658
  let endIndex = -1;
38659
38659
  if (start2 === 0) startIndex = 0;
38660
38660
  if (end === 0) endIndex = 0;
38661
38661
  if (end === Number.POSITIVE_INFINITY) endIndex = lineEl.children.length;
38662
38662
  if (startIndex === -1 || endIndex === -1) for (let i3 = 0; i3 < lineEl.children.length; i3++) {
38663
- text9 += stringify3(lineEl.children[i3]);
38664
- if (startIndex === -1 && text9.length === start2) startIndex = i3 + 1;
38665
- if (endIndex === -1 && text9.length === end) endIndex = i3 + 1;
38663
+ text10 += stringify3(lineEl.children[i3]);
38664
+ if (startIndex === -1 && text10.length === start2) startIndex = i3 + 1;
38665
+ if (endIndex === -1 && text10.length === end) endIndex = i3 + 1;
38666
38666
  }
38667
38667
  if (startIndex === -1) throw new ShikiError(`Failed to find start index for decoration ${JSON.stringify(decoration.start)}`);
38668
38668
  if (endIndex === -1) throw new ShikiError(`Failed to find end index for decoration ${JSON.stringify(decoration.end)}`);
@@ -38883,9 +38883,9 @@ function createAnsiSequenceParser() {
38883
38883
  let position4 = 0;
38884
38884
  do {
38885
38885
  const findResult = findSequence(value, position4);
38886
- const text9 = findResult.sequence ? value.substring(position4, findResult.startPosition) : value.substring(position4);
38887
- if (text9.length > 0) tokens.push({
38888
- value: text9,
38886
+ const text10 = findResult.sequence ? value.substring(position4, findResult.startPosition) : value.substring(position4);
38887
+ if (text10.length > 0) tokens.push({
38888
+ value: text10,
38889
38889
  foreground,
38890
38890
  background,
38891
38891
  decorations: new Set(decorations2)
@@ -43220,11 +43220,11 @@ var {
43220
43220
  var BIN_NAME = "asmgr";
43221
43221
 
43222
43222
  // src/cli/version.ts
43223
- var VERSION = true ? "0.4.2" : devVersion();
43223
+ var VERSION = true ? "0.5.0" : devVersion();
43224
43224
 
43225
43225
  // src/core/index.ts
43226
- import { stat as stat2 } from "node:fs/promises";
43227
- import { basename as basename7 } from "node:path";
43226
+ import { stat as stat4 } from "node:fs/promises";
43227
+ import { basename as basename8 } from "node:path";
43228
43228
 
43229
43229
  // src/core/adapters/claude.ts
43230
43230
  import { basename as basename2 } from "node:path";
@@ -43255,27 +43255,27 @@ function contentToText(content3) {
43255
43255
  if (!Array.isArray(content3)) return stringifyCompact(content3);
43256
43256
  return content3.map((item) => {
43257
43257
  if (!item || typeof item !== "object") return stringifyCompact(item);
43258
- const record2 = item;
43259
- if (typeof record2.text === "string") return record2.text;
43260
- if (typeof record2.content === "string") return record2.content;
43261
- if (Array.isArray(record2.content)) return contentToText(record2.content);
43262
- if (typeof record2.name === "string") return `[${record2.type ?? "item"}:${record2.name}] ${stringifyCompact(record2.input)}`;
43263
- return stringifyCompact(record2);
43258
+ const record3 = item;
43259
+ if (typeof record3.text === "string") return record3.text;
43260
+ if (typeof record3.content === "string") return record3.content;
43261
+ if (Array.isArray(record3.content)) return contentToText(record3.content);
43262
+ if (typeof record3.name === "string") return `[${record3.type ?? "item"}:${record3.name}] ${stringifyCompact(record3.input)}`;
43263
+ return stringifyCompact(record3);
43264
43264
  }).filter(Boolean).join("\n\n");
43265
43265
  }
43266
- function excerpt(text9, query, width = 220) {
43267
- const haystack = text9.toLowerCase();
43266
+ function excerpt(text10, query, width = 220) {
43267
+ const haystack = text10.toLowerCase();
43268
43268
  const needle = query.toLowerCase();
43269
43269
  const pos = haystack.indexOf(needle);
43270
- if (pos < 0) return text9.slice(0, width).replace(/\s+/g, " ");
43270
+ if (pos < 0) return text10.slice(0, width).replace(/\s+/g, " ");
43271
43271
  const start2 = Math.max(0, pos - Math.floor(width / 3));
43272
- return text9.slice(start2, start2 + width).replace(/\s+/g, " ");
43272
+ return text10.slice(start2, start2 + width).replace(/\s+/g, " ");
43273
43273
  }
43274
43274
  function timelineEntrySearchText(entry) {
43275
43275
  const chunks = [];
43276
43276
  function add(value) {
43277
- const text9 = typeof value === "string" ? value : stringifyInline(value);
43278
- if (text9) chunks.push(text9);
43277
+ const text10 = typeof value === "string" ? value : stringifyInline(value);
43278
+ if (text10) chunks.push(text10);
43279
43279
  }
43280
43280
  add(entry.role);
43281
43281
  add(entry.kind);
@@ -43302,7 +43302,148 @@ import { readdir, readFile, stat } from "node:fs/promises";
43302
43302
  import { homedir } from "node:os";
43303
43303
  import { basename, dirname, join } from "node:path";
43304
43304
  import * as zlib from "node:zlib";
43305
- import { Readable } from "node:stream";
43305
+ import { StringDecoder } from "node:string_decoder";
43306
+
43307
+ // src/core/zstd.ts
43308
+ var ZSTD_MAGIC = 4247762216;
43309
+ var SKIPPABLE_MAGIC = 407710288;
43310
+ var MAX_BLOCK_SIZE = 128 * 1024;
43311
+ async function* splitZstdFrames(chunks) {
43312
+ const field = Buffer.allocUnsafe(13);
43313
+ let phase = "magic";
43314
+ let needed = 4;
43315
+ let filled = 0;
43316
+ let descriptor = 0;
43317
+ let blockMaximum = MAX_BLOCK_SIZE;
43318
+ let lastBlock = false;
43319
+ let retain = true;
43320
+ let parts = [];
43321
+ let frameSize = 0;
43322
+ for await (const input of chunks) {
43323
+ const chunk = Buffer.isBuffer(input) ? input : Buffer.from(input.buffer, input.byteOffset, input.byteLength);
43324
+ let offset = 0;
43325
+ let partStart = 0;
43326
+ while (offset < chunk.length) {
43327
+ const count = Math.min(needed - filled, chunk.length - offset);
43328
+ if (phase !== "payload" && phase !== "checksum" && phase !== "skip") {
43329
+ chunk.copy(field, filled, offset, offset + count);
43330
+ }
43331
+ filled += count;
43332
+ offset += count;
43333
+ if (filled < needed) continue;
43334
+ let complete = false;
43335
+ switch (phase) {
43336
+ case "magic": {
43337
+ const magic = field.readUInt32LE(0);
43338
+ if (magic === ZSTD_MAGIC) {
43339
+ phase = "descriptor";
43340
+ needed = 1;
43341
+ } else if ((magic & 4294967280) === SKIPPABLE_MAGIC) {
43342
+ parts = [];
43343
+ frameSize = 0;
43344
+ retain = false;
43345
+ phase = "skipSize";
43346
+ needed = 4;
43347
+ } else {
43348
+ throw new Error("Invalid Zstandard frame magic");
43349
+ }
43350
+ break;
43351
+ }
43352
+ case "descriptor": {
43353
+ descriptor = field[0];
43354
+ if (descriptor & 8) throw new Error("Reserved Zstandard frame header bit");
43355
+ const singleSegment = !!(descriptor & 32);
43356
+ const sizeFlag = descriptor >>> 6;
43357
+ const sizeBytes = sizeFlag === 0 ? singleSegment ? 1 : 0 : 1 << sizeFlag;
43358
+ const dictFlag = descriptor & 3;
43359
+ const dictBytes = dictFlag === 0 ? 0 : 1 << dictFlag - 1;
43360
+ phase = "header";
43361
+ needed = (singleSegment ? 0 : 1) + dictBytes + sizeBytes;
43362
+ break;
43363
+ }
43364
+ case "header": {
43365
+ if (descriptor & 32) {
43366
+ const sizeFlag = descriptor >>> 6;
43367
+ const dictFlag = descriptor & 3;
43368
+ const sizeOffset = dictFlag === 0 ? 0 : 1 << dictFlag - 1;
43369
+ const contentSize = sizeFlag === 3 ? field.readBigUInt64LE(sizeOffset) : BigInt(sizeFlag === 0 ? field[sizeOffset] : sizeFlag === 1 ? field.readUInt16LE(sizeOffset) + 256 : field.readUInt32LE(sizeOffset));
43370
+ blockMaximum = contentSize < BigInt(MAX_BLOCK_SIZE) ? Number(contentSize) : MAX_BLOCK_SIZE;
43371
+ } else {
43372
+ const window2 = field[0];
43373
+ const base2 = 2 ** (10 + (window2 >>> 3));
43374
+ blockMaximum = Math.min(MAX_BLOCK_SIZE, base2 + base2 / 8 * (window2 & 7));
43375
+ }
43376
+ phase = "block";
43377
+ needed = 3;
43378
+ break;
43379
+ }
43380
+ case "block": {
43381
+ const header = field.readUIntLE(0, 3);
43382
+ lastBlock = !!(header & 1);
43383
+ const type = header >>> 1 & 3;
43384
+ const size = header >>> 3;
43385
+ if (type === 3) throw new Error("Reserved Zstandard block type");
43386
+ if (size > blockMaximum) throw new Error("Invalid Zstandard block size");
43387
+ phase = "payload";
43388
+ needed = type === 1 ? 1 : size;
43389
+ if (needed !== 0) break;
43390
+ }
43391
+ // Fall through for an empty block.
43392
+ case "payload": {
43393
+ if (!lastBlock) {
43394
+ phase = "block";
43395
+ needed = 3;
43396
+ } else if (descriptor & 4) {
43397
+ phase = "checksum";
43398
+ needed = 4;
43399
+ } else {
43400
+ complete = true;
43401
+ }
43402
+ break;
43403
+ }
43404
+ case "checksum":
43405
+ complete = true;
43406
+ break;
43407
+ case "skipSize":
43408
+ phase = "skip";
43409
+ needed = field.readUInt32LE(0);
43410
+ if (needed !== 0) break;
43411
+ // An empty skippable frame is complete at its header's boundary.
43412
+ case "skip":
43413
+ complete = true;
43414
+ break;
43415
+ }
43416
+ filled = 0;
43417
+ if (complete) {
43418
+ if (retain) {
43419
+ if (partStart < offset) {
43420
+ const part = chunk.subarray(partStart, offset);
43421
+ parts.push(part);
43422
+ frameSize += part.length;
43423
+ }
43424
+ const frame = parts.length === 1 ? parts[0] : Buffer.concat(parts, frameSize);
43425
+ parts = [];
43426
+ frameSize = 0;
43427
+ yield frame;
43428
+ }
43429
+ retain = true;
43430
+ partStart = offset;
43431
+ phase = "magic";
43432
+ needed = 4;
43433
+ }
43434
+ }
43435
+ if (retain && partStart < offset) {
43436
+ const part = chunk.subarray(partStart, offset);
43437
+ parts.push(part);
43438
+ frameSize += part.length;
43439
+ }
43440
+ }
43441
+ if (phase !== "magic" || filled !== 0) {
43442
+ throw new Error(`Truncated Zstandard frame (${phase})`);
43443
+ }
43444
+ }
43445
+
43446
+ // src/core/fs.ts
43306
43447
  function expandHome(path3) {
43307
43448
  return path3 === "~" ? homedir() : path3.startsWith("~/") ? join(homedir(), path3.slice(2)) : path3;
43308
43449
  }
@@ -43338,45 +43479,47 @@ function parseJsonlLine(line) {
43338
43479
  return { type: "parse_error", text: line };
43339
43480
  }
43340
43481
  }
43341
- async function* zstdFrames(path3) {
43482
+ async function* zstdText(path3) {
43342
43483
  if (typeof zlib.zstdDecompressSync !== "function") {
43343
43484
  throw new Error("\u8BFB\u53D6 DSH .jsonl.zstd \u9700\u8981\u652F\u6301 Zstandard \u7684\u8FD0\u884C\u65F6\uFF08Node.js >= 22.15\uFF09\uFF1B\u4E5F\u53EF\u8BFB\u53D6\u672A\u538B\u7F29\u7684 .jsonl \u6587\u4EF6");
43344
43485
  }
43345
- const bytes = await readFile(path3);
43346
- let offset = 0;
43347
- while (offset < bytes.length) {
43348
- const result = zlib.zstdDecompressSync(bytes.subarray(offset), { info: true });
43349
- const consumed = result.engine?.bytesWritten;
43350
- if (!Buffer.isBuffer(result.buffer) || !Number.isSafeInteger(consumed) || consumed <= 0 || consumed > bytes.length - offset) {
43351
- throw new Error("\u5F53\u524D\u8FD0\u884C\u65F6\u4E0D\u652F\u6301 Zstandard \u5E27\u8BFB\u53D6\uFF0C\u8BF7\u4F7F\u7528 Node.js >= 22.15");
43486
+ const source = createReadStream(path3);
43487
+ const utf8 = new StringDecoder("utf8");
43488
+ try {
43489
+ for await (const frame of splitZstdFrames(source)) {
43490
+ const text10 = utf8.write(zlib.zstdDecompressSync(frame));
43491
+ if (text10) yield text10;
43352
43492
  }
43353
- offset += consumed;
43354
- yield result.buffer;
43493
+ const tail = utf8.end();
43494
+ if (tail) yield tail;
43495
+ } finally {
43496
+ source.destroy();
43497
+ if (!source.closed) await new Promise((resolve13) => source.once("close", resolve13));
43355
43498
  }
43356
43499
  }
43357
43500
  async function* iterateJsonl(path3) {
43358
- const stream = path3.endsWith(".jsonl.zstd") ? Readable.from(zstdFrames(path3)).setEncoding("utf8") : createReadStream(path3, { encoding: "utf8" });
43501
+ const stream = path3.endsWith(".jsonl.zstd") ? zstdText(path3) : createReadStream(path3, { encoding: "utf8" });
43359
43502
  let fragments = [];
43360
43503
  try {
43361
43504
  for await (const chunk of stream) {
43362
- const text9 = chunk;
43505
+ const text10 = chunk;
43363
43506
  let start2 = 0;
43364
- let end = text9.indexOf("\n");
43507
+ let end = text10.indexOf("\n");
43365
43508
  while (end !== -1) {
43366
- fragments.push(text9.slice(start2, end));
43509
+ fragments.push(text10.slice(start2, end));
43367
43510
  const rawLine = fragments.join("");
43368
43511
  fragments = [];
43369
43512
  const line = rawLine.endsWith("\r") ? rawLine.slice(0, -1) : rawLine;
43370
43513
  if (line.trim()) yield parseJsonlLine(line);
43371
43514
  start2 = end + 1;
43372
- end = text9.indexOf("\n", start2);
43515
+ end = text10.indexOf("\n", start2);
43373
43516
  }
43374
- if (start2 < text9.length) fragments.push(text9.slice(start2));
43517
+ if (start2 < text10.length) fragments.push(text10.slice(start2));
43375
43518
  }
43376
43519
  const tail = fragments.join("");
43377
43520
  if (tail.trim()) yield parseJsonlLine(tail);
43378
43521
  } finally {
43379
- stream.destroy();
43522
+ if ("destroy" in stream) stream.destroy();
43380
43523
  }
43381
43524
  }
43382
43525
  async function readJsonl(path3, limit = Infinity) {
@@ -43432,14 +43575,14 @@ async function parseClaude(ref) {
43432
43575
  const content3 = message.content;
43433
43576
  if (Array.isArray(content3)) {
43434
43577
  for (const part of content3) {
43435
- const record2 = part ?? {};
43436
- const partType = String(record2.type ?? "item");
43578
+ const record3 = part ?? {};
43579
+ const partType = String(record3.type ?? "item");
43437
43580
  entries.push({
43438
43581
  index: entries.length,
43439
43582
  role: mapClaudeRole(type, partType),
43440
43583
  kind: partType,
43441
- title: typeof record2.name === "string" ? record2.name : void 0,
43442
- text: contentToText([record2]),
43584
+ title: typeof record3.name === "string" ? record3.name : void 0,
43585
+ text: contentToText([record3]),
43443
43586
  timestamp,
43444
43587
  rawType: `${type}/${partType}`
43445
43588
  });
@@ -43779,9 +43922,9 @@ async function parseCopilot(ref) {
43779
43922
  continue;
43780
43923
  }
43781
43924
  if (type === "user.message") {
43782
- const text9 = stringOrEmpty(data.content);
43783
- if (!text9.trim()) continue;
43784
- push2({ role: "user", kind: "message", text: text9, timestamp, rawType: type });
43925
+ const text10 = stringOrEmpty(data.content);
43926
+ if (!text10.trim()) continue;
43927
+ push2({ role: "user", kind: "message", text: text10, timestamp, rawType: type });
43785
43928
  continue;
43786
43929
  }
43787
43930
  if (type === "assistant.message") {
@@ -43864,8 +44007,8 @@ A: ${answer}` : answer,
43864
44007
  }
43865
44008
  if (type === "abort") {
43866
44009
  const reason = typeof data.reason === "string" ? data.reason : "user_initiated";
43867
- const text9 = reason === "user_initiated" || reason === "user initiated" ? "Operation cancelled by user" : `Operation aborted (${reason})`;
43868
- push2({ role: "event", kind: "info", text: text9, timestamp, rawType: type });
44010
+ const text10 = reason === "user_initiated" || reason === "user initiated" ? "Operation cancelled by user" : `Operation aborted (${reason})`;
44011
+ push2({ role: "event", kind: "info", text: text10, timestamp, rawType: type });
43869
44012
  continue;
43870
44013
  }
43871
44014
  if (type === "session.error" || type === "error") {
@@ -44035,13 +44178,13 @@ A: ${answer}` : answer,
44035
44178
  async function parseCopilotDb(ref) {
44036
44179
  const stored = await readCopilotDbSession(ref.path, ref.id);
44037
44180
  const entries = [];
44038
- function push2(role, text9, turnIndex) {
44039
- if (!text9.trim()) return;
44181
+ function push2(role, text10, turnIndex) {
44182
+ if (!text10.trim()) return;
44040
44183
  entries.push({
44041
44184
  index: entries.length,
44042
44185
  role,
44043
44186
  kind: "message",
44044
- text: text9,
44187
+ text: text10,
44045
44188
  rawType: role === "user" ? "turns.user_message" : "turns.assistant_response",
44046
44189
  data: { turnIndex }
44047
44190
  });
@@ -44140,8 +44283,70 @@ function isIntentionallyIgnoredEvent(type) {
44140
44283
  // src/core/adapters/dsh.ts
44141
44284
  import { basename as basename5, dirname as dirname3, join as join2 } from "node:path";
44142
44285
 
44286
+ // src/core/concurrency.ts
44287
+ async function mapConcurrent(items, concurrency, work) {
44288
+ if (!Number.isSafeInteger(concurrency) || concurrency < 1) throw new Error("concurrency must be a positive integer");
44289
+ const results = new Array(items.length);
44290
+ let next2 = 0;
44291
+ await Promise.all(Array.from({ length: Math.min(concurrency, items.length) }, async () => {
44292
+ while (next2 < items.length) {
44293
+ const index2 = next2++;
44294
+ results[index2] = await work(items[index2]);
44295
+ }
44296
+ }));
44297
+ return results;
44298
+ }
44299
+
44300
+ // src/core/session-metadata.ts
44301
+ import { stat as stat2 } from "node:fs/promises";
44302
+ import { resolve } from "node:path";
44303
+ var record = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
44304
+ var text = (value) => typeof value === "string" ? value : void 0;
44305
+ async function sessionMetadata(ref) {
44306
+ const result = { ...ref };
44307
+ try {
44308
+ const info = await stat2(ref.path);
44309
+ result.mtime = info.mtime.toISOString();
44310
+ result.size = info.size;
44311
+ } catch {
44312
+ }
44313
+ if (ref.agent === "dsh" || ref.agent === "chatgpt" || ref.source?.kind === "db-turns") return result;
44314
+ try {
44315
+ let sampled = 0;
44316
+ for await (const value of iterateJsonl(ref.path)) {
44317
+ const row2 = record(value);
44318
+ if (ref.agent === "copilot" && row2.type === "session.start") {
44319
+ const data = record(row2.data);
44320
+ result.cwd ??= text(record(data.context).cwd);
44321
+ result.startedAt ??= text(data.startTime) ?? text(row2.timestamp);
44322
+ } else if (ref.agent === "codex" && row2.type === "session_meta") {
44323
+ const payload = record(row2.payload);
44324
+ result.cwd ??= text(payload.cwd);
44325
+ result.startedAt ??= text(payload.timestamp) ?? text(row2.timestamp);
44326
+ } else if (ref.agent === "claude" && typeof row2.cwd === "string") {
44327
+ result.cwd ??= row2.cwd;
44328
+ result.startedAt ??= text(row2.timestamp);
44329
+ }
44330
+ if (++sampled >= 50 || result.cwd && result.startedAt) break;
44331
+ }
44332
+ } catch {
44333
+ }
44334
+ return result;
44335
+ }
44336
+ async function enrichSessionRefs(refs) {
44337
+ return mapConcurrent(refs, 8, sessionMetadata);
44338
+ }
44339
+ function sortSessionRefs(refs, sort = "mtime") {
44340
+ return [...refs].sort((a2, b3) => (sort === "mtime" ? (b3.mtime ?? "").localeCompare(a2.mtime ?? "") : 0) || a2.agent.localeCompare(b3.agent) || a2.id.localeCompare(b3.id) || a2.path.localeCompare(b3.path));
44341
+ }
44342
+ function filterSessionCwd(refs, cwd) {
44343
+ if (cwd === void 0) return refs;
44344
+ const target = resolve(expandHome(cwd));
44345
+ return refs.filter((ref) => ref.cwd && resolve(expandHome(ref.cwd)) === target);
44346
+ }
44347
+
44143
44348
  // src/core/adapters/dsh-reader.ts
44144
- function record(value) {
44349
+ function record2(value) {
44145
44350
  return value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
44146
44351
  }
44147
44352
  function isoTime(value) {
@@ -44197,7 +44402,7 @@ function diagnosticName(value) {
44197
44402
  return value.length > 160 || escaped.length > 160 ? `${escaped.slice(0, 159)}\u2026` : escaped;
44198
44403
  }
44199
44404
  function readDshHeader(path3, value, namedVersion) {
44200
- const header = record(value);
44405
+ const header = record2(value);
44201
44406
  if (header.type !== "session" || !Number.isSafeInteger(header.version) || header.version < 0 || typeof header.id !== "string" || !header.id) throw new Error("\u65E0\u6548\u7684 DSH session \u6587\u4EF6\u5934\uFF08\u9700\u8981 version \u4E0E id\uFF09");
44202
44407
  const startedAt = isoTime(header.createdAt);
44203
44408
  if (!startedAt) throw new Error("\u65E0\u6548\u7684 DSH session.createdAt");
@@ -44214,12 +44419,12 @@ function readDshHeader(path3, value, namedVersion) {
44214
44419
  };
44215
44420
  }
44216
44421
  function readDshEvent(value, row2, diagnostics) {
44217
- const raw2 = record(value);
44422
+ const raw2 = record2(value);
44218
44423
  const type = typeof raw2.type === "string" ? raw2.type : "<invalid-row>";
44219
44424
  const event = {
44220
44425
  type,
44221
44426
  row: row2,
44222
- data: record(raw2.data),
44427
+ data: record2(raw2.data),
44223
44428
  seq: typeof raw2.seq === "number" && Number.isSafeInteger(raw2.seq) && raw2.seq >= 0 ? raw2.seq : void 0,
44224
44429
  time: typeof raw2.time === "number" ? raw2.time : void 0,
44225
44430
  surfaceOp: raw2.surfaceOp,
@@ -44249,7 +44454,7 @@ function readDshEvent(value, row2, diagnostics) {
44249
44454
  }
44250
44455
  if (type === "steering/message") {
44251
44456
  event.type = "user/message";
44252
- if (Object.hasOwn(event.data, "message")) event.data = record(event.data.message);
44457
+ if (Object.hasOwn(event.data, "message")) event.data = record2(event.data.message);
44253
44458
  } else if (type.startsWith("compact/") && ["start", "summary", "end", "prune"].includes(type.slice(8))) {
44254
44459
  event.type = `compaction/${type.slice(8)}`;
44255
44460
  } else if (type === "tool/code-dispatch" || type === "tool/code-dispatch-start") {
@@ -44260,7 +44465,7 @@ function readDshEvent(value, row2, diagnostics) {
44260
44465
  function eventMessage(event) {
44261
44466
  const data = event.data;
44262
44467
  if (event.type === "user/message") return data;
44263
- if (Object.hasOwn(data, "message")) return record(data.message);
44468
+ if (Object.hasOwn(data, "message")) return record2(data.message);
44264
44469
  return data;
44265
44470
  }
44266
44471
  var DSH_LOG_ONLY_TYPES = /* @__PURE__ */ new Set([
@@ -44316,7 +44521,7 @@ var DSH_LOG_ONLY_TYPES = /* @__PURE__ */ new Set([
44316
44521
 
44317
44522
  // src/core/adapters/dsh.ts
44318
44523
  function isDshHeader(value) {
44319
- const row2 = record(value);
44524
+ const row2 = record2(value);
44320
44525
  return row2.type === "session" && typeof row2.version === "number" && typeof row2.id === "string";
44321
44526
  }
44322
44527
  function dshLogVersion(path3) {
@@ -44349,17 +44554,27 @@ function headerRef(path3, header) {
44349
44554
  }
44350
44555
  async function refFromDshFile(path3) {
44351
44556
  try {
44352
- return headerRef(path3, (await readJsonl(path3, 1))[0]);
44557
+ return sessionMetadata(headerRef(path3, (await readJsonl(path3, 1))[0]));
44353
44558
  } catch (error) {
44354
44559
  throw new Error(`\u65E0\u6CD5\u8BFB\u53D6 DSH \u4F1A\u8BDD ${path3}\uFF1A${errorMessage(error)}`, { cause: error });
44355
44560
  }
44356
44561
  }
44562
+ async function discoverDshRef(path3) {
44563
+ try {
44564
+ return await refFromDshFile(path3);
44565
+ } catch (error) {
44566
+ return sessionMetadata({
44567
+ agent: "dsh",
44568
+ id: basename5(dirname3(path3)),
44569
+ path: path3,
44570
+ source: { kind: "events", path: path3, lossy: true, warning: errorMessage(error) }
44571
+ });
44572
+ }
44573
+ }
44357
44574
  async function discoverDsh(root5) {
44358
44575
  const directory = expandHome(root5 ?? join2(process.env.DSH_HOME || "~/.dsh", "sessions"));
44359
44576
  const files = selectDshGenerations(await walkFiles(directory, (path3) => dshLogVersion(path3) !== void 0));
44360
- const refs = [];
44361
- for (const path3 of files) refs.push(await refFromDshFile(path3));
44362
- return refs;
44577
+ return mapConcurrent(files, 8, discoverDshRef);
44363
44578
  }
44364
44579
  async function parseDsh(ref) {
44365
44580
  const rows = iterateJsonl(ref.path);
@@ -44367,7 +44582,7 @@ async function parseDsh(ref) {
44367
44582
  const first = await rows.next();
44368
44583
  if (first.done) throw new Error("\u7A7A\u4F1A\u8BDD\u6587\u4EF6");
44369
44584
  const source = headerRef(ref.path, first.value);
44370
- const diagnostics = new DshDiagnostics(record(first.value).version);
44585
+ const diagnostics = new DshDiagnostics(record2(first.value).version);
44371
44586
  async function* events() {
44372
44587
  let row2 = 1;
44373
44588
  for await (const value of rows) {
@@ -44444,7 +44659,7 @@ async function projectDsh(ref, events, report) {
44444
44659
  }
44445
44660
  const answers = readAnswers(content3, pending.questions.map(({ question }) => question));
44446
44661
  if (!answers) {
44447
- warnings.add("\u90E8\u5206\u63D0\u95EE\u7ED3\u679C\u4E0D\u7B26\u5408\u5B98\u65B9\u95EE\u7B54\u683C\u5F0F\uFF0C\u672A\u63A8\u65AD\u56DE\u7B54");
44662
+ report.add("invalid-answer", "\u90E8\u5206\u63D0\u95EE\u7ED3\u679C\u4E0D\u7B26\u5408\u5B98\u65B9\u95EE\u7B54\u683C\u5F0F\uFF0C\u672A\u63A8\u65AD\u56DE\u7B54", current);
44448
44663
  return;
44449
44664
  }
44450
44665
  for (const { question } of pending.questions) {
@@ -44488,11 +44703,11 @@ ${answer}`,
44488
44703
  return "";
44489
44704
  }
44490
44705
  return content3.map((value) => {
44491
- const block = record(value);
44706
+ const block = record2(value);
44492
44707
  if (block.type === "text" && typeof block.text === "string") return block.text;
44493
44708
  if (block.type === "image" || block.type === "file") {
44494
44709
  warnings.add("\u56FE\u7247\u548C\u6587\u4EF6\u9644\u4EF6\u4EC5\u663E\u793A\u5360\u4F4D\u7B26\uFF0C\u672A\u5D4C\u5165\u9644\u4EF6\u5185\u5BB9");
44495
- const name2 = record(block.attachment).name;
44710
+ const name2 = record2(block.attachment).name;
44496
44711
  return block.type === "image" ? "[\u56FE\u7247]" : `[\u9644\u4EF6\uFF1A${typeof name2 === "string" ? name2 : "\u6587\u4EF6"}]`;
44497
44712
  }
44498
44713
  if (block.type !== "reasoning" && block.type !== "tool-call" && block.type !== "tool-result") {
@@ -44564,9 +44779,9 @@ ${answer}`,
44564
44779
  activeCompaction = void 0;
44565
44780
  } else if (raw2.type === "user/message" || raw2.type === "assistant/message" || raw2.type === "tool/result") {
44566
44781
  const message = eventMessage(raw2);
44567
- const source = record(message.source);
44782
+ const source = record2(message.source);
44568
44783
  if (raw2.surfaceOp !== "append") {
44569
- const operation = record(raw2.surfaceOp);
44784
+ const operation = record2(raw2.surfaceOp);
44570
44785
  const start2 = operation.startSeq ?? operation.start;
44571
44786
  const end = operation.endSeq ?? operation.end;
44572
44787
  const replacement = operation.op === "replace" && typeof start2 === "number" && typeof end === "number" && Number.isSafeInteger(start2) && Number.isSafeInteger(end) && start2 >= 0 && end >= 0;
@@ -44590,14 +44805,14 @@ ${answer}`,
44590
44805
  diagnostics.ignored++;
44591
44806
  continue;
44592
44807
  }
44593
- const text9 = visibleText(message.content);
44594
- if (text9.trim()) push2({ role: "user", kind: "message", text: text9, timestamp, rawType: raw2.type });
44808
+ const text10 = visibleText(message.content);
44809
+ if (text10.trim()) push2({ role: "user", kind: "message", text: text10, timestamp, rawType: raw2.type });
44595
44810
  } else if (raw2.type === "assistant/message") {
44596
44811
  const content3 = Array.isArray(message.content) ? message.content : [];
44597
- const reasoning = content3.map(record).filter((block) => block.type === "reasoning" && typeof block.text === "string").map((block) => block.text).join("");
44812
+ const reasoning = content3.map(record2).filter((block) => block.type === "reasoning" && typeof block.text === "string").map((block) => block.text).join("");
44598
44813
  if (reasoning.trim()) push2({ role: "reasoning", kind: "reasoning", text: reasoning, timestamp, rawType: raw2.type });
44599
- const text9 = visibleText(message.content);
44600
- if (text9.trim()) push2({ role: "assistant", kind: "message", text: text9, timestamp, rawType: raw2.type });
44814
+ const text10 = visibleText(message.content);
44815
+ if (text10.trim()) push2({ role: "assistant", kind: "message", text: text10, timestamp, rawType: raw2.type });
44601
44816
  } else {
44602
44817
  const result = toolResult(message);
44603
44818
  if (!result) {
@@ -44631,7 +44846,7 @@ ${answer}`,
44631
44846
  if (collision || candidates.length > 1) report.add("ambiguous-tool-result", "\u5DE5\u5177\u7ED3\u679C\u5173\u8054\u5230\u591A\u4E2A\u8C03\u7528\uFF0C\u4FDD\u7559\u72EC\u7ACB\u7ED3\u679C", raw2);
44632
44847
  else if (candidate && !pending) report.add("duplicate-tool-result", "\u5DF2\u7ED3\u675F\u7684\u5DE5\u5177\u8C03\u7528\u53C8\u6536\u5230\u7ED3\u679C\uFF0C\u4FDD\u7559\u72EC\u7ACB\u7ED3\u679C", raw2);
44633
44848
  else if (explicit && sources && !pending) report.add("unmatched-tool-result", "\u5DE5\u5177\u7ED3\u679C\u7684\u660E\u786E\u6765\u6E90\u672A\u5339\u914D\u5230\u8C03\u7528\uFF0C\u4FDD\u7559\u72EC\u7ACB\u7ED3\u679C", raw2);
44634
- if (pending) finishTool(pending, result.content, result.isError, record(data.error).code, timestamp);
44849
+ if (pending) finishTool(pending, result.content, result.isError, record2(data.error).code, timestamp);
44635
44850
  else independentResult(result.callId, result.content, result.isError, timestamp, raw2.type);
44636
44851
  }
44637
44852
  } else {
@@ -44646,19 +44861,20 @@ ${answer}`,
44646
44861
  for (const { entry } of pending.questions) entry.text += "\n\n\uFF08\u672A\u8BB0\u5F55\u53EF\u5339\u914D\u7684\u56DE\u7B54\uFF09";
44647
44862
  }
44648
44863
  }
44864
+ const notices = [...warnings];
44649
44865
  const diagnosticWarning = report.finish();
44650
44866
  if (diagnosticWarning) warnings.add(diagnosticWarning);
44651
44867
  return {
44652
44868
  ...ref,
44653
44869
  title,
44654
44870
  updatedAt,
44655
- source: { kind: "events", path: ref.path, lossy: warnings.size > 0, warning: warnings.size ? [...warnings].join("\uFF1B") : void 0 },
44871
+ source: { kind: "events", path: ref.path, lossy: warnings.size > 0, warning: warnings.size ? [...warnings].join("\uFF1B") : void 0, ...notices.length ? { notices } : {} },
44656
44872
  entries,
44657
44873
  diagnostics
44658
44874
  };
44659
44875
  }
44660
44876
  function toolResult(message) {
44661
- const row2 = record(message);
44877
+ const row2 = record2(message);
44662
44878
  if (row2.role === "tool") {
44663
44879
  return typeof row2.toolCallId === "string" && row2.toolCallId && typeof row2.isError === "boolean" ? { callId: row2.toolCallId, content: row2.content, isError: row2.isError } : void 0;
44664
44880
  }
@@ -44666,7 +44882,7 @@ function toolResult(message) {
44666
44882
  return { callId: row2.callId, content: row2.content, isError: row2.isError };
44667
44883
  }
44668
44884
  if (row2.role !== void 0 && row2.role !== "user") return void 0;
44669
- const wrapper = record(Array.isArray(row2.content) && row2.content.length === 1 ? row2.content[0] : void 0);
44885
+ const wrapper = record2(Array.isArray(row2.content) && row2.content.length === 1 ? row2.content[0] : void 0);
44670
44886
  if (wrapper.type !== "tool-result" || typeof wrapper.toolCallId !== "string" || !wrapper.toolCallId || typeof wrapper.isError !== "boolean") return void 0;
44671
44887
  return { callId: wrapper.toolCallId, content: wrapper.content, isError: wrapper.isError === true };
44672
44888
  }
@@ -44685,7 +44901,7 @@ function sameJson(a2, b3) {
44685
44901
  for (let i3 = 0; i3 < left.length; i3++) work.push([left[i3], right[i3]]);
44686
44902
  } else {
44687
44903
  if (!left || !right || typeof left !== "object" || typeof right !== "object") return false;
44688
- const x3 = record(left), y3 = record(right), keys2 = Object.keys(x3);
44904
+ const x3 = record2(left), y3 = record2(right), keys2 = Object.keys(x3);
44689
44905
  if (keys2.length !== Object.keys(y3).length) return false;
44690
44906
  for (const key2 of keys2) {
44691
44907
  if (!Object.hasOwn(y3, key2)) return false;
@@ -44704,16 +44920,16 @@ function parseJson(value) {
44704
44920
  }
44705
44921
  }
44706
44922
  function readQuestions(args) {
44707
- const values = record(args).questions;
44923
+ const values = record2(args).questions;
44708
44924
  if (!Array.isArray(values) || values.length === 0) return [];
44709
44925
  const questions = [];
44710
44926
  for (const value of values) {
44711
- const q2 = record(value);
44927
+ const q2 = record2(value);
44712
44928
  if (typeof q2.id !== "string" || typeof q2.question !== "string" || questions.some((other) => other.id === q2.id)) return [];
44713
44929
  if (q2.options !== void 0 && !Array.isArray(q2.options) || q2.multi_select !== void 0 && typeof q2.multi_select !== "boolean" || q2.header !== void 0 && typeof q2.header !== "string") return [];
44714
44930
  const options = [];
44715
44931
  for (const value2 of q2.options ?? []) {
44716
- const option2 = record(value2);
44932
+ const option2 = record2(value2);
44717
44933
  if (typeof option2.label !== "string" || option2.description !== void 0 && typeof option2.description !== "string") return [];
44718
44934
  options.push({ label: option2.label, description: option2.description });
44719
44935
  }
@@ -44735,13 +44951,13 @@ ${index2 + 1}. ${option2.label}${option2.description ? ` \u2014 ${option2.descri
44735
44951
  }
44736
44952
  function readAnswers(content3, questions) {
44737
44953
  if (!Array.isArray(content3) || content3.length !== 1) return void 0;
44738
- const block = record(content3[0]);
44954
+ const block = record2(content3[0]);
44739
44955
  if (block.type !== "text" || typeof block.text !== "string") return void 0;
44740
- const values = record(parseJson(block.text)).answers;
44956
+ const values = record2(parseJson(block.text)).answers;
44741
44957
  if (!Array.isArray(values) || values.length !== questions.length) return void 0;
44742
44958
  const answers = /* @__PURE__ */ new Map();
44743
44959
  for (const value of values) {
44744
- const answer = record(value);
44960
+ const answer = record2(value);
44745
44961
  if (typeof answer.id !== "string" || answers.has(answer.id) || !questions.some((q2) => q2.id === answer.id) || !Array.isArray(answer.selected) || !answer.selected.every((item) => typeof item === "string") || answer.custom !== void 0 && typeof answer.custom !== "string") return void 0;
44746
44962
  const parts = [...answer.selected, ...typeof answer.custom === "string" && answer.custom.trim() ? [answer.custom] : []];
44747
44963
  answers.set(answer.id, parts.length ? parts.join("\n") : "\uFF08\u672A\u9009\u62E9\uFF09");
@@ -44780,8 +44996,8 @@ var Deferred = class {
44780
44996
  resolve;
44781
44997
  reject;
44782
44998
  constructor() {
44783
- this.promise = new Promise((resolve10, reject) => {
44784
- this.resolve = resolve10;
44999
+ this.promise = new Promise((resolve13, reject) => {
45000
+ this.resolve = resolve13;
44785
45001
  this.reject = reject;
44786
45002
  });
44787
45003
  }
@@ -45290,7 +45506,7 @@ function parseChatGptSnapshot(ref, snapshot) {
45290
45506
  const recipient = stringValue(message.recipient);
45291
45507
  const content3 = asRecord(message.content);
45292
45508
  const contentType = stringValue(content3?.content_type) ?? "unknown";
45293
- const text9 = messageText(message);
45509
+ const text10 = messageText(message);
45294
45510
  const timestamp = isoTimestamp(message.create_time);
45295
45511
  const visuallyHidden = metadata?.is_visually_hidden_from_conversation === true;
45296
45512
  const rawType = `chatgpt/${role}/${contentType}${recipient ? `/${recipient}` : ""}`;
@@ -45312,22 +45528,22 @@ function parseChatGptSnapshot(ref, snapshot) {
45312
45528
  visuallyHidden
45313
45529
  });
45314
45530
  if (role === "user") {
45315
- if (!text9.trim()) {
45531
+ if (!text10.trim()) {
45316
45532
  diagnosticCounts.ignored += 1;
45317
45533
  continue;
45318
45534
  }
45319
45535
  diagnosticCounts.handled += 1;
45320
- push2({ role: "user", kind: "message", text: text9, timestamp, rawType, data: commonData });
45536
+ push2({ role: "user", kind: "message", text: text10, timestamp, rawType, data: commonData });
45321
45537
  continue;
45322
45538
  }
45323
45539
  if (role === "assistant") {
45324
45540
  if (contentType === "thoughts" || contentType === "reasoning_recap") {
45325
- if (!text9.trim()) {
45541
+ if (!text10.trim()) {
45326
45542
  diagnosticCounts.ignored += 1;
45327
45543
  continue;
45328
45544
  }
45329
45545
  diagnosticCounts.handled += 1;
45330
- push2({ role: "reasoning", kind: contentType, text: text9, timestamp, rawType, data: commonData });
45546
+ push2({ role: "reasoning", kind: contentType, text: text10, timestamp, rawType, data: commonData });
45331
45547
  continue;
45332
45548
  }
45333
45549
  if (recipient && recipient !== "all") {
@@ -45350,7 +45566,7 @@ function parseChatGptSnapshot(ref, snapshot) {
45350
45566
  tool: {
45351
45567
  callId: stringValue(message.id),
45352
45568
  name: recipient,
45353
- arguments: parseToolArguments(text9),
45569
+ arguments: parseToolArguments(text10),
45354
45570
  intentionSummary: stringValue(metadata?.search_display_string),
45355
45571
  result: matchedResult ? normalizedToolResult(matchedResult) : { type: "pending" }
45356
45572
  }
@@ -45358,23 +45574,23 @@ function parseChatGptSnapshot(ref, snapshot) {
45358
45574
  continue;
45359
45575
  }
45360
45576
  if (contentType !== "text") {
45361
- if (!text9.trim()) {
45577
+ if (!text10.trim()) {
45362
45578
  diagnosticCounts.ignored += 1;
45363
45579
  continue;
45364
45580
  }
45365
45581
  diagnosticCounts.handled += 1;
45366
- push2({ role: "system", kind: contentType, text: text9, timestamp, rawType, data: commonData });
45582
+ push2({ role: "system", kind: contentType, text: text10, timestamp, rawType, data: commonData });
45367
45583
  continue;
45368
45584
  }
45369
- if (visuallyHidden || !text9.trim()) {
45585
+ if (visuallyHidden || !text10.trim()) {
45370
45586
  diagnosticCounts.ignored += 1;
45371
45587
  continue;
45372
45588
  }
45373
45589
  diagnosticCounts.handled += 1;
45374
45590
  if (firstUserPosition >= 0 && position4 < firstUserPosition) {
45375
- push2({ role: "system", kind: "preamble", text: text9, timestamp, rawType, data: commonData });
45591
+ push2({ role: "system", kind: "preamble", text: text10, timestamp, rawType, data: commonData });
45376
45592
  } else {
45377
- push2({ role: "assistant", kind: "message", text: text9, timestamp, rawType, data: commonData });
45593
+ push2({ role: "assistant", kind: "message", text: text10, timestamp, rawType, data: commonData });
45378
45594
  }
45379
45595
  continue;
45380
45596
  }
@@ -45384,7 +45600,7 @@ function parseChatGptSnapshot(ref, snapshot) {
45384
45600
  diagnosticCounts.handled += 1;
45385
45601
  continue;
45386
45602
  }
45387
- if (!redacted && !text9.trim()) {
45603
+ if (!redacted && !text10.trim()) {
45388
45604
  diagnosticCounts.ignored += 1;
45389
45605
  continue;
45390
45606
  }
@@ -45393,7 +45609,7 @@ function parseChatGptSnapshot(ref, snapshot) {
45393
45609
  role: "tool",
45394
45610
  kind: "tool_result",
45395
45611
  title: authorName ?? "tool result",
45396
- text: redacted ? "" : text9,
45612
+ text: redacted ? "" : text10,
45397
45613
  timestamp,
45398
45614
  rawType,
45399
45615
  data: commonData,
@@ -45402,18 +45618,18 @@ function parseChatGptSnapshot(ref, snapshot) {
45402
45618
  result: redacted ? {
45403
45619
  type: "redacted",
45404
45620
  log: "ChatGPT \u5DF2\u5728\u516C\u5F00\u5206\u4EAB\u4E2D\u9690\u85CF\u8BE5\u5DE5\u5177\u7684\u539F\u59CB\u8F93\u51FA\u3002"
45405
- } : { type: "success", log: text9 }
45621
+ } : { type: "success", log: text10 }
45406
45622
  }
45407
45623
  });
45408
45624
  continue;
45409
45625
  }
45410
45626
  if (role === "system") {
45411
- if (!text9.trim()) {
45627
+ if (!text10.trim()) {
45412
45628
  diagnosticCounts.ignored += 1;
45413
45629
  continue;
45414
45630
  }
45415
45631
  diagnosticCounts.handled += 1;
45416
- push2({ role: "system", kind: contentType, text: text9, timestamp, rawType, data: commonData });
45632
+ push2({ role: "system", kind: contentType, text: text10, timestamp, rawType, data: commonData });
45417
45633
  continue;
45418
45634
  }
45419
45635
  diagnosticCounts.unknown += 1;
@@ -45603,12 +45819,12 @@ function partToText(value) {
45603
45819
  }
45604
45820
  return contentToText(part);
45605
45821
  }
45606
- function parseToolArguments(text9) {
45607
- if (!text9) return void 0;
45822
+ function parseToolArguments(text10) {
45823
+ if (!text10) return void 0;
45608
45824
  try {
45609
- return JSON.parse(text9);
45825
+ return JSON.parse(text10);
45610
45826
  } catch {
45611
- return text9;
45827
+ return text10;
45612
45828
  }
45613
45829
  }
45614
45830
  function matchChatGptToolResults(rows) {
@@ -45626,22 +45842,22 @@ function matchChatGptToolResults(rows) {
45626
45842
  if (segment.length > 0) segments.push(segment);
45627
45843
  const resultByCallPosition = /* @__PURE__ */ new Map();
45628
45844
  const callByResultPosition = /* @__PURE__ */ new Map();
45629
- for (const positions of segments) {
45630
- const calls = positions.flatMap((position4) => {
45845
+ for (const positions2 of segments) {
45846
+ const calls = positions2.flatMap((position4) => {
45631
45847
  const message = asRecord(asRecord(rows[position4])?.message);
45632
45848
  const role = stringValue(asRecord(message?.author)?.role);
45633
45849
  const name2 = stringValue(message?.recipient);
45634
45850
  return role === "assistant" && name2 && name2 !== "all" ? [{ position: position4, name: name2 }] : [];
45635
45851
  });
45636
45852
  const unmatchedCalls = new Set(calls.map((call) => call.position));
45637
- for (const position4 of positions) {
45853
+ for (const position4 of positions2) {
45638
45854
  const node2 = asRecord(rows[position4]);
45639
45855
  const message = asRecord(node2?.message);
45640
45856
  const role = stringValue(asRecord(message?.author)?.role);
45641
45857
  if (role !== "tool" || !message) continue;
45642
- const text9 = messageText(message);
45858
+ const text10 = messageText(message);
45643
45859
  const redacted = isRedactedToolResult(message);
45644
- if (!redacted && !text9.trim()) continue;
45860
+ if (!redacted && !text10.trim()) continue;
45645
45861
  const name2 = stringValue(asRecord(message.author)?.name);
45646
45862
  const candidates = calls.filter((call2) => unmatchedCalls.has(call2.position) && (name2 ? call2.name === name2 : true));
45647
45863
  if (candidates.length !== 1) continue;
@@ -45649,7 +45865,7 @@ function matchChatGptToolResults(rows) {
45649
45865
  const result = {
45650
45866
  position: position4,
45651
45867
  name: name2,
45652
- text: text9,
45868
+ text: text10,
45653
45869
  redacted,
45654
45870
  nodeId: stringValue(node2?.id),
45655
45871
  messageId: stringValue(message.id)
@@ -45697,15 +45913,15 @@ function collectOmittedContentKinds(value, kinds) {
45697
45913
  if (Array.isArray(value)) {
45698
45914
  return value.reduce((count, item) => count + collectOmittedContentKinds(item, kinds), 0);
45699
45915
  }
45700
- const record2 = asRecord(value);
45701
- if (!record2) return 0;
45702
- const contentType = stringValue(record2.content_type);
45703
- const hasExternalAsset = typeof record2.asset_pointer === "string" || "image_url" in record2 || "audio_url" in record2 || "video_url" in record2 || "file_id" in record2;
45916
+ const record3 = asRecord(value);
45917
+ if (!record3) return 0;
45918
+ const contentType = stringValue(record3.content_type);
45919
+ const hasExternalAsset = typeof record3.asset_pointer === "string" || "image_url" in record3 || "audio_url" in record3 || "video_url" in record3 || "file_id" in record3;
45704
45920
  if (hasExternalAsset) {
45705
45921
  kinds.add(contentType ?? "external_asset");
45706
45922
  return 1;
45707
45923
  }
45708
- return Object.values(record2).reduce((count, item) => count + collectOmittedContentKinds(item, kinds), 0);
45924
+ return Object.values(record3).reduce((count, item) => count + collectOmittedContentKinds(item, kinds), 0);
45709
45925
  }
45710
45926
  function chatGptFidelityWarning(fidelity) {
45711
45927
  const warnings = [];
@@ -45772,16 +45988,242 @@ function isAddressBarConversationPath(pathname) {
45772
45988
  return /^\/c\/[^/]+\/?$/u.test(pathname) || /^\/g\/[^/]+\/c\/[^/]+\/?$/u.test(pathname);
45773
45989
  }
45774
45990
 
45991
+ // src/core/parse.ts
45992
+ async function parseSession(ref) {
45993
+ if (ref.agent === "copilot") return parseCopilot(ref);
45994
+ if (ref.agent === "claude") return parseClaude(ref);
45995
+ if (ref.agent === "codex") return parseCodex(ref);
45996
+ if (ref.agent === "dsh") return parseDsh(ref);
45997
+ return parseChatGpt(ref);
45998
+ }
45999
+
46000
+ // src/core/session-cache.ts
46001
+ import { createHash, randomUUID } from "node:crypto";
46002
+ import { mkdir, readFile as readFile2, rename, stat as stat3, unlink, writeFile } from "node:fs/promises";
46003
+ import { basename as basename7, dirname as dirname4, join as join4, resolve as resolve2 } from "node:path";
46004
+ import { promisify } from "node:util";
46005
+ import { gzip, gunzip } from "node:zlib";
46006
+
46007
+ // src/core/search-bloom.ts
46008
+ var BLOOM_BYTES = 32 * 1024;
46009
+ var MASK = BLOOM_BYTES * 8 - 1;
46010
+ function positions(text10, index2, out) {
46011
+ const a2 = text10.charCodeAt(index2), b3 = text10.charCodeAt(index2 + 1), c = text10.charCodeAt(index2 + 2);
46012
+ const first = Math.imul(a2, 2654435761) ^ Math.imul(b3, 2246822507) ^ Math.imul(c, 3266489909);
46013
+ const step = first >>> 17 ^ Math.imul(a2 + c, 668265261) ^ b3 | 1;
46014
+ out[0] = first & MASK;
46015
+ out[1] = first + step & MASK;
46016
+ out[2] = first + 2 * step & MASK;
46017
+ }
46018
+ function buildSearchBloom(lowerTexts) {
46019
+ const bits = Buffer.alloc(BLOOM_BYTES);
46020
+ const indices = new Uint32Array(3);
46021
+ for (const text10 of lowerTexts) {
46022
+ for (let i3 = 0; i3 + 2 < text10.length; i3++) {
46023
+ positions(text10, i3, indices);
46024
+ for (let j2 = 0; j2 < 3; j2++) {
46025
+ const bit = indices[j2];
46026
+ bits[bit >>> 3] |= 1 << (bit & 7);
46027
+ }
46028
+ }
46029
+ }
46030
+ return bits;
46031
+ }
46032
+ function bloomMayContain(bits, lowerQuery) {
46033
+ if (bits.length !== BLOOM_BYTES) return true;
46034
+ const indices = new Uint32Array(3);
46035
+ for (let i3 = 0; i3 + 2 < lowerQuery.length; i3++) {
46036
+ positions(lowerQuery, i3, indices);
46037
+ for (let j2 = 0; j2 < 3; j2++) {
46038
+ const bit = indices[j2];
46039
+ if (!(bits[bit >>> 3] & 1 << (bit & 7))) return false;
46040
+ }
46041
+ }
46042
+ return true;
46043
+ }
46044
+
46045
+ // src/core/session-cache.ts
46046
+ var SEARCH_CACHE_VERSION = "search-text-1";
46047
+ var compress = promisify(gzip);
46048
+ var decompress = promisify(gunzip);
46049
+ var MAX_BYTES = 128 * 1024 * 1024;
46050
+ var hash = (value) => createHash("sha256").update(value).digest("hex");
46051
+ async function fingerprint(ref) {
46052
+ if (/^https?:\/\//i.test(ref.path) || ref.source?.kind === "db-turns" || ref.agent === "copilot" && basename7(ref.path) === "session-store.db") return void 0;
46053
+ try {
46054
+ const info = await stat3(ref.path, { bigint: true });
46055
+ return [SEARCH_CACHE_VERSION, ref.agent, ref.id, resolve2(ref.path), info.dev, info.ino, info.size, info.mtimeNs ?? info.mtimeMs, info.ctimeNs ?? info.ctimeMs].join("\0");
46056
+ } catch {
46057
+ return void 0;
46058
+ }
46059
+ }
46060
+ function validMetadata(header) {
46061
+ const metadata = header.metadata;
46062
+ if (!metadata || typeof metadata !== "object") return false;
46063
+ for (const key2 of ["cwd", "title", "startedAt", "updatedAt", "mtime", "repository", "branch"]) {
46064
+ if (metadata[key2] !== void 0 && typeof metadata[key2] !== "string") return false;
46065
+ }
46066
+ const source = metadata.source;
46067
+ if (source !== void 0 && (!source || typeof source !== "object" || typeof source.path !== "string" || typeof source.lossy !== "boolean" || !["events", "db-turns", "chatgpt-share"].includes(source.kind) || source.warning !== void 0 && typeof source.warning !== "string" || source.notices !== void 0 && (!Array.isArray(source.notices) || !source.notices.every((value) => typeof value === "string")))) return false;
46068
+ const report = header.diagnostics;
46069
+ return report === void 0 || !!report && typeof report === "object" && [report.handled, report.ignored, report.unknown].every((value) => Number.isSafeInteger(value) && value >= 0) && Array.isArray(report.unknownTypes) && report.unknownTypes.every((value) => typeof value === "string") && (report.issues === void 0 || Array.isArray(report.issues) && report.issues.every((issue) => issue && typeof issue.code === "string" && typeof issue.message === "string" && Number.isSafeInteger(issue.count) && issue.count > 0));
46070
+ }
46071
+ function seal(header) {
46072
+ const { headerHash: _previous, ...payload } = header;
46073
+ return { ...payload, headerHash: hash(JSON.stringify(payload)) };
46074
+ }
46075
+ function validSeal(header) {
46076
+ const { headerHash, ...payload } = header;
46077
+ return typeof headerHash === "string" && headerHash === hash(JSON.stringify(payload));
46078
+ }
46079
+ function matches(header, ref, signature) {
46080
+ return validMetadata(header) && header.version === SEARCH_CACHE_VERSION && header.fingerprint === signature && header.metadata?.id === ref.id && header.metadata.agent === ref.agent && header.metadata.path === ref.path;
46081
+ }
46082
+ async function atomicWrite(namespace, name2, data) {
46083
+ await mkdir(namespace, { recursive: true, mode: 448 });
46084
+ const path3 = join4(namespace, name2);
46085
+ const temporary = join4(namespace, `${name2}.${randomUUID()}.tmp`);
46086
+ if (dirname4(path3) !== namespace || dirname4(temporary) !== namespace) throw new Error("invalid cache target");
46087
+ try {
46088
+ await writeFile(temporary, data, { mode: 384, flag: "wx" });
46089
+ await rename(temporary, path3);
46090
+ } finally {
46091
+ await unlink(temporary).catch(() => {
46092
+ });
46093
+ }
46094
+ }
46095
+ function withBloom(header, lowerTexts) {
46096
+ const bloom = buildSearchBloom(lowerTexts);
46097
+ return { ...header, bloom: bloom.toString("base64"), bloomHash: hash(bloom) };
46098
+ }
46099
+ async function readSearchSession(ref, query, cacheRoot) {
46100
+ if (!cacheRoot) return { parsed: await parseSession(ref) };
46101
+ const before = await fingerprint(ref);
46102
+ if (!before) return { parsed: await parseSession(ref) };
46103
+ const namespace = join4(resolve2(cacheRoot), "search", SEARCH_CACHE_VERSION);
46104
+ const key2 = hash([ref.agent, ref.id, resolve2(ref.path)].join("\0"));
46105
+ const path3 = join4(namespace, `${key2}.json.gz`);
46106
+ const manifest = join4(namespace, `${key2}.meta.json`);
46107
+ let manifestValid = false;
46108
+ try {
46109
+ if ((await stat3(manifest)).size <= 1024 * 1024) {
46110
+ const header = JSON.parse(await readFile2(manifest, "utf8"));
46111
+ if (matches(header, ref, before) && validSeal(header) && typeof header.bloom === "string") {
46112
+ const bloom = Buffer.from(header.bloom, "base64");
46113
+ if (bloom.length === BLOOM_BYTES && hash(bloom) === header.bloomHash) {
46114
+ manifestValid = true;
46115
+ if (!bloomMayContain(bloom, query.toLowerCase()) && await fingerprint(ref) === before) {
46116
+ return { parsed: { ...header.metadata, diagnostics: header.diagnostics, entries: [] } };
46117
+ }
46118
+ }
46119
+ }
46120
+ }
46121
+ } catch {
46122
+ }
46123
+ try {
46124
+ const info = await stat3(path3);
46125
+ if (info.size <= MAX_BYTES) {
46126
+ const bytes = await decompress(await readFile2(path3), { maxOutputLength: MAX_BYTES });
46127
+ const boundary = bytes.indexOf(10);
46128
+ if (boundary < 0 || boundary > 1024 * 1024) throw new Error("invalid cache header");
46129
+ const header = JSON.parse(bytes.subarray(0, boundary).toString("utf8"));
46130
+ const body3 = bytes.subarray(boundary + 1);
46131
+ if (matches(header, ref, before) && header.bodyHash === hash(body3) && await fingerprint(ref) === before) {
46132
+ if (!manifestValid) {
46133
+ let promoted = header;
46134
+ const bloom = typeof header.bloom === "string" ? Buffer.from(header.bloom, "base64") : void 0;
46135
+ if (!bloom || bloom.length !== BLOOM_BYTES || hash(bloom) !== header.bloomHash) {
46136
+ const lowerTexts2 = JSON.parse(body3.toString("utf8"));
46137
+ if (!Array.isArray(lowerTexts2) || !lowerTexts2.every((text10) => typeof text10 === "string")) throw new Error("invalid text index");
46138
+ promoted = withBloom(header, lowerTexts2);
46139
+ }
46140
+ await atomicWrite(namespace, `${key2}.meta.json`, JSON.stringify(seal(promoted))).catch(() => {
46141
+ });
46142
+ }
46143
+ if (/[\uD800-\uDFFF]/.test(query)) return { parsed: await parseSession(ref) };
46144
+ const encodedNeedle = JSON.stringify(query.toLowerCase()).slice(1, -1);
46145
+ if (!body3.includes(Buffer.from(encodedNeedle))) {
46146
+ return { parsed: { ...header.metadata, diagnostics: header.diagnostics, entries: [] } };
46147
+ }
46148
+ return { parsed: await parseSession(ref) };
46149
+ }
46150
+ }
46151
+ } catch {
46152
+ }
46153
+ const parsed = await parseSession(ref);
46154
+ const lowerTexts = parsed.entries.map((entry) => timelineEntrySearchText(entry).toLowerCase());
46155
+ if (await fingerprint(ref) !== before) return { parsed, lowerTexts };
46156
+ try {
46157
+ const body3 = JSON.stringify(lowerTexts);
46158
+ const { entries: _entries, diagnostics, ...metadata } = parsed;
46159
+ const header = withBloom({ version: SEARCH_CACHE_VERSION, fingerprint: before, metadata, diagnostics, bodyHash: hash(body3) }, lowerTexts);
46160
+ const text10 = JSON.stringify(header) + "\n" + body3;
46161
+ if (Buffer.byteLength(text10) > MAX_BYTES) return { parsed, lowerTexts };
46162
+ await atomicWrite(namespace, `${key2}.json.gz`, await compress(text10));
46163
+ await atomicWrite(namespace, `${key2}.meta.json`, JSON.stringify(seal(header)));
46164
+ } catch {
46165
+ }
46166
+ return { parsed, lowerTexts };
46167
+ }
46168
+
46169
+ // src/core/search.ts
46170
+ async function scanSession(ref, query, limit, options = {}) {
46171
+ const diagnostics = [];
46172
+ const found = [];
46173
+ try {
46174
+ const { parsed, lowerTexts } = await readSearchSession(ref, query, options.cacheDir);
46175
+ const { entries, diagnostics: report, ...session } = parsed;
46176
+ const notices = new Set(parsed.source?.notices ?? []);
46177
+ for (const message of notices) diagnostics.push({ kind: "notice", session: ref, code: "source-notice", message });
46178
+ for (const issue of report?.issues ?? []) diagnostics.push({ kind: "warning", session: ref, code: issue.code, message: issue.message });
46179
+ if (parsed.source?.warning && !report?.issues?.length && !notices.has(parsed.source.warning)) {
46180
+ diagnostics.push({ kind: "warning", session: ref, code: "source-warning", message: parsed.source.warning });
46181
+ }
46182
+ const needle = query.toLowerCase();
46183
+ for (let index2 = 0; index2 < entries.length; index2++) {
46184
+ const entry = entries[index2];
46185
+ if (options.role && entry.role !== options.role) continue;
46186
+ if (lowerTexts && !lowerTexts[index2].includes(needle)) continue;
46187
+ const text10 = timelineEntrySearchText(entry);
46188
+ if (!lowerTexts && !text10.toLowerCase().includes(needle)) continue;
46189
+ found.push({ session, entry, excerpt: excerpt(text10, query) });
46190
+ if (found.length >= limit) break;
46191
+ }
46192
+ } catch (error) {
46193
+ diagnostics.push({ kind: "unreadable", session: ref, code: "unreadable", message: error instanceof Error ? error.message : String(error) });
46194
+ }
46195
+ return { found, diagnostics };
46196
+ }
46197
+ async function searchRefs(refs, query, limit = 20, options = {}) {
46198
+ if (!Number.isSafeInteger(limit) || limit < 0) throw new Error("limit must be a non-negative integer");
46199
+ const concurrency = options.concurrency ?? 2;
46200
+ if (!Number.isSafeInteger(concurrency) || concurrency < 1 || concurrency > 32) throw new Error("concurrency must be an integer between 1 and 32");
46201
+ if (!query.trim()) throw new Error("search query must not be empty");
46202
+ if (limit === 0) return [];
46203
+ const hits = [];
46204
+ const ordered = sortSessionRefs(refs);
46205
+ const scan = options.scanSession ?? ((ref) => scanSession(ref, query, limit, options));
46206
+ for (let offset = 0; offset < ordered.length; offset += concurrency) {
46207
+ const results = await mapConcurrent(ordered.slice(offset, offset + concurrency), concurrency, scan);
46208
+ for (const result of results) {
46209
+ for (const diagnostic of result.diagnostics) options.onDiagnostic?.(diagnostic);
46210
+ hits.push(...result.found.slice(0, limit - hits.length));
46211
+ }
46212
+ if (hits.length >= limit && options.earlyExit !== false) break;
46213
+ }
46214
+ return hits;
46215
+ }
46216
+
45775
46217
  // src/core/project.ts
45776
46218
  import { existsSync } from "node:fs";
45777
- import { dirname as dirname4, join as join4 } from "node:path";
46219
+ import { dirname as dirname5, join as join5 } from "node:path";
45778
46220
  function deriveProject(cwd) {
45779
46221
  if (!cwd) return "(unscoped)";
45780
46222
  if (existsSync(cwd)) {
45781
46223
  let dir = cwd;
45782
46224
  for (let i3 = 0; i3 < 40; i3 += 1) {
45783
- if (existsSync(join4(dir, ".git"))) return dir;
45784
- const parent = dirname4(dir);
46225
+ if (existsSync(join5(dir, ".git"))) return dir;
46226
+ const parent = dirname5(dir);
45785
46227
  if (parent === dir) break;
45786
46228
  dir = parent;
45787
46229
  }
@@ -45798,63 +46240,18 @@ async function discoverSessions(agents = AGENTS, roots = {}) {
45798
46240
  if (agents.includes("codex")) found.push(...await discoverCodex(roots.codex));
45799
46241
  if (agents.includes("chatgpt")) found.push(...await discoverChatGpt(roots.chatgpt));
45800
46242
  if (agents.includes("dsh")) found.push(...await discoverDsh(roots.dsh));
45801
- return found.sort((a2, b3) => a2.agent.localeCompare(b3.agent) || a2.id.localeCompare(b3.id));
45802
- }
45803
- async function parseSession(ref) {
45804
- if (ref.agent === "copilot") return parseCopilot(ref);
45805
- if (ref.agent === "claude") return parseClaude(ref);
45806
- if (ref.agent === "codex") return parseCodex(ref);
45807
- if (ref.agent === "dsh") return parseDsh(ref);
45808
- return parseChatGpt(ref);
46243
+ return sortSessionRefs(await enrichSessionRefs(found));
45809
46244
  }
45810
46245
  async function findSession(id, agents = AGENTS, roots = {}) {
45811
46246
  return findSessionAmong(await discoverSessions(agents, roots), id);
45812
46247
  }
45813
46248
  function findSessionAmong(refs, id) {
45814
- for (const needle of id.startsWith("session-") ? [id] : [id, `session-${id}`]) {
45815
- const found = refs.find((session) => session.id === needle) ?? refs.find((session) => session.id.startsWith(needle));
45816
- if (found) return found;
45817
- }
45818
- return void 0;
45819
- }
45820
- async function searchRefs(refs, query, limit = 20) {
45821
- const hits = [];
45822
- const needle = query.toLowerCase();
45823
- let skipped = 0;
45824
- for (const ref of refs) {
45825
- let parsed;
45826
- try {
45827
- parsed = await parseSession(ref);
45828
- } catch (error) {
45829
- skipped++;
45830
- console.error(`\u8DF3\u8FC7\u65E0\u6CD5\u89E3\u6790\u7684\u4F1A\u8BDD ${ref.path}\uFF1A${error instanceof Error ? error.message : String(error)}`);
45831
- continue;
45832
- }
45833
- if (parsed.agent === "dsh" && parsed.source?.warning) console.error(`\u8BFB\u53D6\u4F1A\u8BDD ${ref.path} \u7684\u8B66\u544A\uFF1A${parsed.source.warning}`);
45834
- for (const entry of parsed.entries) {
45835
- const searchText = timelineEntrySearchText(entry);
45836
- if (!searchText.toLowerCase().includes(needle)) continue;
45837
- hits.push({
45838
- session: {
45839
- agent: parsed.agent,
45840
- id: parsed.id,
45841
- path: parsed.path,
45842
- startedAt: parsed.startedAt,
45843
- updatedAt: parsed.updatedAt,
45844
- cwd: parsed.cwd,
45845
- title: parsed.title,
45846
- repository: parsed.repository,
45847
- branch: parsed.branch,
45848
- source: parsed.source
45849
- },
45850
- entry,
45851
- excerpt: excerpt(searchText, query)
45852
- });
45853
- if (hits.length >= limit) return hits;
45854
- }
45855
- }
45856
- if (skipped > 0) console.error(`\u5DF2\u8DF3\u8FC7 ${skipped} \u4E2A\u65E0\u6CD5\u89E3\u6790\u7684\u4F1A\u8BDD\uFF08\u8BE6\u89C1\u4E0A\u65B9\u5404\u6761\u8DEF\u5F84\u4E0E\u539F\u56E0\uFF09`);
45857
- return hits;
46249
+ if (!id) return void 0;
46250
+ const needles = id.startsWith("session-") ? [id] : [id, `session-${id}`];
46251
+ const exact = refs.filter((session) => needles.includes(session.id));
46252
+ const matches3 = exact.length ? exact : refs.filter((session) => needles.some((needle) => session.id.startsWith(needle)));
46253
+ if (matches3.length > 1) throw new Error(`ambiguous session id: ${id}; use a longer id or --agent/--file`);
46254
+ return matches3[0];
45858
46255
  }
45859
46256
  async function summarizeSession(ref) {
45860
46257
  const parsed = await parseSession(ref);
@@ -45897,18 +46294,18 @@ function detectAgent(rows, path3) {
45897
46294
  let claude = 0;
45898
46295
  for (const row2 of rows.slice(0, 50)) {
45899
46296
  if (!row2 || typeof row2 !== "object") continue;
45900
- const record2 = row2;
45901
- const type = typeof record2.type === "string" ? record2.type : "";
45902
- if ("payload" in record2 && CODEX_TYPES.has(type)) {
46297
+ const record3 = row2;
46298
+ const type = typeof record3.type === "string" ? record3.type : "";
46299
+ if ("payload" in record3 && CODEX_TYPES.has(type)) {
45903
46300
  codex += 1;
45904
- } else if ("data" in record2 && (type.includes(".") || COPILOT_TYPES.has(type))) {
46301
+ } else if ("data" in record3 && (type.includes(".") || COPILOT_TYPES.has(type))) {
45905
46302
  copilot += 1;
45906
- } else if (CLAUDE_TYPES.has(type) && ("message" in record2 || type === "ai-title" || type === "summary")) {
46303
+ } else if (CLAUDE_TYPES.has(type) && ("message" in record3 || type === "ai-title" || type === "summary")) {
45907
46304
  claude += 1;
45908
46305
  }
45909
46306
  }
45910
46307
  if (copilot === 0 && codex === 0 && claude === 0) {
45911
- return path3 && basename7(path3) === "events.jsonl" ? "copilot" : void 0;
46308
+ return path3 && basename8(path3) === "events.jsonl" ? "copilot" : void 0;
45912
46309
  }
45913
46310
  if (copilot >= codex && copilot >= claude) return "copilot";
45914
46311
  if (codex >= claude) return "codex";
@@ -45918,19 +46315,19 @@ function deriveId(path3, agent, rows) {
45918
46315
  if (agent === "copilot") {
45919
46316
  for (const row2 of rows.slice(0, 10)) {
45920
46317
  if (!row2 || typeof row2 !== "object") continue;
45921
- const record2 = row2;
45922
- if (record2.type !== "session.start") continue;
45923
- const data = record2.data ?? {};
46318
+ const record3 = row2;
46319
+ if (record3.type !== "session.start") continue;
46320
+ const data = record3.data ?? {};
45924
46321
  if (typeof data.sessionId === "string" && data.sessionId) return data.sessionId;
45925
46322
  }
45926
- return basename7(path3) === "events.jsonl" ? parentName(path3) : fileStem(path3);
46323
+ return basename8(path3) === "events.jsonl" ? parentName(path3) : fileStem(path3);
45927
46324
  }
45928
46325
  if (agent === "codex") {
45929
46326
  for (const row2 of rows.slice(0, 10)) {
45930
46327
  if (!row2 || typeof row2 !== "object") continue;
45931
- const record2 = row2;
45932
- if (record2.type !== "session_meta") continue;
45933
- const payload = record2.payload ?? {};
46328
+ const record3 = row2;
46329
+ if (record3.type !== "session_meta") continue;
46330
+ const payload = record3.payload ?? {};
45934
46331
  const id = payload.session_id ?? payload.id;
45935
46332
  if (typeof id === "string" && id) return id;
45936
46333
  }
@@ -45995,15 +46392,14 @@ function refFromUrl(value) {
45995
46392
  async function discoverPath(path3, agentOverride) {
45996
46393
  const abs = expandHome(path3);
45997
46394
  if (!await pathExists(abs)) throw new Error(`path not found: ${path3}`);
45998
- const info = await stat2(abs);
45999
- if (info.isFile()) return [await refFromFile(abs, agentOverride)];
46395
+ const info = await stat4(abs);
46396
+ if (info.isFile()) return enrichSessionRefs([await refFromFile(abs, agentOverride)]);
46000
46397
  const files = selectDshGenerations(await walkFiles(
46001
46398
  abs,
46002
46399
  (candidate) => candidate.endsWith(".jsonl") || candidate.endsWith(".chatgpt-share.json") || candidate.endsWith(".jsonl.zstd") && dshLogVersion(candidate) !== void 0
46003
46400
  ));
46004
- const refs = [];
46005
- for (const file of files) refs.push(await refFromFile(file, agentOverride));
46006
- return refs.sort((a2, b3) => a2.agent.localeCompare(b3.agent) || a2.id.localeCompare(b3.id));
46401
+ const refs = await mapConcurrent(files, 8, (file) => dshLogVersion(file) !== void 0 && (!agentOverride || agentOverride === "dsh") ? discoverDshRef(file) : refFromFile(file, agentOverride));
46402
+ return sortSessionRefs(await enrichSessionRefs(refs));
46007
46403
  }
46008
46404
  var LOSSY_SOURCE_WARNING = "\u6570\u636E\u6E90\u56DE\u9000\u5230 db.turns (fallback) \u2014\u2014 \u4EA4\u4E92\u5F0F\u7528\u6237\u51B3\u7B56\u4E0E\u5DE5\u5177\u6761\u76EE\u5728\u6B64\u6A21\u5F0F\u4E0B\u4E0D\u53EF\u6062\u590D";
46009
46405
  function lossySourceWarning(source) {
@@ -46058,7 +46454,7 @@ ${entry.tool.result.log}`);
46058
46454
  }
46059
46455
  const data = entry.data ?? {};
46060
46456
  const stats = [];
46061
- let text9 = entry.text;
46457
+ let text10 = entry.text;
46062
46458
  if (entry.kind === "subagent") {
46063
46459
  stats.push(`name: ${stringifyInline(entry.title ?? data.agentDisplayName ?? data.agentName ?? "(unnamed)")}`);
46064
46460
  if (data.model !== void 0) stats.push(`model: ${stringifyInline(data.model)}`);
@@ -46073,15 +46469,27 @@ ${entry.tool.result.log}`);
46073
46469
  if (data.preTokens !== void 0) stats.push(`tokens: ${stringifyInline(data.preTokens)}`);
46074
46470
  if (data.preMessages !== void 0) stats.push(`messages: ${stringifyInline(data.preMessages)}`);
46075
46471
  if (data.durationMs !== void 0) stats.push(`duration-ms: ${stringifyInline(data.durationMs)}`);
46076
- if (text9) stats.push(`summary:
46077
- ${text9}`);
46078
- text9 = "";
46472
+ if (text10) stats.push(`summary:
46473
+ ${text10}`);
46474
+ text10 = "";
46079
46475
  }
46080
- if (text9) stats.push(text9);
46476
+ if (text10) stats.push(text10);
46081
46477
  return stats.join("\n");
46082
46478
  }
46083
46479
 
46084
46480
  // src/cli/options/common.ts
46481
+ function nonNegativeInteger(value) {
46482
+ if (!/^\d+$/.test(value) || !Number.isSafeInteger(Number(value))) throw new InvalidArgumentError("must be a non-negative integer");
46483
+ return Number(value);
46484
+ }
46485
+ function searchConcurrency(value) {
46486
+ const count = nonNegativeInteger(value);
46487
+ if (count < 1 || count > 32) throw new InvalidArgumentError("must be between 1 and 32");
46488
+ return count;
46489
+ }
46490
+ function withRole(cmd) {
46491
+ return cmd.addOption(new Option("--role <role>", "filter normalized timeline role").choices(["user", "assistant", "tool", "reasoning", "system", "event"]));
46492
+ }
46085
46493
  function withAgent(cmd) {
46086
46494
  return cmd.option("-a, --agent <agent>", "copilot|claude|codex|chatgpt|dsh|all", "all");
46087
46495
  }
@@ -46121,8 +46529,8 @@ function rootsFromOptions(opts) {
46121
46529
  }
46122
46530
  async function resolveRefs(opts) {
46123
46531
  const file = filePathFromOptions(opts);
46124
- if (file) return discoverPath(file, agentOverrideFromOptions(opts));
46125
- return discoverSessions(parseAgents(String(opts.agent ?? "all")), rootsFromOptions(opts));
46532
+ const refs = file ? await discoverPath(file, agentOverrideFromOptions(opts)) : await discoverSessions(parseAgents(String(opts.agent ?? "all")), rootsFromOptions(opts));
46533
+ return filterSessionCwd(refs, typeof opts.cwd === "string" ? opts.cwd : void 0);
46126
46534
  }
46127
46535
  async function resolveOne(id, opts) {
46128
46536
  const file = filePathFromOptions(opts);
@@ -46154,20 +46562,25 @@ async function resolveOne(id, opts) {
46154
46562
  // src/cli/commands/list.ts
46155
46563
  function buildListCommand() {
46156
46564
  const cmd = withReadSource(
46157
- new Command("list").description("List discovered sessions"),
46565
+ new Command("list").description("List discovered sessions, newest file activity first"),
46158
46566
  "read an explicit session file/directory instead of the live agent homes (agent auto-detected)"
46159
46567
  );
46160
- cmd.option("--by <mode>", "group output by project|agent (default: flat list)");
46568
+ cmd.addOption(new Option("--by <mode>", "group output (parses full timelines for entry counts)").choices(["project", "agent"])).addOption(new Option("--sort <field>", "session ordering").choices(["mtime", "id"]).default("mtime")).option("--cwd <path>", "filter exact recorded working directory").option("--json", "print metadata as a JSON array").option("-l, --limit <n>", "maximum sessions to list", nonNegativeInteger);
46161
46569
  cmd.action(async (opts) => {
46162
- const refs = await resolveRefs(opts);
46163
- const by = opts.by === "project" || opts.by === "agent" ? opts.by : void 0;
46570
+ const refs = sortSessionRefs(await resolveRefs(opts), opts.sort).slice(0, opts.limit);
46571
+ const by = opts.by;
46164
46572
  if (!by) {
46165
- for (const session of refs) {
46166
- console.log(`${session.agent} ${session.id} ${session.path}`);
46573
+ if (opts.json) console.log(JSON.stringify(refs, null, 2));
46574
+ else for (const session of refs) {
46575
+ console.log(`${session.agent} ${session.id} ${session.path} ${session.mtime ?? ""} ${session.size ?? ""} ${session.cwd ?? ""}`);
46167
46576
  }
46168
46577
  return;
46169
46578
  }
46170
- const summaries = await Promise.all(refs.map(summarizeSession));
46579
+ const summaries = await mapConcurrent(refs, 4, summarizeSession);
46580
+ if (opts.json) {
46581
+ console.log(JSON.stringify(summaries, null, 2));
46582
+ return;
46583
+ }
46171
46584
  const keyOf = (summary) => by === "project" ? summary.project : summary.ref.agent;
46172
46585
  const groups = /* @__PURE__ */ new Map();
46173
46586
  for (const summary of summaries) {
@@ -46177,7 +46590,7 @@ function buildListCommand() {
46177
46590
  else groups.set(key2, [summary]);
46178
46591
  }
46179
46592
  for (const key2 of [...groups.keys()].sort()) {
46180
- const items = groups.get(key2).sort((a2, b3) => (b3.updatedAt ?? "").localeCompare(a2.updatedAt ?? ""));
46593
+ const items = groups.get(key2);
46181
46594
  console.log(`# ${key2} (${items.length})`);
46182
46595
  for (const summary of items) {
46183
46596
  console.log(`${keyOf(summary)} ${summary.ref.agent} ${summary.ref.id} ${summary.updatedAt ?? ""} ${summary.entryCount}`);
@@ -46187,46 +46600,195 @@ function buildListCommand() {
46187
46600
  return cmd;
46188
46601
  }
46189
46602
 
46603
+ // src/cli/commands/current.ts
46604
+ function buildCurrentCommand() {
46605
+ const cmd = withRoots(new Command("current").description("Print the DSH session identity injected as DSH_SESSION_ID (never guess newest)").option("--json", "resolve and print current session metadata"));
46606
+ cmd.action(async (opts) => {
46607
+ const id = process.env.DSH_SESSION_ID?.trim();
46608
+ if (!id) throw new Error("DSH_SESSION_ID is not set; run inside DSH, or use list --cwd <path> --limit 1 to find the latest (not necessarily current) session");
46609
+ if (opts.json) console.log(JSON.stringify(await resolveOne(id, { ...opts, agent: "dsh" }), null, 2));
46610
+ else console.log(id);
46611
+ });
46612
+ return cmd;
46613
+ }
46614
+
46615
+ // src/cli/commands/search.ts
46616
+ import { homedir as homedir3 } from "node:os";
46617
+ import { join as join6, resolve as resolve3 } from "node:path";
46618
+
46619
+ // src/core/search-worker.ts
46620
+ import { Worker, isMainThread, parentPort, workerData } from "node:worker_threads";
46621
+ var PROTOCOL = "asmgr-search-1";
46622
+ var isSearchWorker = !isMainThread && workerData?.protocol === PROTOCOL;
46623
+ if (isSearchWorker) {
46624
+ parentPort.on("message", async (ref) => {
46625
+ const result = await scanSession(ref, workerData.query, workerData.limit, workerData.options);
46626
+ parentPort.postMessage(result);
46627
+ });
46628
+ }
46629
+ var SearchWorkerPool = class {
46630
+ constructor(count, query, limit, options) {
46631
+ this.count = count;
46632
+ this.query = query;
46633
+ this.limit = limit;
46634
+ this.options = options;
46635
+ }
46636
+ count;
46637
+ query;
46638
+ limit;
46639
+ options;
46640
+ slots = [];
46641
+ failed = false;
46642
+ closing = false;
46643
+ get backend() {
46644
+ return this.failed ? "in-process fallback" : `workers (${this.slots.length})`;
46645
+ }
46646
+ scan = async (ref) => {
46647
+ if (this.failed || this.closing) return scanSession(ref, this.query, this.limit, this.options);
46648
+ let slot = this.slots.find((candidate) => !candidate.busy);
46649
+ try {
46650
+ if (!slot) {
46651
+ if (this.slots.length >= this.count) throw new Error("search pool exceeded bounded concurrency");
46652
+ const worker = new Worker(new URL(import.meta.url), {
46653
+ workerData: { protocol: PROTOCOL, query: this.query, limit: this.limit, options: this.options }
46654
+ });
46655
+ slot = { worker, busy: false };
46656
+ const created = slot;
46657
+ worker.on("message", (result) => {
46658
+ created.resolve?.(result);
46659
+ created.resolve = void 0;
46660
+ created.reject = void 0;
46661
+ created.busy = false;
46662
+ });
46663
+ worker.on("error", (error) => {
46664
+ this.failed = true;
46665
+ created.reject?.(error);
46666
+ created.resolve = void 0;
46667
+ created.reject = void 0;
46668
+ created.busy = false;
46669
+ });
46670
+ worker.on("exit", (code4) => {
46671
+ if (!this.closing) this.failed = true;
46672
+ created.reject?.(new Error(`search worker exited (${code4})`));
46673
+ created.reject = void 0;
46674
+ created.resolve = void 0;
46675
+ created.busy = false;
46676
+ });
46677
+ this.slots.push(slot);
46678
+ }
46679
+ const selected = slot;
46680
+ selected.busy = true;
46681
+ return await new Promise((resolve13, reject) => {
46682
+ selected.resolve = resolve13;
46683
+ selected.reject = reject;
46684
+ selected.worker.postMessage(ref);
46685
+ });
46686
+ } catch {
46687
+ this.failed = true;
46688
+ return scanSession(ref, this.query, this.limit, this.options);
46689
+ }
46690
+ };
46691
+ async close() {
46692
+ this.closing = true;
46693
+ await Promise.all(this.slots.map((slot) => slot.worker.terminate()));
46694
+ this.slots = [];
46695
+ }
46696
+ };
46697
+
46698
+ // src/cli/util/search-diagnostics.ts
46699
+ var SearchDiagnosticReporter = class {
46700
+ constructor(quiet = false, verbose = false) {
46701
+ this.quiet = quiet;
46702
+ this.verbose = verbose;
46703
+ }
46704
+ quiet;
46705
+ verbose;
46706
+ skipped = 0;
46707
+ omitted = 0;
46708
+ examples = [];
46709
+ warnings = /* @__PURE__ */ new Map();
46710
+ observe = (diagnostic) => {
46711
+ if (this.quiet) return;
46712
+ const { kind, session, code: code4, message } = diagnostic;
46713
+ if (kind === "notice" && !this.verbose) return;
46714
+ if (this.verbose) console.error(`${kind}: ${session.path}\uFF1A${message}`);
46715
+ if (kind === "unreadable") {
46716
+ this.skipped++;
46717
+ if (this.examples.length < 3) this.examples.push(`${session.path}\uFF1A${message}`);
46718
+ } else {
46719
+ const key2 = `${kind}:${code4}:${message}`;
46720
+ const previous4 = this.warnings.get(key2);
46721
+ if (previous4) previous4.sessions.add(session.path);
46722
+ else if (this.warnings.size < 50) this.warnings.set(key2, { message, sessions: /* @__PURE__ */ new Set([session.path]) });
46723
+ else this.omitted++;
46724
+ }
46725
+ };
46726
+ finish() {
46727
+ if (this.quiet) return;
46728
+ if (this.skipped) console.error(`\u8DF3\u8FC7\u65E0\u6CD5\u89E3\u6790\u7684\u4F1A\u8BDD\uFF1A${this.skipped} \u4E2A\u3002${this.examples.join("\uFF1B")}\uFF08--verbose \u67E5\u770B\u9010\u6761\u8BE6\u60C5\uFF09`);
46729
+ for (const { message, sessions } of this.warnings.values()) console.error(`${sessions.size} \u4E2A\u4F1A\u8BDD\uFF1A${message}`);
46730
+ if (this.omitted) console.error(`\u53E6\u6709 ${this.omitted} \u6761\u8BCA\u65AD\u8D85\u51FA\u6458\u8981\u4E0A\u9650\uFF1B--verbose \u67E5\u770B\u9010\u6761\u8BE6\u60C5`);
46731
+ }
46732
+ };
46733
+
46190
46734
  // src/cli/commands/search.ts
46191
46735
  function buildSearchCommand() {
46192
- const cmd = new Command("search").argument("<query>").description("Search timeline text across sessions or within one session");
46193
- withAgent(cmd).option("--session <id>", "restrict search to one session id or prefix").option("-l, --limit <n>", "maximum hits", "20");
46736
+ const cmd = new Command("search").argument("<query>").description("Search timeline text, newest sessions first (bounded read-ahead)");
46737
+ withRole(withAgent(cmd)).option("--session <id>", "restrict search to one session id or unambiguous prefix").option("--cwd <path>", "filter exact recorded working directory").option("-l, --limit <n>", "maximum hits; stop scheduling at this cap (0: no search)", nonNegativeInteger, 20).option("--no-early-exit", "scan all sessions even after reaching the output cap").option("--no-cache", "do not read or write derived transcript caches").option("--cache-dir <path>", "cache root (default: ASMGR_CACHE_HOME or XDG_CACHE_HOME/asmgr)").option("-j, --concurrency <n>", "maximum simultaneous session reads (1-32)", searchConcurrency, 2).option("-q, --quiet", "suppress search diagnostics").option("--verbose", "include per-session diagnostics and attachment notices");
46194
46738
  withSource(cmd, "search an explicit session file/directory (e.g. a restic-restored backup cache)");
46195
46739
  withRoots(cmd);
46196
46740
  cmd.action(async (query, opts) => {
46741
+ if (!String(query).trim()) throw new Error("search query must not be empty");
46742
+ if (opts.limit === 0) return;
46197
46743
  const refs = await resolveRefs(opts);
46198
- const sessionId = typeof opts.session === "string" ? opts.session : void 0;
46199
46744
  let scopedRefs = refs;
46200
- if (sessionId) {
46201
- const session = findSessionAmong(refs, sessionId);
46202
- if (!session) throw new Error(`session not found: ${sessionId}`);
46745
+ if (opts.session) {
46746
+ const session = findSessionAmong(refs, opts.session);
46747
+ if (!session) throw new Error(`session not found: ${opts.session}`);
46203
46748
  scopedRefs = [session];
46204
46749
  }
46205
- const hits = await searchRefs(scopedRefs, query, Number(opts.limit));
46206
- for (const hit of hits) {
46207
- console.log(`${deriveProject(hit.session.cwd)} ${hit.session.agent} ${hit.session.id} #${hit.entry.index + 1} ${hit.entry.role}/${hit.entry.kind} ${hit.excerpt}`);
46750
+ const diagnostics = new SearchDiagnosticReporter(opts.quiet, opts.verbose);
46751
+ const cacheDir = opts.cache ? resolve3(expandHome(opts.cacheDir || process.env.ASMGR_CACHE_HOME || join6(process.env.XDG_CACHE_HOME || join6(homedir3(), ".cache"), "asmgr"))) : void 0;
46752
+ const readOptions = { role: opts.role, cacheDir };
46753
+ const pool = opts.concurrency > 1 && scopedRefs.length > 1 ? new SearchWorkerPool(Math.min(opts.concurrency, scopedRefs.length), query, opts.limit, readOptions) : void 0;
46754
+ try {
46755
+ const hits = await searchRefs(scopedRefs, query, opts.limit, {
46756
+ ...readOptions,
46757
+ concurrency: opts.concurrency,
46758
+ earlyExit: opts.earlyExit,
46759
+ scanSession: pool?.scan,
46760
+ onDiagnostic: diagnostics.observe
46761
+ });
46762
+ if (opts.verbose && !opts.quiet) console.error(`search backend: ${pool?.backend ?? "in-process"}; cache: ${cacheDir ? cacheDir : "disabled"}`);
46763
+ diagnostics.finish();
46764
+ for (const hit of hits) {
46765
+ console.log(`${deriveProject(hit.session.cwd)} ${hit.session.agent} ${hit.session.id} #${hit.entry.index + 1} ${hit.entry.role}/${hit.entry.kind} ${hit.excerpt}`);
46766
+ }
46767
+ } finally {
46768
+ await pool?.close();
46208
46769
  }
46209
46770
  });
46210
46771
  return cmd;
46211
46772
  }
46212
46773
 
46213
46774
  // src/cli/commands/show.ts
46214
- import { mkdir, writeFile } from "node:fs/promises";
46215
- import { dirname as dirname5, resolve } from "node:path";
46775
+ import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
46776
+ import { dirname as dirname6, resolve as resolve4 } from "node:path";
46216
46777
  function buildShowCommand() {
46217
46778
  const cmd = new Command("show").argument("[session-id-or-url]", "\u4F1A\u8BDD ID \u6216 ChatGPT \u516C\u5F00\u5206\u4EAB\u94FE\u63A5\uFF08--file \u53EA\u6709\u4E00\u4E2A\u4F1A\u8BDD\u65F6\u53EF\u7701\u7565\uFF09").description("Print a session as text, dialogue, or JSON");
46218
- withAgent(cmd).option("-f, --format <format>", "text|dialogue|json", "text").option("-o, --out <path>", "output file (default: stdout)");
46779
+ withRole(withAgent(cmd)).option("-f, --format <format>", "text|dialogue|json", "text").option("-o, --out <path>", "output file (default: stdout)");
46219
46780
  withSource(cmd, "read an explicit session file/directory instead of the live agent homes");
46220
46781
  withRoots(cmd);
46221
46782
  cmd.action(async (id, opts) => {
46222
46783
  const ref = await resolveOne(id, opts);
46223
- const session = await parseSession(ref);
46784
+ const parsed = await parseSession(ref);
46785
+ const session = opts.role ? { ...parsed, entries: parsed.entries.filter((entry) => entry.role === opts.role) } : parsed;
46224
46786
  const output = opts.format === "json" ? `${JSON.stringify(session, null, 2)}
46225
46787
  ` : opts.format === "dialogue" ? sessionToDialogue(session) : sessionToText(session);
46226
46788
  if (opts.out) {
46227
- const out = resolve(String(opts.out));
46228
- await mkdir(dirname5(out), { recursive: true });
46229
- await writeFile(out, output, "utf8");
46789
+ const out = resolve4(String(opts.out));
46790
+ await mkdir2(dirname6(out), { recursive: true });
46791
+ await writeFile2(out, output, "utf8");
46230
46792
  console.log(out);
46231
46793
  } else {
46232
46794
  process.stdout.write(output);
@@ -46236,8 +46798,8 @@ function buildShowCommand() {
46236
46798
  }
46237
46799
 
46238
46800
  // src/cli/commands/html.ts
46239
- import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
46240
- import { dirname as dirname6, resolve as resolve3 } from "node:path";
46801
+ import { mkdir as mkdir3, writeFile as writeFile3 } from "node:fs/promises";
46802
+ import { dirname as dirname7, resolve as resolve6 } from "node:path";
46241
46803
 
46242
46804
  // src/html/index.tsx
46243
46805
  var import_server = __toESM(require_server_node());
@@ -46525,7 +47087,7 @@ function one(state, node2, key2) {
46525
47087
  return root(state, node2, key2);
46526
47088
  }
46527
47089
  if (node2.type === "text") {
46528
- return text(state, node2);
47090
+ return text2(state, node2);
46529
47091
  }
46530
47092
  }
46531
47093
  function element(state, node2, key2) {
@@ -46593,7 +47155,7 @@ function root(state, node2, key2) {
46593
47155
  addChildren(props, createChildren(state, node2));
46594
47156
  return state.create(node2, state.Fragment, props, key2);
46595
47157
  }
46596
- function text(_3, node2) {
47158
+ function text2(_3, node2) {
46597
47159
  return node2.value;
46598
47160
  }
46599
47161
  function addNode(state, props, type, node2) {
@@ -49470,10 +50032,10 @@ function resolveAll(constructs2, events, context) {
49470
50032
  const called = [];
49471
50033
  let index2 = -1;
49472
50034
  while (++index2 < constructs2.length) {
49473
- const resolve10 = constructs2[index2].resolveAll;
49474
- if (resolve10 && !called.includes(resolve10)) {
49475
- events = resolve10(events, context);
49476
- called.push(resolve10);
50035
+ const resolve13 = constructs2[index2].resolveAll;
50036
+ if (resolve13 && !called.includes(resolve13)) {
50037
+ events = resolve13(events, context);
50038
+ called.push(resolve13);
49477
50039
  }
49478
50040
  }
49479
50041
  return events;
@@ -49489,7 +50051,7 @@ function resolveAllAttention(events, context) {
49489
50051
  let index2 = -1;
49490
50052
  let open2;
49491
50053
  let group;
49492
- let text9;
50054
+ let text10;
49493
50055
  let openingSequence;
49494
50056
  let closingSequence;
49495
50057
  let use;
@@ -49527,7 +50089,7 @@ function resolveAllAttention(events, context) {
49527
50089
  },
49528
50090
  end
49529
50091
  };
49530
- text9 = {
50092
+ text10 = {
49531
50093
  type: use > 1 ? "strongText" : "emphasisText",
49532
50094
  start: {
49533
50095
  ...events[open2][1].end
@@ -49555,9 +50117,9 @@ function resolveAllAttention(events, context) {
49555
50117
  if (events[open2][1].end.offset - events[open2][1].start.offset) {
49556
50118
  nextEvents = push(nextEvents, [["enter", events[open2][1], context], ["exit", events[open2][1], context]]);
49557
50119
  }
49558
- nextEvents = push(nextEvents, [["enter", group, context], ["enter", openingSequence, context], ["exit", openingSequence, context], ["enter", text9, context]]);
50120
+ nextEvents = push(nextEvents, [["enter", group, context], ["enter", openingSequence, context], ["exit", openingSequence, context], ["enter", text10, context]]);
49559
50121
  nextEvents = push(nextEvents, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open2 + 1, index2), context));
49560
- nextEvents = push(nextEvents, [["exit", text9, context], ["enter", closingSequence, context], ["exit", closingSequence, context], ["exit", group, context]]);
50122
+ nextEvents = push(nextEvents, [["exit", text10, context], ["enter", closingSequence, context], ["exit", closingSequence, context], ["exit", group, context]]);
49561
50123
  if (events[index2][1].end.offset - events[index2][1].start.offset) {
49562
50124
  offset = 2;
49563
50125
  nextEvents = push(nextEvents, [["enter", events[index2][1], context], ["exit", events[index2][1], context]]);
@@ -51005,7 +51567,7 @@ function resolveHeadingAtx(events, context) {
51005
51567
  let contentEnd = events.length - 2;
51006
51568
  let contentStart = 3;
51007
51569
  let content3;
51008
- let text9;
51570
+ let text10;
51009
51571
  if (events[contentStart][1].type === "whitespace") {
51010
51572
  contentStart += 2;
51011
51573
  }
@@ -51021,13 +51583,13 @@ function resolveHeadingAtx(events, context) {
51021
51583
  start: events[contentStart][1].start,
51022
51584
  end: events[contentEnd][1].end
51023
51585
  };
51024
- text9 = {
51586
+ text10 = {
51025
51587
  type: "chunkText",
51026
51588
  start: events[contentStart][1].start,
51027
51589
  end: events[contentEnd][1].end,
51028
51590
  contentType: "text"
51029
51591
  };
51030
- splice(events, contentStart, contentEnd - contentStart + 1, [["enter", content3, context], ["enter", text9, context], ["exit", text9, context], ["exit", content3, context]]);
51592
+ splice(events, contentStart, contentEnd - contentStart + 1, [["enter", content3, context], ["enter", text10, context], ["exit", text10, context], ["exit", content3, context]]);
51031
51593
  }
51032
51594
  return events;
51033
51595
  }
@@ -51917,7 +52479,7 @@ function resolveToLabelEnd(events, context) {
51917
52479
  ...events[close2][1].end
51918
52480
  }
51919
52481
  };
51920
- const text9 = {
52482
+ const text10 = {
51921
52483
  type: "labelText",
51922
52484
  start: {
51923
52485
  ...events[open2 + offset + 2][1].end
@@ -51928,9 +52490,9 @@ function resolveToLabelEnd(events, context) {
51928
52490
  };
51929
52491
  media = [["enter", group, context], ["enter", label, context]];
51930
52492
  media = push(media, events.slice(open2 + 1, open2 + offset + 3));
51931
- media = push(media, [["enter", text9, context]]);
52493
+ media = push(media, [["enter", text10, context]]);
51932
52494
  media = push(media, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open2 + offset + 4, close2 - 3), context));
51933
- media = push(media, [["exit", text9, context], events[close2 - 2], events[close2 - 1], ["exit", label, context]]);
52495
+ media = push(media, [["exit", text10, context], events[close2 - 2], events[close2 - 1], ["exit", label, context]]);
51934
52496
  media = push(media, events.slice(close2 + 1));
51935
52497
  media = push(media, [["exit", group, context]]);
51936
52498
  splice(events, open2, events.length, media);
@@ -52310,7 +52872,7 @@ var setextUnderline = {
52310
52872
  function resolveToSetextUnderline(events, context) {
52311
52873
  let index2 = events.length;
52312
52874
  let content3;
52313
- let text9;
52875
+ let text10;
52314
52876
  let definition3;
52315
52877
  while (index2--) {
52316
52878
  if (events[index2][0] === "enter") {
@@ -52319,7 +52881,7 @@ function resolveToSetextUnderline(events, context) {
52319
52881
  break;
52320
52882
  }
52321
52883
  if (events[index2][1].type === "paragraph") {
52322
- text9 = index2;
52884
+ text10 = index2;
52323
52885
  }
52324
52886
  } else {
52325
52887
  if (events[index2][1].type === "content") {
@@ -52339,9 +52901,9 @@ function resolveToSetextUnderline(events, context) {
52339
52901
  ...events[events.length - 1][1].end
52340
52902
  }
52341
52903
  };
52342
- events[text9][1].type = "setextHeadingText";
52904
+ events[text10][1].type = "setextHeadingText";
52343
52905
  if (definition3) {
52344
- events.splice(text9, 0, ["enter", heading4, context]);
52906
+ events.splice(text10, 0, ["enter", heading4, context]);
52345
52907
  events.splice(definition3 + 1, 0, ["exit", events[content3][1], context]);
52346
52908
  events[content3][1].end = {
52347
52909
  ...events[definition3][1].end
@@ -52436,7 +52998,7 @@ var resolver = {
52436
52998
  resolveAll: createResolver()
52437
52999
  };
52438
53000
  var string = initializeFactory("string");
52439
- var text2 = initializeFactory("text");
53001
+ var text3 = initializeFactory("text");
52440
53002
  function initializeFactory(field) {
52441
53003
  return {
52442
53004
  resolveAll: createResolver(field === "text" ? resolveAllLineSuffixes : void 0),
@@ -52445,10 +53007,10 @@ function initializeFactory(field) {
52445
53007
  function initializeText(effects) {
52446
53008
  const self2 = this;
52447
53009
  const constructs2 = this.parser.constructs[field];
52448
- const text9 = effects.attempt(constructs2, start2, notText);
53010
+ const text10 = effects.attempt(constructs2, start2, notText);
52449
53011
  return start2;
52450
53012
  function start2(code4) {
52451
- return atBreak(code4) ? text9(code4) : notText(code4);
53013
+ return atBreak(code4) ? text10(code4) : notText(code4);
52452
53014
  }
52453
53015
  function notText(code4) {
52454
53016
  if (code4 === null) {
@@ -52462,7 +53024,7 @@ function initializeFactory(field) {
52462
53024
  function data(code4) {
52463
53025
  if (atBreak(code4)) {
52464
53026
  effects.exit("data");
52465
- return text9(code4);
53027
+ return text10(code4);
52466
53028
  }
52467
53029
  effects.consume(code4);
52468
53030
  return data;
@@ -52581,7 +53143,7 @@ __export(constructs_exports, {
52581
53143
  flowInitial: () => flowInitial,
52582
53144
  insideSpan: () => insideSpan,
52583
53145
  string: () => string2,
52584
- text: () => text3
53146
+ text: () => text4
52585
53147
  });
52586
53148
  var document3 = {
52587
53149
  [42]: list,
@@ -52621,7 +53183,7 @@ var string2 = {
52621
53183
  [38]: characterReference,
52622
53184
  [92]: characterEscape
52623
53185
  };
52624
- var text3 = {
53186
+ var text4 = {
52625
53187
  [-5]: lineEnding,
52626
53188
  [-4]: lineEnding,
52627
53189
  [-3]: lineEnding,
@@ -52983,7 +53545,7 @@ function parse3(options) {
52983
53545
  flow: create2(flow),
52984
53546
  lazy: {},
52985
53547
  string: create2(string),
52986
- text: create2(text2)
53548
+ text: create2(text3)
52987
53549
  };
52988
53550
  return parser;
52989
53551
  function create2(initial) {
@@ -53484,7 +54046,7 @@ function compiler(options) {
53484
54046
  const siblings2 = node2.children;
53485
54047
  let tail = siblings2[siblings2.length - 1];
53486
54048
  if (!tail || tail.type !== "text") {
53487
- tail = text9();
54049
+ tail = text10();
53488
54050
  tail.position = {
53489
54051
  start: point3(token2.start),
53490
54052
  // @ts-expect-error: we’ll add `end` later.
@@ -53729,7 +54291,7 @@ function compiler(options) {
53729
54291
  children: []
53730
54292
  };
53731
54293
  }
53732
- function text9() {
54294
+ function text10() {
53733
54295
  return {
53734
54296
  type: "text",
53735
54297
  value: ""
@@ -54012,13 +54574,13 @@ function image(state, node2) {
54012
54574
 
54013
54575
  // node_modules/.pnpm/mdast-util-to-hast@13.2.1/node_modules/mdast-util-to-hast/lib/handlers/inline-code.js
54014
54576
  function inlineCode(state, node2) {
54015
- const text9 = { type: "text", value: node2.value.replace(/\r?\n|\r/g, " ") };
54016
- state.patch(node2, text9);
54577
+ const text10 = { type: "text", value: node2.value.replace(/\r?\n|\r/g, " ") };
54578
+ state.patch(node2, text10);
54017
54579
  const result = {
54018
54580
  type: "element",
54019
54581
  tagName: "code",
54020
54582
  properties: {},
54021
- children: [text9]
54583
+ children: [text10]
54022
54584
  };
54023
54585
  state.patch(node2, result);
54024
54586
  return state.applyData(node2, result);
@@ -54305,7 +54867,7 @@ function trimLine(value, start2, end) {
54305
54867
  }
54306
54868
 
54307
54869
  // node_modules/.pnpm/mdast-util-to-hast@13.2.1/node_modules/mdast-util-to-hast/lib/handlers/text.js
54308
- function text4(state, node2) {
54870
+ function text5(state, node2) {
54309
54871
  const result = { type: "text", value: trimLines(String(node2.value)) };
54310
54872
  state.patch(node2, result);
54311
54873
  return state.applyData(node2, result);
@@ -54347,7 +54909,7 @@ var handlers = {
54347
54909
  table,
54348
54910
  tableCell,
54349
54911
  tableRow,
54350
- text: text4,
54912
+ text: text5,
54351
54913
  thematicBreak: thematicBreak2,
54352
54914
  toml: ignore,
54353
54915
  yaml: ignore,
@@ -55283,10 +55845,10 @@ var VFile = class {
55283
55845
  * @returns {undefined}
55284
55846
  * Nothing.
55285
55847
  */
55286
- set basename(basename9) {
55287
- assertNonEmpty(basename9, "basename");
55288
- assertPart(basename9, "basename");
55289
- this.path = default2.join(this.dirname || "", basename9);
55848
+ set basename(basename10) {
55849
+ assertNonEmpty(basename10, "basename");
55850
+ assertPart(basename10, "basename");
55851
+ this.path = default2.join(this.dirname || "", basename10);
55290
55852
  }
55291
55853
  /**
55292
55854
  * Get the parent path (example: `'~'`).
@@ -55307,9 +55869,9 @@ var VFile = class {
55307
55869
  * @returns {undefined}
55308
55870
  * Nothing.
55309
55871
  */
55310
- set dirname(dirname10) {
55872
+ set dirname(dirname11) {
55311
55873
  assertPath(this.basename, "dirname");
55312
- this.path = default2.join(dirname10 || "", this.basename);
55874
+ this.path = default2.join(dirname11 || "", this.basename);
55313
55875
  }
55314
55876
  /**
55315
55877
  * Get the extname (including dot) (example: `'.js'`).
@@ -55908,7 +56470,7 @@ var Processor = class _Processor extends CallableInstance {
55908
56470
  assertParser("process", this.parser || this.Parser);
55909
56471
  assertCompiler("process", this.compiler || this.Compiler);
55910
56472
  return done ? executor(void 0, done) : new Promise(executor);
55911
- function executor(resolve10, reject) {
56473
+ function executor(resolve13, reject) {
55912
56474
  const realFile = vfile(file);
55913
56475
  const parseTree3 = (
55914
56476
  /** @type {HeadTree extends undefined ? Node : HeadTree} */
@@ -55939,8 +56501,8 @@ var Processor = class _Processor extends CallableInstance {
55939
56501
  function realDone(error, file2) {
55940
56502
  if (error || !file2) {
55941
56503
  reject(error);
55942
- } else if (resolve10) {
55943
- resolve10(file2);
56504
+ } else if (resolve13) {
56505
+ resolve13(file2);
55944
56506
  } else {
55945
56507
  ok(done, "`done` is defined if `resolve` is not");
55946
56508
  done(void 0, file2);
@@ -56042,7 +56604,7 @@ var Processor = class _Processor extends CallableInstance {
56042
56604
  file = void 0;
56043
56605
  }
56044
56606
  return done ? executor(void 0, done) : new Promise(executor);
56045
- function executor(resolve10, reject) {
56607
+ function executor(resolve13, reject) {
56046
56608
  ok(
56047
56609
  typeof file !== "function",
56048
56610
  "`file` can\u2019t be a `done` anymore, we checked"
@@ -56056,8 +56618,8 @@ var Processor = class _Processor extends CallableInstance {
56056
56618
  );
56057
56619
  if (error) {
56058
56620
  reject(error);
56059
- } else if (resolve10) {
56060
- resolve10(resultingTree);
56621
+ } else if (resolve13) {
56622
+ resolve13(resultingTree);
56061
56623
  } else {
56062
56624
  ok(done, "`done` is defined if `resolve` is not");
56063
56625
  done(void 0, resultingTree, file2);
@@ -56548,13 +57110,13 @@ function isChild(value) {
56548
57110
  return true;
56549
57111
  }
56550
57112
  if (typeof value.type !== "string") return false;
56551
- const record2 = (
57113
+ const record3 = (
56552
57114
  /** @type {Record<string, unknown>} */
56553
57115
  value
56554
57116
  );
56555
57117
  const keys2 = Object.keys(value);
56556
57118
  for (const key2 of keys2) {
56557
- const value2 = record2[key2];
57119
+ const value2 = record3[key2];
56558
57120
  if (value2 && typeof value2 === "object") {
56559
57121
  if (!Array.isArray(value2)) return true;
56560
57122
  const list4 = (
@@ -61327,22 +61889,22 @@ var defaultTreeAdapter = {
61327
61889
  node2.parentNode = null;
61328
61890
  }
61329
61891
  },
61330
- insertText(parentNode, text9) {
61892
+ insertText(parentNode, text10) {
61331
61893
  if (parentNode.childNodes.length > 0) {
61332
61894
  const prevNode = parentNode.childNodes[parentNode.childNodes.length - 1];
61333
61895
  if (defaultTreeAdapter.isTextNode(prevNode)) {
61334
- prevNode.value += text9;
61896
+ prevNode.value += text10;
61335
61897
  return;
61336
61898
  }
61337
61899
  }
61338
- defaultTreeAdapter.appendChild(parentNode, defaultTreeAdapter.createTextNode(text9));
61900
+ defaultTreeAdapter.appendChild(parentNode, defaultTreeAdapter.createTextNode(text10));
61339
61901
  },
61340
- insertTextBefore(parentNode, text9, referenceNode) {
61902
+ insertTextBefore(parentNode, text10, referenceNode) {
61341
61903
  const prevNode = parentNode.childNodes[parentNode.childNodes.indexOf(referenceNode) - 1];
61342
61904
  if (prevNode && defaultTreeAdapter.isTextNode(prevNode)) {
61343
- prevNode.value += text9;
61905
+ prevNode.value += text10;
61344
61906
  } else {
61345
- defaultTreeAdapter.insertBefore(parentNode, defaultTreeAdapter.createTextNode(text9), referenceNode);
61907
+ defaultTreeAdapter.insertBefore(parentNode, defaultTreeAdapter.createTextNode(text10), referenceNode);
61346
61908
  }
61347
61909
  },
61348
61910
  adoptAttributes(recipient, attrs) {
@@ -65584,15 +66146,15 @@ function collectText(node2, info) {
65584
66146
  start2 = end + 1;
65585
66147
  }
65586
66148
  let index2 = -1;
65587
- let join6;
66149
+ let join8;
65588
66150
  while (++index2 < lines.length) {
65589
66151
  if (lines[index2].charCodeAt(lines[index2].length - 1) === 8203 || index2 < lines.length - 1 && lines[index2 + 1].charCodeAt(0) === 8203) {
65590
66152
  result.push(lines[index2]);
65591
- join6 = void 0;
66153
+ join8 = void 0;
65592
66154
  } else if (lines[index2]) {
65593
- if (typeof join6 === "number") result.push(join6);
66155
+ if (typeof join8 === "number") result.push(join8);
65594
66156
  result.push(lines[index2]);
65595
- join6 = 0;
66157
+ join8 = 0;
65596
66158
  } else if (index2 === 0 || index2 === lines.length - 1) {
65597
66159
  result.push(0);
65598
66160
  }
@@ -65715,7 +66277,7 @@ var ESCAPE_LOOKUP = {
65715
66277
  "'": "&#x27;"
65716
66278
  };
65717
66279
  var ESCAPE_REGEX = /[&><"']/g;
65718
- var escape = (text9) => String(text9).replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match]);
66280
+ var escape = (text10) => String(text10).replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match]);
65719
66281
  var getBaseElem = (group) => {
65720
66282
  if (group.type === "ordgroup") {
65721
66283
  if (group.body.length === 1) {
@@ -66590,7 +67152,7 @@ var iCombinations = {
66590
67152
  "\xEC": "\u0131\u0300"
66591
67153
  };
66592
67154
  var SymbolNode = class {
66593
- constructor(text9, height, depth, italic2, skew, width, classes, style2) {
67155
+ constructor(text10, height, depth, italic2, skew, width, classes, style2) {
66594
67156
  this.text = void 0;
66595
67157
  this.height = void 0;
66596
67158
  this.depth = void 0;
@@ -66600,7 +67162,7 @@ var SymbolNode = class {
66600
67162
  this.maxFontSize = void 0;
66601
67163
  this.classes = void 0;
66602
67164
  this.style = void 0;
66603
- this.text = text9;
67165
+ this.text = text10;
66604
67166
  this.height = height || 0;
66605
67167
  this.depth = depth || 0;
66606
67168
  this.italic = italic2 || 0;
@@ -69068,7 +69630,7 @@ function defineSymbol(mode, font, group, replace2, name2, acceptUnicodeChar) {
69068
69630
  }
69069
69631
  }
69070
69632
  var math = "math";
69071
- var text5 = "text";
69633
+ var text6 = "text";
69072
69634
  var main = "main";
69073
69635
  var ams = "ams";
69074
69636
  var accent = "accent-token";
@@ -69109,11 +69671,11 @@ defineSymbol(math, main, rel, "\u220B", "\\owns");
69109
69671
  defineSymbol(math, main, punct, ".", "\\ldotp");
69110
69672
  defineSymbol(math, main, punct, "\u22C5", "\\cdotp");
69111
69673
  defineSymbol(math, main, punct, "\u22C5", "\xB7");
69112
- defineSymbol(text5, main, textord, "\u22C5", "\xB7");
69674
+ defineSymbol(text6, main, textord, "\u22C5", "\xB7");
69113
69675
  defineSymbol(math, main, textord, "#", "\\#");
69114
- defineSymbol(text5, main, textord, "#", "\\#");
69676
+ defineSymbol(text6, main, textord, "#", "\\#");
69115
69677
  defineSymbol(math, main, textord, "&", "\\&");
69116
- defineSymbol(text5, main, textord, "&", "\\&");
69678
+ defineSymbol(text6, main, textord, "&", "\\&");
69117
69679
  defineSymbol(math, main, textord, "\u2135", "\\aleph", true);
69118
69680
  defineSymbol(math, main, textord, "\u2200", "\\forall", true);
69119
69681
  defineSymbol(math, main, textord, "\u210F", "\\hbar", true);
@@ -69131,15 +69693,15 @@ defineSymbol(math, main, textord, "\u2661", "\\heartsuit", true);
69131
69693
  defineSymbol(math, main, textord, "\u2111", "\\Im", true);
69132
69694
  defineSymbol(math, main, textord, "\u2660", "\\spadesuit", true);
69133
69695
  defineSymbol(math, main, textord, "\xA7", "\\S", true);
69134
- defineSymbol(text5, main, textord, "\xA7", "\\S");
69696
+ defineSymbol(text6, main, textord, "\xA7", "\\S");
69135
69697
  defineSymbol(math, main, textord, "\xB6", "\\P", true);
69136
- defineSymbol(text5, main, textord, "\xB6", "\\P");
69698
+ defineSymbol(text6, main, textord, "\xB6", "\\P");
69137
69699
  defineSymbol(math, main, textord, "\u2020", "\\dag");
69138
- defineSymbol(text5, main, textord, "\u2020", "\\dag");
69139
- defineSymbol(text5, main, textord, "\u2020", "\\textdagger");
69700
+ defineSymbol(text6, main, textord, "\u2020", "\\dag");
69701
+ defineSymbol(text6, main, textord, "\u2020", "\\textdagger");
69140
69702
  defineSymbol(math, main, textord, "\u2021", "\\ddag");
69141
- defineSymbol(text5, main, textord, "\u2021", "\\ddag");
69142
- defineSymbol(text5, main, textord, "\u2021", "\\textdaggerdbl");
69703
+ defineSymbol(text6, main, textord, "\u2021", "\\ddag");
69704
+ defineSymbol(text6, main, textord, "\u2021", "\\textdaggerdbl");
69143
69705
  defineSymbol(math, main, close, "\u23B1", "\\rmoustache", true);
69144
69706
  defineSymbol(math, main, open, "\u23B0", "\\lmoustache", true);
69145
69707
  defineSymbol(math, main, close, "\u27EF", "\\rgroup", true);
@@ -69243,7 +69805,7 @@ defineSymbol(math, ams, textord, "\u25BD", "\\triangledown");
69243
69805
  defineSymbol(math, ams, textord, "\u25CA", "\\lozenge");
69244
69806
  defineSymbol(math, ams, textord, "\u24C8", "\\circledS");
69245
69807
  defineSymbol(math, ams, textord, "\xAE", "\\circledR");
69246
- defineSymbol(text5, ams, textord, "\xAE", "\\circledR");
69808
+ defineSymbol(text6, ams, textord, "\xAE", "\\circledR");
69247
69809
  defineSymbol(math, ams, textord, "\u2221", "\\measuredangle", true);
69248
69810
  defineSymbol(math, ams, textord, "\u2204", "\\nexists");
69249
69811
  defineSymbol(math, ams, textord, "\u2127", "\\mho");
@@ -69258,16 +69820,16 @@ defineSymbol(math, ams, textord, "\u2605", "\\bigstar");
69258
69820
  defineSymbol(math, ams, textord, "\u2222", "\\sphericalangle", true);
69259
69821
  defineSymbol(math, ams, textord, "\u2201", "\\complement", true);
69260
69822
  defineSymbol(math, ams, textord, "\xF0", "\\eth", true);
69261
- defineSymbol(text5, main, textord, "\xF0", "\xF0");
69823
+ defineSymbol(text6, main, textord, "\xF0", "\xF0");
69262
69824
  defineSymbol(math, ams, textord, "\u2571", "\\diagup");
69263
69825
  defineSymbol(math, ams, textord, "\u2572", "\\diagdown");
69264
69826
  defineSymbol(math, ams, textord, "\u25A1", "\\square");
69265
69827
  defineSymbol(math, ams, textord, "\u25A1", "\\Box");
69266
69828
  defineSymbol(math, ams, textord, "\u25CA", "\\Diamond");
69267
69829
  defineSymbol(math, ams, textord, "\xA5", "\\yen", true);
69268
- defineSymbol(text5, ams, textord, "\xA5", "\\yen", true);
69830
+ defineSymbol(text6, ams, textord, "\xA5", "\\yen", true);
69269
69831
  defineSymbol(math, ams, textord, "\u2713", "\\checkmark", true);
69270
- defineSymbol(text5, ams, textord, "\u2713", "\\checkmark");
69832
+ defineSymbol(text6, ams, textord, "\u2713", "\\checkmark");
69271
69833
  defineSymbol(math, ams, textord, "\u2136", "\\beth", true);
69272
69834
  defineSymbol(math, ams, textord, "\u2138", "\\daleth", true);
69273
69835
  defineSymbol(math, ams, textord, "\u2137", "\\gimel", true);
@@ -69407,13 +69969,13 @@ defineSymbol(math, ams, rel, "\u21DB", "\\Rrightarrow", true);
69407
69969
  defineSymbol(math, ams, rel, "\u21BE", "\\restriction");
69408
69970
  defineSymbol(math, main, textord, "\u2018", "`");
69409
69971
  defineSymbol(math, main, textord, "$", "\\$");
69410
- defineSymbol(text5, main, textord, "$", "\\$");
69411
- defineSymbol(text5, main, textord, "$", "\\textdollar");
69972
+ defineSymbol(text6, main, textord, "$", "\\$");
69973
+ defineSymbol(text6, main, textord, "$", "\\textdollar");
69412
69974
  defineSymbol(math, main, textord, "%", "\\%");
69413
- defineSymbol(text5, main, textord, "%", "\\%");
69975
+ defineSymbol(text6, main, textord, "%", "\\%");
69414
69976
  defineSymbol(math, main, textord, "_", "\\_");
69415
- defineSymbol(text5, main, textord, "_", "\\_");
69416
- defineSymbol(text5, main, textord, "_", "\\textunderscore");
69977
+ defineSymbol(text6, main, textord, "_", "\\_");
69978
+ defineSymbol(text6, main, textord, "_", "\\textunderscore");
69417
69979
  defineSymbol(math, main, textord, "\u2220", "\\angle", true);
69418
69980
  defineSymbol(math, main, textord, "\u221E", "\\infty", true);
69419
69981
  defineSymbol(math, main, textord, "\u2032", "\\prime");
@@ -69530,10 +70092,10 @@ defineSymbol(math, ams, rel, "\u2270", "\\nleq", true);
69530
70092
  defineSymbol(math, main, spacing, "\xA0", "\\ ");
69531
70093
  defineSymbol(math, main, spacing, "\xA0", "\\space");
69532
70094
  defineSymbol(math, main, spacing, "\xA0", "\\nobreakspace");
69533
- defineSymbol(text5, main, spacing, "\xA0", "\\ ");
69534
- defineSymbol(text5, main, spacing, "\xA0", " ");
69535
- defineSymbol(text5, main, spacing, "\xA0", "\\space");
69536
- defineSymbol(text5, main, spacing, "\xA0", "\\nobreakspace");
70095
+ defineSymbol(text6, main, spacing, "\xA0", "\\ ");
70096
+ defineSymbol(text6, main, spacing, "\xA0", " ");
70097
+ defineSymbol(text6, main, spacing, "\xA0", "\\space");
70098
+ defineSymbol(text6, main, spacing, "\xA0", "\\nobreakspace");
69537
70099
  defineSymbol(math, main, spacing, "", "\\nobreak");
69538
70100
  defineSymbol(math, main, spacing, "", "\\allowbreak");
69539
70101
  defineSymbol(math, main, punct, ",", ",");
@@ -69555,21 +70117,21 @@ defineSymbol(math, main, bin, "\u22C6", "\\star");
69555
70117
  defineSymbol(math, main, bin, "\u25C3", "\\triangleleft");
69556
70118
  defineSymbol(math, main, bin, "\u25B9", "\\triangleright");
69557
70119
  defineSymbol(math, main, open, "{", "\\{");
69558
- defineSymbol(text5, main, textord, "{", "\\{");
69559
- defineSymbol(text5, main, textord, "{", "\\textbraceleft");
70120
+ defineSymbol(text6, main, textord, "{", "\\{");
70121
+ defineSymbol(text6, main, textord, "{", "\\textbraceleft");
69560
70122
  defineSymbol(math, main, close, "}", "\\}");
69561
- defineSymbol(text5, main, textord, "}", "\\}");
69562
- defineSymbol(text5, main, textord, "}", "\\textbraceright");
70123
+ defineSymbol(text6, main, textord, "}", "\\}");
70124
+ defineSymbol(text6, main, textord, "}", "\\textbraceright");
69563
70125
  defineSymbol(math, main, open, "{", "\\lbrace");
69564
70126
  defineSymbol(math, main, close, "}", "\\rbrace");
69565
70127
  defineSymbol(math, main, open, "[", "\\lbrack", true);
69566
- defineSymbol(text5, main, textord, "[", "\\lbrack", true);
70128
+ defineSymbol(text6, main, textord, "[", "\\lbrack", true);
69567
70129
  defineSymbol(math, main, close, "]", "\\rbrack", true);
69568
- defineSymbol(text5, main, textord, "]", "\\rbrack", true);
70130
+ defineSymbol(text6, main, textord, "]", "\\rbrack", true);
69569
70131
  defineSymbol(math, main, open, "(", "\\lparen", true);
69570
70132
  defineSymbol(math, main, close, ")", "\\rparen", true);
69571
- defineSymbol(text5, main, textord, "<", "\\textless", true);
69572
- defineSymbol(text5, main, textord, ">", "\\textgreater", true);
70133
+ defineSymbol(text6, main, textord, "<", "\\textless", true);
70134
+ defineSymbol(text6, main, textord, ">", "\\textgreater", true);
69573
70135
  defineSymbol(math, main, open, "\u230A", "\\lfloor", true);
69574
70136
  defineSymbol(math, main, close, "\u230B", "\\rfloor", true);
69575
70137
  defineSymbol(math, main, open, "\u2308", "\\lceil", true);
@@ -69577,13 +70139,13 @@ defineSymbol(math, main, close, "\u2309", "\\rceil", true);
69577
70139
  defineSymbol(math, main, textord, "\\", "\\backslash");
69578
70140
  defineSymbol(math, main, textord, "\u2223", "|");
69579
70141
  defineSymbol(math, main, textord, "\u2223", "\\vert");
69580
- defineSymbol(text5, main, textord, "|", "\\textbar", true);
70142
+ defineSymbol(text6, main, textord, "|", "\\textbar", true);
69581
70143
  defineSymbol(math, main, textord, "\u2225", "\\|");
69582
70144
  defineSymbol(math, main, textord, "\u2225", "\\Vert");
69583
- defineSymbol(text5, main, textord, "\u2225", "\\textbardbl");
69584
- defineSymbol(text5, main, textord, "~", "\\textasciitilde");
69585
- defineSymbol(text5, main, textord, "\\", "\\textbackslash");
69586
- defineSymbol(text5, main, textord, "^", "\\textasciicircum");
70145
+ defineSymbol(text6, main, textord, "\u2225", "\\textbardbl");
70146
+ defineSymbol(text6, main, textord, "~", "\\textasciitilde");
70147
+ defineSymbol(text6, main, textord, "\\", "\\textbackslash");
70148
+ defineSymbol(text6, main, textord, "^", "\\textasciicircum");
69587
70149
  defineSymbol(math, main, rel, "\u2191", "\\uparrow", true);
69588
70150
  defineSymbol(math, main, rel, "\u21D1", "\\Uparrow", true);
69589
70151
  defineSymbol(math, main, rel, "\u2193", "\\downarrow", true);
@@ -69610,14 +70172,14 @@ defineSymbol(math, main, op, "\u222F", "\\oiint");
69610
70172
  defineSymbol(math, main, op, "\u2230", "\\oiiint");
69611
70173
  defineSymbol(math, main, op, "\u2A06", "\\bigsqcup");
69612
70174
  defineSymbol(math, main, op, "\u222B", "\\smallint");
69613
- defineSymbol(text5, main, inner, "\u2026", "\\textellipsis");
70175
+ defineSymbol(text6, main, inner, "\u2026", "\\textellipsis");
69614
70176
  defineSymbol(math, main, inner, "\u2026", "\\mathellipsis");
69615
- defineSymbol(text5, main, inner, "\u2026", "\\ldots", true);
70177
+ defineSymbol(text6, main, inner, "\u2026", "\\ldots", true);
69616
70178
  defineSymbol(math, main, inner, "\u2026", "\\ldots", true);
69617
70179
  defineSymbol(math, main, inner, "\u22EF", "\\@cdots", true);
69618
70180
  defineSymbol(math, main, inner, "\u22F1", "\\ddots", true);
69619
70181
  defineSymbol(math, main, textord, "\u22EE", "\\varvdots");
69620
- defineSymbol(text5, main, textord, "\u22EE", "\\varvdots");
70182
+ defineSymbol(text6, main, textord, "\u22EE", "\\varvdots");
69621
70183
  defineSymbol(math, main, accent, "\u02CA", "\\acute");
69622
70184
  defineSymbol(math, main, accent, "\u02CB", "\\grave");
69623
70185
  defineSymbol(math, main, accent, "\xA8", "\\ddot");
@@ -69633,55 +70195,55 @@ defineSymbol(math, main, mathord, "\uE131", "\\@imath");
69633
70195
  defineSymbol(math, main, mathord, "\uE237", "\\@jmath");
69634
70196
  defineSymbol(math, main, textord, "\u0131", "\u0131");
69635
70197
  defineSymbol(math, main, textord, "\u0237", "\u0237");
69636
- defineSymbol(text5, main, textord, "\u0131", "\\i", true);
69637
- defineSymbol(text5, main, textord, "\u0237", "\\j", true);
69638
- defineSymbol(text5, main, textord, "\xDF", "\\ss", true);
69639
- defineSymbol(text5, main, textord, "\xE6", "\\ae", true);
69640
- defineSymbol(text5, main, textord, "\u0153", "\\oe", true);
69641
- defineSymbol(text5, main, textord, "\xF8", "\\o", true);
69642
- defineSymbol(text5, main, textord, "\xC6", "\\AE", true);
69643
- defineSymbol(text5, main, textord, "\u0152", "\\OE", true);
69644
- defineSymbol(text5, main, textord, "\xD8", "\\O", true);
69645
- defineSymbol(text5, main, accent, "\u02CA", "\\'");
69646
- defineSymbol(text5, main, accent, "\u02CB", "\\`");
69647
- defineSymbol(text5, main, accent, "\u02C6", "\\^");
69648
- defineSymbol(text5, main, accent, "\u02DC", "\\~");
69649
- defineSymbol(text5, main, accent, "\u02C9", "\\=");
69650
- defineSymbol(text5, main, accent, "\u02D8", "\\u");
69651
- defineSymbol(text5, main, accent, "\u02D9", "\\.");
69652
- defineSymbol(text5, main, accent, "\xB8", "\\c");
69653
- defineSymbol(text5, main, accent, "\u02DA", "\\r");
69654
- defineSymbol(text5, main, accent, "\u02C7", "\\v");
69655
- defineSymbol(text5, main, accent, "\xA8", '\\"');
69656
- defineSymbol(text5, main, accent, "\u02DD", "\\H");
69657
- defineSymbol(text5, main, accent, "\u25EF", "\\textcircled");
70198
+ defineSymbol(text6, main, textord, "\u0131", "\\i", true);
70199
+ defineSymbol(text6, main, textord, "\u0237", "\\j", true);
70200
+ defineSymbol(text6, main, textord, "\xDF", "\\ss", true);
70201
+ defineSymbol(text6, main, textord, "\xE6", "\\ae", true);
70202
+ defineSymbol(text6, main, textord, "\u0153", "\\oe", true);
70203
+ defineSymbol(text6, main, textord, "\xF8", "\\o", true);
70204
+ defineSymbol(text6, main, textord, "\xC6", "\\AE", true);
70205
+ defineSymbol(text6, main, textord, "\u0152", "\\OE", true);
70206
+ defineSymbol(text6, main, textord, "\xD8", "\\O", true);
70207
+ defineSymbol(text6, main, accent, "\u02CA", "\\'");
70208
+ defineSymbol(text6, main, accent, "\u02CB", "\\`");
70209
+ defineSymbol(text6, main, accent, "\u02C6", "\\^");
70210
+ defineSymbol(text6, main, accent, "\u02DC", "\\~");
70211
+ defineSymbol(text6, main, accent, "\u02C9", "\\=");
70212
+ defineSymbol(text6, main, accent, "\u02D8", "\\u");
70213
+ defineSymbol(text6, main, accent, "\u02D9", "\\.");
70214
+ defineSymbol(text6, main, accent, "\xB8", "\\c");
70215
+ defineSymbol(text6, main, accent, "\u02DA", "\\r");
70216
+ defineSymbol(text6, main, accent, "\u02C7", "\\v");
70217
+ defineSymbol(text6, main, accent, "\xA8", '\\"');
70218
+ defineSymbol(text6, main, accent, "\u02DD", "\\H");
70219
+ defineSymbol(text6, main, accent, "\u25EF", "\\textcircled");
69658
70220
  var ligatures = {
69659
70221
  "--": true,
69660
70222
  "---": true,
69661
70223
  "``": true,
69662
70224
  "''": true
69663
70225
  };
69664
- defineSymbol(text5, main, textord, "\u2013", "--", true);
69665
- defineSymbol(text5, main, textord, "\u2013", "\\textendash");
69666
- defineSymbol(text5, main, textord, "\u2014", "---", true);
69667
- defineSymbol(text5, main, textord, "\u2014", "\\textemdash");
69668
- defineSymbol(text5, main, textord, "\u2018", "`", true);
69669
- defineSymbol(text5, main, textord, "\u2018", "\\textquoteleft");
69670
- defineSymbol(text5, main, textord, "\u2019", "'", true);
69671
- defineSymbol(text5, main, textord, "\u2019", "\\textquoteright");
69672
- defineSymbol(text5, main, textord, "\u201C", "``", true);
69673
- defineSymbol(text5, main, textord, "\u201C", "\\textquotedblleft");
69674
- defineSymbol(text5, main, textord, "\u201D", "''", true);
69675
- defineSymbol(text5, main, textord, "\u201D", "\\textquotedblright");
70226
+ defineSymbol(text6, main, textord, "\u2013", "--", true);
70227
+ defineSymbol(text6, main, textord, "\u2013", "\\textendash");
70228
+ defineSymbol(text6, main, textord, "\u2014", "---", true);
70229
+ defineSymbol(text6, main, textord, "\u2014", "\\textemdash");
70230
+ defineSymbol(text6, main, textord, "\u2018", "`", true);
70231
+ defineSymbol(text6, main, textord, "\u2018", "\\textquoteleft");
70232
+ defineSymbol(text6, main, textord, "\u2019", "'", true);
70233
+ defineSymbol(text6, main, textord, "\u2019", "\\textquoteright");
70234
+ defineSymbol(text6, main, textord, "\u201C", "``", true);
70235
+ defineSymbol(text6, main, textord, "\u201C", "\\textquotedblleft");
70236
+ defineSymbol(text6, main, textord, "\u201D", "''", true);
70237
+ defineSymbol(text6, main, textord, "\u201D", "\\textquotedblright");
69676
70238
  defineSymbol(math, main, textord, "\xB0", "\\degree", true);
69677
- defineSymbol(text5, main, textord, "\xB0", "\\degree");
69678
- defineSymbol(text5, main, textord, "\xB0", "\\textdegree", true);
70239
+ defineSymbol(text6, main, textord, "\xB0", "\\degree");
70240
+ defineSymbol(text6, main, textord, "\xB0", "\\textdegree", true);
69679
70241
  defineSymbol(math, main, textord, "\xA3", "\\pounds");
69680
70242
  defineSymbol(math, main, textord, "\xA3", "\\mathsterling", true);
69681
- defineSymbol(text5, main, textord, "\xA3", "\\pounds");
69682
- defineSymbol(text5, main, textord, "\xA3", "\\textsterling", true);
70243
+ defineSymbol(text6, main, textord, "\xA3", "\\pounds");
70244
+ defineSymbol(text6, main, textord, "\xA3", "\\textsterling", true);
69683
70245
  defineSymbol(math, ams, textord, "\u2720", "\\maltese");
69684
- defineSymbol(text5, ams, textord, "\u2720", "\\maltese");
70246
+ defineSymbol(text6, ams, textord, "\u2720", "\\maltese");
69685
70247
  var mathTextSymbols = '0123456789/@."';
69686
70248
  for (i = 0; i < mathTextSymbols.length; i++) {
69687
70249
  ch = mathTextSymbols.charAt(i);
@@ -69692,7 +70254,7 @@ var i;
69692
70254
  var textSymbols = '0123456789!@*()-=+";:?/.,';
69693
70255
  for (_i = 0; _i < textSymbols.length; _i++) {
69694
70256
  _ch = textSymbols.charAt(_i);
69695
- defineSymbol(text5, main, textord, _ch, _ch);
70257
+ defineSymbol(text6, main, textord, _ch, _ch);
69696
70258
  }
69697
70259
  var _ch;
69698
70260
  var _i;
@@ -69700,84 +70262,84 @@ var letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
69700
70262
  for (_i2 = 0; _i2 < letters.length; _i2++) {
69701
70263
  _ch2 = letters.charAt(_i2);
69702
70264
  defineSymbol(math, main, mathord, _ch2, _ch2);
69703
- defineSymbol(text5, main, textord, _ch2, _ch2);
70265
+ defineSymbol(text6, main, textord, _ch2, _ch2);
69704
70266
  }
69705
70267
  var _ch2;
69706
70268
  var _i2;
69707
70269
  defineSymbol(math, ams, textord, "C", "\u2102");
69708
- defineSymbol(text5, ams, textord, "C", "\u2102");
70270
+ defineSymbol(text6, ams, textord, "C", "\u2102");
69709
70271
  defineSymbol(math, ams, textord, "H", "\u210D");
69710
- defineSymbol(text5, ams, textord, "H", "\u210D");
70272
+ defineSymbol(text6, ams, textord, "H", "\u210D");
69711
70273
  defineSymbol(math, ams, textord, "N", "\u2115");
69712
- defineSymbol(text5, ams, textord, "N", "\u2115");
70274
+ defineSymbol(text6, ams, textord, "N", "\u2115");
69713
70275
  defineSymbol(math, ams, textord, "P", "\u2119");
69714
- defineSymbol(text5, ams, textord, "P", "\u2119");
70276
+ defineSymbol(text6, ams, textord, "P", "\u2119");
69715
70277
  defineSymbol(math, ams, textord, "Q", "\u211A");
69716
- defineSymbol(text5, ams, textord, "Q", "\u211A");
70278
+ defineSymbol(text6, ams, textord, "Q", "\u211A");
69717
70279
  defineSymbol(math, ams, textord, "R", "\u211D");
69718
- defineSymbol(text5, ams, textord, "R", "\u211D");
70280
+ defineSymbol(text6, ams, textord, "R", "\u211D");
69719
70281
  defineSymbol(math, ams, textord, "Z", "\u2124");
69720
- defineSymbol(text5, ams, textord, "Z", "\u2124");
70282
+ defineSymbol(text6, ams, textord, "Z", "\u2124");
69721
70283
  defineSymbol(math, main, mathord, "h", "\u210E");
69722
- defineSymbol(text5, main, mathord, "h", "\u210E");
70284
+ defineSymbol(text6, main, mathord, "h", "\u210E");
69723
70285
  var wideChar;
69724
70286
  for (_i3 = 0; _i3 < letters.length; _i3++) {
69725
70287
  _ch3 = letters.charAt(_i3);
69726
70288
  wideChar = String.fromCharCode(55349, 56320 + _i3);
69727
70289
  defineSymbol(math, main, mathord, _ch3, wideChar);
69728
- defineSymbol(text5, main, textord, _ch3, wideChar);
70290
+ defineSymbol(text6, main, textord, _ch3, wideChar);
69729
70291
  wideChar = String.fromCharCode(55349, 56372 + _i3);
69730
70292
  defineSymbol(math, main, mathord, _ch3, wideChar);
69731
- defineSymbol(text5, main, textord, _ch3, wideChar);
70293
+ defineSymbol(text6, main, textord, _ch3, wideChar);
69732
70294
  wideChar = String.fromCharCode(55349, 56424 + _i3);
69733
70295
  defineSymbol(math, main, mathord, _ch3, wideChar);
69734
- defineSymbol(text5, main, textord, _ch3, wideChar);
70296
+ defineSymbol(text6, main, textord, _ch3, wideChar);
69735
70297
  wideChar = String.fromCharCode(55349, 56580 + _i3);
69736
70298
  defineSymbol(math, main, mathord, _ch3, wideChar);
69737
- defineSymbol(text5, main, textord, _ch3, wideChar);
70299
+ defineSymbol(text6, main, textord, _ch3, wideChar);
69738
70300
  wideChar = String.fromCharCode(55349, 56684 + _i3);
69739
70301
  defineSymbol(math, main, mathord, _ch3, wideChar);
69740
- defineSymbol(text5, main, textord, _ch3, wideChar);
70302
+ defineSymbol(text6, main, textord, _ch3, wideChar);
69741
70303
  wideChar = String.fromCharCode(55349, 56736 + _i3);
69742
70304
  defineSymbol(math, main, mathord, _ch3, wideChar);
69743
- defineSymbol(text5, main, textord, _ch3, wideChar);
70305
+ defineSymbol(text6, main, textord, _ch3, wideChar);
69744
70306
  wideChar = String.fromCharCode(55349, 56788 + _i3);
69745
70307
  defineSymbol(math, main, mathord, _ch3, wideChar);
69746
- defineSymbol(text5, main, textord, _ch3, wideChar);
70308
+ defineSymbol(text6, main, textord, _ch3, wideChar);
69747
70309
  wideChar = String.fromCharCode(55349, 56840 + _i3);
69748
70310
  defineSymbol(math, main, mathord, _ch3, wideChar);
69749
- defineSymbol(text5, main, textord, _ch3, wideChar);
70311
+ defineSymbol(text6, main, textord, _ch3, wideChar);
69750
70312
  wideChar = String.fromCharCode(55349, 56944 + _i3);
69751
70313
  defineSymbol(math, main, mathord, _ch3, wideChar);
69752
- defineSymbol(text5, main, textord, _ch3, wideChar);
70314
+ defineSymbol(text6, main, textord, _ch3, wideChar);
69753
70315
  if (_i3 < 26) {
69754
70316
  wideChar = String.fromCharCode(55349, 56632 + _i3);
69755
70317
  defineSymbol(math, main, mathord, _ch3, wideChar);
69756
- defineSymbol(text5, main, textord, _ch3, wideChar);
70318
+ defineSymbol(text6, main, textord, _ch3, wideChar);
69757
70319
  wideChar = String.fromCharCode(55349, 56476 + _i3);
69758
70320
  defineSymbol(math, main, mathord, _ch3, wideChar);
69759
- defineSymbol(text5, main, textord, _ch3, wideChar);
70321
+ defineSymbol(text6, main, textord, _ch3, wideChar);
69760
70322
  }
69761
70323
  }
69762
70324
  var _ch3;
69763
70325
  var _i3;
69764
70326
  wideChar = String.fromCharCode(55349, 56668);
69765
70327
  defineSymbol(math, main, mathord, "k", wideChar);
69766
- defineSymbol(text5, main, textord, "k", wideChar);
70328
+ defineSymbol(text6, main, textord, "k", wideChar);
69767
70329
  for (_i4 = 0; _i4 < 10; _i4++) {
69768
70330
  _ch4 = _i4.toString();
69769
70331
  wideChar = String.fromCharCode(55349, 57294 + _i4);
69770
70332
  defineSymbol(math, main, mathord, _ch4, wideChar);
69771
- defineSymbol(text5, main, textord, _ch4, wideChar);
70333
+ defineSymbol(text6, main, textord, _ch4, wideChar);
69772
70334
  wideChar = String.fromCharCode(55349, 57314 + _i4);
69773
70335
  defineSymbol(math, main, mathord, _ch4, wideChar);
69774
- defineSymbol(text5, main, textord, _ch4, wideChar);
70336
+ defineSymbol(text6, main, textord, _ch4, wideChar);
69775
70337
  wideChar = String.fromCharCode(55349, 57324 + _i4);
69776
70338
  defineSymbol(math, main, mathord, _ch4, wideChar);
69777
- defineSymbol(text5, main, textord, _ch4, wideChar);
70339
+ defineSymbol(text6, main, textord, _ch4, wideChar);
69778
70340
  wideChar = String.fromCharCode(55349, 57334 + _i4);
69779
70341
  defineSymbol(math, main, mathord, _ch4, wideChar);
69780
- defineSymbol(text5, main, textord, _ch4, wideChar);
70342
+ defineSymbol(text6, main, textord, _ch4, wideChar);
69781
70343
  }
69782
70344
  var _ch4;
69783
70345
  var _i4;
@@ -69785,7 +70347,7 @@ var extraLatin = "\xD0\xDE\xFE";
69785
70347
  for (_i5 = 0; _i5 < extraLatin.length; _i5++) {
69786
70348
  _ch5 = extraLatin.charAt(_i5);
69787
70349
  defineSymbol(math, main, mathord, _ch5, _ch5);
69788
- defineSymbol(text5, main, textord, _ch5, _ch5);
70350
+ defineSymbol(text6, main, textord, _ch5, _ch5);
69789
70351
  }
69790
70352
  var _ch5;
69791
70353
  var _i5;
@@ -69989,7 +70551,7 @@ var boldSymbol = function boldSymbol2(value, mode, type) {
69989
70551
  };
69990
70552
  var makeOrd = function makeOrd2(group, options, type) {
69991
70553
  var mode = group.mode;
69992
- var text9 = group.text;
70554
+ var text10 = group.text;
69993
70555
  var classes = ["mord"];
69994
70556
  var {
69995
70557
  font,
@@ -70001,18 +70563,18 @@ var makeOrd = function makeOrd2(group, options, type) {
70001
70563
  var fontOrFamily = useFont ? font : fontFamily;
70002
70564
  var wideFontName = "";
70003
70565
  var wideFontClass = "";
70004
- if (text9.charCodeAt(0) === 55349) {
70005
- var wideCharData = wideCharacterFont(text9);
70566
+ if (text10.charCodeAt(0) === 55349) {
70567
+ var wideCharData = wideCharacterFont(text10);
70006
70568
  wideFontName = wideCharData.font;
70007
70569
  wideFontClass = wideCharData[mode + "Class"];
70008
70570
  }
70009
70571
  if (wideFontName) {
70010
- return makeSymbol(text9, wideFontName, mode, options, classes.concat(wideFontClass));
70572
+ return makeSymbol(text10, wideFontName, mode, options, classes.concat(wideFontClass));
70011
70573
  } else if (fontOrFamily) {
70012
70574
  var fontName;
70013
70575
  var fontClasses;
70014
70576
  if (fontOrFamily === "boldsymbol") {
70015
- var fontData = boldSymbol(text9, mode, type);
70577
+ var fontData = boldSymbol(text10, mode, type);
70016
70578
  fontName = fontData.fontName;
70017
70579
  fontClasses = [fontData.fontClass];
70018
70580
  } else if (useFont) {
@@ -70022,29 +70584,29 @@ var makeOrd = function makeOrd2(group, options, type) {
70022
70584
  fontName = retrieveTextFontName(fontFamily, fontWeight, fontShape);
70023
70585
  fontClasses = [fontFamily, fontWeight, fontShape];
70024
70586
  }
70025
- if (lookupSymbol(text9, fontName, mode).metrics) {
70026
- return makeSymbol(text9, fontName, mode, options, classes.concat(fontClasses));
70027
- } else if (ligatures.hasOwnProperty(text9) && fontName.slice(0, 10) === "Typewriter") {
70587
+ if (lookupSymbol(text10, fontName, mode).metrics) {
70588
+ return makeSymbol(text10, fontName, mode, options, classes.concat(fontClasses));
70589
+ } else if (ligatures.hasOwnProperty(text10) && fontName.slice(0, 10) === "Typewriter") {
70028
70590
  var parts = [];
70029
- for (var i3 = 0; i3 < text9.length; i3++) {
70030
- parts.push(makeSymbol(text9[i3], fontName, mode, options, classes.concat(fontClasses)));
70591
+ for (var i3 = 0; i3 < text10.length; i3++) {
70592
+ parts.push(makeSymbol(text10[i3], fontName, mode, options, classes.concat(fontClasses)));
70031
70593
  }
70032
70594
  return makeFragment(parts);
70033
70595
  }
70034
70596
  }
70035
70597
  if (type === "mathord") {
70036
- return makeSymbol(text9, "Math-Italic", mode, options, classes.concat(["mathnormal"]));
70598
+ return makeSymbol(text10, "Math-Italic", mode, options, classes.concat(["mathnormal"]));
70037
70599
  } else if (type === "textord") {
70038
- var _font = symbols[mode][text9] && symbols[mode][text9].font;
70600
+ var _font = symbols[mode][text10] && symbols[mode][text10].font;
70039
70601
  if (_font === "ams") {
70040
70602
  var _fontName = retrieveTextFontName("amsrm", fontWeight, fontShape);
70041
- return makeSymbol(text9, _fontName, mode, options, classes.concat("amsrm", fontWeight, fontShape));
70603
+ return makeSymbol(text10, _fontName, mode, options, classes.concat("amsrm", fontWeight, fontShape));
70042
70604
  } else if (_font === "main" || !_font) {
70043
70605
  var _fontName2 = retrieveTextFontName("textrm", fontWeight, fontShape);
70044
- return makeSymbol(text9, _fontName2, mode, options, classes.concat(fontWeight, fontShape));
70606
+ return makeSymbol(text10, _fontName2, mode, options, classes.concat(fontWeight, fontShape));
70045
70607
  } else {
70046
70608
  var _fontName3 = retrieveTextFontName(_font, fontWeight, fontShape);
70047
- return makeSymbol(text9, _fontName3, mode, options, classes.concat(_fontName3, fontWeight, fontShape));
70609
+ return makeSymbol(text10, _fontName3, mode, options, classes.concat(_fontName3, fontWeight, fontShape));
70048
70610
  }
70049
70611
  } else {
70050
70612
  throw new Error("unexpected type: " + type + " in makeOrd");
@@ -70780,11 +71342,11 @@ var MathNode = class {
70780
71342
  }
70781
71343
  for (var i3 = 0; i3 < this.children.length; i3++) {
70782
71344
  if (this.children[i3] instanceof TextNode && this.children[i3 + 1] instanceof TextNode) {
70783
- var text9 = this.children[i3].toText() + this.children[++i3].toText();
71345
+ var text10 = this.children[i3].toText() + this.children[++i3].toText();
70784
71346
  while (this.children[i3 + 1] instanceof TextNode) {
70785
- text9 += this.children[++i3].toText();
71347
+ text10 += this.children[++i3].toText();
70786
71348
  }
70787
- node2.appendChild(new TextNode(text9).toNode());
71349
+ node2.appendChild(new TextNode(text10).toNode());
70788
71350
  } else {
70789
71351
  node2.appendChild(this.children[i3].toNode());
70790
71352
  }
@@ -70821,9 +71383,9 @@ var MathNode = class {
70821
71383
  }
70822
71384
  };
70823
71385
  var TextNode = class {
70824
- constructor(text9) {
71386
+ constructor(text10) {
70825
71387
  this.text = void 0;
70826
- this.text = text9;
71388
+ this.text = text10;
70827
71389
  }
70828
71390
  /**
70829
71391
  * Converts the text node into a DOM text node.
@@ -70909,11 +71471,11 @@ var SpaceNode = class {
70909
71471
  };
70910
71472
  var noVariantSymbols = /* @__PURE__ */ new Set(["\\imath", "\\jmath"]);
70911
71473
  var rowLikeTypes = /* @__PURE__ */ new Set(["mrow", "mtable"]);
70912
- var makeText = function makeText2(text9, mode, options) {
70913
- if (symbols[mode][text9] && symbols[mode][text9].replace && text9.charCodeAt(0) !== 55349 && !(ligatures.hasOwnProperty(text9) && options && (options.fontFamily && options.fontFamily.slice(4, 6) === "tt" || options.font && options.font.slice(4, 6) === "tt"))) {
70914
- text9 = symbols[mode][text9].replace;
71474
+ var makeText = function makeText2(text10, mode, options) {
71475
+ if (symbols[mode][text10] && symbols[mode][text10].replace && text10.charCodeAt(0) !== 55349 && !(ligatures.hasOwnProperty(text10) && options && (options.fontFamily && options.fontFamily.slice(4, 6) === "tt" || options.font && options.font.slice(4, 6) === "tt"))) {
71476
+ text10 = symbols[mode][text10].replace;
70915
71477
  }
70916
- return new TextNode(text9);
71478
+ return new TextNode(text10);
70917
71479
  };
70918
71480
  var makeRow = function makeRow2(body3) {
70919
71481
  if (body3.length === 1) {
@@ -70965,18 +71527,18 @@ var getVariant = (group, options) => {
70965
71527
  if (mathVariant) {
70966
71528
  return typeof mathVariant === "function" ? mathVariant(group) : mathVariant;
70967
71529
  }
70968
- var text9 = group.text;
70969
- if (noVariantSymbols.has(text9)) {
71530
+ var text10 = group.text;
71531
+ if (noVariantSymbols.has(text10)) {
70970
71532
  return null;
70971
71533
  }
70972
- if (symbols[mode][text9]) {
70973
- var replacement = symbols[mode][text9].replace;
71534
+ if (symbols[mode][text10]) {
71535
+ var replacement = symbols[mode][text10].replace;
70974
71536
  if (replacement) {
70975
- text9 = replacement;
71537
+ text10 = replacement;
70976
71538
  }
70977
71539
  }
70978
71540
  var fontName = fontMap[font].fontName;
70979
- if (getCharacterMetrics(text9, fontName, mode)) {
71541
+ if (getCharacterMetrics(text10, fontName, mode)) {
70980
71542
  return fontMap[font].variant;
70981
71543
  }
70982
71544
  return null;
@@ -72447,21 +73009,21 @@ defineFunction({
72447
73009
  number2 += node2.text;
72448
73010
  }
72449
73011
  var code4 = parseInt(number2);
72450
- var text9;
73012
+ var text10;
72451
73013
  if (isNaN(code4)) {
72452
73014
  throw new ParseError("\\@char has non-numeric argument " + number2);
72453
73015
  } else if (code4 < 0 || code4 >= 1114111) {
72454
73016
  throw new ParseError("\\@char with invalid code point " + number2);
72455
73017
  } else if (code4 <= 65535) {
72456
- text9 = String.fromCharCode(code4);
73018
+ text10 = String.fromCharCode(code4);
72457
73019
  } else {
72458
73020
  code4 -= 65536;
72459
- text9 = String.fromCharCode((code4 >> 10) + 55296, (code4 & 1023) + 56320);
73021
+ text10 = String.fromCharCode((code4 >> 10) + 55296, (code4 & 1023) + 56320);
72460
73022
  }
72461
73023
  return {
72462
73024
  type: "textord",
72463
73025
  mode: parser.mode,
72464
- text: text9
73026
+ text: text10
72465
73027
  };
72466
73028
  }
72467
73029
  });
@@ -72785,8 +73347,8 @@ var centerSpan = function centerSpan2(span, options, style2) {
72785
73347
  span.depth += shift;
72786
73348
  };
72787
73349
  var makeSmallDelim = function makeSmallDelim2(delim, style2, center, options, mode, classes) {
72788
- var text9 = makeSymbol(delim, "Main-Regular", mode, options);
72789
- var span = styleWrap(text9, style2, options, classes);
73350
+ var text10 = makeSymbol(delim, "Main-Regular", mode, options);
73351
+ var span = styleWrap(text10, style2, options, classes);
72790
73352
  if (center) {
72791
73353
  centerSpan(span, options, style2);
72792
73354
  }
@@ -73893,20 +74455,20 @@ var SourceLocation = class _SourceLocation {
73893
74455
  };
73894
74456
  var Token = class _Token {
73895
74457
  // used in \noexpand
73896
- constructor(text9, loc) {
74458
+ constructor(text10, loc) {
73897
74459
  this.text = void 0;
73898
74460
  this.loc = void 0;
73899
74461
  this.noexpand = void 0;
73900
74462
  this.treatAsRelax = void 0;
73901
- this.text = text9;
74463
+ this.text = text10;
73902
74464
  this.loc = loc;
73903
74465
  }
73904
74466
  /**
73905
74467
  * Given a pair of tokens (this and endToken), compute a `Token` encompassing
73906
74468
  * the whole input range enclosed by these two.
73907
74469
  */
73908
- range(endToken, text9) {
73909
- return new _Token(text9, SourceLocation.range(this, endToken));
74470
+ range(endToken, text10) {
74471
+ return new _Token(text10, SourceLocation.range(this, endToken));
73910
74472
  }
73911
74473
  };
73912
74474
  function getHLines(parser) {
@@ -77199,17 +77761,17 @@ defineFunctionBuilders({
77199
77761
  return makeOrd(group, options, "textord");
77200
77762
  },
77201
77763
  mathmlBuilder(group, options) {
77202
- var text9 = makeText(group.text, group.mode, options);
77764
+ var text10 = makeText(group.text, group.mode, options);
77203
77765
  var variant = getVariant(group, options) || "normal";
77204
77766
  var node2;
77205
77767
  if (group.mode === "text") {
77206
- node2 = new MathNode("mtext", [text9]);
77768
+ node2 = new MathNode("mtext", [text10]);
77207
77769
  } else if (/[0-9]/.test(group.text)) {
77208
- node2 = new MathNode("mn", [text9]);
77770
+ node2 = new MathNode("mn", [text10]);
77209
77771
  } else if (group.text === "\\prime") {
77210
- node2 = new MathNode("mo", [text9]);
77772
+ node2 = new MathNode("mo", [text10]);
77211
77773
  } else {
77212
- node2 = new MathNode("mi", [text9]);
77774
+ node2 = new MathNode("mi", [text10]);
77213
77775
  }
77214
77776
  if (variant !== defaultVariant[node2.type]) {
77215
77777
  node2.setAttribute("mathvariant", variant);
@@ -77445,11 +78007,11 @@ defineFunction({
77445
78007
  throw new ParseError("\\verb ended by end of line instead of matching delimiter");
77446
78008
  },
77447
78009
  htmlBuilder(group, options) {
77448
- var text9 = makeVerb(group);
78010
+ var text10 = makeVerb(group);
77449
78011
  var body3 = [];
77450
78012
  var newOptions = options.havingStyle(options.style.text());
77451
- for (var i3 = 0; i3 < text9.length; i3++) {
77452
- var c = text9[i3];
78013
+ for (var i3 = 0; i3 < text10.length; i3++) {
78014
+ var c = text10[i3];
77453
78015
  if (c === "~") {
77454
78016
  c = "\\textasciitilde";
77455
78017
  }
@@ -77458,8 +78020,8 @@ defineFunction({
77458
78020
  return makeSpan(["mord", "text"].concat(newOptions.sizingClasses(options)), tryCombineChars(body3), newOptions);
77459
78021
  },
77460
78022
  mathmlBuilder(group, options) {
77461
- var text9 = new TextNode(makeVerb(group));
77462
- var node2 = new MathNode("mtext", [text9]);
78023
+ var text10 = new TextNode(makeVerb(group));
78024
+ var node2 = new MathNode("mtext", [text10]);
77463
78025
  node2.setAttribute("mathvariant", "monospace");
77464
78026
  return node2;
77465
78027
  }
@@ -77514,8 +78076,8 @@ var Lexer = class {
77514
78076
  if (match === null || match.index !== pos) {
77515
78077
  throw new ParseError("Unexpected character: '" + input[pos] + "'", new Token(input[pos], new SourceLocation(this, pos, pos + 1)));
77516
78078
  }
77517
- var text9 = match[6] || match[3] || (match[2] ? "\\ " : " ");
77518
- if (this.catcodes[text9] === 14) {
78079
+ var text10 = match[6] || match[3] || (match[2] ? "\\ " : " ");
78080
+ if (this.catcodes[text10] === 14) {
77519
78081
  var nlIndex = input.indexOf("\n", this.tokenRegex.lastIndex);
77520
78082
  if (nlIndex === -1) {
77521
78083
  this.tokenRegex.lastIndex = input.length;
@@ -77525,7 +78087,7 @@ var Lexer = class {
77525
78087
  }
77526
78088
  return this.lex();
77527
78089
  }
77528
- return new Token(text9, new SourceLocation(this, pos, this.tokenRegex.lastIndex));
78090
+ return new Token(text10, new SourceLocation(this, pos, this.tokenRegex.lastIndex));
77529
78091
  }
77530
78092
  };
77531
78093
  var Namespace = class {
@@ -79204,12 +79766,12 @@ var Parser2 = class _Parser {
79204
79766
  * Checks a result to make sure it has the right type, and throws an
79205
79767
  * appropriate error otherwise.
79206
79768
  */
79207
- expect(text9, consume) {
79769
+ expect(text10, consume) {
79208
79770
  if (consume === void 0) {
79209
79771
  consume = true;
79210
79772
  }
79211
- if (this.fetch().text !== text9) {
79212
- throw new ParseError("Expected '" + text9 + "', got '" + this.fetch().text + "'", this.fetch());
79773
+ if (this.fetch().text !== text10) {
79774
+ throw new ParseError("Expected '" + text10 + "', got '" + this.fetch().text + "'", this.fetch());
79213
79775
  }
79214
79776
  if (consume) {
79215
79777
  this.consume();
@@ -79390,13 +79952,13 @@ var Parser2 = class _Parser {
79390
79952
  * Converts the textual input of an unsupported command into a text node
79391
79953
  * contained within a color node whose color is determined by errorColor
79392
79954
  */
79393
- formatUnsupportedCmd(text9) {
79955
+ formatUnsupportedCmd(text10) {
79394
79956
  var textordArray = [];
79395
- for (var i3 = 0; i3 < text9.length; i3++) {
79957
+ for (var i3 = 0; i3 < text10.length; i3++) {
79396
79958
  textordArray.push({
79397
79959
  type: "textord",
79398
79960
  mode: "text",
79399
- text: text9[i3]
79961
+ text: text10[i3]
79400
79962
  });
79401
79963
  }
79402
79964
  var textNode = {
@@ -79808,11 +80370,11 @@ var Parser2 = class _Parser {
79808
80370
  */
79809
80371
  parseGroup(name2, breakOnTokenText) {
79810
80372
  var firstToken = this.fetch();
79811
- var text9 = firstToken.text;
80373
+ var text10 = firstToken.text;
79812
80374
  var result;
79813
- if (text9 === "{" || text9 === "\\begingroup") {
80375
+ if (text10 === "{" || text10 === "\\begingroup") {
79814
80376
  this.consume();
79815
- var groupEnd = text9 === "{" ? "}" : "\\endgroup";
80377
+ var groupEnd = text10 === "{" ? "}" : "\\endgroup";
79816
80378
  this.gullet.beginGroup();
79817
80379
  var expression = this.parseExpression(false, groupEnd);
79818
80380
  var lastToken = this.fetch();
@@ -79827,15 +80389,15 @@ var Parser2 = class _Parser {
79827
80389
  // which doesn't affect spacing in math mode, i.e., is transparent.
79828
80390
  // https://tex.stackexchange.com/questions/1930/when-should-one-
79829
80391
  // use-begingroup-instead-of-bgroup
79830
- semisimple: text9 === "\\begingroup" || void 0
80392
+ semisimple: text10 === "\\begingroup" || void 0
79831
80393
  };
79832
80394
  } else {
79833
80395
  result = this.parseFunction(breakOnTokenText, name2) || this.parseSymbol();
79834
- if (result == null && text9[0] === "\\" && !implicitCommands.hasOwnProperty(text9)) {
80396
+ if (result == null && text10[0] === "\\" && !implicitCommands.hasOwnProperty(text10)) {
79835
80397
  if (this.settings.throwOnError) {
79836
- throw new ParseError("Undefined control sequence: " + text9, firstToken);
80398
+ throw new ParseError("Undefined control sequence: " + text10, firstToken);
79837
80399
  }
79838
- result = this.formatUnsupportedCmd(text9);
80400
+ result = this.formatUnsupportedCmd(text10);
79839
80401
  this.consume();
79840
80402
  }
79841
80403
  }
@@ -79898,10 +80460,10 @@ var Parser2 = class _Parser {
79898
80460
  */
79899
80461
  parseSymbol() {
79900
80462
  var nucleus = this.fetch();
79901
- var text9 = nucleus.text;
79902
- if (/^\\verb[^a-zA-Z]/.test(text9)) {
80463
+ var text10 = nucleus.text;
80464
+ if (/^\\verb[^a-zA-Z]/.test(text10)) {
79903
80465
  this.consume();
79904
- var arg = text9.slice(5);
80466
+ var arg = text10.slice(5);
79905
80467
  var star = arg.charAt(0) === "*";
79906
80468
  if (star) {
79907
80469
  arg = arg.slice(1);
@@ -79917,27 +80479,27 @@ var Parser2 = class _Parser {
79917
80479
  star
79918
80480
  };
79919
80481
  }
79920
- if (unicodeSymbols.hasOwnProperty(text9[0]) && !symbols[this.mode][text9[0]]) {
80482
+ if (unicodeSymbols.hasOwnProperty(text10[0]) && !symbols[this.mode][text10[0]]) {
79921
80483
  if (this.settings.strict && this.mode === "math") {
79922
- this.settings.reportNonstrict("unicodeTextInMathMode", 'Accented Unicode text character "' + text9[0] + '" used in math mode', nucleus);
80484
+ this.settings.reportNonstrict("unicodeTextInMathMode", 'Accented Unicode text character "' + text10[0] + '" used in math mode', nucleus);
79923
80485
  }
79924
- text9 = unicodeSymbols[text9[0]] + text9.slice(1);
80486
+ text10 = unicodeSymbols[text10[0]] + text10.slice(1);
79925
80487
  }
79926
- var match = combiningDiacriticalMarksEndRegex.exec(text9);
80488
+ var match = combiningDiacriticalMarksEndRegex.exec(text10);
79927
80489
  if (match) {
79928
- text9 = text9.substring(0, match.index);
79929
- if (text9 === "i") {
79930
- text9 = "\u0131";
79931
- } else if (text9 === "j") {
79932
- text9 = "\u0237";
80490
+ text10 = text10.substring(0, match.index);
80491
+ if (text10 === "i") {
80492
+ text10 = "\u0131";
80493
+ } else if (text10 === "j") {
80494
+ text10 = "\u0237";
79933
80495
  }
79934
80496
  }
79935
80497
  var symbol;
79936
- if (symbols[this.mode][text9]) {
79937
- if (this.settings.strict && this.mode === "math" && extraLatin.includes(text9)) {
79938
- this.settings.reportNonstrict("unicodeTextInMathMode", 'Latin-1/Unicode text character "' + text9[0] + '" used in math mode', nucleus);
80498
+ if (symbols[this.mode][text10]) {
80499
+ if (this.settings.strict && this.mode === "math" && extraLatin.includes(text10)) {
80500
+ this.settings.reportNonstrict("unicodeTextInMathMode", 'Latin-1/Unicode text character "' + text10[0] + '" used in math mode', nucleus);
79939
80501
  }
79940
- var group = symbols[this.mode][text9].group;
80502
+ var group = symbols[this.mode][text10].group;
79941
80503
  var loc = SourceLocation.range(nucleus);
79942
80504
  var s3;
79943
80505
  if (isAtom(group)) {
@@ -79946,30 +80508,30 @@ var Parser2 = class _Parser {
79946
80508
  mode: this.mode,
79947
80509
  family: group,
79948
80510
  loc,
79949
- text: text9
80511
+ text: text10
79950
80512
  };
79951
80513
  } else {
79952
80514
  s3 = {
79953
80515
  type: group,
79954
80516
  mode: this.mode,
79955
80517
  loc,
79956
- text: text9
80518
+ text: text10
79957
80519
  };
79958
80520
  }
79959
80521
  symbol = s3;
79960
- } else if (text9.charCodeAt(0) >= 128) {
80522
+ } else if (text10.charCodeAt(0) >= 128) {
79961
80523
  if (this.settings.strict) {
79962
- if (!supportedCodepoint(text9.charCodeAt(0))) {
79963
- this.settings.reportNonstrict("unknownSymbol", 'Unrecognized Unicode character "' + text9[0] + '"' + (" (" + text9.charCodeAt(0) + ")"), nucleus);
80524
+ if (!supportedCodepoint(text10.charCodeAt(0))) {
80525
+ this.settings.reportNonstrict("unknownSymbol", 'Unrecognized Unicode character "' + text10[0] + '"' + (" (" + text10.charCodeAt(0) + ")"), nucleus);
79964
80526
  } else if (this.mode === "math") {
79965
- this.settings.reportNonstrict("unicodeTextInMathMode", 'Unicode text character "' + text9[0] + '" used in math mode', nucleus);
80527
+ this.settings.reportNonstrict("unicodeTextInMathMode", 'Unicode text character "' + text10[0] + '" used in math mode', nucleus);
79966
80528
  }
79967
80529
  }
79968
80530
  symbol = {
79969
80531
  type: "textord",
79970
80532
  mode: "text",
79971
80533
  loc: SourceLocation.range(nucleus),
79972
- text: text9
80534
+ text: text10
79973
80535
  };
79974
80536
  } else {
79975
80537
  return null;
@@ -81413,12 +81975,12 @@ function linkReference2(node2, _3, state, info) {
81413
81975
  let subexit = state.enter("label");
81414
81976
  const tracker = state.createTracker(info);
81415
81977
  let value = tracker.move("[");
81416
- const text9 = state.containerPhrasing(node2, {
81978
+ const text10 = state.containerPhrasing(node2, {
81417
81979
  before: value,
81418
81980
  after: "]",
81419
81981
  ...tracker.current()
81420
81982
  });
81421
- value += tracker.move(text9 + "][");
81983
+ value += tracker.move(text10 + "][");
81422
81984
  subexit();
81423
81985
  const stack = state.stack;
81424
81986
  state.stack = [];
@@ -81431,7 +81993,7 @@ function linkReference2(node2, _3, state, info) {
81431
81993
  subexit();
81432
81994
  state.stack = stack;
81433
81995
  exit3();
81434
- if (type === "full" || !text9 || text9 !== reference) {
81996
+ if (type === "full" || !text10 || text10 !== reference) {
81435
81997
  value += tracker.move(reference + "]");
81436
81998
  } else if (type === "shortcut") {
81437
81999
  value = value.slice(0, -1);
@@ -81676,7 +82238,7 @@ function strongPeek(_3, _1, state) {
81676
82238
  }
81677
82239
 
81678
82240
  // node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/text.js
81679
- function text6(node2, _3, state, info) {
82241
+ function text7(node2, _3, state, info) {
81680
82242
  return state.safe(node2.value, info);
81681
82243
  }
81682
82244
 
@@ -81717,7 +82279,7 @@ var handle = {
81717
82279
  paragraph: paragraph2,
81718
82280
  root: root3,
81719
82281
  strong: strong2,
81720
- text: text6,
82282
+ text: text7,
81721
82283
  thematicBreak: thematicBreak3
81722
82284
  };
81723
82285
 
@@ -82005,27 +82567,27 @@ var emailAutolink = {
82005
82567
  tokenize: tokenizeEmailAutolink,
82006
82568
  previous: previousEmail
82007
82569
  };
82008
- var text7 = {};
82570
+ var text8 = {};
82009
82571
  function gfmAutolinkLiteral() {
82010
82572
  return {
82011
- text: text7
82573
+ text: text8
82012
82574
  };
82013
82575
  }
82014
82576
  var code3 = 48;
82015
82577
  while (code3 < 123) {
82016
- text7[code3] = emailAutolink;
82578
+ text8[code3] = emailAutolink;
82017
82579
  code3++;
82018
82580
  if (code3 === 58) code3 = 65;
82019
82581
  else if (code3 === 91) code3 = 97;
82020
82582
  }
82021
- text7[43] = emailAutolink;
82022
- text7[45] = emailAutolink;
82023
- text7[46] = emailAutolink;
82024
- text7[95] = emailAutolink;
82025
- text7[72] = [emailAutolink, protocolAutolink];
82026
- text7[104] = [emailAutolink, protocolAutolink];
82027
- text7[87] = [emailAutolink, wwwAutolink];
82028
- text7[119] = [emailAutolink, wwwAutolink];
82583
+ text8[43] = emailAutolink;
82584
+ text8[45] = emailAutolink;
82585
+ text8[46] = emailAutolink;
82586
+ text8[95] = emailAutolink;
82587
+ text8[72] = [emailAutolink, protocolAutolink];
82588
+ text8[104] = [emailAutolink, protocolAutolink];
82589
+ text8[87] = [emailAutolink, wwwAutolink];
82590
+ text8[119] = [emailAutolink, wwwAutolink];
82029
82591
  function tokenizeEmailAutolink(effects, ok3, nok) {
82030
82592
  const self2 = this;
82031
82593
  let dot;
@@ -82624,17 +83186,17 @@ function gfmStrikethrough(options) {
82624
83186
  start: Object.assign({}, events[open2][1].start),
82625
83187
  end: Object.assign({}, events[index2][1].end)
82626
83188
  };
82627
- const text9 = {
83189
+ const text10 = {
82628
83190
  type: "strikethroughText",
82629
83191
  start: Object.assign({}, events[open2][1].end),
82630
83192
  end: Object.assign({}, events[index2][1].start)
82631
83193
  };
82632
- const nextEvents = [["enter", strikethrough2, context], ["enter", events[open2][1], context], ["exit", events[open2][1], context], ["enter", text9, context]];
83194
+ const nextEvents = [["enter", strikethrough2, context], ["enter", events[open2][1], context], ["exit", events[open2][1], context], ["enter", text10, context]];
82633
83195
  const insideSpan2 = context.parser.constructs.insideSpan.null;
82634
83196
  if (insideSpan2) {
82635
83197
  splice(nextEvents, nextEvents.length, 0, resolveAll(insideSpan2, events.slice(open2 + 1, index2), context));
82636
83198
  }
82637
- splice(nextEvents, nextEvents.length, 0, [["exit", text9, context], ["enter", events[index2][1], context], ["exit", events[index2][1], context], ["exit", strikethrough2, context]]);
83199
+ splice(nextEvents, nextEvents.length, 0, [["exit", text10, context], ["enter", events[index2][1], context], ["exit", events[index2][1], context], ["exit", strikethrough2, context]]);
82638
83200
  splice(events, open2 - 1, index2 - open2 + 3, nextEvents);
82639
83201
  index2 = open2 + nextEvents.length - 2;
82640
83202
  break;
@@ -84001,12 +84563,12 @@ ${css}` } })
84001
84563
  ] }),
84002
84564
  session.entries.map((entry) => {
84003
84565
  const key2 = entryFilterKey(entry);
84004
- let text9;
84566
+ let text10;
84005
84567
  if (entry.role === "tool" && entry.tool) {
84006
84568
  const name2 = entry.tool.name ?? "(tool)";
84007
- text9 = entry.tool.intentionSummary ? `${name2} \u2014 ${entry.tool.intentionSummary}` : name2;
84569
+ text10 = entry.tool.intentionSummary ? `${name2} \u2014 ${entry.tool.intentionSummary}` : name2;
84008
84570
  } else {
84009
- text9 = firstLine(entry.title ?? entry.text);
84571
+ text10 = firstLine(entry.title ?? entry.text);
84010
84572
  }
84011
84573
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("a", { href: `#entry-${entry.index}`, "data-nav-role": key2, children: [
84012
84574
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { children: [
@@ -84014,7 +84576,7 @@ ${css}` } })
84014
84576
  entry.index + 1
84015
84577
  ] }),
84016
84578
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("strong", { children: pillLabel(key2, session.agent) }),
84017
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("em", { children: text9 })
84579
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("em", { children: text10 })
84018
84580
  ] }, entry.index);
84019
84581
  })
84020
84582
  ] }) }),
@@ -84119,11 +84681,11 @@ function ToolResult({ tool }) {
84119
84681
  }
84120
84682
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("pre", { className: "plain", children: log });
84121
84683
  }
84122
- function ToolPartialOutput({ text: text9 }) {
84123
- if (!text9) return null;
84684
+ function ToolPartialOutput({ text: text10 }) {
84685
+ if (!text10) return null;
84124
84686
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("details", { className: "args-block partial-output", open: false, children: [
84125
84687
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("summary", { children: "Partial Output" }),
84126
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("pre", { className: "plain", children: text9 })
84688
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("pre", { className: "plain", children: text10 })
84127
84689
  ] });
84128
84690
  }
84129
84691
  function EventCard({ entry, sessionStart }) {
@@ -84504,13 +85066,13 @@ function sourceLabelWarning(sourceLabel) {
84504
85066
  if (!sourceLabel || sourceLabel === "events.jsonl") return void 0;
84505
85067
  return sourceLabel === "db.turns (fallback)" ? LOSSY_SOURCE_WARNING : sourceLabel;
84506
85068
  }
84507
- function isDiff(text9) {
84508
- return text9.includes("diff --git") || text9.includes("@@") && (text9.includes("+++") || text9.includes("---"));
85069
+ function isDiff(text10) {
85070
+ return text10.includes("diff --git") || text10.includes("@@") && (text10.includes("+++") || text10.includes("---"));
84509
85071
  }
84510
85072
  function htmlToSearchText(html7) {
84511
85073
  return html7.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
84512
85074
  }
84513
- function Markdown2({ text: text9 }) {
85075
+ function Markdown2({ text: text10 }) {
84514
85076
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "markdown", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
84515
85077
  Markdown,
84516
85078
  {
@@ -84533,12 +85095,12 @@ function Markdown2({ text: text9 }) {
84533
85095
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("code", { className, ...props, children });
84534
85096
  }
84535
85097
  },
84536
- children: text9
85098
+ children: text10
84537
85099
  }
84538
85100
  ) });
84539
85101
  }
84540
- function PreBlock({ text: text9 }) {
84541
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("pre", { className: "plain", children: text9 });
85102
+ function PreBlock({ text: text10 }) {
85103
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("pre", { className: "plain", children: text10 });
84542
85104
  }
84543
85105
  function countByFilter(entries, summary) {
84544
85106
  const counts = Object.fromEntries(PILL_ORDER.map((k3) => [k3, 0]));
@@ -84555,8 +85117,8 @@ function reportTitle(session) {
84555
85117
  if (repository) return repository;
84556
85118
  return `${session.agent} session`;
84557
85119
  }
84558
- function firstLine(text9) {
84559
- const line = (text9 ?? "").split("\n").find((item) => item.trim())?.trim() ?? "";
85120
+ function firstLine(text10) {
85121
+ const line = (text10 ?? "").split("\n").find((item) => item.trim())?.trim() ?? "";
84560
85122
  return line.length > 100 ? `${line.slice(0, 100)}\u2026` : line;
84561
85123
  }
84562
85124
  function pad2(n) {
@@ -84994,11 +85556,11 @@ footer { color:var(--muted); text-align:center; font-size:12px; padding:18px 0;
84994
85556
  `;
84995
85557
 
84996
85558
  // src/cli/util/io.ts
84997
- import { readFile as readFile2 } from "node:fs/promises";
84998
- import { resolve as resolve2 } from "node:path";
85559
+ import { readFile as readFile3 } from "node:fs/promises";
85560
+ import { resolve as resolve5 } from "node:path";
84999
85561
  async function readOptionalFile(path3) {
85000
85562
  if (typeof path3 !== "string" || !path3) return void 0;
85001
- return readFile2(resolve2(path3), "utf8");
85563
+ return readFile3(resolve5(path3), "utf8");
85002
85564
  }
85003
85565
 
85004
85566
  // src/cli/render-options.ts
@@ -85034,12 +85596,12 @@ function buildHtmlCommand() {
85034
85596
  cmd.action(async (id, opts) => {
85035
85597
  const ref = await resolveOne(id, opts);
85036
85598
  const session = await parseSession(ref);
85037
- const out = resolve3(String(opts.out));
85038
- await mkdir2(dirname6(out), { recursive: true });
85599
+ const out = resolve6(String(opts.out));
85600
+ await mkdir3(dirname7(out), { recursive: true });
85039
85601
  const warning = summaryMismatchWarning(opts.summary, opts.summaryFormat, "html");
85040
85602
  if (warning) console.warn(warning);
85041
85603
  const summary = await readOptionalFile(opts.summary);
85042
- await writeFile2(out, await renderSessionHtml(session, {
85604
+ await writeFile3(out, await renderSessionHtml(session, {
85043
85605
  summary,
85044
85606
  sourceLabel: sourceLabelForSession(session)
85045
85607
  }), "utf8");
@@ -85049,8 +85611,8 @@ function buildHtmlCommand() {
85049
85611
  }
85050
85612
 
85051
85613
  // src/cli/commands/md.ts
85052
- import { mkdir as mkdir3, writeFile as writeFile3 } from "node:fs/promises";
85053
- import { dirname as dirname7, resolve as resolve4 } from "node:path";
85614
+ import { mkdir as mkdir4, writeFile as writeFile4 } from "node:fs/promises";
85615
+ import { dirname as dirname8, resolve as resolve7 } from "node:path";
85054
85616
 
85055
85617
  // src/markdown/index.ts
85056
85618
  function renderSessionMarkdown(session, opts = {}) {
@@ -85209,8 +85771,8 @@ ${escapeMd(entry.text)}` : "";
85209
85771
  }
85210
85772
  return heading3(`\u{1F4CC} ${entry.kind}`, entry.text);
85211
85773
  }
85212
- function heading3(label, text9, opts = {}) {
85213
- const body3 = opts.escape === false ? text9 : escapeMd(text9);
85774
+ function heading3(label, text10, opts = {}) {
85775
+ const body3 = opts.escape === false ? text10 : escapeMd(text10);
85214
85776
  return `### ${label}
85215
85777
 
85216
85778
  ${body3}
@@ -85348,30 +85910,30 @@ function pathsSummary2(a2) {
85348
85910
  function str(value) {
85349
85911
  return value == null ? "" : String(value);
85350
85912
  }
85351
- function escapeMd(text9) {
85352
- return (text9 ?? "").replace(/</g, "\\<").replace(/>/g, "\\>");
85913
+ function escapeMd(text10) {
85914
+ return (text10 ?? "").replace(/</g, "\\<").replace(/>/g, "\\>");
85353
85915
  }
85354
- function isShort(text9, max = 5) {
85355
- return text9.split("\n").length <= max;
85916
+ function isShort(text10, max = 5) {
85917
+ return text10.split("\n").length <= max;
85356
85918
  }
85357
- function isDiffOutput(text9) {
85358
- return text9.includes("diff --git") || text9.includes("@@") && (text9.includes("+++") || text9.includes("---"));
85919
+ function isDiffOutput(text10) {
85920
+ return text10.includes("diff --git") || text10.includes("@@") && (text10.includes("+++") || text10.includes("---"));
85359
85921
  }
85360
- function containsDetailsTag(text9) {
85361
- return text9.includes("</details>") || text9.includes("<details") || text9.includes("</summary>") || text9.includes("<summary");
85922
+ function containsDetailsTag(text10) {
85923
+ return text10.includes("</details>") || text10.includes("<details") || text10.includes("</summary>") || text10.includes("<summary");
85362
85924
  }
85363
- function fence(text9, lang16 = "") {
85364
- const maxBackticks = longestBacktickRun(text9);
85925
+ function fence(text10, lang16 = "") {
85926
+ const maxBackticks = longestBacktickRun(text10);
85365
85927
  const fenceLen = Math.max(3, maxBackticks + 1);
85366
85928
  const bar = "`".repeat(fenceLen);
85367
85929
  return `${bar}${lang16}
85368
- ${text9}
85930
+ ${text10}
85369
85931
  ${bar}`;
85370
85932
  }
85371
- function longestBacktickRun(text9) {
85933
+ function longestBacktickRun(text10) {
85372
85934
  let max = 0;
85373
85935
  let run2 = 0;
85374
- for (const ch2 of text9) {
85936
+ for (const ch2 of text10) {
85375
85937
  if (ch2 === "`") {
85376
85938
  run2 += 1;
85377
85939
  if (run2 > max) max = run2;
@@ -85381,8 +85943,8 @@ function longestBacktickRun(text9) {
85381
85943
  }
85382
85944
  return max;
85383
85945
  }
85384
- function outputLabel(text9, name2) {
85385
- const lines = text9.split("\n").filter((line) => line.trim());
85946
+ function outputLabel(text10, name2) {
85947
+ const lines = text10.split("\n").filter((line) => line.trim());
85386
85948
  const n = lines.length;
85387
85949
  if (n === 0) return "No output";
85388
85950
  if (name2 === "grep" || name2 === "rg" || name2 === "glob") return `${n} ${n === 1 ? "match" : "matches"}`;
@@ -85418,9 +85980,9 @@ function buildMdCommand() {
85418
85980
  sourceLabel: sourceLabelForSession(session)
85419
85981
  });
85420
85982
  if (opts.out) {
85421
- const out = resolve4(String(opts.out));
85422
- await mkdir3(dirname7(out), { recursive: true });
85423
- await writeFile3(out, markdown, "utf8");
85983
+ const out = resolve7(String(opts.out));
85984
+ await mkdir4(dirname8(out), { recursive: true });
85985
+ await writeFile4(out, markdown, "utf8");
85424
85986
  console.log(out);
85425
85987
  } else {
85426
85988
  process.stdout.write(markdown);
@@ -85430,18 +85992,18 @@ function buildMdCommand() {
85430
85992
  }
85431
85993
 
85432
85994
  // src/cli/commands/backup/run.ts
85433
- import { resolve as resolve6 } from "node:path";
85995
+ import { resolve as resolve9 } from "node:path";
85434
85996
 
85435
85997
  // src/cli/util/proc.ts
85436
85998
  import { existsSync as existsSync2 } from "node:fs";
85437
85999
  import { spawn } from "node:child_process";
85438
- import { dirname as dirname8, resolve as resolve5 } from "node:path";
86000
+ import { dirname as dirname9, resolve as resolve8 } from "node:path";
85439
86001
  import { fileURLToPath as fileURLToPath2 } from "node:url";
85440
86002
  function resolveRepoRoot() {
85441
- let dir = dirname8(fileURLToPath2(import.meta.url));
86003
+ let dir = dirname9(fileURLToPath2(import.meta.url));
85442
86004
  for (let i3 = 0; i3 < 8; i3 += 1) {
85443
- if (existsSync2(resolve5(dir, "backup.sh"))) return dir;
85444
- dir = resolve5(dir, "..");
86005
+ if (existsSync2(resolve8(dir, "backup.sh"))) return dir;
86006
+ dir = resolve8(dir, "..");
85445
86007
  }
85446
86008
  throw new Error(
85447
86009
  "`asmgr backup` requires a source checkout: backup.sh was not found. The npm package and native binary do not bundle the restic wrapper \u2014 clone the repository and run backup from there."
@@ -85457,7 +86019,7 @@ function run(command, args) {
85457
86019
 
85458
86020
  // src/cli/commands/backup/run.ts
85459
86021
  async function runBackup(dryRun) {
85460
- const script2 = resolve6(resolveRepoRoot(), "backup.sh");
86022
+ const script2 = resolve9(resolveRepoRoot(), "backup.sh");
85461
86023
  await run(script2, dryRun ? ["--dry-run"] : []);
85462
86024
  }
85463
86025
  function buildBackupRunCommand() {
@@ -85470,30 +86032,30 @@ function buildBackupRunCommand() {
85470
86032
 
85471
86033
  // src/cli/commands/backup/cache.ts
85472
86034
  import { existsSync as existsSync3 } from "node:fs";
85473
- import { resolve as resolve8 } from "node:path";
86035
+ import { resolve as resolve11 } from "node:path";
85474
86036
 
85475
86037
  // src/cli/commands/backup/cache-target.ts
85476
- import { homedir as homedir3 } from "node:os";
85477
- import { join as join5, resolve as resolve7, sep } from "node:path";
86038
+ import { homedir as homedir4 } from "node:os";
86039
+ import { join as join7, resolve as resolve10, sep } from "node:path";
85478
86040
  function expandHome2(path3) {
85479
- if (path3 === "~") return homedir3();
85480
- if (path3.startsWith("~/")) return join5(homedir3(), path3.slice(2));
86041
+ if (path3 === "~") return homedir4();
86042
+ if (path3.startsWith("~/")) return join7(homedir4(), path3.slice(2));
85481
86043
  return path3;
85482
86044
  }
85483
86045
  function defaultCacheDir() {
85484
- return join5(homedir3(), ".cache", BIN_NAME, "restic-cache");
86046
+ return join7(homedir4(), ".cache", BIN_NAME, "restic-cache");
85485
86047
  }
85486
86048
  function assertSafeCacheTarget(target) {
85487
- const resolved = resolve7(expandHome2(target));
85488
- const home = homedir3();
86049
+ const resolved = resolve10(expandHome2(target));
86050
+ const home = homedir4();
85489
86051
  if (resolved === home) {
85490
86052
  throw new Error(`refusing to restore into the home directory (${home}); choose a dedicated --target`);
85491
86053
  }
85492
86054
  const forbiddenRoots = [
85493
- join5(home, ".copilot"),
85494
- join5(home, ".claude"),
85495
- join5(home, ".codex"),
85496
- resolve7(chatGptRoot())
86055
+ join7(home, ".copilot"),
86056
+ join7(home, ".claude"),
86057
+ join7(home, ".codex"),
86058
+ resolve10(chatGptRoot())
85497
86059
  ];
85498
86060
  for (const forbidden of forbiddenRoots) {
85499
86061
  if (resolved === forbidden || resolved.startsWith(forbidden + sep)) {
@@ -85509,7 +86071,7 @@ function buildBackupCacheCommand() {
85509
86071
  cmd.option("--target <dir>", "restore destination (must be outside the live agent homes)", defaultCacheDir()).option("--host <host>", "restrict to a restic snapshot host").option("--dry-run", "print the restic restore command without running it");
85510
86072
  cmd.action(async (snapshot, opts) => {
85511
86073
  const target = assertSafeCacheTarget(String(opts.target));
85512
- const script2 = resolve8(resolveRepoRoot(), "tools/backup-cache.sh");
86074
+ const script2 = resolve11(resolveRepoRoot(), "tools/backup-cache.sh");
85513
86075
  const extra = [];
85514
86076
  if (opts.host) extra.push("--host", String(opts.host));
85515
86077
  if (opts.dryRun) {
@@ -85534,21 +86096,21 @@ function buildBackupCommand() {
85534
86096
  }
85535
86097
 
85536
86098
  // src/cli/commands/import.ts
85537
- import { access, chmod, mkdir as mkdir4, writeFile as writeFile4 } from "node:fs/promises";
85538
- import { dirname as dirname9, resolve as resolve9 } from "node:path";
86099
+ import { access, chmod, mkdir as mkdir5, writeFile as writeFile5 } from "node:fs/promises";
86100
+ import { dirname as dirname10, resolve as resolve12 } from "node:path";
85539
86101
  function buildImportCommand() {
85540
86102
  const cmd = new Command("import").argument("<url>", "ChatGPT \u516C\u5F00\u5206\u4EAB\u94FE\u63A5").description("\u628A ChatGPT \u516C\u5F00\u5206\u4EAB\u5BFC\u5165\u672C\u5730 asmgr \u5F52\u6863").option("-o, --out <path>", "\u6307\u5B9A\u5FEB\u7167\u8F93\u51FA\u8DEF\u5F84").option("--chatgpt-root <path>", "\u8986\u76D6 ChatGPT \u5BFC\u5165\u6587\u4EF6\u7684\u6258\u7BA1\u76EE\u5F55").option("--force", "\u8986\u76D6\u5DF2\u7ECF\u5B58\u5728\u7684\u5FEB\u7167");
85541
86103
  cmd.action(async (url, opts) => {
85542
86104
  const sourceUrl = String(url);
85543
86105
  const id = chatGptConversationId(sourceUrl);
85544
- const out = opts.out ? resolve9(String(opts.out)) : chatGptSnapshotPath(id, typeof opts.chatgptRoot === "string" ? opts.chatgptRoot : void 0);
86106
+ const out = opts.out ? resolve12(String(opts.out)) : chatGptSnapshotPath(id, typeof opts.chatgptRoot === "string" ? opts.chatgptRoot : void 0);
85545
86107
  if (!opts.force && await fileExists(out)) {
85546
86108
  throw new Error(`\u8F93\u51FA\u6587\u4EF6\u5DF2\u5B58\u5728\uFF1A${out}\uFF08\u5982\u9700\u8986\u76D6\uFF0C\u8BF7\u52A0 --force\uFF09`);
85547
86109
  }
85548
86110
  const snapshot = await captureChatGptShare(sourceUrl);
85549
- await mkdir4(dirname9(out), { recursive: true });
86111
+ await mkdir5(dirname10(out), { recursive: true });
85550
86112
  try {
85551
- await writeFile4(out, `${JSON.stringify(snapshot, null, 2)}
86113
+ await writeFile5(out, `${JSON.stringify(snapshot, null, 2)}
85552
86114
  `, {
85553
86115
  encoding: "utf8",
85554
86116
  mode: 384,
@@ -85584,6 +86146,7 @@ function buildProgram() {
85584
86146
  const program2 = new Command();
85585
86147
  program2.name(BIN_NAME).description("Search and render coding-agent sessions and public ChatGPT shares").version(VERSION);
85586
86148
  program2.addCommand(buildListCommand());
86149
+ program2.addCommand(buildCurrentCommand());
85587
86150
  program2.addCommand(buildSearchCommand());
85588
86151
  program2.addCommand(buildShowCommand());
85589
86152
  program2.addCommand(buildHtmlCommand());
@@ -85594,7 +86157,7 @@ function buildProgram() {
85594
86157
  }
85595
86158
 
85596
86159
  // src/cli/index.ts
85597
- buildProgram().parseAsync().catch((error) => {
86160
+ if (!isSearchWorker) buildProgram().parseAsync().catch((error) => {
85598
86161
  console.error(error instanceof Error ? error.message : String(error));
85599
86162
  process.exit(1);
85600
86163
  });