Skip to content

Feat/agent picker collab cells#4

Open
xjsongphy wants to merge 26 commits into
mainfrom
feat/agent-picker-collab-cells
Open

Feat/agent picker collab cells#4
xjsongphy wants to merge 26 commits into
mainfrom
feat/agent-picker-collab-cells

Conversation

@xjsongphy

Copy link
Copy Markdown
Owner

No description provided.

xjsongphy and others added 26 commits July 21, 2026 18:44
Control target/ growth: enable incremental builds, line-only debug info
in dev (debug=1), and strip/lto/codegen-units=1 in release for smaller
binaries. Removed machine-specific jobs override.

Co-Authored-By: Claude <noreply@anthropic.com>
Copies codex-rs/execpolicy verbatim (Starlark-based command policy engine)
into a new workspace crate autoreport-execpolicy, and rewrites
core/src/exec_policy.rs as a thin adapter that delegates Decision evaluation
and prefix-rule persistence to the vendored crate while keeping the project's
ExecApprovalRequirement / ExecPolicyManager surface.

Co-Authored-By: Claude <noreply@anthropic.com>
Extracts provider-specific SSE/protocol handling (Anthropic, OpenAI chat,
OpenAI responses) into core/src/provider/protocols/ with a shared
sse_protocol helper, slimming the per-provider files.

Co-Authored-By: Claude <noreply@anthropic.com>
- Default approval policy Never -> OnRequest: safe commands run silently,
  only dangerous commands prompt the user (minimal interruption). Pinned via
  default_approval_policy() serde fn; enum #[default] stays OnRequest.
- ApprovalRequestPayload (core/types) carries the full displayable request.
- Bus stores pending approvals in an insertion-ordered Vec as the non-lossy
  source of truth (broadcast can lag/drop); pending_approvals() snapshots it.
  register_approval(payload) stores + returns the oneshot rx.
- Runtime registers the payload BEFORE broadcasting so a lagging or
  late-subscribing TUI receiver cannot drop or deadlock a request.

Co-Authored-By: Claude <noreply@anthropic.com>
- Approval keys aligned to codex's default ApprovalKeymap: y approve,
  a approve-for-session, p persist-prefix, d deny, c/Esc/n cancel
  (our 4-variant ReviewDecision folds deny/decline/cancel into Denied).
- Overlay hint text updated to the codex key set.
- TUI rebuilds its pending-approval queue from Bus::pending_approvals() at
  startup and on every broadcast RecvError::Lagged, so a dropped
  ApprovalRequest is recovered instead of deadlocking the agent.

Co-Authored-By: Claude <noreply@anthropic.com>
- renderable: add ColumnRenderable::with() and InsetRenderable::new()
  constructors (ported from codex; #[allow(dead_code)] until callers arrive).
- motion: add the animation_primitives_are_only_used_by_motion_module guard
  test (find_resource! macro swapped for env!("CARGO_MANIFEST_DIR")).
- shimmer: add codex's #[allow(clippy::disallowed_methods)] around Color::Rgb.
- color: tighten is_light/blend/perceptual_distance to pub(crate) (codex parity).

Co-Authored-By: Claude <noreply@anthropic.com>
- /agent picker popup (multi_agents picker status dots, labels, subtitle)
  with keyboard nav (Tab/Up/Down/j/k, digits, Enter, Esc) wired in app_event.
- Collab history cells + agent-to-agent interaction/report rendering.
- Chat composer reverse/forward-i-search (Ctrl-R/Ctrl-S) ported from codex
  (new bottom_pane/history_search.rs).
- ReasoningSummaryCell for dimmed italic reasoning transcripts.
- NOTE: app_event.rs also carries the approval reconcile/push_pending glue
  (consumed by the earlier approval commits) and messages.rs carries a
  stray-brace fix; both are co-resident with the picker/collab work here.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
…nal_hyperlinks) + cell types

Render-layer full-port foundation (R1-R4 of the hyperlink feature):
- custom_terminal.rs: codex's ratatui Terminal replacement that flushes the
  buffer itself, embedding OSC-8 hyperlink escapes in cell symbols and
  computing display width with OSC stripped. Compiles verbatim on our stock
  ratatui 0.29 (unstable-widget-ref feature) — does NOT depend on codex's
  ratatui fork (OSC-8 is hand-emitted, not via fork Style APIs).
- terminal_hyperlinks.rs: HyperlinkLine, annotate_web_urls, mark_buffer_hyperlinks
  (writes OSC-8 into a ratatui Buffer's cell symbols). Path fix: crate::line_utils.
- HistoryCell trait gains display_hyperlink_lines + transcript_hyperlink_lines
  (default impls) — codex parity.
- base.rs: port PlainHistoryCell / WebHyperlinkHistoryCell /
  PrefixedWrappedHistoryCell verbatim. Adds plain_lines helper.
- Adds derive_more = {2, features=["is_variant"]} workspace dep.

Foundation only — not yet wired into the draw path. R5 will swap run() to
custom_terminal::Terminal (with render_widget/render_stateful_widget compat
on its Frame) and mark transcript buffer hyperlinks so URLs render clickable.
Marked #[allow(dead_code)] pending R5.

Co-Authored-By: Claude <noreply@anthropic.com>
R5 of the hyperlink feature: the whole draw path now renders through
codex's custom_terminal::Terminal (vendored earlier) instead of stock
ratatui::Terminal, so the terminal flush can carry OSC-8 hyperlink escapes
in cell symbols (used once hyperlink cells are wired).

- custom_terminal::Frame gains render_widget / render_stateful_widget compat
  shims (mirroring ratatui::Frame) so the existing 43 call sites work unchanged.
- custom_terminal::Terminal::resize now actually resizes the buffers + viewport
  (codex's app calls set_viewport_area externally; we rely on autoresize), and
  the constructor forces the first autoresize to size buffers.
- CaptureBackend test impl drops codex-fork-only scroll_region_* Backend methods.
- All draw fns + overlays + cli switch to custom_terminal::{Frame,Terminal}.
- New test_support::WritableTestBackend (TestBackend newtype + no-op Write) so
  render tests can drive the custom Terminal; Terminal exposes a test-only
  rendered_buffer() accessor for clean cell-based assertions.

Hyperlink cell construction + buffer marking (the visible OSC-8 URLs) is the
remaining R5 step.

Co-Authored-By: Claude <noreply@anthropic.com>
R5b / C1 completion: assistant markdown URLs now render as clickable
terminal hyperlinks.

- AgentMarkdownCell overrides display_hyperlink_lines to run annotate_web_urls
  over its rendered markdown (mirrors codex's WebHyperlinkHistoryCell).
- render_history_hyperlink_lines_for_agent: parallel of the plain-line renderer,
  emitting each cell's display_hyperlink_lines in the same order.
- TranscriptAreaRenderable carries a parallel hyperlink_lines vec and, after the
  Paragraph draws, calls mark_buffer_hyperlinks over the transcript area (which
  re-wraps to locate URL cells and honors the same scroll offset). The vendored
  custom_terminal backend then emits the OSC 8 escapes.
- transcript_hyperlink_lines builds header + per-cell hyperlink rows.

Tests: agent_markdown_annotates_web_urls_as_hyperlinks,
agent_markdown_without_urls_has_no_hyperlinks (147 TUI tests green).

Co-Authored-By: Claude <noreply@anthropic.com>
C2 complete: the turn-end separator now shows codex-style per-turn stats
("Local tools: N calls (Xs) • Inference: N calls (Ys)").

- core/types: RuntimeMetricTotals + RuntimeMetricsSummary (faithful to codex;
  defined in core so the TUI need not depend on the heavy otel crate).
- separators.rs: FinalMessageSeparator gains a runtime_metrics field and
  runtime_metrics_label() ported verbatim from codex (format_duration_ms,
  pluralize). Display/raw lines combine "Worked for" + metrics label.
- runtime/codex_thread: lightweight per-turn accumulator
  (Arc<Mutex<RuntimeMetricsSummary>>) reset at turn start, recorded around
  execute_tool_call (tool_calls) and stream_completion (api_calls), snapshotted
  into BusMessage::StatusChange at the Idle transition. Session stays
  fixed-agent (not codex's SessionTelemetry).
- BusMessage::StatusChange carries Option<RuntimeMetricsSummary>; Cell::TurnSeparator
  gains the field; the TUI attaches the metrics retroactively to that agent's
  most recent separator when the Idle transition arrives.

Tests: empty/tools+inference/singular label cases (150 TUI tests green).

Co-Authored-By: Claude <noreply@anthropic.com>
D alignment: ports the 4th codex base.rs cell type verbatim. The cell set
(PlainHistoryCell / WebHyperlinkHistoryCell / PrefixedWrappedHistoryCell /
CompositeHistoryCell) is now fully aligned with codex's base.rs.

The remaining history_cell files (patches/exec/plans/mcp) are NOT verbatim-
portable without codex subsystems they bind to: patches needs diff_model +
FileChange (~2500 lines), exec needs exec-server state, mcp needs app-server
types, plans uses codex's streaming-plan model. Those are views over codex's
session/thread data and are kept as our fixed-agent re-implementments.

Co-Authored-By: Claude <noreply@anthropic.com>
First step of the app-server stack vendoring (leaf crates upward).
autoreport-async-utils: codex's OrCancelExt/or_cancel helper (86 lines,
tokio-only). codex-protocol depends on it.

Already-vendored foundation leaves: utils/absolute-path, utils/path-uri,
utils/string, utils/home-dir, execpolicy. Next up the tree: expand protocol
toward full codex-protocol (currently a 5k subset of codex's 21k), then
app-server-protocol (29k) + its deps (rmcp, codex-extension-items, codex-
experimental-api-macros), then app-server (42k) + transport (16k).

Co-Authored-By: Claude <noreply@anthropic.com>
…tal-api-macros)

APP foundation, leaf-up: vendor the two small codex crates that
app-server-protocol depends on, both clean leaves.

- extension-items (ext/items, 271 lines): image_generation/sleep/web_search
  experimental tool items. Deps already vendored (absolute-path) + workspace
  crates. Import rewritten codex_utils_absolute_path -> autoreport_utils_absolute_path.
- experimental-api-macros (310 lines, proc-macro): the ExperimentalApi derive.
  Adds proc-macro2/quote/syn =2 to the workspace.

Both compile. Workspace members + deps registered.

Co-Authored-By: Claude <noreply@anthropic.com>
…-server

APP foundation: the complete codex shared protocol vocabulary is now
vendored as autoreport-codex-protocol (21,576 lines, 37 files) — the
foundation app-server-protocol builds on.

New vendored crates (clean leaves, all compile):
- utils/cache (193 lines, lru+sha1+tokio)
- utils/image (845 lines, base64+image+mime_guess+utils-cache)

New workspace external deps: icu_decimal/icu_locale_core/icu_provider (locale
number formatting), image, lru, mime_guess, quick-xml, sha1, sys-locale,
wildmatch, serde_with, proc-macro2/quote/syn (for experimental-api-macros),
ts-rs +uuid-impl, uuid +serde/v7.

All codex_* crate imports remapped to autoreport_* across vendored sources.
Our existing working autoreport-protocol (5k) is left untouched for now;
core/runtime keep using it. Consolidation is a later step.

Co-Authored-By: Claude <noreply@anthropic.com>
…l codex version

APP foundation milestone: the full app-server protocol layer compiles.

- app-server-protocol (28,883 lines, 49 files) vendored as
  autoreport-app-server-protocol. Adds rmcp (MCP, base64/macros/schemars/server)
  + inventory to the workspace. Schema-gen bins (codex_utils_cargo_bin macro)
  dropped; find_resource! lives in #[cfg(test)] only. All codex_* imports remapped.
- shell-command upgraded from partial to codex's full 6.7k version (adds
  parse_command.rs — the shell parser app-server-protocol needs). Now depends
  on autoreport-codex-protocol (for ParsedCommand). Existing callers
  (is_dangerous/is_safe/bash/powershell/shell_detect) unchanged — superset.

Whole workspace builds clean (our core/runtime/tui + the new app-server stack).

Co-Authored-By: Claude <noreply@anthropic.com>
Clean leaf (tokio only). The IPC transport app-server-protocol rides on —
useful for the eventual thin TUI↔runtime RPC for multi-project.

Co-Authored-By: Claude <noreply@anthropic.com>
…rving)

First step toward multi-project (Route A — see docs/APP-ROUTE-A-PLAN.md):
extract the per-project Tui state into a ProjectSession struct.

- New project_session.rs: ProjectSession owns manager/bus/workspace/history/
  statuses/status_since/focused/queued_inputs/pending_submissions/
  suppress_until_idle/rx/index/pending_approvals/pending_user_inputs/
  user_input_requests. Tui holds a single `session: ProjectSession` (v1;
  Vec+switch arrives in later steps).
- All accessors rewritten self.X -> self.session.X across the TUI sources.

Pure refactor — behavior identical. v1 keeps ONE session (single project),
so multi-project is not yet observable; this step only sets up the seam.
150 TUI tests green; whole workspace builds. Session model stays fixed-agent.

Co-Authored-By: Claude <noreply@anthropic.com>
…codex)

Clippy on ubuntu failed: autoreport-codex-protocol references
`landlock` and `seccompiler` in linux-only code paths, but those crates
were never declared. Match codex's protocol/Cargo.toml verbatim:

- codex-protocol: add [target.'cfg(target_os = "linux")'.dependencies]
  with landlock + seccompiler
- uds: add [target.'cfg(windows)'.dependencies] with async-io,
  tokio-util (compat), uds_windows — prevents the same class of failure
  on the Windows workflow
- workspace.dependencies: add async-io = "2.6.0", uds_windows = "1.1.0"
  (versions from codex's workspace Cargo.toml)

Co-Authored-By: Claude <noreply@anthropic.com>
The export tests (e.g. generated_ts_optional_nullable_fields_only_in_params)
read committed TypeScript/JSON schema fixtures under schema/. We vendored
the crate sources without this directory, so the Test step failed on both
ubuntu and macos ("missing ClientRequest.ts fixture"). Copy codex's
app-server-protocol/schema/ (889 files, json + typescript) verbatim —
these are the generated fixtures the tests compare against.

Co-Authored-By: Claude <noreply@anthropic.com>
…bsocket)

APP step (corrected course — the user rightly pushed back on my over-broad
'codex-core wall' claim): vendor codex's app-server-transport GENERIC layer,
which is plain RPC plumbing over the already-vendored app-server-protocol and
does NOT depend on codex-core at all.

Vendored (1,788 lines, compiles):
- outgoing_message.rs (ConnectionId, OutgoingMessage, QueuedOutgoingMessage)
- transport/mod.rs: AppServerTransport enum + parse, TransportEvent,
  ConnectionOrigin, JSON-RPC enqueue/overload/serialize helpers.
- transport/{unix_socket,websocket,stdio,auth}.rs — the actual local IPC
  transports. Websocket uses axum ws; auth uses jsonwebtoken/HMAC (inert for
  local-only use).

Adaptations (no codex-core):
- Dropped remote_control/ (codex cloud pairing — the ONLY part that needed
  codex-core/login/state/api). Only local transports ported.
- find_codex_home -> autoreport_utils_home_dir::find_autoreport_home.
- tokio-tungstenite crates.io 0.28 (codex's fork-only 'proxy' feature dropped),
  rustls-tls-webpki-roots.
- New workspace externals: axum, tokio-tungstenite, jsonwebtoken,
  constant_time_eq, owo-colors, time.

Whole workspace builds. Next: the app-server RPC framework + generic request
processors (also codex-core-free), then adapter for the ~11 agent-driving
processors to our runtime.

Co-Authored-By: Claude <noreply@anthropic.com>
exec_respects_write_dir (autoreport-tools --test isolation) spawns a
sandboxed exec which on Linux needs the autoreport-linux-sandbox binary.
cargo test --workspace doesn't place workspace bin targets into deps/,
so the test failed: "missing autoreport-linux-sandbox helper".

Build the helper on the Linux runner and point the ExecTool at it via
AUTOREPORT_LINUX_SANDBOX_EXE (the env var sandboxing/src/mode.rs already
reads). Mirrors codex's rust-ci-full-nextest-platform.yml, which builds
codex-linux-sandbox and hands it to the test harness.

Co-Authored-By: Claude <noreply@anthropic.com>
…codex)

The newly vendored app-server-transport generic layer (9edbccd) references
base64 and hmac but neither was declared, so clippy failed (lib test):
E0433 cannot find crate base64 / E0432 unresolved import hmac. Match codex's
app-server-transport Cargo.toml (both are [dependencies], workspace = true):
- add base64 + hmac to the crate's [dependencies]
- add hmac = "0.12.1" to workspace.dependencies (base64 already present)
- cargo fmt the two drifted files (auth.rs, mod.rs)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant