@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.
- package/CHANGELOG.md +17 -3
- package/README.md +5 -5
- package/README.zh-CN.md +5 -5
- package/cli.ts +20 -1
- package/dist/cli.js +3785 -1462
- package/package.json +19 -11
- package/packages/chat-room-channeld/README.md +16 -10
- package/packages/chat-room-channeld/src/delivery.ts +0 -4
- package/packages/chat-room-channeld/src/host.ts +48 -37
- package/packages/chat-room-channeld/src/inbound.ts +3 -6
- package/packages/chat-room-channeld/src/pg/database.ts +141 -49
- 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 +148 -99
- package/packages/chat-room-channeld/src/pg/worker.mts +201 -0
- package/packages/chat-room-channeld/src/state-rows.ts +132 -0
- package/packages/chat-room-channeld/src/state.ts +129 -157
- package/plugin.ts +21 -5
- package/server/app.ts +9 -0
- package/server/assets/base.css +22 -2
- package/server/assets/chat/admin.js +17 -1
- package/server/assets/chat/announcements.js +79 -34
- package/server/assets/chat/attachments.js +3 -3
- package/server/assets/chat/clipboard.js +1 -1
- package/server/assets/chat/confirm-dialog.js +3 -0
- package/server/assets/chat/copy-action.js +1 -1
- package/server/assets/chat/create-room-dialog.js +7 -0
- package/server/assets/chat/diagram-viewer.js +4 -8
- package/server/assets/chat/doc-preview.js +71 -31
- package/server/assets/chat/editor.js +49 -10
- package/server/assets/chat/events.js +13 -6
- package/server/assets/chat/files.js +33 -27
- package/server/assets/chat/history-loader.js +31 -15
- package/server/assets/chat/integration-editor.js +27 -1
- package/server/assets/chat/integrations.js +108 -16
- package/server/assets/chat/join-requests.js +40 -2
- package/server/assets/chat/locales/de.js +5 -3
- package/server/assets/chat/locales/es.js +5 -3
- package/server/assets/chat/locales/fr.js +5 -3
- package/server/assets/chat/locales/it.js +5 -3
- package/server/assets/chat/locales/ja.js +5 -3
- package/server/assets/chat/locales/ko.js +5 -3
- package/server/assets/chat/markdown-footnotes.js +27 -15
- package/server/assets/chat/markdown.js +6 -12
- package/server/assets/chat/members.js +34 -22
- package/server/assets/chat/mentions.js +8 -5
- package/server/assets/chat/message-cache.js +9 -3
- package/server/assets/chat/message-polling.js +10 -4
- package/server/assets/chat/message-window.js +58 -1
- package/server/assets/chat/messages.js +90 -37
- package/server/assets/chat/office-preview.js +3 -3
- package/server/assets/chat/operator.js +624 -0
- package/server/assets/chat/palette.js +7 -10
- package/server/assets/chat/panels.js +42 -0
- package/server/assets/chat/questions.js +75 -58
- package/server/assets/chat/recall.js +14 -5
- package/server/assets/chat/receipts.js +63 -7
- package/server/assets/chat/refresh-timing.js +6 -0
- package/server/assets/chat/reminders.js +47 -13
- package/server/assets/chat/replies.js +39 -25
- package/server/assets/chat/resource-format.js +6 -3
- package/server/assets/chat/room-list.js +202 -3
- package/server/assets/chat/room-watcher.js +3 -1
- package/server/assets/chat/rooms.js +29 -7
- package/server/assets/chat/settings.js +37 -6
- package/server/assets/chat/shortcuts.js +3 -1
- package/server/assets/chat/side-pane.js +1 -1
- package/server/assets/chat/state.js +51 -18
- package/server/assets/chat/system-events.js +3 -2
- package/server/assets/chat/system-messages.js +15 -15
- package/server/assets/chat/tasks.js +37 -14
- package/server/assets/chat/window-controls.js +25 -15
- package/server/assets/code-highlight.css +0 -13
- package/server/assets/conversation.css +45 -5
- package/server/assets/doc-preview.css +9 -0
- package/server/assets/files.css +4 -0
- package/server/assets/monaco/integration-rules.js +1 -1
- 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/assets/responsive.css +12 -2
- package/server/assets/settings.css +3 -1
- package/server/assets/tasks.css +6 -1
- package/server/assets/window-controls.css +3 -1
- package/server/channels.ts +3 -2
- package/server/chat.html +7 -2
- package/server/inbox.ts +3 -1
- package/server/join-requests.ts +8 -1
- package/server/member-routes.ts +16 -2
- package/server/newrooms.ts +2 -13
- package/server/operator-auth.ts +21 -0
- package/server/operator-routes.ts +150 -0
- package/server/operator-state.ts +64 -0
- package/server/operator.css +139 -0
- package/server/room-owner.ts +17 -0
- package/server/routes/inbox.ts +15 -5
- package/server/routes/pages.ts +12 -2
- package/server/routes/room-actions.ts +4 -3
- package/server/sw.js +3 -1
- package/server/system.html +109 -0
- package/server/wake.ts +1 -1
- package/skills/chatroom/SKILL.md +9 -0
- package/src/README.md +1 -1
- package/src/acp/client.ts +254 -0
- package/src/acp/protocol.ts +300 -0
- package/src/acp/watch.ts +498 -0
- package/src/agent/agent-receipts.ts +98 -8
- package/src/center/center-client.ts +6 -1
- package/src/center/center-inbox.ts +54 -7
- package/src/center/center-wake.ts +57 -3
- package/src/center/forward-client.ts +48 -0
- package/src/center/mentions.ts +16 -3
- package/src/center/notification-delay.ts +139 -0
- package/src/center/queue.ts +3 -0
- package/src/config/file-config.ts +25 -0
- package/src/mcp/server.ts +389 -0
- package/src/protocol/config.ts +7 -0
- package/src/runtime/plugin-notifications.ts +43 -9
- package/src/runtime/v2-plugin.ts +14 -3
- package/src/runtime/v2-receiver.ts +10 -2
- package/src/runtime/watch.ts +5 -1
- package/src/state/pg-database.ts +133 -49
- package/src/state/pg-sql.mjs +157 -142
- package/src/state/pg-sql.mts +175 -0
- package/src/state/pg-worker.mjs +148 -99
- package/src/state/pg-worker.mts +201 -0
- package/src/state/receiver-state.ts +47 -0
- package/src/state/sqlite-database.ts +6 -2
- package/src/state/sqlite-members.ts +48 -4
- package/src/state/sqlite-messages.ts +25 -12
- package/src/state/sqlite-schema.ts +4 -1
- package/src/state/sqlite-state.ts +1 -1
- package/src/state/store.ts +31 -11
- package/src/tui/app-types.mjs +1 -0
- package/src/tui/app-types.mts +175 -0
- package/src/tui/app.mjs +473 -423
- package/src/tui/app.mts +543 -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 +275 -242
- package/src/tui/room-settings-app.mts +318 -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
- 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
|
+
}
|
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
|
+
}
|