mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
d85abb781d
## What Replaces the homemade animated `⏳` "thinking" placeholder (a posted message whose dots cycled via `setInterval`) with Slack's **native** `assistant.threads.setStatus` "is thinking…" indicator — and generalizes it from assistant-pane-only to **every thread-anchored reply**: channel @-mentions, channel threads, DMs, and the pane. ## Why The hourglass was an extra post-then-delete message that looked nothing like the native loading state other Slack agents show. Slack has since relaxed `assistant.threads.setStatus` to accept the ordinary **`chat:write`** scope (not just `assistant:write`), specifically so channel-based apps can show AI loading states in channels and DMs ([docs](https://docs.slack.dev/reference/methods/assistant.threads.setStatus/)). The adapter already used `setStatus` for the pane — this just extends it everywhere and deletes the placeholder. ## How - **`event-renderer.ts`** — delete the hourglass machinery (`startThinking`/`claimThinking`/`clearThinking`/`setInterval`); generalize `setPaneStatus`/`clearPaneStatus` → `setStatus`/`clearStatus`. New `status?: { threadTs, isPane, config }` arg: `statusMode` drives the thinking indicator; `isPane` only selects tool-progress surface (pane composer status vs `task_update` timeline / `🔧` rows — both unchanged). - **`adapter.ts`** — `createRunRenderer` builds `status` for any target with a thread anchor (`threadTs ?? statusTs`); `assistant: false` opts out everywhere. - **`types.ts` / `slack-listener.ts`** — flat DMs (no `thread_ts`) carry the inbound message `ts` as the status anchor; replies still post flat. - **README** — document the broadened status + the `chat:write` relaxation. ## Testing - `nx run-many -t test build` for `bot-slack` — **248 tests pass**, build clean, oxlint 0 errors, oxfmt clean. - New tests cover non-pane channel-thread status, the `🔧` tool path staying on non-pane, and the DM `statusTs` anchor. - Net **−149 lines**. > Note: the DM path anchors `setStatus` to a non-assistant DM message ts — the one piece only verifiable against the live Slack API. Channel @-mentions already carry a real `thread_ts`.