@alexsun-top/opencode-chat-room 0.5.0 → 0.5.2

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.
Files changed (54) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +23 -7
  3. package/README.zh-CN.md +23 -7
  4. package/docs/administrator-rooms.md +51 -0
  5. package/package.json +11 -2
  6. package/plugin.ts +29 -12
  7. package/server/admin-auth.ts +16 -0
  8. package/server/admin-plan-routes.ts +79 -0
  9. package/server/admin-routes.ts +154 -0
  10. package/server/admin-scheduler.ts +42 -0
  11. package/server/admin-state.ts +61 -0
  12. package/server/admin-task-routes.ts +182 -0
  13. package/server/assets/base.css +55 -43
  14. package/server/assets/chat/admin.js +223 -0
  15. package/server/assets/chat/attachments.js +240 -0
  16. package/server/assets/chat/editor.js +211 -0
  17. package/server/assets/chat/events.js +34 -10
  18. package/server/assets/chat/index.js +8 -0
  19. package/server/assets/chat/markdown.js +1 -12
  20. package/server/assets/chat/members.js +1 -1
  21. package/server/assets/chat/mentions.js +38 -28
  22. package/server/assets/chat/message-window.js +18 -0
  23. package/server/assets/chat/messages.js +64 -46
  24. package/server/assets/chat/questions.js +113 -41
  25. package/server/assets/chat/receipts.js +0 -1
  26. package/server/assets/chat/reminders.js +101 -0
  27. package/server/assets/chat/replies.js +149 -0
  28. package/server/assets/chat/rooms.js +30 -10
  29. package/server/assets/chat/state.js +68 -18
  30. package/server/assets/conversation.css +111 -45
  31. package/server/assets/responsive.css +83 -28
  32. package/server/chat-server.ts +23 -6
  33. package/server/chat.html +82 -31
  34. package/server/inbox.ts +5 -1
  35. package/server/newrooms.ts +27 -10
  36. package/server/resource-routes.ts +3 -0
  37. package/server/room-reminders.ts +212 -0
  38. package/server/wake.ts +11 -15
  39. package/skills/chatroom/SKILL.md +21 -1
  40. package/src/admin-client.ts +130 -0
  41. package/src/admin-credentials.ts +58 -0
  42. package/src/agent-receipts.ts +13 -18
  43. package/src/center-client.ts +1 -1
  44. package/src/center-inbox.ts +2 -0
  45. package/src/plugin-notifications.ts +4 -0
  46. package/src/queue.ts +7 -2
  47. package/src/reminder-client.ts +50 -0
  48. package/src/resource-read.ts +118 -0
  49. package/src/resources.ts +1 -1
  50. package/src/sqlite-state.ts +89 -21
  51. package/src/store.ts +22 -8
  52. package/src/supervision-inbox.ts +62 -0
  53. package/src/v1-plugin.ts +13 -3
  54. package/src/v2-plugin.ts +24 -7
@@ -3,22 +3,22 @@
3
3
  flex-wrap: wrap;
4
4
  align-items: center;
5
5
  justify-content: space-between;
6
- gap: 8px 14px;
7
- padding: 14px 20px;
6
+ gap: 10px 18px;
7
+ padding: 16px 24px;
8
8
  border-bottom: 1px solid var(--line);
9
- background: var(--surface);
9
+ background: linear-gradient(115deg, color-mix(in srgb, var(--accent-soft) 38%, var(--surface)), var(--surface) 62%);
10
10
  }
11
- .chat-head-main h1 { margin: 0; font-family: var(--font-sans); font-size: 20px; font-weight: 650; line-height: 1.25; letter-spacing: -.02em; }
11
+ .chat-head-main h1 { margin: 0; font-family: var(--font-display); font-size: 22px; font-weight: 600; line-height: 1.2; letter-spacing: -.025em; }
12
12
  .room-title-row { display: flex; align-items: center; min-width: 0; gap: 8px; }
13
13
  .room-title-row h1 { flex: 1; min-width: 0; }
14
14
  .rooms-drawer-trigger { display: none; }
15
15
  .room-drawer-backdrop { position: fixed; inset: 0; z-index: 49; border: 0; background: rgb(9 16 22 / .38); }
16
- .room-meta { margin: 2px 0 0; font-size: 13px; color: var(--ink-2); }
16
+ .room-meta { margin: 4px 0 0; font-size: 11px; color: var(--ink-3); }
17
17
  .mono { font-family: var(--font-mono); }
18
18
  .copy-id {
19
19
  appearance: none;
20
20
  font: inherit;
21
- font-size: 12px;
21
+ font-size: 11px;
22
22
  color: var(--ink-3);
23
23
  background: none;
24
24
  border: none;
@@ -33,18 +33,26 @@
33
33
  .copy-id.copied .copy-ok { display: inline; color: var(--accent); }
34
34
 
35
35
  .chat-head-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
36
- .question-panel { width: min(390px, calc(100vw - 32px)); max-height: min(70vh, 620px); overflow: auto; }
36
+ .chat-head .action-icon { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
37
+ .panel.question-panel { width: min(720px, calc(100vw - 32px)); max-height: min(86vh, 820px); overflow: auto; }
37
38
  .questions-trigger { position: relative; }
38
39
  .question-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
39
40
  .question-panel-head h3 { margin-bottom: 0; }
40
41
  .question-refresh { border: 0; padding: 4px 7px; color: var(--accent); background: transparent; font: inherit; font-size: 12px; cursor: pointer; }
41
- .question-list { list-style: none; max-height: 260px; overflow: auto; margin: 10px 0 0; padding: 0; }
42
- .question-item { width: 100%; padding: 9px 10px; border: 1px solid transparent; border-radius: 9px; color: var(--ink); background: transparent; font: inherit; font-size: 13px; line-height: 1.5; text-align: left; overflow-wrap: anywhere; cursor: pointer; }
43
- .question-item:hover, .question-item[aria-pressed="true"] { border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); background: var(--accent-soft); }
42
+ .question-list { list-style: none; max-height: 40vh; overflow: auto; margin: 10px 0 0; padding: 0; }
43
+ .question-item { display: grid; gap: 8px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--surface-2); font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; cursor: pointer; }
44
+ .question-item-body { min-width: 0; }
45
+ .question-item:hover, .question-item.selected { border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); background: var(--accent-soft); }
46
+ .question-select { justify-self: end; border: 0; padding: 3px 5px; color: var(--accent); background: transparent; font: inherit; font-size: 12px; font-weight: 650; cursor: pointer; }
47
+ .question-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
44
48
  .question-reply { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
45
- .question-reply-quote { max-height: 72px; overflow: auto; margin: 0 0 8px; padding: 8px 10px; border-left: 3px solid var(--accent); border-radius: 4px; background: var(--surface-2); font-size: 12px; overflow-wrap: anywhere; }
49
+ .question-copy { margin-bottom: 4px; }
50
+ .question-copy-feedback { min-height: 1.4em; margin: 0 0 6px; color: var(--ink-2); font-size: 12px; }
51
+ .question-panel p, .question-panel ul, .question-panel ol, .question-panel pre, .question-panel blockquote, .question-panel table { margin-top: 0; margin-bottom: 6px; }
52
+ .question-panel pre { max-width: 100%; overflow-x: auto; }
53
+ .question-panel table { display: block; max-width: 100%; overflow-x: auto; }
46
54
  .question-reply-form { display: grid; gap: 8px; }
47
- .question-reply-form textarea { min-height: 62px; resize: vertical; }
55
+ .question-reply-form .message-editor { position: relative; min-height: 62px; resize: vertical; }
48
56
  .question-reply-form .btn { justify-self: end; }
49
57
  .question-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-left: 5px; padding: 0 4px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font-size: 10px; }
50
58
  .chip {
@@ -61,7 +69,8 @@
61
69
  cursor: pointer;
62
70
  transition: color .12s, border-color .12s, background .12s;
63
71
  }
64
- .chip:hover { color: var(--ink); border-color: var(--ink-3); }
72
+ .chip:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--accent-soft); }
73
+ .chip[aria-expanded="true"] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 44%, var(--line)); background: var(--accent-soft); }
65
74
  .profile-trigger { display: grid; place-items: center; width: 36px; height: 36px; padding: 3px; border-radius: 50%; }
66
75
  .profile-trigger .rail-avatar { width: 25px; height: 25px; font-size: 12px; font-weight: 700; }
67
76
  .chip.danger { color: var(--danger); }
@@ -74,11 +83,12 @@
74
83
  right: 0;
75
84
  z-index: 20;
76
85
  width: min(320px, calc(100vw - 32px));
77
- padding: 16px;
86
+ padding: 17px;
78
87
  background: var(--surface);
79
- border: 1px solid var(--line);
80
- border-radius: 14px;
88
+ border: 1px solid color-mix(in srgb, var(--accent) 14%, var(--line));
89
+ border-radius: 16px;
81
90
  box-shadow: var(--shadow);
91
+ backdrop-filter: blur(12px);
82
92
  animation: rise .18s ease both;
83
93
  }
84
94
  .panel h3 { margin: 0 0 10px; font-size: 14px; font-weight: 600; }
@@ -150,17 +160,18 @@
150
160
  right: 20px;
151
161
  bottom: 16px;
152
162
  z-index: 5;
153
- display: flex;
154
- align-items: center;
155
- gap: 6px;
156
- padding: 9px 14px;
163
+ display: grid;
164
+ place-items: center;
165
+ width: 44px;
166
+ height: 44px;
167
+ padding: 0;
157
168
  font: inherit;
158
169
  font-size: 13px;
159
170
  font-weight: 600;
160
171
  color: var(--accent-ink);
161
172
  background: var(--accent);
162
173
  border: none;
163
- border-radius: 999px;
174
+ border-radius: 50%;
164
175
  cursor: pointer;
165
176
  box-shadow: var(--shadow);
166
177
  transition: filter .12s, transform .1s;
@@ -168,6 +179,9 @@
168
179
  .jump:hover { filter: brightness(1.07); }
169
180
  .jump:active { transform: translateY(1px); }
170
181
  .jump .badge {
182
+ position: absolute;
183
+ top: -6px;
184
+ right: -6px;
171
185
  display: inline-flex;
172
186
  align-items: center;
173
187
  justify-content: center;
@@ -181,12 +195,12 @@
181
195
  border-radius: 999px;
182
196
  }
183
197
 
184
- .msg { display: flex; flex-direction: column; margin-bottom: 14px; }
198
+ .msg { display: flex; flex-direction: column; margin-bottom: 16px; }
185
199
  .msg.in, .sys.in, .day-sep.in { animation: msg-in .25s ease both; }
186
200
  .msg.own { align-items: flex-end; }
187
201
  .msg.repeat { margin-bottom: 8px; }
188
202
  .msg-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
189
- .msg-name { font-size: 14px; font-weight: 600; color: var(--ink); }
203
+ .msg-name { font-size: 13px; font-weight: 650; color: var(--ink-2); }
190
204
  .msg.own .msg-name { color: var(--accent); }
191
205
  .question-mark { padding: 1px 6px; border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 999px; color: var(--accent); background: var(--accent-soft); font-size: 10px; line-height: 1.5; }
192
206
  .msg.repeat .msg-name { display: none; }
@@ -195,8 +209,10 @@
195
209
  display: inline-block;
196
210
  width: max-content;
197
211
  max-width: min(86%, 540px);
198
- padding: 8px 12px;
199
- border-radius: 14px;
212
+ padding: 9px 13px;
213
+ border: 1px solid color-mix(in srgb, var(--ink) 5%, transparent);
214
+ border-radius: 16px;
215
+ box-shadow: 0 1px 2px rgb(20 40 32 / .035);
200
216
  background: var(--surface-2);
201
217
  border-bottom-left-radius: 4px;
202
218
  font-size: 16px;
@@ -204,26 +220,46 @@
204
220
  white-space: normal;
205
221
  overflow-wrap: anywhere;
206
222
  }
207
- .msg.own .msg-text { background: var(--accent-soft); border-bottom-left-radius: 14px; border-bottom-right-radius: 4px; }
208
- .msg.own .msg-text ::selection { color: var(--accent-ink); background: var(--accent); }
223
+ .msg-text::selection, .msg-text *::selection { color: var(--accent-ink); background: var(--accent); }
224
+ .msg.own .msg-text { background: linear-gradient(145deg, color-mix(in srgb, var(--accent-soft) 86%, var(--surface)), var(--accent-soft)); border-color: color-mix(in srgb, var(--accent) 12%, transparent); border-bottom-left-radius: 16px; border-bottom-right-radius: 5px; }
209
225
  .msg-content { position: relative; display: flex; align-items: flex-end; gap: 6px; width: 100%; max-width: 100%; }
210
226
  .msg.own .msg-content { flex-direction: row-reverse; }
211
227
  .message-copy {
228
+ position: relative;
212
229
  align-self: flex-start;
213
- margin: 2px 0 0 4px;
214
- padding: 2px 6px;
215
- border: 0;
216
- border-radius: 5px;
230
+ display: grid;
231
+ place-items: center;
232
+ flex: none;
233
+ width: 32px;
234
+ height: 32px;
235
+ margin: 3px 0 0 4px;
236
+ padding: 0;
237
+ border: 1px solid transparent;
238
+ border-radius: 9px;
217
239
  color: var(--ink-3);
218
240
  background: transparent;
219
241
  font: inherit;
220
- font-size: 11px;
221
242
  cursor: pointer;
243
+ transition: color .14s, background .14s, border-color .14s;
222
244
  }
223
245
  .msg.own .message-copy { align-self: flex-end; margin-right: 4px; }
224
- .message-copy:hover, .message-copy:focus-visible { color: var(--ink); background: var(--surface-2); }
246
+ .message-copy-icon { display: block; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
247
+ .message-copy:hover, .message-copy:focus-visible, .message-copy.is-flashing { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 24%, var(--line)); }
225
248
  .message-copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
226
- .message-readers { flex: 0 0 22px; align-self: flex-end; margin: 0 0 4px; padding: 0; width: 22px; height: 22px; border: 1px solid var(--line); border-radius: 50%; color: var(--ink-3); background: var(--surface); font: inherit; font-size: 10px; cursor: pointer; }
249
+ .message-copy-feedback { position: absolute; z-index: 25; left: 0; bottom: calc(100% + 5px); width: max-content; max-width: min(260px, calc(100vw - 32px)); padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--surface); box-shadow: var(--shadow); font-size: 11px; font-weight: 500; line-height: 1.4; text-align: left; white-space: normal; overflow-wrap: anywhere; }
250
+ .message-actions { display: flex; align-items: center; gap: 2px; }
251
+ .message-reply { min-height: 32px; padding: 0 7px; border: 1px solid transparent; border-radius: 8px; color: var(--ink-3); background: transparent; font: inherit; font-size: 11px; cursor: pointer; }
252
+ .message-reply:hover, .message-reply:focus-visible { border-color: var(--line); color: var(--accent); background: var(--accent-soft); }
253
+ .reply-preview { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: min(940px, 100%); margin: 0 auto; padding: 8px 12px; border-left: 3px solid var(--accent); border-radius: 6px; background: var(--accent-soft); }
254
+ .reply-preview strong { font-size: 12px; color: var(--accent); }
255
+ .reply-preview p { overflow: hidden; margin: 2px 0 0; color: var(--ink-2); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
256
+ .reply-cancel { flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%; color: var(--ink-2); background: transparent; font: inherit; font-size: 20px; cursor: pointer; }
257
+ .reply-cancel:hover { color: var(--danger); background: var(--surface); }
258
+ .reply-quote { display: block; max-width: min(82%, 500px); overflow: hidden; margin: 0 0 5px; padding: 5px 10px; border: 0; border-left: 2px solid var(--accent); border-radius: 0 6px 6px 0; color: var(--ink-2); background: var(--surface-2); font: inherit; font-size: 12px; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
259
+ .reply-quote:hover:not(:disabled) { color: var(--accent); background: var(--accent-soft); }
260
+ .reply-quote:disabled { cursor: default; opacity: .7; }
261
+ .msg.own .message-copy-feedback { left: auto; right: 0; }
262
+ .message-readers { flex: 0 0 24px; align-self: flex-end; margin: 0 0 4px; padding: 0; width: 24px; height: 24px; border: 1px solid var(--line); border-radius: 50%; color: var(--ink-3); background: var(--surface); font: inherit; font-size: 10px; cursor: pointer; box-shadow: 0 1px 3px rgb(20 40 32 / .06); }
227
263
  .message-readers[data-reader-state="empty"], .message-readers[data-reader-state="unknown"] { background: var(--surface-2); }
228
264
  .message-readers:hover, .message-readers[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
229
265
  .message-readers:focus-visible, .reader-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@@ -236,9 +272,8 @@
236
272
  .reader-panel-head h2 { margin: 0; font-family: var(--font-sans); font-size: 18px; font-weight: 650; letter-spacing: -.01em; }
237
273
  .reader-panel-head .hint { margin: 0 0 4px; }
238
274
  .reader-close { flex: none; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 50%; color: var(--ink-2); background: var(--surface); font: inherit; font-size: 21px; cursor: pointer; }
239
- .reader-excerpt { max-height: 110px; overflow: auto; margin: 16px 0; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--surface-2); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
240
275
  .reader-panel .receipt-reader-list li { display: grid; gap: 3px; padding: 10px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
241
- .chat-resource { display: grid; gap: 8px; min-width: 0; margin: 10px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
276
+ .chat-resource { display: grid; gap: 9px; min-width: 0; margin: 10px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--surface-2) 76%, var(--surface)); }
242
277
  .resource-info, .resource-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
243
278
  .resource-name { min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
244
279
  .resource-size, .resource-status { color: var(--ink-3); font-size: 12px; }
@@ -367,7 +402,6 @@
367
402
  }
368
403
  .sys::before { content: ""; position: absolute; top: 9px; left: 0; right: 0; height: 1px; background: var(--line); }
369
404
  .sys span { position: relative; padding: 0 10px; background: var(--surface); }
370
- .sys .message-copy { align-self: center; margin: -8px 0 0; }
371
405
 
372
406
  .day-sep {
373
407
  display: flex;
@@ -383,40 +417,47 @@
383
417
 
384
418
  .gap { padding: 6px 0 2px; text-align: center; font-size: 12px; color: var(--ink-3); }
385
419
 
386
- .chat-empty { padding: 56px 0 40px; text-align: center; font-size: 13px; color: var(--ink-3); }
420
+ .chat-empty { padding: 64px 0 44px; text-align: center; font-family: var(--font-display); font-size: 16px; color: var(--ink-3); }
387
421
  .chat-empty::before {
388
422
  content: "";
389
423
  display: block;
390
424
  width: 56px;
391
425
  height: 56px;
392
426
  margin: 0 auto 14px;
393
- border: 1.5px dashed var(--line);
427
+ border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
394
428
  border-radius: 50%;
395
- background: radial-gradient(circle at 50% 50%, var(--ink-3) 0 3px, transparent 4px);
429
+ background: radial-gradient(circle at 50% 50%, var(--accent) 0 3px, transparent 4px), var(--accent-soft);
396
430
  }
397
431
 
398
432
  .composer {
399
433
  position: relative;
400
434
  display: flex;
401
435
  flex-direction: column;
402
- gap: 8px;
403
- padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
436
+ gap: 9px;
437
+ padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
404
438
  border-top: 1px solid var(--line);
405
- background: var(--surface);
439
+ background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--accent-soft) 18%, var(--surface)));
406
440
  }
407
- .composer-row { display: flex; gap: 10px; align-items: flex-end; }
408
- .composer-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: min(940px, 100%); min-width: 0; margin: -2px auto 0; }
441
+ .composer-row { display: flex; gap: 9px; align-items: flex-end; }
442
+ .composer-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: min(940px, 100%); min-width: 0; margin: -1px auto 0; }
409
443
  .question-toggle { min-width: 0; margin: 0; color: var(--ink-2); font-size: 12px; }
410
444
  .question-toggle input { accent-color: var(--accent); vertical-align: -1px; }
411
445
  .composer .input { flex: 1; }
412
446
  .composer .input:disabled { opacity: .5; }
413
447
  #msgInput {
448
+ position: relative;
414
449
  min-height: 0;
415
450
  padding: 12px 13px;
416
451
  line-height: 1.5;
452
+ border-radius: 15px;
453
+ background: color-mix(in srgb, var(--surface) 92%, var(--accent-soft));
417
454
  resize: none;
418
455
  overflow-y: hidden;
419
456
  }
457
+ #msgInput:empty, #msgInput:has(> br:only-child), #msgInput:has(> div:only-child > br:only-child) { height: 50px !important; }
458
+ .message-editor { white-space: pre-wrap; overflow-wrap: anywhere; outline: none; }
459
+ .message-editor:empty::before, .message-editor:has(> br:only-child)::before, .message-editor:has(> div:only-child > br:only-child)::before { content: attr(aria-placeholder); position: absolute; inset: 12px 13px auto; overflow: hidden; color: var(--ink-3); pointer-events: none; text-overflow: ellipsis; white-space: nowrap; }
460
+ .editor-mention { display: inline-block; padding: 1px 7px; border: 1px solid color-mix(in srgb, var(--mention-blue) 32%, transparent); border-radius: 999px; color: var(--mention-blue); background: color-mix(in srgb, var(--mention-blue) 14%, transparent); font-size: .92em; font-weight: 600; vertical-align: baseline; white-space: nowrap; }
420
461
  #btnSend { padding: 12px 22px; }
421
462
  .send-error { margin: 0; font-size: 12.5px; color: var(--danger); }
422
463
  .draft-count { flex: none; margin: 0; color: var(--ink-3); text-align: right; font-size: 11px; font-variant-numeric: tabular-nums; }
@@ -424,5 +465,30 @@
424
465
  .failed-messages h3 { margin: 0 0 5px; color: var(--danger); font-size: 12px; }
425
466
  .failed-message { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-top: 1px solid var(--line); }
426
467
  .failed-message p { flex: 1; min-width: 0; max-height: 48px; overflow: auto; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; }
468
+ .failed-reply-context { flex: 0 0 100%; overflow: hidden; color: var(--accent); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
427
469
  .failed-message button { flex: none; border: 1px solid var(--line); border-radius: 7px; padding: 4px 8px; background: var(--surface); color: var(--ink-2); font: inherit; font-size: 12px; cursor: pointer; }
428
470
  .failed-message button:disabled { opacity: .5; cursor: default; }
471
+ .attachment-button { flex: none; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 12px; color: var(--ink-2); background: var(--surface); font: inherit; font-size: 24px; cursor: pointer; }
472
+ .attachment-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
473
+ .attachment-button:hover { color: var(--accent); border-color: var(--accent); }
474
+ .attachment-button:disabled { opacity: .5; cursor: default; }
475
+ .attachment-tray { width: min(940px, 100%); margin: 0 auto; }
476
+ .attachment-volatile { margin: 0 0 3px; color: var(--ink-3); font-size: 10.5px; }
477
+ .attachment-status { display: inline-flex; width: fit-content; margin: 5px 0 0; padding: 3px 8px; border-radius: 999px; color: var(--accent); background: var(--accent-soft); font-size: 10.5px; }
478
+ .attachment-status.danger-text { color: var(--danger); background: var(--danger-soft); }
479
+ .attachment-status:empty { display: none; }
480
+ .attachment-list { display: grid; gap: 6px; max-height: 132px; overflow: auto; margin: 0; padding: 0; list-style: none; }
481
+ .attachment-item { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 9px; min-width: 0; padding: 7px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); box-shadow: 0 1px 2px rgb(20 40 32 / .035); }
482
+ .attachment-preview { display: grid; place-items: center; width: 38px; height: 38px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--ink) 5%, transparent); border-radius: 8px; background: var(--surface-2); color: var(--ink-3); font-size: 11px; font-weight: 700; }
483
+ .attachment-preview img { width: 100%; height: 100%; object-fit: cover; }
484
+ .attachment-file { min-width: 0; }
485
+ .attachment-name { overflow: hidden; margin: 0; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
486
+ .attachment-detail { margin: 0; color: var(--ink-3); font-size: 10px; }
487
+ .attachment-item progress { display: block; width: 100%; height: 5px; accent-color: var(--accent); }
488
+ .attachment-actions { display: flex; gap: 4px; }
489
+ .attachment-actions button { min-width: 44px; min-height: 44px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink-2); background: var(--surface); font: inherit; font-size: 11px; cursor: pointer; }
490
+ .attachment-actions button:hover { border-color: var(--accent); color: var(--accent); }
491
+ .attachment-over-limit { color: var(--danger); }
492
+ #draftCount.over-limit { color: var(--danger); font-weight: 700; }
493
+ .attachment-drop-overlay { position: fixed; inset: 12px; z-index: 100; place-items: center; border: 2px dashed var(--accent); border-radius: 18px; color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 88%, transparent); font-size: clamp(18px, 4vw, 28px); font-weight: 700; pointer-events: none; }
494
+ #chatView.drag-over .attachment-drop-overlay { display: grid; }
@@ -31,34 +31,84 @@
31
31
  min-height: 0;
32
32
  padding: 22px 14px 14px;
33
33
  color: var(--ink);
34
- background: linear-gradient(155deg, color-mix(in srgb, var(--accent) 11%, var(--surface)) 0%, var(--surface) 52%);
34
+ background: radial-gradient(320px 260px at 0% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 72%), linear-gradient(160deg, var(--surface), color-mix(in srgb, var(--accent-soft) 25%, var(--surface)));
35
35
  border-right: 1px solid var(--line);
36
36
  }
37
- .rail-brand { display: flex; align-items: center; gap: 10px; margin: 0 0 35px 5px; font-family: var(--font-sans); font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
38
- .brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 11px 11px 11px 4px; background: var(--accent); color: var(--accent-ink); font: 700 11px var(--font-sans); }
39
- .rail-label { display: flex; align-items: center; justify-content: space-between; margin: 0 8px 10px; color: var(--ink-3); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
37
+ .rail-brand { display: flex; align-items: center; gap: 11px; margin: 0 0 30px 5px; font-family: var(--font-display); font-size: 19px; font-weight: 700; letter-spacing: -.025em; }
38
+ .brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid color-mix(in srgb, var(--accent-ink) 24%, transparent); border-radius: 12px 12px 12px 5px; background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 82%, #18382f), var(--accent)); color: var(--accent-ink); font: 700 11px var(--font-sans); box-shadow: 0 3px 8px color-mix(in srgb, var(--accent) 18%, transparent); }
39
+ .rail-label { display: flex; align-items: center; justify-content: space-between; margin: 0 8px 10px; color: var(--ink-3); font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
40
40
  .rail-tools { display: flex; align-items: center; gap: 7px; }
41
- .icon-btn { border: 0; background: transparent; color: var(--ink-2); font: inherit; font-size: 20px; cursor: pointer; }
42
- .icon-btn:hover { color: var(--accent); }
41
+ .icon-btn { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--ink-2); font: inherit; font-size: 20px; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
42
+ .icon-btn:hover { color: var(--accent); border-color: var(--line); background: var(--surface); }
43
+ .icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
43
44
  .rail-composer { position: absolute; top: 76px; left: 12px; right: 12px; z-index: 25; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
44
45
  .rail-composer .field { margin-bottom: 8px; }
45
46
  .rail-composer .btn { width: 100%; }
46
47
  .mobile-locale { display: none; }
47
48
  .rail-rooms { flex: 1; min-height: 0; overflow: auto; list-style: none; margin: 0; padding: 0; }
48
- #roomListChat .room-row { padding: 10px 12px; border-color: transparent; }
49
- #roomListChat .room-row.selected { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 22%, transparent); }
49
+ #roomListChat .room-row { padding: 11px 12px; border-color: transparent; border-radius: 12px; }
50
+ #roomListChat .room-row.selected { background: linear-gradient(110deg, color-mix(in srgb, var(--accent-soft) 92%, var(--surface)), var(--accent-soft)); border-color: color-mix(in srgb, var(--accent) 24%, var(--line)); box-shadow: inset 3px 0 var(--accent); }
50
51
  .r-kind { color: var(--accent); font-size: 11px; font-weight: 700; }
51
52
  .r-status { color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
52
53
  .r-preview { overflow: hidden; color: var(--ink-3); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
53
54
  .r-badge { position: absolute; top: 8px; right: 9px; display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 10px; font-weight: 700; }
54
- .rail-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding: 13px 8px 0; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); }
55
+ .rail-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding: 12px 4px 0; border-top: 1px solid color-mix(in srgb, var(--line) 80%, transparent); font-size: 12px; color: var(--ink-3); }
56
+ .rail-foot .anchor { width: 100%; }
57
+ .user-menu-trigger { display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; padding: 7px; border: 1px solid transparent; border-radius: 12px; color: var(--ink); background: transparent; font: inherit; text-align: left; cursor: pointer; transition: border-color .16s, background .16s, box-shadow .16s; }
58
+ .user-menu-trigger:hover, .user-menu-trigger[aria-expanded="true"] { border-color: color-mix(in srgb, var(--accent) 20%, var(--line)); background: color-mix(in srgb, var(--surface) 84%, var(--accent-soft)); box-shadow: 0 2px 8px rgb(25 50 42 / .06); }
59
+ .user-menu-trigger:focus-visible, .menu-action:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
60
+ .user-menu-trigger #railIdentity { flex: 1; min-width: 0; overflow: hidden; color: var(--ink-2); text-overflow: ellipsis; white-space: nowrap; }
61
+ .user-menu-trigger .rail-avatar { flex: none; width: 34px; height: 34px; border: 1px solid color-mix(in srgb, var(--accent) 15%, var(--line)); font-size: 13px; font-weight: 700; }
62
+ .user-menu-caret { font-size: 14px; }
63
+ .user-menu-panel { top: auto; right: auto; bottom: calc(100% + 8px); left: 0; max-height: min(65dvh, 560px); overflow: auto; }
64
+ .room-options-panel { display: grid; gap: 4px; width: 190px; }
65
+ .menu-action { width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; color: var(--ink); background: transparent; font: inherit; text-align: left; cursor: pointer; }
66
+ .menu-action:hover { background: var(--surface-2); }
67
+ .restore-view { display: none; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 20px; color: var(--ink-2); text-align: center; }
68
+ .session-restore #joinView { display: none; }
69
+ .session-restore .restore-view { display: flex; }
70
+ .restore-message { display: flex; align-items: center; justify-content: center; gap: 12px; }
71
+ #restoreError { max-width: min(440px, 100%); margin: 0; }
72
+ .restore-spinner { width: 20px; height: 20px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
73
+ @keyframes spin { to { transform: rotate(360deg); } }
74
+ .admin-access { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }
75
+ .admin-access summary { margin: 0 0 8px; font-size: 13px; font-weight: 600; cursor: pointer; }
76
+ .admin-badge, .room-admin-badge { display: inline-flex; align-items: center; width: fit-content; border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line)); border-radius: 999px; color: var(--accent); background: var(--accent-soft); font-size: 10px; font-weight: 700; letter-spacing: .04em; line-height: 1.4; }
77
+ .admin-badge { padding: 3px 8px; }
78
+ .room-admin-badge { padding: 1px 6px; vertical-align: middle; }
79
+ .admin-scope-note { margin: 0 0 14px; padding: 10px 11px; border-left: 2px solid var(--accent); border-radius: 0 8px 8px 0; background: color-mix(in srgb, var(--accent-soft) 58%, transparent); line-height: 1.5; }
80
+ .admin-dialog { width: min(1020px, calc(100vw - 32px)); max-width: none; max-height: 90dvh; overflow: auto; padding: 24px; color: var(--ink); background: linear-gradient(145deg, var(--surface), color-mix(in srgb, var(--accent-soft) 16%, var(--surface))); border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line)); border-radius: 20px; box-shadow: 0 24px 80px rgb(10 25 20 / .2); }
81
+ .admin-dialog::backdrop { background: rgb(9 22 18 / .52); backdrop-filter: blur(4px); }
82
+ .admin-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
83
+ .admin-dialog-actions { display: flex; align-items: center; gap: 10px; }
84
+ .admin-dialog #btnCloseAdmin { width: 36px; height: 36px; margin: 0; }
85
+ .admin-dialog-head h2 { margin: 0; font-family: var(--font-display); font-size: 25px; font-weight: 600; letter-spacing: -.02em; }
86
+ .admin-dialog h3 { margin: 20px 0 9px; font-size: 14px; font-weight: 700; letter-spacing: .01em; }
87
+ .admin-columns { display: grid; grid-template-columns: minmax(230px, .8fr) minmax(0, 1.2fr); gap: 26px; }
88
+ .admin-columns > section { min-width: 0; padding: 14px; border: 1px solid color-mix(in srgb, var(--line) 82%, transparent); border-radius: 14px; background: color-mix(in srgb, var(--surface) 84%, var(--accent-soft)); }
89
+ .admin-columns > section > h3:first-child { margin-top: 0; }
90
+ .admin-columns .field { margin-bottom: 10px; }
91
+ .admin-dialog .admin-select { display: block; box-sizing: border-box; width: 100%; min-width: 0; min-height: 40px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--surface); font: inherit; }
92
+ .admin-overview, .admin-list { margin: 0; padding: 0; list-style: none; }
93
+ .admin-overview p, .admin-list li { margin: 6px 0; padding: 9px; border: 1px solid var(--line); border-radius: 9px; overflow-wrap: anywhere; }
94
+ .admin-list li { display: grid; gap: 7px; }
95
+ .admin-plan-form { display: grid; gap: 8px; }
96
+ .admin-enrollment { display: grid; gap: 8px; margin-top: 12px; padding: 12px; border-radius: 10px; background: var(--accent-soft); overflow-wrap: anywhere; }
97
+ .admin-enrollment code { user-select: all; }
98
+ @media (max-width: 620px) { .admin-dialog { padding: 15px; } .admin-columns { grid-template-columns: minmax(0, 1fr); gap: 0; } }
55
99
  .rail-avatar { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; color: var(--accent); background: var(--accent-soft); }
56
100
  .online-dot { width: 7px; height: 7px; border-radius: 50%; background: #609773; box-shadow: 0 0 0 3px color-mix(in srgb, #609773 16%, transparent); }
57
- #chatView > .chat-head { grid-column: 2; grid-row: 1; min-width: 0; padding: 17px 24px; background: color-mix(in srgb, var(--surface) 93%, var(--accent)); }
101
+ #chatView > .chat-head { grid-column: 2; grid-row: 1; min-width: 0; }
102
+ @media (min-width: 901px) {
103
+ #chatView > .chat-head .action-icon { display: none; }
104
+ }
105
+ @media (max-width: 900px) {
106
+ #chatView > .chat-head .action-icon { display: block; }
107
+ #chatView > .chat-head .action-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }
108
+ }
58
109
  #chatView > .conn-bar { grid-column: 2; grid-row: 2; }
59
110
  #chatView > .msg-scroll { grid-column: 2; grid-row: 3; min-height: 0; }
60
111
  #chatView > .composer { grid-column: 2; grid-row: 4; }
61
- .chat-head-main h1 { font-size: 21px; }
62
112
  .thread { padding: 28px 24px 12px; }
63
113
  .msg-text { max-width: min(82%, 680px); padding: 10px 14px; }
64
114
  .composer { padding: 14px 24px calc(14px + env(safe-area-inset-bottom)); }
@@ -67,9 +117,6 @@
67
117
  .member-action { border: 0; background: transparent; padding: 2px 4px; color: var(--accent); font: inherit; font-size: 11px; cursor: pointer; white-space: nowrap; }
68
118
  .member-action:hover { text-decoration: underline; }
69
119
  #memberList li { align-items: center; }
70
- .msg-text pre { position: relative; padding-top: 32px; }
71
- .code-copy { position: absolute; top: 5px; right: 6px; border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; background: var(--surface); color: var(--ink-2); font: inherit; font-size: 11px; cursor: pointer; }
72
- .code-copy:hover { color: var(--accent); border-color: var(--accent); }
73
120
  .msg-text table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
74
121
  .msg-text th, .msg-text td { padding: 5px 9px; border: 1px solid var(--line); text-align: left; }
75
122
  .msg-text td { overflow-wrap: normal; }
@@ -81,6 +128,16 @@
81
128
  .mermaid-diagram svg { display: block; max-width: 100%; height: auto; margin: 0 auto; }
82
129
  .diagram-status { margin: 0 0 6px; color: var(--ink-3); font-size: 12px; }
83
130
 
131
+ @media (min-width: 761px) and (max-width: 900px) {
132
+ #chatView > .chat-head { flex-wrap: nowrap; gap: 8px; }
133
+ .chat-head-main { flex: 1; min-width: 0; }
134
+ .chat-head-main h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 18px; }
135
+ .chat-head-actions { flex: none; flex-wrap: nowrap; gap: 4px; }
136
+ .chat-head-actions > .locale-control { display: none; }
137
+ #chatView > .chat-head .chip:not(.rooms-drawer-trigger) { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; font-size: 0; }
138
+ #btnQuestions .question-badge { position: absolute; top: -5px; right: -5px; margin: 0; font-size: 10px; }
139
+ }
140
+
84
141
  @media (max-width: 760px) {
85
142
  #chatView { width: 100%; height: 100%; margin: 0; border: 0; border-radius: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto; }
86
143
  .room-rail { display: none; position: fixed; inset: 0 auto 0 0; z-index: 50; width: min(300px, 88vw); height: 100dvh; min-height: 0; padding: 20px 14px 14px; background: var(--surface); border-right: 1px solid var(--line); box-shadow: var(--shadow); }
@@ -98,22 +155,17 @@
98
155
  #chatView > .conn-bar { grid-column: 1; grid-row: 2; }
99
156
  #chatView > .msg-scroll { grid-column: 1; grid-row: 3; }
100
157
  #chatView > .composer { grid-column: 1; grid-row: 4; }
101
- .reader-excerpt { max-height: 46px; margin: 8px 0; padding: 6px 9px; }
102
158
  .chat-head-actions { flex: none; flex-wrap: nowrap; gap: 4px; }
103
159
  .chat-head-actions > .locale-control { display: none; }
104
160
  .chat-head-main { flex: 1; min-width: 0; }
105
161
  .room-title-row { gap: 6px; }
106
162
  .chat-head-main h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 18px; }
107
- .chat-head .chip { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; font-size: 0; }
163
+ .chat-head .chip { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; font-size: 0; }
164
+ #chatView > .chat-head .action-icon { display: block; }
108
165
  .rooms-drawer-trigger { display: grid; flex: none; }
109
- #btnRoomsDrawer::before { content: "☰"; font-size: 16px; }
110
- #btnQuestions::before { content: "?"; font-size: 17px; }
111
- #btnAnnouncements::before { content: "▤"; font-size: 16px; }
112
166
  #btnQuestions .question-badge { position: absolute; top: -5px; right: -5px; margin: 0; font-size: 10px; }
113
- #btnMembers::before { content: "♧"; font-size: 18px; }
114
- #btnDeleteRoom::before { content: "×"; font-size: 20px; }
115
- #btnLeave::before { content: "↪"; font-size: 17px; }
116
- .mobile-locale { display: block; }
167
+ #questionPanel, #announcementPanel { position: fixed; top: 70px; left: 12px; right: 12px; width: auto; max-height: calc(100dvh - 92px); }
168
+ .room-options-panel { right: 0; left: auto; }
117
169
  .thread { padding: 14px 12px 6px; }
118
170
  .msg-text { max-width: 92%; font-size: 15px; }
119
171
  .composer { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
@@ -126,18 +178,21 @@
126
178
  @media (max-width: 420px) {
127
179
  #chatView > .chat-head { align-items: center; }
128
180
  .chat-head-actions { justify-content: flex-start; gap: 2px; }
129
- .chat-head-actions .chip { width: 30px; height: 30px; padding: 0; font-size: 0; }
130
181
  .chat-head-actions .panel { max-height: min(70dvh, 520px); overflow: auto; }
131
182
  .room-meta { max-width: 100px; overflow: hidden; }
132
183
  }
184
+ @media (max-width: 300px) {
185
+ #chatView > .chat-head { padding: 8px; gap: 0; }
186
+ .chat-head-actions { gap: 0; }
187
+ .chat-head .chip { width: 36px; height: 36px; }
188
+ #btnRoomsDrawer { width: 36px; height: 36px; }
189
+ }
133
190
  @media (max-width: 260px) {
134
191
  #msgInput:placeholder-shown { min-height: calc(7.25em + 20px); }
135
192
  .composer-meta { min-height: 3.6em; }
136
193
  }
137
194
  @media (max-width: 220px) {
138
- #chatView > .chat-head { padding: 8px; gap: 3px; }
139
- .chat-head-actions { gap: 1px; }
140
- .chat-head-actions .chip { width: 26px; height: 26px; }
141
- .rooms-drawer-trigger { width: 26px; height: 26px; }
195
+ .chat-head .chip { width: 28px; height: 28px; }
196
+ #btnRoomsDrawer { width: 28px; height: 28px; }
142
197
  .room-title-row { gap: 3px; }
143
198
  }
@@ -8,7 +8,7 @@ import RoomService, {
8
8
  type Message,
9
9
  type Room,
10
10
  } from "../src/room-service";
11
- import { answerQuestion, readQuestions, readState, writeState, type Registry, type RegistryEntry } from "../src/store";
11
+ import { answerQuestion, sendReply, readQuestions, readState, writeState, type Registry, type RegistryEntry } from "../src/store";
12
12
  import {
13
13
  admissionMatches,
14
14
  clearPendingAdmission,
@@ -21,6 +21,8 @@ import { roomManagement } from "./newrooms";
21
21
  import { memberRoutes } from "./member-routes";
22
22
  import { resourceRoutes } from "./resource-routes";
23
23
  import { maxResourceBytes } from "../src/resources";
24
+ import { adminRoutes } from "./admin-routes";
25
+ import { roomReminderRoutes, startRoomReminderScheduler } from "./room-reminders";
24
26
 
25
27
  function parsePort(value: string): number {
26
28
  const port = Number(value);
@@ -80,8 +82,6 @@ async function handle(req: Request): Promise<Response> {
80
82
  return Response.redirect(new URL("/chat", url).toString(), 302);
81
83
  }
82
84
  if (req.method === "GET" && p === "/chat") {
83
- // ponytail: the human-facing chat page; APIs stay token-gated, the page
84
- // itself is a static shell
85
85
  const html = await fs
86
86
  .readFile(path.join(import.meta.dir, "chat.html"), "utf8")
87
87
  .catch(() => null);
@@ -91,8 +91,6 @@ async function handle(req: Request): Promise<Response> {
91
91
  return new Response(html, {
92
92
  headers: {
93
93
  "Content-Type": "text/html; charset=utf-8",
94
- // ponytail: never cache the page — the UI is iterated often and the
95
- // server reads it fresh from disk on every request
96
94
  "Cache-Control": "no-store",
97
95
  },
98
96
  });
@@ -112,7 +110,7 @@ async function handle(req: Request): Promise<Response> {
112
110
  // ponytail: F1 — reject non-JSON POSTs; a text/plain simple request from a
113
111
  // malicious page would otherwise mutate rooms cross-origin (no preflight)
114
112
  if (
115
- ["POST", "PUT", "DELETE"].includes(req.method) &&
113
+ ["POST", "PUT", "PATCH", "DELETE"].includes(req.method) &&
116
114
  !req.headers.get("content-type")?.includes("application/json") &&
117
115
  !(/^\/rooms\/[^/]+\/resources$/.test(p) && req.method === "POST")
118
116
  ) {
@@ -122,6 +120,9 @@ async function handle(req: Request): Promise<Response> {
122
120
  return json({ error: "unauthorized" }, 401);
123
121
  }
124
122
  try {
123
+ const reminders = await roomReminderRoutes(req, url);
124
+ if (reminders) return reminders;
125
+ const admin = await adminRoutes(req, url); if (admin) return admin;
125
126
  const resource = await resourceRoutes(req, url);
126
127
  if (resource) return resource;
127
128
  const history = await historyRoute(url);
@@ -386,6 +387,21 @@ async function handle(req: Request): Promise<Response> {
386
387
  if (text.length > 2000) {
387
388
  return json({ error: "text too long (max 2000)" }, 400);
388
389
  }
390
+ const replyTo = (body as Record<string, unknown>).replyToMessageID;
391
+ if (replyTo !== undefined && (typeof replyTo !== "string" || !replyTo)) return json({ error: "replyToMessageID must be a non-empty message ID" }, 400);
392
+ if (replyTo !== undefined) {
393
+ const result = await sendReply(roomId, replyTo, sessionID, text);
394
+ if (result.status !== "ok") {
395
+ if (result.status === "missing") return json({ error: "room not found" }, 404);
396
+ if (result.status === "target") return json({ error: "reply target not found in room" }, 404);
397
+ if (result.status === "question") return json({ error: "use the question answers endpoint to reply to a question" }, 409);
398
+ return json({ error: "session is not a room member" }, 409);
399
+ }
400
+ touchActive(sessionID);
401
+ const room = await read((svc) => svc.getRoom(roomId));
402
+ void wakeMentionedSessions(serveWakeUrl, roomId, room.name, text, sessionID, result.message);
403
+ return json(serializeRoom(room), 201);
404
+ }
389
405
  const room = await mutate((svc, reg) => {
390
406
  const senderEntry = reg[roomId]?.[sessionID];
391
407
  if (!senderEntry) throw new RoomError("NOT_JOINED", "session is not a room member");
@@ -493,6 +509,7 @@ export default {
493
509
  console.log(
494
510
  `chat-room center listening on http://${displayHostname}:${port}${token ? " (token auth on)" : ""}`,
495
511
  );
512
+ startRoomReminderScheduler();
496
513
  if (!token) {
497
514
  console.warn(
498
515
  "chat-room center has NO token auth — set CHAT_ROOM_SERVER_TOKEN if this port is reachable from other hosts",