@johngaynor/ocnus 2.0.1-next.73 → 2.0.1-next.78

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.
package/README.md CHANGED
@@ -100,9 +100,10 @@ its own layout, which has no Layout dropdown, so the first switch is
100
100
  a block of its own, so that you can see each one working before you choose
101
101
  what to put in a layout of your own. `vibe` is three columns for steering
102
102
  every agent without reading code, with no files, diffs or split terminals,
103
- and the dropdown again, to come back to `default`. The `layouts/vibe.json`
104
- row in [herdr/README.md](herdr/README.md#whats-here) says what each column
105
- holds.
103
+ and the dropdown again, to come back to `default`. Its middle column starts
104
+ with the card list, the cards that are running and every open card of the
105
+ space that is showing. The `layouts/vibe.json` row in
106
+ [herdr/README.md](herdr/README.md#whats-here) says what each column holds.
106
107
 
107
108
  In a terminal, `ocnus install` and `ocnus help`, which `ocnus` with no
108
109
  command is too, open with a banner: OCNUS in block letters beside Ocnus on
@@ -651,6 +652,19 @@ not yet started. The section draws what `task log <space> --json` counts,
651
652
  and updates on its own. See
652
653
  [herdr/README.md](herdr/README.md#the-step-counts-section).
653
654
 
655
+ On the `vibe` layout, the card list, at the top of the middle column, shows
656
+ the cards of the space that is showing in two views. Agents lists the cards
657
+ that are running, those whose tab ocnus opened is open with their phase
658
+ still going on, the ones that need you first: Stuck, then Permission,
659
+ Approve? and Asking, then Merge?, then Working. Each row has the card's
660
+ parent, a bar for its seven steps, its status, how long it has been so and
661
+ the tokens its agents have used. Linear lists every open card under its
662
+ parent card, with Start for a card not approved yet, Held and what it waits
663
+ on for one that is held, and the rest as `task log` has them. A click on a
664
+ running card opens its agent on the right. It draws what `task ls` and
665
+ `task log` give, and updates on its own. See
666
+ [herdr/README.md](herdr/README.md#the-card-list).
667
+
654
668
  `task asks` lists every question that waits on you in a space, oldest first,
655
669
  so that you, or a board, can see what each agent is asking without opening
656
670
  its tab:
@@ -811,6 +825,53 @@ session's transcript. The command then says why and exits non-zero, as it
811
825
  does when Claude Code could not make the brief. See
812
826
  [herdr/README.md](herdr/README.md#hand-offs).
813
827
 
828
+ To follow how a card's steps went without reading code or scrolling a
829
+ terminal, list what its agents did:
830
+
831
+ ```sh
832
+ ocnus task events my-space ABC-122
833
+ ```
834
+
835
+ It lists each step the card has been in, as `task log` times it, with what
836
+ its agent did in it, oldest first: a line an event, with its time, its kind
837
+ and one line of text. `--step` lists one step alone, such as
838
+ `--step review`, each time the card was in it, and `--json` gives the same
839
+ as one line for programs. Each kind's line says this much:
840
+
841
+ - An **edit** names the files the agent edited and how many, from the
842
+ folder it works in. Edits made one after another, with no other event
843
+ between them, are one event, which names each file once.
844
+ - A **test run**, a command that runs `ocnus tests run`, says how many cases
845
+ passed and how many failed. When its output went to a file, or it ran in
846
+ the background, they are read from the first command after it that read
847
+ the file and printed them. While it is still going, or when its totals
848
+ cannot be read, it has no totals, never 0.
849
+ - A **commit** gives its short hash and its subject, as git printed them.
850
+ - A **command**, any other command the agent ran, says what it was for, as
851
+ the agent described it when it ran it, or the program it ran when it gave
852
+ no description.
853
+ - A **question** is what the agent asked you in a `needs-human` hand-off.
854
+ - An **answer** is what you said to the agent in its tab. ocnus's first
855
+ message to it, ocnus's watch waking it, and asking it for a brief are not
856
+ answers.
857
+
858
+ The list never gives a file's contents or a diff, whether it would come
859
+ from an edit, from a command's own text or from what a command printed: of
860
+ what a command printed, it gives only a test run's totals and a commit's
861
+ hash and subject. Nor does it list the files an agent read, its calls to
862
+ Linear or Claude Code's permission prompts.
863
+
864
+ It reads the transcripts Claude Code keeps of the sessions `task new` and
865
+ `task build` record, so while an agent works, its step lists what it has
866
+ done so far, and once the card has merged and its task is finished, the list
867
+ is still given, for as long as Claude Code keeps the transcripts. A step
868
+ says `not recorded` when its agent's session was not recorded, as for a card
869
+ from before ocnus recorded sessions or an agent in another harness, or when
870
+ Claude Code no longer keeps the transcript. It never shows such a step as
871
+ one in which the agent did nothing: a step in which it did nothing that is
872
+ listed says `nothing to list`. See
873
+ [herdr/README.md](herdr/README.md#hand-offs).
874
+
814
875
  `task start` starts the work, once you have approved the card. It takes the
815
876
  card too, makes a branch and a git worktree of it in every repo of the
816
877
  space, opens a tab for it, and starts the agent there that runs the build
@@ -1261,9 +1322,9 @@ Its `./cli/ocnus` runs only the commands that read: `help`, `status`,
1261
1322
  with `--json`), `tests` and `tests ls` (each alone or with `--json`),
1262
1323
  `approval` (alone or with `--json`), `billing` (alone or with `--json`),
1263
1324
  `chain` (alone or with `--json`), `usage` (alone or with `--json`),
1264
- `task ls`, `task log`, `task asks`, `host` and `host report`.
1265
- Any other command stops before it does anything, says that it is a
1266
- worktree's copy, and gives the command that runs it for real:
1325
+ `task ls`, `task log`, `task asks`, `task events`, `host` and
1326
+ `host report`. Any other command stops before it does anything, says that
1327
+ it is a worktree's copy, and gives the command that runs it for real:
1267
1328
  `OCNUS_LIVE=1 ./cli/ocnus …`, for that one run. The installed `ocnus` is never stopped, whatever folder
1268
1329
  it is run from, so an agent in the worktree records its hand-offs with it.
1269
1330
 
package/cli/lib/agents.sh CHANGED
@@ -59,6 +59,12 @@
59
59
  # neither place can list the space's tabs: herdr-core cannot list its
60
60
  # terminals, and the app is not running or `herdr-app ls` fails. With no
61
61
  # tab to look in, no agent is running then.
62
+ # - What was seen in the card's tab is kept beside its agent state, as
63
+ # seen, whether or not the agent has anything to say: closed when the
64
+ # tab is not open, or when it was not looked for, as with no tab to look
65
+ # in. It is not an agent state either: the list's JSON reads it to say
66
+ # whether the card is running, as the card list in Herdr shows it
67
+ # (cards_sql in handoff.sh).
62
68
 
63
69
  # The seconds after a start row in which the agent is still starting.
64
70
  AGENT_START_GRACE=15
@@ -232,12 +238,14 @@ card_seen() {
232
238
  # AGENT_READY is 1 for a card ready to merge: its pull requests wait on the
233
239
  # human, it has no agent state, and ocnus's watch says they are ready
234
240
  # (merges_seen). It is 0 for any other card, and AGENT_JSON is null with it.
241
+ # AGENT_SEEN is left as card_seen saw the card's tab, and is closed when it
242
+ # did not look, whatever AGENT_JSON is.
235
243
  # card_agent <card> <the card in lower case> <step> <status> <next>
236
244
  # <seconds since the hand-off> <space>
237
245
  AGENT_JSON=null AGENT_LABEL='' AGENT_FOR='' AGENT_READY=0
238
246
  card_agent() {
239
247
  local card=$1 low=$2 step=$3 status=$4 next=$5 since=$6 space=$7
240
- AGENT_JSON=null AGENT_LABEL='' AGENT_FOR='' AGENT_READY=0
248
+ AGENT_JSON=null AGENT_LABEL='' AGENT_FOR='' AGENT_READY=0 AGENT_SEEN=closed
241
249
  # Its pull requests wait on the human.
242
250
  local waits=0
243
251
  [ "$step $status" != 'pr needs-human' ] || waits=1
@@ -329,20 +337,24 @@ card_agent() {
329
337
  }
330
338
 
331
339
  # Work out the agent of every card in a view of the log, as AGENTS_SQL: the
332
- # SQL for the table agents (card, agent, ready) that the log's query joins,
333
- # with each card whose agent has something to say and its JSON, with ready
334
- # 0, and each card ready to merge, which has no agent state: its agent is
335
- # null and its ready 1, for the list's counts (counts_sql in handoff.sh).
340
+ # SQL for the table agents (card, agent, ready, seen) that the log's query
341
+ # joins, with each card whose agent has something to say and its JSON, with
342
+ # ready 0; each card ready to merge, which has no agent state: its agent is
343
+ # null and its ready 1, for the list's counts (counts_sql in handoff.sh); and
344
+ # each other card whose tab is open, with its agent null and its ready 0.
345
+ # seen is what card_seen saw in the card's tab, closed when it is not open,
346
+ # for whether the card is running (cards_sql in handoff.sh). A card with no
347
+ # row has no agent state, and its tab is closed.
336
348
  # The space's tabs are read here, once. AGENT_NOW is the last agent's label
337
349
  # and how long it has been so, as the list shows them, for the `now:` line
338
350
  # of the log of one card. Nothing is worked out without jq, which reads hc's
339
351
  # answers, as ocnus's watch on the merges needs it to run.
340
352
  # agents_table <view> <space> <the space's folder>
341
- AGENTS_SQL='agents (card, agent, ready) as (select null, null, null where 0)'
353
+ AGENTS_SQL='agents (card, agent, ready, seen) as (select null, null, null, null where 0)'
342
354
  AGENT_NOW=''
343
355
  agents_table() {
344
356
  local view=$1 name=$2 dir=$3 rows sep=$'\x1f' card low step status next since values='' only=''
345
- AGENTS_SQL='agents (card, agent, ready) as (select null, null, null where 0)' AGENT_NOW=''
357
+ AGENTS_SQL='agents (card, agent, ready, seen) as (select null, null, null, null where 0)' AGENT_NOW=''
346
358
  [ -n "$view" ] || return 0
347
359
  command -v jq >/dev/null 2>&1 || return 0
348
360
  agents_read "$name" "$dir"
@@ -354,13 +366,14 @@ agents_table() {
354
366
  from shown where after is null $only order by id;") || return 0
355
367
  while IFS=$sep read -r card low step status next since; do
356
368
  [ -n "$card" ] || continue
357
- card_agent "$card" "$low" "$step" "$status" "$next" "$since" "$name" || AGENT_JSON=null AGENT_READY=0
369
+ card_agent "$card" "$low" "$step" "$status" "$next" "$since" "$name" ||
370
+ AGENT_JSON=null AGENT_READY=0 AGENT_SEEN=closed
358
371
  if [ "$AGENT_JSON" != null ]; then
359
- values="$values${values:+, }($(sql_str "$card"), $(sql_str "$AGENT_JSON"), 0)"
372
+ values="$values${values:+, }($(sql_str "$card"), $(sql_str "$AGENT_JSON"), 0, $(sql_str "$AGENT_SEEN"))"
360
373
  AGENT_NOW="$AGENT_LABEL, for $AGENT_FOR"
361
- elif [ "$AGENT_READY" = 1 ]; then
362
- values="$values${values:+, }($(sql_str "$card"), null, 1)"
374
+ elif [ "$AGENT_READY" = 1 ] || [ "$AGENT_SEEN" != closed ]; then
375
+ values="$values${values:+, }($(sql_str "$card"), null, $AGENT_READY, $(sql_str "$AGENT_SEEN"))"
363
376
  fi
364
377
  done <<< "$rows"
365
- [ -z "$values" ] || AGENTS_SQL="agents (card, agent, ready) as (values $values)"
378
+ [ -z "$values" ] || AGENTS_SQL="agents (card, agent, ready, seen) as (values $values)"
366
379
  }
package/cli/lib/asks.sh CHANGED
@@ -280,6 +280,19 @@ ask_kind() {
280
280
  esac
281
281
  }
282
282
 
283
+ # The same kind as SQL, for the list's JSON (cards_sql, in handoff.sh): merge,
284
+ # approval or choice, from the columns that hold the hand-off's step and its
285
+ # options. The first option is the text before the first " | ", without the
286
+ # spaces around it, as ask_kind takes it, and GLOB, unlike LIKE, minds the
287
+ # case, as `case` does. A change to one is a change to both.
288
+ # ask_kind_sql <step column> <options column>
289
+ ask_kind_sql() {
290
+ local first="trim(substr($2, 1, instr($2 || ' | ', ' | ') - 1))"
291
+ printf "case when %s = 'pr' and %s = 'merged' then 'merge'
292
+ when %s = 'breakdown' and %s glob 'approve*' then 'approval' else 'choice' end" \
293
+ "$1" "$first" "$1" "$first"
294
+ }
295
+
283
296
  # The links of the open pull requests of a card that waits on its merge, a
284
297
  # line each: the ones ocnus's watch on the merges last saw open, one in
285
298
  # conflict among them, from the card's .pulls file (merges_check, in