"use client";
import { useCallback } from "react";
import { useStigmer } from "../hooks";
import { useResourceList } from "../search";
/**
 * Data hook that fetches a paginated list of agents for the Library.
 *
 * Wraps `stigmer.agent.list()` with pagination, scope filtering,
 * and text search. All parameters are externally controlled — the
 * consumer manages page state, query debouncing, and scope toggling.
 *
 * For picker/type-ahead search with internal debouncing and query
 * state management, use {@link useAgentSearch} instead.
 *
 * Pass `null` as `org` to skip fetching (stable no-op).
 *
 * @example
 * ```tsx
 * const { agents, totalCount, isLoading } = useAgentList("acme", {
 *   page: 1,
 *   pageSize: 20,
 *   scope: "org",
 * });
 * ```
 *
 * @example
 * ```tsx
 * // Show all agents including public/platform ones
 * const { agents } = useAgentList("acme", { scope: "all" });
 * ```
 */
export function useAgentList(org, options) {
    const stigmer = useStigmer();
    const listFn = useCallback((params) => stigmer.agent.list(params), [stigmer]);
    const { entries, totalCount, totalPages, currentPage, isLoading, error, refetch } = useResourceList(listFn, org, options);
    return { agents: entries, totalCount, totalPages, currentPage, isLoading, error, refetch };
}
//# sourceMappingURL=useAgentList.js.map