feat(commands): multi-select ordered command pipeline with step reordering and single-pass composition (AI-05, AI-07)

This commit is contained in:
Yun Chan 2026-10-31 02:54:54 +09:00
parent f49acf0105
commit 10af20a0ad
157 changed files with 29455 additions and 913 deletions

View file

@ -0,0 +1,19 @@
"""Bound local inference workers so foreground input has scheduling headroom.
Keep the policy aligned with src/main/utils/inference-cpu-budget.ts.
This limits inference workers, not process affinity or total process CPU usage.
"""
import os
def inference_cpu_threads(available_cpus: int | None) -> int:
if available_cpus is None or available_cpus < 1:
return 1
return max(1, min(4, available_cpus - 2))
def local_inference_cpu_threads() -> int:
# Python 3.13+ exposes the CPUs available to this process, including affinity.
count = getattr(os, "process_cpu_count", os.cpu_count)()
return inference_cpu_threads(count)