feat: web chat runs /refresh, /spec, /refine, /preview, /speed; TUI argument menus name their default #74
Loading…
Reference in a new issue
No description provided.
Delete branch "taha/web-commands"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Stacked on #73 (review-followups, head
8bac5367): until #73 merges, this PR also lists #73's commits; only the last two are new. WEB COMMANDS (f88445db): /refresh, /spec, /refine and /preview move from terminal-only to WebAction and run in the daemon through commands.run (internal/app/command_web.go) with the existing text/notice results. /refresh reuses models.refresh and the caller's context; /spec mirrors the TUI grammar (spec.user reads, command.execute changes); /refine keeps a bounded per-session proposal cache and applies the session filter to undo with and without an id. /preview reads a file in the session's project only: local execution endpoints only, path resolved against the session cwd and refused when its real path leaves it or lands in a credential store (secretpaths), opened O_NOFOLLOW|O_NONBLOCK with fstat identity against the checked path, regular files only, binaries refused, 64 KiB shown. commands.run refuses plugin callers. /speed is a page command toggling the usage bar's tok/s reading (browser-local). /share, /traces, /update, /nightly, /import, /quit, /exit, /back, /fullscreen stay terminal-only. Docs: docs/web-commands.md (new), docs/remote.md. TUI ARGUMENT MENUS (2ee8db7e): every argument menu lists the bare command's action first and highlighted: new verbs /remote start, /fullscreen toggle, /speed toggle, /tier panel, /acp list; existing options reused (list for /mcp and /plugins, status for /traces, /nightly, /sandbox, /autonomous, /heartbeat, /spec). Handlers accept the new verbs with exactly the bare behaviour; Enter on a fresh menu still runs the default, Tab cycles. Docs: docs/tui-completion.md. REVIEW: a security review of the web commands (endpoint bypass, check-then-open race, credential paths, plugin caller) found 4 issues, all fixed with red-before-fix tests. CHECKS: go build, go vet ./internal/... (and darwin for internal/app), gofmt, plugin API unchanged; go test for internal/commands, internal/tui2/..., internal/remoteui and the internal/app command/preview/refine/spec/refresh/web/plugin tests pass (remoteui port and tui2/term tty timing flaked once under load, pass on rerun); web svelte-check 0 errors, 439 tests, assets rebuilt. The full scripts/check.sh was not run to completion for this PR (build/vet/gofmt/plugin-API/web-stamp steps passed). BEHAVIOUR CHANGES: commands.run now refuses plugin callers; the web chat can read project files via /preview (local sessions, project only, credential stores refused).A dependency chart with two subgraphs, a fan-in node and a <br/> label came out garbled in the TUI: - `Infra -.->|x| Core` created plain nodes named Infra and Core. An edge that names a subgraph now runs from its exit node to the other's entry node, across both borders, keeping its label and dotted style. - Subgraph borders overwrote wires and labels ("│││", the label left as stray letters). Borders now join the wires they cross, gaps between subgraphs hold both borders (per nesting level) and the wire's channel, and labels are placed last on free cells, or the chart is refused. - Every wire cell set all four directions at a run's ends, so turns became T-pieces and runs started one cell past the corner ("│──", "─┼"). Runs now share corner cells and set only the directions they use, so turns are corners and merges are junctions. - <br/> became literal text; it now makes a multi-line box. - Nested subgraphs were clamped onto each other at the grid edge; the drawing shifts instead. Boxes that would overlap or enclose a non-member are refused (the caller shows the source). - A left-to-right chart wider than the terminal is drawn top-down instead of falling back to source. The goldens are regenerated: the old ones froze the same junction bugs. New tests (all red on the previous code): TestEdgeBetweenSubgraphsLinksTheBoxes, TestLineBreakInALabelMakesATallerBox, TestFanInJoinsWithJunctions, TestWideLeftToRightChartStacksTopDown; plus TestOverlappingSubgraphBoxesAreRefused. FuzzRender: 45 s, 3.4M execs, no crashers. TUI line budget raised to 49300 (measured 48804).The real dependency chart still showed only its source: APPS, a node outside all subgraphs fed from inside Core, was placed in Core's layer column under Core's nodes, so Core's box would have enclosed it and the render was refused. Each top-level subgraph, and the group of outside nodes, now gets its own cross-axis lane where their layers overlap (groups on disjoint layers share a lane and stay aligned). Also: - An edge between boxes of different heights (a <br/> box next to a one-line box) jogged out of the taller box's centre ("──┐ └▶"); it now runs straight on a row both boxes share. - A quoted dotted/pipe label (`-. "Makefile order" .->`) kept its quotes. Tests (red on the previous commit): TestRealDependencyChartRenders (the model's exact chart, at 400 and 228 columns) and TestDifferentHeightBoxesConnectStraight. One golden lost a needless jog.- On Linux a plain-text clipboard line naming an existing non-image path (a directory, a .txt) failed Ctrl+V with "not an image file". Such a path now pastes as text; a file-manager copy of a non-image keeps its clear error. - Clipboard text is read with a 1 MiB limit instead of the 50 MiB image limit, one paste has an overall deadline, and a helper that never answers reports a timeout instead of "signal: killed". - The fourth sandbox decision shape ("access recorded, not enforced") stays out of the transcript like the other three. docs/pasting-images.md: plain-text image paths attach on Linux only, and the overall bound is stated.- Text after an "Image N" pill drew one space to the right of the caret: the mirror's {#each}/{#if} markup was indented across lines, Svelte kept those newline text nodes, and under white-space: pre-wrap each painted as a space. The segments are emitted with no whitespace between them, and the token element inherits the textarea's text metrics with margin, padding and border reset. - The pill and its label overhung the token by 5px on each side and hid the neighbouring letters. Both are inset 0 now, the label is 0.85em and degrades to icon + number when the run is too narrow. - The full-screen mermaid viewer drew every node as a black box: the viewer copy's ids were rewritten but the SVG's own <style> selectors (#<id> .node rect ...) still named the old id, so no style applied. Selectors inside <style> are rewritten too, pinned by a styled sample SVG test. Web assets rebuilt.