/** * useAgentEdit Hook * * Manages agent edit sessions for a specific agent. * Provides methods to check permissions, start, complete, and abort edits. */ import type { AgentEditPermission, AgentEditSession, AgentTrigger } from '@pantheon-systems/css-client'; /** * Parameters for starting or checking an edit. */ export interface AgentEditParams { /** Trigger type */ trigger: AgentTrigger; /** Intent description */ intent: string; /** Target regions to edit */ targetRegions: string[]; /** User who requested the edit (for human_requested trigger) */ requestedById?: string; } /** * Options for useAgentEdit hook. */ export interface UseAgentEditOptions { /** Agent ID to use for operations */ agentId: string; /** Callback when edit permission is denied */ onDenied?: (reason: string, conflictingRegions?: string[]) => void; /** Callback when edit completes successfully */ onComplete?: (checkpointId: string) => void; /** Callback when edit is aborted */ onAborted?: () => void; } /** * Return value of useAgentEdit hook. */ export interface UseAgentEditReturn { /** Check if agent can edit specified regions */ canEdit: (params: AgentEditParams) => Promise; /** Start an edit session */ startEdit: (params: AgentEditParams) => Promise; /** Complete the current edit session */ completeEdit: () => Promise; /** Abort the current edit session */ abortEdit: () => Promise; /** Current session info */ session: AgentEditSession | null; /** * Current session ID for agent authorization. * Convenience property - same as session?.sessionId ?? null. * Use this to pass to realtime client or REST API calls. */ sessionId: string | null; /** Whether an edit session is active */ isEditing: boolean; /** Loading state */ isLoading: boolean; /** Error state */ error: Error | null; } /** * Hook for managing agent edit sessions. * * @param options - Hook options including agentId and callbacks * @returns Methods and state for managing agent edits */ export declare function useAgentEdit(options: UseAgentEditOptions): UseAgentEditReturn;