Files
patterm/internal/harness/input.go
Harry Bayliss 52e06c914e
Some checks failed
release / build-linux-amd64 (push) Failing after 10m52s
Release v0.0.1
Bundles the in-flight work into the first tagged release. See
CHANGELOG.md `[0.0.1] - 2026-05-14` for the full per-change list.
Highlights:

- Sidebar / chrome stability: clamp absolute cursor positioning and
  printable bytes to the viewport so long-running TUIs (claude, codex)
  can't spray into the right rail; bound tab bar's row clear to the
  viewport width so the rail isn't wiped on every tab redraw; flag
  scroll escapes (RI/IND/NEL/SU/SD/IL/DL) and clamp `CSI 0/1/2 J`/`K`
  to viewport columns.
- Palette: "Spawn process…" form, macros (`sw `, `k `, `sp `), kill
  entries mark the focused tab, dead agents drop out of the switch
  list.
- Sidebar: split into Processes (session-wide) + Agent Tree
  (per-active-agent) sections; relaunch indicator; Ctrl+W/S walks the
  combined list, Ctrl+A/D steps tabs.
- MCP: protocol handshake (`initialize`, `tools/list`, `tools/call`,
  `ping`), `mcp_injection.kind = cli_override / config_env` so codex
  and opencode pick up the server with no file writes, `lifecycle`
  help topic and tool-description cleanup-duty pointers.
- Lifecycle: orchestrator-spawned children cascade-killed when the
  parent dies; orchestrator-injected prompts end with CR + delayed
  Enter so claude submits cleanly.
2026-05-14 22:04:32 +01:00

40 lines
831 B
Go

package harness
import "fmt"
func EncodeChord(name string) ([]byte, error) {
switch name {
case "ctrl-k":
return []byte{0x0b}, nil
case "ctrl-k-kitty":
return []byte("\x1b[107;5u"), nil
case "ctrl-k-xterm":
return []byte("\x1b[27;5;107~"), nil
case "enter":
return []byte{'\r'}, nil
case "escape":
return []byte{0x1b}, nil
case "backspace":
return []byte{0x7f}, nil
case "up":
return []byte("\x1b[A"), nil
case "down":
return []byte("\x1b[B"), nil
case "left":
return []byte("\x1b[D"), nil
case "right":
return []byte("\x1b[C"), nil
case "ctrl-n":
return []byte{0x0e}, nil
case "ctrl-p":
return []byte{0x10}, nil
case "ctrl-u":
return []byte{0x15}, nil
case "tab":
return []byte{'\t'}, nil
case "space":
return []byte{' '}, nil
}
return nil, fmt.Errorf("unknown chord %q", name)
}