/**
 * `CrewManifest` — the team configuration service.
 *
 * A crew is the cast of teammate agents the swarm runs with: who is on it, what
 * role each plays, which model backs them, and which slice of the tool surface
 * they are trusted with. This module persists that roster and nothing else. It
 * is a deliberately thin wrapper over {@link JsonCell}: every read and write
 * goes through the kernel's lock + atomic-publish + schema-validate machinery,
 * so this file never touches `node:fs` locking, temp-file renames, or
 * hand-rolled coercion. It only owns the *shape* of a crew and the small set of
 * roster edits a caller is allowed to make.
 *
 * The persisted document is a single {@link CrewRecord}:
 *
 *   { crewId; members: CrewMember[]; createdAt }
 *
 * Each {@link CrewMember} names a role and optionally pins a model and a tool
 * collection. A member that leaves its `model` unset defers to the
 * {@link ModelPolicy} table, which maps a role to its default model — so the
 * common case ("the reviewer always runs on the heavy model") lives in one
 * place rather than being repeated at every `addMember` call site.
 *
 * Surface:
 *   - {@link CrewManifest.create}      — mint an empty crew (idempotent-friendly).
 *   - {@link CrewManifest.addMember}   — enroll a teammate; rejects duplicate ids.
 *   - {@link CrewManifest.removeMember}— dismiss a teammate by id.
 *   - {@link CrewManifest.get}         — the whole crew record.
 *   - {@link CrewManifest.members}     — just the roster array.
 *
 * Concurrency, durability, and validation are inherited wholesale from
 * {@link JsonCell}; the methods here are pure transforms handed to
 * `cell.mutate`, so two processes editing the same manifest serialize correctly
 * with zero lost updates.
 */
/**
 * The tool surface a teammate is trusted with, mirroring the named collections
 * the capabilities layer publishes:
 *   - `read-only` — observe the workspace and the web; never mutate.
 *   - `coding`    — read-only plus write/edit/bash/todo/process.
 *   - `all`       — every registered tool.
 *
 * Kept as a local literal union (not an import of the capabilities type) so the
 * roster schema stays self-contained and zod can validate against it directly;
 * the three names are intentionally identical to the capabilities collections.
 */
export type CrewToolCollection = "read-only" | "coding" | "all";
/**
 * One teammate on the crew.
 *
 * `id` is the stable handle other services address the member by. `role` is the
 * functional slot (`planner`, `coder`, `reviewer`, …) the {@link ModelPolicy}
 * keys off. `model` and `toolCollection` are optional overrides; when omitted,
 * the resolver and the host's defaults fill them in.
 */
export interface CrewMember {
    /** Stable member handle, unique within a crew. */
    readonly id: string;
    /** The functional role this member fills (drives model defaulting). */
    readonly role: string;
    /** Pinned model id; when absent, {@link ModelPolicy} supplies one for the role. */
    readonly model?: string;
    /** The tool slice this member may call; when absent, the host decides. */
    readonly toolCollection?: CrewToolCollection;
}
/**
 * The persisted crew document — exactly what lives in the manifest cell.
 *
 * `crewId` identifies the crew, `createdAt` is its birth time (epoch ms), and
 * `members` is the ordered roster. The order is enrollment order and is
 * preserved across edits.
 */
export interface CrewRecord {
    /** Identifier for this crew. */
    readonly crewId: string;
    /** The roster, in enrollment order. */
    readonly members: readonly CrewMember[];
    /** Crew creation time, epoch milliseconds. */
    readonly createdAt: number;
}
/** Inputs accepted when enrolling a member; the id may be left for us to mint. */
export interface MemberDraft {
    /** Optional explicit id; when omitted a fresh `mbr_…` id is minted. */
    readonly id?: string;
    /** The member's role (required — it drives model defaulting). */
    readonly role: string;
    /** Optional pinned model id. */
    readonly model?: string;
    /** Optional tool collection. */
    readonly toolCollection?: CrewToolCollection;
}
/**
 * Per-role model selection, expressed as a small lookup table.
 *
 * A crew member may pin its own `model`; when it does not, the role decides.
 * This resolver holds the role→model table and answers {@link ModelPolicy.for}:
 * "given a member, which model should it actually run on?" The precedence is
 * deliberate and total:
 *
 *   1. an explicit `member.model`, if present;
 *   2. otherwise the table entry for `member.role`;
 *   3. otherwise the configured `fallback`.
 *
 * The table is data, not branching logic — a new role is a new row, not a new
 * `if`. Construct one with {@link ModelPolicy.of}.
 */
export declare class ModelPolicy {
    private readonly table;
    private readonly fallback;
    private constructor();
    /**
     * Build a policy from a `{ role: model }` table and a fallback model used for
     * any role the table does not name.
     */
    static of(table: Readonly<Record<string, string>>, fallback: string): ModelPolicy;
    /**
     * The model a `role` resolves to by the table alone (ignoring any per-member
     * override) — the table entry, or the fallback when the role is unlisted.
     */
    modelForRole(role: string): string;
    /**
     * The model a concrete member should run on: its own pin if set, else the
     * role's table entry, else the fallback. Never returns `undefined`.
     */
    for(member: Pick<CrewMember, "role" | "model">): string;
    /** The roles this policy has explicit table rows for. */
    roles(): string[];
}
/**
 * The team-config service: a typed, concurrency-safe view over one crew
 * manifest file.
 *
 * Open with {@link CrewManifest.open}; the factory wires up the underlying
 * {@link JsonCell} (which ensures the parent directory exists) and returns a
 * ready service. Every mutator is a pure transform fed to `cell.mutate`, so
 * concurrent edits from separate processes serialize through the kernel guard.
 */
export declare class CrewManifest {
    private readonly cell;
    private constructor();
    /** Absolute path of the JSON file backing this manifest. */
    get path(): string;
    /**
     * Open (or adopt) the manifest stored at `path`.
     *
     * The cell is born "unborn" — {@link get} on a fresh path yields an empty crew
     * until {@link create} writes a real record. The parent directory is created
     * by the underlying cell if missing.
     */
    static open(path: string): Promise<CrewManifest>;
    /**
     * Initialize the crew record.
     *
     * Mints a `crew_…` id when `crewId` is omitted, stamps `createdAt` with the
     * current time, and starts the roster empty. Refuses to overwrite a crew that
     * already exists (raises a `conflict` fault) so `create` is safe to call
     * without first checking — call it once when standing a crew up.
     */
    create(crewId?: string): Promise<CrewRecord>;
    /**
     * Enroll a teammate and return the stored {@link CrewMember}.
     *
     * The draft's `id` is used if given, otherwise a fresh `mbr_…` id is minted.
     * Appends to the end of the roster (enrollment order is preserved). Raises a
     * `conflict` fault if the crew has not been {@link create}d yet, or if a
     * member with the same id is already enrolled.
     *
     * Note the returned member is read back out of the freshly persisted record,
     * so the caller always sees exactly what was stored (including the minted id).
     */
    addMember(draft: MemberDraft): Promise<CrewMember>;
    /**
     * Dismiss the teammate with `id` and return the trimmed roster.
     *
     * Raises a `conflict` fault if the crew is unborn, and a `not_found` fault if
     * no member carries that id. On success the member is dropped and the
     * remaining order is preserved.
     */
    removeMember(id: string): Promise<readonly CrewMember[]>;
    /** The whole crew record (lock-free read; unborn crews read back empty). */
    get(): Promise<CrewRecord>;
    /** Just the roster array, in enrollment order. */
    members(): Promise<readonly CrewMember[]>;
    /** Guard a mutation against an uninitialized crew. */
    private assertBorn;
}
