/**
 * coach-session — D5 deep module (PRD-0006 v0.1.5).
 *
 * The "灵感/研究·策略 coach": a PERSISTED chat session (sidecar-backed, survives
 * reload — unlike the ephemeral `trends_` research sessions that intentionally
 * keep no history) whose agent wears a research/strategy persona rather than the
 * editing/delivery persona of the work-bound creative agent.
 *
 * Everything here is a PURE function over its inputs — no fs / no WsBridge — so
 * the honesty + cost-guardrail contracts are unit-testable in isolation (ADR-009
 * "pure core + thin shell"). The WsBridge wiring (sidecar persistence, spawn,
 * session-scoped model) lives in ws-bridge.ts and merely calls into this module.
 *
 * Cost guardrails baked into the contract:
 *   1. LAZY CONTEXT — `summarizeWorksForCoach` caps the works embedded in the
 *      system prompt to the top performers; the agent is told to ask for more
 *      rather than re-reading every work each turn.
 *   2. TOKEN BUDGET — `fitWorksToBudget` / `estimateTokens` keep the grounded
 *      prompt under `COACH_TOKEN_BUDGET`, so a large library can't blow up cost.
 *   3. READ-ONLY / ADVISORY — the persona prompt forbids destructive editing;
 *      the coach proposes topics, it doesn't mutate the user's works.
 *
 * Honesty constraint (PRD-0006): with thin data the prompt tells the agent to
 * SAY the sample is small and pivot to trend/interest grounding rather than
 * fabricate per-work statistical precision — and it never references metrics
 * AutoViral has never measured (retention / 完播 / hook-retention).
 */
/** Prefix that namespaces a persisted coach session, parallel to `trends_`. */
export declare const COACH_KEY_PREFIX = "coach_";
/** Mint the stable storage key for a coach session (e.g. "main" → "coach_main"). */
export declare function coachKeyFor(slug: string): string;
/** True iff `key` names a coach session (not a work id, not a trends_ key). */
export declare function isCoachKey(key: string): boolean;
/**
 * The coach's session-scoped default model alias. SESSION-scoped — distinct from
 * the global `config.model` the editing agent uses — so switching the coach's
 * tier never steals the editing agent's tier (the bug S6 fixes). A real alias,
 * never "" (which would fall back to whatever the global default happens to be).
 */
export declare const COACH_DEFAULT_MODEL = "sonnet";
/**
 * Per-session context-token budget for the coach's grounded system prompt.
 * Picked so the prompt stays cheap to send every turn; `fitWorksToBudget`
 * trims the works block to respect it.
 */
export declare const COACH_TOKEN_BUDGET = 4000;
/** How many works the prompt embeds by default (lazy — top performers only). */
export declare const COACH_DEFAULT_MAX_WORKS = 12;
/** Below this work count we treat the data as "thin" and pivot to trends/interests. */
export declare const COACH_THIN_DATA_THRESHOLD = 3;
/**
 * Cheap, dependency-free token estimate. Mixed CJK/latin text: CJK chars are
 * ~1 token each, latin runs ~¼ token/char. We approximate by counting CJK code
 * points at 1 token and the remaining characters at ~0.25 token, which is close
 * enough to gate the prompt size without pulling a real tokenizer into the
 * server. Monotonic in length, which is all the budget logic relies on.
 */
export declare function estimateTokens(text: string): number;
export interface CoachWorkInput {
    desc: string;
    playCount: number;
    diggCount: number;
    commentCount: number;
    shareCount: number;
    collectCount: number;
}
export interface WorksSummary {
    /** One human-readable line per (capped) work, top performers first. */
    lines: string[];
    /** True when more works existed than were embedded (lazy-loading cap hit). */
    truncated: boolean;
    /** True when the sample is too small to draw confident per-work conclusions. */
    thinData: boolean;
}
/**
 * Summarize the user's works for the coach prompt — LAZY: keeps only the top
 * `maxWorks` by play count so the prompt never embeds the full detail of every
 * work every turn. Flags `truncated` (cap hit) and `thinData` (too few works to
 * be confident). Real metrics only.
 */
export declare function summarizeWorksForCoach(works: CoachWorkInput[], opts?: {
    maxWorks?: number;
}): WorksSummary;
/**
 * Trim a works list so the joined descriptions fit within `budget` estimated
 * tokens — the token-budget half of the cost guardrail (complements the count
 * cap in `summarizeWorksForCoach`). Keeps the highest-play works first.
 */
export declare function fitWorksToBudget(works: CoachWorkInput[], budget: number): CoachWorkInput[];
export interface CoachContext {
    /** The platform the user is grounding against (e.g. "douyin"). */
    platform: string;
    /** The user's published works (frozen scrape) — may be empty. */
    works: CoachWorkInput[];
    /** Selected-platform trend topic titles (from the trends artifact). */
    trendTopics: string[];
    /** The user's configured content interests / niche. */
    interests: string[];
    /** Optional: cap embedded works (defaults to COACH_DEFAULT_MAX_WORKS). */
    maxWorks?: number;
    /** Optional token budget the works block must fit (defaults COACH_TOKEN_BUDGET). */
    tokenBudget?: number;
}
/**
 * Build the coach's research/strategy system prompt — PURE. Grounds in the
 * user's works + selected-platform trends + interests, enforces the
 * read-only/advisory + honest-about-thin-data contracts, and stays within the
 * token budget (works are first fit-to-budget, then summarized/capped).
 */
export declare function buildCoachSystemPrompt(ctx: CoachContext): string;
//# sourceMappingURL=coach-session.d.ts.map