export type MemoryType = 'user' | 'feedback' | 'project' | 'reference';
export declare const MEMORY_TYPES: readonly MemoryType[];
export interface MemoryEntrySummary {
    /** File slug, without the `.md` suffix. e.g., "user_role" or "feedback_tests". */
    id: string;
    /** Human display title pulled from frontmatter `name`. */
    name: string;
    /** One-line description pulled from frontmatter `description`. */
    description: string;
    /** Category — drives the filename prefix and the system-prompt section it lands in. */
    type: MemoryType;
    /** Unix milliseconds — file mtime. */
    updatedAt: number;
}
export interface MemoryEntry extends MemoryEntrySummary {
    /** Markdown body, frontmatter stripped. */
    body: string;
}
export interface MemoryListResponse {
    /** True when the daemon will inject memory into the next system prompt. */
    enabled: boolean;
    /** Absolute path to the memory directory (informational, for the settings UI). */
    rootDir: string;
    /** The MEMORY.md index body — usually a list of `- [Name](file.md) — hook` lines. */
    index: string;
    entries: MemoryEntrySummary[];
    /** User-supplied override for the LLM extraction provider. `null` when
     *  the daemon should auto-pick (env var → media-config fallback). API
     *  keys returned here are masked — only the last 4 characters are
     *  echoed back so the UI can show a "configured" affordance without
     *  leaking the secret into the DOM. */
    extraction: MemoryExtractionMaskedConfig | null;
}
/** Provider/protocol the memory extractor calls. Mirrors the chat
 *  BYOK form's protocols — anthropic + openai-compatible + azure
 *  (openai-compatible at a different URL/header) + google gemini +
 *  ollama (also openai-compatible, just hosted on Ollama Cloud) — so
 *  the memory picker can offer the same options as the chat picker
 *  above it. The daemon routes ollama through the same callOpenAI
 *  path since the wire protocol is identical. */
export type MemoryExtractionProvider = 'anthropic' | 'openai' | 'azure' | 'google' | 'ollama';
/** Masked version of MemoryExtractionConfig returned by GET endpoints —
 *  the api key field is replaced with a 4-char tail so the settings UI
 *  can render "•••• abcd" without echoing the secret back into the DOM. */
export interface MemoryExtractionMaskedConfig {
    provider: MemoryExtractionProvider;
    model: string;
    baseUrl: string;
    /** Azure-only: the `?api-version=…` query param value. Empty for the
     *  other providers. The daemon falls back to a sensible default when
     *  this is empty even on azure. */
    apiVersion: string;
    /** Last 4 chars of the configured key, or empty when unset. */
    apiKeyTail: string;
    /** True when an apiKey is stored in the override config. */
    apiKeyConfigured: boolean;
}
export interface MemoryEntryResponse {
    entry: MemoryEntry;
}
export interface UpsertMemoryRequest {
    /** Optional on create — daemon derives a slug from `type` + `name`. */
    id?: string;
    name: string;
    description: string;
    type: MemoryType;
    body: string;
}
export interface UpsertMemoryResponse {
    entry: MemoryEntry;
}
export interface UpdateMemoryIndexRequest {
    index: string;
}
export interface UpdateMemoryConfigRequest {
    enabled?: boolean;
    /** Pass `null` to clear the override and fall back to auto-pick. Pass an
     *  object to commit a custom provider. Omit to leave unchanged. */
    extraction?: MemoryExtractionConfig | null;
}
export interface MemoryConfigResponse {
    enabled: boolean;
    extraction: MemoryExtractionConfig | null;
}
export interface MemoryExtractionConfig {
    provider: MemoryExtractionProvider;
    /** Override model id. When empty, the daemon picks a provider default
     *  (`claude-haiku-4-5` for anthropic; `gpt-4o-mini` for openai/azure;
     *  `gemini-2.0-flash` for google). For azure this is the deployment
     *  name, not the underlying model family. */
    model?: string;
    /** Override base URL. When empty, the daemon uses the provider default
     *  (no default for azure — the user must supply their resource URL). */
    baseUrl?: string;
    /** Override API key. When empty, the daemon falls back to env vars and
     *  the media-config OpenAI key (openai provider only). */
    apiKey?: string;
    /** Azure-only: `?api-version=…` query string. Ignored for other providers. */
    apiVersion?: string;
}
export interface DeleteMemoryResponse {
    ok: true;
}
export interface ExtractMemoryRequest {
    userMessage: string;
    assistantMessage?: string;
    projectId?: string | null;
    conversationId?: string | null;
    /** BYOK chat config snapshot. The web app sends this with every
     *  BYOK / API-mode extraction call so the daemon can run LLM
     *  extraction against the *current* chat provider/key/baseUrl/
     *  apiVersion when no explicit memory model override is set —
     *  i.e. the picker is on "Same as chat". Without it the daemon's
     *  `pickProvider()` falls back to env vars or the media-config
     *  OpenAI key, which is wrong for BYOK chats whose creds the
     *  daemon never persists.
     *
     *  When the user has set an explicit memory model (override
     *  exists), the override always wins and this field is ignored.
     *  CLI-mode extraction calls leave this empty — the agent-id
     *  constrained branch in `pickProvider()` handles those.
     *
     *  An empty `apiKey` (or missing field) is treated as "no usable
     *  BYOK config" and falls through to the legacy provider chain so
     *  a half-configured BYOK form doesn't silently break extraction. */
    chatProvider?: {
        provider: MemoryExtractionProvider;
        apiKey?: string;
        baseUrl?: string;
        /** Azure-only `?api-version=…` value. Ignored for other providers. */
        apiVersion?: string;
        /** Optional — the daemon prefers a fast/cheap default per protocol
         *  (`claude-haiku-4-5` / `gpt-4o-mini` / etc.) over the chat model
         *  the user is paying for. Pass this only when the caller
         *  explicitly wants the same model used for both. */
        model?: string;
    };
}
export interface ExtractMemoryResponse {
    /** Entries created or updated by this extraction pass. Empty when the
     *  heuristic found nothing worth saving. */
    changed: MemoryEntrySummary[];
    /** True when the daemon also kicked off the background LLM extractor
     *  for this turn — i.e. the caller supplied both a non-empty
     *  `userMessage` and `assistantMessage`. The LLM extractor runs out
     *  of band; observe `MemoryExtractionEvent` on `/api/memory/events`
     *  for its result. */
    attemptedLLM?: boolean;
}
export interface MemorySystemPromptResponse {
    body: string;
}
export type MemoryChangeKind = 'upsert' | 'delete' | 'index' | 'config' | 'extract';
export interface MemoryChangeEvent {
    kind: MemoryChangeKind;
    /** Present on `upsert` and `delete`. */
    id?: string;
    /** Mirrored from the entry frontmatter on `upsert`. */
    name?: string;
    description?: string;
    type?: MemoryType;
    /** Number of entries written in this pass — only on `kind: 'extract'`. */
    count?: number;
    /** Where the change came from. Useful for UX (e.g., suppress toasts on
     *  manual edits since the user just clicked Save themselves). */
    source?: 'heuristic' | 'llm' | 'manual';
    /** Only on `kind: 'config'` — the new enabled flag. */
    enabled?: boolean;
    /** Unix milliseconds. */
    at: number;
}
/** Which extractor produced the attempt. `'llm'` is the legacy default
 *  for records written before this field existed. */
export type MemoryExtractionKind = 'heuristic' | 'llm';
export type MemoryExtractionPhase = 'running' | 'success' | 'skipped' | 'failed' | 'deleted' | 'cleared';
/** Why an attempt was skipped before any LLM call (or, for the regex
 *  extractor, before any pattern was tested). Surface this in the UI so
 *  the user can see "we'd run extraction but no API key is configured"
 *  instead of staring at a memory list that mysteriously stopped
 *  growing. `'no-match'` is heuristic-only — the regex ran but every
 *  pattern produced 0 captures. */
export type MemoryExtractionSkipReason = 'no-provider' | 'memory-disabled' | 'empty-message' | 'no-match';
export interface MemoryExtractionRecord {
    /** Stable id for the attempt. UUID-ish; safe to use as a React key. */
    id: string;
    /** Which extractor wrote this record. Optional for backwards compat
     *  with daemons that predate the heuristic surfacing — the UI treats
     *  a missing kind as `'llm'` since that was the only writer. */
    kind?: MemoryExtractionKind;
    /** Unix milliseconds — when the attempt was queued. */
    startedAt: number;
    /** Unix milliseconds — when the attempt reached a terminal phase. */
    finishedAt?: number;
    phase: MemoryExtractionPhase;
    /** Populated when phase === 'skipped'. */
    reason?: MemoryExtractionSkipReason;
    /** Provider+model resolved at attempt time. Absent when kind ===
     *  'heuristic' (the regex pack has no provider) or when the LLM
     *  attempt was skipped before provider selection. */
    provider?: {
        kind: MemoryExtractionProvider;
        model: string;
        /** Where the credential came from. `'memory-config'` = the explicit
         *  override under Settings → Memory; `'env'` = ANTHROPIC_API_KEY /
         *  OPENAI_API_KEY in the daemon's environment; `'media-config'` =
         *  the OpenAI key the user configured under Settings → Media
         *  providers; `'chat-byok'` = the live BYOK chat provider/key/
         *  baseUrl threaded through `/api/memory/extract` for "Same as
         *  chat" extraction in API mode. */
        credentialSource: 'memory-config' | 'env' | 'media-config' | 'chat-byok';
    };
    /** First ~120 chars of the user's message for display in the list. */
    userMessagePreview: string;
    /** How many entries the model proposed (after JSON parse + type filter).
     *  Heuristic records never set this — they go straight from match to write. */
    proposedCount?: number;
    /** How many entries actually landed on disk (proposed minus already-known dedupes). */
    writtenCount?: number;
    /** Slugs of entries written in this attempt — clickable in the UI. */
    writtenIds?: string[];
    /** Populated when phase === 'failed'. Single-line, ≤ 240 chars. */
    error?: string;
}
export interface MemoryExtractionsResponse {
    /** Most recent first. */
    extractions: MemoryExtractionRecord[];
}
export interface DeleteMemoryExtractionResponse {
    removed: number;
}
export interface MemoryExtractionEvent extends MemoryExtractionRecord {
}
//# sourceMappingURL=memory.d.ts.map