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
2026-01-08 16:04:52 -08:00
committed by Peter Steinberger
parent 29e6f13b29
commit b4663ed11c
11 changed files with 475 additions and 12 deletions

View File

@@ -510,6 +510,14 @@ export function createClawdbotCodingTools(options?: {
sessionKey?: string;
agentDir?: string;
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 bashToolName = "bash";
const sandbox = options?.sandbox?.enabled ? options.sandbox : undefined;
@@ -580,6 +588,10 @@ export function createClawdbotCodingTools(options?: {
agentDir: options?.agentDir,
sandboxed: !!sandbox,
config: options?.config,
currentChannelId: options?.currentChannelId,
currentThreadTs: options?.currentThreadTs,
replyToMode: options?.replyToMode,
hasRepliedRef: options?.hasRepliedRef,
}),
];
const toolsFiltered = effectiveToolsPolicy