Repository navigation
feat(tui): plan 0.5 call graph tool and phase C closeout (acceptance probes, 7-page guide, notices; plan r11) - #13
Merged
Merged
Conversation
…he TUI workspace (plan 0.5) The tool reads the Rust sources and reports which modules live code refers to. It replaces the hand-written list of examples of what the support layer keeps. Subcommands: crates, units, keep. 35 tests; each mutation of the tool fails them.
…NOTICE (plan C.3) scripts/tui_notices.py finds the packages that ship in zypi (normal and build dependency closure of pi-pager-bin, five targets) and fixes the notices file: 222 stale entries out, 44 missing entries in, hand-written sections kept. The wording of a new entry is copied from the entries with the same license. tui/NOTICE now names the product (zypi), says tui/ is a hard fork that does not follow upstream, and lists the changes. The stale nfsserve entry in third_party/ is gone. 62 tests.
…ial overlay removed, no per-start extraction - docs: seven pages (getting started, slash commands, theming, sessions, terminal support, permissions and safety, status line) written against the code and agent.toml; sixteen pages of removed features deleted. The status-line page says the row stays empty with the Python agent (it is filled from a session-status update only the Rust agent sent). - docs.rs: USER_GUIDE lists the seven pages; extract_user_guide_docs and its call in pi-pager-bin are gone; two tests guard the pages (no old product names, every file in the directory is listed). - tutorial overlay (views/tutorial.rs, tutorial_docs.rs, docs/tutorial/) removed: no entry point since A.3, and its pages described commands zypi does not have. - doc picker: the footer tip pointed at files zypi no longer writes. - strings that pointed at ~/.grok/docs/user-guide/*.md (mcp.rs, glob.rs), the zypi wrap help line that pointed at a README that does not exist, and two comments.
…lan C.1) net_audit.py plays one turn under a pseudo-terminal and samples the sockets of zypi and of each process below it (/proc/<pid>/fd joined with /proc/<pid>/net/*). zypi must hold no connection to a non-loopback address and listen on none. --mock checks that the agent is silent too, --no-network runs it in an empty network namespace, and --model-from FILE plays one real turn (the agent must hold an established connection: the positive control; the output names no host, address or key). status_line_probe.py shows that the status row is not drawn with the plain Python agent and is drawn when status_proxy_agent.py adds the session_status message. Unit tests for the three run on Windows and Linux.
…se 4 spec revised, P2 admission rule in DESIGN AGENTS.md (pi-agent-cli) says what zypi really does with config.toml: strict types for the keys it knows (a top-level permission string, a [[models]] array and invalid TOML stop it with exit 1), unknown keys ignored; the agent falls back to config.toml only when agent.toml is missing. TUI-AND-CODE-AGENT.md: ACP link, real [model] keys (id, not model_id; no context_window; permission values ask|auto|always-approve; [skills] paths), the real slash commands, no model client / tool runner / MCP client in zypi, pointer to the network audit. Phase 4 spec section 1.3 #2 and section 3 get a revision note (runtime part of the shell is gone; pi-tools and pi-workspace still tie the pager to the tree; tui/ is a hard fork). DESIGN section 8.5 states the five-condition admission rule for pi/ extensions (plan P2).
…tover words (plan C.4) The pi-shell README was the upstream Grok CLI manual (1,968 lines, an install script that installs the official CLI): replaced by a short note on what the crate is now. Doc comments and a label in pi-agent, pi-http, pi-tty-utils and pi-test-support no longer name a 'grok agent' command. pi-test-support's README now says that only EnvGuard, scaled, TestProcess/TestSandbox, env_parse and ResourceGrowth have users outside the crate (plan D.5). tui_baseline.py gets count_residue and a [gates.residue] ceiling per phrase: 'grok agent' 0, 'leader' 245, 'x.ai' 304 lines under tui/crates (the plan's literal zero cannot be met before phase D: the lines are the removed leader process, xAI endpoints in the auth, voice and update code, and the vendor-method filter itself). A test runs the same ratchet in the Python CI job.
…et the pi-pager baseline to 5,608 tui-support.md is the output of tui_callgraph.py keep (item 0.5). The tui.md section on leftover words classifies the 245 leader and 304 x.ai lines that the new residue gate holds as ceilings. pi-pager is 5,626 -> 5,608 after the embedded user guide change (item C.2); the other nine suites did not move (8,665 over ten suites, one local run on Linux).
…list (plan 0.5) Check: copy tui/, delete the files of every unit the tool calls dead, run cargo check on the consumer crates. The first run listed 21 dead units and 4 of them were live: - a path inside a string of an attribute (`serde(with = "crate::util::serde_base64")`): `util::serde_base64`, `serde_helpers` - a path that starts at a child module, with no `use` and no `crate::` (`hub_auth::init_metrics()` in lib.rs): `hub_auth`, `hub_auth::proactive` Both are references now. A third kind cannot be seen from the text: an impl that code uses without a name (`types::error` holds the `impl From<TodoError> for ToolError` that `?` calls). A dead unit with `impl` blocks for types it does not define is listed apart as "check first", and the summary table gets a column for it. Result on 24907ef: 17 dead units, 6,190 lines. With all 17 deleted, cargo check fails at exactly one unit (`types::error`, 5 errors, and it is in the "check first" list); with that one kept, the check passes and shows one new warning (an unused function in pi-hooks, which is a function, not a module). Tests 35 -> 39. Each of the 17 mutations of the tool makes a test fail. docs/baselines/tui-support.md is regenerated.
…g, baselines and changelog Plan: 0.5 and C.1-C.4 are done; decision 15 (the status line) and the phase D candidates D.5-D.9 are new; index, status and revision text say r11. D.9: the Rust test run does not isolate HOME, so some tests write the developer's real ~/.pi-python and /tmp. Execution log: section 10.14, appendix B.7 and the revision log. Baselines: tui.md gets the r11 numbers and a keep-list section; tui-history.md gets the r11 paragraph. CHANGELOG: the call graph tool, the notices check, the network audit, the status line probe, the 7-page user guide, NOTICE, the leftover-word ratchet, the config.toml notes. AGENTS.md: the two new TUI tools, the new PTY scripts and the HOME warning. Numbers: 10 suites 8,665 passed / 0 failed / 22 ignored (WSL2, one local run); pytest Windows 2,510 and Linux 2,538 passed; Ruff 0.16.10 and 0.16.0 clean. Nothing is pushed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Plan item 0.5 and phase C (C.1 to C.4), plan r11. Nine commits on top of
main(df812d1). The Python agent does not change its behaviour: one docstring, oneAGENTS.mdand two example files change wording. The record is section 10.14 ofdocs/PLAN/archive/PLAN-RUST-AGENT-RUNTIME-REMOVAL-EXECUTION-LOG.md. The status is indocs/PLAN/PLAN-RUST-AGENT-RUNTIME-REMOVAL.md.What a user of
zypisees.zypino longer writes documentation files into<home>/docs/user-guide/at start. The embedded user guide has 7 pages (was 33 files). The tutorial overlay is gone (it had no entry point). Some messages that named missing files now say something true. Old copies of the extracted guide stay where they are.Nothing was deleted from the source tree because of the call graph. The tool only lists candidates (item D.8).
scripts/tui_callgraph.py(crates,units,keep) reads the Rust source as text. It needs nocargoand no network.keepwritesdocs/baselines/tui-support.md: of 305,581 non-test lines in the 7 support crates, 17 modules (6,190 lines, 2 %) have no live reference.pi-hookshas 4,339 of its 9,026 lines in that list. I checked the list with the compiler in 5 runs on a pruned copy. The first runs found 3 classes of live code that the tool called dead: paths inside attribute strings, paths that start at a child module, and animplthat no path names. The tool now counts the first two as references and marks the third as "check first". In the last good run, 16 modules (6,143 lines) were removed andcargo checkpassed for the three product crates and for--workspace --tests. The 17th (pi-toolstypes::error) must stay: it holds theimpl From<...> for ToolErrorthat?needs.scripts/tui_pty/net_audit.pysamples the socket tables ofzypiand of every process below it, about every 9 ms, during one conversation turn.zypihas no connection to a non-local address and listens on nothing. Mock model: 13 of 13 checks. Whole process tree in an empty network namespace: 13 of 13 (the turn still finishes). One real-model turn: 13 of 13, with a positive control (the agent's own outside connections were seen). The model key went to the child process through an environment variable only.scripts/tui_pty/status_line_probe.py: the custom status line is never drawn under the Python agent (4 of 4 runs), because the agent never sendssession_status. This is decision 15 below.agent.example.toml. The start-up extraction is removed. The tutorial overlay (688 + 149 lines) is removed. Six strings that pointed to files that do not exist are fixed (4 inmcp.rs, 1 inglob.rs, 1 help line ofzypi wrap), and so is the picker footer.pi-pagertests: 5,626 to 5,608.scripts/tui_notices.py(check,update [--write]) comparestui/THIRD-PARTY-NOTICESwithCargo.lockfor the 5 release targets. The file had 1,167 entries for 989 packages: 222 stale entries are removed and 44 missing entries are added (18,898 to 16,548 lines).tui/NOTICEis rewritten: the product iszypiandtui/is a hard fork. This is a comparison withCargo.lock, not a legal review.config.tomllimits measured and written down,docs/TUI-AND-CODE-AGENT.mdcorrected, a revision note in the phase 4 spec, the admission rule forpi/extensions indocs/DESIGN.mdsection 8.5.grok agent: 28 lines to 0 (pi-shell/README.mdwas the upstream Grok manual, 2,682 lines, now 43).leader(245) andx.ai(304) cannot go to 0 yet, so[gates.residue]inscripts/tui_baseline.tomlholds them as ceilings that only go down.Decisions for you
session_status(a newpi/extension, it must pass the five admission rules first); (b) the pager draws the line from data it already has (working directory, model, permission mode, git branch); (c) delete the setting, the code and the guide page. I lean to (b) or (c). Status: open.pi-test-supporthas 5,003 of 7,384 lines without an outside user. D.6: the embedded guide viewer has no entry point, so nobody reads the 7 pages. D.7: npm and updater leftovers that never run. D.8: delete the 16 compiler-checked modules (6,143 lines) andpi-hooks/tests/integration.rs. D.9:tui_baseline.py testdoes not isolateHOME, so some tests write into the real~/.pi-pythonand/tmp(found after the runs; 18 trust entries for deleted temp folders and 46grok-unified-log-test-*folders).Not verified, left
THIRD-PARTY-NOTICES.tui_notices.py checkneedscargo, so it is not in CI yet.24907ef. The 16 deletable modules were not deleted and no test ran in the pruned copy.<user_guide>block inpi-agent/templates/prompt.mdstill names~/.grok/docs/user-guide/. I found no code that renders this template, so it probably reaches no prompt. I did not prove it.zypi --helpstill lists Grok-era flags (--agent,--agents,--no-plan,--no-subagents,--oauth); I did not check each one.Review guide
scripts/tui_callgraph.py,scripts/tests/test_tui_callgraph.py(new),docs/baselines/tui-support.md(new, generated)scripts/tui_notices.py,scripts/tests/test_tui_notices.py(new),tui/NOTICE,tui/THIRD-PARTY-NOTICES,tui/third_party/*Cargo.lockscripts/tui_pty/net_audit.py,status_line_probe.py,status_proxy_agent.py(new),scripts/tests/test_tui_pty.py,scripts/tui_pty/README.mdtui/crates/codegen/pi-pager/docs/**,src/docs.rs,src/tutorial_docs.rs,src/views/tutorial.rs,src/views/modal.rs,src/app/app_view*.rstui/crates/codegen/pi-shell/README.md,pi-shell/src/util/config/mcp.rs,pi-sandbox/src/deny/glob.rs,pi-agent,pi-http,pi-status-line,pi-test-support,pi-tty-utilsgrok agentpointers removed, strings fixed; comments, labels and READMEs onlyscripts/tui_baseline.py,scripts/tui_baseline.toml,scripts/tests/test_tui_baseline.py[gates.residue]),pi-pagerreference_passed5,608docs/PLAN/**,docs/baselines/**,docs/DESIGN.md,docs/TUI-AND-CODE-AGENT.md,docs/WINDOWS.md,docs/specs/...phase4...,CHANGELOG.md,AGENTS.md,packages/pi-agent-cli/{AGENTS.md,agent.example.toml,config.toml.example,pi_agent_cli/config.py}config.pychange is a docstring)Verification
All numbers are local. No CI ran on this branch before this PR.
python scripts/tui_baseline.py test, scrubbed environment,PI_E2E_PYTHONandPI_E2E_REQUIRED=1), at4fadcf3: 10 suites, 8,665 passed, 0 failed, 22 ignored (22 m 22 s). That is the last CI result (8,683) minus the 18 tests that went with the guide.pi-pager: 5,608 (13 ignored). Every other suite equals itsreference_passed. After4fadcf3,tui/changed only in doc comments, one label and two READMEs, so the tests did not run again.python scripts/tui_baseline.py checkat24907ef: passes in 5 m 24 s (dependency graph 980, warnings 0, leftover words 0 / 245 / 304).python scripts/tui_notices.py checkat71286ed: 989 packages, 989 entries, 0 missing, 0 stale.real_llm: 2,510 passed, 0 failed, 39 skipped on Windows (Python 3.12.7); 2,538 passed, 0 failed, 11 skipped on Linux (WSL2, Python 3.12.3).ruff check .andruff format --check .: clean with the project's Ruff 0.16.10 and with CI's pinned 0.16.0 (234 files).cargo test, about 30 minutes) shows 8,665 passed, 0 failed, 22 ignored. Ifpi-pageris not 5,608, look at the manifest first.