import { type PersistedStaff, type StaffState, type StaffTrigger } from "./staff-store.js";
import type { SessionManager } from "./session-manager.js";
import type { ProjectContextManager } from "./project-context-manager.js";
import type { InboxManager } from "./inbox-manager.js";
export declare class StaffManager {
    private pcm;
    private inboxManager;
    constructor(pcm: ProjectContextManager);
    /**
     * Late-bound inbox manager wiring — set from `server.ts` boot after both
     * `StaffManager` and `InboxManager` are constructed. Used solely by
     * `deleteStaff` to wipe the per-staff inbox file. The nudger never
     * touches `StaffManager.inboxManager`; it has its own direct binding.
     */
    setInboxManager(inboxManager: InboxManager): void;
    /**
     * Validate a triggers array before persistence.
     *
     * - Goal lifecycle triggers (`goal_created`, `goal_archived`) MUST carry a
     *   non-empty trimmed `prompt`. The push-based dispatcher passes the prompt
     *   straight through to the inbox entry with no fallback, so an empty prompt
     *   would produce a useless wake.
     * - Other trigger types are unchecked here (existing behaviour: optional
     *   prompt with the engine synthesising one if missing).
     *
     * Throws a plain `Error` on failure so callers (REST routes) can surface
     * the message via `jsonError(400, err)`. Safe to call with `undefined`
     * (skipped) so PUT routes can pass `body.triggers` directly.
     */
    validateTriggers(triggers: StaffTrigger[] | undefined): void;
    /**
     * Log any orphaned staff (missing projectId or persisted under the synthetic
     * system project) one time during construction. This surfaces legacy records
     * that won't render under any real project's Sessions bucket until the user
     * re-homes them via the orphan banner.
     */
    private logOrphansOnce;
    /**
     * Return staff records that are not anchored to a real project: either
     * missing `projectId` outright, or persisted under the synthetic system
     * project. The sidebar surfaces these in an orphan banner with a one-click
     * re-assignment flow.
     */
    listOrphaned(): PersistedStaff[];
    /**
     * Re-home a staff record to a different project. Moves the persisted record
     * between per-project stores, updates `staff.projectId`, and re-indexes
     * search under the new project. Used by the orphan banner's "Assign to
     * project…" flow.
     *
     * Project changes intentionally drop runtime metadata from the previous
     * project. The next staff wake creates a fresh session rooted at the target
     * project instead of continuing from the old cwd/worktree.
     */
    reassignProject(staffId: string, newProjectId: string, sessionManager?: SessionManager): Promise<PersistedStaff | null>;
    private getStore;
    private findStoreForStaff;
    private projectSupportsWorktree;
    private provisionStaffWorktree;
    private staffSessionCwd;
    private staffWorktreeEntries;
    private staffSessionWorktreeMeta;
    private cleanupStaffWorktree;
    createStaff(name: string, description: string, systemPrompt: string, cwd: string, sessionManager: SessionManager, opts?: {
        triggers?: StaffTrigger[];
        roleId?: string;
        projectId?: string;
        sandboxed?: boolean;
        worktree?: boolean;
        accessory?: string;
    }): Promise<PersistedStaff>;
    getStaff(id: string): PersistedStaff | undefined;
    listStaff(projectId?: string): PersistedStaff[];
    updateStaff(id: string, updates: {
        name?: string;
        description?: string;
        systemPrompt?: string;
        cwd?: string;
        state?: StaffState;
        triggers?: StaffTrigger[];
        memory?: string;
        roleId?: string;
        accessory?: string;
        currentSessionId?: string;
        contextPolicy?: "preserve" | "compact";
        /** Updated by `InboxNudger.applyPolicyThenNudge`; no longer mutated by `StaffManager`. */
        lastWakeAt?: number;
    }): boolean;
    deleteStaff(id: string, sessionManager: SessionManager): Promise<boolean>;
    /**
     * Update a specific trigger's runtime state (lastFired, lastSeenSha).
     */
    updateTriggerState(staffId: string, triggerId: string, updates: {
        lastFired?: number;
        lastSeenSha?: string;
    }): boolean;
    /**
     * Refresh a staff agent's worktree: rebase onto the primary branch and
     * re-run the project's worktree setup command (e.g. npm ci).
     * Non-fatal — logs warnings on failure so the agent can still operate.
     */
    private refreshWorktree;
    /**
     * Ensure the staff agent has a live, ready-to-use session, returning its id.
     *
     * Three branches:
     *   1. **Legacy migration** — `currentSessionId` is missing. Create a fresh
     *      permanent session with the staff's system prompt + pinned memory.
     *   2. **Subprocess recovery** — the session exists but its agent CLI has
     *      exited (status `terminated`). Restore it via `ensureSessionAlive`;
     *      if that fails the session record itself is gone, clear
     *      `currentSessionId` and recurse into the legacy-migration branch.
     *   3. **Healthy** — session is live. Just refresh the worktree (rebase +
     *      deps) so the agent runs on the current primary branch.
     *
     * Sandbox init (`sandboxManager.ensureForProject`) and `refreshWorktree`
     * always run before returning so the session is ready to receive prompts.
     * Throws if the staff isn't `active`.
     *
     * Replaces the deleted public `wake()` method — the inbox nudger now
     * decides *when* to wake; this helper handles the *how*.
     */
    ensureSessionForStaff(staffId: string, sessionManager: SessionManager): Promise<string>;
}
//# sourceMappingURL=staff-manager.d.ts.map