import type { Skill } from "@mariozechner/pi-coding-agent";
import type { ChatType } from "../../channels/chat-type.js";
import type { ChannelId } from "../../channels/plugins/types.js";
import type { DeliveryContext } from "../../utils/delivery-context.js";
export type SessionScope = "per-sender" | "global";
export type SessionChannelId = ChannelId | "webchat";
export type SessionChatType = ChatType;
export type SessionOrigin = {
    label?: string;
    provider?: string;
    surface?: string;
    chatType?: SessionChatType;
    from?: string;
    to?: string;
    accountId?: string;
    threadId?: string | number;
};
export type SessionEntry = {
    sessionId: string;
    updatedAt: number;
    sessionFile?: string;
    /** Parent session key that spawned this session (used for sandbox session-tool scoping). */
    spawnedBy?: string;
    /** Subagent spawn depth (0 = main, 1 = sub-agent, 2 = sub-sub-agent). */
    spawnDepth?: number;
    systemSent?: boolean;
    abortedLastRun?: boolean;
    chatType?: SessionChatType;
    thinkingLevel?: string;
    verboseLevel?: string;
    reasoningLevel?: string;
    elevatedLevel?: string;
    execHost?: string;
    execSecurity?: string;
    execAsk?: string;
    execNode?: string;
    responseUsage?: "on" | "off" | "tokens" | "full";
    providerOverride?: string;
    modelOverride?: string;
    authProfileOverride?: string;
    authProfileOverrideSource?: "auto" | "user";
    authProfileOverrideCompactionCount?: number;
    groupActivation?: "mention" | "always";
    groupActivationNeedsSystemIntro?: boolean;
    sendPolicy?: "allow" | "deny";
    queueMode?: "steer" | "followup" | "collect" | "steer-backlog" | "steer+backlog" | "queue" | "interrupt";
    queueDebounceMs?: number;
    queueCap?: number;
    queueDrop?: "old" | "new" | "summarize";
    inputTokens?: number;
    outputTokens?: number;
    totalTokens?: number;
    /**
     * Whether totalTokens reflects a fresh context snapshot for the latest run.
     * Undefined means legacy/unknown freshness; false forces consumers to treat
     * totalTokens as stale/unknown for context-utilization displays.
     */
    totalTokensFresh?: boolean;
    cacheRead?: number;
    cacheWrite?: number;
    modelProvider?: string;
    model?: string;
    /**
     * Last selected/runtime model pair for which a fallback notice was emitted.
     * Used to avoid repeating the same fallback notice every turn.
     */
    fallbackNoticeSelectedModel?: string;
    fallbackNoticeActiveModel?: string;
    fallbackNoticeReason?: string;
    contextTokens?: number;
    compactionCount?: number;
    /**
     * Phase 18 — when set, the session has hit a hard boundary (context
     * overflow, role-ordering error). Subsequent turns are short-circuited
     * with a friendly "start a new session" message; the full transcript
     * stays on disk and is browsable in history.
     */
    endedReason?: "context_overflow";
    /**
     * Phase 18 — set once the soft context-warning has been surfaced to
     * the user (at ~85% of context window). Prevents the warning from
     * firing on every subsequent turn in the same session.
     */
    contextWarningSent?: boolean;
    cliSessionIds?: Record<string, string>;
    claudeCliSessionId?: string;
    label?: string;
    displayName?: string;
    channel?: string;
    groupId?: string;
    subject?: string;
    groupChannel?: string;
    space?: string;
    origin?: SessionOrigin;
    deliveryContext?: DeliveryContext;
    lastChannel?: SessionChannelId;
    lastTo?: string;
    lastAccountId?: string;
    lastThreadId?: string | number;
    skillsSnapshot?: SessionSkillSnapshot;
    systemPromptReport?: SessionSystemPromptReport;
};
export declare function mergeSessionEntry(existing: SessionEntry | undefined, patch: Partial<SessionEntry>): SessionEntry;
export declare function resolveFreshSessionTotalTokens(entry?: Pick<SessionEntry, "totalTokens" | "totalTokensFresh"> | null): number | undefined;
export declare function isSessionTotalTokensFresh(entry?: Pick<SessionEntry, "totalTokens" | "totalTokensFresh"> | null): boolean;
export type GroupKeyResolution = {
    key: string;
    channel?: string;
    id?: string;
    chatType?: SessionChatType;
};
export type SessionSkillSnapshot = {
    prompt: string;
    skills: Array<{
        name: string;
        primaryEnv?: string;
        requiredEnv?: string[];
    }>;
    /** Normalized agent-level filter used to build this snapshot; undefined means unrestricted. */
    skillFilter?: string[];
    resolvedSkills?: Skill[];
    version?: number;
};
export type SessionSystemPromptReport = {
    source: "run" | "estimate";
    generatedAt: number;
    sessionId?: string;
    sessionKey?: string;
    provider?: string;
    model?: string;
    workspaceDir?: string;
    bootstrapMaxChars?: number;
    bootstrapTotalMaxChars?: number;
    sandbox?: {
        mode?: string;
        sandboxed?: boolean;
    };
    systemPrompt: {
        chars: number;
        projectContextChars: number;
        nonProjectContextChars: number;
    };
    injectedWorkspaceFiles: Array<{
        name: string;
        path: string;
        missing: boolean;
        rawChars: number;
        injectedChars: number;
        truncated: boolean;
    }>;
    skills: {
        promptChars: number;
        entries: Array<{
            name: string;
            blockChars: number;
        }>;
    };
    tools: {
        listChars: number;
        schemaChars: number;
        entries: Array<{
            name: string;
            summaryChars: number;
            schemaChars: number;
            propertiesCount?: number | null;
        }>;
    };
};
export declare const DEFAULT_RESET_TRIGGER = "/new";
export declare const DEFAULT_RESET_TRIGGERS: string[];
export declare const DEFAULT_IDLE_MINUTES = 60;
