@alexsun-top/opencode-chat-room 0.7.8 → 0.8.0
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 +14 -1
- package/LICENSE +21 -0
- package/README.md +45 -36
- package/README.zh-CN.md +50 -41
- package/dist/cli.js +2629 -350
- package/package.json +13 -3
- package/packages/chat-room-channeld/README.md +242 -0
- package/packages/chat-room-channeld/dist/feishu-adapter.js +499 -0
- package/packages/chat-room-channeld/dist/mock-adapter.js +295 -0
- package/packages/chat-room-channeld/src/adapter.ts +475 -0
- package/packages/chat-room-channeld/src/cli.ts +124 -0
- package/packages/chat-room-channeld/src/config.ts +207 -0
- package/packages/chat-room-channeld/src/delivery.ts +158 -0
- package/packages/chat-room-channeld/src/feishu-adapter.ts +473 -0
- package/packages/chat-room-channeld/src/framing.ts +128 -0
- package/packages/chat-room-channeld/src/host-helpers.ts +41 -0
- package/packages/chat-room-channeld/src/host.ts +509 -0
- package/packages/chat-room-channeld/src/ingest-gate.ts +108 -0
- package/packages/chat-room-channeld/src/log.ts +26 -0
- package/packages/chat-room-channeld/src/mock-adapter.ts +206 -0
- package/packages/chat-room-channeld/src/protocol.ts +75 -0
- package/packages/chat-room-channeld/src/published.ts +37 -0
- package/packages/chat-room-channeld/src/rules.ts +127 -0
- package/packages/chat-room-channeld/src/state.ts +485 -0
- package/packages/chat-room-channeld/src/stats.ts +167 -0
- package/plugin.ts +22 -5
- package/server/addressing-routes.ts +130 -0
- package/server/assets/NOTICE.txt +2 -2
- package/server/assets/SHIKI-LICENSE +22 -0
- package/server/assets/base.css +9 -1
- package/server/assets/chat/doc-preview.js +3 -4
- package/server/assets/chat/forward.js +69 -0
- package/server/assets/chat/index.js +2 -0
- package/server/assets/chat/locales/de.js +5 -0
- package/server/assets/chat/locales/es.js +5 -0
- package/server/assets/chat/locales/fr.js +5 -0
- package/server/assets/chat/locales/it.js +5 -0
- package/server/assets/chat/locales/ja.js +5 -0
- package/server/assets/chat/locales/ko.js +5 -0
- package/server/assets/chat/markdown-footnotes.js +115 -0
- package/server/assets/chat/markdown.js +24 -35
- package/server/assets/chat/palette.js +1 -1
- package/server/assets/chat/replies.js +7 -1
- package/server/assets/chat/shiki.js +87 -0
- package/server/assets/chat/side-pane.js +8 -1
- package/server/assets/chat/state.js +14 -1
- package/server/assets/chat/system-messages.js +2 -0
- package/server/assets/code-highlight.css +20 -31
- package/server/assets/conversation.css +3 -2
- package/server/assets/doc-preview.css +2 -1
- package/server/assets/responsive.css +5 -0
- package/server/assets/shiki.bundle.js +152 -0
- package/server/channels.ts +314 -0
- package/server/chat-server.ts +27 -4
- package/server/chat.html +10 -3
- package/server/sw.js +1 -2
- package/skills/chatroom/SKILL.md +1 -1
- package/src/center/center-client.ts +79 -1
- package/src/config/file-config.ts +34 -0
- package/src/runtime/v2-plugin.ts +8 -2
- package/src/runtime/watch.ts +3 -2
- package/src/state/sqlite-state.ts +42 -11
- package/src/state/store.ts +9 -3
- package/src/tui/http.mjs +16 -2
- package/src/tui/main.mjs +1 -1
- package/server/assets/HIGHLIGHT-LICENSE +0 -29
- package/server/assets/highlight-10.7.3.min.js +0 -1358
package/src/runtime/v2-plugin.ts
CHANGED
|
@@ -81,7 +81,7 @@ export function createV2Setup(deps: {
|
|
|
81
81
|
});
|
|
82
82
|
toolRegistration = await context.tool.transform((editor) => editor.add({
|
|
83
83
|
name: "room",
|
|
84
|
-
description: "Chat room operations: create, join, join_status, leave and list rooms; send and poll messages;
|
|
84
|
+
description: "Chat room operations: create, join, join_status, leave and list rooms; send and poll messages; get_message fetches one message by ID (recalled messages come back as tombstones); catch_up pages messages after a seq cursor and is read-only (no read receipt or wake); send accepts parentMessageId to reply. List members, announcements and tasks; create, update and delete room tasks; manage reminders. In an approval room join returns pending: you are not a member yet; call join_status to check whether an administrator approved you. Reminder schedules use the server timezone unless an IANA timezone is provided; once schedules require an ISO datetime. Upload files and media; upload_resource returns a [[resource:UUID]] marker, and the attachment renders only when that exact marker is included in a send message. read_resource saves files to a private temporary path and leaves them there until removed or system cleanup. delete_resource removes an uploaded file; servers allow human room administrators any resource and agents only their own uploads.",
|
|
85
85
|
options: { codemode: false },
|
|
86
86
|
input: roomSchema(),
|
|
87
87
|
execute: async (args, toolContext) => {
|
|
@@ -169,13 +169,19 @@ export function createV2Setup(deps: {
|
|
|
169
169
|
|
|
170
170
|
export function roomSchema() {
|
|
171
171
|
return z.object({
|
|
172
|
-
action: z.enum(["create", "join", "join_status", "leave", "list", "send", "poll", "members", "upload_resource", "read_resource", "delete_resource", "announcement_list", "announcement_read", "announcement_write", "announcement_delete", "reminder_list", "reminder_create", "reminder_update", "reminder_delete", "task_list", "task_create", "task_update", "task_delete"]),
|
|
172
|
+
action: z.enum(["create", "join", "join_status", "leave", "list", "send", "poll", "get_message", "catch_up", "members", "upload_resource", "read_resource", "delete_resource", "announcement_list", "announcement_read", "announcement_write", "announcement_delete", "reminder_list", "reminder_create", "reminder_update", "reminder_delete", "task_list", "task_create", "task_update", "task_delete"]),
|
|
173
173
|
name: z.string().max(64).optional().describe("For join: your own participant display name, NOT the room name (required). For create: the new room name."),
|
|
174
174
|
roomId: z.string().optional(),
|
|
175
|
+
messageId: z.string().optional().describe("For get_message: the full message ID returned by send, poll, or catch_up."),
|
|
175
176
|
resourceId: z.string().optional(),
|
|
176
177
|
filePath: z.string().optional().describe("Local regular file to upload; central mode only; requires host read permission."),
|
|
177
178
|
text: z.string().max(5000).optional(),
|
|
178
179
|
isQuestion: z.boolean().optional(),
|
|
180
|
+
parentMessageId: z.string().optional().describe("For send: the ID of the message this one answers or replies to."),
|
|
181
|
+
replyToMessageID: z.string().optional().describe("Legacy alias of parentMessageId for send."),
|
|
182
|
+
clientMessageID: z.string().max(100).optional().describe("For send: idempotency key; retrying with the same ID and parent creates one message."),
|
|
183
|
+
afterSeq: z.number().int().min(0).optional().describe("For catch_up: return messages with seq greater than this cursor; omit to start at 0."),
|
|
184
|
+
limit: z.number().int().min(1).max(200).optional().describe("For catch_up: page size from 1 to 200; the server default is 50."),
|
|
179
185
|
announcementName: z.string().optional().describe("Name of a room announcement; distinct from participant or room name."),
|
|
180
186
|
content: z.string().optional().describe("Announcement content, at most 5000 Unicode characters."),
|
|
181
187
|
taskId: z.string().optional().describe("Task UUID from task_list; required for task_update and task_delete."),
|
package/src/runtime/watch.ts
CHANGED
|
@@ -242,7 +242,8 @@ export async function watchStatus(): Promise<"running" | "stopped" | "unavailabl
|
|
|
242
242
|
return await control(record) ? "running" : "unavailable";
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
|
|
245
|
+
// readyTimeoutMs is a test seam so the timeout cleanup can be exercised quickly.
|
|
246
|
+
export async function startWatcher(beforePublish?: () => Promise<void>, readyTimeoutMs = 20_000): Promise<string> {
|
|
246
247
|
await privateDirectory();
|
|
247
248
|
const own: WatchRecord = { phase: "starting", token: randomBytes(32).toString("base64url"), nonce: randomBytes(16).toString("hex"), instanceID: randomBytes(16).toString("hex"), pid: process.pid, createdAt: Date.now() };
|
|
248
249
|
const reservation = await reserveWatcher(own, beforePublish);
|
|
@@ -269,7 +270,7 @@ export async function startWatcher(beforePublish?: () => Promise<void>): Promise
|
|
|
269
270
|
});
|
|
270
271
|
child.once("error", (error) => { childError = error; });
|
|
271
272
|
child.unref();
|
|
272
|
-
const deadline = Date.now() +
|
|
273
|
+
const deadline = Date.now() + readyTimeoutMs;
|
|
273
274
|
while (Date.now() < deadline) {
|
|
274
275
|
if (childError) { await removeRecord(own.token, own.nonce); releaseWatcherClaim(profile(), own.instanceID); throw childError; }
|
|
275
276
|
const record = await readRecord();
|
|
@@ -530,6 +530,16 @@ export async function readQuestions(file: string, roomID: string): Promise<Messa
|
|
|
530
530
|
return (db.query("SELECT id,room_id,sender_id,sender_session_id,text,created_at,is_question,answer_to,answered_by FROM messages WHERE room_id=? AND is_question=1 AND answered_by IS NULL AND recalled_at IS NULL ORDER BY seq").all(roomID) as Array<Record<string, string | number | null>>).map(rowMessage);
|
|
531
531
|
}
|
|
532
532
|
|
|
533
|
+
// Open questions as seq references for catch-up; room-wide, excluding recalled.
|
|
534
|
+
// Capped so a room with a large question backlog cannot bloat a catch-up page.
|
|
535
|
+
export const MAX_OPEN_QUESTION_REFS = 200;
|
|
536
|
+
export async function readOpenQuestionRefs(file: string, roomID: string, limit = MAX_OPEN_QUESTION_REFS): Promise<Array<{ id: string; seq: number }>> {
|
|
537
|
+
const db = await openStateDatabase(file);
|
|
538
|
+
const take = Number.isSafeInteger(limit) ? Math.min(MAX_OPEN_QUESTION_REFS, Math.max(1, limit)) : MAX_OPEN_QUESTION_REFS;
|
|
539
|
+
return (db.query("SELECT id,seq FROM messages WHERE room_id=? AND is_question=1 AND answered_by IS NULL AND recalled_at IS NULL ORDER BY seq LIMIT ?").all(roomID, take) as Array<{ id: string; seq: number }>)
|
|
540
|
+
.map((row) => ({ id: String(row.id), seq: Number(row.seq) }));
|
|
541
|
+
}
|
|
542
|
+
|
|
533
543
|
export async function countOpenQuestions(file: string, roomID: string): Promise<number> {
|
|
534
544
|
const db = await openStateDatabase(file);
|
|
535
545
|
const row = db.query("SELECT COUNT(*) AS count FROM messages WHERE room_id=? AND is_question=1 AND answered_by IS NULL AND recalled_at IS NULL").get(roomID) as { count: number };
|
|
@@ -578,7 +588,7 @@ export async function appendRoomMessage(file: string, roomID: string, sessionID:
|
|
|
578
588
|
});
|
|
579
589
|
}
|
|
580
590
|
|
|
581
|
-
export async function sendReply(file: string, roomID: string, targetID: string, sessionID: string, text: string, clientMessageID?: string): Promise<{ status: "ok"; message: Message; duplicate?: true } | { status: "missing" | "member" | "target" | "question" }> {
|
|
591
|
+
export async function sendReply(file: string, roomID: string, targetID: string, sessionID: string, text: string, clientMessageID?: string): Promise<{ status: "ok"; message: Message; duplicate?: true } | { status: "missing" | "member" | "target" | "recalled" | "question" }> {
|
|
582
592
|
const db = await openStateDatabase(file);
|
|
583
593
|
return immediate(db, () => {
|
|
584
594
|
if (!db.query("SELECT 1 FROM rooms WHERE id=?").get(roomID)) return { status: "missing" };
|
|
@@ -589,7 +599,8 @@ export async function sendReply(file: string, roomID: string, targetID: string,
|
|
|
589
599
|
if (existing) return { status: "ok", message: rowMessage(existing as Record<string, string | number | null>), duplicate: true };
|
|
590
600
|
}
|
|
591
601
|
const target = db.query("SELECT is_question,recalled_at FROM messages WHERE room_id=? AND id=?").get(roomID, targetID) as { is_question: number; recalled_at: number | null } | null;
|
|
592
|
-
if (!target
|
|
602
|
+
if (!target) return { status: "target" };
|
|
603
|
+
if (target.recalled_at !== null) return { status: "recalled" };
|
|
593
604
|
if (target.is_question) return { status: "question" };
|
|
594
605
|
const tail = db.query("SELECT created_at FROM messages WHERE room_id=? ORDER BY seq DESC LIMIT 1").get(roomID) as { created_at: number } | null;
|
|
595
606
|
const message: Message = { id: randomUUID(), roomId: roomID, senderId: member.kind === "direct" ? sessionID : member.name, senderSessionID: sessionID, text, createdAt: Math.max(Date.now(), (tail?.created_at ?? 0) + 1), answerToMessageID: targetID };
|
|
@@ -749,24 +760,44 @@ export async function readInboxPage(file: string, sessionID: string, roomFilter:
|
|
|
749
760
|
}).deferred();
|
|
750
761
|
}
|
|
751
762
|
|
|
752
|
-
|
|
763
|
+
const HISTORY_COLUMNS = "seq,id,room_id,sender_id,sender_session_id,text,created_at,is_question,answer_to,answered_by,recalled_at,recalled_by";
|
|
764
|
+
|
|
765
|
+
function historyRowMessage(row: Record<string, string | number | null>): HistoryMessage {
|
|
766
|
+
const message = rowMessage(row);
|
|
767
|
+
const recalledAt = row.recalled_at === null || row.recalled_at === undefined ? undefined : Number(row.recalled_at);
|
|
768
|
+
// Recalled rows keep their original text in storage for member reveal; history
|
|
769
|
+
// surfaces only a tombstone.
|
|
770
|
+
return { ...message, ...(recalledAt !== undefined ? { text: "", recalledAt, ...(row.recalled_by ? { recalledBy: String(row.recalled_by) } : {}) } : {}), seq: Number(row.seq) };
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
// afterSeq switches the page to ascending order, exclusive cursor semantics,
|
|
774
|
+
// for catch-up from a persisted seq. beforeSeq is ignored in that branch.
|
|
775
|
+
export async function readHistoryPage(file: string, roomID: string, beforeSeq?: number, limit = 100, excludeSessionID?: string, excludeName = "", afterSeq?: number): Promise<{ messages: HistoryMessage[]; nextBeforeSeq: number | null; hasMore: boolean; recallVersion: number }> {
|
|
753
776
|
const db = await openStateDatabase(file);
|
|
754
777
|
return db.transaction(() => {
|
|
755
778
|
const take = Math.min(200, Math.max(1, limit));
|
|
756
|
-
const
|
|
757
|
-
|
|
758
|
-
|
|
779
|
+
const exclude = `(? IS NULL OR (sender_session_id IS NOT NULL AND sender_session_id!=?) OR (sender_session_id IS NULL AND sender_id!=?))`;
|
|
780
|
+
if (afterSeq !== undefined) {
|
|
781
|
+
const rows = db.query(`SELECT ${HISTORY_COLUMNS} FROM messages WHERE room_id=? AND seq>? AND ${exclude} ORDER BY seq ASC LIMIT ?`)
|
|
782
|
+
.all(roomID, afterSeq, excludeSessionID ?? null, excludeSessionID ?? null, excludeName, take + 1) as Array<Record<string, string | number | null>>;
|
|
783
|
+
const hasMore = rows.length > take;
|
|
784
|
+
return { messages: rows.slice(0, take).map(historyRowMessage), nextBeforeSeq: null, hasMore, recallVersion: recallVersion(db, roomID) };
|
|
785
|
+
}
|
|
786
|
+
const rows = db.query(`SELECT ${HISTORY_COLUMNS} FROM messages WHERE room_id=? ${beforeSeq === undefined ? "" : "AND seq<? "}AND
|
|
787
|
+
${exclude} ORDER BY seq DESC LIMIT ?`).all(...(beforeSeq === undefined ? [roomID] : [roomID, beforeSeq]),
|
|
759
788
|
excludeSessionID ?? null, excludeSessionID ?? null, excludeName, take + 1) as Array<Record<string, string | number | null>>;
|
|
760
789
|
const hasMore = rows.length > take;
|
|
761
|
-
const messages = rows.slice(0, take).reverse().map(
|
|
762
|
-
const message = rowMessage(row);
|
|
763
|
-
const recalledAt = row.recalled_at === null || row.recalled_at === undefined ? undefined : Number(row.recalled_at);
|
|
764
|
-
return { ...message, ...(recalledAt !== undefined ? { text: "", recalledAt, ...(row.recalled_by ? { recalledBy: String(row.recalled_by) } : {}) } : {}), seq: Number(row.seq) };
|
|
765
|
-
});
|
|
790
|
+
const messages = rows.slice(0, take).reverse().map(historyRowMessage);
|
|
766
791
|
return { messages, nextBeforeSeq: hasMore ? messages[0]?.seq ?? null : null, hasMore, recallVersion: recallVersion(db, roomID) };
|
|
767
792
|
}).deferred();
|
|
768
793
|
}
|
|
769
794
|
|
|
795
|
+
export async function readMessage(file: string, roomID: string, messageID: string): Promise<HistoryMessage | undefined> {
|
|
796
|
+
const db = await openStateDatabase(file);
|
|
797
|
+
const row = db.query(`SELECT ${HISTORY_COLUMNS} FROM messages WHERE room_id=? AND id=?`).get(roomID, messageID) as Record<string, string | number | null> | null;
|
|
798
|
+
return row ? historyRowMessage(row) : undefined;
|
|
799
|
+
}
|
|
800
|
+
|
|
770
801
|
export async function readMessageReceipts(file: string, roomID: string, messageIDs?: string[]): Promise<MessageReceipt[] | undefined> {
|
|
771
802
|
const db = await openStateDatabase(file);
|
|
772
803
|
return db.transaction(() => {
|
package/src/state/store.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { Buffer } from "node:buffer";
|
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import os from "node:os";
|
|
7
7
|
import RoomService, { type Message, type Room } from "../rooms/room-service.ts";
|
|
8
|
-
import { acknowledgeQueued as sqliteAcknowledgeQueued, acknowledgeRead as sqliteAcknowledgeRead, answerQuestion as sqliteAnswerQuestion, appendRoomMessage as sqliteAppendRoomMessage, sendReply as sqliteSendReply, readHistoryPage, readInboxPage as sqliteInboxPage, readMessageReceipts, readQuestionExcerpt as sqliteQuestionExcerpt, readQuestions as sqliteReadQuestions, countOpenQuestions as sqliteCountOpenQuestions, readSqliteState, readUnreadPage, recallMessage as sqliteRecallMessage, revealMessageContent as sqliteRevealMessageContent, isMessageRecalled, recalledMessageIDs as sqliteRecalledMessageIDs, writeMessageReceipts, writePresenceState, writeSqliteState, type HistoryMessage, type JoinRequest, listJoinRequests as sqliteListJoinRequests, readJoinRequest as sqliteReadJoinRequest, type RecallMessageResult, type RevealMessageResult } from "./sqlite-state.ts";
|
|
8
|
+
import { acknowledgeQueued as sqliteAcknowledgeQueued, acknowledgeRead as sqliteAcknowledgeRead, answerQuestion as sqliteAnswerQuestion, appendRoomMessage as sqliteAppendRoomMessage, sendReply as sqliteSendReply, readHistoryPage, readMessage as sqliteReadMessage, readOpenQuestionRefs as sqliteReadOpenQuestionRefs, MAX_OPEN_QUESTION_REFS, readInboxPage as sqliteInboxPage, readMessageReceipts, readQuestionExcerpt as sqliteQuestionExcerpt, readQuestions as sqliteReadQuestions, countOpenQuestions as sqliteCountOpenQuestions, readSqliteState, readUnreadPage, recallMessage as sqliteRecallMessage, revealMessageContent as sqliteRevealMessageContent, isMessageRecalled, recalledMessageIDs as sqliteRecalledMessageIDs, writeMessageReceipts, writePresenceState, writeSqliteState, type HistoryMessage, type JoinRequest, listJoinRequests as sqliteListJoinRequests, readJoinRequest as sqliteReadJoinRequest, type RecallMessageResult, type RevealMessageResult } from "./sqlite-state.ts";
|
|
9
9
|
export type { JoinRequest, RecallMessageResult, RevealMessageResult } from "./sqlite-state.ts";
|
|
10
10
|
|
|
11
11
|
export function statePath(): string {
|
|
@@ -33,8 +33,14 @@ export async function readUnreadMessages(roomID: string, afterTs: number, limit
|
|
|
33
33
|
export async function readInboxMessages(sessionID: string, roomID: string | null, excludeSelf: boolean, limit = 100, afterTs?: number) {
|
|
34
34
|
return sqliteInboxPage(databasePath(), sessionID, roomID, excludeSelf, limit, afterTs);
|
|
35
35
|
}
|
|
36
|
-
export async function readHistory(roomID: string, beforeSeq?: number, limit = 100, exclude?: { sessionID: string; name: string }): Promise<{ messages: HistoryMessage[]; nextBeforeSeq: number | null; hasMore: boolean; recallVersion: number }> {
|
|
37
|
-
return readHistoryPage(databasePath(), roomID, beforeSeq, limit, exclude?.sessionID, exclude?.name);
|
|
36
|
+
export async function readHistory(roomID: string, beforeSeq?: number, limit = 100, exclude?: { sessionID: string; name: string }, afterSeq?: number): Promise<{ messages: HistoryMessage[]; nextBeforeSeq: number | null; hasMore: boolean; recallVersion: number }> {
|
|
37
|
+
return readHistoryPage(databasePath(), roomID, beforeSeq, limit, exclude?.sessionID, exclude?.name, afterSeq);
|
|
38
|
+
}
|
|
39
|
+
export async function readMessage(roomID: string, messageID: string): Promise<HistoryMessage | undefined> {
|
|
40
|
+
return sqliteReadMessage(databasePath(), roomID, messageID);
|
|
41
|
+
}
|
|
42
|
+
export async function readOpenQuestionRefs(roomID: string, limit = MAX_OPEN_QUESTION_REFS): Promise<Array<{ id: string; seq: number }>> {
|
|
43
|
+
return sqliteReadOpenQuestionRefs(databasePath(), roomID, limit);
|
|
38
44
|
}
|
|
39
45
|
export async function readQuestions(roomID: string): Promise<Message[]> { return sqliteReadQuestions(databasePath(), roomID); }
|
|
40
46
|
export async function countOpenQuestions(roomID: string): Promise<number> { return sqliteCountOpenQuestions(databasePath(), roomID); }
|
package/src/tui/http.mjs
CHANGED
|
@@ -87,10 +87,24 @@ export function createApi({ url, token, requestTimeoutMs = 10000 }) {
|
|
|
87
87
|
async leave(roomId, sessionID) {
|
|
88
88
|
await call(`${room(roomId)}/leave`, { method: "POST", body: { sessionID } });
|
|
89
89
|
},
|
|
90
|
-
async
|
|
90
|
+
async getMessage(roomId, messageId, sessionID) {
|
|
91
|
+
return (await call(`${room(roomId)}/messages/${encodeURIComponent(messageId)}?${query({ sessionID })}`)).data;
|
|
92
|
+
},
|
|
93
|
+
async catchUp(roomId, sessionID, { afterSeq, limit } = {}) {
|
|
94
|
+
const pageSize = limit === undefined ? undefined : Math.min(200, Math.max(1, Math.floor(limit)));
|
|
95
|
+
return (await call(`${room(roomId)}/catch-up?${query({ sessionID, afterSeq, limit: pageSize })}`)).data;
|
|
96
|
+
},
|
|
97
|
+
async send(roomId, sessionID, text, { replyToMessageID, parentMessageId, isQuestion, clientMessageID } = {}) {
|
|
91
98
|
return (await call(`${room(roomId)}/messages`, {
|
|
92
99
|
method: "POST",
|
|
93
|
-
body: {
|
|
100
|
+
body: {
|
|
101
|
+
sessionID,
|
|
102
|
+
text,
|
|
103
|
+
...(replyToMessageID ? { replyToMessageID } : {}),
|
|
104
|
+
...(parentMessageId ? { parentMessageId } : {}),
|
|
105
|
+
...(isQuestion ? { isQuestion: true } : {}),
|
|
106
|
+
...(clientMessageID ? { clientMessageID } : {}),
|
|
107
|
+
},
|
|
94
108
|
})).data;
|
|
95
109
|
},
|
|
96
110
|
async poll(roomId, sessionID, afterTs, { signal, timeoutMs = 20000 } = {}) {
|
package/src/tui/main.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import path from "node:path";
|
|
|
5
5
|
import { createApp } from "./app.mjs";
|
|
6
6
|
|
|
7
7
|
const NAME = "opencode-chat-room cli";
|
|
8
|
-
const FALLBACK_VERSION = "0.
|
|
8
|
+
const FALLBACK_VERSION = "0.8.0";
|
|
9
9
|
|
|
10
10
|
export const HELP = `opencode-chat-room cli - terminal client for a chat-room server
|
|
11
11
|
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
BSD 3-Clause License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2006, Ivan Sagalaev.
|
|
4
|
-
All rights reserved.
|
|
5
|
-
|
|
6
|
-
Redistribution and use in source and binary forms, with or without
|
|
7
|
-
modification, are permitted provided that the following conditions are met:
|
|
8
|
-
|
|
9
|
-
* Redistributions of source code must retain the above copyright notice, this
|
|
10
|
-
list of conditions and the following disclaimer.
|
|
11
|
-
|
|
12
|
-
* Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
-
this list of conditions and the following disclaimer in the documentation
|
|
14
|
-
and/or other materials provided with the distribution.
|
|
15
|
-
|
|
16
|
-
* Neither the name of the copyright holder nor the names of its
|
|
17
|
-
contributors may be used to endorse or promote products derived from
|
|
18
|
-
this software without specific prior written permission.
|
|
19
|
-
|
|
20
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|