dsh-keeper-plugin 0.1.5 → 0.1.6
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 +57 -57
- package/client.js +2498 -155
- package/index.js +30 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -28,7 +28,7 @@ export const inject = [
|
|
|
28
28
|
const NS = 'dsh-keeper';
|
|
29
29
|
const PANEL_ID = 'dsh-keeper';
|
|
30
30
|
const API_PATH = '/dsh-keeper/api';
|
|
31
|
-
const PLUGIN_VERSION = '0.1.
|
|
31
|
+
const PLUGIN_VERSION = '0.1.6';
|
|
32
32
|
const META_NAME = '.dsh-keeper-trash.json';
|
|
33
33
|
/** Pre-rename identifiers. Kept only so existing installs migrate in place. */
|
|
34
34
|
const LEGACY_NS = 'sidebar-studio';
|
|
@@ -62,6 +62,13 @@ const NOTIFY_DEFAULTS = {
|
|
|
62
62
|
volume: 100,
|
|
63
63
|
sounds: { normal: { name: '' }, interrupt: { name: '' } },
|
|
64
64
|
openOnClick: true,
|
|
65
|
+
// Quiet hours (DND): within the local-time window banners and tones are
|
|
66
|
+
// held back, but the notification center still records the entry.
|
|
67
|
+
quiet: { enabled: false, start: '22:00', end: '08:00' },
|
|
68
|
+
// Mute completion reminders only; failures and pending questions still pass.
|
|
69
|
+
muteDone: false,
|
|
70
|
+
// Workspace ids whose notifications are held back (history unaffected).
|
|
71
|
+
mutedWorkspaces: [],
|
|
65
72
|
};
|
|
66
73
|
|
|
67
74
|
const DEFAULT_SETTINGS = {
|
|
@@ -85,6 +92,11 @@ function normalizeNotifyLastChannels(value, fallback) {
|
|
|
85
92
|
return { banner: true, sound: true };
|
|
86
93
|
}
|
|
87
94
|
|
|
95
|
+
function normalizeClock(value, fallback) {
|
|
96
|
+
const match = /^([01]\d|2[0-3]):([0-5]\d)$/.exec(typeof value === 'string' ? value.trim() : '');
|
|
97
|
+
return match ? `${match[1]}:${match[2]}` : fallback;
|
|
98
|
+
}
|
|
99
|
+
|
|
88
100
|
function normalizeNotificationSettings(value) {
|
|
89
101
|
const raw = value && typeof value === 'object' ? value : {};
|
|
90
102
|
// Older builds stored 'custom'; that synthetic tone is now the built-in
|
|
@@ -120,6 +132,15 @@ function normalizeNotificationSettings(value) {
|
|
|
120
132
|
lastChannels,
|
|
121
133
|
volume: Number.isFinite(volume) ? Math.max(0, Math.min(100, Math.round(volume))) : 100,
|
|
122
134
|
sounds,
|
|
135
|
+
quiet: {
|
|
136
|
+
enabled: raw.quiet?.enabled === true,
|
|
137
|
+
start: normalizeClock(raw.quiet?.start, '22:00'),
|
|
138
|
+
end: normalizeClock(raw.quiet?.end, '08:00'),
|
|
139
|
+
},
|
|
140
|
+
muteDone: raw.muteDone === true,
|
|
141
|
+
mutedWorkspaces: Array.isArray(raw.mutedWorkspaces)
|
|
142
|
+
? raw.mutedWorkspaces.filter((id) => typeof id === 'string' && id).slice(0, 100)
|
|
143
|
+
: [],
|
|
123
144
|
openOnClick: raw.openOnClick !== false,
|
|
124
145
|
};
|
|
125
146
|
}
|
|
@@ -633,6 +654,8 @@ async function sessionInfo(ctx, id, snapshot, dirMap, runningSet, registry) {
|
|
|
633
654
|
running: runningSet.has(id),
|
|
634
655
|
archived: registry.archived.has(id),
|
|
635
656
|
pinned: registry.pinned.has(id),
|
|
657
|
+
origin: typeof snapshot?.header?.origin === 'string' ? snapshot.header.origin : '',
|
|
658
|
+
parentSession: typeof snapshot?.header?.parentSession === 'string' ? snapshot.header.parentSession : '',
|
|
636
659
|
};
|
|
637
660
|
}
|
|
638
661
|
|
|
@@ -2274,12 +2297,14 @@ function pushNotification(ctx, entry) {
|
|
|
2274
2297
|
const rawSummary =
|
|
2275
2298
|
entry.summary || (entry.kind === 'error' ? entry.detail : '') || meta.summary || '';
|
|
2276
2299
|
const summary = truncate(stripMarkdown(String(rawSummary)), 100);
|
|
2300
|
+
const owner = sessionId ? workspaceContaining(ctx, sessionId) : null;
|
|
2277
2301
|
const notification = {
|
|
2278
2302
|
id: String(notificationSeq),
|
|
2279
2303
|
kind: entry.kind,
|
|
2280
2304
|
sessionId,
|
|
2281
2305
|
title: meta.title,
|
|
2282
2306
|
workspace: meta.workspace,
|
|
2307
|
+
workspaceId: owner?.id ?? '',
|
|
2283
2308
|
model: meta.model,
|
|
2284
2309
|
summary,
|
|
2285
2310
|
detail: entry.detail ?? '',
|
|
@@ -2311,6 +2336,10 @@ function readNotifications(ctx, payload) {
|
|
|
2311
2336
|
// model is available, so fill the gaps the first time it is read.
|
|
2312
2337
|
for (const item of items) {
|
|
2313
2338
|
if (!item.sessionId) continue;
|
|
2339
|
+
if (!item.workspaceId) {
|
|
2340
|
+
const owner = workspaceContaining(ctx, item.sessionId);
|
|
2341
|
+
if (owner) item.workspaceId = owner.id;
|
|
2342
|
+
}
|
|
2314
2343
|
if (item.title && item.workspace && item.model && item.summary) continue;
|
|
2315
2344
|
const meta = notificationMeta(ctx, null, item.sessionId);
|
|
2316
2345
|
if (!item.title && meta.title) item.title = meta.title;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-keeper-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "DSH Keeper — manage DSH workspace sessions, plugins, sidebar entries, and notifications in one place. DSH 管家:集中管理 DSH 的会话、插件、侧栏入口与通知。",
|
|
5
5
|
"icon": "icon.svg",
|
|
6
6
|
"type": "module",
|