agent-joule/dev-docs/UPSTREAM_DIVERGENCE.md
David Charlot 7a59f0ffc5 agent-mei: rename agent_joule panel/theme/workflows to agent-mei, MEI fleet wiring and honest-energy receipts
Brings over the uncommitted agent-mei work (Mac checkout, Sep 22) plus box
follow-ups (Oct 17: agent_mei action namespace in keymap/zed.rs, MEI_BRIDGE.md,
RENAME_AGENT_MEI.md, unmetered receipts report 0 uJ). joule_core, JOULE_CODE_*
and JouleDB names unchanged. *.bak.* scratch files excluded.
2026-10-27 12:59:12 -04:00

72 lines
6.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Upstream Divergence — what we removed & modified
> Generated 2026-06-14. Fork baseline `a084434` ("hard fork of zed@e2e7a67") → HEAD. `git diff --stat a084434 HEAD`: **245 files, +13,564 / −187,592.** The binary compiles clean (`cargo check -p zed --bin agent-mei` → exit 0; 8 benign warnings).
The deletions are almost entirely upstream's `agent` + `agent_ui` + `sidebar`; the insertions are almost entirely the new `crates/agent_mei_panel`.
## 1. Entire crates / features removed
LOC = Rust LOC at baseline.
| Crate / feature | LOC | What it did upstream | Reason |
|---|---|---|---|
| `crates/agent` | ~75,549 | Native in-tree agent: thread engine, tool suite, prompt templates, eval fixtures, agent DB | Replaced by `agent_mei_panel` (federated ACP + local cascade) |
| `crates/agent_ui` | ~74,075 | Agent Panel UI: thread views, model selector, inline assistant, provider modals, agent_diff | Replaced by `agent_mei_panel` UI |
| `crates/sidebar` | ~22,660 | Thread/workspace switcher (+14.6k LOC tests) | Tied to removed agent_ui thread model; bloat |
| `crates/skill_creator` | ~1,993 | "Skill" authoring UI | Tied to removed agent skill system |
| `crates/auto_update` | ~1,555 | In-app updater; **held live egress** to Joule release servers | **Privacy / no-phone-home** |
| `crates/auto_update_ui` | ~391 | Release-notes / update banner | Privacy |
| `crates/auto_update_helper` | ~858 | Windows updater helper exe | Privacy |
| `crates/acp_tools` | ~842 | ACP protocol-inspector devtool | Bloat |
| `crates/eval_cli` | ~898 | Headless agent eval harness | Bloat |
| `crates/eval_utils` | ~146 | Eval helpers | Bloat |
| `title_bar/src/update_version.rs` | 148 | Title-bar "update available" | Privacy |
| `zed/src/zed/open_listener.rs` | 264 | `zed://` URL handler (AgentPanel/SharedAgentThread/InstallSkill deep-links) | Depended on removed agent_ui |
| `settings_ui/.../tool_permissions_setup.rs` | 1,461 | Agent tool-permission setup page | Tied to removed agent tool-permissions |
**Added:** `crates/agent_mei_panel` (~+12k LOC) + conformance vectors.
## 2. Core files modified
| File (lines) | What changed | Classification |
|---|---|---|
| `zed/src/main.rs` (~269) | Removed `agent_ui::init`/`acp_tools::init`/`auto_update*::init`/`PromptBuilder`; added `agent_mei_panel::init`. `authenticate()` → no-op (no startup sign-in — "the real phone-home"). Deleted agent deep-link handlers. Added `--jc-control/-params/-sock/-tcp/-token/-mcp` flags + control/MCP dispatch. Multi-instance by default (single now opt-in). | **privacy + wiring** |
| `zed/src/zed.rs` (~148) | Removed `Sidebar`, `acp_tools` toolbar, and the entire `initialize_agent_panel`/`setup_or_teardown_ai_panel`/`DisableAiSettings` machinery. Loads `AgentMeiPanel`. | **wiring + dead-removal** |
| `http_client/src/http_client.rs` (~84) | The four `build_zed_*_url` builders now `bail!` instead of returning a URL. | **privacy (egress backstop)** |
| `client/src/telemetry.rs` (~18) | `MINIDUMP_ENDPOINT = None` (ignores env); `send_event` builds but never transmits. | **privacy (crash + telemetry)** |
| `telemetry/src/telemetry.rs` (~14) | `send_event`/`init` no-ops; neutralizes ~43 `telemetry::event!` sites with one edit. | **privacy** |
| `title_bar/src/title_bar.rs` (~132) | Removed `update_version`, `SimulateUpdateAvailable`, and the Sign-In button (`render_sign_in_button` deleted). | **privacy + branding** |
| `onboarding/{basics_page,onboarding}.rs` (~109) | Removed `render_zed_agent_button` (Joule-cloud promo) + the `SignIn` action/handler. | **privacy** |
| `remote_connection/src/remote_connection.rs` (~112) | `download_server_binary_locally` → "disabled" error; `get_download_url` → `Ok(None)`; removed `AutoUpdater` dep (closes residual SSH remote-server fetch). | **privacy** |
| `project/src/agent_registry_store.rs` (~28) | `init_global` no longer auto-`refresh()`es; `refresh_if_stale` no-op. On-disk cache only; explicit `refresh()` retained. | **privacy (ACP registry auto-fetch)** |
| `activity_indicator.rs` (~5) | `DismissMessage` re-homed from removed `auto_update` crate. | clean re-home |
| `zed/Cargo.toml`, `Cargo.toml` | Binary `zed`→`agent-mei`; bundle id `dev.zed.Zed`→`science.transaction.AgentJoule`; member/path-dep changes. | **branding + wiring** |
| `assets/settings/default.json` (~37) | Theme→"Agent Mei"; `auto_install_extensions` emptied; added local `vllm` provider + `agent_servers` (claude-acp/gemini/codex). | **privacy + wiring + branding** |
| `assets/keymaps/*` | Removed `agent::*`/`agents_sidebar::*`/`onboarding::SignIn` bindings (would panic keymap validation); added `agent_mei::*`. | **wiring + privacy** |
## 3. Privacy hardening — claims vs code (all verified ✅)
`PRIVACY_HARDENING.md` claims check out against the diff:
- **A Sign-in removed** ✅ `main.rs::authenticate` no-op; title-bar button + `onboarding::SignIn` + keymap bindings removed. `client` crate retained, signed-out.
- **B Auto-update removed** ✅ all three `auto_update*` crates deleted; inits removed; menu items gone; `remote_connection` download stubbed (closes residual SSH egress).
- **C Telemetry neutralized** ✅ both `send_event` paths confirmed inert.
- **D Crash upload disabled** ✅ `MINIDUMP_ENDPOINT = None` (forced).
- **E ACP registry auto-fetch disabled** ✅ `init_global` auto-refresh removed + `refresh_if_stale` no-op (was ~36 startup connections to `cdn.agentclientprotocol.com`); explicit refresh retained.
- **F Egress backstop** ✅ all four `build_zed_*_url` `bail!`.
- **Extensions** ✅ `auto_install_extensions` emptied.
The doc's tshark-SNI "network-silent startup" runtime claim is asserted there, not re-run in this audit.
## 4. Dangling risk — none load-bearing
Build compiles (exit 0). Per removed-crate grep:
- `acp_tools`, `auto_update_ui`, `auto_update_helper`, `eval_cli`, `eval_utils` → **0 references.** Clean.
- `agent_ui` → 3 benign refs (a comment, a `clippy.toml` allow-path, and `visual_test_runner.rs` behind the **`visual-tests` feature** — *not* built by the binary). **Latent:** the `visual-tests` feature is itself now broken (calls removed `agent_ui::init`); dev-only.
- `sidebar` → all false positives (the word "sidebar" in `agents_sidebar` action ns, `AgentSettings.sidebar_side`, a `SidebarHandle` in `crates/workspace`).
- `skill_creator` / `agents_sidebar` → dead string literals in `zed.rs::test_action_namespaces:5135` (only fails if that test runs).
- `auto_update` → all refs are the inert settings *key* (a harmless dead config bool).
**Cleanly handled:** `DismissMessage` re-homed (not dangling); `render_sign_in_button` fully deleted; keymap bindings removed in lockstep (avoids the documented startup keymap-validation panic).
**Cleanup left behind** (see [FINDINGS.md](FINDINGS.md) P3): 8 unused-import/var warnings in `zed.rs`/`main.rs`; the broken `visual-tests` feature; the dead `"skill_creator"`/`"agents_sidebar"` test-namespace strings.