@soffits/dsh-card-board 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.
@@ -67,7 +67,26 @@
67
67
  }
68
68
  ],
69
69
  "key": "chore-2",
70
- "icon": "book-open"
70
+ "icon": "book-open",
71
+ "detail": {
72
+ "text": "Three books, due at the branch on Elm Street.",
73
+ "facts": [
74
+ {
75
+ "label": "Renewals left",
76
+ "value": 1
77
+ },
78
+ {
79
+ "label": "Fine per day",
80
+ "value": "0.25 EUR"
81
+ }
82
+ ],
83
+ "history": [
84
+ {
85
+ "at": "2026-02-20T15:10:00+01:00",
86
+ "text": "Borrowed"
87
+ }
88
+ ]
89
+ }
71
90
  },
72
91
  {
73
92
  "title": {
@@ -100,7 +119,8 @@
100
119
  }
101
120
  ],
102
121
  "key": "chore-3",
103
- "icon": "trash-2"
122
+ "icon": "trash-2",
123
+ "link": "https://example.com/heating"
104
124
  }
105
125
  ],
106
126
  "empty": {
@@ -109,5 +129,28 @@
109
129
  }
110
130
  },
111
131
  "icon": "list-todo",
112
- "tone": "accent"
132
+ "tone": "accent",
133
+ "detail": {
134
+ "text": "Chores for the flat, from the shared list.",
135
+ "facts": [
136
+ {
137
+ "label": "Done this week",
138
+ "value": 4
139
+ },
140
+ {
141
+ "label": "Left",
142
+ "value": 3
143
+ }
144
+ ],
145
+ "history": [
146
+ {
147
+ "at": "2026-03-02T08:30:00+01:00",
148
+ "text": "Watered the plants"
149
+ },
150
+ {
151
+ "at": "2026-03-01T18:05:00+01:00",
152
+ "text": "Took the recycling out"
153
+ }
154
+ ]
155
+ }
113
156
  }
@@ -59,7 +59,8 @@
59
59
  "value": 4.3,
60
60
  "icon": "cloud-drizzle"
61
61
  }
62
- ]
62
+ ],
63
+ "link": "https://example.com/forecast"
63
64
  },
64
65
  {
65
66
  "label": {
package/locale/en.json CHANGED
@@ -16,7 +16,6 @@
16
16
  "open": "Open",
17
17
  "listEmpty": "Nothing here.",
18
18
  "checked": "Done",
19
- "unchecked": "Not done",
20
19
  "error.forbidden": "You can’t see this board.",
21
20
  "error.notFound": "This board isn’t there any more.",
22
21
  "error.gone": "This action isn’t on the card any more.",
@@ -36,6 +35,11 @@
36
35
  "dayPart.evening": "evening",
37
36
  "dayPart.night": "night",
38
37
  "showMore": "{n} more",
39
- "showFewer": "Show fewer"
38
+ "showFewer": "Show fewer",
39
+ "details": "Details",
40
+ "close": "Close",
41
+ "history": "History",
42
+ "markDone": "Mark done",
43
+ "rowGone": "This item is no longer on the card."
40
44
  }
41
45
  }
package/locale/fr.json CHANGED
@@ -16,7 +16,6 @@
16
16
  "open": "Ouvrir",
17
17
  "listEmpty": "Rien ici.",
18
18
  "checked": "Fait",
19
- "unchecked": "Pas fait",
20
19
  "error.forbidden": "Vous n’avez pas accès à ce tableau.",
21
20
  "error.notFound": "Ce tableau n’existe plus.",
22
21
  "error.gone": "Cette action n’est plus sur la carte.",
@@ -36,6 +35,11 @@
36
35
  "dayPart.evening": "soir",
37
36
  "dayPart.night": "nuit",
38
37
  "showMore": "{n} de plus",
39
- "showFewer": "Afficher moins"
38
+ "showFewer": "Afficher moins",
39
+ "details": "Détails",
40
+ "close": "Fermer",
41
+ "history": "Historique",
42
+ "markDone": "Marquer comme fait",
43
+ "rowGone": "Cet élément n’est plus sur la carte."
40
44
  }
41
45
  }
package/locale/zh.json CHANGED
@@ -16,7 +16,6 @@
16
16
  "open": "打开",
17
17
  "listEmpty": "暂无",
18
18
  "checked": "已完成",
19
- "unchecked": "未完成",
20
19
  "error.forbidden": "你没有权限查看这个面板。",
21
20
  "error.notFound": "这个面板已经不存在了。",
22
21
  "error.gone": "这个操作已经不在卡片上了。",
@@ -36,6 +35,11 @@
36
35
  "dayPart.evening": "傍晚",
37
36
  "dayPart.night": "夜里",
38
37
  "showMore": "还有 {n} 项",
39
- "showFewer": "收起"
38
+ "showFewer": "收起",
39
+ "details": "详情",
40
+ "close": "关闭",
41
+ "history": "记录",
42
+ "markDone": "标为完成",
43
+ "rowGone": "这一项已经不在卡片上了。"
40
44
  }
41
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soffits/dsh-card-board",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "A data-driven card board for DeepSeek Harness: scripts write small JSON cards, the Web UI shows each person the boards they may see.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/presses.js CHANGED
@@ -108,7 +108,9 @@ export function createPresses({ logPath, publisher, notify = () => {}, timeoutSe
108
108
  const at = now()
109
109
  return events.map(event => {
110
110
  const time = Date.parse(event.at)
111
- const state = written > time ? 'done' : at - time > timeoutSeconds * 1000 ? 'unhandled' : 'pending'
111
+ // A step is carried out by sending it to the assistant (dsh-ui-actions does that right after the press), so it
112
+ // is done once recorded; the others wait for their owner to write the card again.
113
+ const state = event.action === 'step' || written > time ? 'done' : at - time > timeoutSeconds * 1000 ? 'unhandled' : 'pending'
112
114
  return { press: event.press, id: event.id, ...(event.source.row === undefined ? {} : { row: event.source.row }), at: event.at, state }
113
115
  })
114
116
  }
package/src/schema.js CHANGED
@@ -210,12 +210,56 @@ function actions(c, list, path) {
210
210
  })
211
211
  }
212
212
 
213
+ /**
214
+ * The more a card or a row shows when it is opened: some text, facts (label and value), a chart (a line or bar card's
215
+ * data) and a history, newest first. Every part is optional; the opened view also shows the whole body and all actions.
216
+ * Exported so other row shapes can check theirs the same way.
217
+ */
218
+ export function checkDetail(c, detail, path) {
219
+ if (!c.object(detail, path, [], ['text', 'facts', 'chart', 'history'])) return
220
+ c.optional(detail, 'text', v => c.label(v, join(path, 'text'), { max: 2000 }))
221
+ c.optional(detail, 'facts', facts => {
222
+ if (!c.array(facts, join(path, 'facts'), { max: 24 })) return
223
+ facts.forEach((fact, i) => {
224
+ const fp = join(join(path, 'facts'), i)
225
+ if (!c.object(fact, fp, ['label', 'value'])) return
226
+ c.label(fact.label, join(fp, 'label'), { max: 60 })
227
+ c.labelOrNumber(fact.value, join(fp, 'value'))
228
+ })
229
+ })
230
+ c.optional(detail, 'chart', chart => {
231
+ const cp = join(path, 'chart')
232
+ if (!c.object(chart, cp, ['type', 'data'])) return
233
+ if (!c.oneOf(chart.type, join(cp, 'type'), ['line', 'bar'])) return
234
+ DATA[chart.type](c, chart.data, join(cp, 'data'))
235
+ })
236
+ c.optional(detail, 'history', history => {
237
+ if (!c.array(history, join(path, 'history'), { max: 100 })) return
238
+ history.forEach((entry, i) => {
239
+ const hp = join(join(path, 'history'), i)
240
+ if (!c.object(entry, hp, ['at', 'text'])) return
241
+ c.dateTime(entry.at, join(hp, 'at'))
242
+ c.label(entry.text, join(hp, 'text'), { max: 400 })
243
+ })
244
+ })
245
+ }
246
+
247
+ /** A row's `link` (where a tap goes) and `detail` (what opening it shows; the row needs a `key` to be opened). */
248
+ function rowOpen(c, row, path) {
249
+ c.optional(row, 'link', v => isSafeLink(v) || c.fail(join(path, 'link'), 'must be an http(s) URL or a path starting with /'))
250
+ c.optional(row, 'detail', v => {
251
+ checkDetail(c, v, join(path, 'detail'))
252
+ if (row.key === undefined) c.fail(join(path, 'key'), 'is required on a row with a detail: it is how the row is opened')
253
+ })
254
+ }
255
+
213
256
  function statData(c, data, path) {
214
257
  if (!c.object(data, path, ['items'])) return
215
258
  if (!c.array(data.items, join(path, 'items'), { min: 1, max: 6 })) return
216
259
  data.items.forEach((item, i) => {
217
260
  const p = join(join(path, 'items'), i)
218
- if (!c.object(item, p, ['label', 'value'], ['unit', 'delta', 'sub', 'tone', 'spark', 'progress', 'strip'])) return
261
+ if (!c.object(item, p, ['label', 'value'], ['unit', 'delta', 'sub', 'tone', 'spark', 'progress', 'strip', 'link'])) return
262
+ c.optional(item, 'link', v => isSafeLink(v) || c.fail(join(p, 'link'), 'must be an http(s) URL or a path starting with /'))
219
263
  c.label(item.label, join(p, 'label'))
220
264
  c.labelOrNumber(item.value, join(p, 'value'))
221
265
  c.optional(item, 'unit', v => c.label(v, join(p, 'unit'), { max: 20 }))
@@ -350,7 +394,8 @@ function listData(c, data, path) {
350
394
  if (c.array(data.rows, join(path, 'rows'), { max: 100 }))
351
395
  data.rows.forEach((row, i) => {
352
396
  const p = join(join(path, 'rows'), i)
353
- if (!c.object(row, p, ['title'], ['sub', 'chip', 'checked', 'date', 'actions', 'icon', 'tone', 'key', 'active'])) return
397
+ if (!c.object(row, p, ['title'], ['sub', 'chip', 'checked', 'date', 'actions', 'icon', 'tone', 'key', 'active', 'link', 'detail'])) return
398
+ rowOpen(c, row, p)
354
399
  rowLook(c, row, p, keys)
355
400
  c.optional(row, 'actions', v => actions(c, v, join(p, 'actions')))
356
401
  c.label(row.title, join(p, 'title'))
@@ -412,7 +457,8 @@ function statusData(c, data, path) {
412
457
  const keys = new Set()
413
458
  data.rows.forEach((row, i) => {
414
459
  const p = join(join(path, 'rows'), i)
415
- if (!c.object(row, p, ['label', 'value', 'tone'], ['sub', 'spark', 'actions', 'icon', 'key', 'active'])) return
460
+ if (!c.object(row, p, ['label', 'value', 'tone'], ['sub', 'spark', 'actions', 'icon', 'key', 'active', 'link', 'detail'])) return
461
+ rowOpen(c, row, p)
416
462
  rowLook(c, row, p, keys, { toneRequired: true })
417
463
  c.optional(row, 'actions', v => actions(c, v, join(p, 'actions')))
418
464
  c.label(row.label, join(p, 'label'))
@@ -491,7 +537,8 @@ export function isSafeLink(value) {
491
537
  /** Problems with one card file's parsed content. */
492
538
  export function checkCard(card) {
493
539
  const c = new Check()
494
- if (!c.object(card, '', ['type', 'title', 'updatedAt', 'data'], ['staleAfter', 'link', 'stat', 'actions', 'icon', 'tone'])) return c.problems
540
+ if (!c.object(card, '', ['type', 'title', 'updatedAt', 'data'], ['staleAfter', 'link', 'stat', 'actions', 'icon', 'tone', 'detail'])) return c.problems
541
+ c.optional(card, 'detail', v => checkDetail(c, v, 'detail'))
495
542
  if (!c.oneOf(card.type, 'type', CARD_TYPES)) return c.problems
496
543
  c.label(card.title, 'title', { max: 120 })
497
544
  c.dateTime(card.updatedAt, 'updatedAt')