@alexsun-top/opencode-chat-room 0.2.3 → 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 +21 -0
- package/README.md +44 -7
- package/README.zh-CN.md +44 -7
- package/package.json +6 -2
- package/plugin.ts +21 -6
- package/server/assets/DOMPURIFY-LICENSE +202 -0
- package/server/assets/MARKED-LICENSE +44 -0
- package/server/assets/NOTICE.txt +6 -0
- package/server/assets/base.css +225 -0
- package/server/assets/chat/events.js +148 -0
- package/server/assets/chat/index.js +12 -0
- package/server/assets/chat/markdown.js +65 -0
- package/server/assets/chat/members.js +201 -0
- package/server/assets/chat/mentions.js +131 -0
- package/server/assets/chat/messages.js +489 -0
- package/server/assets/chat/rooms.js +443 -0
- package/server/assets/chat/state.js +327 -0
- package/server/assets/conversation.css +364 -0
- package/server/assets/dompurify-3.4.7.js +3 -0
- package/server/assets/marked-18.0.4.js +79 -0
- package/server/assets/responsive.css +119 -0
- package/server/chat-server.ts +39 -43
- package/server/chat.html +27 -1984
- package/server/history-route.ts +2 -1
- package/server/inbox.ts +1 -1
- package/server/member-routes.ts +117 -0
- package/server/newrooms.ts +86 -0
- package/server/wake.ts +13 -14
- package/src/agent-presence.ts +60 -0
- package/src/agent-receipts.ts +107 -0
- package/src/background.ts +70 -25
- package/src/center-client.ts +25 -6
- package/src/center-inbox.ts +77 -37
- package/src/center-wake.ts +43 -9
- package/src/member-state.ts +25 -0
- package/src/mentions.ts +7 -0
- package/src/plugin-notifications.ts +75 -23
- package/src/queue-transport.ts +17 -1
- package/src/queue.ts +36 -2
- package/src/receiver-state.ts +108 -6
- package/src/room-service.ts +19 -1
- package/src/sqlite-state.ts +123 -16
- 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,26 @@
|
|
|
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
|
+
|
|
12
|
+
## 0.3.0 — 2026-10-30
|
|
13
|
+
|
|
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.
|
|
15
|
+
- Direct conversations target the selected registered session and are implicitly addressed. Group `@all` and `@所有人` broadcasts address other members. The shared token grants all holders room-management and message-reading access; direct conversations are not private from token holders or the server.
|
|
16
|
+
- Central messages retain sender session IDs to distinguish same-name members. Reopening a direct conversation avoids replaying old messages and preserves the other participant's read cursor; room-switch races and mixed V1/V2 session updates preserve per-room state.
|
|
17
|
+
- V2 makes one best-effort session-wide backgrounding attempt before steering each eligible notification. Failure is logged and does not block steering; message-delivery retries remain separate. The session-wide API cannot guarantee detachment of a particular task, and backgrounding does not cancel work.
|
|
18
|
+
- Installations carrying ambiguous background-retry rows from an intermediate development build conservatively disable backgrounding for the affected service/room; normal steering continues.
|
|
19
|
+
|
|
20
|
+
### Verification
|
|
21
|
+
|
|
22
|
+
Initial host checks covered OpenCode 2.2.0 and 2.2.1. The final single-attempt implementation was verified on 2.2.1 with the actual plugin, native foreground Shell work, and a general subagent using `@all`. Subsequent watermark changes passed regression checks without an API change. These checks did not establish a specific cause for the reported user failure.
|
|
23
|
+
|
|
3
24
|
## 0.2.3
|
|
4
25
|
|
|
5
26
|
- V2 room notifications steer the running session by default. Direct requests ask the agent to acknowledge once in the originating room before working, then provide useful progress and a final reply there; routine updates and broadcasts do not trigger acknowledgements. Mention-triggered backgrounding remains best-effort and no longer changes delivery mode.
|
package/README.md
CHANGED
|
@@ -6,8 +6,10 @@ A chat-room plugin for [opencode](https://opencode.ai) that lets multiple sessio
|
|
|
6
6
|
|
|
7
7
|
- 7 room actions: `create`, `join`, `leave`, `list`, `send`, `poll`, `members` (plus a `/room` command)
|
|
8
8
|
- **Human web chat UI** served at `GET /chat` (central mode): humans join rooms in the browser and chat with agents on equal footing
|
|
9
|
+
- Web chat supports switching among joined group rooms and direct conversations without leaving them; drafts and read positions are stored per tab
|
|
10
|
+
- Group broadcasts support `@all` and `@所有人`; direct messages are addressed to the other participant without an @mention
|
|
9
11
|
- Notifications wrapped in `<notification>…</notification>`; V2 steers the persistent session, while V1 uses asynchronous prompts
|
|
10
|
-
- Incremental read watermark: `poll` returns unread messages; failed
|
|
12
|
+
- Incremental read watermark: `poll` returns unread messages; failed message-delivery attempts remain available for retry. V1 asynchronous acceptance does not guarantee durable delivery.
|
|
11
13
|
- Two deployment modes: **standalone** (local SQLite, zero config) and **central** (one HTTP server, one env var per client)
|
|
12
14
|
- Normalized SQLite storage with transactional legacy JSON migration and append-only message history
|
|
13
15
|
|
|
@@ -55,9 +57,11 @@ Typical usage in a session:
|
|
|
55
57
|
- Read new messages: `room poll <roomId>` — only unread ones, or just wait for the push
|
|
56
58
|
- `room list` / `room members <roomId>` / `room leave <roomId>`
|
|
57
59
|
|
|
60
|
+
In group rooms, `@all` or `@所有人` addresses the other room members. A direct conversation notifies its other participant without requiring an @mention.
|
|
61
|
+
|
|
58
62
|
Push notifications use the host's supported transport. V1 notifications are ordinary asynchronous prompts; V2 notifications steer the persistent session. In both cases the unread watermark advances only after the host accepts the notification. V2 steering takes effect at a safe boundary; it is not an instant interrupt and does not guarantee that a currently blocking task can be detached.
|
|
59
63
|
|
|
60
|
-
On V2, every notification steers the session when observed.
|
|
64
|
+
On V2, every notification steers the session when observed. For an eligible mention (`@alice`, `@all`, or `@所有人`) or direct message, the plugin makes one best-effort backgrounding attempt before steering. OpenCode exposes session-wide backgrounding, not an atomic operation bound to a particular shell or subagent task, so the plugin cannot guarantee which active work is detached. It calls only the current OS user's registered OpenCode service after verifying its PID and version. Failure is logged and does not block steering; message-delivery retries are separate. Backgrounding does not cancel work, and success does not guarantee task completion. A session must still be a room member to receive notifications; only explicitly addressed sessions can be restored by the watcher when OpenCode is not running. No service is started and no ports are probed. Polling is every five seconds, so this is not instant push.
|
|
61
65
|
|
|
62
66
|
For a direct request, the notification asks the agent to acknowledge it once in the originating room before working, then send useful progress updates and its final response there. Routine confirmations, status or membership updates, system messages, and ordinary broadcasts do not call for an acknowledgement. The prompt includes the room ID so the agent can address the right room.
|
|
63
67
|
|
|
@@ -65,6 +69,8 @@ For a direct request, the notification asks the agent to acknowledge it once in
|
|
|
65
69
|
|
|
66
70
|
Run `opencode-chat-room watch start` to keep V2 delivery polling after the project that loaded the plugin closes. The watcher uses the current user's registered OpenCode service and joined-room owner bindings; it does not start OpenCode. In central mode it inherits `CHAT_ROOM_SERVER_URL` and `CHAT_ROOM_SERVER_TOKEN` from the command environment. If the service is offline, it stays running and retries. `watch status` checks its authenticated loopback control endpoint, `watch stop` shuts it down gracefully, and `watch run` runs it in the foreground. Start it manually or under an OS supervisor if desired; the package does not install startup services. The watcher also does not auto-start when you send or receive a message. Its private control state and cross-process delivery leases live under the user's XDG state directory. If status reports an unreadable legacy control file, remove only that user's `watch-*.json` after confirming the watcher is not running; the default directory is `~/.local/state/opencode/chat-room`.
|
|
67
71
|
|
|
72
|
+
OpenCode 2.2.1 unloads idle project-location services after a default 60-minute idle timeout. The watcher keeps delivery polling possible, not sessions awake; it can restore only joined sessions addressed by `@name`, `@all`, `@所有人`, or a direct message. Start it explicitly. If the OpenCode service is offline, it retries and resumes when the service returns. It sends no synthetic messages or model requests to keep sessions alive.
|
|
73
|
+
|
|
68
74
|
## Central mode (multi-host)
|
|
69
75
|
|
|
70
76
|
For several machines: run one central server, point every client at it. This is the only per-client configuration.
|
|
@@ -73,17 +79,17 @@ On the server machine, install Bun first. `npx`, `pnpx`, and `bunx` only execute
|
|
|
73
79
|
|
|
74
80
|
```bash
|
|
75
81
|
# Show CLI options:
|
|
76
|
-
npx --yes --package=@alexsun-top/opencode-chat-room@0.
|
|
82
|
+
npx --yes --package=@alexsun-top/opencode-chat-room@0.3.1 -- opencode-chat-room --help
|
|
77
83
|
|
|
78
84
|
# Start the local central server (choose any one runner):
|
|
79
|
-
npx --yes --package=@alexsun-top/opencode-chat-room@0.
|
|
80
|
-
pnpx --package=@alexsun-top/opencode-chat-room@0.
|
|
81
|
-
bunx @alexsun-top/opencode-chat-room@0.
|
|
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
|
|
82
88
|
|
|
83
89
|
# Environment variables also work; CLI options take precedence:
|
|
84
90
|
CHAT_ROOM_SERVER_HOST=127.0.0.1 CHAT_ROOM_SERVER_PORT=4399 \
|
|
85
91
|
CHAT_ROOM_SERVER_TOKEN=secret \
|
|
86
|
-
bunx @alexsun-top/opencode-chat-room@0.
|
|
92
|
+
bunx @alexsun-top/opencode-chat-room@0.3.1
|
|
87
93
|
|
|
88
94
|
# Local checkout:
|
|
89
95
|
bun install
|
|
@@ -92,6 +98,34 @@ bun run server
|
|
|
92
98
|
|
|
93
99
|
Open `http://<server-ip>:4399/chat` in a browser to join or create a room and chat with agents. If a token is configured, enter it in the page settings.
|
|
94
100
|
|
|
101
|
+
### Browser chat
|
|
102
|
+
|
|
103
|
+
Rooms you joined remain joined as you switch the sidebar selection; switching views does not leave a room. Direct conversations are created with the selected registered member session. Each tab stores its joined-room list, drafts, and read positions separately, and tracks unread counts within that tab. This is tab-scoped convenience state, not account identity: if browser tab storage is blocked, the generated session identity lasts only for that page lifetime.
|
|
104
|
+
|
|
105
|
+
The chat renders GitHub Flavored Markdown using locally bundled Marked and DOMPurify assets. Message text is sanitized before rendered HTML is inserted. No CDN is required.
|
|
106
|
+
|
|
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
|
+
|
|
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
|
+
|
|
95
129
|
On every client machine:
|
|
96
130
|
|
|
97
131
|
```bash
|
|
@@ -120,6 +154,7 @@ Then start opencode normally. Room state lives on the central server. Clients on
|
|
|
120
154
|
- **Standalone**: V1 sends asynchronous prompts to registered session servers; V2 polls shared local state and steers notifications through its persistent session API. The watermark advances only on host acceptance.
|
|
121
155
|
- **Central**: sessions pull their inbox (`GET /inbox?sessionID=…`) and steer `<notification>` messages through the host API. Items are grouped per room; a room's queued watermark advances only after admission.
|
|
122
156
|
- Standalone V1 HTTP attempts are appended to `notify.log` (`OK <status> <url>` / `FAIL <reason>`). V2 notification admissions are not currently written there.
|
|
157
|
+
- Backgrounding is attempted once per eligible notification. Failures are reported to process diagnostics but do not block steering; message-delivery retries are separate. The session-wide API cannot guarantee task-specific detachment, and backgrounding does not cancel existing work.
|
|
123
158
|
- Notifications include instructions for the agent: do not reply, do not call tools, unless explicitly addressed.
|
|
124
159
|
|
|
125
160
|
## Tool reference
|
|
@@ -142,4 +177,6 @@ Note: `join` with `name:"alice"` registers the identity `alice` for that session
|
|
|
142
177
|
- Sessions on the same machine share the host identity (`user@host`); pass distinct `name` values on join to tell members apart.
|
|
143
178
|
- The central server is unauthenticated unless `CHAT_ROOM_SERVER_TOKEN` is set — anyone who can reach the port can read/write rooms. It also enforces limits: room/member names ≤ 64 chars, message text ≤ 2000 chars (rejected with 400).
|
|
144
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.
|
|
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.
|
|
145
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
|
@@ -6,8 +6,10 @@
|
|
|
6
6
|
|
|
7
7
|
- 7 种房间操作:`create`、`join`、`leave`、`list`、`send`、`poll`、`members`(另提供 `/room` 命令)
|
|
8
8
|
- **真人 Web 聊天界面**:中心模式 `GET /chat`——真人可在浏览器中加入房间,与 agent 平等聊天
|
|
9
|
+
- Web 聊天可在已加入的群组和私聊之间切换,不必离开房间;草稿和阅读位置按标签页保存
|
|
10
|
+
- 群组广播支持 `@all` 和 `@所有人`;私聊会直接通知另一位成员,无需 @ 提及
|
|
9
11
|
- 通知以 `<notification>…</notification>` 包裹;V2 steer 持久会话,V1 使用异步 prompt
|
|
10
|
-
- 增量阅读水位:`poll`
|
|
12
|
+
- 增量阅读水位:`poll` 返回未读消息;消息投递失败后仍可重试。V1 的异步接受不保证通知已持久化送达。
|
|
11
13
|
- 两种部署模式:**单机模式**(本地 SQLite,零配置)与**中心模式**(一个 HTTP 服务 + 每个客户端一个环境变量)
|
|
12
14
|
- 规范化 SQLite 持久化、事务式迁移旧 JSON,并保留完整追加式消息历史
|
|
13
15
|
|
|
@@ -53,9 +55,11 @@ SQLite WAL 需要本地文件系统。不要把单机状态放在 NFS/SMB 等网
|
|
|
53
55
|
- 读新消息:`room poll <房间ID>`——只返回未读部分,或者干脆等推送
|
|
54
56
|
- 其他:`room list` / `room members <房间ID>` / `room leave <房间ID>`
|
|
55
57
|
|
|
58
|
+
群组中可用 `@all` 或 `@所有人` 寻址其他成员。私聊会直接通知另一位成员,无需 @ 提及。
|
|
59
|
+
|
|
56
60
|
推送通知使用宿主支持的传输方式。V1 通知是普通异步 prompt;V2 通知通过持久会话 API steer。两者都只有在宿主接受通知后才推进未读水位。V2 steer 会在安全边界生效,并非即时打断,也不保证正在阻塞的任务一定能够移至后台。
|
|
57
61
|
|
|
58
|
-
V2 在观察到通知时都会 steer
|
|
62
|
+
V2 在观察到通知时都会 steer 会话。对于符合条件的提及(例如 `@alice`、`@all` 或 `@所有人`)及私聊,插件会在 steer 前尝试一次尽力而为的后台操作。OpenCode 提供的是会话级后台接口,并非与某个 shell 或子 agent 任务原子绑定的操作,因此无法保证具体移走哪项活动任务。插件只会调用当前操作系统用户注册、且已验证 PID 和版本的 OpenCode 服务。失败会记入诊断信息,但不会阻止 steer;消息投递重试与后台操作无关。后台操作不会取消任务,成功也不保证任务完成。会话仍需加入房间才能收到通知;OpenCode 未运行时,watcher 只会恢复明确收到寻址的会话。插件不会启动服务或扫描端口。消息每五秒轮询一次,并非即时推送。
|
|
59
63
|
|
|
60
64
|
对于直接请求,通知会要求 agent 先在原房间发送一次简短确认,再开始处理,之后可发送有用的进度更新和最终回复。例行确认、状态或成员变更、系统消息及普通广播不需要确认。提示中包含房间 ID,确保回复发往正确房间。
|
|
61
65
|
|
|
@@ -63,6 +67,8 @@ V2 在观察到通知时都会 steer 会话。收到明确提及房间注册名
|
|
|
63
67
|
|
|
64
68
|
运行 `opencode-chat-room watch start`,即可在关闭加载插件的项目后继续轮询 V2 消息。Watcher 使用当前用户已注册的 OpenCode 服务及已加入房间的所有者绑定,不会启动 OpenCode。中心模式下会继承执行该命令时的 `CHAT_ROOM_SERVER_URL` 和 `CHAT_ROOM_SERVER_TOKEN`。服务离线时,watcher 会继续运行并重试。`watch status` 检查经过认证的本机回环控制接口,`watch stop` 会优雅停止,`watch run` 则在前台运行。可手动启动,也可交由操作系统的进程管理器监督;包不会安装开机启动服务,也不会在消息收发时自动启动 watcher。私有控制状态和跨进程投递租约保存在用户的 XDG 状态目录中。若状态显示控制文件无法读取,请确认 watcher 已停止后,仅删除该用户的 `watch-*.json`;默认目录为 `~/.local/state/opencode/chat-room`。
|
|
65
69
|
|
|
70
|
+
OpenCode 2.2.1 会在默认 60 分钟无活动后卸载闲置项目的服务。Watcher 维持消息投递轮询,但不会阻止项目服务卸载;它只会恢复被 `@昵称`、`@all`、`@所有人` 或私聊寻址的已加入会话。Watcher 需要显式启动。OpenCode 服务离线时会持续重试,并在服务恢复后继续;它不会发送虚构消息或调用模型来保持会话活跃。
|
|
71
|
+
|
|
66
72
|
## 中心模式(多主机)
|
|
67
73
|
|
|
68
74
|
多台机器时:跑一个中心服务器,所有客户端指向它。**每个客户端只需要这一个环境变量**。
|
|
@@ -71,17 +77,17 @@ V2 在观察到通知时都会 steer 会话。收到明确提及房间注册名
|
|
|
71
77
|
|
|
72
78
|
```bash
|
|
73
79
|
# 查看 CLI 选项:
|
|
74
|
-
npx --yes --package=@alexsun-top/opencode-chat-room@0.
|
|
80
|
+
npx --yes --package=@alexsun-top/opencode-chat-room@0.3.1 -- opencode-chat-room --help
|
|
75
81
|
|
|
76
82
|
# 启动本地中心服务器(三选一):
|
|
77
|
-
npx --yes --package=@alexsun-top/opencode-chat-room@0.
|
|
78
|
-
pnpx --package=@alexsun-top/opencode-chat-room@0.
|
|
79
|
-
bunx @alexsun-top/opencode-chat-room@0.
|
|
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
|
|
80
86
|
|
|
81
87
|
# 也可以使用环境变量;CLI 参数优先:
|
|
82
88
|
CHAT_ROOM_SERVER_HOST=127.0.0.1 CHAT_ROOM_SERVER_PORT=4399 \
|
|
83
89
|
CHAT_ROOM_SERVER_TOKEN=secret \
|
|
84
|
-
bunx @alexsun-top/opencode-chat-room@0.
|
|
90
|
+
bunx @alexsun-top/opencode-chat-room@0.3.1
|
|
85
91
|
|
|
86
92
|
# 本地 checkout:
|
|
87
93
|
bun install
|
|
@@ -90,6 +96,34 @@ bun run server
|
|
|
90
96
|
|
|
91
97
|
在浏览器打开 `http://<服务器IP>:4399/chat`,即可加入或创建房间并与 agent 聊天。若设置了 token,请在页面设置中填入。
|
|
92
98
|
|
|
99
|
+
### 浏览器聊天
|
|
100
|
+
|
|
101
|
+
侧栏切换房间只切换当前视图,不会离开已加入的房间。私聊由你在成员列表中选中的已注册会话创建。每个标签页分别保存已加入房间、草稿和阅读位置,并在各自标签页中跟踪未读计数;这些只是标签页级的便捷状态,并非账户身份。若浏览器阻止标签页存储,生成的会话身份只在当前页面生命周期内有效。
|
|
102
|
+
|
|
103
|
+
聊天内容使用本地打包的 Marked 解析 GitHub Flavored Markdown,并由 DOMPurify 清理后再插入页面,不依赖 CDN。
|
|
104
|
+
|
|
105
|
+
中心服务器使用团队共享令牌,不提供逐用户授权或私密私聊:任何持有令牌的人都能读取消息、管理房间、移除成员和删除房间;服务器及其 SQLite 数据库也能读取私聊内容。移除成员前会要求确认;删除房间也会要求确认,并永久删除房间消息和历史记录,无法恢复。
|
|
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
|
+
|
|
93
127
|
每台客户端机器上:
|
|
94
128
|
|
|
95
129
|
```bash
|
|
@@ -118,6 +152,7 @@ export CHAT_ROOM_SERVER_TOKEN=secret # 仅当服务器设置了 token 时
|
|
|
118
152
|
- **单机模式**:V1 向已注册会话的服务发送异步 prompt;V2 轮询共享本地状态,并通过持久会话 API steer 通知。只有宿主接受通知后才推进水位。
|
|
119
153
|
- **中心模式**:会话拉取 inbox(`GET /inbox?sessionID=…`),并通过宿主 API steer `<notification>`。消息按房间分组;V1 异步接受或 V2 成功接收后,才推进该房间的投递水位。
|
|
120
154
|
- 单机 V1 HTTP 推送尝试会追加到 `notify.log`(`OK <状态码> <URL>` / `FAIL <原因>`);V2 推送目前不会写入该日志。
|
|
155
|
+
- 每条符合条件的通知只尝试一次后台操作。失败会写入进程诊断信息,但不会阻止 steer;消息投递重试与后台操作无关。会话级接口无法保证移走特定任务,后台操作也不会取消现有工作。
|
|
121
156
|
|
|
122
157
|
## 工具参考
|
|
123
158
|
|
|
@@ -139,4 +174,6 @@ export CHAT_ROOM_SERVER_TOKEN=secret # 仅当服务器设置了 token 时
|
|
|
139
174
|
- 同一台机器的会话共享 `user@host` 身份;用不同的 `name` 加入以区分成员。
|
|
140
175
|
- 中心服务器不设 `CHAT_ROOM_SERVER_TOKEN` 时无认证——任何能访问端口的人都能读写房间。服务端另有输入限制:房间/成员名 ≤ 64 字符、消息文本 ≤ 2000 字符(超限返回 400)。
|
|
141
176
|
- SQLite 持续保留历史消息,不自动删除。500 条只是内存工作窗口,不是磁盘保留上限;未读消息和历史记录均分页读取。请定期备份数据库。
|
|
177
|
+
- 仅包含某个过渡开发版重试记录的安装会受影响:若旧后台重试记录无法恢复消息时间戳,迁移会采取保守处理,永久停用该服务/房间的后台操作;正常通知 steer 仍会继续。
|
|
142
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
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "A chat-room plugin and central server for OpenCode.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,8 +27,11 @@
|
|
|
27
27
|
"server/chat-server.ts",
|
|
28
28
|
"server/inbox.ts",
|
|
29
29
|
"server/history-route.ts",
|
|
30
|
+
"server/newrooms.ts",
|
|
31
|
+
"server/member-routes.ts",
|
|
30
32
|
"server/wake.ts",
|
|
31
33
|
"server/chat.html",
|
|
34
|
+
"server/assets",
|
|
32
35
|
"CHANGELOG.md",
|
|
33
36
|
"README.md",
|
|
34
37
|
"README.zh-CN.md"
|
|
@@ -44,7 +47,8 @@
|
|
|
44
47
|
},
|
|
45
48
|
"devDependencies": {
|
|
46
49
|
"@opencode/plugin": "2.0.29",
|
|
47
|
-
"@types/bun": "latest"
|
|
50
|
+
"@types/bun": "latest",
|
|
51
|
+
"playwright": "1.64.1"
|
|
48
52
|
},
|
|
49
53
|
"peerDependencies": {
|
|
50
54
|
"typescript": "^5"
|
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";
|
|
@@ -26,7 +28,7 @@ import {
|
|
|
26
28
|
clearPendingAdmission,
|
|
27
29
|
} from "./src/queue";
|
|
28
30
|
import { createNotifier } from "./src/plugin-notifications";
|
|
29
|
-
import {
|
|
31
|
+
import { explicitlyAddresses } from "./src/mentions";
|
|
30
32
|
import { createV2Setup, type V2Runtime } from "./src/v2-plugin";
|
|
31
33
|
import { createV1Server } from "./src/v1-plugin";
|
|
32
34
|
|
|
@@ -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()]);
|
|
@@ -201,14 +212,14 @@ export async function pollKnownSessions(
|
|
|
201
212
|
if (mentionOnly && (scan.untilTs === undefined || scan.untilTs <= cursor)) {
|
|
202
213
|
scan.untilTs = undefined;
|
|
203
214
|
const tail = await readUnreadMessages(room.id, cursor, 20, sessionID, entry.name, true);
|
|
204
|
-
if (tail.items.some((message) =>
|
|
215
|
+
if (tail.items.some((message) => explicitlyAddresses(message, entry.name, sessionID, room.kind))) {
|
|
205
216
|
scan.untilTs = tail.items.at(-1)!.createdAt;
|
|
206
217
|
scan.afterTs = Math.max(scan.afterTs, scan.untilTs);
|
|
207
218
|
} else {
|
|
208
219
|
const candidates = await readUnreadMessages(room.id, scan.afterTs, 20, sessionID, entry.name);
|
|
209
220
|
if (!candidates.items.length) { restoreScans.set(key, scan); continue; }
|
|
210
221
|
scan.afterTs = candidates.items.at(-1)!.createdAt;
|
|
211
|
-
if (candidates.items.some((message) =>
|
|
222
|
+
if (candidates.items.some((message) => explicitlyAddresses(message, entry.name, sessionID, room.kind))) scan.untilTs = scan.afterTs;
|
|
212
223
|
restoreScans.set(key, scan);
|
|
213
224
|
if (scan.untilTs === undefined) continue;
|
|
214
225
|
}
|
|
@@ -219,8 +230,9 @@ export async function pollKnownSessions(
|
|
|
219
230
|
const target = mentionOnly ? { ...transport, mentionOnlySessions: new Set([...transport.mentionOnlySessions!].filter((id) => id !== sessionID)) } : transport;
|
|
220
231
|
await notifyTarget(sessionID, {
|
|
221
232
|
roomId: room.id,
|
|
222
|
-
|
|
223
|
-
|
|
233
|
+
roomName: room.name,
|
|
234
|
+
roomKind: room.kind ?? "group",
|
|
235
|
+
messages: page.items,
|
|
224
236
|
}, target);
|
|
225
237
|
if (mentionOnly && scan.untilTs !== undefined) {
|
|
226
238
|
const queued = (await loadRegistry())[room.id]?.[sessionID]?.lastQueuedTs ?? cursor;
|
|
@@ -228,6 +240,7 @@ export async function pollKnownSessions(
|
|
|
228
240
|
}
|
|
229
241
|
}
|
|
230
242
|
}
|
|
243
|
+
await flushReceiptCandidates({ destination: receiptDestination(""), receiverOwnerID: transport.receiverOwnerID }).catch(() => {});
|
|
231
244
|
}
|
|
232
245
|
|
|
233
246
|
const READ_ONLY_ACTIONS = new Set(["list", "members", "poll"]);
|
|
@@ -268,12 +281,14 @@ const roomExecute = async (
|
|
|
268
281
|
let leaveNameShared = false;
|
|
269
282
|
let pollLastRead = 0;
|
|
270
283
|
let pollEntry = false;
|
|
284
|
+
let pollIdentity: { membershipID: string; receiverOwnerID?: string } | undefined;
|
|
271
285
|
let pollPage: Awaited<ReturnType<typeof readUnreadMessages>> | undefined;
|
|
272
286
|
let pollMaxTs: number | undefined;
|
|
273
287
|
const notifications: Array<{ roomId: string; roomName: string; messages: Message[] }> = [];
|
|
274
288
|
if (args.action === "poll" && args.roomId) {
|
|
275
289
|
const entry = (await loadRegistry())[args.roomId]?.[context.sessionID];
|
|
276
290
|
pollEntry = entry !== undefined;
|
|
291
|
+
if (entry?.membershipID) pollIdentity = { membershipID: entry.membershipID, ...(entry.receiverOwnerID ? { receiverOwnerID: entry.receiverOwnerID } : {}) };
|
|
277
292
|
selfName = entry?.name ?? selfName;
|
|
278
293
|
pollLastRead = entry?.lastReadTs ?? 0;
|
|
279
294
|
if (entry) pollPage = await readUnreadMessages(args.roomId, pollLastRead, 100);
|
|
@@ -418,7 +433,7 @@ const roomExecute = async (
|
|
|
418
433
|
context.sessionID, notification.messages).catch(() => {});
|
|
419
434
|
}
|
|
420
435
|
if (args.action === "poll" && pollMaxTs !== undefined && pollMaxTs > 0) {
|
|
421
|
-
await
|
|
436
|
+
await acknowledgeStandalonePoll(args.roomId!, context.sessionID, pollMaxTs, pollPage?.items ?? [], pollIdentity);
|
|
422
437
|
}
|
|
423
438
|
return result;
|
|
424
439
|
} catch (err) {
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|