dsh-client-auto-continue 0.11.2 → 0.11.3
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/lib/index.js +5 -1
- package/lib/types/host/engine.d.ts +1 -1
- package/package.json +1 -1
- package/src/host/engine.ts +11 -2
package/lib/index.js
CHANGED
|
@@ -621,6 +621,7 @@ ${event.data.arguments}`;
|
|
|
621
621
|
this.bumpStat({ skipped: 1, code: failure.code });
|
|
622
622
|
if (config.notify) {
|
|
623
623
|
this.notify(
|
|
624
|
+
sessionId,
|
|
624
625
|
copy.notContinuedTitle,
|
|
625
626
|
copy.permanentErrorBody(sessionId, summary),
|
|
626
627
|
this.notifyOptions(sessionId, config.locale)
|
|
@@ -666,11 +667,12 @@ ${event.data.arguments}`;
|
|
|
666
667
|
}
|
|
667
668
|
}
|
|
668
669
|
/** 通知桥: 产生一条通知事件, SSE 端点推给 browser 侧展示。 */
|
|
669
|
-
notify(title, body, options) {
|
|
670
|
+
notify(sessionId, title, body, options) {
|
|
670
671
|
const notice = {
|
|
671
672
|
id: `${Date.now()}-${Math.random().toString(36).slice(2)}`,
|
|
672
673
|
title,
|
|
673
674
|
body,
|
|
675
|
+
sessionId,
|
|
674
676
|
...options?.actions !== void 0 && options.actions.length > 0 ? { actions: options.actions } : { actions: [] },
|
|
675
677
|
at: Date.now()
|
|
676
678
|
};
|
|
@@ -803,6 +805,7 @@ ${event.data.arguments}`;
|
|
|
803
805
|
if (config.notify) {
|
|
804
806
|
const copy = NOTICE_COPY[config.locale];
|
|
805
807
|
this.notify(
|
|
808
|
+
sessionId,
|
|
806
809
|
copy.continuedTitle,
|
|
807
810
|
copy.continuedBody(sessionId, text, state.consecutive),
|
|
808
811
|
this.notifyOptions(sessionId, config.locale)
|
|
@@ -814,6 +817,7 @@ ${event.data.arguments}`;
|
|
|
814
817
|
if (config.notify) {
|
|
815
818
|
const copy = NOTICE_COPY[config.locale];
|
|
816
819
|
this.notify(
|
|
820
|
+
sessionId,
|
|
817
821
|
copy.stoppedTitle,
|
|
818
822
|
copy.stoppedBody(sessionId, state.consecutive),
|
|
819
823
|
this.notifyOptions(sessionId, config.locale)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-client-auto-continue",
|
|
3
3
|
"description": "DSH Web UI plugin: automatically sends a localized continue prompt when a request is interrupted by network errors or other non-human causes",
|
|
4
|
-
"version": "0.11.
|
|
4
|
+
"version": "0.11.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/types/index.d.ts",
|
package/src/host/engine.ts
CHANGED
|
@@ -79,7 +79,7 @@ export interface HostNotice {
|
|
|
79
79
|
title: string;
|
|
80
80
|
body: string;
|
|
81
81
|
/** 会话 id(通知按钮「立即续跑 / 暂停该会话」作用于它)。 */
|
|
82
|
-
sessionId
|
|
82
|
+
sessionId: SessionId;
|
|
83
83
|
actions: NotifyAction[];
|
|
84
84
|
/** 产生时间。 */
|
|
85
85
|
at: number;
|
|
@@ -505,6 +505,7 @@ export class AutoContinueRunner {
|
|
|
505
505
|
this.bumpStat({ skipped: 1, code: failure.code });
|
|
506
506
|
if (config.notify) {
|
|
507
507
|
this.notify(
|
|
508
|
+
sessionId,
|
|
508
509
|
copy.notContinuedTitle,
|
|
509
510
|
copy.permanentErrorBody(sessionId, summary),
|
|
510
511
|
this.notifyOptions(sessionId, config.locale),
|
|
@@ -563,11 +564,17 @@ export class AutoContinueRunner {
|
|
|
563
564
|
}
|
|
564
565
|
|
|
565
566
|
/** 通知桥: 产生一条通知事件, SSE 端点推给 browser 侧展示。 */
|
|
566
|
-
private notify(
|
|
567
|
+
private notify(
|
|
568
|
+
sessionId: SessionId,
|
|
569
|
+
title: string,
|
|
570
|
+
body: string,
|
|
571
|
+
options?: NotifyOptions,
|
|
572
|
+
): void {
|
|
567
573
|
const notice: HostNotice = {
|
|
568
574
|
id: `${Date.now()}-${Math.random().toString(36).slice(2)}`,
|
|
569
575
|
title,
|
|
570
576
|
body,
|
|
577
|
+
sessionId,
|
|
571
578
|
...(options?.actions !== undefined && options.actions.length > 0
|
|
572
579
|
? { actions: options.actions }
|
|
573
580
|
: { actions: [] }),
|
|
@@ -720,6 +727,7 @@ export class AutoContinueRunner {
|
|
|
720
727
|
if (config.notify) {
|
|
721
728
|
const copy = NOTICE_COPY[config.locale];
|
|
722
729
|
this.notify(
|
|
730
|
+
sessionId,
|
|
723
731
|
copy.continuedTitle,
|
|
724
732
|
copy.continuedBody(sessionId, text, state.consecutive),
|
|
725
733
|
this.notifyOptions(sessionId, config.locale),
|
|
@@ -731,6 +739,7 @@ export class AutoContinueRunner {
|
|
|
731
739
|
if (config.notify) {
|
|
732
740
|
const copy = NOTICE_COPY[config.locale];
|
|
733
741
|
this.notify(
|
|
742
|
+
sessionId,
|
|
734
743
|
copy.stoppedTitle,
|
|
735
744
|
copy.stoppedBody(sessionId, state.consecutive),
|
|
736
745
|
this.notifyOptions(sessionId, config.locale),
|