# proxy/flow | 794 func | 12 pipelines | 10 hub-types | 2026-03-23

PIPELINES[12] (Core:2, IO:4, Refactor:2, Unknown:4):
  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 [IO]: click.Context → float
              → browser_list(ctx:click.Context)         CC=1    pure ▶
              → 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: 3/6 pure  BOTTLENECK: _detect_chromium_family(CC=9)

  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 [IO]: Request → None
              → chat_completions(request:Request, x_task_tier:str | None) CC=17   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
              → _apply_heuristics(user_text:str, all_text:str, file_count:int, context_tokens:int, tier_scores:dict[TaskTier, float], caps:set[Capability], signals:list[str]) → None CC=1    pure
              → _keyword_signals(user_text:str, all_text:str, tier_scores:dict, caps:set, signals:list) → None CC=9    mutation ■
              PURITY: 4/6 pure  BOTTLENECK: chat_completions(CC=17)

  Todo [Refactor]: ? → ?
              → VoiceChat()                             CC=68   IO  !! ▶
              → startListening()                        CC=8    pure
              → processInput()                          CC=21   cache  !!
              → executeDSL()                            CC=5    pure
              → label()                                 CC=2    pure
              → finish()                                CC=6    pure ■
              PURITY: 4/6 pure  BOTTLENECK: VoiceChat(CC=68)

  Todo [Refactor]: ? → ?
              → onKey()                                 CC=4    pure ▶
              → startListening()                        CC=8    pure
              → processInput()                          CC=21   cache  !!
              → executeDSL()                            CC=5    pure
              → label()                                 CC=2    pure
              → finish()                                CC=6    pure ■
              PURITY: 5/6 pure  BOTTLENECK: processInput(CC=21)

  Src [Unknown]: ? → ?
              → VoiceChat()                             CC=70   IO  !! ▶
              → h()                                     CC=8    pure
              → processInput()                          CC=20   cache  !!
              → label()                                 CC=2    pure
              → executeDSL()                            CC=4    pure
              → apiCall()                               CC=6    cache ■
              PURITY: 3/6 pure  BOTTLENECK: VoiceChat(CC=70)

  Src [Unknown]: ? → ?
              → onKey()                                 CC=4    pure ▶
              → startListening()                        CC=8    pure
              → processInput()                          CC=20   cache  !!
              → label()                                 CC=2    pure
              → executeDSL()                            CC=4    pure
              → apiCall()                               CC=6    cache ■
              PURITY: 4/6 pure  BOTTLENECK: processInput(CC=20)

  Src [Core]: click.Context → Settings
              → vm_ssh(ctx:click.Context, vm_id:str, user:str) CC=1    pure ▶
              → 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: 3/5 pure  BOTTLENECK: _find_vm(CC=6)

  Src [Core]: click.Context → Settings
              → vm_logs(ctx:click.Context, vm_id:str)   CC=1    pure ▶
              → 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: 3/5 pure  BOTTLENECK: _find_vm(CC=6)

  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 [IO]: VMConfig → Path | None
              → create_vm(config:VMConfig) → VMConfig   CC=4    pure ▶
              → _create_vm_clonebox(config:VMConfig) → None CC=7    IO
              → _inject_vm_config(config:VMConfig) → dict[str, Any] CC=9    IO
              → _load_profile_cloud_init(tool:str) → dict[str, Any] CC=3    pure
              → get_builtin_profile(tool:str) → Path | None CC=2    pure ■
              PURITY: 3/5 pure  BOTTLENECK: _inject_vm_config(CC=9)


TRANSFORMS (fan-out ≥10):
  VoiceChat()                                             fan=54   !! mutation-heavy
  VoiceChat()                                             fan=52   !! mutation-heavy
  chat_completions(request:Request, x_task_tier:str | None) fan=27   !! side-effects
  useDashboardData()                                      fan=20   !! side-effects
  run_all_tests(request:Request)                          fan=19   fan=19
  LogPanel()                                              fan=19   fan=19
  TicketsPanel()                                          fan=18   fan=18
  detect_firefox_profiles() → list[BrowserProfile]        fan=17   fan=17
  _detect_chromium_family(base_dir:Path, browser:str) → list[BrowserProfile] fan=17   fan=17
  ollama_status()                                         fan=17   fan=17
  VMsPanel()                                              fan=17   fan=17
  analyze_request(messages:list[dict] | str) → AnalysisResult fan=16   fan=16
  _check_roo_cline_config() → dict[str, Any]              fan=16   fan=16
  processInput()                                          fan=15   fan=15
  sortColumn()                                            fan=15   fan=15

CONTRACTS:
  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
    browser_list(ctx:click.Context)
      IN:  ctx:click.Context
      OUT: None

    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
      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
    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
      SMELL: CC=17 → split

    _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

    _apply_heuristics(user_text:str, all_text:str, file_count:int, context_tokens:int, tier_scores:dict[TaskTier, float], caps:set[Capability], signals:list[str]) → None
      IN:  user_text:str, all_text:str, file_count:int, context_tokens:int, tier_scores:dict[TaskTier, float], caps:set[Capability], signals:list[str]
      OUT: None

    _keyword_signals(user_text:str, all_text:str, tier_scores:dict, caps:set, signals:list) → None
      IN:  user_text:str, all_text:str, tier_scores:dict, caps:set, signals:list
      OUT: None
      SIDE-EFFECT: pure

  Pipeline: Todo
    VoiceChat()
      IN:  ()
      OUT: None
      SIDE-EFFECT: IO(calls:IO)
      SMELL: CC=68 → split

    startListening()
      IN:  ()
      OUT: None

    processInput()
      IN:  ()
      OUT: None
      SIDE-EFFECT: cache(calls:cache)
      SMELL: CC=21 → split

    executeDSL()
      IN:  ()
      OUT: None

    label()
      IN:  ()
      OUT: None

    finish()
      IN:  ()
      OUT: None

  Pipeline: Todo
    onKey()
      IN:  ()
      OUT: None

    startListening()
      IN:  ()
      OUT: None

    processInput()
      IN:  ()
      OUT: None
      SIDE-EFFECT: cache(calls:cache)
      SMELL: CC=21 → split

    executeDSL()
      IN:  ()
      OUT: None

    label()
      IN:  ()
      OUT: None

    finish()
      IN:  ()
      OUT: None

  Pipeline: Src
    VoiceChat()
      IN:  ()
      OUT: None
      SIDE-EFFECT: IO(calls:IO)
      SMELL: CC=70 → split

    h()
      IN:  ()
      OUT: None

    processInput()
      IN:  ()
      OUT: None
      SIDE-EFFECT: cache(calls:cache)
      SMELL: CC=20 → split

    label()
      IN:  ()
      OUT: None

    executeDSL()
      IN:  ()
      OUT: None

    apiCall()
      IN:  ()
      OUT: None
      SIDE-EFFECT: cache(calls:cache)

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

    startListening()
      IN:  ()
      OUT: None

    processInput()
      IN:  ()
      OUT: None
      SIDE-EFFECT: cache(calls:cache)
      SMELL: CC=20 → split

    label()
      IN:  ()
      OUT: None

    executeDSL()
      IN:  ()
      OUT: None

    apiCall()
      IN:  ()
      OUT: None
      SIDE-EFFECT: cache(calls:cache)

  Pipeline: Src
    vm_ssh(ctx:click.Context, vm_id:str, user:str)
      IN:  ctx:click.Context, vm_id:str, user:str
      OUT: None

    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
    vm_logs(ctx:click.Context, vm_id:str)
      IN:  ctx:click.Context, vm_id:str
      OUT: None

    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)

  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
    create_vm(config:VMConfig) → VMConfig
      IN:  config:VMConfig
      OUT: VMConfig

    _create_vm_clonebox(config:VMConfig) → None
      IN:  config:VMConfig
      OUT: None
      SIDE-EFFECT: IO(unlink)

    _inject_vm_config(config:VMConfig) → dict[str, Any]
      IN:  config:VMConfig
      OUT: dict[str, Any]
      SIDE-EFFECT: IO(loads, dumps)

    _load_profile_cloud_init(tool:str) → dict[str, Any]
      IN:  tool:str
      OUT: dict[str, Any]

    get_builtin_profile(tool:str) → Path | None
      IN:  tool:str
      OUT: Path | None


DATA_TYPES (by cross-function usage) [385 annotated, 7 inferred / 794 functions]:
  str                  consumed:187 produced:41   !! HUB-TYPE → split interface
  str | None           consumed:40  produced:7    !! HUB-TYPE → split interface
  dict[str, Any]       consumed:6   produced:35 
  int                  consumed:36  produced:5    !! HUB-TYPE → split interface
  bool                 consumed:10  produced:28   !! HUB-TYPE → split interface
  dict                 consumed:19  produced:14   !! HUB-TYPE → split interface
  click.Context        consumed:29  produced:0    !! HUB-TYPE → split interface
  list[str]            consumed:15  produced:9    !! HUB-TYPE → split interface
  float                consumed:19  produced:3    !! HUB-TYPE → split interface
  VMConfig             consumed:15  produced:1    !! HUB-TYPE → split interface
  CloneBoxResult       consumed:0   produced:11   output-heavy
  Path                 consumed:9   produced:2  
  list[dict]           consumed:9   produced:2  
  Request              consumed:10  produced:0    !! HUB-TYPE → split interface
  AnalysisResult       consumed:5   produced:3  
  Path | None          consumed:3   produced:4  
  dict[str, FileSnapshot] consumed:6   produced:1    input-heavy (read-only flow)
  list[BrowserProfile] consumed:0   produced:5    output-heavy
  ProjectContext       consumed:2   produced:3  
  Account              consumed:2   produced:2    narrow scope

  HUB TYPES (consumed ≥10):
    str → 187 consumers → split into:
      - (analyze consumers to suggest sub-interfaces)
    str | None → 40 consumers → split into:
      - (analyze consumers to suggest sub-interfaces)
    int → 36 consumers → split into:
      - (analyze consumers to suggest sub-interfaces)
    bool → 10 consumers → split into:
      - (analyze consumers to suggest sub-interfaces)
    dict → 19 consumers → split into:
      - replace with typed alternatives (dataclass/TypedDict)
    click.Context → 29 consumers → split into:
      - (analyze consumers to suggest sub-interfaces)
    list[str] → 15 consumers → split into:
      - (analyze consumers to suggest sub-interfaces)
    float → 19 consumers → split into:
      - (analyze consumers to suggest sub-interfaces)
    VMConfig → 15 consumers → split into:
      - (analyze consumers to suggest sub-interfaces)
    Request → 10 consumers → split into:
      - (analyze consumers to suggest sub-interfaces)

SIDE_EFFECTS:
  IO:        _wait_for_vscode, install_voice_deps, main, FileSnapshot.from_path, detect_firefox_profiles, _detect_chromium_family, _scan_firefox_cookies, _scan_chrome_cookies, _InfraMixin._generate_domain_xml, _SnapshotMixin.delete_vm
  Cache:     ct, get, post, apiCall, processInput, ctrl, res, stored_list, r, apiCall
  Mutation:  _make_args, get_settings, DeltaBuffer.__init__, DeltaBuffer.compute_delta, DeltaBuffer._classify_changes, DeltaBuffer._build_diff_text, DeltaBuffer._build_full_context, AuthMiddleware.__init__, detect_all_profiles, _check_clonebox
  Pure:      _compose_dir, _run_compose, _is_vscode_running, _get_vscode_port, vscode_status, vscode_start, vscode_stop, vscode_restart, vscode_logs, vscode_build

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