diff --git a/.gitignore b/.gitignore index fed1a61..5366b57 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,6 @@ docs/ # Claude Code project settings .claude/ + +# macOS +.DS_Store diff --git a/lambda/slack-processor/index.ts b/lambda/slack-processor/index.ts index 519efc3..e578b18 100644 --- a/lambda/slack-processor/index.ts +++ b/lambda/slack-processor/index.ts @@ -173,12 +173,14 @@ export const handler = async (event: ProcessorEvent): Promise => { resolveSessionId(userId), ]); - // Post placeholder immediately so the user sees a response while the agent thinks + // In channels, reply in a thread; in DMs, reply flat (no thread_ts) + const replyThreadTs = eventType === 'app_mention' ? (threadTs ?? ts) : threadTs; + const placeholderTs = await postToSlack( credentials.botToken, channelId, '_Alex is thinking..._', - threadTs ?? ts, + replyThreadTs, ); let answer: string; diff --git a/services/socket-mode/src/index.ts b/services/socket-mode/src/index.ts index 59e3265..bbb7fc4 100644 --- a/services/socket-mode/src/index.ts +++ b/services/socket-mode/src/index.ts @@ -36,6 +36,7 @@ async function main(): Promise { if (event.bot_id || event.subtype) return; if (event.channel_type !== 'im') return; + console.log('Processing DM from', event.user); await invokeProcessor({ userId: event.user, channelId: event.channel, @@ -51,6 +52,7 @@ async function main(): Promise { const text = (event.text ?? '').replace(/^<@[A-Z0-9]+>\s*/, ''); + console.log('Processing @mention from', event.user, 'in', event.channel); await invokeProcessor({ userId: event.user, channelId: event.channel,