/**
 * Public `agency.*` namespace — the canonical entry point for TS code
 * that wants to participate in an Agency run (read context, push
 * thread messages, install handlers, create checkpoints, etc.).
 *
 * Every method is a thin wrapper over an existing runtime function;
 * no new behavior is added here. The namespace exists for
 * discoverability and to give docs/IDEs a single surface to point at.
 *
 * Naming conventions:
 *  - No underscore prefix. Read APIs throw on missing frame by
 *    default; `*Maybe` variants return `undefined` instead.
 *    `callsite()` is the lone exception: callsite is intrinsically
 *    optional (bootstrap frames omit it) so it always returns
 *    `CallsiteLocation | undefined` even from inside a valid frame.
 *  - `with*` prefix for scope-installing helpers (run a callback with
 *    a temporary modification to the active frame).
 *  - Thread-related operations live under `agency.thread.*` to keep
 *    the top-level surface lean; e.g. `agency.thread.user("hi")` and
 *    `agency.thread.current()`.
 *  - Codegen-emitted internals (`getRuntimeContext`, `agencyStore`,
 *    `__threads`, `__stateStack`, `__call`, `__callMethod`,
 *    `runInTestContext`) keep their existing names and are still
 *    exported from `agency-lang/runtime` because generated code
 *    imports them directly. TS helper authors should prefer
 *    `agency.*`.
 */
import * as smoltalk from "smoltalk";
import { type CallsiteLocation } from "./asyncContext.js";
import { interrupt, type InterruptOpts } from "./agencyInterrupt.js";
import { llm as _llm } from "./agencyLlm.js";
import type { RestoreOptions } from "./errors.js";
import { withResumableScope as _withResumableScope, type ResumableScope, type ResumableScopeOpts } from "./resumableScope.js";
import type { Checkpoint } from "./state/checkpointStore.js";
import type { RuntimeContext } from "./state/context.js";
import type { StateStack } from "./state/stateStack.js";
import type { MessageThread } from "./state/messageThread.js";
import type { ThreadStore } from "./state/threadStore.js";
import type { HandlerFn } from "./types.js";
import type { MemoryConfig } from "./memory/types.js";
/** Plain record describing a thread in the run's registry. Slug-ified
 *  ids (`t0`, `t1`, ...) wrap the internal counter strings so LLMs see
 *  short, easy-to-quote identifiers. `label` and `summary` are
 *  surfaced directly from the underlying `MessageThread` (post-Commit-B:
 *  no more module-level TS cache). */
export type ThreadInfoTS = {
    id: string;
    parentId: string | null;
    threadType: "thread" | "subthread";
    messageCount: number;
    isActive: boolean;
    /** Snapshot of the thread's messages in smoltalk's wire format.
     *  Consumers that need flat `{role, content}` records can call
     *  `m.role` / `m.content` directly; tool-call / structured-content
     *  variants land here untouched (no lossy coercion). */
    messages: smoltalk.MessageJSON[];
    /** Optional user-supplied label from `thread(label: "...") { ... }`.
     *  `null` when no label was given. */
    label: string | null;
    /** Cached summary written by the stdlib's `summaryFor()` helper.
     *  `null` until the summary is computed (lazy on first
     *  `listThreads()`). */
    summary: string | null;
};
/**
 * Public `agency` namespace — the canonical entry point for TS code
 * that wants to participate in an Agency run. Users access everything
 * through `agency.<method>(...)`; there are no individual named
 * exports.
 */
export declare const agency: {
    ctx: () => RuntimeContext<any>;
    ctxMaybe: () => RuntimeContext<any> | undefined;
    callsite: () => CallsiteLocation | undefined;
    global: <T = unknown>(name: string, moduleId?: string) => T;
    thread: {
        current: () => MessageThread;
        user: (content: string) => void;
        system: (content: string) => void;
        assistant: (content: string) => void;
        store: () => ThreadStore;
        storeMaybe: () => ThreadStore | undefined;
        with: <T>(threadId: string, fn: () => T | Promise<T>) => Promise<T>;
    };
    checkpoint: () => Promise<number>;
    getCheckpoint: (id: number) => Checkpoint;
    restore: (idOrCp: number | Checkpoint, opts?: RestoreOptions) => void;
    withCallsite: <T>(loc: CallsiteLocation, fn: () => T) => T;
    withHandler: <T>(handler: HandlerFn, fn: () => Promise<T>) => Promise<T>;
    withCostGuard: <T>(maxCost: number, fn: () => Promise<T>) => Promise<T>;
    withTimeGuard: <T>(maxMs: number, fn: () => Promise<T>) => Promise<T>;
    addCost: (amount: number) => void;
    withResumableScope: typeof _withResumableScope;
    llm: typeof _llm;
    interrupt: typeof interrupt;
    memory: {
        enable: (config: MemoryConfig) => Promise<void>;
        disable: () => void;
        setId: (id: string) => Promise<void>;
        enabled: () => boolean;
        remember: (content: string) => Promise<void>;
        recall: (query: string) => Promise<string>;
        forget: (query: string) => Promise<void>;
    };
    threads: {
        list: () => ThreadInfoTS[];
        get: (id: string, offset?: number, limit?: number) => smoltalk.MessageJSON[];
        current: () => string | undefined;
    };
    withTestContext: <T>(args: {
        ctx: RuntimeContext<any>;
        stack: StateStack;
        threads: ThreadStore;
    }, fn: () => T) => T;
};
export type { InterruptOpts, ResumableScope, ResumableScopeOpts };
export type { MemoryConfig };
