/**
 * Role types available for team members.
 * 'team-leader' manages a sub-team of workers in hierarchical mode.
 */
export type TeamMemberRole = 'orchestrator' | 'team-leader' | 'tpm' | 'architect' | 'pgm' | 'developer' | 'frontend-developer' | 'backend-developer' | 'fullstack-dev' | 'qa' | 'qa-engineer' | 'tester' | 'designer' | 'product-manager' | 'sales' | 'support';
export interface TeamMember {
    id: string;
    name: string;
    sessionName: string;
    role: TeamMemberRole;
    avatar?: string;
    systemPrompt: string;
    agentStatus: 'inactive' | 'starting' | 'started' | 'active' | 'suspended' | 'activating';
    workingStatus: 'idle' | 'in_progress';
    runtimeType: 'claude-code' | 'gemini-cli' | 'codex-cli' | 'crewly-agent';
    /** Model ID for crewly-agent runtime (format: provider/modelId, e.g. google/gemini-3-flash-preview) */
    modelId?: string;
    skillOverrides?: string[];
    excludedRoleSkills?: string[];
    enableBrowserAutomation?: boolean;
    currentTickets?: string[];
    readyAt?: string;
    capabilities?: string[];
    lastActivityCheck?: string;
    createdAt: string;
    updatedAt: string;
    /** Parent member ID in the hierarchy. undefined = root (orchestrator). */
    parentMemberId?: string;
    /**
     * Position in hierarchy: 0=orchestrator, 1=team leader, 2=worker.
     * Supports N-level depth for future expansion.
     */
    hierarchyLevel?: number;
    /** IDs of direct subordinate members. Maintained by backend. */
    subordinateIds?: string[];
    /** Whether this member can delegate tasks to subordinates. */
    canDelegate?: boolean;
    /** Maximum number of concurrent tasks this member can handle. */
    maxConcurrentTasks?: number;
    /** #235: Reason the agent last went inactive */
    dropoutReason?: 'idle_exit' | 'update_exit' | 'crash' | 'manual' | 'task_complete' | 'loop_detected' | 'startup_timeout' | 'invalid_role';
    /** Autonomy level: directed (default), bounded, or domain_autonomous */
    autonomyLevel?: 'directed' | 'bounded' | 'domain_autonomous';
    /** Domain SOP name — loads config/domain-sops/{domainSOP}.sop.md */
    domainSOP?: string;
    /** Risk policy name — loads config/risk-policies/{riskPolicy}.policy.md */
    riskPolicy?: string;
    /** Job title: "Frontend Tech Lead", "Backend Developer", "QA Lead" */
    jobTitle?: string;
    /** What this member is responsible for in the team */
    jobDescription?: string;
    /** Ownership scope — domains, deliverables, and areas this member owns */
    ownershipScope?: import('./team-template.types.js').OwnershipScope;
    /** Accountability type — how this member is responsible */
    responsibilityType?: import('./team-template.types.js').ResponsibilityType;
    /** Expert profile ID — loads thinking patterns from config/experts/{expertId}.md */
    expertId?: string;
}
export interface Team {
    id: string;
    name: string;
    description?: string;
    members: TeamMember[];
    projectIds: string[];
    createdAt: string;
    updatedAt: string;
    /** Whether this team uses hierarchical management (TL → Workers). Default: false. */
    hierarchical?: boolean;
    /**
     * @deprecated Use `leaderIds` instead. Retained for backward compatibility.
     * When both exist, `leaderId` equals `leaderIds[0]`.
     */
    leaderId?: string;
    /** Member IDs of the team leaders. Supports multiple TLs per team. */
    leaderIds?: string[];
    /** Template ID this team was created from (see TeamTemplate system). */
    templateId?: string;
    /** Parent team ID for team organization/grouping. null/undefined = top-level team. */
    parentTeamId?: string;
    /** Whether this team is archived. Archived teams are hidden from default listings. (#171) */
    archived?: boolean;
    /** ISO timestamp when the team was archived. (#171) */
    archivedAt?: string;
    /** Team mission statement — displayed in get-team-status and org chart. */
    mission?: string;
    /** Token/cost budget configuration for the team. */
    budget?: TeamBudget;
    /** Quality gate configuration for task review. */
    qualityGate?: TeamQualityGate;
    /**
     * Authenticated principal that materialised this team (Cloud Portal
     * multi-tenant attribution — N1b, Phase E pre-beta). Populated by the
     * provision route from `req.user.userId` so a team is bound to the user
     * that triggered its creation. Undefined for OSS single-user teams and
     * for legacy teams created before this field existed; consumers must
     * tolerate both shapes.
     *
     * Read-side scoping (filter Team list/get by `ownerUserId`) is a
     * separate ticket — N1b only closes the *attribution* leak so audit
     * trails and future scoping have a stable field to key on.
     */
    ownerUserId?: string;
    /** Team-level ownership scope — what this team is responsible for */
    ownershipScope?: import('./team-template.types.js').OwnershipScope;
    /** Service contract — what the team accepts, avoids, and delivers */
    serviceContract?: import('./team-template.types.js').ServiceContract;
    /**
     * Declarative trigger specs that materialise the team's operating cadence
     * (monthly kickoff, weekly review, daily EOD, ...). Reconciled with
     * TriggerEngine on team load/update so SOP timing fires autonomously.
     */
    triggers?: TeamTriggerSpec[];
}
/**
 * Declarative spec for a team-owned trigger. Persisted on the Team config and
 * reconciled with the runtime TriggerEngine. The pair (teamId, name) forms
 * the identity key — editing this spec edits the running trigger in place
 * rather than duplicating it.
 */
export interface TeamTriggerSpec {
    /** Stable identifier within the team (e.g. "youtube-monthly-kickoff"). */
    name: string;
    /** Human-readable label used for logs and optional WorkItem titles. */
    description?: string;
    /** Whether the reconciler should register/keep this trigger active. */
    enabled?: boolean;
    /** Time or signal config, mirrors TriggerEngine.create input. */
    config: import('./v2/trigger.types.js').TriggerConfig;
    /** What to do when the trigger fires. */
    action: import('./v2/trigger.types.js').TriggerAction;
    /** Optional fire cap — undefined = unlimited. */
    maxFires?: number;
    /** Optional idle-fire tolerance before auto-cancel. */
    maxIdleFires?: number;
}
/**
 * Token and cost budget for a team (#173).
 */
export interface TeamBudget {
    /** Maximum tokens per day across all team members. */
    maxTokensPerDay?: number;
    /** Maximum USD spend per month. */
    maxUsdPerMonth?: number;
    /** Percentage (0-100) at which to alert (e.g., 80 = alert at 80% usage). */
    alertThreshold?: number;
}
/**
 * Quality gate configuration for task review (#173).
 */
export interface TeamQualityGate {
    /** Member ID of the designated reviewer. */
    reviewerId?: string;
    /** Whether tasks below minQualityScore are auto-approved. */
    autoApprove?: boolean;
    /** Minimum quality score (0-100) required for auto-approval. */
    minQualityScore?: number;
}
export interface Project {
    id: string;
    name: string;
    path: string;
    teams: Record<string, string[]>;
    status: 'active' | 'paused' | 'completed' | 'stopped';
    scheduledMessageId?: string;
    /**
     * ISO timestamp of the first successful orchestrator bootstrap against
     * this project (Onboarding v3 — B1). Set once on first orc launch and
     * never overwritten thereafter; absence (or undefined) signals a
     * "cold-start" candidate to the onboarding bootstrap detector.
     *
     * Defends the cold-start signal against the edge case where chat-v2 is
     * wiped accidentally — if the user has been here before, this marker
     * stays set even if the chat store is empty.
     */
    firstLaunchedAt?: string;
    createdAt: string;
    updatedAt: string;
}
export interface Ticket {
    id: string;
    title: string;
    description: string;
    status: 'open' | 'in_progress' | 'review' | 'done' | 'blocked';
    assignedTo?: string;
    priority: 'low' | 'medium' | 'high' | 'critical';
    labels?: string[];
    projectId: string;
    createdAt: string;
    updatedAt: string;
}
export interface SessionInfo {
    sessionName: string;
    pid: number;
    windows: number;
    created: string;
    attached: boolean;
}
export interface ScheduledCheck {
    id: string;
    targetSession: string;
    message: string;
    scheduledFor: string;
    intervalMinutes?: number;
    isRecurring: boolean;
    label?: string;
    persistent?: boolean;
    timezone?: string;
    recurrenceType?: 'interval' | 'daily' | 'weekdays' | 'weekly';
    timeOfDay?: string;
    dayOfWeek?: number;
    maxOccurrences?: number;
    currentOccurrence?: number;
    createdAt: string;
    /** Optional session name of the agent being monitored (for status enrichment) */
    watchedSession?: string;
    /** Task ID that this schedule monitors — auto-cancels when task completes */
    taskId?: string;
    /** Cron expression for cron-based scheduling (e.g., '0 9 * * *'). Overrides intervalMinutes when set. (#167) */
    cronExpression?: string;
    /** Session ID that created this check — used to auto-cancel stale checks from previous sessions on restart (#169) */
    sessionId?: string;
}
export interface ScheduledMessage {
    id: string;
    name: string;
    targetTeam: string;
    targetProject?: string;
    message: string;
    delayAmount: number;
    delayUnit: 'seconds' | 'minutes' | 'hours';
    isRecurring: boolean;
    isActive: boolean;
    lastRun?: string;
    nextRun?: string;
    createdAt: string;
    updatedAt: string;
}
export interface MessageDeliveryLog {
    id: string;
    scheduledMessageId: string;
    messageName: string;
    targetTeam: string;
    targetProject?: string;
    message: string;
    sentAt: string;
    success: boolean;
    error?: string;
}
export interface FileChange {
    type: 'created' | 'updated' | 'deleted';
    path: string;
    timestamp: string;
}
export interface TicketFilter {
    status?: string;
    assignedTo?: string;
    projectId?: string;
    priority?: string;
}
export interface TeamMemberConfig {
    name: string;
    role: TeamMemberRole;
    systemPrompt: string;
    skillOverrides?: string[];
    excludedRoleSkills?: string[];
}
export interface TeamConfig {
    name: string;
    description?: string;
    members: TeamMemberConfig[];
    projectPath?: string;
}
/**
 * Subordinate info resolved from TeamMember data, used by the prompt builder
 * to tell a Team Lead who their direct reports are.
 */
export interface SubordinateInfo {
    name: string;
    sessionName: string;
    role: TeamMemberRole;
    memberId: string;
}
export interface TeamMemberSessionConfig {
    name: string;
    role: TeamMemberRole;
    systemPrompt: string;
    projectPath?: string;
    memberId?: string;
    runtimeType?: TeamMember['runtimeType'];
    skillOverrides?: string[];
    excludedRoleSkills?: string[];
    /** The team ID this member belongs to (used for TL skill template variables). */
    teamId?: string;
    /** Whether this member can delegate tasks to subordinates. */
    canDelegate?: boolean;
    /** Resolved subordinate details for prompt injection. */
    subordinates?: SubordinateInfo[];
    /** Autonomy level: directed (default), bounded, or domain_autonomous */
    autonomyLevel?: 'directed' | 'bounded' | 'domain_autonomous';
    /** Domain SOP name — loads config/domain-sops/{domainSOP}.sop.md */
    domainSOP?: string;
    /** Risk policy name — loads config/risk-policies/{riskPolicy}.policy.md */
    riskPolicy?: string;
}
export interface TerminalOutput {
    sessionName: string;
    content: string;
    timestamp: string;
    type: 'stdout' | 'stderr';
}
export interface WebSocketMessage {
    type: 'terminal_output' | 'file_change' | 'team_status' | 'schedule_update' | 'connection_established' | 'subscription_confirmed' | 'unsubscription_confirmed' | 'session_not_found' | 'session_pending' | 'input_error' | 'initial_terminal_state' | 'terminal_state_error' | 'system_notification' | 'orchestrator_status_changed' | 'team_member_status_changed' | 'team_activity_updated' | 'read_only';
    payload: any;
    timestamp: string;
}
export interface ApiResponse<T = any> {
    success: boolean;
    data?: T;
    error?: string;
    message?: string;
    /**
     * Optional non-fatal advisory string. Used by graceful-degradation paths
     * (e.g. project-task endpoints) to signal "the service is healthy but the
     * underlying source failed; treat as empty rather than down". Consumers
     * should display this without breaking the page when present alongside
     * `success: true`.
     */
    warning?: string;
}
export interface StartupConfig {
    webPort: number;
    crewlyHome: string;
    defaultCheckInterval: number;
    autoCommitInterval: number;
    /** When true, skip frontend serving (API-only mode for cloud deployment) */
    headless: boolean;
}
export * from './memory.types.js';
export * from './continuation.types.js';
export * from './quality-gate.types.js';
export * from './sop.types.js';
export * from './budget.types.js';
export * from './scheduler.types.js';
export * from './role.types.js';
export * from './settings.types.js';
export * from './skill.types.js';
export * from './chat.types.js';
export * from './task-output.types.js';
export * from './thread-status.types.js';
//# sourceMappingURL=index.d.ts.map