Repository navigation
Commit 55c4675
feat(web): make the thread outbox read as composer chrome, and let it be reordered (#35)
Issue #35 §1: the queued-message list was visually heavier than the messages
it held. It rendered four bordered cards inside the composer's own 22px
outline, so a one-line message got card-sized padding and three or four
queued messages pushed the prompt well up the viewport. The
`QUEUED MESSAGES · N` caption collided with the container's top border, the
edit/delete icons were always visible and pinned far right away from the text
they act on, nothing anywhere stated that queued messages send themselves,
and there was no way to reorder them.
The list already renders *inside* `chat-composer-glass-host`, so the fix is to
stop drawing a second container:
- One dense row per message: a single truncated line, an ordinal, no border,
hover background. The block is capped at `max-h-40` and scrolls, so a long
queue can no longer push the composer up.
- One hairline under the block instead of a card per row, so the queue reads
as the top section of the composer surface.
- The caption now sits inside the padded block and carries the contract:
"Sends automatically when the chat is ready" — phrased to hold for both
reasons a message queues, a running turn and a dropped connection.
- Row actions are revealed on hover, on keyboard focus anywhere in the row,
and unconditionally on coarse pointers, which have no hover to reveal them.
- Beside the Queue button, Stop drops to a quiet outline. A saturated red
circle should not be the highest-contrast element in the composer while the
primary action is Queue. Upstream's filled treatment is untouched and still
used wherever Stop is the only action.
Reordering needed a persisted key. `createdAt` could not be reused: it is sent
verbatim as the turn-start command's timestamp, so it becomes the message's
permanent createdAt/updatedAt in server-side thread history and feeds the
client's queued-turn-start grace window. Moving a message would have rewritten
its history timestamp. Instead `QueuedThreadMessage` gains an *optional*
`sortKey`, which keeps the persisted schema at version 1 — the version literal
is a `Schema.Literals`, and storage swallows a decode failure as "skip
invalid", so a bump would have silently emptied every existing queue on
upgrade.
A move re-deals the queue's existing ordering slots to the permuted order
rather than inventing new keys, so a reordered message can never sort past one
enqueued later, and only the messages that actually moved are written. Ties
now break on messageId: the order is user-editable, and `load` returns
messages in localStorage key-enumeration order, which is browser-defined, so
two messages queued in the same millisecond could otherwise swap places across
a reload.
Verified against a seeded local environment: a four-message queue renders in
~130px against ~230px before, hover reveals the actions, and moving row 3 up
survives a full page reload with only the two swapped records rewritten and
every createdAt intact. Confirmed in light and dark.
Seam impact: the only upstream-owned file touched is
`ComposerPrimaryActions.tsx`, which already has a row in the ledger; its row
and the header totals are updated here (+56/-13 → +71/-13, risk 276 → 336,
totals +1516 → +1531). Everything else is fork-owned. This also records the
web outbox as an undeclared logic mirror of upstream's mobile one, which it
was already, and which this commit deliberately diverges further.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>1 parent 3f8e11c commit 55c4675
7 files changed
Lines changed: 482 additions & 31 deletions
File tree
- apps/web/src
- components/chat
- outbox
- docs/t3x
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
| 94 | + | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
98 | 101 | | |
99 | 102 | | |
100 | 103 | | |
| |||
105 | 108 | | |
106 | 109 | | |
107 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
108 | 123 | | |
109 | 124 | | |
110 | 125 | | |
| |||
177 | 192 | | |
178 | 193 | | |
179 | 194 | | |
180 | | - | |
| 195 | + | |
181 | 196 | | |
182 | 197 | | |
183 | 198 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | | - | |
19 | | - | |
20 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
21 | 27 | | |
22 | 28 | | |
23 | 29 | | |
| |||
33 | 39 | | |
34 | 40 | | |
35 | 41 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
40 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
41 | 52 | | |
42 | | - | |
43 | | - | |
44 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
45 | 64 | | |
46 | 65 | | |
47 | 66 | | |
48 | 67 | | |
49 | 68 | | |
50 | 69 | | |
51 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
52 | 81 | | |
53 | 82 | | |
54 | 83 | | |
| |||
106 | 135 | | |
107 | 136 | | |
108 | 137 | | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
109 | 150 | | |
110 | 151 | | |
111 | | - | |
| 152 | + | |
112 | 153 | | |
113 | 154 | | |
114 | 155 | | |
| |||
146 | 187 | | |
147 | 188 | | |
148 | 189 | | |
149 | | - | |
| 190 | + | |
150 | 191 | | |
151 | 192 | | |
152 | 193 | | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
157 | 224 | | |
158 | 225 | | |
159 | 226 | | |
160 | 227 | | |
161 | | - | |
| 228 | + | |
162 | 229 | | |
163 | 230 | | |
164 | 231 | | |
| |||
167 | 234 | | |
168 | 235 | | |
169 | 236 | | |
170 | | - | |
| 237 | + | |
171 | 238 | | |
172 | 239 | | |
173 | 240 | | |
| |||
0 commit comments