/**
 * Session orchestration — types + constants.
 *
 * A "supervisor" session has the `orchestrate_*` tool group enabled
 * and can spawn / observe / message / interrupt / kill / detach a set
 * of "worker" sessions. Workers are real first-class sessions (same
 * .jsonl on disk, same browser visibility) — the link is purely
 * forge-side metadata in `${FORGE_DATA_DIR}/session-orchestration.json`.
 *
 * Topology is strict hub-and-spoke: workers don't get the orchestrate
 * tools and have no way to enumerate or message other workers.
 * Enforcement is by tool-surface (the tools simply aren't there),
 * not by permission check at the registry layer.
 *
 * Depth is limited to 1: a worker cannot become a supervisor. Keeps
 * the worst case bounded against fork-bomb runaway prompts.
 */
export const ORCHESTRATION_VERSION = 1;
/**
 * Inbox events the supervisor's LLM sees when it calls
 * `orchestrate_read_inbox`. All carry the workerId; the `data`
 * shape is event-specific and intentionally small — the supervisor
 * can call `orchestrate_read_worker` to fetch full detail.
 */
export const INBOX_EVENT_TYPES = [
    "worker.ended",
    "worker.ask_user",
    "worker.auto_retry_failed",
    "worker.process_alert",
    "worker.deleted",
];
export function isInboxEventType(v) {
    return typeof v === "string" && INBOX_EVENT_TYPES.includes(v);
}
export function emptyStore() {
    return { version: ORCHESTRATION_VERSION, supervisors: {}, workers: {} };
}
export function emptyInboxStore() {
    return { version: ORCHESTRATION_VERSION, inboxes: {} };
}
/**
 * Per-supervisor inbox cap. Items beyond this evict from the FIFO
 * front. 200 is enough headroom for a supervisor that goes offline
 * for an hour while 20 workers run; the supervisor can still see the
 * last few hundred events on resume. Bumping this is cheap (small
 * JSON blob); shrinking risks an inattentive supervisor missing
 * events that fired before its next wake-up.
 */
export const MAX_INBOX_ITEMS = 200;
/** Default per-supervisor concurrent worker cap. Configurable via
 *  `ORCHESTRATION_MAX_WORKERS_PER_SUPERVISOR`. */
export const DEFAULT_MAX_WORKERS_PER_SUPERVISOR = 8;
/** Depth limit — workers cannot themselves be supervisors. Phase 1
 *  ships at depth=1 only. Reconsider once real usage clarifies what
 *  the worst-case prompt loops look like. */
export const MAX_DEPTH = 1;
//# sourceMappingURL=types.js.map