@alexsun-top/opencode-chat-room 0.8.4 → 0.8.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. package/CHANGELOG.md +17 -3
  2. package/README.md +5 -5
  3. package/README.zh-CN.md +5 -5
  4. package/cli.ts +20 -1
  5. package/dist/cli.js +3785 -1462
  6. package/package.json +19 -11
  7. package/packages/chat-room-channeld/README.md +16 -10
  8. package/packages/chat-room-channeld/src/delivery.ts +0 -4
  9. package/packages/chat-room-channeld/src/host.ts +48 -37
  10. package/packages/chat-room-channeld/src/inbound.ts +3 -6
  11. package/packages/chat-room-channeld/src/pg/database.ts +141 -49
  12. package/packages/chat-room-channeld/src/pg/sql.mjs +157 -142
  13. package/packages/chat-room-channeld/src/pg/sql.mts +175 -0
  14. package/packages/chat-room-channeld/src/pg/worker.mjs +148 -99
  15. package/packages/chat-room-channeld/src/pg/worker.mts +201 -0
  16. package/packages/chat-room-channeld/src/state-rows.ts +132 -0
  17. package/packages/chat-room-channeld/src/state.ts +129 -157
  18. package/plugin.ts +21 -5
  19. package/server/app.ts +9 -0
  20. package/server/assets/base.css +22 -2
  21. package/server/assets/chat/admin.js +17 -1
  22. package/server/assets/chat/announcements.js +79 -34
  23. package/server/assets/chat/attachments.js +3 -3
  24. package/server/assets/chat/clipboard.js +1 -1
  25. package/server/assets/chat/confirm-dialog.js +3 -0
  26. package/server/assets/chat/copy-action.js +1 -1
  27. package/server/assets/chat/create-room-dialog.js +7 -0
  28. package/server/assets/chat/diagram-viewer.js +4 -8
  29. package/server/assets/chat/doc-preview.js +71 -31
  30. package/server/assets/chat/editor.js +49 -10
  31. package/server/assets/chat/events.js +13 -6
  32. package/server/assets/chat/files.js +33 -27
  33. package/server/assets/chat/history-loader.js +31 -15
  34. package/server/assets/chat/integration-editor.js +27 -1
  35. package/server/assets/chat/integrations.js +108 -16
  36. package/server/assets/chat/join-requests.js +40 -2
  37. package/server/assets/chat/locales/de.js +5 -3
  38. package/server/assets/chat/locales/es.js +5 -3
  39. package/server/assets/chat/locales/fr.js +5 -3
  40. package/server/assets/chat/locales/it.js +5 -3
  41. package/server/assets/chat/locales/ja.js +5 -3
  42. package/server/assets/chat/locales/ko.js +5 -3
  43. package/server/assets/chat/markdown-footnotes.js +27 -15
  44. package/server/assets/chat/markdown.js +6 -12
  45. package/server/assets/chat/members.js +34 -22
  46. package/server/assets/chat/mentions.js +8 -5
  47. package/server/assets/chat/message-cache.js +9 -3
  48. package/server/assets/chat/message-polling.js +10 -4
  49. package/server/assets/chat/message-window.js +58 -1
  50. package/server/assets/chat/messages.js +90 -37
  51. package/server/assets/chat/office-preview.js +3 -3
  52. package/server/assets/chat/operator.js +624 -0
  53. package/server/assets/chat/palette.js +7 -10
  54. package/server/assets/chat/panels.js +42 -0
  55. package/server/assets/chat/questions.js +75 -58
  56. package/server/assets/chat/recall.js +14 -5
  57. package/server/assets/chat/receipts.js +63 -7
  58. package/server/assets/chat/refresh-timing.js +6 -0
  59. package/server/assets/chat/reminders.js +47 -13
  60. package/server/assets/chat/replies.js +39 -25
  61. package/server/assets/chat/resource-format.js +6 -3
  62. package/server/assets/chat/room-list.js +202 -3
  63. package/server/assets/chat/room-watcher.js +3 -1
  64. package/server/assets/chat/rooms.js +29 -7
  65. package/server/assets/chat/settings.js +37 -6
  66. package/server/assets/chat/shortcuts.js +3 -1
  67. package/server/assets/chat/side-pane.js +1 -1
  68. package/server/assets/chat/state.js +51 -18
  69. package/server/assets/chat/system-events.js +3 -2
  70. package/server/assets/chat/system-messages.js +15 -15
  71. package/server/assets/chat/tasks.js +37 -14
  72. package/server/assets/chat/window-controls.js +25 -15
  73. package/server/assets/code-highlight.css +0 -13
  74. package/server/assets/conversation.css +45 -5
  75. package/server/assets/doc-preview.css +9 -0
  76. package/server/assets/files.css +4 -0
  77. package/server/assets/monaco/integration-rules.js +1 -1
  78. package/server/assets/office/THIRD-PARTY-NOTICES.txt +23 -1
  79. package/server/assets/office/licenses/docx-preview-HEADER.txt +6 -0
  80. package/server/assets/office/licenses/echarts-LICENSE-d3.txt +27 -0
  81. package/server/assets/office/licenses/echarts-NOTICE.txt +5 -0
  82. package/server/assets/office/licenses/immediate-LICENSE.txt +20 -0
  83. package/server/assets/office/licenses/lie-LICENSE.txt +7 -0
  84. package/server/assets/office/licenses/pako-LICENSE.txt +21 -0
  85. package/server/assets/office/licenses/pako-ZLIB.txt +18 -0
  86. package/server/assets/office/licenses/setimmediate-LICENSE.txt +20 -0
  87. package/server/assets/responsive.css +12 -2
  88. package/server/assets/settings.css +3 -1
  89. package/server/assets/tasks.css +6 -1
  90. package/server/assets/window-controls.css +3 -1
  91. package/server/channels.ts +3 -2
  92. package/server/chat.html +7 -2
  93. package/server/inbox.ts +3 -1
  94. package/server/join-requests.ts +8 -1
  95. package/server/member-routes.ts +16 -2
  96. package/server/newrooms.ts +2 -13
  97. package/server/operator-auth.ts +21 -0
  98. package/server/operator-routes.ts +150 -0
  99. package/server/operator-state.ts +64 -0
  100. package/server/operator.css +139 -0
  101. package/server/room-owner.ts +17 -0
  102. package/server/routes/inbox.ts +15 -5
  103. package/server/routes/pages.ts +12 -2
  104. package/server/routes/room-actions.ts +4 -3
  105. package/server/sw.js +3 -1
  106. package/server/system.html +109 -0
  107. package/server/wake.ts +1 -1
  108. package/skills/chatroom/SKILL.md +9 -0
  109. package/src/README.md +1 -1
  110. package/src/acp/client.ts +254 -0
  111. package/src/acp/protocol.ts +300 -0
  112. package/src/acp/watch.ts +498 -0
  113. package/src/agent/agent-receipts.ts +98 -8
  114. package/src/center/center-client.ts +6 -1
  115. package/src/center/center-inbox.ts +54 -7
  116. package/src/center/center-wake.ts +57 -3
  117. package/src/center/forward-client.ts +48 -0
  118. package/src/center/mentions.ts +16 -3
  119. package/src/center/notification-delay.ts +139 -0
  120. package/src/center/queue.ts +3 -0
  121. package/src/config/file-config.ts +25 -0
  122. package/src/mcp/server.ts +389 -0
  123. package/src/protocol/config.ts +7 -0
  124. package/src/runtime/plugin-notifications.ts +43 -9
  125. package/src/runtime/v2-plugin.ts +14 -3
  126. package/src/runtime/v2-receiver.ts +10 -2
  127. package/src/runtime/watch.ts +5 -1
  128. package/src/state/pg-database.ts +133 -49
  129. package/src/state/pg-sql.mjs +157 -142
  130. package/src/state/pg-sql.mts +175 -0
  131. package/src/state/pg-worker.mjs +148 -99
  132. package/src/state/pg-worker.mts +201 -0
  133. package/src/state/receiver-state.ts +47 -0
  134. package/src/state/sqlite-database.ts +6 -2
  135. package/src/state/sqlite-members.ts +48 -4
  136. package/src/state/sqlite-messages.ts +25 -12
  137. package/src/state/sqlite-schema.ts +4 -1
  138. package/src/state/sqlite-state.ts +1 -1
  139. package/src/state/store.ts +31 -11
  140. package/src/tui/app-types.mjs +1 -0
  141. package/src/tui/app-types.mts +175 -0
  142. package/src/tui/app.mjs +473 -423
  143. package/src/tui/app.mts +543 -0
  144. package/src/tui/config.mjs +166 -158
  145. package/src/tui/config.mts +247 -0
  146. package/src/tui/http.mjs +239 -206
  147. package/src/tui/http.mts +412 -0
  148. package/src/tui/i18n.mjs +17 -20
  149. package/src/tui/i18n.mts +42 -0
  150. package/src/tui/info-app.mjs +431 -427
  151. package/src/tui/info-app.mts +500 -0
  152. package/src/tui/info-content.mjs +205 -199
  153. package/src/tui/info-content.mts +341 -0
  154. package/src/tui/join-app.mjs +75 -64
  155. package/src/tui/join-app.mts +99 -0
  156. package/src/tui/locales/en.mjs +302 -320
  157. package/src/tui/locales/en.mts +349 -0
  158. package/src/tui/locales/zh-CN.mjs +302 -320
  159. package/src/tui/locales/zh-CN.mts +349 -0
  160. package/src/tui/main.mjs +219 -213
  161. package/src/tui/main.mts +255 -0
  162. package/src/tui/markdown.mjs +128 -272
  163. package/src/tui/markdown.mts +152 -0
  164. package/src/tui/mentions.mjs +181 -184
  165. package/src/tui/mentions.mts +251 -0
  166. package/src/tui/message-app.mjs +181 -173
  167. package/src/tui/message-app.mts +213 -0
  168. package/src/tui/message-view.mjs +90 -111
  169. package/src/tui/message-view.mts +151 -0
  170. package/src/tui/messages.mjs +55 -49
  171. package/src/tui/messages.mts +106 -0
  172. package/src/tui/palette-app.mjs +364 -344
  173. package/src/tui/palette-app.mts +388 -0
  174. package/src/tui/palette.mjs +100 -98
  175. package/src/tui/palette.mts +176 -0
  176. package/src/tui/prefs.mjs +56 -63
  177. package/src/tui/prefs.mts +126 -0
  178. package/src/tui/reminder-app.mjs +191 -181
  179. package/src/tui/reminder-app.mts +228 -0
  180. package/src/tui/room-settings-app.mjs +275 -242
  181. package/src/tui/room-settings-app.mts +318 -0
  182. package/src/tui/session.mjs +30 -29
  183. package/src/tui/session.mts +51 -0
  184. package/src/tui/settings-app.mjs +151 -138
  185. package/src/tui/settings-app.mts +179 -0
  186. package/src/tui/ui-content.mjs +426 -421
  187. package/src/tui/ui-content.mts +499 -0
  188. package/src/tui/ui-help.mjs +58 -67
  189. package/src/tui/ui-help.mts +87 -0
  190. package/src/tui/ui-mentions.mjs +34 -36
  191. package/src/tui/ui-mentions.mts +60 -0
  192. package/src/tui/ui-overlay-view.mjs +259 -267
  193. package/src/tui/ui-overlay-view.mts +322 -0
  194. package/src/tui/ui-suggest-view.mjs +54 -57
  195. package/src/tui/ui-suggest-view.mts +78 -0
  196. package/src/tui/ui-suggest.mjs +164 -167
  197. package/src/tui/ui-suggest.mts +248 -0
  198. package/src/tui/ui-theme.mjs +52 -57
  199. package/src/tui/ui-theme.mts +98 -0
  200. package/src/tui/ui-view.mjs +267 -275
  201. package/src/tui/ui-view.mts +308 -0
  202. package/src/tui/ui.mjs +372 -359
  203. package/src/tui/ui.mts +440 -0
  204. package/src/tui/wire.mjs +215 -0
  205. package/src/tui/wire.mts +383 -0
  206. package/src/web/integration-rules-editor.ts +25 -2
@@ -0,0 +1,383 @@
1
+ // Server wire shapes shared by the TUI HTTP client and its views. Guarded
2
+ // constructors check the fields a client indexes by, so malformed payloads
3
+ // degrade to null or an empty list instead of reaching a typed caller.
4
+ import type { ChatMessage, Participant } from "./messages.mjs";
5
+
6
+ export interface Member {
7
+ sessionID?: string;
8
+ membershipID?: string;
9
+ name?: string;
10
+ type?: string;
11
+ protocol?: string;
12
+ host?: string;
13
+ activity?: { state?: string; observedAt?: number | null };
14
+ }
15
+
16
+ export interface Announcement {
17
+ name?: string;
18
+ content?: unknown;
19
+ updatedAt?: unknown;
20
+ }
21
+
22
+ export interface Question {
23
+ id?: unknown;
24
+ senderId?: string;
25
+ text?: unknown;
26
+ answeredByMessageID?: unknown;
27
+ }
28
+
29
+ export interface Resource {
30
+ id?: unknown;
31
+ name?: string;
32
+ size?: unknown;
33
+ uploaderName?: string;
34
+ uploaderSessionID?: string;
35
+ createdAt?: unknown;
36
+ }
37
+
38
+ export interface JoinRequest {
39
+ sessionID?: unknown;
40
+ name?: string;
41
+ participantId?: string;
42
+ isAgent?: unknown;
43
+ createdAt?: unknown;
44
+ }
45
+
46
+ export interface ReminderScheduleInput {
47
+ type?: string;
48
+ expression?: string;
49
+ timezone?: string;
50
+ at?: string;
51
+ }
52
+
53
+ export interface Reminder {
54
+ id?: unknown;
55
+ paused?: unknown;
56
+ text?: unknown;
57
+ schedule?: ReminderScheduleInput;
58
+ nextRunAt?: unknown;
59
+ }
60
+
61
+ export interface RoomWire {
62
+ id: string;
63
+ name?: string;
64
+ participants?: Participant[];
65
+ messages?: ChatMessage[];
66
+ hasMore?: boolean;
67
+ nextBeforeSeq?: number | null;
68
+ recallVersion?: number;
69
+ joined?: boolean;
70
+ ownerId?: string;
71
+ adminIds?: string[];
72
+ successorId?: string | null;
73
+ joinPolicy?: string;
74
+ kind?: string;
75
+ adminSessionID?: string | null;
76
+ }
77
+
78
+ export interface HistoryPage {
79
+ messages: ChatMessage[];
80
+ hasMore?: boolean;
81
+ nextBeforeSeq?: number | null;
82
+ recallVersion?: number;
83
+ }
84
+
85
+ export interface InboxItem extends ChatMessage {
86
+ roomName?: string;
87
+ roomKind?: "group" | "direct";
88
+ answerQuestionExcerpt?: string;
89
+ }
90
+
91
+ export interface InboxPage {
92
+ member: boolean;
93
+ items: InboxItem[];
94
+ hasMore?: boolean;
95
+ recallVersion?: number;
96
+ }
97
+
98
+ export interface MessageView {
99
+ id: string;
100
+ roomId?: string;
101
+ seq?: number;
102
+ senderId?: string;
103
+ senderName?: string;
104
+ text?: string | null;
105
+ createdAt?: number | string;
106
+ isQuestion?: boolean;
107
+ parentMessageId?: string | null;
108
+ answeredByMessageId?: string | null;
109
+ recalled?: boolean;
110
+ recalledAt?: number;
111
+ recalledBy?: string | null;
112
+ unavailable?: string;
113
+ resourceIDs?: string[];
114
+ }
115
+
116
+ export interface RevealedMessage {
117
+ messageID?: string;
118
+ text?: string | null;
119
+ senderId?: string;
120
+ createdAt?: number;
121
+ recalledAt?: number;
122
+ }
123
+
124
+ export interface RecallResult {
125
+ ok?: boolean;
126
+ messageID?: string;
127
+ text?: string | null;
128
+ senderId?: string;
129
+ createdAt?: number;
130
+ recalledAt?: number;
131
+ }
132
+
133
+ export interface CatchUpPage {
134
+ messages: MessageView[];
135
+ nextCursor?: number;
136
+ hasMore?: boolean;
137
+ unreadMentions?: Array<{ id: string; seq?: number }>;
138
+ unreadMentionCount?: number;
139
+ unansweredQuestions?: Array<{ id: string; seq?: number }>;
140
+ unansweredQuestionCount?: number;
141
+ }
142
+
143
+ export interface ResourcesPage {
144
+ resources: Resource[];
145
+ total?: number;
146
+ }
147
+
148
+ export interface QuestionAnswer {
149
+ questionID?: string;
150
+ answer?: unknown;
151
+ }
152
+
153
+ export interface OkResult {
154
+ ok?: boolean;
155
+ }
156
+
157
+ function record(value: unknown): Record<string, unknown> | null {
158
+ return value !== null && typeof value === "object" && !Array.isArray(value)
159
+ ? value as Record<string, unknown>
160
+ : null;
161
+ }
162
+
163
+ const isString = (value: unknown): boolean => typeof value === "string";
164
+ const isNumber = (value: unknown): boolean => typeof value === "number";
165
+ const isBoolean = (value: unknown): boolean => typeof value === "boolean";
166
+ const optional = (value: unknown, check: (value: unknown) => boolean): boolean =>
167
+ value === undefined || check(value);
168
+ const nullable = (value: unknown, check: (value: unknown) => boolean): boolean =>
169
+ value === undefined || value === null || check(value);
170
+ const isMessageText = (value: unknown): boolean => value === null || isString(value);
171
+ const isIdRefList = (value: unknown): boolean =>
172
+ Array.isArray(value) && value.every((item) => {
173
+ const ref = record(item);
174
+ return ref !== null && isString(ref.id) && optional(ref.seq, isNumber);
175
+ });
176
+ const isParticipantList = (value: unknown): boolean =>
177
+ Array.isArray(value) && value.every((item) => {
178
+ const participant = record(item);
179
+ return participant !== null && optional(participant.id, isString) && optional(participant.name, isString);
180
+ });
181
+
182
+ // Valid entries are kept; one malformed entry is skipped so the caller still
183
+ // gets the rest of an otherwise valid page.
184
+ function keepItems<T>(value: unknown, guard: (value: unknown) => value is T): T[] | null {
185
+ return Array.isArray(value) ? value.filter(guard) : null;
186
+ }
187
+
188
+ export function isStoredMessage(value: unknown): value is ChatMessage {
189
+ const message = record(value);
190
+ return message !== null
191
+ && isString(message.id) && message.id !== ""
192
+ && optional(message.createdAt, (item) => isNumber(item) || isString(item))
193
+ && optional(message.text, isString)
194
+ && optional(message.seq, isNumber)
195
+ && optional(message.senderId, isString)
196
+ && optional(message.senderSessionID, isString)
197
+ && optional(message.recalledAt, isNumber)
198
+ && optional(message.isQuestion, isBoolean);
199
+ }
200
+
201
+ export function isInboxItem(value: unknown): value is InboxItem {
202
+ if (!isStoredMessage(value)) return false;
203
+ const item = record(value);
204
+ return item !== null
205
+ && optional(item.roomName, isString)
206
+ && optional(item.roomKind, (kind) => kind === "group" || kind === "direct")
207
+ && optional(item.answerQuestionExcerpt, isString);
208
+ }
209
+
210
+ export function isRoom(value: unknown): value is RoomWire {
211
+ const room = record(value);
212
+ if (!room || !isString(room.id) || !room.id) return false;
213
+ if (!optional(room.name, isString)
214
+ || !optional(room.hasMore, isBoolean)
215
+ || !nullable(room.nextBeforeSeq, isNumber)
216
+ || !optional(room.recallVersion, isNumber)
217
+ || !optional(room.joined, isBoolean)
218
+ || !optional(room.ownerId, isString)
219
+ || !optional(room.adminIds, (ids) => Array.isArray(ids) && ids.every(isString))
220
+ || !nullable(room.successorId, isString)
221
+ || !optional(room.joinPolicy, isString)
222
+ || !optional(room.kind, isString)
223
+ || !nullable(room.adminSessionID, isString)
224
+ || !optional(room.participants, isParticipantList)) return false;
225
+ const messages = keepItems(room.messages, isStoredMessage);
226
+ if (room.messages !== undefined && messages === null) return false;
227
+ if (messages) room.messages = messages;
228
+ return true;
229
+ }
230
+
231
+ export function roomList(value: unknown): RoomWire[] {
232
+ return Array.isArray(value) ? value.filter(isRoom) : [];
233
+ }
234
+
235
+ export function isHistoryPage(value: unknown): value is HistoryPage {
236
+ const page = record(value);
237
+ if (page === null || !optional(page.hasMore, isBoolean)
238
+ || !nullable(page.nextBeforeSeq, isNumber)
239
+ || !optional(page.recallVersion, isNumber)) return false;
240
+ const messages = keepItems(page.messages, isStoredMessage);
241
+ if (messages === null) return false;
242
+ page.messages = messages;
243
+ return true;
244
+ }
245
+
246
+ export function isInboxPage(value: unknown): value is InboxPage {
247
+ const page = record(value);
248
+ if (page === null || !isBoolean(page.member)
249
+ || !optional(page.hasMore, isBoolean)
250
+ || !optional(page.recallVersion, isNumber)) return false;
251
+ const items = keepItems(page.items, isInboxItem);
252
+ if (items === null) return false;
253
+ page.items = items;
254
+ return true;
255
+ }
256
+
257
+ export function isMessageView(value: unknown): value is MessageView {
258
+ const message = record(value);
259
+ return message !== null
260
+ && isString(message.id) && message.id !== ""
261
+ && optional(message.roomId, isString)
262
+ && optional(message.seq, isNumber)
263
+ && optional(message.senderId, isString)
264
+ && optional(message.senderName, isString)
265
+ && optional(message.text, isMessageText)
266
+ && optional(message.createdAt, (item) => isNumber(item) || isString(item))
267
+ && optional(message.isQuestion, isBoolean)
268
+ && nullable(message.parentMessageId, isString)
269
+ && nullable(message.answeredByMessageId, isString)
270
+ && optional(message.recalled, isBoolean)
271
+ && optional(message.recalledAt, isNumber)
272
+ && nullable(message.recalledBy, isString)
273
+ && optional(message.unavailable, isString)
274
+ && optional(message.resourceIDs, (ids) => Array.isArray(ids) && ids.every(isString));
275
+ }
276
+
277
+ export function isCatchUpPage(value: unknown): value is CatchUpPage {
278
+ const page = record(value);
279
+ if (page === null || !optional(page.nextCursor, isNumber)
280
+ || !optional(page.hasMore, isBoolean)
281
+ || !optional(page.unreadMentions, isIdRefList)
282
+ || !optional(page.unreadMentionCount, isNumber)
283
+ || !optional(page.unansweredQuestions, isIdRefList)
284
+ || !optional(page.unansweredQuestionCount, isNumber)) return false;
285
+ const messages = keepItems(page.messages, isMessageView);
286
+ if (messages === null) return false;
287
+ page.messages = messages;
288
+ return true;
289
+ }
290
+
291
+ export function isRecallResult(value: unknown): value is RecallResult {
292
+ const result = record(value);
293
+ return result !== null
294
+ && optional(result.ok, isBoolean)
295
+ && optional(result.messageID, isString)
296
+ && optional(result.text, isMessageText)
297
+ && optional(result.senderId, isString)
298
+ && optional(result.createdAt, isNumber)
299
+ && optional(result.recalledAt, isNumber);
300
+ }
301
+
302
+ export function isRevealed(value: unknown): value is RevealedMessage {
303
+ const message = record(value);
304
+ return message !== null
305
+ && optional(message.messageID, isString)
306
+ && optional(message.text, isMessageText)
307
+ && optional(message.senderId, isString)
308
+ && optional(message.createdAt, isNumber)
309
+ && optional(message.recalledAt, isNumber);
310
+ }
311
+
312
+ export function isResource(value: unknown): value is Resource {
313
+ const resource = record(value);
314
+ return resource !== null
315
+ && optional(resource.name, isString)
316
+ && optional(resource.uploaderName, isString)
317
+ && optional(resource.uploaderSessionID, isString);
318
+ }
319
+
320
+ export function isResourcesPage(value: unknown): value is ResourcesPage {
321
+ const page = record(value);
322
+ if (page === null || !optional(page.total, isNumber)) return false;
323
+ const resources = keepItems(page.resources, isResource);
324
+ if (resources === null) return false;
325
+ page.resources = resources;
326
+ return true;
327
+ }
328
+
329
+ export function isMember(value: unknown): value is Member {
330
+ const member = record(value);
331
+ return member !== null
332
+ && optional(member.sessionID, isString)
333
+ && optional(member.membershipID, isString)
334
+ && optional(member.name, isString)
335
+ && optional(member.type, isString)
336
+ && optional(member.protocol, isString)
337
+ && optional(member.host, isString)
338
+ && optional(member.activity, (item) => {
339
+ const activity = record(item);
340
+ return activity !== null
341
+ && optional(activity.state, isString)
342
+ && nullable(activity.observedAt, isNumber);
343
+ });
344
+ }
345
+
346
+ export function isAnnouncement(value: unknown): value is Announcement {
347
+ const announcement = record(value);
348
+ return announcement !== null && optional(announcement.name, isString);
349
+ }
350
+
351
+ export function isQuestion(value: unknown): value is Question {
352
+ const question = record(value);
353
+ return question !== null && optional(question.senderId, isString);
354
+ }
355
+
356
+ export function isJoinRequest(value: unknown): value is JoinRequest {
357
+ const request = record(value);
358
+ return request !== null
359
+ && optional(request.name, isString)
360
+ && optional(request.participantId, isString);
361
+ }
362
+
363
+ export function isReminder(value: unknown): value is Reminder {
364
+ const reminder = record(value);
365
+ return reminder !== null && optional(reminder.schedule, (item) => {
366
+ const schedule = record(item);
367
+ return schedule !== null
368
+ && optional(schedule.type, isString)
369
+ && optional(schedule.expression, isString)
370
+ && optional(schedule.timezone, isString)
371
+ && optional(schedule.at, isString);
372
+ });
373
+ }
374
+
375
+ export function isQuestionsAnswer(value: unknown): value is QuestionAnswer {
376
+ const answer = record(value);
377
+ return answer !== null && optional(answer.questionID, isString);
378
+ }
379
+
380
+ export function isOk(value: unknown): value is OkResult {
381
+ const result = record(value);
382
+ return result !== null && optional(result.ok, isBoolean);
383
+ }
@@ -424,6 +424,9 @@ export function createIntegrationRulesEditor(options: Options): IntegrationRules
424
424
  autoClosingQuotes: "never",
425
425
  wordWrap: "on",
426
426
  fixedOverflowWidgets: true,
427
+ // Monaco renders context menus in a shadow root whose theme variables never
428
+ // arrive from the page, leaving the menu background transparent.
429
+ useShadowDOM: false,
427
430
  renderLineHighlight: "line",
428
431
  overviewRulerLanes: 0,
429
432
  hideCursorInOverviewRuler: true,
@@ -569,7 +572,27 @@ export function createCodePreviewEditor(options: CodePreviewOptions): { dispose:
569
572
  padding: { top: 10, bottom: 10 },
570
573
  scrollbar: { verticalScrollbarSize: 8, horizontalScrollbarSize: 8, useShadows: false },
571
574
  contextmenu: true,
575
+ // Same shadow-root theme gap as the integration editor; keep menus in the page.
576
+ useShadowDOM: false,
572
577
  ariaLabel: "Code preview",
573
578
  });
574
- return { dispose: () => { editor.dispose(); model.dispose(); } };
575
- }
579
+ // Monaco 0.58 ships no toggle-word-wrap action in the editor API. Toggle it
580
+ // here, using the physical key so Option+Z works on non-US Mac layouts too.
581
+ let wrapped = false;
582
+ const onKeyDown = (event: KeyboardEvent) => {
583
+ if (!event.altKey || event.ctrlKey || event.metaKey || event.shiftKey || event.code !== "KeyZ") return;
584
+ event.preventDefault();
585
+ event.stopPropagation();
586
+ if (event.repeat) return;
587
+ wrapped = !wrapped;
588
+ editor.updateOptions({ wordWrap: wrapped ? "on" : "off" });
589
+ };
590
+ options.container.addEventListener("keydown", onKeyDown, true);
591
+ return {
592
+ dispose: () => {
593
+ options.container.removeEventListener("keydown", onKeyDown, true);
594
+ editor.dispose();
595
+ model.dispose();
596
+ },
597
+ };
598
+ }