···77 # s herd 'fix issue #13' --model opus
88 # Everything is passed through to omp, so any omp flag works. The tab
99 # lands in the focused workspace (one is created from $PWD if there is
1010- # none) and is not focused, so the caller's pane stays put. herdr picks
1111- # the agent up by itself; name it with `herdr agent rename <pane> <name>`
1212- # if you want to address it by name afterwards.
1010+ # none). By default it is not focused, so the caller's pane stays put;
1111+ # `-f`/`--focus` (before the prompt) switches to the new pane instead.
1212+ # herdr picks the agent up by itself; name it with
1313+ # `herdr agent rename <pane> <name>` if you want to address it by name
1414+ # afterwards.
1315 packages.herd =
1416 (pkgs.writeShellApplication {
1517 name = "herd";
···1820 pkgs.jq
1921 ];
2022 text = ''
2121- workspace=''${HERDR_WORKSPACE_ID:-$(herdr workspace list | jq -r '.result.workspaces[] | select(.focused) | .workspace_id')}
2323+ focus=--no-focus
2424+ case "''${1:-}" in
2525+ -f|--focus)
2626+ focus=--focus
2727+ shift
2828+ ;;
2929+ esac
3030+ # Not $HERDR_WORKSPACE_ID: that is the launch-time value and goes
3131+ # stale once the pane is moved to another workspace (herdr keeps
3232+ # the old pane id as an alias, so `pane current` still resolves).
3333+ workspace=$(herdr pane current 2>/dev/null | jq -r '.result.pane.workspace_id // empty')
3434+ [ -n "$workspace" ] || workspace=$(herdr workspace list | jq -r '.result.workspaces[] | select(.focused) | .workspace_id')
2235 label=$(printf '%s' "''${1:-omp}" | cut -c1-32)
2336 if [ -n "$workspace" ]; then
2424- created=$(herdr tab create --workspace "$workspace" --cwd "$PWD" --label "$label" --no-focus)
3737+ created=$(herdr tab create --workspace "$workspace" --cwd "$PWD" --label "$label" "$focus")
2538 else
2626- created=$(herdr workspace create --cwd "$PWD" --label "$(basename "$PWD")" --no-focus)
3939+ created=$(herdr workspace create --cwd "$PWD" --label "$(basename "$PWD")" "$focus")
2740 fi
2841 pane=$(printf '%s' "$created" | jq -er .result.root_pane.pane_id)
2942 herdr pane run "$pane" "s llm.omp$(printf ' %q' "$@")" >/dev/null
···11bin "herd"
22about "Start an omp agent in a new herdr tab (current workspace, current directory) and print its pane id"
3344+flag "-f --focus" help="Switch to the new pane instead of staying in the current one (must come before the prompt)"
55+46arg "[prompt]" help="First message for omp"
57arg "[omp-args...]" help="Arguments passed through to omp, e.g. --model opus"