Slack: implement replyToMode threading for tool path

- Add shared hasRepliedRef state between auto-reply and tool paths
- Extract buildSlackThreadingContext helper in agent-runner.ts
- Extract resolveThreadTsFromContext helper in slack-actions.ts
- Update docs with clear replyToMode table (off/first/all)
- Add tests for first mode behavior across multiple messages
This commit is contained in:
Austin Mudd authored and Peter Steinberger committed 2026-01-09 21:59:51 +01:00
1 parent 29e6f13b29
commit b4663ed11c
11 files changed
+475 -12

No files matched your search

+12
View File
@@ -22,6 +22,14 @@ export function createClawdbotTools(options?: {
agentDir?: string;
sandboxed?: boolean;
config?: ClawdbotConfig;
/** Current channel ID for auto-threading (Slack). */
currentChannelId?: string;
/** Current thread timestamp for auto-threading (Slack). */
currentThreadTs?: string;
/** Reply-to mode for Slack auto-threading. */
replyToMode?: "off" | "first" | "all";
/** Mutable ref to track if a reply was sent (for "first" mode). */
hasRepliedRef?: { value: boolean };
}): AnyAgentTool[] {
const imageTool = createImageTool({
config: options?.config,
@@ -35,6 +43,10 @@ export function createClawdbotTools(options?: {
createMessageTool({
agentAccountId: options?.agentAccountId,
config: options?.config,
currentChannelId: options?.currentChannelId,
currentThreadTs: options?.currentThreadTs,
replyToMode: options?.replyToMode,
hasRepliedRef: options?.hasRepliedRef,
}),
createGatewayTool({
agentSessionKey: options?.agentSessionKey,