@soffits/dsh-card-board 0.16.0 → 0.16.1
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 +4 -0
- package/README.md +2 -2
- package/client.js +1 -1
- package/package.json +1 -1
- package/src/access.js +9 -14
- package/src/routes.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.16.1
|
|
4
|
+
|
|
5
|
+
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.
|
|
6
|
+
|
|
3
7
|
## 0.16.0
|
|
4
8
|
|
|
5
9
|
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
|
|
|
@@ -308,7 +308,7 @@ A card, a list row or a status row can carry up to six buttons (a list or status
|
|
|
308
308
|
]
|
|
309
309
|
```
|
|
310
310
|
|
|
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.
|
|
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. 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
312
|
- `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
313
|
- `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
314
|
- `link` opens `payload.url`.
|
package/client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @soffits/dsh-card-board 0.16.
|
|
1
|
+
/* @soffits/dsh-card-board 0.16.1: 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) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soffits/dsh-card-board",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.1",
|
|
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,16 @@ 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')
|
|
130
125
|
return kept.length > 0 ? { ...rest, actions: kept } : rest
|
|
131
126
|
}
|
|
132
127
|
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)
|