Skip to content

Commit 455527c

Browse files
authored
refactor(tui): remove the Rust agent runtime and keep /model via ACP config options (#7)
The TUI (tui/, binary zypi) is now a pure ACP client: the Python pi_agent_cli is the only agent, and a future pi-rust agent only has to be a stdio ACP executable (PI_AGENT_COMMAND). - Remove the in-process Rust agent runtime (pi-sampler, MvpAgent, the sampler/provider stack, the headless runner, the whole leader mode) and the UI entries that have no Python producer: dashboard, MCP, prompt queue, subagents/workflows/goals, hooks/plugins, rewind/fork, feedback/consent, changelog, session rename. Then the crates, dependencies and `pub` items that were left unused. - Keep /model through ACP Session Config Options: the Python agent advertises a `category: "model"` select option and routes session/set_config_option; the pager builds its picker from it (session/set_model stays as a fallback). - Gate the TUI on Linux: tui-ci.yml + scripts/tui_baseline.py enforce the toolchain pin, a deny-list, a dependency-graph ceiling, zero warnings, `cargo check --workspace --tests` and 8 test suites with floors. Report: docs/baselines/tui.md. - Python agent: session/list returns real titles and mtimes; a stdio ACP contract suite (it found that initialize advertised session/close and session/resume while the SDK answered "Method not found"; run_agent now uses use_unstable_protocol=True); SIGTERM and SIGHUP stop the agent like stdin EOF, so its tools are no longer orphaned; `-p` refuses --sandbox instead of running unsandboxed. - Merge main (the Phase 6/7 audit work) into the branch. Six files in pi-agent-cli conflicted and both sides are kept: an api_key_env is the key of its own provider only, for every /model choice too; model_for_choice carries Model.reasoning; _bind_session decides project trust before it restores the saved model. Size: 1,485 files, +11,177 / -625,252. Linux CI green: TUI CI (gates; 8 suites, 7,439 passed / 0 failed / 20 ignored) and CI (Ruff, pytest on Python 3.11 to 3.13). Plan and execution record: docs/PLAN/PLAN-RUST-AGENT-RUNTIME-REMOVAL.md.
1 parent 7e7d4d4 commit 455527c

1,485 files changed

Lines changed: 11177 additions & 625252 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/tui-ci.yml‎

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
name: TUI CI
2+
3+
# Stage 0 of docs/PLAN/PLAN-RUST-AGENT-RUNTIME-REMOVAL.md: a Linux gate and baseline for the Rust
4+
# TUI workspace (tui/). Authoritative environment (ADR6): ubuntu-24.04 + the toolchain pinned in
5+
# tui/rust-toolchain.toml. What is enforced vs report-only lives in scripts/tui_baseline.toml; the
6+
# report is docs/baselines/tui.md. Python code is covered by ci.yml.
7+
8+
on:
9+
push:
10+
branches: [main]
11+
paths:
12+
- "tui/**"
13+
- "scripts/tui_baseline.py"
14+
- "scripts/tui_baseline.toml"
15+
- ".github/workflows/tui-ci.yml"
16+
pull_request:
17+
paths:
18+
- "tui/**"
19+
- "scripts/tui_baseline.py"
20+
- "scripts/tui_baseline.toml"
21+
- ".github/workflows/tui-ci.yml"
22+
workflow_dispatch:
23+
inputs:
24+
release_baseline:
25+
description: "Also build release-dist and record binary size, build time and startup latency (~30 min)"
26+
type: boolean
27+
default: false
28+
29+
concurrency:
30+
group: ${{ github.workflow }}-${{ github.ref }}
31+
cancel-in-progress: true
32+
33+
permissions:
34+
contents: read
35+
36+
env:
37+
CARGO_TERM_COLOR: always
38+
CARGO_INCREMENTAL: "0"
39+
CARGO_NET_RETRY: "10"
40+
# No debuginfo for dev/test builds: smaller target dir and faster links on the runner.
41+
CARGO_PROFILE_DEV_DEBUG: "0"
42+
RUST_BACKTRACE: "1"
43+
44+
jobs:
45+
check:
46+
name: Gates + cargo check (Linux x86_64)
47+
runs-on: ubuntu-24.04
48+
timeout-minutes: 90
49+
steps:
50+
- uses: actions/checkout@v7
51+
52+
- uses: actions/setup-python@v6
53+
with:
54+
python-version: "3.12"
55+
56+
- name: Install Rust toolchain (pinned by tui/rust-toolchain.toml)
57+
working-directory: tui
58+
run: |
59+
rustup show active-toolchain || rustup toolchain install
60+
rustc --version --verbose
61+
62+
- name: Install protoc
63+
uses: arduino/setup-protoc@v3
64+
with:
65+
version: "28.x"
66+
repo-token: ${{ secrets.GITHUB_TOKEN }}
67+
68+
- name: Cache cargo registry and target
69+
uses: Swatinem/rust-cache@v2
70+
with:
71+
workspaces: tui
72+
shared-key: tui-linux-x86_64-check
73+
save-if: ${{ github.ref == 'refs/heads/main' }}
74+
75+
- name: Gates and cargo check
76+
run: python scripts/tui_baseline.py check --out tui-baseline
77+
78+
- uses: actions/upload-artifact@v4
79+
if: always()
80+
with:
81+
name: tui-baseline-check
82+
path: tui-baseline/
83+
84+
test:
85+
name: cargo test (Linux x86_64)
86+
runs-on: ubuntu-24.04
87+
timeout-minutes: 150
88+
steps:
89+
- uses: actions/checkout@v7
90+
91+
- uses: actions/setup-python@v6
92+
with:
93+
python-version: "3.12"
94+
95+
- name: Install Rust toolchain (pinned by tui/rust-toolchain.toml)
96+
working-directory: tui
97+
run: |
98+
rustup show active-toolchain || rustup toolchain install
99+
rustc --version --verbose
100+
101+
- name: Install protoc
102+
uses: arduino/setup-protoc@v3
103+
with:
104+
version: "28.x"
105+
repo-token: ${{ secrets.GITHUB_TOKEN }}
106+
107+
- name: Cache cargo registry and target
108+
uses: Swatinem/rust-cache@v2
109+
with:
110+
workspaces: tui
111+
shared-key: tui-linux-x86_64-test
112+
save-if: ${{ github.ref == 'refs/heads/main' }}
113+
114+
# Report-only until `[test] enforce = true` in scripts/tui_baseline.toml (after the first
115+
# Linux run has been triaged); the per-suite table lands in the job summary either way.
116+
- name: Test suites
117+
run: python scripts/tui_baseline.py test --out tui-baseline
118+
119+
- uses: actions/upload-artifact@v4
120+
if: always()
121+
with:
122+
name: tui-baseline-test
123+
path: tui-baseline/
124+
125+
release-baseline:
126+
name: Release build baseline (Linux x86_64)
127+
if: github.event_name == 'workflow_dispatch' && inputs.release_baseline
128+
runs-on: ubuntu-24.04
129+
timeout-minutes: 150
130+
steps:
131+
- uses: actions/checkout@v7
132+
133+
- uses: actions/setup-python@v6
134+
with:
135+
python-version: "3.12"
136+
137+
- name: Install Rust toolchain (pinned by tui/rust-toolchain.toml)
138+
working-directory: tui
139+
run: |
140+
rustup show active-toolchain || rustup toolchain install
141+
rustc --version --verbose
142+
143+
- name: Install protoc
144+
uses: arduino/setup-protoc@v3
145+
with:
146+
version: "28.x"
147+
repo-token: ${{ secrets.GITHUB_TOKEN }}
148+
149+
# A warm cache would make the recorded build time meaningless, so only the registry is cached.
150+
- name: Cache cargo registry
151+
uses: Swatinem/rust-cache@v2
152+
with:
153+
workspaces: tui
154+
shared-key: tui-linux-x86_64-release
155+
cache-targets: "false"
156+
157+
- name: Build release-dist and measure
158+
run: python scripts/tui_baseline.py release --out tui-baseline
159+
160+
- uses: actions/upload-artifact@v4
161+
if: always()
162+
with:
163+
name: tui-baseline-release
164+
path: tui-baseline/

0 commit comments

Comments
 (0)