This repository has no description
1.5 kB
35 lines
1{ inputs, ... }:
2{
3 perSystem =
4 { pkgs, system, ... }:
5 {
6 # Start an omp agent in a new herdr tab from one command:
7 # s herd 'fix issue #13' --model opus
8 # Everything is passed through to omp, so any omp flag works. The tab
9 # lands in the focused workspace (one is created from $PWD if there is
10 # none) and is not focused, so the caller's pane stays put. herdr picks
11 # the agent up by itself; name it with `herdr agent rename <pane> <name>`
12 # if you want to address it by name afterwards.
13 packages.herd =
14 (pkgs.writeShellApplication {
15 name = "herd";
16 runtimeInputs = [
17 inputs.llm-agents.packages.${system}.herdr
18 pkgs.jq
19 ];
20 text = ''
21 workspace=''${HERDR_WORKSPACE_ID:-$(herdr workspace list | jq -r '.result.workspaces[] | select(.focused) | .workspace_id')}
22 label=$(printf '%s' "''${1:-omp}" | cut -c1-32)
23 if [ -n "$workspace" ]; then
24 created=$(herdr tab create --workspace "$workspace" --cwd "$PWD" --label "$label" --no-focus)
25 else
26 created=$(herdr workspace create --cwd "$PWD" --label "$(basename "$PWD")" --no-focus)
27 fi
28 pane=$(printf '%s' "$created" | jq -er .result.root_pane.pane_id)
29 herdr pane run "$pane" "s llm.omp$(printf ' %q' "$@")" >/dev/null
30 echo "$pane"
31 '';
32 }).overrideAttrs
33 { passthru.usage = builtins.readFile ./usage.kdl; };
34 };
35}