mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-21 21:03:56 +00:00
mom: Thread-based tool details, improved README, fixed message ordering
This commit is contained in:
parent
f53e4fba42
commit
30964e0c33
3 changed files with 224 additions and 5 deletions
|
|
@ -16,9 +16,11 @@ export interface SlackMessage {
|
|||
export interface SlackContext {
|
||||
message: SlackMessage;
|
||||
store: ChannelStore;
|
||||
/** Send a new message */
|
||||
/** Send/update the main message (accumulates text) */
|
||||
respond(text: string): Promise<void>;
|
||||
/** Show/hide typing indicator. If text is provided to respond() after setTyping(true), it updates the typing message instead of posting new. */
|
||||
/** Post a message in the thread under the main message (for verbose details) */
|
||||
respondInThread(text: string): Promise<void>;
|
||||
/** Show/hide typing indicator */
|
||||
setTyping(isTyping: boolean): Promise<void>;
|
||||
/** Upload a file to the channel */
|
||||
uploadFile(filePath: string, title?: string): Promise<void>;
|
||||
|
|
@ -227,6 +229,22 @@ export class MomBot {
|
|||
|
||||
await updatePromise;
|
||||
},
|
||||
respondInThread: async (threadText: string) => {
|
||||
// Queue thread posts to maintain order
|
||||
updatePromise = updatePromise.then(async () => {
|
||||
if (!messageTs) {
|
||||
// No main message yet, just skip
|
||||
return;
|
||||
}
|
||||
// Post in thread under the main message
|
||||
await this.webClient.chat.postMessage({
|
||||
channel: event.channel,
|
||||
thread_ts: messageTs,
|
||||
text: threadText,
|
||||
});
|
||||
});
|
||||
await updatePromise;
|
||||
},
|
||||
setTyping: async (isTyping: boolean) => {
|
||||
if (isTyping && !messageTs) {
|
||||
// Post initial "thinking" message
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue