@soffits/dsh-card-board 0.11.0 → 0.12.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 CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.12.0
4
+
5
+ - Every list and status row now has an Ask button without declaring one, the way every card has its chat button: it opens a new conversation with that row and its card attached ("Ask Robin" when the board names an `assistant`). A row that declares its own `chat` action keeps it, and a row with all six buttons taken gets none. Rows without a `key` get it too: the chat names the row by its place in the card.
6
+ - New `ask` field, a boolean on a card (all its rows) or on a row: `false` leaves the default button out. The card's corner button is unchanged.
7
+
3
8
  ## 0.11.0
4
9
 
5
10
  - Each person can arrange a board for themselves: drag a card (mouse: by the handle on hover; touch: press and hold the head), or use its menu (Pin to top, Move up, Move down; Alt+↑/↓ on the menu button). Pinned cards come first, and **Reset order** goes back to the board's `order`, which stays the default. The arrangement is stored once by the plugin per person (`<dataDir>/.arrange/`, the same identity as who sees what), follows them across devices and reaches their other open pages through the events stream (`{ "type": "arrange" }`). A card the person never placed goes where the board's order puts it.
package/README.md CHANGED
@@ -289,7 +289,7 @@ On a chart, hovering or tapping shows the value and date of the point under the
289
289
 
290
290
  ## Actions
291
291
 
292
- A card, a list row or a status row can carry up to six buttons:
292
+ A card, a list row or a status row can carry up to six buttons (a list or status row also gets the Ask button below):
293
293
 
294
294
  ```json
295
295
  "actions": [
@@ -302,7 +302,7 @@ A card, a list row or a status row can carry up to six buttons:
302
302
  ]
303
303
  ```
304
304
 
305
- - `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"); 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.
305
+ - `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.
306
306
  - `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.
307
307
  - `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.
308
308
  - `link` opens `payload.url`.
package/client.js CHANGED
@@ -1,4 +1,4 @@
1
- /* @soffits/dsh-card-board 0.11.0: built by scripts/build.mjs from src/client/. Do not edit. */
1
+ /* @soffits/dsh-card-board 0.12.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) => {
@@ -966,6 +966,15 @@ function doneState(row, latest) {
966
966
  }
967
967
  var withKept = (kept = [], entry) => [...kept.filter((other) => other.id !== entry.id), entry];
968
968
 
969
+ // src/client/ask.js
970
+ var MAX_ACTIONS = 6;
971
+ function rowButtons(row, cardAsk) {
972
+ const own = row.actions ?? [];
973
+ if (row.ask === false || cardAsk === false) return own;
974
+ if (own.some((action) => action.kind === "chat") || own.length >= MAX_ACTIONS) return own;
975
+ return [...own, { kind: "chat", id: "_ask" }];
976
+ }
977
+
969
978
  // src/client/cards.js
970
979
  var STATE_OF_TONE = { ok: "done", warn: "warning", bad: "error" };
971
980
  var DIRECTION_ICON = { up: "trending-up", down: "trending-down" };
@@ -1027,7 +1036,7 @@ function RowWhen({ row, locale, t }) {
1027
1036
  }
1028
1037
  return row.date ? (0, import_react6.createElement)("span", { className: "cb-when" }, (0, import_react6.createElement)(kit.RelativeDay, { date: row.date })) : null;
1029
1038
  }
1030
- function Row({ lead, title, sub, meta, value, spark, row, index, washCount, fresh, rowActions, className, onOpenRow }) {
1039
+ function Row({ lead, title, sub, meta, value, spark, row, index, washCount, fresh, rowActions, ask, className, onOpenRow }) {
1031
1040
  const kit = useKit();
1032
1041
  const now = kit.useNow();
1033
1042
  const wash = kit.useWash(washCount, row.key);
@@ -1049,6 +1058,7 @@ function Row({ lead, title, sub, meta, value, spark, row, index, washCount, fres
1049
1058
  }
1050
1059
  }
1051
1060
  };
1061
+ const buttons = rowActions && rowButtons(row, ask);
1052
1062
  return (0, import_react6.createElement)(
1053
1063
  "li",
1054
1064
  { className: ["cb-row", className, isActive(row.active, now) && "cb-rowNow", go && "cb-rowOpens", wash].filter(Boolean).join(" "), ...opens },
@@ -1063,11 +1073,11 @@ function Row({ lead, title, sub, meta, value, spark, row, index, washCount, fres
1063
1073
  meta,
1064
1074
  value,
1065
1075
  // The row's own buttons on the right: its steps first (a step starts the work on one tap), then the others.
1066
- row.actions && rowActions && (0, import_react6.createElement)(
1076
+ buttons?.length > 0 && (0, import_react6.createElement)(
1067
1077
  "span",
1068
1078
  { className: "cb-rowActions" },
1069
- row.actions.some((action) => action.kind === "step") && rowActions(index, row.actions, "steps"),
1070
- rowActions(index, row.actions, "buttons")
1079
+ buttons.some((action) => action.kind === "step") && rowActions(index, buttons, "steps"),
1080
+ rowActions(index, buttons, "buttons")
1071
1081
  )
1072
1082
  );
1073
1083
  }
@@ -1090,7 +1100,7 @@ function DoneBox({ row, index, done, rowControls, t }) {
1090
1100
  );
1091
1101
  }
1092
1102
  var rowLive = (live, row) => ({ washCount: live.rows?.[row.key] ?? 0, fresh: row.key !== void 0 && live.freshRows.has(row.key) });
1093
- function ListCard({ data, live, locale, t, rowActions, all = false, onOpenRow, rowControls }) {
1103
+ function ListCard({ data, live, locale, t, rowActions, ask, all = false, onOpenRow, rowControls }) {
1094
1104
  const kit = useKit();
1095
1105
  const [open, setOpen] = (0, import_react6.useState)(false);
1096
1106
  const listed = keepTicked(data.rows, rowControls?.kept);
@@ -1125,6 +1135,7 @@ function ListCard({ data, live, locale, t, rowActions, all = false, onOpenRow, r
1125
1135
  index: data.rows.indexOf(row),
1126
1136
  row: doneOf(row) && rowControls ? { ...row, actions: row.actions.filter((a) => a.kind !== "done") } : row,
1127
1137
  rowActions: data.rows.includes(row) ? rowActions : void 0,
1138
+ ask,
1128
1139
  onOpenRow,
1129
1140
  className: [i >= LIST_ROWS && "cb-rowLate", ticked(row) && "cb-done"].filter(Boolean).join(" ") || void 0,
1130
1141
  ...rowLive(live, row),
@@ -1148,13 +1159,14 @@ function ListCard({ data, live, locale, t, rowActions, all = false, onOpenRow, r
1148
1159
  )
1149
1160
  );
1150
1161
  }
1151
- function StatusCard({ data, live, locale, rowActions, onOpenRow }) {
1162
+ function StatusCard({ data, live, locale, rowActions, ask, onOpenRow }) {
1152
1163
  const kit = useKit();
1153
1164
  return (0, import_react6.createElement)("ul", { className: "cb-rows" }, data.rows.map((row, i) => (0, import_react6.createElement)(Row, {
1154
1165
  key: row.key ?? i,
1155
1166
  index: i,
1156
1167
  row,
1157
1168
  rowActions,
1169
+ ask,
1158
1170
  onOpenRow,
1159
1171
  ...rowLive(live, row),
1160
1172
  className: "cb-statusRow",
@@ -1428,9 +1440,9 @@ function Body({ card, live, wash, locale, t, rowActions, all, onOpenRow, rowCont
1428
1440
  case "stat":
1429
1441
  return (0, import_react10.createElement)(StatBlock, { data, locale, wash });
1430
1442
  case "list":
1431
- return (0, import_react10.createElement)(ListCard, { data, live, locale, t, rowActions, all, onOpenRow, rowControls });
1443
+ return (0, import_react10.createElement)(ListCard, { data, live, locale, t, rowActions, ask: card.ask, all, onOpenRow, rowControls });
1432
1444
  case "status":
1433
- return (0, import_react10.createElement)(StatusCard, { data, live, locale, rowActions, onOpenRow });
1445
+ return (0, import_react10.createElement)(StatusCard, { data, live, locale, rowActions, ask: card.ask, onOpenRow });
1434
1446
  case "countdown":
1435
1447
  return (0, import_react10.createElement)(CountdownBody, { card, locale });
1436
1448
  default: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soffits/dsh-card-board",
3
- "version": "0.11.0",
3
+ "version": "0.12.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/schema.js CHANGED
@@ -425,10 +425,11 @@ function listData(c, data, path) {
425
425
  if (c.array(data.rows, join(path, 'rows'), { max: 100 }))
426
426
  data.rows.forEach((row, i) => {
427
427
  const p = join(join(path, 'rows'), i)
428
- if (!c.object(row, p, ['title'], ['sub', 'chip', 'checked', 'date', 'actions', 'icon', 'tone', 'key', 'active', 'link', 'detail'])) return
428
+ if (!c.object(row, p, ['title'], ['sub', 'chip', 'checked', 'date', 'actions', 'icon', 'tone', 'key', 'active', 'link', 'detail', 'ask'])) return
429
429
  rowOpen(c, row, p)
430
430
  rowLook(c, row, p, keys)
431
431
  c.optional(row, 'actions', v => actions(c, v, join(p, 'actions')))
432
+ c.optional(row, 'ask', v => c.boolean(v, join(p, 'ask')))
432
433
  c.label(row.title, join(p, 'title'))
433
434
  c.optional(row, 'sub', v => c.label(v, join(p, 'sub')))
434
435
  c.optional(row, 'checked', v => c.boolean(v, join(p, 'checked')))
@@ -488,7 +489,7 @@ function statusData(c, data, path) {
488
489
  const keys = new Set()
489
490
  data.rows.forEach((row, i) => {
490
491
  const p = join(join(path, 'rows'), i)
491
- if (!c.object(row, p, ['label', 'value', 'tone'], ['sub', 'spark', 'actions', 'icon', 'key', 'active', 'link', 'detail'])) return
492
+ if (!c.object(row, p, ['label', 'value', 'tone'], ['sub', 'spark', 'actions', 'icon', 'key', 'active', 'link', 'detail', 'ask'])) return
492
493
  rowOpen(c, row, p)
493
494
  rowLook(c, row, p, keys, { toneRequired: true })
494
495
  c.optional(row, 'actions', v => actions(c, v, join(p, 'actions')))
@@ -568,7 +569,8 @@ export function isSafeLink(value) {
568
569
  /** Problems with one card file's parsed content. */
569
570
  export function checkCard(card) {
570
571
  const c = new Check()
571
- if (!c.object(card, '', ['type', 'title', 'updatedAt', 'data'], ['staleAfter', 'link', 'stat', 'actions', 'icon', 'tone', 'detail', 'raise'])) return c.problems
572
+ if (!c.object(card, '', ['type', 'title', 'updatedAt', 'data'], ['staleAfter', 'link', 'stat', 'actions', 'icon', 'tone', 'detail', 'raise', 'ask'])) return c.problems
573
+ c.optional(card, 'ask', v => c.boolean(v, 'ask'))
572
574
  c.optional(card, 'raise', v => raiseWindow(c, v, 'raise'))
573
575
  c.optional(card, 'detail', v => checkDetail(c, v, 'detail'))
574
576
  if (!c.oneOf(card.type, 'type', CARD_TYPES)) return c.problems