@wanji_dsh/dsh-sales 0.11.3 → 0.11.5
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/README.md +3 -1
- package/README.zh.md +13 -3
- package/config/production.cordis.yml +2 -2
- package/cordis.patch.yml +3 -0
- package/dist/client.js +412 -182
- package/dist/host.js +1398 -982
- package/dist/types/agent-knowledge.d.ts +5 -1
- package/dist/types/agent.d.ts +4 -2
- package/dist/types/company/observations.d.ts +13 -0
- package/dist/types/generation-model-route.d.ts +5 -0
- package/dist/types/generation-progress.d.ts +5 -0
- package/dist/types/generation-runtime.d.ts +5 -2
- package/dist/types/host.d.ts +1 -0
- package/dist/types/knowledge-host.d.ts +1 -1
- package/dist/types/knowledge-http-correlation.d.ts +14 -0
- package/dist/types/langfuse-outbox.d.ts +1 -0
- package/dist/types/question-tracing.d.ts +9 -2
- package/dist/types/sales-model.d.ts +2 -0
- package/dist/types/server/llm.d.ts +26 -10
- package/dist/types/update/coordinator.d.ts +5 -0
- package/dist/types/update/types.d.ts +2 -0
- package/dist/types/wechat/routes.d.ts +1 -1
- package/dist/types/wechat/transcription.d.ts +5 -0
- package/docs/auto-update.md +3 -3
- package/package.json +1 -1
- package/runtime/wechat-manifest.json +6 -6
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
5106
|
+
// ../../node_modules/devlop/lib/default.js
|
|
5107
5107
|
function ok() {
|
|
5108
5108
|
}
|
|
5109
5109
|
|
|
5110
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
5217
|
+
// ../../node_modules/unist-util-visit-parents/lib/color.js
|
|
5218
5218
|
function color(d) {
|
|
5219
5219
|
return d;
|
|
5220
5220
|
}
|
|
5221
5221
|
|
|
5222
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
7127
|
+
// ../../node_modules/micromark-extension-gfm/index.js
|
|
7128
7128
|
function gfm(options) {
|
|
7129
7129
|
return combineExtensions([
|
|
7130
7130
|
gfmAutolinkLiteral(),
|
|
@@ -7389,42 +7389,107 @@ function updateErrorKey(error) {
|
|
|
7389
7389
|
if (/SERVICE_UNAVAILABLE|offline/i.test(error)) return "updateReconnect";
|
|
7390
7390
|
return "updateUnknown";
|
|
7391
7391
|
}
|
|
7392
|
+
var updateChevronIcon = /* @__PURE__ */ import_react4.default.createElement("svg", { className: "ws-update-chevron", width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.25", "aria-hidden": "true" }, /* @__PURE__ */ import_react4.default.createElement("path", { d: "m2.5 4.5 3.5 3.5 3.5-3.5" }));
|
|
7393
|
+
var updateRefreshIcon = /* @__PURE__ */ import_react4.default.createElement("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.6", "aria-hidden": "true" }, /* @__PURE__ */ import_react4.default.createElement("path", { d: "M20 7v5h-5M4 17v-5h5M6 7a7 7 0 0 1 12-1l2 2M18 17a7 7 0 0 1-12 1l-2-2" }));
|
|
7392
7394
|
function UpdatePanel({ client, view, t }) {
|
|
7393
|
-
const [open, setOpen] = (0, import_react4.useState)(false)
|
|
7395
|
+
const [open, setOpen] = (0, import_react4.useState)(false);
|
|
7396
|
+
const id = (0, import_react4.useId)();
|
|
7397
|
+
const trigger = (0, import_react4.useRef)(null);
|
|
7398
|
+
const close = () => {
|
|
7399
|
+
setOpen(false);
|
|
7400
|
+
trigger.current?.focus();
|
|
7401
|
+
};
|
|
7394
7402
|
const company = view.source === "company-market";
|
|
7395
|
-
const
|
|
7396
|
-
const
|
|
7397
|
-
const
|
|
7398
|
-
const
|
|
7399
|
-
const
|
|
7400
|
-
const
|
|
7401
|
-
const
|
|
7402
|
-
const
|
|
7403
|
-
const
|
|
7404
|
-
|
|
7405
|
-
|
|
7403
|
+
const { phase, installedVersion, runningVersion, automatic } = view;
|
|
7404
|
+
const restartRequired = phase === "restart-required";
|
|
7405
|
+
const candidate = company ? view.availableVersion : view.candidate?.version;
|
|
7406
|
+
const available = candidate && candidate !== installedVersion && candidate !== runningVersion ? candidate : void 0;
|
|
7407
|
+
const active = phase === "preparing" || phase === "installing" || phase === "verifying";
|
|
7408
|
+
const disconnected = Boolean(view.reconnecting && (active || view.preparing));
|
|
7409
|
+
const checking = !disconnected && (Boolean(view.checking) && !active || phase === "checking");
|
|
7410
|
+
const busy = view.preparing || checking || active || disconnected;
|
|
7411
|
+
const unavailable = phase === "unsupported" || phase === "migration-required" || phase === "recovery-required" || restartRequired;
|
|
7412
|
+
const needsSetup = phase === "unsupported" || phase === "migration-required";
|
|
7413
|
+
const stages = company || view.reconnecting || checking ? void 0 : view.completedStages;
|
|
7414
|
+
const percent = stages === void 0 ? void 0 : Math.round(stages * 100 / 3);
|
|
7415
|
+
const progressText = stages === void 0 ? void 0 : t("updateProgressCompleted").replace("{count}", String(stages));
|
|
7416
|
+
const deferred = phase === "waiting-idle" && Boolean(view.error);
|
|
7417
|
+
const errorKey = view.error && !disconnected ? updateErrorKey(view.error) : void 0;
|
|
7418
|
+
const status = t(disconnected ? "updateReconnect" : checking ? "updateChecking" : deferred ? "updateDeferred" : phase === "idle" && !view.checkedAt ? "updateInitial" : labels[phase]);
|
|
7419
|
+
const companyStatus = t(restartRequired ? "updateCompanyRestart" : phase === "migration-required" ? "updateCompanyMigration" : available ? "updateAvailable" : checking ? "updateCompanyChecking" : phase === "idle" && view.checkedAt ? "updateIdle" : "updateCompanyUnavailable");
|
|
7420
|
+
const hasUpdate = Boolean(available && (company || phase === "available"));
|
|
7421
|
+
const triggerLabel = disconnected ? t("updateStatePending") : active ? percent === void 0 ? status : `${t("updateBusyTrigger")} ${percent}%` : phase === "waiting-idle" ? t(deferred ? "updateDeferred" : "updateWaitingTrigger") : phase === "recovery-required" || view.retryable ? t(phase === "recovery-required" ? "updateStatePending" : "updateFailed") : hasUpdate ? `${t("updateTitle")} \xB7 ${t("updateHasUpdate")}` : t("updateTitle");
|
|
7422
|
+
return /* @__PURE__ */ import_react4.default.createElement("div", { className: "ws-update", onKeyDown: (event) => {
|
|
7423
|
+
if (open && event.key === "Escape") {
|
|
7424
|
+
event.stopPropagation();
|
|
7425
|
+
close();
|
|
7426
|
+
}
|
|
7406
7427
|
} }, /* @__PURE__ */ import_react4.default.createElement(
|
|
7407
7428
|
"button",
|
|
7408
7429
|
{
|
|
7409
|
-
|
|
7430
|
+
ref: trigger,
|
|
7431
|
+
className: `ws-button ws-update-trigger${restartRequired ? " ws-update-trigger-restart" : active || disconnected ? " ws-update-trigger-active" : ""}`,
|
|
7410
7432
|
type: "button",
|
|
7411
7433
|
"aria-expanded": open,
|
|
7412
|
-
"aria-controls": id,
|
|
7413
|
-
"aria-label":
|
|
7434
|
+
"aria-controls": open ? id : void 0,
|
|
7435
|
+
"aria-label": active || disconnected ? `${t("updateTitle")} \xB7 ${triggerLabel}` : void 0,
|
|
7414
7436
|
onClick: () => {
|
|
7415
7437
|
if (!open && company) void client.poll();
|
|
7416
7438
|
setOpen(!open);
|
|
7417
7439
|
}
|
|
7418
7440
|
},
|
|
7419
|
-
/* @__PURE__ */ import_react4.default.createElement("
|
|
7420
|
-
|
|
7421
|
-
|
|
7422
|
-
), open && /* @__PURE__ */ import_react4.default.createElement("section", { id, className: "ws-update-card", "aria-label": t("updateTitle") }, /* @__PURE__ */ import_react4.default.createElement("div", { className: "ws-update-heading" }, /* @__PURE__ */ import_react4.default.createElement("strong", null, t("updateTitle")), /* @__PURE__ */ import_react4.default.createElement("button", { type: "button", className: "ws-icon-button", "aria-label": t("updateClose"), onClick: () => setOpen(false) }, "\xD7")), /* @__PURE__ */ import_react4.default.createElement("dl", { className: "ws-update-versions" }, /* @__PURE__ */ import_react4.default.createElement("div", null, /* @__PURE__ */ import_react4.default.createElement("dt", null, t("updateCurrent")), /* @__PURE__ */ import_react4.default.createElement("dd", null, view.runningVersion || "\u2014")), view.installedVersion && view.installedVersion !== view.runningVersion && /* @__PURE__ */ import_react4.default.createElement("div", null, /* @__PURE__ */ import_react4.default.createElement("dt", null, t("updateInstalled")), /* @__PURE__ */ import_react4.default.createElement("dd", null, view.installedVersion)), availableVersion && availableVersion !== view.installedVersion && /* @__PURE__ */ import_react4.default.createElement("div", null, /* @__PURE__ */ import_react4.default.createElement("dt", null, t("updateTarget")), /* @__PURE__ */ import_react4.default.createElement("dd", { className: company ? "ws-company-update-version" : void 0 }, availableVersion))), company ? /* @__PURE__ */ import_react4.default.createElement("div", { className: "ws-company-update-hint", role: "status" }, availableVersion ? /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, /* @__PURE__ */ import_react4.default.createElement("p", null, t("updateCompanyPathTitle")), /* @__PURE__ */ import_react4.default.createElement("p", null, t("updateCompanyPath"))) : /* @__PURE__ */ import_react4.default.createElement("p", null, t(companyStatus))) : /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, /* @__PURE__ */ import_react4.default.createElement("div", { role: "status", className: "ws-update-status", "aria-live": "polite" }, /* @__PURE__ */ import_react4.default.createElement("span", { className: "ws-dot" }), status), errorKey && /* @__PURE__ */ import_react4.default.createElement("p", { className: "ws-update-error", role: "status" }, t(errorKey)), !needsSetup && /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, /* @__PURE__ */ import_react4.default.createElement("label", { className: "ws-update-toggle" }, /* @__PURE__ */ import_react4.default.createElement("input", { type: "checkbox", checked: view.automatic, disabled: busy || unavailable, onChange: (e) => void client.action("automatic", e.target.checked) }), /* @__PURE__ */ import_react4.default.createElement("span", null, t("updateAutomatic"))), /* @__PURE__ */ import_react4.default.createElement("p", { className: "ws-update-policy" }, t("updatePolicy"))), view.checkedAt && !needsSetup && /* @__PURE__ */ import_react4.default.createElement("p", { className: "ws-update-policy" }, t("updateChecked"), " ", /* @__PURE__ */ import_react4.default.createElement("time", { dateTime: new Date(view.checkedAt).toISOString() }, new Date(view.checkedAt).toLocaleTimeString(void 0, { hour: "2-digit", minute: "2-digit", second: "2-digit" }))), /* @__PURE__ */ import_react4.default.createElement("div", { className: "ws-update-actions" }, /* @__PURE__ */ import_react4.default.createElement("button", { type: "button", className: "ws-button", disabled: busy || unavailable, "aria-busy": checking, onClick: () => void client.action("check") }, t(checking ? "updateChecking" : unavailable ? "updateCheckUnavailable" : "updateCheck")), view.candidate && !unavailable && /* @__PURE__ */ import_react4.default.createElement("button", { type: "button", className: "ws-button ws-primary", disabled: busy, onClick: () => void client.action("install") }, t("updateInstall"))))));
|
|
7441
|
+
restartRequired ? /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, /* @__PURE__ */ import_react4.default.createElement("span", { className: "ws-dot ws-update-restart-dot", "aria-hidden": "true" }), /* @__PURE__ */ import_react4.default.createElement("span", { className: "ws-update-restart-copy" }, /* @__PURE__ */ import_react4.default.createElement("span", null, t("updateRestartTrigger")), installedVersion && /* @__PURE__ */ import_react4.default.createElement("span", { className: "ws-update-restart-version" }, t("updateInstalled"), " ", installedVersion))) : /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, hasUpdate ? /* @__PURE__ */ import_react4.default.createElement("span", { className: company ? "ws-dot ws-company-update-dot" : "ws-dot", "aria-hidden": "true" }) : updateRefreshIcon, /* @__PURE__ */ import_react4.default.createElement("span", null, triggerLabel)),
|
|
7442
|
+
updateChevronIcon
|
|
7443
|
+
), open && /* @__PURE__ */ import_react4.default.createElement("section", { id, className: "ws-update-card", "aria-label": t("updateTitle") }, /* @__PURE__ */ import_react4.default.createElement("div", { className: "ws-update-heading" }, /* @__PURE__ */ import_react4.default.createElement("strong", null, t("updateTitle")), /* @__PURE__ */ import_react4.default.createElement("button", { type: "button", className: "ws-icon-button", "aria-label": t("updateClose"), onClick: close }, "\xD7")), /* @__PURE__ */ import_react4.default.createElement("dl", { className: "ws-update-versions" }, /* @__PURE__ */ import_react4.default.createElement("div", null, /* @__PURE__ */ import_react4.default.createElement("dt", null, t("updateCurrent")), /* @__PURE__ */ import_react4.default.createElement("dd", null, runningVersion || "\u2014")), installedVersion && installedVersion !== runningVersion && /* @__PURE__ */ import_react4.default.createElement("div", null, /* @__PURE__ */ import_react4.default.createElement("dt", null, t("updateInstalled")), /* @__PURE__ */ import_react4.default.createElement("dd", null, installedVersion)), available && /* @__PURE__ */ import_react4.default.createElement("div", null, /* @__PURE__ */ import_react4.default.createElement("dt", null, t(company ? "updateTarget" : "updateTargetVersion")), /* @__PURE__ */ import_react4.default.createElement("dd", { className: company ? "ws-company-update-version" : void 0 }, available))), company ? /* @__PURE__ */ import_react4.default.createElement("div", { role: "status" }, /* @__PURE__ */ import_react4.default.createElement("div", { className: "ws-company-update-hint" }, /* @__PURE__ */ import_react4.default.createElement("p", { className: "ws-update-summary" }, companyStatus), restartRequired && /* @__PURE__ */ import_react4.default.createElement("p", null, t("updateRestartHelp")), available && /* @__PURE__ */ import_react4.default.createElement("p", null, t("updateCompanyNew"))), available && /* @__PURE__ */ import_react4.default.createElement("div", { className: "ws-company-update-path" }, /* @__PURE__ */ import_react4.default.createElement("p", null, t("updateCompanyPathTitle")), /* @__PURE__ */ import_react4.default.createElement("strong", null, t("updateCompanyPath")))) : /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, /* @__PURE__ */ import_react4.default.createElement("div", { className: `ws-update-feedback${restartRequired ? " ws-update-feedback-restart" : ""}` }, /* @__PURE__ */ import_react4.default.createElement("div", { className: "ws-update-status" }, /* @__PURE__ */ import_react4.default.createElement("span", { role: "status" }, /* @__PURE__ */ import_react4.default.createElement("span", { className: "ws-dot", "aria-hidden": "true" }), status), percent !== void 0 && /* @__PURE__ */ import_react4.default.createElement("strong", { className: "ws-update-percent", "aria-hidden": "true" }, percent, "%")), stages !== void 0 && /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, /* @__PURE__ */ import_react4.default.createElement("div", { className: "ws-update-track", role: "progressbar", "aria-label": t("updateProgressTitle"), "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": percent, "aria-valuetext": progressText }, [0, 1, 2].map((step) => /* @__PURE__ */ import_react4.default.createElement("span", { key: step, "data-state": step < stages ? "done" : step === stages ? "current" : "pending" }))), /* @__PURE__ */ import_react4.default.createElement("div", { className: "ws-update-track-caption", "aria-hidden": "true" }, /* @__PURE__ */ import_react4.default.createElement("span", null, t("updateProgressSteps")), /* @__PURE__ */ import_react4.default.createElement("span", null, progressText))), restartRequired && /* @__PURE__ */ import_react4.default.createElement("p", { className: "ws-update-note" }, t("updateRestartHelp")), phase === "installing" && !disconnected && /* @__PURE__ */ import_react4.default.createElement("p", { className: "ws-update-note" }, t("updateInstallHelp")), phase === "available" && !checking && view.candidate?.automatic === false && /* @__PURE__ */ import_react4.default.createElement("p", { className: "ws-update-note" }, t("updateConfirmMinor")), phase === "available" && !checking && view.candidate?.automatic && !automatic && /* @__PURE__ */ import_react4.default.createElement("p", { className: "ws-update-note" }, t("updateManualHelp")), errorKey && /* @__PURE__ */ import_react4.default.createElement("p", { className: "ws-update-note", role: "status" }, t(errorKey))), !needsSetup && phase !== "recovery-required" && !disconnected && /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, busy || unavailable ? /* @__PURE__ */ import_react4.default.createElement("div", { className: "ws-update-toggle" }, /* @__PURE__ */ import_react4.default.createElement("span", null, t("updateAutomatic")), /* @__PURE__ */ import_react4.default.createElement("span", { className: "ws-update-toggle-state" }, t(automatic ? "updateOn" : "updateOff"))) : /* @__PURE__ */ import_react4.default.createElement("label", { className: "ws-update-toggle" }, /* @__PURE__ */ import_react4.default.createElement("span", null, t("updateAutomatic")), /* @__PURE__ */ import_react4.default.createElement("input", { type: "checkbox", role: "switch", checked: automatic, onChange: (e) => void client.action("automatic", e.target.checked) })), !busy && !restartRequired && /* @__PURE__ */ import_react4.default.createElement("p", { className: "ws-update-policy" }, t("updatePolicy"))), !active && !unavailable && !disconnected && /* @__PURE__ */ import_react4.default.createElement("div", { className: "ws-update-actions" }, view.checkedAt && !checking && /* @__PURE__ */ import_react4.default.createElement("p", { className: "ws-update-checked" }, t("updateChecked"), " ", /* @__PURE__ */ import_react4.default.createElement("time", { dateTime: new Date(view.checkedAt).toISOString() }, new Date(view.checkedAt).toLocaleTimeString(void 0, { hour: "2-digit", minute: "2-digit", second: "2-digit" }))), /* @__PURE__ */ import_react4.default.createElement("button", { type: "button", className: "ws-button", disabled: busy, "aria-busy": checking, onClick: () => void client.action("check") }, t(checking ? "updateChecking" : "updateCheck")), available && !checking && /* @__PURE__ */ import_react4.default.createElement("button", { type: "button", className: "ws-button ws-primary", disabled: busy, onClick: () => void client.action("install") }, t(view.retryable ? "updateRetry" : "updateInstall"))))));
|
|
7423
7444
|
}
|
|
7424
7445
|
var updateStyles = `
|
|
7425
|
-
.ws-update{-webkit-app-region:no-drag}
|
|
7446
|
+
.ws-update{-webkit-app-region:no-drag}
|
|
7447
|
+
.ws-update-card{position:absolute;right:24px;top:78px;z-index:15;width:340px;max-width:calc(100% - 24px);max-height:calc(100% - 92px);overflow:auto;padding:16px;background:var(--ws-bg);border:1px solid var(--ws-line);border-radius:12px;box-shadow:0 12px 36px #00000018;text-align:left}
|
|
7448
|
+
.ws-update-heading{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
|
|
7449
|
+
.ws-update-heading strong{font-size:14px}
|
|
7450
|
+
.ws-update-card .ws-update-versions{display:grid;gap:4px;margin-bottom:10px}
|
|
7451
|
+
.ws-update-versions>div{display:flex;align-items:baseline;justify-content:space-between;gap:8px}
|
|
7452
|
+
.ws-update-versions dt{color:var(--ws-muted);font-size:12px}
|
|
7453
|
+
.ws-update-versions dd{font-variant-numeric:tabular-nums;font-family:ui-monospace,monospace;font-size:12px;overflow-wrap:anywhere}
|
|
7454
|
+
.ws-update-feedback,.ws-company-update-hint{padding:9px 10px;border-radius:8px;background:var(--dsw-alias-interactive-bg-hover-solid,var(--ws-soft))}
|
|
7455
|
+
.ws-update-status{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:12px;font-weight:500}
|
|
7456
|
+
.ws-update-status [role=status]{display:flex;align-items:baseline;gap:7px}
|
|
7457
|
+
.ws-update-status .ws-dot{align-self:center}
|
|
7458
|
+
.ws-update-percent{font:600 22px/1.15 ui-monospace,monospace;color:var(--ws-accent)}
|
|
7459
|
+
.ws-update-track{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;margin-top:7px}
|
|
7460
|
+
.ws-update-track>span{height:5px;border-radius:3px;background:color-mix(in srgb,var(--ws-accent) 18%,var(--ws-bg))}
|
|
7461
|
+
.ws-update-track>span[data-state=current]{background:color-mix(in srgb,var(--ws-accent) 53%,var(--ws-bg))}
|
|
7462
|
+
.ws-update-track>span[data-state=done]{background:var(--ws-accent)}
|
|
7463
|
+
.ws-update-track-caption{display:flex;justify-content:space-between;flex-wrap:wrap;gap:2px 7px;margin-top:4px;font-size:11px}
|
|
7464
|
+
.ws-update-card .ws-update-note{font-size:11px;line-height:1.6;margin-top:4px;overflow-wrap:anywhere}
|
|
7465
|
+
.ws-update-toggle{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:10px;border-top:1px solid var(--ws-line);padding-top:10px;font-size:12px}
|
|
7466
|
+
label.ws-update-toggle{cursor:pointer}
|
|
7467
|
+
.ws-update-toggle input{appearance:none;display:flex;align-items:center;flex:none;width:28px;height:16px;margin:0;padding:2px;border:0;border-radius:10px;background:var(--dsw-alias-button-contrast-fill,var(--ws-muted));cursor:pointer}
|
|
7468
|
+
.ws-update-toggle input:checked{justify-content:flex-end;background:var(--ws-accent)}
|
|
7469
|
+
.ws-update-toggle input::after{content:'';width:12px;height:12px;border-radius:50%;background:var(--dsw-alias-label-primary-foreground,var(--ws-bg))}
|
|
7470
|
+
.ws-update-toggle input:not(:checked)::after{background:var(--dsw-alias-switch-thumb,var(--ws-bg))}
|
|
7471
|
+
.ws-update-toggle-state,.ws-update-card .ws-update-policy,.ws-update-checked{color:var(--ws-muted);font-size:11px}
|
|
7472
|
+
.ws-update-card .ws-update-policy{line-height:1.7;margin-top:4px}
|
|
7473
|
+
.ws-update-actions{display:flex;justify-content:flex-end;align-items:center;flex-wrap:wrap;gap:6px;margin-top:10px}
|
|
7474
|
+
.ws-update-actions .ws-update-checked{margin-inline-end:auto;white-space:nowrap}
|
|
7475
|
+
.ws-update-freeze{padding:8px 28px;border-top:1px solid var(--ws-line);background:var(--ws-soft);font-size:12px;flex:none}
|
|
7476
|
+
.ws-update-trigger .ws-dot{color:var(--ws-accent)}
|
|
7477
|
+
.ws-update-chevron{margin-inline-start:auto;color:var(--ws-muted)}
|
|
7478
|
+
.ws-update-trigger[aria-expanded=true] .ws-update-chevron{transform:rotate(180deg)}
|
|
7479
|
+
.ws-update-trigger-active{font-variant-numeric:tabular-nums;background:var(--dsw-alias-interactive-bg-hover-solid,var(--ws-soft))}
|
|
7480
|
+
.ws-update-trigger-restart{min-width:144px;min-height:44px;justify-content:flex-start;gap:10px}
|
|
7481
|
+
.ws-update-trigger-restart,.ws-update-feedback-restart{background:var(--ws-soft);background:light-dark(#faf9f6,var(--ws-soft))}
|
|
7482
|
+
.ws-update-trigger-restart .ws-update-restart-dot,.ws-update-feedback-restart .ws-dot{width:7px;height:7px;color:#a66a12;color:light-dark(#a66a12,#e2ad54);opacity:1}
|
|
7483
|
+
.ws-update-restart-copy{display:grid;gap:2px;text-align:start;font-size:13px;font-weight:500;line-height:1.25}
|
|
7484
|
+
.ws-update-restart-version{color:var(--ws-muted);font-size:11px;font-weight:400;font-variant-numeric:tabular-nums}
|
|
7485
|
+
.ws-update-trigger .ws-company-update-dot,.ws-company-update-version{color:#237c3d;color:light-dark(#237c3d,#76d68c)}
|
|
7486
|
+
.ws-update-trigger .ws-company-update-dot{width:7px;height:7px;opacity:1}
|
|
7487
|
+
.ws-company-update-hint{font-size:12px;line-height:1.6}
|
|
7488
|
+
.ws-company-update-hint p+p{margin-top:4px}
|
|
7489
|
+
.ws-update-summary{font-weight:500}
|
|
7490
|
+
.ws-company-update-path{margin-top:10px;font-size:12px;overflow-wrap:anywhere}
|
|
7491
|
+
.ws-company-update-path p{margin-bottom:3px;color:var(--ws-muted);font-size:11px}
|
|
7426
7492
|
@container(max-width:540px){.ws-header{flex-wrap:wrap}.ws-header-actions{margin-left:auto;gap:8px}.ws-update-card{top:120px;right:12px;max-height:calc(100% - 132px)}}
|
|
7427
|
-
.ws-update-trigger .ws-company-update-dot,.ws-company-update-version{color:#237c3d;color:light-dark(#237c3d,#76d68c)}.ws-update-trigger .ws-company-update-dot{width:7px;height:7px;opacity:1}.ws-company-update-hint{margin-top:14px;border-top:1px solid var(--ws-line);padding-top:12px;font-size:12px;line-height:1.6;color:var(--ws-muted)}.ws-company-update-hint p+p{margin-top:3px}
|
|
7428
7493
|
`;
|
|
7429
7494
|
|
|
7430
7495
|
// src/company/panel.tsx
|
|
@@ -8044,8 +8109,9 @@ var voicePlayback = new VoicePlaybackCoordinator();
|
|
|
8044
8109
|
function WechatMessageBody({ message, client, contactId, revision: revision2, t, onPrioritize }) {
|
|
8045
8110
|
const attachment = message.kind === "image" || message.kind === "voice" || message.kind === "audio" || message.kind === "video";
|
|
8046
8111
|
const text4 = attachment ? /^\[(?:image|图片|video|视频|(?:voice|audio|语音)(?:\s*\d+(?:\.\d+)?\s*(?:秒|s|["″”]))?)\]$/i.test(message.text?.trim() ?? "") ? "" : message.text : message.text || `[${message.kind}]`;
|
|
8047
|
-
const
|
|
8048
|
-
|
|
8112
|
+
const voiceMenu = !!contactId && message.kind === "voice";
|
|
8113
|
+
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 });
|
|
8114
|
+
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);
|
|
8049
8115
|
}
|
|
8050
8116
|
function PendingAttachment({ kind, t, prioritize }) {
|
|
8051
8117
|
const [state, setState] = (0, import_react8.useState)("idle");
|
|
@@ -8065,7 +8131,7 @@ function PendingAttachment({ kind, t, prioritize }) {
|
|
|
8065
8131
|
function NativeMedia(props) {
|
|
8066
8132
|
return /* @__PURE__ */ import_react8.default.createElement(MediaAttachment, { key: props.mediaId, ...props });
|
|
8067
8133
|
}
|
|
8068
|
-
function MediaAttachment({ client, mediaId, kind, revision: revision2, t,
|
|
8134
|
+
function MediaAttachment({ client, mediaId, kind, revision: revision2, t, voiceMenu }) {
|
|
8069
8135
|
const [result, setResult] = (0, import_react8.useState)({ mediaId });
|
|
8070
8136
|
const [requested, setRequested] = (0, import_react8.useState)(kind !== "video");
|
|
8071
8137
|
const [retry, setRetry] = (0, import_react8.useState)(0), element2 = (0, import_react8.useRef)(null), loaded = (0, import_react8.useRef)(false);
|
|
@@ -8101,7 +8167,7 @@ function MediaAttachment({ client, mediaId, kind, revision: revision2, t, transc
|
|
|
8101
8167
|
if (kind === "video") {
|
|
8102
8168
|
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")));
|
|
8103
8169
|
}
|
|
8104
|
-
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,
|
|
8170
|
+
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")));
|
|
8105
8171
|
}
|
|
8106
8172
|
function ImageAttachment({ src, t, onError }) {
|
|
8107
8173
|
const [open, setOpen] = (0, import_react8.useState)(false), trigger = (0, import_react8.useRef)(null);
|
|
@@ -8113,18 +8179,14 @@ function VoiceWaves() {
|
|
|
8113
8179
|
function VoicePlaceholder({ state, t, retry }) {
|
|
8114
8180
|
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")));
|
|
8115
8181
|
}
|
|
8116
|
-
function VoiceAttachment({ src, t, onError,
|
|
8182
|
+
function VoiceAttachment({ src, t, onError, voiceMenu }) {
|
|
8117
8183
|
const audio = (0, import_react8.useRef)(null), alive = (0, import_react8.useRef)(true);
|
|
8118
|
-
const trigger = (0, import_react8.useRef)(null), menu = (0, import_react8.useRef)(null);
|
|
8119
|
-
const request = (0, import_react8.useRef)(null);
|
|
8120
8184
|
const [playing, setPlaying] = (0, import_react8.useState)(false), [duration, setDuration] = (0, import_react8.useState)(), [playError, setPlayError] = (0, import_react8.useState)(false);
|
|
8121
|
-
const [transcription, setTranscription] = (0, import_react8.useState)();
|
|
8122
8185
|
(0, import_react8.useEffect)(() => {
|
|
8123
8186
|
alive.current = true;
|
|
8124
8187
|
const element2 = audio.current;
|
|
8125
8188
|
return () => {
|
|
8126
8189
|
alive.current = false;
|
|
8127
|
-
request.current?.abort();
|
|
8128
8190
|
if (element2) voicePlayback.stop(element2);
|
|
8129
8191
|
};
|
|
8130
8192
|
}, []);
|
|
@@ -8138,6 +8200,38 @@ function VoiceAttachment({ src, t, onError, transcribe }) {
|
|
|
8138
8200
|
if (alive.current) setPlayError(true);
|
|
8139
8201
|
}
|
|
8140
8202
|
};
|
|
8203
|
+
const durationLabel = voiceDurationLabel(duration);
|
|
8204
|
+
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) => {
|
|
8205
|
+
voicePlayback.stop(event.currentTarget);
|
|
8206
|
+
setPlaying(false);
|
|
8207
|
+
}, onError }), /* @__PURE__ */ import_react8.default.createElement(
|
|
8208
|
+
"button",
|
|
8209
|
+
{
|
|
8210
|
+
type: "button",
|
|
8211
|
+
className: `ws-voice-button${playing ? " is-playing" : ""}`,
|
|
8212
|
+
style: { width: Math.min(240, 112 + (duration && Number.isFinite(duration) ? duration : 0) * 2) },
|
|
8213
|
+
onClick: () => void toggle(),
|
|
8214
|
+
"aria-label": `${t(playing ? "wxPauseVoice" : "wxPlayVoice")}${durationLabel ? " \xB7 " + durationLabel : ""}`,
|
|
8215
|
+
"aria-pressed": playing,
|
|
8216
|
+
"aria-haspopup": voiceMenu ? "menu" : void 0
|
|
8217
|
+
},
|
|
8218
|
+
/* @__PURE__ */ import_react8.default.createElement(VoiceWaves, null),
|
|
8219
|
+
/* @__PURE__ */ import_react8.default.createElement("span", { className: "ws-voice-duration", "aria-hidden": "true" }, durationLabel)
|
|
8220
|
+
), playError && /* @__PURE__ */ import_react8.default.createElement("span", { className: "ws-voice-error", role: "status" }, t("wxVoicePlaybackFailed")));
|
|
8221
|
+
}
|
|
8222
|
+
var transcriptionErrors = {
|
|
8223
|
+
WECHAT_VOICE_NOT_AVAILABLE: "wxTranscriptVoicePending",
|
|
8224
|
+
WECHAT_TRANSCRIPTION_NOT_CONFIGURED: "wxTranscriptNotConfigured",
|
|
8225
|
+
WECHAT_TRANSCRIPTION_AUTH_FAILED: "wxTranscriptAuthFailed",
|
|
8226
|
+
WECHAT_TRANSCRIPTION_TIMEOUT: "wxTranscriptTimeout",
|
|
8227
|
+
WECHAT_TRANSCRIPTION_EMPTY: "wxTranscriptEmpty",
|
|
8228
|
+
WECHAT_TRANSCRIPTION_INVALID_AUDIO: "wxAudioUnavailable"
|
|
8229
|
+
};
|
|
8230
|
+
function VoiceTranscription({ children, pending, t, transcribe }) {
|
|
8231
|
+
const trigger = (0, import_react8.useRef)(null), menu = (0, import_react8.useRef)(null);
|
|
8232
|
+
const request = (0, import_react8.useRef)(null);
|
|
8233
|
+
const [transcription, setTranscription] = (0, import_react8.useState)();
|
|
8234
|
+
(0, import_react8.useEffect)(() => () => request.current?.abort(), []);
|
|
8141
8235
|
const showMenu = (x, y) => {
|
|
8142
8236
|
const element2 = menu.current;
|
|
8143
8237
|
if (!element2) return;
|
|
@@ -8152,64 +8246,62 @@ function VoiceAttachment({ src, t, onError, transcribe }) {
|
|
|
8152
8246
|
};
|
|
8153
8247
|
const convert2 = async () => {
|
|
8154
8248
|
closeMenu();
|
|
8155
|
-
if (
|
|
8249
|
+
if (request.current || transcription?.state === "done") return;
|
|
8156
8250
|
const controller = new AbortController();
|
|
8157
8251
|
request.current = controller;
|
|
8158
|
-
setTranscription({ state: "loading" });
|
|
8252
|
+
setTranscription({ state: "loading", text: t("wxTranscribingVoice") });
|
|
8159
8253
|
try {
|
|
8160
8254
|
const { text: text4 } = await transcribe(controller.signal);
|
|
8161
8255
|
if (!controller.signal.aborted) setTranscription({ state: "done", text: text4 });
|
|
8162
|
-
} catch {
|
|
8163
|
-
|
|
8256
|
+
} catch (error) {
|
|
8257
|
+
const code2 = error instanceof Error && "code" in error ? error.code : void 0;
|
|
8258
|
+
const key = typeof code2 === "string" && Object.hasOwn(transcriptionErrors, code2) ? transcriptionErrors[code2] : "wxTranscriptUnavailable";
|
|
8259
|
+
if (!controller.signal.aborted) setTranscription({ state: "error", text: t(key) });
|
|
8164
8260
|
} finally {
|
|
8165
8261
|
request.current = null;
|
|
8166
8262
|
}
|
|
8167
8263
|
};
|
|
8168
|
-
|
|
8169
|
-
|
|
8170
|
-
voicePlayback.stop(event.currentTarget);
|
|
8171
|
-
setPlaying(false);
|
|
8172
|
-
}, onError }), /* @__PURE__ */ import_react8.default.createElement(
|
|
8173
|
-
"button",
|
|
8264
|
+
return /* @__PURE__ */ import_react8.default.createElement(
|
|
8265
|
+
"div",
|
|
8174
8266
|
{
|
|
8175
|
-
|
|
8176
|
-
|
|
8177
|
-
|
|
8178
|
-
|
|
8179
|
-
onClick: () => void toggle(),
|
|
8180
|
-
"aria-label": `${t(playing ? "wxPauseVoice" : "wxPlayVoice")}${durationLabel ? " \xB7 " + durationLabel : ""}`,
|
|
8181
|
-
"aria-pressed": playing,
|
|
8182
|
-
"aria-haspopup": transcribe ? "menu" : void 0,
|
|
8183
|
-
onContextMenu: transcribe ? (event) => {
|
|
8267
|
+
tabIndex: pending ? 0 : void 0,
|
|
8268
|
+
"aria-haspopup": pending ? "menu" : void 0,
|
|
8269
|
+
onContextMenu: (event) => {
|
|
8270
|
+
if (menu.current?.contains(event.target)) return;
|
|
8184
8271
|
event.preventDefault();
|
|
8272
|
+
event.stopPropagation();
|
|
8273
|
+
trigger.current = event.currentTarget.querySelector(".ws-voice-button") ?? event.currentTarget;
|
|
8185
8274
|
showMenu(event.clientX, event.clientY);
|
|
8186
|
-
}
|
|
8187
|
-
onKeyDown:
|
|
8275
|
+
},
|
|
8276
|
+
onKeyDown: (event) => {
|
|
8188
8277
|
if (event.key !== "ContextMenu" && !(event.shiftKey && event.key === "F10")) return;
|
|
8278
|
+
if (!(event.target instanceof HTMLElement) || menu.current?.contains(event.target)) return;
|
|
8189
8279
|
event.preventDefault();
|
|
8190
|
-
|
|
8280
|
+
trigger.current = event.target;
|
|
8281
|
+
const position2 = event.target.getBoundingClientRect();
|
|
8191
8282
|
showMenu(position2.left, position2.bottom);
|
|
8192
|
-
} : void 0
|
|
8193
|
-
},
|
|
8194
|
-
/* @__PURE__ */ import_react8.default.createElement(VoiceWaves, null),
|
|
8195
|
-
/* @__PURE__ */ import_react8.default.createElement("span", { className: "ws-voice-duration", "aria-hidden": "true" }, durationLabel)
|
|
8196
|
-
), transcribe && /* @__PURE__ */ import_react8.default.createElement(
|
|
8197
|
-
"div",
|
|
8198
|
-
{
|
|
8199
|
-
ref: menu,
|
|
8200
|
-
...{ popover: "auto" },
|
|
8201
|
-
className: "ws-voice-menu",
|
|
8202
|
-
role: "menu",
|
|
8203
|
-
onKeyDown: (event) => {
|
|
8204
|
-
if (event.key === "Escape") {
|
|
8205
|
-
event.preventDefault();
|
|
8206
|
-
event.stopPropagation();
|
|
8207
|
-
closeMenu();
|
|
8208
|
-
}
|
|
8209
8283
|
}
|
|
8210
8284
|
},
|
|
8211
|
-
|
|
8212
|
-
|
|
8285
|
+
children,
|
|
8286
|
+
/* @__PURE__ */ import_react8.default.createElement(
|
|
8287
|
+
"div",
|
|
8288
|
+
{
|
|
8289
|
+
ref: menu,
|
|
8290
|
+
...{ popover: "auto" },
|
|
8291
|
+
className: "ws-voice-menu",
|
|
8292
|
+
role: "menu",
|
|
8293
|
+
onKeyDown: (event) => {
|
|
8294
|
+
if (event.key === "Escape") {
|
|
8295
|
+
event.preventDefault();
|
|
8296
|
+
event.stopPropagation();
|
|
8297
|
+
closeMenu();
|
|
8298
|
+
}
|
|
8299
|
+
}
|
|
8300
|
+
},
|
|
8301
|
+
/* @__PURE__ */ import_react8.default.createElement("button", { type: "button", role: "menuitem", "aria-disabled": transcription?.state === "loading" || transcription?.state === "done", onClick: () => void convert2() }, t("wxTranscribeVoice"))
|
|
8302
|
+
),
|
|
8303
|
+
transcription && /* @__PURE__ */ import_react8.default.createElement("div", { className: "ws-voice-transcript", role: "status" }, transcription.text)
|
|
8304
|
+
);
|
|
8213
8305
|
}
|
|
8214
8306
|
|
|
8215
8307
|
// src/wechat/sync-panel.tsx
|
|
@@ -8686,11 +8778,13 @@ function createUpdateClient(rpc, options) {
|
|
|
8686
8778
|
let view = { phase: "idle", runningVersion: "", automatic: DEFAULT_AUTOMATIC, preparing: false, checking: false };
|
|
8687
8779
|
let prepared, disposed = false, timer, polling;
|
|
8688
8780
|
const listeners = /* @__PURE__ */ new Set(), lifetime = new AbortController();
|
|
8689
|
-
const
|
|
8781
|
+
const replace2 = (next) => {
|
|
8690
8782
|
if (disposed) return;
|
|
8691
|
-
view =
|
|
8783
|
+
view = next;
|
|
8692
8784
|
for (const f of listeners) f();
|
|
8693
8785
|
};
|
|
8786
|
+
const publish = (patch) => replace2({ ...view, ...patch });
|
|
8787
|
+
const publishSnapshot = (snapshot) => replace2({ ...snapshot, preparing: view.preparing, checking: view.checking });
|
|
8694
8788
|
const freeze = (value) => {
|
|
8695
8789
|
options.freeze(value);
|
|
8696
8790
|
publish({ preparing: value });
|
|
@@ -8702,14 +8796,18 @@ function createUpdateClient(rpc, options) {
|
|
|
8702
8796
|
};
|
|
8703
8797
|
const heartbeat = () => call({ operation: "heartbeat", clientId: options.id, readiness: { ...options.readiness(), prepared } });
|
|
8704
8798
|
const poll = () => polling ??= (async () => {
|
|
8799
|
+
let saving = false;
|
|
8705
8800
|
try {
|
|
8706
8801
|
let reply = await heartbeat();
|
|
8707
8802
|
if (disposed) return;
|
|
8708
8803
|
if (reply.prepareRequestId) {
|
|
8709
8804
|
freeze(true);
|
|
8710
8805
|
if (prepared !== reply.prepareRequestId && !options.readiness().busy) {
|
|
8806
|
+
publishSnapshot(reply.snapshot);
|
|
8807
|
+
saving = true;
|
|
8711
8808
|
await options.flush();
|
|
8712
8809
|
if (disposed) return;
|
|
8810
|
+
saving = false;
|
|
8713
8811
|
const ready = options.readiness();
|
|
8714
8812
|
if (!ready.busy && !ready.dirty) {
|
|
8715
8813
|
prepared = reply.prepareRequestId;
|
|
@@ -8722,9 +8820,9 @@ function createUpdateClient(rpc, options) {
|
|
|
8722
8820
|
prepared = void 0;
|
|
8723
8821
|
freeze(false);
|
|
8724
8822
|
}
|
|
8725
|
-
|
|
8823
|
+
publishSnapshot(reply.snapshot);
|
|
8726
8824
|
} catch (error) {
|
|
8727
|
-
|
|
8825
|
+
publish({ reconnecting: !saving, error: saving ? "UPDATE_SAVE_FAILED" : error instanceof Error ? error.message : "UPDATE_SERVICE_UNAVAILABLE" });
|
|
8728
8826
|
}
|
|
8729
8827
|
})().finally(() => {
|
|
8730
8828
|
polling = void 0;
|
|
@@ -8751,7 +8849,7 @@ function createUpdateClient(rpc, options) {
|
|
|
8751
8849
|
if (operation === "check") publish({ checking: true, error: void 0 });
|
|
8752
8850
|
try {
|
|
8753
8851
|
const reply = await call({ operation, ...operation === "automatic" ? { enabled } : {} });
|
|
8754
|
-
|
|
8852
|
+
publishSnapshot(reply.snapshot);
|
|
8755
8853
|
await poll();
|
|
8756
8854
|
} catch (error) {
|
|
8757
8855
|
publish({ error: error instanceof Error ? error.message : "UPDATE_UNAVAILABLE" });
|
|
@@ -9567,6 +9665,27 @@ var updateZh = {
|
|
|
9567
9665
|
updateInstall: "\u7ACB\u5373\u66F4\u65B0",
|
|
9568
9666
|
updateAutomatic: "\u7A7A\u95F2\u65F6\u81EA\u52A8\u5B89\u88C5\u8865\u4E01\u66F4\u65B0",
|
|
9569
9667
|
updatePolicy: "\u9ED8\u8BA4\u81EA\u52A8\u68C0\u67E5\u5E76\u5B89\u88C5\u8865\u4E01\uFF0C\u65E0\u9700\u5F00\u542F\u3002\u8DE8\u5C0F\u7248\u672C\u5347\u7EA7\u9700\u786E\u8BA4\uFF1B\u4E0D\u4F1A\u5F3A\u5236\u91CD\u542F\u3002",
|
|
9668
|
+
updateRestartTrigger: "\u91CD\u542F\u540E\u751F\u6548",
|
|
9669
|
+
updateRestartHelp: "\u53EF\u7EE7\u7EED\u4F7F\u7528\uFF0C\u65B9\u4FBF\u65F6\u91CD\u542F\u5E94\u7528\u3002",
|
|
9670
|
+
updateTargetVersion: "\u66F4\u65B0\u76EE\u6807",
|
|
9671
|
+
updateHasUpdate: "\u6709\u66F4\u65B0",
|
|
9672
|
+
updateProgressTitle: "\u66F4\u65B0\u9636\u6BB5\u5B8C\u6210\u5EA6",
|
|
9673
|
+
updateProgressSteps: "\u51C6\u5907 \xB7 \u5B89\u88C5 \xB7 \u9A8C\u8BC1",
|
|
9674
|
+
updateProgressCompleted: "\u5DF2\u5B8C\u6210 {count}/3 \u9636\u6BB5",
|
|
9675
|
+
updateBusyTrigger: "\u66F4\u65B0\u4E2D",
|
|
9676
|
+
updateWaitingTrigger: "\u7B49\u5F85\u7A7A\u95F2",
|
|
9677
|
+
updateDeferred: "\u66F4\u65B0\u5DF2\u5EF6\u540E",
|
|
9678
|
+
updateRetry: "\u91CD\u8BD5\u66F4\u65B0",
|
|
9679
|
+
updateStatePending: "\u66F4\u65B0\u72B6\u6001\u5F85\u786E\u8BA4",
|
|
9680
|
+
updateCompanyChecking: "\u6B63\u5728\u68C0\u67E5\u516C\u53F8\u5E02\u573A",
|
|
9681
|
+
updateCompanyNew: "\u8BF7\u5728\u4E07\u673A\u63D2\u4EF6\u4E2D\u5FC3\u66F4\u65B0\u3002",
|
|
9682
|
+
updateInstallHelp: "\u5B89\u88C5\u5B8C\u6210\u540E\u5C06\u9A8C\u8BC1\u65B0\u7248\u6216\u63D0\u793A\u91CD\u542F\u3002",
|
|
9683
|
+
updateOn: "\u5DF2\u5F00\u542F",
|
|
9684
|
+
updateOff: "\u5DF2\u5173\u95ED",
|
|
9685
|
+
updateFreezeInstalling: "\u6B63\u5728\u5B89\u88C5\u66F4\u65B0\uFF0C\u6682\u65F6\u65E0\u6CD5\u7F16\u8F91\u3002",
|
|
9686
|
+
updateFreezeVerifying: "\u6B63\u5728\u9A8C\u8BC1\u65B0\u7248\uFF0C\u6682\u65F6\u65E0\u6CD5\u7F16\u8F91\u3002",
|
|
9687
|
+
updateConfirmMinor: "\u8DE8\u5C0F\u7248\u672C\u5347\u7EA7\u9700\u8981\u786E\u8BA4\u3002",
|
|
9688
|
+
updateManualHelp: "\u53EF\u5728\u65B9\u4FBF\u65F6\u624B\u52A8\u5B89\u88C5\u3002",
|
|
9570
9689
|
updateIdle: "\u5DF2\u5B8C\u6210\u68C0\u67E5\uFF0C\u6682\u65E0\u66F4\u65B0",
|
|
9571
9690
|
updateInitial: "\u542F\u52A8\u540E\u81EA\u52A8\u68C0\u67E5\u66F4\u65B0",
|
|
9572
9691
|
updateChecking: "\u6B63\u5728\u68C0\u67E5\u65B0\u7248\u672C",
|
|
@@ -9606,6 +9725,27 @@ var updateEn = {
|
|
|
9606
9725
|
updateInstall: "Update now",
|
|
9607
9726
|
updateAutomatic: "Install patch updates when idle",
|
|
9608
9727
|
updatePolicy: "Checks and installs patches automatically by default; no setup required. Minor upgrades require confirmation. The app never restarts automatically.",
|
|
9728
|
+
updateRestartTrigger: "Restart to apply",
|
|
9729
|
+
updateRestartHelp: "You can continue working and restart when convenient.",
|
|
9730
|
+
updateTargetVersion: "Update target",
|
|
9731
|
+
updateHasUpdate: "Update available",
|
|
9732
|
+
updateProgressTitle: "Update stages completed",
|
|
9733
|
+
updateProgressSteps: "Prepare \xB7 Install \xB7 Verify",
|
|
9734
|
+
updateProgressCompleted: "{count}/3 stages complete",
|
|
9735
|
+
updateBusyTrigger: "Updating",
|
|
9736
|
+
updateWaitingTrigger: "Waiting to install",
|
|
9737
|
+
updateDeferred: "Update deferred",
|
|
9738
|
+
updateRetry: "Retry update",
|
|
9739
|
+
updateStatePending: "Awaiting update status",
|
|
9740
|
+
updateCompanyChecking: "Checking the Company market",
|
|
9741
|
+
updateCompanyNew: "Update from Wanji Plugin Center.",
|
|
9742
|
+
updateInstallHelp: "After installation, the app verifies the new version or asks you to restart.",
|
|
9743
|
+
updateOn: "On",
|
|
9744
|
+
updateOff: "Off",
|
|
9745
|
+
updateFreezeInstalling: "Installing the update. Editing is paused.",
|
|
9746
|
+
updateFreezeVerifying: "Verifying the new version. Editing is paused.",
|
|
9747
|
+
updateConfirmMinor: "Minor upgrades require confirmation.",
|
|
9748
|
+
updateManualHelp: "You can install the update when convenient.",
|
|
9609
9749
|
updateIdle: "No updates available",
|
|
9610
9750
|
updateInitial: "Checks automatically after startup",
|
|
9611
9751
|
updateChecking: "Checking for updates",
|
|
@@ -10095,6 +10235,11 @@ var zh = {
|
|
|
10095
10235
|
wxTranscribeVoice: "\u8F6C\u4E3A\u6587\u5B57",
|
|
10096
10236
|
wxTranscribingVoice: "\u6B63\u5728\u8F6C\u5199\u8BED\u97F3\u2026",
|
|
10097
10237
|
wxTranscriptUnavailable: "\u8BED\u97F3\u8F6C\u5199\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u8BED\u97F3\u8BC6\u522B\u670D\u52A1\u540E\u91CD\u8BD5\u3002",
|
|
10238
|
+
wxTranscriptVoicePending: "\u8BED\u97F3\u5C1A\u672A\u540C\u6B65\u5230\u672C\u673A\u3002\u8BF7\u540C\u6B65\u540E\u91CD\u8BD5\u3002",
|
|
10239
|
+
wxTranscriptNotConfigured: "\u8BED\u97F3\u8BC6\u522B\u672A\u914D\u7F6E\u3002\u8BF7\u5728\u4E07\u673A\u5927\u8111\u7684\u6A21\u578B\u51ED\u636E\u4E2D\u914D\u7F6E\u963F\u91CC\u4E91\u767E\u70BC API Key\u3002",
|
|
10240
|
+
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",
|
|
10241
|
+
wxTranscriptTimeout: "\u8BED\u97F3\u8BC6\u522B\u8D85\u65F6\uFF0C\u8BF7\u91CD\u8BD5\u3002",
|
|
10242
|
+
wxTranscriptEmpty: "\u8FD9\u6761\u8BED\u97F3\u6CA1\u6709\u8BC6\u522B\u51FA\u6587\u5B57\u3002",
|
|
10098
10243
|
wxPrioritizeMedia: "\u4F18\u5148\u540C\u6B65",
|
|
10099
10244
|
wxMediaPriorityQueued: "\u5DF2\u5B89\u6392\u4F18\u5148\u540C\u6B65",
|
|
10100
10245
|
wxMediaPriorityFailed: "\u6682\u65F6\u65E0\u6CD5\u4F18\u5148\u540C\u6B65\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5",
|
|
@@ -10424,6 +10569,11 @@ var en = {
|
|
|
10424
10569
|
wxTranscribeVoice: "Transcribe",
|
|
10425
10570
|
wxTranscribingVoice: "Transcribing\u2026",
|
|
10426
10571
|
wxTranscriptUnavailable: "Could not transcribe. Check the speech recognition service and retry.",
|
|
10572
|
+
wxTranscriptVoicePending: "This voice message has not synced yet. Sync it and try again.",
|
|
10573
|
+
wxTranscriptNotConfigured: "Speech recognition needs an Alibaba Cloud Model Studio API key in the app\u2019s model credentials.",
|
|
10574
|
+
wxTranscriptAuthFailed: "Speech recognition was denied. Check the Alibaba Cloud Model Studio API key and model access.",
|
|
10575
|
+
wxTranscriptTimeout: "Speech recognition timed out. Try again.",
|
|
10576
|
+
wxTranscriptEmpty: "No speech was recognized in this message.",
|
|
10427
10577
|
wxPrioritizeMedia: "Sync first",
|
|
10428
10578
|
wxMediaPriorityQueued: "Marked for priority sync",
|
|
10429
10579
|
wxMediaPriorityFailed: "Priority sync unavailable. Try again shortly.",
|
|
@@ -10607,6 +10757,11 @@ var en = {
|
|
|
10607
10757
|
contextHint: "Based on the sample conversation"
|
|
10608
10758
|
};
|
|
10609
10759
|
|
|
10760
|
+
// src/sales-model.ts
|
|
10761
|
+
function isSalesFlash(provider, model) {
|
|
10762
|
+
return model === "deepseek-v4.1-flash" || provider === "deepseek-account" && model === "deepseek-flash";
|
|
10763
|
+
}
|
|
10764
|
+
|
|
10610
10765
|
// src/plan-projection.ts
|
|
10611
10766
|
var steps = { answer: "\u7B54\u590D\u5F53\u524D\u95EE\u9898\uFF0C\u63A5\u5BA2\u6237\u540E\u7EED\u7591\u95EE\u3002", provide_material: "\u63D0\u4F9B\u5BA2\u6237\u672C\u8F6E\u8981\u7684\u8BF4\u660E\u6216\u6750\u6599\uFF1B\u5DF2\u6536\u5230\u7684\u5185\u5BB9\u4E0D\u91CD\u590D\u51C6\u5907\u3002", prepare_confirmation: "\u6309\u5DF2\u786E\u8BA4\u8303\u56F4\u63D0\u4F9B\u786E\u8BA4\u6750\u6599\uFF1B\u672A\u5B9A\u4ED8\u6B3E\u6216\u5F00\u901A\u7EC6\u8282\u5355\u72EC\u8865\uFF0C\u4E0D\u62D6\u4F4F\u5DF2\u5B9A\u6750\u6599\u3002", clarify: "\u53EA\u8865\u95EE\u5F71\u54CD\u5F53\u524D\u5224\u65AD\u7684\u5FC5\u8981\u4FE1\u606F\uFF0C\u4E0D\u91CD\u95EE\u5DF2\u7ECF\u660E\u786E\u7684\u5185\u5BB9\u3002", verify_company: "\u53EA\u6838\u5B9E\u672C\u8F6E\u672A\u5B9A\u7684\u516C\u53F8\u6761\u4EF6\uFF0C\u4FDD\u7559\u5176\u4ED6\u5DF2\u7ECF\u786E\u8BA4\u7684\u6761\u4EF6\u3002", coordinate_demo: "\u534F\u8C03\u5BA2\u6237\u5DF2\u613F\u610F\u4E86\u89E3\u7684\u6F14\u793A\uFF0C\u4E0D\u627F\u8BFA\u672A\u786E\u8BA4\u6863\u671F\u3002", wait: "\u7B49\u5F85\u5BA2\u6237\u7EA6\u5B9A\u7684\u53CD\u9988\uFF0C\u4E0D\u91CD\u590D\u51C6\u5907\u5DF2\u5B8C\u6210\u7684\u5185\u5BB9\u3002", stop: "\u6682\u505C\u4E3B\u52A8\u8054\u7CFB\uFF1B\u5BA2\u6237\u56DE\u6765\u63D0\u51FA\u65B0\u95EE\u9898\u65F6\u518D\u63A5\u8BE5\u95EE\u9898\u3002" };
|
|
10612
10767
|
function projectInternalPlan(plan, latest) {
|
|
@@ -12204,6 +12359,9 @@ async function reviewTurn(turn, prompt, parse2, maxAttempts, correction, signal)
|
|
|
12204
12359
|
throw new ReviewProtocolError(true);
|
|
12205
12360
|
}
|
|
12206
12361
|
|
|
12362
|
+
// src/generation-progress.ts
|
|
12363
|
+
var GENERATION_MODEL_ENDPOINT = "wanji-sales-generation/model";
|
|
12364
|
+
|
|
12207
12365
|
// src/agent.ts
|
|
12208
12366
|
var object2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
12209
12367
|
function terminalGenerationFailure(response, afterSeq, throughSeq) {
|
|
@@ -12212,7 +12370,24 @@ function terminalGenerationFailure(response, afterSeq, throughSeq) {
|
|
|
12212
12370
|
if (!object2(ending) || !object2(ending.data) || !object2(ending.data.reason)) return;
|
|
12213
12371
|
const reason = ending.data.reason;
|
|
12214
12372
|
if (reason.kind !== "error" || !object2(reason.error)) return;
|
|
12215
|
-
|
|
12373
|
+
return generationFailure(reason.error.code);
|
|
12374
|
+
}
|
|
12375
|
+
function generationFailure(code2) {
|
|
12376
|
+
switch (code2) {
|
|
12377
|
+
case "GENERATION_COMPANY_MODEL_UNAVAILABLE":
|
|
12378
|
+
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";
|
|
12379
|
+
case "GENERATION_MODEL_NOT_CONFIGURED":
|
|
12380
|
+
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";
|
|
12381
|
+
case "GENERATION_MODEL_INCOMPATIBLE":
|
|
12382
|
+
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";
|
|
12383
|
+
case "GENERATION_WORKSPACE":
|
|
12384
|
+
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";
|
|
12385
|
+
case "GENERATION_SKILL_UNAVAILABLE":
|
|
12386
|
+
return "\u9500\u552E\u52A9\u624B\u6280\u80FD\u6682\u4E0D\u53EF\u7528\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u5B89\u88C5\u3002";
|
|
12387
|
+
case "GENERATION_BUSY":
|
|
12388
|
+
return "\u9500\u552E\u52A9\u624B\u6B63\u5728\u5904\u7406\u5176\u4ED6\u8349\u7A3F\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002";
|
|
12389
|
+
case "GENERATION_TIMEOUT":
|
|
12390
|
+
return "\u7B49\u5F85\u9500\u552E\u56DE\u590D\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002";
|
|
12216
12391
|
case "QUOTA":
|
|
12217
12392
|
case "ACCOUNT_QUOTA":
|
|
12218
12393
|
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";
|
|
@@ -12346,22 +12521,16 @@ async function generateReply(rpc, workspaceId, contact, latest, signal, options
|
|
|
12346
12521
|
};
|
|
12347
12522
|
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");
|
|
12348
12523
|
}
|
|
12524
|
+
const modelLifetime = rpc.draftModel ? new AbortController() : void 0;
|
|
12525
|
+
const modelSignal = modelLifetime ? AbortSignal.any([signal, modelLifetime.signal]) : signal;
|
|
12349
12526
|
let generationLease;
|
|
12350
12527
|
const createSession = async (title) => {
|
|
12351
12528
|
let created;
|
|
12352
12529
|
if (knowledge.generationSessionsSupported) {
|
|
12353
12530
|
const result = await invoke("/api", "wanji-sales-generation/session", { operation: "create", workspaceId, title, ...generationLease ? { leaseId: generationLease } : {} });
|
|
12354
12531
|
if (object2(result) && result.ok === false && object2(result.error)) {
|
|
12355
|
-
|
|
12356
|
-
|
|
12357
|
-
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");
|
|
12358
|
-
case "GENERATION_MODEL_NOT_CONFIGURED":
|
|
12359
|
-
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 Flash\uFF08deepseek-v4.1-flash\uFF09\uFF0C\u518D\u751F\u6210\u56DE\u590D\u3002");
|
|
12360
|
-
case "GENERATION_MODEL_INCOMPATIBLE":
|
|
12361
|
-
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 Flash\uFF08deepseek-v4.1-flash\uFF09\u3002\u6709\u72EC\u7ACB\u9500\u552E\u6A21\u578B\u914D\u7F6E\u65F6\uFF0C\u8BF7\u7BA1\u7406\u5458\u68C0\u67E5\u8BE5\u914D\u7F6E\u3002");
|
|
12362
|
-
case "GENERATION_WORKSPACE":
|
|
12363
|
-
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");
|
|
12364
|
-
}
|
|
12532
|
+
const failure = generationFailure(result.error.code);
|
|
12533
|
+
if (failure) throw Error(failure);
|
|
12365
12534
|
}
|
|
12366
12535
|
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");
|
|
12367
12536
|
generationLease = result.value.leaseId;
|
|
@@ -12411,7 +12580,7 @@ async function generateReply(rpc, workspaceId, contact, latest, signal, options
|
|
|
12411
12580
|
if (!object2(record3) || !object2(record3.event) || !object2(record3.event.data)) return [];
|
|
12412
12581
|
const message = record3.event.data.message;
|
|
12413
12582
|
if (!object2(message) || message.role !== "assistant" || !Array.isArray(message.content)) return [];
|
|
12414
|
-
if (!object2(message.source) || message.source.
|
|
12583
|
+
if (!object2(message.source) || !isSalesFlash(message.source.provider, message.source.model)) throw new Error("\u672C\u6B21\u56DE\u590D\u6CA1\u6709\u4F7F\u7528\u5DF2\u56FA\u5B9A\u7684Flash\uFF0C\u6682\u672A\u91C7\u7528\uFF1B\u8BF7\u68C0\u67E5\u4E07\u673A\u5927\u8111\u5F53\u524D\u6A21\u578B\u3002");
|
|
12415
12584
|
const text5 = message.content.filter((c) => object2(c) && c.type === "text" && typeof c.text === "string").map((c) => c.text).join("\n");
|
|
12416
12585
|
return text5.trim() ? [text5] : [];
|
|
12417
12586
|
});
|
|
@@ -12432,18 +12601,78 @@ async function generateReply(rpc, workspaceId, contact, latest, signal, options
|
|
|
12432
12601
|
observer?.stop();
|
|
12433
12602
|
}
|
|
12434
12603
|
};
|
|
12604
|
+
const openTurn = async (title, requireSkill = false) => {
|
|
12605
|
+
if (!rpc.draftModel) {
|
|
12606
|
+
const sessionId = await createSession(title);
|
|
12607
|
+
if (requireSkill) {
|
|
12608
|
+
const skills = await call("skills/list", { sessionId });
|
|
12609
|
+
if (!Array.isArray(skills.skills) || !skills.skills.some((s) => object2(s) && s.name === "wanji-sales-assistant")) {
|
|
12610
|
+
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");
|
|
12611
|
+
}
|
|
12612
|
+
}
|
|
12613
|
+
return (prompt, writer = false) => turn(sessionId, prompt, writer);
|
|
12614
|
+
}
|
|
12615
|
+
const history = [];
|
|
12616
|
+
return async (prompt, writer = false) => {
|
|
12617
|
+
modelSignal.throwIfAborted();
|
|
12618
|
+
const requestId = crypto.randomUUID();
|
|
12619
|
+
const preview = writer && !!options.onProgress;
|
|
12620
|
+
const stopped = new AbortController();
|
|
12621
|
+
const previewSignal = AbortSignal.any([modelSignal, stopped.signal]);
|
|
12622
|
+
const submitted = performance.now();
|
|
12623
|
+
let lastPreview = "";
|
|
12624
|
+
const show = (value) => {
|
|
12625
|
+
if (typeof value.firstTokenMs === "number") {
|
|
12626
|
+
timings.writerFirstTokenMs ??= value.firstTokenMs;
|
|
12627
|
+
timings.firstTokenMs ??= submitted - started + value.firstTokenMs;
|
|
12628
|
+
}
|
|
12629
|
+
if (typeof value.text === "string" && value.text !== lastPreview) {
|
|
12630
|
+
lastPreview = value.text;
|
|
12631
|
+
progress("writing", lastPreview);
|
|
12632
|
+
}
|
|
12633
|
+
};
|
|
12634
|
+
const payload = { workspaceId, requestId };
|
|
12635
|
+
let previewTimer;
|
|
12636
|
+
const pollPreview = async () => {
|
|
12637
|
+
if (stopped.signal.aborted || modelSignal.aborted) return;
|
|
12638
|
+
try {
|
|
12639
|
+
const result = await invoke("/api", GENERATION_MODEL_ENDPOINT, { ...payload, operation: "preview" }, previewSignal);
|
|
12640
|
+
if (stopped.signal.aborted || modelSignal.aborted) return;
|
|
12641
|
+
if (object2(result) && result.ok === true && object2(result.value)) show(result.value);
|
|
12642
|
+
previewTimer = setTimeout(() => void pollPreview(), 250);
|
|
12643
|
+
} catch {
|
|
12644
|
+
}
|
|
12645
|
+
};
|
|
12646
|
+
if (preview) previewTimer = setTimeout(() => void pollPreview(), 250);
|
|
12647
|
+
try {
|
|
12648
|
+
const result = await invoke("/api", GENERATION_MODEL_ENDPOINT, { ...payload, operation: "run", prompt, history, preview }, modelSignal);
|
|
12649
|
+
modelSignal.throwIfAborted();
|
|
12650
|
+
if (!object2(result) || result.ok !== true || !object2(result.value) || typeof result.value.text !== "string" || !result.value.text.trim() || result.value.text.length > 64e3) {
|
|
12651
|
+
const code2 = object2(result) && object2(result.error) ? result.error.code : void 0;
|
|
12652
|
+
throw Error(generationFailure(code2) ?? "\u672A\u53D6\u5F97\u6709\u6548\u7684\u9500\u552E\u56DE\u590D\uFF0C\u8BF7\u91CD\u8BD5\u3002");
|
|
12653
|
+
}
|
|
12654
|
+
if (preview) show({ firstTokenMs: result.value.firstTokenMs, text: wechatPreview(result.value.text) });
|
|
12655
|
+
history.push({ prompt, text: result.value.text });
|
|
12656
|
+
return result.value.text;
|
|
12657
|
+
} catch (error) {
|
|
12658
|
+
if (preview) show({ text: "" });
|
|
12659
|
+
throw error;
|
|
12660
|
+
} finally {
|
|
12661
|
+
stopped.abort();
|
|
12662
|
+
clearTimeout(previewTimer);
|
|
12663
|
+
}
|
|
12664
|
+
};
|
|
12665
|
+
};
|
|
12435
12666
|
try {
|
|
12436
12667
|
const selectMaterial = () => selectReplyMaterial(
|
|
12437
12668
|
rpc,
|
|
12438
12669
|
materialQuery,
|
|
12439
|
-
async (prompt) =>
|
|
12670
|
+
async (prompt) => (await openTurn("\u9500\u552E\u7D20\u6750\u5339\u914D\uFF5C" + contact.name))(prompt),
|
|
12440
12671
|
signal,
|
|
12441
12672
|
allowMaterialResend(latest) ? [] : sentMaterialUrls(buildTurnPacket(contact, latest))
|
|
12442
12673
|
);
|
|
12443
12674
|
if (knowledge.catalogMaterialsAvailable && contact.replyMode !== "source-bound" && materialOnly) return materialOnlyReply(await selectMaterial());
|
|
12444
|
-
const
|
|
12445
|
-
const skills = await call("skills/list", { sessionId });
|
|
12446
|
-
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");
|
|
12675
|
+
const replyTurn = await openTurn("\u9500\u552E\u56DE\u590D\uFF5C" + contact.name, true);
|
|
12447
12676
|
const bound = contact.replyMode === "source-bound" ? buildSourceContext(contact, latest) : void 0;
|
|
12448
12677
|
const catalogMaterial = knowledge.catalogMaterialsAvailable && !bound && !isExplicitStop(latest) && (explicitMaterial || isMaterialReferenceQuestion(latest)) ? await selectMaterial() : void 0;
|
|
12449
12678
|
if (bound && contact.replyMode === "source-bound") {
|
|
@@ -12451,7 +12680,7 @@ async function generateReply(rpc, workspaceId, contact, latest, signal, options
|
|
|
12451
12680
|
let feedback = "", planned;
|
|
12452
12681
|
let rendered;
|
|
12453
12682
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
12454
|
-
const text4 = await
|
|
12683
|
+
const text4 = await replyTurn(sourcePlanPrompt(contact, latest, bound, knowledge) + feedback);
|
|
12455
12684
|
try {
|
|
12456
12685
|
planned = parseSourcePlan(text4);
|
|
12457
12686
|
assertSourceSelection(bound, planned);
|
|
@@ -12483,7 +12712,7 @@ async function generateReply(rpc, workspaceId, contact, latest, signal, options
|
|
|
12483
12712
|
let plan, recoveredPlan, planFeedback = "";
|
|
12484
12713
|
progress("planning");
|
|
12485
12714
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
12486
|
-
const text4 = await
|
|
12715
|
+
const text4 = await replyTurn(buildTurnPlanPrompt(contact, latest, knowledge.contextId, packet) + planFeedback);
|
|
12487
12716
|
try {
|
|
12488
12717
|
plan = parseTurnPlan(text4, contact, latest, packet);
|
|
12489
12718
|
break;
|
|
@@ -12523,9 +12752,9 @@ async function generateReply(rpc, workspaceId, contact, latest, signal, options
|
|
|
12523
12752
|
},
|
|
12524
12753
|
async revise(draft, issues) {
|
|
12525
12754
|
progress("writing", "");
|
|
12526
|
-
const
|
|
12755
|
+
const rewrite = await openTurn("\u9500\u552E\u5C40\u90E8\u6539\u7A3F\uFF5C" + contact.name), prompt = buildDraftEditPrompt(packet, plan, draft, issues);
|
|
12527
12756
|
for (let n = 0; n < 2; n++) {
|
|
12528
|
-
const result = await
|
|
12757
|
+
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" : ""));
|
|
12529
12758
|
try {
|
|
12530
12759
|
return applyDraftEdits(draft, result);
|
|
12531
12760
|
} catch (error) {
|
|
@@ -12536,22 +12765,22 @@ async function generateReply(rpc, workspaceId, contact, latest, signal, options
|
|
|
12536
12765
|
},
|
|
12537
12766
|
async generate(prompt) {
|
|
12538
12767
|
progress("writing", "");
|
|
12539
|
-
const writer = firstDraft ?
|
|
12768
|
+
const writer = firstDraft ? replyTurn : await openTurn("\u9500\u552E\u6539\u7A3F\uFF5C" + contact.name);
|
|
12540
12769
|
firstDraft = false;
|
|
12541
|
-
return
|
|
12770
|
+
return writer(prompt, true);
|
|
12542
12771
|
},
|
|
12543
12772
|
async review(kind, draft) {
|
|
12544
12773
|
progress("reviewing");
|
|
12545
|
-
const own2 = await
|
|
12774
|
+
const own2 = await openTurn((kind === "facts" ? "\u9500\u552E\u4E8B\u5B9E\u6838\u5BF9\uFF5C" : "\u9500\u552E\u63A5\u8BDD\u6838\u5BF9\uFF5C") + contact.name);
|
|
12546
12775
|
const prompt = kind === "facts" ? buildFactProofPrompt(packet, draft, true) : buildConversationReviewPrompt(contact, latest, draft, packet, plan, true);
|
|
12547
12776
|
if (kind !== "facts") {
|
|
12548
|
-
return reviewTurn(
|
|
12777
|
+
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);
|
|
12549
12778
|
}
|
|
12550
|
-
const proof = await reviewTurn(
|
|
12779
|
+
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);
|
|
12551
12780
|
if (proof.issues.length) return proof.issues;
|
|
12552
|
-
const verifier = await
|
|
12781
|
+
const verifier = await openTurn("\u9500\u552E\u8BC1\u636E\u590D\u6838\uFF5C" + contact.name);
|
|
12553
12782
|
const verificationPrompt = buildEntailmentPrompt(proof.claims, latest, packet.selection_rule, packet);
|
|
12554
|
-
return reviewTurn(
|
|
12783
|
+
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);
|
|
12555
12784
|
},
|
|
12556
12785
|
validate(value) {
|
|
12557
12786
|
const delivery = bindDeliveryToAction(plan.action ?? "answer", value);
|
|
@@ -12597,6 +12826,7 @@ async function generateReply(rpc, workspaceId, contact, latest, signal, options
|
|
|
12597
12826
|
}
|
|
12598
12827
|
return includeReplyMaterial({ ...reply, next_step: nextStep, progress: plan.progress ? advanceDialogueTasks(plan.progress, packet, plan.action ?? "answer") : void 0, knowledge, timings }, material);
|
|
12599
12828
|
} finally {
|
|
12829
|
+
modelLifetime?.abort();
|
|
12600
12830
|
if (generationLease) try {
|
|
12601
12831
|
await invoke("/api", "wanji-sales-generation/session", { operation: "release", workspaceId, leaseId: generationLease, background: true }, AbortSignal.timeout(1e4));
|
|
12602
12832
|
} catch {
|
|
@@ -12614,8 +12844,7 @@ async function generateReply(rpc, workspaceId, contact, latest, signal, options
|
|
|
12614
12844
|
var PANEL_ID = "wanji-sales.workspace";
|
|
12615
12845
|
var NS = "wanji-sales";
|
|
12616
12846
|
function createGenerationTransport(ctx) {
|
|
12617
|
-
|
|
12618
|
-
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) } : {} };
|
|
12847
|
+
return { draftModel: true, call: (channel, endpoint, payload, signal) => ctx.connection.rpc.call(channel, endpoint, payload, signal) };
|
|
12619
12848
|
}
|
|
12620
12849
|
function selectSalesWorkspace(items, connectedWorkspaceId) {
|
|
12621
12850
|
return items.find((w) => w.workspaceId === connectedWorkspaceId)?.workspaceId ?? items[0]?.workspaceId ?? "";
|
|
@@ -12825,7 +13054,7 @@ function mountSales(ctx, Page, Icon) {
|
|
|
12825
13054
|
return source?.autoDraftMessageId === auto?.job.messageId && source?.version === auto?.job.version;
|
|
12826
13055
|
};
|
|
12827
13056
|
const question = (contact.wechat ? contact.messages.filter((m) => m.direction === "in").at(-1)?.text : state.latest[id])?.trim();
|
|
12828
|
-
const trace =
|
|
13057
|
+
const trace = question && contact.wechat?.latestInbound?.hasText !== false ? { workspaceId, contactId: id, requestId, question: question.slice(0, 8e3), startedAt: Date.now() } : void 0;
|
|
12829
13058
|
const observe = (params) => ctx.connection.rpc.call("/api", "wanji-sales-observation/question", { ...trace, ...params }, AbortSignal.timeout(5e3));
|
|
12830
13059
|
const capture = trace ? observe({ operation: "begin" }).catch(() => {
|
|
12831
13060
|
}) : void 0;
|
|
@@ -13054,6 +13283,7 @@ var mediaStyles = `
|
|
|
13054
13283
|
.ws-voice-menu button:hover,.ws-voice-menu button:focus-visible{background:var(--ws-soft)}
|
|
13055
13284
|
.ws-voice-menu button[aria-disabled=true]{color:var(--ws-muted)}
|
|
13056
13285
|
.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}
|
|
13286
|
+
.ws-out .ws-voice-button,.ws-out .ws-voice-transcript{margin-inline-start:auto}
|
|
13057
13287
|
.ws-voice-error{display:block;max-width:240px;margin-top:5px;font-size:11px;color:var(--ws-muted)}
|
|
13058
13288
|
@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))}}
|
|
13059
13289
|
`;
|
|
@@ -13360,7 +13590,7 @@ function SalesPage({ t, useSales, useWorkspaces, dispatch, generate, loadConvers
|
|
|
13360
13590
|
const syncProgress = presentation.blocked || view.status?.phase === "authorizing" ? void 0 : view.status?.progress;
|
|
13361
13591
|
const syncPercent = wechatProgressPercent({ progress: syncProgress });
|
|
13362
13592
|
const syncLabel = view.error ? "wxProgressUnavailable" : view.status?.phase === "error" ? "wxProgressFailed" : view.status?.phase === "paused" ? "wxPaused" : syncActive ? "wxIncremental" : "wxRoundComplete";
|
|
13363
|
-
return /* @__PURE__ */ import_react12.default.createElement("section", { className: "ws-page", "aria-label": t("title") }, /* @__PURE__ */ import_react12.default.createElement("style", null, styles + updateStyles + companyIdentityStyles), /* @__PURE__ */ import_react12.default.createElement("header", { className: "ws-header" }, /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-heading" }, /* @__PURE__ */ import_react12.default.createElement("span", { className: "ws-brand" }, /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: "chat", size: 22 })), /* @__PURE__ */ import_react12.default.createElement("div", null, /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-title-line" }, /* @__PURE__ */ import_react12.default.createElement("h1", null, t("title")), /* @__PURE__ */ import_react12.default.createElement("span", { className: "ws-demo-label" }, t("wxConnected"))), /* @__PURE__ */ import_react12.default.createElement("p", null, t("subtitle")))), (companyIdentityRpc || updater && update) && /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-header-actions" }, companyIdentityRpc && /* @__PURE__ */ import_react12.default.createElement(CompanyIdentityPanel, { rpc: companyIdentityRpc, t, disabled: frozen }), updater && update && /* @__PURE__ */ import_react12.default.createElement(UpdatePanel, { client: updater, view: update, t }))), frozen && /* @__PURE__ */ import_react12.default.createElement("p", { role: "status", className: "ws-update-freeze" }, t("updateFreeze")), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-inline-sync" }, wechat && /* @__PURE__ */ import_react12.default.createElement(SyncPanel, { client: wechat, t, view, workspaceId: selectedWorkspace }), !contact.id && workspaceState.error && /* @__PURE__ */ import_react12.default.createElement("span", { role: "status" }, workspaceState.error)), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-body", "data-empty": !contact.id, "data-show-chat": showChat, "data-profile": profileVisibility }, /* @__PURE__ */ import_react12.default.createElement("aside", { className: "ws-contacts", "aria-label": t("customers") }, /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-contacts-head" }, /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-intent-sortline" }, /* @__PURE__ */ import_react12.default.createElement("h2", null, t("customers")), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-intent-sort-control" }, /* @__PURE__ */ import_react12.default.createElement("select", { className: "ws-intent-sort", "aria-label": t("intentSort"), value: sort, onChange: (event) => setSort(event.currentTarget.value === "intent" ? "intent" : "recent") }, /* @__PURE__ */ import_react12.default.createElement("option", { value: "recent" }, t("intentSortRecent")), /* @__PURE__ */ import_react12.default.createElement("option", { value: "intent" }, t("intentSortHigh"))), /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: "chevron", size: 12 }))), /* @__PURE__ */ import_react12.default.createElement("label", { className: "ws-search" }, /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: "search", size: 15 }), /* @__PURE__ */ import_react12.default.createElement("input", { name: "sales-search", autoComplete: "off", "aria-label": t("search"), placeholder: t("search"), value: query, onChange: (e) => setQuery(e.target.value) })), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-filters", role: "group", "aria-label": t("customers") }, ["all", "pending", "handled"].map((value) => /* @__PURE__ */ import_react12.default.createElement("button", { key: value, type: "button", "aria-pressed": filter === value, onClick: () => setFilter(value) }, t(value), /* @__PURE__ */ import_react12.default.createElement("span", null, value === "all" ? state.contacts.length : value === "pending" ? pending : state.contacts.length - pending))))), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-contact-list" }, contacts.map((c) => /* @__PURE__ */ import_react12.default.createElement("button", { key: c.id, className: `ws-contact ${c.id === contact.id ? "is-selected" : ""}`, "aria-pressed": c.id === contact.id, onClick: () => select(c.id) }, /* @__PURE__ */ import_react12.default.createElement(WechatAvatar, { client: wechat, scope: JSON.stringify([selectedWorkspace, c.wechat?.accountId]), owner: c.wechat?.chatKey ?? c.id, mediaId: c.wechat?.avatarId, fallback: c.initials }), /* @__PURE__ */ import_react12.default.createElement("span", { className: "ws-contact-content" }, /* @__PURE__ */ import_react12.default.createElement("span", { className: "ws-contact-line" }, /* @__PURE__ */ import_react12.default.createElement("strong", { title: c.name }, c.name), /* @__PURE__ */ import_react12.default.createElement("time", { dateTime: c.time, title: c.time }, displayTime(c.time))), /* @__PURE__ */ import_react12.default.createElement("span", { className: "ws-preview" }, c.wechat && c.preview === "[image]" ? t("wxImageListPreview") : c.preview), c.wechat && /* @__PURE__ */ import_react12.default.createElement(IntentBadge, { intent: c.intent, t })))), !contacts.length && /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-empty" }, /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: "search", size: 26 }), /* @__PURE__ */ import_react12.default.createElement("p", null, t(state.contacts.length ? "noResults" : presentation.emptyKey)), state.contacts.length > 0 && /* @__PURE__ */ import_react12.default.createElement("button", { className: "ws-text-button", onClick: () => {
|
|
13593
|
+
return /* @__PURE__ */ import_react12.default.createElement("section", { className: "ws-page", "aria-label": t("title") }, /* @__PURE__ */ import_react12.default.createElement("style", null, styles + updateStyles + companyIdentityStyles), /* @__PURE__ */ import_react12.default.createElement("header", { className: "ws-header" }, /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-heading" }, /* @__PURE__ */ import_react12.default.createElement("span", { className: "ws-brand" }, /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: "chat", size: 22 })), /* @__PURE__ */ import_react12.default.createElement("div", null, /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-title-line" }, /* @__PURE__ */ import_react12.default.createElement("h1", null, t("title")), /* @__PURE__ */ import_react12.default.createElement("span", { className: "ws-demo-label" }, t("wxConnected"))), /* @__PURE__ */ import_react12.default.createElement("p", null, t("subtitle")))), (companyIdentityRpc || updater && update) && /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-header-actions" }, companyIdentityRpc && /* @__PURE__ */ import_react12.default.createElement(CompanyIdentityPanel, { rpc: companyIdentityRpc, t, disabled: frozen }), updater && update && /* @__PURE__ */ import_react12.default.createElement(UpdatePanel, { client: updater, view: update, t }))), frozen && /* @__PURE__ */ import_react12.default.createElement("p", { role: "status", className: "ws-update-freeze" }, t(update?.reconnecting ? "updateReconnect" : update?.phase === "installing" ? "updateFreezeInstalling" : update?.phase === "verifying" ? "updateFreezeVerifying" : "updateFreeze")), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-inline-sync" }, wechat && /* @__PURE__ */ import_react12.default.createElement(SyncPanel, { client: wechat, t, view, workspaceId: selectedWorkspace }), !contact.id && workspaceState.error && /* @__PURE__ */ import_react12.default.createElement("span", { role: "status" }, workspaceState.error)), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-body", "data-empty": !contact.id, "data-show-chat": showChat, "data-profile": profileVisibility }, /* @__PURE__ */ import_react12.default.createElement("aside", { className: "ws-contacts", "aria-label": t("customers") }, /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-contacts-head" }, /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-intent-sortline" }, /* @__PURE__ */ import_react12.default.createElement("h2", null, t("customers")), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-intent-sort-control" }, /* @__PURE__ */ import_react12.default.createElement("select", { className: "ws-intent-sort", "aria-label": t("intentSort"), value: sort, onChange: (event) => setSort(event.currentTarget.value === "intent" ? "intent" : "recent") }, /* @__PURE__ */ import_react12.default.createElement("option", { value: "recent" }, t("intentSortRecent")), /* @__PURE__ */ import_react12.default.createElement("option", { value: "intent" }, t("intentSortHigh"))), /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: "chevron", size: 12 }))), /* @__PURE__ */ import_react12.default.createElement("label", { className: "ws-search" }, /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: "search", size: 15 }), /* @__PURE__ */ import_react12.default.createElement("input", { name: "sales-search", autoComplete: "off", "aria-label": t("search"), placeholder: t("search"), value: query, onChange: (e) => setQuery(e.target.value) })), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-filters", role: "group", "aria-label": t("customers") }, ["all", "pending", "handled"].map((value) => /* @__PURE__ */ import_react12.default.createElement("button", { key: value, type: "button", "aria-pressed": filter === value, onClick: () => setFilter(value) }, t(value), /* @__PURE__ */ import_react12.default.createElement("span", null, value === "all" ? state.contacts.length : value === "pending" ? pending : state.contacts.length - pending))))), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-contact-list" }, contacts.map((c) => /* @__PURE__ */ import_react12.default.createElement("button", { key: c.id, className: `ws-contact ${c.id === contact.id ? "is-selected" : ""}`, "aria-pressed": c.id === contact.id, onClick: () => select(c.id) }, /* @__PURE__ */ import_react12.default.createElement(WechatAvatar, { client: wechat, scope: JSON.stringify([selectedWorkspace, c.wechat?.accountId]), owner: c.wechat?.chatKey ?? c.id, mediaId: c.wechat?.avatarId, fallback: c.initials }), /* @__PURE__ */ import_react12.default.createElement("span", { className: "ws-contact-content" }, /* @__PURE__ */ import_react12.default.createElement("span", { className: "ws-contact-line" }, /* @__PURE__ */ import_react12.default.createElement("strong", { title: c.name }, c.name), /* @__PURE__ */ import_react12.default.createElement("time", { dateTime: c.time, title: c.time }, displayTime(c.time))), /* @__PURE__ */ import_react12.default.createElement("span", { className: "ws-preview" }, c.wechat && c.preview === "[image]" ? t("wxImageListPreview") : c.preview), c.wechat && /* @__PURE__ */ import_react12.default.createElement(IntentBadge, { intent: c.intent, t })))), !contacts.length && /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-empty" }, /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: "search", size: 26 }), /* @__PURE__ */ import_react12.default.createElement("p", null, t(state.contacts.length ? "noResults" : presentation.emptyKey)), state.contacts.length > 0 && /* @__PURE__ */ import_react12.default.createElement("button", { className: "ws-text-button", onClick: () => {
|
|
13364
13594
|
setQuery("");
|
|
13365
13595
|
setFilter("all");
|
|
13366
13596
|
} }, t("clearSearch")))), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-sync" }, state.contacts.length > 0 ? /* @__PURE__ */ import_react12.default.createElement(SyncFooter, { view, t }) : /* @__PURE__ */ import_react12.default.createElement("span", null, /* @__PURE__ */ import_react12.default.createElement("span", { className: "ws-dot" }), t("wxLocalHistory")))), /* @__PURE__ */ import_react12.default.createElement("main", { className: "ws-conversation" }, !contact.id ? /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-conversation-empty" }, /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: "chat", size: 34 }), /* @__PURE__ */ import_react12.default.createElement("h2", null, t("wxRealTitle")), /* @__PURE__ */ import_react12.default.createElement("p", null, syncActive || syncPercent !== void 0 ? /* @__PURE__ */ import_react12.default.createElement(SyncActivity, { active: syncActive, percent: syncPercent }, t(syncActive ? "wxSyncingHint" : syncLabel)) : t(presentation.blocked ? "wxAwaitConnectionHistory" : presentation.hintKey ?? "wxSelectChat")), (syncActive || syncPercent !== void 0) && /* @__PURE__ */ import_react12.default.createElement(SyncProgressTrack, { progress: syncProgress, active: syncActive, t })) : /* @__PURE__ */ import_react12.default.createElement(import_react12.default.Fragment, null, /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-conversation-head" }, /* @__PURE__ */ import_react12.default.createElement("button", { className: "ws-icon-button ws-mobile-back", "aria-label": t("contactsBack"), onClick: () => setShowChat(false) }, /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: "arrow" })), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-person-title" }, /* @__PURE__ */ import_react12.default.createElement("h2", null, contact.name, !contact.wechat && /* @__PURE__ */ import_react12.default.createElement("span", null, contact.segment)), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-person-meta" }, /* @__PURE__ */ import_react12.default.createElement("span", { className: "ws-person-source" }, /* @__PURE__ */ import_react12.default.createElement("span", { className: "ws-dot", "aria-hidden": "true" }), t("wechat"), /* @__PURE__ */ import_react12.default.createElement("span", { className: "ws-separator", "aria-hidden": "true" }, "/"), contact.wechat ? contact.crm ? t("wxBound") : t("wxUnbound") : t("sampleContact")), contact.wechat && /* @__PURE__ */ import_react12.default.createElement(IntentDetails, { key: contact.id, intent: contact.intent, t }))), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-conversation-actions" }, /* @__PURE__ */ import_react12.default.createElement("button", { className: "ws-button ws-handle", disabled: frozen || contact.status === "handled", onClick: () => {
|
|
@@ -13383,7 +13613,7 @@ function SalesPage({ t, useSales, useWorkspaces, dispatch, generate, loadConvers
|
|
|
13383
13613
|
void copy();
|
|
13384
13614
|
} }, /* @__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"))))));
|
|
13385
13615
|
}
|
|
13386
|
-
var inject = ["slots", "layout", "locale", "connection"
|
|
13616
|
+
var inject = ["slots", "layout", "locale", "connection"];
|
|
13387
13617
|
function apply(ctx) {
|
|
13388
13618
|
mountSales(ctx, SalesPage, SalesIcon);
|
|
13389
13619
|
}
|