Commit Graph
928 Commits
Author SHA1 Message Date
James Peter fcdebf603c chore(tui): polish maintainability
- Remove legacy string-based  (use ExecAction everywhere)
- Add ergonomic traits for newtype IDs (From<&str>, From<String>, AsRef<str>, Display)
- Replace remaining direct streaming mutations with streaming facade
- Update refactor docs: Step 3 and 4 marked DONE

Build: ./build-fast.sh clean
2025-09-02 21:14:34 +10:00
James Peter aef5029ef4 refactor(tui): complete Step 3 and Step 4
- Step 3: fully adopt  and ID newtypes
  * Replace string action checks in history_cell + chatwidget
  * Keep labels (Read/Searched/List Files/Ran) identical
  * Wrap stream/exec/tool ids in StreamId/ExecCallId/ToolCallId
- Step 4: streaming API cleanup
  * Add  and refactor callers
  * Encapsulate  mutations inside streaming module
  * Keep behavior identical; zero warnings

Validated with ./build-fast.sh (clean).
2025-09-02 21:08:47 +10:00
James Peter 929f1d7987 refactor(history_cell): adopt ExecAction in key paths
- Use ExecAction for ExecCell.kind() and MergedExecCell::from_exec
- Switch exec_render_parts_parsed to ExecAction for status/style logic
- Preserve text labels and styling; behavior unchanged

Builds green via ./build-fast.sh
2025-09-02 20:22:04 +10:00
James Peter c6d74b1b89 refactor(tui): finish step 3 partials — ID newtypes + broader ExecAction usage
- Add newtypes: ExecCallId, ToolCallId, StreamId
- Migrate ChatWidget state maps/sets to newtypes and update call sites
- Switch remaining stream-id guards to newtype wrappers
- Use ExecAction in exec begin/end; leave deep history_cell formatting on strings for now

Build: ./build-fast.sh passing (no warnings).
2025-09-02 20:15:04 +10:00
James Peter cbb48b59a3 refactor(tui/history): consolidate merges + introduce ExecAction enum
- Add ExecAction enum and action_enum_from_parsed()
- Switch exec_tools to use enum instead of string tags
- Add ChatWidget::history_maybe_merge_tool_with_previous()
- Adopt merge helper in web_search_complete
- Keep behavior identical; centralize merge pathways

Validated with ./build-fast.sh (no warnings).
2025-09-02 19:38:37 +10:00
James Peter f22f837f15 refactor(tui/history): add history_*_and_maybe_merge API and adopt in exec flow
- Add  and
- Use in exec completion paths to encapsulate merge heuristics
- Continue to centralize invalidation/redraw in helpers

Validated with ./build-fast.sh (no warnings).
2025-09-02 17:43:11 +10:00
James Peter d630d3f9fc refactor(tui/chatwidget): finish history helper adoption across TUI
- Replace direct history mutations with shim:
  - add_to_history -> history_push
  - history_cells[idx] = … -> history_replace_at
  - history_cells.remove(i) -> history_remove_at (where safe)
- Sweep chatwidget.rs, chatwidget/tools.rs, chatwidget/exec_tools.rs, chatwidget/interrupts.rs
- Preserve move-before-assistant helpers where removal return value is required
- Keep behavior identical; centralize invalidation/redraw in helpers

Validated with ./build-fast.sh (no warnings).
2025-09-02 17:41:46 +10:00
James Peter 145c1bbaef chore(tui/onboarding): copy tweak for ChatGPT sign-in message
- Use "use your paid OpenAI plan"
- Fix indentation in preferred-method note
- Add trailing newline for EOF hygiene
2025-09-02 13:56:10 +10:00
James Peter 811b4ffa87 fix(tui/history): restore ReadAggregationCell used by chat widget read grouping 2025-09-01 23:22:08 +10:00
James Peter 8cc7b8ef04 chore: revert unrelated changes in browser/prompt/history/tui files from prior commit 2025-09-01 23:16:39 +10:00
James Peter 3650b647cb fix(core/exec): kill child on task abort to avoid orphaned commands\n\nWrap spawned child in KillOnDrop guard so user interrupts (which abort the agent\ntask) terminate the process immediately. This ensures the UI no longer shows\ncommands as still running after cancel, and the OS process is not left alive. 2025-09-01 23:16:21 +10:00
James Peter 47cabd27e6 fix(tui/core): make cancel + exit immediate during streaming\n\n- TUI: on interrupt, finalize active stream and drop further deltas so output stops instantly.\n- TUI: second Ctrl+C sends ExitRequest immediately (don’t wait for ShutdownComplete).\n- Core: abort running agent on Op::Shutdown to stop model streaming promptly.\n\nThis fixes cases where Ctrl+C/Esc stopped the spinner but the model kept streaming until completion. 2025-09-01 23:10:52 +10:00
James Peter 323b8b748e feat(tui): preserve event order relative to final assistant message; stabilize interrupt processing order\n\n- Track per-event sequence in and \n- Move exec/tool cells ahead of final assistant cell to keep narrative flow\n- Render tool results with markdown extracted from JSON\n- Improve history insertion: use Reverse Index + Clear instead of raw escape strings\n\nchore(deps): remove ratatui git override; downgrade (tests only); refresh lockfile with minor bumps (image, clap, deadpool, deranged) 2025-09-01 22:21:39 +10:00
James Peter d2072587b6 refactor(tui/reasoning): enforce headings as 'entire line bold' only for collapsed summaries; remove leading-bold/markdown cases to match product constraint. 2025-09-01 21:51:04 +10:00
James Peter 03c147f72d refactor(tui/reasoning): remove brittle phrase checks; rely solely on formatting (all-bold, leading-bold with colon, or markdown heading) for collapsed reasoning titles. Clean up unused var. 2025-09-01 21:49:19 +10:00
James Peter ac6788b89d fix(tui/reasoning): improve collapsed-title extraction; ignore meta/preamble lines (e.g., 'Here are the key updates', 'I need to…'), treat trailing quotes/brackets when checking punctuation, and exclude ':' endings to prevent non‑titles from appearing as headings. 2025-09-01 21:47:24 +10:00
James Peter 900fba8d84 fix(tui/plan): defer PlanUpdate history while streaming to prevent interleaving between reasoning headings and content; queue and flush after stream finalization. 2025-09-01 21:45:35 +10:00
James Peter 7baeafe2e1 fix(tui/reasoning): ignore duplicate final Reasoning events (summary/raw) per id to prevent duplicated lines; guard deltas after final as well. Addresses duplicate 'Planning a concise approach' reasoning blocks after threading changes. 2025-09-01 21:37:43 +10:00
James Peter 7378dd4475 fix(core/client): key reasoning delta ordering by (item_id, output_index, content_index); fallback duplicate-text guard when sequence_number missing 2025-09-01 21:25:01 +10:00
James Peter d6ae594a09 fix(tui/colors): unify truecolor detection and avoid false 256-color fallback on Windows Terminal; use env + supports_color + known terminals. Update shimmer to rely on unified detection for smooth gradients. 2025-09-01 21:20:31 +10:00
James Peter 49479510bf fix(core/client): record sequence_number on reasoning deltas and drop duplicates/out-of-order per item_id; reduces repeated or shuffled reasoning text 2025-09-01 21:19:28 +10:00
James Peter 9850c75024 fix(tui/init): skip full-screen background paint on Windows Terminal; avoid color/animation glitches. Gate macOS Terminal workaround behind TERM_PROGRAM and opt-in env var (CODE_FORCE_FULL_BG_PAINT=1). 2025-09-01 21:14:55 +10:00
James Peter d75c6cb125 fix(tui/streaming): merge final Reasoning content with streamed deltas to avoid losing text; preserve committed lines before finalize 2025-09-01 20:52:46 +10:00
James Peter bd7004d7a5 fix(tui/colors): map ANSI-256 Indexed to correct RGB; improve luminance decisions
Also update fallback detection:
- fix(tui/theme): treat Windows Terminal as truecolor using TERM_PROGRAM/WT_SESSION.

This prevents misclassifying light/dark themes on non-truecolor terminals and avoids unnecessary 256-color fallback on Windows Terminal.
2025-09-01 20:50:57 +10:00
James Peter 6f088a1675 fix(tui/paste): qualify AppEvent paths to satisfy CI name resolution; remove unused import 2025-09-01 20:36:05 +10:00
James Peter 33dc9b76b9 docs(changelog): note clipboard image paste support and auto-close #10 2025-09-01 20:29:56 +10:00
James Peter bc499636dd feat(tui/paste): show [image: filename] placeholder and map to temp path
- Composer now inserts a placeholder instead of a full temp path when an image
  is pasted (from clipboard or base64/data-URI).
- Added AppEvent::RegisterPastedImage; composer notifies ChatWidget to map the
  placeholder to its backing file so submit resolves to LocalImage.
- Keeps visual consistency with drag-and-drop and avoids leaking temp paths in
  the visible message.
2025-09-01 20:28:12 +10:00
James Peter 63d1e4acba fix(tui/paste): treat data-URI and raw base64 image pastes as images
- Add decoder to recognize  and common raw base64
  (PNG/JPEG/GIF) payloads, decode with , and write a temp .png.
- Hook into composer paste path before large-paste placeholder logic so iTerm2’s
  menu Paste (which pastes an iVBORw0K... blob) becomes an attached image
  with a temp path and a footer notice, not raw base64 text.
2025-09-01 20:24:20 +10:00
James Peter ecf3d2bbb1 feat(tui): add paste shortcuts fallback to read raw image from clipboard
Terminals like iTerm2 do not emit  for non-text clipboards. When
users press common paste keys (Ctrl+V, Ctrl+Shift+V, Shift+Insert), dispatch an
empty paste to the composer. The composer already treats empty paste as a cue to
attempt  via arboard+image and attach the PNG path.

This keeps normal text paste behavior (Cmd+V still triggers Event::Paste) and
adds a sensible fallback for image-only clipboards.
2025-09-01 20:18:22 +10:00
James Peter 590f18c5f0 fix(tui/clipboard): enable PNG encoder so raw image clipboard paste saves to temp .png
Clipboard reading uses arboard -> RGBA -> image::write_to(ImageFormat::Png), but the
 crate disabled default features on  and only enabled .
This meant encoding PNG failed at runtime and the paste path returned Err,
so pasting raw image data appeared to do nothing.

Enable the  feature on  for the TUI crate so we can encode the
clipboard image to PNG, insert the temp path, and flash the footer notice as intended.
2025-09-01 18:24:23 +10:00
James Peter 58baec56d9 fix(tui/chatwidget): handle ExecCommandBegin before flushing queued interrupts to ensure running cell exists and prevent out-of-order End showing call_id instead of command 2025-09-01 18:20:10 +10:00
James Peter a240e22e45 feat(browser): improve internal browser launch diagnostics and log path 2025-09-01 18:05:09 +10:00
James Peter 38f446fce0 feat(tui/hud): raise expanded HUD minimum to 25 rows 2025-09-01 18:05:09 +10:00
James Peter 0e73ea095d feat(tui): coalesce redraws; refine HUD sizing; update shortcuts
- Coalesce scheduled redraws via atomic flag; send Redraw and clear pending\n- Remove ScheduleFrameIn from allowed AppEvent variants\n- Track full frame height to size HUD: 30% of terminal, min 15 rows (<=60%)\n- Simplify header copy and show dynamic "expand/collapse" hints\n- Change Agents toggle to Ctrl+A (was Ctrl+P); keep Browser on Ctrl+B
2025-09-01 11:45:44 +10:00
James Peter c38ed5bf31 feat(browser,tui): CDP console logs; collapsible HUD; page scroll
browser/manager: install JS console hook on connect to capture logs immediately for already-loaded pages; prefer CDP-captured buffer and fall back to JS hook.\n\nbrowser/page: enable CDP Runtime/Log and buffer console + log events; expose tail accessor.\n\nTUI/chatwidget: add HUD expand/collapse toggles (Ctrl+B for Browser, Ctrl+P for Agents), PageUp/PageDown to page transcript, and track external Chrome connection status for titles.\n\nTUI/height_manager: allow caller-provided HUD target height to support stacked/collapsed layout; keep legacy aspect estimate as fallback.\n\napp, app_event_sender, tui: wire height target and redraws.\n\nRationale: ensure reliable console capture regardless of page state and improve TUI ergonomics for HUD and scrolling.
2025-09-01 09:53:22 +10:00
James Peter 0d40711c2b fix(tui/diff): sanitize diff content like input/output (expand tabs, strip control sequences) to avoid terminal layout issues with tabs and ANSI codes 2025-08-30 14:51:45 +10:00
James Peter dca72e915f fix(cli/coder): de-duplicate validateBinary to avoid ESM redeclare error under Bun/Node 23 2025-08-30 14:15:21 +10:00
James Peter 1723dbf3d4 fix(cli/coder): make bootstrap helper async; fix Bun global install when postinstall is blocked\n\nBun can block postinstall; our coder entry bootstraps the native binary.\nIt used an await inside a non-async function, causing a syntax error under Node.\nNow the helper is async and the top-level call awaits it correctly. 2025-08-30 13:59:41 +10:00
James Peter 2115b55267 fix(cli/install): bootstrap native binary on first run; drop unpublished win optional dep\n\n- Add self-bootstrap in bin/coder.js to fetch validated platform binary when postinstall is blocked (e.g., Bun global)\n- Prefer cached binary, then optional platform pkg, then GitHub release download\n- Remove @just-every/code-win32-x64 from optionalDependencies to avoid Bun 404 noise on non-Windows installs\n- Build verified with ./build-fast.sh 2025-08-30 13:39:39 +10:00
James Peter ebb845ead1 feat(tui/chatwidget): add environment summary and resolved tool paths in Help panel
- Show platform, CWD, git repo status
- Summarize PATH entries (first 6) and PATHEXT on Windows
- Resolve CLI paths via which and display locations
- Clarify built-in 'code' and add exec flag tip
2025-08-30 12:41:49 +10:00
James Peter 5fc5780a12 fix(core/codex): avoid false branch-change detection by ignoring quoted text and tokenizing git subcommands
Prevents blocking on 'git commit -m ...switch...' and similar cases. Only flags explicit branch-changing forms (checkout -b/-B/--orphan/--detach, switch [-c|<name>]).
2025-08-30 11:42:32 +10:00
James Peter 54c5f1ccfd feat(tui,core): add /agents; smoother animations; safe branch names
tui:
- Replace verbose “...ing” labels with concise past-tense labels
- Schedule animation frames with ScheduleFrameIn to avoid debounce drops
- Add /agents output to list active/configured agents and PATH status
- Update bottom-pane status text for search

core/agent_tool:
- Sanitize/shorten model/agent parts for branch IDs (git-safe)
- Pass --skip-git-repo-check to code/codex exec invocations

docs:
- Prompt coder wording tweak

Build: ./build-fast.sh passed locally with no warnings
2025-08-30 11:38:27 +10:00
James Peter d95e0c618a fix(tui): import behind release cfg for colored stderr banner 2025-08-30 10:28:48 +10:00
James Peter 76f7d8ef65 fix(tui/glitch_animation): compute render rect first and scale against it; early-bail on small effective area; cap height to scaled glyphs 2025-08-30 10:24:38 +10:00
James Peter 9df011a16c merge(upstream): integrate upstream/main with 'ours' strategy; adopt MCP unbounded channels, lock-scope fixes, and CI windows target; keep our TUI hooks intact 2025-08-30 06:35:54 +10:00
James Peter 44afbd26ba fix(core/exec): show suggested confirm argv when blocking branch change 2025-08-30 06:31:38 +10:00
James Peter bf871f50ff Merge origin/main: CLI cache; UI highlight; search boost; confirm git
- codex-cli: add persistent user cache and smarter global shim behavior\n- tui/syntax: derive theme from UI (UI-aware syntect)\n- file-search: prefer cwd + directory hints; trim stale popup rows\n- core/exec: require 'confirm:' prefix for branch-changing git scripts\n\nConcludes in-progress merge with resolved conflicts and updated behavior.
2025-08-30 06:25:25 +10:00
James Peter b15f6534de feat(tui/file-completion): prioritize CWD matches; related UX fixes
- TUI: prioritize files from current working directory in completions;
  refine redraw debounce for lower latency; history/markdown rendering tweaks.
- Core/web_fetch: safer HTML sanitization, basic GitHub issue extraction,
  and trimmed payload heuristics.
- Core/agent_tool: more robust command_exists on unix/windows; improve fallbacks.
- Fix: remove unused var in JSON-LD scan to silence warning.

Build: verified with ./build-fast.sh (no warnings).
2025-08-30 06:19:34 +10:00
James Peter a003596e86 ui(tui/assistant): unify streaming + final code cards and set inner padding to two spaces\n\n- Final + streaming: borders only vertically, inner L/R padding = 2\n- Remove outer stripes in streaming; align to content area\n- Height math in streaming changed from +4 to +2 (borders only)\n- Final path updated to +6 width (borders+padding) and padding {2,2,0,0} 2025-08-29 19:01:20 +10:00
James Peter fa7b97f037 ui(tui/assistant): add 1-col inner L/R padding inside code cards\n\n- Block padding left/right = 1 (top/bottom = 0)\n- Adjust card width to content + 4 (borders + inner padding)\n- Keeps height math at +2 (borders only) 2025-08-29 18:56:37 +10:00