@alexsun-top/opencode-chat-room 0.4.0 → 0.5.1

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 (53) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +38 -5
  3. package/README.zh-CN.md +34 -4
  4. package/docs/administrator-rooms.md +51 -0
  5. package/package.json +11 -1
  6. package/plugin.ts +28 -17
  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/announcement-routes.ts +34 -0
  14. package/server/assets/MERMAID-LICENSE +21 -0
  15. package/server/assets/NOTICE.txt +2 -1
  16. package/server/assets/base.css +60 -43
  17. package/server/assets/chat/admin.js +196 -0
  18. package/server/assets/chat/announcements.js +119 -0
  19. package/server/assets/chat/attachments.js +240 -0
  20. package/server/assets/chat/events.js +206 -10
  21. package/server/assets/chat/index.js +6 -0
  22. package/server/assets/chat/markdown.js +208 -16
  23. package/server/assets/chat/members.js +5 -2
  24. package/server/assets/chat/messages.js +85 -23
  25. package/server/assets/chat/receipts.js +22 -17
  26. package/server/assets/chat/rooms.js +32 -10
  27. package/server/assets/chat/state.js +88 -22
  28. package/server/assets/conversation.css +100 -40
  29. package/server/assets/mermaid-11.12.2.min.js +2811 -0
  30. package/server/assets/responsive.css +108 -49
  31. package/server/chat-server.ts +10 -11
  32. package/server/chat.html +85 -32
  33. package/server/member-routes.ts +3 -0
  34. package/server/newrooms.ts +29 -10
  35. package/server/resource-routes.ts +68 -0
  36. package/server/wake.ts +7 -14
  37. package/skills/chatroom/SKILL.md +104 -0
  38. package/src/admin-client.ts +130 -0
  39. package/src/admin-credentials.ts +58 -0
  40. package/src/agent-receipts.ts +4 -4
  41. package/src/announcement-tool.ts +25 -0
  42. package/src/announcements.ts +16 -0
  43. package/src/center-client.ts +27 -1
  44. package/src/center-inbox.ts +11 -9
  45. package/src/chatroom-skill.ts +15 -0
  46. package/src/plugin-notifications.ts +7 -9
  47. package/src/resource-upload.ts +50 -0
  48. package/src/resources.ts +104 -0
  49. package/src/sqlite-state.ts +81 -12
  50. package/src/store.ts +1 -10
  51. package/src/supervision-inbox.ts +62 -0
  52. package/src/v1-plugin.ts +19 -4
  53. package/src/v2-plugin.ts +45 -8
@@ -3,18 +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; }
12
- .room-meta { margin: 2px 0 0; font-size: 13px; color: var(--ink-2); }
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
+ .room-title-row { display: flex; align-items: center; min-width: 0; gap: 8px; }
13
+ .room-title-row h1 { flex: 1; min-width: 0; }
14
+ .rooms-drawer-trigger { display: none; }
15
+ .room-drawer-backdrop { position: fixed; inset: 0; z-index: 49; border: 0; background: rgb(9 16 22 / .38); }
16
+ .room-meta { margin: 4px 0 0; font-size: 11px; color: var(--ink-3); }
13
17
  .mono { font-family: var(--font-mono); }
14
18
  .copy-id {
15
19
  appearance: none;
16
20
  font: inherit;
17
- font-size: 12px;
21
+ font-size: 11px;
18
22
  color: var(--ink-3);
19
23
  background: none;
20
24
  border: none;
@@ -29,6 +33,7 @@
29
33
  .copy-id.copied .copy-ok { display: inline; color: var(--accent); }
30
34
 
31
35
  .chat-head-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
36
+ .chat-head .action-icon { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
32
37
  .question-panel { width: min(390px, calc(100vw - 32px)); max-height: min(70vh, 620px); overflow: auto; }
33
38
  .questions-trigger { position: relative; }
34
39
  .question-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
@@ -57,7 +62,10 @@
57
62
  cursor: pointer;
58
63
  transition: color .12s, border-color .12s, background .12s;
59
64
  }
60
- .chip:hover { color: var(--ink); border-color: var(--ink-3); }
65
+ .chip:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--accent-soft); }
66
+ .chip[aria-expanded="true"] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 44%, var(--line)); background: var(--accent-soft); }
67
+ .profile-trigger { display: grid; place-items: center; width: 36px; height: 36px; padding: 3px; border-radius: 50%; }
68
+ .profile-trigger .rail-avatar { width: 25px; height: 25px; font-size: 12px; font-weight: 700; }
61
69
  .chip.danger { color: var(--danger); }
62
70
  .chip.danger:hover { border-color: var(--danger); background: var(--danger-soft); }
63
71
 
@@ -68,11 +76,12 @@
68
76
  right: 0;
69
77
  z-index: 20;
70
78
  width: min(320px, calc(100vw - 32px));
71
- padding: 16px;
79
+ padding: 17px;
72
80
  background: var(--surface);
73
- border: 1px solid var(--line);
74
- border-radius: 14px;
81
+ border: 1px solid color-mix(in srgb, var(--accent) 14%, var(--line));
82
+ border-radius: 16px;
75
83
  box-shadow: var(--shadow);
84
+ backdrop-filter: blur(12px);
76
85
  animation: rise .18s ease both;
77
86
  }
78
87
  .panel h3 { margin: 0 0 10px; font-size: 14px; font-weight: 600; }
@@ -144,17 +153,18 @@
144
153
  right: 20px;
145
154
  bottom: 16px;
146
155
  z-index: 5;
147
- display: flex;
148
- align-items: center;
149
- gap: 6px;
150
- padding: 9px 14px;
156
+ display: grid;
157
+ place-items: center;
158
+ width: 44px;
159
+ height: 44px;
160
+ padding: 0;
151
161
  font: inherit;
152
162
  font-size: 13px;
153
163
  font-weight: 600;
154
164
  color: var(--accent-ink);
155
165
  background: var(--accent);
156
166
  border: none;
157
- border-radius: 999px;
167
+ border-radius: 50%;
158
168
  cursor: pointer;
159
169
  box-shadow: var(--shadow);
160
170
  transition: filter .12s, transform .1s;
@@ -162,6 +172,9 @@
162
172
  .jump:hover { filter: brightness(1.07); }
163
173
  .jump:active { transform: translateY(1px); }
164
174
  .jump .badge {
175
+ position: absolute;
176
+ top: -6px;
177
+ right: -6px;
165
178
  display: inline-flex;
166
179
  align-items: center;
167
180
  justify-content: center;
@@ -175,12 +188,12 @@
175
188
  border-radius: 999px;
176
189
  }
177
190
 
178
- .msg { display: flex; flex-direction: column; margin-bottom: 14px; }
191
+ .msg { display: flex; flex-direction: column; margin-bottom: 16px; }
179
192
  .msg.in, .sys.in, .day-sep.in { animation: msg-in .25s ease both; }
180
193
  .msg.own { align-items: flex-end; }
181
194
  .msg.repeat { margin-bottom: 8px; }
182
195
  .msg-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
183
- .msg-name { font-size: 14px; font-weight: 600; color: var(--ink); }
196
+ .msg-name { font-size: 13px; font-weight: 650; color: var(--ink-2); }
184
197
  .msg.own .msg-name { color: var(--accent); }
185
198
  .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; }
186
199
  .msg.repeat .msg-name { display: none; }
@@ -189,8 +202,10 @@
189
202
  display: inline-block;
190
203
  width: max-content;
191
204
  max-width: min(86%, 540px);
192
- padding: 8px 12px;
193
- border-radius: 14px;
205
+ padding: 9px 13px;
206
+ border: 1px solid color-mix(in srgb, var(--ink) 5%, transparent);
207
+ border-radius: 16px;
208
+ box-shadow: 0 1px 2px rgb(20 40 32 / .035);
194
209
  background: var(--surface-2);
195
210
  border-bottom-left-radius: 4px;
196
211
  font-size: 16px;
@@ -198,25 +213,36 @@
198
213
  white-space: normal;
199
214
  overflow-wrap: anywhere;
200
215
  }
201
- .msg.own .msg-text { background: var(--accent-soft); border-bottom-left-radius: 14px; border-bottom-right-radius: 4px; }
216
+ .msg-text::selection, .msg-text *::selection { color: var(--accent-ink); background: var(--accent); }
217
+ .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; }
202
218
  .msg-content { position: relative; display: flex; align-items: flex-end; gap: 6px; width: 100%; max-width: 100%; }
203
219
  .msg.own .msg-content { flex-direction: row-reverse; }
204
220
  .message-copy {
221
+ position: relative;
205
222
  align-self: flex-start;
206
- margin: 2px 0 0 4px;
207
- padding: 2px 6px;
208
- border: 0;
209
- border-radius: 5px;
223
+ display: grid;
224
+ place-items: center;
225
+ flex: none;
226
+ width: 32px;
227
+ height: 32px;
228
+ margin: 3px 0 0 4px;
229
+ padding: 0;
230
+ border: 1px solid transparent;
231
+ border-radius: 9px;
210
232
  color: var(--ink-3);
211
233
  background: transparent;
212
234
  font: inherit;
213
- font-size: 11px;
214
235
  cursor: pointer;
236
+ transition: color .14s, background .14s, border-color .14s;
215
237
  }
216
238
  .msg.own .message-copy { align-self: flex-end; margin-right: 4px; }
217
- .message-copy:hover, .message-copy:focus-visible { color: var(--ink); background: var(--surface-2); }
239
+ .message-copy-icon { display: block; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
240
+ .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)); }
218
241
  .message-copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
219
- .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; }
242
+ .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; }
243
+ .msg.own .message-copy-feedback { left: auto; right: 0; }
244
+ .sys .message-copy-feedback { left: 50%; right: auto; transform: translateX(-50%); }
245
+ .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); }
220
246
  .message-readers[data-reader-state="empty"], .message-readers[data-reader-state="unknown"] { background: var(--surface-2); }
221
247
  .message-readers:hover, .message-readers[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
222
248
  .message-readers:focus-visible, .reader-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@@ -224,13 +250,21 @@
224
250
  .receipt-reader-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
225
251
  .receipt-reader-list li + li { margin-top: 4px; }
226
252
  .receipt-reader-list li span:last-child { color: var(--ink-3); }
227
- .reader-panel { min-width: 0; grid-column: 3; grid-row: 2 / 5; overflow: auto; padding: 20px 16px; border-left: 1px solid var(--line); background: var(--surface); }
253
+ .reader-panel { position: fixed; z-index: 40; width: min(320px, calc(100vw - 24px)); min-width: 0; max-height: calc(100dvh - 24px); overflow: auto; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
228
254
  .reader-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
229
255
  .reader-panel-head h2 { margin: 0; font-family: var(--font-sans); font-size: 18px; font-weight: 650; letter-spacing: -.01em; }
230
256
  .reader-panel-head .hint { margin: 0 0 4px; }
231
257
  .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; }
232
258
  .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; }
233
259
  .reader-panel .receipt-reader-list li { display: grid; gap: 3px; padding: 10px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
260
+ .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)); }
261
+ .resource-info, .resource-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
262
+ .resource-name { min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
263
+ .resource-size, .resource-status { color: var(--ink-3); font-size: 12px; }
264
+ .resource-status { margin: 0; }
265
+ .resource-button { min-height: 34px; }
266
+ .chat-resource img, .chat-resource video { display: block; max-width: 100%; max-height: 420px; border-radius: 7px; }
267
+ .chat-resource audio { width: min(100%, 420px); }
234
268
 
235
269
  /* Markdown content */
236
270
  .msg-text p, .msg-text pre, .msg-text blockquote, .msg-text ul, .msg-text ol { margin: 0; }
@@ -368,46 +402,72 @@
368
402
 
369
403
  .gap { padding: 6px 0 2px; text-align: center; font-size: 12px; color: var(--ink-3); }
370
404
 
371
- .chat-empty { padding: 56px 0 40px; text-align: center; font-size: 13px; color: var(--ink-3); }
405
+ .chat-empty { padding: 64px 0 44px; text-align: center; font-family: var(--font-display); font-size: 16px; color: var(--ink-3); }
372
406
  .chat-empty::before {
373
407
  content: "";
374
408
  display: block;
375
409
  width: 56px;
376
410
  height: 56px;
377
411
  margin: 0 auto 14px;
378
- border: 1.5px dashed var(--line);
412
+ border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
379
413
  border-radius: 50%;
380
- background: radial-gradient(circle at 50% 50%, var(--ink-3) 0 3px, transparent 4px);
414
+ background: radial-gradient(circle at 50% 50%, var(--accent) 0 3px, transparent 4px), var(--accent-soft);
381
415
  }
382
416
 
383
417
  .composer {
384
418
  position: relative;
385
419
  display: flex;
386
420
  flex-direction: column;
387
- gap: 8px;
388
- padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
421
+ gap: 9px;
422
+ padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
389
423
  border-top: 1px solid var(--line);
390
- background: var(--surface);
424
+ background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--accent-soft) 18%, var(--surface)));
391
425
  }
392
- .composer-row { display: flex; gap: 10px; align-items: flex-end; }
393
- .question-toggle { width: min(940px, 100%); margin: -2px auto 0; color: var(--ink-2); font-size: 12px; }
426
+ .composer-row { display: flex; gap: 9px; align-items: flex-end; }
427
+ .composer-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: min(940px, 100%); min-width: 0; margin: -1px auto 0; }
428
+ .question-toggle { min-width: 0; margin: 0; color: var(--ink-2); font-size: 12px; }
394
429
  .question-toggle input { accent-color: var(--accent); vertical-align: -1px; }
395
430
  .composer .input { flex: 1; }
396
431
  .composer .input:disabled { opacity: .5; }
397
432
  #msgInput {
398
- min-height: 46px;
399
- max-height: 132px;
433
+ min-height: 0;
400
434
  padding: 12px 13px;
401
435
  line-height: 1.5;
436
+ border-radius: 15px;
437
+ background: color-mix(in srgb, var(--surface) 92%, var(--accent-soft));
402
438
  resize: none;
403
- overflow-y: auto;
439
+ overflow-y: hidden;
404
440
  }
405
441
  #btnSend { padding: 12px 22px; }
406
442
  .send-error { margin: 0; font-size: 12.5px; color: var(--danger); }
407
- .draft-count { width: min(940px, 100%); margin: -3px auto 0; color: var(--ink-3); text-align: right; font-size: 11px; font-variant-numeric: tabular-nums; }
443
+ .draft-count { flex: none; margin: 0; color: var(--ink-3); text-align: right; font-size: 11px; font-variant-numeric: tabular-nums; }
408
444
  .failed-messages { max-height: 150px; overflow-y: auto; padding: 8px 10px; border: 1px solid var(--danger-soft); border-radius: 10px; background: var(--danger-soft); }
409
445
  .failed-messages h3 { margin: 0 0 5px; color: var(--danger); font-size: 12px; }
410
446
  .failed-message { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-top: 1px solid var(--line); }
411
447
  .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; }
412
448
  .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; }
413
449
  .failed-message button:disabled { opacity: .5; cursor: default; }
450
+ .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; }
451
+ .attachment-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
452
+ .attachment-button:hover { color: var(--accent); border-color: var(--accent); }
453
+ .attachment-button:disabled { opacity: .5; cursor: default; }
454
+ .attachment-tray { width: min(940px, 100%); margin: 0 auto; }
455
+ .attachment-volatile { margin: 0 0 3px; color: var(--ink-3); font-size: 10.5px; }
456
+ .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; }
457
+ .attachment-status.danger-text { color: var(--danger); background: var(--danger-soft); }
458
+ .attachment-status:empty { display: none; }
459
+ .attachment-list { display: grid; gap: 6px; max-height: 132px; overflow: auto; margin: 0; padding: 0; list-style: none; }
460
+ .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); }
461
+ .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; }
462
+ .attachment-preview img { width: 100%; height: 100%; object-fit: cover; }
463
+ .attachment-file { min-width: 0; }
464
+ .attachment-name { overflow: hidden; margin: 0; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
465
+ .attachment-detail { margin: 0; color: var(--ink-3); font-size: 10px; }
466
+ .attachment-item progress { display: block; width: 100%; height: 5px; accent-color: var(--accent); }
467
+ .attachment-actions { display: flex; gap: 4px; }
468
+ .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; }
469
+ .attachment-actions button:hover { border-color: var(--accent); color: var(--accent); }
470
+ .attachment-over-limit { color: var(--danger); }
471
+ #draftCount.over-limit { color: var(--danger); font-weight: 700; }
472
+ .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; }
473
+ #chatView.drag-over .attachment-drop-overlay { display: grid; }