zot/internal/tui
patriceckhart b11e6ed4e4 swarm: introduce /swarm dashboard, /btw-style transcript view, and per-session scope
A /swarm subsystem for long-running parallel subagents. Each agent runs
in its own subprocess against a fresh git worktree (branch swarm/<id>)
with its own persistent session file and unix-socket inbox; the parent
zot stays in the main session and pokes / observes them via the
dashboard.

Highlights:

- New internal/swarm package: Agent, Spawn/Resume/Kill/Remove, event log
  (events.jsonl), inbox protocol (listen/dial), worktree manager, exec
  runner that spawns "zot --swarm-agent ...".
- New internal/agent/swarm_agent.go: daemon-mode child entry point.
  Reuses the standard agent loop but persists turns to the supervisor-
  chosen session.json and streams events as JSONL on stdout. Mirror to
  events.jsonl is dormant while the supervisor's stdout pipe is alive so
  events do not get double-written.
- Resume reattaches in place: reuses the same worktree, session, branch
  and inbox path; carries forward the prior transcript replayed from
  events.jsonl. Resume no longer re-fires the original Task as a fresh
  user turn -- that was producing "agent busy; send cancel first" races.
- core.NewSessionAtPath plus an openOrCreateSession fallback so the
  child actually persists its session.json at the supervisor-chosen path
  on first spawn instead of running with sess==nil.
- Dashboard in internal/agent/modes/swarm_dialog.go + swarm_slash.go:
  list / new / kill / remove / resume / logs / send subcommands plus an
  interactive picker. Transcript view is /btw-style: an always-on
  inline editor at the bottom, streaming auto-follow, inline busy
  spinner with the agent's current activity such as "thinking" or
  "tool: edit". /model inside the spawn editor pops the global model
  picker.
- Per-session scope: each spawn is stamped with the host session's id
  and only shows in that session's /swarm dashboard. Pre-upgrade agents
  -- empty session_id -- remain visible everywhere as a safety net. The
  active scope is re-applied whenever loadSession swaps sessions.
- Resolve falls back to the provider's default model when the persisted
  cfg.Model is no longer in the catalogue, warns on stderr, and rewrites
  config.json so the next launch is silent.
- ReadEventLog folds back-to-back same-type identical-payload events
  within 250ms so events.jsonl files polluted by the old supervisor +
  mirror double-write read back cleanly.
- DrawLog gains an idle no-op fast path: identical buffer plus identical
  cursor = emit nothing, so the terminal's cursor blink keeps ticking in
  dialogs whose underlying agent is idle.

Slash UX:

- New /swarm command with subcommands; the suggester picks it up.
- README.md documents the full dashboard, CLI, and persistence story,
  and explicitly notes that /session export does NOT bundle subagents
  -- their worktree and unix-socket inbox cannot round-trip through a
  .zotsession.

Tests cover: SpawnReq + Resume lifecycle, session-id scoping + persistence,
default-child-args spawn vs resume contract, NewSessionAtPath at a fixed
path, model fallback when the configured model is gone, swarm dialog
behaviour -- auto-open editor, /model in spawn editor, transcript grows
without internal scroll, busy spinner, multi-message send -- event-log
dedup, swarm emitter dormant-until-orphan, and the DrawLog idle no-op +
change-breaks-fast-path invariants.
2026-05-16 11:53:20 +02:00
..
crlf_test.go tui: use DECSC/DECRC for bottom-band anchor; normalize \r in editor input 2026-05-05 14:35:40 +02:00
detect_bg.go tui: user bubble layout, OSC 11 theme detection, image footprint fix 2026-05-03 10:18:48 +02:00
editor.go tui: strip ANSI from prompt before wrapping so cursor lands at end 2026-05-13 11:13:20 +02:00
editor_ansi_prompt_test.go tui: strip ANSI from prompt before wrapping so cursor lands at end 2026-05-13 11:13:20 +02:00
highlight.go tui: strip syntax highlight backgrounds 2026-05-04 15:54:13 +02:00
image.go tui: disable iTerm inline images by default 2026-05-03 11:08:56 +02:00
image_test.go fix(tui): stabilize inline image scrolling 2026-04-26 11:20:25 +02:00
input.go interactive: speed up mouse scrolling in vscode 2026-05-04 10:08:11 +02:00
input_test.go interactive: speed up mouse scrolling in vscode 2026-05-04 10:08:11 +02:00
markdown.go tui: render markdown tables 2026-05-03 12:31:11 +02:00
markdown_test.go tui: render markdown tables 2026-05-03 12:31:11 +02:00
partialjson.go feat(tui): live-stream file body during write/edit tool calls 2026-04-20 08:37:14 +02:00
partialjson_test.go feat(tui): live-stream file body during write/edit tool calls 2026-04-20 08:37:14 +02:00
paste_collapse_test.go tweak(tui): two-threshold paste collapse with line-vs-char shape 2026-04-21 17:13:23 +02:00
quote_paste_test.go tui: skip path-quoting tests on windows 2026-04-27 11:14:39 +02:00
render.go swarm: introduce /swarm dashboard, /btw-style transcript view, and per-session scope 2026-05-16 11:53:20 +02:00
render_test.go swarm: introduce /swarm dashboard, /btw-style transcript view, and per-session scope 2026-05-16 11:53:20 +02:00
resize_unix.go fix ci: portable syscall.Select via x/sys/unix; gofmt pass 2026-04-18 10:55:42 +02:00
resize_windows.go initial commit 2026-04-17 20:36:38 +02:00
statusbar_test.go tui: show no-yolo status tag 2026-05-03 19:38:33 +02:00
terminal.go gofmt: realign const block in tui/terminal.go 2026-05-11 09:31:21 +02:00
theme.go tui: tune user bubble colors 2026-05-03 19:23:24 +02:00
view.go tui: separate live prose from tool boxes 2026-05-05 18:06:40 +02:00
wrap_test.go feat(tui): collapse multi-line pastes to a placeholder token 2026-04-21 08:47:36 +02:00