@alexsun-top/opencode-chat-room 0.8.3 → 0.8.5
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 +7 -1
- package/README.md +5 -5
- package/README.zh-CN.md +5 -5
- package/cli.ts +1 -1
- package/dist/cli.js +35 -16
- package/package.json +15 -9
- package/packages/chat-room-channeld/README.md +3 -2
- package/packages/chat-room-channeld/src/inbound.ts +3 -6
- package/packages/chat-room-channeld/src/pg/sql.mjs +157 -142
- package/packages/chat-room-channeld/src/pg/sql.mts +175 -0
- package/packages/chat-room-channeld/src/pg/worker.mjs +107 -99
- package/packages/chat-room-channeld/src/pg/worker.mts +166 -0
- package/plugin.ts +1 -1
- package/server/assets/chat/admin-badge.js +1 -1
- package/server/assets/chat/admin.js +16 -10
- package/server/assets/chat/announcements.js +12 -2
- package/server/assets/chat/attachment-store.js +15 -6
- package/server/assets/chat/attachments.js +48 -33
- package/server/assets/chat/chat-background.js +8 -14
- package/server/assets/chat/clipboard.js +2 -1
- package/server/assets/chat/confirm-dialog.js +3 -3
- package/server/assets/chat/copy-action.js +1 -2
- package/server/assets/chat/diagram-viewer.js +7 -9
- package/server/assets/chat/doc-preview.js +19 -12
- package/server/assets/chat/editor.js +87 -61
- package/server/assets/chat/events.js +49 -34
- package/server/assets/chat/files.js +45 -13
- package/server/assets/chat/history-loader.js +5 -3
- package/server/assets/chat/image-zoom.js +21 -17
- package/server/assets/chat/install-prompt.js +10 -9
- package/server/assets/chat/integration-account-schema.js +5 -3
- package/server/assets/chat/integration-editor.js +2 -2
- package/server/assets/chat/integration-values.js +17 -11
- package/server/assets/chat/integrations.js +138 -81
- package/server/assets/chat/join-requests.js +20 -13
- package/server/assets/chat/markdown-footnotes.js +8 -8
- package/server/assets/chat/markdown.js +48 -38
- package/server/assets/chat/members.js +48 -25
- package/server/assets/chat/mentions.js +39 -12
- package/server/assets/chat/message-cache.js +2 -2
- package/server/assets/chat/message-polling.js +40 -21
- package/server/assets/chat/message-window.js +10 -6
- package/server/assets/chat/messages.js +70 -46
- package/server/assets/chat/office-preview.js +3 -3
- package/server/assets/chat/palette.js +45 -29
- package/server/assets/chat/panels.js +19 -1
- package/server/assets/chat/pwa.js +5 -4
- package/server/assets/chat/questions.js +25 -22
- package/server/assets/chat/recall.js +39 -21
- package/server/assets/chat/receipts.js +9 -7
- package/server/assets/chat/reminders.js +25 -8
- package/server/assets/chat/replies.js +34 -15
- package/server/assets/chat/resource-format.js +2 -2
- package/server/assets/chat/room-list.js +2 -2
- package/server/assets/chat/room-watcher.js +8 -4
- package/server/assets/chat/rooms.js +51 -40
- package/server/assets/chat/search.js +8 -6
- package/server/assets/chat/settings.js +16 -14
- package/server/assets/chat/shiki.js +1 -1
- package/server/assets/chat/shortcuts.js +3 -3
- package/server/assets/chat/side-pane.js +4 -3
- package/server/assets/chat/state.js +65 -37
- package/server/assets/chat/system-events.js +6 -5
- package/server/assets/chat/system-messages.js +15 -15
- package/server/assets/chat/task-form.js +5 -5
- package/server/assets/chat/task-row.js +1 -1
- package/server/assets/chat/tasks.js +41 -28
- package/server/assets/chat/window-controls.js +3 -2
- package/server/assets/conversation.css +14 -2
- package/server/assets/doc-preview.css +6 -0
- package/server/assets/office/THIRD-PARTY-NOTICES.txt +23 -1
- package/server/assets/office/licenses/docx-preview-HEADER.txt +6 -0
- package/server/assets/office/licenses/echarts-LICENSE-d3.txt +27 -0
- package/server/assets/office/licenses/echarts-NOTICE.txt +5 -0
- package/server/assets/office/licenses/immediate-LICENSE.txt +20 -0
- package/server/assets/office/licenses/lie-LICENSE.txt +7 -0
- package/server/assets/office/licenses/pako-LICENSE.txt +21 -0
- package/server/assets/office/licenses/pako-ZLIB.txt +18 -0
- package/server/assets/office/licenses/setimmediate-LICENSE.txt +20 -0
- package/server/chat.html +1 -0
- package/server/sw.js +3 -1
- package/skills/chatroom/SKILL.md +9 -0
- package/src/README.md +1 -1
- package/src/agent/agent-receipts.ts +12 -4
- package/src/center/center-client.ts +1 -1
- package/src/state/pg-sql.mjs +157 -142
- package/src/state/pg-sql.mts +175 -0
- package/src/state/pg-worker.mjs +107 -99
- package/src/state/pg-worker.mts +166 -0
- package/src/state/store.ts +21 -7
- package/src/tui/app-types.mjs +1 -0
- package/src/tui/app-types.mts +175 -0
- package/src/tui/app.mjs +426 -423
- package/src/tui/app.mts +500 -0
- package/src/tui/config.mjs +166 -158
- package/src/tui/config.mts +247 -0
- package/src/tui/http.mjs +239 -206
- package/src/tui/http.mts +412 -0
- package/src/tui/i18n.mjs +17 -20
- package/src/tui/i18n.mts +42 -0
- package/src/tui/info-app.mjs +431 -427
- package/src/tui/info-app.mts +500 -0
- package/src/tui/info-content.mjs +205 -199
- package/src/tui/info-content.mts +341 -0
- package/src/tui/join-app.mjs +75 -64
- package/src/tui/join-app.mts +99 -0
- package/src/tui/locales/en.mjs +302 -320
- package/src/tui/locales/en.mts +349 -0
- package/src/tui/locales/zh-CN.mjs +302 -320
- package/src/tui/locales/zh-CN.mts +349 -0
- package/src/tui/main.mjs +219 -213
- package/src/tui/main.mts +255 -0
- package/src/tui/markdown.mjs +128 -272
- package/src/tui/markdown.mts +152 -0
- package/src/tui/mentions.mjs +181 -184
- package/src/tui/mentions.mts +251 -0
- package/src/tui/message-app.mjs +181 -173
- package/src/tui/message-app.mts +213 -0
- package/src/tui/message-view.mjs +90 -111
- package/src/tui/message-view.mts +151 -0
- package/src/tui/messages.mjs +55 -49
- package/src/tui/messages.mts +106 -0
- package/src/tui/palette-app.mjs +364 -344
- package/src/tui/palette-app.mts +388 -0
- package/src/tui/palette.mjs +100 -98
- package/src/tui/palette.mts +176 -0
- package/src/tui/prefs.mjs +56 -63
- package/src/tui/prefs.mts +126 -0
- package/src/tui/reminder-app.mjs +191 -181
- package/src/tui/reminder-app.mts +228 -0
- package/src/tui/room-settings-app.mjs +257 -242
- package/src/tui/room-settings-app.mts +301 -0
- package/src/tui/session.mjs +30 -29
- package/src/tui/session.mts +51 -0
- package/src/tui/settings-app.mjs +151 -138
- package/src/tui/settings-app.mts +179 -0
- package/src/tui/ui-content.mjs +426 -421
- package/src/tui/ui-content.mts +499 -0
- package/src/tui/ui-help.mjs +58 -67
- package/src/tui/ui-help.mts +87 -0
- package/src/tui/ui-mentions.mjs +34 -36
- package/src/tui/ui-mentions.mts +60 -0
- package/src/tui/ui-overlay-view.mjs +259 -267
- package/src/tui/ui-overlay-view.mts +322 -0
- package/src/tui/ui-suggest-view.mjs +54 -57
- package/src/tui/ui-suggest-view.mts +78 -0
- package/src/tui/ui-suggest.mjs +164 -167
- package/src/tui/ui-suggest.mts +248 -0
- package/src/tui/ui-theme.mjs +52 -57
- package/src/tui/ui-theme.mts +98 -0
- package/src/tui/ui-view.mjs +267 -275
- package/src/tui/ui-view.mts +308 -0
- package/src/tui/ui.mjs +372 -359
- package/src/tui/ui.mts +440 -0
- package/src/tui/wire.mjs +215 -0
- package/src/tui/wire.mts +383 -0
|
@@ -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
|
+
}
|
package/src/tui/ui-mentions.mjs
CHANGED
|
@@ -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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
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
|
+
}
|