···11+{ inputs, ... }:
22+{
33+ perSystem =
44+ { pkgs, system, ... }:
55+ {
66+ # Start an omp agent in a new herdr tab from one command:
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.
1313+ packages.herd =
1414+ (pkgs.writeShellApplication {
1515+ name = "herd";
1616+ runtimeInputs = [
1717+ inputs.llm-agents.packages.${system}.herdr
1818+ pkgs.jq
1919+ ];
2020+ text = ''
2121+ workspace=''${HERDR_WORKSPACE_ID:-$(herdr workspace list | jq -r '.result.workspaces[] | select(.focused) | .workspace_id')}
2222+ label=$(printf '%s' "''${1:-omp}" | cut -c1-32)
2323+ if [ -n "$workspace" ]; then
2424+ created=$(herdr tab create --workspace "$workspace" --cwd "$PWD" --label "$label" --no-focus)
2525+ else
2626+ created=$(herdr workspace create --cwd "$PWD" --label "$(basename "$PWD")" --no-focus)
2727+ fi
2828+ pane=$(printf '%s' "$created" | jq -er .result.root_pane.pane_id)
2929+ herdr pane run "$pane" "s llm.omp$(printf ' %q' "$@")" >/dev/null
3030+ echo "$pane"
3131+ '';
3232+ }).overrideAttrs
3333+ { passthru.usage = builtins.readFile ./usage.kdl; };
3434+ };
3535+}
···11+bin "herd"
22+about "Start an omp agent in a new herdr tab (current workspace, current directory) and print its pane id"
33+44+arg "[prompt]" help="First message for omp"
55+arg "[omp-args...]" help="Arguments passed through to omp, e.g. --model opus"