@soffits/dsh-card-board 0.4.0 → 0.4.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 +1 -1
- package/client.js +3 -1
- package/package.json +1 -1
- package/src/schema.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.1
|
|
4
|
+
|
|
5
|
+
- A chat button's `payload.prompt` can be text in several languages like any other text; the other payload fields stay as written.
|
|
6
|
+
|
|
3
7
|
## 0.4.0
|
|
4
8
|
|
|
5
9
|
- Languages: any text on a card or board can be a string or a map of language id to text (`{ "en": "Today", "fr": "Aujourd’hui" }`, `en` required), and the page shows the one for DSH's active language, falling back from the exact tag to its primary language to `en`. Numbers, dates, ages and units are formatted with `Intl` in that language.
|
package/README.md
CHANGED
|
@@ -225,7 +225,7 @@ A card, a list row or a status row can carry up to six buttons:
|
|
|
225
225
|
]
|
|
226
226
|
```
|
|
227
227
|
|
|
228
|
-
- `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; when the board names an `assistant` the button says who it asks. A `label` can be text in several languages.
|
|
228
|
+
- `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; when the board names an `assistant` the button says who it asks. A `label` and `payload.prompt` can be text in several languages.
|
|
229
229
|
- `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.
|
|
230
230
|
- `link` opens `payload.url`.
|
|
231
231
|
|
package/client.js
CHANGED
|
@@ -52,12 +52,14 @@ window.__ModuleLoader__.load({
|
|
|
52
52
|
|
|
53
53
|
/** A card copy whose texts are resolved: walks the whole tree, so every component sees plain strings. */
|
|
54
54
|
function pickCard(card, active) {
|
|
55
|
+
const withPrompt = payload => (payload && 'prompt' in payload ? { ...payload, prompt: pickText(payload.prompt, active) } : payload)
|
|
55
56
|
const walk = value => {
|
|
56
57
|
if (Array.isArray(value)) return value.map(walk)
|
|
57
58
|
if (typeof value !== 'object' || value === null) return value
|
|
58
59
|
const keys = Object.keys(value)
|
|
59
60
|
if (keys.length > 0 && 'en' in value && keys.every(key => /^[a-z]{2,3}(-[a-z0-9]{2,8})*$/.test(key)) && keys.every(key => typeof value[key] === 'string')) return pickText(value, active)
|
|
60
|
-
|
|
61
|
+
// An action's payload is data for handlers, except the words a chat starts with.
|
|
62
|
+
return Object.fromEntries(keys.map(key => [key, key === 'payload' ? withPrompt(value[key]) : walk(value[key])]))
|
|
61
63
|
}
|
|
62
64
|
return walk(card)
|
|
63
65
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soffits/dsh-card-board",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.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/schema.js
CHANGED
|
@@ -168,7 +168,7 @@ function actions(c, list, path) {
|
|
|
168
168
|
if (action.kind === 'snooze' && payload !== undefined && 'until' in payload) c.dateTime(payload.until, join(join(p, 'payload'), 'until'))
|
|
169
169
|
if (action.kind === 'chat' && payload !== undefined) {
|
|
170
170
|
const pp = join(p, 'payload')
|
|
171
|
-
if ('prompt' in payload) c.
|
|
171
|
+
if ('prompt' in payload) c.label(payload.prompt, join(pp, 'prompt'), { max: 2000 })
|
|
172
172
|
if ('session' in payload) c.text(payload.session, join(pp, 'session'), { max: 200 })
|
|
173
173
|
}
|
|
174
174
|
})
|