@johngaynor/ocnus 2.0.1-next.80 → 2.0.1-next.89

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.
@@ -0,0 +1,301 @@
1
+ # The picture install and status show while they work, in a terminal that
2
+ # can show all of it: the banner at the top, moving, a bar under it that
3
+ # fills as each of the command's steps finishes, and under the bar one line
4
+ # that says what is happening now. Sourced by cli/ocnus.
5
+ #
6
+ # The command calls progress_begin once, saying how many steps it has,
7
+ # progress_next as each step starts, and progress_end once the last one has
8
+ # finished. The picture shows only where stdout is a terminal of at least 79
9
+ # columns and 25 rows, the banner's 23 with the bar and the line, whose TERM
10
+ # is not dumb, and where NO_COLOR is not set. Anywhere else, progress_begin
11
+ # gives install the banner (banner.sh) and status nothing, the other calls do
12
+ # nothing, and both commands print what they always have.
13
+ #
14
+ # One process draws all of it, the frames, the bar and the line, so that no
15
+ # second writer can cut into a frame: progress_draw, in the background, with
16
+ # the terminal as its stdout. The command goes on in the main shell, as it
17
+ # does without the picture, so that set -e, die and Ctrl-C act on it as they
18
+ # always have. What it prints is held back meanwhile: its stdout, and its
19
+ # stderr when that is the terminal, go to a file in the picture's folder,
20
+ # which mktemp makes in TMPDIR. As each step starts, the command writes how
21
+ # many steps have finished and the step's line to another file there, which
22
+ # the drawing process reads before each frame. bash has what it starts in the
23
+ # background ignore Ctrl-C, so the drawing process is never ended by a
24
+ # signal: the command tells it, through that file, to end or to stop, and
25
+ # waits for it before it prints anything itself.
26
+ #
27
+ # At the end the bar is full, the line's row is empty, and the command
28
+ # prints from that row: status all it held back, then its closing lines,
29
+ # and install only its notes, the lines `note` prints, then its "Done"
30
+ # line. On an error, or Ctrl-C, the picture stops where it is, the bar and
31
+ # the line showing the step that was running, and all that was held back is
32
+ # printed below it, the error with it.
33
+
34
+ # The rows the picture takes: the banner's 23, the bar, on the row where the
35
+ # cursor waits under the banner, and the line under the bar.
36
+ PROGRESS_ROWS=$((BANNER_ROWS + 1))
37
+
38
+ # The colours of the bar: the share of the steps that have finished in the
39
+ # rope's, and the rest in the drawing's grey.
40
+ PROGRESS_DONE='38;5;179' PROGRESS_LEFT='38;5;243'
41
+
42
+ # While the picture shows: its folder, the drawing process, the command
43
+ # (install or status), how many steps it has and how many have started, and
44
+ # what the bar and the line should show now: how many steps have finished,
45
+ # a space, and the line. PROGRESS_STOPPED is 1 once the picture was told to
46
+ # stop. Once progress_finish is putting the picture away, PROGRESS_ENDING is
47
+ # 1, and a signal that comes then is kept in PROGRESS_GOT, for it to end
48
+ # ocnus as that signal would once it is done.
49
+ PROGRESS_DIR='' PROGRESS_PID='' PROGRESS_WHAT='' PROGRESS_STEPS=0 PROGRESS_AT=0
50
+ PROGRESS_SHOWS='' PROGRESS_STOPPED='' PROGRESS_ENDING='' PROGRESS_GOT=''
51
+
52
+ # Whether stdout is a terminal that can show the whole picture.
53
+ progress_fits() {
54
+ [ -z "${NO_COLOR:-}" ] && [ "${TERM:-}" != dumb ] || return 1
55
+ banner_size || return 1
56
+ [ "$TTY_COLS" -ge "$BANNER_COLS" ] && [ "$TTY_ROWS" -ge "$PROGRESS_ROWS" ]
57
+ }
58
+
59
+ # Show the picture, for a command with this many steps, or where it cannot
60
+ # show, give install the banner and status nothing. As with the banner,
61
+ # nothing here can stop or fail the command: where the folder cannot be
62
+ # made, it is as if the terminal could not show the picture.
63
+ #
64
+ # The folder is made in TMPDIR, or /tmp where that is not set, from a
65
+ # template that names it: given no template, macOS's mktemp makes it in a
66
+ # folder of its own choosing whatever TMPDIR says, and Linux's in TMPDIR.
67
+ #
68
+ # The drawing process starts with the terminal as its stdout, and the
69
+ # terminal is then kept on 8 and 9, as bash 3.2 has no {fd}> to pick free
70
+ # ones, for progress_finish to give stdout and stderr back. The traps are set,
71
+ # and cleared, as task_start sets its own (task.sh): EXIT for an error, such
72
+ # as die or a command that fails under set -e, and INT and TERM for Ctrl-C and
73
+ # a kill.
74
+ # progress_begin <install|status> <steps>
75
+ progress_begin() {
76
+ local what=$1 steps=$2 dir tmp=${TMPDIR:-/tmp}
77
+ [ -z "$PROGRESS_DIR" ] || return 0
78
+ [ "$steps" -ge 1 ] 2>/dev/null || steps=1
79
+ if ! progress_fits || ! dir=$(mktemp -d "${tmp%/}/ocnus-progress.XXXXXX" 2>/dev/null) || [ ! -d "$dir" ]; then
80
+ [ "$what" != install ] || banner
81
+ return 0
82
+ fi
83
+ if ! { printf '0 \n' > "$dir/state"; } 2>/dev/null; then
84
+ rm -rf "$dir" 2>/dev/null || true
85
+ [ "$what" != install ] || banner
86
+ return 0
87
+ fi
88
+ PROGRESS_DIR=$dir PROGRESS_WHAT=$what PROGRESS_STEPS=$steps PROGRESS_AT=0
89
+ PROGRESS_SHOWS='0 ' PROGRESS_STOPPED='' PROGRESS_ENDING='' PROGRESS_GOT=''
90
+ progress_draw "$dir" "$what" "$steps" 2>/dev/null &
91
+ PROGRESS_PID=$!
92
+ exec 8>&1 9>&2
93
+ exec > "$dir/out"
94
+ [ ! -t 9 ] || exec 2>&1
95
+ trap progress_stop EXIT
96
+ trap 'progress_signal INT' INT
97
+ trap 'progress_signal TERM' TERM
98
+ }
99
+
100
+ # The step before has finished, and this one starts: the bar takes in the
101
+ # one that finished, and the line becomes this one's. A line has no path in
102
+ # it, so that none can be too long for the row.
103
+ # progress_next <line>
104
+ progress_next() {
105
+ [ -n "$PROGRESS_DIR" ] || return 0
106
+ PROGRESS_AT=$((PROGRESS_AT + 1))
107
+ PROGRESS_SHOWS="$((PROGRESS_AT - 1)) $1"
108
+ progress_say "$PROGRESS_SHOWS"
109
+ }
110
+
111
+ # The last step has finished: the bar fills, the line empties, the banner
112
+ # comes to rest, and what was held back is printed below the picture.
113
+ progress_end() {
114
+ [ -n "$PROGRESS_DIR" ] || return 0
115
+ PROGRESS_SHOWS="$PROGRESS_STEPS "
116
+ progress_say end
117
+ progress_finish
118
+ }
119
+
120
+ # Write what the drawing process reads before each frame, one line in its
121
+ # own file: how many steps have finished and the line of the one running;
122
+ # end once the last one has finished; or stop, with what the bar and the line
123
+ # show then, so that a step that fails before the drawing process has drawn
124
+ # it is still the one the picture stops on. Only the command writes it. It
125
+ # is written in one go, and a line caught half written has no newline yet,
126
+ # which the drawing process reads as nothing new.
127
+ # progress_say <what>
128
+ progress_say() {
129
+ { printf '%s\n' "$1" > "$PROGRESS_DIR/state"; } 2>/dev/null || true
130
+ }
131
+
132
+ # The EXIT trap: the command is ending with an error, before progress_end.
133
+ # Nothing in a trap on EXIT may fail under set -e, or ocnus would exit with
134
+ # that failure's status rather than with the error's own.
135
+ progress_stop() {
136
+ set +e
137
+ [ -n "$PROGRESS_DIR" ] || return 0
138
+ PROGRESS_STOPPED=1
139
+ progress_say "stop $PROGRESS_SHOWS"
140
+ progress_finish
141
+ }
142
+
143
+ # The INT and TERM traps: stop the picture where it is, print what was held
144
+ # back, then end as that signal would have ended ocnus, as banner_play does,
145
+ # so that whatever ran ocnus sees it end the same way. A signal that comes
146
+ # while the picture is being put away already only stops the drawing, and
147
+ # progress_finish ends ocnus with it once it is done.
148
+ # progress_signal <INT|TERM>
149
+ progress_signal() {
150
+ PROGRESS_GOT=$1
151
+ [ -n "$PROGRESS_DIR" ] || { trap - "$1"; kill -"$1" $$; }
152
+ PROGRESS_STOPPED=1
153
+ progress_say "stop $PROGRESS_SHOWS"
154
+ [ -n "$PROGRESS_ENDING" ] || progress_finish
155
+ }
156
+
157
+ # Put the picture away: wait for the drawing process to end or stop, give
158
+ # stdout and stderr back to the terminal, show the cursor, whatever became of
159
+ # the drawing process, and print what was held back. That is all of it for
160
+ # status, and after a stop; for install it is only the notes. Then remove the
161
+ # folder and clear the traps. A signal cuts a wait short, so it waits again
162
+ # until the drawing process is gone. What was held back is printed by the
163
+ # shell itself, with no program that Ctrl-C could stop half way.
164
+ progress_finish() {
165
+ local dir=$PROGRESS_DIR pid=$PROGRESS_PID held line=''
166
+ PROGRESS_ENDING=1
167
+ while kill -0 "$pid" 2>/dev/null; do wait "$pid" 2>/dev/null || true; done
168
+ { exec 1>&8 2>&9; } 2>/dev/null || true
169
+ printf '\033[?25h' 2>/dev/null || true
170
+ held=$dir/out
171
+ [ -n "$PROGRESS_STOPPED" ] || [ "$PROGRESS_WHAT" != install ] || held=$dir/notes
172
+ if [ -f "$held" ]; then
173
+ { while IFS= read -r line; do printf '%s\n' "$line"; done
174
+ [ -z "$line" ] || printf '%s' "$line"; } < "$held" 2>/dev/null || true
175
+ fi
176
+ rm -rf "$dir" 2>/dev/null || true
177
+ { exec 8>&- 9>&-; } 2>/dev/null || true
178
+ PROGRESS_DIR='' PROGRESS_PID='' PROGRESS_STOPPED='' PROGRESS_ENDING=''
179
+ trap - EXIT INT TERM
180
+ [ -z "$PROGRESS_GOT" ] || kill -"$PROGRESS_GOT" $$
181
+ }
182
+
183
+ # Print a line the way say does, and while the picture shows, keep it for
184
+ # after the picture too: install prints its notes there, the lines that say
185
+ # something was skipped, is waiting, could not be done or is left for the
186
+ # human to do. Without the picture it is say.
187
+ # note <line>
188
+ note() {
189
+ say "$@"
190
+ [ -z "$PROGRESS_DIR" ] || { printf '%s\n' "$*" >> "$PROGRESS_DIR/notes"; } 2>/dev/null || true
191
+ }
192
+
193
+ # --- the drawing process ----------------------------------------------------
194
+
195
+ # Draw the bar on the cursor's row, which is the bar's, and go back to the
196
+ # start of the row: 79 ━, the finished share in the rope's colour and the
197
+ # rest in the drawing's grey. A share is a whole number of steps. The braces
198
+ # matter: bash 3.2 reads the first byte of ━ after a bare $name as part of
199
+ # the name.
200
+ # progress_bar <finished> <steps>
201
+ progress_bar() {
202
+ local fill i=0 got='' left='' n=$1
203
+ case $n in '' | *[!0-9]*) n=0 ;; esac
204
+ [ "$n" -le "$2" ] || n=$2
205
+ fill=$((BANNER_COLS * n / $2))
206
+ while [ "$i" -lt "$BANNER_COLS" ]; do
207
+ if [ "$i" -lt "$fill" ]; then got="${got}━"; else left="${left}━"; fi
208
+ i=$((i + 1))
209
+ done
210
+ [ -z "$got" ] || printf '\033[%sm%s' "$PROGRESS_DONE" "$got"
211
+ [ -z "$left" ] || printf '\033[%sm%s' "$PROGRESS_LEFT" "$left"
212
+ printf '\033[0m\r'
213
+ }
214
+
215
+ # Write the line under the bar, in place of what was there, from the bar's
216
+ # row, and go back to the start of the bar's row.
217
+ # progress_line <line>
218
+ progress_line() { printf '\033[1B\033[2K%s\r\033[1A' "$1"; }
219
+
220
+ # Draw the still banner again over a moving one, from the bar's row: go up
221
+ # to its first row, then print each line after clearing its row. The cursor
222
+ # ends back on the bar's row.
223
+ progress_redraw() {
224
+ local line
225
+ printf '\033[%sA' "$((BANNER_ROWS - 1))"
226
+ while IFS= read -r line; do printf '\033[2K%b\n' "$line"; done < <(banner_art)
227
+ }
228
+
229
+ # The drawing process, in the background, with the terminal as its stdout
230
+ # and nothing on its stderr. It hides the cursor and prints the still
231
+ # banner, then makes the line's row below the bar's, clears it, and draws the
232
+ # empty bar. The cursor then waits at the start of the bar's row, where each
233
+ # frame starts and ends. Then, before each frame, it reads what the command
234
+ # wrote, and draws the bar and the line again when what they should show has
235
+ # changed: the bar first, then the line.
236
+ #
237
+ # The banner moves as banner_frames has it move, and after their 28th frame
238
+ # goes on with banner_loop's, then round from banner_frames' second, for as
239
+ # long as the command works. Once the command says the end, it draws the bar
240
+ # full and the line empty. Then status has the still banner drawn again at
241
+ # once, within a frame's 0.11 seconds, with no frame after the full bar.
242
+ # install plays on to banner_frames' closing frame, which leaves the still
243
+ # banner, so that its banner moves for about three seconds, as it does
244
+ # without the picture, or, once the play is over, has the still banner drawn
245
+ # again. Either way the cursor then goes down to the line's row, where the
246
+ # command prints.
247
+ #
248
+ # Told to stop, or once the command's process is gone, it stops after the
249
+ # frame it is on, with the bar and the line of the step that was running,
250
+ # puts the colour back, and goes down below the line. It shows the cursor
251
+ # itself only when the command is gone, which would have shown it. INT is
252
+ # ignored in what bash starts in the background, and TERM is ignored here,
253
+ # so that a kill of the whole process group stops it only through the
254
+ # command.
255
+ # progress_draw <folder> <install|status> <steps>
256
+ progress_draw() {
257
+ local dir=$1 what=$2 steps=$3 frames=() closing line play state want shown='0 ' ending='' stopping=''
258
+ local i=0 played=0
259
+ set +eu
260
+ trap '' TERM
261
+ printf '\033[?25l'
262
+ banner_still 1
263
+ printf '\n\033[2K\033[1A'
264
+ progress_bar 0 "$steps"
265
+ while IFS= read -r line; do frames[${#frames[@]}]=$line; done < <(banner_frames)
266
+ play=$((${#frames[@]} - 1))
267
+ closing=${frames[$play]}
268
+ unset "frames[$play]"
269
+ while IFS= read -r line; do frames[${#frames[@]}]=$line; done < <(banner_loop)
270
+ while :; do
271
+ want=$shown
272
+ if IFS= read -r state < "$dir/state"; then
273
+ case $state in
274
+ end) ending=1 want="$steps " ;;
275
+ stop\ *) stopping=1 want=${state#stop } ;;
276
+ *) want=$state ;;
277
+ esac
278
+ fi
279
+ kill -0 $$ 2>/dev/null || stopping=1
280
+ if [ "$want" != "$shown" ]; then
281
+ shown=$want
282
+ progress_bar "${want%% *}" "$steps"
283
+ progress_line "${want#* }"
284
+ fi
285
+ [ -z "$stopping" ] || break
286
+ if [ -n "$ending" ] && { [ "$what" != install ] || [ "$played" -ge "$play" ]; }; then
287
+ if [ "$what" = install ] && [ "$played" = "$play" ]; then printf '%b' "${closing#* }"
288
+ else progress_redraw
289
+ fi
290
+ printf '\n'
291
+ return 0
292
+ fi
293
+ line=${frames[$i]}
294
+ printf '%b' "${line#* }"
295
+ sleep "${line%% *}"
296
+ played=$((played + 1)) i=$((i + 1))
297
+ [ "$i" -lt "${#frames[@]}" ] || i=1
298
+ done
299
+ printf '\033[0m\n\n'
300
+ kill -0 $$ 2>/dev/null || printf '\033[?25h'
301
+ }
@@ -276,7 +276,7 @@ settings_init() {
276
276
  say " made $SETTINGS (every profile on $DEFAULT_MODEL at $DEFAULT_EFFORT effort)"
277
277
  else
278
278
  rm -f "$tmp"
279
- say " note could not make $SETTINGS, so every profile runs on $DEFAULT_MODEL at $DEFAULT_EFFORT effort"
279
+ note " note could not make $SETTINGS, so every profile runs on $DEFAULT_MODEL at $DEFAULT_EFFORT effort"
280
280
  fi
281
281
  }
282
282
 
@@ -437,7 +437,7 @@ write_review_profiles() {
437
437
  is_clone || return 0
438
438
  [ -d "$REVIEW_SOURCES" ] || [ -d "$AGENTS_HOME" ] || return 0
439
439
  if ! settings_load; then
440
- say " skipped the review subagents: $SETTINGS_WHY"
440
+ note " skipped the review subagents: $SETTINGS_WHY"
441
441
  return 0
442
442
  fi
443
443
  for src in "$REVIEW_SOURCES"/*.md; do
@@ -456,10 +456,10 @@ write_review_profiles() {
456
456
  say " wrote $(label "$dst") ($model, $effort effort)"
457
457
  else
458
458
  rm -f "$tmp"
459
- say " skipped $(label "$dst") (it could not be written)"
459
+ note " skipped $(label "$dst") (it could not be written)"
460
460
  fi
461
461
  ;;
462
- skipped) say " skipped $(label "$dst") (a file of your own is there; move it aside to use ocnus's)" ;;
462
+ skipped) note " skipped $(label "$dst") (a file of your own is there; move it aside to use ocnus's)" ;;
463
463
  esac
464
464
  done
465
465
  [ -z "$only" ] || return 0
package/cli/ocnus CHANGED
@@ -662,8 +662,23 @@ terminal at least 44 columns wide gets the OCNUS letters alone, six lines,
662
662
  in colour unless NO_COLOR is set or TERM is dumb. Piped or sent to a file,
663
663
  or in a terminal narrower than 44 columns, both print what they print
664
664
  without it, with no banner and no letters. No other command shows either,
665
- nor does the usage an unknown command gets. NO_COLOR and TERM are read from
666
- the environment alone: the env file sets neither.
665
+ nor does the usage an unknown command gets, but for the picture below.
666
+ NO_COLOR and TERM are read from the environment alone: the env file sets
667
+ neither.
668
+
669
+ In a terminal one row taller, at least 79 columns wide and 25 rows tall,
670
+ whose TERM is not dumb, with NO_COLOR unset, `install` and `status` show
671
+ their work under the banner instead: the banner moves at the top, a bar
672
+ under it fills as each part of the work finishes, and under the bar one
673
+ line says what is being done now, such as "Checking the Linear key".
674
+ install's banner moves for about three seconds, and longer only while a
675
+ part is still running. Then the banner rests, and below it status prints
676
+ its report, and install the lines that are left for you to see to, such as
677
+ a link skipped or a folder missing from PATH, then its closing line. If
678
+ something fails, the picture stops where it is, and below it comes
679
+ everything the command printed, the error with it. Ctrl-C stops ocnus there
680
+ too. However it ends, the cursor shows again below it all. In any other
681
+ terminal, or piped, both print what they always have.
667
682
 
668
683
  The copy of ocnus in a git worktree of the ocnus repo, run as
669
684
  ./cli/ocnus, is a change being built. It runs only the commands that
@@ -828,7 +843,7 @@ TEMPLATE_MARK='<!-- ocnus:template -->'
828
843
 
829
844
  # Sourced, so every file shares the settings above and each other's functions.
830
845
  LIB=$REPO/cli/lib
831
- for part in common guard banner links recipes trust settings space linear archive tests approval billing chain usage cost task finish close agents github merges handoff asks sessions brief host events commands; do
846
+ for part in common guard banner progress links recipes trust settings space linear archive tests approval billing chain usage cost task finish close agents github merges handoff asks sessions brief host events commands; do
832
847
  [ -f "$LIB/$part.sh" ] ||
833
848
  { printf 'ocnus: %s is missing; reinstall ocnus\n' "$LIB/$part.sh" >&2; exit 1; }
834
849
  # shellcheck source=/dev/null
@@ -838,10 +853,12 @@ done
838
853
  # A worktree's copy runs only the commands that read, unless asked (guard.sh).
839
854
  guard_worktree "$@"
840
855
 
841
- # install and help open with the banner, in a terminal that can show it
842
- # (banner.sh). The usage an unknown command gets does not.
856
+ # help opens with the banner, in a terminal that can show it (banner.sh),
857
+ # and so does install, from progress_begin, where the picture it shows while
858
+ # it works cannot show (progress.sh). The usage an unknown command gets
859
+ # does not.
843
860
  case ${1:-help} in
844
- install) shift; banner; cmd_install "$@" ;;
861
+ install) shift; cmd_install "$@" ;;
845
862
  update) shift; cmd_update "$@" ;;
846
863
  status) shift; cmd_status "$@" ;;
847
864
  space) shift; cmd_space "$@" ;;
package/herdr/README.md CHANGED
@@ -16,11 +16,12 @@ layouts (whole-window arrangements of mods).
16
16
  | `mods/card-list/` | The card list, at the top of the `vibe` layout's middle column, and in a column of its own beside the terminals on `showcase`: the cards of the space that is showing, in two views. Agents lists the cards running now, the ones that need you first; Linear lists every open card under its parent card, with Start for a card not approved yet. A click on a running card opens its agent on the right. See [The card list](#the-card-list). |
17
17
  | `mods/steps/` | The steps of the card whose tab is selected: what each did, how long it took, and how long it waited on you. With no card's tab selected, the space's cards and where each stands. |
18
18
  | `mods/step-counts/` | The Step counts section, right above Usage and about as small: the seven steps, each with a dot for every card of the space that is showing that stands on it, coloured by how the card's agent is doing, and how many there are. See [The Step counts section](#the-step-counts-section). |
19
+ | `mods/needs-you/` | Needs you, the right column of `vibe`: the questions that wait on you in the space that is showing, most urgent first, each answered with a click, with nothing typed in the agent's tab. See [Needs you](#needs-you). |
19
20
  | `mods/agent-settings/` | The settings button, a cog at the right end of the tab bar, and the popup it opens: the model and effort of each phase profile and dev profile, then the breakdown approval, archiving, the tests setting and billing, each of which a click changes. See [The settings button](#the-settings-button). |
20
21
  | `mods/names/` | Draws nothing but a note saying what it does, and that only where a layout asks for it, as `showcase` does. It gives the spaces and tabs the app takes in from herdr-core, for agents started while the app was closed, the names ocnus gave them. See [Writing the card up](#writing-the-card-up). |
21
22
  | `layouts/default.json` | Herdr's own layout with ocnus's panels: the Ocnus spaces panel, the `ocnus-spaces` mod, in place of Herdr's own list of spaces; the layout dropdown, the Cards and Steps panels, the Step counts section, the Usage section, the Memory mod and the CPU mod in the sidebar, with the Step counts right above Usage, Usage above Memory and CPU, and Memory right above CPU; and the settings button beside the tabs. Herdr's Agents section, its `agents` mod, is not on it. The tab bar is a row of Herdr's `tabs`, `agent-settings` and `names`, in a block 1px wide, since a mod runs only while a layout places it. |
22
- | `layouts/showcase.json` | For seeing each mod working before you choose what to put in a layout of your own: it places every mod ocnus ships, each in a block of its own that shows as soon as the layout opens, and each is the mod itself, on this machine's own data, as on `default`. It is `default` with three changes: the card list, which `default` does not have, is a column of its own left of the terminals, 540px wide; the Usage section, the Memory mod and the CPU mod leave the sidebar for a row along the bottom, under the terminals; and `names` sits at the end of that row, where it draws a note saying that it draws nothing, and what it does. `npm test` fails, naming the mod, when a mod in `mods/` is not on it, so a card that adds a mod adds it here too. |
23
- | `layouts/vibe.json` | Three columns side by side, each the window's full height, for steering every agent without reading code. The left one is the sidebar, 268px wide as `default`'s is: Herdr's brand, the layout dropdown, the Ocnus spaces panel and, at its bottom, the Step counts section, the Usage section, the Memory mod and the CPU mod, stacked in that order with nothing between them. The middle one is the card list, the `card-list` mod, which fills its place there (see [The card list](#the-card-list)), above the place for Brainstorm (LAB-240), and the right one is the place for Needs you (LAB-238), which turns into the opened agent (LAB-239). Those two places are still empty: each is a column with nothing in it, which its card swaps for the mod's block, so the layout names no mod that is not installed. It shows no files, diffs or split terminals: it has no Files panel, no Changes panel, no tab bar and no block for a tab's terminals, shown or hidden, so code is only in the pull requests. It has no settings button and no footer either: the settings button is on `default`, and Herdr's Settings still opens by its key. The `names` mod is beside the brand, in a block 1px wide. `layouts/vibe.svg`, beside it, is its picture in Herdr's Settings: `ocnus install` and `ocnus update` link it, and `ocnus status` lists it, as they do a layout. |
23
+ | `layouts/showcase.json` | For seeing each mod working before you choose what to put in a layout of your own: it places every mod ocnus ships, each in a block of its own that shows as soon as the layout opens, and each is the mod itself, on this machine's own data, as on `default`. It is `default` with four changes: the card list, which `default` does not have, is a column of its own left of the terminals, 540px wide; Needs you, which `default` does not have either, is a column of its own right of them, 368px wide; the Usage section, the Memory mod and the CPU mod leave the sidebar for a row along the bottom, under the terminals; and `names` sits at the end of that row, where it draws a note saying that it draws nothing, and what it does. `npm test` fails, naming the mod, when a mod in `mods/` is not on it, so a card that adds a mod adds it here too. |
24
+ | `layouts/vibe.json` | Three columns side by side, each the window's full height, for steering every agent without reading code. The left one is the sidebar, 268px wide as `default`'s is: Herdr's brand, the layout dropdown, the Ocnus spaces panel and, at its bottom, the Step counts section, the Usage section, the Memory mod and the CPU mod, stacked in that order with nothing between them. The middle one is the card list, the `card-list` mod, which fills its place there (see [The card list](#the-card-list)), above the place for Brainstorm (LAB-240), and the right one is Needs you, the `needs-you` mod (see [Needs you](#needs-you)), which turns into the opened agent (LAB-239). The place for Brainstorm is still empty: it is a column with nothing in it, which its card swaps for the mod's block, so the layout names no mod that is not installed. It shows no files, diffs or split terminals: it has no Files panel, no Changes panel, no tab bar and no block for a tab's terminals, shown or hidden, so code is only in the pull requests. It has no settings button and no footer either: the settings button is on `default`, and Herdr's Settings still opens by its key. The `names` mod is beside the brand, in a block 1px wide. `layouts/vibe.svg`, beside it, is its picture in Herdr's Settings: `ocnus install` and `ocnus update` link it, and `ocnus status` lists it, as they do a layout. |
24
25
  | `spaces/template/` | The starting `SPACE.md` for every new space. |
25
26
 
26
27
  The skills are in [../skills/](../skills/), outside this folder. They are
@@ -967,6 +968,7 @@ ocnus task answer <space> <card> <question> <answer>
967
968
  |---|---|
968
969
  | `id` | The question's id, a string: what `task answer` takes |
969
970
  | `card`, `kind`, `text` | The card, one of the four kinds, and what is asked. A permission prompt's text names the tool and what it would do, such as `Allow Bash to run: npm test` or `Allow Edit on the file: /repo/app.ts` |
971
+ | `step` | The step the question's agent is at. For an approval, a choice or a merge, the step of its hand-off. For a permission prompt, the step its card stands on, as the Step counts section places a card: the step that comes next when the card's latest hand-off is `done`, and that hand-off's own step otherwise, as after an answer. null for a card with no hand-off |
970
972
  | `options` | The options, a list of strings |
971
973
  | `at`, `seconds` | When it was asked, in UTC, and how many seconds ago |
972
974
  | `summary` | The summary the agent recorded with the question, or null |
@@ -1373,6 +1375,94 @@ ocnus task answer <space> <card> <question> <answer>
1373
1375
  tab opens, closes or is renamed, or one of its terminals reports another
1374
1376
  status. They also read it again every 6 seconds.
1375
1377
 
1378
+ ### Needs you
1379
+
1380
+ On the `vibe` layout, the right column is Needs you: the questions that
1381
+ wait on you in the space that is showing, as `task asks` lists them (see
1382
+ [Hand-offs](#hand-offs)), each answered with a click and with nothing typed
1383
+ in the agent's tab. An agent with no question waiting is not in it.
1384
+
1385
+ - **It lists what `task asks <space> --json` lists, most urgent first:**
1386
+ permission prompts, approvals and the agents' own lists of options, then
1387
+ merges, and within each of those two groups the question that has waited
1388
+ longest first. That is ocnus's order, oldest first, with the merges moved
1389
+ after the rest, which is the one thing the mod orders. Its heading says how
1390
+ many there are, as `Needs you · 3`.
1391
+ - **Each question shows** its card's ID and title, the step its agent is at
1392
+ (`step`), how long it has waited, as `<1m`, then in whole minutes, hours
1393
+ or days, such as `6m`, `2h` or `3d`, and its kind: Permission, Approve? or
1394
+ Asking in the theme's `blocked` colour, and Merge? in its `done` colour.
1395
+ Under them come the question's text and, when the agent recorded one with
1396
+ it, its summary. The titles come from `task ls <space> --json`, so a card
1397
+ `task ls` does not list, as when no Linear key is saved, shows its ID
1398
+ alone. A read of the titles that fails leaves the ones the space's last
1399
+ read gave.
1400
+ - **A permission prompt, an approval and a merge show their options as
1401
+ buttons in a row**, in the order ocnus gives them, the first standing
1402
+ out. Each answers with the option ocnus gave:
1403
+
1404
+ | Kind | Button | Answers with |
1405
+ |---|---|---|
1406
+ | `permission` | Yes | `allow` |
1407
+ | `permission` | No | `refuse` |
1408
+ | `permission` | Yes, and don't ask again, only where the prompt offers it | `allow from now on` |
1409
+ | `approval` | Approve, Change breakdown, Change plan, Change specification: each option with a capital | the option, such as `approve` |
1410
+ | `merge` | Merge | `merge`, which merges the card's pull requests on GitHub |
1411
+ | `merge` | Ask for changes | `a change you want made`, which goes to the agent |
1412
+ | `merge` | Open and a pull request's repo and number, such as `Open acme/api#7 ↗`, for each of the card's open pull requests (`pulls`) | nothing: it opens the pull request in your browser |
1413
+
1414
+ A merge's `stop here` has no button: give it in the agent's tab.
1415
+ - **An agent's own list of options is a stack of rows**, in the agent's
1416
+ order, each with its number and the option as the agent wrote it, on as
1417
+ many lines as it needs. The last row is Something else. A click on it
1418
+ answers nothing and runs no command: it sets Herdr's shared value
1419
+ `ocnus.open` to `{space, card}`, which the opened agent (LAB-239) reads to
1420
+ open that agent on its conversation, where you answer in your own words.
1421
+ Until the opened agent is installed, nothing reads it. When the agent's
1422
+ own last option is Something else, in any case, it shows once, as that
1423
+ row.
1424
+ - **A click on any other button or row answers its question,** with
1425
+ `ocnus task answer <space> <card> <question> <option>`. From the click,
1426
+ the question shows the choice beside a spinner in place of its buttons or
1427
+ rows, and takes no second answer. Once the command exits zero, which is
1428
+ once ocnus says the agent, the prompt's hook or GitHub took the answer,
1429
+ it shows `✓ Sent:` and the choice until ocnus no longer lists the
1430
+ question. Each question has its own state, so one being sent holds no
1431
+ other. The questions are read again as soon as an answer has ended.
1432
+ - **When ocnus refuses the answer or cannot deliver it,** the question shows
1433
+ what `task answer` said, with its buttons or rows back under it, and
1434
+ nothing reads as sent, so a question that still waits can be answered
1435
+ again. That is so for a question answered already in the tab, one whose
1436
+ agent is not running, a pull request GitHub will not merge as it stands,
1437
+ and each of the other refusals under [Hand-offs](#hand-offs), and for a
1438
+ command that cannot start or has not ended after 2 minutes.
1439
+ - **It keeps up on its own** while Herdr's window is visible. It looks every
1440
+ second, and reads the questions again every 4 seconds, at once when
1441
+ Herdr's tabs in the space open, close, are renamed or report another
1442
+ status, and once an answer has ended. So a question shows within 5
1443
+ seconds of ocnus listing it, and goes within 5 seconds of ocnus no longer
1444
+ listing it, however it was answered: by a click, in the agent's tab or by
1445
+ a merge on GitHub, which ocnus records within a minute. Showing another
1446
+ space reads that space's questions at once. The spaces and the cards'
1447
+ titles are read when another space shows and every minute, on their own,
1448
+ so a slow Linear never holds the questions up. Nothing is read while the
1449
+ window is hidden, and it redraws only when what it shows has changed.
1450
+ - **In place of the list, one line says why** there is none:
1451
+
1452
+ | It says | When |
1453
+ |---|---|
1454
+ | `Nothing needs you.` | No question waits on you in the space. |
1455
+ | `This space is not an ocnus space.` | The Herdr space that is showing is not one of ocnus's spaces. |
1456
+ | `This ocnus cannot list the questions. Run: ocnus update` | The `ocnus` it runs is from before `task asks`. |
1457
+ | What `task asks` or `space ls` said, such as that `sqlite3` is not installed | Either one failed, or could not run. |
1458
+
1459
+ - **It works nothing out itself.** The space comes from `space ls --json`,
1460
+ the questions from `task asks <space> --json`, the titles from
1461
+ `task ls <space> --json`, and what an answer does from `task answer`, so
1462
+ Needs you and the commands always agree. It runs the `ocnus` on your
1463
+ `PATH`, or the copy it is linked from when Herdr cannot start that, as the
1464
+ other panels do.
1465
+
1376
1466
  ### The Step counts section
1377
1467
 
1378
1468
  On the `default` layout, the Step counts section sits in the sidebar right
@@ -210,6 +210,17 @@
210
210
  "min": 280,
211
211
  "max": 900,
212
212
  "hidden": true
213
+ },
214
+ {
215
+ "id": "needs-you",
216
+ "type": "block",
217
+ "content": {
218
+ "mod": "needs-you"
219
+ },
220
+ "size": {
221
+ "px": 368
222
+ },
223
+ "min": 280
213
224
  }
214
225
  ],
215
226
  "padding": 8,
@@ -139,8 +139,13 @@
139
139
  "children": [
140
140
  {
141
141
  "id": "needs-you",
142
- "type": "column",
143
- "children": []
142
+ "type": "block",
143
+ "content": {
144
+ "mod": "needs-you"
145
+ },
146
+ "size": {
147
+ "weight": 1
148
+ }
144
149
  }
145
150
  ],
146
151
  "size": {