@alexsun-top/opencode-chat-room 0.3.0 → 0.3.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.
- package/CHANGELOG.md +9 -0
- package/README.md +26 -5
- package/README.zh-CN.md +26 -5
- package/package.json +2 -1
- package/plugin.ts +15 -1
- package/server/assets/chat/events.js +4 -2
- package/server/assets/chat/members.js +120 -14
- package/server/assets/chat/messages.js +81 -9
- package/server/assets/chat/rooms.js +1 -1
- package/server/assets/chat/state.js +12 -1
- package/server/assets/conversation.css +19 -5
- package/server/assets/responsive.css +3 -3
- package/server/chat-server.ts +5 -33
- package/server/member-routes.ts +117 -0
- package/server/newrooms.ts +6 -10
- package/src/agent-presence.ts +60 -0
- package/src/agent-receipts.ts +107 -0
- package/src/center-client.ts +22 -5
- package/src/center-inbox.ts +7 -1
- package/src/member-state.ts +25 -0
- package/src/plugin-notifications.ts +6 -0
- package/src/receiver-state.ts +51 -6
- package/src/sqlite-state.ts +99 -7
- package/src/store.ts +28 -1
- package/src/v2-plugin.ts +10 -2
- package/src/v2-receiver.ts +67 -45
- package/src/watch.ts +17 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.1 — 2026-10-31
|
|
4
|
+
|
|
5
|
+
- Added owner-sequenced V2 foreground presence and exact per-message receipts with `displayed`, `tool`, and `context` evidence. Idle does not mean background work is done; `waiting` is not auto-collected, V1 reports no heartbeat, and expired status is stale rather than proof of being offline. Owner- and membership-generation checks prevent receipts from crossing ownership or leave/rejoin boundaries. Capped previews do not count as full-message evidence.
|
|
6
|
+
- Added the member and receipt APIs and SQLite schema for membership generations, presence, and message receipts. Migrations preserve message history and do not invent receipts from old read or queued cursors.
|
|
7
|
+
- Improved chat scroll anchoring and layout. Made pending-admission reads lock-free to reduce plugin/watcher contention.
|
|
8
|
+
- Verified against OpenCode 2.2.1 source and in an isolated runtime; this does not verify every supported OpenCode version.
|
|
9
|
+
- Upgrade the central server and each client plugin separately; no automatic server deployment or service configuration changes occur.
|
|
10
|
+
- Known issue: a report of users being unable to select their own text in Edge on macOS and Windows remains unverified. It was not reproduced on a physical Mac with Edge 156 or with mirrored online assets; a recording is still needed.
|
|
11
|
+
|
|
3
12
|
## 0.3.0 — 2026-10-30
|
|
4
13
|
|
|
5
14
|
- Central web chat can switch among joined group rooms and direct conversations without leaving them. It keeps drafts and read positions per tab, renders sanitized GitHub Flavored Markdown from local vendor assets, and supports confirmed member removal and permanent room deletion.
|
package/README.md
CHANGED
|
@@ -79,17 +79,17 @@ On the server machine, install Bun first. `npx`, `pnpx`, and `bunx` only execute
|
|
|
79
79
|
|
|
80
80
|
```bash
|
|
81
81
|
# Show CLI options:
|
|
82
|
-
npx --yes --package=@alexsun-top/opencode-chat-room@0.3.
|
|
82
|
+
npx --yes --package=@alexsun-top/opencode-chat-room@0.3.1 -- opencode-chat-room --help
|
|
83
83
|
|
|
84
84
|
# Start the local central server (choose any one runner):
|
|
85
|
-
npx --yes --package=@alexsun-top/opencode-chat-room@0.3.
|
|
86
|
-
pnpx --package=@alexsun-top/opencode-chat-room@0.3.
|
|
87
|
-
bunx @alexsun-top/opencode-chat-room@0.3.
|
|
85
|
+
npx --yes --package=@alexsun-top/opencode-chat-room@0.3.1 -- opencode-chat-room --host 0.0.0.0 --port 4399
|
|
86
|
+
pnpx --package=@alexsun-top/opencode-chat-room@0.3.1 opencode-chat-room --host 0.0.0.0 --port 4399
|
|
87
|
+
bunx @alexsun-top/opencode-chat-room@0.3.1 --host 0.0.0.0 --port 4399 --token secret
|
|
88
88
|
|
|
89
89
|
# Environment variables also work; CLI options take precedence:
|
|
90
90
|
CHAT_ROOM_SERVER_HOST=127.0.0.1 CHAT_ROOM_SERVER_PORT=4399 \
|
|
91
91
|
CHAT_ROOM_SERVER_TOKEN=secret \
|
|
92
|
-
bunx @alexsun-top/opencode-chat-room@0.3.
|
|
92
|
+
bunx @alexsun-top/opencode-chat-room@0.3.1
|
|
93
93
|
|
|
94
94
|
# Local checkout:
|
|
95
95
|
bun install
|
|
@@ -106,6 +106,26 @@ The chat renders GitHub Flavored Markdown using locally bundled Marked and DOMPu
|
|
|
106
106
|
|
|
107
107
|
The central server uses a trusted shared-token model, not per-user authorization or private DMs: anyone holding the token can read messages, manage rooms, remove members, and delete rooms. The server and its SQLite database can read direct-message content. Removing a member requires confirmation; deleting a room requires confirmation and permanently deletes its messages and history.
|
|
108
108
|
|
|
109
|
+
### Agent presence and message receipts
|
|
110
|
+
|
|
111
|
+
`GET /rooms/<roomId>/members` returns each member's `membershipID`, `type`, and `activity: { state, observedAt }`; `observedAt` is the server timestamp in milliseconds. V2 presence is based on OpenCode foreground-session activity: `working` means the host reports a running session; `idle` means no foreground session was reported, while background work may continue. `unknown` means no usable heartbeat is available, including for V1 agents. `waiting` is an accepted state but is not automatically detected. Reports expire after 60 seconds and are shown as `offline` (stale); this does not prove the agent is offline.
|
|
112
|
+
|
|
113
|
+
V2 presence uses `POST /presence` with an owner-scoped increasing sequence and up to 200 sessions per request:
|
|
114
|
+
|
|
115
|
+
```json
|
|
116
|
+
{"ownerID":"123e4567-e89b-42d3-a456-426614174000","sequence":42,"sessions":[{"sessionID":"<session-id>","receiverOwnerID":"123e4567-e89b-42d3-a456-426614174000","state":"working"}]}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Older or repeated sequences are ignored and do not refresh presence. The plugin reports foreground activity about every 10 seconds.
|
|
120
|
+
|
|
121
|
+
Receipts identify exact messages; join, read, and queued cursors do not create them. `GET /rooms/<roomId>/receipts?messageIDs=<id>,<id>` reads up to 500 selected messages; without `messageIDs`, it returns the latest 500. Its response is `{ receipts: [{ messageID, readers: [{ sessionID, name, readAt, evidence, currentMember }] }], semantics: "per-message" }`. `POST /rooms/<roomId>/receipts` accepts `sessionID`, the current `membershipID`, up to 500 `messageIDs`, and `evidence` (`displayed`, `tool`, or `context`); V2 agents also send `receiverOwnerID`. `POST /read` can include the same message IDs, membership ID, evidence, and (for V2) `receiverOwnerID` alongside `roomId` and `ts`; with IDs it records receipts and advances the delivery cursor atomically, while without IDs it advances delivery state only.
|
|
122
|
+
|
|
123
|
+
`membershipID` identifies the current join generation. Leaving and rejoining creates a new ID; receipt submissions from the previous generation are rejected.
|
|
124
|
+
|
|
125
|
+
`displayed` means the message intersected the visible area of a focused browser tab. `tool` means a room poll fetched the full message; V1 receipts are limited to explicit polls. `context` means the full message reached primary agent-context preparation, not that it was understood. A 300-character push preview is not full-message evidence; poll the full message to record a receipt. Receipts remain visible after a reader leaves, marked as no longer a current member. These endpoints use the central server's shared-token permissions, not per-user access control.
|
|
126
|
+
|
|
127
|
+
Upgrade the central server and every client plugin separately; updating only a local plugin does not deploy the server APIs. The package does not automatically deploy or reconfigure the server service.
|
|
128
|
+
|
|
109
129
|
On every client machine:
|
|
110
130
|
|
|
111
131
|
```bash
|
|
@@ -159,3 +179,4 @@ Note: `join` with `name:"alice"` registers the identity `alice` for that session
|
|
|
159
179
|
- SQLite retains message history without automatic deletion. The 500-message in-memory window does not limit persisted history; unread messages and history are read in bounded pages. Back up the database regularly.
|
|
160
180
|
- Only installations carrying retry rows from an intermediate development build are affected: records without a recoverable message timestamp migrate conservatively, permanently disabling backgrounding for that service/room. Normal notification steering continues.
|
|
161
181
|
- `notify.log` grows without rotation.
|
|
182
|
+
- Known issue: a report of users being unable to select their own text in Edge on macOS and Windows remains unverified. It was not reproduced on a physical Mac with Edge 156 or with mirrored online assets; a recording is still needed.
|
package/README.zh-CN.md
CHANGED
|
@@ -77,17 +77,17 @@ OpenCode 2.2.1 会在默认 60 分钟无活动后卸载闲置项目的服务。W
|
|
|
77
77
|
|
|
78
78
|
```bash
|
|
79
79
|
# 查看 CLI 选项:
|
|
80
|
-
npx --yes --package=@alexsun-top/opencode-chat-room@0.3.
|
|
80
|
+
npx --yes --package=@alexsun-top/opencode-chat-room@0.3.1 -- opencode-chat-room --help
|
|
81
81
|
|
|
82
82
|
# 启动本地中心服务器(三选一):
|
|
83
|
-
npx --yes --package=@alexsun-top/opencode-chat-room@0.3.
|
|
84
|
-
pnpx --package=@alexsun-top/opencode-chat-room@0.3.
|
|
85
|
-
bunx @alexsun-top/opencode-chat-room@0.3.
|
|
83
|
+
npx --yes --package=@alexsun-top/opencode-chat-room@0.3.1 -- opencode-chat-room --host 0.0.0.0 --port 4399
|
|
84
|
+
pnpx --package=@alexsun-top/opencode-chat-room@0.3.1 opencode-chat-room --host 0.0.0.0 --port 4399
|
|
85
|
+
bunx @alexsun-top/opencode-chat-room@0.3.1 --host 0.0.0.0 --port 4399 --token secret
|
|
86
86
|
|
|
87
87
|
# 也可以使用环境变量;CLI 参数优先:
|
|
88
88
|
CHAT_ROOM_SERVER_HOST=127.0.0.1 CHAT_ROOM_SERVER_PORT=4399 \
|
|
89
89
|
CHAT_ROOM_SERVER_TOKEN=secret \
|
|
90
|
-
bunx @alexsun-top/opencode-chat-room@0.3.
|
|
90
|
+
bunx @alexsun-top/opencode-chat-room@0.3.1
|
|
91
91
|
|
|
92
92
|
# 本地 checkout:
|
|
93
93
|
bun install
|
|
@@ -104,6 +104,26 @@ bun run server
|
|
|
104
104
|
|
|
105
105
|
中心服务器使用团队共享令牌,不提供逐用户授权或私密私聊:任何持有令牌的人都能读取消息、管理房间、移除成员和删除房间;服务器及其 SQLite 数据库也能读取私聊内容。移除成员前会要求确认;删除房间也会要求确认,并永久删除房间消息和历史记录,无法恢复。
|
|
106
106
|
|
|
107
|
+
### Agent 状态与消息回执
|
|
108
|
+
|
|
109
|
+
`GET /rooms/<roomId>/members` 会返回成员的 `membershipID`、`type` 和 `activity: { state, observedAt }`;`observedAt` 是服务端记录的毫秒时间戳。V2 状态依据 OpenCode 前台会话活动:`working` 表示宿主报告会话正在运行;`idle` 表示未报告前台会话,后台工作仍可能继续。没有可用心跳时(包括 V1 agent)状态为 `unknown`。`waiting` 是接口接受的状态,但插件不会自动检测。状态报告 60 秒后过期并显示为 `offline`(已过期);这不能证明 agent 已离线。
|
|
110
|
+
|
|
111
|
+
V2 使用 `POST /presence` 上报 owner 范围内递增的序号,每次最多 200 个会话:
|
|
112
|
+
|
|
113
|
+
```json
|
|
114
|
+
{"ownerID":"123e4567-e89b-42d3-a456-426614174000","sequence":42,"sessions":[{"sessionID":"<session-id>","receiverOwnerID":"123e4567-e89b-42d3-a456-426614174000","state":"working"}]}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
较旧或重复的序号会被忽略,且不会刷新状态时间。插件大约每 10 秒上报一次前台活动。
|
|
118
|
+
|
|
119
|
+
回执针对具体消息;加入、已读和排队游标都不会生成回执。`GET /rooms/<roomId>/receipts?messageIDs=<id>,<id>` 查询最多 500 条指定消息;省略 `messageIDs` 时返回最近 500 条。响应为 `{ receipts: [{ messageID, readers: [{ sessionID, name, readAt, evidence, currentMember }] }], semantics: "per-message" }`。`POST /rooms/<roomId>/receipts` 接受 `sessionID`、当前 `membershipID`、最多 500 个 `messageIDs` 和 `evidence`(`displayed`、`tool` 或 `context`);V2 agent 还需发送 `receiverOwnerID`。`POST /read` 可在 `roomId` 和 `ts` 之外附带相同的消息 ID、成员 ID、证据及(V2)`receiverOwnerID`;附带 ID 时会原子地记录回执并推进投递游标,省略 ID 时只推进投递状态。
|
|
120
|
+
|
|
121
|
+
`membershipID` 标识当前加入代次。离开后重新加入会生成新 ID;使用旧代次提交回执会被拒绝。
|
|
122
|
+
|
|
123
|
+
`displayed` 表示消息出现在当前聚焦浏览器标签页的可视区域。`tool` 表示房间轮询已获取完整消息;V1 仅在显式轮询时产生此类回执。`context` 表示完整消息进入了 agent 的主要上下文准备阶段,不代表 agent 已理解。被截为 300 字符的推送预览不算完整消息证据;需轮询完整消息才能记录回执。成员离开后回执仍保留,并标记其已不是当前成员。这些接口使用中心服务器的共享令牌权限,不提供逐用户访问控制。
|
|
124
|
+
|
|
125
|
+
需分别升级中心服务器和每台客户端的插件;只更新本地插件不会部署服务端 API。此包不会自动部署或重新配置服务器服务。
|
|
126
|
+
|
|
107
127
|
每台客户端机器上:
|
|
108
128
|
|
|
109
129
|
```bash
|
|
@@ -156,3 +176,4 @@ export CHAT_ROOM_SERVER_TOKEN=secret # 仅当服务器设置了 token 时
|
|
|
156
176
|
- SQLite 持续保留历史消息,不自动删除。500 条只是内存工作窗口,不是磁盘保留上限;未读消息和历史记录均分页读取。请定期备份数据库。
|
|
157
177
|
- 仅包含某个过渡开发版重试记录的安装会受影响:若旧后台重试记录无法恢复消息时间戳,迁移会采取保守处理,永久停用该服务/房间的后台操作;正常通知 steer 仍会继续。
|
|
158
178
|
- `notify.log` 会持续增长,暂无轮转。
|
|
179
|
+
- 已知问题:有用户报告在 macOS 和 Windows 的 Edge 中无法选中自己的消息文本,但问题尚未复现。在实际 Mac 的 Edge 156 和镜像在线资源中均未复现;仍需用户提供录屏。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alexsun-top/opencode-chat-room",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "A chat-room plugin and central server for OpenCode.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"server/inbox.ts",
|
|
29
29
|
"server/history-route.ts",
|
|
30
30
|
"server/newrooms.ts",
|
|
31
|
+
"server/member-routes.ts",
|
|
31
32
|
"server/wake.ts",
|
|
32
33
|
"server/chat.html",
|
|
33
34
|
"server/assets",
|
package/plugin.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { z } from "zod";
|
|
|
5
5
|
import RoomService, { RoomError, type Message } from "./src/room-service";
|
|
6
6
|
import {
|
|
7
7
|
formatRoom,
|
|
8
|
+
acknowledgeReadWithReceipts,
|
|
8
9
|
identity,
|
|
9
10
|
loadRegistry,
|
|
10
11
|
loadRooms,
|
|
@@ -17,6 +18,7 @@ import {
|
|
|
17
18
|
type Registry,
|
|
18
19
|
type RegistryEntry,
|
|
19
20
|
} from "./src/store";
|
|
21
|
+
import { flushReceiptCandidates, receiptDestination } from "./src/agent-receipts";
|
|
20
22
|
import { centerAction } from "./src/center-client";
|
|
21
23
|
import { createQueueTransport, type QueueTransport } from "./src/queue-transport";
|
|
22
24
|
import { checkCenterInbox } from "./src/center-inbox";
|
|
@@ -144,6 +146,14 @@ async function bumpLastRead(
|
|
|
144
146
|
return updated;
|
|
145
147
|
}
|
|
146
148
|
|
|
149
|
+
export async function acknowledgeStandalonePoll(roomID: string, sessionID: string, throughTs: number,
|
|
150
|
+
messages: Message[], identityForReceipt?: { membershipID: string; receiverOwnerID?: string }): Promise<void> {
|
|
151
|
+
if (!identityForReceipt) { await bumpLastRead(roomID, sessionID, throughTs); return; }
|
|
152
|
+
if (!messages.length || !messages.every((message) => typeof message.id === "string" && message.id)) return;
|
|
153
|
+
const result = await acknowledgeReadWithReceipts(roomID, sessionID, throughTs, messages.map((message) => message.id!), "tool", identityForReceipt);
|
|
154
|
+
if (result.status === "ok") clearPendingAdmission(sessionID, roomID, result.readThroughTs ?? 0);
|
|
155
|
+
}
|
|
156
|
+
|
|
147
157
|
async function bumpLastQueued(
|
|
148
158
|
roomId: string,
|
|
149
159
|
sessionID: string,
|
|
@@ -183,6 +193,7 @@ export async function pollKnownSessions(
|
|
|
183
193
|
await Promise.all([...sessions].map((sessionID) =>
|
|
184
194
|
checkCenterInbox(opts, sessionID, transport),
|
|
185
195
|
));
|
|
196
|
+
if (transport.receiverOwnerID) await flushReceiptCandidates({ destination: receiptDestination(opts.center), receiverOwnerID: transport.receiverOwnerID, center: opts.center, token: opts.token }).catch(() => {});
|
|
186
197
|
return;
|
|
187
198
|
}
|
|
188
199
|
const [rooms, registry] = await Promise.all([loadRooms(), loadRegistry()]);
|
|
@@ -229,6 +240,7 @@ export async function pollKnownSessions(
|
|
|
229
240
|
}
|
|
230
241
|
}
|
|
231
242
|
}
|
|
243
|
+
await flushReceiptCandidates({ destination: receiptDestination(""), receiverOwnerID: transport.receiverOwnerID }).catch(() => {});
|
|
232
244
|
}
|
|
233
245
|
|
|
234
246
|
const READ_ONLY_ACTIONS = new Set(["list", "members", "poll"]);
|
|
@@ -269,12 +281,14 @@ const roomExecute = async (
|
|
|
269
281
|
let leaveNameShared = false;
|
|
270
282
|
let pollLastRead = 0;
|
|
271
283
|
let pollEntry = false;
|
|
284
|
+
let pollIdentity: { membershipID: string; receiverOwnerID?: string } | undefined;
|
|
272
285
|
let pollPage: Awaited<ReturnType<typeof readUnreadMessages>> | undefined;
|
|
273
286
|
let pollMaxTs: number | undefined;
|
|
274
287
|
const notifications: Array<{ roomId: string; roomName: string; messages: Message[] }> = [];
|
|
275
288
|
if (args.action === "poll" && args.roomId) {
|
|
276
289
|
const entry = (await loadRegistry())[args.roomId]?.[context.sessionID];
|
|
277
290
|
pollEntry = entry !== undefined;
|
|
291
|
+
if (entry?.membershipID) pollIdentity = { membershipID: entry.membershipID, ...(entry.receiverOwnerID ? { receiverOwnerID: entry.receiverOwnerID } : {}) };
|
|
278
292
|
selfName = entry?.name ?? selfName;
|
|
279
293
|
pollLastRead = entry?.lastReadTs ?? 0;
|
|
280
294
|
if (entry) pollPage = await readUnreadMessages(args.roomId, pollLastRead, 100);
|
|
@@ -419,7 +433,7 @@ const roomExecute = async (
|
|
|
419
433
|
context.sessionID, notification.messages).catch(() => {});
|
|
420
434
|
}
|
|
421
435
|
if (args.action === "poll" && pollMaxTs !== undefined && pollMaxTs > 0) {
|
|
422
|
-
await
|
|
436
|
+
await acknowledgeStandalonePoll(args.roomId!, context.sessionID, pollMaxTs, pollPage?.items ?? [], pollIdentity);
|
|
423
437
|
}
|
|
424
438
|
return result;
|
|
425
439
|
} catch (err) {
|
|
@@ -64,12 +64,14 @@ export function initEvents(app) {
|
|
|
64
64
|
$("#thread").addEventListener("scroll", () => {
|
|
65
65
|
const thread = $("#thread");
|
|
66
66
|
if (thread.scrollHeight - thread.scrollTop - thread.clientHeight < 80) void app.markActiveRoomRead();
|
|
67
|
+
app.queueReceiptRefresh();
|
|
68
|
+
app.queueReceiptObservation();
|
|
67
69
|
app.updateJump();
|
|
68
70
|
});
|
|
69
71
|
document.addEventListener("visibilitychange", () => {
|
|
70
|
-
if (!document.hidden) void app.markActiveRoomRead();
|
|
72
|
+
if (!document.hidden) { void app.markActiveRoomRead(); void app.loadManageableMembers(); }
|
|
71
73
|
});
|
|
72
|
-
window.addEventListener("focus", () => void app.markActiveRoomRead());
|
|
74
|
+
window.addEventListener("focus", () => { void app.markActiveRoomRead(); app.queueReceiptRefresh(); app.queueReceiptObservation(); });
|
|
73
75
|
$("#msgList").addEventListener("click", (event) => {
|
|
74
76
|
const button = event.target.closest("[data-copy-code]");
|
|
75
77
|
if (button) void copyCodeFromButton(button, app);
|
|
@@ -30,34 +30,97 @@ export function initMembers(app) {
|
|
|
30
30
|
|
|
31
31
|
app.loadManageableMembers = async () => {
|
|
32
32
|
const room = app.state.room;
|
|
33
|
-
if (!room) return;
|
|
33
|
+
if (!room || app.state.memberApiUnavailable.has(room.id)) return;
|
|
34
|
+
const generation = app.state.pollGeneration;
|
|
35
|
+
clearTimeout(app.state.memberRefreshTimer);
|
|
34
36
|
try {
|
|
35
37
|
const members = await app.api(`/rooms/${encodeURIComponent(room.id)}/members`);
|
|
36
|
-
if (app
|
|
38
|
+
if (!current(app, room.id, generation)) return;
|
|
37
39
|
const previous = app.state.memberSessions.get(room.id) || [];
|
|
38
|
-
const signature = (items) => items.map((member) => `${member.sessionID}\0${member.name}`).sort().join("\u0001");
|
|
40
|
+
const signature = (items) => items.map((member) => `${member.sessionID}\0${member.name}\0${member.type}`).sort().join("\u0001");
|
|
39
41
|
const changed = signature(previous) !== signature(members);
|
|
40
42
|
app.state.memberSessions.set(room.id, members);
|
|
41
43
|
if (changed && app.mentionActive) app.updateMentionList();
|
|
42
44
|
if (changed && room.kind !== "direct" && room.messages.some((message) => !message.senderSessionID && message.senderId === app.state.myName)) app.rerenderMessages();
|
|
43
45
|
const list = $("#memberList");
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (
|
|
46
|
+
const rows = Array.from(list.querySelectorAll("li[data-member-session-id]"));
|
|
47
|
+
if (signature(rows.map((row) => ({ sessionID: row.dataset.memberSessionId, name: row.dataset.memberName, type: row.dataset.memberType }))) !== signature(members)) {
|
|
48
|
+
list.textContent = "";
|
|
49
|
+
for (const member of members) {
|
|
50
|
+
const row = document.createElement("li"), name = document.createElement("span"), actions = document.createElement("span");
|
|
51
|
+
row.dataset.memberSessionId = member.sessionID; row.dataset.memberName = member.name; row.dataset.memberType = member.type;
|
|
52
|
+
name.textContent = member.name; row.append(name);
|
|
53
|
+
if (member.type === "agent") row.append(activityBadge(member, app));
|
|
54
|
+
actions.className = "member-actions";
|
|
55
|
+
if (member.sessionID !== LS.sessionID) {
|
|
56
|
+
actions.append(actionButton(member, "messagePrivately", app.startDirect));
|
|
57
|
+
if (room.kind !== "direct") actions.append(actionButton(member, "removeMember", app.kickMember));
|
|
58
|
+
}
|
|
59
|
+
row.append(actions); list.append(row);
|
|
52
60
|
}
|
|
53
|
-
|
|
54
|
-
list.append(row);
|
|
55
|
-
}
|
|
61
|
+
} else for (const member of members) updateActivity(list.querySelector(`[data-member-session-id="${CSS.escape(member.sessionID)}"]`), member, app);
|
|
56
62
|
$("#memberEmpty").hidden = members.length > 0;
|
|
63
|
+
app.queueReceiptObservation();
|
|
64
|
+
app.state.memberRefreshTimer = setTimeout(() => {
|
|
65
|
+
if (current(app, room.id, generation) && !document.hidden) void app.loadManageableMembers();
|
|
66
|
+
}, 5000);
|
|
57
67
|
} catch (error) {
|
|
58
68
|
if (error.status === 401) app.openChatSettings();
|
|
69
|
+
else if (error.status === 404) app.state.memberApiUnavailable.add(room.id);
|
|
70
|
+
else if (current(app, room.id, generation) && !document.hidden) app.state.memberRefreshTimer = setTimeout(() => void app.loadManageableMembers(), 5000);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
app.loadVisibleReceipts = async (roomId, generation = app.state.pollGeneration) => {
|
|
75
|
+
if (app.state.receiptApiUnavailable.has(roomId) || !current(app, roomId, generation)) return;
|
|
76
|
+
const ids = visibleMessageIDs(app);
|
|
77
|
+
if (!ids.length) return;
|
|
78
|
+
const query = new URLSearchParams({ messageIDs: ids.join(",") });
|
|
79
|
+
try {
|
|
80
|
+
const result = await app.api(`/rooms/${encodeURIComponent(roomId)}/receipts?${query}`);
|
|
81
|
+
if (!current(app, roomId, generation)) return;
|
|
82
|
+
app.renderReceiptData(roomId, result.receipts || []);
|
|
83
|
+
} catch (error) {
|
|
84
|
+
if (error.status === 404) app.state.receiptApiUnavailable.add(roomId);
|
|
59
85
|
}
|
|
60
86
|
};
|
|
87
|
+
app.queueReceiptRefresh = () => {
|
|
88
|
+
clearTimeout(app.state.receiptRefreshTimer);
|
|
89
|
+
const roomId = app.state.room?.id, generation = app.state.pollGeneration;
|
|
90
|
+
app.state.receiptRefreshTimer = setTimeout(() => void app.loadVisibleReceipts(roomId, generation), 180);
|
|
91
|
+
};
|
|
92
|
+
app.queueReceiptObservation = () => {
|
|
93
|
+
app.state.receiptObservation = { roomId: app.state.room?.id, generation: app.state.pollGeneration };
|
|
94
|
+
if (app.state.receiptObservationFrame) return;
|
|
95
|
+
app.state.receiptObservationFrame = requestAnimationFrame(() => {
|
|
96
|
+
app.state.receiptObservationFrame = 0;
|
|
97
|
+
const target = app.state.receiptObservation;
|
|
98
|
+
app.state.receiptObservation = null;
|
|
99
|
+
if (!target || document.hidden || !document.hasFocus() || !current(app, target.roomId, target.generation)) return;
|
|
100
|
+
void app.loadVisibleReceipts(target.roomId, target.generation);
|
|
101
|
+
void app.ackVisibleMessages(target.roomId, target.generation);
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
app.ackVisibleMessages = async (roomId = app.state.room?.id, generation = app.state.pollGeneration) => {
|
|
105
|
+
const room = app.state.room;
|
|
106
|
+
if (!room || room.id !== roomId || app.state.pollGeneration !== generation || app.state.receiptApiUnavailable.has(room.id)) return;
|
|
107
|
+
const self = app.state.memberSessions.get(room.id)?.find((member) => member.sessionID === LS.sessionID);
|
|
108
|
+
if (self?.type !== "human" || !self.membershipID) return;
|
|
109
|
+
const key = `${room.id}\0${self.membershipID}`;
|
|
110
|
+
const acknowledged = app.state.acknowledgedMessages.get(key) || new Set();
|
|
111
|
+
const pending = app.state.pendingAcknowledgements.get(key) || new Set();
|
|
112
|
+
const ids = visibleMessageIDs(app).filter((id) => !acknowledged.has(id) && !pending.has(id));
|
|
113
|
+
if (!ids.length) return;
|
|
114
|
+
app.state.pendingAcknowledgements.set(key, pending);
|
|
115
|
+
ids.forEach((id) => pending.add(id));
|
|
116
|
+
try {
|
|
117
|
+
const result = await app.api(`/rooms/${encodeURIComponent(room.id)}/receipts`, { method: "POST", body: JSON.stringify({ sessionID: LS.sessionID, membershipID: self.membershipID, messageIDs: ids, evidence: "displayed" }) });
|
|
118
|
+
if (current(app, room.id, generation) && app.state.memberSessions.get(room.id)?.some((member) => member.sessionID === LS.sessionID && member.membershipID === self.membershipID)) {
|
|
119
|
+
acknowledgedMessages(app, key, acknowledged, result.acceptedIDs || []);
|
|
120
|
+
}
|
|
121
|
+
} catch (error) { if (error.status === 404) app.state.receiptApiUnavailable.add(room.id); }
|
|
122
|
+
finally { ids.forEach((id) => pending.delete(id)); }
|
|
123
|
+
};
|
|
61
124
|
|
|
62
125
|
app.startDirect = async (member) => {
|
|
63
126
|
const source = app.state.room;
|
|
@@ -93,3 +156,46 @@ export function initMembers(app) {
|
|
|
93
156
|
return button;
|
|
94
157
|
}
|
|
95
158
|
}
|
|
159
|
+
|
|
160
|
+
function current(app, roomId, generation) {
|
|
161
|
+
return app.state.room?.id === roomId && app.state.pollGeneration === generation && !app.$("#chatView").hidden;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function visibleMessageIDs(app) {
|
|
165
|
+
const thread = app.$("#thread");
|
|
166
|
+
if (document.hidden || !document.hasFocus() || app.$("#chatView").hidden) return [];
|
|
167
|
+
const top = thread.getBoundingClientRect().top + thread.clientTop, bottom = top + thread.clientHeight;
|
|
168
|
+
const overlays = Array.from(document.querySelectorAll(".panel:not([hidden]), #mentionPicker:not([hidden]), #railRoomForm:not([hidden])"))
|
|
169
|
+
.map((node) => node.getBoundingClientRect());
|
|
170
|
+
return Array.from(thread.querySelectorAll("[data-msg-id]")).filter((row) => {
|
|
171
|
+
const rect = row.getBoundingClientRect();
|
|
172
|
+
return rect.bottom > top && rect.top < bottom && !overlays.some((overlay) => rect.left < overlay.right && rect.right > overlay.left && rect.top < overlay.bottom && rect.bottom > overlay.top);
|
|
173
|
+
}).map((row) => row.dataset.msgId).filter(Boolean);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function acknowledgedMessages(app, key, set, ids) {
|
|
177
|
+
ids.forEach((id) => set.add(id));
|
|
178
|
+
app.state.acknowledgedMessages.set(key, set);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function activityBadge(member, app) {
|
|
182
|
+
const badge = document.createElement("span");
|
|
183
|
+
updateActivityBadge(badge, member, app);
|
|
184
|
+
return badge;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function updateActivity(row, member, app) {
|
|
188
|
+
if (!row) return;
|
|
189
|
+
let badge = row.querySelector(".member-activity");
|
|
190
|
+
if (member.type !== "agent") { badge?.remove(); return; }
|
|
191
|
+
if (!badge) { badge = activityBadge(member, app); row.insertBefore(badge, row.querySelector(".member-actions")); }
|
|
192
|
+
updateActivityBadge(badge, member, app);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function updateActivityBadge(badge, member, app) {
|
|
196
|
+
const state = member.activity?.state || "unknown";
|
|
197
|
+
badge.className = `member-activity ${state}`;
|
|
198
|
+
badge.textContent = app.t(`activity_${state}`);
|
|
199
|
+
badge.title = app.t(`activityHint_${state}`);
|
|
200
|
+
badge.setAttribute("aria-label", `${badge.textContent}. ${badge.title}`);
|
|
201
|
+
}
|
|
@@ -142,20 +142,40 @@ export function initMessages(app) {
|
|
|
142
142
|
const body = document.createElement("div");
|
|
143
143
|
body.className = "msg-text";
|
|
144
144
|
renderMarkdown(body, message.text, app);
|
|
145
|
-
row.append(meta, body);
|
|
145
|
+
row.append(meta, body, receiptDetails(message, app));
|
|
146
146
|
}
|
|
147
147
|
if (live) row.classList.add("in");
|
|
148
148
|
return row;
|
|
149
149
|
};
|
|
150
150
|
|
|
151
|
+
app.renderReceiptData = (roomId, receipts) => {
|
|
152
|
+
const thread = $("#thread"), edge = thread.getBoundingClientRect();
|
|
153
|
+
const atBottom = thread.scrollHeight - thread.scrollTop - thread.clientHeight <= 2;
|
|
154
|
+
const anchor = Array.from($("#msgList").querySelectorAll("[data-msg-id]")).find((node) => node.getBoundingClientRect().bottom > edge.top);
|
|
155
|
+
const anchorId = anchor?.dataset.msgId, anchorTop = anchor ? anchor.getBoundingClientRect().top - edge.top : 0;
|
|
156
|
+
for (const receipt of receipts) app.state.receipts.set(`${roomId}\0${receipt.messageID}`, receipt.readers);
|
|
157
|
+
for (const row of document.querySelectorAll(`#msgList [data-msg-id]`)) {
|
|
158
|
+
const message = app.state.room?.messages.find((item) => item.id === row.dataset.msgId);
|
|
159
|
+
if (message?.roomId === roomId || app.state.room?.id === roomId && message) updateReceiptDetails(row, message, app);
|
|
160
|
+
}
|
|
161
|
+
if (atBottom) thread.scrollTop = thread.scrollHeight;
|
|
162
|
+
else if (anchorId) {
|
|
163
|
+
const next = $("#msgList").querySelector(`[data-msg-id="${CSS.escape(anchorId)}"]`);
|
|
164
|
+
if (next) thread.scrollTop += next.getBoundingClientRect().top - thread.getBoundingClientRect().top - anchorTop;
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
|
|
151
168
|
app.renderMessages = (live = false) => {
|
|
152
169
|
const thread = $("#thread"), list = $("#msgList"), messages = app.state.room.messages;
|
|
153
|
-
const nearBottom = thread.scrollHeight - thread.scrollTop - thread.clientHeight
|
|
170
|
+
const nearBottom = thread.scrollHeight - thread.scrollTop - thread.clientHeight <= 2;
|
|
154
171
|
let last = list.lastElementChild, skipped = 0;
|
|
155
|
-
let anchorId = null;
|
|
172
|
+
let anchorId = null, anchorOffset = 0, oldTop = thread.scrollTop;
|
|
156
173
|
let renderedIds = new Set([...list.children].map((node) => node.dataset.msgId).filter(Boolean));
|
|
174
|
+
const viewport = thread.getBoundingClientRect();
|
|
175
|
+
const firstVisible = [...list.children].find((node) => node.dataset.msgId && node.getBoundingClientRect().bottom > viewport.top);
|
|
176
|
+
anchorId = firstVisible?.dataset.msgId || null;
|
|
177
|
+
anchorOffset = firstVisible ? firstVisible.getBoundingClientRect().top - viewport.top : 0;
|
|
157
178
|
if (messages.length && app.firstMessageId && messages[0].id !== app.firstMessageId) {
|
|
158
|
-
anchorId = [...list.children].find((node) => node.classList.contains("msg"))?.dataset.msgId || null;
|
|
159
179
|
list.textContent = "";
|
|
160
180
|
app.rendered = 0;
|
|
161
181
|
last = null;
|
|
@@ -190,13 +210,29 @@ export function initMessages(app) {
|
|
|
190
210
|
app.rendered = messages.length;
|
|
191
211
|
app.firstMessageId = messages[0]?.id || app.firstMessageId;
|
|
192
212
|
$("#msgEmpty").hidden = messages.length > 0;
|
|
193
|
-
if (
|
|
213
|
+
if (nearBottom) thread.scrollTop = thread.scrollHeight;
|
|
214
|
+
else if (anchorId) {
|
|
194
215
|
const anchor = list.querySelector(`[data-msg-id="${CSS.escape(anchorId)}"]`);
|
|
195
|
-
if (anchor) thread.scrollTop += anchor.getBoundingClientRect().top -
|
|
196
|
-
else thread.scrollTop =
|
|
216
|
+
if (anchor) thread.scrollTop += anchor.getBoundingClientRect().top - viewport.top - anchorOffset;
|
|
217
|
+
else thread.scrollTop = oldTop;
|
|
197
218
|
} else if (!live || nearBottom) thread.scrollTop = thread.scrollHeight;
|
|
198
219
|
app.updateJump();
|
|
199
220
|
trimMessages(list, app);
|
|
221
|
+
if (nearBottom) {
|
|
222
|
+
thread.scrollTop = thread.scrollHeight;
|
|
223
|
+
const roomId = app.state.room?.id, generation = app.state.pollGeneration;
|
|
224
|
+
requestAnimationFrame(() => {
|
|
225
|
+
if (app.state.room?.id === roomId && app.state.pollGeneration === generation
|
|
226
|
+
&& thread.scrollHeight - thread.scrollTop - thread.clientHeight < 80) thread.scrollTop = thread.scrollHeight;
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
else if (anchorId) {
|
|
230
|
+
const anchor = list.querySelector(`[data-msg-id="${CSS.escape(anchorId)}"]`);
|
|
231
|
+
if (anchor) thread.scrollTop += anchor.getBoundingClientRect().top - thread.getBoundingClientRect().top - anchorOffset;
|
|
232
|
+
else thread.scrollTop = oldTop;
|
|
233
|
+
}
|
|
234
|
+
app.queueReceiptRefresh?.();
|
|
235
|
+
app.queueReceiptObservation?.();
|
|
200
236
|
return { skipped };
|
|
201
237
|
};
|
|
202
238
|
|
|
@@ -397,7 +433,7 @@ export function initMessages(app) {
|
|
|
397
433
|
return { ...updated, messages: [...messages.values()].sort((a, b) => a.createdAt - b.createdAt).slice(-500) };
|
|
398
434
|
}
|
|
399
435
|
|
|
400
|
-
|
|
436
|
+
function trimMessages(list, app) {
|
|
401
437
|
if (list.children.length <= 400) return;
|
|
402
438
|
while (list.children.length > 300) list.removeChild(list.firstChild);
|
|
403
439
|
if (list.firstElementChild && !list.firstElementChild.classList.contains("gap")) {
|
|
@@ -406,9 +442,45 @@ export function initMessages(app) {
|
|
|
406
442
|
app.setText(gap, "earlierMessages");
|
|
407
443
|
list.insertBefore(gap, list.firstChild);
|
|
408
444
|
}
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
function receiptDetails(message, app) {
|
|
448
|
+
const details = document.createElement("details");
|
|
449
|
+
details.className = "message-readers";
|
|
450
|
+
const summary = document.createElement("summary"), count = document.createElement("span"), list = document.createElement("ul");
|
|
451
|
+
count.className = "receipt-count";
|
|
452
|
+
list.className = "receipt-reader-list";
|
|
453
|
+
summary.append(count);
|
|
454
|
+
details.append(summary, list);
|
|
455
|
+
updateReceiptDetails(details.closest("li") || details, message, app);
|
|
456
|
+
return details;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
function updateReceiptDetails(row, message, app) {
|
|
460
|
+
const details = row.matches?.("details.message-readers") ? row : row.querySelector("details.message-readers");
|
|
461
|
+
if (!details) return;
|
|
462
|
+
const detailsKey = `${app.state.room?.id || message.roomId || ""}\0${message.id}`;
|
|
463
|
+
const senderID = message.senderSessionID || (app.state.room?.kind === "direct" ? message.senderId : "");
|
|
464
|
+
const readers = (app.state.receipts.get(detailsKey) || []).filter((reader) => reader.sessionID !== senderID);
|
|
465
|
+
details.hidden = readers.length === 0;
|
|
466
|
+
details.querySelector(".receipt-count").textContent = app.t("receiptCount", { count: readers.length });
|
|
467
|
+
const list = details.querySelector(".receipt-reader-list");
|
|
468
|
+
list.textContent = "";
|
|
469
|
+
const members = app.state.memberSessions.get(app.state.room?.id) || [];
|
|
470
|
+
for (const reader of readers) {
|
|
471
|
+
const row = document.createElement("li"), name = document.createElement("span"), evidence = document.createElement("span");
|
|
472
|
+
const duplicates = members.filter((member) => member.name === reader.name).length > 1 || readers.filter((item) => item.name === reader.name).length > 1;
|
|
473
|
+
name.textContent = `${reader.name}${duplicates ? ` · ${reader.sessionID.slice(0, 8)}` : ""}${reader.currentMember === false ? ` · ${app.t("departedMember")}` : ""}`;
|
|
474
|
+
evidence.textContent = app.t(`receiptEvidence_${reader.evidence}`);
|
|
475
|
+
evidence.title = evidence.textContent;
|
|
476
|
+
evidence.setAttribute("aria-label", evidence.textContent);
|
|
477
|
+
row.dataset.readerSessionId = reader.sessionID;
|
|
478
|
+
row.append(name, evidence);
|
|
479
|
+
list.append(row);
|
|
409
480
|
}
|
|
481
|
+
}
|
|
410
482
|
|
|
411
|
-
|
|
483
|
+
function systemMessage(text, app) {
|
|
412
484
|
const joined = /^(.*?)\s+joined the room$/.exec(String(text));
|
|
413
485
|
if (joined) return app.t("systemJoined", { name: joined[1] });
|
|
414
486
|
const left = /^(.*?)\s+left the room$/.exec(String(text));
|
|
@@ -73,6 +73,7 @@ export function initRooms(app) {
|
|
|
73
73
|
app.renderHead();
|
|
74
74
|
$("#msgList").textContent = "";
|
|
75
75
|
app.renderMessages(false);
|
|
76
|
+
app.startPolling();
|
|
76
77
|
app.renderMembers();
|
|
77
78
|
$("#thread").scrollTop = hasSavedPosition ? entry.position : entry.position || $("#thread").scrollHeight;
|
|
78
79
|
$("#msgInput").disabled = false;
|
|
@@ -82,7 +83,6 @@ export function initRooms(app) {
|
|
|
82
83
|
app.updateDraftCount();
|
|
83
84
|
app.updateSendState();
|
|
84
85
|
app.hideSendError();
|
|
85
|
-
app.startPolling();
|
|
86
86
|
app.updateBadge();
|
|
87
87
|
app.updateJump();
|
|
88
88
|
app.markActiveRoomRead();
|
|
@@ -3,7 +3,10 @@ export const app = {
|
|
|
3
3
|
state: {
|
|
4
4
|
room: null, myName: "", unread: 0, drafts: new Map(), rooms: new Map(),
|
|
5
5
|
pollGeneration: 0, navigationGeneration: 0, draftRevision: new Map(), memberSessions: new Map(),
|
|
6
|
-
retryingFailedIds: new Set(), pollController: null,
|
|
6
|
+
retryingFailedIds: new Set(), pollController: null, memberRefreshTimer: 0, receiptRefreshTimer: 0, receiptObservationFrame: 0,
|
|
7
|
+
receiptObservation: null,
|
|
8
|
+
memberApiUnavailable: new Set(), receiptApiUnavailable: new Set(),
|
|
9
|
+
receipts: new Map(), acknowledgedMessages: new Map(), pendingAcknowledgements: new Map(),
|
|
7
10
|
pendingAction: null, watcherTimer: 0, restored: false,
|
|
8
11
|
},
|
|
9
12
|
rendered: 0,
|
|
@@ -163,6 +166,10 @@ const messages = {
|
|
|
163
166
|
allMembers: "Everyone", messageCount: ({ count }) => `${count} / 2000`,
|
|
164
167
|
privacyNote: "Anyone with the shared token can read direct messages and manage rooms; the server can read them too.",
|
|
165
168
|
systemJoined: ({ name }) => `${name} joined the room`, systemLeft: ({ name }) => `${name} left the room`,
|
|
169
|
+
activity_working: "Working", activity_idle: "Foreground idle", activity_waiting: "Waiting", activity_unknown: "Status unknown", activity_offline: "Status stale",
|
|
170
|
+
activityHint_working: "The agent reports active work.", activityHint_idle: "Foreground is idle; background work may continue.", activityHint_waiting: "The agent reports that it is waiting.", activityHint_unknown: "No activity report is available.", activityHint_offline: "The last status is stale; this does not prove the agent is offline.",
|
|
171
|
+
receiptCount: ({ count }) => `Read by ${count}`, departedMember: "left",
|
|
172
|
+
receiptEvidence_displayed: "Shown on screen", receiptEvidence_tool: "Fetched with room tool", receiptEvidence_context: "Full message reached agent context preparation (not proof of understanding)",
|
|
166
173
|
},
|
|
167
174
|
"zh-CN": {
|
|
168
175
|
brand: "闲叙", documentTitle: "闲叙 · 轻量聊天室", roomTitle: ({ name }) => `${name} · 闲叙`,
|
|
@@ -199,6 +206,10 @@ const messages = {
|
|
|
199
206
|
allMembers: "所有人", messageCount: ({ count }) => `${count} / 2000`,
|
|
200
207
|
privacyNote: "持有共享令牌的人都可以读取私聊内容和管理房间;服务器也可以读取私聊内容。",
|
|
201
208
|
systemJoined: ({ name }) => `${name} 加入了房间`, systemLeft: ({ name }) => `${name} 离开了房间`,
|
|
209
|
+
activity_working: "工作中", activity_idle: "前台空闲", activity_waiting: "等待中", activity_unknown: "状态未知", activity_offline: "状态已过期",
|
|
210
|
+
activityHint_working: "Agent 正在报告工作状态。", activityHint_idle: "前台空闲;后台任务仍可能继续。", activityHint_waiting: "Agent 正在报告等待状态。", activityHint_unknown: "暂无活动状态报告。", activityHint_offline: "最近的状态已过期;这不能证明 Agent 已离线。",
|
|
211
|
+
receiptCount: ({ count }) => `已读 ${count} 人`, departedMember: "已离开",
|
|
212
|
+
receiptEvidence_displayed: "已显示在屏幕上", receiptEvidence_tool: "通过房间工具读取", receiptEvidence_context: "完整消息已进入 Agent 上下文准备阶段(不代表已理解)",
|
|
202
213
|
},
|
|
203
214
|
};
|
|
204
215
|
|
|
@@ -64,16 +64,23 @@
|
|
|
64
64
|
.panel .btn { margin-top: 10px; }
|
|
65
65
|
#memberList { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; }
|
|
66
66
|
#memberList li {
|
|
67
|
-
display:
|
|
68
|
-
|
|
69
|
-
align-items:
|
|
70
|
-
gap:
|
|
67
|
+
display: grid;
|
|
68
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
69
|
+
align-items: center;
|
|
70
|
+
gap: 4px 8px;
|
|
71
71
|
padding: 7px 0;
|
|
72
72
|
border-bottom: 1px solid var(--line);
|
|
73
73
|
font-size: 14px;
|
|
74
74
|
}
|
|
75
|
+
#memberList li > span:first-child { grid-column: 1 / -1; min-width: 0; overflow-wrap: anywhere; }
|
|
76
|
+
#memberList .member-actions { grid-column: 1 / -1; justify-content: flex-end; flex-wrap: wrap; }
|
|
77
|
+
#memberList .member-activity + .member-actions { grid-column: 2; grid-row: 2; }
|
|
78
|
+
#memberList .member-action { white-space: normal; }
|
|
75
79
|
#memberList li:last-child { border-bottom: none; }
|
|
76
80
|
.m-time { font-size: 11.5px; color: var(--ink-3); }
|
|
81
|
+
.member-activity { flex: none; padding: 2px 6px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: 10px; }
|
|
82
|
+
.member-activity.working { color: var(--accent); background: var(--accent-soft); }
|
|
83
|
+
.member-activity.offline { color: var(--danger); background: var(--danger-soft); }
|
|
77
84
|
|
|
78
85
|
.conn-bar {
|
|
79
86
|
display: flex;
|
|
@@ -99,10 +106,11 @@
|
|
|
99
106
|
flex: 1;
|
|
100
107
|
min-height: 0;
|
|
101
108
|
overflow-y: auto;
|
|
109
|
+
overflow-anchor: none;
|
|
102
110
|
overscroll-behavior: contain;
|
|
103
111
|
padding: 22px 22px 6px;
|
|
104
112
|
}
|
|
105
|
-
#msgList { list-style: none; margin: 0; padding: 0; }
|
|
113
|
+
#msgList { width: min(100%, 940px); list-style: none; margin: 0 auto; padding: 0; }
|
|
106
114
|
|
|
107
115
|
.thread, #roomList, #memberList {
|
|
108
116
|
scrollbar-width: thin;
|
|
@@ -173,6 +181,12 @@
|
|
|
173
181
|
overflow-wrap: anywhere;
|
|
174
182
|
}
|
|
175
183
|
.msg.own .msg-text { background: var(--accent-soft); border-bottom-left-radius: 14px; border-bottom-right-radius: 4px; }
|
|
184
|
+
.message-readers { margin-top: 4px; color: var(--ink-3); font-size: 11px; }
|
|
185
|
+
.message-readers summary { cursor: pointer; }
|
|
186
|
+
.receipt-reader-list { margin: 4px 0 0; padding: 5px 8px; list-style: none; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
|
|
187
|
+
.receipt-reader-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
|
|
188
|
+
.receipt-reader-list li + li { margin-top: 4px; }
|
|
189
|
+
.receipt-reader-list li span:last-child { color: var(--ink-3); }
|
|
176
190
|
|
|
177
191
|
/* Markdown content */
|
|
178
192
|
.msg-text p, .msg-text pre, .msg-text blockquote, .msg-text ul, .msg-text ol { margin: 0; }
|