import type { SeedAgentName } from "../../config/schema.js";
import type { SeedTeamCapabilityProfile, SeedTeamSpawnPolicy } from "../../config/schema.js";
import type { SeedTeamMcpPolicy, SeedTeamSkillPolicy, SeedTeamToolPolicy } from "./spec.js";
export type SeedTeamRuntimeStatus = "creating" | "active" | "failed" | "stopped" | "completed";
export type SeedTeamMemberStatus = "queued" | "launching" | "running" | "active" | "idle" | "waiting_on_mailbox" | "blocked" | "completed" | "done" | "failed" | "cancelled";
export type SeedTeamMemberRole = "lead" | "member";
export type SeedTeamMemberLaunchStatus = "pending" | "queued" | "failed";
export type SeedTeamMemberWriteSurface = "native_hook_enforced" | "read_only_or_coordination_only";
export type SeedTeamMember = {
    name: SeedAgentName | string;
    role: SeedTeamMemberRole;
    status: SeedTeamMemberStatus;
    joined_at: string;
    last_seen_at?: string;
    role_label?: string;
    capability_profile?: SeedTeamCapabilityProfile | string;
    resolved_agent?: SeedAgentName | string;
    parent_session_id?: string;
    thread_id?: string;
    parent_thread_id?: string;
    session_id?: string;
    background_id?: string;
    agent_call_id?: string;
    prompt_ref?: string;
    tool_manifest_ref?: string;
    memory_ref?: string;
    helper_counts?: {
        running: number;
        completed: number;
        failed: number;
    };
    coverage?: string[];
    mission_prompt?: string;
    prompt_budget?: {
        max_prompt_chars: number;
    };
    model_route?: {
        model_profile?: string;
        fallback_profiles: string[];
    };
    spawn_policy?: SeedTeamSpawnPolicy;
    write_surface?: SeedTeamMemberWriteSurface;
    opencode_agent?: SeedAgentName | string;
    launch_policy?: {
        mode: "sync" | "background";
        wait_for_dependencies: boolean;
        parallel_group?: string;
    };
    delivery_policy?: {
        report_to: string;
        expected_artifact_paths: string[];
    };
    evidence_contract?: {
        required_refs: string[];
        required_artifacts: string[];
        oracle_scope: string[];
    };
    authoritative_inputs?: string[];
    expected_state_version?: number;
    read_paths?: string[];
    write_paths?: string[];
    evidence_paths?: string[];
    artifact_paths?: string[];
    expected_outputs?: string[];
    stop_condition?: string;
    dependencies?: string[];
    artifact_inputs?: string[];
    evidence_inputs?: string[];
    verifier_obligations?: string[];
    oracle_scope?: string[];
    semantic_conflict_policy?: string;
    human_in_the_loop?: {
        risk_tier: string;
        escalation_triggers: string[];
    };
    tool_policy?: SeedTeamToolPolicy;
    mcp_policy?: SeedTeamMcpPolicy;
    skill_policy?: SeedTeamSkillPolicy;
    pending_message_ids?: string[];
    launch_status?: SeedTeamMemberLaunchStatus;
    launch_error?: string;
};
export type SeedTeamRuntime = {
    version: 1;
    run_id: string;
    team_id?: string;
    team_name?: string;
    spec_ref?: string;
    spec_markdown_ref?: string;
    status: SeedTeamRuntimeStatus;
    created_at: string;
    updated_at: string;
    members: SeedTeamMember[];
    cleanup_instructions?: string[];
    launch_error?: string;
};
export type SeedTeamMessageKind = "message" | "announcement" | "handoff" | "blocker" | "broadcast" | "meeting";
export type SeedTeamMessage = {
    message_id: string;
    run_id: string;
    from: string;
    to: string;
    body: string;
    kind: SeedTeamMessageKind;
    created_at: string;
    acknowledged_at: string | null;
    metadata: Record<string, unknown>;
};
export type SeedTeamConversationEntry = {
    version: 1;
    type: string;
    at: string;
    run_id: string;
    from?: string;
    to?: string;
    kind?: string;
    body?: string;
    message_id?: string;
    agent_call_id?: string;
    launch_id?: string;
    child_session_id?: string;
    background_id?: string;
    prompt_ref?: string;
    prompt_summary?: string;
    status?: string;
    metadata?: Record<string, unknown>;
};
export type SeedTeamMeetingStatus = "open" | "closed";
export type SeedTeamMeetingPostKind = "message" | "decision" | "action_item" | "summary";
export type SeedTeamMeetingPost = {
    post_id: string;
    meeting_id: string;
    run_id: string;
    from: string;
    kind: SeedTeamMeetingPostKind;
    body: string;
    created_at: string;
    reply_to?: string;
    action_owner?: string;
    action_status?: "open" | "done" | "cancelled";
};
export type SeedTeamMeeting = {
    version: 1;
    meeting_id: string;
    run_id: string;
    title: string;
    agenda: string[];
    status: SeedTeamMeetingStatus;
    participants: string[];
    created_by: string;
    created_at: string;
    updated_at: string;
    closed_at?: string;
    summary?: string;
    metadata?: Record<string, unknown>;
    posts: SeedTeamMeetingPost[];
};
export type SeedTeamMemberRequestType = "new_member" | "task" | "meeting" | "delegation" | "other";
export type SeedTeamMemberRequestStatus = "open" | "accepted" | "rejected";
export type SeedTeamMemberRequest = {
    request_id: string;
    run_id: string;
    from_member: string;
    request_type: SeedTeamMemberRequestType;
    summary: string;
    detail: string;
    suggested_role_id?: string;
    priority: number;
    status: SeedTeamMemberRequestStatus;
    created_at: string;
    updated_at: string;
    inbox_message_id?: string;
};
export type SeedTeamTaskStatus = "pending" | "claimed" | "in_progress" | "blocked" | "review" | "completed" | "cancelled";
export type SeedTeamTaskConflictKind = "stale_revision";
export type SeedTeamTaskConflict = {
    conflict_id: string;
    kind: SeedTeamTaskConflictKind;
    actor: string;
    expected_revision: number;
    actual_revision: number;
    attempted_patch: Record<string, unknown>;
    summary: string;
    created_at: string;
    resolved_at?: string;
};
export type SeedTeamTask = {
    team_task_id: string;
    title: string;
    description: string;
    status: SeedTeamTaskStatus;
    owner_agent: string | null;
    priority: number;
    revision: number;
    depends_on: string[];
    evidence_refs: string[];
    conflicts: SeedTeamTaskConflict[];
    created_at: string;
    updated_at: string;
    claimed_at?: string;
    completed_at?: string;
    blocker?: string;
};
export type SeedTeamCleanupReport = {
    version: 1;
    run_id: string;
    created_at: string;
    runtime_status_before: SeedTeamRuntimeStatus;
    runtime_status_after: SeedTeamRuntimeStatus;
    members: Array<Pick<SeedTeamMember, "name" | "role" | "status" | "last_seen_at">>;
    tasks_by_status: Record<string, number>;
    open_task_ids: string[];
    unread_by_member: Record<string, number>;
    unread_message_count: number;
    warnings: string[];
};
