# proxy/flow | 381 func | 12 pipelines | 7 hub-types | 2026-03-21

PIPELINES[12] (Core:2, IO:1, Refactor:1, Unknown:8):
  Src [Unknown]: str → bool
              → switch_project(vm_id:str, new_project_path:str) → bool CC=3    pure ▶
              → _remount_project(vm:VMConfig, vm_id:str) → None 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: 4/6 pure  BOTTLENECK: _refresh_state_clonebox(CC=7)

  Src [Unknown]: ? → float
              → execute() → StreamingResponse | JSONResponse CC=1    pure ▶
              → _run() → StreamingResponse | JSONResponse CC=1    pure
              → _execute_with_fallbacks(kwargs:dict) → StreamingResponse | JSONResponse CC=4    pure
              → _make_stream_response(kwargs, model_spec, t0) → StreamingResponse CC=1    pure
              → _stream_wrapper(response_coro, model_spec, t0) CC=7    IO
              → _calculate_cost(model, prompt_tokens:int, completion_tokens:int) → float CC=1    pure ■
              PURITY: 5/6 pure  BOTTLENECK: _stream_wrapper(CC=7)

  Src [Refactor]: ? → Settings
              → main()                                  CC=2    pure ▶
              → _dispatch(args, sub_parsers:dict)       CC=7    pure
              → cmd_vm_action(args)                     CC=2    IO
              → make_client(base:str, key:str) → httpx.Client CC=3    pure
              → get_settings() → Settings               CC=2    mutation ■
              PURITY: 3/5 pure  BOTTLENECK: _dispatch(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)

  Src [IO]: args → float
              → cmd_browser_list(args)                  CC=6    IO ▶
              → detect_all_profiles() → list[BrowserProfile] CC=1    mutation
              → detect_chromium_profiles() → list[BrowserProfile] CC=1    pure
              → _detect_chromium_family(base_dir:Path, browser:str) → list[BrowserProfile] CC=9    IO
              → _dir_size_mb(path:Path) → float         CC=4    pure ■
              PURITY: 2/5 pure  BOTTLENECK: _detect_chromium_family(CC=9)

  Src [Unknown]: Request → list[str]
              → detect_context(request:Request)         CC=2    pure ▶
              → 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
              → _detect_frameworks(root:Path) → list[str] CC=7    IO ■
              PURITY: 3/5 pure  BOTTLENECK: detect_project(CC=8)

  Src [Unknown]: VMConfig → subprocess.CompletedProcess
              → create_vm(config:VMConfig) → VMConfig   CC=4    pure ▶
              → _create_vm_virsh(config:VMConfig) → None CC=2    pure
              → _generate_domain_xml(vm:VMConfig) → str CC=1    IO
              → _run(cmd:str, check:bool) → subprocess.CompletedProcess CC=3    pure ■
              PURITY: 3/4 pure  BOTTLENECK: create_vm(CC=4)

  Src [Unknown]: str → bool
              → start_vm(vm_id:str) → bool              CC=4    pure ▶
              → _start_vm_clonebox(vm:VMConfig, vm_id:str) → bool CC=3    pure
              → _get_clonebox()                         CC=3    mutation
              → _check_clonebox() → bool                CC=3    mutation ■
              PURITY: 2/4 pure  BOTTLENECK: start_vm(CC=4)

  Src [Unknown]: str → bool
              → stop_vm(vm_id:str, force:bool) → bool   CC=5    pure ▶
              → _stop_vm_clonebox(vm:VMConfig) → bool   CC=3    pure
              → _get_clonebox()                         CC=3    mutation
              → _check_clonebox() → bool                CC=3    mutation ■
              PURITY: 2/4 pure  BOTTLENECK: stop_vm(CC=5)

  Src [Unknown]: str → bool
              → snapshot_vm(vm_id:str, name:str) → bool CC=5    pure ▶
              → _snapshot_clonebox(vm:VMConfig, snap_name:str) → bool CC=3    pure
              → _get_clonebox()                         CC=3    mutation
              → _check_clonebox() → bool                CC=3    mutation ■
              PURITY: 2/4 pure  BOTTLENECK: snapshot_vm(CC=5)

  Src [Core]: args → Settings
              → cmd_vm_ssh(args)                        CC=2    pure ▶
              → _find_vm(args)                          CC=6    IO
              → make_client(base:str, key:str) → httpx.Client CC=3    pure
              → get_settings() → Settings               CC=2    mutation ■
              PURITY: 2/4 pure  BOTTLENECK: _find_vm(CC=6)

  Src [Core]: args → Settings
              → cmd_vm_logs(args)                       CC=1    pure ▶
              → _find_vm(args)                          CC=6    IO
              → make_client(base:str, key:str) → httpx.Client CC=3    pure
              → get_settings() → Settings               CC=2    mutation ■
              PURITY: 2/4 pure  BOTTLENECK: _find_vm(CC=6)


TRANSFORMS (fan-out ≥10):
  useDashboardData()                                      fan=19   fan=19
  detect_firefox_profiles() → list[BrowserProfile]        fan=17   fan=17
  _detect_chromium_family(base_dir:Path, browser:str) → list[BrowserProfile] fan=17   fan=17
  analyze_request(messages:list[dict]) → AnalysisResult   fan=15   fan=15
  sortColumn()                                            fan=15   fan=15
  table()                                                 fan=15   fan=15
  table_body_rows()                                       fan=15   fan=15
  no_rows()                                               fan=15   fan=15
  footer()                                                fan=15   fan=15
  ratio_columns()                                         fan=15   fan=15
  filter_handler()                                        fan=15   fan=15
  cmd_status(args)                                        fan=14   fan=14
  system_status()                                         fan=13   fan=13
  _make_non_stream_response(kwargs, model_spec, t0, fallback_index) → JSONResponse fan=12   PIPELINE:CompletionPipeline.entry
  main()                                                  fan=11   !! script-in-disguise

CONTRACTS:
  Pipeline: Src
    switch_project(vm_id:str, new_project_path:str) → bool
      IN:  vm_id:str, new_project_path:str
      OUT: bool

    _remount_project(vm:VMConfig, vm_id:str) → None
      IN:  vm:VMConfig, vm_id:str
      OUT: None

    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

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

    _run() → StreamingResponse | JSONResponse
      IN:  ()
      OUT: StreamingResponse | JSONResponse

    _execute_with_fallbacks(kwargs:dict) → StreamingResponse | JSONResponse
      IN:  kwargs:dict
      OUT: StreamingResponse | JSONResponse

    _make_stream_response(kwargs, model_spec, t0) → StreamingResponse
      IN:  kwargs, model_spec, t0
      OUT: StreamingResponse

    _stream_wrapper(response_coro, model_spec, t0)
      IN:  response_coro, model_spec, t0
      OUT: None
      SIDE-EFFECT: IO(dumps); generator

    _calculate_cost(model, prompt_tokens:int, completion_tokens:int) → float
      IN:  model, prompt_tokens:int, completion_tokens:int
      OUT: float

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

    _dispatch(args, sub_parsers:dict)
      IN:  args, sub_parsers:dict
      OUT: None

    cmd_vm_action(args)
      IN:  args
      OUT: None
      SIDE-EFFECT: IO(print, print)

    make_client(base:str, key:str) → httpx.Client
      IN:  base:str, key:str
      OUT: httpx.Client

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

  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

  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_chromium_family(base_dir:Path, browser:str) → list[BrowserProfile]
      IN:  base_dir:Path, browser:str
      OUT: list[BrowserProfile]
      SIDE-EFFECT: IO(loads, read_text)

    _dir_size_mb(path:Path) → float
      IN:  path:Path
      OUT: float

  Pipeline: Src
    detect_context(request:Request)
      IN:  request:Request
      OUT: None

    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

    _detect_frameworks(root:Path) → list[str]
      IN:  root:Path
      OUT: list[str]
      SIDE-EFFECT: IO(read_text)

  Pipeline: Src
    create_vm(config:VMConfig) → VMConfig
      IN:  config:VMConfig
      OUT: VMConfig

    _create_vm_virsh(config:VMConfig) → None
      IN:  config:VMConfig
      OUT: None

    _generate_domain_xml(vm:VMConfig) → str
      IN:  vm:VMConfig
      OUT: str
      SIDE-EFFECT: IO(write_text)

    _run(cmd:str, check:bool) → subprocess.CompletedProcess
      IN:  cmd:str, check:bool
      OUT: subprocess.CompletedProcess

  Pipeline: Src
    start_vm(vm_id:str) → bool
      IN:  vm_id:str
      OUT: bool

    _start_vm_clonebox(vm:VMConfig, vm_id:str) → bool
      IN:  vm:VMConfig, vm_id:str
      OUT: bool

    _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

  Pipeline: Src
    stop_vm(vm_id:str, force:bool) → bool
      IN:  vm_id:str, force:bool
      OUT: bool

    _stop_vm_clonebox(vm:VMConfig) → bool
      IN:  vm:VMConfig
      OUT: bool

    _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

  Pipeline: Src
    snapshot_vm(vm_id:str, name:str) → bool
      IN:  vm_id:str, name:str
      OUT: bool

    _snapshot_clonebox(vm:VMConfig, snap_name:str) → bool
      IN:  vm:VMConfig, snap_name:str
      OUT: bool

    _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

  Pipeline: Src
    cmd_vm_ssh(args)
      IN:  args
      OUT: None

    _find_vm(args)
      IN:  args
      OUT: None
      SIDE-EFFECT: IO(print, print)

    make_client(base:str, key:str) → httpx.Client
      IN:  base:str, key:str
      OUT: httpx.Client

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

  Pipeline: Src
    cmd_vm_logs(args)
      IN:  args
      OUT: None

    _find_vm(args)
      IN:  args
      OUT: None
      SIDE-EFFECT: IO(print, print)

    make_client(base:str, key:str) → httpx.Client
      IN:  base:str, key:str
      OUT: httpx.Client

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


DATA_TYPES (by cross-function usage) [214 annotated, 0 inferred / 381 functions]:
  str                  consumed:96  produced:13   !! HUB-TYPE → split interface
  int                  consumed:24  produced:2    !! HUB-TYPE → split interface
  bool                 consumed:5   produced:19 
  dict                 consumed:12  produced:10   !! HUB-TYPE → split interface
  list[str]            consumed:12  produced:9    !! HUB-TYPE → split interface
  float                consumed:15  produced:3    !! HUB-TYPE → split interface
  VMConfig             consumed:12  produced:1    !! HUB-TYPE → split interface
  list[dict]           consumed:10  produced:2    !! HUB-TYPE → split interface
  str | None           consumed:8   produced:3  
  CloneBoxResult       consumed:0   produced:11   output-heavy
  Path                 consumed:9   produced:0    input-heavy (read-only flow)
  AnalysisResult       consumed:5   produced:3  
  dict[str, FileSnapshot] consumed:6   produced:1    input-heavy (read-only flow)
  Request              consumed:6   produced:0    input-heavy (read-only flow)
  list[BrowserProfile] consumed:0   produced:5    output-heavy
  dict[str, Any]       consumed:2   produced:3  
  ProjectContext       consumed:2   produced:3  
  set[str] | None      consumed:4   produced:0    narrow scope
  list[MCPServerSpec]  consumed:1   produced:3    narrow scope
  list                 consumed:4   produced:0    narrow scope

  HUB TYPES (consumed ≥10):
    str → 96 consumers → split into:
      - (analyze consumers to suggest sub-interfaces)
    int → 24 consumers → split into:
      - (analyze consumers to suggest sub-interfaces)
    dict → 12 consumers → split into:
      - replace with typed alternatives (dataclass/TypedDict)
    list[str] → 12 consumers → split into:
      - (analyze consumers to suggest sub-interfaces)
    float → 15 consumers → split into:
      - (analyze consumers to suggest sub-interfaces)
    VMConfig → 12 consumers → split into:
      - (analyze consumers to suggest sub-interfaces)
    list[dict] → 10 consumers → split into:
      - (analyze consumers to suggest sub-interfaces)

SIDE_EFFECTS:
  IO:        FileSnapshot.from_path, detect_firefox_profiles, _detect_chromium_family, _scan_firefox_cookies, _scan_chrome_cookies, _InfraMixin._generate_domain_xml, _SnapshotMixin.delete_vm, VMOrchestrator.__init__, VMOrchestrator._load_configs, VMOrchestrator._save_config
  Cache:     stored_list, get, post
  Mutation:  DeltaBuffer.__init__, DeltaBuffer.compute_delta, DeltaBuffer._classify_changes, DeltaBuffer._build_diff_text, DeltaBuffer._build_full_context, AuthMiddleware.__init__, detect_all_profiles, _check_clonebox, CloneBoxAdapter.__init__, CloneBoxAdapter._find_bin
  Pure:      _dispatch, _build_serve_parser, _build_accounts_parser, _build_vm_parser, _build_browser_parser, main, DeltaBuffer.scan, DeltaBuffer._make_full_payload, DeltaBuffer._estimate_tokens, DeltaBuffer.get_stats

  PIPELINE PURITY:
    Src             ██░░ 66% pure
    Src             ███░ 83% pure
    Src             ██░░ 60% pure
    Src             ██░░ 60% pure
    Src             █░░░ 40% pure
    Src             ██░░ 60% pure
    Src             ███░ 75% pure
    Src             ██░░ 50% pure
    Src             ██░░ 50% pure
    Src             ██░░ 50% pure
    Src             ██░░ 50% pure
    Src             ██░░ 50% pure
