dsh-workspace-status 0.3.4 → 0.3.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/CHANGELOG.md CHANGED
@@ -6,6 +6,36 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.3.6] - 2026-12-05
10
+
11
+ ### Added
12
+
13
+ - Forked conversations are marked in the sidebar: a branch glyph, a 14px
14
+ indent and a tooltip naming the parent, derived from the `parentId` the
15
+ session feed already carries. The marker is additive CSS plus a `title`
16
+ attribute on the row — row order, grouping and the shipped tree are
17
+ untouched, so a fork still sits where its timestamp puts it.
18
+
19
+ ## [0.3.5] - 2026-12-05
20
+
21
+ ### Added
22
+
23
+ - A status bar under the Pinned header: one line summarising how many pinned
24
+ conversations are waiting for you, running, or parked for later.
25
+ - "Work on later": park a conversation from its row with an optional one-line
26
+ note, e.g. "waiting for reboot". Parked conversations leave their workspace
27
+ group, collect under a **Later** heading in queue order, show their note, and
28
+ can be unparked from that row.
29
+ - A parked conversation raises no in-app notice, chime or system banner while
30
+ it stays parked, and unparking cannot replay the events it muted: the diff
31
+ still advances while the row is quiet.
32
+
33
+ ### Fixed
34
+
35
+ - The pinned group count referenced an invalid theme token
36
+ (`--dsws-alias-label-tertiary`) and inherited its colour instead of the
37
+ tertiary label colour.
38
+
9
39
  ## [0.3.4] - 2026-12-05
10
40
 
11
41
  ### Added
package/client.js CHANGED
@@ -75,6 +75,9 @@ window.__ModuleLoader__.load({
75
75
  /** Browser-local preference store for pinned-conversation notifications. */
76
76
  const NOTIFY_STORE_KEY = 'dsh-workspace-status/notifications/v1'
77
77
 
78
+ /** Browser-local "work on this later" marks, keyed by Session id. */
79
+ const LATER_STORE_KEY = 'dsh-workspace-status/later/v1'
80
+
78
81
  /** The renderer's Notification constructor, when the platform has one. */
79
82
  const NOTIFICATION_API = typeof Notification === 'undefined' ? undefined : Notification
80
83
 
@@ -90,6 +93,11 @@ window.__ModuleLoader__.load({
90
93
  `.${SR_CLASS}{position:absolute;width:1px;height:1px;margin:-1px;padding:0;`,
91
94
  'overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}',
92
95
  '.dsws-anchor{display:none!important}',
96
+ // A single branch glyph shared by every forked row; the mask keeps it
97
+ // theme-coloured through the row's own CSS variable.
98
+ ':root{--dsws-branch-icon:url("data:image/svg+xml,%3Csvg xmlns=\'http://www.w3.org/2000/svg\' ',
99
+ 'viewBox=\'0 0 16 16\' fill=\'none\' stroke=\'%23000\' stroke-width=\'1.5\' stroke-linecap=\'round\' ',
100
+ 'stroke-linejoin=\'round\'%3E%3Cpath d=\'M3.5 2.5v6a3 3 0 0 0 3 3h6\'/%3E%3Cpath d=\'M10 8.5l3 3-3 3\'/%3E%3C/svg%3E")}',
93
101
  ].join('')
94
102
 
95
103
  /**
@@ -103,9 +111,12 @@ window.__ModuleLoader__.load({
103
111
  'activity.waiting': '{n} waiting for you',
104
112
  'activity.running': '{n} running',
105
113
  'activity.done': '{n} recently finished',
114
+ 'activity.later': '{n} later',
106
115
  'activity.unnamed': 'Ungrouped',
107
116
  'activity.more': 'and {n} more',
108
117
  'activity.listSeparator': ', ',
118
+ 'branch.from': 'Branched from {title}',
119
+ 'branch.fromUnknown': 'Branched from an earlier conversation',
109
120
  'pinned.title': 'Pinned',
110
121
  'pinned.untitled': 'Untitled',
111
122
  'pinned.unpin': 'Unpin',
@@ -134,6 +145,14 @@ window.__ModuleLoader__.load({
134
145
  'notify.finished.title': '{title} finished',
135
146
  'notify.finished.body': 'Finished and not opened yet · {workspace}',
136
147
  'notify.dismiss': 'Dismiss',
148
+ 'later.title': 'Later',
149
+ 'later.mark': 'Mark for later',
150
+ 'later.markAria': 'Mark {title} for later',
151
+ 'later.unmark': 'Stop deferring',
152
+ 'later.unmarkAria': 'Stop deferring {title}',
153
+ 'later.note': 'Why later? e.g. waiting for reboot',
154
+ 'later.groupAria': 'Conversations parked for later',
155
+ 'later.noteFallback': 'No note',
137
156
  'star.suite': 'Star the suite',
138
157
  },
139
158
  zh: {
@@ -141,9 +160,12 @@ window.__ModuleLoader__.load({
141
160
  'activity.waiting': '{n} 个等待你处理',
142
161
  'activity.running': '{n} 个运行中',
143
162
  'activity.done': '{n} 个刚刚完成',
163
+ 'activity.later': '{n} 个稍后处理',
144
164
  'activity.unnamed': '未分组',
145
165
  'activity.more': '等 {n} 个',
146
166
  'activity.listSeparator': '、',
167
+ 'branch.from': '分支自 {title}',
168
+ 'branch.fromUnknown': '分支自更早的会话',
147
169
  'pinned.title': '已置顶',
148
170
  'pinned.untitled': '未命名',
149
171
  'pinned.unpin': '取消置顶',
@@ -172,6 +194,14 @@ window.__ModuleLoader__.load({
172
194
  'notify.finished.title': '{title} 已完成',
173
195
  'notify.finished.body': '已完成且尚未打开 · {workspace}',
174
196
  'notify.dismiss': '关闭',
197
+ 'later.title': '稍后处理',
198
+ 'later.mark': '标记为稍后处理',
199
+ 'later.markAria': '将 {title} 标记为稍后处理',
200
+ 'later.unmark': '取消稍后处理',
201
+ 'later.unmarkAria': '取消 {title} 的稍后处理',
202
+ 'later.note': '为什么稍后?例如:等待重启',
203
+ 'later.groupAria': '已推迟到稍后处理的会话',
204
+ 'later.noteFallback': '无备注',
175
205
  'star.suite': '为插件套件点星',
176
206
  },
177
207
  }
@@ -287,6 +317,19 @@ window.__ModuleLoader__.load({
287
317
  }, h('path', { d: BELL_PATH, fill: 'currentColor' }))
288
318
  }
289
319
 
320
+ /** Render the later bookmark; `filled` marks a parked Session. */
321
+ function bookmarkIcon(filled) {
322
+ return h('svg', {
323
+ width: 13, height: 13, viewBox: '0 0 24 24', 'aria-hidden': 'true', focusable: 'false',
324
+ }, h('path', {
325
+ d: 'M7 3.75h10a1.25 1.25 0 0 1 1.25 1.25v16.1a.4.4 0 0 1-.62.33L12 17.3l-5.63 4.13a.4.4 0 0 1-.62-.33V5A1.25 1.25 0 0 1 7 3.75Z',
326
+ fill: filled ? 'currentColor' : 'none',
327
+ stroke: 'currentColor',
328
+ 'stroke-width': filled ? 0 : 1.6,
329
+ 'stroke-linejoin': 'round',
330
+ }))
331
+ }
332
+
290
333
  /** Render the sound toggle glyph. */
291
334
  function volumeIcon() {
292
335
  return h('svg', {
@@ -734,6 +777,113 @@ window.__ModuleLoader__.load({
734
777
  return `${rows}{display:none!important}`
735
778
  }
736
779
 
780
+ /**
781
+ * Sessions that continue another conversation, keyed by session id.
782
+ *
783
+ * The shell keeps forks flat: the stored session records its parent and the
784
+ * sidebar summary carries it as `parentId`, but no shipped row reads the
785
+ * relation — the only hint is the "(n)" the fork action appends to the
786
+ * title. The marker gives such a row a branch glyph, an indent, and the
787
+ * parent's name in its tooltip.
788
+ *
789
+ * A self-parented row (a corrupt or hand-edited header) is ignored, and a
790
+ * parent that is no longer listed still marks the child, with a generic
791
+ * tooltip: the branch is real even when the parent was archived away.
792
+ * @param byId - session summaries from the sidebar feed.
793
+ * @returns one entry per forked session: its parent id and tooltip text.
794
+ */
795
+ function branchRows(byId) {
796
+ const rows = new Map()
797
+ if (byId === null || typeof byId !== 'object') return rows
798
+ for (const [id, row] of Object.entries(byId)) {
799
+ const parentId = row !== null && typeof row === 'object' && typeof row.parentId === 'string'
800
+ ? row.parentId
801
+ : ''
802
+ if (parentId === '' || parentId === id) continue
803
+ const parent = byId[parentId]
804
+ const parentTitle = parent !== null && typeof parent === 'object'
805
+ ? typeof parent.displayTitle === 'string' && parent.displayTitle !== ''
806
+ ? parent.displayTitle
807
+ : typeof parent.title === 'string' && parent.title !== ''
808
+ ? parent.title
809
+ : ''
810
+ : ''
811
+ rows.set(id, {
812
+ parentId,
813
+ tip: parentTitle === ''
814
+ ? message('branch.fromUnknown')
815
+ : message('branch.from', { title: parentTitle }),
816
+ })
817
+ }
818
+ return rows
819
+ }
820
+
821
+ /**
822
+ * Indent and glyph for the forked rows, one rule per row.
823
+ *
824
+ * The indent repeats the shell's own padding formula plus a step, so a row
825
+ * that already carries a workspace indent keeps it. The glyph is a masked
826
+ * background rather than a text node: it inherits the theme colour and
827
+ * cannot be selected or read out.
828
+ * @param branches - map from branchRows().
829
+ * @returns CSS text, or an empty string when nothing is forked.
830
+ */
831
+ function branchCss(branches) {
832
+ // Duck-typed rather than `instanceof Map`: the bundle is loaded in a
833
+ // separate realm, where a Map built by the shell is not this realm's Map.
834
+ if (branches === null || branches === undefined || typeof branches.keys !== 'function') return ''
835
+ if (typeof branches.size !== 'number' || branches.size === 0) return ''
836
+ const rules = []
837
+ for (const id of branches.keys()) {
838
+ const row = `[data-row-key="session:${quote(id)}"]`
839
+ rules.push(`${row}{padding-inline-start:calc(var(--dsh-sidebar-row-padding) - var(--dsh-sidebar-paint-inset) + var(--dsh-workspace-indent,0px) + 14px)}`)
840
+ rules.push(
841
+ `${row}::before{content:"";flex:none;width:12px;height:12px;margin-right:1px;`,
842
+ 'background-color:var(--dsw-alias-label-tertiary);',
843
+ '-webkit-mask:var(--dsws-branch-icon) center / 12px 12px no-repeat;',
844
+ 'mask:var(--dsws-branch-icon) center / 12px 12px no-repeat}',
845
+ )
846
+ }
847
+ return rules.join('')
848
+ }
849
+
850
+ /**
851
+ * Write the branch tooltip onto the shipped rows.
852
+ *
853
+ * CSS can indent and draw the glyph, but the parent's name only reaches a
854
+ * row through its `title` attribute, which the shell does not set on
855
+ * session rows. The marker attribute remembers that the tooltip is ours, so
856
+ * it is removed again once the session stops being a fork.
857
+ * @param doc - document that owns the sidebar.
858
+ * @param branches - map from branchRows().
859
+ */
860
+ function syncBranchTitles(doc, branches) {
861
+ if (doc === null || doc === undefined || typeof doc.querySelectorAll !== 'function') return
862
+ if (branches === null || branches === undefined || typeof branches.get !== 'function') return
863
+ let rows
864
+ try {
865
+ rows = doc.querySelectorAll('[data-row-key^="session:"]')
866
+ } catch {
867
+ return
868
+ }
869
+ for (const row of rows) {
870
+ const key = row.getAttribute('data-row-key') ?? ''
871
+ if (!key.startsWith('session:')) continue
872
+ const branch = branches.get(key.slice('session:'.length))
873
+ if (branch === undefined) {
874
+ if (row.getAttribute('data-dsws-branch-tip') !== null) {
875
+ row.removeAttribute('data-dsws-branch-tip')
876
+ row.removeAttribute('title')
877
+ }
878
+ continue
879
+ }
880
+ if (row.getAttribute('data-dsws-branch-tip') !== branch.tip) {
881
+ row.setAttribute('data-dsws-branch-tip', branch.tip)
882
+ row.setAttribute('title', branch.tip)
883
+ }
884
+ }
885
+ }
886
+
737
887
  /**
738
888
  * Static stylesheet for the pinned section. Geometry mirrors the shipped
739
889
  * sidebar: 34px workspace rows, 32px session rows, the same radii, gaps and
@@ -806,7 +956,7 @@ window.__ModuleLoader__.load({
806
956
  '.dsws-pinned-group-head:hover .dsws-pinned-fileglyph,.dsws-pinned-group-head:focus-visible .dsws-pinned-fileglyph{display:none}',
807
957
  '.dsws-pinned-group-head:hover .dsws-pinned-arrow,.dsws-pinned-group-head:focus-visible .dsws-pinned-arrow{display:inline-flex}',
808
958
  '.dsws-pinned-group-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
809
- '.dsws-pinned-group-count{flex:none;color:var(--dsws-alias-label-tertiary);font-size:12px;line-height:17px;',
959
+ '.dsws-pinned-group-count{flex:none;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:17px;',
810
960
  'font-variant-numeric:tabular-nums}',
811
961
  '.dsws-pinned-row{display:flex;align-items:center;box-sizing:border-box;width:100%;height:32px;',
812
962
  'margin:0;padding:0 6px 0 28px;border:0;border-radius:var(--dsw-radius-md);background:none;',
@@ -831,6 +981,28 @@ window.__ModuleLoader__.load({
831
981
  'background:none;color:var(--dsw-alias-label-tertiary);cursor:pointer}',
832
982
  '.dsws-pinned-unpin:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}',
833
983
  '.dsws-pinned-unpin:disabled{opacity:.45;cursor:default}',
984
+ '.dsws-pinned-statusbar{display:flex;flex-wrap:wrap;align-items:center;gap:10px;',
985
+ 'padding:0 8px 6px;color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px}',
986
+ '.dsws-statusbar-seg{display:inline-flex;align-items:center;gap:5px;white-space:nowrap}',
987
+ '.dsws-statusbar-dot{flex:none;width:6px;height:6px;border-radius:50%;',
988
+ 'background:var(--dsw-alias-label-tertiary)}',
989
+ '.dsws-statusbar-dot[data-tone="wait"]{background:var(--dsw-alias-state-warn-primary)}',
990
+ '.dsws-statusbar-dot[data-tone="run"]{background:var(--dsw-static-deepseek-450)}',
991
+ '.dsws-statusbar-dot[data-tone="later"]{background:var(--dsw-alias-label-secondary)}',
992
+ '.dsws-pinned-latergroup{margin-top:2px}',
993
+ '.dsws-pinned-laterrow{align-items:flex-start;height:auto;min-height:32px;padding-top:3px;padding-bottom:3px}',
994
+ '.dsws-pinned-laterrow .dsws-pinned-dotslot{margin-top:2px}',
995
+ '.dsws-pinned-latertext{flex:1;min-width:0;display:flex;flex-direction:column;gap:1px}',
996
+ '.dsws-pinned-laternote{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:15px;',
997
+ 'overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
998
+ '.dsws-pinned-bookmark{flex:none;width:22px;height:22px;margin-left:2px;display:inline-flex;',
999
+ 'align-items:center;justify-content:center;padding:0;border:0;border-radius:var(--dsw-radius-sm);',
1000
+ 'background:none;color:var(--dsw-alias-label-tertiary);cursor:pointer}',
1001
+ '.dsws-pinned-bookmark:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}',
1002
+ '.dsws-pinned-bookmark[data-on="true"]{color:var(--dsw-alias-label-secondary)}',
1003
+ '.dsws-pinned-note{flex:1;min-width:0;height:22px;box-sizing:border-box;padding:0 6px;',
1004
+ 'border:0.5px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-sm);',
1005
+ 'background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary);font:inherit;font-size:12px}',
834
1006
  '@media (prefers-reduced-motion:reduce){',
835
1007
  '.dsws-pinned-dot[data-state="ongoing"]{animation:none;opacity:.7}',
836
1008
  '.dsws-pinned-chevron,.dsws-pinned-arrow{transition:none}}',
@@ -847,9 +1019,11 @@ window.__ModuleLoader__.load({
847
1019
  *
848
1020
  * @param previous - previous per-session status map.
849
1021
  * @param sessions - pinned sessions from the current model.
1022
+ * @param muted - Sessions parked for later: their state still advances so
1023
+ * unparking cannot replay history, but no event is emitted.
850
1024
  * @returns the events to deliver plus the map for the next render.
851
1025
  */
852
- function notificationEvents(previous, sessions) {
1026
+ function notificationEvents(previous, sessions, muted) {
853
1027
  const next = new Map()
854
1028
  const events = []
855
1029
  for (const session of Array.isArray(sessions) ? sessions : []) {
@@ -862,10 +1036,11 @@ window.__ModuleLoader__.load({
862
1036
  next.set(session.id, state)
863
1037
  continue
864
1038
  }
865
- if (pendingKind !== null && pendingKind !== prior.pendingKind) {
1039
+ const parked = muted !== null && typeof muted?.has === 'function' && muted.has(session.id)
1040
+ if (!parked && pendingKind !== null && pendingKind !== prior.pendingKind) {
866
1041
  events.push({ type: 'waiting', session })
867
1042
  }
868
- if (completionUnread && !running && (prior.running === true || prior.completionUnread !== true)) {
1043
+ if (!parked && completionUnread && !running && (prior.running === true || prior.completionUnread !== true)) {
869
1044
  events.push({ type: 'finished', session })
870
1045
  }
871
1046
  next.set(session.id, state)
@@ -930,6 +1105,104 @@ window.__ModuleLoader__.load({
930
1105
  return prefs
931
1106
  }
932
1107
 
1108
+ /** Read the browser-local later marks without assuming storage access. */
1109
+ function readLater() {
1110
+ if (typeof localStorage === 'undefined') return {}
1111
+ try {
1112
+ const raw = localStorage.getItem(LATER_STORE_KEY)
1113
+ if (typeof raw !== 'string' || raw === '') return {}
1114
+ const parsed = JSON.parse(raw)
1115
+ if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) return {}
1116
+ const later = {}
1117
+ for (const [sessionId, value] of Object.entries(parsed)) {
1118
+ if (typeof sessionId !== 'string' || sessionId === '') continue
1119
+ if (value === null || typeof value !== 'object' || Array.isArray(value)) continue
1120
+ later[sessionId] = {
1121
+ note: typeof value.note === 'string' ? value.note.slice(0, 160) : '',
1122
+ at: typeof value.at === 'number' && Number.isFinite(value.at) ? value.at : 0,
1123
+ }
1124
+ }
1125
+ return later
1126
+ } catch {
1127
+ return {}
1128
+ }
1129
+ }
1130
+
1131
+ /** Persist the later marks and return the value for a state update. */
1132
+ function writeLater(later) {
1133
+ if (typeof localStorage !== 'undefined') {
1134
+ try {
1135
+ localStorage.setItem(LATER_STORE_KEY, JSON.stringify(later))
1136
+ } catch {
1137
+ // Storage may be unavailable; the in-memory marks still apply.
1138
+ }
1139
+ }
1140
+ return later
1141
+ }
1142
+
1143
+ /** Whether a Session is parked for later. */
1144
+ function hasLater(later, sessionId) {
1145
+ return later !== null && typeof later === 'object' && typeof sessionId === 'string'
1146
+ && Object.prototype.hasOwnProperty.call(later, sessionId)
1147
+ }
1148
+
1149
+ /** Park a Session with an optional note and return the next map. */
1150
+ function setLater(later, sessionId, note) {
1151
+ const next = { ...later }
1152
+ next[sessionId] = { note: String(note ?? '').slice(0, 160), at: Date.now() }
1153
+ return writeLater(next)
1154
+ }
1155
+
1156
+ /** Clear one Session's later mark and return the next map. */
1157
+ function clearLater(later, sessionId) {
1158
+ const next = { ...later }
1159
+ delete next[sessionId]
1160
+ return writeLater(next)
1161
+ }
1162
+
1163
+ /**
1164
+ * Parked Sessions, oldest park first, with the same live facts the pinned
1165
+ * rows carry. Archived, blank and subagent rows have no ordinary row to
1166
+ * lift, so they are skipped exactly like the pinned view does.
1167
+ * @param later - browser-local marks keyed by Session id.
1168
+ * @param sessions - Session summaries keyed by id.
1169
+ * @param statuses - Session UI status map.
1170
+ * @param archivedSessionIds - registry archive set.
1171
+ * @param now - render clock for the relative label.
1172
+ * @returns the entries in queue order plus their count.
1173
+ */
1174
+ function buildLaterView(later, sessions, statuses, archivedSessionIds, now) {
1175
+ const byId = sessions !== null && typeof sessions === 'object' ? sessions : {}
1176
+ const archived = new Set(Array.isArray(archivedSessionIds) ? archivedSessionIds : [])
1177
+ const statusMap = statuses !== null && typeof statuses?.get === 'function' ? statuses : undefined
1178
+ const children = childMap(byId)
1179
+ const entries = []
1180
+ for (const [sessionId, mark] of Object.entries(later ?? {})) {
1181
+ const row = byId[sessionId]
1182
+ if (row === null || row === undefined) continue
1183
+ if (archived.has(sessionId)) continue
1184
+ if (row.origin === 'subagent' || row.blank === true) continue
1185
+ const facts = sessionFacts(sessionId, row, statusMap, children, byId)
1186
+ entries.push({
1187
+ id: sessionId,
1188
+ title: typeof row.displayTitle === 'string' && row.displayTitle !== ''
1189
+ ? row.displayTitle
1190
+ : typeof row.title === 'string' && row.title !== ''
1191
+ ? row.title
1192
+ : message('pinned.untitled'),
1193
+ note: typeof mark?.note === 'string' ? mark.note : '',
1194
+ at: typeof mark?.at === 'number' ? mark.at : 0,
1195
+ time: relativeTime(row.updatedAt, now),
1196
+ mark: facts.mark,
1197
+ pendingKind: facts.pendingKind,
1198
+ running: facts.running,
1199
+ completionUnread: facts.completionUnread,
1200
+ })
1201
+ }
1202
+ entries.sort((left, right) => left.at - right.at)
1203
+ return { entries, count: entries.length }
1204
+ }
1205
+
933
1206
  /** Lazily created audio context for the optional chime. */
934
1207
  let audioContext
935
1208
 
@@ -1058,7 +1331,7 @@ window.__ModuleLoader__.load({
1058
1331
  * the Workspace feed, groups it per Workspace, and unpins through the
1059
1332
  * Workspace service so the official tree and this section update together.
1060
1333
  */
1061
- function PinnedSection({ model, openSession, unpinSession }) {
1334
+ function PinnedSection({ model, sessions, statuses, archived, openSession, unpinSession }) {
1062
1335
  const [view, setView] = React.useState(readViewState)
1063
1336
  const [pending, setPending] = React.useState(() => ({}))
1064
1337
  const [notifyPrefs, setNotifyPrefs] = React.useState(readNotificationPrefs)
@@ -1068,6 +1341,8 @@ window.__ModuleLoader__.load({
1068
1341
  const notifyStateRef = React.useRef(new Map())
1069
1342
  const [notices, setNotices] = React.useState([])
1070
1343
  const noticeTimers = React.useRef(new Map())
1344
+ const [later, setLaterState] = React.useState(readLater)
1345
+ const [editingLater, setEditingLater] = React.useState(null)
1071
1346
 
1072
1347
  const dismissNotice = (id) => {
1073
1348
  const timer = noticeTimers.current.get(id)
@@ -1104,8 +1379,9 @@ window.__ModuleLoader__.load({
1104
1379
  // advances even while notifications are off, so turning them on cannot
1105
1380
  // replay history.
1106
1381
  React.useEffect(() => {
1107
- const sessions = model.groups.flatMap((group) => group.sessions)
1108
- const { events, next } = notificationEvents(notifyStateRef.current, sessions)
1382
+ const pinnedSessions = model.groups.flatMap((group) => group.sessions)
1383
+ const muted = new Set(Object.keys(later))
1384
+ const { events, next } = notificationEvents(notifyStateRef.current, pinnedSessions, muted)
1109
1385
  notifyStateRef.current = next
1110
1386
  if (events.length === 0) return
1111
1387
  if (!notifyPrefs.enabled) return
@@ -1144,7 +1420,7 @@ window.__ModuleLoader__.load({
1144
1420
  }
1145
1421
  }
1146
1422
  if (delivered && notifyPrefs.sound) playChime()
1147
- }, [model, notifyPrefs.enabled, notifyPrefs.sound, permission, openSession])
1423
+ }, [model, later, notifyPrefs.enabled, notifyPrefs.sound, permission, openSession])
1148
1424
 
1149
1425
  const sendTestNotification = (osAllowed = permission === 'granted') => {
1150
1426
  const title = message('notify.enabled.title')
@@ -1234,6 +1510,31 @@ window.__ModuleLoader__.load({
1234
1510
  const sectionOpen = view.sectionCollapsed !== true
1235
1511
  const rows = []
1236
1512
 
1513
+ const laterModel = React.useMemo(
1514
+ () => buildLaterView(later, sessions, statuses, archived, Date.now()),
1515
+ [later, sessions, statuses, archived],
1516
+ )
1517
+ // Parked conversations leave their workspace group: they are lifted into
1518
+ // the Later group, so one row never appears twice.
1519
+ const visibleGroups = React.useMemo(
1520
+ () => model.groups
1521
+ .map((group) => ({
1522
+ ...group,
1523
+ sessions: group.sessions.filter((session) => !hasLater(later, session.id)),
1524
+ }))
1525
+ .map((group) => ({ ...group, count: group.sessions.length }))
1526
+ .filter((group) => group.count > 0),
1527
+ [model, later],
1528
+ )
1529
+ const waitingNow = visibleGroups.reduce(
1530
+ (total, group) => total + group.sessions.filter((session) => session.mark === 'warning').length,
1531
+ 0,
1532
+ )
1533
+ const runningNow = visibleGroups.reduce(
1534
+ (total, group) => total + group.sessions.filter((session) => session.mark === 'ongoing').length,
1535
+ 0,
1536
+ )
1537
+
1237
1538
  rows.push(h(
1238
1539
  'div',
1239
1540
  { key: 'header', className: 'dsws-pinned-headerrow' },
@@ -1337,8 +1638,102 @@ window.__ModuleLoader__.load({
1337
1638
  ))
1338
1639
  }
1339
1640
 
1641
+ const statusSegments = []
1642
+ if (waitingNow > 0) statusSegments.push(['wait', message('activity.waiting', { n: waitingNow })])
1643
+ if (runningNow > 0) statusSegments.push(['run', message('activity.running', { n: runningNow })])
1644
+ if (laterModel.count > 0) statusSegments.push(['later', message('activity.later', { n: laterModel.count })])
1645
+ if (statusSegments.length > 0) {
1646
+ rows.push(h(
1647
+ 'div',
1648
+ { key: 'statusbar', className: 'dsws-pinned-statusbar', role: 'status', 'aria-live': 'polite' },
1649
+ statusSegments.map(([tone, label]) => h(
1650
+ 'span',
1651
+ { key: tone, className: 'dsws-statusbar-seg' },
1652
+ h('span', { className: 'dsws-statusbar-dot', 'data-tone': tone }),
1653
+ label,
1654
+ )),
1655
+ ))
1656
+ }
1657
+
1658
+ if (laterModel.count > 0) {
1659
+ const laterOpen = view.groups['__later'] !== true
1660
+ const laterRows = [h(
1661
+ 'button',
1662
+ {
1663
+ key: 'later-head',
1664
+ type: 'button',
1665
+ className: 'dsws-pinned-group-head dsws-pinned-laterhead',
1666
+ 'aria-expanded': String(laterOpen),
1667
+ 'aria-label': message('later.groupAria'),
1668
+ onClick: () => toggleGroup('__later'),
1669
+ },
1670
+ h('span', { className: 'dsws-pinned-fileglyph' }, bookmarkIcon(false)),
1671
+ h('span', { className: 'dsws-pinned-arrow' }, chevronIcon()),
1672
+ h('span', { className: 'dsws-pinned-group-title' }, message('later.title')),
1673
+ h('span', { className: 'dsws-pinned-group-count' }, String(laterModel.count)),
1674
+ )]
1675
+ if (laterOpen) {
1676
+ for (const entry of laterModel.entries) {
1677
+ laterRows.push(h(
1678
+ 'div',
1679
+ {
1680
+ key: entry.id,
1681
+ className: 'dsws-pinned-row dsws-pinned-laterrow',
1682
+ role: 'treeitem',
1683
+ tabIndex: 0,
1684
+ title: entry.title,
1685
+ onClick: () => open(entry.id),
1686
+ onKeyDown: (event) => {
1687
+ if (event.key !== 'Enter' && event.key !== ' ') return
1688
+ event.preventDefault()
1689
+ open(entry.id)
1690
+ },
1691
+ },
1692
+ h(
1693
+ 'span',
1694
+ { className: 'dsws-pinned-dotslot' },
1695
+ entry.mark === undefined
1696
+ ? null
1697
+ : h('span', { className: 'dsws-pinned-dot', 'data-state': entry.mark }),
1698
+ ),
1699
+ h(
1700
+ 'span',
1701
+ { className: 'dsws-pinned-latertext' },
1702
+ h('span', { className: 'dsws-pinned-row-title' }, entry.title),
1703
+ h(
1704
+ 'span',
1705
+ { className: 'dsws-pinned-laternote' },
1706
+ entry.note !== '' ? entry.note : message('later.noteFallback'),
1707
+ ),
1708
+ ),
1709
+ entry.time === '' ? null : h('span', { className: 'dsws-pinned-time' }, entry.time),
1710
+ h(
1711
+ 'button',
1712
+ {
1713
+ type: 'button',
1714
+ className: 'dsws-pinned-bookmark',
1715
+ 'data-on': 'true',
1716
+ title: message('later.unmark'),
1717
+ 'aria-label': message('later.unmarkAria', { title: entry.title }),
1718
+ onClick: (event) => {
1719
+ event.stopPropagation()
1720
+ setLaterState(clearLater(later, entry.id))
1721
+ },
1722
+ },
1723
+ bookmarkIcon(true),
1724
+ ),
1725
+ ))
1726
+ }
1727
+ }
1728
+ rows.push(h(
1729
+ 'div',
1730
+ { key: 'later-group', className: 'dsws-pinned-group dsws-pinned-latergroup', role: 'group' },
1731
+ laterRows,
1732
+ ))
1733
+ }
1734
+
1340
1735
  if (sectionOpen) {
1341
- for (const group of model.groups) {
1736
+ for (const group of visibleGroups) {
1342
1737
  const expanded = view.groups[group.key] !== true
1343
1738
  const title = group.title !== '' ? group.title : message('activity.unnamed')
1344
1739
  const groupRows = []
@@ -1383,8 +1778,44 @@ window.__ModuleLoader__.load({
1383
1778
  ? null
1384
1779
  : h('span', { className: 'dsws-pinned-dot', 'data-state': session.mark }),
1385
1780
  ),
1386
- h('span', { className: 'dsws-pinned-row-title' }, session.title),
1781
+ editingLater === session.id
1782
+ ? h('input', {
1783
+ className: 'dsws-pinned-note',
1784
+ defaultValue: later[session.id] === undefined ? '' : later[session.id].note,
1785
+ placeholder: message('later.note'),
1786
+ onClick: (event) => event.stopPropagation(),
1787
+ onKeyDown: (event) => {
1788
+ event.stopPropagation()
1789
+ if (event.key === 'Enter') {
1790
+ event.preventDefault()
1791
+ setLaterState(setLater(later, session.id, event.currentTarget.value))
1792
+ setEditingLater(null)
1793
+ } else if (event.key === 'Escape') {
1794
+ event.preventDefault()
1795
+ setEditingLater(null)
1796
+ }
1797
+ },
1798
+ onBlur: (event) => {
1799
+ setLaterState(setLater(later, session.id, event.currentTarget.value))
1800
+ setEditingLater(null)
1801
+ },
1802
+ })
1803
+ : h('span', { className: 'dsws-pinned-row-title' }, session.title),
1387
1804
  session.time === '' ? null : h('span', { className: 'dsws-pinned-time' }, session.time),
1805
+ h(
1806
+ 'button',
1807
+ {
1808
+ type: 'button',
1809
+ className: 'dsws-pinned-bookmark',
1810
+ title: message('later.mark'),
1811
+ 'aria-label': message('later.markAria', { title: session.title }),
1812
+ onClick: (event) => {
1813
+ event.stopPropagation()
1814
+ setEditingLater(session.id)
1815
+ },
1816
+ },
1817
+ bookmarkIcon(false),
1818
+ ),
1388
1819
  h(
1389
1820
  'button',
1390
1821
  {
@@ -1479,6 +1910,23 @@ window.__ModuleLoader__.load({
1479
1910
  [items, byId, statuses, archived, watchRef],
1480
1911
  )
1481
1912
 
1913
+ const branches = React.useMemo(() => branchRows(byId), [byId])
1914
+
1915
+ // The glyph and indent are CSS; the parent's name has to be written onto
1916
+ // the shipped row, once at render and once after the list commits.
1917
+ React.useEffect(() => {
1918
+ if (typeof document === 'undefined') return undefined
1919
+ const apply = () => {
1920
+ syncBranchTitles(document, branches)
1921
+ }
1922
+ apply()
1923
+ if (typeof window === 'undefined' || typeof window.requestAnimationFrame !== 'function') return undefined
1924
+ const raf = window.requestAnimationFrame(apply)
1925
+ return () => {
1926
+ window.cancelAnimationFrame(raf)
1927
+ }
1928
+ }, [branches])
1929
+
1482
1930
  const pinnedModel = React.useMemo(
1483
1931
  () => buildPinnedView(pinned, items, byId, statuses, archived, Date.now()),
1484
1932
  [pinned, items, byId, statuses, archived],
@@ -1520,7 +1968,7 @@ window.__ModuleLoader__.load({
1520
1968
 
1521
1969
 
1522
1970
 
1523
- const cssText = BASE_CSS + PINNED_CSS + rowCss(activity)
1971
+ const cssText = BASE_CSS + PINNED_CSS + rowCss(activity) + branchCss(branches)
1524
1972
  + (portalHost === undefined ? '' : hideCss(pinnedModel.ids))
1525
1973
  const children = [h('style', { key: 'style', 'data-plugin-css': STYLE_ID }, cssText)]
1526
1974
 
@@ -1534,6 +1982,9 @@ window.__ModuleLoader__.load({
1534
1982
  if (pinnedModel.total > 0) {
1535
1983
  const section = h(PinnedSection, {
1536
1984
  model: pinnedModel,
1985
+ sessions: byId,
1986
+ statuses,
1987
+ archived,
1537
1988
  openSession: typeof externalOpenSession === 'function' ? externalOpenSession : noop,
1538
1989
  unpinSession: typeof externalUnpinSession === 'function' ? externalUnpinSession : noopAsync,
1539
1990
  })
@@ -1623,11 +2074,20 @@ window.__ModuleLoader__.load({
1623
2074
  relativeTime,
1624
2075
  buildPinnedView,
1625
2076
  hideCss,
2077
+ branchRows,
2078
+ branchCss,
2079
+ syncBranchTitles,
1626
2080
  sessionMark,
1627
2081
  sessionFacts,
1628
2082
  notificationEvents,
1629
2083
  notificationContent,
2084
+ buildLaterView,
2085
+ readLater,
2086
+ setLater,
2087
+ clearLater,
2088
+ hasLater,
1630
2089
  WorkspaceStatus,
2090
+ PinnedSection,
1631
2091
  FINISHED_WINDOW_MS,
1632
2092
  },
1633
2093
  }
package/locale/en.json CHANGED
@@ -7,9 +7,12 @@
7
7
  "activity.waiting": "{n} waiting for you",
8
8
  "activity.running": "{n} running",
9
9
  "activity.done": "{n} recently finished",
10
+ "activity.later": "{n} later",
10
11
  "activity.unnamed": "Ungrouped",
11
12
  "activity.more": "and {n} more",
12
13
  "activity.listSeparator": ", ",
14
+ "branch.from": "Branched from {title}",
15
+ "branch.fromUnknown": "Branched from an earlier conversation",
13
16
  "pinned.title": "Pinned",
14
17
  "pinned.untitled": "Untitled",
15
18
  "pinned.unpin": "Unpin",
@@ -36,5 +39,13 @@
36
39
  "notify.waiting.title": "{title} needs you",
37
40
  "notify.waiting.body": "{reason} · {workspace}",
38
41
  "notify.finished.title": "{title} finished",
39
- "notify.finished.body": "Finished and not opened yet · {workspace}"
42
+ "notify.finished.body": "Finished and not opened yet · {workspace}",
43
+ "later.title": "Later",
44
+ "later.mark": "Mark for later",
45
+ "later.markAria": "Mark {title} for later",
46
+ "later.unmark": "Stop deferring",
47
+ "later.unmarkAria": "Stop deferring {title}",
48
+ "later.note": "Why later? e.g. waiting for reboot",
49
+ "later.groupAria": "Conversations parked for later",
50
+ "later.noteFallback": "No note"
40
51
  }
package/locale/zh.json CHANGED
@@ -7,9 +7,12 @@
7
7
  "activity.waiting": "{n} 个等待你处理",
8
8
  "activity.running": "{n} 个运行中",
9
9
  "activity.done": "{n} 个刚刚完成",
10
+ "activity.later": "{n} 个稍后处理",
10
11
  "activity.unnamed": "未分组",
11
12
  "activity.more": "等 {n} 个",
12
13
  "activity.listSeparator": "、",
14
+ "branch.from": "分支自 {title}",
15
+ "branch.fromUnknown": "分支自更早的会话",
13
16
  "pinned.title": "已置顶",
14
17
  "pinned.untitled": "未命名",
15
18
  "pinned.unpin": "取消置顶",
@@ -36,5 +39,13 @@
36
39
  "notify.waiting.title": "{title} 需要你",
37
40
  "notify.waiting.body": "{reason} · {workspace}",
38
41
  "notify.finished.title": "{title} 已完成",
39
- "notify.finished.body": "已完成且尚未打开 · {workspace}"
42
+ "notify.finished.body": "已完成且尚未打开 · {workspace}",
43
+ "later.title": "稍后处理",
44
+ "later.mark": "标记为稍后处理",
45
+ "later.markAria": "将 {title} 标记为稍后处理",
46
+ "later.unmark": "取消稍后处理",
47
+ "later.unmarkAria": "取消 {title} 的稍后处理",
48
+ "later.note": "为什么稍后?例如:等待重启",
49
+ "later.groupAria": "已推迟到稍后处理的会话",
50
+ "later.noteFallback": "无备注"
40
51
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-workspace-status",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "description": "Workspace status marks, a pinned-conversation section and pinned-only notifications for the DeepSeek Harness sidebar.",
5
5
  "type": "module",
6
6
  "license": "MIT",