@wanji_dsh/dsh-sales 0.11.4 → 0.11.6

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.
package/dist/client.js CHANGED
@@ -158,7 +158,7 @@ var import_react3 = __toESM(require("react"), 1);
158
158
  // src/reply-content.tsx
159
159
  var import_react2 = __toESM(require("react"), 1);
160
160
 
161
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-to-string/lib/index.js
161
+ // ../../node_modules/mdast-util-to-string/lib/index.js
162
162
  var emptyOptions = {};
163
163
  function toString(value, options) {
164
164
  const settings = options || emptyOptions;
@@ -195,7 +195,7 @@ function node(value) {
195
195
  return Boolean(value && typeof value === "object");
196
196
  }
197
197
 
198
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/decode-named-character-reference/index.dom.js
198
+ // ../../node_modules/decode-named-character-reference/index.dom.js
199
199
  var element = document.createElement("i");
200
200
  function decodeNamedCharacterReference(value) {
201
201
  const characterReference2 = "&" + value + ";";
@@ -207,7 +207,7 @@ function decodeNamedCharacterReference(value) {
207
207
  return character === characterReference2 ? false : character;
208
208
  }
209
209
 
210
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-chunked/index.js
210
+ // ../../node_modules/micromark-util-chunked/index.js
211
211
  function splice(list2, start, remove, items) {
212
212
  const end = list2.length;
213
213
  let chunkStart = 0;
@@ -241,7 +241,7 @@ function push(list2, items) {
241
241
  return items;
242
242
  }
243
243
 
244
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-combine-extensions/index.js
244
+ // ../../node_modules/micromark-util-combine-extensions/index.js
245
245
  var hasOwnProperty = {}.hasOwnProperty;
246
246
  function combineExtensions(extensions) {
247
247
  const all2 = {};
@@ -281,7 +281,7 @@ function constructs(existing, list2) {
281
281
  splice(existing, 0, 0, before);
282
282
  }
283
283
 
284
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-decode-numeric-character-reference/index.js
284
+ // ../../node_modules/micromark-util-decode-numeric-character-reference/index.js
285
285
  function decodeNumericCharacterReference(value, base) {
286
286
  const code2 = Number.parseInt(value, base);
287
287
  if (
@@ -299,12 +299,12 @@ function decodeNumericCharacterReference(value, base) {
299
299
  return String.fromCodePoint(code2);
300
300
  }
301
301
 
302
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-normalize-identifier/index.js
302
+ // ../../node_modules/micromark-util-normalize-identifier/index.js
303
303
  function normalizeIdentifier(value) {
304
304
  return value.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
305
305
  }
306
306
 
307
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-character/index.js
307
+ // ../../node_modules/micromark-util-character/index.js
308
308
  var asciiAlpha = regexCheck(/[A-Za-z]/);
309
309
  var asciiAlphanumeric = regexCheck(/[\dA-Za-z]/);
310
310
  var asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/);
@@ -336,7 +336,7 @@ function regexCheck(regex) {
336
336
  }
337
337
  }
338
338
 
339
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-factory-space/index.js
339
+ // ../../node_modules/micromark-factory-space/index.js
340
340
  function factorySpace(effects, ok3, type, max) {
341
341
  const limit = max ? max - 1 : Infinity;
342
342
  let size = 0;
@@ -381,7 +381,7 @@ function factorySpaceMinMax(effects, ok3, nok, type, min, max) {
381
381
  }
382
382
  }
383
383
 
384
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/initialize/content.js
384
+ // ../../node_modules/micromark/lib/initialize/content.js
385
385
  var content = {
386
386
  tokenize: initializeContent
387
387
  };
@@ -431,7 +431,7 @@ function initializeContent(effects) {
431
431
  }
432
432
  }
433
433
 
434
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-edit-map/index.js
434
+ // ../../node_modules/micromark-util-edit-map/index.js
435
435
  var EditMap = class {
436
436
  /**
437
437
  * Create a new edit map.
@@ -529,7 +529,7 @@ function addImplementation(editMap, at, remove, add, before) {
529
529
  editMap.index.set(at, change);
530
530
  }
531
531
 
532
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/initialize/document.js
532
+ // ../../node_modules/micromark/lib/initialize/document.js
533
533
  var document2 = {
534
534
  tokenize: initializeDocument
535
535
  };
@@ -723,7 +723,7 @@ function tokenizeContainer(effects, ok3, nok) {
723
723
  return factorySpace(effects, effects.attempt(this.parser.constructs.document, ok3, nok), "linePrefix", this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4);
724
724
  }
725
725
 
726
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-classify-character/index.js
726
+ // ../../node_modules/micromark-util-classify-character/index.js
727
727
  function classifyCharacter(code2) {
728
728
  if (code2 === null || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) {
729
729
  return 1;
@@ -733,7 +733,7 @@ function classifyCharacter(code2) {
733
733
  }
734
734
  }
735
735
 
736
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-resolve-all/index.js
736
+ // ../../node_modules/micromark-util-resolve-all/index.js
737
737
  function resolveAll(constructs2, events, context) {
738
738
  const called = [];
739
739
  let index2 = -1;
@@ -747,7 +747,7 @@ function resolveAll(constructs2, events, context) {
747
747
  return events;
748
748
  }
749
749
 
750
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/attention.js
750
+ // ../../node_modules/micromark-core-commonmark/lib/attention.js
751
751
  var attention = {
752
752
  name: "attention",
753
753
  resolveAll: resolveAllAttention,
@@ -870,7 +870,7 @@ function movePoint(point3, offset) {
870
870
  point3._bufferIndex += offset;
871
871
  }
872
872
 
873
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/autolink.js
873
+ // ../../node_modules/micromark-core-commonmark/lib/autolink.js
874
874
  var autolink = {
875
875
  name: "autolink",
876
876
  tokenize: tokenizeAutolink
@@ -971,7 +971,7 @@ function tokenizeAutolink(effects, ok3, nok) {
971
971
  }
972
972
  }
973
973
 
974
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/blank-line.js
974
+ // ../../node_modules/micromark-core-commonmark/lib/blank-line.js
975
975
  var blankLine = {
976
976
  partial: true,
977
977
  tokenize: tokenizeBlankLine
@@ -986,7 +986,7 @@ function tokenizeBlankLine(effects, ok3, nok) {
986
986
  }
987
987
  }
988
988
 
989
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/block-quote.js
989
+ // ../../node_modules/micromark-core-commonmark/lib/block-quote.js
990
990
  var blockQuote = {
991
991
  continuation: {
992
992
  tokenize: tokenizeBlockQuoteContinuation
@@ -1044,7 +1044,7 @@ function exit(effects) {
1044
1044
  effects.exit("blockQuote");
1045
1045
  }
1046
1046
 
1047
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/character-escape.js
1047
+ // ../../node_modules/micromark-core-commonmark/lib/character-escape.js
1048
1048
  var characterEscape = {
1049
1049
  name: "characterEscape",
1050
1050
  tokenize: tokenizeCharacterEscape
@@ -1070,7 +1070,7 @@ function tokenizeCharacterEscape(effects, ok3, nok) {
1070
1070
  }
1071
1071
  }
1072
1072
 
1073
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/character-reference.js
1073
+ // ../../node_modules/micromark-core-commonmark/lib/character-reference.js
1074
1074
  var characterReference = {
1075
1075
  name: "characterReference",
1076
1076
  tokenize: tokenizeCharacterReference
@@ -1135,7 +1135,7 @@ function tokenizeCharacterReference(effects, ok3, nok) {
1135
1135
  }
1136
1136
  }
1137
1137
 
1138
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.js
1138
+ // ../../node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.js
1139
1139
  var nonLazyContinuation = {
1140
1140
  partial: true,
1141
1141
  tokenize: tokenizeNonLazyContinuation
@@ -1157,7 +1157,7 @@ function tokenizeNonLazyContinuation(effects, ok3, nok) {
1157
1157
  }
1158
1158
  }
1159
1159
 
1160
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/code-fenced.js
1160
+ // ../../node_modules/micromark-core-commonmark/lib/code-fenced.js
1161
1161
  var codeFenced = {
1162
1162
  concrete: true,
1163
1163
  name: "codeFenced",
@@ -1320,7 +1320,7 @@ function tokenizeCodeFenced(effects, ok3, nok) {
1320
1320
  }
1321
1321
  }
1322
1322
 
1323
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/code-indented.js
1323
+ // ../../node_modules/micromark-core-commonmark/lib/code-indented.js
1324
1324
  var codeIndented = {
1325
1325
  name: "codeIndented",
1326
1326
  tokenize: tokenizeCodeIndented
@@ -1378,7 +1378,7 @@ function tokenizeFurtherStart(effects, ok3, nok) {
1378
1378
  }
1379
1379
  }
1380
1380
 
1381
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/code-text.js
1381
+ // ../../node_modules/micromark-core-commonmark/lib/code-text.js
1382
1382
  var codeText = {
1383
1383
  name: "codeText",
1384
1384
  previous,
@@ -1493,7 +1493,7 @@ function tokenizeCodeText(effects, ok3, nok) {
1493
1493
  }
1494
1494
  }
1495
1495
 
1496
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-subtokenize/lib/splice-buffer.js
1496
+ // ../../node_modules/micromark-util-subtokenize/lib/splice-buffer.js
1497
1497
  var SpliceBuffer = class {
1498
1498
  /**
1499
1499
  * @param {ReadonlyArray<T> | null | undefined} [initial]
@@ -1686,7 +1686,7 @@ function chunkedPush(list2, right) {
1686
1686
  }
1687
1687
  }
1688
1688
 
1689
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-subtokenize/index.js
1689
+ // ../../node_modules/micromark-util-subtokenize/index.js
1690
1690
  function subtokenize(eventsArray) {
1691
1691
  const jumps = {};
1692
1692
  let index2 = -1;
@@ -1839,7 +1839,7 @@ function subcontent(events, eventIndex) {
1839
1839
  return gaps;
1840
1840
  }
1841
1841
 
1842
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/content.js
1842
+ // ../../node_modules/micromark-core-commonmark/lib/content.js
1843
1843
  var content2 = {
1844
1844
  resolve: resolveContent,
1845
1845
  tokenize: tokenizeContent
@@ -1910,7 +1910,7 @@ function tokenizeContinuation(effects, ok3, nok) {
1910
1910
  }
1911
1911
  }
1912
1912
 
1913
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-factory-destination/index.js
1913
+ // ../../node_modules/micromark-factory-destination/index.js
1914
1914
  function factoryDestination(effects, ok3, nok, type, literalType, literalMarkerType, rawType, stringType, max) {
1915
1915
  const limit = max || Number.POSITIVE_INFINITY;
1916
1916
  let balance = 0;
@@ -2002,7 +2002,7 @@ function factoryDestination(effects, ok3, nok, type, literalType, literalMarkerT
2002
2002
  }
2003
2003
  }
2004
2004
 
2005
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-factory-label/index.js
2005
+ // ../../node_modules/micromark-factory-label/index.js
2006
2006
  function factoryLabel(effects, ok3, nok, type, markerType, stringType) {
2007
2007
  const self = this;
2008
2008
  let size = 0;
@@ -2063,7 +2063,7 @@ function factoryLabel(effects, ok3, nok, type, markerType, stringType) {
2063
2063
  }
2064
2064
  }
2065
2065
 
2066
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-factory-title/index.js
2066
+ // ../../node_modules/micromark-factory-title/index.js
2067
2067
  function factoryTitle(effects, ok3, nok, type, markerType, stringType) {
2068
2068
  let marker;
2069
2069
  return start;
@@ -2125,7 +2125,7 @@ function factoryTitle(effects, ok3, nok, type, markerType, stringType) {
2125
2125
  }
2126
2126
  }
2127
2127
 
2128
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-factory-whitespace/index.js
2128
+ // ../../node_modules/micromark-factory-whitespace/index.js
2129
2129
  function factoryWhitespace(effects, ok3) {
2130
2130
  let seen;
2131
2131
  return start;
@@ -2144,7 +2144,7 @@ function factoryWhitespace(effects, ok3) {
2144
2144
  }
2145
2145
  }
2146
2146
 
2147
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/definition.js
2147
+ // ../../node_modules/micromark-core-commonmark/lib/definition.js
2148
2148
  var definition = {
2149
2149
  name: "definition",
2150
2150
  tokenize: tokenizeDefinition
@@ -2230,7 +2230,7 @@ function tokenizeTitleBefore(effects, ok3, nok) {
2230
2230
  }
2231
2231
  }
2232
2232
 
2233
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/hard-break-escape.js
2233
+ // ../../node_modules/micromark-core-commonmark/lib/hard-break-escape.js
2234
2234
  var hardBreakEscape = {
2235
2235
  name: "hardBreakEscape",
2236
2236
  tokenize: tokenizeHardBreakEscape
@@ -2251,7 +2251,7 @@ function tokenizeHardBreakEscape(effects, ok3, nok) {
2251
2251
  }
2252
2252
  }
2253
2253
 
2254
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/heading-atx.js
2254
+ // ../../node_modules/micromark-core-commonmark/lib/heading-atx.js
2255
2255
  var headingAtx = {
2256
2256
  name: "headingAtx",
2257
2257
  resolve: resolveHeadingAtx,
@@ -2340,7 +2340,7 @@ function tokenizeHeadingAtx(effects, ok3, nok) {
2340
2340
  }
2341
2341
  }
2342
2342
 
2343
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-html-tag-name/index.js
2343
+ // ../../node_modules/micromark-util-html-tag-name/index.js
2344
2344
  var htmlBlockNames = [
2345
2345
  "address",
2346
2346
  "article",
@@ -2407,7 +2407,7 @@ var htmlBlockNames = [
2407
2407
  ];
2408
2408
  var htmlRawNames = ["pre", "script", "style", "textarea"];
2409
2409
 
2410
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/html-flow.js
2410
+ // ../../node_modules/micromark-core-commonmark/lib/html-flow.js
2411
2411
  var htmlFlow = {
2412
2412
  concrete: true,
2413
2413
  name: "htmlFlow",
@@ -2766,7 +2766,7 @@ function tokenizeBlankLineBefore(effects, ok3, nok) {
2766
2766
  }
2767
2767
  }
2768
2768
 
2769
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/html-text.js
2769
+ // ../../node_modules/micromark-core-commonmark/lib/html-text.js
2770
2770
  var htmlText = {
2771
2771
  name: "htmlText",
2772
2772
  tokenize: tokenizeHtmlText
@@ -3072,7 +3072,7 @@ function tokenizeHtmlText(effects, ok3, nok) {
3072
3072
  }
3073
3073
  }
3074
3074
 
3075
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/label-end.js
3075
+ // ../../node_modules/micromark-core-commonmark/lib/label-end.js
3076
3076
  var labelEnd = {
3077
3077
  name: "labelEnd",
3078
3078
  resolveAll: resolveAllLabelEnd,
@@ -3298,7 +3298,7 @@ function tokenizeReferenceCollapsed(effects, ok3, nok) {
3298
3298
  }
3299
3299
  }
3300
3300
 
3301
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/label-start-image.js
3301
+ // ../../node_modules/micromark-core-commonmark/lib/label-start-image.js
3302
3302
  var labelStartImage = {
3303
3303
  name: "labelStartImage",
3304
3304
  resolveAll: labelEnd.resolveAll,
@@ -3335,7 +3335,7 @@ function tokenizeLabelStartImage(effects, ok3, nok) {
3335
3335
  }
3336
3336
  }
3337
3337
 
3338
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/label-start-link.js
3338
+ // ../../node_modules/micromark-core-commonmark/lib/label-start-link.js
3339
3339
  var labelStartLink = {
3340
3340
  name: "labelStartLink",
3341
3341
  resolveAll: labelEnd.resolveAll,
@@ -3363,7 +3363,7 @@ function tokenizeLabelStartLink(effects, ok3, nok) {
3363
3363
  }
3364
3364
  }
3365
3365
 
3366
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/line-ending.js
3366
+ // ../../node_modules/micromark-core-commonmark/lib/line-ending.js
3367
3367
  var lineEnding = {
3368
3368
  name: "lineEnding",
3369
3369
  tokenize: tokenizeLineEnding
@@ -3378,7 +3378,7 @@ function tokenizeLineEnding(effects, ok3) {
3378
3378
  }
3379
3379
  }
3380
3380
 
3381
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/thematic-break.js
3381
+ // ../../node_modules/micromark-core-commonmark/lib/thematic-break.js
3382
3382
  var thematicBreak = {
3383
3383
  name: "thematicBreak",
3384
3384
  tokenize: tokenizeThematicBreak
@@ -3417,7 +3417,7 @@ function tokenizeThematicBreak(effects, ok3, nok) {
3417
3417
  }
3418
3418
  }
3419
3419
 
3420
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/list.js
3420
+ // ../../node_modules/micromark-core-commonmark/lib/list.js
3421
3421
  var list = {
3422
3422
  continuation: {
3423
3423
  tokenize: tokenizeListContinuation
@@ -3547,7 +3547,7 @@ function tokenizeListItemPrefixWhitespace(effects, ok3, nok) {
3547
3547
  }
3548
3548
  }
3549
3549
 
3550
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/setext-underline.js
3550
+ // ../../node_modules/micromark-core-commonmark/lib/setext-underline.js
3551
3551
  var setextUnderline = {
3552
3552
  name: "setextUnderline",
3553
3553
  resolveTo: resolveToSetextUnderline,
@@ -3641,7 +3641,7 @@ function tokenizeSetextUnderline(effects, ok3, nok) {
3641
3641
  }
3642
3642
  }
3643
3643
 
3644
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/initialize/flow.js
3644
+ // ../../node_modules/micromark/lib/initialize/flow.js
3645
3645
  var flow = {
3646
3646
  tokenize: initializeFlow
3647
3647
  };
@@ -3679,7 +3679,7 @@ function initializeFlow(effects) {
3679
3679
  }
3680
3680
  }
3681
3681
 
3682
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/initialize/text.js
3682
+ // ../../node_modules/micromark/lib/initialize/text.js
3683
3683
  var resolver = {
3684
3684
  resolveAll: createResolver()
3685
3685
  };
@@ -3821,7 +3821,7 @@ function resolveAllLineSuffixes(events, context) {
3821
3821
  return events;
3822
3822
  }
3823
3823
 
3824
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/constructs.js
3824
+ // ../../node_modules/micromark/lib/constructs.js
3825
3825
  var constructs_exports = {};
3826
3826
  __export(constructs_exports, {
3827
3827
  attentionMarkers: () => attentionMarkers,
@@ -3896,7 +3896,7 @@ var disable = {
3896
3896
  null: []
3897
3897
  };
3898
3898
 
3899
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/create-tokenizer.js
3899
+ // ../../node_modules/micromark/lib/create-tokenizer.js
3900
3900
  function createTokenizer(parser, initialize, from) {
3901
3901
  let point3 = {
3902
3902
  _bufferIndex: -1,
@@ -4222,7 +4222,7 @@ function serializeChunks(chunks, expandTabs) {
4222
4222
  return result.join("");
4223
4223
  }
4224
4224
 
4225
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/parse.js
4225
+ // ../../node_modules/micromark/lib/parse.js
4226
4226
  function parse(options) {
4227
4227
  const settings = options || {};
4228
4228
  const constructs2 = (
@@ -4248,14 +4248,14 @@ function parse(options) {
4248
4248
  }
4249
4249
  }
4250
4250
 
4251
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/postprocess.js
4251
+ // ../../node_modules/micromark/lib/postprocess.js
4252
4252
  function postprocess(events) {
4253
4253
  while (!subtokenize(events)) {
4254
4254
  }
4255
4255
  return events;
4256
4256
  }
4257
4257
 
4258
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/preprocess.js
4258
+ // ../../node_modules/micromark/lib/preprocess.js
4259
4259
  var search = /[\0\t\n\r]/g;
4260
4260
  function preprocess() {
4261
4261
  let column = 1;
@@ -4335,7 +4335,7 @@ function preprocess() {
4335
4335
  }
4336
4336
  }
4337
4337
 
4338
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-decode-string/index.js
4338
+ // ../../node_modules/micromark-util-decode-string/index.js
4339
4339
  var characterEscapeOrReference = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;
4340
4340
  function decodeString(value) {
4341
4341
  return value.replace(characterEscapeOrReference, decode);
@@ -4353,7 +4353,7 @@ function decode($0, $1, $2) {
4353
4353
  return decodeNamedCharacterReference($2) || $0;
4354
4354
  }
4355
4355
 
4356
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/unist-util-stringify-position/lib/index.js
4356
+ // ../../node_modules/unist-util-stringify-position/lib/index.js
4357
4357
  function stringifyPosition(value) {
4358
4358
  if (!value || typeof value !== "object") {
4359
4359
  return "";
@@ -4379,7 +4379,7 @@ function index(value) {
4379
4379
  return value && typeof value === "number" ? value : 1;
4380
4380
  }
4381
4381
 
4382
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-from-markdown/lib/index.js
4382
+ // ../../node_modules/mdast-util-from-markdown/lib/index.js
4383
4383
  var own = {}.hasOwnProperty;
4384
4384
  function fromMarkdown(value, encoding, options) {
4385
4385
  if (encoding && typeof encoding === "object") {
@@ -5088,7 +5088,7 @@ function defaultOnError(left, right) {
5088
5088
  }
5089
5089
  }
5090
5090
 
5091
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/ccount/index.js
5091
+ // ../../node_modules/ccount/index.js
5092
5092
  function ccount(value, character) {
5093
5093
  const source = String(value);
5094
5094
  if (typeof character !== "string") {
@@ -5103,11 +5103,11 @@ function ccount(value, character) {
5103
5103
  return count;
5104
5104
  }
5105
5105
 
5106
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/devlop/lib/default.js
5106
+ // ../../node_modules/devlop/lib/default.js
5107
5107
  function ok() {
5108
5108
  }
5109
5109
 
5110
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/escape-string-regexp/index.js
5110
+ // ../../node_modules/escape-string-regexp/index.js
5111
5111
  function escapeStringRegexp(string5) {
5112
5112
  if (typeof string5 !== "string") {
5113
5113
  throw new TypeError("Expected a string");
@@ -5115,7 +5115,7 @@ function escapeStringRegexp(string5) {
5115
5115
  return string5.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
5116
5116
  }
5117
5117
 
5118
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/unist-util-is/lib/index.js
5118
+ // ../../node_modules/unist-util-is/lib/index.js
5119
5119
  var convert = (
5120
5120
  // Note: overloads in JSDoc can’t yet use different `@template`s.
5121
5121
  /**
@@ -5214,12 +5214,12 @@ function looksLikeANode(value) {
5214
5214
  return value !== null && typeof value === "object" && "type" in value;
5215
5215
  }
5216
5216
 
5217
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/unist-util-visit-parents/lib/color.js
5217
+ // ../../node_modules/unist-util-visit-parents/lib/color.js
5218
5218
  function color(d) {
5219
5219
  return d;
5220
5220
  }
5221
5221
 
5222
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/unist-util-visit-parents/lib/index.js
5222
+ // ../../node_modules/unist-util-visit-parents/lib/index.js
5223
5223
  var empty = [];
5224
5224
  var CONTINUE = true;
5225
5225
  var EXIT = false;
@@ -5339,7 +5339,7 @@ function toResult(value) {
5339
5339
  return value === null || value === void 0 ? empty : [value];
5340
5340
  }
5341
5341
 
5342
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-find-and-replace/lib/index.js
5342
+ // ../../node_modules/mdast-util-find-and-replace/lib/index.js
5343
5343
  function findAndReplace(tree, list2, options) {
5344
5344
  const settings = options || {};
5345
5345
  const ignored = convert(settings.ignore || []);
@@ -5440,7 +5440,7 @@ function toFunction(replace2) {
5440
5440
  };
5441
5441
  }
5442
5442
 
5443
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-gfm-autolink-literal/lib/index.js
5443
+ // ../../node_modules/mdast-util-gfm-autolink-literal/lib/index.js
5444
5444
  function gfmAutolinkLiteralFromMarkdown() {
5445
5445
  return {
5446
5446
  transforms: [transformGfmAutolinkLiterals],
@@ -5605,7 +5605,7 @@ function previous2(match) {
5605
5605
  return match.index === 0 || unicodeWhitespace(code2) || unicodePunctuation(code2);
5606
5606
  }
5607
5607
 
5608
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-gfm-footnote/lib/index.js
5608
+ // ../../node_modules/mdast-util-gfm-footnote/lib/index.js
5609
5609
  footnoteReference.peek = footnoteReferencePeek;
5610
5610
  function enterFootnoteCallString() {
5611
5611
  this.buffer();
@@ -5679,7 +5679,7 @@ function gfmFootnoteFromMarkdown() {
5679
5679
  };
5680
5680
  }
5681
5681
 
5682
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-gfm-strikethrough/lib/index.js
5682
+ // ../../node_modules/mdast-util-gfm-strikethrough/lib/index.js
5683
5683
  handleDelete.attention = attentionDelete;
5684
5684
  handleDelete.peek = peekDelete;
5685
5685
  function gfmStrikethroughFromMarkdown() {
@@ -5716,7 +5716,7 @@ function peekDelete() {
5716
5716
  return "~";
5717
5717
  }
5718
5718
 
5719
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-gfm-table/lib/index.js
5719
+ // ../../node_modules/mdast-util-gfm-table/lib/index.js
5720
5720
  function gfmTableFromMarkdown() {
5721
5721
  return {
5722
5722
  enter: {
@@ -5777,7 +5777,7 @@ function replace($0, $1) {
5777
5777
  return $1 === "|" ? $1 : $0;
5778
5778
  }
5779
5779
 
5780
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-gfm-task-list-item/lib/index.js
5780
+ // ../../node_modules/mdast-util-gfm-task-list-item/lib/index.js
5781
5781
  function gfmTaskListItemFromMarkdown() {
5782
5782
  return {
5783
5783
  exit: {
@@ -5824,7 +5824,7 @@ function exitParagraphWithTaskListItem(token) {
5824
5824
  this.exit(token);
5825
5825
  }
5826
5826
 
5827
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-gfm/lib/index.js
5827
+ // ../../node_modules/mdast-util-gfm/lib/index.js
5828
5828
  function gfmFromMarkdown() {
5829
5829
  return [
5830
5830
  gfmAutolinkLiteralFromMarkdown(),
@@ -5835,7 +5835,7 @@ function gfmFromMarkdown() {
5835
5835
  ];
5836
5836
  }
5837
5837
 
5838
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm-autolink-literal/lib/syntax.js
5838
+ // ../../node_modules/micromark-extension-gfm-autolink-literal/lib/syntax.js
5839
5839
  var wwwPrefix = {
5840
5840
  tokenize: tokenizeWwwPrefix,
5841
5841
  partial: true
@@ -6177,7 +6177,7 @@ function previousUnbalanced(events) {
6177
6177
  return result;
6178
6178
  }
6179
6179
 
6180
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm-footnote/lib/syntax.js
6180
+ // ../../node_modules/micromark-extension-gfm-footnote/lib/syntax.js
6181
6181
  var indent = {
6182
6182
  tokenize: tokenizeIndent2,
6183
6183
  partial: true
@@ -6452,7 +6452,7 @@ function tokenizeIndent2(effects, ok3, nok) {
6452
6452
  }
6453
6453
  }
6454
6454
 
6455
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm-strikethrough/lib/syntax.js
6455
+ // ../../node_modules/micromark-extension-gfm-strikethrough/lib/syntax.js
6456
6456
  function gfmStrikethrough(options) {
6457
6457
  const options_ = options || {};
6458
6458
  let single = options_.singleTilde;
@@ -6546,7 +6546,7 @@ function gfmStrikethrough(options) {
6546
6546
  }
6547
6547
  }
6548
6548
 
6549
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm-table/lib/edit-map.js
6549
+ // ../../node_modules/micromark-extension-gfm-table/lib/edit-map.js
6550
6550
  var EditMap2 = class {
6551
6551
  /**
6552
6552
  * Create a new edit map.
@@ -6632,7 +6632,7 @@ function addImplementation2(editMap, at, remove, add) {
6632
6632
  editMap.index.set(at, change);
6633
6633
  }
6634
6634
 
6635
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm-table/lib/infer.js
6635
+ // ../../node_modules/micromark-extension-gfm-table/lib/infer.js
6636
6636
  function gfmTableAlign(events, index2) {
6637
6637
  let inDelimiterRow = false;
6638
6638
  const align = [];
@@ -6659,7 +6659,7 @@ function gfmTableAlign(events, index2) {
6659
6659
  return align;
6660
6660
  }
6661
6661
 
6662
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm-table/lib/syntax.js
6662
+ // ../../node_modules/micromark-extension-gfm-table/lib/syntax.js
6663
6663
  function gfmTable() {
6664
6664
  return {
6665
6665
  flow: {
@@ -7050,7 +7050,7 @@ function getPoint(events, index2) {
7050
7050
  return event[1][side];
7051
7051
  }
7052
7052
 
7053
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm-task-list-item/lib/syntax.js
7053
+ // ../../node_modules/micromark-extension-gfm-task-list-item/lib/syntax.js
7054
7054
  var tasklistCheck = {
7055
7055
  name: "tasklistCheck",
7056
7056
  tokenize: tokenizeTasklistCheck
@@ -7124,7 +7124,7 @@ function spaceThenNonSpace(effects, ok3, nok) {
7124
7124
  }
7125
7125
  }
7126
7126
 
7127
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm/index.js
7127
+ // ../../node_modules/micromark-extension-gfm/index.js
7128
7128
  function gfm(options) {
7129
7129
  return combineExtensions([
7130
7130
  gfmAutolinkLiteral(),
@@ -7888,21 +7888,31 @@ function createWechatClient(rpc, snapshot, options = {}) {
7888
7888
  if (e !== epoch || refreshId !== refreshEpoch) return;
7889
7889
  if (status2.revision !== revision2) {
7890
7890
  const contacts = [];
7891
- let result, expectedRevision;
7891
+ let page;
7892
+ let expectedRevision;
7893
+ let snapshotId = status2.stableContactPages ? "" : void 0;
7892
7894
  do {
7893
- result = await request("contacts", { limit: 200, offset: contacts.length, ...expectedRevision === void 0 ? {} : { expectedRevision } });
7894
- if (expectedRevision !== void 0 && result.revision !== expectedRevision) throw Error("WECHAT_SNAPSHOT_CHANGED");
7895
- expectedRevision = result.revision;
7896
- contacts.push(...result.contacts);
7897
- } while (result.contacts.length === 200);
7898
- if (e !== epoch || scope !== workspace || refreshId !== refreshEpoch) return;
7895
+ const cursor = snapshotId !== void 0 ? { snapshotId } : expectedRevision === void 0 ? {} : { expectedRevision };
7896
+ page = await request("contacts", { limit: 200, offset: contacts.length, ...cursor });
7897
+ if (e !== epoch || refreshId !== refreshEpoch) return;
7898
+ if (expectedRevision !== void 0 && page.revision !== expectedRevision) throw Error("WECHAT_SNAPSHOT_CHANGED");
7899
+ if (status2.stableContactPages) {
7900
+ if (!page.snapshotId || snapshotId && page.snapshotId !== snapshotId) throw Error("WECHAT_CONTACT_SNAPSHOT_EXPIRED");
7901
+ snapshotId = page.snapshotId;
7902
+ }
7903
+ expectedRevision = page.revision;
7904
+ contacts.push(...page.contacts);
7905
+ } while (page.contacts.length === 200);
7906
+ if (scope !== workspace) return;
7899
7907
  snapshot(contacts);
7900
7908
  revision2 = expectedRevision;
7901
7909
  }
7902
7910
  publish({ status: status2, error: void 0 });
7903
- } catch (e2) {
7904
- if (e2 instanceof Error && (e2.message === "WECHAT_SNAPSHOT_CHANGED" || "code" in e2 && e2.code === "WECHAT_SNAPSHOT_CHANGED")) return;
7905
- if (scope === workspace && !disposed && refreshId === refreshEpoch) publish({ error: e2 instanceof Error ? e2.message : "\u5FAE\u4FE1\u72B6\u6001\u52A0\u8F7D\u5931\u8D25" });
7911
+ } catch (error) {
7912
+ if (scope !== workspace || disposed || e !== epoch || refreshId !== refreshEpoch) return;
7913
+ const code2 = error instanceof Error ? "code" in error ? error.code : error.message : void 0;
7914
+ if (code2 === "WECHAT_SNAPSHOT_CHANGED" || code2 === "WECHAT_CONTACT_SNAPSHOT_EXPIRED") return;
7915
+ publish({ error: error instanceof Error ? error.message : "\u5FAE\u4FE1\u72B6\u6001\u52A0\u8F7D\u5931\u8D25" });
7906
7916
  }
7907
7917
  const status = view.status;
7908
7918
  if (options.automatic && !disposed && e === epoch && refreshId === refreshEpoch && !view.error && status?.phase === "disconnected" && !status.message && status.capabilities?.ready && !automaticAttempts.has(scope)) {
@@ -8109,8 +8119,9 @@ var voicePlayback = new VoicePlaybackCoordinator();
8109
8119
  function WechatMessageBody({ message, client, contactId, revision: revision2, t, onPrioritize }) {
8110
8120
  const attachment = message.kind === "image" || message.kind === "voice" || message.kind === "audio" || message.kind === "video";
8111
8121
  const text4 = attachment ? /^\[(?:image|图片|video|视频|(?:voice|audio|语音)(?:\s*\d+(?:\.\d+)?\s*(?:秒|s|["″”]))?)\]$/i.test(message.text?.trim() ?? "") ? "" : message.text : message.text || `[${message.kind}]`;
8112
- const transcribe = contactId && message.kind === "voice" ? (signal) => client.transcribeVoice(contactId, message.id, signal) : void 0;
8113
- return /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null, text4 && /* @__PURE__ */ import_react8.default.createElement("div", null, text4), message.mediaId ? /* @__PURE__ */ import_react8.default.createElement(NativeMedia, { client, mediaId: message.mediaId, kind: message.kind, revision: revision2, t, transcribe }) : attachment && /* @__PURE__ */ import_react8.default.createElement(PendingAttachment, { kind: message.kind, t, prioritize: message.kind === "video" ? void 0 : onPrioritize }));
8122
+ const voiceMenu = !!contactId && message.kind === "voice";
8123
+ const media = message.mediaId ? /* @__PURE__ */ import_react8.default.createElement(NativeMedia, { client, mediaId: message.mediaId, kind: message.kind, revision: revision2, t, voiceMenu }) : attachment && /* @__PURE__ */ import_react8.default.createElement(PendingAttachment, { kind: message.kind, t, prioritize: message.kind === "video" ? void 0 : onPrioritize });
8124
+ return /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null, text4 && /* @__PURE__ */ import_react8.default.createElement("div", null, text4), voiceMenu ? /* @__PURE__ */ import_react8.default.createElement(VoiceTranscription, { key: message.mediaId, t, pending: !message.mediaId, transcribe: (signal) => client.transcribeVoice(contactId, message.id, signal) }, media) : media);
8114
8125
  }
8115
8126
  function PendingAttachment({ kind, t, prioritize }) {
8116
8127
  const [state, setState] = (0, import_react8.useState)("idle");
@@ -8130,7 +8141,7 @@ function PendingAttachment({ kind, t, prioritize }) {
8130
8141
  function NativeMedia(props) {
8131
8142
  return /* @__PURE__ */ import_react8.default.createElement(MediaAttachment, { key: props.mediaId, ...props });
8132
8143
  }
8133
- function MediaAttachment({ client, mediaId, kind, revision: revision2, t, transcribe }) {
8144
+ function MediaAttachment({ client, mediaId, kind, revision: revision2, t, voiceMenu }) {
8134
8145
  const [result, setResult] = (0, import_react8.useState)({ mediaId });
8135
8146
  const [requested, setRequested] = (0, import_react8.useState)(kind !== "video");
8136
8147
  const [retry, setRetry] = (0, import_react8.useState)(0), element2 = (0, import_react8.useRef)(null), loaded = (0, import_react8.useRef)(false);
@@ -8166,7 +8177,7 @@ function MediaAttachment({ client, mediaId, kind, revision: revision2, t, transc
8166
8177
  if (kind === "video") {
8167
8178
  return /* @__PURE__ */ import_react8.default.createElement("div", { ref: element2, className: "ws-native-media" }, result.url ? /* @__PURE__ */ import_react8.default.createElement("video", { src: result.url, controls: true, playsInline: true, preload: "metadata", "aria-label": t("wxVideoMessage"), onError: failed }) : result.error ? /* @__PURE__ */ import_react8.default.createElement("span", { role: "status" }, t("wxVideoUnavailable"), " ", /* @__PURE__ */ import_react8.default.createElement("button", { type: "button", className: "ws-text-button", onClick: () => setRetry((value) => value + 1) }, t("wxMediaRetry"))) : requested ? /* @__PURE__ */ import_react8.default.createElement("span", { className: "ws-media-placeholder", role: "status" }, t("wxVideoLoading")) : /* @__PURE__ */ import_react8.default.createElement("button", { type: "button", className: "ws-button ws-video-load", onClick: () => setRequested(true) }, t("wxVideoLoad")));
8168
8179
  }
8169
- return /* @__PURE__ */ import_react8.default.createElement("div", { ref: element2, className: "ws-native-media" }, result.url ? result.url.startsWith("data:image/") ? /* @__PURE__ */ import_react8.default.createElement(ImageAttachment, { src: result.url, t, onError: failed }) : /* @__PURE__ */ import_react8.default.createElement(VoiceAttachment, { key: result.url, src: result.url, t, onError: failed, transcribe }) : result.error ? kind === "voice" || kind === "audio" ? /* @__PURE__ */ import_react8.default.createElement(VoicePlaceholder, { state: "error", t, retry: () => setRetry((value) => value + 1) }) : /* @__PURE__ */ import_react8.default.createElement("span", { role: "status" }, t(kind === "image" ? "wxImageUnavailable" : "wxAudioUnavailable"), " ", /* @__PURE__ */ import_react8.default.createElement("button", { className: "ws-text-button", onClick: () => setRetry((value) => value + 1) }, t("wxMediaRetry"))) : kind === "voice" || kind === "audio" ? /* @__PURE__ */ import_react8.default.createElement(VoicePlaceholder, { state: "loading", t }) : /* @__PURE__ */ import_react8.default.createElement("span", { className: "ws-media-placeholder", role: "status" }, t("wxImageLoading")));
8180
+ return /* @__PURE__ */ import_react8.default.createElement("div", { ref: element2, className: "ws-native-media" }, result.url ? result.url.startsWith("data:image/") ? /* @__PURE__ */ import_react8.default.createElement(ImageAttachment, { src: result.url, t, onError: failed }) : /* @__PURE__ */ import_react8.default.createElement(VoiceAttachment, { key: result.url, src: result.url, t, onError: failed, voiceMenu }) : result.error ? kind === "voice" || kind === "audio" ? /* @__PURE__ */ import_react8.default.createElement(VoicePlaceholder, { state: "error", t, retry: () => setRetry((value) => value + 1) }) : /* @__PURE__ */ import_react8.default.createElement("span", { role: "status" }, t(kind === "image" ? "wxImageUnavailable" : "wxAudioUnavailable"), " ", /* @__PURE__ */ import_react8.default.createElement("button", { className: "ws-text-button", onClick: () => setRetry((value) => value + 1) }, t("wxMediaRetry"))) : kind === "voice" || kind === "audio" ? /* @__PURE__ */ import_react8.default.createElement(VoicePlaceholder, { state: "loading", t }) : /* @__PURE__ */ import_react8.default.createElement("span", { className: "ws-media-placeholder", role: "status" }, t("wxImageLoading")));
8170
8181
  }
8171
8182
  function ImageAttachment({ src, t, onError }) {
8172
8183
  const [open, setOpen] = (0, import_react8.useState)(false), trigger = (0, import_react8.useRef)(null);
@@ -8178,18 +8189,14 @@ function VoiceWaves() {
8178
8189
  function VoicePlaceholder({ state, t, retry }) {
8179
8190
  return /* @__PURE__ */ import_react8.default.createElement("div", { className: `ws-voice-placeholder is-${state}`, role: "status", title: t(state === "pending" ? "wxAudioPending" : state === "loading" ? "wxAudioLoading" : "wxAudioUnavailable") }, /* @__PURE__ */ import_react8.default.createElement(VoiceWaves, null), /* @__PURE__ */ import_react8.default.createElement("span", { className: "ws-voice-status" }, /* @__PURE__ */ import_react8.default.createElement("strong", null, t("wxVoiceMessage")), /* @__PURE__ */ import_react8.default.createElement("span", null, t(state === "pending" ? "wxVoicePending" : state === "loading" ? "wxAudioLoading" : "wxAudioUnavailable"))), retry && /* @__PURE__ */ import_react8.default.createElement("button", { type: "button", className: "ws-text-button ws-voice-retry", onClick: retry }, t("wxMediaRetry")));
8180
8191
  }
8181
- function VoiceAttachment({ src, t, onError, transcribe }) {
8192
+ function VoiceAttachment({ src, t, onError, voiceMenu }) {
8182
8193
  const audio = (0, import_react8.useRef)(null), alive = (0, import_react8.useRef)(true);
8183
- const trigger = (0, import_react8.useRef)(null), menu = (0, import_react8.useRef)(null);
8184
- const request = (0, import_react8.useRef)(null);
8185
8194
  const [playing, setPlaying] = (0, import_react8.useState)(false), [duration, setDuration] = (0, import_react8.useState)(), [playError, setPlayError] = (0, import_react8.useState)(false);
8186
- const [transcription, setTranscription] = (0, import_react8.useState)();
8187
8195
  (0, import_react8.useEffect)(() => {
8188
8196
  alive.current = true;
8189
8197
  const element2 = audio.current;
8190
8198
  return () => {
8191
8199
  alive.current = false;
8192
- request.current?.abort();
8193
8200
  if (element2) voicePlayback.stop(element2);
8194
8201
  };
8195
8202
  }, []);
@@ -8203,6 +8210,38 @@ function VoiceAttachment({ src, t, onError, transcribe }) {
8203
8210
  if (alive.current) setPlayError(true);
8204
8211
  }
8205
8212
  };
8213
+ const durationLabel = voiceDurationLabel(duration);
8214
+ return /* @__PURE__ */ import_react8.default.createElement("div", { className: "ws-voice-message" }, /* @__PURE__ */ import_react8.default.createElement("audio", { ref: audio, hidden: true, preload: "metadata", src, onLoadedMetadata: (event) => setDuration(event.currentTarget.duration), onDurationChange: (event) => setDuration(event.currentTarget.duration), onPlaying: () => setPlaying(true), onPause: () => setPlaying(false), onEnded: (event) => {
8215
+ voicePlayback.stop(event.currentTarget);
8216
+ setPlaying(false);
8217
+ }, onError }), /* @__PURE__ */ import_react8.default.createElement(
8218
+ "button",
8219
+ {
8220
+ type: "button",
8221
+ className: `ws-voice-button${playing ? " is-playing" : ""}`,
8222
+ style: { width: Math.min(240, 112 + (duration && Number.isFinite(duration) ? duration : 0) * 2) },
8223
+ onClick: () => void toggle(),
8224
+ "aria-label": `${t(playing ? "wxPauseVoice" : "wxPlayVoice")}${durationLabel ? " \xB7 " + durationLabel : ""}`,
8225
+ "aria-pressed": playing,
8226
+ "aria-haspopup": voiceMenu ? "menu" : void 0
8227
+ },
8228
+ /* @__PURE__ */ import_react8.default.createElement(VoiceWaves, null),
8229
+ /* @__PURE__ */ import_react8.default.createElement("span", { className: "ws-voice-duration", "aria-hidden": "true" }, durationLabel)
8230
+ ), playError && /* @__PURE__ */ import_react8.default.createElement("span", { className: "ws-voice-error", role: "status" }, t("wxVoicePlaybackFailed")));
8231
+ }
8232
+ var transcriptionErrors = {
8233
+ WECHAT_VOICE_NOT_AVAILABLE: "wxTranscriptVoicePending",
8234
+ WECHAT_TRANSCRIPTION_NOT_CONFIGURED: "wxTranscriptNotConfigured",
8235
+ WECHAT_TRANSCRIPTION_AUTH_FAILED: "wxTranscriptAuthFailed",
8236
+ WECHAT_TRANSCRIPTION_TIMEOUT: "wxTranscriptTimeout",
8237
+ WECHAT_TRANSCRIPTION_EMPTY: "wxTranscriptEmpty",
8238
+ WECHAT_TRANSCRIPTION_INVALID_AUDIO: "wxAudioUnavailable"
8239
+ };
8240
+ function VoiceTranscription({ children, pending, t, transcribe }) {
8241
+ const trigger = (0, import_react8.useRef)(null), menu = (0, import_react8.useRef)(null);
8242
+ const request = (0, import_react8.useRef)(null);
8243
+ const [transcription, setTranscription] = (0, import_react8.useState)();
8244
+ (0, import_react8.useEffect)(() => () => request.current?.abort(), []);
8206
8245
  const showMenu = (x, y) => {
8207
8246
  const element2 = menu.current;
8208
8247
  if (!element2) return;
@@ -8217,64 +8256,62 @@ function VoiceAttachment({ src, t, onError, transcribe }) {
8217
8256
  };
8218
8257
  const convert2 = async () => {
8219
8258
  closeMenu();
8220
- if (!transcribe || request.current || transcription?.state === "done") return;
8259
+ if (request.current || transcription?.state === "done") return;
8221
8260
  const controller = new AbortController();
8222
8261
  request.current = controller;
8223
- setTranscription({ state: "loading" });
8262
+ setTranscription({ state: "loading", text: t("wxTranscribingVoice") });
8224
8263
  try {
8225
8264
  const { text: text4 } = await transcribe(controller.signal);
8226
8265
  if (!controller.signal.aborted) setTranscription({ state: "done", text: text4 });
8227
- } catch {
8228
- if (!controller.signal.aborted) setTranscription({ state: "error" });
8266
+ } catch (error) {
8267
+ const code2 = error instanceof Error && "code" in error ? error.code : void 0;
8268
+ const key = typeof code2 === "string" && Object.hasOwn(transcriptionErrors, code2) ? transcriptionErrors[code2] : "wxTranscriptUnavailable";
8269
+ if (!controller.signal.aborted) setTranscription({ state: "error", text: t(key) });
8229
8270
  } finally {
8230
8271
  request.current = null;
8231
8272
  }
8232
8273
  };
8233
- const durationLabel = voiceDurationLabel(duration);
8234
- return /* @__PURE__ */ import_react8.default.createElement("div", { className: "ws-voice-message" }, /* @__PURE__ */ import_react8.default.createElement("audio", { ref: audio, hidden: true, preload: "metadata", src, onLoadedMetadata: (event) => setDuration(event.currentTarget.duration), onDurationChange: (event) => setDuration(event.currentTarget.duration), onPlaying: () => setPlaying(true), onPause: () => setPlaying(false), onEnded: (event) => {
8235
- voicePlayback.stop(event.currentTarget);
8236
- setPlaying(false);
8237
- }, onError }), /* @__PURE__ */ import_react8.default.createElement(
8238
- "button",
8274
+ return /* @__PURE__ */ import_react8.default.createElement(
8275
+ "div",
8239
8276
  {
8240
- ref: trigger,
8241
- type: "button",
8242
- className: `ws-voice-button${playing ? " is-playing" : ""}`,
8243
- style: { width: Math.min(240, 112 + (duration && Number.isFinite(duration) ? duration : 0) * 2) },
8244
- onClick: () => void toggle(),
8245
- "aria-label": `${t(playing ? "wxPauseVoice" : "wxPlayVoice")}${durationLabel ? " \xB7 " + durationLabel : ""}`,
8246
- "aria-pressed": playing,
8247
- "aria-haspopup": transcribe ? "menu" : void 0,
8248
- onContextMenu: transcribe ? (event) => {
8277
+ tabIndex: pending ? 0 : void 0,
8278
+ "aria-haspopup": pending ? "menu" : void 0,
8279
+ onContextMenu: (event) => {
8280
+ if (menu.current?.contains(event.target)) return;
8249
8281
  event.preventDefault();
8282
+ event.stopPropagation();
8283
+ trigger.current = event.currentTarget.querySelector(".ws-voice-button") ?? event.currentTarget;
8250
8284
  showMenu(event.clientX, event.clientY);
8251
- } : void 0,
8252
- onKeyDown: transcribe ? (event) => {
8285
+ },
8286
+ onKeyDown: (event) => {
8253
8287
  if (event.key !== "ContextMenu" && !(event.shiftKey && event.key === "F10")) return;
8288
+ if (!(event.target instanceof HTMLElement) || menu.current?.contains(event.target)) return;
8254
8289
  event.preventDefault();
8255
- const position2 = event.currentTarget.getBoundingClientRect();
8290
+ trigger.current = event.target;
8291
+ const position2 = event.target.getBoundingClientRect();
8256
8292
  showMenu(position2.left, position2.bottom);
8257
- } : void 0
8258
- },
8259
- /* @__PURE__ */ import_react8.default.createElement(VoiceWaves, null),
8260
- /* @__PURE__ */ import_react8.default.createElement("span", { className: "ws-voice-duration", "aria-hidden": "true" }, durationLabel)
8261
- ), transcribe && /* @__PURE__ */ import_react8.default.createElement(
8262
- "div",
8263
- {
8264
- ref: menu,
8265
- ...{ popover: "auto" },
8266
- className: "ws-voice-menu",
8267
- role: "menu",
8268
- onKeyDown: (event) => {
8269
- if (event.key === "Escape") {
8270
- event.preventDefault();
8271
- event.stopPropagation();
8272
- closeMenu();
8273
- }
8274
8293
  }
8275
8294
  },
8276
- /* @__PURE__ */ import_react8.default.createElement("button", { type: "button", role: "menuitem", "aria-disabled": transcription?.state === "loading" || transcription?.state === "done", onClick: () => void convert2() }, t("wxTranscribeVoice"))
8277
- ), transcription && /* @__PURE__ */ import_react8.default.createElement("div", { className: "ws-voice-transcript", role: "status" }, transcription.state === "done" ? transcription.text : transcription.state === "loading" ? t("wxTranscribingVoice") : t("wxTranscriptUnavailable")), playError && /* @__PURE__ */ import_react8.default.createElement("span", { className: "ws-voice-error", role: "status" }, t("wxVoicePlaybackFailed")));
8295
+ children,
8296
+ /* @__PURE__ */ import_react8.default.createElement(
8297
+ "div",
8298
+ {
8299
+ ref: menu,
8300
+ ...{ popover: "auto" },
8301
+ className: "ws-voice-menu",
8302
+ role: "menu",
8303
+ onKeyDown: (event) => {
8304
+ if (event.key === "Escape") {
8305
+ event.preventDefault();
8306
+ event.stopPropagation();
8307
+ closeMenu();
8308
+ }
8309
+ }
8310
+ },
8311
+ /* @__PURE__ */ import_react8.default.createElement("button", { type: "button", role: "menuitem", "aria-disabled": transcription?.state === "loading" || transcription?.state === "done", onClick: () => void convert2() }, t("wxTranscribeVoice"))
8312
+ ),
8313
+ transcription && /* @__PURE__ */ import_react8.default.createElement("div", { className: "ws-voice-transcript", role: "status" }, transcription.text)
8314
+ );
8278
8315
  }
8279
8316
 
8280
8317
  // src/wechat/sync-panel.tsx
@@ -10208,6 +10245,11 @@ var zh = {
10208
10245
  wxTranscribeVoice: "\u8F6C\u4E3A\u6587\u5B57",
10209
10246
  wxTranscribingVoice: "\u6B63\u5728\u8F6C\u5199\u8BED\u97F3\u2026",
10210
10247
  wxTranscriptUnavailable: "\u8BED\u97F3\u8F6C\u5199\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u8BED\u97F3\u8BC6\u522B\u670D\u52A1\u540E\u91CD\u8BD5\u3002",
10248
+ wxTranscriptVoicePending: "\u8BED\u97F3\u5C1A\u672A\u540C\u6B65\u5230\u672C\u673A\u3002\u8BF7\u540C\u6B65\u540E\u91CD\u8BD5\u3002",
10249
+ wxTranscriptNotConfigured: "\u8BED\u97F3\u8BC6\u522B\u672A\u914D\u7F6E\u3002\u8BF7\u5728\u6A21\u578B\u8BBE\u7F6E\u4E2D\u914D\u7F6E\u963F\u91CC\u4E91\u767E\u70BC API Key\u3002",
10250
+ wxTranscriptAuthFailed: "\u8BED\u97F3\u8BC6\u522B\u9274\u6743\u5931\u8D25\u3002\u8BF7\u68C0\u67E5\u963F\u91CC\u4E91\u767E\u70BC API Key \u548C\u6A21\u578B\u6743\u9650\u3002",
10251
+ wxTranscriptTimeout: "\u8BED\u97F3\u8BC6\u522B\u8D85\u65F6\uFF0C\u8BF7\u91CD\u8BD5\u3002",
10252
+ wxTranscriptEmpty: "\u8FD9\u6761\u8BED\u97F3\u6CA1\u6709\u8BC6\u522B\u51FA\u6587\u5B57\u3002",
10211
10253
  wxPrioritizeMedia: "\u4F18\u5148\u540C\u6B65",
10212
10254
  wxMediaPriorityQueued: "\u5DF2\u5B89\u6392\u4F18\u5148\u540C\u6B65",
10213
10255
  wxMediaPriorityFailed: "\u6682\u65F6\u65E0\u6CD5\u4F18\u5148\u540C\u6B65\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5",
@@ -10537,6 +10579,11 @@ var en = {
10537
10579
  wxTranscribeVoice: "Transcribe",
10538
10580
  wxTranscribingVoice: "Transcribing\u2026",
10539
10581
  wxTranscriptUnavailable: "Could not transcribe. Check the speech recognition service and retry.",
10582
+ wxTranscriptVoicePending: "This voice message has not synced yet. Sync it and try again.",
10583
+ wxTranscriptNotConfigured: "Configure an Alibaba Cloud Model Studio API key in model settings to transcribe voice messages.",
10584
+ wxTranscriptAuthFailed: "Speech recognition was denied. Check the Alibaba Cloud Model Studio API key and model access.",
10585
+ wxTranscriptTimeout: "Speech recognition timed out. Try again.",
10586
+ wxTranscriptEmpty: "No speech was recognized in this message.",
10540
10587
  wxPrioritizeMedia: "Sync first",
10541
10588
  wxMediaPriorityQueued: "Marked for priority sync",
10542
10589
  wxMediaPriorityFailed: "Priority sync unavailable. Try again shortly.",
@@ -12322,6 +12369,9 @@ async function reviewTurn(turn, prompt, parse2, maxAttempts, correction, signal)
12322
12369
  throw new ReviewProtocolError(true);
12323
12370
  }
12324
12371
 
12372
+ // src/generation-progress.ts
12373
+ var GENERATION_MODEL_ENDPOINT = "wanji-sales-generation/model";
12374
+
12325
12375
  // src/agent.ts
12326
12376
  var object2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
12327
12377
  function terminalGenerationFailure(response, afterSeq, throughSeq) {
@@ -12330,7 +12380,24 @@ function terminalGenerationFailure(response, afterSeq, throughSeq) {
12330
12380
  if (!object2(ending) || !object2(ending.data) || !object2(ending.data.reason)) return;
12331
12381
  const reason = ending.data.reason;
12332
12382
  if (reason.kind !== "error" || !object2(reason.error)) return;
12333
- switch (reason.error.code) {
12383
+ return generationFailure(reason.error.code);
12384
+ }
12385
+ function generationFailure(code2) {
12386
+ switch (code2) {
12387
+ case "GENERATION_COMPANY_MODEL_UNAVAILABLE":
12388
+ return "\u516C\u53F8\u9500\u552E\u8EAB\u4EFD\u5DF2\u9A8C\u8BC1\uFF0C\u6A21\u578B\u901A\u9053\u6682\u4E0D\u53EF\u7528\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6216\u7A0D\u540E\u91CD\u8BD5\u3002";
12389
+ case "GENERATION_MODEL_NOT_CONFIGURED":
12390
+ return "\u9500\u552E\u6A21\u578B\u5C1A\u672A\u914D\u7F6E\u3002\u8BF7\u5728\u4E07\u673A\u5927\u8111\u8BBE\u7F6E\u4E2D\u9009\u7528\u5DF2\u6388\u6743\u7684 DeepSeek V4.1 Flash\uFF0C\u518D\u751F\u6210\u56DE\u590D\u3002";
12391
+ case "GENERATION_MODEL_INCOMPATIBLE":
12392
+ return "\u5F53\u524D\u9500\u552E\u6A21\u578B\u65E0\u6CD5\u7528\u4E8E\u8D77\u8349\u3002\u8BF7\u5728\u4E07\u673A\u5927\u8111\u8BBE\u7F6E\u4E2D\u9009\u62E9 DeepSeek V4.1 Flash\u3002\u6709\u72EC\u7ACB\u9500\u552E\u6A21\u578B\u914D\u7F6E\u65F6\uFF0C\u8BF7\u7BA1\u7406\u5458\u68C0\u67E5\u8BE5\u914D\u7F6E\u3002";
12393
+ case "GENERATION_WORKSPACE":
12394
+ return "\u9500\u552E\u52A9\u624B\u627E\u4E0D\u5230\u672C\u8F6E\u5DE5\u4F5C\u533A\u3002\u8BF7\u91CD\u65B0\u6253\u5F00\u9500\u552E\u52A9\u624B\uFF0C\u7B49\u5F85\u5DE5\u4F5C\u533A\u8F7D\u5165\u540E\u91CD\u8BD5\u3002";
12395
+ case "GENERATION_SKILL_UNAVAILABLE":
12396
+ return "\u9500\u552E\u52A9\u624B\u6280\u80FD\u6682\u4E0D\u53EF\u7528\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u5B89\u88C5\u3002";
12397
+ case "GENERATION_BUSY":
12398
+ return "\u9500\u552E\u52A9\u624B\u6B63\u5728\u5904\u7406\u5176\u4ED6\u8349\u7A3F\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002";
12399
+ case "GENERATION_TIMEOUT":
12400
+ return "\u7B49\u5F85\u9500\u552E\u56DE\u590D\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002";
12334
12401
  case "QUOTA":
12335
12402
  case "ACCOUNT_QUOTA":
12336
12403
  return "\u9500\u552E\u6A21\u578B\u989D\u5EA6\u4E0D\u8DB3\uFF0C\u8BF7\u68C0\u67E5\u6A21\u578B\u901A\u9053\u7684\u53EF\u7528\u989D\u5EA6\u540E\u91CD\u8BD5\u3002";
@@ -12464,22 +12531,16 @@ async function generateReply(rpc, workspaceId, contact, latest, signal, options
12464
12531
  };
12465
12532
  throw new Error("\u8FD9\u6B21\u56DE\u590D\u9700\u8981\u7684\u8D44\u6599\u6682\u4E0D\u53EF\u7528\uFF1A" + (reasons[errorCode(error)] ?? "\u672A\u80FD\u8FDE\u63A5\u77E5\u8BC6\u68C0\u7D22\u670D\u52A1\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002") + "\u672C\u6B21\u672A\u751F\u6210\u8349\u7A3F\u3002");
12466
12533
  }
12534
+ const modelLifetime = rpc.draftModel ? new AbortController() : void 0;
12535
+ const modelSignal = modelLifetime ? AbortSignal.any([signal, modelLifetime.signal]) : signal;
12467
12536
  let generationLease;
12468
12537
  const createSession = async (title) => {
12469
12538
  let created;
12470
12539
  if (knowledge.generationSessionsSupported) {
12471
12540
  const result = await invoke("/api", "wanji-sales-generation/session", { operation: "create", workspaceId, title, ...generationLease ? { leaseId: generationLease } : {} });
12472
12541
  if (object2(result) && result.ok === false && object2(result.error)) {
12473
- switch (result.error.code) {
12474
- case "GENERATION_COMPANY_MODEL_UNAVAILABLE":
12475
- throw Error("\u516C\u53F8\u9500\u552E\u8EAB\u4EFD\u5DF2\u9A8C\u8BC1\uFF0C\u6A21\u578B\u901A\u9053\u6682\u4E0D\u53EF\u7528\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6216\u7A0D\u540E\u91CD\u8BD5\u3002");
12476
- case "GENERATION_MODEL_NOT_CONFIGURED":
12477
- throw Error("\u9500\u552E\u6A21\u578B\u5C1A\u672A\u914D\u7F6E\u3002\u8BF7\u5728\u4E07\u673A\u5927\u8111\u8BBE\u7F6E\u4E2D\u9009\u7528\u5DF2\u6388\u6743\u7684 DeepSeek V4.1 Flash\uFF0C\u518D\u751F\u6210\u56DE\u590D\u3002");
12478
- case "GENERATION_MODEL_INCOMPATIBLE":
12479
- throw Error("\u5F53\u524D\u9500\u552E\u6A21\u578B\u65E0\u6CD5\u7528\u4E8E\u8D77\u8349\u3002\u8BF7\u5728\u4E07\u673A\u5927\u8111\u8BBE\u7F6E\u4E2D\u9009\u62E9 DeepSeek V4.1 Flash\u3002\u6709\u72EC\u7ACB\u9500\u552E\u6A21\u578B\u914D\u7F6E\u65F6\uFF0C\u8BF7\u7BA1\u7406\u5458\u68C0\u67E5\u8BE5\u914D\u7F6E\u3002");
12480
- case "GENERATION_WORKSPACE":
12481
- throw Error("\u9500\u552E\u52A9\u624B\u627E\u4E0D\u5230\u672C\u8F6E\u5DE5\u4F5C\u533A\u3002\u8BF7\u91CD\u65B0\u6253\u5F00\u9500\u552E\u52A9\u624B\uFF0C\u7B49\u5F85\u5DE5\u4F5C\u533A\u8F7D\u5165\u540E\u91CD\u8BD5\u3002");
12482
- }
12542
+ const failure = generationFailure(result.error.code);
12543
+ if (failure) throw Error(failure);
12483
12544
  }
12484
12545
  if (!object2(result) || result.ok !== true || !object2(result.value) || typeof result.value.leaseId !== "string" || generationLease && generationLease !== result.value.leaseId) throw Error("\u672C\u8F6E\u4E34\u65F6\u9500\u552E\u4F1A\u8BDD\u6682\u672A\u5C31\u7EEA\uFF0C\u8BF7\u68C0\u67E5\u8FDE\u63A5\u3002");
12485
12546
  generationLease = result.value.leaseId;
@@ -12550,18 +12611,78 @@ async function generateReply(rpc, workspaceId, contact, latest, signal, options
12550
12611
  observer?.stop();
12551
12612
  }
12552
12613
  };
12614
+ const openTurn = async (title, requireSkill = false) => {
12615
+ if (!rpc.draftModel) {
12616
+ const sessionId = await createSession(title);
12617
+ if (requireSkill) {
12618
+ const skills = await call("skills/list", { sessionId });
12619
+ if (!Array.isArray(skills.skills) || !skills.skills.some((s) => object2(s) && s.name === "wanji-sales-assistant")) {
12620
+ throw Error("\u6B64\u5DE5\u4F5C\u533A\u6CA1\u6709\u5B89\u88C5\u4E07\u673A\u9500\u552E\u6280\u80FD\uFF0C\u8BF7\u9009\u62E9\u9879\u76EE\u5DE5\u4F5C\u533A\u6216\u5148\u5B89\u88C5\u6280\u80FD\u3002");
12621
+ }
12622
+ }
12623
+ return (prompt, writer = false) => turn(sessionId, prompt, writer);
12624
+ }
12625
+ const history = [];
12626
+ return async (prompt, writer = false) => {
12627
+ modelSignal.throwIfAborted();
12628
+ const requestId = crypto.randomUUID();
12629
+ const preview = writer && !!options.onProgress;
12630
+ const stopped = new AbortController();
12631
+ const previewSignal = AbortSignal.any([modelSignal, stopped.signal]);
12632
+ const submitted = performance.now();
12633
+ let lastPreview = "";
12634
+ const show = (value) => {
12635
+ if (typeof value.firstTokenMs === "number") {
12636
+ timings.writerFirstTokenMs ??= value.firstTokenMs;
12637
+ timings.firstTokenMs ??= submitted - started + value.firstTokenMs;
12638
+ }
12639
+ if (typeof value.text === "string" && value.text !== lastPreview) {
12640
+ lastPreview = value.text;
12641
+ progress("writing", lastPreview);
12642
+ }
12643
+ };
12644
+ const payload = { workspaceId, requestId };
12645
+ let previewTimer;
12646
+ const pollPreview = async () => {
12647
+ if (stopped.signal.aborted || modelSignal.aborted) return;
12648
+ try {
12649
+ const result = await invoke("/api", GENERATION_MODEL_ENDPOINT, { ...payload, operation: "preview" }, previewSignal);
12650
+ if (stopped.signal.aborted || modelSignal.aborted) return;
12651
+ if (object2(result) && result.ok === true && object2(result.value)) show(result.value);
12652
+ previewTimer = setTimeout(() => void pollPreview(), 250);
12653
+ } catch {
12654
+ }
12655
+ };
12656
+ if (preview) previewTimer = setTimeout(() => void pollPreview(), 250);
12657
+ try {
12658
+ const result = await invoke("/api", GENERATION_MODEL_ENDPOINT, { ...payload, operation: "run", prompt, history, preview }, modelSignal);
12659
+ modelSignal.throwIfAborted();
12660
+ if (!object2(result) || result.ok !== true || !object2(result.value) || typeof result.value.text !== "string" || !result.value.text.trim() || result.value.text.length > 64e3) {
12661
+ const code2 = object2(result) && object2(result.error) ? result.error.code : void 0;
12662
+ throw Error(generationFailure(code2) ?? "\u672A\u53D6\u5F97\u6709\u6548\u7684\u9500\u552E\u56DE\u590D\uFF0C\u8BF7\u91CD\u8BD5\u3002");
12663
+ }
12664
+ if (preview) show({ firstTokenMs: result.value.firstTokenMs, text: wechatPreview(result.value.text) });
12665
+ history.push({ prompt, text: result.value.text });
12666
+ return result.value.text;
12667
+ } catch (error) {
12668
+ if (preview) show({ text: "" });
12669
+ throw error;
12670
+ } finally {
12671
+ stopped.abort();
12672
+ clearTimeout(previewTimer);
12673
+ }
12674
+ };
12675
+ };
12553
12676
  try {
12554
12677
  const selectMaterial = () => selectReplyMaterial(
12555
12678
  rpc,
12556
12679
  materialQuery,
12557
- async (prompt) => turn(await createSession("\u9500\u552E\u7D20\u6750\u5339\u914D\uFF5C" + contact.name), prompt),
12680
+ async (prompt) => (await openTurn("\u9500\u552E\u7D20\u6750\u5339\u914D\uFF5C" + contact.name))(prompt),
12558
12681
  signal,
12559
12682
  allowMaterialResend(latest) ? [] : sentMaterialUrls(buildTurnPacket(contact, latest))
12560
12683
  );
12561
12684
  if (knowledge.catalogMaterialsAvailable && contact.replyMode !== "source-bound" && materialOnly) return materialOnlyReply(await selectMaterial());
12562
- const sessionId = await createSession("\u9500\u552E\u56DE\u590D\uFF5C" + contact.name);
12563
- const skills = await call("skills/list", { sessionId });
12564
- if (!Array.isArray(skills.skills) || !skills.skills.some((s) => object2(s) && s.name === "wanji-sales-assistant")) throw new Error("\u6B64\u5DE5\u4F5C\u533A\u6CA1\u6709\u5B89\u88C5\u4E07\u673A\u9500\u552E\u6280\u80FD\uFF0C\u8BF7\u9009\u62E9\u9879\u76EE\u5DE5\u4F5C\u533A\u6216\u5148\u5B89\u88C5\u6280\u80FD\u3002");
12685
+ const replyTurn = await openTurn("\u9500\u552E\u56DE\u590D\uFF5C" + contact.name, true);
12565
12686
  const bound = contact.replyMode === "source-bound" ? buildSourceContext(contact, latest) : void 0;
12566
12687
  const catalogMaterial = knowledge.catalogMaterialsAvailable && !bound && !isExplicitStop(latest) && (explicitMaterial || isMaterialReferenceQuestion(latest)) ? await selectMaterial() : void 0;
12567
12688
  if (bound && contact.replyMode === "source-bound") {
@@ -12569,7 +12690,7 @@ async function generateReply(rpc, workspaceId, contact, latest, signal, options
12569
12690
  let feedback = "", planned;
12570
12691
  let rendered;
12571
12692
  for (let attempt = 0; attempt < 3; attempt++) {
12572
- const text4 = await turn(sessionId, sourcePlanPrompt(contact, latest, bound, knowledge) + feedback);
12693
+ const text4 = await replyTurn(sourcePlanPrompt(contact, latest, bound, knowledge) + feedback);
12573
12694
  try {
12574
12695
  planned = parseSourcePlan(text4);
12575
12696
  assertSourceSelection(bound, planned);
@@ -12601,7 +12722,7 @@ async function generateReply(rpc, workspaceId, contact, latest, signal, options
12601
12722
  let plan, recoveredPlan, planFeedback = "";
12602
12723
  progress("planning");
12603
12724
  for (let attempt = 0; attempt < 2; attempt++) {
12604
- const text4 = await turn(sessionId, buildTurnPlanPrompt(contact, latest, knowledge.contextId, packet) + planFeedback);
12725
+ const text4 = await replyTurn(buildTurnPlanPrompt(contact, latest, knowledge.contextId, packet) + planFeedback);
12605
12726
  try {
12606
12727
  plan = parseTurnPlan(text4, contact, latest, packet);
12607
12728
  break;
@@ -12641,9 +12762,9 @@ async function generateReply(rpc, workspaceId, contact, latest, signal, options
12641
12762
  },
12642
12763
  async revise(draft, issues) {
12643
12764
  progress("writing", "");
12644
- const id = await createSession("\u9500\u552E\u5C40\u90E8\u6539\u7A3F\uFF5C" + contact.name), prompt = buildDraftEditPrompt(packet, plan, draft, issues);
12765
+ const rewrite = await openTurn("\u9500\u552E\u5C40\u90E8\u6539\u7A3F\uFF5C" + contact.name), prompt = buildDraftEditPrompt(packet, plan, draft, issues);
12645
12766
  for (let n = 0; n < 2; n++) {
12646
- const result = await turn(id, prompt + (n ? "\n\u4E0A\u6B21\u4FEE\u6539\u672A\u901A\u8FC7\u3002\u53EA\u8FD4\u56DEedits\uFF0C\u6BCF\u9879\u53EA\u9009\u5F53\u524Dedit_units\u7684id\u53CAafter\uFF1B\u4E0D\u53EF\u9020\u7F16\u53F7\u6216\u91CD\u5199\u5168\u6587\u3002" : ""));
12767
+ const result = await rewrite(prompt + (n ? "\n\u4E0A\u6B21\u4FEE\u6539\u672A\u901A\u8FC7\u3002\u53EA\u8FD4\u56DEedits\uFF0C\u6BCF\u9879\u53EA\u9009\u5F53\u524Dedit_units\u7684id\u53CAafter\uFF1B\u4E0D\u53EF\u9020\u7F16\u53F7\u6216\u91CD\u5199\u5168\u6587\u3002" : ""));
12647
12768
  try {
12648
12769
  return applyDraftEdits(draft, result);
12649
12770
  } catch (error) {
@@ -12654,22 +12775,22 @@ async function generateReply(rpc, workspaceId, contact, latest, signal, options
12654
12775
  },
12655
12776
  async generate(prompt) {
12656
12777
  progress("writing", "");
12657
- const writer = firstDraft ? sessionId : await createSession("\u9500\u552E\u6539\u7A3F\uFF5C" + contact.name);
12778
+ const writer = firstDraft ? replyTurn : await openTurn("\u9500\u552E\u6539\u7A3F\uFF5C" + contact.name);
12658
12779
  firstDraft = false;
12659
- return turn(writer, prompt, true);
12780
+ return writer(prompt, true);
12660
12781
  },
12661
12782
  async review(kind, draft) {
12662
12783
  progress("reviewing");
12663
- const own2 = await createSession((kind === "facts" ? "\u9500\u552E\u4E8B\u5B9E\u6838\u5BF9\uFF5C" : "\u9500\u552E\u63A5\u8BDD\u6838\u5BF9\uFF5C") + contact.name);
12784
+ const own2 = await openTurn((kind === "facts" ? "\u9500\u552E\u4E8B\u5B9E\u6838\u5BF9\uFF5C" : "\u9500\u552E\u63A5\u8BDD\u6838\u5BF9\uFF5C") + contact.name);
12664
12785
  const prompt = kind === "facts" ? buildFactProofPrompt(packet, draft, true) : buildConversationReviewPrompt(contact, latest, draft, packet, plan, true);
12665
12786
  if (kind !== "facts") {
12666
- return reviewTurn((p) => turn(own2, p), prompt, (text4) => parseConversationReview(text4, draft), 4, "\u4EC5\u62A5\u544A\u5F53\u524Dreview_units\u7F16\u53F7\u3001severity\u548Creason\uFF0C\u539F\u53E5\u7531\u7A0B\u5E8F\u7ED1\u5B9A\u3002", signal);
12787
+ return reviewTurn(own2, prompt, (text4) => parseConversationReview(text4, draft), 4, "\u4EC5\u62A5\u544A\u5F53\u524Dreview_units\u7F16\u53F7\u3001severity\u548Creason\uFF0C\u539F\u53E5\u7531\u7A0B\u5E8F\u7ED1\u5B9A\u3002", signal);
12667
12788
  }
12668
- const proof = await reviewTurn((p) => turn(own2, p), prompt, (text4) => parseFactProof(text4, draft, packet, true), 4, "\u53EA\u8FD4\u56DEchecks\uFF0C\u9010\u4E2A\u8986\u76D6\uFF0C\u6765\u6E90\u53EA\u9009evidence_basis\u7F16\u53F7\uFF0C\u4E0D\u6284\u957F\u5F15\u6587\u3002", signal);
12789
+ const proof = await reviewTurn(own2, prompt, (text4) => parseFactProof(text4, draft, packet, true), 4, "\u53EA\u8FD4\u56DEchecks\uFF0C\u9010\u4E2A\u8986\u76D6\uFF0C\u6765\u6E90\u53EA\u9009evidence_basis\u7F16\u53F7\uFF0C\u4E0D\u6284\u957F\u5F15\u6587\u3002", signal);
12669
12790
  if (proof.issues.length) return proof.issues;
12670
- const verifier = await createSession("\u9500\u552E\u8BC1\u636E\u590D\u6838\uFF5C" + contact.name);
12791
+ const verifier = await openTurn("\u9500\u552E\u8BC1\u636E\u590D\u6838\uFF5C" + contact.name);
12671
12792
  const verificationPrompt = buildEntailmentPrompt(proof.claims, latest, packet.selection_rule, packet);
12672
- return reviewTurn((p) => turn(verifier, p), verificationPrompt, (text4) => parseFactReview(text4, draft, contact, latest), 2, "\u53EA\u8FD4\u56DEissues\u6570\u7EC4\uFF0Cid\u4EC5\u9009\u5F53\u524Dassertion_units\u7F16\u53F7\uFF0Creason\u89E3\u91CA\u7F3A\u53E3\uFF1B\u6CA1\u6709\u95EE\u9898\u8FD4\u56DE\u7A7A\u6570\u7EC4\u3002", signal);
12793
+ return reviewTurn(verifier, verificationPrompt, (text4) => parseFactReview(text4, draft, contact, latest), 2, "\u53EA\u8FD4\u56DEissues\u6570\u7EC4\uFF0Cid\u4EC5\u9009\u5F53\u524Dassertion_units\u7F16\u53F7\uFF0Creason\u89E3\u91CA\u7F3A\u53E3\uFF1B\u6CA1\u6709\u95EE\u9898\u8FD4\u56DE\u7A7A\u6570\u7EC4\u3002", signal);
12673
12794
  },
12674
12795
  validate(value) {
12675
12796
  const delivery = bindDeliveryToAction(plan.action ?? "answer", value);
@@ -12715,6 +12836,7 @@ async function generateReply(rpc, workspaceId, contact, latest, signal, options
12715
12836
  }
12716
12837
  return includeReplyMaterial({ ...reply, next_step: nextStep, progress: plan.progress ? advanceDialogueTasks(plan.progress, packet, plan.action ?? "answer") : void 0, knowledge, timings }, material);
12717
12838
  } finally {
12839
+ modelLifetime?.abort();
12718
12840
  if (generationLease) try {
12719
12841
  await invoke("/api", "wanji-sales-generation/session", { operation: "release", workspaceId, leaseId: generationLease, background: true }, AbortSignal.timeout(1e4));
12720
12842
  } catch {
@@ -12732,8 +12854,7 @@ async function generateReply(rpc, workspaceId, contact, latest, signal, options
12732
12854
  var PANEL_ID = "wanji-sales.workspace";
12733
12855
  var NS = "wanji-sales";
12734
12856
  function createGenerationTransport(ctx) {
12735
- const session = ctx.remote?.session;
12736
- return { call: (channel, endpoint, payload, signal) => ctx.connection.rpc.call(channel, endpoint, payload, signal), ...session ? { follow: (sessionId, signal) => session.follow({ address: { kind: "session", sessionId }, assistantStream: true, maxMessages: 1 }, signal) } : {} };
12857
+ return { draftModel: true, call: (channel, endpoint, payload, signal) => ctx.connection.rpc.call(channel, endpoint, payload, signal) };
12737
12858
  }
12738
12859
  function selectSalesWorkspace(items, connectedWorkspaceId) {
12739
12860
  return items.find((w) => w.workspaceId === connectedWorkspaceId)?.workspaceId ?? items[0]?.workspaceId ?? "";
@@ -12943,7 +13064,7 @@ function mountSales(ctx, Page, Icon) {
12943
13064
  return source?.autoDraftMessageId === auto?.job.messageId && source?.version === auto?.job.version;
12944
13065
  };
12945
13066
  const question = (contact.wechat ? contact.messages.filter((m) => m.direction === "in").at(-1)?.text : state.latest[id])?.trim();
12946
- const trace = !auto && question && contact.wechat?.latestInbound?.hasText !== false ? { workspaceId, contactId: id, requestId, question: question.slice(0, 8e3), startedAt: Date.now() } : void 0;
13067
+ const trace = question && contact.wechat?.latestInbound?.hasText !== false ? { workspaceId, contactId: id, requestId, question: question.slice(0, 8e3), startedAt: Date.now() } : void 0;
12947
13068
  const observe = (params) => ctx.connection.rpc.call("/api", "wanji-sales-observation/question", { ...trace, ...params }, AbortSignal.timeout(5e3));
12948
13069
  const capture = trace ? observe({ operation: "begin" }).catch(() => {
12949
13070
  }) : void 0;
@@ -13172,6 +13293,7 @@ var mediaStyles = `
13172
13293
  .ws-voice-menu button:hover,.ws-voice-menu button:focus-visible{background:var(--ws-soft)}
13173
13294
  .ws-voice-menu button[aria-disabled=true]{color:var(--ws-muted)}
13174
13295
  .ws-voice-transcript{width:fit-content;max-width:min(360px,100%);margin-top:5px;padding:8px 12px;border:1px solid var(--ws-line);border-radius:6px;background:var(--ws-soft);color:var(--ws-ink);white-space:pre-wrap;overflow-wrap:anywhere;text-align:start}
13296
+ .ws-out .ws-voice-button,.ws-out .ws-voice-transcript{margin-inline-start:auto}
13175
13297
  .ws-voice-error{display:block;max-width:240px;margin-top:5px;font-size:11px;color:var(--ws-muted)}
13176
13298
  @media(prefers-reduced-motion:reduce){.ws-voice-button.is-playing .ws-voice-wave-mid,.ws-voice-button.is-playing .ws-voice-wave-outer{animation:none}.ws-voice-button.is-playing{box-shadow:inset 3px 0 0 var(--ws-accent,var(--ws-ink))}}
13177
13299
  `;
@@ -13501,7 +13623,7 @@ function SalesPage({ t, useSales, useWorkspaces, dispatch, generate, loadConvers
13501
13623
  void copy();
13502
13624
  } }, /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: copyResult?.id === contact.id && copyResult.success ? "check" : "copy", size: 15 }), copyResult?.id === contact.id && copyResult.success ? t("copied") : t("copy"))), wechatSendingEnabled && contact.wechat && /* @__PURE__ */ import_react12.default.createElement("p", { role: "status", "aria-live": "polite" }, !delivery.available ? t("wxCuaRequired") : delivery.status === "sending" ? t("wxSending") : delivery.status === "awaiting-receipt" ? t("wxAwaitReceipt") : delivery.status === "sent" ? t("wxSent") : ["unknown", "claimed", "stopped", "blocked"].includes(delivery.status) ? t("wxSendStopped") : t("wxManualNote")), state.historyErrors?.[contact.id] && /* @__PURE__ */ import_react12.default.createElement("p", { role: "status" }, state.historyErrors[contact.id]), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-notice", role: "status" }, copyResult?.id === contact.id && !copyResult.success ? t("copyError") : notice)))), contact.id && /* @__PURE__ */ import_react12.default.createElement("aside", { id: profileId, className: "ws-profile", "aria-label": t("profile") }, /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-profile-head" }, /* @__PURE__ */ import_react12.default.createElement("h2", null, t("profile")), /* @__PURE__ */ import_react12.default.createElement("button", { type: "button", className: "ws-icon-button ws-profile-close", ref: closeProfileButton, "aria-label": t("closeProfile"), title: t("closeProfile"), onClick: () => setProfileVisibility("closed") }, /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: "close", size: 17 }))), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-profile-person" }, /* @__PURE__ */ import_react12.default.createElement(WechatAvatar, { client: wechat, scope: JSON.stringify([selectedWorkspace, contact.wechat?.accountId]), owner: contact.wechat?.chatKey ?? contact.id, mediaId: contact.wechat?.avatarId, fallback: contact.initials, className: "ws-profile-avatar" }), /* @__PURE__ */ import_react12.default.createElement("h3", null, contact.name), /* @__PURE__ */ import_react12.default.createElement("p", null, contact.segment), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-tags" }, contact.tags.map((tag) => /* @__PURE__ */ import_react12.default.createElement("span", { key: tag }, tag)))), contact.wechat && bindWechat && /* @__PURE__ */ import_react12.default.createElement(CrmForm, { key: contact.id, contact, t, frozen, dirty: updateFormDirty, bind: (binding) => bindWechat(selectedWorkspace, contact.id, binding) }), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-profile-section" }, /* @__PURE__ */ import_react12.default.createElement("h3", null, t("interest")), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-product" }, /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: "chat", size: 18 }), /* @__PURE__ */ import_react12.default.createElement("div", null, /* @__PURE__ */ import_react12.default.createElement("strong", null, contact.product), /* @__PURE__ */ import_react12.default.createElement("p", null, contact.wechat ? t("wxContext") : t("contextHint")))), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-budget" }, /* @__PURE__ */ import_react12.default.createElement("span", null, t("budget")), /* @__PURE__ */ import_react12.default.createElement("strong", null, contact.budget))), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-profile-section" }, /* @__PURE__ */ import_react12.default.createElement("h3", null, t("facts")), /* @__PURE__ */ import_react12.default.createElement("dl", null, contact.facts.map((fact) => /* @__PURE__ */ import_react12.default.createElement("div", { key: fact.label }, /* @__PURE__ */ import_react12.default.createElement("dt", null, fact.label), /* @__PURE__ */ import_react12.default.createElement("dd", null, fact.value))))), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-profile-caption" }, /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: "spark", size: 14 }), /* @__PURE__ */ import_react12.default.createElement("span", null, contact.wechat ? t("wxSources") : t("profileNote"))))));
13503
13625
  }
13504
- var inject = ["slots", "layout", "locale", "connection", "remote", "remote.session"];
13626
+ var inject = ["slots", "layout", "locale", "connection"];
13505
13627
  function apply(ctx) {
13506
13628
  mountSales(ctx, SalesPage, SalesIcon);
13507
13629
  }