Repository navigation
feat: add charts, preserve chat history and improve file tools - #146
Merged
Merged
Conversation
Lancetnik
added this pull request to stack #131
October 11, 2026 06:07
Branch coverage
51 files skipped due to complete coverage. |
Render line and bar charts from bound data, retain compaction status for replay, and reuse skill references already present in context. Keep Thinking active across tool rounds and rebuild the SPA bundle.
Group consecutive tool batches across empty continuing model replies while retaining Thinking activity. Cover counted labels, skill cards, replay, and visible message boundaries.
Aggregate interleaved calls across continuing replies and observer alerts. Group repeated details with counts and time ranges, move call times to the left column, and expose file actions as inline icons. Hide redundant provenance badges and empty popovers.
Replace the standalone preview icon with a clickable filename while retaining the Download icon, grouped call counts, and call times. Verify filename navigation and narrow-screen layout in Chrome.
6 of 7 tasks
marklysze
approved these changes
Oct 11, 2026
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.
Why are these changes needed?
Long chats need to open on their recent messages and retain their visible history after compaction, show ongoing agent work consistently, and draw factual charts directly from data. This PR also bounds local file reads, validates block edits before writing, warns before file overwrites, simplifies A2UI card controls and preserves the current view when switching Drawer tabs. Transient provider connection failures and interrupted response streams now retry the failed model call before failing the Turn.
Add a shared native
Chartprimitive for line, grouped bar and stacked bar charts. Labels, series and event annotations accept data bindings. SVG rendering includes axes, legends, exact-value tooltips, an accessible data table, localized controls, theme colors and contained horizontal scrolling. Missing measurements remainnullgaps. Authoring validation andcharts.mddocument the supported contract.Archive typed chat events for complete UI and card-draft replay while the model receives the current compacted context. Chat deletion removes archived segments. Compaction uses the current Turn's resolved model, including chat overrides, and retains a recent tail within half the token threshold, capped at 60 conversational events. Advanced Settings exposes a per-profile threshold, defaulting to 50,000 estimated tokens, applied to the next message without a restart.
Open the SPA chat on its latest ten complete turns, then request earlier event pages when scrolling near the top. Stable cursors survive archived compaction segments and reconnects restore the already loaded range. Prepending preserves mounted item identities and the visible scroll anchor; chronological replay applies later feedback, inquiry answers and card updates to earlier items. Loading status, retry and an explicit Load earlier messages button support slow or failed requests. The model switcher requests only the last transcript message. WebSocket replay buffers concurrent live events before the ready marker, and clients without the pagination option retain full replay. Pages limit transport and rendering; selection reads the existing complete event archive on the server.
Retain and render compaction started/completed/failed events across reconnects and restarts. Successful status remains in the timeline after subsequent messages; cancellation retires a pending status. Compaction has its own progress indicator.
Retry OpenAI/Anthropic connection and timeout errors, HTTPX/HTTPX2 network failures and interrupted response streams through the existing LLM middleware, including explicitly wrapped transport causes. Resolve the actual HTTP status before a provider-specific string code; fatal HTTP errors still stop immediately. The default two-retry budget and exponential backoff remain unchanged. Retrying preserves completed local tool results and does not restart the Turn; cancellation interrupts backoff. Document the retry/timeout settings, environment overrides and separate SDK retries.
Keep
Thinkingactive through tool rounds and pauses before the next reply. A response containing text and tool calls is a continuing response; replay restores the same activity state. Streaming text, final responses and cancelled/failed turns have the appropriate indicator behavior. Aggregate one chip per tool across interleaved calls, empty continuing replies and observer alerts within a work block. Visible progress and user messages start a new group. Hover, keyboard focus or a tap opens the ordered list of distinct run details with skill, script and file names; repeated details share a count and time range; long lists scroll within the viewport. Call times occupy the left column, replacing numbering and the timestamps below each entry. Clickable filenames open files directly for read and write tools, including home-relative and absolute paths in granted folders; preview and download retain the current Thread grant scope. Only the Download icon sits beside the filename in that list, replacing standalone artifact and provenance badges. Clicking alist folderpath opens Files, expands and selects that directory while preserving the current Thread.read chatdetails show the conversation title and identifier, falling back to its identifier when it is unavailable. Clicking the title opens that conversation and dismisses the run popover; the same action is accessible by keyboard. The popover closes on hover leave, Escape, an outside click or a second tap, without a redundant close button. Tools with no meaningful details keep a plain counted chip instead of a popover that repeats their name. Save confirmations distinguish card definitions from instances.Show only the first source line of each shell command or code run, with an ellipsis and a down/up chevron to expand or collapse its complete, copyable source. Local and sandboxed variants preserve the language and repeated-run counts. Leaving a hover-opened popover closes it after clicking a chevron; keyboard focus retains it. Execution rows mount only while the popover is open, so reopening starts collapsed without a separate state reset.
Align the host file tools with Pi-style line reads and block replacements.
read_filereturns complete UTF-8 lines under a 500-line / 10 KiB cap, accepts 1-basedoffsetand linelimit, and reports file size, returned and remaining counts plus the next call to continue. Text with unfamiliar extensions is readable, relative paths resolve in the workspace, and PDFs/images retain visual reading. A line over the byte cap gives a bounded-shell fallback diagnostic.update_fileacceptseditswitholdText/newText, checks every unique, non-overlapping match against the original before writing, tolerates Unicode typography/trailing whitespace, preserves untouched lines and BOM/LF/CRLF style, and returns a numbered diff with patch metadata. It checks folder write grants for both workspace and external paths and replaces the native toolkit version.write_filecreates UTF-8 files and parent folders, warns without writing when a file exists, and requires an explicit retry withoverwrite=trueto replace it. Permission checks apply to every read, edit and overwrite.Reuse unchanged skill instructions and resources whose full text is already in the current context. Load missing or changed references, and reload needed text removed by compaction. Apply this guidance to the shared skill prompt, card authoring, rich views, Screens and table instructions.
Render authored card layouts without extra Overview/title/catalog decoration. Use consistent anchored save popovers with keyboard focus, viewport fitting, replacement/copy choices, retries and read-only behavior. Use the shared Select for directory selection. Numeric Metric values and changes omit trailing decimal zeros while preserving authored strings.
Switching to Files changes only the Drawer, preserving the current Chat, Task, run, Screen and file preview. Per-profile session selections survive refresh and history navigation; unsaved editor buffers remain available. Drawer switches alone do not reload Screen data.
Add Copy as image for cards, excluding service controls from the clipboard PNG and reporting success or errors. Resolved inquiries show a compact answer badge and retain their details toggle.
Move weather and market quote fetching beside the bundled WeatherPanel and MarketBoard definitions, and remove their AG2 wrappers and agent tool schemas. Backend refresh uses the same data providers and stable source IDs, so existing Chat and saved file instances continue to refresh. Tests cover HTTP parsing, saved-instance updates through typed events, and the tools actually offered to the model.
Use GitHub Issues as the source of truth for tasks and specs. Local
.scratch/files only buffer work currently in progress and are deleted after merge and issue closure. Contributor and triage instructions now use GitHub publishing, fetching and labels.Offer only tools backed by the current profile's configured capabilities. Voice controls require credentials for the effective Active Live model or supported legacy provider fallback; image generation requires an image-capable Text model resolved for the current Turn and its key or ChatGPT sign-in. CLI execution requires a local ACP adapter or configured host bridge; disabled MCP servers contribute no tools. Diagnostic tools remain available. Existing chats refresh their schemas on their next Turn without network availability probes.
Resolve
list_voices,set_voice, voice sessions and voice diagnostics through the same per-profile Active override / install-wide Active Live model.set_voicepersists that model's voice for the next session; profiles sharing the model share its voice. Legacy profile voice settings remain supported when no named Live model is active.Includes the regenerated SPA bundle, chart and activity browser fixtures, file-tool regression tests, and file-tool usage documentation. The profile scheduler unit test injects fake title and summary collaborators.
Related issue number
Follow-up to #145; stacked on
feat/a2ui-calendar-heatmap.Validation
ruff check .,ruff format --check .and mypy over 160 source files passed.Full Python unit run: 2,616 passed, 2 skipped, 11 integration cases deselected on Python 3.13. Integration tests were not run.
Provider retries: 38 focused cases passed, including 30 new cases for real SDK/transport errors, HTTP status precedence, explicit causes, retry limits and cancellation. Real AG2 turns with the OpenAI Chat Completions and Responses SDKs use a mock HTTP transport to interrupt a stream after a completed tool call: both recover with the same request, produce the final answer and append the tool’s file marker exactly once. No external provider calls were made.
All 616 SPA tests passed, including the OpenAPI/zod contract gate. Strict Svelte typecheck reported zero errors and warnings; the production bundle was rebuilt.
Live Chrome: 88 activity and tool-run popover scenarios at each of 1280px and 360px widths, 52 chart fixtures and 150 existing layout fixtures passed with no console or network errors. Activity scenarios cover progress text with tools, tool-only responses, gaps between rounds, reopening during tools, interleaved aggregation across observer warnings, hover/focus/tap dismissal, complete long lists, repeated-detail counts and time ranges, clickable filenames, inline Download icons and call times in the left column, non-interactive chips without meaningful details, final replies, cancellation/failure and compaction. The actual chat was also checked for hover, keyboard dismissal and opening a file from its run list. Latest checks opened
~/Desktop/english/plan.mdthrough the current chat grant and verified directory navigation toenglish,reportsandsources, including expansion, selection and preservation of the chat. Browser fixtures also cover conversation titles, unavailable-chat fallback and navigation from the run list. Live Chrome additionally verified mouse and Enter navigation fromread chatto the named conversation, with popover dismissal and no console or local network errors.Execution details: Chrome fixtures verify single-line previews, complete multiline code, safe source rendering, grouped counts, independent expansion, contained scrolling, hover dismissal after pointer focus and collapsed reopening. The actual chat on port 8878 also passed mouse expansion, Enter collapse, down/up chevrons, hover leave after clicking the chevron, collapsed reopening, Tab focus retention and Escape dismissal, with no console or local network errors.
Progressive loading: 26 Chrome scenarios across 1280px and 360px widths passed, covering automatic loading, scroll anchoring, live arrivals during a pending page, duplicate request suppression, reconnects, retry, reaching the oldest page and discarding a response after chat navigation. In the actual long chat, initial replay decreased from 1,642 events / 10.6 MB to 713 events / 6.6 MB; three further HTTP requests restored all history with less than one pixel of anchor movement and no console or network errors.
Live chart preview additionally verified factual bound data, missing weeks, a lesson-start marker, interactive legends, the localized table and narrow-screen scrolling.
Earlier live browser validation covered persisted compaction settings and archived chat replay; Drawer/history navigation with an unsaved editor buffer; clipboard PNG output without service controls; and resolved inquiry details.
Built a wheel and verified that both Card data-provider modules and YAML definitions are included, and the former weather/finance agent tool modules are absent. Ran
graphify update ..Checks
ruff check .,ruff format --check ., andpytest -m "not integration"locally and they pass.web/, I rebuilt and committed the SPA bundle (npm --prefix web run build).AI assistance
Implemented with Codex assistance; reviewed the source diff, regression tests, regenerated bundle and live browser results.