herdr-orchestra 6.40.0 → 6.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  All notable changes. Versions follow [semantic versioning](https://semver.org).
4
4
 
5
+ ## [6.41.0] - 2026-11-28
6
+
7
+ The board (`prefix+a`, `orch board`) no longer drops keys you typed while it was busy.
8
+
9
+ Example: on a busy machine you press `↓`, `Enter`, `→` quickly while the board is still reading git. Before, all three reached it at once, were read as one unknown key, and nothing happened. Now it reads them one by one: it picks the milestone, opens its files, and moves to the next milestone.
10
+
11
+ ### Fixed
12
+ - **Keys typed while the board was busy were lost.** The board read up to 8 bytes at a time, so keys waiting together in the terminal became one string that matched no key. It now reads one key at a time: a whole escape sequence (arrows, Page Up and Page Down) or one character. This was the 1 failing check in the main CI run after 6.33.0 ("↓ picks a milestone and Enter opens its files"). That run was on a loaded machine, so the keys queued up.
13
+ - **Keys typed while the board was starting were thrown away.** This was the 1 failing check in the main CI run after 6.34.0 ("the board popup: f shows the changed files"). On a busy machine the board took over a second to start, and the test typed `f` and `Enter` in that time. Two things lost them. Turning on key-by-key mode flushed what was already typed (now `TCSANOW`). The half-second guard against terminal replies at open dropped every key, not only the replies. It now drops only what a terminal sends by itself (focus, cursor or size reports, OSC strings, a lone Esc), so `f`, Enter and the arrows count. A new check types the keys before the board has started.
14
+ - New checks type the keys in one go, and before the board has started. They fail before this fix and pass after it.
15
+
5
16
  ## [6.40.0] - 2026-11-28
6
17
 
7
18
  Tokens per milestone no longer miss a reply written in a job's last second. That also made the CI check "orch report: ... tokens per milestone" fail now and then (main CI after 6.34.0, PR #68).
package/VERSION CHANGED
@@ -1 +1 @@
1
- 6.40.0
1
+ 6.41.0
Binary file
package/bin/orch CHANGED
@@ -10023,10 +10023,34 @@ def render_diff(ch, f, lines, width=100, height=40, color=True, top=0, err=None)
10023
10023
  return head + [""] + shown + foot, top
10024
10024
 
10025
10025
 
10026
+ def _terminal_reply(key):
10027
+ """True for what a terminal sends by itself as a popup opens, never typed: focus in/out, cursor or size reports,
10028
+ device replies, OSC/DCS strings, and a lone Esc (the start of one that came in pieces)."""
10029
+ if key == "\x1b" or key[:2] in ("\x1b]", "\x1bP", "\x1b_", "\x1b^"):
10030
+ return True
10031
+ return key.startswith("\x1b[") and (key in ("\x1b[I", "\x1b[O") or key[-1:] in ("R", "t", "c", "n", "y"))
10032
+
10033
+
10026
10034
  def _board_key(fd, select):
10027
- ch = os.read(fd, 8).decode(errors="ignore")
10028
- if ch == "\x1b" and select.select([sys.stdin], [], [], 0.05)[0]:
10029
- ch += os.read(fd, 8).decode(errors="ignore") # the rest of an escape sequence, not the Esc key
10035
+ """ONE key press from the terminal. Keys typed while the board was busy (reading git on a loaded machine) wait
10036
+ together in the terminal; reading them all at once made `↓ Enter →` one unknown key, and nothing happened."""
10037
+ def more(wait=0.05):
10038
+ return select.select([fd], [], [], wait)[0]
10039
+ b = os.read(fd, 1)
10040
+ if b == b"\x1b":
10041
+ if more(): # the rest of an escape sequence, not the Esc key
10042
+ b += os.read(fd, 1)
10043
+ if b[1:] in (b"[", b"O"): # CSI / SS3: up to and including the final byte (@ to ~)
10044
+ while len(b) < 16 and more():
10045
+ b += os.read(fd, 1)
10046
+ if 0x40 <= b[-1] <= 0x7e:
10047
+ break
10048
+ elif b and b[0] >= 0xc0: # the other bytes of one UTF-8 character
10049
+ need = 3 if b[0] >= 0xf0 else 2 if b[0] >= 0xe0 else 1
10050
+ while need and more():
10051
+ b += os.read(fd, 1)
10052
+ need -= 1
10053
+ ch = b.decode(errors="ignore")
10030
10054
  return {"\x1bOA": "\x1b[A", "\x1bOB": "\x1b[B", "\x1bOC": "\x1b[C", "\x1bOD": "\x1b[D"}.get(ch, ch)
10031
10055
 
10032
10056
 
@@ -10108,7 +10132,8 @@ def cmd_board(args):
10108
10132
  mid, ch, fsel, ftop = None, None, 0, 0 # the changed-files screen: milestone, its changes, picked file, scroll
10109
10133
  dfile, dlines, derr, dtop = None, [], None, 0 # the diff screen
10110
10134
  try:
10111
- tty.setcbreak(fd)
10135
+ # TCSANOW, not the default TCSAFLUSH: that throws away every key typed while the board was starting up
10136
+ tty.setcbreak(fd, termios.TCSANOW)
10112
10137
  sys.stdout.write("\x1b[?1049h\x1b[?25l")
10113
10138
  while True:
10114
10139
  k = _view_snapshot_key()
@@ -10145,8 +10170,9 @@ def cmd_board(args):
10145
10170
  if not r:
10146
10171
  continue
10147
10172
  key = _board_key(fd, select)
10148
- if time.time() - opened < 0.5:
10149
- continue # what a terminal sends as a pane opens (focus or size replies) is not a key press
10173
+ if time.time() - opened < 0.5 and _terminal_reply(key):
10174
+ continue # what a terminal sends as a pane opens (focus or size replies) is not a key press;
10175
+ # keys typed while the board was starting (f, Enter, an arrow) still count
10150
10176
  size = shutil.get_terminal_size((100, 40))
10151
10177
  if screen == "diff":
10152
10178
  page = max(3, size.lines - 8)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "herdr-orchestra",
3
- "version": "6.40.0",
3
+ "version": "6.41.0",
4
4
  "description": "Orchestrate AI coding agents (Claude Code, Codex, OpenCode, Amp, Pi) as one team: a lead plans, coders build, a reviewer checks, you get one PR. Runs in Herdr panes, or in one Pi window with subagents.",
5
5
  "license": "MIT",
6
6
  "bin": {