geneseed 4.30.1 → 4.31.0

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/SHIPPED.md +1 -1
  3. package/docs/concepts/footprint.md +1 -1
  4. package/docs/reference/plugin-activity.md +1 -1
  5. package/docs/web-ui.md +70 -21
  6. package/harness.config.json +1 -1
  7. package/js/README.md +3 -3
  8. package/js/web/actions.mjs +13 -23
  9. package/js/web/activity.mjs +139 -23
  10. package/js/web/api.mjs +29 -11
  11. package/js/web/catalog.mjs +108 -23
  12. package/js/web/handler.mjs +4 -3
  13. package/js/web/routes.mjs +47 -14
  14. package/js/web/server.mjs +14 -13
  15. package/js/web/state.mjs +36 -15
  16. package/js/web/usage-api.mjs +7 -3
  17. package/package.json +1 -1
  18. package/web/dist/assets/Activity-B7cFtS00.js +1 -0
  19. package/web/dist/assets/ActivityDetail-C-GbMmuW.js +1 -0
  20. package/web/dist/assets/{Bonsai-CN4rRAHc.js → Bonsai-_YyexVC5.js} +1 -1
  21. package/web/dist/assets/{CopyButton-CYljsnLo.js → CopyButton-IXnXzH4Y.js} +1 -1
  22. package/web/dist/assets/{Dashboard-DkUm4XMu.js → Dashboard-sCfEjowQ.js} +2 -2
  23. package/web/dist/assets/{Docs-DE04qOKj.js → Docs-w3Y7M5Ts.js} +2 -2
  24. package/web/dist/assets/{GreenhouseView-DPwhFO_j.js → GreenhouseView-BWWbMKmg.js} +1 -1
  25. package/web/dist/assets/Installs-CnkdJ-VA.js +3 -0
  26. package/web/dist/assets/{JournalView-DQlDC-7i.js → JournalView-C7bPD3fZ.js} +1 -1
  27. package/web/dist/assets/{KitApply-BN2Az7dc.js → KitApply-CQQbnThf.js} +1 -1
  28. package/web/dist/assets/{Kits-C9qVd466.js → Kits-aj07N7mT.js} +1 -1
  29. package/web/dist/assets/Laws-DZ38nl_H.js +3 -0
  30. package/web/dist/assets/Library-QCGXPV5h.js +2 -0
  31. package/web/dist/assets/Loops-C5u7fQOR.js +2 -0
  32. package/web/dist/assets/{OperatorHudView-CLN6Qn25.js → OperatorHudView-Blu1lqiZ.js} +1 -1
  33. package/web/dist/assets/Personal-ox_MktWO.js +2 -0
  34. package/web/dist/assets/Tabs-CIPyMAX-.js +1 -0
  35. package/web/dist/assets/api-BxjLd7Qd.js +1 -0
  36. package/web/dist/assets/index-0GCxkY7m.css +1 -0
  37. package/web/dist/assets/index-CzDi9JpF.js +3 -0
  38. package/web/dist/index.html +3 -3
  39. package/web/dist/assets/Activity-C8pQvnos.js +0 -1
  40. package/web/dist/assets/ActivityDetail-D_8Bx-QO.js +0 -1
  41. package/web/dist/assets/Installs-DmPzD4BW.js +0 -3
  42. package/web/dist/assets/Laws-T2wbwMmB.js +0 -3
  43. package/web/dist/assets/Library-t3KocV0-.js +0 -2
  44. package/web/dist/assets/Loops-6lNY-9uR.js +0 -2
  45. package/web/dist/assets/Personal-xjoSqCzr.js +0 -2
  46. package/web/dist/assets/Tabs-DaExAgql.js +0 -1
  47. package/web/dist/assets/api-LvBC0CnK.js +0 -1
  48. package/web/dist/assets/index-DhNNxhfg.js +0 -3
  49. package/web/dist/assets/index-XTGBLKQr.css +0 -1
package/CHANGELOG.md CHANGED
@@ -8,6 +8,18 @@ label. For the capability ↔ spec map, see [SHIPPED.md](SHIPPED.md).
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [4.31.0] — 2026-10-31
12
+
13
+ Minor: the web console becomes one hub over every install. The top install switch is gone; Activity, Library, Rules, Profile, Memory and Notebook cover every install, and a page or control that acts on one install has its own picker next to it. Run `geneseed web restart` after updating, so the console serves the new UI.
14
+
15
+ ### Changed
16
+ - **The web console's Activity view covers every install.** It reads the `activity/` folder of every active install (OpenCode, Claude Code, Bob, OpenClaude; global and project) and shows one garden: each card carries a host chip, shelves stay grouped by repo, and collisions and loops are found across hosts. A session that two installs record in one checkout (a global and a project install of one host) is one card. The tracking switch is one row per install, and the daemon sweeps every install's old cards. An OpenCode project install has no row of its own: its sessions appear under, and follow the switch of, the OpenCode global install.
17
+ - **The web console's Library covers every install.** Skills and agents are listed once each across every active install, with a badge for each install that has it, so a skill one install leaves out stays visible. The reader shows the first install's copy (host order, global before project) and, when several installs have the entry, a "Viewing copy from" picker for that entry only. The rail counts match the combined list.
18
+ - **The web console has no install switch any more: it is one hub over every install.** The topbar selector and `POST /api/view` are gone, and the breadcrumb is the page name. A page or control that acts on one install carries its own labelled picker next to it, shown only when two or more installs are active: Doctor, Local edits and Server each remember theirs; the Constitution's gate switches and doctrine Apply, Loops and the Voice rebuild act on the install they name. Rules, Profile, Memory and Notebook list every install, each entry tagged; an edit, Forget or Promote writes back to the entry's own install, and a new rule goes where its form's "Write to:" picker says. Every per-install figure on a combined page names its install (the gate "off" badge reads "off · claude global"). The Overview is fleet-only, with each install's voice, footprint, posture, mode and memory count in its row. A request that names no install reads the default install: the first active one in host order, global before project.
19
+
20
+ ### Fixed
21
+ - **The web console sees an OpenCode project install.** That install keeps its manifest and the skills and agents OpenCode loads under `<repo>/.opencode/`, and the console looked for the manifest only at the repo root. So it called the install "not deployed", listed the full source catalogue instead of what the install has (skills it left out included), refused Build, could jump to another install on refresh, and built its "never used" list from the root bundle. It now reads the manifest at either place, reads skills and agents from `.opencode/`, and Build rebuilds such an install in place with the same command `rebuild-all` uses. Diff and Restore are unchanged: as for every project install, no drift check exists.
22
+
11
23
  ## [4.30.1] — 2026-10-31
12
24
 
13
25
  Patch: Bob can read a protected check again (a regression in 4.29.0 and 4.30.0). Run `geneseed rebuild-all` once after updating.
package/SHIPPED.md CHANGED
@@ -20,7 +20,7 @@ historical references, not files distributed with the repo.
20
20
  > **On version numbers.** [`harness.config.json`](harness.config.json)'s `version` is a
21
21
  > human-readable label only. The canonical identity of an installed harness is the
22
22
  > **source fingerprint** stamped in `.geneseed-version` (see `geneseed version`), not the
23
- > string. Current label: **4.30.1**.
23
+ > string. Current label: **4.31.0**.
24
24
 
25
25
  ## Capabilities
26
26
 
@@ -42,7 +42,7 @@ Footprint is stored in a `.geneseed-footprint` marker in the install and kept ac
42
42
  geneseed setup
43
43
  ```
44
44
 
45
- - **Web console** — each install's own panel on the Hosts page changes its footprint and rebuilds it; Settings shows the viewed install's footprint and links there. A new install or deploy from the console starts lean, as from the command line.
45
+ - **Web console** — each install's own panel on the Hosts page changes its footprint and rebuilds it; Settings shows the footprint of the install its own picker names and links there. A new install or deploy from the console starts lean, as from the command line.
46
46
  - **Command line** — with the emit target of the install you are changing:
47
47
 
48
48
  ```bash
@@ -16,7 +16,7 @@ One of the [OpenCode plugins](opencode-plugins.md). [Environment variables](envi
16
16
 
17
17
  **Archive.** On `SessionStart` and `SessionEnd` the hook writer moves every snapshot that is no longer live into `activity/archive/`, keeping the newest 50 and none older than 7 days. `/api/activity` returns them, with the stale and dead ones still in `activity/`, in its `ended` list — capped there by the same rule, since the OpenCode plugin never sweeps.
18
18
 
19
- **What `/api/activity` returns.** `activity` (the live sessions), `ended`, and `collisions`. Each session carries the snapshot as written, plus the v2 fields: `root` (the git root of the session's own checkout, read from the session's directory: never the plugin instance's, since one `opencode serve` hosts an instance per opened project and each hears every session; `null` outside any repository), `repo` (its main worktree), `agents` (`{id, type, status, started}`), `attribution` (`false` only on a Bob session that ran a sub-agent, else `null`), `turns`, `context` (`{used, window}`), `compactions`, `compacted_at` and `context_at_compaction` (either `context` field can be `null`, right after a compaction for one), and `repo_key`, the repo (else the root) case-folded on Windows, to group a repo's sessions whatever case each host spelled it in. A v1 snapshot reads `null` for those, `[]` for `agents` and `0` for the counts. A live session also gets `files_all`, the uncapped file rows from its detail file (`files` stays the capped summary), and `loops`: `{title, iteration, status}` for each loop registered on its `root`, a finished or unreadable loop left out. `collisions` lists each `{repo, path}` that two or more writers changed among the live sessions — a writer is a session or one of its sub-agents (`{sid, by, root}`) — with `kind: "same-worktree"` when two of them share a `root`, else `"cross-worktree"`. A file outside the root is stored with `path: null` (its `file` keeps the basename) and takes no part in a collision. Roots and paths compare case-folded on Windows, and a session root is resolved to its real path before the loop join, as the loop registry stores it. `/api/activity/<id>` returns the same fields for one session, an archived one included.
19
+ **What `/api/activity` returns.** One list over every active install on the machine (each install's `activity/` folder), so it ignores a `?host=&path=` pair. It returns `enabled`, `installs`, `activity` (the live sessions), `ended`, and `collisions`. `installs` has one `{install, host, scope, path, enabled}` row per active install, in the same fixed order: `install` is the `host:scope:root` key that `/api/usage` also uses, `path` is the install root as `/api/installs` gives it, and `enabled` is that install's own on/off flag. An install that is off gives no session. The top-level `enabled` is true when any install is on, or when no install is active. `ended` keeps the newest 50 over all installs. A global and a project install of one host both record the same session (both hooks run), so the copies that share a session id and a checkout (the same `root`, case-folded on Windows, or the same `cwd` when there is no root) are one session. Its data comes from the newest copy. `installs` lists every install that recorded it in a fixed order (host order: OpenCode, Claude Code, Bob, OpenClaude; then global before project; then detection order), and `install`, the first of them, names the install the chip shows and the detail link reads. The order never follows recency, because two installs write one session milliseconds apart. The session also has a `key` (its id and its checkout, with a trailing separator dropped) that never names an install, so the console keeps the same card from poll to poll. A detail page that is already open keeps reading the install its link names. Such a session never collides with itself. The same id in two checkouts stays two sessions. Each collision writer carries `install` too. An OpenCode project install has no `installs` row: the plugin always writes its sessions and reads its on/off flag in the global OpenCode config folder, so OpenCode project sessions appear under, and follow the switch of, the OpenCode global install. Each session carries the snapshot as written, plus the v2 fields: `root` (the git root of the session's own checkout, read from the session's directory: never the plugin instance's, since one `opencode serve` hosts an instance per opened project and each hears every session; `null` outside any repository), `repo` (its main worktree), `agents` (`{id, type, status, started}`), `attribution` (`false` only on a Bob session that ran a sub-agent, else `null`), `turns`, `context` (`{used, window}`), `compactions`, `compacted_at` and `context_at_compaction` (either `context` field can be `null`, right after a compaction for one), and `repo_key`, the repo (else the root) case-folded on Windows, to group a repo's sessions whatever case each host spelled it in. A v1 snapshot reads `null` for those, `[]` for `agents` and `0` for the counts. A live session also gets `files_all`, the uncapped file rows from its detail file (`files` stays the capped summary), and `loops`: `{title, iteration, status}` for each loop registered on its `root`, a finished or unreadable loop left out. `collisions` lists each `{repo, path}` that two or more writers changed among the live sessions — a writer is a session or one of its sub-agents (`{sid, by, root, install}`), and sessions from different installs collide too — with `kind: "same-worktree"` when two of them share a `root`, else `"cross-worktree"`. A file outside the root is stored with `path: null` (its `file` keeps the basename) and takes no part in a collision. Roots and paths compare case-folded on Windows, and a session root is resolved to its real path before the loop join, as the loop registry stores it. `/api/activity/<id>?host=&path=` returns the same fields for one session of the install the pair names (the console's link carries it), an archived one included; with no pair it reads the default install (the first active one). `POST /api/activity` with `{enabled, host, path}` turns tracking on or off for that install only.
20
20
 
21
21
  **What you see.** A card per live session in **Activity** (`geneseed web`).
22
22
 
package/docs/web-ui.md CHANGED
@@ -61,16 +61,38 @@ A request can name the install it reads or writes. A read takes two query parame
61
61
  it against the same detected-install allowlist as the install toggle. An unknown or half pair
62
62
  gets a 404 and never falls through to another install's folder. The writes that take the pair
63
63
  are `/api/activity`, `/api/memory/delete`, `/api/rules`, `/api/rules/promote`, `/api/profile`,
64
- and the `restore` and `build` actions. In `/api/view`, `/api/install`, the `install` and
64
+ and the `restore` and `build` actions. In `/api/install`, the `install` and
65
65
  `deploy` actions, `/api/excludes` and `/api/reveal`, `host`/`path` keep their own meaning.
66
66
 
67
67
  Every `/api/*` read takes and checks the pair, with these exceptions:
68
68
  - `/api/ping` and `/api/jobs` ignore it.
69
69
  - The machine-wide reads also ignore it: `/api/update`, `/api/installs`, `/api/fleet`,
70
- `/api/kits`, `/api/usage`, `/api/gates`, `/api/excludes`, `/api/mcp` and `/api/loops/active`.
71
- Such a read does not check the pair, and its answer does not change with the pair.
72
-
73
- A request that names no install reads the install the topbar picker selected (`POST /api/view`).
70
+ `/api/kits`, `/api/usage`, `/api/gates`, `/api/excludes`, `/api/mcp`, `/api/loops/active`,
71
+ `/api/activity`, and the Library's skill, agent, memory and notebook lists,
72
+ `/api/catalog/skills`, `/api/catalog/agents`, `/api/catalog/memory` and
73
+ `/api/catalog/notebook`. Such a read does not check the pair, and its answer does not change
74
+ with the pair. The Activity detail (`/api/activity/<id>`) and the Activity toggle still take
75
+ the pair.
76
+
77
+ The skill, agent, memory and notebook lists read every active install (memory and notebook
78
+ entries are your own files, so a fact's Forget and Promote act on the install of the copy on
79
+ screen, and Promote writes to that install's `user-rules.md`). Each row is one id (kind and name), and
80
+ its `installs` field names the installs that have it, as `host:scope:root` keys (the same keys
81
+ as `/api/usage`). An id that only some installs have lists only those installs, so an exclusion
82
+ stays visible. The other catalog sections stay install-scoped. `/api/item/skill/<name>` and
83
+ `/api/item/agent/<name>` stay install-scoped too, because each install renders its own copy in
84
+ its own theme and footprint. With a pair, the item is that install's copy, and an id that
85
+ install lacks gets a 404. Without a pair, the item is the copy of the first install that has
86
+ it. The order is the host order (OpenCode, Claude Code, Bob, OpenClaude), then global before
87
+ project. The item's `install` field names the copy, and its `installs` field names every
88
+ install that has the id.
89
+
90
+ A request that names no install reads the **default install**: the first active one in the console's one
91
+ install order (`fleetSort`): host order (opencode, claude, bob, openclaude), then global before
92
+ project. `/api/installs` marks
93
+ that row `default: true`. There is no console-wide install and no `POST /api/view`: a page that
94
+ acts on one install names it on each request, through a picker placed beside the entry or form it
95
+ applies to (see below).
74
96
  Each named install keeps its own cached doctor run and inventory, and a mutation refreshes all
75
97
  of them.
76
98
 
@@ -87,9 +109,20 @@ The left rail mirrors the harness's own shape:
87
109
 
88
110
  At the foot of the rail sits a **vitals** card — the doctor's verdict, drift, how long ago the
89
111
  harness was built, and a Voice button — so those facts are on screen from every page. It is
90
- hidden where the rail collapses to icons (≤960px) and returns with the phone drawer. When two
91
- or more installs are active, the topbar's first breadcrumb is the picker for the install the
92
- console views.
112
+ hidden where the rail collapses to icons (≤960px) and returns with the phone drawer. The topbar's
113
+ breadcrumb starts at the page: it names no install.
114
+
115
+ **Install pickers.** The console has no install switch. Where a page acts on one install, an
116
+ `InstallPicker` sits beside what it applies to, labelled for it (*Write to:*, *Doctor for:*), and
117
+ starts on the default install; with one active install it is not shown. Rules and Profile list
118
+ every active install's entries together, each tagged with its install, and write back to the
119
+ install an entry came from; so do Memory and Notebook, whose Forget and Promote act on the
120
+ install of the copy on screen. Doctor, Local edits, Server, the Constitution (*Constitution of:*,
121
+ for its gate switches and doctrine Apply), Loops (*Templates and bricks of:*) and the rail's Voice
122
+ popover (*Rebuild:*) each keep their own pick (in the browser's localStorage). The Overview is
123
+ fleet-wide: each install's own facts (voice, footprint, posture, mode, memory facts, drift) sit on
124
+ its row, and a figure still read off the default install (a suggestion, a tab badge, an older
125
+ Overview view, Personal's Rule budget) names that install once two or more are active.
93
126
 
94
127
  A global **Spotlight** search lives in the topbar — press <kbd>/</kbd> to focus it (or
95
128
  <kbd>Ctrl</kbd>/<kbd>⌘</kbd>+<kbd>K</kbd>, which also works from inside a text field), type
@@ -124,7 +157,9 @@ streams the output of background jobs and keeps their history across reloads.
124
157
 
125
158
  - **Rules** (`#/rules`) — your own standing rules, read from and written to the
126
159
  `user-rules.md` beside the deployed AGENT.md (the seed-once file no update ever
127
- touches). List with scope (project/global — a hand-written `user` opens as global — or any other scope written by hand, which a
160
+ touches) of every active install, listed together and tagged with their install; an edit,
161
+ graduate or retire writes back to the rule's own install, and a new rule goes to the install
162
+ its form's *Write to:* picker names. List with scope (project/global — a hand-written `user` opens as global — or any other scope written by hand, which a
128
163
  save keeps as written) and trial chips, add/edit/retire forms (retire moves the rule to `user-rules-retired.md`, which is never loaded; its id is never reused) (a body line starting
129
164
  `## ` is refused: the file would read it as a new rule heading), a
130
165
  **Graduate** action that adopts a trial rule for good, and a budget meter that turns
@@ -176,8 +211,10 @@ streams the output of background jobs and keeps their history across reloads.
176
211
  for *mutate*, *human gate*, what they override and *unavailable*; the reader shows the
177
212
  frontmatter facts (outcomes as pills, availability with its reason), then the body rendered as
178
213
  markdown, with a **View source** toggle for the file as parsed, frontmatter and all. Templates and
179
- Bricks read `GET /api/loops`, resolved from the selected install's root, so a project
180
- install shows its `.geneseed/` bricks and templates. **Active** is every loop
214
+ Bricks read `GET /api/loops` for the install the page's *Templates and bricks of:* picker
215
+ names (its own remembered pick, starting on the default; hidden with one install and on
216
+ Active), resolved from that install's root, so a project install shows its `.geneseed/` bricks
217
+ and templates. **Active** is every loop
181
218
  `geneseed loop init` registered on this machine (`GET /api/loops/active`, polled every
182
219
  5 s), grouped awaiting, running, done/stopped, finished/unreadable; the reader shows its
183
220
  branch, `iteration N / max`, current node and a preset picker (`POST /api/loops/preset`,
@@ -185,11 +222,15 @@ streams the output of background jobs and keeps their history across reloads.
185
222
  human gate, with its node) — the answer is given in the agent's session, never here — and
186
223
  its ring with the current node filled, with its iteration history under it.
187
224
  - **Profile** (`#/profile`) — `PROFILE.md` beside the deployed AGENT.md: who you are and
188
- how you like to work. Opens rendered; **Edit** is a whole-file editor. The save carries
225
+ how you like to work, one card per active install, each saving to its own. Opens rendered; **Edit** is a whole-file editor. The save carries
189
226
  the fingerprint it loaded — if an agent session changed the file first, your edit stays
190
227
  on screen and a second Save replaces the newer version.
191
- - **Skills** (`#/skills`) and **Agents** (`#/agents`) — the deployed catalogue, each entry
192
- with its purpose line and full spec. While Skills is selected, its skill types sit nested
228
+ - **Skills** (`#/skills`) and **Agents** (`#/agents`) — the deployed catalogue of every
229
+ installed harness, each entry with its purpose line and full spec. Each row is one skill or
230
+ agent; when more than one install is active, it carries a badge for each install that has it
231
+ (`opencode · global`; a project install by its folder). The reader shows the first install's copy. When more installs have the entry,
232
+ a **Viewing copy from** picker beside the copy opens another install's version, for that
233
+ entry only. While Skills is selected, its skill types sit nested
193
234
  under it in the rail, each with its count, above a thin bar of their shares; pick one to
194
235
  narrow the list.
195
236
  - **Docs** (`#/docs`) — rendered documentation: markdown pages, concept pages, a CLI
@@ -205,8 +246,16 @@ streams the output of background jobs and keeps their history across reloads.
205
246
 
206
247
  ### 🩺 Care
207
248
 
208
- - **Activity** (`#/activity`) — the agent sessions on this machine: each one's status,
209
- the files it touched and its todo progress; open one for its detail. Sessions that ended in the last 7 days are listed under
249
+ - **Activity** (`#/activity`) — the agent sessions on this machine, from every active install
250
+ in one view: each one's status, the files it touched and its todo progress; open one for its
251
+ detail. Each card has a chip that names its install: the host, then the scope when a host has
252
+ two installs, then the project folder when a host has two project installs, and more of the
253
+ folder's path (up to the whole path) when two folders have the same name. A session that two
254
+ installs of one host both recorded is one card. Its chip and link name the first of those
255
+ installs in a fixed order (host order, then global before project), so they do not change
256
+ between polls. Tracking is on or off per install: the tracking
257
+ card has one switch per install, and each switch changes only that install. OpenCode project
258
+ installs have no switch: their sessions appear under, and follow, the OpenCode global switch. Sessions that ended in the last 7 days are listed under
210
259
  **Recently ended**, below the live ones. Every host records it:
211
260
  the OpenCode plugin, and `geneseed-hook activity` on Claude Code, OpenClaude and Bob.
212
261
  The live sessions open in the **Garden** by default; a **List | Garden** switch (kept in the
@@ -227,17 +276,17 @@ streams the output of background jobs and keeps their history across reloads.
227
276
  you) fold into chips, the largest first; the last standing shelf never folds. **Sakura** repaints the crowns pink, nothing more.
228
277
  A session's detail page shows its tree too, live or ended, with the same pad hovers and a
229
278
  legend of its turns, context, compactions and sub-agents; an ended session's tree stands still, without the `!`.
230
- - **Changes** (`#/diff`) — the diff between the deployed harness and the source: edited /
279
+ - **Changes** (`#/diff`) — the diff between the install its *Local edits of:* picker names and the source: edited /
231
280
  added / missing files, and files only behind the source (unedited; a rebuild updates them)
232
281
  listed apart under **Behind source**, with per-file expansion and coloured unified-diff lines. Select
233
282
  files to **export an `improvements.md`** back-port, or **restore** them to source.
234
283
  Restore acts only on files the diff lists, and never on your own files (`user-rules.md`,
235
284
  `PROFILE.md`, `memory/`, `notebook/`). An added file is moved into
236
285
  `archived-restore/<date-time>/` in the install, not deleted.
237
- - **Doctor** (`#/doctor`) — runs the same health engine as the `doctor` command (every
286
+ - **Doctor** (`#/doctor`) — runs, for the install its *Doctor for:* picker names, the same health engine as the `doctor` command (every
238
287
  theme, parity, links, authoring gates, drift), grouping any problems per check. It shows
239
- the server's last run — warmed at start, redone after a job, an install toggle or a view
240
- switch — and **Re-run checks** runs every check again on demand.
288
+ the server's last run for that install — warmed at start, redone after a job or an install
289
+ toggle — and **Re-run checks** runs every check again on demand.
241
290
 
242
291
  ### 🎨 Setup
243
292
 
@@ -276,7 +325,7 @@ streams the output of background jobs and keeps their history across reloads.
276
325
  - **Server** (`#/installs/server`; `#/settings` and `#/about` resolve here) — a settings sheet
277
326
  with a section index. **Appearance**: skin, accent (a skin change resets it to the skin's own), Overview view. **Machine**:
278
327
  version + Update (labelled by how this copy updates: git pull, npm install -g, or the command
279
- to run by hand), Add to PATH, the viewed install's footprint (read-only, links to Hosts). **Server**: running · port ·
328
+ to run by hand), Add to PATH, the footprint of the install the head's *Footprint of:* picker names (read-only, links to Hosts). **Server**: running · port ·
280
329
  pid · uptime, whether the code matches the disk (with Restart), start-at-login state (read
281
330
  only), and the four request guards; the index marks Server with a good/warn dot. **About**: version, changelog, credits, source, creator.
282
331
  **Danger zone**: Stop server, Remove from PATH, and a pointer to each install's own
@@ -2,5 +2,5 @@
2
2
  "_comment": "version is a human-readable release label only; the canonical identity of an installed harness is the source fingerprint stamped in .geneseed-version (see `harness version`), not this string.",
3
3
  "theme": "neutral",
4
4
  "product": "Geneseed",
5
- "version": "4.30.1"
5
+ "version": "4.31.0"
6
6
  }
package/js/README.md CHANGED
@@ -240,8 +240,8 @@ the deployed harness as JSON.
240
240
  | `server.mjs` | `serve()`/`cmdWeb`: UI-build precheck, socket bind, token mint, daemon record wiring |
241
241
  | `routes.mjs` | The route tables — `STATE_ROUTES`, `PREFIX_ROUTES`, `POST_ROUTES` (+ its 409 column) — and the inline lists |
242
242
  | `handler.mjs` | One function per request: per-request install (`?host=&path=` on every read but `MACHINE_GETS`, or the body on `VIEW_POSTS`), dispatch, gzip, `requestGuard` (Host+port, Origin/Sec-Fetch-Site on `/api`, constant-time CSRF token) and body cap (before the body is read), `securityHeaders` (CSP nonce, framing), static SPA fallback |
243
- | `state.mjs` | `webState` — the resolved install view every endpoint reads, with its cached inventory and doctor; per-install views (`installView` in `actions.mjs`) hang off it, pinned, refreshed with it |
244
- | `catalog.mjs` | The Library read model: inventory, constitution tiers, memory/notebook/wiki/config items, `apiCatalog`/`apiItem`, `NotFound` |
243
+ | `state.mjs` | `webState` — the resolved install view every endpoint reads, with its cached inventory and doctor, `defaultView` (the install a request naming none reads) and `fleetSort` (the one install order); per-install views (`installView` in `actions.mjs`) hang off it, pinned, refreshed with it |
244
+ | `catalog.mjs` | The Library read model: inventory, constitution tiers, memory/notebook/wiki/config items, `apiCatalog`/`apiItem`, `NotFound`. Skills and agents are listed across every active install (`FLEET_SECTIONS`; `routes.mjs` builds the fleet), each item served from one install's copy |
245
245
  | `api.mjs` | The dashboard and settings reads: overview, recent, themes, setup, doctor, diff, installs, excludes, loops |
246
246
  | `update-check.mjs` | Is a newer release on npm? Answers from memory, refreshes in the background (a day when it got an answer, an hour when it did not), `null` on any failure, never asked under `node --test` |
247
247
  | `gates-api.mjs` | `GET /api/gates`: gate asks per rule per day over 30 days, read off every installed harness's `notebook/gates.jsonl` (the Overview's sparklines) |
@@ -251,7 +251,7 @@ the deployed harness as JSON.
251
251
  | `daemon.mjs` | Detached web start/stop/status/restart, the `.geneseed-web.json` record, and `openUrl` |
252
252
  | `jobs.mjs` | `JobManager` and the action→argv table. The only module here that spawns job children |
253
253
  | `docs.mjs` | The Docs tab: the `docs/<folder>/` page registry, `?harness=` filtering, link rewriting, the six page kinds |
254
- | `activity.mjs` | The `activity/` session files: pid-liveness prune, list, detail, and the on/off flag |
254
+ | `activity.mjs` | The `activity/` session files of every active install: one merged list (`activitySummary`), the per-install detail and on/off flag, and the daemon's sweep over all installs (`sweepInstalls`) |
255
255
 
256
256
  **Before editing:** `makeHandler(state, jm, token, dist, holder)`'s arity is load-bearing — three
257
257
  test call sites construct one directly and drive it without a socket. `routes.mjs`'s tables
@@ -177,7 +177,8 @@ function bodyAxes(body, dflt) {
177
177
 
178
178
  /**
179
179
  * The DETECTED install a body's (host, path) pair names — `[host, scope, root]` — or a
180
- * `NotFound`. THE ALLOWLIST three endpoints share (view select, rebuild, deactivate/remove), and
180
+ * `NotFound`. THE ALLOWLIST every install-naming endpoint shares (a per-request install, rebuild,
181
+ * deactivate/remove), and
181
182
  * one copy of it: two copies of a security check drift, and the copy that drifts is the one
182
183
  * nobody re-read.
183
184
  *
@@ -195,8 +196,7 @@ function detectedInstall(body) {
195
196
 
196
197
  /**
197
198
  * The state a request reads: the install its `{host, path}` names, or `base` (the daemon's
198
- * own, the topbar selector's view) when it names neither — so a client that sends no install
199
- * keeps today's answers.
199
+ * own, on the default install, `defaultView`) when it names neither.
200
200
  *
201
201
  * NAMING ONE IS AN ALLOWLIST LOOKUP, EVERY TIME: `detectedInstall` runs on a cache hit too, so
202
202
  * a half pair, an unknown pair or an install removed since is a `NotFound` (404), never a fall
@@ -207,7 +207,15 @@ function detectedInstall(body) {
207
207
  */
208
208
  export function installView(base, sel) {
209
209
  if (bget(sel, 'host') == null && bget(sel, 'path') == null) return base;
210
- const [host, scope, root] = detectedInstall(sel);
210
+ return targetView(base, detectedInstall(sel));
211
+ }
212
+
213
+ /**
214
+ * The cached view of one `[host, scope, root]` that `installTargets()` yielded — the allowlist
215
+ * already passed, so a caller holding a whole scan (the Library's fleet, `routes.mjs`) makes no
216
+ * second scan per install. Never call it with a pair a request supplied: that is `installView`.
217
+ */
218
+ export function targetView(base, [host, scope, root]) {
211
219
  const key = JSON.stringify([host, String(root)]);
212
220
  let v = base._views.get(key);
213
221
  if (v === undefined) {
@@ -472,24 +480,6 @@ export function mcpTargetPaths() {
472
480
  return known;
473
481
  }
474
482
 
475
- // ---- the harness selector ------------------------------------------------------------------
476
-
477
- /**
478
- * Re-point the whole console at a detected install.
479
- *
480
- * The (host, path) PAIR must be one of the detected targets, and the ROOT is threaded through
481
- * beside the data dir: markers and sigils live at the install root, not in the data dir, and
482
- * without it a claude/bob PROJECT view mis-detects as opencode/neutral.
483
- *
484
- * The pair is SERIALISED into the key rather than concatenated with a separator: the path
485
- * comes straight out of a request body, and any separator it could contain would let one
486
- * pair impersonate another in a lookup whose whole job is to be an allowlist.
487
- */
488
- export function apiSelectView(state, body) {
489
- const [host, scope, root] = detectedInstall(body);
490
- state.selectView(viewCfg(host, scope, root), root);
491
- return { ok: true, target: state.target, theme: state.theme, emit: state.emit };
492
- }
493
483
 
494
484
  // ---- restore, and the two build-command resolvers ---------------------------------------
495
485
 
@@ -706,7 +696,7 @@ const EMIT_FOR = new Map([
706
696
  * already-active one (an in-place re-emit, the same command either way).
707
697
  *
708
698
  * The (host, path) pair MUST be one of the detected targets — the same allowlist
709
- * `apiSelectView` uses, and the reason the target is never built from raw body input — and
699
+ * `installView` uses, and the reason the target is never built from raw body input — and
710
700
  * it must not be `disabled` (reactivate first). Every other field follows the same rule: a
711
701
  * VALID picked value wins, else the install's own, so a re-theme never silently flips the
712
702
  * footprint, the register or the mode, and a bogus body value cannot reach the argv.
@@ -17,6 +17,17 @@
17
17
  * returned, to the archive's own rule (the newest `ARCHIVE_KEEP`, none older than
18
18
  * `ARCHIVE_MAX_AGE_SECONDS`) — without touching a file.
19
19
  *
20
+ * ONE GARDEN OVER EVERY ACTIVE INSTALL. `apiActivity` is machine-wide, like `/api/usage`: it reads
21
+ * `<viewCfg(install)>/activity` of each active install (`activeInstalls`) and merges the cards.
22
+ * Each card, ended row and collision writer carries `install`, the same `host:scope:root` string
23
+ * `/api/usage` keys its rows by; the top-level `installs[]` maps it to `{host, scope, path,
24
+ * enabled}`, `path` being the root verbatim, so a client names the install back (`?host=&path=`)
25
+ * without parsing a key whose Windows root holds a `:`. One session two installs both recorded
26
+ * is one card (`mergeCopies`), which lists them in `installs`. Collisions and the loop join run ONCE over
27
+ * the merged live list, so a claude and an opencode session on one file are a collision. The
28
+ * on/off flag stays per install: the detail (`/api/activity/<sid>`) and the toggle read the
29
+ * install the request names, through `installView`.
30
+ *
20
31
  * `/api/activity` answers a GET through `apiActivity` and a POST through `apiActivityToggle`
21
32
  * at the bottom of this file. It is the one POST route whose result is sent at 200 whatever
22
33
  * `ok` says, which is why `POST_ROUTES` in `js/web/routes.mjs` carries a 409 COLUMN rather
@@ -43,9 +54,11 @@ import { readText, writeText, isDir, isFile } from '../lib/fs.mjs';
43
54
  import { parseJson, isTruthy } from '../lib/json.mjs';
44
55
  import { normcase } from '../lib/paths.mjs';
45
56
  import { stripWhitespace } from '../lib/text.mjs';
46
- import { ARCHIVE_KEEP, ARCHIVE_MAX_AGE_SECONDS, isLive, safeStem } from '../hosts/activity.mjs';
57
+ import { ARCHIVE_KEEP, ARCHIVE_MAX_AGE_SECONDS, isLive, safeStem, sweepActivity } from '../hosts/activity.mjs';
58
+ import { installState, installTargets } from '../hosts/installs.mjs';
47
59
  import { runningLoops } from '../loop/registry.mjs';
48
60
  import { NotFound, stemOf } from './catalog.mjs';
61
+ import { fleetSort, viewCfg } from './state.mjs';
49
62
 
50
63
  const nowSeconds = () => Date.now() / 1000;
51
64
 
@@ -59,6 +72,30 @@ const activityDir = (state) => path.join(state.target, 'activity');
59
72
  /** The runtime on/off flag — the same path the plugin resolves. */
60
73
  const activityFlag = (state) => path.join(state.target, '.geneseed-activity');
61
74
 
75
+ /**
76
+ * Each active install that records activity, as `{install, host, scope, path, dir}`; `install` is
77
+ * usage-api's key. An OpenCode PROJECT install is left out: the OpenCode plugin writes its cards and
78
+ * reads its `.geneseed-activity` flag in the GLOBAL OpenCode config dir whichever install loaded it,
79
+ * so a project row would hold an empty dir and a switch nobody reads. Its sessions appear under, and
80
+ * follow the switch of, the OpenCode global row. `installState` runs per install inside a catch: one
81
+ * broken install is skipped, never a blank garden. Rows come in the fixed order below.
82
+ */
83
+ function installRows(targets) {
84
+ const rows = [];
85
+ for (const [host, scope, root] of targets) {
86
+ if (host === 'opencode' && scope !== 'global') continue;
87
+ let active;
88
+ try { active = installState(root, host, scope) === 'active'; } catch { continue; }
89
+ if (active) {
90
+ rows.push({ install: `${host}:${scope}:${root}`, host, scope, path: String(root),
91
+ dir: viewCfg(host, scope, root) });
92
+ }
93
+ }
94
+ // The fleet's FIXED order (`fleetSort`). A merged card's primary install is the first of its
95
+ // installs in it.
96
+ return fleetSort(rows, (r) => [r.host, r.scope]);
97
+ }
98
+
62
99
  /**
63
100
  * On unless the flag file explicitly says off. An absent (or unreadable) file is the
64
101
  * default every user who has never toggled is in. An undecodable flag file is not treated
@@ -169,7 +206,8 @@ function loopsByRoot(sessions) {
169
206
  */
170
207
  function collisionsOf(sessions) {
171
208
  const byFile = new Map();
172
- const ordered = [...sessions].sort((a, b) => (String(a.session_id) < String(b.session_id) ? -1 : 1));
209
+ const idOf = (s) => s.key ?? `${s.install ?? ''}\0${s.session_id}`;
210
+ const ordered = [...sessions].sort((a, b) => (idOf(a) < idOf(b) ? -1 : 1));
173
211
  for (const s of ordered) {
174
212
  const repo = typeof s.repo === 'string' ? s.repo : s.root;
175
213
  if (typeof repo !== 'string') continue;
@@ -178,14 +216,17 @@ function collisionsOf(sessions) {
178
216
  const key = `${normcase(repo)}\0${normcase(f.path)}`;
179
217
  if (!byFile.has(key)) byFile.set(key, { repo, path: f.path, writers: new Map() });
180
218
  const by = f.by ?? null;
181
- byFile.get(key).writers.set(`${s.session_id}\0${by}`, { sid: s.session_id, by, root: s.root });
219
+ // Keyed by install too. Copies of one session in one checkout are already one card
220
+ // (`mergeCopies`); an id left in two installs is two checkouts, so two writers.
221
+ byFile.get(key).writers.set(`${idOf(s)}\0${by}`,
222
+ { sid: s.session_id, by, root: s.root, install: s.install ?? null, key: s.key ?? null });
182
223
  }
183
224
  }
184
225
  const out = [];
185
226
  for (const { repo, path: p, writers } of byFile.values()) {
186
227
  if (writers.size < 2) continue;
187
- const list = [...writers.values()].sort((a, b) => (
188
- `${a.sid}\0${a.by ?? ''}` < `${b.sid}\0${b.by ?? ''}` ? -1 : 1));
228
+ const wk = (w) => `${w.sid}\0${w.install ?? ''}\0${w.by ?? ''}`;
229
+ const list = [...writers.values()].sort((a, b) => (wk(a) < wk(b) ? -1 : 1));
189
230
  const roots = list.map((w) => (typeof w.root === 'string' ? normcase(w.root) : null));
190
231
  const shared = roots.some((r, i) => r !== null && roots.indexOf(r) !== i);
191
232
  out.push({ repo, path: p, writers: list, kind: shared ? 'same-worktree' : 'cross-worktree' });
@@ -228,28 +269,38 @@ function snapshots(d) {
228
269
  const newestFirst = (list) => list.sort((a, b) => Number(b.updated_at) - Number(a.updated_at));
229
270
 
230
271
  /**
231
- * `{activity, ended}`: the live sessions, and the ones that are not — still in the directory
232
- * or already archived — each listed once, the live copy and then the directory's winning.
272
+ * A session's identity across installs, and the card's `key`: its id plus its checkout, `root`
273
+ * (else `cwd`) case-folded where the platform folds and with any trailing separator dropped, so
274
+ * `C:\w\main\` is `C:\w\main`. It never names an install, so it holds still when the shown copy moves.
233
275
  */
234
- function activityEntries(state) {
235
- const d = activityDir(state);
236
- const now = nowSeconds();
276
+ const sessionKey = (e) => {
277
+ const w = typeof e.root === 'string' ? e.root : e.cwd;
278
+ return `${e.session_id}\0${typeof w === 'string' ? normcase(w).replace(/[\\/]+$/, '') : ''}`;
279
+ };
280
+
281
+ /**
282
+ * `{live, ended}` of ONE activity dir, each card tagged with `install`: the live sessions, and
283
+ * the ones that are not — still in the directory or already archived — each listed once, the
284
+ * live copy and then the directory's winning. Per install, so a live claude `s1` never hides an
285
+ * ended opencode `s1`. Neither loops nor collisions here: those join the merged list.
286
+ */
287
+ function dirEntries(d, install, now) {
237
288
  const live = [];
238
289
  const ended = [];
239
290
  const seen = new Set();
240
291
  const rest = [];
241
292
  for (const [name, entry] of snapshots(d)) {
242
- const e = normalizeEntry(entry, stemOf(name));
293
+ const n = normalizeEntry(entry, stemOf(name));
294
+ const e = /** @type {Record<string, any>} */ ({ ...n, install, installs: [install], key: sessionKey(n) });
243
295
  if (isLive(entry, now)) {
244
296
  e.files_all = allFiles(d, stemOf(name), e);
245
297
  live.push(e);
246
298
  seen.add(String(e.session_id));
247
299
  } else rest.push(e);
248
300
  }
249
- const loops = loopsByRoot(live);
250
- for (const e of live) e.loops = typeof e.root === 'string' ? loops.get(loopKey(e.root)) ?? [] : [];
251
301
  for (const [name, entry] of snapshots(path.join(d, 'archive'))) {
252
- rest.push(normalizeEntry(entry, stemOf(name)));
302
+ const n = normalizeEntry(entry, stemOf(name));
303
+ rest.push({ ...n, install, installs: [install], key: sessionKey(n) });
253
304
  }
254
305
  for (const e of rest) {
255
306
  if (seen.has(String(e.session_id))) continue;
@@ -257,21 +308,86 @@ function activityEntries(state) {
257
308
  if (now - Number(e.updated_at) > ARCHIVE_MAX_AGE_SECONDS) continue;
258
309
  ended.push({ ...e, ended: true });
259
310
  }
260
- return {
261
- activity: newestFirst(live),
262
- ended: newestFirst(ended).slice(0, ARCHIVE_KEEP),
263
- collisions: collisionsOf(live),
264
- };
311
+ return { live, ended };
265
312
  }
266
313
 
267
- export function apiActivity(state) {
268
- const enabled = activityEnabled(state);
314
+ /**
315
+ * One card per session. A global and a project install of one Claude-shaped host both run
316
+ * `geneseed-hook activity --root <own install>` for the same session, so the same session lands in
317
+ * two dirs. Copies with an equal `key` (`sessionKey`: id and checkout) are ONE card. Its DATA is
318
+ * the newest `updated_at`'s copy; its `installs` are every install that saw it and its `install`
319
+ * (the chip, and the install the detail link reads) the first of them, both in the fixed order of
320
+ * `rank` (`installRows`'s order) — never by recency, since two installs write one session within
321
+ * milliseconds and the newest copy can change between two polls. A live copy also absorbs an ended
322
+ * copy elsewhere, but a live card's `install` is the first install holding a LIVE copy: a stale
323
+ * ended copy would send the detail link to a session shown as ended. Without this the session
324
+ * would collide with itself.
325
+ */
326
+ function mergeCopies(live, ended, rank) {
327
+ const by = new Map();
328
+ const keep = (list) => newestFirst(list).filter((e) => {
329
+ const had = by.get(e.key);
330
+ if (!had) { by.set(e.key, e); return true; }
331
+ if (!had.installs.includes(e.install)) had.installs.push(e.install);
332
+ return false;
333
+ });
334
+ const byRank = (x, y) => rank.get(x) - rank.get(y);
335
+ const out = { live: keep(live) };
336
+ const liveIn = new Map(out.live.map((e) => [e.key, [...e.installs]]));
337
+ out.ended = keep(ended);
338
+ for (const e of by.values()) {
339
+ e.installs.sort(byRank);
340
+ e.install = (liveIn.get(e.key)?.sort(byRank) ?? e.installs)[0];
341
+ }
342
+ return out;
343
+ }
344
+ /**
345
+ * GET /api/activity, machine-wide: `{enabled, installs[], activity, ended, collisions}` over every
346
+ * active install in `targets`. An install whose flag is off contributes no card. `enabled` is
347
+ * true when ANY install tracks (or none is active), so the Overview's "tracking is off" notice
348
+ * fires only once every install is off. `ended` is capped after the merge, to one archive's rule.
349
+ */
350
+ export function activitySummary({ targets = installTargets() } = {}) {
351
+ const now = nowSeconds();
352
+ const installs = [];
353
+ const live = [];
354
+ const ended = [];
355
+ for (const { dir, ...row } of installRows(targets)) {
356
+ const enabled = activityEnabled({ target: dir });
357
+ installs.push({ ...row, enabled });
358
+ if (!enabled) continue;
359
+ const got = dirEntries(path.join(dir, 'activity'), row.install, now);
360
+ live.push(...got.live);
361
+ ended.push(...got.ended);
362
+ }
363
+ const one = mergeCopies(live, ended, new Map(installs.map((i, n) => [i.install, n])));
364
+ const loops = loopsByRoot(one.live);
365
+ for (const e of one.live) e.loops = typeof e.root === 'string' ? loops.get(loopKey(e.root)) ?? [] : [];
269
366
  return {
270
- enabled,
271
- ...(enabled ? activityEntries(state) : { activity: [], ended: [], collisions: [] }),
367
+ enabled: installs.length === 0 || installs.some((i) => i.enabled),
368
+ installs,
369
+ activity: one.live,
370
+ ended: one.ended.slice(0, ARCHIVE_KEEP),
371
+ collisions: collisionsOf(one.live),
272
372
  };
273
373
  }
274
374
 
375
+ export const apiActivity = () => activitySummary();
376
+
377
+ /**
378
+ * Archive the ended sessions of every active install (`sweepActivity`), each on its own: one
379
+ * unreadable dir never skips the rest. The daemon runs it at start and every 10 minutes, and
380
+ * re-reads the installs each time, so an install added since is swept too. Only ACTIVE installs are
381
+ * swept (installRows): a disabled or absent install's `activity/` is left as it is.
382
+ */
383
+ export function sweepInstalls({ targets = installTargets() } = {}) {
384
+ let rows;
385
+ try { rows = installRows(targets); } catch { return; }
386
+ for (const { dir } of rows) {
387
+ try { sweepActivity(path.join(dir, 'activity')); } catch { /* best-effort */ }
388
+ }
389
+ }
390
+
275
391
  /**
276
392
  * One session's snapshot plus its step timeline and its UNCAPPED files/todos. A session that is
277
393
  * no longer live — still in the directory, or archived — is returned too, with `ended: true`.