import { type McpServerUsageInput, type ResourceRef } from "@stigmer/sdk";
import type { AgentResolution } from "../agent";
import { type HarnessOption } from "../models/harness";
import { type UseWorkspaceEntriesReturn } from "../workspace";
import { type UseSessionVariablesReturn } from "../execution/useSessionVariables";
import type { SessionComposerSubmitContext } from "../composer";
/** Options for {@link useNewSessionFlow}. */
export interface UseNewSessionFlowOptions {
    /** Organization slug. Required for session and execution creation. */
    readonly org: string;
    /**
     * Called after a session and its first execution are created successfully.
     * The consumer is responsible for navigation (e.g. `router.push`).
     */
    readonly onSessionCreated: (sessionId: string) => void;
    /**
     * Called when an error occurs during session creation.
     * The consumer can use this for toast notifications or other UI feedback.
     * If not provided, errors are still available via {@link UseNewSessionFlowReturn.submitError}.
     */
    readonly onError?: (message: string) => void;
}
/** Return value of {@link useNewSessionFlow}. */
export interface UseNewSessionFlowReturn {
    /** Currently selected harness (persisted to localStorage). */
    readonly harness: HarnessOption;
    /** Switch the harness. Resets the model if invalid for the new harness. */
    readonly setHarness: (harness: HarnessOption) => void;
    /** Currently selected model ID (persisted per-harness to localStorage). */
    readonly modelId: string | undefined;
    /** Update the selected model. Automatically persists to localStorage. */
    readonly setModelId: (id: string) => void;
    /** Currently selected agent reference, or `null` for the default agent. */
    readonly agentRef: ResourceRef | null;
    /** Update the selected agent reference. */
    readonly setAgentRef: (ref: ResourceRef | null) => void;
    /** Current agent resolution state (saved instance vs direct reference). */
    readonly resolution: AgentResolution | null;
    /** Update the agent resolution. */
    readonly setResolution: (r: AgentResolution | null) => void;
    /** Active MCP server configurations. */
    readonly mcpServerUsages: McpServerUsageInput[];
    /** Update MCP server configurations. */
    readonly setMcpServerUsages: (usages: McpServerUsageInput[]) => void;
    /** Active skill references. */
    readonly skillRefs: ResourceRef[];
    /** Update skill references. */
    readonly setSkillRefs: (refs: ResourceRef[]) => void;
    /** Selected runner ID, or `null` for auto-selection. */
    readonly runnerId: string | null;
    /** Update the selected runner. */
    readonly setRunnerId: (id: string | null) => void;
    /** Workspace entries manager (git repos and local paths). */
    readonly workspace: UseWorkspaceEntriesReturn;
    /** Session variables (per-execution secrets) manager. */
    readonly sessionVariables: UseSessionVariablesReturn;
    /** `true` while the create session + execution flow is in flight. */
    readonly isSubmitting: boolean;
    /** Human-readable error from the last failed submission, or `null`. */
    readonly submitError: string | null;
    /**
     * Create a session with the first execution.
     *
     * Composes all managed state (agent, workspace, MCP servers, skills,
     * runner, model, session variables) into the session and execution
     * creation RPCs, then calls `onSessionCreated` on success.
     *
     * The `model` parameter overrides `modelId` for this submission only
     * (used when SessionComposer passes a per-message model selection).
     */
    readonly submit: (message: string, model?: string, context?: SessionComposerSubmitContext) => Promise<void>;
}
/**
 * Orchestrates the "create a new session" flow.
 *
 * Manages all the state required to configure and submit a new session:
 * model selection (with localStorage persistence), agent resolution,
 * MCP server/skill/runner selection, workspace entries, and session
 * variables. On submission, creates the session and its first execution
 * in sequence, then notifies the consumer via `onSessionCreated`.
 *
 * This hook is framework-agnostic — it works identically in Next.js,
 * Vite, Tauri, or any React environment. Navigation, toast notifications,
 * and draft-mode logic are the consumer's responsibility.
 *
 * @example
 * ```tsx
 * const flow = useNewSessionFlow({
 *   org: "acme",
 *   onSessionCreated: (id) => navigate(`/sessions/${id}`),
 *   onError: (msg) => toast.error(msg),
 * });
 *
 * <SessionComposer
 *   onSubmit={flow.submit}
 *   isSubmitting={flow.isSubmitting}
 *   org="acme"
 *   workspace={flow.workspace}
 *   agentRef={flow.agentRef}
 *   onAgentRefChange={flow.setAgentRef}
 *   onAgentResolutionChange={flow.setResolution}
 *   mcpServerUsages={flow.mcpServerUsages}
 *   onMcpServerUsagesChange={flow.setMcpServerUsages}
 *   skillRefs={flow.skillRefs}
 *   onSkillRefsChange={flow.setSkillRefs}
 *   runnerId={flow.runnerId}
 *   onRunnerIdChange={flow.setRunnerId}
 *   sessionVariables={flow.sessionVariables}
 *   defaultModelId={flow.modelId}
 *   onModelChange={flow.setModelId}
 * />
 * ```
 */
export declare function useNewSessionFlow(options: UseNewSessionFlowOptions): UseNewSessionFlowReturn;
//# sourceMappingURL=useNewSessionFlow.d.ts.map