@eum-agent/system-notifications 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +5 -2
- package/package.json +2 -2
- package/ui/ui.js +25 -11
package/dist/index.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import { dirname } from "node:path";
|
|
1
2
|
import { existsSync } from "node:fs";
|
|
2
3
|
import { fileURLToPath } from "node:url";
|
|
3
4
|
//#region src/index.ts
|
|
4
|
-
/** Owns this optional client feature and its browser activation. */
|
|
5
5
|
const plugin = {
|
|
6
6
|
name: "@eum-agent/system-notifications",
|
|
7
7
|
apply(ctx) {
|
|
8
8
|
const module = fileURLToPath(new URL("../ui/ui.js", import.meta.url));
|
|
9
|
-
if (existsSync(module)) ctx.client.
|
|
9
|
+
if (existsSync(module)) ctx.client.registerPackageFiles({
|
|
10
|
+
root: dirname(module),
|
|
11
|
+
entry: "ui.js"
|
|
12
|
+
});
|
|
10
13
|
}
|
|
11
14
|
};
|
|
12
15
|
//#endregion
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"en-US": "System Notifications",
|
|
5
5
|
"zh-CN": "系统通知"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.
|
|
7
|
+
"version": "1.2.0",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"description": "System reminders for completed tasks and pending requests",
|
|
10
10
|
"license": "MIT",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"i18next": "^26.4.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@eum-agent/plugin": "1.
|
|
25
|
+
"@eum-agent/plugin": "1.2.0",
|
|
26
26
|
"@types/react": "^19.2.18",
|
|
27
27
|
"@types/react-dom": "^19.2.5",
|
|
28
28
|
"react": "^19.2.0",
|
package/ui/ui.js
CHANGED
|
@@ -78,6 +78,7 @@ var en_US_default = {
|
|
|
78
78
|
"turnCompleted": "Turn completed",
|
|
79
79
|
"turnFailed": "Turn failed",
|
|
80
80
|
"turnInterrupted": "Turn interrupted",
|
|
81
|
+
"turnStopped": "Turn stopped",
|
|
81
82
|
"subprocessEnded": "Process ended",
|
|
82
83
|
"subprocessFailed": "Process failed",
|
|
83
84
|
"participantJoined": "Participant joined",
|
|
@@ -100,7 +101,8 @@ var en_US_default = {
|
|
|
100
101
|
"outcome": {
|
|
101
102
|
"completed": "Session completed",
|
|
102
103
|
"failed": "Session failed",
|
|
103
|
-
"interrupted": "Session stopped"
|
|
104
|
+
"interrupted": "Session stopped",
|
|
105
|
+
"stopped": "Session stopped"
|
|
104
106
|
},
|
|
105
107
|
"label": "Inbox",
|
|
106
108
|
"labelCount": "Inbox, {{count}} to look at",
|
|
@@ -128,6 +130,7 @@ var en_US_default = {
|
|
|
128
130
|
"turnCompleted": "“{{session}}” finished",
|
|
129
131
|
"turnFailed": "“{{session}}” failed",
|
|
130
132
|
"turnInterrupted": "“{{session}}” was interrupted",
|
|
133
|
+
"turnStopped": "“{{session}}” was stopped",
|
|
131
134
|
"processEnded": "Background command ended: {{command}}",
|
|
132
135
|
"processFailed": "Background command failed: {{command}}",
|
|
133
136
|
"generic": "A new message",
|
|
@@ -188,6 +191,7 @@ var zh_CN_default = {
|
|
|
188
191
|
"turnCompleted": "回合完成",
|
|
189
192
|
"turnFailed": "回合失败",
|
|
190
193
|
"turnInterrupted": "回合中断",
|
|
194
|
+
"turnStopped": "回合已停止",
|
|
191
195
|
"subprocessEnded": "进程结束",
|
|
192
196
|
"subprocessFailed": "进程失败",
|
|
193
197
|
"participantJoined": "参与者加入",
|
|
@@ -210,7 +214,8 @@ var zh_CN_default = {
|
|
|
210
214
|
"outcome": {
|
|
211
215
|
"completed": "会话已完成",
|
|
212
216
|
"failed": "会话出错了",
|
|
213
|
-
"interrupted": "会话已停止"
|
|
217
|
+
"interrupted": "会话已停止",
|
|
218
|
+
"stopped": "会话已停止"
|
|
214
219
|
},
|
|
215
220
|
"label": "消息",
|
|
216
221
|
"labelCount": "消息,{{count}} 项待看",
|
|
@@ -237,6 +242,7 @@ var zh_CN_default = {
|
|
|
237
242
|
"turnCompleted": "「{{session}}」已完成",
|
|
238
243
|
"turnFailed": "「{{session}}」出错了",
|
|
239
244
|
"turnInterrupted": "「{{session}}」已中断",
|
|
245
|
+
"turnStopped": "「{{session}}」已停止",
|
|
240
246
|
"processEnded": "后台命令已结束:{{command}}",
|
|
241
247
|
"processFailed": "后台命令失败:{{command}}",
|
|
242
248
|
"generic": "有一条新消息",
|
|
@@ -754,6 +760,7 @@ function category(item) {
|
|
|
754
760
|
case "completed": return platformText("notifications.category.turnCompleted", { defaultValue: "Turn completed" });
|
|
755
761
|
case "failed": return platformText("notifications.category.turnFailed", { defaultValue: "Turn failed" });
|
|
756
762
|
case "interrupted": return platformText("notifications.category.turnInterrupted", { defaultValue: "Turn interrupted" });
|
|
763
|
+
case "stopped": return platformText("notifications.category.turnStopped", { defaultValue: "Turn stopped" });
|
|
757
764
|
}
|
|
758
765
|
break;
|
|
759
766
|
case "subprocess-ended": return detail.ending.kind === "exited" && detail.ending.code === 0 ? platformText("notifications.category.subprocessEnded", { defaultValue: "Process ended" }) : platformText("notifications.category.subprocessFailed", { defaultValue: "Process failed" });
|
|
@@ -799,15 +806,18 @@ function registerInboxNotifications(ctx) {
|
|
|
799
806
|
if (!host) return;
|
|
800
807
|
const epoch = generation;
|
|
801
808
|
const current = () => epoch === generation && !ctx.signal.aborted && useConnection.getState().status === "online" && notificationHost() === host;
|
|
802
|
-
for (const item of items)
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
809
|
+
for (const item of items) {
|
|
810
|
+
if (item.detail.category !== "human-request" && item.detail.category !== "turn-ended") continue;
|
|
811
|
+
(async () => {
|
|
812
|
+
try {
|
|
813
|
+
const state = await host.state();
|
|
814
|
+
if (!current() || !state.enabled || state.permission !== "granted" && state.permission !== "system-managed") return;
|
|
815
|
+
await host.show(notificationSummary(item));
|
|
816
|
+
} catch (error) {
|
|
817
|
+
if (current()) reportNotificationFailure(error, host);
|
|
818
|
+
}
|
|
819
|
+
})();
|
|
820
|
+
}
|
|
811
821
|
});
|
|
812
822
|
return () => {
|
|
813
823
|
generation++;
|
|
@@ -1090,6 +1100,10 @@ function noticeText(item, t, name) {
|
|
|
1090
1100
|
text: t("inbox.turnFailed", { session }),
|
|
1091
1101
|
tone: "failure"
|
|
1092
1102
|
};
|
|
1103
|
+
if (detail.outcome.kind === "stopped") return {
|
|
1104
|
+
text: t("inbox.turnStopped", { session }),
|
|
1105
|
+
tone: "neutral"
|
|
1106
|
+
};
|
|
1093
1107
|
return {
|
|
1094
1108
|
text: t("inbox.turnInterrupted", { session }),
|
|
1095
1109
|
tone: "neutral"
|