import type { ExtensionAPI } from "@earendil-works/pi-coding-agent"; import type { InboxMessage } from "./helpers.js"; import type { SlackResult } from "./slack-api.js"; export interface SlackToolsThreadContextPort { resolveThreadChannel: (threadTs: string | undefined) => Promise; noteThreadReply: (threadTs: string, channelId: string) => void; clearPendingAttention: (threadTs: string) => void; } export interface SlackPinetDeliveryInput { threadId: string; channel: string; text: string; blocks?: ReadonlyArray>; files?: ReadonlyArray<{ path: string; filename?: string; title?: string; filetype?: string; }>; } export interface SlackPinetDeliveryResult { adapter: string; messageId: number; threadId: string; channel: string; source: string; } export interface SlackPinetDeliveryPort { /** * True when Pinet is configured/enabled for this session, regardless of * live broker connectivity. When true, threaded Slack replies MUST route * through the broker; direct Slack fallback is refused even if the broker * is momentarily unavailable, to preserve broker-enforced thread * ownership (see gugu91/extensions#855). */ isEnabled: () => boolean; isAvailable: () => boolean; sendSlackMessage: (input: SlackPinetDeliveryInput) => Promise; } export interface RegisterSlackToolsDeps { getBotToken: () => string; getDefaultChannel: () => string | undefined; getSecurityPrompt: () => string; inbox: InboxMessage[]; slack: (method: string, token: string, body?: Record) => Promise; getAgentName: () => string; getAgentEmoji: () => string; getAgentOwnerToken: () => string; getLastDmChannel: () => string | null; updateBadge: () => void; resolveUser: (userId: string) => Promise; threadContext: SlackToolsThreadContextPort; resolveChannel: (nameOrId: string) => Promise; rememberChannel: (name: string, channelId: string) => void; requireToolPolicy: (toolName: string, threadTs: string | undefined, action: string) => void; registerConfirmationRequest: (threadTs: string, tool: string, action: string) => { status: "created" | "refreshed" | "conflict"; conflict?: { toolPattern: string; action: string; }; }; getBotUserId: () => string | null; pinetDelivery?: SlackPinetDeliveryPort; } export declare function registerSlackTools(pi: ExtensionAPI, deps: RegisterSlackToolsDeps): void;