# proxy/flow | 1671 func | 12 pipelines | 14 hub-types | 2026-03-23

PIPELINES[12] (Core:3, IO:3, Refactor:1, Unknown:5):
  Src [IO]: args → list[str]
              → cmd_browser_list(args)                  CC=6    IO ▶
              → detect_all_profiles() → list[BrowserProfile] CC=1    mutation
              → detect_chromium_profiles() → list[BrowserProfile] CC=1    pure
              → _detect_browser_profile(browser_name:str, config_path:str) → list[BrowserProfile] CC=1    pure
              → _detect_chromium_family(base_dir:Path, browser:str) → list[BrowserProfile] CC=9    IO
              → _scan_chrome_cookies(cookies_file:Path) → list[str] CC=1    pure
              → _scan_cookies(db_path:Path, table:str, column:str, label:str) → list[str] CC=4    IO ■
              PURITY: 3/7 pure  BOTTLENECK: _detect_chromium_family(CC=9)

  Src [IO]: Request → Any
              → chat_completions(request:Request, x_task_tier:str | None) CC=13   IO ▶
              → _route_to_model(messages, model:str | None, x_task_tier:str | None) CC=4    pure
              → _analyze_request(messages, x_task_tier:str | None) CC=1    pure
              → analyze_request(messages:list[dict] | str) → AnalysisResult CC=7    pure
              → log_call() → Callable                   CC=1    mutation
              → _safe_args(args:tuple, kwargs:dict, include:bool) → dict[str, Any] CC=6    pure
              → _truncate(value:Any, max_len:int) → Any CC=9    pure ■
              PURITY: 5/7 pure  BOTTLENECK: chat_completions(CC=13)

  Src [Unknown]: ? → ?
              → execute() → StreamingResponse | JSONResponse CC=1    pure ▶
              → _build_context() → None                 CC=2    mutation
              → detect_project(messages:list[dict], headers:dict[str, str] | None) → ProjectContext CC=8    pure
              → _from_directory(directory:str) → ProjectContext CC=2    pure
              → _detect_stack(root:Path) → list[str]    CC=4    mutation
              → sorted()                                CC=4    pure
              → cmp()                                   CC=2    pure ■
              PURITY: 5/7 pure  BOTTLENECK: detect_project(CC=8)

  Src [Core]: str → T
              → create_project_ticket(project_id:str, req:dict[str, Any]) → dict[str, Any] CC=4    pure ▶
              → create_ticket(task:str, title:str, project_id:str | None, description:str, status:str, priority:str, type:str, sprint_id:str, milestone_id:str, tags:list[str], files:list[str], estimated_hours:float, tool:str | None) CC=9    pure
              → _default_project_dir(project_id:str | None) → str CC=6    pure
              → _get_registry()                         CC=3    mutation
              → get_settings() → Settings               CC=1    mutation
              → get_singleton(instance_var:T | None, instance_class:Type[T]) → T CC=2    pure ■
              PURITY: 4/6 pure  BOTTLENECK: create_ticket(CC=9)

  Src [Unknown]: ? → ?
              → start() → None                          CC=2    mutation ▶
              → _worker_loop() → None                   CC=4    pure
              → _execute_job(job:ToolJob) → None        CC=8    pure
              → get_adapter(tool_name:str) → BaseAdapter | None CC=3    pure
              → get(cls) → ToolRegistry                 CC=2    pure
              → cls()                                   CC=1    pure ■
              PURITY: 5/6 pure  BOTTLENECK: _execute_job(CC=8)

  Src [Core]: Request → ?
              → run_all_tests(request:Request)          CC=9    mutation ▶
              → test_agent_completion() → dict[str, Any] CC=6    IO
              → cheapest_model(tier:TaskTier, available_providers:set[str] | None, required_caps:frozenset[Capability] | None) → ModelSpec | None CC=2    pure
              → models_for_tier(tier:TaskTier, required_caps:frozenset[Capability] | None, available_providers:set[str] | None) → list[ModelSpec] CC=8    mutation
              → sorted()                                CC=4    pure
              → cmp()                                   CC=2    pure ■
              PURITY: 3/6 pure  BOTTLENECK: run_all_tests(CC=9)

  Src [Core]: ? → ?
              → test_agent()                            CC=1    pure ▶
              → test_agent_completion() → dict[str, Any] CC=6    IO
              → cheapest_model(tier:TaskTier, available_providers:set[str] | None, required_caps:frozenset[Capability] | None) → ModelSpec | None CC=2    pure
              → models_for_tier(tier:TaskTier, required_caps:frozenset[Capability] | None, available_providers:set[str] | None) → list[ModelSpec] CC=8    mutation
              → sorted()                                CC=4    pure
              → cmp()                                   CC=2    pure ■
              PURITY: 4/6 pure  BOTTLENECK: models_for_tier(CC=8)

  Src [Unknown]: Request → ?
              → detect_context(request:Request)         CC=5    mutation ▶
              → detect_project(messages:list[dict], headers:dict[str, str] | None) → ProjectContext CC=8    pure
              → _from_directory(directory:str) → ProjectContext CC=2    pure
              → _detect_stack(root:Path) → list[str]    CC=4    mutation
              → sorted()                                CC=4    pure
              → cmp()                                   CC=2    pure ■
              PURITY: 4/6 pure  BOTTLENECK: detect_project(CC=8)

  Src [Refactor]: ? → ?
              → bulk_autofix() → dict[str, Any]         CC=10   mutation ▶
              → execute_autofix(req:AutoFixRequest) → dict[str, Any] CC=12   pure
              → _create_human_action_ticket(tool_name:str, action:str, command:str) → Any CC=3    pure
              → _get_default_user() → dict[str, Any] | None CC=2    pure
              → get(cls, persist_path:Path | None) → UserManager CC=2    pure
              → cls()                                   CC=1    pure ■
              PURITY: 5/6 pure  BOTTLENECK: execute_autofix(CC=12)

  Src [IO]: ? → ?
              → compute_delta() → DeltaPayload          CC=5    mutation ▶
              → _make_full_payload(current:dict[str, FileSnapshot], modified:int, added:int, removed:int) → DeltaPayload CC=1    pure
              → _build_full_context(snapshots:dict[str, FileSnapshot]) → str CC=4    mutation
              → sorted()                                CC=4    pure
              → cmp()                                   CC=2    pure ■
              PURITY: 3/5 pure  BOTTLENECK: compute_delta(CC=5)

  Src [Unknown]: ? → ?
              → __init__() → None                       CC=2    mutation ▶
              → list_available() → list[ToolDefinition] CC=1    pure
              → list_tools(category:ToolCategory | None, available_only:bool) → list[ToolDefinition] CC=7    pure
              → sorted()                                CC=4    pure
              → cmp()                                   CC=2    pure ■
              PURITY: 4/5 pure  BOTTLENECK: list_tools(CC=7)

  Src [Unknown]: ? → bool
              → list_vms() → list[VMStatus]             CC=3    pure ▶
              → get_status(vm_id:str) → VMStatus | None CC=6    pure
              → _refresh_state_clonebox(vm:VMConfig) → None CC=7    pure
              → _get_clonebox()                         CC=3    mutation
              → _check_clonebox() → bool                CC=3    mutation ■
              PURITY: 3/5 pure  BOTTLENECK: _refresh_state_clonebox(CC=7)


TRANSFORMS (fan-out ≥10):
  TicketsPanel()                                          fan=56   !! mutation-heavy
  useDashboardData()                                      fan=33   !! mutation-heavy
  VoiceChat()                                             fan=31   !! mutation-heavy
  run_all_tests(request:Request)                          fan=28   !! side-effects
  create_ticket(task:str, title:str, project_id:str | None, description:str, status:str, priority:str, type:str, sprint_id:str, milestone_id:str, tags:list[str], files:list[str], estimated_hours:float, tool:str | None) fan=27   !! side-effects
  chat_completions(request:Request, x_task_tier:str | None) fan=27   !! side-effects
  QuickTaskCreator()                                      fan=27   !! side-effects
  TicketDispatchTable()                                   fan=27   !! side-effects
  ToolHealthPanel()                                       fan=26   !! side-effects
  TableExport()                                           fan=23   !! side-effects
  TableExport()                                           fan=23   !! side-effects
  TableExport()                                           fan=23   !! side-effects
  DiagnosticsPanel()                                      fan=22   !! side-effects
  SetupPanel()                                            fan=21   !! side-effects
  AddProjectForm() → AnalysisResult                       fan=20   !! side-effects

CONTRACTS:
  Pipeline: Src
    cmd_browser_list(args)
      IN:  args
      OUT: None
      SIDE-EFFECT: IO(print, print)

    detect_all_profiles() → list[BrowserProfile]
      IN:  ()
      OUT: list[BrowserProfile]
      SIDE-EFFECT: pure

    detect_chromium_profiles() → list[BrowserProfile]
      IN:  ()
      OUT: list[BrowserProfile]

    _detect_browser_profile(browser_name:str, config_path:str) → list[BrowserProfile]
      IN:  browser_name:str, config_path:str
      OUT: list[BrowserProfile]

    _detect_chromium_family(base_dir:Path, browser:str) → list[BrowserProfile]
      IN:  base_dir:Path, browser:str
      OUT: list[BrowserProfile]
      SIDE-EFFECT: IO(loads, read_text)

    _scan_chrome_cookies(cookies_file:Path) → list[str]
      IN:  cookies_file:Path
      OUT: list[str]

    _scan_cookies(db_path:Path, table:str, column:str, label:str) → list[str]
      IN:  db_path:Path, table:str, column:str, label:str
      OUT: list[str]
      SIDE-EFFECT: IO(connect, conn.close, execute)

  Pipeline: Src
    chat_completions(request:Request, x_task_tier:str | None)
      IN:  request:Request, x_task_tier:str | None
      OUT: None
      SIDE-EFFECT: IO(execute, dumps); generator

    _route_to_model(messages, model:str | None, x_task_tier:str | None)
      IN:  messages, model:str | None, x_task_tier:str | None
      OUT: None

    _analyze_request(messages, x_task_tier:str | None)
      IN:  messages, x_task_tier:str | None
      OUT: None

    analyze_request(messages:list[dict] | str) → AnalysisResult
      IN:  messages:list[dict] | str
      OUT: AnalysisResult

    log_call() → Callable
      IN:  ()
      OUT: Callable
      SIDE-EFFECT: pure

    _safe_args(args:tuple, kwargs:dict, include:bool) → dict[str, Any]
      IN:  args:tuple, kwargs:dict, include:bool
      OUT: dict[str, Any]

    _truncate(value:Any, max_len:int) → Any
      IN:  value:Any, max_len:int
      OUT: Any

  Pipeline: Src
    execute() → StreamingResponse | JSONResponse
      IN:  ()
      OUT: StreamingResponse | JSONResponse

    _build_context() → None
      IN:  ()
      OUT: None
      SIDE-EFFECT: mutates self.project_ctx

    detect_project(messages:list[dict], headers:dict[str, str] | None) → ProjectContext
      IN:  messages:list[dict], headers:dict[str, str] | None
      OUT: ProjectContext

    _from_directory(directory:str) → ProjectContext
      IN:  directory:str
      OUT: ProjectContext

    _detect_stack(root:Path) → list[str]
      IN:  root:Path
      OUT: list[str]
      SIDE-EFFECT: pure

    sorted()
      IN:  ()
      OUT: None
      INVARIANT: output is sorted

    cmp()
      IN:  ()
      OUT: None

  Pipeline: Src
    create_project_ticket(project_id:str, req:dict[str, Any]) → dict[str, Any]
      IN:  project_id:str, req:dict[str, Any]
      OUT: dict[str, Any]

    create_ticket(task:str, title:str, project_id:str | None, description:str, status:str, priority:str, type:str, sprint_id:str, milestone_id:str, tags:list[str], files:list[str], estimated_hours:float, tool:str | None)
      IN:  task:str, title:str, project_id:str | None, description:str, status:str, priority:str, type:str, sprint_id:str, milestone_id:str, tags:list[str], files:list[str], estimated_hours:float, tool:str | None
      OUT: None

    _default_project_dir(project_id:str | None) → str
      IN:  project_id:str | None
      OUT: str

    _get_registry()
      IN:  ()
      OUT: None
      SIDE-EFFECT: global(_registry)

    get_settings() → Settings
      IN:  ()
      OUT: Settings
      SIDE-EFFECT: global(_settings)

    get_singleton(instance_var:T | None, instance_class:Type[T]) → T
      IN:  instance_var:T | None, instance_class:Type[T]
      OUT: T

  Pipeline: Src
    start() → None
      IN:  ()
      OUT: None
      SIDE-EFFECT: mutates self._running, self._worker_task

    _worker_loop() → None
      IN:  ()
      OUT: None

    _execute_job(job:ToolJob) → None
      IN:  job:ToolJob
      OUT: None

    get_adapter(tool_name:str) → BaseAdapter | None
      IN:  tool_name:str
      OUT: BaseAdapter | None

    get(cls) → ToolRegistry
      IN:  cls
      OUT: ToolRegistry

    cls()
      IN:  ()
      OUT: None

  Pipeline: Src
    run_all_tests(request:Request)
      IN:  request:Request
      OUT: None
      SIDE-EFFECT: pure

    test_agent_completion() → dict[str, Any]
      IN:  ()
      OUT: dict[str, Any]
      SIDE-EFFECT: IO(client.post)

    cheapest_model(tier:TaskTier, available_providers:set[str] | None, required_caps:frozenset[Capability] | None) → ModelSpec | None
      IN:  tier:TaskTier, available_providers:set[str] | None, required_caps:frozenset[Capability] | None
      OUT: ModelSpec | None

    models_for_tier(tier:TaskTier, required_caps:frozenset[Capability] | None, available_providers:set[str] | None) → list[ModelSpec]
      IN:  tier:TaskTier, required_caps:frozenset[Capability] | None, available_providers:set[str] | None
      OUT: list[ModelSpec]
      SIDE-EFFECT: pure

    sorted()
      IN:  ()
      OUT: None
      INVARIANT: output is sorted

    cmp()
      IN:  ()
      OUT: None

  Pipeline: Src
    test_agent()
      IN:  ()
      OUT: None

    test_agent_completion() → dict[str, Any]
      IN:  ()
      OUT: dict[str, Any]
      SIDE-EFFECT: IO(client.post)

    cheapest_model(tier:TaskTier, available_providers:set[str] | None, required_caps:frozenset[Capability] | None) → ModelSpec | None
      IN:  tier:TaskTier, available_providers:set[str] | None, required_caps:frozenset[Capability] | None
      OUT: ModelSpec | None

    models_for_tier(tier:TaskTier, required_caps:frozenset[Capability] | None, available_providers:set[str] | None) → list[ModelSpec]
      IN:  tier:TaskTier, required_caps:frozenset[Capability] | None, available_providers:set[str] | None
      OUT: list[ModelSpec]
      SIDE-EFFECT: pure

    sorted()
      IN:  ()
      OUT: None
      INVARIANT: output is sorted

    cmp()
      IN:  ()
      OUT: None

  Pipeline: Src
    detect_context(request:Request)
      IN:  request:Request
      OUT: None
      SIDE-EFFECT: pure

    detect_project(messages:list[dict], headers:dict[str, str] | None) → ProjectContext
      IN:  messages:list[dict], headers:dict[str, str] | None
      OUT: ProjectContext

    _from_directory(directory:str) → ProjectContext
      IN:  directory:str
      OUT: ProjectContext

    _detect_stack(root:Path) → list[str]
      IN:  root:Path
      OUT: list[str]
      SIDE-EFFECT: pure

    sorted()
      IN:  ()
      OUT: None
      INVARIANT: output is sorted

    cmp()
      IN:  ()
      OUT: None

  Pipeline: Src
    bulk_autofix() → dict[str, Any]
      IN:  ()
      OUT: dict[str, Any]
      SIDE-EFFECT: pure

    execute_autofix(req:AutoFixRequest) → dict[str, Any]
      IN:  req:AutoFixRequest
      OUT: dict[str, Any]

    _create_human_action_ticket(tool_name:str, action:str, command:str) → Any
      IN:  tool_name:str, action:str, command:str
      OUT: Any

    _get_default_user() → dict[str, Any] | None
      IN:  ()
      OUT: dict[str, Any] | None

    get(cls, persist_path:Path | None) → UserManager
      IN:  cls, persist_path:Path | None
      OUT: UserManager

    cls()
      IN:  ()
      OUT: None

  Pipeline: Src
    compute_delta() → DeltaPayload
      IN:  ()
      OUT: DeltaPayload
      SIDE-EFFECT: mutates self._version, self._snapshots, self._initialized

    _make_full_payload(current:dict[str, FileSnapshot], modified:int, added:int, removed:int) → DeltaPayload
      IN:  current:dict[str, FileSnapshot], modified:int, added:int, removed:int
      OUT: DeltaPayload

    _build_full_context(snapshots:dict[str, FileSnapshot]) → str
      IN:  snapshots:dict[str, FileSnapshot]
      OUT: str
      SIDE-EFFECT: pure

    sorted()
      IN:  ()
      OUT: None
      INVARIANT: output is sorted

    cmp()
      IN:  ()
      OUT: None

  Pipeline: Src
    __init__() → None
      IN:  ()
      OUT: None
      SIDE-EFFECT: mutates self._tools

    list_available() → list[ToolDefinition]
      IN:  ()
      OUT: list[ToolDefinition]

    list_tools(category:ToolCategory | None, available_only:bool) → list[ToolDefinition]
      IN:  category:ToolCategory | None, available_only:bool
      OUT: list[ToolDefinition]

    sorted()
      IN:  ()
      OUT: None
      INVARIANT: output is sorted

    cmp()
      IN:  ()
      OUT: None

  Pipeline: Src
    list_vms() → list[VMStatus]
      IN:  ()
      OUT: list[VMStatus]

    get_status(vm_id:str) → VMStatus | None
      IN:  vm_id:str
      OUT: VMStatus | None

    _refresh_state_clonebox(vm:VMConfig) → None
      IN:  vm:VMConfig
      OUT: None

    _get_clonebox()
      IN:  ()
      OUT: None
      SIDE-EFFECT: mutates self._clonebox

    _check_clonebox() → bool
      IN:  ()
      OUT: bool
      SIDE-EFFECT: global(_CLONEBOX_AVAILABLE)
      INVARIANT: raises on invalid input


DATA_TYPES (by cross-function usage) [690 annotated, 51 inferred / 1671 functions]:
  str                  consumed:393 produced:58   !! HUB-TYPE → split interface
  dict[str, Any]       consumed:33  produced:108  !! HUB-TYPE → split interface
  str | None           consumed:106 produced:7    !! HUB-TYPE → split interface
  int                  consumed:50  produced:4    !! HUB-TYPE → split interface
  bool                 consumed:18  produced:36   !! HUB-TYPE → split interface
  click.Context        consumed:51  produced:0    !! HUB-TYPE → split interface
  dict                 consumed:26  produced:17   !! HUB-TYPE → split interface
  AnalysisResult       consumed:5   produced:36 
  list[str]            consumed:18  produced:18   !! HUB-TYPE → split interface
  float                consumed:27  produced:3    !! HUB-TYPE → split interface
  list[Ticket]         consumed:10  produced:14   !! HUB-TYPE → split interface
  VMConfig             consumed:16  produced:1    !! HUB-TYPE → split interface
  list[dict]           consumed:8   produced:9  
  list[str] | None     consumed:12  produced:0    !! HUB-TYPE → split interface
  Path                 consumed:11  produced:1    !! HUB-TYPE → split interface
  Ticket               consumed:8   produced:3  
  CloneBoxResult       consumed:0   produced:11   output-heavy
  Request              consumed:10  produced:0    !! HUB-TYPE → split interface
  dict[str, str]       consumed:5   produced:5  
  Path | None          consumed:6   produced:4  

  HUB TYPES (consumed ≥10):
    str → 393 consumers → split into:
      - (analyze consumers to suggest sub-interfaces)
    dict[str, Any] → 33 consumers → split into:
      - (analyze consumers to suggest sub-interfaces)
    str | None → 106 consumers → split into:
      - (analyze consumers to suggest sub-interfaces)
    int → 50 consumers → split into:
      - (analyze consumers to suggest sub-interfaces)
    bool → 18 consumers → split into:
      - (analyze consumers to suggest sub-interfaces)
    click.Context → 51 consumers → split into:
      - (analyze consumers to suggest sub-interfaces)
    dict → 26 consumers → split into:
      - replace with typed alternatives (dataclass/TypedDict)
    list[str] → 18 consumers → split into:
      - (analyze consumers to suggest sub-interfaces)
    float → 27 consumers → split into:
      - (analyze consumers to suggest sub-interfaces)
    list[Ticket] → 10 consumers → split into:
      - (analyze consumers to suggest sub-interfaces)
    VMConfig → 16 consumers → split into:
      - (analyze consumers to suggest sub-interfaces)
    list[str] | None → 12 consumers → split into:
      - (analyze consumers to suggest sub-interfaces)
    Path → 11 consumers → split into:
      - (analyze consumers to suggest sub-interfaces)
    Request → 10 consumers → split into:
      - (analyze consumers to suggest sub-interfaces)

SIDE_EFFECTS:
  IO:        count_complexity, validate_jsx_component, main, validate_jsx_component, count_complexity, main, validate_jsx_component, count_complexity, main, install_voice_deps
  Cache:     ct, get, post, put, r, stored_list, apiCall, r, _callLLM, res
  Mutation:  SQLiteNamespaceStore.__init__, _make_args, get_settings, list_providers, cost_detailed, _tickets, export_tickets, shared_accounts, shared_vms, bulk_delete_vms
  Pure:      check_voice_deps, cli, serve, status, models, chat, logs_cmd, providers_cmd, routing_test_cmd, projects_cmd

  PIPELINE PURITY:
    Src             █░░░ 42% pure
    Src             ██░░ 71% pure
    Src             ██░░ 71% pure
    Src             ██░░ 66% pure
    Src             ███░ 83% pure
    Src             ██░░ 50% pure
    Src             ██░░ 66% pure
    Src             ██░░ 66% pure
    Src             ███░ 83% pure
    Src             ██░░ 60% pure
    Src             ███░ 80% pure
    Src             ██░░ 60% pure
