// This file is auto-generated by @hey-api/openapi-ts

export type ClientOptions = {
    baseURL: 'https://platform.kodex.works' | (string & {});
};

export type ErrorResponse = {
    code: 'invalid_argument' | 'unauthorized' | 'forbidden' | 'not_found' | 'conflict' | 'failed_precondition' | 'resource_exhausted' | 'deadline_exceeded' | 'unavailable' | 'canceled' | 'internal';
    message: string;
    field?: string;
};

export type IngestGitHubWebhookResponse = {
    correlation_id: string;
    run_id?: string;
    status: 'accepted' | 'duplicate' | 'ignored';
    duplicate: boolean;
};

export type MeUser = {
    id: string;
    email: string;
    github_login: string;
    is_platform_admin: boolean;
    is_platform_owner: boolean;
};

export type MeResponse = {
    user: MeUser;
};

export type RunNamespaceCleanupResponse = {
    run_id: string;
    namespace: string;
    deleted: boolean;
    already_deleted: boolean;
    comment_url?: string | null;
};

export type RunActionRequest = {
    reason?: string | null;
};

export type RunActionResponse = {
    run_id: string;
    action: 'cancel';
    previous_status: 'pending' | 'running' | 'waiting_backpressure' | 'succeeded' | 'failed' | 'canceled';
    current_status: 'pending' | 'running' | 'waiting_backpressure' | 'succeeded' | 'failed' | 'canceled';
    already_terminal: boolean;
    runtime_deploy_cancel_requested: boolean;
    job_stopped: boolean;
    canceled_github_waits: number;
    comment_url?: string | null;
};

export type Project = {
    id: string;
    slug: string;
    name: string;
    role: string;
};

export type SystemSetting = {
    key: string;
    section: string;
    value_kind: string;
    reload_semantics: string;
    visibility: string;
    boolean_value: boolean;
    default_boolean_value: boolean;
    source: string;
    version: number;
    updated_at?: string | null;
    updated_by_user_id?: string | null;
    updated_by_email?: string | null;
};

export type Run = {
    id: string;
    correlation_id: string;
    project_id?: string | null;
    project_slug: string;
    project_name: string;
    issue_number?: number | null;
    issue_url?: string | null;
    pr_number?: number | null;
    pr_url?: string | null;
    trigger_kind?: string | null;
    trigger_label?: string | null;
    job_name?: string | null;
    job_namespace?: string | null;
    namespace?: string | null;
    job_exists?: boolean;
    namespace_exists?: boolean;
    wait_state?: string | null;
    wait_reason?: string | null;
    agent_key?: string | null;
    wait_since?: string | null;
    last_heartbeat_at?: string | null;
    status: string;
    created_at: string;
    started_at?: string | null;
    finished_at?: string | null;
    wait_projection?: RunWaitProjection;
};

export type RunWaitProjection = {
    wait_state: string;
    wait_reason: string;
    dominant_wait: GitHubRateLimitWaitItem;
    related_waits: Array<GitHubRateLimitWaitItem>;
    comment_mirror_state: 'synced' | 'pending_retry' | 'not_attempted';
};

export type GitHubRateLimitWaitItem = {
    wait_id: string;
    contour_kind: 'platform_pat' | 'agent_bot_token';
    limit_kind: 'primary' | 'secondary';
    operation_class: 'run_status_comment' | 'issue_label_transition' | 'repository_provider_call' | 'agent_github_call';
    state: 'open' | 'auto_resume_scheduled' | 'auto_resume_in_progress' | 'resolved' | 'manual_action_required' | 'cancelled';
    confidence: 'deterministic' | 'conservative' | 'provider_uncertain';
    entered_at: string;
    resume_not_before?: string | null;
    attempts_used: number;
    max_attempts: number;
    recovery_hint: GitHubRateLimitRecoveryHint;
    manual_action?: GitHubRateLimitManualAction;
};

export type GitHubRateLimitRecoveryHint = {
    hint_kind: 'rate_limit_reset' | 'retry_after' | 'exponential_backoff' | 'manual_only';
    resume_not_before?: string | null;
    source_headers: 'reset_at' | 'retry_after' | 'provider_uncertain';
    details_markdown: string;
};

export type GitHubRateLimitManualAction = {
    kind: 'requeue_platform_operation' | 'resume_agent_session' | 'retry_after_operator_review';
    summary: string;
    details_markdown: string;
    suggested_not_before?: string | null;
};

export type RunWaitResolution = {
    wait_id: string;
    contour_kind: 'platform_pat' | 'agent_bot_token';
    resolution_kind: 'auto_resumed' | 'manually_resolved' | 'cancelled';
    resolved_at: string;
};

export type RunWaitManualActionEvent = {
    wait_id: string;
    manual_action: GitHubRateLimitManualAction;
    updated_at: string;
};

export type RunRealtimeMessage = {
    type: 'snapshot' | 'run' | 'events' | 'logs' | 'wait_entered' | 'wait_updated' | 'wait_resolved' | 'wait_manual_action_required' | 'error';
    run?: Run;
    events?: Array<FlowEvent>;
    logs?: RunLogs;
    wait_projection?: RunWaitProjection;
    wait_resolution?: RunWaitResolution;
    wait_manual_action?: RunWaitManualActionEvent;
    message?: string | null;
    sent_at: string;
};

export type ApprovalRequest = {
    id: number;
    correlation_id: string;
    run_id?: string | null;
    project_id?: string | null;
    project_slug?: string | null;
    project_name?: string | null;
    issue_number?: number | null;
    pr_number?: number | null;
    trigger_label?: string | null;
    tool_name: string;
    action: string;
    approval_mode: 'none' | 'owner' | 'delegated';
    requested_by: string;
    created_at: string;
};

export type ResolveApprovalDecisionRequest = {
    decision: 'approved' | 'denied' | 'expired' | 'failed';
    reason?: string | null;
};

export type UpdateSystemSettingBooleanRequest = {
    boolean_value: boolean;
};

export type McpApprovalCallbackRequest = {
    approval_request_id: number;
    decision: 'approved' | 'denied' | 'expired' | 'failed' | 'applied';
    reason?: string | null;
    actor_id?: string | null;
};

export type InteractionCallbackEnvelope = {
    schema_version: 'telegram-interaction-v1';
    interaction_id: string;
    delivery_id?: string | null;
    adapter_event_id: string;
    callback_kind: 'delivery_receipt' | 'option_selected' | 'free_text_received' | 'transport_failure';
    occurred_at: string;
    callback_handle?: string | null;
    /**
     * User free-text answer. Contract limit: at most 8192 UTF-8 bytes; larger payloads are classified as invalid and do not resume the run.
     *
     */
    free_text?: string | null;
    responder_ref?: string | null;
    provider_message_ref?: InteractionProviderMessageRef;
    provider_update_id?: string | null;
    provider_callback_query_id?: string | null;
    delivery_status?: 'accepted' | 'delivered' | 'failed';
    error?: InteractionCallbackError;
};

export type InteractionProviderMessageRef = {
    chat_ref?: string | null;
    message_id?: string | null;
    inline_message_id?: string | null;
    sent_at?: string | null;
};

export type InteractionCallbackError = {
    code: string;
    retryable: boolean;
    message?: string;
};

export type InteractionCallbackOutcome = {
    accepted: boolean;
    classification: 'applied' | 'duplicate' | 'stale' | 'expired' | 'invalid';
    interaction_state: string;
    resume_required: boolean;
    continuation_action?: 'none' | 'edit_message' | 'send_follow_up' | 'manual_fallback';
    message?: string | null;
};

export type ResolveApprovalDecisionResponse = {
    id: number;
    correlation_id: string;
    run_id?: string | null;
    tool_name: string;
    action: string;
    approval_state: 'requested' | 'approved' | 'denied' | 'expired' | 'failed' | 'applied';
};

export type FlowEvent = {
    correlation_id: string;
    event_type: string;
    created_at: string;
    payload_json: string;
};

export type RunLogs = {
    run_id: string;
    status: string;
    updated_at?: string | null;
    snapshot_json: string;
    tail_lines: Array<string>;
};

export type RuntimeDeployTaskLog = {
    stage: string;
    level: 'info' | 'warn' | 'error';
    message: string;
    created_at?: string | null;
};

export type RuntimeDeployTaskListItem = {
    run_id: string;
    status: 'pending' | 'running' | 'succeeded' | 'failed' | 'canceled';
    repository_full_name: string;
    target_env: string;
    result_target_env?: string | null;
    namespace: string;
    result_namespace?: string | null;
    runtime_mode: string;
    build_ref: string;
    created_at?: string | null;
    updated_at?: string | null;
};

export type RuntimeDeployTaskActionRequest = {
    reason?: string | null;
    /**
     * Must be true for destructive stop requests; ignored by cancel.
     */
    force?: boolean;
};

export type RuntimeDeployTaskActionResponse = {
    run_id: string;
    action: 'cancel' | 'stop';
    previous_status: 'pending' | 'running' | 'succeeded' | 'failed' | 'canceled';
    current_status: 'pending' | 'running' | 'succeeded' | 'failed' | 'canceled';
    already_terminal: boolean;
};

export type RuntimeDeployTask = {
    run_id: string;
    runtime_mode: string;
    namespace: string;
    target_env: string;
    slot_no: number;
    repository_full_name: string;
    services_yaml_path: string;
    build_ref: string;
    deploy_only: boolean;
    status: 'pending' | 'running' | 'succeeded' | 'failed' | 'canceled';
    lease_owner?: string | null;
    lease_until?: string | null;
    attempts: number;
    last_error?: string | null;
    result_namespace?: string | null;
    result_target_env?: string | null;
    cancel_requested_at?: string | null;
    cancel_requested_by?: string | null;
    cancel_reason?: string | null;
    stop_requested_at?: string | null;
    stop_requested_by?: string | null;
    stop_reason?: string | null;
    terminal_status_source?: 'worker' | 'operator' | 'system';
    terminal_event_seq?: number;
    created_at?: string | null;
    updated_at?: string | null;
    started_at?: string | null;
    finished_at?: string | null;
    logs: Array<RuntimeDeployTaskLog>;
};

export type RuntimeError = {
    id: string;
    source: string;
    level: 'error' | 'warning' | 'critical';
    message: string;
    details_json: string;
    stack_trace?: string | null;
    correlation_id?: string | null;
    run_id?: string | null;
    project_id?: string | null;
    namespace?: string | null;
    job_name?: string | null;
    viewed_at?: string | null;
    viewed_by?: string | null;
    created_at: string;
};

export type LearningFeedback = {
    id: number;
    run_id: string;
    repository_id?: string | null;
    pr_number?: number | null;
    file_path?: string | null;
    line?: number | null;
    kind: string;
    explanation: string;
    created_at: string;
};

export type User = {
    id: string;
    email: string;
    github_user_id?: number | null;
    github_login?: string | null;
    is_platform_admin: boolean;
    is_platform_owner: boolean;
};

export type ProjectMember = {
    project_id: string;
    user_id: string;
    email: string;
    role: 'read' | 'read_write' | 'admin';
    learning_mode_override?: boolean | null;
};

export type RepositoryBinding = {
    id: string;
    project_id: string;
    alias: string;
    role: 'orchestrator' | 'service' | 'docs' | 'mixed';
    default_ref: string;
    provider: string;
    external_id: number;
    owner: string;
    name: string;
    services_yaml_path: string;
    docs_root_path?: string | null;
    bot_username?: string | null;
    bot_email?: string | null;
    preflight_updated_at?: string | null;
};

export type ProjectGitHubTokens = {
    project_id: string;
    has_platform_token: boolean;
    has_bot_token: boolean;
    bot_username?: string | null;
    bot_email?: string | null;
};

export type UpsertProjectGitHubTokensRequest = {
    platform_token?: string | null;
    bot_token?: string | null;
    bot_username?: string | null;
    bot_email?: string | null;
};

export type NextStepActionRequest = {
    repository_full_name: string;
    issue_number?: number | null;
    pull_request_number?: number | null;
    action_kind: string;
    target_label: string;
};

export type NextStepActionResponse = {
    repository_full_name: string;
    thread_kind: string;
    thread_number: number;
    thread_url?: string | null;
    removed_labels: Array<string>;
    added_labels: Array<string>;
    final_labels: Array<string>;
};

export type UpsertRepositoryBotParamsRequest = {
    bot_token?: string | null;
    bot_username?: string | null;
    bot_email?: string | null;
};

export type PreflightCheckResult = {
    name: string;
    status: string;
    details?: string | null;
};

export type RunRepositoryPreflightResponse = {
    repository_id: string;
    status: string;
    checks: Array<PreflightCheckResult>;
    report_json: string;
    finished_at: string;
};

export type DocsetGroup = {
    id: string;
    title: string;
    description: string;
    default_selected: boolean;
};

export type DocsetGroupItemsResponse = {
    groups: Array<DocsetGroup>;
};

export type ImportDocsetRequest = {
    repository_id: string;
    docset_ref: string;
    locale: 'ru' | 'en';
    group_ids: Array<string>;
};

export type ImportDocsetResponse = {
    repository_full_name: string;
    pr_number: number;
    pr_url: string;
    branch: string;
    files_total: number;
};

export type SyncDocsetRequest = {
    repository_id: string;
    docset_ref: string;
};

export type SyncDocsetResponse = {
    repository_full_name: string;
    pr_number: number;
    pr_url: string;
    branch: string;
    files_updated: number;
    files_drift: number;
};

export type MissionControlNodeRef = {
    node_kind: 'discussion' | 'work_item' | 'run' | 'pull_request';
    node_public_id: string;
};

export type MissionControlWorkspaceFilters = {
    open_scope: 'open_only';
    assignment_scope: 'assigned_to_me_or_unassigned';
    state_preset: 'working' | 'waiting' | 'blocked' | 'review' | 'recent_critical_updates' | 'all_active';
    search?: string | null;
};

export type MissionControlWorkspaceSummary = {
    root_count: number;
    node_count: number;
    blocking_gap_count: number;
    warning_gap_count: number;
    recent_closed_context_count: number;
    working_count: number;
    waiting_count: number;
    blocked_count: number;
    review_count: number;
    recent_critical_updates_count: number;
};

export type MissionControlWorkspaceWatermark = {
    watermark_kind: 'provider_freshness' | 'provider_coverage' | 'graph_projection' | 'launch_policy';
    status: 'fresh' | 'stale' | 'degraded' | 'out_of_scope';
    summary: string;
    observed_at: string;
    window_started_at?: string | null;
    window_ended_at?: string | null;
};

export type MissionControlRootGroup = {
    root_node_kind: 'discussion' | 'work_item' | 'run' | 'pull_request';
    root_node_public_id: string;
    root_title: string;
    node_refs: Array<MissionControlNodeRef>;
    has_blocking_gap: boolean;
    latest_activity_at?: string | null;
};

export type MissionControlNode = {
    node_kind: 'discussion' | 'work_item' | 'run' | 'pull_request';
    node_public_id: string;
    title: string;
    visibility_tier: 'primary' | 'secondary_dimmed';
    active_state: 'working' | 'waiting' | 'blocked' | 'review' | 'recent_critical_updates' | 'archived';
    continuity_status: 'complete' | 'missing_run' | 'missing_pull_request' | 'missing_follow_up_issue' | 'stale_provider' | 'out_of_scope';
    coverage_class: 'open_primary' | 'recent_closed_context' | 'out_of_scope';
    provider_reference?: MissionControlProviderReference;
    root_node_public_id: string;
    column_index: number;
    last_activity_at?: string | null;
    has_blocking_gap: boolean;
    badges: Array<'continuity_gap' | 'provider_stale' | 'recent_closed_context' | 'waiting_mcp' | 'review_required'>;
    projection_version: number;
};

export type MissionControlEdge = {
    edge_kind: 'formalized_from' | 'spawned_run' | 'produced_pull_request' | 'continues_with' | 'blocked_by' | 'related_to' | 'tracked_by_command';
    source_node_kind: 'discussion' | 'work_item' | 'run' | 'pull_request';
    source_node_public_id: string;
    target_node_kind: 'discussion' | 'work_item' | 'run' | 'pull_request';
    target_node_public_id: string;
    visibility_tier: 'primary' | 'secondary_dimmed';
    source_of_truth: 'platform' | 'provider' | 'command';
    is_primary_path: boolean;
};

export type MissionControlContinuityGap = {
    gap_id: number;
    gap_kind: 'missing_run' | 'missing_pull_request' | 'missing_follow_up_issue' | 'provider_out_of_scope' | 'provider_stale' | 'orphan_node';
    severity: 'blocking' | 'warning' | 'info';
    status: 'open' | 'resolved' | 'deferred';
    subject_node_kind: 'discussion' | 'work_item' | 'run' | 'pull_request';
    subject_node_public_id: string;
    expected_node_kind?: 'discussion' | 'work_item' | 'run' | 'pull_request';
    expected_stage_label?: string | null;
    detected_at: string;
    resolved_at?: string | null;
    resolution_hint?: string | null;
};

export type MissionControlStageNextStepTemplate = {
    thread_kind: 'issue' | 'pull_request';
    thread_number: number;
    target_label: string;
    removed_labels: Array<string>;
    display_variant?: string | null;
    approval_requirement: 'none' | 'owner_review';
    expected_gap_ids: Array<number>;
};

export type MissionControlLaunchSurface = {
    action_kind: 'preview_next_stage' | 'open_linked_pull_request' | 'open_linked_follow_up_issue' | 'open_provider_context' | 'inspect_run_context';
    presentation: 'primary' | 'secondary' | 'link';
    approval_requirement: 'none' | 'owner_review';
    blocked_reason?: string | null;
    command_template?: MissionControlStageNextStepTemplate;
};

export type MissionControlDiscussionNodeDetails = {
    discussion_kind: string;
    status: string;
    author: string;
    participant_count: number;
    latest_comment_excerpt: string;
    formalization_target_refs: Array<MissionControlNodeRef>;
};

export type MissionControlWorkItemNodeDetails = {
    repository_full_name: string;
    issue_number: number;
    stage_label: string;
    labels: Array<string>;
    assignees: Array<string>;
    linked_run_refs: Array<MissionControlNodeRef>;
    linked_follow_up_refs: Array<MissionControlNodeRef>;
    last_provider_sync_at?: string | null;
};

export type MissionControlRunNodeDetails = {
    run_id: string;
    agent_key: string;
    run_status: string;
    runtime_mode: string;
    trigger_label: string;
    build_ref: string;
    candidate_namespace: string;
    started_at?: string | null;
    finished_at?: string | null;
    linked_pull_request_refs: Array<MissionControlNodeRef>;
    produced_issue_refs: Array<MissionControlNodeRef>;
};

export type MissionControlPullRequestNodeDetails = {
    repository_full_name: string;
    pull_request_number: number;
    branch_head: string;
    branch_base: string;
    merge_state: string;
    review_decision: string;
    checks_summary: string;
    linked_issue_refs: Array<MissionControlNodeRef>;
    linked_run_ref?: MissionControlNodeRef;
};

export type MissionControlNodeDetailsPayload = MissionControlDiscussionNodeDetails | MissionControlWorkItemNodeDetails | MissionControlRunNodeDetails | MissionControlPullRequestNodeDetails;

export type MissionControlActivityEntry = {
    entry_id: string;
    node_kind: 'discussion' | 'work_item' | 'run' | 'pull_request';
    node_public_id: string;
    source_kind: 'provider' | 'platform' | 'command';
    source_ref: string;
    occurred_at: string;
    summary: string;
    body_markdown?: string | null;
    provider_url?: string | null;
    is_read_only: boolean;
};

export type MissionControlNodeDetails = {
    node: MissionControlNode;
    detail_payload: MissionControlNodeDetailsPayload;
    adjacent_nodes: Array<MissionControlNode>;
    adjacent_edges: Array<MissionControlEdge>;
    continuity_gaps: Array<MissionControlContinuityGap>;
    node_watermarks: Array<MissionControlWorkspaceWatermark>;
    activity_preview: Array<MissionControlActivityEntry>;
    launch_surfaces: Array<MissionControlLaunchSurface>;
    provider_deep_links: Array<MissionControlProviderDeepLink>;
};

export type MissionControlWorkspaceSnapshot = {
    snapshot_id: string;
    view_mode: 'graph' | 'list';
    generated_at: string;
    resume_token: string;
    effective_filters: MissionControlWorkspaceFilters;
    summary: MissionControlWorkspaceSummary;
    workspace_watermarks: Array<MissionControlWorkspaceWatermark>;
    root_groups: Array<MissionControlRootGroup>;
    nodes: Array<MissionControlNode>;
    edges: Array<MissionControlEdge>;
    next_root_cursor?: string | null;
};

export type MissionControlNodeActivityItemsResponse = {
    items: Array<MissionControlActivityEntry>;
    next_cursor?: string | null;
};

export type MissionControlLaunchPreviewRequest = {
    node_kind: 'discussion' | 'work_item' | 'run' | 'pull_request';
    node_public_id: string;
    thread_kind: 'issue' | 'pull_request';
    thread_number: number;
    target_label: string;
    removed_labels?: Array<string>;
    expected_projection_version?: number;
};

export type MissionControlLaunchPreviewLabelDiff = {
    removed_labels: Array<string>;
    added_labels: Array<string>;
    final_labels: Array<string>;
};

export type MissionControlLaunchPreviewContinuityEffect = {
    resolved_gap_ids: Array<number>;
    remaining_gap_ids: Array<number>;
    resulting_node_refs: Array<MissionControlNodeRef>;
    provider_redirects: Array<string>;
};

export type MissionControlLaunchPreview = {
    preview_id: string;
    approval_requirement: 'none' | 'owner_review';
    label_diff: MissionControlLaunchPreviewLabelDiff;
    continuity_effect: MissionControlLaunchPreviewContinuityEffect;
    blocking_reason?: string | null;
};

export type MissionControlDashboardSummary = {
    total_entities: number;
    working_count: number;
    waiting_count: number;
    blocked_count: number;
    review_count: number;
    recent_critical_updates_count: number;
};

export type MissionControlProviderReference = {
    provider: 'github' | 'platform';
    external_id: string;
    url?: string | null;
};

export type MissionControlPrimaryActor = {
    actor_type: string;
    actor_id: string;
    display_name: string;
};

export type MissionControlEntityRef = {
    entity_kind: 'work_item' | 'discussion' | 'pull_request' | 'agent';
    entity_public_id: string;
};

export type MissionControlEntityCard = {
    entity_kind: 'work_item' | 'discussion' | 'pull_request' | 'agent';
    entity_public_id: string;
    title: string;
    state: 'working' | 'waiting' | 'blocked' | 'review' | 'recent_critical_updates';
    sync_status: 'synced' | 'pending_sync' | 'failed' | 'degraded';
    provider_reference: MissionControlProviderReference;
    primary_actor?: MissionControlPrimaryActor;
    relation_count: number;
    last_timeline_at?: string | null;
    badges: Array<'blocked' | 'owner_review' | 'waiting_mcp' | 'realtime_stale' | 'voice_candidate'>;
    projection_version: number;
};

export type MissionControlRelation = {
    relation_kind: 'linked_to' | 'blocks' | 'blocked_by' | 'formalized_from' | 'owned_by' | 'assigned_to' | 'tracked_by_command';
    source_kind: 'platform' | 'provider' | 'command' | 'voice_candidate';
    source_entity_kind: 'work_item' | 'discussion' | 'pull_request' | 'agent';
    source_entity_public_id: string;
    target_entity_kind: 'work_item' | 'discussion' | 'pull_request' | 'agent';
    target_entity_public_id: string;
    direction: 'outbound' | 'inbound' | 'bidirectional';
};

export type MissionControlTimelineEntry = {
    entry_id: string;
    entity_kind: 'work_item' | 'discussion' | 'pull_request' | 'agent';
    entity_public_id: string;
    source_kind: 'provider' | 'platform' | 'command' | 'voice_candidate';
    source_ref: string;
    occurred_at: string;
    summary: string;
    body_markdown?: string | null;
    command_id?: string | null;
    provider_url?: string | null;
    is_read_only: boolean;
};

export type MissionControlAllowedAction = {
    action_kind: 'discussion.create' | 'work_item.create' | 'discussion.formalize' | 'stage.next_step.execute' | 'command.retry_sync';
    presentation: 'primary' | 'secondary' | 'danger' | 'link';
    allowed_when_degraded: boolean;
    approval_requirement: 'none' | 'owner_review';
    blocked_reason?: string | null;
};

export type MissionControlProviderDeepLink = {
    action_kind: 'provider.open_issue' | 'provider.open_pr' | 'provider.review' | 'provider.merge' | 'provider.reply_comment';
    url: string;
    reason: 'provider_policy' | 'not_in_mvp_inline_scope' | 'requires_human_review' | 'unsafe_when_degraded';
};

export type WorkItemDetailsPayload = {
    repository_full_name?: string;
    issue_number: number;
    issue_url?: string | null;
    last_run_id?: string | null;
    last_status?: string | null;
    trigger_kind?: string | null;
    work_item_type?: string | null;
    stage_label?: string | null;
    labels?: Array<string>;
    owner?: string | null;
    assignees?: Array<string>;
    last_provider_sync_at?: string | null;
};

export type DiscussionDetailsPayload = {
    discussion_kind: string;
    status?: string | null;
    author?: string | null;
    participant_count?: number;
    latest_comment_excerpt?: string | null;
    formalization_target?: string | null;
};

export type PullRequestDetailsPayload = {
    repository_full_name?: string;
    pull_request_number: number;
    pull_request_url?: string | null;
    last_run_id?: string | null;
    last_status?: string | null;
    branch_head?: string | null;
    branch_base?: string | null;
    merge_state?: string | null;
    review_decision?: string | null;
    checks_summary?: string | null;
    linked_issue_refs?: Array<string>;
};

export type AgentDetailsPayload = {
    agent_key: string;
    run_status?: string | null;
    runtime_mode?: string | null;
    waiting_reason?: string | null;
    active_run_id?: string | null;
    last_heartbeat_at?: string | null;
    last_run_repository?: string | null;
};

export type MissionControlEntityDetailsPayload = WorkItemDetailsPayload | DiscussionDetailsPayload | PullRequestDetailsPayload | AgentDetailsPayload;

export type MissionControlEntityDetails = {
    entity: MissionControlEntityCard;
    detail_payload: MissionControlEntityDetailsPayload;
    relations: Array<MissionControlRelation>;
    timeline_preview: Array<MissionControlTimelineEntry>;
    allowed_actions: Array<MissionControlAllowedAction>;
    provider_deep_links: Array<MissionControlProviderDeepLink>;
};

export type MissionControlDashboardSnapshot = {
    snapshot_id: string;
    view_mode: 'board' | 'list';
    freshness_status: 'fresh' | 'stale' | 'degraded';
    generated_at: string;
    stale_after: string;
    realtime_resume_token: string;
    summary: MissionControlDashboardSummary;
    entities: Array<MissionControlEntityCard>;
    relations: Array<MissionControlRelation>;
    next_page_cursor?: string | null;
};

export type MissionControlCommandApproval = {
    approval_state: 'not_required' | 'pending' | 'approved' | 'denied' | 'expired';
    approval_request_id?: string | null;
    requested_at?: string | null;
    decided_at?: string | null;
    approver_actor_id?: string | null;
};

export type DiscussionCreatePayload = {
    title: string;
    body_markdown?: string | null;
    parent_entity_kind?: 'work_item' | 'discussion' | 'pull_request' | 'agent';
    parent_entity_public_id?: string | null;
};

export type WorkItemCreatePayload = {
    title: string;
    body_markdown?: string | null;
    initial_labels?: Array<string>;
    related_entity_refs?: Array<MissionControlEntityRef>;
};

export type DiscussionFormalizePayload = {
    source_entity_kind: 'work_item' | 'discussion' | 'pull_request' | 'agent';
    source_entity_public_id: string;
    formalized_kind: string;
    title: string;
    body_markdown?: string | null;
};

export type MissionControlStageNextStepPayload = {
    thread_kind: string;
    thread_number: number;
    target_label: string;
    removed_labels?: Array<string>;
    display_variant?: string | null;
    approval_requirement?: 'none' | 'owner_review';
};

export type RetrySyncPayload = {
    command_id: string;
    retry_reason?: string | null;
    expected_status?: 'accepted' | 'pending_approval' | 'queued' | 'pending_sync' | 'reconciled' | 'failed' | 'blocked' | 'cancelled';
};

export type MissionControlDiscussionCreateCommandRequest = {
    command_kind: 'discussion.create';
    project_id: string;
    target_entity_kind?: 'work_item' | 'discussion' | 'pull_request' | 'agent';
    target_entity_public_id?: string | null;
    business_intent_key: string;
    expected_projection_version?: number;
    payload: DiscussionCreatePayload;
};

export type MissionControlWorkItemCreateCommandRequest = {
    command_kind: 'work_item.create';
    project_id: string;
    target_entity_kind?: 'work_item' | 'discussion' | 'pull_request' | 'agent';
    target_entity_public_id?: string | null;
    business_intent_key: string;
    expected_projection_version?: number;
    payload: WorkItemCreatePayload;
};

export type MissionControlDiscussionFormalizeCommandRequest = {
    command_kind: 'discussion.formalize';
    project_id: string;
    target_entity_kind?: 'work_item' | 'discussion' | 'pull_request' | 'agent';
    target_entity_public_id?: string | null;
    business_intent_key: string;
    expected_projection_version?: number;
    payload: DiscussionFormalizePayload;
};

export type MissionControlStageNextStepCommandRequest = {
    command_kind: 'stage.next_step.execute';
    project_id: string;
    target_entity_kind?: 'work_item' | 'discussion' | 'pull_request' | 'agent';
    target_entity_public_id?: string | null;
    business_intent_key: string;
    expected_projection_version?: number;
    payload: MissionControlStageNextStepPayload;
};

export type MissionControlRetrySyncCommandRequest = {
    command_kind: 'command.retry_sync';
    project_id: string;
    target_entity_kind?: 'work_item' | 'discussion' | 'pull_request' | 'agent';
    target_entity_public_id?: string | null;
    business_intent_key: string;
    expected_projection_version?: number;
    payload: RetrySyncPayload;
};

export type MissionControlCommandRequest = MissionControlDiscussionCreateCommandRequest | MissionControlWorkItemCreateCommandRequest | MissionControlDiscussionFormalizeCommandRequest | MissionControlStageNextStepCommandRequest | MissionControlRetrySyncCommandRequest;

export type MissionControlCommandState = {
    command_id: string;
    command_kind: 'discussion.create' | 'work_item.create' | 'discussion.formalize' | 'stage.next_step.execute' | 'command.retry_sync';
    status: 'accepted' | 'pending_approval' | 'queued' | 'pending_sync' | 'reconciled' | 'failed' | 'blocked' | 'cancelled';
    failure_reason?: 'provider_error' | 'policy_denied' | 'projection_stale' | 'duplicate_intent' | 'timeout' | 'approval_denied' | 'approval_expired' | 'unknown';
    correlation_id: string;
    status_message?: string | null;
    updated_at: string;
    reconciled_at?: string | null;
    business_intent_key: string;
    entity_refs: Array<MissionControlEntityRef>;
    provider_delivery_ids: Array<string>;
    approval?: MissionControlCommandApproval;
    blocking_reason?: string | null;
};

export type MissionControlConnectedRealtimePayload = {
    snapshot_freshness_status: 'fresh' | 'stale' | 'degraded';
    server_cursor: string;
};

export type MissionControlDeltaRealtimePayload = {
    delta_entities: Array<MissionControlEntityCard>;
    delta_relations: Array<MissionControlRelation>;
    delta_timeline_entries: Array<MissionControlTimelineEntry>;
    changed_command_ids: Array<string>;
};

export type MissionControlInvalidateRealtimePayload = {
    reason: string;
    refresh_scope: string;
    affected_entity_refs: Array<MissionControlEntityRef>;
};

export type MissionControlStaleRealtimePayload = {
    reason: string;
    stale_since: string;
    suggested_refresh: string;
};

export type MissionControlDegradedRealtimePayload = {
    reason: string;
    fallback_mode: string;
    affected_capabilities: Array<string>;
};

export type MissionControlResyncRequiredRealtimePayload = {
    reason: string;
    required_snapshot_id: string;
    dropped_event_count: number;
};

export type MissionControlHeartbeatRealtimePayload = {
    server_time: string;
    snapshot_id: string;
};

export type MissionControlErrorRealtimePayload = {
    code: string;
    message: string;
    retryable: boolean;
};

export type MissionControlRealtimePayload = MissionControlConnectedRealtimePayload | MissionControlDeltaRealtimePayload | MissionControlInvalidateRealtimePayload | MissionControlStaleRealtimePayload | MissionControlDegradedRealtimePayload | MissionControlResyncRequiredRealtimePayload | MissionControlHeartbeatRealtimePayload | MissionControlErrorRealtimePayload;

export type MissionControlRealtimeEnvelope = {
    event_kind: 'connected' | 'delta' | 'invalidate' | 'stale' | 'degraded' | 'resync_required' | 'heartbeat' | 'error';
    snapshot_id: string;
    resume_token: string;
    occurred_at: string;
    payload: MissionControlRealtimePayload;
};

export type MissionControlTimelineItemsResponse = {
    items: Array<MissionControlTimelineEntry>;
    next_cursor?: string | null;
};

export type ProjectItemsResponse = {
    items: Array<Project>;
};

export type SystemSettingItemsResponse = {
    items: Array<SystemSetting>;
};

export type RunItemsResponse = {
    items: Array<Run>;
};

export type RuntimeDeployTaskItemsResponse = {
    items: Array<RuntimeDeployTaskListItem>;
};

export type RuntimeErrorItemsResponse = {
    items: Array<RuntimeError>;
};

export type ApprovalRequestItemsResponse = {
    items: Array<ApprovalRequest>;
};

export type FlowEventItemsResponse = {
    items: Array<FlowEvent>;
};

export type LearningFeedbackItemsResponse = {
    items: Array<LearningFeedback>;
};

export type UserItemsResponse = {
    items: Array<User>;
};

export type ProjectMemberItemsResponse = {
    items: Array<ProjectMember>;
};

export type RepositoryBindingItemsResponse = {
    items: Array<RepositoryBinding>;
};

export type UpsertProjectRequest = {
    slug: string;
    name: string;
};

export type CreateUserRequest = {
    email: string;
    is_platform_admin: boolean;
};

export type UpsertProjectMemberRequest = unknown & {
    user_id?: string;
    email?: string;
    role?: 'read' | 'read_write' | 'admin';
};

export type SetProjectMemberLearningModeRequest = {
    enabled: boolean | null;
};

export type UpsertProjectRepositoryRequest = {
    provider: string;
    owner: string;
    name: string;
    token: string;
    services_yaml_path: string;
    alias?: string;
    role?: 'orchestrator' | 'service' | 'docs' | 'mixed';
    default_ref?: string;
    docs_root_path?: string;
};

export type ProjectId = string;

export type RunId = string;

export type RuntimeErrorId = string;

export type ApprovalRequestId = number;

export type SettingKey = string;

export type Page = number;

export type PageSize = number;

export type UserId = string;

export type Limit = number;

export type TriggerKindFilter = string;

export type RunStatusFilter = string;

export type AgentKeyFilter = string;

export type WaitStateFilter = string;

export type TailLines = number;

export type IncludePayload = boolean;

export type IncludeSnapshot = boolean;

export type IncludeLogs = boolean;

/**
 * Callback bearer token. Authorization: Bearer ... is also accepted.
 */
export type McpCallbackToken = string;

export type MissionControlViewMode = 'board' | 'list';

export type MissionControlActiveFilter = 'working' | 'waiting' | 'blocked' | 'review' | 'recent_critical_updates' | 'all_active';

export type MissionControlWorkspaceViewMode = 'graph' | 'list';

export type MissionControlWorkspaceStatePreset = 'working' | 'waiting' | 'blocked' | 'review' | 'recent_critical_updates' | 'all_active';

export type MissionControlSearch = string;

export type MissionControlCursor = string;

export type MissionControlRootLimit = number;

export type MissionControlResumeToken = string;

export type MissionControlCorrelationId = string;

export type MissionControlIdempotencyKey = string;

export type MissionControlEntityKind = 'work_item' | 'discussion' | 'pull_request' | 'agent';

/**
 * URL-encoded public entity identifier.
 */
export type MissionControlEntityPublicId = string;

export type MissionControlNodeKind = 'discussion' | 'work_item' | 'run' | 'pull_request';

/**
 * URL-encoded public node identifier.
 */
export type MissionControlNodePublicId = string;

export type MissionControlCommandId = string;

export type IngestGithubWebhookData = {
    body: {
        [key: string]: unknown;
    };
    headers: {
        'X-GitHub-Event': string;
        'X-GitHub-Delivery': string;
        'X-Hub-Signature-256': string;
    };
    path?: never;
    query?: never;
    url: '/api/v1/webhooks/github';
};

export type IngestGithubWebhookErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Internal error
     */
    500: ErrorResponse;
};

export type IngestGithubWebhookError = IngestGithubWebhookErrors[keyof IngestGithubWebhookErrors];

export type IngestGithubWebhookResponses = {
    /**
     * Duplicate delivery already ingested
     */
    200: IngestGitHubWebhookResponse;
    /**
     * Accepted and enqueued for processing
     */
    202: IngestGitHubWebhookResponse;
};

export type IngestGithubWebhookResponse = IngestGithubWebhookResponses[keyof IngestGithubWebhookResponses];

export type McpApproverCallbackData = {
    body: McpApprovalCallbackRequest;
    headers?: {
        /**
         * Callback bearer token. Authorization: Bearer ... is also accepted.
         */
        'X-Codex-MCP-Token'?: string;
    };
    path?: never;
    query?: never;
    url: '/api/v1/mcp/approver/callback';
};

export type McpApproverCallbackErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Internal error
     */
    500: ErrorResponse;
};

export type McpApproverCallbackError = McpApproverCallbackErrors[keyof McpApproverCallbackErrors];

export type McpApproverCallbackResponses = {
    /**
     * Approval callback applied
     */
    200: ResolveApprovalDecisionResponse;
};

export type McpApproverCallbackResponse = McpApproverCallbackResponses[keyof McpApproverCallbackResponses];

export type McpExecutorCallbackData = {
    body: McpApprovalCallbackRequest;
    headers?: {
        /**
         * Callback bearer token. Authorization: Bearer ... is also accepted.
         */
        'X-Codex-MCP-Token'?: string;
    };
    path?: never;
    query?: never;
    url: '/api/v1/mcp/executor/callback';
};

export type McpExecutorCallbackErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Internal error
     */
    500: ErrorResponse;
};

export type McpExecutorCallbackError = McpExecutorCallbackErrors[keyof McpExecutorCallbackErrors];

export type McpExecutorCallbackResponses = {
    /**
     * Executor callback applied
     */
    200: ResolveApprovalDecisionResponse;
};

export type McpExecutorCallbackResponse = McpExecutorCallbackResponses[keyof McpExecutorCallbackResponses];

export type McpInteractionCallbackData = {
    body: InteractionCallbackEnvelope;
    headers?: {
        /**
         * Callback bearer token. Authorization: Bearer ... is also accepted.
         */
        'X-Codex-MCP-Token'?: string;
    };
    path?: never;
    query?: never;
    url: '/api/v1/mcp/interactions/callback';
};

export type McpInteractionCallbackErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Not found
     */
    404: ErrorResponse;
    /**
     * Rate limit exceeded
     */
    429: ErrorResponse;
    /**
     * Internal error
     */
    500: ErrorResponse;
};

export type McpInteractionCallbackError = McpInteractionCallbackErrors[keyof McpInteractionCallbackErrors];

export type McpInteractionCallbackResponses = {
    /**
     * Interaction callback classified and applied
     */
    200: InteractionCallbackOutcome;
};

export type McpInteractionCallbackResponse = McpInteractionCallbackResponses[keyof McpInteractionCallbackResponses];

export type LoginGithubData = {
    body?: never;
    path?: never;
    query?: never;
    url: '/api/v1/auth/github/login';
};

export type LoginGithubErrors = {
    /**
     * Internal error
     */
    500: ErrorResponse;
};

export type LoginGithubError = LoginGithubErrors[keyof LoginGithubErrors];

export type CallbackGithubData = {
    body?: never;
    path?: never;
    query: {
        state: string;
        code: string;
    };
    url: '/api/v1/auth/github/callback';
};

export type CallbackGithubErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Internal error
     */
    500: ErrorResponse;
};

export type CallbackGithubError = CallbackGithubErrors[keyof CallbackGithubErrors];

export type LogoutData = {
    body?: never;
    path?: never;
    query?: never;
    url: '/api/v1/auth/logout';
};

export type LogoutErrors = {
    /**
     * Unauthorized
     */
    401: ErrorResponse;
};

export type LogoutError = LogoutErrors[keyof LogoutErrors];

export type LogoutResponses = {
    /**
     * Logged out
     */
    204: void;
};

export type LogoutResponse = LogoutResponses[keyof LogoutResponses];

export type GetMeData = {
    body?: never;
    path?: never;
    query?: never;
    url: '/api/v1/auth/me';
};

export type GetMeErrors = {
    /**
     * Unauthorized
     */
    401: ErrorResponse;
};

export type GetMeError = GetMeErrors[keyof GetMeErrors];

export type GetMeResponses = {
    /**
     * Authenticated principal
     */
    200: MeResponse;
};

export type GetMeResponse = GetMeResponses[keyof GetMeResponses];

export type ListProjectsData = {
    body?: never;
    path?: never;
    query?: {
        limit?: number;
    };
    url: '/api/v1/staff/projects';
};

export type ListProjectsErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
};

export type ListProjectsError = ListProjectsErrors[keyof ListProjectsErrors];

export type ListProjectsResponses = {
    /**
     * Project list
     */
    200: ProjectItemsResponse;
};

export type ListProjectsResponse = ListProjectsResponses[keyof ListProjectsResponses];

export type UpsertProjectData = {
    body: UpsertProjectRequest;
    path?: never;
    query?: never;
    url: '/api/v1/staff/projects';
};

export type UpsertProjectErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
    /**
     * Internal error
     */
    500: ErrorResponse;
};

export type UpsertProjectError = UpsertProjectErrors[keyof UpsertProjectErrors];

export type UpsertProjectResponses = {
    /**
     * Project created or updated
     */
    201: Project;
};

export type UpsertProjectResponse = UpsertProjectResponses[keyof UpsertProjectResponses];

export type DeleteProjectData = {
    body?: never;
    path: {
        project_id: string;
    };
    query?: never;
    url: '/api/v1/staff/projects/{project_id}';
};

export type DeleteProjectErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
};

export type DeleteProjectError = DeleteProjectErrors[keyof DeleteProjectErrors];

export type DeleteProjectResponses = {
    /**
     * Project deleted
     */
    204: void;
};

export type DeleteProjectResponse = DeleteProjectResponses[keyof DeleteProjectResponses];

export type GetProjectData = {
    body?: never;
    path: {
        project_id: string;
    };
    query?: never;
    url: '/api/v1/staff/projects/{project_id}';
};

export type GetProjectErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Not found
     */
    404: ErrorResponse;
};

export type GetProjectError = GetProjectErrors[keyof GetProjectErrors];

export type GetProjectResponses = {
    /**
     * Project
     */
    200: Project;
};

export type GetProjectResponse = GetProjectResponses[keyof GetProjectResponses];

export type ListRunWaitsData = {
    body?: never;
    path?: never;
    query?: {
        limit?: number;
        trigger_kind?: string;
        status?: string;
        agent_key?: string;
        wait_state?: string;
    };
    url: '/api/v1/staff/runs/waits';
};

export type ListRunWaitsErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
};

export type ListRunWaitsError = ListRunWaitsErrors[keyof ListRunWaitsErrors];

export type ListRunWaitsResponses = {
    /**
     * Wait queue list
     */
    200: RunItemsResponse;
};

export type ListRunWaitsResponse = ListRunWaitsResponses[keyof ListRunWaitsResponses];

export type RunsRealtimeData = {
    body?: never;
    path?: never;
    query?: {
        page?: number;
        page_size?: number;
    };
    url: '/api/v1/staff/runs/realtime';
};

export type RunsRealtimeErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
};

export type RunsRealtimeError = RunsRealtimeErrors[keyof RunsRealtimeErrors];

export type RunsRealtimeResponses = {
    /**
     * Realtime runs list stream endpoint (expects WebSocket upgrade)
     */
    200: unknown;
};

export type ListPendingApprovalsData = {
    body?: never;
    path?: never;
    query?: {
        limit?: number;
    };
    url: '/api/v1/staff/approvals';
};

export type ListPendingApprovalsErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
};

export type ListPendingApprovalsError = ListPendingApprovalsErrors[keyof ListPendingApprovalsErrors];

export type ListPendingApprovalsResponses = {
    /**
     * Pending approvals list
     */
    200: ApprovalRequestItemsResponse;
};

export type ListPendingApprovalsResponse = ListPendingApprovalsResponses[keyof ListPendingApprovalsResponses];

export type ResolveApprovalDecisionData = {
    body: ResolveApprovalDecisionRequest;
    path: {
        approval_request_id: number;
    };
    query?: never;
    url: '/api/v1/staff/approvals/{approval_request_id}/decision';
};

export type ResolveApprovalDecisionErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
    /**
     * Not found
     */
    404: ErrorResponse;
};

export type ResolveApprovalDecisionError = ResolveApprovalDecisionErrors[keyof ResolveApprovalDecisionErrors];

export type ResolveApprovalDecisionResponses = {
    /**
     * Approval resolved
     */
    200: ResolveApprovalDecisionResponse;
};

export type ResolveApprovalDecisionResponse2 = ResolveApprovalDecisionResponses[keyof ResolveApprovalDecisionResponses];

export type ListSystemSettingsData = {
    body?: never;
    path?: never;
    query?: never;
    url: '/api/v1/staff/system-settings';
};

export type ListSystemSettingsErrors = {
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
};

export type ListSystemSettingsError = ListSystemSettingsErrors[keyof ListSystemSettingsErrors];

export type ListSystemSettingsResponses = {
    /**
     * Platform system settings list
     */
    200: SystemSettingItemsResponse;
};

export type ListSystemSettingsResponse = ListSystemSettingsResponses[keyof ListSystemSettingsResponses];

export type SystemSettingsRealtimeData = {
    body?: never;
    path?: never;
    query?: never;
    url: '/api/v1/staff/system-settings/realtime';
};

export type SystemSettingsRealtimeErrors = {
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
};

export type SystemSettingsRealtimeError = SystemSettingsRealtimeErrors[keyof SystemSettingsRealtimeErrors];

export type SystemSettingsRealtimeResponses = {
    /**
     * System settings realtime stream endpoint (expects WebSocket upgrade)
     */
    200: unknown;
};

export type GetSystemSettingData = {
    body?: never;
    path: {
        setting_key: string;
    };
    query?: never;
    url: '/api/v1/staff/system-settings/{setting_key}';
};

export type GetSystemSettingErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
    /**
     * Not found
     */
    404: ErrorResponse;
};

export type GetSystemSettingError = GetSystemSettingErrors[keyof GetSystemSettingErrors];

export type GetSystemSettingResponses = {
    /**
     * Platform system setting
     */
    200: SystemSetting;
};

export type GetSystemSettingResponse = GetSystemSettingResponses[keyof GetSystemSettingResponses];

export type UpdateSystemSettingBooleanData = {
    body: UpdateSystemSettingBooleanRequest;
    path: {
        setting_key: string;
    };
    query?: never;
    url: '/api/v1/staff/system-settings/{setting_key}';
};

export type UpdateSystemSettingBooleanErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
    /**
     * Not found
     */
    404: ErrorResponse;
};

export type UpdateSystemSettingBooleanError = UpdateSystemSettingBooleanErrors[keyof UpdateSystemSettingBooleanErrors];

export type UpdateSystemSettingBooleanResponses = {
    /**
     * Updated platform system setting
     */
    200: SystemSetting;
};

export type UpdateSystemSettingBooleanResponse = UpdateSystemSettingBooleanResponses[keyof UpdateSystemSettingBooleanResponses];

export type ResetSystemSettingData = {
    body?: never;
    path: {
        setting_key: string;
    };
    query?: never;
    url: '/api/v1/staff/system-settings/{setting_key}/reset';
};

export type ResetSystemSettingErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
    /**
     * Not found
     */
    404: ErrorResponse;
};

export type ResetSystemSettingError = ResetSystemSettingErrors[keyof ResetSystemSettingErrors];

export type ResetSystemSettingResponses = {
    /**
     * Reset platform system setting
     */
    200: SystemSetting;
};

export type ResetSystemSettingResponse = ResetSystemSettingResponses[keyof ResetSystemSettingResponses];

export type GetRunData = {
    body?: never;
    path: {
        run_id: string;
    };
    query?: never;
    url: '/api/v1/staff/runs/{run_id}';
};

export type GetRunErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Not found
     */
    404: ErrorResponse;
};

export type GetRunError = GetRunErrors[keyof GetRunErrors];

export type GetRunResponses = {
    /**
     * Run details
     */
    200: Run;
};

export type GetRunResponse = GetRunResponses[keyof GetRunResponses];

export type CancelRunData = {
    body?: RunActionRequest;
    path: {
        run_id: string;
    };
    query?: never;
    url: '/api/v1/staff/runs/{run_id}/cancel';
};

export type CancelRunErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
    /**
     * Not found
     */
    404: ErrorResponse;
    /**
     * Conflict
     */
    409: ErrorResponse;
};

export type CancelRunError = CancelRunErrors[keyof CancelRunErrors];

export type CancelRunResponses = {
    /**
     * Run cancel result
     */
    200: RunActionResponse;
};

export type CancelRunResponse = CancelRunResponses[keyof CancelRunResponses];

export type DeleteRunNamespaceData = {
    body?: never;
    path: {
        run_id: string;
    };
    query?: never;
    url: '/api/v1/staff/runs/{run_id}/namespace';
};

export type DeleteRunNamespaceErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
};

export type DeleteRunNamespaceError = DeleteRunNamespaceErrors[keyof DeleteRunNamespaceErrors];

export type DeleteRunNamespaceResponses = {
    /**
     * Namespace cleanup result
     */
    200: RunNamespaceCleanupResponse;
};

export type DeleteRunNamespaceResponse = DeleteRunNamespaceResponses[keyof DeleteRunNamespaceResponses];

export type ListRunEventsData = {
    body?: never;
    path: {
        run_id: string;
    };
    query?: {
        limit?: number;
        include_payload?: boolean;
    };
    url: '/api/v1/staff/runs/{run_id}/events';
};

export type ListRunEventsErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
};

export type ListRunEventsError = ListRunEventsErrors[keyof ListRunEventsErrors];

export type ListRunEventsResponses = {
    /**
     * Flow events list
     */
    200: FlowEventItemsResponse;
};

export type ListRunEventsResponse = ListRunEventsResponses[keyof ListRunEventsResponses];

export type RunRealtimeData = {
    body?: never;
    path: {
        run_id: string;
    };
    query?: {
        limit?: number;
        tail_lines?: number;
        include_logs?: boolean;
    };
    url: '/api/v1/staff/runs/{run_id}/realtime';
};

export type RunRealtimeErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
};

export type RunRealtimeError = RunRealtimeErrors[keyof RunRealtimeErrors];

export type RunRealtimeResponses = {
    /**
     * Realtime stream endpoint (expects WebSocket upgrade)
     */
    200: RunRealtimeMessage;
};

export type RunRealtimeResponse = RunRealtimeResponses[keyof RunRealtimeResponses];

export type GetRunLogsData = {
    body?: never;
    path: {
        run_id: string;
    };
    query?: {
        tail_lines?: number;
        include_snapshot?: boolean;
    };
    url: '/api/v1/staff/runs/{run_id}/logs';
};

export type GetRunLogsErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Not found
     */
    404: ErrorResponse;
};

export type GetRunLogsError = GetRunLogsErrors[keyof GetRunLogsErrors];

export type GetRunLogsResponses = {
    /**
     * Run logs snapshot
     */
    200: RunLogs;
};

export type GetRunLogsResponse = GetRunLogsResponses[keyof GetRunLogsResponses];

export type ListRunLearningFeedbackData = {
    body?: never;
    path: {
        run_id: string;
    };
    query?: {
        limit?: number;
    };
    url: '/api/v1/staff/runs/{run_id}/learning-feedback';
};

export type ListRunLearningFeedbackErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
};

export type ListRunLearningFeedbackError = ListRunLearningFeedbackErrors[keyof ListRunLearningFeedbackErrors];

export type ListRunLearningFeedbackResponses = {
    /**
     * Learning feedback list
     */
    200: LearningFeedbackItemsResponse;
};

export type ListRunLearningFeedbackResponse = ListRunLearningFeedbackResponses[keyof ListRunLearningFeedbackResponses];

export type RuntimeDeployTasksRealtimeData = {
    body?: never;
    path?: never;
    query?: {
        page?: number;
        page_size?: number;
        status?: 'pending' | 'running' | 'succeeded' | 'failed' | 'canceled';
        target_env?: string;
    };
    url: '/api/v1/staff/runtime-deploy/tasks/realtime';
};

export type RuntimeDeployTasksRealtimeErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
};

export type RuntimeDeployTasksRealtimeError = RuntimeDeployTasksRealtimeErrors[keyof RuntimeDeployTasksRealtimeErrors];

export type RuntimeDeployTasksRealtimeResponses = {
    /**
     * Realtime runtime deploy tasks stream endpoint (expects WebSocket upgrade)
     */
    200: unknown;
};

export type GetRuntimeDeployTaskData = {
    body?: never;
    path: {
        run_id: string;
    };
    query?: never;
    url: '/api/v1/staff/runtime-deploy/tasks/{run_id}';
};

export type GetRuntimeDeployTaskErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
    /**
     * Not found
     */
    404: ErrorResponse;
};

export type GetRuntimeDeployTaskError = GetRuntimeDeployTaskErrors[keyof GetRuntimeDeployTaskErrors];

export type GetRuntimeDeployTaskResponses = {
    /**
     * Runtime deploy task details
     */
    200: RuntimeDeployTask;
};

export type GetRuntimeDeployTaskResponse = GetRuntimeDeployTaskResponses[keyof GetRuntimeDeployTaskResponses];

export type CancelRuntimeDeployTaskData = {
    body?: RuntimeDeployTaskActionRequest;
    path: {
        run_id: string;
    };
    query?: never;
    url: '/api/v1/staff/runtime-deploy/tasks/{run_id}/cancel';
};

export type CancelRuntimeDeployTaskErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
    /**
     * Not found
     */
    404: ErrorResponse;
    /**
     * Conflict
     */
    409: ErrorResponse;
};

export type CancelRuntimeDeployTaskError = CancelRuntimeDeployTaskErrors[keyof CancelRuntimeDeployTaskErrors];

export type CancelRuntimeDeployTaskResponses = {
    /**
     * Runtime deploy task action result
     */
    200: RuntimeDeployTaskActionResponse;
};

export type CancelRuntimeDeployTaskResponse = CancelRuntimeDeployTaskResponses[keyof CancelRuntimeDeployTaskResponses];

export type StopRuntimeDeployTaskData = {
    body?: RuntimeDeployTaskActionRequest;
    path: {
        run_id: string;
    };
    query?: never;
    url: '/api/v1/staff/runtime-deploy/tasks/{run_id}/stop';
};

export type StopRuntimeDeployTaskErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
    /**
     * Not found
     */
    404: ErrorResponse;
    /**
     * Conflict
     */
    409: ErrorResponse;
};

export type StopRuntimeDeployTaskError = StopRuntimeDeployTaskErrors[keyof StopRuntimeDeployTaskErrors];

export type StopRuntimeDeployTaskResponses = {
    /**
     * Runtime deploy task action result
     */
    200: RuntimeDeployTaskActionResponse;
};

export type StopRuntimeDeployTaskResponse = StopRuntimeDeployTaskResponses[keyof StopRuntimeDeployTaskResponses];

export type ListRuntimeErrorsData = {
    body?: never;
    path?: never;
    query?: {
        limit?: number;
        state?: 'active' | 'viewed' | 'all';
        level?: 'error' | 'warning' | 'critical';
        source?: string;
        run_id?: string;
        correlation_id?: string;
    };
    url: '/api/v1/staff/runtime-errors';
};

export type ListRuntimeErrorsErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
};

export type ListRuntimeErrorsError = ListRuntimeErrorsErrors[keyof ListRuntimeErrorsErrors];

export type ListRuntimeErrorsResponses = {
    /**
     * Runtime error journal entries
     */
    200: RuntimeErrorItemsResponse;
};

export type ListRuntimeErrorsResponse = ListRuntimeErrorsResponses[keyof ListRuntimeErrorsResponses];

export type MarkRuntimeErrorViewedData = {
    body?: never;
    path: {
        runtime_error_id: string;
    };
    query?: never;
    url: '/api/v1/staff/runtime-errors/{runtime_error_id}/viewed';
};

export type MarkRuntimeErrorViewedErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
    /**
     * Not found
     */
    404: ErrorResponse;
};

export type MarkRuntimeErrorViewedError = MarkRuntimeErrorViewedErrors[keyof MarkRuntimeErrorViewedErrors];

export type MarkRuntimeErrorViewedResponses = {
    /**
     * Runtime error marked as viewed
     */
    200: RuntimeError;
};

export type MarkRuntimeErrorViewedResponse = MarkRuntimeErrorViewedResponses[keyof MarkRuntimeErrorViewedResponses];

export type ListUsersData = {
    body?: never;
    path?: never;
    query?: {
        limit?: number;
    };
    url: '/api/v1/staff/users';
};

export type ListUsersErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
};

export type ListUsersError = ListUsersErrors[keyof ListUsersErrors];

export type ListUsersResponses = {
    /**
     * Users list
     */
    200: UserItemsResponse;
};

export type ListUsersResponse = ListUsersResponses[keyof ListUsersResponses];

export type CreateUserData = {
    body: CreateUserRequest;
    path?: never;
    query?: never;
    url: '/api/v1/staff/users';
};

export type CreateUserErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
};

export type CreateUserError = CreateUserErrors[keyof CreateUserErrors];

export type CreateUserResponses = {
    /**
     * User created
     */
    201: User;
};

export type CreateUserResponse = CreateUserResponses[keyof CreateUserResponses];

export type DeleteUserData = {
    body?: never;
    path: {
        user_id: string;
    };
    query?: never;
    url: '/api/v1/staff/users/{user_id}';
};

export type DeleteUserErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
};

export type DeleteUserError = DeleteUserErrors[keyof DeleteUserErrors];

export type DeleteUserResponses = {
    /**
     * User deleted
     */
    204: void;
};

export type DeleteUserResponse = DeleteUserResponses[keyof DeleteUserResponses];

export type ListProjectMembersData = {
    body?: never;
    path: {
        project_id: string;
    };
    query?: {
        limit?: number;
    };
    url: '/api/v1/staff/projects/{project_id}/members';
};

export type ListProjectMembersErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
};

export type ListProjectMembersError = ListProjectMembersErrors[keyof ListProjectMembersErrors];

export type ListProjectMembersResponses = {
    /**
     * Project members list
     */
    200: ProjectMemberItemsResponse;
};

export type ListProjectMembersResponse = ListProjectMembersResponses[keyof ListProjectMembersResponses];

export type UpsertProjectMemberData = {
    body: UpsertProjectMemberRequest;
    path: {
        project_id: string;
    };
    query?: never;
    url: '/api/v1/staff/projects/{project_id}/members';
};

export type UpsertProjectMemberErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
};

export type UpsertProjectMemberError = UpsertProjectMemberErrors[keyof UpsertProjectMemberErrors];

export type UpsertProjectMemberResponses = {
    /**
     * Member upserted
     */
    204: void;
};

export type UpsertProjectMemberResponse = UpsertProjectMemberResponses[keyof UpsertProjectMemberResponses];

export type DeleteProjectMemberData = {
    body?: never;
    path: {
        project_id: string;
        user_id: string;
    };
    query?: never;
    url: '/api/v1/staff/projects/{project_id}/members/{user_id}';
};

export type DeleteProjectMemberErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
};

export type DeleteProjectMemberError = DeleteProjectMemberErrors[keyof DeleteProjectMemberErrors];

export type DeleteProjectMemberResponses = {
    /**
     * Member deleted
     */
    204: void;
};

export type DeleteProjectMemberResponse = DeleteProjectMemberResponses[keyof DeleteProjectMemberResponses];

export type SetProjectMemberLearningModeOverrideData = {
    body: SetProjectMemberLearningModeRequest;
    path: {
        project_id: string;
        user_id: string;
    };
    query?: never;
    url: '/api/v1/staff/projects/{project_id}/members/{user_id}/learning-mode';
};

export type SetProjectMemberLearningModeOverrideErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
};

export type SetProjectMemberLearningModeOverrideError = SetProjectMemberLearningModeOverrideErrors[keyof SetProjectMemberLearningModeOverrideErrors];

export type SetProjectMemberLearningModeOverrideResponses = {
    /**
     * Learning mode override updated
     */
    204: void;
};

export type SetProjectMemberLearningModeOverrideResponse = SetProjectMemberLearningModeOverrideResponses[keyof SetProjectMemberLearningModeOverrideResponses];

export type ListProjectRepositoriesData = {
    body?: never;
    path: {
        project_id: string;
    };
    query?: {
        limit?: number;
    };
    url: '/api/v1/staff/projects/{project_id}/repositories';
};

export type ListProjectRepositoriesErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
};

export type ListProjectRepositoriesError = ListProjectRepositoriesErrors[keyof ListProjectRepositoriesErrors];

export type ListProjectRepositoriesResponses = {
    /**
     * Project repositories list
     */
    200: RepositoryBindingItemsResponse;
};

export type ListProjectRepositoriesResponse = ListProjectRepositoriesResponses[keyof ListProjectRepositoriesResponses];

export type UpsertProjectRepositoryData = {
    body: UpsertProjectRepositoryRequest;
    path: {
        project_id: string;
    };
    query?: never;
    url: '/api/v1/staff/projects/{project_id}/repositories';
};

export type UpsertProjectRepositoryErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
};

export type UpsertProjectRepositoryError = UpsertProjectRepositoryErrors[keyof UpsertProjectRepositoryErrors];

export type UpsertProjectRepositoryResponses = {
    /**
     * Repository binding created or updated
     */
    201: RepositoryBinding;
};

export type UpsertProjectRepositoryResponse = UpsertProjectRepositoryResponses[keyof UpsertProjectRepositoryResponses];

export type DeleteProjectRepositoryData = {
    body?: never;
    path: {
        project_id: string;
        repository_id: string;
    };
    query?: never;
    url: '/api/v1/staff/projects/{project_id}/repositories/{repository_id}';
};

export type DeleteProjectRepositoryErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
};

export type DeleteProjectRepositoryError = DeleteProjectRepositoryErrors[keyof DeleteProjectRepositoryErrors];

export type DeleteProjectRepositoryResponses = {
    /**
     * Repository binding deleted
     */
    204: void;
};

export type DeleteProjectRepositoryResponse = DeleteProjectRepositoryResponses[keyof DeleteProjectRepositoryResponses];

export type UpsertRepositoryBotParamsData = {
    body: UpsertRepositoryBotParamsRequest;
    path: {
        project_id: string;
        repository_id: string;
    };
    query?: never;
    url: '/api/v1/staff/projects/{project_id}/repositories/{repository_id}/bot-params';
};

export type UpsertRepositoryBotParamsErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
};

export type UpsertRepositoryBotParamsError = UpsertRepositoryBotParamsErrors[keyof UpsertRepositoryBotParamsErrors];

export type UpsertRepositoryBotParamsResponses = {
    /**
     * Repository bot params updated
     */
    204: void;
};

export type UpsertRepositoryBotParamsResponse = UpsertRepositoryBotParamsResponses[keyof UpsertRepositoryBotParamsResponses];

export type RunRepositoryPreflightData = {
    body?: never;
    path: {
        project_id: string;
        repository_id: string;
    };
    query?: never;
    url: '/api/v1/staff/projects/{project_id}/repositories/{repository_id}/preflight';
};

export type RunRepositoryPreflightErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
};

export type RunRepositoryPreflightError = RunRepositoryPreflightErrors[keyof RunRepositoryPreflightErrors];

export type RunRepositoryPreflightResponses = {
    /**
     * Preflight report
     */
    200: RunRepositoryPreflightResponse;
};

export type RunRepositoryPreflightResponse2 = RunRepositoryPreflightResponses[keyof RunRepositoryPreflightResponses];

export type GetProjectGitHubTokensData = {
    body?: never;
    path: {
        project_id: string;
    };
    query?: never;
    url: '/api/v1/staff/projects/{project_id}/github-tokens';
};

export type GetProjectGitHubTokensErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
};

export type GetProjectGitHubTokensError = GetProjectGitHubTokensErrors[keyof GetProjectGitHubTokensErrors];

export type GetProjectGitHubTokensResponses = {
    /**
     * Project GitHub tokens
     */
    200: ProjectGitHubTokens;
};

export type GetProjectGitHubTokensResponse = GetProjectGitHubTokensResponses[keyof GetProjectGitHubTokensResponses];

export type UpsertProjectGitHubTokensData = {
    body: UpsertProjectGitHubTokensRequest;
    path: {
        project_id: string;
    };
    query?: never;
    url: '/api/v1/staff/projects/{project_id}/github-tokens';
};

export type UpsertProjectGitHubTokensErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
};

export type UpsertProjectGitHubTokensError = UpsertProjectGitHubTokensErrors[keyof UpsertProjectGitHubTokensErrors];

export type UpsertProjectGitHubTokensResponses = {
    /**
     * Project GitHub tokens updated
     */
    204: void;
};

export type UpsertProjectGitHubTokensResponse = UpsertProjectGitHubTokensResponses[keyof UpsertProjectGitHubTokensResponses];

export type PreviewNextStepActionData = {
    body: NextStepActionRequest;
    path?: never;
    query?: never;
    url: '/api/v1/staff/github/next-step-actions/preview';
};

export type PreviewNextStepActionErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
};

export type PreviewNextStepActionError = PreviewNextStepActionErrors[keyof PreviewNextStepActionErrors];

export type PreviewNextStepActionResponses = {
    /**
     * Next-step action preview
     */
    200: NextStepActionResponse;
};

export type PreviewNextStepActionResponse = PreviewNextStepActionResponses[keyof PreviewNextStepActionResponses];

export type ExecuteNextStepActionData = {
    body: NextStepActionRequest;
    path?: never;
    query?: never;
    url: '/api/v1/staff/github/next-step-actions/execute';
};

export type ExecuteNextStepActionErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
};

export type ExecuteNextStepActionError = ExecuteNextStepActionErrors[keyof ExecuteNextStepActionErrors];

export type ExecuteNextStepActionResponses = {
    /**
     * Next-step action executed
     */
    200: NextStepActionResponse;
};

export type ExecuteNextStepActionResponse = ExecuteNextStepActionResponses[keyof ExecuteNextStepActionResponses];

export type ListDocsetGroupsData = {
    body?: never;
    path?: never;
    query?: {
        docset_ref?: string;
        locale?: 'ru' | 'en';
    };
    url: '/api/v1/staff/docset/groups';
};

export type ListDocsetGroupsErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
};

export type ListDocsetGroupsError = ListDocsetGroupsErrors[keyof ListDocsetGroupsErrors];

export type ListDocsetGroupsResponses = {
    /**
     * Docset groups
     */
    200: DocsetGroupItemsResponse;
};

export type ListDocsetGroupsResponse = ListDocsetGroupsResponses[keyof ListDocsetGroupsResponses];

export type ImportDocsetData = {
    body: ImportDocsetRequest;
    path: {
        project_id: string;
    };
    query?: never;
    url: '/api/v1/staff/projects/{project_id}/docset/import';
};

export type ImportDocsetErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
};

export type ImportDocsetError = ImportDocsetErrors[keyof ImportDocsetErrors];

export type ImportDocsetResponses = {
    /**
     * Import created PR
     */
    200: ImportDocsetResponse;
};

export type ImportDocsetResponse2 = ImportDocsetResponses[keyof ImportDocsetResponses];

export type SyncDocsetData = {
    body: SyncDocsetRequest;
    path: {
        project_id: string;
    };
    query?: never;
    url: '/api/v1/staff/projects/{project_id}/docset/sync';
};

export type SyncDocsetErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
};

export type SyncDocsetError = SyncDocsetErrors[keyof SyncDocsetErrors];

export type SyncDocsetResponses = {
    /**
     * Sync created PR
     */
    200: SyncDocsetResponse;
};

export type SyncDocsetResponse2 = SyncDocsetResponses[keyof SyncDocsetResponses];

export type GetMissionControlWorkspaceData = {
    body?: never;
    path?: never;
    query?: {
        view_mode?: 'graph' | 'list';
        state_preset?: 'working' | 'waiting' | 'blocked' | 'review' | 'recent_critical_updates' | 'all_active';
        search?: string;
        cursor?: string;
        root_limit?: number;
    };
    url: '/api/v1/staff/mission-control/workspace';
};

export type GetMissionControlWorkspaceErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
    /**
     * Conflict
     */
    409: ErrorResponse;
};

export type GetMissionControlWorkspaceError = GetMissionControlWorkspaceErrors[keyof GetMissionControlWorkspaceErrors];

export type GetMissionControlWorkspaceResponses = {
    /**
     * Mission Control workspace snapshot
     */
    200: MissionControlWorkspaceSnapshot;
};

export type GetMissionControlWorkspaceResponse = GetMissionControlWorkspaceResponses[keyof GetMissionControlWorkspaceResponses];

export type GetMissionControlNodeData = {
    body?: never;
    path: {
        node_kind: 'discussion' | 'work_item' | 'run' | 'pull_request';
        /**
         * URL-encoded public node identifier.
         */
        node_public_id: string;
    };
    query?: never;
    url: '/api/v1/staff/mission-control/nodes/{node_kind}/{node_public_id}';
};

export type GetMissionControlNodeErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
    /**
     * Not found
     */
    404: ErrorResponse;
    /**
     * Conflict
     */
    409: ErrorResponse;
};

export type GetMissionControlNodeError = GetMissionControlNodeErrors[keyof GetMissionControlNodeErrors];

export type GetMissionControlNodeResponses = {
    /**
     * Mission Control node details
     */
    200: MissionControlNodeDetails;
};

export type GetMissionControlNodeResponse = GetMissionControlNodeResponses[keyof GetMissionControlNodeResponses];

export type ListMissionControlNodeActivityData = {
    body?: never;
    path: {
        node_kind: 'discussion' | 'work_item' | 'run' | 'pull_request';
        /**
         * URL-encoded public node identifier.
         */
        node_public_id: string;
    };
    query?: {
        cursor?: string;
        limit?: number;
    };
    url: '/api/v1/staff/mission-control/nodes/{node_kind}/{node_public_id}/activity';
};

export type ListMissionControlNodeActivityErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
    /**
     * Not found
     */
    404: ErrorResponse;
    /**
     * Conflict
     */
    409: ErrorResponse;
};

export type ListMissionControlNodeActivityError = ListMissionControlNodeActivityErrors[keyof ListMissionControlNodeActivityErrors];

export type ListMissionControlNodeActivityResponses = {
    /**
     * Mission Control node activity page
     */
    200: MissionControlNodeActivityItemsResponse;
};

export type ListMissionControlNodeActivityResponse = ListMissionControlNodeActivityResponses[keyof ListMissionControlNodeActivityResponses];

export type PreviewMissionControlLaunchData = {
    body: MissionControlLaunchPreviewRequest;
    path?: never;
    query?: never;
    url: '/api/v1/staff/mission-control/launch-preview';
};

export type PreviewMissionControlLaunchErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
    /**
     * Not found
     */
    404: ErrorResponse;
    /**
     * Conflict
     */
    409: ErrorResponse;
};

export type PreviewMissionControlLaunchError = PreviewMissionControlLaunchErrors[keyof PreviewMissionControlLaunchErrors];

export type PreviewMissionControlLaunchResponses = {
    /**
     * Mission Control launch preview
     */
    200: MissionControlLaunchPreview;
};

export type PreviewMissionControlLaunchResponse = PreviewMissionControlLaunchResponses[keyof PreviewMissionControlLaunchResponses];

export type SubmitMissionControlCommandData = {
    body: MissionControlCommandRequest;
    headers: {
        'Idempotency-Key': string;
        'X-Correlation-ID'?: string;
    };
    path?: never;
    query?: never;
    url: '/api/v1/staff/mission-control/commands';
};

export type SubmitMissionControlCommandErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
    /**
     * Not found
     */
    404: ErrorResponse;
    /**
     * Conflict
     */
    409: ErrorResponse;
    /**
     * Rate limit exceeded
     */
    429: ErrorResponse;
};

export type SubmitMissionControlCommandError = SubmitMissionControlCommandErrors[keyof SubmitMissionControlCommandErrors];

export type SubmitMissionControlCommandResponses = {
    /**
     * Mission Control command accepted
     */
    200: MissionControlCommandState;
};

export type SubmitMissionControlCommandResponse = SubmitMissionControlCommandResponses[keyof SubmitMissionControlCommandResponses];

export type GetMissionControlCommandData = {
    body?: never;
    path: {
        command_id: string;
    };
    query?: never;
    url: '/api/v1/staff/mission-control/commands/{command_id}';
};

export type GetMissionControlCommandErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
    /**
     * Not found
     */
    404: ErrorResponse;
};

export type GetMissionControlCommandError = GetMissionControlCommandErrors[keyof GetMissionControlCommandErrors];

export type GetMissionControlCommandResponses = {
    /**
     * Mission Control command status
     */
    200: MissionControlCommandState;
};

export type GetMissionControlCommandResponse = GetMissionControlCommandResponses[keyof GetMissionControlCommandResponses];

export type MissionControlRealtimeData = {
    body?: never;
    path?: never;
    query: {
        resume_token: string;
    };
    url: '/api/v1/staff/mission-control/realtime';
};

export type MissionControlRealtimeErrors = {
    /**
     * Invalid request
     */
    400: ErrorResponse;
    /**
     * Unauthorized
     */
    401: ErrorResponse;
    /**
     * Forbidden
     */
    403: ErrorResponse;
    /**
     * Conflict
     */
    409: ErrorResponse;
};

export type MissionControlRealtimeError = MissionControlRealtimeErrors[keyof MissionControlRealtimeErrors];

export type MissionControlRealtimeResponses = {
    /**
     * Mission Control realtime stream endpoint (expects WebSocket upgrade)
     */
    200: unknown;
};
