import { type Identity, type SlackDestination, type SlackActor, type SlackSource, type User } from "@sentry/junior-plugin-api"; import { z } from "zod"; import { type SchedulerStore } from "./store"; import type { ScheduledTask, ScheduledTaskConversationAccess, ScheduledTaskPrincipal, ScheduledTaskStatus } from "./types"; export interface SchedulerToolContext { actor?: SlackActor; now?: () => number; source?: SlackSource; store: SchedulerStore; users: { resolveActor(): Promise<{ identity: Identity; user?: User; } | undefined>; }; userText?: string; } export declare const MAX_LISTED_TASKS = 50; declare const compactTaskResultSchema: z.ZodObject<{ id: z.ZodString; status: z.ZodEnum<{ blocked: "blocked"; active: "active"; paused: "paused"; deleted: "deleted"; }>; task: z.ZodString; schedule: z.ZodString; timezone: z.ZodString; recurrence: z.ZodNullable; next_run_at: z.ZodNullable; conversation_access: z.ZodObject<{ audience: z.ZodEnum<{ direct: "direct"; group: "group"; channel: "channel"; }>; visibility: z.ZodEnum<{ public: "public"; private: "private"; }>; }, z.core.$strict>; credential_mode: z.ZodEnum<{ system: "system"; creator: "creator"; }>; last_run_at: z.ZodNullable; run_now_at: z.ZodNullable; }, z.core.$strict>; export declare const scheduleTaskToolResultSchema: z.ZodObject<{ truncated: z.ZodOptional; continuation: z.ZodOptional; reason: z.ZodOptional; }, z.core.$strict>>; target: z.ZodString; task: z.ZodObject<{ id: z.ZodString; status: z.ZodEnum<{ blocked: "blocked"; active: "active"; paused: "paused"; deleted: "deleted"; }>; task: z.ZodString; schedule: z.ZodString; timezone: z.ZodString; recurrence: z.ZodNullable; next_run_at: z.ZodNullable; conversation_access: z.ZodObject<{ audience: z.ZodEnum<{ direct: "direct"; group: "group"; channel: "channel"; }>; visibility: z.ZodEnum<{ public: "public"; private: "private"; }>; }, z.core.$strict>; credential_mode: z.ZodEnum<{ system: "system"; creator: "creator"; }>; last_run_at: z.ZodNullable; run_now_at: z.ZodNullable; }, z.core.$strict>; }, z.core.$loose>; export declare const scheduleListToolResultSchema: z.ZodObject<{ continuation: z.ZodOptional; reason: z.ZodOptional; }, z.core.$strict>>; target: z.ZodString; tasks: z.ZodArray; task: z.ZodString; schedule: z.ZodString; timezone: z.ZodString; recurrence: z.ZodNullable; next_run_at: z.ZodNullable; conversation_access: z.ZodObject<{ audience: z.ZodEnum<{ direct: "direct"; group: "group"; channel: "channel"; }>; visibility: z.ZodEnum<{ public: "public"; private: "private"; }>; }, z.core.$strict>; credential_mode: z.ZodEnum<{ system: "system"; creator: "creator"; }>; last_run_at: z.ZodNullable; run_now_at: z.ZodNullable; }, z.core.$strict>>; truncated: z.ZodBoolean; }, z.core.$loose>; export type CompactTaskResult = z.output; /** Normalize scheduler validation failures into the plugin tool error contract. */ export declare function throwToolInputError(error: string): never; /** Require scheduler mutations to stay scoped to the active Slack conversation. */ export declare function requireActiveConversation(context: SchedulerToolContext): SlackDestination; /** Require a concrete Slack actor before creating scheduler ownership state. */ export declare function requireActor(context: SchedulerToolContext, destination: SlackDestination): ScheduledTaskPrincipal; /** Preserve the active destination's ingress-confirmed access classification. */ export declare function getConversationAccess(destination: SlackDestination, source: SlackSource | undefined): ScheduledTaskConversationAccess; /** Keep scheduler management operations bound to the task's original Slack destination. */ export declare function sameDestination(task: ScheduledTask, destination: SlackDestination): boolean; /** Look up a mutable task only after enforcing active-conversation ownership. */ export declare function getWritableTask(args: { context: SchedulerToolContext; taskId: string; }): Promise; /** Project scheduled task state into the stable model-facing result shape. */ export declare function compactTask(task: ScheduledTask): CompactTaskResult; /** Build the structured result shared by single-task scheduler tools. */ export declare function scheduleTaskToolResult(target: string, task: CompactTaskResult): { readonly target: string; readonly task: { id: string; status: "blocked" | "active" | "paused" | "deleted"; task: string; schedule: string; timezone: string; recurrence: unknown; next_run_at: string | null; conversation_access: { audience: "direct" | "group" | "channel"; visibility: "public" | "private"; }; credential_mode: "system" | "creator"; last_run_at: string | null; run_now_at: string | null; }; }; /** Build the structured result for listing scheduler tools. */ export declare function scheduleListToolResult(args: { target: string; tasks: CompactTaskResult[]; truncated: boolean; }): { readonly target: string; readonly tasks: { id: string; status: "blocked" | "active" | "paused" | "deleted"; task: string; schedule: string; timezone: string; recurrence: unknown; next_run_at: string | null; conversation_access: { audience: "direct" | "group" | "channel"; visibility: "public" | "private"; }; credential_mode: "system" | "creator"; last_run_at: string | null; run_now_at: string | null; }[]; readonly truncated: boolean; }; /** Build a retry-stable scheduler id scoped to the creating actor and destination. */ export declare function buildTaskId(args: { actor: ScheduledTaskPrincipal; destination: SlackDestination; toolCallId: string | undefined; }): string; /** Keep concrete scheduler tools coupled to the injected store, not global state. */ export declare function schedulerStore(context: SchedulerToolContext): SchedulerStore; /** Accept only persisted scheduler statuses from model-facing update input. */ export declare function normalizeStatus(value: string | undefined): ScheduledTaskStatus | undefined; /** Centralize scheduler timezone defaulting for all concrete tool entry points. */ export declare function getDefaultScheduleTimezone(): string; export {};