Skip to content

feat(desktop): interactive to-do card rendering + kind:40009 check-off responses - #4928

Closed
mcdickenson wants to merge 1 commit into
block:mainfrom
mcdickenson:feature/todo-card-desktop
Closed

feat(desktop): interactive to-do card rendering + kind:40009 check-off responses#4928
mcdickenson wants to merge 1 commit into
block:mainfrom
mcdickenson:feature/todo-card-desktop

Conversation

@mcdickenson

@mcdickenson mcdickenson commented Aug 5, 2026

Copy link
Copy Markdown

What

Renders interactive buzz:todo-card messages in the desktop client. A ```buzz:todo-card fenced JSON sentinel inside an ordinary stream message (kind:9 / kind:40002) now renders as a native checklist card with per-item check-offs; every other surface (drafts, previews, inbox) and any client that doesn't understand the fence keeps showing the prose fallback.

  • desktop/src/features/messages/lib/todoCard.ts — sentinel extract/strip + type guards (never throws; malformed/over-cap/wrong-version payloads fall back to prose), and reduceTodoResponses, a pure fold over kind:40009 events: latest response per (item, pubkey) wins; an assignee's response is authoritative for their item; non-assignee completions are allowed and attributed; un-check only retracts your own completion.
  • desktop/src/shared/api/cardResponses.tssendCardResponse signs {done} with the clicking user's key (tags h/e/item); subscribeToCardResponses replays per-card history scoped by #e. Composes relayClientSession's public surface instead of growing the size-ratcheted client.
  • desktop/src/features/messages/ui/TodoCardAttachment.tsx — per-card live subscription + fold, optimistic pending state while a publish is in flight, per-item completer avatar/name, n-of-m progress.
  • desktop/src/features/messages/ui/MessageRow.tsx — renders the card in place of the prose fallback whenever a channelId is available.
  • desktop/src/shared/constants/kinds.ts — adds KIND_CARD_RESPONSE (40009) but keeps it out of all timeline/unread/mention kind sets: responses are not rows and must never create unreads.

Why

Checklists posted as prose can't be checked off, attributed, or kept in sync across viewers. Embedding the card in a normal message (config-nudge sentinel pattern for the carrier, huddle-card fold pattern for state) keeps delivery, threading, unreads, and permissions exactly as they are — the relay stores nothing card-specific.

Test evidence (run on this branch at 34d51c5)

  • pnpm typecheck (tsc --noEmit): clean
  • pnpm test (node test runner): 4314 pass, 0 fail across 63 suites
  • New todoCard.test.mjs: 28 tests, all passing (sentinel parsing/fallback edge cases + fold semantics)

Stack

Spec: docs/nips/NIP-TC.md (in #4929).

🤖 Generated with Claude Code

… check-offs

A ```buzz:todo-card fenced JSON sentinel inside an ordinary stream
message now renders as a native to-do card (config-nudge pattern for
the carrier, huddle-card pattern for state):

- todoCard.ts: sentinel extract/strip + type guards (never throws;
  malformed payloads fall back to prose) and reduceTodoResponses, a
  pure fold over kind:40009 events — latest response per (item, pubkey)
  wins, so only a completer can un-check their own completion;
  assignee's response takes precedence, non-assignee completions are
  allowed and attributed.
- cardResponses.ts: sendCardResponse signs {done} with the clicking
  user's key (tags h/e/item) and subscribeToCardResponses replays
  per-card history scoped by #e — composes relayClientSession's public
  surface instead of growing the size-ratcheted client.
- TodoCardAttachment.tsx: per-card subscription + fold, optimistic
  pending state, per-item completer avatar/name, n-of-m progress.
- MessageRow renders the card in place of the prose fallback whenever
  a channelId is available; every other surface (drafts, previews,
  inbox) keeps showing the prose + fence.
- KIND_CARD_RESPONSE stays out of all timeline/unread kind sets:
  responses are not rows and must never create unreads.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Matt Dickenson <mdickenson@squareup.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant