Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
145 commits
Select commit Hold shift + click to select a range
03c83d0
fix(ui): close functional gaps for proxy monitor and runtime paths
11cookies11 Feb 28, 2026
27abadd
chore(repo): ignore AGENTS.md from git tracking
11cookies11 Feb 28, 2026
229604b
feat(runtime): close proxy monitor forwarding loop
11cookies11 Feb 28, 2026
567499c
fix(runtime): stabilize proxy capture direction semantics
11cookies11 Feb 28, 2026
dc2975f
feat(ui): add proxy error visibility and retry flow
11cookies11 Feb 28, 2026
454d05c
feat(runtime): harden proxy state recovery across restarts
11cookies11 Feb 28, 2026
5f7e3c0
feat(test): add proxy forwarding regression toolkit
11cookies11 Feb 28, 2026
307f6b7
chore(test): add virtual serial environment bootstrap script
11cookies11 Feb 28, 2026
de4048e
feat(test): add mock proxy regression and bootstrap scripts
11cookies11 Feb 28, 2026
3d4cb4a
docs(test): add P0 acceptance artifacts and one-click regression entry
11cookies11 Feb 28, 2026
a0cecf1
test(runtime): extend mock proxy regression for soak and fault injection
11cookies11 Feb 28, 2026
ed25cf6
fix(runtime): sync comm.connected after serial auto-reconnect
11cookies11 Feb 28, 2026
4c7191d
fix(comm): complete disconnect event consistency and add regression mock
11cookies11 Feb 28, 2026
3d59a91
feat(protocol): close parser error-loop with malformed frame diagnostics
11cookies11 Feb 28, 2026
e1dba88
fix(dsl): close run/stop/error lifecycle with explicit runner states
11cookies11 Feb 28, 2026
c3c35e7
fix(config): close persistence loop with atomic save and backup fallback
11cookies11 Feb 28, 2026
19723ce
test(runtime): close packaging consistency loop with release regression
11cookies11 Feb 28, 2026
1b1df5d
refactor(frontend): land phase B/C baseline for interaction governance
11cookies11 Mar 1, 2026
df8fdd6
refactor(frontend): extract i18n module and wire app composables
11cookies11 Mar 1, 2026
cefc61c
refactor(frontend): split i18n locales and wire proxy capture composable
11cookies11 Mar 1, 2026
6a5b86a
perf(frontend): virtualize proxy capture table rendering
11cookies11 Mar 1, 2026
4d26795
perf(frontend): virtualize log stream rendering
11cookies11 Mar 1, 2026
8e7d3d5
perf(frontend): throttle high-frequency app update paths
11cookies11 Mar 1, 2026
04b621e
feat(frontend): add perf budget gate and interaction test matrix
11cookies11 Mar 1, 2026
58a914e
refactor(frontend): wire settings state composable into app
11cookies11 Mar 1, 2026
c5a8c59
refactor(frontend): split proxy capture table into subcomponent
11cookies11 Mar 1, 2026
dcd275b
refactor(frontend): split proxy capture details into subcomponent
11cookies11 Mar 1, 2026
8bd0a92
refactor(frontend): extract proxy capture toolbar component
11cookies11 Mar 1, 2026
30f79e2
refactor(frontend): extract proxy capture footer component
11cookies11 Mar 1, 2026
75efaac
feat(frontend): add dropdown interaction regression tests
11cookies11 Mar 1, 2026
a2df802
refactor(frontend): extract proxy delete confirm modal
11cookies11 Mar 1, 2026
f54d244
refactor(frontend): extract proxy edit modal component
11cookies11 Mar 1, 2026
d9d7404
refactor(frontend): extract proxy panel card component
11cookies11 Mar 1, 2026
f32b108
refactor(frontend): extract settings panels component
11cookies11 Mar 1, 2026
d66ea9a
feat(frontend): add settings panels interaction tests
11cookies11 Mar 1, 2026
a114d70
refactor(frontend): extract settings persistence composable
11cookies11 Mar 1, 2026
95ca2af
refactor(frontend): extract settings bridge io composable
11cookies11 Mar 1, 2026
274e9a4
refactor(frontend): extract settings header component
11cookies11 Mar 1, 2026
aaa1c7e
refactor(frontend): extract protocol cards section component
11cookies11 Mar 1, 2026
379fe98
refactor(frontend): extract protocol header component
11cookies11 Mar 1, 2026
54234a5
refactor(frontend): extract protocol edit and delete modals
11cookies11 Mar 1, 2026
3e0f00f
refactor(frontend): extract channel dialog modal component
11cookies11 Mar 1, 2026
e3f666f
refactor(frontend): extract ui yaml preview modal component
11cookies11 Mar 1, 2026
34d726e
refactor(frontend): extract protocol manager composable
11cookies11 Mar 1, 2026
2ceadbe
refactor(frontend): extract channel dialog composable
11cookies11 Mar 1, 2026
980495a
refactor(frontend): extract payload sender composable
11cookies11 Mar 1, 2026
43896d1
refactor(frontend): extract yaml document ops composable
11cookies11 Mar 1, 2026
156d1b6
refactor(frontend): extract script runner composable
11cookies11 Mar 1, 2026
fbf4298
refactor(frontend): extract yaml search composable
11cookies11 Mar 1, 2026
658d393
refactor(frontend): extract script log helpers composable
11cookies11 Mar 1, 2026
92c1fb5
refactor(frontend): extract script bridge signal bindings
11cookies11 Mar 1, 2026
c783ef3
refactor(frontend): extract communication bridge signal bindings
11cookies11 Mar 1, 2026
a3556b0
refactor(frontend): extract comm and window chrome bindings
11cookies11 Mar 1, 2026
8cab217
refactor(frontend): extract channel connection actions composable
11cookies11 Mar 1, 2026
705ae1c
refactor(frontend): extract channel sync composable
11cookies11 Mar 1, 2026
11b4c0a
refactor(frontend): extract bridge bootstrap composable
11cookies11 Mar 1, 2026
65469b5
refactor(frontend): extract log buffer composable
11cookies11 Mar 1, 2026
e462c60
refactor(frontend): unify async result helper
11cookies11 Mar 1, 2026
1d24de1
refactor(frontend): extract comm batch ingestor composable
11cookies11 Mar 1, 2026
9b7d908
refactor(frontend): extract comm log export composable
11cookies11 Mar 1, 2026
7fd3349
refactor(frontend): complete app logic extraction for quick and captu…
11cookies11 Mar 1, 2026
a4d90d6
fix(frontend): proxy capture interactions and baseline audit
11cookies11 Mar 1, 2026
d669bc5
feat(frontend): add interaction acceptance gate to ci
11cookies11 Mar 1, 2026
0462fe1
ci(frontend): enforce button interaction audit in acceptance gate
11cookies11 Mar 1, 2026
0e0a107
perf(frontend): lazy-load app views and codemirror deps
11cookies11 Mar 1, 2026
9f84cb3
chore(progress): mark baseline audit phase A as done
11cookies11 Mar 1, 2026
c5f142e
fix(frontend): prevent i18n startup crash with enUS fallback
11cookies11 Mar 1, 2026
fb5ae5f
fix(frontend): resolve App composable TDZ startup crash
11cookies11 Mar 1, 2026
4479d61
fix(frontend): restore window snap preview during drag
11cookies11 Mar 1, 2026
038e4a5
fix(frontend): make custom titlebar drag start via global pointer tra…
11cookies11 Mar 1, 2026
83ef462
fix(frontend): remove drag preview overlay to eliminate titlebar lag
11cookies11 Mar 1, 2026
0e63e02
fix(frontend): avoid titlebar dblclick and drag-start race
11cookies11 Mar 1, 2026
8d9a923
fix(desktop): restore edge snap support for custom titlebar on Windows
11cookies11 Mar 1, 2026
3fdba61
fix(desktop): use native Windows snap assist instead of manual apply
11cookies11 Mar 1, 2026
d9c4486
fix(desktop): restore manual edge snap fallback on Windows
11cookies11 Mar 1, 2026
11fa7ad
feat(desktop): enable native Windows caption hit-test for custom titl…
11cookies11 Mar 1, 2026
e090074
revert(desktop): rollback native hit-test experiment causing input re…
11cookies11 Mar 1, 2026
1748809
feat(desktop): add narrow native caption hit-test rollout on Windows
11cookies11 Mar 1, 2026
201d7d8
feat(desktop): reduce JS move path when native caption rollout is ena…
11cookies11 Mar 1, 2026
0897b1c
fix(desktop): restore bridge move fallback after native rollout regre…
11cookies11 Mar 1, 2026
3c102f9
fix(desktop): default to stable manual snap and gate native caption e…
11cookies11 Mar 1, 2026
0578067
fix(desktop): stabilize webview repaint after maximize and snap trans…
11cookies11 Mar 1, 2026
8d665ca
chore(repo): add bilingual commit message template
11cookies11 Mar 1, 2026
cab95dc
fix(ui): replace COMx default with concrete serial port and adaptive …
11cookies11 Mar 1, 2026
9c397e5
fix(runtime): serialize config writes and retry atomic replace on Win…
11cookies11 Mar 1, 2026
8fabe7d
chore(ui): hide proxy monitor entry during core feature phase
11cookies11 Mar 5, 2026
1c68774
docs(dsl): persist core YAML-DSL target scenarios and archive where …
11cookies11 Mar 5, 2026
4fae866
docs(dsl): add v0.1 channel contract and advance where schema planning
11cookies11 Mar 5, 2026
b40fdf5
docs(dsl): add v0.1 schema spec and persist design baseline updates
11cookies11 Mar 5, 2026
7b9896f
feat(dsl): implement v0.1 session schema parsing baseline
11cookies11 Mar 5, 2026
56448e7
feat(dsl): implement v0.1 send step execution path
11cookies11 Mar 5, 2026
9b5db36
feat(dsl): add v0.1 expect step matching with timeout
11cookies11 Mar 5, 2026
b75b318
feat(dsl): add v0.1 sleep step support
11cookies11 Mar 5, 2026
e4ba885
feat(dsl): add v0.1 capture extraction for vars
11cookies11 Mar 5, 2026
727c704
feat(dsl): add v0.1 step reliability with retry/backoff/on_fail
11cookies11 Mar 5, 2026
e0e62ba
feat(dsl): add v0.1 assert step for match and expression checks
11cookies11 Mar 5, 2026
38a4bfc
feat(dsl): separate params and runtime vars lifecycle in context
11cookies11 Mar 5, 2026
0a7c8d2
feat(dsl): complete v0.1 artifact export, samples, regression, and r…
11cookies11 Mar 5, 2026
06851a5
docs(dsl): define v0.2 scope and schema extension baseline
11cookies11 Mar 6, 2026
93e530b
feat(dsl): implement controlled if/else flow for v0.2 scripts
11cookies11 Mar 6, 2026
ee17a7a
feat(dsl): implement controlled loop flow with times and until
11cookies11 Mar 6, 2026
67b873f
feat(dsl): add v0.2 structured parse step for json/kv/csv
11cookies11 Mar 6, 2026
9913d55
feat(dsl): add v0.2 path extraction step with var assignment
11cookies11 Mar 6, 2026
b6aa6b2
feat(dsl): add v0.2 measure step and dotted variable templating
11cookies11 Mar 6, 2026
8671b09
feat(dsl): add v0.2 assert_range step for threshold checks
11cookies11 Mar 6, 2026
7faa8ac
feat(dsl): add parser-level reuse mechanisms (include/import, templa…
11cookies11 Mar 6, 2026
bd531c6
feat(dsl): add controlled exec step with security allowlists
11cookies11 Mar 6, 2026
1b76ded
feat(dsl): add controlled file step with root allowlist policy
11cookies11 Mar 6, 2026
20febb2
feat(dsl): add switch_session step and nested var flattening in context
11cookies11 Mar 6, 2026
7f705c5
feat(dsl): unify v0.2 structured error codes and failure payloads
11cookies11 Mar 6, 2026
def1db7
feat(dsl): enrich step audit traces and add v0.2 example suite
11cookies11 Mar 6, 2026
cb230cf
docs(dsl): finalize v0.2 migration guide and release freeze checklist
11cookies11 Mar 6, 2026
4dae11f
feat(protocol-pkg): define external package spec and add scanner val…
11cookies11 Mar 6, 2026
c95481c
feat(protocols): add protocol package loader and gateway
11cookies11 Mar 6, 2026
e0b863d
feat(dsl): support protocol send/recv/rpc steps in v0.1
11cookies11 Mar 6, 2026
68b205f
refactor(runtime): remove legacy built-in protocol action registration
11cookies11 Mar 6, 2026
d7de975
feat(protocols): add vectors executor and CLI runner
11cookies11 Mar 6, 2026
c19b47b
feat(protocols): add external modbus and xmodem package examples
11cookies11 Mar 6, 2026
2495072
refactor(ui): switch protocol bridge to external packages
11cookies11 Mar 6, 2026
61c9925
feat(protocols): unify gateway errors and audit logs
11cookies11 Mar 6, 2026
56cf60b
test(protocols): add protocol package test suite
11cookies11 Mar 6, 2026
9057388
docs(protocols): add developer guide template and migration notes
11cookies11 Mar 6, 2026
ada1151
docs(release): add v0.3 external protocol package freeze checklist
11cookies11 Mar 6, 2026
ca763a5
docs(protocols): define modbus three-package model and boundaries
11cookies11 Mar 6, 2026
173e66a
feat(protocols): implement full modbus RTU package with shared codec
11cookies11 Mar 6, 2026
f402cf5
feat(protocols): add full modbus ASCII external package
11cookies11 Mar 6, 2026
a24b9f1
feat(protocols): add full modbus TCP external package
11cookies11 Mar 6, 2026
84c316c
feat(protocols): expand modbus vectors examples and category integration
11cookies11 Mar 6, 2026
5994ce6
docs(protocols): add modbus package guide and freeze checklist
11cookies11 Mar 6, 2026
9dbfb22
feat(protocols): add at_command external package and vectors
11cookies11 Mar 6, 2026
336c44b
feat(protocols): add ymodem external package with retry flow
11cookies11 Mar 6, 2026
f59687f
feat(protocols): add scpi external package and regression coverage
11cookies11 Mar 6, 2026
3f340e2
docs(protocols): finalize v0.4 guide and release freeze checklist
11cookies11 Mar 6, 2026
e612b07
feat(runtime): gate proxy monitor behind feature flags
11cookies11 Mar 6, 2026
b0837df
test(ui): gate proxy acceptance checks by feature flag
11cookies11 Mar 6, 2026
a378f48
feat(dsl): add full-feature v0.2 YAML workbench example
11cookies11 Mar 6, 2026
7453ee4
feat(runtime): add standalone target emulator toolkit
11cookies11 Mar 6, 2026
16c54e1
test(runtime): integrate target emulator into regression suite with …
11cookies11 Mar 6, 2026
ffe7b74
chore(ci): finalize layered target-emulator CI and baseline freeze a…
11cookies11 Mar 6, 2026
8f6b991
test(runtime): add full target-driven YAML-DSL regression and phase0…
11cookies11 Mar 6, 2026
153baac
test(runtime): add YAML-DSL capability suite and stabilize regression…
11cookies11 Mar 6, 2026
b2d296e
test(runtime): integrate protocol package suite into full regression
11cookies11 Mar 6, 2026
5697f21
test(runtime): add YAML-DSL fault injection regression and extend matrix
11cookies11 Mar 6, 2026
13ac43e
test(runtime): add combo/stability/performance YAML-DSL regressions
11cookies11 Mar 6, 2026
1aee664
docs(ci): add layered YAML-DSL regression pipeline and release gates
11cookies11 Mar 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/target-emulator-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Target Emulator CI

on:
push:
branches: ["main"]
pull_request:
schedule:
- cron: "0 2 * * *"
workflow_dispatch:

jobs:
mock-regression:
name: Mock Regression (Python 3.11)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install minimal dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pyyaml

- name: Run target emulator regressions
run: |
python scripts/target_emulator_regression.py
python scripts/target_emulator_fault_regression.py

nightly-virtual-serial:
name: Nightly Virtual Serial (Windows)
runs-on: windows-latest
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt

- name: Run nightly virtual-serial regression
shell: powershell
env:
TARGET_HOST_PORT: ${{ vars.TARGET_HOST_PORT }}
TARGET_DEVICE_PORT: ${{ vars.TARGET_DEVICE_PORT }}
run: |
.\scripts\nightly_virtual_serial_regression.ps1
93 changes: 93 additions & 0 deletions .github/workflows/yaml-dsl-regression.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: YAML DSL Regression

on:
pull_request:
push:
branches: ["main"]
schedule:
- cron: "20 2 * * *"
- cron: "40 3 * * 0"
workflow_dispatch:
inputs:
tier:
description: "Regression tier to run"
required: true
default: "full"
type: choice
options:
- fast
- full
- soak

jobs:
pr-fast:
name: PR Fast Set
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tier == 'fast')
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt

- name: Run fast regression set
run: |
python scripts/v01_dsl_regression.py
python scripts/target_emulator_regression.py
python scripts/protocol_package_test_suite.py
python scripts/yaml_dsl_capability_suite.py
python scripts/yaml_dsl_combo_regression.py
python scripts/yaml_dsl_fault_injection_regression.py

nightly-full:
name: Nightly Full Set
runs-on: ubuntu-latest
if: (github.event_name == 'schedule' && github.event.schedule == '20 2 * * *') || (github.event_name == 'workflow_dispatch' && github.event.inputs.tier == 'full')
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt

- name: Run full runtime regression
run: |
python scripts/runtime_regression_suite.py

weekly-soak:
name: Weekly Soak Set
runs-on: ubuntu-latest
if: (github.event_name == 'schedule' && github.event.schedule == '40 3 * * 0') || (github.event_name == 'workflow_dispatch' && github.event.inputs.tier == 'soak')
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt

- name: Run soak + baseline
run: |
python scripts/yaml_dsl_stability_regression.py --iterations 80 --mem-delta-kb-max 12288
python scripts/yaml_dsl_performance_baseline.py --basic-iters 30 --retry-iters 20
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ Thumbs.db
/.vscode/
/.idea/
/logs/
/runs/
/tmp/
/docs/target-emulator-baseline/
/web-ui/node_modules/
/web-ui/dist/
build/
dist/
ProtoFlow.spec
AGENTS.md
22 changes: 22 additions & 0 deletions .gitmessage-bilingual.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Conventional Commit Subject
# format: type(scope): summary

[中文]
- 变更内容:
- <请填写本次核心改动>
- 影响范围:
- <请填写受影响模块/页面>
- 兼容性/行为变化:
- <请填写是否有行为变化>
- 依赖/环境:
- <请填写依赖、配置或环境要求>

[English]
- Changes:
- <Describe core changes>
- Impact:
- <Describe affected modules/pages>
- Compatibility / Behavior Changes:
- <Describe behavior changes>
- Dependencies / Environment:
- <Describe dependency/config/env requirements>
26 changes: 26 additions & 0 deletions .where-agent-progress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Plan: YAML-DSL + 通讯包全量测试计划(全面覆盖)
- [x] 阶段 0:建立测试覆盖矩阵(DSL 功能点 × 协议包 × 场景类型 × 通过准则)
- [x] 阶段 0:统一测试目录与命名规范(cases/scenarios/reports)
- [x] 阶段 0:定义统一结果模型(PASS/FAIL、错误码、重试命中、耗时、日志链接)
- [x] 阶段 1:DSL 基础能力用例(session/send/expect/sleep/capture/assert)全覆盖
- [x] 阶段 1:DSL 控制流用例(if/loop/retry/on_fail/switch_session)全覆盖
- [x] 阶段 1:DSL 数据能力用例(parse json|kv|csv/path/measure/assert_range)全覆盖
- [x] 阶段 1:DSL 安全能力用例(exec/file allowlist、拒绝路径、越权拦截)全覆盖
- [x] 阶段 1:DSL 产物能力用例(raw_log/summary_json/report_csv)全覆盖
- [x] 阶段 2:协议包 API 合规测试框架(send/recv/rpc 统一契约、入参校验、错误语义)
- [x] 阶段 2:AT 包测试(正常/ERROR/超时/多行回显/capture 兼容)
- [x] 阶段 2:SCPI 包测试(query/write/错误帧/csv 解析/超时)
- [x] 阶段 2:YMODEM 包测试(握手/分包/重传/EOT/失败中断)
- [x] 阶段 2:XMODEM 包测试(握手/块序/重传/结束)
- [x] 阶段 2:Modbus RTU 包测试(读写寄存器、异常码、CRC 错误)
- [x] 阶段 2:Modbus ASCII 包测试(LRC、帧边界、异常码)
- [x] 阶段 2:Modbus TCP 包测试(MBAP、并发请求、异常码)
- [x] 阶段 2:协议 vectors.yaml 全量回归(每包正常+异常+边界)
- [x] 阶段 3:靶机故障注入矩阵(超时/抖动/分片/丢包/断连/乱序)与 DSL 联动验证
- [x] 阶段 3:多场景组合测试(升级 + 参数写入 + 版本校验 + 报告导出)
- [x] 阶段 3:长稳测试(循环运行、资源泄漏、错误恢复、重复执行一致性)
- [x] 阶段 3:性能基线(平均耗时、P95、重试成本、日志吞吐)
- [x] 阶段 4:一键总入口(full regression suite)整合 DSL + 协议包 + 靶机测试
- [x] 阶段 4:CI 分层执行(PR 快速集、Nightly 全量集、周全稳集)
- [x] 阶段 4:发布门禁(全量通过率 100%、关键路径零回归、基线报告归档)
- [x] 阶段 4:测试文档冻结(测试矩阵、故障注入指南、排障手册、已知限制)
56 changes: 55 additions & 1 deletion app/main_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
import time
from pathlib import Path
from typing import Optional
import yaml

try:
from PySide6.QtWidgets import QApplication
except ImportError: # pragma: no cover
from PyQt6.QtWidgets import QApplication # type: ignore

from infra.comm.communication_manager import CommunicationManager
from infra.comm.proxy_forward_manager import ProxyForwardManager
from infra.common.event_bus import EventBus
from app.packet_engine import PacketAnalysisEngine
from app.plugin_manager import PluginManager
Expand Down Expand Up @@ -162,6 +164,35 @@ def _select_webengine_flags() -> Optional[str]:
return "--disable-features=DirectComposition"


def _parse_bool(value: object, default: bool = False) -> bool:
if isinstance(value, bool):
return value
if value is None:
return default
text = str(value).strip().lower()
if text in {"1", "true", "yes", "on"}:
return True
if text in {"0", "false", "no", "off"}:
return False
return default


def _proxy_monitor_enabled() -> bool:
env = os.environ.get("PROTOFLOW_ENABLE_PROXY_MONITOR")
if env is not None:
return _parse_bool(env, default=False)
cfg_path = Path.cwd() / "config" / "app.yaml"
if cfg_path.exists():
try:
raw = yaml.safe_load(cfg_path.read_text(encoding="utf-8")) or {}
app_cfg = raw.get("app", {}) if isinstance(raw, dict) else {}
if isinstance(app_cfg, dict) and "proxy_monitor_enabled" in app_cfg:
return _parse_bool(app_cfg.get("proxy_monitor_enabled"), default=False)
except Exception:
pass
return False


def main() -> None:
_ensure_repo_cwd()
_setup_run_logging()
Expand All @@ -170,13 +201,36 @@ def main() -> None:
os.environ.setdefault("QTWEBENGINE_CHROMIUM_FLAGS", flags)
bus = EventBus()
comm = CommunicationManager(bus)
proxy_enabled = _proxy_monitor_enabled()
proxy_manager = ProxyForwardManager(bus) if proxy_enabled else None
logging.getLogger("main_web").info("Proxy monitor enabled: %s", proxy_enabled)
protocol = ProtocolLoader(bus)
packet_engine = PacketAnalysisEngine(bus)
plugins = PluginManager(bus, protocol=protocol)
plugins.load_all()

app = QApplication.instance() or QApplication(sys.argv)
window = WebWindow(bus=bus, comm=comm)
_shutdown_done = {"value": False}

def _shutdown_proxy() -> None:
if _shutdown_done["value"]:
return
_shutdown_done["value"] = True
if proxy_manager is None:
return
try:
proxy_manager.stop_all()
except Exception:
logging.getLogger("main_web").exception("Failed to stop proxy sessions on shutdown")

app.aboutToQuit.connect(_shutdown_proxy)
atexit.register(_shutdown_proxy)
window = WebWindow(
bus=bus,
comm=comm,
proxy_manager=proxy_manager,
proxy_monitor_enabled=proxy_enabled,
)
window.show()
print("ProtoFlow Web UI started")
app.exec()
Expand Down
Loading