geneseed 4.32.0 → 5.0.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 (245) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/DESIGN.md +2 -2
  3. package/README.md +6 -5
  4. package/SHIPPED.md +4 -3
  5. package/adapters/bob/README.md +6 -5
  6. package/adapters/claude-code/README.md +4 -3
  7. package/adapters/claude-code/skills/geneseed/SKILL.md +1 -1
  8. package/adapters/openclaude/README.md +4 -3
  9. package/adapters/opencode/GLOBAL-HARNESS-SPEC.md +3 -1
  10. package/adapters/opencode/HOW-OPENCODE-LOADS.md +2 -1
  11. package/adapters/opencode/README.md +18 -18
  12. package/adapters/opencode/plugins/geneseed-activity.js +57 -1
  13. package/adapters/opencode/plugins/geneseed-context.js +85 -18
  14. package/adapters/opencode/plugins/geneseed-guard.js +437 -76
  15. package/adapters/opencode/plugins/geneseed-learn.js +97 -23
  16. package/bin/geneseed-cli.mjs +17 -25
  17. package/bin/geneseed-hook.mjs +23 -8
  18. package/docs/DESIGN.md +175 -0
  19. package/docs/PRD.md +111 -0
  20. package/docs/README.md +3 -2
  21. package/docs/architecture.md +145 -0
  22. package/docs/concepts/agents.md +1 -1
  23. package/docs/concepts/collaboration.md +1 -1
  24. package/docs/concepts/enforcement-table.md +1 -1
  25. package/docs/concepts/exclusions.md +5 -5
  26. package/docs/concepts/footprint.md +1 -1
  27. package/docs/concepts/foreman-mode.md +2 -2
  28. package/docs/concepts/hooks.md +22 -8
  29. package/docs/concepts/host-matrix.md +2 -2
  30. package/docs/concepts/hosts.md +1 -1
  31. package/docs/concepts/kits.md +3 -1
  32. package/docs/concepts/ownership.md +1 -1
  33. package/docs/concepts/rules.md +15 -2
  34. package/docs/concepts/shared-tier.md +73 -0
  35. package/docs/concepts/skills.md +2 -2
  36. package/docs/concepts/themes.md +1 -1
  37. package/docs/extending.md +13 -12
  38. package/docs/guides/install-claude-code.md +1 -1
  39. package/docs/guides/install-opencode.md +1 -1
  40. package/docs/guides/migrate.md +4 -2
  41. package/docs/guides/project-context.md +2 -2
  42. package/docs/guides/setup-footprint.md +1 -1
  43. package/docs/guides/uninstall.md +2 -1
  44. package/docs/guides/upgrade-to-5.md +116 -0
  45. package/docs/guides/upgrade.md +21 -9
  46. package/docs/guides/wiki.md +3 -3
  47. package/docs/reference/env-context.md +5 -3
  48. package/docs/reference/environment.md +1 -1
  49. package/docs/reference/glossary.md +2 -0
  50. package/docs/reference/opencode-plugins.md +3 -3
  51. package/docs/reference/plugin-activity.md +1 -1
  52. package/docs/reference/plugin-context.md +1 -0
  53. package/docs/reference/plugin-guard.md +14 -6
  54. package/docs/reference/plugin-learn.md +13 -6
  55. package/docs/reference/troubleshoot-hooks.md +3 -3
  56. package/docs/reference/troubleshoot-update.md +14 -0
  57. package/docs/token-footprint.md +4 -3
  58. package/docs/understand/a-day.md +2 -2
  59. package/docs/understand/design-choices-install.md +2 -1
  60. package/docs/understand/enforced-vs-asked.md +1 -1
  61. package/docs/understand/machine-bob.md +2 -0
  62. package/docs/understand/machine-claude.md +7 -5
  63. package/docs/understand/machine-opencode.md +7 -5
  64. package/docs/understand/on-your-machine.md +4 -0
  65. package/docs/understand/take-it-out.md +1 -1
  66. package/docs/web-ui.md +126 -68
  67. package/harness.config.json +1 -1
  68. package/js/README.md +10 -6
  69. package/js/build/args.mjs +10 -8
  70. package/js/build/bundle.mjs +11 -13
  71. package/js/build/driver.mjs +66 -65
  72. package/js/build/emit-claude.mjs +22 -16
  73. package/js/build/emit-common.mjs +4 -5
  74. package/js/build/emit-opencode.mjs +22 -22
  75. package/js/build/fold.mjs +515 -0
  76. package/js/build/generate.mjs +41 -52
  77. package/js/build/render.mjs +115 -29
  78. package/js/build/source.mjs +4 -1
  79. package/js/build/stubs.mjs +70 -9
  80. package/js/build/version.mjs +10 -10
  81. package/js/cli-table.json +23 -83
  82. package/js/hosts/activity.mjs +2 -2
  83. package/js/hosts/geneseed-dir.mjs +1 -1
  84. package/js/hosts/hooks-context.mjs +389 -99
  85. package/js/hosts/hooks-learn.mjs +38 -7
  86. package/js/hosts/hooks-prims.mjs +4 -2
  87. package/js/hosts/hooks.mjs +114 -39
  88. package/js/hosts/hosts.mjs +150 -51
  89. package/js/hosts/installs.mjs +55 -167
  90. package/js/hosts/link.mjs +3 -5
  91. package/js/hosts/mcp.mjs +1 -1
  92. package/js/hosts/memory-files.mjs +219 -17
  93. package/js/hosts/ownership-gate.mjs +1 -1
  94. package/js/hosts/settings.mjs +18 -13
  95. package/js/hosts/shim.mjs +4 -33
  96. package/js/hosts/store-watch.mjs +189 -0
  97. package/js/inspect/checks-authoring.mjs +3 -3
  98. package/js/inspect/checks-build.mjs +45 -18
  99. package/js/inspect/checks-counts.mjs +4 -4
  100. package/js/inspect/checks-repo.mjs +13 -14
  101. package/js/inspect/cost.mjs +24 -2
  102. package/js/inspect/diff.mjs +123 -123
  103. package/js/inspect/doctor.mjs +22 -27
  104. package/js/inspect/excludes.mjs +181 -62
  105. package/js/inspect/inventory.mjs +22 -27
  106. package/js/inspect/registry.mjs +106 -30
  107. package/js/inspect/scan.mjs +5 -5
  108. package/js/inspect/status.mjs +141 -119
  109. package/js/inspect/validate.mjs +22 -24
  110. package/js/lib/fs.mjs +47 -50
  111. package/js/lib/json.mjs +10 -17
  112. package/js/lib/machine-dir.mjs +73 -0
  113. package/js/lib/paths.mjs +22 -33
  114. package/js/lib/proc.mjs +1 -1
  115. package/js/lib/prompt.mjs +19 -27
  116. package/js/lib/text.mjs +8 -12
  117. package/js/lib/udiff.mjs +11 -15
  118. package/js/loop/catalog.mjs +2 -3
  119. package/js/maintain/memory.mjs +17 -17
  120. package/js/maintain/migrate.mjs +79 -89
  121. package/js/maintain/setup.mjs +43 -32
  122. package/js/maintain/uninstall.mjs +43 -61
  123. package/js/maintain/update.mjs +200 -93
  124. package/js/ui/anim.mjs +21 -35
  125. package/js/ui/cli.mjs +36 -58
  126. package/js/ui/menu.mjs +22 -45
  127. package/js/ui/tui.mjs +27 -67
  128. package/js/web/actions.mjs +34 -34
  129. package/js/web/api.mjs +130 -74
  130. package/js/web/catalog.mjs +175 -46
  131. package/js/web/docs.mjs +33 -12
  132. package/js/web/doctor-worker.mjs +14 -0
  133. package/js/web/handler.mjs +14 -5
  134. package/js/web/routes.mjs +17 -19
  135. package/js/web/state.mjs +78 -19
  136. package/js/web/update-check.mjs +25 -10
  137. package/js/web/user-files.mjs +50 -105
  138. package/package.json +7 -4
  139. package/registry.json +48 -55
  140. package/src/AGENT.md.tmpl +13 -14
  141. package/src/agents/_self-improvement.md +1 -1
  142. package/src/agents/_template.md +1 -1
  143. package/src/agents/advocate.md +1 -1
  144. package/src/agents/architect.md +1 -1
  145. package/src/agents/developer.md +1 -1
  146. package/src/agents/devops-engineer.md +1 -1
  147. package/src/agents/docker-expert.md +1 -1
  148. package/src/agents/docs.md +1 -1
  149. package/src/agents/empiricist.md +1 -1
  150. package/src/agents/explorer.md +1 -1
  151. package/src/agents/framer.md +1 -1
  152. package/src/agents/historian.md +1 -1
  153. package/src/agents/kubernetes-specialist.md +1 -1
  154. package/src/agents/memory-curator.md +2 -2
  155. package/src/agents/operator.md +1 -1
  156. package/src/agents/performance.md +1 -1
  157. package/src/agents/pragmatist.md +1 -1
  158. package/src/agents/react-engineer.md +1 -1
  159. package/src/agents/react-reviewer.md +1 -1
  160. package/src/agents/researcher.md +1 -1
  161. package/src/agents/reviewer.md +1 -1
  162. package/src/agents/security.md +1 -1
  163. package/src/agents/skeptic.md +1 -1
  164. package/src/agents/spring-boot-engineer.md +1 -1
  165. package/src/agents/spring-reviewer.md +1 -1
  166. package/src/agents/spring-security.md +1 -1
  167. package/src/agents/steward.md +1 -1
  168. package/src/agents/tester.md +1 -1
  169. package/src/agents/user-advocate.md +1 -1
  170. package/src/agents/visionary.md +1 -1
  171. package/src/memory/README.md +1 -1
  172. package/src/skills/_self-improvement.md +2 -2
  173. package/src/skills/daydream/SKILL.md +2 -2
  174. package/src/skills/daydream/instructions.md +1 -1
  175. package/src/skills/geneseed.md +1 -1
  176. package/src/skills/learn-mode.md +1 -2
  177. package/src/skills/profile.md +2 -2
  178. package/src/skills/rule/approve.md +69 -0
  179. package/src/skills/rule/consolidate.md +3 -3
  180. package/src/skills/rule.md +13 -5
  181. package/src/skills/skill-forge.md +1 -1
  182. package/src/skills/teach.md +29 -12
  183. package/src/skills/wiki.md +1 -1
  184. package/themes/_TEMPLATE.json +1 -2
  185. package/themes/biker.json +1 -2
  186. package/themes/commentator.json +1 -2
  187. package/themes/cyberpunk.json +1 -2
  188. package/themes/gamer.json +1 -2
  189. package/themes/imperial.json +1 -2
  190. package/themes/joker.json +1 -2
  191. package/themes/marvin.json +1 -2
  192. package/themes/mean.json +1 -2
  193. package/themes/military.json +1 -2
  194. package/themes/neutral.json +1 -2
  195. package/themes/pirate.json +1 -2
  196. package/themes/sports.json +1 -2
  197. package/themes/verstappen.json +1 -2
  198. package/themes/wizard.json +1 -2
  199. package/web/dist/assets/Activity-D8G4eClY.js +1 -0
  200. package/web/dist/assets/ActivityDetail-BtOBYk3M.js +1 -0
  201. package/web/dist/assets/AgentGlyph-k6o3gCM1.js +1 -0
  202. package/web/dist/assets/Bonsai-B_y20b3i.js +1 -0
  203. package/web/dist/assets/{CopyButton-C5Li6awl.js → CopyButton-CHQte7Ap.js} +1 -1
  204. package/web/dist/assets/Dashboard-B8uXeJZ_.js +2 -0
  205. package/web/dist/assets/Docs-Dgv_MWfT.js +5 -0
  206. package/web/dist/assets/GreenhouseView-CSzTMSl_.js +1 -0
  207. package/web/dist/assets/Installs-BDk9lqBI.js +3 -0
  208. package/web/dist/assets/JournalView-CvRk1-m5.js +1 -0
  209. package/web/dist/assets/Kits-CoITzxWM.js +1 -0
  210. package/web/dist/assets/Laws-Ctf5r9rE.js +3 -0
  211. package/web/dist/assets/Library-DNwHYVXt.js +3 -0
  212. package/web/dist/assets/{Loops-CzitjxGV.js → Loops-S85PMQ8m.js} +2 -2
  213. package/web/dist/assets/{Markdown-C4S4tTA7.js → Markdown-0ORz7tAc.js} +21 -21
  214. package/web/dist/assets/OperatorHudView-DuGz_sTk.js +1 -0
  215. package/web/dist/assets/Personal-afJNwvRS.js +2 -0
  216. package/web/dist/assets/{RailCats-D5weYPCS.js → RailCats-AW92uhsX.js} +1 -1
  217. package/web/dist/assets/Settings-CGDFz-6j.js +1 -0
  218. package/web/dist/assets/Tabs-1qLrnqmn.js +1 -0
  219. package/web/dist/assets/api-C46vAuqp.js +1 -0
  220. package/web/dist/assets/controls-D4wmg_pl.js +1 -0
  221. package/web/dist/assets/index-COTd4TRZ.js +3 -0
  222. package/web/dist/assets/index-CtorA7uK.css +1 -0
  223. package/web/dist/assets/motion-RlUl1osO.js +1 -0
  224. package/web/dist/assets/{sections-ChwaobfW.js → sections-CtFz7HFH.js} +1 -1
  225. package/web/dist/index.html +5 -5
  226. package/src/skills/quiz.md +0 -44
  227. package/web/dist/assets/Activity-Bjy64wHC.js +0 -1
  228. package/web/dist/assets/ActivityDetail-B0AaipP8.js +0 -1
  229. package/web/dist/assets/Bonsai-CJniRqaH.js +0 -1
  230. package/web/dist/assets/Dashboard-B-6DTmae.js +0 -2
  231. package/web/dist/assets/Docs-LRc30XL9.js +0 -5
  232. package/web/dist/assets/GreenhouseView-CcoYlaWo.js +0 -1
  233. package/web/dist/assets/Installs-dp1epTcE.js +0 -3
  234. package/web/dist/assets/JournalView-nFP4poCf.js +0 -1
  235. package/web/dist/assets/KitApply-DwyZUj57.js +0 -1
  236. package/web/dist/assets/Kits-C0IEdZXe.js +0 -1
  237. package/web/dist/assets/Laws-CkykmQWu.js +0 -3
  238. package/web/dist/assets/Library-Guh9HBZU.js +0 -2
  239. package/web/dist/assets/OperatorHudView-DLGNulIY.js +0 -1
  240. package/web/dist/assets/Personal-BMtberL8.js +0 -2
  241. package/web/dist/assets/Tabs-uYJqfuQt.js +0 -1
  242. package/web/dist/assets/api-BxjLd7Qd.js +0 -1
  243. package/web/dist/assets/index-DA7BiaE5.js +0 -3
  244. package/web/dist/assets/index-dbbDGFDq.css +0 -1
  245. package/web/dist/assets/motion-Bccx3zE8.js +0 -1
package/js/ui/cli.mjs CHANGED
@@ -1,38 +1,30 @@
1
1
  /**
2
2
  * `js/cli-table.json` — the CLI as data, and the one place either implementation describes it.
3
3
  *
4
- * WHY THIS FILE EXISTS. `rituals/harness.py`'s `build_argparser()` was 25 subparsers (26
5
- * invocable names — `update` aliases `upgrade`) and 46 `add_argument` calls. Node cannot
6
- * introspect argparse, and P6d deferred the console's `cli` docs page for exactly that
7
- * reason: a Node twin could only be a hand-written copy of the whole CLI surface, describing
8
- * verbs `bin/geneseed-cli.mjs` cannot even run. This port's standing rule is that a copy of a
9
- * value under test stops being the value under test, and that would have been the largest
10
- * copy in it.
4
+ * WHY THIS FILE EXISTS. The CLI surface is 26 invocable names (`update` aliases `upgrade`),
5
+ * and a hand-written copy of it for the console's `cli` docs page would describe verbs
6
+ * `bin/geneseed-cli.mjs` cannot even run. A copy of a value under test stops being the value
7
+ * under test, and that would have been the largest copy in the tree.
11
8
  *
12
- * P10c's answer was to make the metadata DATA — generated into `cli.json` at the repo root by
13
- * a since-deleted Python script and read by both sides. P2 finishes the thought: the table is
14
- * no longer GENERATED from anything, it is the OWNED document, and it lives here on a product
9
+ * So the metadata is DATA: the table is the OWNED document, and it lives here on a product
15
10
  * path because that is where a document npm ships belongs. `package.json`'s `files[]` already
16
11
  * carries `js/`, so it needs no row of its own, and nothing has to import out of `tests/`.
17
12
  *
18
13
  * ITS READERS, and each one takes a different view of the same rows:
19
14
  *
20
- * * `cliReference()` — `js/web/docs.mjs`'s `cli` kind, the page P6d deferred. STRIPS the
15
+ * * `cliReference()` — `js/web/docs.mjs`'s `cli` kind. STRIPS the
21
16
  * hidden arguments and the two fields the page never carried;
22
- * * `cliSpec()` — `bin/geneseed-cli.mjs`'s argument parser. That table used to carry its
23
- * OWN hand-written transcription of the same `add_argument` calls, gated against the
24
- * subparsers by name only, so `VERBS` is now `{ fn }` per row and everything
25
- * argparse-shaped is derived here. KEEPS the hidden arguments, `--port`'s int type and
17
+ * * `cliSpec()` — `bin/geneseed-cli.mjs`'s argument parser. `VERBS` is `{ fn }` per row
18
+ * and everything argparse-shaped is derived here. KEEPS the hidden arguments, `--port`'s int type and
26
19
  * `theme`'s mutex group, none of which the page may show;
27
20
  * * `cliCommand()`/`printHelp()` — `--help` on BOTH entry points, so the table owes a row to
28
21
  * every verb `bin/geneseed-hook.mjs` dispatches as well, not only to the CLI entry's.
29
22
  *
30
23
  * THE STORED SHAPE IS THE UNION AND MUST STAY ONE. Neither reader's shape can be the file's:
31
24
  * a file filtered for the page breaks the CLI, and a file in `cliSpec`'s shape cannot render
32
- * the docs. It stays exactly what the argparse walk produced.
25
+ * the docs.
33
26
  *
34
- * WHAT GUARDS IT. The Python parser it was walked from is gone, and with it every comparison
35
- * against argparse; the table is now simply the source of truth and is edited directly.
27
+ * WHAT GUARDS IT. The table is the source of truth and is edited directly.
36
28
  * `tests/unit/cli_table.test.mjs` checks the WHOLE table.
37
29
  *
38
30
  * THE COST, NAMED: this entry cannot parse anything without this file. `js/build/source.mjs`
@@ -57,10 +49,9 @@ const PAGE_ARG_KEYS = ['names', 'dest', 'metavar', 'help', 'choices', 'default',
57
49
  * `js/cli-table.json`, parsed. An unreadable file is the empty reference; the entry points
58
50
  * turn that into a refusal that names itself rather than a parse with no rules.
59
51
  *
60
- * NOT MEMOISED, and the first draft was. `harness.load_cli_reference` re-reads the file on
61
- * every call, so a cache here would make an edited table visible to the reference's running
62
- * daemon and invisible to this one until it restarted — a divergence no cell can reach and no
63
- * reviewer would look for. One re-read of a file this size is not a cost worth buying that with.
52
+ * NOT MEMOISED: a cache here would leave a running daemon showing the table it started with
53
+ * after the file was edited, a divergence no cell can reach and no reviewer would look for.
54
+ * One re-read of a file this size is not a cost worth buying that with.
64
55
  */
65
56
  function load() {
66
57
  try {
@@ -99,9 +90,9 @@ export function cliReference() {
99
90
  /**
100
91
  * `-h/--help`, which the table does NOT carry.
101
92
  *
102
- * argparse adds it at parser construction, before any `add_argument` the walk can see, so it
103
- * is absent from every command in the file and present in every help text the reference
104
- * prints. Reproduced here as a row rather than special-cased in the renderer, because it is
93
+ * argparse adds it at parser construction, so it
94
+ * is absent from every command in the file and present in every help text.
95
+ * It is a row here rather than special-cased in the renderer, because it is
105
96
  * first in the options section and first in the usage line for every verb the table carries —
106
97
  * a position it only gets by being an action like the others.
107
98
  */
@@ -153,8 +144,7 @@ function actionInvocation(a, positional) {
153
144
  // hyphenated word into two chunks, so it can break a line inside `back-compat` where a
154
145
  // space-only wrap cannot. Measured before deciding: every help string then in the table disagreed
155
146
  // with a greedy wrap at some width, the widest at 175 — so "the branch is dead" was simply
156
- // false, and the former Python suite's every-width comparison against `textwrap` said so on
157
- // the run that first asserted it. The rules are transcribed instead.
147
+ // false. The rules are transcribed instead.
158
148
  //
159
149
  // Python's classes, spelled for a `u`-flagged JavaScript regex: `\w` is letters, numbers and
160
150
  // underscore; `[^\d\W]` is that minus the DECIMAL digits, which leaves the letter-ish half
@@ -305,28 +295,18 @@ function formatAction(a, positional, helpPosition, width) {
305
295
  /**
306
296
  * `parser.format_help()` for one subcommand, byte for byte with argparse.
307
297
  *
308
- * WHY THE PORT RENDERS THIS AT ALL. Task 10 compared the two implementations' `--help` for the
309
- * first time — the former Python CLI matrix had zero `--help` cells — and found the port answering
310
- * `geneseed: error: unrecognized arguments: --help`, exit 2, on all 26 verbs. That is not the
311
- * declared wording divergence `parse`'s docblock reserves for argparse's ERROR text: it is the
312
- * absence of the surface, on the binary that survives the reference's deletion.
298
+ * `prog` IS AN ARGUMENT: a user who typed `geneseed status --help` is shown
299
+ * `usage: geneseed status`, which is also how every error this entry prints already spells
300
+ * itself (`die`). The layout is pinned by the written-out `formatHelp` rows in
301
+ * `tests/unit/text_layout.test.mjs`.
313
302
  *
314
- * `prog` IS AN ARGUMENT AND THAT IS THE ONE DELIBERATE DIVERGENCE. The reference names itself
315
- * `harness`, after the Python file this migration deletes; a user who typed `geneseed status
316
- * --help` is shown `usage: geneseed status`, which is also how every error this entry prints
317
- * already spells itself (`die`). The former Python suite replayed the reference's recorded
318
- * answers through here with `prog` set to the reference's own, so the layout was gated byte for
319
- * byte and the rename was the only thing that moved. That corpus is gone; the layout is now
320
- * pinned by the written-out `formatHelp` rows in `tests/unit/text_layout.test.mjs`.
303
+ * `catalog`, `mcp` and `memory` have no subparser to render from, so they are held
304
+ * ABSOLUTELY instead — and `tests/unit/hook_cli.test.mjs`'s `NATIVE` list names that
305
+ * population and fails a verb that falls into neither, which is what keeps "no recorded
306
+ * text" from meaning "no gate".
321
307
  *
322
- * NOT EVERY VERB HAD A RECORDED ANSWER, AND THREE NEVER COULD. `catalog`, `mcp` and `memory` had
323
- * no subparser for the recorder to render from, so they were held ABSOLUTELY instead — and
324
- * `tests/unit/hook_cli.test.mjs`'s `NATIVE` list still names that population and fails a verb
325
- * that falls into neither, which is what keeps "no recorded text" from meaning "no gate".
326
- *
327
- * The alias rides on the same argument: argparse gives `update` the parser object it built for
328
- * `upgrade`, so `harness.py update --help` printed `usage: harness upgrade`. The recorded prog
329
- * map reproduced that; the shipped call passes `geneseed update`, which is what the user typed.
308
+ * The alias rides on the same argument: the shipped call passes `geneseed update`, which is
309
+ * what the user typed.
330
310
  *
331
311
  * `width` is argparse's `shutil.get_terminal_size().columns - 2`, passed in rather than read,
332
312
  * because a recorded help text whose wrap column came from the recorder's terminal is a corpus
@@ -401,16 +381,14 @@ export function formatHelp(cmd, prog, width) {
401
381
  * reads `COLUMNS` before it asks the tty, and falls back to 80 when neither answers, which is
402
382
  * every pipe both implementations write help into.)
403
383
  *
404
- * `parseIntStrict`, NOT `Number.parseInt`, and the tree already owned it. `get_terminal_size` spells
405
- * this `int(os.environ['COLUMNS'])` inside `except (KeyError, ValueError)`, and `int` is not
406
- * `parseInt`. Measured against the reference over a corpus of `$COLUMNS` values in the former
407
- * Python suite (`tests/unit/cli_table.test.mjs`'s 'the help width is the terminal width less
408
- * two, and COLUMNS wins' keeps a written-out part of it): `COLUMNS=1_0` is 10 to Python and
409
- * 1 to `parseInt`, `COLUMNS=٣` is 3 and NaN, `COLUMNS=' 80 '` is 80 and NaN. `COLUMNS=80abc`
410
- * is a ValueError to Python and 80 to `parseInt` — the same answer down a PIPE, where the
411
- * fallback is 80 either way, and a different one on any terminal that is not 80 wide, which is
412
- * why a unit test is the gate rather than a cell. A non-positive value falls through on both
413
- * sides, which is Python's `if columns <= 0` and was already right here.
384
+ * `parseIntStrict`, NOT `Number.parseInt`, and the tree already owned it. `get_terminal_size`
385
+ * parses `$COLUMNS` with `int()`, and `int` is not `parseInt` (`tests/unit/cli_table.test.mjs`'s
386
+ * 'the help width is the terminal width less two, and COLUMNS wins' keeps a written-out part
387
+ * of the corpus): `COLUMNS=1_0` is 10 to `int` and 1 to `parseInt`, `COLUMNS=٣` is 3 and
388
+ * NaN, `COLUMNS=' 80 '` is 80 and NaN. `COLUMNS=80abc` is a ValueError to `int` and 80 to
389
+ * `parseInt` — the same answer down a PIPE, where the fallback is 80 either way, and a
390
+ * different one on any terminal that is not 80 wide, which is why a unit test is the gate
391
+ * rather than a cell. A non-positive value falls through on both sides.
414
392
  *
415
393
  * `stripWhitespace` because THIS is the caller `parseIntStrict`'s docblock did not have: its other two
416
394
  * strip before calling, and `$COLUMNS` arrives however the shell set it — `int(' 80 ')` is 80.
@@ -471,7 +449,7 @@ const camel = (dest) => dest.replace(/_([a-z])/g, (_m, c) => c.toUpperCase());
471
449
  * EVERY ROW OF THIS MAPPING WAS A HAND-WRITTEN COMMENT IN THAT FILE'S `VERBS` TABLE, and each
472
450
  * one names a failure it prevents:
473
451
  *
474
- * * a positional with `nargs="?"` is OPTIONAL — `link [dir]`, `upgrade [ref] [theme]`;
452
+ * * a positional with `nargs="?"` is OPTIONAL — `link [dir]`, `upgrade [theme]`;
475
453
  * * a positional with `nargs="*"` is the trailing SINK (`bootstrap extra`), and `parse`
476
454
  * keeps it from absorbing options, which is what stops `bootstrap --no-setpu` from
477
455
  * running a full update-and-wizard while the user believes they asked for neither;
package/js/ui/menu.mjs CHANGED
@@ -1,36 +1,18 @@
1
1
  /**
2
- * `menu` and `home` — `rituals/_harness_menu.py`'s two dispatchers.
2
+ * `menu` and `home` — the two dispatchers.
3
3
  *
4
- * WHAT CROSSES HERE AND WHAT DOES NOT, said plainly, because this is the one module in the
5
- * port whose Python twin is 3,398 lines and whose Node twin is ninety.
4
+ * `cmdMenu` is a FORK, not a menu. Off a TTY it prints five lines of command list and
5
+ * returns 0. On a TTY it falls back to the same command list rather than inventing a
6
+ * second menu: there is no full-screen panel, by decision, and it is stated as such on
7
+ * stderr. A numbered line-menu built out of `js/maintain/setup.mjs`'s `askChoice` was
8
+ * considered and refused: it would be a separate user interface, unreachable from every cell
9
+ * (no cell has a TTY), for a panel that was rejected outright rather than deferred. The
10
+ * off-TTY arm is what every cell can reach.
6
11
  *
7
- * `cmd_menu` is a FORK, not a menu. Off a TTY it prints five lines of command list and
8
- * returns 0; on a TTY it hands control to `curses.wrapper(_main_menu)` — the full-screen
9
- * panel, which is P7c's and is not here. The fork's off-TTY arm is what every cell of this
10
- * port can reach, and it is ported byte for byte.
12
+ * `cmdHome` is the default for a bare `geneseed`. Its two arms are `webFirstOk()` — the
13
+ * web console, started by `startDaemon` — and `cmdMenu` above.
11
14
  *
12
- * ON A TTY, THIS ENTRY FALLS BACK RATHER THAN INVENTING A SECOND MENU. The reference already
13
- * has that behaviour: `cmd_menu` wraps the panel in `except Exception`, writes `[menu] TUI
14
- * unavailable (<reason>)` to stderr and prints the same command list. Node's reason is
15
- * permanent rather than accidental, and it is stated as such.
16
- *
17
- * ⚠ THE REASON THIS HEADER ORIGINALLY GAVE WAS WRONG, and P7b measured it: it said the
18
- * reference reaches that arm often because "`import curses` fails on stock Windows Python".
19
- * A bare `import curses` does fail here, but `rituals/_harness_core.py` installs
20
- * `rituals/_winterm.py` under the name `curses` when it does — so inside the harness the
21
- * import succeeds, the panel opens, and it is the PORT that has no window. The fallback is
22
- * still the right shape; only its explanation moved. The alternative that was considered and
23
- * refused: building a numbered line-menu out of `js/maintain/setup.mjs`'s `askChoice`. That is not a
24
- * port of `_main_menu` — it is a THIRD user interface, differing from the reference on every
25
- * screen, unreachable from every cell (no cell has a TTY), for a panel that was rejected
26
- * outright rather than deferred. The fallback is the reference's own contract for "no
27
- * full-screen menu available here"; a new UI would not be.
28
- *
29
- * `cmd_home` is the default for a bare `geneseed`, and it crosses WHOLE. Its two arms are
30
- * `_web_first_ok()` — the web console, which is P6h's `startDaemon` and is fully ported —
31
- * and `cmd_menu` above. Nothing in it was deferred.
32
- *
33
- * `_web_first_ok`'s FIVE REFUSALS ARE THE PAYLOAD, and only two of them are reachable from a
15
+ * `webFirstOk`'s FIVE REFUSALS ARE THE PAYLOAD, and only two of them are reachable from a
34
16
  * cell: a cell's stdin is a pipe, so `isTTY` is false and everything past it is dead. The
35
17
  * other three (SSH, the Linux display server, the browser) are gated by
36
18
  * `tests/unit/web_first.test.mjs`, which drives this function through
@@ -40,7 +22,7 @@ import { printOut, printErr } from '../lib/fs.mjs';
40
22
  import { which } from '../lib/paths.mjs';
41
23
  import { startDaemon } from '../web/daemon.mjs';
42
24
 
43
- /** `_menu_help` — the off-TTY arm, and the fallback both TTY arms end in. */
25
+ /** The off-TTY arm, and the fallback both TTY arms end in. */
44
26
  function menuHelp() {
45
27
  printOut('Geneseed — no interactive menu here. Get started with: geneseed setup\n');
46
28
  printOut('Other commands: bootstrap · update · build · doctor · diff · tui · web\n');
@@ -57,12 +39,10 @@ function menuHelp() {
57
39
  * `cmd /c start` on Windows and `open` on macOS are OS builtins that are always there, and
58
40
  * everywhere else it is `xdg-open`, which is not.
59
41
  *
60
- * DECLARED DIVERGENCE: on Linux the reference consults `$BROWSER` and a list of a dozen
61
- * browser binaries before giving up, so a box with `firefox` on PATH and no `xdg-open`
62
- * answers True there and false here. It is unreachable from this port's machine (the
63
- * previous branch already returned false without a display server, and Windows never gets
64
- * here), and closing it would mean reproducing `webbrowser`'s registry — a table of browser
65
- * names that would go stale silently, which is the shape this port refuses.
42
+ * DECLARED LIMIT: on Linux this does not consult `$BROWSER` or a list of a dozen browser
43
+ * binaries, so a box with `firefox` on PATH and no `xdg-open` answers false. Closing it
44
+ * would mean reproducing `webbrowser`'s registry — a table of browser names that would go
45
+ * stale silently, which is the shape this code refuses.
66
46
  */
67
47
  function browserAvailable() {
68
48
  if (process.platform === 'win32' || process.platform === 'darwin') return true;
@@ -70,8 +50,8 @@ function browserAvailable() {
70
50
  }
71
51
 
72
52
  /**
73
- * `_web_first_ok` — whether a bare `geneseed` opens the web UI rather than the TUI menu.
74
- * Deliberately conservative in the reference and here: any doubt falls back to the menu, so
53
+ * Whether a bare `geneseed` opens the web UI rather than the TUI menu.
54
+ * Deliberately conservative: any doubt falls back to the menu, so
75
55
  * a server box is never dropped into a browser launch that cannot open.
76
56
  */
77
57
  export function webFirstOk() {
@@ -86,18 +66,15 @@ export function webFirstOk() {
86
66
  return browserAvailable();
87
67
  }
88
68
 
89
- /** `cmd_menu`. See this module's header for why the TTY arm falls back. */
69
+ /** See this module's header for why the TTY arm falls back. */
90
70
  export function cmdMenu() {
91
71
  if (!process.stdin.isTTY) return menuHelp();
92
- // The reference's own `except Exception` arm, with a reason that is permanent here rather
93
- // than machine-dependent. stderr, and CRLF on Windows, because `sys.stderr.write` does.
72
+ // stderr, and CRLF on Windows.
94
73
  //
95
74
  // The reason is on THIS side: there is no window implementation, by decision, and that is
96
75
  // what the message says (`tests/unit/no_panel.test.mjs` keeps it so).
97
- // NOTHING TO POINT AT ANY MORE. The message used to end by sending the reader at the
98
- // Python panel, and P2 took the pointer out rather than re-aiming it: the panel it named
99
- // is the Python this migration deletes, and a refusal that sends a user to a file which
100
- // will not be there is worse than one that simply says the screen does not exist.
76
+ // NOTHING TO POINT AT: a refusal that sends a user to a file which will not be there is
77
+ // worse than one that simply says the screen does not exist.
101
78
  printErr('[menu] TUI unavailable (this entry has no full-screen menu).\n');
102
79
  return menuHelp();
103
80
  }
package/js/ui/tui.mjs CHANGED
@@ -1,59 +1,36 @@
1
1
  /**
2
- * `tui` — and the TUI's pure half, which is the part of the panel that has no curses in it.
2
+ * `tui` — and the TUI's pure half: the layout helpers that have no screen in them.
3
3
  *
4
- * WHAT CROSSES HERE AND WHAT DOES NOT.
4
+ * `cmdTui` is an entry with no full-screen panel. Off a TTY it prints one line and returns 1;
5
+ * on a TTY it prints a refusal that names the console and returns 1, rather than inventing
6
+ * a screen — the same decision `js/ui/menu.mjs` makes. `tests/unit/no_panel.test.mjs` fakes
7
+ * `isTTY` true in a child and asserts BOTH arms — the exit code, and that the refusal names
8
+ * the console rather than pretending to draw.
5
9
  *
6
- * `cmd_tui` (`rituals/_harness_tui.py`) is twenty-six lines and three arms. Off a TTY it
7
- * prints one line and returns 1; when `import curses` fails it prints one line and returns
8
- * 1; otherwise it builds the inventory and hands the screen to `curses.wrapper(_tui_loop)`.
9
- * NO CELL COULD EVER GIVE `cmd_tui` A TTY while the acceptance matrix was the gate, so the
10
- * off-TTY arm was the whole of its reachable behaviour. That changed with the matrix:
11
- * `tests/unit/no_panel.test.mjs` fakes `isTTY` true in a child and asserts BOTH arms — the
12
- * exit code, and that the refusal names the console rather than pretending to draw.
13
- *
14
- * THE PANEL ITSELF IS P7C'S, AND THIS ENTRY FALLS BACK RATHER THAN INVENTING ONE — the same
15
- * decision `js/ui/menu.mjs` made in P7a, for the same reason. `cmd_tui` already owns a fourth
16
- * path: an `except Exception` around `curses.wrapper` that prints `[tui] full-screen panel
17
- * unavailable (<reason>)` and returns 1, written for the Windows shim's `Unsupported`. That
18
- * is the reference's own contract for "no full-screen panel is available here", so the port
19
- * speaks it with a reason that is permanent rather than machine-dependent. A Node panel that
20
- * differed from the reference on every screen, that no cell could reach, and that would be
21
- * deleted the day the real one crossed, would be a second user interface and not a port.
22
- *
23
- * WHAT DOES CROSS is the alignment contract — the functions below that decide what a row
10
+ * What lives here is the alignment contract — the functions below that decide what a row
24
11
  * looks like: display width, fitting, glyph tiers, the catalogue's entries and detail lines.
25
12
  * Each has a caller outside this file (the catalogue, the status panel, the web console).
26
- * The panel itself was REJECTED, not deferred, so the helpers that existed only for it —
27
- * the spinner, the wordmark, scroll clamping, the progress bar and the theme preview/flair
28
- * readers — were deleted rather than kept waiting for a screen that will not come.
29
- *
30
- * WHAT IS DELIBERATELY NOT HERE: `_bx` (its non-ASCII arm returned `curses.ACS_*` chtype
31
- * ints, which belonged with the window) and every `(stdscr, curses, pal)` drawing helper.
32
- * `_wrap_lines` is NOT deferred but RETIRED — it reflowed a body into a fixed-width detail
33
- * pane, the pane is gone, and the web console does its own wrapping.
13
+ * There is no panel, so nothing exists only for one: no spinner, wordmark, scroll clamping,
14
+ * progress bar or theme preview.
34
15
  *
35
- * **DO NOT WRITE A SECOND LINE BREAKER.** This block used to argue that `textwrap.wrap` was
36
- * "a second `difflib` — a stdlib payload with no Node twin". It has one since P1:
37
- * `wrapText` in `js/ui/cli.mjs`, written because `--help` was the caller that finally
38
- * required it, pinned by the written-out rows in `tests/unit/text_layout.test.mjs`.
39
- * Anything that needs wrapping wraps THAT. `_parse_laws`, `load_registry`, `entity_status` and
40
- * `_tui_inventory` crossed in P6c and live in `js/inspect/inventory.mjs`.
16
+ * **DO NOT WRITE A SECOND LINE BREAKER.** `wrapText` in `js/ui/cli.mjs` is the one,
17
+ * pinned by the written-out rows in `tests/unit/text_layout.test.mjs`. Anything that needs
18
+ * wrapping wraps THAT. The law parser, registry and inventory walk live in
19
+ * `js/inspect/inventory.mjs`.
41
20
  */
42
21
  import { splitLines } from '../lib/udiff.mjs';
43
22
  import { printOut } from '../lib/fs.mjs';
44
23
 
45
24
  // ---- display tiers -------------------------------------------------------------------
46
25
  //
47
- // The reference reads these into MODULE CONSTANTS at import time (`_TUI_ASCII = bool(
48
- // os.environ.get(...))`), so a process answers one way for its whole life and the corpus
49
- // runs one probe process per mode rather than monkeypatching. Read once here too, for the
50
- // same reason. `bool(os.environ.get(x))` and `!!process.env.x` agree on the case that
51
- // matters: an EMPTY value is not set.
26
+ // Read into MODULE CONSTANTS at import time, so a process answers one way for its whole
27
+ // life and a probe runs one process per mode rather than monkeypatching. An EMPTY value is
28
+ // not set.
52
29
  const TUI_ASCII = !!process.env.GENESEED_TUI_ASCII;
53
30
  const TUI_PLAIN = !!process.env.GENESEED_TUI_PLAIN;
54
31
  const TUI_EMOJI = !(TUI_ASCII || TUI_PLAIN);
55
32
 
56
- /** `_glyphs` — the one glyph table for the whole TUI, unicode or ASCII stand-ins. */
33
+ /** The one glyph table for the whole TUI, unicode or ASCII stand-ins. */
57
34
  export function glyphs(asciiMode) {
58
35
  return {
59
36
  sel: asciiMode ? '>' : '▸',
@@ -77,7 +54,7 @@ export const GLYPH = glyphs(TUI_ASCII);
77
54
  // `Mc` with combining class 0 and a great many `Mn` have class 0 too. So the tables below
78
55
  // are the port's own, and no dependency was added to get them.
79
56
 
80
- //: East_Asian_Width W or F, below U+1F000 — above it the reference's own `>= 0x1F000` rule
57
+ //: East_Asian_Width W or F, below U+1F000 — above it the `>= 0x1F000` rule
81
58
  //: already answers 2, so the table stops where that rule takes over.
82
59
  const WIDE = [
83
60
  0x1100, 0x115F, 0x231A, 0x231B, 0x2329, 0x232A, 0x23E9, 0x23EC, 0x23F0, 0x23F0,
@@ -265,12 +242,11 @@ export function mark(kind) {
265
242
  // ---- the inventory's two consumers ----------------------------------------------------
266
243
 
267
244
  /**
268
- * `_tui_entries` — the ordered (kind, label, data) rows for the left list. `head` is a
245
+ * The ordered (kind, label, data) rows for the left list. `head` is a
269
246
  * section divider and is not selectable.
270
247
  *
271
- * ⚠ THE TWO NEW TIERS ARE GUARDED, AND THE GUARD IS NOT DEFENSIVENESS. When they landed, this
272
- * function had two recorded cases per platform in the former Python suite's corpus, and their
273
- * argument was a synthetic inventory carrying exactly `{agents, skills, laws, theme}`. Reading
248
+ * ⚠ THE TWO NEW TIERS ARE GUARDED, AND THE GUARD IS NOT DEFENSIVENESS. A synthetic inventory
249
+ * carrying exactly `{agents, skills, laws, theme}` is a valid argument. Reading
274
250
  * `inv.doctrines.length` on such an inventory THROWS; emitting a head unconditionally changes
275
251
  * the result array. Keyed on presence, an inventory without the tiers renders as it always did
276
252
  * and a real inventory gets all three tiers.
@@ -312,25 +288,11 @@ export function tuiEntries(inv) {
312
288
  }
313
289
 
314
290
  /**
315
- * `_detail_lines` — right-pane content for the selected entry.
316
- *
317
- * The reference falls off the end for every other `kind`, so it returns `None` — not `[]`.
318
- * `null` here, because a caller that treated the two alike would render an empty pane where
319
- * the reference renders nothing at all.
320
- *
321
- * ⚠ A REFERENCE BUG LIVES ON THIS RETURN, FOUND BY P7B'S CORPUS AND DELIBERATELY NOT FIXED
322
- * (it is in the panel, which is P7c's). `_tui_loop` does, at `_harness_tui.py`:614:
323
- *
324
- * wrapped = _wrap_lines(_detail_lines(kind, label, data), riw)
291
+ * Right-pane content for the selected entry.
325
292
  *
326
- * and `_wrap_lines` iterates its argument. For a `head` row `_detail_lines` returns `None`,
327
- * so that is a `TypeError: 'NoneType' object is not iterable`. It is normally unreachable
328
- * because line 554 moves `sel` onto the first SELECTABLE row — but line 555 is
329
- * `if not selectable: sel = 0`, and row 0 is always the AGENTS header. So an inventory with
330
- * no agents, no skills AND no laws crashes the panel on its first frame instead of drawing
331
- * an empty state. `_TUI_INV_EMPTY` in the former Python parity suite is the corpus
332
- * entry that surfaced it. **P7c must not reproduce the crash when it ports `_tui_loop`** —
333
- * the fix is one `or []` at the call site, and it belongs in the same change as the port.
293
+ * Every other `kind` returns `null` — not `[]`. A caller that treated the two alike would
294
+ * render an empty pane where nothing should render at all, and a caller that iterates the
295
+ * result must guard for `null` (a `head` row is the one that reaches it).
334
296
  *
335
297
  * Its only consumer with direct assertions is `tests/unit/setup.test.mjs`.
336
298
  */
@@ -348,16 +310,14 @@ export function detailLines(kind, label, data) {
348
310
  // ---- the verb ------------------------------------------------------------------------
349
311
 
350
312
  /**
351
- * `cmd_tui`. Arm one is the reachable one and is byte for byte; the panel is P7c's and this
352
- * falls back through `cmd_tui`'s own `except` arm — see this module's header.
313
+ * The `tui` verb. Arm one is the reachable one; there is no panel, so the TTY arm
314
+ * refuses — see this module's header.
353
315
  */
354
316
  export function cmdTui() {
355
317
  if (!process.stdin.isTTY) {
356
318
  printOut('[tui] not an interactive terminal. Use `geneseed setup`, `geneseed doctor`, or `geneseed build`.\n');
357
319
  return 1;
358
320
  }
359
- // The pointer to the Python panel is gone for `js/ui/menu.mjs`'s reason: the
360
- // panel it named is the Python being deleted. What is left is true and stays true.
361
321
  printOut('[tui] full-screen panel unavailable (this entry carries the TUI\'s layout '
362
322
  + 'half, not its screens). Use `geneseed setup`, `geneseed doctor`, or `geneseed build`.\n');
363
323
  return 1;
@@ -37,7 +37,7 @@ import { emitGlobalInto } from '../build/driver.mjs';
37
37
  import {
38
38
  ROOT, discoverNames, knownRuleIds, loadKits, PACK_ORDER,
39
39
  } from '../build/source.mjs';
40
- import { diffCollect, drifted, withStdoutSwallowed } from '../inspect/diff.mjs';
40
+ import { diffCollect, drifted, renderMemo, withStdoutSwallowed } from '../inspect/diff.mjs';
41
41
  import { SESSION_FILES } from '../hosts/hooks-context.mjs';
42
42
  import { excludeAdd, excludeRemove } from '../inspect/excludes.mjs';
43
43
  import { installProfile, setupBuildArgs } from '../build/generate.mjs';
@@ -48,9 +48,9 @@ import {
48
48
  opencodeConfigDir, resolvePath,
49
49
  } from '../hosts/hosts.mjs';
50
50
  import {
51
- EMIT_HOST_SCOPE, doctrinesForBuild, excludedRulesOfDir, excludedSkillsOfDir, kitsOfDir,
51
+ EMIT_HOST_SCOPE, doctrinesForBuild, excludedRulesOfDir, excludedSkillsOfDir, kitsOfDir, sharedTierOfDir, renderedTier,
52
52
  footprintOfDir, gatesOfDir,
53
- installState, installTargets, legacyProcessCarrierOfDir, modeOfDir, postureOfDir, themeOfDir,
53
+ installState, installTargets, modeOfDir, postureOfDir, themeOfDir,
54
54
  trustOfDir,
55
55
  } from '../hosts/installs.mjs';
56
56
  import {
@@ -65,6 +65,7 @@ import { memoryDelete } from '../maintain/memory.mjs';
65
65
  import { installDeactivate, installReactivate, installUninstall } from '../maintain/uninstall.mjs';
66
66
  import { emitChoices, themeChoices, viewCfg } from './api.mjs';
67
67
  import { actionCommands } from './jobs.mjs';
68
+ import { emitOf } from '../inspect/status.mjs';
68
69
  import { webState } from './state.mjs';
69
70
  import { NotFound, deployed, memoryDir } from './catalog.mjs';
70
71
 
@@ -136,7 +137,7 @@ function bodyExcludeRules(body) {
136
137
  }
137
138
 
138
139
  /**
139
- * A request body's `kits` — REPLACES the install's kits (the Kits tab sends the whole set it
140
+ * A request body's `kits` — REPLACES the install's kits (the Kits page sends the whole set it
140
141
  * wants): `[]`/`'none'` give `[]`, an omitted key gives `null` (keep the install's own), and an
141
142
  * unknown name gives `null` too, which `apiInstallCmd` refuses for a body that HAS the key.
142
143
  */
@@ -144,6 +145,15 @@ function bodyKits(body) {
144
145
  return bodyList(body, 'kits', () => [...loadKits().keys()]);
145
146
  }
146
147
 
148
+ /**
149
+ * A request body's `sharedTier` — the project install's switch for reading the machine tier. Only
150
+ * a real JSON boolean counts, as a gate's does: anything else keeps the install's own answer.
151
+ */
152
+ function bodySharedTier(body, root, host) {
153
+ const said = bget(body, 'sharedTier');
154
+ return typeof said === 'boolean' ? said : sharedTierOfDir(root, host);
155
+ }
156
+
147
157
  /**
148
158
  * The gate switches across the trust boundary (`deletionGate`, `secretsGate`, `doneGate`,
149
159
  * `ownershipGate`), each on its own: only a real JSON boolean counts. Anything else — a string
@@ -221,8 +231,10 @@ export function targetView(base, [host, scope, root]) {
221
231
  if (v === undefined) {
222
232
  const target = viewCfg(host, scope, root);
223
233
  v = webState(null, target);
224
- v.selectView(target, root);
234
+ v.selectView(target, root, emitOf(host, scope));
225
235
  v.pinned = true;
236
+ // The daemon's one memo: a render is keyed on what it read, not on who asked for it.
237
+ v.renderMemo = (base.renderMemo ??= renderMemo());
226
238
  v.refresh = base.refresh;
227
239
  v.daemonStale = () => base.daemonStale?.();
228
240
  v.jobBusy = () => base.jobBusy?.();
@@ -234,7 +246,7 @@ export function targetView(base, [host, scope, root]) {
234
246
  // ---- OS-native folder picker ---------------------------------------------------------------
235
247
 
236
248
  /**
237
- * ms before an open dialog is abandoned. The Python original's 300 s, kept as a named
249
+ * ms before an open dialog is abandoned. 300 s, kept as a named
238
250
  * constant rather than a literal in the spawn call. `GENESEED_PICK_TIMEOUT_MS` is a TEST HOOK
239
251
  * ONLY — it overrides the constant so the timeout path can be proven in seconds instead of
240
252
  * five minutes (nobody is at the dialog to cancel it in an automated run); the 300 s default
@@ -256,8 +268,7 @@ const PICK_SCRIPT_WIN = 'Add-Type -AssemblyName System.Windows.Forms; '
256
268
  + 'if ($d.ShowDialog() -eq [System.Windows.Forms.DialogResult]::OK) '
257
269
  + '{ Write-Output $d.SelectedPath }';
258
270
 
259
- // Ported VERBATIM from the deleted Python (`git show 8860c72:rituals/_web_actions.py`,
260
- // `api_pick_folder`) — same prompt text, same AppleScript shape. `choose folder` is a
271
+ // The prompt text and the AppleScript shape are fixed. `choose folder` is a
261
272
  // StandardAdditions command that runs in-process inside `osascript`, so it needs no
262
273
  // automation-consent prompt the way scripting another app would.
263
274
  const PICK_SCRIPT_MAC = 'set f to POSIX path of (choose folder with prompt '
@@ -560,7 +571,8 @@ export function globalEmitHostFor(emit) {
560
571
  * user's after the first build. Derived from `SESSION_FILES`, the one list of them.
561
572
  */
562
573
  const SEED_FILES = new Set(SESSION_FILES.filter((r) => !r.includes('/')));
563
- const SEED_DIRS = new Set(SESSION_FILES.filter((r) => r.includes('/')).map((r) => r.split('/')[0]));
574
+ // `anamnesis` is the memory store's older name: no longer a session file, still the user's.
575
+ const SEED_DIRS = new Set(['anamnesis', ...SESSION_FILES.filter((r) => r.includes('/')).map((r) => r.split('/')[0])]);
564
576
  const isSeedOnce = (rel) => SEED_FILES.has(rel) || SEED_DIRS.has(rel.split('/')[0]);
565
577
 
566
578
  /**
@@ -626,12 +638,15 @@ export function apiRestore(state, files) {
626
638
  // behind it — prompt and boundary disagreeing by a WRITE, the write-side twin of the
627
639
  // read-side hole `diffCollect` had (and the reason the panel offered the file at all).
628
640
  doctrines: doctrinesForBuild(target),
641
+ // Its own tier root, or a restored file names a tier this install does not read.
642
+ sharedRoot: renderedTier(target, globalEmitHostFor(state.emit)).root,
629
643
  // The excluded rules for the same boundary reason: without them a restored AGENT.md
630
644
  // re-states a rule whose hook gate the install deliberately left unwired.
631
645
  excludeRules: excludedRulesOfDir(target),
632
646
  excludeSkills: excludedSkillsOfDir(target),
633
647
  // The kits: a restored AGENT.md keeps its Kits block and `Active kits:` line.
634
648
  kits: kitsOfDir(target),
649
+ sharedTier: sharedTierOfDir(target),
635
650
  // The gate switches: a restored AGENT.md must keep the install's `<gate>: off` lines.
636
651
  ...gatesOfDir(target),
637
652
  }));
@@ -709,20 +724,11 @@ export function apiInstallCmd(state, body) {
709
724
  if (installState(root, host, scope) === 'disabled') {
710
725
  return { error: 'install is disabled — reactivate it before (re)building' };
711
726
  }
712
- // A LEGACY CARRIER IS REFUSED, NEVER REBUILT — same guard as `rebuild-all`/`migrate` (see
713
- // `legacyProcessCarrierOfDir`'s docblock): `doctrinesForBuild`/`excludedRulesOfDir` below
714
- // read a pre-comms carrier exactly as written, and this endpoint's `{cmd}` is EXECUTED by
715
- // `startJob` (`js/web/handler.mjs`'s `install` action) — building that argv here would write
716
- // the same permanent loss a console click away.
717
- if (legacyProcessCarrierOfDir(root, host)) {
718
- return { error: `${host}:${scope} (${root}) predates the comms pack (its carrier names `
719
- + "'process 8') — run `geneseed setup` for it before rebuilding from the console" };
720
- }
721
727
  const emit = EMIT_FOR.get(`${host} ${scope}`);
722
728
  if (emit === undefined) return { error: `no install mode for ${host}:${scope}` };
723
729
  // Every read-back below is narrowed to `host`'s OWN carrier (host-compat B1) — see the
724
730
  // comment at `installProfile` in `js/build/generate.mjs`.
725
- // The theme default is THIS install's own, not the viewed one's: the Kits tab acts on any row.
731
+ // The theme default is THIS install's own, not the viewed one's: the Kits page acts on any row.
726
732
  // An ABSENT row has no footprint of its own (`footprintOfDir` answers its no-marker `full`),
727
733
  // so a new install takes the CLI's default, lean — see `apiDeployCmd` below.
728
734
  const { theme, footprint: fp, posture: pos, mode, trust } = bodyAxes(body, {
@@ -755,10 +761,15 @@ export function apiInstallCmd(state, body) {
755
761
  + [...loadKits().keys()].join(', ') };
756
762
  }
757
763
  } catch (e) { return { error: String(e?.message ?? e) }; }
764
+ // D11: the shared tier is a project install's option; a global install owns it.
765
+ const sharedTier = scope === 'global' ? false : bodySharedTier(body, root, host);
766
+ if (scope === 'global' && bget(body, 'sharedTier') === true) {
767
+ return { error: 'the shared tier is a project option — a global install already owns it' };
768
+ }
758
769
  const out = scope === 'global' ? null : String(root);
759
770
  const argv = setupBuildArgs(theme || 'neutral', emit, out, out, fp, pos, mode, doctrines,
760
771
  PACK_ORDER, excludeRules, trust, excludedSkillsOfDir(root, host), gates,
761
- kits ?? kitsOfDir(root, host));
772
+ kits ?? kitsOfDir(root, host), sharedTier);
762
773
  return { cmd: [process.execPath, path.join(ROOT, 'bin', 'build-driver.mjs'), ...argv] };
763
774
  }
764
775
 
@@ -772,7 +783,7 @@ export function apiInstallCmd(state, body) {
772
783
  * built from the REGISTRY's host/scope/root, never from body strings, and it is what `rebuildAll`
773
784
  * replays (`installProfile`), so a console rebuild of one row equals the CLI's of all of them.
774
785
  *
775
- * ALL OR NOTHING: one unknown, inactive or legacy entry (or a malformed body) is `{ error }` and no
786
+ * ALL OR NOTHING: one unknown or inactive entry (or a malformed body) is `{ error }` and no
776
787
  * job starts. `detectedInstall`'s `NotFound` would answer 404; a refusal here means the world
777
788
  * changed under the client, so the dispatcher answers 409, as for `install`. The shape is checked
778
789
  * before the registry is read, so a bad body never costs a detect.
@@ -791,11 +802,6 @@ export function rebuildCmds(body) {
791
802
  const hit = active.findLast(([host, , root]) => JSON.stringify([host, String(root)]) === key);
792
803
  if (hit === undefined) return { error: `not an active install: ${key}` };
793
804
  const [host, scope, root] = hit;
794
- // Asked BEFORE `installProfile`, as `rebuildAll` does: a legacy carrier must never be rebuilt.
795
- if (legacyProcessCarrierOfDir(root, host)) {
796
- return { error: `${host}:${scope} (${root}) predates the comms pack (its carrier names `
797
- + "'process 8') — run `geneseed setup` for it before rebuilding from the console" };
798
- }
799
805
  steps.push(...actionCommands('build', { buildArgv: installProfile(host, scope, root).argv }));
800
806
  }
801
807
  return { cmds: steps };
@@ -877,13 +883,6 @@ export function apiDeployCmd(state, body) {
877
883
  if (cfgdirs.has(root)) {
878
884
  return { error: "that's a host global config dir — use its existing row to build a global install" };
879
885
  }
880
- // Same guard as `apiInstallCmd` above: a landing folder that already holds a pre-comms
881
- // install must not be rebuilt through `doctrinesForBuild`/`excludedRulesOfDir` below. A
882
- // fresh, never-built folder has no carrier at all, so this is a no-op for the common case.
883
- if (legacyProcessCarrierOfDir(root, host)) {
884
- return { error: `${root} predates the comms pack (its carrier names 'process 8') — `
885
- + 'run `geneseed setup` for it before deploying over it' };
886
- }
887
886
  // A fresh deploy is LEAN, at the default register, mode and trust: the same default as the
888
887
  // CLI's `--footprint`, which the user chose (2026-10-24) over the console's old `full` — a
889
888
  // console install and a CLI install of the same folder must not differ in always-on text for
@@ -902,6 +901,7 @@ export function apiDeployCmd(state, body) {
902
901
  const gates = bodyGates(body, root, host);
903
902
  // project-scope emit name == host name (opencode / claude / bob / openclaude)
904
903
  const argv = setupBuildArgs(theme || 'neutral', host, root, root, fp, pos, mode, doctrines,
905
- PACK_ORDER, excludeRules, trust, excludedSkillsOfDir(root, host), gates, kitsOfDir(root, host));
904
+ PACK_ORDER, excludeRules, trust, excludedSkillsOfDir(root, host), gates, kitsOfDir(root, host),
905
+ bodySharedTier(body, root, host));
906
906
  return { cmd: [process.execPath, path.join(ROOT, 'bin', 'build-driver.mjs'), ...argv] };
907
907
  }