Land staged session/MCP/chrome work + sidebar clear-J fix
This batches the in-flight [Unreleased] block from CHANGELOG.md into a single commit. Highlights: - Real MCP protocol layer (initialize / tools/list / tools/call) so vendor MCP clients can complete the handshake against the per-PID socket. Legacy direct-dispatch preserved for the harness. - New mcp_injection kinds — cli_override for codex, config_env for opencode — joining the existing env-var and config_file paths so patterm can slot into more agents without touching their real config or auth. - Ctrl+A/D and Ctrl+W/S focus navigation across tabs and intra-tab process lists, recognised in legacy / kitty CSI u / xterm modifyOtherKeys encodings. - Palette macros (sw / k / sp ) and reordering so open sessions surface above spawn-new entries. - Two-row tab bar, sidebar/tabbar/status chrome cache, viewport-wipe on agent spawn, CR-terminated orchestrator injections, and split- Enter PTY writes so paste-detecting TUIs see Enter as a key event. Also fixes the bug logged in TODO: claude's Ctrl+O tool-call expansion emits CSI 0 J, which the viewport renderer was forwarding verbatim — wiping the sidebar to the right of the cursor and leaving the chrome cache convinced nothing had changed. CSI 0 J and CSI 1 J are now translated into per-row ECH sequences clamped to the viewport, same as CSI 2 J and CSI K already were. Agent guides (CLAUDE.md / AGENTS.md) now spell out the TODO->CHANGELOG workflow so completed items land in the changelog rather than as ticked entries left behind in TODO.
This commit is contained in:
@@ -39,3 +39,61 @@ func childIDs(cs []*Child) []string {
|
||||
}
|
||||
return ids
|
||||
}
|
||||
|
||||
func TestNextTabIDWrapsAndSkipsCurrent(t *testing.T) {
|
||||
r1 := testChild("c1", "root1", "", StatusRunning)
|
||||
r2 := testChild("c2", "root2", "", StatusRunning)
|
||||
r3 := testChild("c3", "root3", "", StatusRunning)
|
||||
children := []*Child{r1, r2, r3}
|
||||
|
||||
if got := nextTabID(children, "c1", +1); got != "c2" {
|
||||
t.Fatalf("next from c1: %q", got)
|
||||
}
|
||||
if got := nextTabID(children, "c1", -1); got != "c3" {
|
||||
t.Fatalf("prev from c1: %q", got)
|
||||
}
|
||||
if got := nextTabID(children, "c3", +1); got != "c1" {
|
||||
t.Fatalf("wrap forward from c3: %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNextTabIDFromSubAgentJumpsByRoot(t *testing.T) {
|
||||
r1 := testChild("c1", "root1", "", StatusRunning)
|
||||
r1Child := testChild("c2", "child1", "c1", StatusRunning)
|
||||
r2 := testChild("c3", "root2", "", StatusRunning)
|
||||
children := []*Child{r1, r1Child, r2}
|
||||
|
||||
// Focus is on a sub-agent of root1; Ctrl+D should jump to root2,
|
||||
// not stay inside root1's sub-tree.
|
||||
if got := nextTabID(children, "c2", +1); got != "c3" {
|
||||
t.Fatalf("next from sub-agent: %q want c3", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNextChildIDCyclesWithinTab(t *testing.T) {
|
||||
r1 := testChild("c1", "root1", "", StatusRunning)
|
||||
a := testChild("c2", "a", "c1", StatusRunning)
|
||||
b := testChild("c3", "b", "c1", StatusRunning)
|
||||
other := testChild("c4", "other-root", "", StatusRunning)
|
||||
children := []*Child{r1, a, b, other}
|
||||
|
||||
if got := nextChildID(children, "c1", +1); got != "c2" {
|
||||
t.Fatalf("root->first child: %q", got)
|
||||
}
|
||||
if got := nextChildID(children, "c2", +1); got != "c3" {
|
||||
t.Fatalf("a->b: %q", got)
|
||||
}
|
||||
if got := nextChildID(children, "c3", +1); got != "c1" {
|
||||
t.Fatalf("wrap b->root: %q", got)
|
||||
}
|
||||
if got := nextChildID(children, "c1", -1); got != "c3" {
|
||||
t.Fatalf("wrap backward root->b: %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNextChildIDNoopWhenOnlyOneProcess(t *testing.T) {
|
||||
r := testChild("c1", "solo", "", StatusRunning)
|
||||
if got := nextChildID([]*Child{r}, "c1", +1); got != "" {
|
||||
t.Fatalf("expected empty when only one process in tab, got %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user