@johngaynor/ocnus 2.0.1-next.22 → 2.0.1-next.27
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 +19 -56
- package/cli/lib/agents.sh +32 -16
- package/cli/lib/github.sh +33 -17
- package/cli/lib/handoff.sh +86 -5
- package/cli/lib/host.sh +18 -348
- package/cli/lib/merges.sh +23 -12
- package/cli/lib/tests.sh +2 -3
- package/cli/ocnus +9 -39
- package/herdr/README.md +100 -142
- package/herdr/layouts/default.json +10 -0
- package/herdr/mods/step-counts/main.js +281 -0
- package/herdr/mods/step-counts/mod.json +1 -0
- package/package.json +1 -1
package/herdr/README.md
CHANGED
|
@@ -14,9 +14,10 @@ a layout (a whole-window arrangement of mods).
|
|
|
14
14
|
| `mods/ocnus-spaces/` | The Ocnus spaces panel: every space in your config, open or not. Click one to show it; `+` makes a new one. It is not `spaces`, which is Herdr's own list of the spaces it has open. |
|
|
15
15
|
| `mods/cards/` | The open Linear cards of the space that is showing, under their statuses. Start writes a card up with `task new`; Open shows the tab of a card already started. |
|
|
16
16
|
| `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. |
|
|
17
|
+
| `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). |
|
|
17
18
|
| `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). |
|
|
18
19
|
| `mods/names/` | Draws nothing. 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). |
|
|
19
|
-
| `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 Usage section, the Memory mod and the CPU mod in the sidebar, with 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. |
|
|
20
|
+
| `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. |
|
|
20
21
|
| `spaces/template/` | The starting `SPACE.md` for every new space. |
|
|
21
22
|
|
|
22
23
|
The skills are in [../skills/](../skills/), outside this folder. They are
|
|
@@ -738,7 +739,10 @@ ocnus task log <space> [<card>]
|
|
|
738
739
|
every such card in one call, with `gh api graphql`, however many cards wait
|
|
739
740
|
and in however many spaces and repos (past 100 worktrees, in calls of 100).
|
|
740
741
|
It names each worktree's repo by its `origin` on GitHub, and only a
|
|
741
|
-
branch's newest pull request counts.
|
|
742
|
+
branch's newest pull request counts. The same call asks whether each can
|
|
743
|
+
be merged and what its checks came to, which is how a pass knows that a
|
|
744
|
+
card is ready to merge (see
|
|
745
|
+
[The Step counts section](#the-step-counts-section)). A
|
|
742
746
|
repo that GitHub answers with an error, or a worktree whose origin is not on
|
|
743
747
|
GitHub, leaves only its own card as it is, and `task log` says why. It
|
|
744
748
|
records the card's merge, as your answer
|
|
@@ -861,7 +865,10 @@ ocnus task log <space> [<card>]
|
|
|
861
865
|
before. `task log` learns what ocnus's watch saw from the files
|
|
862
866
|
each pass leaves: `~/.config/ocnus/merges/.alive`, the time its
|
|
863
867
|
latest pass began, and `~/.config/ocnus/merges/<space>/<card>`, the
|
|
864
|
-
time and what it saw of the card's pull requests
|
|
868
|
+
time and what it saw of the card's pull requests: `closed` or `conflict`
|
|
869
|
+
with each such pull request's URL, `failed` and why GitHub could not be
|
|
870
|
+
asked, `ready` once every one of them is open and ready to merge, `open`
|
|
871
|
+
while one is open and that does not hold, `merged`, or `none`. Beside them, a pass
|
|
865
872
|
whose call to GitHub failed leaves `~/.config/ocnus/merges/.gh`, for
|
|
866
873
|
`ocnus status`: the time, `sign-in` when `gh` needs signing in or else
|
|
867
874
|
`failed`, and `gh`'s words. The next pass whose call works, or that asks
|
|
@@ -882,7 +889,14 @@ ocnus task log <space> [<card>]
|
|
|
882
889
|
when closed), its `label`, `for`, `seconds` and `pulls`: the URLs of the
|
|
883
890
|
pull requests its label names, an empty list for any state but `closed`
|
|
884
891
|
and `conflict`. The card's own `state`, `for` and `seconds` keep
|
|
885
|
-
their meaning.
|
|
892
|
+
their meaning. With no card, `--json` gives `counts` too, beside `cards`:
|
|
893
|
+
the seven steps in order, each with its `step`, its `count`, how many
|
|
894
|
+
cards stand on it, its `marks`, one for each of those cards (`stuck`,
|
|
895
|
+
`needs-human`, `ready` or `working`, most urgent first, and none at
|
|
896
|
+
`start`), and its `text`, the count as the Step counts section shows it,
|
|
897
|
+
such as `2 held` at `start` (see
|
|
898
|
+
[The Step counts section](#the-step-counts-section)). None of it is
|
|
899
|
+
stored: it is read from Herdr and those
|
|
886
900
|
files each time, and no row or step's time changes with it. With `jq`
|
|
887
901
|
missing, every card shows as before. With `hc` missing, or with neither
|
|
888
902
|
herdr-core able to list its terminals nor the app open and able to list
|
|
@@ -919,6 +933,86 @@ ocnus task log <space> [<card>]
|
|
|
919
933
|
tab opens, closes or is renamed, or one of its terminals reports another
|
|
920
934
|
status. They also read it again every 6 seconds.
|
|
921
935
|
|
|
936
|
+
### The Step counts section
|
|
937
|
+
|
|
938
|
+
On the `default` layout, the Step counts section sits in the sidebar right
|
|
939
|
+
above Usage, under a line like the one above Usage, and is about as small:
|
|
940
|
+
how many cards are at each step in the space that is showing, and how each
|
|
941
|
+
card's agent is doing, so you can see where the work stands, and what needs
|
|
942
|
+
you, without opening a tab.
|
|
943
|
+
|
|
944
|
+
- **Seven rows, one for each step**, in two columns: `define`, `plan`,
|
|
945
|
+
`breakdown` and `start`, then `build`, `review` and `pr`. A row has a dot
|
|
946
|
+
for each card that stands on its step, and how many there are: `0`, with
|
|
947
|
+
no dots, when there are none.
|
|
948
|
+
- **A card stands where `ocnus task log <space>` has it**: on the step
|
|
949
|
+
that comes next after one that is done, or on the step that is asking
|
|
950
|
+
while it waits on you; and so on the step that was answered, or that
|
|
951
|
+
failed. Each card is counted once. A card whose pull requests have merged
|
|
952
|
+
is on no row, and neither is a card with no hand-offs.
|
|
953
|
+
- **A dot's colour says how its card is doing:**
|
|
954
|
+
|
|
955
|
+
| Colour | The card |
|
|
956
|
+
|---|---|
|
|
957
|
+
| Amber | Needs you: it is waiting on you, or its agent is blocked on a prompt in its tab |
|
|
958
|
+
| Blue | Its agent is working: its step is under way |
|
|
959
|
+
| Green | Is ready to merge, at `pr`: its pull requests are all open, none is in conflict, and every check on them has passed |
|
|
960
|
+
| Red | `task log` says its agent is stuck or has stopped: it hit an error, stopped without handing off or is not running, or a pull request of the card's is closed, in conflict or unwatched. A card whose step failed is red too |
|
|
961
|
+
|
|
962
|
+
The first of these that holds gives the colour: an agent blocked on a
|
|
963
|
+
prompt is amber, whatever else holds; any other state `task log` gives
|
|
964
|
+
the agent (see [Hand-offs](#hand-offs)), or a step that failed, is red; a
|
|
965
|
+
card waiting on you is green when it is ready to merge and amber
|
|
966
|
+
otherwise; and anything else is blue. A row's dots come most urgent
|
|
967
|
+
first: red, amber, green, then blue.
|
|
968
|
+
- **Green takes the place of amber at `pr`.** A card whose pull requests
|
|
969
|
+
wait on you to merge them is amber until they are ready, and green once
|
|
970
|
+
they are. ocnus's watch on the merges asks GitHub about them once a
|
|
971
|
+
minute, so a card turns green within about a minute of its last check
|
|
972
|
+
passing, and amber again within a minute of a new commit whose checks are
|
|
973
|
+
running. A pull request with no checks, as in a repo that has none, has
|
|
974
|
+
nothing to wait for and counts as passed. A review that the repo's rules
|
|
975
|
+
ask for is not a check, so green does not say that GitHub will let you
|
|
976
|
+
merge. The card is amber while a check is running or has failed, while
|
|
977
|
+
GitHub has not yet said whether a pull request can be merged, once one of
|
|
978
|
+
several has merged, and when the watch has not seen the card in the last 3
|
|
979
|
+
minutes. It stays amber, too, when GitHub will not say what a pull
|
|
980
|
+
request's checks came to, as when `gh`'s token may not read them.
|
|
981
|
+
- **`start` has no dots**, since no agent runs that step. Its row says how
|
|
982
|
+
many cards are held there, as `2 held`: approved, with their work not yet
|
|
983
|
+
started. `task start` has recorded no start for them, as while a card that
|
|
984
|
+
blocks one is not done yet (see [Starting the work](#starting-the-work)).
|
|
985
|
+
Once it records the start, the card is on `build`.
|
|
986
|
+
- **A row with more dots than fit** shows the ones that fit and `+N` for the
|
|
987
|
+
rest. Its count still says how many there are in all.
|
|
988
|
+
- **It updates on its own** while Herdr's window is visible, with no click
|
|
989
|
+
or restart. It looks at Herdr's tabs in the space every 2 seconds, and
|
|
990
|
+
reads the counts again as soon as a tab opens, closes or is renamed, or
|
|
991
|
+
one of its terminals reports another status: a change in an agent's state
|
|
992
|
+
shows within 5 seconds, as in the Cards and Steps panels. It also reads
|
|
993
|
+
them again every 6 seconds, so a card's move to another step shows within
|
|
994
|
+
10.
|
|
995
|
+
- **One line stands in place of the rows** when the space that is showing is
|
|
996
|
+
not an ocnus space, when the counts cannot be read, in which case it is
|
|
997
|
+
what `ocnus` said, and when the `ocnus` on the machine is too old to give
|
|
998
|
+
them. A read that failed is tried again. The rest of the sidebar works as
|
|
999
|
+
before. On the sidebar's rail, the section draws only its line.
|
|
1000
|
+
- **It works nothing out itself.** It draws the `counts` that
|
|
1001
|
+
`ocnus task log <space> --json` prints, so the section and `task log`
|
|
1002
|
+
always agree. When `ocnus` is not on Herdr's `PATH`, it runs the copy the
|
|
1003
|
+
mod is linked from. Each entry of `counts` is a step: its name, how many
|
|
1004
|
+
cards stand on it, a mark for each of them, and the text to show:
|
|
1005
|
+
|
|
1006
|
+
```
|
|
1007
|
+
"counts":[{"step":"define","count":0,"marks":[],"text":"0"},…,{"step":"start","count":2,"marks":[],"text":"2 held"},{"step":"build","count":3,"marks":["stuck","needs-human","working"],"text":"3"},…]
|
|
1008
|
+
```
|
|
1009
|
+
|
|
1010
|
+
A mark is `stuck`, which shows red, `needs-human`, amber, `ready`, green,
|
|
1011
|
+
or `working`, blue.
|
|
1012
|
+
- **It needs `jq` to say how an agent is doing.** Without it, `task log`
|
|
1013
|
+
reads no agent and no pull request, so a card is amber when it waits on
|
|
1014
|
+
you, red when its step failed, and blue otherwise.
|
|
1015
|
+
|
|
922
1016
|
### Starting the work
|
|
923
1017
|
|
|
924
1018
|
One branch for an approved card, checked out as a git worktree of the repos
|
|
@@ -1655,7 +1749,7 @@ turn it on, and works on macOS only.
|
|
|
1655
1749
|
ocnus host # whether recording is on, and what it has
|
|
1656
1750
|
ocnus host on # turn recording on
|
|
1657
1751
|
ocnus host off # turn it off, and delete every reading
|
|
1658
|
-
ocnus host report [<period>] # how often CPU, memory and disk were at their limit,
|
|
1752
|
+
ocnus host report [<period>] # how often CPU, memory and disk were at their limit, what used the most, and where the steps' time went
|
|
1659
1753
|
ocnus tests run <command> # run a test command, and record the test run
|
|
1660
1754
|
```
|
|
1661
1755
|
|
|
@@ -1884,8 +1978,7 @@ ocnus tests run <command> # run a test command, and record the test run
|
|
|
1884
1978
|
- **The fingerprint of its command.** Before the job starts,
|
|
1885
1979
|
`/usr/bin/shasum -a 256` hashes the command's arguments, each ended by a
|
|
1886
1980
|
NUL, and the first 15 hex digits of the hash, as a number, are the run's
|
|
1887
|
-
`cmd`. The same arguments give the same number,
|
|
1888
|
-
runs of the same command in the same repo against each other, and the
|
|
1981
|
+
`cmd`. The same arguments give the same number, and the
|
|
1889
1982
|
command's text cannot be read back from it. It is all that is kept of
|
|
1890
1983
|
the command line. `shasum` runs as part of watching the run, so its CPU
|
|
1891
1984
|
is in the run's `watch_secs`; without it, `cmd` is empty and the run is
|
|
@@ -1999,68 +2092,6 @@ figures.
|
|
|
1999
2092
|
time no agent was open, as well as when the machine slept or recording was
|
|
2000
2093
|
off. A period with no readings at all says so.
|
|
2001
2094
|
|
|
2002
|
-
Then come the agents working at once, under `Agents working at once:`, to
|
|
2003
|
-
tell how many agents to run at once:
|
|
2004
|
-
|
|
2005
|
-
- **A line for each number of agents working** in the period, from none
|
|
2006
|
-
up: how long that many were working, and how long and how much of that
|
|
2007
|
-
time the CPU or the memory was at its limit. Each reading counts for the
|
|
2008
|
-
part of it in the period, as above.
|
|
2009
|
-
- **Readings from before the agents working were counted** hold no count.
|
|
2010
|
-
They are left out of these lines, never counted as none working, and
|
|
2011
|
-
their time is on a line of its own, `not counted`.
|
|
2012
|
-
- **How much slower test runs were.** Under each number from 2 up comes
|
|
2013
|
-
how much slower test runs were than with one agent working, as
|
|
2014
|
-
`test runs 30% slower than with 1 working, from 3 runs of 1 command
|
|
2015
|
-
against 3 with 1 working`, or as `faster` when they were faster:
|
|
2016
|
-
- **A test run counts at one number of agents working**: the one that
|
|
2017
|
-
covers most of its time, from when it started for as long as it took,
|
|
2018
|
-
over the readings that counted them, and the larger number on a tie. A
|
|
2019
|
-
run under 10 seconds, shorter than a reading, counts at the number of
|
|
2020
|
-
the reading that holds most of it. Runs that started in the period
|
|
2021
|
-
count, but a run cut short, one still going, one with no `cmd`, from
|
|
2022
|
-
before the fingerprints were kept, and one that overlaps no reading
|
|
2023
|
-
with a count of the agents working are left out.
|
|
2024
|
-
- **A command is a repo and a `cmd`**, so only runs of the same command
|
|
2025
|
-
in the same repo are set against each other. A command counts at a
|
|
2026
|
-
number when it ran at least 3 times with that many working and 3 times
|
|
2027
|
-
with one. Its ratio is the median time of its runs at that number over
|
|
2028
|
-
the median of its runs at one, and the figure is the median of those
|
|
2029
|
-
commands' ratios, with the runs and the commands it rests on, and the
|
|
2030
|
-
runs with one working. Medians keep one odd run, such as one that
|
|
2031
|
-
failed early, from moving the figure.
|
|
2032
|
-
- **With no such command**, it says it cannot tell yet for that number.
|
|
2033
|
-
- **A store from before the fingerprints** has no `cmd`, and the report
|
|
2034
|
-
leaves these lines out. It never alters the store: the next test run or
|
|
2035
|
-
recorder start adds the column.
|
|
2036
|
-
- **The last line names the number from which the host was the limit**:
|
|
2037
|
-
the fewest working at which the CPU or memory was at its limit for at
|
|
2038
|
-
least a quarter of the time. With no such number, it says the host was
|
|
2039
|
-
not the limit at any number of working agents in the period, and with no
|
|
2040
|
-
reading that counted them, it says so.
|
|
2041
|
-
|
|
2042
|
-
Then come the longest stretches when the CPU or the memory was at its limit:
|
|
2043
|
-
|
|
2044
|
-
- **A stretch** is readings in a row, each starting where the one before
|
|
2045
|
-
ended, each with the CPU or memory at its limit. A reading under the
|
|
2046
|
-
limit, or time with no reading, ends it. Each reading counts for the part
|
|
2047
|
-
of it in the period.
|
|
2048
|
-
- **The 5 longest** in the period are listed, longest first, or fewer when
|
|
2049
|
-
there are fewer. Each says when it started, how long it lasted, and
|
|
2050
|
-
whether the CPU, the memory or both were at their limit in it.
|
|
2051
|
-
- **Under each, the work going then**: every card, with its step, or its
|
|
2052
|
-
phase when its card was in none of that phase's steps, then every test
|
|
2053
|
-
run, by its card, its repo and when it started. Each has its share of all
|
|
2054
|
-
cores over the stretch, each reading's share counted for that reading's
|
|
2055
|
-
seconds, and the most memory it held in one reading. Each card also says
|
|
2056
|
-
for how much of the stretch its agent was working, as `working 50% of
|
|
2057
|
-
it`, or `working not read` for shares from before that was read. A share
|
|
2058
|
-
that names no card is left out, and a stretch with no card or test run
|
|
2059
|
-
going says so.
|
|
2060
|
-
- **With none**, the report says the host was never at its limit for CPU or
|
|
2061
|
-
memory in the period. Disk is not among the stretches: under 10% free is
|
|
2062
|
-
not caused by a moment's work.
|
|
2063
|
-
|
|
2064
2095
|
Then come the steps, the phases and the test runs that used the most:
|
|
2065
2096
|
|
|
2066
2097
|
- **The 10 steps and the 10 phases that used the most CPU time** in the
|
|
@@ -2094,66 +2125,6 @@ Then comes where the steps' time went:
|
|
|
2094
2125
|
With no split in the period, or a store made before the splits, the
|
|
2095
2126
|
report says no step was split.
|
|
2096
2127
|
|
|
2097
|
-
Then, after a blank line, it says whether the network may be the cause, as
|
|
2098
|
-
a slow wait on the model can be the network rather than the host:
|
|
2099
|
-
|
|
2100
|
-
- **A slow wait** took over twice the median of every wait in
|
|
2101
|
-
`model_waits`, so 90 days at most. The median is the wait halfway in order
|
|
2102
|
-
of length, the later of the two for an even count. A wait of exactly twice
|
|
2103
|
-
it is not slow.
|
|
2104
|
-
- **It counts for the network** when there is a reading over it, in whole or
|
|
2105
|
-
in part, and every reading over it had the CPU, memory and disk below
|
|
2106
|
-
their limit, as above. A slow wait with no reading over it does not count.
|
|
2107
|
-
- **The period's waits** are those that ended in it, whenever they started.
|
|
2108
|
-
- **With any that count**, it says how many of the period's waits on the
|
|
2109
|
-
model were slow while the host was below its limit, and the median, to a
|
|
2110
|
-
tenth of a second under a minute: `The network may be the cause: 14 of 412
|
|
2111
|
-
waits on the model were slow (over twice the median of 6.2s) while CPU,
|
|
2112
|
-
memory and disk were below their limit.` With none, or a store made before
|
|
2113
|
-
the waits on the model, it says nothing.
|
|
2114
|
-
- **It cannot tell a slow network from a slow model**: the line says only
|
|
2115
|
-
that the network may be the cause.
|
|
2116
|
-
|
|
2117
|
-
Last comes the verdict on the host, one line after a blank one, with the
|
|
2118
|
-
numbers behind it, so that money goes on what slows the agents' work on the
|
|
2119
|
-
host. It is the first of these that holds:
|
|
2120
|
-
|
|
2121
|
-
- **Too little data yet**, with fewer than 10 steps with their time split in
|
|
2122
|
-
the period, each one card's own, or under 1 hour of the agents' time on
|
|
2123
|
-
the host. It says how many steps and how long, against the 10 and the
|
|
2124
|
-
hour. With no split in the period, or a store made before the splits,
|
|
2125
|
-
both are none.
|
|
2126
|
-
- **The one to upgrade first**: of CPU, memory and disk, the one at its
|
|
2127
|
-
limit, as above, for the most of the agents' time on the host, when that
|
|
2128
|
-
is at least 10% of it; the CPU before memory, and memory before the disk,
|
|
2129
|
-
when two were at their limit as long. The line gives its share of the
|
|
2130
|
-
agents' time on the host, that time, and the other two's shares:
|
|
2131
|
-
`upgrade memory first: it was at its limit for 23.0% of the agents' 6h
|
|
2132
|
-
10m on the host (CPU 8.0%, disk 0.0%)`.
|
|
2133
|
-
- **The power state was the limit**, in place of an upgrade, when over half
|
|
2134
|
-
of that one's time at its limit was on battery, in Low Power Mode, or with
|
|
2135
|
-
the thermal state at serious or critical: plugging in, turning Low Power
|
|
2136
|
-
Mode off or letting the machine cool costs nothing. The line gives how
|
|
2137
|
-
much of that time it was, too. At exactly half it is an upgrade. A
|
|
2138
|
-
reading from before the power state was read counts as on power.
|
|
2139
|
-
- **The network was the limit**, when none of the three was at its limit
|
|
2140
|
-
for 10% of the agents' time on the host, and the slow waits that count for
|
|
2141
|
-
the network, as above, are at least 10% of the period's waits on the
|
|
2142
|
-
model: `the network was the limit: 12.0% of the 100 waits on the model
|
|
2143
|
-
were slow (over twice the median of 6.2s) while CPU, memory and disk were
|
|
2144
|
-
below their limit, and each was at its limit for under 10% of the agents'
|
|
2145
|
-
2h 46m on the host (CPU 0.0%, memory 4.0%, disk 0.0%)`. Then no host
|
|
2146
|
-
upgrade is bought that would not have helped. A store made before the
|
|
2147
|
-
waits on the model never has it.
|
|
2148
|
-
- **No upgrade is needed**, otherwise, with the three shares.
|
|
2149
|
-
|
|
2150
|
-
The agents' time on the host is the seconds their tools ran, from the
|
|
2151
|
-
splits, an agent's second each: two agents on the host for a second are two
|
|
2152
|
-
seconds of it. A reading counts for the verdict by the agents' time on the
|
|
2153
|
-
host in it, each split counted for the part of its reading in the period,
|
|
2154
|
-
so time at the limit while the agents waited on the model or on you, or
|
|
2155
|
-
with no split, counts for none of it.
|
|
2156
|
-
|
|
2157
2128
|
```
|
|
2158
2129
|
The host from 2026-11-22 17:20 to 2026-11-29 17:20 (7d)
|
|
2159
2130
|
recorded 9h 41m of 7d 00h
|
|
@@ -2166,15 +2137,6 @@ The host from 2026-11-22 17:20 to 2026-11-29 17:20 (7d)
|
|
|
2166
2137
|
By day:
|
|
2167
2138
|
...
|
|
2168
2139
|
|
|
2169
|
-
Longest stretches with CPU or memory at its limit:
|
|
2170
|
-
2026-11-29 14:02:40 for 12m 30s, CPU at its limit
|
|
2171
|
-
LAB-150 build step CPU 61.4%, memory 3412 MB
|
|
2172
|
-
LAB-151 write-up phase CPU 4.2%, memory 1204 MB
|
|
2173
|
-
LAB-150 ocnus test run 2026-11-29 14:02 CPU 52.8%, memory 1830 MB
|
|
2174
|
-
2026-11-28 10:41:10 for 4m 20s, CPU and memory at their limit
|
|
2175
|
-
LAB-149 review step CPU 48.0%, memory 1890 MB
|
|
2176
|
-
LAB-149 ocnus test run 2026-11-28 10:41 CPU 41.5%, memory 1795 MB
|
|
2177
|
-
|
|
2178
2140
|
Steps that used the most CPU time:
|
|
2179
2141
|
LAB-150 build step CPU time 1h 12m, ran 2h 40m
|
|
2180
2142
|
LAB-149 review step CPU time 22m 05s, ran 51m 10s
|
|
@@ -2199,10 +2161,6 @@ Where the steps' time went:
|
|
|
2199
2161
|
LAB-150 build step open 2h 40m: on the host 51m 20s, waiting on the model 1h 22m, the rest 26m 40s
|
|
2200
2162
|
LAB-149 review step open 51m 10s: on the host 10m 40s, waiting on the model 27m 00s, the rest 13m 30s
|
|
2201
2163
|
1 step had no split, as an agent's time is split only when it starts in Claude Code while recording is on
|
|
2202
|
-
|
|
2203
|
-
The network may be the cause: 14 of 412 waits on the model were slow (over twice the median of 6.2s) while CPU, memory and disk were below their limit.
|
|
2204
|
-
|
|
2205
|
-
Verdict: too little data yet: 2 steps had their time split, with 1h 02m of the agents' time on the host, and a verdict takes at least 10 steps and 1h 00m.
|
|
2206
2164
|
```
|
|
2207
2165
|
|
|
2208
2166
|
- **In a worktree**, `./cli/ocnus host` and `./cli/ocnus host report`
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
// The Step counts section: how many cards are at each step, in the ocnus
|
|
2
|
+
// space that is showing, and how each card's agent is doing. It sits above
|
|
3
|
+
// Usage in the default layout's sidebar, and is about as small.
|
|
4
|
+
//
|
|
5
|
+
// All of that is worked out by `ocnus task log <space> --json`, whose
|
|
6
|
+
// `counts` are the steps in order, each with how many cards are on it, a mark
|
|
7
|
+
// for each of those cards and the text to show at its right. This mod draws
|
|
8
|
+
// those counts and holds no rules about hand-offs, steps or agents: where a
|
|
9
|
+
// card stands, what its mark is and what a step's text says all arrive from
|
|
10
|
+
// the command. What is its own is the drawing: a dot of its colour for each
|
|
11
|
+
// mark, as many dots as fit in the row, and "+N" for the rest.
|
|
12
|
+
import { View, div } from "gpui-kit";
|
|
13
|
+
import { v_flex, h_flex } from "gpui-base";
|
|
14
|
+
import { exec, spaces, panes, terminals, theme, layout, window, checking, appHome, settings } from "herdr";
|
|
15
|
+
|
|
16
|
+
// How often to see whether another space is showing, or Herdr's tabs have
|
|
17
|
+
// changed. A change in them is read at once, so an agent's state shows within
|
|
18
|
+
// this and a read.
|
|
19
|
+
const LOOK_MS = 2000;
|
|
20
|
+
const REREAD_MS = 6000; // how often to read the counts again
|
|
21
|
+
const SPACES_MS = 60000; // spaces change rarely
|
|
22
|
+
const TIMEOUT_MS = 10000;
|
|
23
|
+
// How this mod's own link into the repo that ships it ends.
|
|
24
|
+
const LINKED_AT = "/herdr/mods/step-counts";
|
|
25
|
+
|
|
26
|
+
const LEFT = 4; // the steps in the left column; the rest are in the right one
|
|
27
|
+
const COLUMN_GAP = 12;
|
|
28
|
+
const NAME_CH = 6.6; // px a letter of a step's name takes, to line a column's dots up
|
|
29
|
+
const DOT = 6; // px across a mark's dot
|
|
30
|
+
const DOT_GAP = 3;
|
|
31
|
+
const MORE_CH = 7; // px kept for each character of "+N"
|
|
32
|
+
const ROOM = 36; // px a row's dots are taken to have, until the row is measured
|
|
33
|
+
|
|
34
|
+
// The colour of each mark's dot: red for a card whose agent is stuck or has
|
|
35
|
+
// stopped, amber for one that needs the human, green for one that is ready to
|
|
36
|
+
// merge, and blue for one whose agent is working.
|
|
37
|
+
const colors = (t) => ({ stuck: t.ansi1, "needs-human": t.ansi3, ready: t.ansi2, working: t.ansi4 });
|
|
38
|
+
|
|
39
|
+
// `herdr-app check` draws the mod once, with nothing read, which would show
|
|
40
|
+
// one line of text and none of the rows. It is given these to draw, so a
|
|
41
|
+
// mistake in a row fails the check: every mark, a row with more dots than
|
|
42
|
+
// fit, a row with none, and a count of cards that are held. It draws a line
|
|
43
|
+
// under them too, as one stands in place of the rows.
|
|
44
|
+
const SAMPLE = {
|
|
45
|
+
space: "demo",
|
|
46
|
+
counts: [
|
|
47
|
+
{ step: "define", count: 1, marks: ["working"], text: "1" },
|
|
48
|
+
{ step: "plan", count: 0, marks: [], text: "0" },
|
|
49
|
+
{ step: "breakdown", count: 1, marks: ["needs-human"], text: "1" },
|
|
50
|
+
{ step: "start", count: 2, marks: [], text: "2 held" },
|
|
51
|
+
{ step: "build", count: 12, text: "12",
|
|
52
|
+
marks: ["stuck", "needs-human", "needs-human", "working", "working", "working", "working", "working",
|
|
53
|
+
"working", "working", "working", "working"] },
|
|
54
|
+
{ step: "review", count: 2, marks: ["needs-human", "working"], text: "2" },
|
|
55
|
+
{ step: "pr", count: 3, marks: ["stuck", "needs-human", "ready"], text: "3" },
|
|
56
|
+
],
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
function find(node, id) {
|
|
60
|
+
if (node?.id === id) return node;
|
|
61
|
+
for (const child of node?.children ?? []) {
|
|
62
|
+
const found = find(child, id);
|
|
63
|
+
if (found) return found;
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// The sidebar's rail goes by its width, as in Herdr's own lists.
|
|
69
|
+
const narrow = () => (find(layout(), "sidebar")?.size?.px ?? Infinity) < 160;
|
|
70
|
+
|
|
71
|
+
function parse(text) {
|
|
72
|
+
try {
|
|
73
|
+
return JSON.parse(text);
|
|
74
|
+
} catch {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// What Herdr shows of the tabs in the spaces whose folder is `folder`, on
|
|
80
|
+
// this computer: each tab's id and name, and each of its terminals' status
|
|
81
|
+
// and app. `task log` works out each card's mark from these, so a change in
|
|
82
|
+
// them is read at once. A pane's status has no word for hc's error, so each
|
|
83
|
+
// terminal's own word, from terminals(), is in it too.
|
|
84
|
+
function herdrSees(folder) {
|
|
85
|
+
if (folder === null) return "";
|
|
86
|
+
const word = new Map(terminals().map((t) => [t.address, t.status ?? null]));
|
|
87
|
+
const tabs = new Set();
|
|
88
|
+
const seen = [];
|
|
89
|
+
for (const space of spaces()) {
|
|
90
|
+
if (space.machine || space.folder !== folder) continue;
|
|
91
|
+
for (const tab of space.tabs) {
|
|
92
|
+
tabs.add(tab.id);
|
|
93
|
+
seen.push([tab.id, tab.name]);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
for (const p of panes()) {
|
|
97
|
+
if (p.terminal && tabs.has(p.tab)) seen.push([p.tab, p.terminal, p.status, p.app, word.get(p.terminal) ?? null]);
|
|
98
|
+
}
|
|
99
|
+
return JSON.stringify(seen);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// What a failed command said, without the name it starts its errors with.
|
|
103
|
+
const said = (r) => (r.stderr || r.stdout).trim().replace(/^ocnus: /, "");
|
|
104
|
+
|
|
105
|
+
const OLD_CLI = "This ocnus is too old for the step counts. Run: ocnus update";
|
|
106
|
+
const NOT_OCNUS = "This space is not an ocnus space.";
|
|
107
|
+
// An ocnus from before --json answers with its usage line, not JSON, and
|
|
108
|
+
// one from before the list of cards asks which card.
|
|
109
|
+
const failure = (r, what) => {
|
|
110
|
+
const text = said(r);
|
|
111
|
+
return text.startsWith("usage:") || text.startsWith("which card?") ? OLD_CLI : text || `${what} failed`;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
// The folder of the space that is showing on this computer, or null.
|
|
115
|
+
const selected = () => spaces().find((s) => s.active && !s.machine)?.folder ?? null;
|
|
116
|
+
|
|
117
|
+
// How many dots to draw for a row of `marks` marks in `room` px: all of
|
|
118
|
+
// them when they fit, and else as many as fit beside the "+N" that stands
|
|
119
|
+
// for the rest.
|
|
120
|
+
function fit(marks, room) {
|
|
121
|
+
const wide = (n) => n * DOT + Math.max(0, n - 1) * DOT_GAP;
|
|
122
|
+
if (wide(marks) <= room) return marks;
|
|
123
|
+
for (let n = marks - 1; n > 0; n--) {
|
|
124
|
+
const more = (String(marks - n).length + 1) * MORE_CH;
|
|
125
|
+
if (wide(n) + DOT_GAP + more <= room) return n;
|
|
126
|
+
}
|
|
127
|
+
return 0;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export default class StepCounts extends View {
|
|
131
|
+
init(_props, cx) {
|
|
132
|
+
this.cmd = "ocnus"; // the one on PATH, until that cannot start
|
|
133
|
+
this.listed = null; // the spaces ocnus listed last
|
|
134
|
+
this.listedAt = 0;
|
|
135
|
+
this.key = null; // the folder that the counts on hand were read for
|
|
136
|
+
this.space = null; // the ocnus space the shown Herdr space is, or null
|
|
137
|
+
this.counts = null; // the counts read last
|
|
138
|
+
this.error = null;
|
|
139
|
+
this.busy = false;
|
|
140
|
+
this.readAt = 0;
|
|
141
|
+
this.seen = null; // what Herdr showed of the space's tabs when it was read
|
|
142
|
+
this.drawn = null; // what the last redraw showed, to redraw only on a change
|
|
143
|
+
this.room = {}; // the px each row has for its dots, as measured, by the row's place
|
|
144
|
+
if (checking()) return;
|
|
145
|
+
cx.timer.every(LOOK_MS, (cx) => this.look(cx));
|
|
146
|
+
this.look(cx);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Runs the ocnus command. One that cannot run is tried again as the
|
|
150
|
+
// copy this mod is linked from: Herdr may have been started without the
|
|
151
|
+
// user's PATH. Everything this mod runs only reads, so twice is safe.
|
|
152
|
+
async ocnus(args) {
|
|
153
|
+
try {
|
|
154
|
+
return await exec(this.cmd, args, { timeout: TIMEOUT_MS });
|
|
155
|
+
} catch (e) {
|
|
156
|
+
if (this.cmd !== "ocnus") throw e;
|
|
157
|
+
const link = await exec("readlink", [`${appHome()}/mods/step-counts`]);
|
|
158
|
+
const at = link.stdout.trim();
|
|
159
|
+
if (link.code !== 0 || !at.endsWith(LINKED_AT)) throw e;
|
|
160
|
+
this.cmd = `${at.slice(0, -LINKED_AT.length)}/cli/ocnus`;
|
|
161
|
+
return exec(this.cmd, args, { timeout: TIMEOUT_MS });
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Read the counts again when another space is showing, when Herdr's tabs
|
|
166
|
+
// in the space have changed, or when what is on hand is stale: so does a
|
|
167
|
+
// read that failed, which is tried again. A space that is not an ocnus
|
|
168
|
+
// space is looked up again only as often as the spaces are listed. Nothing
|
|
169
|
+
// is read while nobody can see the section.
|
|
170
|
+
look(cx) {
|
|
171
|
+
if (this.busy || window()?.visible === false || narrow()) return;
|
|
172
|
+
const folder = selected();
|
|
173
|
+
const key = folder ?? "";
|
|
174
|
+
const seen = herdrSees(folder);
|
|
175
|
+
const stale = this.space || this.error
|
|
176
|
+
? Date.now() - this.readAt >= REREAD_MS || seen !== this.seen
|
|
177
|
+
: Date.now() - this.readAt >= SPACES_MS;
|
|
178
|
+
if (key === this.key && !stale) return;
|
|
179
|
+
this.busy = true;
|
|
180
|
+
cx.spawn(async (cx) => {
|
|
181
|
+
let space = null;
|
|
182
|
+
let counts = null;
|
|
183
|
+
let error = null;
|
|
184
|
+
try {
|
|
185
|
+
if (!this.listed || Date.now() - this.listedAt >= SPACES_MS) {
|
|
186
|
+
const r = await this.ocnus(["space", "ls", "--json"]);
|
|
187
|
+
const list = r.code === 0 ? parse(r.stdout)?.spaces : null;
|
|
188
|
+
if (Array.isArray(list)) {
|
|
189
|
+
this.listed = list;
|
|
190
|
+
this.listedAt = Date.now();
|
|
191
|
+
} else {
|
|
192
|
+
error = r.code === 0 ? OLD_CLI : failure(r, "ocnus space ls");
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
space = (this.listed ?? []).find((s) => s.folder === folder)?.name ?? null;
|
|
196
|
+
if (!error && space) {
|
|
197
|
+
const r = await this.ocnus(["task", "log", space, "--json"]);
|
|
198
|
+
const got = r.code === 0 ? parse(r.stdout) : null;
|
|
199
|
+
// An ocnus from before the counts gives the list without them.
|
|
200
|
+
if (Array.isArray(got?.counts)) counts = got.counts;
|
|
201
|
+
else error = r.code === 0 ? OLD_CLI : failure(r, "ocnus task log");
|
|
202
|
+
}
|
|
203
|
+
} catch (e) {
|
|
204
|
+
error = `Could not run ocnus: ${e?.message ?? e}`;
|
|
205
|
+
}
|
|
206
|
+
this.key = key;
|
|
207
|
+
this.space = space;
|
|
208
|
+
this.counts = counts;
|
|
209
|
+
this.error = error;
|
|
210
|
+
this.readAt = Date.now();
|
|
211
|
+
this.seen = seen;
|
|
212
|
+
this.busy = false;
|
|
213
|
+
// A redraw of a mod redraws the whole window, so only when what it
|
|
214
|
+
// shows has changed.
|
|
215
|
+
const drawn = JSON.stringify([key, space, counts, error]);
|
|
216
|
+
if (drawn !== this.drawn) {
|
|
217
|
+
this.drawn = drawn;
|
|
218
|
+
cx.notify();
|
|
219
|
+
}
|
|
220
|
+
// A space chosen while this was being read is read now, not at the
|
|
221
|
+
// next look.
|
|
222
|
+
if ((selected() ?? "") !== key) this.look(cx);
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// One step, on one line: its name, a dot for each of its cards, as many as
|
|
227
|
+
// fit, with "+N" for the rest, and its text at the right. `i` is its place
|
|
228
|
+
// among the steps, and `name` the px its column gives a name.
|
|
229
|
+
row(c, i, t, name) {
|
|
230
|
+
const marks = Array.isArray(c.marks) ? c.marks : [];
|
|
231
|
+
const color = colors(t);
|
|
232
|
+
const shown = fit(marks.length, this.room[i] ?? ROOM);
|
|
233
|
+
const rest = marks.length - shown;
|
|
234
|
+
return h_flex().flex_none().gap(6).items_center()
|
|
235
|
+
.child(div().flex_none().min_w(name).text_color(t.muted).child(String(c.step ?? "")))
|
|
236
|
+
.child(h_flex().id(`dots-${i}`).flex_1().min_w(0).gap(DOT_GAP).items_center().overflow_hidden()
|
|
237
|
+
// The room the dots have, measured. The size is in window px.
|
|
238
|
+
.on_size_change((size, cx) => {
|
|
239
|
+
const room = size.width / (Number(settings().zoom) || 1);
|
|
240
|
+
const was = this.room[i] ?? ROOM;
|
|
241
|
+
this.room[i] = room;
|
|
242
|
+
if (fit(marks.length, room) !== fit(marks.length, was)) cx.notify();
|
|
243
|
+
})
|
|
244
|
+
.children(marks.slice(0, shown).map((m) =>
|
|
245
|
+
div().flex_none().size(DOT).rounded(DOT / 2).bg(color[m] ?? t.dim)))
|
|
246
|
+
.when(rest > 0, (el) => el.child(div().flex_none().text_color(t.dim).child(`+${rest}`))))
|
|
247
|
+
.child(div().flex_none().text_color(c.count > 0 ? t.foreground : t.dim).child(String(c.text ?? "")));
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
render() {
|
|
251
|
+
const t = theme();
|
|
252
|
+
// The block and the line above it, as Usage and CPU have theirs.
|
|
253
|
+
const block = () => v_flex().size_full().bg(t.chrome).border_t(1).border_color(t.border);
|
|
254
|
+
// The sidebar's rail has room for the line alone.
|
|
255
|
+
if (narrow()) return block();
|
|
256
|
+
const sample = checking();
|
|
257
|
+
const counts = (sample ? SAMPLE.counts : this.counts) ?? [];
|
|
258
|
+
// A column of rows, with the room for a name that its longest one needs.
|
|
259
|
+
const column = (from, to) => {
|
|
260
|
+
const rows = counts.slice(from, to);
|
|
261
|
+
const name = Math.ceil(Math.max(0, ...rows.map((c) => String(c.step ?? "").length)) * NAME_CH);
|
|
262
|
+
return v_flex().flex_1().min_w(0).overflow_hidden()
|
|
263
|
+
.children(rows.map((c, i) => this.row(c, from + i, t, name)));
|
|
264
|
+
};
|
|
265
|
+
const rows = () => h_flex().flex_none().gap(COLUMN_GAP).items_start()
|
|
266
|
+
.child(column(0, LEFT))
|
|
267
|
+
.child(column(LEFT, counts.length));
|
|
268
|
+
// The one line that stands in place of the rows.
|
|
269
|
+
const line = (text, color) => div().flex_none().text_color(color).whitespace_normal().child(text);
|
|
270
|
+
let body;
|
|
271
|
+
if (sample) body = [rows(), line(NOT_OCNUS, t.dim)];
|
|
272
|
+
else if ((selected() ?? "") !== this.key) body = [line("Reading…", t.dim)];
|
|
273
|
+
else if (this.error) body = [line(this.error, t.blocked)];
|
|
274
|
+
else if (!this.space) body = [line(NOT_OCNUS, t.dim)];
|
|
275
|
+
else body = [rows()];
|
|
276
|
+
// A line height of its own, so that the four rows of the left column fit
|
|
277
|
+
// the 72px the layout gives the section, whatever the default is.
|
|
278
|
+
return block().px(14).py(6).justify_center().line_height(1.25).overflow_hidden().text_size(11)
|
|
279
|
+
.children(body);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "place": "none", "title": "Step counts" }
|