@frockbot/plugin-flock 0.3.4 → 0.3.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/package.json +7 -7
- package/src/client/index.ts +20 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frockbot/plugin-flock",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
"typecheck": "vue-tsc --noEmit -p tsconfig.json"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@frockbot/client-core": "0.3.
|
|
31
|
-
"@frockbot/client-ui": "0.3.
|
|
32
|
-
"@frockbot/configuration-core": "0.3.
|
|
33
|
-
"@frockbot/kernel-contracts": "0.3.
|
|
34
|
-
"@frockbot/plugin-shell": "0.3.
|
|
30
|
+
"@frockbot/client-core": "0.3.5",
|
|
31
|
+
"@frockbot/client-ui": "0.3.5",
|
|
32
|
+
"@frockbot/configuration-core": "0.3.5",
|
|
33
|
+
"@frockbot/kernel-contracts": "0.3.5",
|
|
34
|
+
"@frockbot/plugin-shell": "0.3.5",
|
|
35
35
|
"cordis": "4.0.0-rc.8",
|
|
36
36
|
"vue": "3.5.41"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@frockbot/plugin-testkit": "0.3.
|
|
39
|
+
"@frockbot/plugin-testkit": "0.3.5",
|
|
40
40
|
"@types/bun": "1.4.0",
|
|
41
41
|
"@vitejs/plugin-vue": "6.0.8",
|
|
42
42
|
"css-tree": "2.3.1",
|
package/src/client/index.ts
CHANGED
|
@@ -235,6 +235,26 @@ export const flockClientPlugin: ClientPlugin = (ctx) => {
|
|
|
235
235
|
state.value.unread = Object.fromEntries(
|
|
236
236
|
directory.unread.map((view) => [view.botId, view]),
|
|
237
237
|
);
|
|
238
|
+
// A Turn that settles in the conversation the User is looking at has
|
|
239
|
+
// been read by the time it arrives, so the badge that counted it is
|
|
240
|
+
// wrong the instant it appears. Reading up to it is still the explicit
|
|
241
|
+
// authenticated command; what the poll refreshed is only which cursor it
|
|
242
|
+
// names. Every other Bot's badge is left exactly as the fan-out said.
|
|
243
|
+
const openBotId = shell?.value.activeBotId;
|
|
244
|
+
if (
|
|
245
|
+
openBotId &&
|
|
246
|
+
(state.value.unread[openBotId]?.count ?? 0) > 0 &&
|
|
247
|
+
!state.value.unread[openBotId]?.manuallyUnread &&
|
|
248
|
+
typeof document !== "undefined" &&
|
|
249
|
+
document.visibilityState === "visible" &&
|
|
250
|
+
document.hasFocus()
|
|
251
|
+
) {
|
|
252
|
+
try {
|
|
253
|
+
await state.value.markRead(openBotId);
|
|
254
|
+
} catch {
|
|
255
|
+
// The badge stays until the next poll; nothing durable is lost.
|
|
256
|
+
}
|
|
257
|
+
}
|
|
238
258
|
},
|
|
239
259
|
async markRead(botId) {
|
|
240
260
|
const cursor = state.value.unread[botId]?.lastActivityCursor;
|