@lukstei/dsh-client-favicon 0.0.0-stage → 0.2.2-rc.5.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Lukas Steinbrecher
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,107 @@
1
- # Temporary Holding Version
1
+ # @lukstei/dsh-client-favicon
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ ## Summary
4
+
5
+ Draws the browser tab favicon as an eight-tick status ring. Green ticks show running sessions, orange ticks show sessions awaiting review, and a centre pip shows pending interactions. For anyone running several DSH sessions in one tab.
6
+
7
+ ## Table of Contents
8
+
9
+ - [Use this package](#use-this-package)
10
+ - [Understand the implementation](#understand-the-implementation)
11
+ - [Further Exploration](#further-exploration)
12
+ - [Model Experience](#model-experience)
13
+ - [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
14
+ - [Dev Note](#dev-note)
15
+
16
+ -----
17
+
18
+ <a id="use-this-package"></a>
19
+ ## Use this package
20
+
21
+ Mount it in the bundle patch ([cordis.patch.yml](cordis.patch.yml)):
22
+
23
+ ```yaml
24
+ - insert:
25
+ - id: favicon
26
+ name: '@lukstei/dsh-client-favicon'
27
+ ```
28
+
29
+ No config. Client plugin (`platform: web`, `immediately: true`). It needs `sessions` and `uiSession`, from `@deepseek-ai/dsh-api-session-controller` and `@deepseek-ai/dsh-client-ui-session`. It needs no notification or audio permission.
30
+
31
+ | Signal | Source | Rendering |
32
+ |---|---|---|
33
+ | Running | `sessionStatus.running`, else `sessions.list` summary `running` | Green ticks, filled from the bottom |
34
+ | Review | `faviconBadge.setBadge({ reviewCount })` | Orange ticks, filled from the top |
35
+ | Pending interaction | `sessionStatus.pendingInteraction` | Red centre pip |
36
+ | Review overflow | `reviewCount` larger than the free ticks | Orange centre pip (the red pip wins) |
37
+
38
+ - The ring has 8 ticks. Running ticks take priority; review fills the remaining ticks. Counts are not drawn as numbers.
39
+ - Sessions are the union of ids in the session list and the status store, so subagents count.
40
+ - With no running session, no pending interaction and `reviewCount` 0, the original favicon is restored.
41
+ - If the page has `link[rel~='icon']` elements, their `href` is replaced. Otherwise one `<link rel="icon" type="image/svg+xml">` is created. Disposal restores the original hrefs and removes the created link.
42
+
43
+ Other client plugins can inject `faviconBadge` (`IFaviconBadge`, from `@lukstei/dsh-client-favicon/client-contract`) and call `setBadge({ reviewCount })`. Reset it to 0 when the caller unloads. [`@lukstei/dsh-client-kanban`](../dsh-client-kanban/README.md) does this with its review lane count.
44
+
45
+ ### Plugin dependencies
46
+
47
+ Client-side only (`dsh.client`, no host entry). Client `inject`: `sessions`, `uiSession` (all required; the client plugin stays pending without them).
48
+
49
+ | Plugin / service | Required? | Provided by | Effect without it |
50
+ |---|---|---|---|
51
+ | `sessions` | Required | @deepseek-ai/dsh-api-session-controller | Plugin stays pending; never applies. |
52
+ | `uiSession` | Required | @deepseek-ai/dsh-client-ui-session | Plugin stays pending; never applies. |
53
+
54
+ Provides the client service `faviconBadge`.
55
+
56
+ Used by: [`dsh-client-kanban`](../dsh-client-kanban/README.md) (optional `faviconBadge` consumer; its review count only reaches the favicon when this is mounted).
57
+
58
+ -----
59
+
60
+ <a id="understand-the-implementation"></a>
61
+ ## Understand the implementation
62
+
63
+ <details>
64
+ <summary>Implementation internals — click to expand</summary>
65
+
66
+ | File | Role |
67
+ |---|---|
68
+ | [src/index.ts](src/index.ts) | Host entry, a no-op `apply` |
69
+ | [src/client/index.tsx](src/client/index.tsx) | Client entry: subscribes to the session list and status store, swaps favicon hrefs, provides `faviconBadge` |
70
+ | [src/client/favicon.ts](src/client/favicon.ts) | Pure `generateFaviconSvg` / `renderFaviconBadgeUri` (SVG data URI) |
71
+ | [src/client/contract.ts](src/client/contract.ts) | `IFaviconBadge` and the `Context.faviconBadge` augmentation |
72
+
73
+ The renderer takes `{ running, review, alert }`. Tick order is clockwise from north: running fills S, SW, SE, W, E, NW, NE, N; review fills N, NW, NE, W, E, SW, SE, S. Inputs are floored and clamped at 0. It never throws.
74
+
75
+ Persisted state: none. The effect re-renders on every session-list and status-store change.
76
+
77
+ </details>
78
+
79
+ -----
80
+
81
+ <a id="further-exploration"></a>
82
+ ## Further Exploration
83
+
84
+ - Upstream: [DSH module graph](https://github.com/deepseek-ai/deepseek-harness/blob/master/docs/module-graph.md).
85
+ - [`@lukstei/dsh-client-kanban`](../dsh-client-kanban/README.md): supplies the review count.
86
+ - [`@lukstei/dsh-client-notify`](../dsh-client-notify/README.md): app-icon badge and desktop notifications.
87
+
88
+ <a id="model-experience"></a>
89
+ ## Model Experience
90
+
91
+ No model-visible surface. This package adds no tools, prompt text, or context to the model.
92
+
93
+ <a id="known-limitations-and-deferred-work"></a>
94
+ ## Known Limitations and Deferred Work
95
+
96
+ - Browsers differ in whether they show dynamic SVG tab favicons. Mobile launch icons and pinned tabs follow browser-specific behavior.
97
+ - An existing `link[rel~='icon']` is overwritten in place; with several icon links, all get the same SVG.
98
+
99
+ <a id="dev-note"></a>
100
+ ### Dev Note
101
+
102
+ <details>
103
+ <summary>Working context for maintainers — click to expand</summary>
104
+
105
+ `pnpm run verify` runs Biome, build, typecheck and tests ([tests/favicon.spec.ts](tests/favicon.spec.ts) for the renderer, [tests/lifecycle.spec.ts](tests/lifecycle.spec.ts) for restore/dispose).
106
+
107
+ </details>
@@ -0,0 +1,3 @@
1
+ - insert:
2
+ - id: favicon
3
+ name: '@lukstei/dsh-client-favicon'
package/dist/client.js ADDED
@@ -0,0 +1,135 @@
1
+ window.__ModuleLoader__.load({
2
+ id: "@lukstei/dsh-client-favicon",
3
+ factory: (require) => {
4
+ var module = { exports: {} };
5
+ var exports = module.exports;
6
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
+ // src/client/favicon.ts
8
+ const COLOR_INACTIVE = "rgba(128, 128, 128, 0.25)";
9
+ const COLOR_RUNNING = "#00C853";
10
+ const COLOR_REVIEW = "#FF9800";
11
+ const COLOR_ALERT = "#EF4444";
12
+ const COLOR_IDLE_PIP = COLOR_INACTIVE;
13
+ const REVIEW_ORDER = [
14
+ 0,
15
+ 7,
16
+ 1,
17
+ 6,
18
+ 2,
19
+ 5,
20
+ 3,
21
+ 4
22
+ ];
23
+ const RUNNING_ORDER = [
24
+ 4,
25
+ 5,
26
+ 3,
27
+ 6,
28
+ 2,
29
+ 7,
30
+ 1,
31
+ 0
32
+ ];
33
+ function generateFaviconSvg({ running = 0, review = 0, alert = 0 } = {}) {
34
+ const safeRunning = Math.max(0, Math.floor(running));
35
+ const safeReview = Math.max(0, Math.floor(review));
36
+ const safeAlert = Math.max(0, Math.floor(alert));
37
+ const totalTicks = 8;
38
+ const rInner = 3.7;
39
+ const rOuter = 6.6;
40
+ let ticks = "";
41
+ for (let i = 0; i < totalTicks; i++) {
42
+ const rad = (i * 45 - 90) * (Math.PI / 180);
43
+ const x1 = (8 + rInner * Math.cos(rad)).toFixed(2);
44
+ const y1 = (8 + rInner * Math.sin(rad)).toFixed(2);
45
+ const x2 = (8 + rOuter * Math.cos(rad)).toFixed(2);
46
+ const y2 = (8 + rOuter * Math.sin(rad)).toFixed(2);
47
+ let strokeColor = COLOR_INACTIVE;
48
+ if (RUNNING_ORDER.indexOf(i) < safeRunning) strokeColor = COLOR_RUNNING;
49
+ else if (REVIEW_ORDER.indexOf(i) < Math.min(safeReview, totalTicks - safeRunning)) strokeColor = COLOR_REVIEW;
50
+ ticks += `<line x1="${x1}" y1="${y1}" x2="${x2}" y2="${y2}" stroke="${strokeColor}" stroke-width="2.6" stroke-linecap="round" />`;
51
+ }
52
+ const reviewOverflow = safeReview > Math.max(0, totalTicks - safeRunning);
53
+ return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16" shape-rendering="geometricPrecision">${ticks}${safeAlert > 0 ? `<circle cx="8" cy="8" r="2.4" fill="${COLOR_ALERT}" />` : reviewOverflow ? `<circle cx="8" cy="8" r="2.4" fill="${COLOR_REVIEW}" />` : `<circle cx="8" cy="8" r="1.8" fill="${COLOR_IDLE_PIP}" />`}</svg>`;
54
+ }
55
+ /**
56
+ * Purpose: Render an SVG data URI displaying an 8-radial status badge with central alert/overflow pip.
57
+ * Contract:
58
+ * - Inputs: optional FaviconBadgeOptions ({ running, review, alert }).
59
+ * - Outputs: SVG data URI string formatted as data:image/svg+xml,...
60
+ * - Throws / Errors: Never throws.
61
+ */
62
+ function renderFaviconBadgeUri(options = {}) {
63
+ const svg = generateFaviconSvg(options);
64
+ return `data:image/svg+xml,${encodeURIComponent(svg)}`;
65
+ }
66
+ // src/client/index.tsx
67
+ const inject = ["sessions", "uiSession"];
68
+ function apply(ctx) {
69
+ const sessions = ctx.sessions;
70
+ const originals = [...document.querySelectorAll("link[rel~='icon']")].map((link) => ({
71
+ link,
72
+ href: link.getAttribute("href")
73
+ }));
74
+ let created = null;
75
+ let reviewCount = 0;
76
+ const restore = () => {
77
+ for (const { link, href } of originals) if (href === null) link.removeAttribute("href");
78
+ else link.setAttribute("href", href);
79
+ if (created !== null) {
80
+ created.remove();
81
+ created = null;
82
+ }
83
+ };
84
+ const update = () => {
85
+ const list = sessions.list.getSnapshot();
86
+ const statuses = ctx.uiSession.sessionStatus.getSnapshot();
87
+ const ids = /* @__PURE__ */ new Set([...list.ids, ...statuses.keys()]);
88
+ let running = 0;
89
+ let alerts = 0;
90
+ for (const id of ids) {
91
+ const status = statuses.get(id);
92
+ const summary = list.byId[id];
93
+ if (status !== void 0 && status.pendingInteraction !== void 0) alerts++;
94
+ if (status !== void 0 && status.running !== void 0 ? status.running : summary !== void 0 && summary.running) running++;
95
+ }
96
+ if (running === 0 && alerts === 0 && reviewCount === 0) {
97
+ restore();
98
+ return;
99
+ }
100
+ const uri = renderFaviconBadgeUri({
101
+ running,
102
+ review: reviewCount,
103
+ alert: alerts
104
+ });
105
+ if (originals.length > 0) for (const { link } of originals) link.href = uri;
106
+ else {
107
+ if (created === null) {
108
+ created = document.createElement("link");
109
+ created.rel = "icon";
110
+ created.type = "image/svg+xml";
111
+ document.head.appendChild(created);
112
+ }
113
+ created.href = uri;
114
+ }
115
+ };
116
+ ctx.provide("faviconBadge", { setBadge: (badge) => {
117
+ reviewCount = badge.reviewCount;
118
+ update();
119
+ } });
120
+ ctx.effect(() => {
121
+ update();
122
+ const offList = sessions.list.subscribe(update);
123
+ const offStatus = ctx.uiSession.sessionStatus.subscribe(update);
124
+ return () => {
125
+ offList();
126
+ offStatus();
127
+ restore();
128
+ };
129
+ }, "favicon: status badges");
130
+ }
131
+ exports.apply = apply;
132
+ exports.inject = inject;
133
+ return module.exports;
134
+ }
135
+ });
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ // src/index.ts
2
+ const name = "dsh-client-favicon";
3
+ function apply() {}
4
+ export { apply, name };
package/package.json CHANGED
@@ -1,6 +1,77 @@
1
1
  {
2
2
  "name": "@lukstei/dsh-client-favicon",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.2.2-rc.5.3",
4
+ "description": "Browser favicon status badges for DeepSeek Harness",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./src/index.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./src/index.ts",
11
+ "default": "./dist/index.js"
12
+ },
13
+ "./client": "./dist/client.js",
14
+ "./package.json": "./package.json",
15
+ "./client-contract": "./src/client/contract.ts"
16
+ },
17
+ "files": [
18
+ "src",
19
+ "dist",
20
+ "README.md",
21
+ "cordis.patch.yml",
22
+ "!src/**/*.spec.*",
23
+ "!src/**/*.test.*",
24
+ "!src/**/*.stories.*",
25
+ "!src/**/stories",
26
+ "!src/**/*.e2e.*",
27
+ "!src/**/__snapshots__",
28
+ "!src/**/fixtures"
29
+ ],
30
+ "dsh": {
31
+ "bundle": {
32
+ "patch": "./cordis.patch.yml"
33
+ },
34
+ "client": {
35
+ "platform": "web",
36
+ "immediately": true,
37
+ "inject": [
38
+ "@deepseek-ai/dsh-api-session-controller",
39
+ "@deepseek-ai/dsh-client-ui-session"
40
+ ]
41
+ }
42
+ },
43
+ "devDependencies": {
44
+ "@deepseek-ai/cordis": "4.1.0",
45
+ "@deepseek-ai/dsh-api-session-controller": "0.2.2-rc.5",
46
+ "@deepseek-ai/dsh-client-ui-session": "0.2.2-rc.5",
47
+ "@deepseek-ai/dsh-session": "0.2.2-rc.5",
48
+ "@types/node": "^26.0.0",
49
+ "tsdown": "^0.23.0",
50
+ "typescript": "^7.0.2",
51
+ "vitest": "5.0.5"
52
+ },
53
+ "peerDependencies": {
54
+ "@deepseek-ai/cordis": "*",
55
+ "@deepseek-ai/dsh-api-session-controller": "*",
56
+ "@deepseek-ai/dsh-client-ui-session": "*"
57
+ },
58
+ "license": "MIT",
59
+ "repository": {
60
+ "type": "git",
61
+ "url": "git+https://github.com/lukstei/dsh-plugins.git",
62
+ "directory": "packages/dsh-client-favicon"
63
+ },
64
+ "publishConfig": {
65
+ "access": "public"
66
+ },
67
+ "scripts": {
68
+ "build": "tsdown --config tsdown.config.ts --logLevel error",
69
+ "dev": "tsdown --config tsdown.config.ts --watch",
70
+ "check": "biome check --reporter=concise .",
71
+ "typecheck": "tsc --noEmit",
72
+ "test": "vitest run --reporter=minimal",
73
+ "test:watch": "vitest",
74
+ "test:update": "vitest run -u",
75
+ "verify": "pnpm --silent run check && pnpm --silent run build && pnpm --silent run typecheck && pnpm --silent run test"
76
+ }
6
77
  }
@@ -0,0 +1,11 @@
1
+ import type {} from "@deepseek-ai/cordis";
2
+
3
+ export interface IFaviconBadge {
4
+ readonly setBadge: (badge: { readonly reviewCount: number }) => void;
5
+ }
6
+
7
+ declare module "@deepseek-ai/cordis" {
8
+ interface Context {
9
+ faviconBadge: IFaviconBadge;
10
+ }
11
+ }
@@ -0,0 +1,84 @@
1
+ export interface FaviconBadgeOptions {
2
+ /** Active / running processes (rendered in #00C853) */
3
+ readonly running?: number;
4
+ /** Items awaiting review / action (rendered in #FF9800) */
5
+ readonly review?: number;
6
+ /** Critical alerts (activates central red pip #EF4444) */
7
+ readonly alert?: number;
8
+ }
9
+
10
+ const COLOR_INACTIVE = "rgba(128, 128, 128, 0.25)";
11
+ const COLOR_RUNNING = "#00C853";
12
+ const COLOR_REVIEW = "#FF9800";
13
+ const COLOR_ALERT = "#EF4444";
14
+ const COLOR_IDLE_PIP = COLOR_INACTIVE;
15
+
16
+ // Tick indices run clockwise from north (0=N, 1=NE, 2=E, 3=SE, 4=S, 5=SW, 6=W, 7=NW).
17
+ // Review fills from the top (N, NW, NE, ...), running from the bottom (S, SW, SE, ...).
18
+ const REVIEW_ORDER = [0, 7, 1, 6, 2, 5, 3, 4];
19
+ const RUNNING_ORDER = [4, 5, 3, 6, 2, 7, 1, 0];
20
+
21
+ export function generateFaviconSvg({
22
+ running = 0,
23
+ review = 0,
24
+ alert = 0,
25
+ }: FaviconBadgeOptions = {}): string {
26
+ const safeRunning = Math.max(0, Math.floor(running));
27
+ const safeReview = Math.max(0, Math.floor(review));
28
+ const safeAlert = Math.max(0, Math.floor(alert));
29
+
30
+ const totalTicks = 8;
31
+ const rInner = 3.7;
32
+ const rOuter = 6.6;
33
+ let ticks = "";
34
+
35
+ // 8 radial tick capsules at 45-degree intervals forming a uniform circle
36
+ for (let i = 0; i < totalTicks; i++) {
37
+ // Start from top (-90 deg / -0.5*PI) and rotate clockwise
38
+ const rad = (i * 45 - 90) * (Math.PI / 180);
39
+
40
+ // Segment coordinates: r_inner = 3.7, r_outer = 6.6
41
+ const x1 = (8 + rInner * Math.cos(rad)).toFixed(2);
42
+ const y1 = (8 + rInner * Math.sin(rad)).toFixed(2);
43
+ const x2 = (8 + rOuter * Math.cos(rad)).toFixed(2);
44
+ const y2 = (8 + rOuter * Math.sin(rad)).toFixed(2);
45
+
46
+ // Color priority: Running segments -> Review segments -> Inactive
47
+ let strokeColor = COLOR_INACTIVE;
48
+ if (RUNNING_ORDER.indexOf(i) < safeRunning) {
49
+ strokeColor = COLOR_RUNNING;
50
+ } else if (
51
+ REVIEW_ORDER.indexOf(i) < Math.min(safeReview, totalTicks - safeRunning)
52
+ ) {
53
+ strokeColor = COLOR_REVIEW;
54
+ }
55
+
56
+ ticks += `<line x1="${x1}" y1="${y1}" x2="${x2}" y2="${y2}" stroke="${strokeColor}" stroke-width="2.6" stroke-linecap="round" />`;
57
+ }
58
+
59
+ const reviewOverflow = safeReview > Math.max(0, totalTicks - safeRunning);
60
+
61
+ // Central pip: prominent alert pip, prominent review overflow pip, or subtle idle core
62
+ const centerPip =
63
+ safeAlert > 0
64
+ ? `<circle cx="8" cy="8" r="2.4" fill="${COLOR_ALERT}" />`
65
+ : reviewOverflow
66
+ ? `<circle cx="8" cy="8" r="2.4" fill="${COLOR_REVIEW}" />`
67
+ : `<circle cx="8" cy="8" r="1.8" fill="${COLOR_IDLE_PIP}" />`;
68
+
69
+ return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16" shape-rendering="geometricPrecision">${ticks}${centerPip}</svg>`;
70
+ }
71
+
72
+ /**
73
+ * Purpose: Render an SVG data URI displaying an 8-radial status badge with central alert/overflow pip.
74
+ * Contract:
75
+ * - Inputs: optional FaviconBadgeOptions ({ running, review, alert }).
76
+ * - Outputs: SVG data URI string formatted as data:image/svg+xml,...
77
+ * - Throws / Errors: Never throws.
78
+ */
79
+ export function renderFaviconBadgeUri(
80
+ options: FaviconBadgeOptions = {},
81
+ ): string {
82
+ const svg = generateFaviconSvg(options);
83
+ return `data:image/svg+xml,${encodeURIComponent(svg)}`;
84
+ }
@@ -0,0 +1,84 @@
1
+ import type { Context } from "@deepseek-ai/cordis";
2
+ import type { ISessions } from "@deepseek-ai/dsh-api-session-controller/client";
3
+ import type {} from "@deepseek-ai/dsh-client-ui-session/client";
4
+ import type {} from "./contract.ts";
5
+ import { renderFaviconBadgeUri } from "./favicon.ts";
6
+
7
+ export const inject = ["sessions", "uiSession"] as const;
8
+
9
+ export function apply(ctx: Context): void {
10
+ // edge case: shared Context merges host and client session services.
11
+ const sessions = ctx.sessions as unknown as ISessions;
12
+ const originals = [
13
+ ...document.querySelectorAll<HTMLLinkElement>("link[rel~='icon']"),
14
+ ].map((link) => ({
15
+ link,
16
+ href: link.getAttribute("href"),
17
+ }));
18
+ let created: HTMLLinkElement | null = null;
19
+ let reviewCount = 0;
20
+ const restore = () => {
21
+ for (const { link, href } of originals) {
22
+ if (href === null) link.removeAttribute("href");
23
+ else link.setAttribute("href", href);
24
+ }
25
+ if (created !== null) {
26
+ created.remove();
27
+ created = null;
28
+ }
29
+ };
30
+ const update = () => {
31
+ const list = sessions.list.getSnapshot();
32
+ const statuses = ctx.uiSession.sessionStatus.getSnapshot();
33
+ const ids = new Set([...list.ids, ...statuses.keys()]);
34
+ let running = 0;
35
+ let alerts = 0;
36
+ for (const id of ids) {
37
+ const status = statuses.get(id);
38
+ const summary = list.byId[id];
39
+ if (status !== undefined && status.pendingInteraction !== undefined)
40
+ alerts++;
41
+ const isRunning =
42
+ status !== undefined && status.running !== undefined
43
+ ? status.running
44
+ : summary !== undefined && summary.running;
45
+ if (isRunning) running++;
46
+ }
47
+ if (running === 0 && alerts === 0 && reviewCount === 0) {
48
+ restore();
49
+ return;
50
+ }
51
+ const uri = renderFaviconBadgeUri({
52
+ running,
53
+ review: reviewCount,
54
+ alert: alerts,
55
+ });
56
+ if (originals.length > 0) {
57
+ for (const { link } of originals) link.href = uri;
58
+ } else {
59
+ if (created === null) {
60
+ created = document.createElement("link");
61
+ created.rel = "icon";
62
+ created.type = "image/svg+xml";
63
+ document.head.appendChild(created);
64
+ }
65
+ created.href = uri;
66
+ }
67
+ };
68
+ ctx.provide("faviconBadge", {
69
+ setBadge: (badge) => {
70
+ reviewCount = badge.reviewCount;
71
+ update();
72
+ },
73
+ });
74
+ ctx.effect(() => {
75
+ update();
76
+ const offList = sessions.list.subscribe(update);
77
+ const offStatus = ctx.uiSession.sessionStatus.subscribe(update);
78
+ return () => {
79
+ offList();
80
+ offStatus();
81
+ restore();
82
+ };
83
+ }, "favicon: status badges");
84
+ }
package/src/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ export const name = "dsh-client-favicon";
2
+
3
+ export function apply(): void {}