@soffits/dsh-notify-inbox 0.8.0 → 0.9.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/CHANGELOG.md +9 -0
- package/README.md +2 -0
- package/client.js +19 -6
- package/index.js +3 -0
- package/package.json +7 -4
- package/src/routes.js +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.9.0
|
|
4
|
+
|
|
5
|
+
- `quiet`: people whose bell shows a soft grey dot when something is new, never a red count, so their inbox invites rather than nags. The summary says which (`badge`: `count` or `dot`).
|
|
6
|
+
|
|
7
|
+
## 0.8.1
|
|
8
|
+
|
|
9
|
+
- A link to an item from another page of the app (`/?notify-inbox=<id>`, pushed in place) opens it; before, only a page load or a push did.
|
|
10
|
+
- `@deepseek-ai/schemastery` is a peer dependency, so an update never moves a private copy out from under the plugin.
|
|
11
|
+
|
|
3
12
|
## 0.8.0
|
|
4
13
|
|
|
5
14
|
- A reply never dead-ends: when the ask names no session, or the one it names is gone, archived, can't be loaded or was a finished helper, it opens a new top-level session with the whole ask quoted in and the session that asked named, so someone can act on it. New options `replyCwd` and `replyPreset` say where that session starts. Every ask has a reply box now, not only those that name a session.
|
package/README.md
CHANGED
|
@@ -43,6 +43,7 @@ Restart `dsh web`. The inbox appears in the sidebar. Then set `dataDir` in a pro
|
|
|
43
43
|
| `summaryHours` | `12` | How long the summary line is shown after it was written. |
|
|
44
44
|
| `replyCwd` | host default | The folder of the new session a reply opens when the ask names no session, or the one it names is gone (below). |
|
|
45
45
|
| `replyPreset` | host default | The agent preset of that new session. |
|
|
46
|
+
| `quiet` | none | People (person ids) whose bell never shows a count: a soft grey dot says something is new instead of a red number, for someone who wants their inbox to invite rather than nag. |
|
|
46
47
|
|
|
47
48
|
**Who sees what.** With a mapping, every request is checked on the server: a person sees, marks and presses only their own inbox, and a request without a verified identity sees nothing. The identity comes from any plugin that provides a `requestIdentity` service (`current()` → `{ provider, issuer, id, name } | null`), such as [dsh-oidc](https://github.com/soffits/dsh-oidc) 0.3.0-alpha.9 or later. Without a mapping (a DSH only you use), you see every folder.
|
|
48
49
|
|
|
@@ -95,6 +96,7 @@ What waits on the person's answer (a decision, a pick, a small step for someone
|
|
|
95
96
|
- An ask that is a question lists its `options`; the writer gives each its own button (a `done` whose payload carries the answer), so a press answers it. One that is a task has a plain done.
|
|
96
97
|
- A press on an ask's buttons is an action event like any other (`source.record` is the ask's id), for whatever keeps the list to act on.
|
|
97
98
|
- Without `asks.json` nothing changes: notifications keep the group they were filed with.
|
|
99
|
+
- `/?notify-inbox=<id>` opens the inbox on one item, an ask (`todo:1a2b...`) or a notification: from a push, on a page load, or from a link on another page of the app that moves there in place (a card's row, for example).
|
|
98
100
|
|
|
99
101
|
A line `{"v": 1, "type": "handled", "record": "<id>", "press": "<press id>", "action": "done", "result": "done", "time": "..."}` tells the inbox that a press on that record was dealt with (`result: "snoozed"` with `until` shows when it comes back). Bad lines are skipped and counted.
|
|
100
102
|
|
package/client.js
CHANGED
|
@@ -92,6 +92,7 @@ window.__ModuleLoader__.load({
|
|
|
92
92
|
.nib-empty{padding:48px 20px;text-align:center;color:var(--dsw-alias-label-tertiary)}
|
|
93
93
|
.nib-error{color:var(--dsw-alias-state-error-primary)}
|
|
94
94
|
.nib-more{display:flex;justify-content:center}
|
|
95
|
+
.nib-dot{position:absolute;top:-2px;right:-3px;width:7px;height:7px;border-radius:50%;background:var(--dsw-alias-label-tertiary);pointer-events:none}
|
|
95
96
|
.nib-badge{position:absolute;top:-5px;right:-8px;min-width:14px;height:14px;padding:0 3px;box-sizing:border-box;border-radius:7px;background:var(--dsw-alias-state-error-primary);color:#fff;font-size:9px;font-weight:600;line-height:14px;text-align:center;pointer-events:none}
|
|
96
97
|
.nib-bell{position:relative;display:inline-flex}
|
|
97
98
|
@media (width<=640px){.nib-content{padding-inline:12px}.nib-heading{padding-top:16px}.nib-item{padding:8px 6px}.nib-line{gap:10px}}
|
|
@@ -100,7 +101,7 @@ window.__ModuleLoader__.load({
|
|
|
100
101
|
|
|
101
102
|
// ---- shared state: the counts and a version that bumps when anything changes ----
|
|
102
103
|
|
|
103
|
-
const shared = { unread: 0, version: 0, linked: null, ui: null, kit: null, summary: null, openSession: () => {} }
|
|
104
|
+
const shared = { unread: 0, badge: 'count', version: 0, linked: null, ui: null, kit: null, summary: null, openSession: () => {} }
|
|
104
105
|
const listeners = new Set()
|
|
105
106
|
const emit = () => { for (const listener of listeners) listener() }
|
|
106
107
|
const subscribe = listener => { listeners.add(listener); return () => listeners.delete(listener) }
|
|
@@ -120,10 +121,11 @@ window.__ModuleLoader__.load({
|
|
|
120
121
|
async function refreshSummary() {
|
|
121
122
|
try {
|
|
122
123
|
const summary = await call('summary')
|
|
123
|
-
const key = JSON.stringify([summary.unread, summary.latest, summary.total, summary.groups, summary.line])
|
|
124
|
+
const key = JSON.stringify([summary.unread, summary.badge, summary.latest, summary.total, summary.groups, summary.line])
|
|
124
125
|
if (key !== lastSummary) {
|
|
125
126
|
lastSummary = key
|
|
126
127
|
shared.unread = summary.unread
|
|
128
|
+
shared.badge = summary.badge === 'dot' ? 'dot' : 'count'
|
|
127
129
|
shared.summary = summary
|
|
128
130
|
shared.version += 1
|
|
129
131
|
emit()
|
|
@@ -501,9 +503,12 @@ window.__ModuleLoader__.load({
|
|
|
501
503
|
|
|
502
504
|
function SidebarIcon({ size }) {
|
|
503
505
|
const unread = useShared(s => s.unread)
|
|
506
|
+
const badge = useShared(s => s.badge)
|
|
504
507
|
return h('span', { className: 'nib-bell' },
|
|
505
508
|
h(BellGlyph, { size }),
|
|
506
|
-
unread > 0 &&
|
|
509
|
+
unread > 0 && (badge === 'dot'
|
|
510
|
+
? h('span', { className: 'nib-dot' })
|
|
511
|
+
: h('span', { className: 'nib-badge' }, unread > 99 ? '99+' : String(unread))))
|
|
507
512
|
}
|
|
508
513
|
|
|
509
514
|
return {
|
|
@@ -601,14 +606,19 @@ window.__ModuleLoader__.load({
|
|
|
601
606
|
}, 100)
|
|
602
607
|
}
|
|
603
608
|
ctx.effect(() => {
|
|
604
|
-
|
|
605
|
-
|
|
609
|
+
// A link to an item opens it, at page load and when another page of the app links here in place
|
|
610
|
+
// (it pushes the URL and fires popstate, as DSH's own links do).
|
|
611
|
+
const followLink = () => {
|
|
612
|
+
const params = new URLSearchParams(location.search)
|
|
613
|
+
if (!params.has(LINK_PARAM)) return
|
|
606
614
|
const id = params.get(LINK_PARAM)
|
|
607
615
|
params.delete(LINK_PARAM)
|
|
608
616
|
const query = params.toString()
|
|
609
617
|
history.replaceState(history.state, '', `${location.pathname}${query ? `?${query}` : ''}${location.hash}`)
|
|
610
618
|
openLinked(id)
|
|
611
619
|
}
|
|
620
|
+
followLink()
|
|
621
|
+
window.addEventListener('popstate', followLink)
|
|
612
622
|
const onMessage = event => {
|
|
613
623
|
if (event.data?.type !== 'notify-inbox/open') return
|
|
614
624
|
try {
|
|
@@ -619,7 +629,10 @@ window.__ModuleLoader__.load({
|
|
|
619
629
|
}
|
|
620
630
|
navigator.serviceWorker?.addEventListener('message', onMessage)
|
|
621
631
|
navigator.serviceWorker?.startMessages?.()
|
|
622
|
-
return () =>
|
|
632
|
+
return () => {
|
|
633
|
+
window.removeEventListener('popstate', followLink)
|
|
634
|
+
navigator.serviceWorker?.removeEventListener('message', onMessage)
|
|
635
|
+
}
|
|
623
636
|
}, 'notify-inbox: links')
|
|
624
637
|
},
|
|
625
638
|
}
|
package/index.js
CHANGED
|
@@ -52,6 +52,8 @@ export const Config = z.object({
|
|
|
52
52
|
.description('The folder of the new session a reply opens when the item names no conversation, or the one it names is gone or archived. Empty means the host default. A leading ~/ means the home folder.'),
|
|
53
53
|
replyPreset: z.string().default('')
|
|
54
54
|
.description('The agent preset of that new session. Empty means the host default.'),
|
|
55
|
+
quiet: z.array(z.string()).default([])
|
|
56
|
+
.description('People (person ids) whose bell never shows a count: a soft dot says something is new, so their inbox invites rather than nags.'),
|
|
55
57
|
})
|
|
56
58
|
|
|
57
59
|
/**
|
|
@@ -175,6 +177,7 @@ export function apply(ctx, config) {
|
|
|
175
177
|
reply,
|
|
176
178
|
domains: domainMap(config.domains ?? {}),
|
|
177
179
|
summaryHours: config.summaryHours ?? 12,
|
|
180
|
+
quiet: config.quiet ?? [],
|
|
178
181
|
})
|
|
179
182
|
for (const route of routes) ctx.connection.fetch.register(route)
|
|
180
183
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soffits/dsh-notify-inbox",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "A notification inbox for DeepSeek Harness: each person sees their own notifications with read and unread, gets Web Push on their phone or browser, and can act on them.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -62,11 +62,14 @@
|
|
|
62
62
|
"check": "for f in index.js client.js src/*.js test/*.js; do node --check \"$f\" || exit 1; done",
|
|
63
63
|
"test": "node --test test/*.test.js"
|
|
64
64
|
},
|
|
65
|
-
"dependencies": {
|
|
66
|
-
"@deepseek-ai/schemastery": "3.18.5"
|
|
67
|
-
},
|
|
68
65
|
"engines": {
|
|
69
66
|
"node": ">=22",
|
|
70
67
|
"dsh": ">=0.2.2-rc.1 <0.3.0-0"
|
|
68
|
+
},
|
|
69
|
+
"peerDependencies": {
|
|
70
|
+
"@deepseek-ai/schemastery": "^3.18.5"
|
|
71
|
+
},
|
|
72
|
+
"devDependencies": {
|
|
73
|
+
"@deepseek-ai/schemastery": "3.18.5"
|
|
71
74
|
}
|
|
72
75
|
}
|
package/src/routes.js
CHANGED
|
@@ -74,7 +74,8 @@ async function body(request) {
|
|
|
74
74
|
* @param {Record<string, { icon: string, tone?: string }>} options.domains - the domain map (src/domains.js)
|
|
75
75
|
* @param {number} options.summaryHours - how long a summary line is shown
|
|
76
76
|
*/
|
|
77
|
-
export function createRoutes({ store, people, push, actions, identity, serviceWorker, strings = async () => ({}), reply, changes, domains, summaryHours }) {
|
|
77
|
+
export function createRoutes({ store, people, push, actions, identity, serviceWorker, strings = async () => ({}), reply, changes, domains, summaryHours, quiet = [] }) {
|
|
78
|
+
const hushed = new Set(quiet.map(person => String(person).trim().toLowerCase()))
|
|
78
79
|
/** Who is asking, as the inbox folders they may read; undefined with the response to send instead. */
|
|
79
80
|
async function caller() {
|
|
80
81
|
const viewer = await viewerOf(people, identity())
|
|
@@ -110,7 +111,8 @@ export function createRoutes({ store, people, push, actions, identity, serviceWo
|
|
|
110
111
|
const [{ items, bad }, line] = await Promise.all([itemsOf(who), store.summaryLine(who.folders, summaryHours)])
|
|
111
112
|
const { groups, unread } = countItems(items)
|
|
112
113
|
const latest = items.reduce((newest, item) => (newest === null || item.time > newest ? item.time : newest), null)
|
|
113
|
-
|
|
114
|
+
const badge = who.person !== null && who.person !== undefined && hushed.has(who.person.toLowerCase()) ? 'dot' : 'count'
|
|
115
|
+
return json(200, { mode: who.mode, person: who.person, unread, badge, groups, total: items.length, latest, line, domains, problems: { badLines: bad } })
|
|
114
116
|
})
|
|
115
117
|
|
|
116
118
|
const list = handle(async (request, who) => {
|