Skip to content

Tap a task card to open that card's agent - #150

Merged
longzhi merged 1 commit into
mainfrom
claude/touchscreen-cards
Oct 21, 2026
Merged

longzhi merged 1 commit into
mainfrom
claude/touchscreen-cards

Conversation

@longzhi

@longzhi longzhi commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Part 2 of #148, stacked on #149: review that one first. Once #149 is merged, this PR's base becomes main.

What changes

  • Daemon (daemon/src/activity.rs, main.rs):
    • Every item in tasks gets an id: eight hex digits of FNV-1a over the activity's key. It stays the same for as long as the activity lasts.
    • A focus event from the box names a card; the daemon opens that activity's source through source_opener::open, the same path K2 uses.
    • If the activity has ended, or has no source, the daemon logs it and does nothing. It does not fall back to K2's choice.
  • Firmware:
    • Each card keeps the id it came with. Only short alphanumeric ids are accepted, so the id can go back out in a JSON line as is.
    • A tap on a card sends {"version":1,"event":"focus","task":"<id>"}.
    • Cards from an older daemon have no id, and a tap on one sends nothing.
  • Docs: protocol.md (the id field and the focus event), device-menu.md, and both READMEs.

One side effect

Two cards with the same title that swap places now send the box a redraw, because their ids moved. Before, the two snapshots were identical and deduplicated. The box needs the new order, or a tap could open the wrong agent. The CI test parallel_workflows_each_report_their_own_end now expects that task.start. task.start is silent. A redrawn needs-input screen keeps suppress_audio as before.

Mac and Linux

Opening a source lives in the shared daemon, so a card tap works wherever K2 works, on macOS and Linux alike. Neither App changes.

Testing

  • cargo test --workspace passes.
  • New tests:
    • Daemon: a_tapped_card_leads_to_its_own_activity (the id, the card's own source rather than K2's choice, and an unknown id) and a_focus_event_names_the_tapped_card.
    • Firmware: a_tapped_card_asks_for_its_agent and a_card_from_an_older_daemon_or_with_an_odd_id_names_nothing.
  • On box 30:ED:A0:A4:0D:08 (2026-10-15): with three cards sent over serial carrying ids, taps on the top, middle and bottom card sent focus with aaaa0001, bbbb0002 and cccc0003 in turn.
  • End to end on 2026-10-21, with this branch's daemon and firmware on box 30:ED: a tap on the top card, then CX:EROS-TRAINING-INFRA, logged opened a tapped card's source link=codex://threads/…, and Codex came to the front on that thread.

🤖 Generated with Claude Code

@longzhi
longzhi force-pushed the claude/touchscreen-cards branch 2 times, most recently from 7fb9ce0 to 35fa3a6 Compare October 15, 2026 03:10
@longzhi
longzhi force-pushed the claude/touchscreen-cards branch 2 times, most recently from 308680b to 0d548fa Compare October 21, 2026 02:54
The daemon gives each item in `tasks` an `id`: eight hex digits of FNV-1a
over the activity's key, the same for as long as the activity lasts. On a
box with a touchscreen, a tap on a card sends
{"version":1,"event":"focus","task":"<id>"}, and the daemon opens that
activity's source the way K2 opens its choice. An activity that has ended
or has no source opens nothing. Cards without an id, from an older daemon,
send nothing (ADR-0017, #148).

Two cards with the same title that swap places now redraw the box, since
their ids moved; the CI test that saw no event there expects it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@longzhi
longzhi force-pushed the claude/touchscreen branch from ceffa54 to 48653e8 Compare October 21, 2026 02:58
@longzhi
longzhi force-pushed the claude/touchscreen-cards branch from 0d548fa to e06f2e7 Compare October 21, 2026 02:58
Base automatically changed from claude/touchscreen to main October 21, 2026 04:18
@longzhi
longzhi marked this pull request as ready for review October 21, 2026 04:18
Copilot AI balanced review requested due to automatic review settings October 21, 2026 04:18
@longzhi
longzhi merged commit 4438c80 into main Oct 21, 2026
2 of 4 checks passed
@longzhi
longzhi deleted the claude/touchscreen-cards branch October 21, 2026 04:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

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.

2 participants