@soffits/dsh-card-board 0.16.0 → 0.17.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 +8 -0
- package/README.md +5 -4
- package/client.js +20 -2
- package/examples/boards/home/cards/chores.json +13 -0
- package/package.json +1 -1
- package/src/access.js +10 -14
- package/src/routes.js +2 -2
- package/src/schema.js +20 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.17.0
|
|
4
|
+
|
|
5
|
+
A `detail` can carry `actions`: buttons shown only when its card or row is opened, below the detail, and pressed like any other (the server finds them by id on that card or row). They let a row stay short on the board, a chip and a snooze, while its answers sit under the note that asks the question. View-only viewers get none of them, as with the row's own buttons. Why: `docs/decisions/detail-actions.md`.
|
|
6
|
+
|
|
7
|
+
## 0.16.1
|
|
8
|
+
|
|
9
|
+
Someone who may see a board but isn't an actor no longer gets its declared chat buttons. Those are the board owner's buttons, often a prompt in the owner's own words ("My answer to …:"), so a view-only viewer could still speak for the owner through a conversation. Now only plain `link` buttons survive the filter, plus the page's own "Chat about this" and "Ask", which ask about what the viewer sees in their own new conversation. A row whose chat button is taken away gets the built-in "Ask" back.
|
|
10
|
+
|
|
3
11
|
## 0.16.0
|
|
4
12
|
|
|
5
13
|
A board can say who may act on it: `actors` in `board.json` lists the viewers who may press its buttons, and without it every viewer may, so existing boards behave as before. Someone who may see a board but isn't an actor gets it with its `done`, `snooze`, `step` and `event` buttons left out (chat and link stay, and a chat button never names someone else's session), a "View only" note beside the title (English, French and Chinese) and a 403 on any press or undo. All decided on the server. Why: `docs/decisions/board-actors.md`.
|
package/README.md
CHANGED
|
@@ -48,7 +48,7 @@ With no `people` and no `peopleFile`, the plugin assumes a single-person DSH: ev
|
|
|
48
48
|
|
|
49
49
|
With a mapping, each request is checked on the server. The plugin asks the `requestIdentity` service who made the request, maps that user id to a person id, and serves only boards whose `viewers` list that person. A request without a verified identity sees no boards; a board the person may not see answers 403, the same as one that doesn't exist. The tabs in the page come only from the server's list. Person ids compare without regard to case.
|
|
50
50
|
|
|
51
|
-
Seeing and acting are separate. A board can name `actors`, the people who may press its buttons; without it, the viewers may, so a board that never heard of `actors` behaves as it always did. Someone who may see a board but isn't an actor gets it
|
|
51
|
+
Seeing and acting are separate. A board can name `actors`, the people who may press its buttons; without it, the viewers may, so a board that never heard of `actors` behaves as it always did. Someone who may see a board but isn't an actor gets it without any button the board declares (`done`, `snooze`, `step`, `event` and `chat`; plain `link` buttons stay) and with a "View only" note beside the title, and their presses answer 403. A declared chat button is the board owner's, speaking in the owner's words, so it goes with the rest; the page's own "Chat about this" and "Ask" stay, since they ask the assistant about what the viewer sees, in the viewer's own new conversation. Acting needs seeing: naming someone in `actors` who isn't in `viewers` gives them nothing. Reading, marking cards seen and arranging the board for yourself stay open to every viewer, since they only touch the viewer's own view. This is how a person lets someone they trust look at their board without that person's taps landing on their items: `"viewers": ["alex", "sam"], "actors": ["alex"]`. Why it is shaped this way: [docs/decisions/board-actors.md](docs/decisions/board-actors.md).
|
|
52
52
|
|
|
53
53
|
`requestIdentity` is a small service any sign-in plugin can provide. [dsh-oidc](https://github.com/soffits/dsh-oidc) (0.3.0-alpha.9 or later) does; another plugin can provide the same interface:
|
|
54
54
|
|
|
@@ -285,11 +285,12 @@ Tapping a card (anywhere that isn't one of its buttons, links or rows that open
|
|
|
285
285
|
"text": "Three books, due at the branch on Elm Street.",
|
|
286
286
|
"facts": [{ "label": "Renewals left", "value": 1 }, { "label": "Fine per day", "value": "0.25 EUR" }],
|
|
287
287
|
"chart": { "type": "bar", "data": { "bars": [{ "x": "2026-02", "value": 4 }, { "x": "2026-03", "value": 3 }] } },
|
|
288
|
-
"history": [{ "at": "2026-02-20T15:10:00+01:00", "text": "Borrowed" }]
|
|
288
|
+
"history": [{ "at": "2026-02-20T15:10:00+01:00", "text": "Borrowed" }],
|
|
289
|
+
"actions": [{ "kind": "done", "id": "library-books:returned-elm", "label": "Returned at Elm Street" }]
|
|
289
290
|
}
|
|
290
291
|
```
|
|
291
292
|
|
|
292
|
-
Every part is optional: `text`, `facts` (label and value, up to 24), `chart` (a `line` or `bar` card's `data`)
|
|
293
|
+
Every part is optional: `text`, `facts` (label and value, up to 24), `chart` (a `line` or `bar` card's `data`), `history` (newest first, up to 100) and `actions`, buttons shown only in the opened view, below the detail ([Actions](#actions); their ids must differ from the card's or row's own buttons, since a press names its button by id). Buttons that only make sense with the detail in view go there, so the row on the board stays short: a question's answers under the note that asks it, with only a chip and a snooze on the row. A row needs a `key` to carry a `detail`.
|
|
293
294
|
|
|
294
295
|
On a chart, hovering or tapping shows the value and date of the point under the pointer. Cards and rows answer a hover and a press; a row's buttons show on hover with a mouse and are always there on touch. A card that changes settles into place, numbers ease to their new value and rows that a list opens fade in; nothing moves with reduced motion. Buttons, tags, axes and other chrome aren't selectable; titles, notes and numbers are.
|
|
295
296
|
|
|
@@ -308,7 +309,7 @@ A card, a list row or a status row can carry up to six buttons (a list or status
|
|
|
308
309
|
]
|
|
309
310
|
```
|
|
310
311
|
|
|
311
|
-
- `chat` opens a new conversation (or the session named in `payload.session`) with a draft that quotes the card or row and carries its ids as JSON, after `payload.prompt` if you gave one. Nothing is sent until the person sends it, so the message comes from them like any other. Every card also has a chat button in its corner without declaring one ("Chat about this"), and every list and status row has one at the end of its buttons ("Ask"), about that row and its card; a row that declares a `chat` action keeps its own, and one with six buttons already gets none. Set `ask: false` on a row, or on a card for all its rows, where asking makes no sense (a row that only says "nothing else today"). When the board names an `assistant` the buttons say who they ask ("Ask Robin"). A `label` and `payload.prompt` can be text in several languages.
|
|
312
|
+
- `chat` opens a new conversation (or the session named in `payload.session`) with a draft that quotes the card or row and carries its ids as JSON, after `payload.prompt` if you gave one. Nothing is sent until the person sends it, so the message comes from them like any other. Every card also has a chat button in its corner without declaring one ("Chat about this"), and every list and status row has one at the end of its buttons ("Ask"), about that row and its card; a row that declares a `chat` action keeps its own, and one with six buttons already gets none. Set `ask: false` on a row, or on a card for all its rows, where asking makes no sense (a row that only says "nothing else today"). When the board names an `assistant` the buttons say who they ask ("Ask Robin"). A `label` and `payload.prompt` can be text in several languages. People who may see a board but not act on it ([Who sees what](#who-sees-what)) get none of its declared buttons, chat included, only the built-in two.
|
|
312
313
|
- `step` is a suggested next step the assistant starts on one tap (on a row it sits with the row's other buttons, "Start" for instance): the label says the step plainly ("Renew the books online") and the tap is the person's go-ahead for exactly that. The press is recorded on the server like `done`, then the page sends the step (`payload.prompt` when it needs more words than the label, never more than it authorises; otherwise the label) with the card or row into a new session (or `payload.session`) as the person, with no draft to confirm, and the button links to that session. At most 3 steps per card or row; add one only where the data has a clear next step. The label (up to 80 characters) is required.
|
|
313
314
|
- `done`, `snooze` and `event` are pressed on the server. A snooze without `payload.until` asks: in 3 hours, tomorrow at 9:00, or a time.
|
|
314
315
|
- `link` opens `payload.url`.
|
package/client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @soffits/dsh-card-board 0.
|
|
1
|
+
/* @soffits/dsh-card-board 0.17.0: built by scripts/build.mjs from src/client/. Do not edit. */
|
|
2
2
|
window.__ModuleLoader__.load({
|
|
3
3
|
id: "@soffits/dsh-card-board",
|
|
4
4
|
factory: (require) => {
|
|
@@ -1540,6 +1540,16 @@ function Card({ entry, live, boardId, assistant, tracks, active, locale, t, pres
|
|
|
1540
1540
|
about: about(),
|
|
1541
1541
|
onPress: onPress({})
|
|
1542
1542
|
}));
|
|
1543
|
+
const opened = sheet && actions && card.detail?.actions?.length > 0 && [
|
|
1544
|
+
card.detail.actions.some((action) => action.kind === "step") && (0, import_react10.createElement)(kit.Suggested, { key: "steps", actions: card.detail.actions, about: about(), states: statesOf(entry.presses, void 0), onPress: onPress({}) }),
|
|
1545
|
+
(0, import_react10.createElement)("footer", { key: "buttons", className: "cb-cardActions" }, (0, import_react10.createElement)(actions.ActionBar, {
|
|
1546
|
+
actions: named(card.detail.actions.filter((action) => action.kind !== "step")),
|
|
1547
|
+
part: "buttons",
|
|
1548
|
+
states: statesOf(entry.presses, void 0),
|
|
1549
|
+
about: about(),
|
|
1550
|
+
onPress: onPress({})
|
|
1551
|
+
}))
|
|
1552
|
+
];
|
|
1543
1553
|
const openable = !sheet && onOpen && card.type !== "summary";
|
|
1544
1554
|
const className = ["cb-card", `cb-card-${card.type}`, stale && "cb-cardStale", openable && "cb-cardOpenable", sheet && "cb-cardInSheet", raised && "cb-cardRaised", dragging && "cb-cardDragging", wash].filter(Boolean).join(" ");
|
|
1545
1555
|
const openOnTap = openable ? { onClick: (event) => {
|
|
@@ -1550,6 +1560,7 @@ function Card({ entry, live, boardId, assistant, tracks, active, locale, t, pres
|
|
|
1550
1560
|
const index = card.data.rows?.findIndex((r) => r.key === openRow) ?? -1;
|
|
1551
1561
|
const target = index >= 0 ? card.data.rows[index] : null;
|
|
1552
1562
|
if (!target) return (0, import_react10.createElement)("p", { className: "cb-muted" }, t("rowGone"));
|
|
1563
|
+
const opened2 = target.detail?.actions ?? [];
|
|
1553
1564
|
return (0, import_react10.createElement)(
|
|
1554
1565
|
"div",
|
|
1555
1566
|
{ className: "cb-rowSheet" },
|
|
@@ -1563,7 +1574,13 @@ function Card({ entry, live, boardId, assistant, tracks, active, locale, t, pres
|
|
|
1563
1574
|
all: true,
|
|
1564
1575
|
rowControls: { ...rowControls, kept: [], press: (_, action) => rowControls.press(index, action), state: (_, id) => rowControls.state(index, id), latest: (_, id) => rowControls.latest(index, id) }
|
|
1565
1576
|
}),
|
|
1566
|
-
(0, import_react10.createElement)(DetailParts, { detail: target.detail, locale, t })
|
|
1577
|
+
(0, import_react10.createElement)(DetailParts, { detail: target.detail, locale, t }),
|
|
1578
|
+
rowActions && opened2.length > 0 && (0, import_react10.createElement)(
|
|
1579
|
+
"footer",
|
|
1580
|
+
{ className: "cb-cardActions" },
|
|
1581
|
+
opened2.some((action) => action.kind === "step") && rowActions(index, opened2, "steps"),
|
|
1582
|
+
rowActions(index, opened2, "buttons")
|
|
1583
|
+
)
|
|
1567
1584
|
);
|
|
1568
1585
|
}
|
|
1569
1586
|
if (card.type === "summary") {
|
|
@@ -1601,6 +1618,7 @@ function Card({ entry, live, boardId, assistant, tracks, active, locale, t, pres
|
|
|
1601
1618
|
),
|
|
1602
1619
|
statBlock && ["line", "bar", "donut"].includes(card.type) ? (0, import_react10.createElement)("div", { className: "cb-split" }, statBlock, (0, import_react10.createElement)("div", { className: "cb-cardBody" }, body)) : [statBlock && (0, import_react10.createElement)("div", { key: "stat" }, statBlock), (0, import_react10.createElement)("div", { key: "body", className: "cb-cardBody" }, body)],
|
|
1603
1620
|
sheet && (0, import_react10.createElement)(DetailParts, { detail: card.detail, locale, t }),
|
|
1621
|
+
opened,
|
|
1604
1622
|
steps,
|
|
1605
1623
|
footer,
|
|
1606
1624
|
sheet && chat && (0, import_react10.createElement)("div", { className: "cb-sheetChat" }, chat)
|
|
@@ -87,6 +87,19 @@
|
|
|
87
87
|
"at": "2026-02-20T15:10:00+01:00",
|
|
88
88
|
"text": "Borrowed"
|
|
89
89
|
}
|
|
90
|
+
],
|
|
91
|
+
"actions": [
|
|
92
|
+
{
|
|
93
|
+
"kind": "done",
|
|
94
|
+
"id": "library-books:returned-elm",
|
|
95
|
+
"label": {
|
|
96
|
+
"en": "Returned at Elm Street",
|
|
97
|
+
"zh": "在榆树街还了"
|
|
98
|
+
},
|
|
99
|
+
"payload": {
|
|
100
|
+
"branch": "elm"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
90
103
|
]
|
|
91
104
|
}
|
|
92
105
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soffits/dsh-card-board",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.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/access.js
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* plugin that verifies the person behind an `/api` request can provide it
|
|
6
6
|
* (`current()` returns `{ id, ... }` or null). The verified user id maps to a
|
|
7
7
|
* person id through the configured mapping, and a board lists the person ids
|
|
8
|
-
* that may see it in `viewers`. A board can also say who may act on it (
|
|
9
|
-
*
|
|
8
|
+
* that may see it in `viewers`. A board can also say who may act on it (use the buttons it declares) in `actors`;
|
|
9
|
+
* without `actors` the viewers may, so a board that never heard of the field behaves as before.
|
|
10
10
|
* Acting needs seeing: a name in `actors` that isn't in `viewers` gets nothing extra.
|
|
11
11
|
*
|
|
12
12
|
* Two modes:
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
* which is what a single-person DSH wants.
|
|
18
18
|
*/
|
|
19
19
|
import { readFile, stat } from 'node:fs/promises'
|
|
20
|
-
import { PRESS_KINDS } from './schema.js'
|
|
21
20
|
|
|
22
21
|
/** Person ids compare without regard to case or surrounding space. */
|
|
23
22
|
export function personKey(value) {
|
|
@@ -113,20 +112,17 @@ export function mayAct(viewer, board) {
|
|
|
113
112
|
}
|
|
114
113
|
|
|
115
114
|
/**
|
|
116
|
-
* A card as someone who may see but not act gets it:
|
|
117
|
-
*
|
|
118
|
-
*
|
|
115
|
+
* A card as someone who may see but not act gets it: every button it declares is left out except plain links. Buttons
|
|
116
|
+
* belong to the people who may act on the board, and a declared chat button is one of them (it asks in the owner's
|
|
117
|
+
* words, for the owner), only routed through a conversation. The page's own "Chat about this" and "Ask" are not on
|
|
118
|
+
* the card, so they stay: they ask about what the viewer sees, in the viewer's own new conversation.
|
|
119
119
|
*/
|
|
120
|
-
export function
|
|
121
|
-
|
|
122
|
-
if (action.kind !== 'chat' || action.payload?.session === undefined) return action
|
|
123
|
-
const { session: _theirs, ...payload } = action.payload
|
|
124
|
-
return { ...action, payload }
|
|
125
|
-
}
|
|
126
|
-
/** `holder` without its `actions` key, then with the ones that stay if any. */
|
|
120
|
+
export function withoutActions(card) {
|
|
121
|
+
/** `holder` without its `actions` key, then with the links if any. */
|
|
127
122
|
const trimmed = holder => {
|
|
128
123
|
const { actions, ...rest } = holder
|
|
129
|
-
const kept = (actions ?? []).filter(action =>
|
|
124
|
+
const kept = (actions ?? []).filter(action => action.kind === 'link')
|
|
125
|
+
if (Array.isArray(rest.detail?.actions)) rest.detail = trimmed(rest.detail)
|
|
130
126
|
return kept.length > 0 ? { ...rest, actions: kept } : rest
|
|
131
127
|
}
|
|
132
128
|
const rows = card.data?.rows
|
package/src/routes.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* in it is new since the viewer last looked, `fresh: { card: true, rows: [keys] }`.
|
|
18
18
|
*/
|
|
19
19
|
import { join } from 'node:path'
|
|
20
|
-
import { mayAct, maySee, maySeeCard, viewerOf,
|
|
20
|
+
import { mayAct, maySee, maySeeCard, viewerOf, withoutActions } from './access.js'
|
|
21
21
|
import { parseArrangement } from './arrange.js'
|
|
22
22
|
import { LANGUAGE_ID } from './messages.js'
|
|
23
23
|
import { ID_PATTERN, PRESS_KINDS, findAction } from './schema.js'
|
|
@@ -77,7 +77,7 @@ export function createRoutes({ dataDir, people, identity, pollSeconds, presses,
|
|
|
77
77
|
|
|
78
78
|
/** A card entry with its versions, its press states and what is new in it for this viewer. */
|
|
79
79
|
function decorate(card, states, seenBoard, canAct) {
|
|
80
|
-
if (!canAct && card.card !== undefined) card = { ...card, card:
|
|
80
|
+
if (!canAct && card.card !== undefined) card = { ...card, card: withoutActions(card.card) }
|
|
81
81
|
let entry = states[card.id] ? { ...card, presses: states[card.id] } : card
|
|
82
82
|
if (card.card === undefined) return entry
|
|
83
83
|
const versions = cardVersions(card.card)
|
package/src/schema.js
CHANGED
|
@@ -245,11 +245,13 @@ function actions(c, list, path) {
|
|
|
245
245
|
|
|
246
246
|
/**
|
|
247
247
|
* 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
|
|
248
|
-
* data)
|
|
249
|
-
*
|
|
248
|
+
* data), a history, newest first, and buttons that only make sense with all of that in view. Every part is optional;
|
|
249
|
+
* the opened view also shows the whole body and all actions. `own` is the holder's own actions: an opened button's
|
|
250
|
+
* id must differ from them, since a press names its button by id. Exported so other row shapes can check theirs the
|
|
251
|
+
* same way.
|
|
250
252
|
*/
|
|
251
|
-
export function checkDetail(c, detail, path) {
|
|
252
|
-
if (!c.object(detail, path, [], ['text', 'facts', 'chart', 'history'])) return
|
|
253
|
+
export function checkDetail(c, detail, path, own = []) {
|
|
254
|
+
if (!c.object(detail, path, [], ['text', 'facts', 'chart', 'history', 'actions'])) return
|
|
253
255
|
c.optional(detail, 'text', v => c.label(v, join(path, 'text'), { max: 2000 }))
|
|
254
256
|
c.optional(detail, 'facts', facts => {
|
|
255
257
|
if (!c.array(facts, join(path, 'facts'), { max: 24 })) return
|
|
@@ -266,6 +268,12 @@ export function checkDetail(c, detail, path) {
|
|
|
266
268
|
if (!c.oneOf(chart.type, join(cp, 'type'), ['line', 'bar'])) return
|
|
267
269
|
DATA[chart.type](c, chart.data, join(cp, 'data'))
|
|
268
270
|
})
|
|
271
|
+
c.optional(detail, 'actions', list => {
|
|
272
|
+
const ap = join(path, 'actions')
|
|
273
|
+
actions(c, list, ap)
|
|
274
|
+
const taken = new Set((Array.isArray(own) ? own : []).map(action => action?.id))
|
|
275
|
+
if (Array.isArray(list)) list.forEach((action, i) => { if (taken.has(action?.id)) c.fail(join(join(ap, i), 'id'), 'repeats one of the buttons it opens from') })
|
|
276
|
+
})
|
|
269
277
|
c.optional(detail, 'history', history => {
|
|
270
278
|
if (!c.array(history, join(path, 'history'), { max: 100 })) return
|
|
271
279
|
history.forEach((entry, i) => {
|
|
@@ -281,7 +289,7 @@ export function checkDetail(c, detail, path) {
|
|
|
281
289
|
function rowOpen(c, row, path) {
|
|
282
290
|
c.optional(row, 'link', v => isSafeLink(v) || c.fail(join(path, 'link'), 'must be an http(s) URL or a path starting with /'))
|
|
283
291
|
c.optional(row, 'detail', v => {
|
|
284
|
-
checkDetail(c, v, join(path, 'detail'))
|
|
292
|
+
checkDetail(c, v, join(path, 'detail'), row.actions)
|
|
285
293
|
if (row.key === undefined) c.fail(join(path, 'key'), 'is required on a row with a detail: it is how the row is opened')
|
|
286
294
|
})
|
|
287
295
|
}
|
|
@@ -578,7 +586,7 @@ export function checkCard(card) {
|
|
|
578
586
|
if (!c.object(card, '', ['type', 'title', 'updatedAt', 'data'], ['staleAfter', 'link', 'stat', 'actions', 'icon', 'tone', 'detail', 'raise', 'ask'])) return c.problems
|
|
579
587
|
c.optional(card, 'ask', v => c.boolean(v, 'ask'))
|
|
580
588
|
c.optional(card, 'raise', v => raiseWindow(c, v, 'raise'))
|
|
581
|
-
c.optional(card, 'detail', v => checkDetail(c, v, 'detail'))
|
|
589
|
+
c.optional(card, 'detail', v => checkDetail(c, v, 'detail', card.actions))
|
|
582
590
|
if (!c.oneOf(card.type, 'type', CARD_TYPES)) return c.problems
|
|
583
591
|
c.label(card.title, 'title', { max: 120 })
|
|
584
592
|
c.dateTime(card.updatedAt, 'updatedAt')
|
|
@@ -597,12 +605,14 @@ export function checkCard(card) {
|
|
|
597
605
|
|
|
598
606
|
/**
|
|
599
607
|
* The action a press names, looked up in the card as written: on the card
|
|
600
|
-
* itself, or on row `row` of a list or status card
|
|
601
|
-
*
|
|
608
|
+
* itself, or on row `row` of a list or status card, among its own buttons and
|
|
609
|
+
* those its detail shows when opened. Undefined when there is no such action,
|
|
610
|
+
* so a browser can only press what the data offers.
|
|
602
611
|
*/
|
|
603
612
|
export function findAction(card, actionId, row) {
|
|
604
|
-
const
|
|
605
|
-
|
|
613
|
+
const holder = row === undefined ? card : card?.data?.rows?.[row]
|
|
614
|
+
const list = [holder?.actions, holder?.detail?.actions].flatMap(value => (Array.isArray(value) ? value : []))
|
|
615
|
+
return list.find(action => action?.id === actionId)
|
|
606
616
|
}
|
|
607
617
|
|
|
608
618
|
/** Problems with a board.json's parsed content. */
|