@alexsun-top/opencode-chat-room 0.7.1 → 0.7.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.
@@ -0,0 +1,86 @@
1
+ /* The rail "+" opens this modal instead of a small popover: one clear surface
2
+ with a backdrop, sized for desktop and near full width on phones. */
3
+ #createRoomDialog {
4
+ width: min(640px, calc(100vw - 40px));
5
+ max-width: none;
6
+ max-height: min(calc(100dvh - 40px), 760px);
7
+ padding: 30px 32px 26px;
8
+ overflow: auto;
9
+ color: var(--ink);
10
+ background:
11
+ radial-gradient(440px 260px at 100% 0%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 72%),
12
+ linear-gradient(155deg, var(--surface), color-mix(in srgb, var(--accent-soft) 22%, var(--surface)));
13
+ border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
14
+ border-radius: 24px;
15
+ box-shadow: 0 32px 100px rgb(10 25 20 / .28);
16
+ }
17
+ #createRoomDialog::backdrop {
18
+ background:
19
+ radial-gradient(900px 560px at 50% 0%, rgb(38 80 68 / .28), transparent 72%),
20
+ rgb(9 22 18 / .56);
21
+ backdrop-filter: blur(5px);
22
+ }
23
+ #createRoomDialog[open] { animation: create-room-enter .24s cubic-bezier(.2, .7, .3, 1); }
24
+ #createRoomDialog[open]::backdrop { animation: create-room-backdrop .24s ease; }
25
+ @keyframes create-room-enter { from { opacity: 0; transform: translateY(12px) scale(.985); } }
26
+ @keyframes create-room-backdrop { from { opacity: 0; } }
27
+
28
+ .create-room-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: start; }
29
+ .create-room-mark {
30
+ display: grid;
31
+ place-items: center;
32
+ width: 46px;
33
+ height: 46px;
34
+ border-radius: 14px 14px 14px 6px;
35
+ color: var(--accent-ink);
36
+ background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 80%, #18382f), var(--accent));
37
+ box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 24%, transparent);
38
+ }
39
+ .create-room-mark svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.9; }
40
+ .create-room-eyebrow { margin: 3px 0 1px; color: var(--ink-3); font-size: 10.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
41
+ .create-room-heading h2 { margin: 0; font-family: var(--font-display); font-size: 30px; font-weight: 600; letter-spacing: -.03em; line-height: 1.12; }
42
+ .create-room-head .reader-close { margin: -8px -10px 0 0; }
43
+ .create-room-hint { max-width: 46ch; margin: 14px 0 0; color: var(--ink-2); font-size: 14px; line-height: 1.55; }
44
+
45
+ .create-room-form { margin-top: 24px; }
46
+ .create-room-input { min-height: 50px; padding: 12px 14px; font-size: 17px; }
47
+ .create-room-policy {
48
+ margin-top: 16px;
49
+ padding: 14px 16px;
50
+ border: 1px solid color-mix(in srgb, var(--accent) 16%, var(--line));
51
+ border-radius: 16px;
52
+ background: color-mix(in srgb, var(--accent-soft) 46%, var(--surface));
53
+ }
54
+ .create-room-policy .join-policy { margin: 0; }
55
+ .create-room-policy .join-policy-label { font-size: 14px; }
56
+ .create-room-policy-hint { margin: 7px 0 0 43px; line-height: 1.45; }
57
+ .create-room-error { margin: 16px 0 0; }
58
+ .create-room-actions {
59
+ display: flex;
60
+ justify-content: flex-end;
61
+ gap: 10px;
62
+ margin-top: 22px;
63
+ padding-top: 18px;
64
+ border-top: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
65
+ }
66
+ .create-room-actions .btn { min-width: 126px; }
67
+
68
+ @media (max-width: 640px) {
69
+ #createRoomDialog {
70
+ width: calc(100vw - 20px);
71
+ max-height: calc(100dvh - 20px);
72
+ padding: 20px 18px 18px;
73
+ border-radius: 20px;
74
+ }
75
+ .create-room-head { gap: 12px; }
76
+ .create-room-mark { width: 40px; height: 40px; border-radius: 12px 12px 12px 5px; }
77
+ .create-room-mark svg { width: 19px; height: 19px; }
78
+ .create-room-heading h2 { font-size: 24px; }
79
+ .create-room-head .reader-close { margin: -4px -6px 0 0; }
80
+ .create-room-hint { margin-top: 12px; font-size: 13.5px; }
81
+ .create-room-form { margin-top: 18px; }
82
+ .create-room-policy { padding: 12px 13px; }
83
+ .create-room-policy-hint { margin-left: 0; }
84
+ .create-room-actions { flex-direction: column-reverse; margin-top: 18px; padding-top: 16px; }
85
+ .create-room-actions .btn { width: 100%; min-height: 46px; }
86
+ }
@@ -96,43 +96,101 @@
96
96
  .join-settings:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); background: var(--accent-soft); }
97
97
  .join-settings:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
98
98
 
99
- /* Settings: one dialog for language, theme, and the optional access token. */
100
- .settings-dialog { width: min(540px, calc(100vw - 28px)); max-width: none; max-height: min(88dvh, 720px); padding: 0; overflow: auto; color: var(--ink); background: 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 / .22); }
101
- .settings-dialog::backdrop { background: rgb(9 22 18 / .46); backdrop-filter: blur(3px); }
102
- .settings-sheet { display: flex; flex-direction: column; gap: 18px; padding: 24px; background: linear-gradient(150deg, color-mix(in srgb, var(--accent-soft) 28%, var(--surface)), var(--surface) 55%); }
103
- .settings-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
104
- .settings-head h2 { margin: 0; font-family: var(--font-display); font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
99
+ /* Settings: one dialog for language, appearance, and the optional access token. */
100
+ .settings-dialog { width: min(1000px, calc(100vw - 32px)); max-width: none; height: min(720px, calc(100dvh - 40px)); max-height: none; margin: auto; padding: 0; overflow: hidden; color: var(--ink); background: var(--surface); border: 1px solid color-mix(in srgb, var(--accent) 16%, var(--line)); border-radius: 22px; box-shadow: 0 30px 90px rgb(8 22 18 / .32); }
101
+ .settings-dialog[open] { display: flex; flex-direction: column; animation: settings-in .18s ease-out both; }
102
+ .settings-dialog::backdrop { background: rgb(8 20 16 / .52); backdrop-filter: blur(5px); }
103
+ @keyframes settings-in { from { opacity: 0; transform: translateY(8px) scale(.995); } }
104
+ @media (prefers-reduced-motion: reduce) { .settings-dialog[open] { animation: none; } }
105
+
106
+ .settings-head { flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 16px; }
107
+ .settings-heading { min-width: 0; }
108
+ .settings-head h2 { margin: 0; font-family: var(--font-display); font-size: 22px; font-weight: 650; letter-spacing: -.02em; }
105
109
  .settings-head h2:focus { outline: none; }
106
- .settings-lead { margin: 4px 0 0; color: var(--ink-3); font-size: 12.5px; line-height: 1.5; }
107
- .settings-section { margin: 0; padding: 0; border: 0; }
108
- .settings-section + .settings-section { padding-top: 16px; border-top: 1px solid color-mix(in srgb, var(--line) 78%, transparent); }
109
- .settings-section .field { margin-bottom: 0; }
110
- .settings-section .btn.small { margin-top: 8px; }
111
- .settings-select { width: 100%; min-height: 40px; font-size: 14px; }
112
- .settings-themes { min-width: 0; }
113
- .settings-themes legend { padding: 0; }
114
- .theme-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); gap: 8px; margin-top: 8px; }
115
- .theme-option { position: relative; display: grid; gap: 6px; min-width: 0; padding: 7px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
110
+ .settings-lead { margin: 5px 0 0; max-width: 560px; color: var(--ink-3); font-size: 12.5px; line-height: 1.5; }
111
+ .settings-close { width: 40px; height: 40px; border-radius: 10px; }
112
+
113
+ .settings-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 232px minmax(0, 1fr); }
114
+ .settings-nav { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; padding: 2px 24px 22px; border-right: 1px solid color-mix(in srgb, var(--line) 74%, transparent); }
115
+ .settings-tab { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 9px 12px; border: 1px solid transparent; border-radius: 11px; color: var(--ink-2); background: transparent; font: inherit; font-size: 13.5px; font-weight: 600; text-align: left; cursor: pointer; transition: color .14s, background .14s, border-color .14s; }
116
+ .settings-tab svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
117
+ .settings-tab:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 5%, transparent); }
118
+ .settings-tab[aria-selected="true"] { color: var(--ink); background: var(--surface-2); border-color: color-mix(in srgb, var(--line) 72%, transparent); box-shadow: 0 1px 2px rgb(20 35 30 / .06); }
119
+ .settings-tab[aria-selected="true"] svg { color: var(--accent); }
120
+ .settings-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
121
+ .settings-content { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
122
+ .settings-panel { max-width: 780px; padding: 4px 30px 30px 26px; }
123
+ .settings-panel[hidden] { display: none; }
124
+
125
+ .settings-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px 22px; padding: 18px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent); }
126
+ .settings-row:first-child { padding-top: 10px; }
127
+ .settings-row:last-of-type { border-bottom: 0; }
128
+ .settings-copy { min-width: 0; display: grid; gap: 4px; }
129
+ .settings-label { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--ink); font-size: 14px; font-weight: 600; line-height: 1.35; }
130
+ .settings-hint { margin: 0; color: var(--ink-3); font-size: 12.5px; line-height: 1.45; }
131
+ .settings-warning { color: var(--warning); font-weight: 600; }
132
+ .settings-select { width: 168px; min-height: 38px; font-size: 13.5px; }
133
+ .settings-number { display: flex; align-items: center; gap: 8px; }
134
+ .settings-number .input { width: 82px; min-height: 38px; text-align: right; }
135
+ .settings-number-unit { color: var(--ink-3); font-size: 13px; }
136
+
137
+ .settings-switch { position: relative; flex: none; appearance: none; width: 42px; height: 24px; margin: 0; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); cursor: pointer; transition: background .16s, border-color .16s; }
138
+ .settings-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgb(34 53 47 / .18); transition: transform .16s, background .16s; }
139
+ .settings-switch:checked { border-color: var(--accent); background: var(--accent); }
140
+ .settings-switch:checked::after { transform: translateX(18px); background: var(--accent-ink); }
141
+ .settings-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
142
+
143
+ .settings-block { min-width: 0; margin: 0; padding: 14px 0 4px; border: 0; }
144
+ .settings-block legend.settings-label { display: block; margin: 0; padding: 0; }
145
+ .settings-block .settings-hint { margin-top: 4px; }
146
+ .theme-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 10px; margin-top: 14px; }
147
+ .theme-option { position: relative; display: grid; gap: 8px; min-width: 0; padding: 8px 8px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s; }
116
148
  .theme-option:hover { border-color: color-mix(in srgb, var(--accent) 38%, var(--line)); }
117
- .theme-option:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 58%, var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent); }
149
+ .theme-option:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 42%, var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent); }
118
150
  .theme-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
119
- .theme-option input:focus-visible + .theme-swatch { outline: 2px solid var(--accent); outline-offset: 2px; }
120
- .theme-swatch { position: relative; display: block; height: 46px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--line) 75%, transparent); border-radius: 8px; background: var(--swatch-bg, var(--surface-2)); }
121
- .theme-swatch::before { content: ""; position: absolute; top: 9px; left: 9px; right: 9px; height: 11px; border-radius: 4px; background: var(--swatch-surface, var(--surface)); }
122
- .theme-swatch::after { content: ""; position: absolute; left: 9px; bottom: 8px; width: 20px; height: 5px; border-radius: 99px; background: var(--swatch-accent, var(--accent)); }
123
- .theme-name { min-width: 0; overflow: hidden; color: var(--ink-2); font-size: 11px; font-weight: 600; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
151
+ .theme-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
152
+ .theme-option:has(input:checked)::after { content: "✓"; position: absolute; top: 14px; right: 14px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: var(--accent-ink); background: var(--accent); font-size: 11px; font-weight: 700; line-height: 1; }
153
+ .theme-preview { position: relative; display: block; height: 64px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--line) 75%, transparent); border-radius: 9px; background: var(--swatch-bg, var(--surface-2)); }
154
+ .theme-preview::before { content: ""; position: absolute; top: 10px; left: 10px; right: 10px; height: 14px; border-radius: 5px; background: var(--swatch-surface, var(--surface)); }
155
+ .theme-preview::after { content: ""; position: absolute; left: 10px; bottom: 10px; width: 26px; height: 6px; border-radius: 99px; background: var(--swatch-accent, var(--accent)); }
156
+ .theme-name { min-width: 0; overflow: hidden; color: var(--ink-2); font-size: 11.5px; font-weight: 600; line-height: 1.3; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
124
157
  .theme-option:has(input:checked) .theme-name { color: var(--ink); }
125
- .theme-option[data-theme-choice="system"] .theme-swatch { background: linear-gradient(118deg, #f3f1ea 0 50%, #111b19 50%); }
126
- .theme-option[data-theme-choice="system"] .theme-swatch::before { background: linear-gradient(90deg, #fffefa 0 50%, #182522 50%); }
127
- .theme-option[data-theme-choice="system"] .theme-swatch::after { background: linear-gradient(90deg, #22695c 0 50%, #8ac9aa 50%); }
128
- .theme-option[data-theme-choice="light"] .theme-swatch { --swatch-bg: #f3f1ea; --swatch-surface: #fffefa; --swatch-accent: #22695c; }
129
- .theme-option[data-theme-choice="dark"] .theme-swatch { --swatch-bg: #111b19; --swatch-surface: #182522; --swatch-accent: #8ac9aa; }
130
- .theme-option[data-theme-choice="forest"] .theme-swatch { --swatch-bg: #e7ede2; --swatch-surface: #f7faf4; --swatch-accent: #2f6b45; }
131
- .theme-option[data-theme-choice="sand"] .theme-swatch { --swatch-bg: #f4e9d6; --swatch-surface: #fff9ef; --swatch-accent: #9a5a32; }
132
- .settings-privacy { margin-top: 10px; line-height: 1.5; }
133
- @media (max-width: 560px) {
134
- .settings-dialog { width: calc(100vw - 20px); }
135
- .settings-sheet { gap: 14px; padding: 18px; }
136
- .settings-head h2 { font-size: 22px; }
137
- .theme-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
158
+ .theme-option[data-theme-choice="system"] .theme-preview { background: linear-gradient(118deg, #f3f1ea 0 50%, #111b19 50%); }
159
+ .theme-option[data-theme-choice="system"] .theme-preview::before { background: linear-gradient(90deg, #fffefa 0 50%, #182522 50%); }
160
+ .theme-option[data-theme-choice="system"] .theme-preview::after { background: linear-gradient(90deg, #22695c 0 50%, #8ac9aa 50%); }
161
+ .theme-option[data-theme-choice="light"] .theme-preview { --swatch-bg: #f3f1ea; --swatch-surface: #fffefa; --swatch-accent: #22695c; }
162
+ .theme-option[data-theme-choice="dark"] .theme-preview { --swatch-bg: #111b19; --swatch-surface: #182522; --swatch-accent: #8ac9aa; }
163
+ .theme-option[data-theme-choice="forest"] .theme-preview { --swatch-bg: #e7ede2; --swatch-surface: #f7faf4; --swatch-accent: #2f6b45; }
164
+ .theme-option[data-theme-choice="sand"] .theme-preview { --swatch-bg: #f4e9d6; --swatch-surface: #fff9ef; --swatch-accent: #9a5a32; }
165
+
166
+ .settings-token-control { display: flex; align-items: center; gap: 8px; }
167
+ .settings-token-control .input { width: 220px; min-height: 38px; }
168
+ .settings-token-control .btn { flex: none; }
169
+ .settings-note { margin: 18px 0 0; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--line) 82%, transparent); border-radius: 12px; background: color-mix(in srgb, var(--surface-2) 62%, var(--surface)); color: var(--ink-3); font-size: 12.5px; line-height: 1.5; }
170
+
171
+ @media (max-width: 760px) {
172
+ .settings-dialog { width: calc(100vw - 16px); height: calc(100dvh - 16px); border-radius: 18px; }
173
+ .settings-head { padding: 16px 16px 12px; }
174
+ .settings-head h2 { font-size: 20px; }
175
+ .settings-close { width: 40px; height: 40px; }
176
+ .settings-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
177
+ .settings-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 0 12px 12px; border-right: 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 74%, transparent); overflow: visible; }
178
+ .settings-tab { flex-direction: column; justify-content: center; gap: 4px; min-height: 52px; padding: 7px 4px; font-size: 11.5px; text-align: center; }
179
+ .settings-tab svg { width: 16px; height: 16px; }
180
+ .settings-panel { padding: 8px 16px 24px; }
181
+ .settings-row { gap: 10px 14px; padding: 15px 0; }
182
+ .settings-row:first-child { padding-top: 10px; }
183
+ .settings-label { font-size: 13.5px; }
184
+ .settings-hint { font-size: 12px; }
185
+ .settings-select { width: 148px; min-height: 38px; }
186
+ .settings-block { padding-top: 12px; }
187
+ .theme-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
188
+ .theme-option { padding: 6px 6px 8px; }
189
+ .theme-option:has(input:checked)::after { top: 10px; right: 10px; width: 16px; height: 16px; font-size: 10px; }
190
+ .theme-preview { height: 48px; }
191
+ .theme-name { font-size: 11px; }
192
+ .settings-row-stack { grid-template-columns: minmax(0, 1fr); }
193
+ .settings-token-control { width: 100%; }
194
+ .settings-token-control .input { flex: 1; width: auto; min-width: 0; }
195
+ .settings-note { margin-top: 14px; }
138
196
  }
@@ -276,9 +276,9 @@ async function handle(req: Request): Promise<Response> {
276
276
  // A recall bumps the version without creating a message; wake the poll so
277
277
  // the client can refetch the room snapshot (reliable version compare).
278
278
  while (result.items.length === 0 && result.recallVersion === initialRecallVersion && Date.now() < deadline) {
279
- // ponytail: 2s between disk scans (orc-1 #7) — 1s × 25 iterations
280
- // doubles the file reads on shared-mount deployments
281
- await sleep(Math.max(1, Math.min(2000, deadline - Date.now())));
279
+ // ponytail: 500ms between disk scans keeps notification latency under
280
+ // half a second; a longer interval makes deliveries feel stuck.
281
+ await sleep(Math.max(1, Math.min(500, deadline - Date.now())));
282
282
  result = await readInbox(sessionID, roomFilter, excludeSelf, afterTs);
283
283
  }
284
284
  return json(result);
package/server/chat.html CHANGED
@@ -26,6 +26,7 @@
26
26
  <link rel="stylesheet" href="/assets/attachments.css">
27
27
  <link rel="stylesheet" href="/assets/responsive.css">
28
28
  <link rel="stylesheet" href="/assets/code-highlight.css">
29
+ <link rel="stylesheet" href="/assets/room-create.css">
29
30
  </head>
30
31
  <body>
31
32
 
@@ -127,68 +128,112 @@
127
128
 
128
129
  <!-- One settings surface for the join page and the signed-in chat. -->
129
130
  <dialog id="chatSettings" class="settings-dialog" aria-labelledby="settingsHeading">
130
- <div class="settings-sheet">
131
- <header class="settings-head">
132
- <div>
133
- <h2 id="settingsHeading" tabindex="-1" data-i18n="settings">Settings</h2>
134
- <p class="settings-lead" data-i18n="settingsLocalHint">Language and theme are saved in this browser.</p>
135
- </div>
136
- <button id="btnCloseSettings" class="reader-close" type="button" aria-label="Close" data-i18n-aria-label="close"><svg class="close-icon" aria-hidden="true" viewBox="0 0 24 24"><path d="M6 6l12 12M18 6 6 18"/></svg></button>
137
- </header>
138
- <section class="settings-section">
139
- <label class="field">
140
- <span class="field-label locale-label"><svg class="locale-icon" aria-hidden="true" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3c2.5 2.7 3.8 5.7 3.8 9S14.5 18.3 12 21M12 3C9.5 5.7 8.2 8.7 8.2 12s1.3 6.3 3.8 9"/></svg><span data-i18n="languageLabel">Language</span></span>
141
- <select id="localeSelectSettings" class="locale-select settings-select">
142
- <option value="en">English</option>
143
- <option value="zh-CN">中文</option>
144
- <option value="ja">日本語</option>
145
- <option value="ko">한국어</option>
146
- <option value="fr">Français</option>
147
- <option value="de">Deutsch</option>
148
- <option value="es">Español</option>
149
- <option value="it">Italiano</option>
150
- </select>
151
- </label>
152
- </section>
153
- <fieldset class="settings-section settings-themes">
154
- <legend class="field-label" data-i18n="themeLabel">Theme</legend>
155
- <div class="theme-grid">
156
- <label class="theme-option" data-theme-choice="system">
157
- <input type="radio" name="theme" value="system">
158
- <span class="theme-swatch" aria-hidden="true"></span>
159
- <span class="theme-name" data-i18n="themeSystem">System</span>
160
- </label>
161
- <label class="theme-option" data-theme-choice="light">
162
- <input type="radio" name="theme" value="light">
163
- <span class="theme-swatch" aria-hidden="true"></span>
164
- <span class="theme-name" data-i18n="themeLight">Light</span>
165
- </label>
166
- <label class="theme-option" data-theme-choice="dark">
167
- <input type="radio" name="theme" value="dark">
168
- <span class="theme-swatch" aria-hidden="true"></span>
169
- <span class="theme-name" data-i18n="themeDark">Dark</span>
170
- </label>
171
- <label class="theme-option" data-theme-choice="forest">
172
- <input type="radio" name="theme" value="forest">
173
- <span class="theme-swatch" aria-hidden="true"></span>
174
- <span class="theme-name" data-i18n="themeForest">Forest</span>
175
- </label>
176
- <label class="theme-option" data-theme-choice="sand">
177
- <input type="radio" name="theme" value="sand">
178
- <span class="theme-swatch" aria-hidden="true"></span>
179
- <span class="theme-name" data-i18n="themeSand">Sand</span>
180
- </label>
181
- </div>
182
- </fieldset>
183
- <section class="settings-section">
184
- <label class="field">
185
- <span class="field-label" data-i18n="tokenOptional">Access token (optional)</span>
186
- <input id="inTokenChat" class="input" type="password" placeholder="Enter if the server requires it" data-i18n-placeholder="tokenPlaceholder" autocomplete="off" spellcheck="false">
187
- </label>
188
- <button class="btn ghost small" type="button" data-token-save="inTokenChat" data-i18n="save">Save</button>
189
- <p id="tokenHint" class="hint" data-i18n="tokenRequired" hidden>The server requires an access token (401).</p>
190
- <p class="hint settings-privacy" data-i18n="privacyNote">Anyone with the shared token can read direct messages and manage rooms; the server can read them too.</p>
191
- </section>
131
+ <header class="settings-head">
132
+ <div class="settings-heading">
133
+ <h2 id="settingsHeading" tabindex="-1" data-i18n="settings">Settings</h2>
134
+ <p class="settings-lead" data-i18n="settingsLocalHint">Language, theme, transition, and scrolling preferences are saved in this browser.</p>
135
+ </div>
136
+ <button id="btnCloseSettings" class="reader-close settings-close" type="button" aria-label="Close" data-i18n-aria-label="close"><svg class="close-icon" aria-hidden="true" viewBox="0 0 24 24"><path d="M6 6l12 12M18 6 6 18"/></svg></button>
137
+ </header>
138
+ <div class="settings-body">
139
+ <nav class="settings-nav" role="tablist" aria-label="Settings sections" data-i18n-aria-label="settingsSections">
140
+ <button id="settingsTabGeneral" class="settings-tab" type="button" role="tab" aria-selected="true" aria-controls="settingsPanelGeneral" data-settings-tab="general">
141
+ <svg aria-hidden="true" viewBox="0 0 24 24"><path d="M4 7h9M17 7h3M4 17h3M11 17h9"/><circle cx="15" cy="7" r="2"/><circle cx="9" cy="17" r="2"/></svg>
142
+ <span data-i18n="settingsGeneral">General</span>
143
+ </button>
144
+ <button id="settingsTabAppearance" class="settings-tab" type="button" role="tab" aria-selected="false" aria-controls="settingsPanelAppearance" tabindex="-1" data-settings-tab="appearance">
145
+ <svg aria-hidden="true" viewBox="0 0 24 24"><circle cx="12" cy="12" r="8"/><path d="M12 4v16"/><path d="M12 4a8 8 0 0 1 0 16" fill="currentColor" stroke="none"/></svg>
146
+ <span data-i18n="settingsAppearance">Appearance</span>
147
+ </button>
148
+ <button id="settingsTabConnection" class="settings-tab" type="button" role="tab" aria-selected="false" aria-controls="settingsPanelConnection" tabindex="-1" data-settings-tab="connection">
149
+ <svg aria-hidden="true" viewBox="0 0 24 24"><circle cx="8" cy="12" r="3"/><path d="M11 12h9M17 12v3M20 12v2"/></svg>
150
+ <span data-i18n="settingsConnection">Connection</span>
151
+ </button>
152
+ </nav>
153
+ <div class="settings-content">
154
+ <section id="settingsPanelGeneral" class="settings-panel" role="tabpanel" aria-labelledby="settingsTabGeneral">
155
+ <div class="settings-row">
156
+ <div class="settings-copy">
157
+ <label class="settings-label locale-label" for="localeSelectSettings">
158
+ <svg class="locale-icon" aria-hidden="true" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3c2.5 2.7 3.8 5.7 3.8 9S14.5 18.3 12 21M12 3C9.5 5.7 8.2 8.7 8.2 12s1.3 6.3 3.8 9"/></svg>
159
+ <span data-i18n="languageLabel">Language</span>
160
+ </label>
161
+ <p class="settings-hint" data-i18n="settingsLanguageHint">Applies right away and is saved in this browser.</p>
162
+ </div>
163
+ <select id="localeSelectSettings" class="locale-select settings-select">
164
+ <option value="en">English</option>
165
+ <option value="zh-CN">中文</option>
166
+ <option value="ja">日本語</option>
167
+ <option value="ko">한국어</option>
168
+ <option value="fr">Français</option>
169
+ <option value="de">Deutsch</option>
170
+ <option value="es">Español</option>
171
+ <option value="it">Italiano</option>
172
+ </select>
173
+ </div>
174
+ <div class="settings-row">
175
+ <div class="settings-copy">
176
+ <label class="settings-label" for="inContentTransition" data-i18n="contentTransition">Room content transition</label>
177
+ <p id="contentTransitionHint" class="settings-hint" data-i18n="contentTransitionHint">Slide messages in when switching rooms with Alt+Arrow. Off by default.</p>
178
+ </div>
179
+ <input id="inContentTransition" class="settings-switch" type="checkbox" role="switch" aria-describedby="contentTransitionHint">
180
+ </div>
181
+ <div class="settings-row">
182
+ <div class="settings-copy">
183
+ <label class="settings-label" for="inPageStep" data-i18n="pageStep">Page scroll distance</label>
184
+ <p id="pageStepHint" class="settings-hint" data-i18n="pageStepHint">How far PageUp and PageDown move per press, as a percentage of the conversation height. Default 90%.</p>
185
+ </div>
186
+ <div class="settings-number"><input id="inPageStep" class="input" type="number" min="20" max="200" step="5" inputmode="numeric" value="90" aria-describedby="pageStepHint"><span class="settings-number-unit" aria-hidden="true">%</span></div>
187
+ </div>
188
+ </section>
189
+ <section id="settingsPanelAppearance" class="settings-panel" role="tabpanel" aria-labelledby="settingsTabAppearance" hidden>
190
+ <fieldset class="settings-block">
191
+ <legend class="settings-label" data-i18n="themeLabel">Theme</legend>
192
+ <p class="settings-hint" data-i18n="settingsThemeHint">Saved in this browser. System follows your device.</p>
193
+ <div class="theme-grid">
194
+ <label class="theme-option" data-theme-choice="system">
195
+ <input type="radio" name="theme" value="system">
196
+ <span class="theme-preview" aria-hidden="true"></span>
197
+ <span class="theme-name" data-i18n="themeSystem">System</span>
198
+ </label>
199
+ <label class="theme-option" data-theme-choice="light">
200
+ <input type="radio" name="theme" value="light">
201
+ <span class="theme-preview" aria-hidden="true"></span>
202
+ <span class="theme-name" data-i18n="themeLight">Light</span>
203
+ </label>
204
+ <label class="theme-option" data-theme-choice="dark">
205
+ <input type="radio" name="theme" value="dark">
206
+ <span class="theme-preview" aria-hidden="true"></span>
207
+ <span class="theme-name" data-i18n="themeDark">Dark</span>
208
+ </label>
209
+ <label class="theme-option" data-theme-choice="forest">
210
+ <input type="radio" name="theme" value="forest">
211
+ <span class="theme-preview" aria-hidden="true"></span>
212
+ <span class="theme-name" data-i18n="themeForest">Forest</span>
213
+ </label>
214
+ <label class="theme-option" data-theme-choice="sand">
215
+ <input type="radio" name="theme" value="sand">
216
+ <span class="theme-preview" aria-hidden="true"></span>
217
+ <span class="theme-name" data-i18n="themeSand">Sand</span>
218
+ </label>
219
+ </div>
220
+ </fieldset>
221
+ </section>
222
+ <section id="settingsPanelConnection" class="settings-panel" role="tabpanel" aria-labelledby="settingsTabConnection" hidden>
223
+ <div class="settings-row settings-row-stack">
224
+ <div class="settings-copy">
225
+ <label class="settings-label" for="inTokenChat" data-i18n="tokenOptional">Access token (optional)</label>
226
+ <p class="settings-hint" data-i18n="settingsTokenHint">Stored only in this browser. Needed only when the server asks for it.</p>
227
+ <p id="tokenHint" class="settings-hint settings-warning" data-i18n="tokenRequired" hidden>The server requires an access token (401).</p>
228
+ </div>
229
+ <div class="settings-token-control">
230
+ <input id="inTokenChat" class="input" type="password" placeholder="Enter if the server requires it" data-i18n-placeholder="tokenPlaceholder" autocomplete="off" spellcheck="false" aria-describedby="tokenHint">
231
+ <button class="btn ghost small" type="button" data-token-save="inTokenChat" data-i18n="save">Save</button>
232
+ </div>
233
+ </div>
234
+ <p class="settings-note" data-i18n="privacyNote">Anyone with the shared token can read direct messages and manage rooms; the server can read them too.</p>
235
+ </section>
236
+ </div>
192
237
  </div>
193
238
  </dialog>
194
239
 
@@ -196,16 +241,7 @@
196
241
  <section id="chatView" class="view" hidden>
197
242
  <aside id="roomRail" class="room-rail" aria-label="Rooms" data-i18n-aria-label="roomsLabel">
198
243
  <div class="rail-brand"><span class="brand-mark">OC</span><span data-i18n="brand">OC Chat</span><span class="version-tag">{{version}}</span></div>
199
- <div class="rail-label"><span data-i18n="existingRooms">Rooms</span><span class="rail-tools"><button id="btnNewRoom" class="icon-btn" type="button" aria-label="Create a room" data-i18n-aria-label="newRoom"><svg aria-hidden="true" viewBox="0 0 24 24"><path d="M12 5v14M5 12h14"/></svg></button><button id="btnRefreshRooms" class="icon-btn" type="button" aria-label="Refresh rooms" data-i18n-aria-label="refreshRooms"><svg aria-hidden="true" viewBox="0 0 24 24"><path d="M20 7v5h-5M4 17v-5h5"/><path d="M5.6 9a7 7 0 0 1 11.8-2L20 12M4 12l2.6 5a7 7 0 0 0 11.8-2"/></svg></button></span></div>
200
- <form id="railRoomForm" class="rail-composer" hidden>
201
- <label class="field"><span class="field-label" data-i18n="newRoomNameLabel">New room name</span><input id="inRoomNameChat" class="input" maxlength="40" data-i18n-placeholder="newRoomNamePlaceholder" placeholder="e.g. Weekend movie night"></label>
202
- <div class="join-policy rail-join-policy">
203
- <input id="inApprovalRequiredChat" type="checkbox" role="switch" aria-describedby="inApprovalRequiredChatHint">
204
- <label for="inApprovalRequiredChat" class="join-policy-label" data-i18n="requireApproval">Require approval to join</label>
205
- </div>
206
- <p id="inApprovalRequiredChatHint" class="hint join-policy-hint rail-join-policy-hint" data-i18n="requireApprovalHint">New members need a human administrator's approval. Agents may also be approved by the administrator agent.</p>
207
- <button id="btnCreateChatRoom" class="btn primary small" type="submit" data-i18n="createRoom">Create room</button>
208
- </form>
244
+ <div class="rail-label"><span data-i18n="existingRooms">Rooms</span><span class="rail-tools"><button id="btnNewRoom" class="icon-btn" type="button" aria-label="Create a room" data-i18n-aria-label="newRoom" aria-haspopup="dialog" aria-controls="createRoomDialog" aria-expanded="false"><svg aria-hidden="true" viewBox="0 0 24 24"><path d="M12 5v14M5 12h14"/></svg></button><button id="btnRefreshRooms" class="icon-btn" type="button" aria-label="Refresh rooms" data-i18n-aria-label="refreshRooms"><svg aria-hidden="true" viewBox="0 0 24 24"><path d="M20 7v5h-5M4 17v-5h5"/><path d="M5.6 9a7 7 0 0 1 11.8-2L20 12M4 12l2.6 5a7 7 0 0 0 11.8-2"/></svg></button></span></div>
209
245
  <ul id="roomListChat" class="rail-rooms"></ul>
210
246
  <p id="roomListChatEmpty" class="hint" data-i18n="noRooms" hidden></p>
211
247
 
@@ -221,6 +257,35 @@
221
257
  </div>
222
258
  </div>
223
259
  </aside>
260
+ <dialog id="createRoomDialog" class="admin-dialog create-room-dialog" aria-labelledby="createRoomHeading" aria-describedby="createRoomHint">
261
+ <header class="create-room-head">
262
+ <span class="create-room-mark" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M12 5v14M5 12h14"/></svg></span>
263
+ <div class="create-room-heading">
264
+ <p class="create-room-eyebrow" data-i18n="existingRooms">Rooms</p>
265
+ <h2 id="createRoomHeading" data-i18n="createRoomTitle">Create a room</h2>
266
+ </div>
267
+ <button id="btnCloseCreateRoom" class="reader-close" type="button" aria-label="Close" data-i18n-aria-label="close"><svg class="close-icon" aria-hidden="true" viewBox="0 0 24 24"><path d="M6 6l12 12M18 6 6 18"/></svg></button>
268
+ </header>
269
+ <p id="createRoomHint" class="create-room-hint" data-i18n="createRoomHint">Start a new room and invite people with its ID.</p>
270
+ <form id="railRoomForm" class="create-room-form" novalidate>
271
+ <label class="field create-room-field">
272
+ <span class="field-label" data-i18n="newRoomNameLabel">New room name</span>
273
+ <input id="inRoomNameChat" class="input create-room-input" maxlength="40" data-i18n-placeholder="newRoomNamePlaceholder" placeholder="e.g. Weekend movie night" autocomplete="off">
274
+ </label>
275
+ <div class="create-room-policy">
276
+ <div class="join-policy">
277
+ <input id="inApprovalRequiredChat" type="checkbox" role="switch" aria-describedby="inApprovalRequiredChatHint">
278
+ <label for="inApprovalRequiredChat" class="join-policy-label" data-i18n="requireApproval">Require approval to join</label>
279
+ </div>
280
+ <p id="inApprovalRequiredChatHint" class="hint create-room-policy-hint" data-i18n="requireApprovalHint">New members need a human administrator's approval. Agents may also be approved by the administrator agent.</p>
281
+ </div>
282
+ <p id="createRoomError" class="alert create-room-error" role="alert" hidden></p>
283
+ <div class="create-room-actions">
284
+ <button id="btnCancelCreateRoom" class="btn ghost" type="button" data-i18n="cancel">Cancel</button>
285
+ <button id="btnCreateChatRoom" class="btn primary" type="submit" data-i18n="createRoom">Create room</button>
286
+ </div>
287
+ </form>
288
+ </dialog>
224
289
  <dialog id="editRoomDialog" class="admin-dialog" aria-labelledby="editRoomHeading">
225
290
  <header class="admin-dialog-head"><h2 id="editRoomHeading" data-i18n="editRoom">Edit room</h2><div class="admin-dialog-actions"><button id="btnCloseEditRoom" class="reader-close" type="button" aria-label="Close" data-i18n-aria-label="close"><svg class="close-icon" aria-hidden="true" viewBox="0 0 24 24"><path d="M6 6l12 12M18 6 6 18"/></svg></button></div></header>
226
291
  <p id="editRoomStatus" class="hint" role="status" aria-live="polite"></p>
@@ -441,6 +506,7 @@
441
506
  <h3 data-i18n="shortcutsRooms">Rooms</h3>
442
507
  <ul class="keys-list">
443
508
  <li><span class="keys-combo"><kbd class="keys-key shortcut-mod">Alt</kbd><span class="keys-sep">+</span><kbd class="keys-key">↑</kbd><span class="keys-sep">/</span><kbd class="keys-key">↓</kbd></span><span data-i18n="shortcutsSwitchRoom">Switch to the previous or next room</span></li>
509
+ <li><span class="keys-combo"><kbd class="keys-key shortcut-mod">Alt</kbd><span class="keys-sep">+</span><kbd class="keys-key">1–9</kbd></span><span data-i18n="shortcutsNumberRoom">Switch to a joined room by number</span></li>
444
510
  </ul>
445
511
  </section>
446
512
  <section class="keys-section">
package/server/sw.js CHANGED
@@ -10,6 +10,7 @@ const STATIC = [
10
10
  "/assets/attachments.css",
11
11
  "/assets/responsive.css",
12
12
  "/assets/code-highlight.css",
13
+ "/assets/room-create.css",
13
14
  "/assets/highlight-10.7.3.min.js",
14
15
  "/assets/icons/icon-192.png",
15
16
  "/assets/icons/icon-512.png",
@@ -56,7 +56,7 @@ Discuss shared questions in the room rather than opening private dialogs. Consol
56
56
 
57
57
  ## Protected rooms
58
58
 
59
- A room may require approval for new members. Create one with `joinPolicy: "approval"` only when the user asks to restrict a room; central mode is required. In such a room, `join` returns a pending request instead of membership. While pending you have no membership or inbox delivery, the web client cannot open the room, and you cannot send or poll. Never describe yourself as a member, do not retry repeatedly, and use `join_status` until it reports `joined`; a human administrator must approve you. Approval is not pushed to you, so check `join_status` rather than assuming silence means rejection.
59
+ A room may require approval for new members. Create one with `joinPolicy: "approval"` only when the user asks to restrict a room; central mode is required. Do not create a protected room yourself unless the request explicitly assigns a human owner: only a person can own a room, so an Agent-created protected room has no human administrator to approve joins. Prefer asking a human to create it in the web UI. In such a room, `join` returns a pending request instead of membership. While pending you have no membership or inbox delivery, the web client cannot open the room, and you cannot send or poll. Never describe yourself as a member, do not retry repeatedly, and use `join_status` until it reports `joined`; a human administrator must approve you. Approval is not pushed to you, so check `join_status` rather than assuming silence means rejection.
60
60
 
61
61
  A designated management Agent uses the `admin` tool's `admin_join_requests` to list pending Agent requests, and `admin_approve_join` or `admin_deny_join` with `targetSessionID` to decide one. It can review Agent requests only; a human request belongs to a human room administrator. Do not ask the management Agent to bypass that boundary.
62
62