@alexsun-top/opencode-chat-room 0.6.8 → 0.7.0
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 +31 -0
- package/README.md +5 -4
- package/README.zh-CN.md +5 -4
- package/package.json +1 -1
- package/plugin.ts +49 -27
- package/server/assets/HIGHLIGHT-LICENSE +29 -0
- package/server/assets/NOTICE.txt +2 -1
- package/server/assets/base.css +7 -58
- package/server/assets/chat/admin.js +1 -1
- package/server/assets/chat/announcements.js +1 -1
- package/server/assets/chat/confirm-dialog.js +28 -0
- package/server/assets/chat/editor.js +97 -16
- package/server/assets/chat/events.js +48 -7
- package/server/assets/chat/index.js +6 -0
- package/server/assets/chat/join-requests.js +37 -17
- package/server/assets/chat/locales/de.js +115 -0
- package/server/assets/chat/locales/es.js +115 -0
- package/server/assets/chat/locales/fr.js +115 -0
- package/server/assets/chat/locales/index.js +8 -0
- package/server/assets/chat/locales/it.js +115 -0
- package/server/assets/chat/locales/ja.js +115 -0
- package/server/assets/chat/locales/ko.js +115 -0
- package/server/assets/chat/markdown.js +101 -1
- package/server/assets/chat/members.js +2 -2
- package/server/assets/chat/mentions.js +1 -0
- package/server/assets/chat/message-polling.js +28 -5
- package/server/assets/chat/messages.js +20 -2
- package/server/assets/chat/panels.js +0 -9
- package/server/assets/chat/questions.js +11 -3
- package/server/assets/chat/recall.js +8 -20
- package/server/assets/chat/reminders.js +1 -1
- package/server/assets/chat/replies.js +1 -1
- package/server/assets/chat/room-watcher.js +4 -0
- package/server/assets/chat/rooms.js +1 -1
- package/server/assets/chat/settings.js +72 -0
- package/server/assets/chat/shortcuts.js +46 -235
- package/server/assets/chat/state.js +52 -36
- package/server/assets/chat/system-messages.js +1 -0
- package/server/assets/chat/viewport.js +23 -0
- package/server/assets/code-highlight.css +124 -0
- package/server/assets/conversation.css +21 -3
- package/server/assets/highlight-10.7.3.min.js +1358 -0
- package/server/assets/responsive.css +6 -5
- package/server/assets/settings.css +138 -0
- package/server/chat-server.ts +4 -1
- package/server/chat.html +110 -51
- package/server/join-requests.ts +11 -0
- package/server/sw.js +3 -0
- package/skills/chatroom/SKILL.md +3 -2
- package/src/agent/admin-client.ts +13 -5
- package/src/agent/announcement-tool.ts +6 -6
- package/src/center/center-client.ts +17 -17
- package/src/center/reminder-client.ts +5 -5
- package/src/rooms/resource-read.ts +16 -9
- package/src/rooms/resource-upload.ts +2 -2
- package/src/state/sqlite-state.ts +3 -2
- package/src/tests/announcement-board.ts +3 -2
- package/server/assets/keyboard-hints.css +0 -51
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.7.0 — 2026-11-19
|
|
4
|
+
|
|
5
|
+
- Keep one compact shortcut entry under the composer. It shows `Alt + /` (`Option + /` on Mac) and opens the full shortcut sheet; all other per-control hints stay removed.
|
|
6
|
+
- Animate Alt+Arrow room switching separately from conversation jumps (Alt+Home/End and PageUp/PageDown), with reduced-motion preferences respected.
|
|
7
|
+
- Treat Alt+PageUp and Alt+PageDown exactly like PageUp and PageDown in the composer, including the conversation-jump transition.
|
|
8
|
+
- Keep mention tokens when copying selected text from rendered messages, so pasting it back restores the mention chips.
|
|
9
|
+
- Syntax-highlight fenced code blocks locally; hover or focus reveals icon-only wrap and copy controls.
|
|
10
|
+
- Keep pasted composer text plain except for mention chips. Multi-line paste no longer leaves browser block markup, a selected mention replaces its trigger `@` cleanly, and Backspace deletes one character at a time.
|
|
11
|
+
- Show the composer placeholder only when the editor is truly empty, so a draft ending in a newline no longer overlaps with the placeholder text.
|
|
12
|
+
- Make tool parameter errors actionable: resource reads require both `roomId` and `resourceId`, missing IDs explain where to get them, and unknown rooms point to `room` action `list`.
|
|
13
|
+
- Keep Home and End caret moves visible around mention chips; Home at a line starting with a mention lands on the first editable character after the chip instead of inside or before it.
|
|
14
|
+
- Scroll the mention picker automatically so the keyboard-selected member stays visible in large rooms.
|
|
15
|
+
- Update the Questions count and the room question marker as soon as a question arrives or is answered, without opening the panel first.
|
|
16
|
+
- Place the caret after a tapped or clicked mention chip so Backspace and Delete can remove it on touch keyboards.
|
|
17
|
+
- Show a sent message immediately while the server confirms it; a failed send removes the pending copy and uses the existing retry panel.
|
|
18
|
+
- Recover the connection bar and clear a stale network send warning after the network returns; timed-out inbox requests retry instead of staying stuck.
|
|
19
|
+
- Show pending join requests as a single numeric badge on Members, and return an explicit HTTP 202 message explaining that the requester is not a member yet and needs human administrator approval.
|
|
20
|
+
- Let a pending applicant cancel their own join request from the join card or chat notice with a red **Cancel request** button; the request is withdrawn on the server, not merely hidden.
|
|
21
|
+
- Let one Agent session join several rooms at once; membership, delivery, and leaving are tracked per room, so leaving one room does not stop delivery for the others.
|
|
22
|
+
- Add a unified Settings dialog for language, theme, and the access token. It opens before joining and from the chat menu; English, 简体中文, 日本語, 한국어, Français, Deutsch, Español, and Italiano are available, with System, Light, Dark, Forest, and Sand themes; language and theme persist per browser without signing in.
|
|
23
|
+
- Keep the mobile composer inside the visible area when the soft keyboard opens, move the conversation to its latest message as the keyboard resizes the view, insert a newline for Enter on touch devices while keeping the Send button, and apply safe-area spacing at the top.
|
|
24
|
+
|
|
25
|
+
## 0.6.9 — 2026-11-18
|
|
26
|
+
|
|
27
|
+
- Remove the automatic keyboard-hint tags on controls, the rail shortcut hint, and the `?` shortcut. Press Alt+/ to open the shortcut sheet, which lists only shortcuts that exist. Alt+Home and Alt+End jump to the oldest or latest loaded message without requesting older history.
|
|
28
|
+
- Replace native browser confirmation dialogs with an in-app dialog for room deletion, member removal, message recall, reminder and announcement deletion, file deletion, and disabling join approval.
|
|
29
|
+
- Block recall of system notices in both the web client and the server.
|
|
30
|
+
- Localize join-approval system messages with natural English and Chinese wording.
|
|
31
|
+
- Use a responsive two-column join page and clear a stale token warning after the token is saved.
|
|
32
|
+
- Align the Codex and dsh plugins at 0.1.1; they inherit the central-server fixes.
|
|
33
|
+
|
|
3
34
|
## 0.6.8 — 2026-11-18
|
|
4
35
|
|
|
5
36
|
- Create protected group rooms that require approval to join. Human owners and administrators approve people and Agents; the designated management Agent can approve Agent requests only. Pending applicants are not members and cannot send, poll, or receive room delivery until approved.
|
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ When upgrading an existing install, quit OpenCode first or use `opencode plugin
|
|
|
24
24
|
On a machine reachable by the other devices, start the server. Replace `your-password` with a shared password:
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
|
-
bunx @alexsun-top/opencode-chat-room@0.
|
|
27
|
+
bunx @alexsun-top/opencode-chat-room@0.7.0 --host 0.0.0.0 --port 4399 --token 'your-password'
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
On each machine running OpenCode, set the server address and the same password, then start OpenCode from that environment:
|
|
@@ -35,7 +35,7 @@ export CHAT_ROOM_SERVER_TOKEN="your-password"
|
|
|
35
35
|
opencode
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
Open `http://SERVER_IP:4399/chat` in a browser and enter the same password in
|
|
38
|
+
Open `http://SERVER_IP:4399/chat` in a browser and enter the same password in Settings. The same dialog, available before joining and from the chat menu, also selects the language and theme. Create or join a room there, and ask each agent to join it too.
|
|
39
39
|
|
|
40
40
|
**Security:** Anyone with the shared password can access and manage rooms, including direct chats. Share it only with trusted people and protect network access to the server. Join approval controls the normal join flow; it is not per-user authentication, so it does not stop a password holder from misrepresenting itself.
|
|
41
41
|
|
|
@@ -49,7 +49,7 @@ docker run --rm -p 4399:4399 -v chat-room-data:/data \
|
|
|
49
49
|
ghcr.io/agentsyaml/opencode-chat-room:latest
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
Pin a release with `ghcr.io/agentsyaml/opencode-chat-room:v0.
|
|
52
|
+
Pin a release with `ghcr.io/agentsyaml/opencode-chat-room:v0.7.0`. Rooms, messages and receipts live in the `/data` volume; keep it mounted across upgrades. If you bind-mount a host directory instead of a named volume, make it writable by uid `10001`.
|
|
53
53
|
|
|
54
54
|
## 3. Start chatting
|
|
55
55
|
|
|
@@ -58,8 +58,9 @@ Pin a release with `ghcr.io/agentsyaml/opencode-chat-room:v0.6.8`. Rooms, messag
|
|
|
58
58
|
- Use Reply to respond to a message. Mark a message as a question when you need an answer.
|
|
59
59
|
- Use the room's reminder button for one-time or recurring reminders. Times default to the server's time zone.
|
|
60
60
|
- Reminder text supports `{{time}}`, `{{initiator}}`, and `{{room}}`.
|
|
61
|
-
-
|
|
61
|
+
- A compact shortcut chip under the composer shows Alt+/ (Option+/ on Mac); click it or press the keys to open the sheet. Alt+Home/Alt+End animate to the oldest/latest message, and PageUp/PageDown scrolls the conversation while you type.
|
|
62
62
|
- Attach files, drag them in, or paste images. The default limit is 500 MiB per file.
|
|
63
|
+
- Fenced code blocks are syntax-highlighted locally. Hover or focus a block for icon-only wrap and copy controls.
|
|
63
64
|
- Agents can recall a message by ID; the original stays available to current members.
|
|
64
65
|
- Agents can use the `room` tool's `read_resource` action to save an attachment to a temporary file before opening it.
|
|
65
66
|
|
package/README.zh-CN.md
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
在一台可被其他设备访问的机器上启动服务器,把 `换成自己的密码` 换成共享密码:
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
|
-
bunx @alexsun-top/opencode-chat-room@0.
|
|
27
|
+
bunx @alexsun-top/opencode-chat-room@0.7.0 --host 0.0.0.0 --port 4399 --token '换成自己的密码'
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
在每台运行 OpenCode 的机器上设置服务器地址和相同密码,再从该环境启动 OpenCode:
|
|
@@ -35,7 +35,7 @@ export CHAT_ROOM_SERVER_TOKEN="换成自己的密码"
|
|
|
35
35
|
opencode
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
在浏览器打开 `http://服务器IP:4399/chat
|
|
38
|
+
在浏览器打开 `http://服务器IP:4399/chat`,在设置窗口中填入相同密码。同一个设置窗口在加入房间前和聊天菜单中都能打开,也可以选择语言和主题。然后创建或加入房间,每个 Agent 也需要加入同一个房间。
|
|
39
39
|
|
|
40
40
|
**安全提示:**共享密码的持有人可以访问和管理房间,包括私聊;请只分享给可信任的人,并保护服务器网络访问。加入审核只约束正常加入流程,不是按用户认证,无法阻止密码持有人伪装身份。
|
|
41
41
|
|
|
@@ -49,7 +49,7 @@ docker run --rm -p 4399:4399 -v chat-room-data:/data \
|
|
|
49
49
|
ghcr.io/agentsyaml/opencode-chat-room:latest
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
用 `ghcr.io/agentsyaml/opencode-chat-room:v0.
|
|
52
|
+
用 `ghcr.io/agentsyaml/opencode-chat-room:v0.7.0` 可以固定到具体版本。房间、消息和回执都保存在 `/data` 卷里,升级时保留该卷即可。如果改用宿主目录做挂载,需要让该目录对 uid `10001` 可写。
|
|
53
53
|
|
|
54
54
|
## 3. 开始聊天
|
|
55
55
|
|
|
@@ -58,8 +58,9 @@ docker run --rm -p 4399:4399 -v chat-room-data:/data \
|
|
|
58
58
|
- 回复消息时点击回复;需要对方回答的问题可标记为「问题」。
|
|
59
59
|
- 点击房间里的提醒按钮,可创建一次性或周期提醒。默认使用服务器时区。
|
|
60
60
|
- 提醒正文支持 `{{time}}`、`{{initiator}}`、`{{room}}` 模板变量。
|
|
61
|
-
-
|
|
61
|
+
- 输入框下方保留唯一快捷键入口,以紧凑标签显示 Alt+/(Mac 为 Option+/);点击或按快捷键都能打开面板。Alt+Home/Alt+End 平滑跳到最早/最新消息,输入时用 PageUp/PageDown 滚动会话。
|
|
62
62
|
- 点击附件按钮、拖入文件或粘贴图片即可分享;默认单文件上限为 500 MiB。
|
|
63
|
+
- 围栏代码块会在本地做语法高亮;鼠标悬停或键盘聚焦时显示纯图标的自动换行和复制按钮。
|
|
63
64
|
- Agent 可按消息 ID 撤回;当前成员仍可查看原文。
|
|
64
65
|
- Agent 收到附件后可通过 `room` 的 `read_resource` 操作保存到临时文件,再打开查看。
|
|
65
66
|
|
package/package.json
CHANGED
package/plugin.ts
CHANGED
|
@@ -61,7 +61,7 @@ async function withRooms<T>(
|
|
|
61
61
|
return fn(svc, registry);
|
|
62
62
|
} catch (err) {
|
|
63
63
|
if (err instanceof RoomError) {
|
|
64
|
-
return `error: ${err
|
|
64
|
+
return `error: ${actionableError(err)}` as unknown as T;
|
|
65
65
|
}
|
|
66
66
|
throw err;
|
|
67
67
|
}
|
|
@@ -246,24 +246,44 @@ export async function pollKnownSessions(
|
|
|
246
246
|
|
|
247
247
|
const READ_ONLY_ACTIONS = new Set(["list", "members", "poll", "join_status", "announcement_list", "announcement_read"]);
|
|
248
248
|
|
|
249
|
+
function actionableError(error: unknown): string {
|
|
250
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
251
|
+
const status = (error as { status?: unknown })?.status;
|
|
252
|
+
if (/^room not found/i.test(message)) return `${message}; run room action list to get a valid room UUID`;
|
|
253
|
+
if (/^not joined/i.test(message)) return `${message}; call join for this room first, and wait for approval if required`;
|
|
254
|
+
if (message === "EMPTY_MESSAGE" || /message text is empty/i.test(message)) return "message text is empty; pass a non-empty text body";
|
|
255
|
+
if (message === "NOT_OWNER") return "only the room owner can do this; ask the room owner or a room administrator";
|
|
256
|
+
if (message === "DIRECT_ROOM_FULL") return "this direct room is limited to its two participants; create or join another room";
|
|
257
|
+
if (status === 401 || message === "unauthorized") return `${message === "unauthorized" ? "unauthorized" : message}; set CHAT_ROOM_SERVER_TOKEN to the server access token, then retry`;
|
|
258
|
+
if (status === 403 || message === "forbidden") return `${message === "forbidden" ? "forbidden" : message}; check that you joined this room and have permission for this action`;
|
|
259
|
+
if (typeof status === "number" && status >= 500) return `${message}; the center failed to handle the request, retry later and report the server log`;
|
|
260
|
+
if ((error as { name?: unknown })?.name === "TimeoutError" || /timed? ?out|aborted/i.test(message)) {
|
|
261
|
+
return "center request timed out; check CHAT_ROOM_SERVER_URL and network, then retry";
|
|
262
|
+
}
|
|
263
|
+
if (/fetch failed|ECONNREFUSED|ENOTFOUND|EAI_AGAIN/i.test(message)) {
|
|
264
|
+
return "could not reach the center; check CHAT_ROOM_SERVER_URL and that the server is running";
|
|
265
|
+
}
|
|
266
|
+
return message;
|
|
267
|
+
}
|
|
268
|
+
|
|
249
269
|
export const roomArgs = z.object({
|
|
250
270
|
action: z.enum(["create", "join", "join_status", "leave", "list", "send", "poll", "recall", "members", "upload_resource", "read_resource", "delete_resource", "announcement_list", "announcement_read", "announcement_write", "announcement_delete", "reminder_list", "reminder_create", "reminder_update", "reminder_delete"]),
|
|
251
271
|
name: z.string().max(64).optional().describe("For join: your own participant display name, NOT the room name (required). For create: the new room name."),
|
|
252
|
-
roomId: z.string().optional(),
|
|
253
|
-
messageId: z.string().optional().describe("For recall: the full message ID
|
|
254
|
-
resourceId: z.string().optional(),
|
|
255
|
-
filePath: z.string().optional().describe("
|
|
256
|
-
text: z.string().max(5000).optional(),
|
|
257
|
-
isQuestion: z.boolean().optional(),
|
|
258
|
-
announcementName: z.string().optional().describe("
|
|
259
|
-
content: z.string().optional().describe("Announcement content, at most 5000 Unicode characters."),
|
|
260
|
-
reminderId: z.string().optional(),
|
|
272
|
+
roomId: z.string().optional().describe("Room UUID, not the room name. Required for resource actions and every room-scoped action."),
|
|
273
|
+
messageId: z.string().optional().describe("For recall: the full message ID returned by send or poll; required for recall."),
|
|
274
|
+
resourceId: z.string().optional().describe("Resource UUID returned by upload_resource. read_resource and delete_resource also require roomId."),
|
|
275
|
+
filePath: z.string().optional().describe("Absolute path to a regular local file to upload; central mode only; requires host read permission."),
|
|
276
|
+
text: z.string().max(5000).optional().describe("Message text, at most 5000 characters; required for send."),
|
|
277
|
+
isQuestion: z.boolean().optional().describe("For send: mark the message as a question awaiting an answer."),
|
|
278
|
+
announcementName: z.string().optional().describe("Exact announcement name from announcement_list; distinct from participant or room name."),
|
|
279
|
+
content: z.string().optional().describe("Announcement content, at most 5000 Unicode characters; required for announcement_write."),
|
|
280
|
+
reminderId: z.string().optional().describe("Reminder UUID from reminder_list; required for reminder_update and reminder_delete."),
|
|
261
281
|
schedule: z.discriminatedUnion("type", [z.object({ type: z.literal("once"), at: z.string(), timezone: z.string().refine((value) => { try { new Intl.DateTimeFormat("en", { timeZone: value }); return true; } catch { return false; } }, "timezone must be an IANA timezone").optional() }), z.object({ type: z.literal("cron"), expression: z.string().regex(/^\S+\s+\S+\s+\S+\s+\S+\s+\S+$/), timezone: z.string().refine((value) => { try { new Intl.DateTimeFormat("en", { timeZone: value }); return true; } catch { return false; } }, "timezone must be an IANA timezone").optional() })]).optional(),
|
|
262
282
|
paused: z.boolean().optional(),
|
|
263
283
|
joinPolicy: z.enum(["open", "approval"]).optional().describe("For create: \"approval\" holds new identities as pending until a human administrator approves them; central mode only."),
|
|
264
284
|
}).superRefine((args, ctx) => {
|
|
265
285
|
if (args.action === "join" && !args.name?.trim()) {
|
|
266
|
-
ctx.addIssue({ code: "custom", path: ["name"], message: "name is required to join a room" });
|
|
286
|
+
ctx.addIssue({ code: "custom", path: ["name"], message: "name is required to join a room; pass your participant display name" });
|
|
267
287
|
}
|
|
268
288
|
});
|
|
269
289
|
type RoomArguments = z.infer<typeof roomArgs>;
|
|
@@ -272,7 +292,7 @@ const roomExecute = async (
|
|
|
272
292
|
args: RoomArguments,
|
|
273
293
|
context: V1ToolContext & { signal?: AbortSignal },
|
|
274
294
|
) => {
|
|
275
|
-
if (args.action === "join" && !args.name?.trim()) return "error: name is required to join a room";
|
|
295
|
+
if (args.action === "join" && !args.name?.trim()) return "error: name is required to join a room; pass your participant display name";
|
|
276
296
|
const runtime = currentRuntime();
|
|
277
297
|
if (args.action === "reminder_list" || args.action === "reminder_create" || args.action === "reminder_update" || args.action === "reminder_delete") {
|
|
278
298
|
return await runReminderTool(runtime.center, args, context.sessionID);
|
|
@@ -280,6 +300,8 @@ const roomExecute = async (
|
|
|
280
300
|
if (args.action === "upload_resource") return uploadAgentResource(runtime.center, args.roomId ?? "", args.filePath ?? "", context.sessionID, context);
|
|
281
301
|
if (args.action === "delete_resource") return deleteAgentResource(runtime.center, args.roomId ?? "", args.resourceId ?? "", context.sessionID);
|
|
282
302
|
if (args.action === "read_resource") {
|
|
303
|
+
if (!args.roomId) return "error: roomId is required for read_resource; use the room UUID, not the room name";
|
|
304
|
+
if (!args.resourceId) return "error: resourceId is required for read_resource; use the resource UUID returned by upload_resource";
|
|
283
305
|
try {
|
|
284
306
|
if (!context.ask) return "error: host webfetch permission is unavailable";
|
|
285
307
|
return await readAgentResource(runtime.center, args.roomId ?? "", args.resourceId ?? "", context, context.abort ?? context.signal);
|
|
@@ -302,14 +324,14 @@ const roomExecute = async (
|
|
|
302
324
|
}, context.sessionID);
|
|
303
325
|
}
|
|
304
326
|
if (args.action === "recall") {
|
|
305
|
-
if (!args.roomId) return "error: roomId is required";
|
|
306
|
-
if (!args.messageId) return "error: messageId is required";
|
|
327
|
+
if (!args.roomId) return "error: roomId is required; use a room UUID from the room list, not the room name";
|
|
328
|
+
if (!args.messageId) return "error: messageId is required; use the full message ID returned by send or poll";
|
|
307
329
|
try {
|
|
308
330
|
const recalled = await recallMessage(args.roomId, args.messageId, context.sessionID);
|
|
309
331
|
switch (recalled.status) {
|
|
310
332
|
case "ok": return `recalled message ${recalled.messageID}`;
|
|
311
333
|
case "missing": return `error: message not found: ${args.messageId}`;
|
|
312
|
-
case "member": return "error: not joined";
|
|
334
|
+
case "member": return "error: not joined; call join for this room first, and wait for approval if required";
|
|
313
335
|
case "forbidden": return "error: only the sender or a room admin can recall this message";
|
|
314
336
|
}
|
|
315
337
|
} catch (err) {
|
|
@@ -351,7 +373,7 @@ const roomExecute = async (
|
|
|
351
373
|
switch (args.action) {
|
|
352
374
|
case "create": {
|
|
353
375
|
if (!args.name?.trim()) {
|
|
354
|
-
return "error: name is required";
|
|
376
|
+
return "error: name is required for create; pass the new room name";
|
|
355
377
|
}
|
|
356
378
|
if (args.joinPolicy === "approval") {
|
|
357
379
|
return "error: joinPolicy \"approval\" requires central mode (set CHAT_ROOM_SERVER_URL); local rooms are always open";
|
|
@@ -362,7 +384,7 @@ const roomExecute = async (
|
|
|
362
384
|
}
|
|
363
385
|
case "join": {
|
|
364
386
|
if (!args.roomId) {
|
|
365
|
-
return "error: roomId is required";
|
|
387
|
+
return "error: roomId is required; use a room UUID from the room list, not the room name";
|
|
366
388
|
}
|
|
367
389
|
const me = identity(args.name!.trim());
|
|
368
390
|
// ponytail: F5 — re-join under a new name retires the old
|
|
@@ -390,7 +412,7 @@ const roomExecute = async (
|
|
|
390
412
|
}
|
|
391
413
|
case "leave": {
|
|
392
414
|
if (!args.roomId) {
|
|
393
|
-
return "error: roomId is required";
|
|
415
|
+
return "error: roomId is required; use a room UUID from the room list, not the room name";
|
|
394
416
|
}
|
|
395
417
|
// ponytail: ora-2 M2 — mirror the join guard: if another session
|
|
396
418
|
// still holds this name, remove only the registry entry, not the
|
|
@@ -419,7 +441,7 @@ const roomExecute = async (
|
|
|
419
441
|
}
|
|
420
442
|
case "members": {
|
|
421
443
|
if (!args.roomId) {
|
|
422
|
-
return "error: roomId is required";
|
|
444
|
+
return "error: roomId is required; use a room UUID from the room list, not the room name";
|
|
423
445
|
}
|
|
424
446
|
const members = svc.getParticipants(args.roomId);
|
|
425
447
|
return members.length > 0
|
|
@@ -428,7 +450,7 @@ const roomExecute = async (
|
|
|
428
450
|
}
|
|
429
451
|
case "join_status": {
|
|
430
452
|
if (!args.roomId) {
|
|
431
|
-
return "error: roomId is required";
|
|
453
|
+
return "error: roomId is required; use a room UUID from the room list, not the room name";
|
|
432
454
|
}
|
|
433
455
|
return registry[args.roomId]?.[context.sessionID]
|
|
434
456
|
? `joined room ${args.roomId}`
|
|
@@ -436,10 +458,10 @@ const roomExecute = async (
|
|
|
436
458
|
}
|
|
437
459
|
case "send": {
|
|
438
460
|
if (!args.roomId) {
|
|
439
|
-
return "error: roomId is required";
|
|
461
|
+
return "error: roomId is required; use a room UUID from the room list, not the room name";
|
|
440
462
|
}
|
|
441
463
|
if (!args.text?.trim()) {
|
|
442
|
-
return "error: text is required";
|
|
464
|
+
return "error: text is required; pass a non-empty message body";
|
|
443
465
|
}
|
|
444
466
|
const msg = svc.sendMessage(
|
|
445
467
|
args.roomId,
|
|
@@ -454,16 +476,16 @@ const roomExecute = async (
|
|
|
454
476
|
}
|
|
455
477
|
case "poll": {
|
|
456
478
|
if (!args.roomId) {
|
|
457
|
-
return "error: roomId is required";
|
|
479
|
+
return "error: roomId is required; use a room UUID from the room list, not the room name";
|
|
458
480
|
}
|
|
459
481
|
// ponytail: gate on registry entry (session granularity) — a
|
|
460
482
|
// participant-id check would pass for any session sharing the
|
|
461
483
|
// same host identity
|
|
462
484
|
if (!pollEntry) {
|
|
463
|
-
return "error: not joined";
|
|
485
|
+
return "error: not joined; call join for this room first, and wait for approval if required";
|
|
464
486
|
}
|
|
465
487
|
if (!svc.containsParticipant(args.roomId, selfName)) {
|
|
466
|
-
return "error: not joined";
|
|
488
|
+
return "error: not joined; call join for this room first, and wait for approval if required";
|
|
467
489
|
}
|
|
468
490
|
// ponytail: only messages newer than this session's last read (or
|
|
469
491
|
// last successful push) — queue-notified messages don't repeat
|
|
@@ -496,11 +518,11 @@ const roomExecute = async (
|
|
|
496
518
|
}
|
|
497
519
|
return result;
|
|
498
520
|
} catch (err) {
|
|
499
|
-
return `error: ${
|
|
521
|
+
return `error: ${actionableError(err)}`;
|
|
500
522
|
}
|
|
501
523
|
};
|
|
502
524
|
const room = tool({
|
|
503
|
-
description: "Chat room operations: create, join, leave and list rooms; send, poll and recall messages; list members and announcements; manage reminders. Sent and polled messages carry full message IDs; recall takes roomId plus messageId and withdraws the message for everyone (agents their own, room admins any). Reminder schedules use the server timezone unless an IANA timezone is provided; once schedules require an ISO datetime. Upload files and media; upload_resource returns a [[resource:UUID]] marker, and the attachment renders only when that exact marker is included in a send message. read_resource saves files to a private temporary path and leaves them there until removed or system cleanup. delete_resource removes an uploaded file; servers allow human room administrators any resource and agents only their own uploads. Room joinPolicy \"approval\" makes join a pending request: you are not a member while pending, never claim otherwise, and use join_status to check whether a human administrator approved it.",
|
|
525
|
+
description: "Chat room operations: create, join, leave and list rooms; send, poll and recall messages; list members and announcements; manage reminders. Sent and polled messages carry full message IDs; recall takes roomId plus messageId and withdraws the message for everyone (agents their own, room admins any). Reminder schedules use the server timezone unless an IANA timezone is provided; once schedules require an ISO datetime. Upload files and media; upload_resource returns a [[resource:UUID]] marker, and the attachment renders only when that exact marker is included in a send message. Resource actions need both roomId (the room UUID) and resourceId (the UUID in the marker); the marker alone does not identify the room. read_resource saves files to a private temporary path and leaves them there until removed or system cleanup. delete_resource removes an uploaded file; servers allow human room administrators any resource and agents only their own uploads. Room joinPolicy \"approval\" makes join a pending request: you are not a member while pending, never claim otherwise, and use join_status to check whether a human administrator approved it.",
|
|
504
526
|
args: roomArgs.shape,
|
|
505
527
|
execute: roomExecute,
|
|
506
528
|
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2006, Ivan Sagalaev.
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
* Neither the name of the copyright holder nor the names of its
|
|
17
|
+
contributors may be used to endorse or promote products derived from
|
|
18
|
+
this software without specific prior written permission.
|
|
19
|
+
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/server/assets/NOTICE.txt
CHANGED
|
@@ -3,5 +3,6 @@ Browser vendors bundled locally; no external requests are made at runtime.
|
|
|
3
3
|
marked 18.0.4 — MIT License, see MARKED-LICENSE.
|
|
4
4
|
DOMPurify 3.4.7 — MPL 2.0 or Apache License 2.0, see DOMPURIFY-LICENSE.
|
|
5
5
|
Mermaid 11.12.2 — MIT License, see MERMAID-LICENSE.
|
|
6
|
+
highlight.js 10.7.3 — BSD 3-Clause License, see HIGHLIGHT-LICENSE.
|
|
6
7
|
|
|
7
|
-
Sources: https://www.npmjs.com/package/marked, https://www.npmjs.com/package/dompurify and https://www.npmjs.com/package/
|
|
8
|
+
Sources: https://www.npmjs.com/package/marked, https://www.npmjs.com/package/dompurify, https://www.npmjs.com/package/mermaid and https://www.npmjs.com/package/highlight.js
|
package/server/assets/base.css
CHANGED
|
@@ -24,27 +24,6 @@
|
|
|
24
24
|
--shadow: 0 2px 5px rgb(34 53 47 / .05), 0 18px 44px rgb(34 53 47 / .09);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
@media (prefers-color-scheme: dark) {
|
|
28
|
-
:root {
|
|
29
|
-
--bg: #111b19;
|
|
30
|
-
--surface: #182522;
|
|
31
|
-
--surface-2: #202f2b;
|
|
32
|
-
--ink: #edf2e9;
|
|
33
|
-
--ink-2: #c6d1c9;
|
|
34
|
-
--ink-3: #a6b3aa;
|
|
35
|
-
--line: #344640;
|
|
36
|
-
--accent: #8ac9aa;
|
|
37
|
-
--accent-ink: #14251e;
|
|
38
|
-
--accent-soft: #263d34;
|
|
39
|
-
--danger: #ef9580;
|
|
40
|
-
--danger-soft: #3a2924;
|
|
41
|
-
--warning: #d9a441;
|
|
42
|
-
--warning-ink: #241a09;
|
|
43
|
-
--mention-blue: #8bc8c2;
|
|
44
|
-
--shadow: 0 2px 6px rgb(0 0 0 / .22), 0 18px 44px rgb(0 0 0 / .32);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
27
|
html, body { height: 100%; }
|
|
49
28
|
body {
|
|
50
29
|
margin: 0;
|
|
@@ -63,7 +42,7 @@
|
|
|
63
42
|
#app {
|
|
64
43
|
max-width: 760px;
|
|
65
44
|
height: 100vh;
|
|
66
|
-
height: 100dvh;
|
|
45
|
+
height: var(--app-height, 100dvh);
|
|
67
46
|
margin: 0 auto;
|
|
68
47
|
display: flex;
|
|
69
48
|
flex-direction: column;
|
|
@@ -93,9 +72,9 @@
|
|
|
93
72
|
.join-shell { display: grid; gap: 22px; width: min(1080px, 100%); margin: auto; align-content: start; }
|
|
94
73
|
.join-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 24px; align-items: start; padding-bottom: 20px; border-bottom: 1px solid color-mix(in srgb, var(--line) 82%, transparent); }
|
|
95
74
|
.join-head .wordmark-row { grid-column: 1; grid-row: 1; align-self: center; }
|
|
96
|
-
.join-head .locale-control { grid-column: 2; grid-row: 1; margin: 0; }
|
|
97
75
|
.join-head .tagline { grid-column: 1 / -1; grid-row: 2; max-width: 62ch; margin: 0; }
|
|
98
|
-
.join-entries { display: grid; grid-template-columns: repeat(
|
|
76
|
+
.join-entries { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
|
|
77
|
+
#createForm { grid-column: 1 / -1; }
|
|
99
78
|
#joinError { grid-column: 1 / -1; }
|
|
100
79
|
.room-list { margin-top: 0; }
|
|
101
80
|
.entry-card.identity-card { display: grid; align-content: start; margin-bottom: 0; background: var(--surface); border-color: var(--line); }
|
|
@@ -137,9 +116,6 @@
|
|
|
137
116
|
background-repeat: no-repeat;
|
|
138
117
|
background-size: 12px 8px;
|
|
139
118
|
}
|
|
140
|
-
@media (prefers-color-scheme: dark) {
|
|
141
|
-
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1.2 1.6 6 6.4l4.8-4.8' fill='none' stroke='%23a6b3aa' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
|
|
142
|
-
}
|
|
143
119
|
@media (forced-colors: active) {
|
|
144
120
|
select { appearance: auto; padding-right: var(--select-pad); background-image: none; }
|
|
145
121
|
}
|
|
@@ -256,6 +232,8 @@
|
|
|
256
232
|
#announcementDialog .admin-dialog-head h2 { font-size: 21px; }
|
|
257
233
|
}
|
|
258
234
|
.danger-text { color: var(--danger) !important; }
|
|
235
|
+
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
|
|
236
|
+
.btn.danger:hover { filter: brightness(.94); }
|
|
259
237
|
.announcement-content { white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
260
238
|
|
|
261
239
|
.panel.reminder-panel { width: min(410px, calc(100vw - 32px)); max-height: min(72dvh, 640px); overflow: auto; }
|
|
@@ -280,27 +258,7 @@
|
|
|
280
258
|
.key-dialog .hint { margin: 0 0 14px; }
|
|
281
259
|
.key-actions { display: flex; align-items: center; gap: 8px; }
|
|
282
260
|
|
|
283
|
-
/* Keyboard help: a
|
|
284
|
-
.keys-hint {
|
|
285
|
-
display: inline-flex;
|
|
286
|
-
align-items: center;
|
|
287
|
-
align-self: center;
|
|
288
|
-
gap: 6px;
|
|
289
|
-
min-height: 28px;
|
|
290
|
-
padding: 2px 8px 2px 4px;
|
|
291
|
-
border: 1px solid transparent;
|
|
292
|
-
border-radius: 999px;
|
|
293
|
-
color: var(--ink-3);
|
|
294
|
-
background: transparent;
|
|
295
|
-
font: inherit;
|
|
296
|
-
font-size: 11.5px;
|
|
297
|
-
font-weight: 600;
|
|
298
|
-
line-height: 1;
|
|
299
|
-
cursor: pointer;
|
|
300
|
-
transition: color .14s, border-color .14s, background .14s;
|
|
301
|
-
}
|
|
302
|
-
.keys-hint:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); background: var(--accent-soft); }
|
|
303
|
-
.keys-hint:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
|
|
261
|
+
/* Keyboard help: a cheat sheet opened with Alt+/. */
|
|
304
262
|
.keys-key {
|
|
305
263
|
display: inline-grid;
|
|
306
264
|
place-items: center;
|
|
@@ -316,12 +274,9 @@
|
|
|
316
274
|
white-space: nowrap;
|
|
317
275
|
box-shadow: 0 1px 0 color-mix(in srgb, var(--line) 55%, transparent);
|
|
318
276
|
}
|
|
319
|
-
.keys-hint:hover .keys-key { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
|
|
320
277
|
.keys-combo { display: inline-flex; align-items: center; gap: 3px; flex: none; }
|
|
321
278
|
.keys-sep { color: var(--ink-3); font-size: 10px; }
|
|
322
|
-
|
|
323
|
-
.rail-key-hint { display: flex; align-items: center; gap: 7px; margin: 7px 8px 0; color: var(--ink-3); font-size: 10.5px; line-height: 1.4; }
|
|
324
|
-
.rail-key-hint .keys-key { height: 18px; min-width: 18px; font-size: 10px; }
|
|
279
|
+
|
|
325
280
|
|
|
326
281
|
.keys-dialog {
|
|
327
282
|
width: min(520px, calc(100vw - 28px));
|
|
@@ -340,8 +295,6 @@
|
|
|
340
295
|
.keys-dialog-head h2 { margin: 0; font-family: var(--font-display); font-size: 24px; font-weight: 600; letter-spacing: -.02em; }
|
|
341
296
|
.keys-dialog-head h2:focus { outline: none; }
|
|
342
297
|
.keys-lead { margin: 6px 0 18px; color: var(--ink-2); font-size: 13px; line-height: 1.55; }
|
|
343
|
-
.keys-sheet-actions { margin: -6px 0 16px; }
|
|
344
|
-
.keys-sheet-actions .btn { margin: 0; }
|
|
345
298
|
.keys-section + .keys-section { margin-top: 16px; }
|
|
346
299
|
.keys-section h3 { margin: 0 0 7px; color: var(--ink-3); font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
|
|
347
300
|
.keys-list { display: grid; gap: 2px; list-style: none; margin: 0; padding: 0; }
|
|
@@ -349,13 +302,9 @@
|
|
|
349
302
|
.keys-list li:first-child { border-top: 0; }
|
|
350
303
|
.keys-list li > span:last-child { color: var(--ink-2); text-align: right; }
|
|
351
304
|
@media (max-width: 560px) {
|
|
352
|
-
.keys-hint .keys-label { display: none; }
|
|
353
|
-
.keys-hint { padding: 2px; }
|
|
354
305
|
.keys-dialog { padding: 18px; }
|
|
355
306
|
.keys-dialog-head h2 { font-size: 21px; }
|
|
356
307
|
}
|
|
357
|
-
@media (max-width: 760px) { .rail-key-hint { display: none; } }
|
|
358
|
-
|
|
359
308
|
.room-list { margin-top: 0; }
|
|
360
309
|
.room-list h2 { margin: 0 0 8px; font-size: 13px; font-weight: 600; letter-spacing: .06em; color: var(--ink-2); }
|
|
361
310
|
#roomList { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 12px; list-style: none; margin: 0; padding: 0; max-height: 220px; overflow-y: auto; }
|
|
@@ -100,7 +100,7 @@ export function initAdmin(app) {
|
|
|
100
100
|
const owner = isOwner(), nextOwner = $("#editRoomOwner").value;
|
|
101
101
|
const checkedAdmins = [...$("#editRoomAdminIds").querySelectorAll("input:checked")].map((input) => input.value);
|
|
102
102
|
const joinPolicy = $("#editRoomJoinPolicy").checked ? "approval" : "open";
|
|
103
|
-
if (joinPolicy !== (room.joinPolicy ?? "open") && joinPolicy === "open" && !
|
|
103
|
+
if (joinPolicy !== (room.joinPolicy ?? "open") && joinPolicy === "open" && !(await app.confirmAction(app.t("joinPolicyOpenConfirm")))) return;
|
|
104
104
|
const body = {
|
|
105
105
|
sessionID: LS.sessionID, name, description: $("#editRoomDescription").value.trim(),
|
|
106
106
|
...(joinPolicy !== (room.joinPolicy ?? "open") ? { joinPolicy } : {}),
|
|
@@ -119,7 +119,7 @@ export function initAnnouncements(app) {
|
|
|
119
119
|
$("#btnNewAnnouncement").addEventListener("click", () => openEditor(null));
|
|
120
120
|
$("#btnDeleteAnnouncement").addEventListener("click", async () => {
|
|
121
121
|
const id = roomId(), name = selected;
|
|
122
|
-
if (!id || !name || !
|
|
122
|
+
if (!id || !name || !(await app.confirmAction(app.t("announcementDeleteConfirm", { name })))) return;
|
|
123
123
|
const context = roomGeneration, captured = editorSnapshot();
|
|
124
124
|
try {
|
|
125
125
|
await app.api(`/rooms/${encodeURIComponent(id)}/announcements/${encodeURIComponent(name)}`, { method: "DELETE", body: JSON.stringify({ sessionID: LS.sessionID }) });
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// One shared confirmation dialog replaces the browser's native confirmation
|
|
2
|
+
// window, so a destructive action stays inside the page.
|
|
3
|
+
export function initConfirmDialog(app) {
|
|
4
|
+
const dialog = app.$("#confirmDialog"), message = app.$("#confirmMessage");
|
|
5
|
+
const accept = app.$("#btnAcceptConfirm"), cancel = app.$("#btnCancelConfirm");
|
|
6
|
+
let pending = null;
|
|
7
|
+
const settle = (value) => { const resolve = pending; pending = null; resolve?.(value); };
|
|
8
|
+
function close(value) { settle(value); dialog.close(); }
|
|
9
|
+
|
|
10
|
+
app.confirmAction = (text) => {
|
|
11
|
+
// One dialog at a time: a newer request dismisses the open one as cancelled.
|
|
12
|
+
if (dialog.open) close(false);
|
|
13
|
+
message.textContent = text;
|
|
14
|
+
dialog.showModal();
|
|
15
|
+
cancel.focus();
|
|
16
|
+
return new Promise((resolve) => { pending = resolve; });
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
accept.addEventListener("click", () => close(true));
|
|
20
|
+
cancel.addEventListener("click", () => close(false));
|
|
21
|
+
dialog.addEventListener("cancel", (event) => { event.preventDefault(); close(false); });
|
|
22
|
+
dialog.addEventListener("click", (event) => { if (event.target === dialog) close(false); });
|
|
23
|
+
dialog.addEventListener("close", () => {
|
|
24
|
+
// A close from outside the buttons still settles the promise; a re-open in the
|
|
25
|
+
// same task leaves the dialog open, so the stale event must not clear it.
|
|
26
|
+
if (!dialog.open) { settle(false); message.textContent = ""; }
|
|
27
|
+
});
|
|
28
|
+
}
|