Skip to content

HERD-37 Start and close sessions on herdr-core-only machines - #123

Merged
makefunstuff merged 7 commits into
mainfrom
task/37-start-and-close-sessions-on-herdr-core-only-mach
Nov 8, 2026
Merged

makefunstuff merged 7 commits into
mainfrom
task/37-start-and-close-sessions-on-herdr-core-only-mach

Conversation

@makefunstuff

Copy link
Copy Markdown
Owner

Fixes #99

On a machine that runs only the Herdr desktop app (herdr-core, no classic herdr, no Shepherdr), the phone can now start and close sessions, not just watch them. Everything goes through herdr-core's own API on the app's existing hc connect channel (terminal.run, terminal.kill, the same calls as hc run --bg / hc kill).

What changes

  • New › Terminal in a herdr-core space's ⋯: a shell in the space's folder (terminal.run, no parent, TERM/COLORTERM set). It is labelled into the space as a tab of its own (herdr.space, a new herdr.tab, where), the way the desktop app labels its own terminals, so the desktop and the phone both show it there.
  • Start work › Agent now offers a herdr-core-only machine. The agent runs through the login shell in the folder (as argv on a Windows/Git Bash machine, where hc runs lines with cmd.exe), in the desktop space that sits in that folder, else under Other terminals. Its chat opens at once with the sentence held above the box. The sentence is sent only once the agent reports idle/done and only while it is still held, claimed atomically so Send now can't send it as well. Nothing is typed blind into an agent that asks something first (e.g. "trust this folder?") or reports nothing: the sentence stays held and a toast says why.
  • Close terminal (asks first, like the classic Close pane): in a herdr-core agent's ⋯, a herdr-core terminal's ⋯, and on a long press on the machine screen. It goes through terminal.kill, and the chat/terminal goes back afterwards.
  • Unchanged: classic herdr's new tab and close, and Shepherdr's spaces (one rule: no herdr-core Close in a space holding its Assistant or a task's worker). HcDetection is untouched.
  • Docs: docs/HERDR_CORE.md (new Starting and closing), README Start work and Managing from the phone.

Checks

  • ./gradlew -p core test and ./gradlew :app:testDebugUnitTest pass. New HcStartTest (16 tests) covers: placing a terminal in a space, other sessions, remote machines and Other terminals; spaceIn covering only the default session; run params (labels, env, no parent, argv on Windows); the name_taken retry; and deliver waiting for ready, never typing on blocked/error/silent agents, words taken over by the person, and a refused send.
  • Live check on a herdr-core 0.1.18 machine: the login-shell line leaves the program itself in the foreground. The probe terminal was killed and removed.
  • Preview scenes added: chat-tab-menu-desktop-only, start-desktop-only, chat-desktop-started, chat-desktop-more, chat-desktop-close, terminal-desktop-menu, machine-desktop-only-close, all looked at in both themes.
  • Six review rounds. The last one (on the commit before merging main) had nothing to fix. After it, merging main (Windows over herdr-core) needed one small change: argv instead of the POSIX line on Windows, with a test.

Shots

Dark theme. The light ones are on the shots/herd-37 branch (not for merge).

Before (mac-mini, herdr-core only): no New › Terminal, mac-mini not offered for Agent now, no Close.

After:

🤖 Generated with Claude Code

makefunstuff and others added 7 commits November 8, 2026 17:47
On a machine that runs only the Herdr desktop app (herdr-core), the phone can now
start and close terminals there, through herdr-core's own API on the app's SSH
connection:

- A space's ⋯ › New › Terminal runs a shell with terminal.run (hc run --bg) in the
  space's folder, labelled into the space as a tab of its own (herdr.space, a new
  herdr.tab, where), so the desktop app and the phone both show it there.
- Start work › Agent now offers a herdr-core-only machine: the agent's program runs
  through the login shell in the folder, in the space that sits there, and the
  sentence goes in once it reports a status.
- Close terminal in a herdr-core agent's ⋯, and a long press on a herdr-core
  terminal on the machine screen, end it with terminal.kill, asked first.

Classic herdr and Shepherdr keep their own new tab and close. Tests in HcStartTest;
preview scenes for the menu, Start work, the sheet, and both confirmations.

Fixes #99

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- An agent started on herdr-core gets its first message only once it reports
  idle or done; one that asks first or says nothing gets no Enter, and a toast
  says the words didn't go in.
- Agent now picks only the desktop app's own (default) session's spaces.
- terminal.run passes TERM and COLORTERM.
- Close runs on the app's scope, and the chat goes back once closed.
- Shepherdr's spaces on the machine screen offer no long press.
- A where:-only space's new terminal gets a tab of its own.
- installedOn asks herdr's integrations and the probe at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A herdr-core terminal's own ⋯ has Close terminal, so the shell New › Terminal
  opens can be closed where it opens (scene terminal-desktop-menu).
- After a close, the chat or terminal goes back only while it is still on top.
- An agent that reports an error says so, not "it asks something first".
- HERDR_CORE.md: the killed terminal's finished record is left to hc.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Agent now on herdr-core opens the chat as soon as the agent runs; its first
  message goes in on the app's scope once it says it waits, else it waits in
  the chat's box (and a toast says why). HcStart.launch / deliver.
- One rule for Close terminal on the agent's ⋯, the terminal's ⋯ and the
  machine screen: not in a space of Shepherdr's.
- Close's toast holds no Activity; the POSIX-only line is noted for Windows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Agent now on herdr-core holds the sentence above the chat's box at once (the
  held-message list: Send now or discard by hand). deliver sends it only while
  it is still held, then drops it, so nothing goes twice; one that can't go in
  stays held. Scene chat-desktop-started.
- The start is recorded as soon as the agent runs.
- HcStart keeps launch and deliver only; tests go to them directly.
- The agent sheet collects the session state for its Shepherdr rule.
- Review shots leave the branch (they go with the PR).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- ComposerStore.take claims a held row at once; Send now and Start work's first
  message on herdr-core both send only what they claimed, and a failed send
  puts it back. deliver takes a claim; a test covers words claimed elsewhere.
- HeldMessage's KDoc names the one held sentence that goes by itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main brought Windows machines over herdr-core (Git Bash). hc runs a `line` with
cmd.exe there, so Start work asks `uname -s` once and, on Windows, starts the
agent as argv instead of the POSIX login-shell line. Test in HcStartTest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@makefunstuff
makefunstuff merged commit f1e9b5e into main Nov 8, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Start and close sessions on herdr-core-only machines

1 participant