/** * Onboarding state store — `/onboarding.json`. * * Holds the few things the first-run checklist cannot read from the rest of * the system (specs/onboarding-harness-login.md, Phase 3): * * - `dismissedAt`: the owner hid the dashboard checklist card; * - `blankChosenAt`: the owner chose "Blank" (the orchestrator only), which * completes the team step without a team; * - `firstTask`: a first task that was handed to the orchestrator; * - `pendingFirstTask`: a first task typed in `crewly onboard` while the * backend was down, delivered when the backend starts. * * Everything else (harness login, teams, Cloud, Slack) is read live. * Writes are atomic (temp file + rename) and serialized per store. * * @module services/onboarding/onboarding-state.store */ /** A first task handed to the orchestrator. */ export interface SentFirstTask { /** ISO time it was handed over */ sentAt: string; /** Team it was meant for (null = the orchestrator itself) */ teamId: string | null; /** Chat conversation it was recorded in */ conversationId: string | null; } /** A first task waiting for the backend to start. */ export interface PendingFirstTask { /** The owner's words */ text: string; /** Team it is meant for (null = the orchestrator itself) */ teamId: string | null; /** ISO time it was typed */ createdAt: string; } /** Contents of `onboarding.json`. */ export interface OnboardingState { dismissedAt: string | null; blankChosenAt: string | null; firstTask: SentFirstTask | null; pendingFirstTask: PendingFirstTask | null; } /** State of a machine that never saw onboarding. */ export declare const EMPTY_ONBOARDING_STATE: OnboardingState; /** * Normalize parsed JSON into a complete state (unknown / malformed fields are dropped). * * @param raw - Parsed file contents * @returns A complete state */ export declare function normalizeOnboardingState(raw: unknown): OnboardingState; /** * File-backed onboarding state. */ export declare class OnboardingStateStore { private readonly filePath; /** Serializes read-modify-write cycles */ private chain; /** * @param crewlyHome - Crewly home dir (defaults to `CREWLY_HOME` / `~/.crewly`) */ constructor(crewlyHome?: string); /** * Path of the state file. * * @returns Absolute path */ getFilePath(): string; /** * Read the state. A missing or unreadable file reads as empty. * * @returns The state */ read(): Promise; /** * Apply a change and write the result atomically. * * @param change - Returns the fields to change * @returns The state after the change * * @example * ```ts * await store.update(() => ({ dismissedAt: new Date().toISOString() })); * ``` */ update(change: (current: OnboardingState) => Partial): Promise; } //# sourceMappingURL=onboarding-state.store.d.ts.map