@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,87 @@
1
+ // Keyboard help overlay: themed shortcut columns, compact on short terminals.
2
+ import { StyledText, bold, fg } from "@opentui/core";
3
+ import type { BoxRenderable, CliRenderer, TextChunk, TextRenderable } from "@opentui/core";
4
+ import { t } from "./i18n.mjs";
5
+ import type { TuiTheme } from "./ui-theme.mjs";
6
+
7
+ export interface HelpUi {
8
+ helpBox: BoxRenderable;
9
+ helpBar: BoxRenderable;
10
+ helpTitle: TextRenderable;
11
+ helpClose: TextRenderable;
12
+ helpFooter: TextRenderable;
13
+ helpLeft: TextRenderable;
14
+ helpRight: TextRenderable;
15
+ theme: TuiTheme;
16
+ helpSignature: string;
17
+ renderer: CliRenderer;
18
+ }
19
+
20
+ export interface HelpState {
21
+ help?: unknown;
22
+ palette?: unknown;
23
+ language?: string;
24
+ }
25
+
26
+ type ShortcutRows = readonly (readonly [string, string])[];
27
+
28
+ function shortcutChunks(title: string, rows: ShortcutRows, theme: TuiTheme): TextChunk[] {
29
+ const chunks = [bold(fg(theme.accent)(`${title}\n`))];
30
+ for (const [key, label] of rows) {
31
+ chunks.push(fg(theme.accent)(key.padEnd(12)));
32
+ chunks.push(fg(theme.text)(`${label}\n`));
33
+ }
34
+ return chunks;
35
+ }
36
+
37
+ export function syncHelp(ui: HelpUi, state: HelpState): void {
38
+ const show = Boolean(state.help) && !state.palette;
39
+ ui.helpBox.visible = show;
40
+ if (!show) return;
41
+ ui.helpBox.borderColor = ui.theme.border;
42
+ ui.helpBox.backgroundColor = ui.theme.surface;
43
+ ui.helpBar.backgroundColor = ui.theme.raised;
44
+ ui.helpTitle.fg = ui.theme.text;
45
+ ui.helpClose.fg = ui.theme.muted;
46
+ ui.helpFooter.fg = ui.theme.muted;
47
+ const signature = `${ui.theme.mode}:${state.language}`;
48
+ if (signature === ui.helpSignature) return;
49
+ ui.helpSignature = signature;
50
+ const compact = ui.renderer.height < 22;
51
+ const navigation: ShortcutRows = compact
52
+ ? [
53
+ ["↑ / ↓", t("help.selectRoom")],
54
+ ["Enter", t("help.openJoin")],
55
+ ["Tab", t("help.focusComposer")],
56
+ ["PgUp / PgDn", t("help.scrollMessages")],
57
+ ]
58
+ : [
59
+ ["↑ / ↓", t("help.selectRoom")],
60
+ ["Enter", t("help.openJoin")],
61
+ ["Tab", t("help.focusComposer")],
62
+ ["PgUp / PgDn", t("help.scrollMessages")],
63
+ ["Alt+Home", t("help.firstMessage")],
64
+ ["Alt+End", t("help.lastMessage")],
65
+ ];
66
+ const composer: ShortcutRows = compact
67
+ ? [
68
+ ["Enter", t("help.sendMessage")],
69
+ ["Esc", t("help.clearBlur")],
70
+ ["/", t("help.inlineCommands")],
71
+ ["@", t("help.mentionMembers")],
72
+ ["Ctrl+C", t("help.quit")],
73
+ ]
74
+ : [
75
+ ["Enter", t("help.sendMessage")],
76
+ ["Ctrl+J", t("help.newline")],
77
+ ["Esc", t("help.clearBlur")],
78
+ ["/", t("help.inlineCommands")],
79
+ ["@", t("help.mentionMembers")],
80
+ ["Alt+Space", t("help.paletteSearch")],
81
+ ["Ctrl+R", t("help.refreshRooms")],
82
+ ["/exit", t("help.quit")],
83
+ ["Ctrl+C", t("help.quit")],
84
+ ];
85
+ ui.helpLeft.content = new StyledText(shortcutChunks(t("help.navigation"), navigation, ui.theme));
86
+ ui.helpRight.content = new StyledText(shortcutChunks(t("help.composer"), composer, ui.theme));
87
+ }
@@ -2,43 +2,41 @@
2
2
  // to the text; we rebuild them only when the visible ranges or theme change.
3
3
  import { SyntaxStyle } from "@opentui/core";
4
4
  import { mentionNames, mentionRanges } from "./mentions.mjs";
5
-
6
5
  function styleFor(ui) {
7
- let style = ui.mentionStyles.get(ui.theme.mode);
8
- if (!style) {
9
- style = SyntaxStyle.fromStyles({
10
- mention: { fg: ui.theme.accent, bold: true },
11
- });
12
- ui.mentionStyles.set(ui.theme.mode, style);
13
- }
14
- return style;
6
+ let style = ui.mentionStyles.get(ui.theme.mode);
7
+ if (!style) {
8
+ style = SyntaxStyle.fromStyles({
9
+ mention: { fg: ui.theme.accent, bold: true },
10
+ }, ui.renderer.nativeScene);
11
+ ui.mentionStyles.set(ui.theme.mode, style);
12
+ }
13
+ return style;
15
14
  }
16
-
17
15
  export function syncMentionHighlights(ui, state) {
18
- const textarea = ui.textarea;
19
- const text = textarea.plainText;
20
- const ranges = mentionRanges(text, state.current?.participants);
21
- const names = mentionNames(state.current?.participants).join(",");
22
- const signature = `${ui.theme.mode}:${names}:${ranges.map((range) => `${range.start}-${range.end}`).join(",")}`;
23
- if (signature === ui.mentionSignature) return;
24
- if (!ranges.length) {
25
- textarea.extmarks.clear();
16
+ const textarea = ui.textarea;
17
+ const text = textarea.plainText;
18
+ const ranges = mentionRanges(text, state.current?.participants);
19
+ const names = mentionNames(state.current?.participants).join(",");
20
+ const signature = `${ui.theme.mode}:${names}:${ranges.map((range) => `${range.start}-${range.end}`).join(",")}`;
21
+ if (signature === ui.mentionSignature)
22
+ return;
23
+ if (!ranges.length) {
24
+ textarea.extmarks.clear();
25
+ ui.mentionSignature = signature;
26
+ return;
27
+ }
28
+ const style = styleFor(ui);
29
+ const styleId = style.getStyleId("mention") ?? style.registerStyle("mention", {
30
+ fg: ui.theme.accent,
31
+ bold: true,
32
+ });
33
+ textarea.syntaxStyle = style;
34
+ const extmarks = textarea.extmarks;
35
+ const typeId = ui.mentionTypeId ??= extmarks.registerType("mention");
36
+ extmarks.clear();
37
+ for (const range of ranges) {
38
+ extmarks.create({ start: range.start, end: range.end, styleId, typeId });
39
+ }
26
40
  ui.mentionSignature = signature;
27
- return;
28
- }
29
-
30
- const style = styleFor(ui);
31
- const styleId = style.getStyleId("mention") ?? style.registerStyle("mention", {
32
- fg: ui.theme.accent,
33
- bold: true,
34
- });
35
- textarea.syntaxStyle = style;
36
- const extmarks = textarea.extmarks;
37
- const typeId = ui.mentionTypeId ??= extmarks.registerType("mention");
38
- extmarks.clear();
39
- for (const range of ranges) {
40
- extmarks.create({ start: range.start, end: range.end, styleId, typeId });
41
- }
42
- ui.mentionSignature = signature;
43
- ui.renderer.requestRender();
44
- }
41
+ ui.renderer.requestRender();
42
+ }
@@ -0,0 +1,60 @@
1
+ // Accent-colored mention chips inside the composer. Extmarks keep ranges tied
2
+ // to the text; we rebuild them only when the visible ranges or theme change.
3
+ import { SyntaxStyle } from "@opentui/core";
4
+ import type { CliRenderer, TextareaRenderable, ThemeMode } from "@opentui/core";
5
+ import { mentionNames, mentionRanges } from "./mentions.mjs";
6
+ import type { Participant } from "./mentions.mjs";
7
+ import type { TuiTheme } from "./ui-theme.mjs";
8
+
9
+ export interface MentionUi {
10
+ textarea: TextareaRenderable;
11
+ theme: TuiTheme;
12
+ mentionStyles: Map<ThemeMode, SyntaxStyle>;
13
+ mentionSignature: string;
14
+ mentionTypeId: number | null;
15
+ renderer: CliRenderer;
16
+ }
17
+
18
+ export interface MentionState {
19
+ current?: { participants?: readonly Participant[] } | null;
20
+ }
21
+
22
+ function styleFor(ui: MentionUi): SyntaxStyle {
23
+ let style = ui.mentionStyles.get(ui.theme.mode);
24
+ if (!style) {
25
+ style = SyntaxStyle.fromStyles({
26
+ mention: { fg: ui.theme.accent, bold: true },
27
+ }, ui.renderer.nativeScene);
28
+ ui.mentionStyles.set(ui.theme.mode, style);
29
+ }
30
+ return style;
31
+ }
32
+
33
+ export function syncMentionHighlights(ui: MentionUi, state: MentionState): void {
34
+ const textarea = ui.textarea;
35
+ const text = textarea.plainText;
36
+ const ranges = mentionRanges(text, state.current?.participants);
37
+ const names = mentionNames(state.current?.participants).join(",");
38
+ const signature = `${ui.theme.mode}:${names}:${ranges.map((range) => `${range.start}-${range.end}`).join(",")}`;
39
+ if (signature === ui.mentionSignature) return;
40
+ if (!ranges.length) {
41
+ textarea.extmarks.clear();
42
+ ui.mentionSignature = signature;
43
+ return;
44
+ }
45
+
46
+ const style = styleFor(ui);
47
+ const styleId = style.getStyleId("mention") ?? style.registerStyle("mention", {
48
+ fg: ui.theme.accent,
49
+ bold: true,
50
+ });
51
+ textarea.syntaxStyle = style;
52
+ const extmarks = textarea.extmarks;
53
+ const typeId = ui.mentionTypeId ??= extmarks.registerType("mention");
54
+ extmarks.clear();
55
+ for (const range of ranges) {
56
+ extmarks.create({ start: range.start, end: range.end, styleId, typeId });
57
+ }
58
+ ui.mentionSignature = signature;
59
+ ui.renderer.requestRender();
60
+ }