gentle-pi 4.8.0 → 4.9.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 (370) hide show
  1. package/README.md +60 -0
  2. package/assets/agents/gentle-ai-explore.md +1 -1
  3. package/assets/agents/gentle-ai-verify.md +1 -1
  4. package/assets/agents/gentle-ai-worker.md +10 -9
  5. package/assets/design-canvas/canvas-boards.js +22 -2
  6. package/assets/design-canvas/canvas-boot.js +3 -1
  7. package/assets/design-canvas/canvas-i18n-es.js +5 -0
  8. package/assets/design-canvas/canvas-menu.js +13 -7
  9. package/assets/design-canvas/canvas-messages.js +1 -1
  10. package/assets/design-canvas/canvas-rail.js +5 -2
  11. package/assets/design-canvas/canvas-store.js +3 -0
  12. package/assets/design-canvas/canvas-theme.js +69 -0
  13. package/assets/design-canvas/canvas.css +27 -2
  14. package/assets/design-canvas/index.html +3 -0
  15. package/assets/design-canvas/inspector.js +28 -5
  16. package/assets/design-canvas/theme-early.js +10 -0
  17. package/assets/migrations/agent-body-history.json +6 -0
  18. package/assets/orchestrator-delegation.md +1 -5
  19. package/assets/orchestrator-full-delegation-card.md +9 -13
  20. package/assets/orchestrator-full-delegation.md +2 -2
  21. package/assets/orchestrator-memory.md +2 -2
  22. package/assets/orchestrator-prompts.md +3 -31
  23. package/assets/orchestrator-tracking.md +6 -6
  24. package/assets/orchestrator-verification.md +4 -4
  25. package/assets/orchestrator-writer.md +12 -12
  26. package/assets/orchestrator.md +2 -2
  27. package/bin/gentle-shell.mjs +77 -1
  28. package/contracts/review-provider-contract-mirror/provider-contract.lock.json +7 -7
  29. package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/manifest.json +3 -3
  30. package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/orchestration/pi.md +1 -1
  31. package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/routing/pi.md +10 -10
  32. package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/generated/provider-capabilities.baseline.json +3 -3
  33. package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/generated/provider-roles.baseline.json +1 -1
  34. package/docs/assets/features/gentle-tower.png +0 -0
  35. package/docs/auto-permission-answers.md +1 -1
  36. package/docs/bundled-install.md +1 -1
  37. package/docs/delegated-verification.md +6 -4
  38. package/docs/desktop-feed.md +303 -0
  39. package/docs/desktop-rpc.md +703 -25
  40. package/docs/fast-mode.md +2 -2
  41. package/docs/gentle-shell-desktop.md +465 -0
  42. package/docs/gentle-shell.md +65 -3
  43. package/docs/images/desktop/chat.png +0 -0
  44. package/docs/images/desktop/palette.png +0 -0
  45. package/docs/images/desktop/todo.png +0 -0
  46. package/docs/install-wizard.md +1 -1
  47. package/docs/odd-preparation-continuity.md +1 -1
  48. package/docs/readme-reference.md +44 -15
  49. package/docs/work-continuity.md +10 -7
  50. package/extensions/ask-user-choice.ts +36 -18
  51. package/extensions/ask-user-question.ts +47 -8
  52. package/extensions/gentle-agents.ts +206 -37
  53. package/extensions/gentle-ai.ts +234 -24
  54. package/extensions/gentle-desktop-feed.ts +778 -0
  55. package/extensions/gentle-desktop-rpc.ts +145 -12
  56. package/extensions/gentle-herdr-desktop-status.ts +275 -0
  57. package/extensions/gentle-shell.ts +69 -7
  58. package/extensions/gentle-stats.ts +30 -1
  59. package/extensions/gentle-tower.ts +305 -0
  60. package/extensions/skill-registry.ts +13 -3
  61. package/herdr/RECIPE.md +157 -0
  62. package/herdr/keys.json +14 -0
  63. package/herdr/layouts/gentle-shell.json +202 -0
  64. package/herdr/mods/gentle-agents/icons/kind-herdr.svg +1 -0
  65. package/herdr/mods/gentle-agents/icons/kind-remote.svg +1 -0
  66. package/herdr/mods/gentle-agents/icons/kind-tui.svg +1 -0
  67. package/herdr/mods/gentle-agents/main.js +190 -0
  68. package/herdr/mods/gentle-agents/mod.json +1 -0
  69. package/herdr/mods/gentle-agents/snapshot.js +469 -0
  70. package/herdr/mods/gentle-agents/tokens.js +273 -0
  71. package/herdr/mods/gentle-chat/MINIMAL.md +69 -0
  72. package/herdr/mods/gentle-chat/actions.js +180 -0
  73. package/herdr/mods/gentle-chat/feed.js +321 -0
  74. package/herdr/mods/gentle-chat/icons/branch.svg +1 -0
  75. package/herdr/mods/gentle-chat/icons/chat.svg +1 -0
  76. package/herdr/mods/gentle-chat/icons/check.svg +1 -0
  77. package/herdr/mods/gentle-chat/icons/chev.svg +1 -0
  78. package/herdr/mods/gentle-chat/icons/clip.svg +1 -0
  79. package/herdr/mods/gentle-chat/icons/down.svg +1 -0
  80. package/herdr/mods/gentle-chat/icons/folder.svg +1 -0
  81. package/herdr/mods/gentle-chat/icons/kind-herdr.svg +1 -0
  82. package/herdr/mods/gentle-chat/icons/kind-remote.svg +1 -0
  83. package/herdr/mods/gentle-chat/icons/kind-tui.svg +1 -0
  84. package/herdr/mods/gentle-chat/icons/mark.svg +1 -0
  85. package/herdr/mods/gentle-chat/icons/send.svg +1 -0
  86. package/herdr/mods/gentle-chat/icons/shield.svg +1 -0
  87. package/herdr/mods/gentle-chat/icons/stop.svg +1 -0
  88. package/herdr/mods/gentle-chat/icons/term.svg +1 -0
  89. package/herdr/mods/gentle-chat/icons/user.svg +1 -0
  90. package/herdr/mods/gentle-chat/icons/x.svg +1 -0
  91. package/herdr/mods/gentle-chat/main.js +968 -0
  92. package/herdr/mods/gentle-chat/mod.json +1 -0
  93. package/herdr/mods/gentle-chat/session.js +212 -0
  94. package/herdr/mods/gentle-chat/snapshot.js +469 -0
  95. package/herdr/mods/gentle-chat/tokens.js +137 -0
  96. package/herdr/mods/gentle-chat/ui.js +883 -0
  97. package/herdr/mods/gentle-confirm/main.js +60 -0
  98. package/herdr/mods/gentle-confirm/mod.json +1 -0
  99. package/herdr/mods/gentle-inspector/actions.js +180 -0
  100. package/herdr/mods/gentle-inspector/icons/bolt.svg +1 -0
  101. package/herdr/mods/gentle-inspector/icons/bot.svg +1 -0
  102. package/herdr/mods/gentle-inspector/icons/check.svg +1 -0
  103. package/herdr/mods/gentle-inspector/icons/db.svg +1 -0
  104. package/herdr/mods/gentle-inspector/icons/diff.svg +1 -0
  105. package/herdr/mods/gentle-inspector/icons/jobs.svg +1 -0
  106. package/herdr/mods/gentle-inspector/icons/plug.svg +1 -0
  107. package/herdr/mods/gentle-inspector/icons/review.svg +1 -0
  108. package/herdr/mods/gentle-inspector/icons/stats.svg +1 -0
  109. package/herdr/mods/gentle-inspector/icons/stop.svg +1 -0
  110. package/herdr/mods/gentle-inspector/icons/todo.svg +1 -0
  111. package/herdr/mods/gentle-inspector/main.js +500 -0
  112. package/herdr/mods/gentle-inspector/mod.json +1 -0
  113. package/herdr/mods/gentle-inspector/snapshot.js +469 -0
  114. package/herdr/mods/gentle-inspector/tokens.js +273 -0
  115. package/herdr/mods/gentle-palette/actions.js +180 -0
  116. package/herdr/mods/gentle-palette/icons/bolt.svg +1 -0
  117. package/herdr/mods/gentle-palette/icons/bot.svg +1 -0
  118. package/herdr/mods/gentle-palette/icons/chat.svg +1 -0
  119. package/herdr/mods/gentle-palette/icons/check.svg +1 -0
  120. package/herdr/mods/gentle-palette/icons/cmd.svg +1 -0
  121. package/herdr/mods/gentle-palette/icons/diff.svg +1 -0
  122. package/herdr/mods/gentle-palette/icons/jobs.svg +1 -0
  123. package/herdr/mods/gentle-palette/icons/plus.svg +1 -0
  124. package/herdr/mods/gentle-palette/icons/review.svg +1 -0
  125. package/herdr/mods/gentle-palette/icons/search.svg +1 -0
  126. package/herdr/mods/gentle-palette/icons/shield.svg +1 -0
  127. package/herdr/mods/gentle-palette/icons/stats.svg +1 -0
  128. package/herdr/mods/gentle-palette/icons/stop.svg +1 -0
  129. package/herdr/mods/gentle-palette/icons/term.svg +1 -0
  130. package/herdr/mods/gentle-palette/icons/todo.svg +1 -0
  131. package/herdr/mods/gentle-palette/main.js +333 -0
  132. package/herdr/mods/gentle-palette/mod.json +1 -0
  133. package/herdr/mods/gentle-palette/snapshot.js +469 -0
  134. package/herdr/mods/gentle-palette/tokens.js +273 -0
  135. package/herdr/mods/gentle-pane/icons/chat.svg +1 -0
  136. package/herdr/mods/gentle-pane/icons/close.svg +1 -0
  137. package/herdr/mods/gentle-pane/icons/kind-herdr.svg +1 -0
  138. package/herdr/mods/gentle-pane/icons/kind-remote.svg +1 -0
  139. package/herdr/mods/gentle-pane/icons/kind-tui.svg +1 -0
  140. package/herdr/mods/gentle-pane/icons/split-down.svg +1 -0
  141. package/herdr/mods/gentle-pane/icons/split-right.svg +1 -0
  142. package/herdr/mods/gentle-pane/icons/term.svg +1 -0
  143. package/herdr/mods/gentle-pane/icons/unzoom.svg +1 -0
  144. package/herdr/mods/gentle-pane/icons/zoom.svg +1 -0
  145. package/herdr/mods/gentle-pane/main.js +91 -0
  146. package/herdr/mods/gentle-pane/mod.json +1 -0
  147. package/herdr/mods/gentle-pane/snapshot.js +469 -0
  148. package/herdr/mods/gentle-pane/tokens.js +273 -0
  149. package/herdr/mods/gentle-sidebar/actions.js +180 -0
  150. package/herdr/mods/gentle-sidebar/icons/gear.svg +1 -0
  151. package/herdr/mods/gentle-sidebar/icons/mark.svg +1 -0
  152. package/herdr/mods/gentle-sidebar/icons/refresh.svg +1 -0
  153. package/herdr/mods/gentle-sidebar/icons/server-plus.svg +1 -0
  154. package/herdr/mods/gentle-sidebar/main.js +171 -0
  155. package/herdr/mods/gentle-sidebar/mod.json +1 -0
  156. package/herdr/mods/gentle-sidebar/snapshot.js +469 -0
  157. package/herdr/mods/gentle-sidebar/tokens.js +273 -0
  158. package/herdr/mods/gentle-spaces/icons/kind-herdr.svg +1 -0
  159. package/herdr/mods/gentle-spaces/icons/kind-remote.svg +1 -0
  160. package/herdr/mods/gentle-spaces/icons/kind-tui.svg +1 -0
  161. package/herdr/mods/gentle-spaces/icons/monitor.svg +1 -0
  162. package/herdr/mods/gentle-spaces/icons/plus.svg +1 -0
  163. package/herdr/mods/gentle-spaces/icons/server.svg +1 -0
  164. package/herdr/mods/gentle-spaces/machines.js +31 -0
  165. package/herdr/mods/gentle-spaces/main.js +299 -0
  166. package/herdr/mods/gentle-spaces/mod.json +1 -0
  167. package/herdr/mods/gentle-spaces/snapshot.js +469 -0
  168. package/herdr/mods/gentle-spaces/tokens.js +273 -0
  169. package/herdr/mods/gentle-status/actions.js +180 -0
  170. package/herdr/mods/gentle-status/main.js +192 -0
  171. package/herdr/mods/gentle-status/mod.json +1 -0
  172. package/herdr/mods/gentle-status/snapshot.js +469 -0
  173. package/herdr/mods/gentle-status/tokens.js +273 -0
  174. package/herdr/mods/gentle-tabs/icons/close.svg +1 -0
  175. package/herdr/mods/gentle-tabs/icons/kind-herdr.svg +1 -0
  176. package/herdr/mods/gentle-tabs/icons/kind-remote.svg +1 -0
  177. package/herdr/mods/gentle-tabs/icons/kind-tui.svg +1 -0
  178. package/herdr/mods/gentle-tabs/icons/plus.svg +1 -0
  179. package/herdr/mods/gentle-tabs/icons/win-close.svg +1 -0
  180. package/herdr/mods/gentle-tabs/icons/win-max.svg +1 -0
  181. package/herdr/mods/gentle-tabs/icons/win-min.svg +1 -0
  182. package/herdr/mods/gentle-tabs/icons/win-restore.svg +1 -0
  183. package/herdr/mods/gentle-tabs/main.js +171 -0
  184. package/herdr/mods/gentle-tabs/mod.json +1 -0
  185. package/herdr/mods/gentle-tabs/snapshot.js +469 -0
  186. package/herdr/mods/gentle-tabs/tokens.js +273 -0
  187. package/herdr/mods/gentle-tokens/main.js +20 -0
  188. package/herdr/mods/gentle-tokens/mod.json +1 -0
  189. package/herdr/mods/gentle-tokens/snapshot.js +469 -0
  190. package/herdr/mods/gentle-tokens/tokens.js +273 -0
  191. package/herdr/preview.png +0 -0
  192. package/herdr/themes/gentle-shell-dark.json +33 -0
  193. package/herdr/themes/gentle-shell-light.json +34 -0
  194. package/lib/agents-protocol.ts +2 -0
  195. package/lib/agents-rpc-publisher.ts +39 -12
  196. package/lib/agents-runner.ts +1 -0
  197. package/lib/auto-permission-answers.ts +2 -1
  198. package/lib/background-jobs.ts +22 -2
  199. package/lib/bounded-writer-admission.ts +1 -1
  200. package/lib/change-diff.ts +104 -0
  201. package/lib/commit-slice-signal.ts +1 -1
  202. package/lib/design-canvas-assets.ts +2 -0
  203. package/lib/desktop-agents-service.ts +31 -10
  204. package/lib/desktop-changes-service.ts +171 -0
  205. package/lib/desktop-feed-actions.ts +804 -0
  206. package/lib/desktop-feed-answers.ts +129 -0
  207. package/lib/desktop-feed-sources.ts +184 -0
  208. package/lib/desktop-feed-stats.ts +98 -0
  209. package/lib/desktop-feed-store.ts +124 -0
  210. package/lib/desktop-feed.ts +788 -0
  211. package/lib/desktop-jobs-service.ts +34 -7
  212. package/lib/desktop-review-service.ts +187 -0
  213. package/lib/desktop-rpc-agents.ts +112 -3
  214. package/lib/desktop-rpc-changes.ts +223 -0
  215. package/lib/desktop-rpc-config-watch.ts +285 -0
  216. package/lib/desktop-rpc-config.ts +162 -8
  217. package/lib/desktop-rpc-jobs.ts +118 -9
  218. package/lib/desktop-rpc-permissions.ts +154 -3
  219. package/lib/desktop-rpc-review.ts +180 -0
  220. package/lib/desktop-rpc-session.ts +203 -0
  221. package/lib/desktop-rpc-sessions.ts +250 -0
  222. package/lib/desktop-rpc-stats.ts +187 -0
  223. package/lib/desktop-rpc-updates.ts +143 -0
  224. package/lib/desktop-rpc.ts +116 -5
  225. package/lib/desktop-session-service.ts +223 -0
  226. package/lib/desktop-sessions-service.ts +249 -0
  227. package/lib/desktop-stats-service.ts +142 -0
  228. package/lib/desktop-updates-service.ts +268 -0
  229. package/lib/gentle-shell-desktop.ts +1370 -0
  230. package/lib/gentle-shell-launcher.ts +45 -3
  231. package/lib/herdr-desktop-events.ts +40 -0
  232. package/lib/herdr-desktop-status.ts +229 -0
  233. package/lib/jobs-sidebar-state.ts +5 -0
  234. package/lib/native-review-cli.ts +7 -0
  235. package/lib/openai-fast-tier.ts +1 -0
  236. package/lib/session-profile-freeze.ts +13 -5
  237. package/lib/stats-collector.ts +56 -27
  238. package/lib/tower-actions.ts +100 -0
  239. package/lib/tower-hub.ts +73 -0
  240. package/lib/tower-launch.ts +111 -0
  241. package/lib/tower-open.ts +99 -0
  242. package/lib/tower-presence.ts +70 -0
  243. package/lib/tower-server.ts +234 -0
  244. package/lib/tower-snapshot.ts +298 -0
  245. package/lib/update-status.ts +238 -0
  246. package/lib/verifier-settle-reminder.ts +1 -1
  247. package/package.json +13 -4
  248. package/runtime/design-canvas-assets.mjs +2 -0
  249. package/runtime/gentle-shell-desktop.mjs +1371 -0
  250. package/runtime/gentle-shell-launcher.mjs +44 -2
  251. package/runtime/native-review-cli.mjs +7 -0
  252. package/runtime/tower-actions.mjs +101 -0
  253. package/runtime/tower-hub.mjs +74 -0
  254. package/runtime/tower-launch.mjs +112 -0
  255. package/runtime/tower-open.mjs +100 -0
  256. package/runtime/tower-presence.mjs +71 -0
  257. package/runtime/tower-server.mjs +234 -0
  258. package/runtime/tower-snapshot.mjs +299 -0
  259. package/scripts/build-full-delegation-card.mjs +1 -21
  260. package/scripts/build-runtime-modules.mjs +9 -0
  261. package/scripts/gentle-ai-installer.mjs +10 -10
  262. package/scripts/verify-package-files.mjs +35 -15
  263. package/skills/provider-defect-report/SKILL.md +61 -0
  264. package/skills/rdd-defect-workflow/SKILL.md +3 -3
  265. package/tests/agent-prompt-diet-contract.test.ts +2 -2
  266. package/tests/append-system-prompt-route.test.ts +16 -5
  267. package/tests/ask-user-choice.test.ts +78 -21
  268. package/tests/ask-user-question.test.ts +59 -5
  269. package/tests/auto-permission-answers.test.ts +12 -1
  270. package/tests/background-jobs.test.ts +12 -0
  271. package/tests/bounded-stop-contract.test.ts +139 -26
  272. package/tests/change-diff.test.ts +75 -0
  273. package/tests/commit-slice-signal.test.ts +3 -2
  274. package/tests/decision-routing-contract.test.ts +390 -0
  275. package/tests/delegated-key-learnings-contract.test.ts +21 -28
  276. package/tests/delivery-b-rendered-surfaces.test.ts +32 -0
  277. package/tests/design-canvas-i18n.test.ts +24 -22
  278. package/tests/design-canvas-inspector.test.ts +67 -0
  279. package/tests/design-canvas-modules.test.ts +3 -2
  280. package/tests/design-canvas-rail.test.ts +10 -10
  281. package/tests/design-canvas-store.test.ts +9 -0
  282. package/tests/design-canvas-theme.test.ts +198 -0
  283. package/tests/design-canvas-tokens.test.ts +1 -1
  284. package/tests/desktop-feed-actions-guards.test.ts +595 -0
  285. package/tests/desktop-feed-actions.test.ts +761 -0
  286. package/tests/desktop-feed-live-work.test.ts +209 -0
  287. package/tests/desktop-feed-performance.test.ts +369 -0
  288. package/tests/desktop-feed-plan-profiles.test.ts +509 -0
  289. package/tests/desktop-feed-send-prompt.test.ts +303 -0
  290. package/tests/desktop-feed-tool-summaries.test.ts +69 -0
  291. package/tests/desktop-feed.test.ts +615 -0
  292. package/tests/desktop-rpc-agents.test.ts +428 -2
  293. package/tests/desktop-rpc-changes.test.ts +608 -0
  294. package/tests/desktop-rpc-config-watch.test.ts +1159 -0
  295. package/tests/desktop-rpc-config.test.ts +11 -1
  296. package/tests/desktop-rpc-design.test.ts +11 -1
  297. package/tests/desktop-rpc-jobs.test.ts +402 -5
  298. package/tests/desktop-rpc-permissions.test.ts +11 -1
  299. package/tests/desktop-rpc-review.test.ts +678 -0
  300. package/tests/desktop-rpc-session.test.ts +642 -0
  301. package/tests/desktop-rpc-sessions.test.ts +647 -0
  302. package/tests/desktop-rpc-stats.test.ts +431 -0
  303. package/tests/desktop-rpc-updates.test.ts +525 -0
  304. package/tests/desktop-rpc-usage.test.ts +11 -1
  305. package/tests/desktop-rpc.test.ts +43 -2
  306. package/tests/fixtures/primary-session-prompt/gentleman.golden.md +11 -13
  307. package/tests/fixtures/session-profile-v1/replay.ts +4 -1
  308. package/tests/full-delegation-closure.test.ts +20 -1
  309. package/tests/gentle-agents.test.ts +519 -4
  310. package/tests/gentle-ai-binary.test.ts +1 -1
  311. package/tests/gentle-ai-installer.test.ts +52 -52
  312. package/tests/gentle-ai.test.ts +75 -16
  313. package/tests/gentle-fast.test.ts +15 -0
  314. package/tests/gentle-herdr-desktop-status.test.ts +595 -0
  315. package/tests/gentle-shell-desktop-bin.test.ts +125 -0
  316. package/tests/gentle-shell-desktop.test.ts +927 -0
  317. package/tests/gentle-shell-launcher-tower.test.ts +104 -0
  318. package/tests/gentle-shell.test.ts +3 -0
  319. package/tests/gentle-tower.test.ts +578 -0
  320. package/tests/herdr-desktop-status.test.ts +285 -0
  321. package/tests/independent-recovery-delivery.test.ts +16 -4
  322. package/tests/installer-server.test.ts +2 -2
  323. package/tests/lazy-module-contradictions-contract.test.ts +27 -4
  324. package/tests/maintainer/desktop-rpc.maintest.ts +279 -4
  325. package/tests/native-review-capability-contract.test.ts +9 -1
  326. package/tests/no-self-pause-contract.test.ts +23 -13
  327. package/tests/odd-routing-canonical-ratchet.test.ts +10 -0
  328. package/tests/odd-routing-contract.test.ts +19 -3
  329. package/tests/orchestrator-budget.test.ts +3 -1
  330. package/tests/orchestrator-prompt-budget.test.ts +2 -1
  331. package/tests/orchestrator-prompt-diet-contract.test.ts +31 -3
  332. package/tests/package-manifest.test.ts +10 -10
  333. package/tests/pi-routing-measured-values.test.ts +24 -0
  334. package/tests/primary-session-prompt.test.ts +25 -0
  335. package/tests/profile-fast-tier.test.ts +66 -1
  336. package/tests/provider-defect-handoff.test.ts +118 -100
  337. package/tests/review-contract-prompt.test.ts +2 -1
  338. package/tests/review-due-public-boundary.test.ts +2 -1
  339. package/tests/sensitive-path-tools.test.ts +138 -4
  340. package/tests/session-profile-extension.test.ts +310 -16
  341. package/tests/session-profile-freeze.test.ts +26 -0
  342. package/tests/session-profile-v1-compat.test.ts +20 -0
  343. package/tests/skill-collision-prefixes.test.ts +1 -0
  344. package/tests/skill-contradictions-contract.test.ts +5 -3
  345. package/tests/skill-registry.test.ts +54 -0
  346. package/tests/stats-collector.test.ts +109 -2
  347. package/tests/support/design-canvas-dom.ts +17 -0
  348. package/tests/task-size-routing-contract.test.ts +7 -3
  349. package/tests/tower-actions.test.ts +247 -0
  350. package/tests/tower-artifacts.test.ts +114 -0
  351. package/tests/tower-open.test.ts +97 -0
  352. package/tests/tower-presence.test.ts +175 -0
  353. package/tests/tower-server.test.ts +122 -0
  354. package/tests/tower-snapshot.test.ts +236 -0
  355. package/tests/tower-web-echo.test.ts +125 -0
  356. package/tests/tower-web-hover.test.ts +251 -0
  357. package/tests/verification-scoped-stop-contract.test.ts +32 -0
  358. package/tests/verification-tiers-contract.test.ts +5 -5
  359. package/tests/verifier-settle-reminder.test.ts +2 -2
  360. package/tests/verify-first-launch-contract.test.ts +2 -2
  361. package/tests/work-continuity-contract.test.ts +83 -17
  362. package/tests/writer-rejection-next-step.test.ts +55 -0
  363. package/tests/writer-surface-authority-contract.test.ts +158 -0
  364. /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/README.md +0 -0
  365. /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/schemas/lens.schema.json +0 -0
  366. /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/schemas/refuter.schema.json +0 -0
  367. /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/schemas/targeted-validator.schema.json +0 -0
  368. /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/vectors/lens.json +0 -0
  369. /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/vectors/refuter.json +0 -0
  370. /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/vectors/targeted-validator.json +0 -0
package/README.md CHANGED
@@ -214,6 +214,26 @@ You should not have to run `git status` in every worktree to find out what your
214
214
 
215
215
  ---
216
216
 
217
+ ### Gentle Tower — Every session as a floor, in your browser
218
+
219
+ <img width="100%" src="docs/assets/features/gentle-tower.png" alt="Gentle Tower: a painted pixel-art building at dusk, one floor per Gentle Shell session with rooms for map, workshop, lab, review, Engram, Gentle AI and lounge; agents stand in the room of what they do, and the floor list on the left shows each session's cost and todo progress">
220
+
221
+ Not everyone lives in a terminal. `/gentle:tower` opens a local web view where each project is a painted building and each open Gentle Shell session is a floor of it. The orchestrator and its named helpers (`worker`, `explore`, `verify`, or `worker-tests` when a role repeats) stand in the room of what they are doing: the map while exploring, the workshop while building, the lab while testing, the lounge when done. A `?` means a floor needs you.
222
+
223
+ To open it without a session, run `gentle-shell tower` from any terminal: it prints the local URL, opens your browser and keeps serving until Ctrl+C (`--no-open` only prints the URL; `--port <n>` fixes the port, still `127.0.0.1` only).
224
+
225
+ - **Tasks at a glance**: each floor shows its todo progress (`2/4 · blocked: …`); click it for the full list. The map's corkboard notes are the same tasks.
226
+ - **Talk to a floor** (`T`): read the orchestrator's latest words and send a message; it arrives as a new turn, or as a follow-up while the agent works. Questions asked in the terminal show as waiting; answer them there or tell the floor.
227
+ - **Artifacts**: the docs, Mermaid diagrams and images a floor wrote open in a viewer.
228
+ - **Engram library and your tab**: a read-only window on the project's memories and on what the open sessions spent, by model and by project.
229
+ - **Controls**: stop a helper, change a floor's permissions, and switch review mode.
230
+
231
+ The web never has more power than the terminal: it listens on `127.0.0.1` only, with a fresh token in the path on every launch, refuses other origins. Lowering a floor's permissions applies at once; raising them asks for confirmation in that session's terminal. Each session runs the requests itself, with its own rules.
232
+
233
+ **[Docs →](docs/gentle-shell.md#gentle-tower)**
234
+
235
+ ---
236
+
217
237
  ### Gentle Agents — Parallel work with a live view
218
238
 
219
239
  <img width="100%" src="docs/assets/features/agents-view.png" alt="Gentle Agents overlay showing a completed subagent thread with model, tokens, and elapsed columns, and the structured handoff it returned">
@@ -305,6 +325,45 @@ The Status panel has a **Jobs** section with each running job's description. Whe
305
325
 
306
326
  **[Docs →](docs/gentle-shell.md#background-jobs)**
307
327
 
328
+ ---
329
+
330
+ ### Gentle Shell Desktop — The same session, in a native window
331
+
332
+ <img width="100%" src="docs/images/desktop/chat.png" alt="Gentle Shell Desktop running a real session: projects and agents in the left sidebar with plan usage below, sessions as tabs, the chat in the centre with an edit diff card, tool calls and the agent's summary, the Changes inspector on the right with per-file line counts, and a status bar with the ODD todo progress and jobs">
333
+
334
+ <p align="center"><sub>A real session: the agent edits <code>src/text.js</code>, runs the tests and reports, while Changes tracks the files.</sub></p>
335
+
336
+ <table>
337
+ <tr>
338
+ <td width="50%"><img src="docs/images/desktop/todo.png" alt="The Todo tab of the inspector showing the session's task list completed, 3 of 3"></td>
339
+ <td width="50%"><img src="docs/images/desktop/palette.png" alt="The ⌘K Gentle palette open over the chat, listing session commands such as /new, /resume, /fork, /compact and /export"></td>
340
+ </tr>
341
+ <tr>
342
+ <td align="center"><sub>The session's todo, live in the inspector.</sub></td>
343
+ <td align="center"><sub><code>⌘K</code> opens every Gentle Shell command.</sub></td>
344
+ </tr>
345
+ </table>
346
+
347
+ Gentle Shell Desktop shows your Gentle Shell sessions in [Herdr app](https://herdr.dev): the conversation as a native chat, with Changes, Todo, Agents, Jobs, Review and Session stats beside it, and the real TUI one switch away (`⌘J`). It is Herdr, unchanged, plus Gentle Shell's own mods and layout; the desktop acts with exactly the authority you have in the terminal, and consent is always answered in the terminal.
348
+
349
+ - **Every session on your machine**, in two sidebar sections: **Herdr** (running in this window, with the Chat | Terminal switch) and **TUI** (running in any other terminal, such as Herdr TUI or Ghostty; you can still write to it from the chat).
350
+ - **Needs you** pinned at the top of the sidebar, with a notification, whenever a session waits for an answer.
351
+ - **A minimal chat** like the TUI's: every tool, diff or subagent is one line that expands (`⌘O` expands or collapses all).
352
+ - **Plan usage and model profiles**: every usage window the TUI shows, and switching profiles from the header.
353
+ - **Remote machines** from Herdr (**Add machine**), and **light and dark** themes that follow Herdr and the system.
354
+
355
+ ```bash
356
+ gentle-shell desktop # install what is missing (asks first), then open the window
357
+ gentle-shell desktop --status # versions and what is installed
358
+ gentle-shell desktop --uninstall # remove our mods, layout and shortcuts; Herdr stays
359
+ ```
360
+
361
+ To try it before it reaches a release, switch to the main channel first with `gentle-shell upgrade --channel main`, then run `gentle-shell desktop`. Sessions that were already open show up after you restart them.
362
+
363
+ Requires macOS on Apple silicon or Linux (x86_64, arm64); Gentle Shell installs Herdr app 0.1.16 for you, checked against a pinned SHA-256. On Windows, install Herdr app with its official installer first.
364
+
365
+ **[Docs →](docs/gentle-shell-desktop.md)**
366
+
308
367
  <p align="center">
309
368
  <img src="docs/assets/brand/terminal-divider.svg" width="480" alt="">
310
369
  </p>
@@ -655,6 +714,7 @@ Start with the product-facing destination, then move into the operational refere
655
714
  | Destination | Purpose |
656
715
  | --- | --- |
657
716
  | [gentle-shell reference](docs/gentle-shell.md) | Workspace layout, changes, usage, agents, and todo interactions. |
717
+ | [Gentle Shell Desktop](docs/gentle-shell-desktop.md) | Install, controls, shortcuts, safety and troubleshooting for the Herdr app window. |
658
718
  | [ODD workflow](docs/readme-reference.md#organic-driven-development) · [Technical reference](docs/readme-reference.md) | Everyday work and recovery, installation, configuration, commands, and contributor detail. |
659
719
  | [Installation wizard (preview)](docs/install-wizard.md) | How the browser installer checks your computer, what it installs on the release and main channels, its security model, and what is still being verified. |
660
720
  | [Removing Gentle Shell](docs/gentle-shell-uninstall.md) | What `gentle-shell self-uninstall` removes, keeps and never touches. |
@@ -28,4 +28,4 @@ Map relevant files, symbols, relationships, and uncertainty within the parent-pr
28
28
  - Do not fix findings, delegate to child agents, commit, or push.
29
29
  - Do not use review lenses. RDD review remains independent and parent-owned.
30
30
 
31
- Return a compact handoff of at most ~2k tokens: `path:line` or source-URL/passage evidence, observed relationships, and remaining uncertainty; never restate the task, the spec text, or unchanged file contents. Any requested `## Key Learnings` block follows it. Never claim evidence you did not observe.
31
+ Return a compact handoff of at most ~2k tokens: `path:line` or source-URL/passage evidence, observed relationships, and remaining uncertainty; never restate the task, the spec text, or unchanged file contents. Never claim evidence you did not observe.
@@ -62,4 +62,4 @@ Probe on your first launch; never wait for further authorization. Create a fresh
62
62
  - Do not delegate to child agents, commit, or push.
63
63
  - Do not use review lenses. RDD review remains independent and parent-owned.
64
64
 
65
- Return a compact evidence handoff of at most ~2k tokens: the verdict per spec item, exact commands with exit codes, test counts, and observed results, blockers with `path:line`, anything left unverified, and scratch paths; never restate the task or spec beyond the line a finding contradicts, or unchanged file contents. The probe regression tests, then any requested `## Key Learnings` block, follow it. Never claim a command ran or a check passed without observed output. A safety-guard denial is not an infrastructure failure: report it in the handoff with the guard's response -- rule and blocked path, sanitized of secret contents -- and mark that probe unverified, so the parent can present the safer-plan decision without transcript hunting (gentle-shell#3082).
65
+ Return a compact evidence handoff of at most ~2k tokens: the verdict per spec item, exact commands with exit codes, test counts, and observed results, blockers with `path:line`, anything left unverified, and scratch paths; never restate the task or spec beyond the line a finding contradicts, or unchanged file contents. The probe regression tests follow it. Never claim a command ran or a check passed without observed output. A safety-guard denial is not an infrastructure failure: report it in the handoff with the guard's response -- rule and blocked path, sanitized of secret contents -- and mark that probe unverified, so the parent can present the safer-plan decision without transcript hunting (gentle-shell#3082).
@@ -25,11 +25,11 @@ The primary parent owns candidate review disposition and lifecycle, including pr
25
25
  Before repository work:
26
26
 
27
27
  1. Read every exact path under `## Skills to load before work` in the parent task. Do not rediscover the skill registry.
28
- 2. Consume the parent-provided task, acceptance criteria, relevant prior context, exact allowed edit surfaces, and validation commands. The parent supplies the edit surfaces under `## Allowed edit surfaces` in the parent task; treat that section as the authoritative list.
28
+ 2. Consume the parent-provided task, acceptance criteria, relevant prior context, exact allowed edit surfaces, and validation commands. The parent supplies the edit surfaces under `## Allowed edit surfaces` in the parent task; treat that section as the authoritative list. Never widen it yourself: report a route beyond it to the parent with exact candidate paths and reasons, and wait; only a parent-issued replacement of that section authorizes it, carrying every still-needed path because the replacement is not a union. That section never substitutes for repository or worktree authority and never authorizes an operation the rules prohibit.
29
29
  Read the parent's ODD feature document locator before edits when supplied: read it from the top until `## Log`. Its `## Specs` are authoritative over any summary in the handoff, and their quoted strings, error messages, and examples are exact. Report in `summary` which `S#` the change covers and any linked `S#` it could not satisfy. Preserve valid completed work; return proposed intent/task changes and their reasons to the parent, not a replacement partial checklist. Findings do not authorize scope expansion.
30
30
  3. Inspect the working tree and preserve pre-existing changes. Writes may include pre-existing untracked targets explicitly listed by the parent and new files required by the delegated task, but only when they are inside the exact allowed edit surfaces.
31
31
  4. Preserve every unrelated tracked or untracked file. Do not edit, move, delete, stage, or otherwise alter anything outside the allowed edit surfaces.
32
- 5. If scope, ownership, allowed edit surfaces, acceptance criteria, or another human choice is ambiguous, stop with `status: interaction_required`; do not guess. Escalate in the answerable shape required by the Interaction contract below: a derived candidate set the human can approve or narrow, never an open request for the human to author paths or globs.
32
+ 5. If scope, ownership, allowed edit surfaces, acceptance criteria, or another choice the task does not delegate to you is ambiguous, stop with `status: interaction_required`; do not guess. Escalate in the answerable shape required by the Interaction contract below: a derived candidate set the parent can approve, narrow, or route to the human, never an open request for anyone to author paths or globs.
33
33
 
34
34
  When resumed in the same child session, do not re-read skill files or spec sections you already read there unless they changed or the parent says so; read anything you have not read yet as usual. Do not read persistent memory for context; the parent forwards relevant observations.
35
35
 
@@ -41,7 +41,7 @@ When resumed in the same child session, do not re-read skill files or spec secti
41
41
  - Use `find` for scoped file discovery. Do not assume an unsupported `glob` tool exists.
42
42
  - Prefer the dedicated `grep`/`find` tools over raw `bash` grep — they honour `.gitignore`. Never run an unbounded recursive scan (`grep -r … .`, `find .` from the workspace root); bound to source directories and pass `--exclude-dir={.git,vendor,node_modules}` (gentle-shell#2686).
43
43
  - **Batch tool calls:** every turn is a full model call, so issue independent calls together in the same turn (parallel tool calls) or read several files with one command, and read each relevant file whole once instead of many small ranges. Make all edits to one file in one `edit` call, and run the focused test and the suite without status-only turns between them.
44
- - Use `blocked` only for a non-human technical blocker such as a missing required tool, denied filesystem access, or an impossible repository invariant. Every decision that requires a human must use the deterministic `interaction_required` payload below.
44
+ - Use `blocked` only for a non-human technical blocker such as a missing required tool, denied filesystem access, or an impossible repository invariant. Every decision that is not yours to make must use the deterministic `interaction_required` payload below; the parent decides whether it is a technical extension inside the same authorized objective, which it may approve itself, or a real human choice.
45
45
  - Treat tool errors, unrelated dirty files, and failing unrelated tests as evidence to report, not problems to hide or rewrite around.
46
46
 
47
47
  ## Tool safety
@@ -49,6 +49,7 @@ When resumed in the same child session, do not re-read skill files or spec secti
49
49
  - Never read sensitive files or locations, including secrets, credentials, tokens, private keys, personal data, `.env` files, credential stores, or unrelated user-home content.
50
50
  - Never write outside the exact allowed edit surfaces, including through generated output, shell redirection, temporary copies, formatters, or scripts.
51
51
  - Never run destructive commands or deletion operations. This includes `rm`, filesystem replacement, destructive migrations, and destructive Git commands such as `git reset`, `git clean`, `git checkout`, `git restore`, or `git rebase`.
52
+ - Replacing a file inside your allowed edit surfaces, including a tool's atomic write-temp-then-rename, is an ordinary write of that surface, not the prohibited filesystem replacement. A tool you run for the task may create and remove its own files in the system temp directory (resolved `TMPDIR`/`os.tmpdir()`, `/tmp`, `/var/tmp`), such as test scratch, caches, or a browser's temporary profile; do not stop or ask for that. Replacing or deleting anything else stays prohibited, and you never run `rm` or delete scratch yourself.
52
53
  - Never stage, commit, push, publish, release, or delegate. Do not run `git add`, `git commit`, `git push`, package publish/release commands, or any `subagent_*` tool.
53
54
  - Do not run installers, dependency mutation, network-changing commands, migrations, or arbitrary repository scripts unless the parent explicitly authorized the exact non-destructive command and it stays within scope.
54
55
  - Retain `bash` only for safe working-tree inspection and the exact focused tests, builds, linters, or validation commands authorized by the parent. Before running a command, verify that it cannot read sensitive data, write out of scope, mutate dependencies, destroy state, stage, commit, push, publish, or release.
@@ -70,9 +71,9 @@ Apply the ODD test-first policy by default for behavior changes with applicable
70
71
 
71
72
  For passive documentation, non-testable changes, an unavailable runner, or no meaningful RED, state the specific exception and run proportionate ordinary functional or structural verification. Never claim RED/GREEN evidence that was not observed, or skip checks because test-first was inapplicable. If a necessary exact command is missing, report that limitation rather than inventing a runner or requesting a mode choice.
72
73
 
73
- Run focused tests first. Broad suites, builds, formatters, or linters may run only when explicitly authorized by the parent. Keep every command exact and verify its scope before execution. Do not claim completion while required validation is failing. Make one correction attempt per failing check, and a second only if the same check still fails after a real fix; then stop and return `status: partial` with the failing command and its output, never looping.
74
+ Run focused tests first. Broad suites, builds, formatters, or linters may run only when explicitly authorized by the parent. Keep every command exact and verify its scope before execution. Do not claim completion while required validation is failing. Make one correction attempt per failing check, and a second only if the same check still fails after a real fix; then stop and return `status: partial` with the failing command and its output, never looping. Making a new test fail for the expected reason is RED construction, not a fix correction: its own harness or setup errors get one self-fix, separate from the fix's correction limit; if the test still cannot reproduce the failure, return `status: partial` with a reproduction blocker and its evidence, not exhausted corrections.
74
75
 
75
- After the correction bound is exhausted, stop and return `status: partial`; report the concrete remaining implementation work, failing commands and outputs, and missing proof, and identify a scoped continuation the parent can offer for explicit human authorization, including its scope, executor, correction limit and checks. This handoff is not authorization to continue. Do not start a fresh correction cycle or treat a new session as a reset; native authority and all other applicable limits remain binding. Worker-local exhaustion is not by itself a feature-wide ban on specifically authorized compilation or implementation, but missing proof still blocks completion and delivery.
76
+ After the correction bound is exhausted, stop and return `status: partial` with the failing commands and outputs, the concrete remaining implementation work, the missing proof, and your diagnosed cause of the loop (for example a wrong test, a wrong hypothesis, missing context, a setup error, or a real blocker) with its evidence. That ends your cycle, not the unit: the parent decides the next step from that evidence. This handoff is not authorization to continue. Do not start a fresh correction cycle or treat a new session as a reset; native authority and all other applicable limits remain binding. Worker-local exhaustion is not by itself a feature-wide ban on specifically authorized compilation or implementation, but missing proof still blocks completion and delivery.
76
77
 
77
78
  Test scratch lives outside the worktree: tests and commands keep temporary state in a fresh system temp directory (`mktemp -d`, `mkdtemp`) and never point `TMPDIR` or a cache directory into the repository. When state must live inside the worktree, use an excluded path that the test removes before it ends. Tests delete the temp directories they create in teardown; name any scratch directory you created outside the worktree in `risks` so the parent removes it. Never leave tool caches or scratch paths in the change.
78
79
 
@@ -90,17 +91,17 @@ When the parent task carries a `## Verification` heading, that heading is the de
90
91
 
91
92
  ## Interaction contract
92
93
 
93
- When any human input is required, stop editing and return the full schema in the Return contract with `status: interaction_required` and the nested `interaction_required` payload completed. Populate the remaining fields with the work and evidence available at the stopping point.
94
+ When any input you may not decide is required, stop editing and return the full schema in the Return contract with `status: interaction_required` and the nested `interaction_required` payload completed. Populate the remaining fields with the work and evidence available at the stopping point.
94
95
 
95
- Every interaction must be answerable from the payload alone. State the concrete choices in `options` as a closed set the human can approve, decline, or select from, and never ask the human to author paths, globs, identifiers, or commands as free text.
96
+ Every interaction must be answerable from the payload alone. State the concrete choices in `options` as a closed set the decision owner can approve, decline, or select from, and never ask anyone to author paths, globs, identifiers, or commands as free text.
96
97
 
97
- When the missing input is the allowed edit surface, derive the candidate set before stopping: put the exact repository-relative paths the delegated task would touch in `options` as the derived answer, not an example, and ask the human to approve that list or name which entries to drop. If the delegated task gives no basis for even a candidate list, say that plainly in `reason` and name the missing evidence in `unblock_response`.
98
+ When the missing input is the allowed edit surface, derive the candidate set before stopping: put the exact repository-relative paths the delegated task would touch in `options` as the derived answer, not an example, each with its reason, and ask the parent to approve that list, narrow it, or route it to the human. If the delegated task gives no basis for even a candidate list, say that plainly in `reason` and name the missing evidence in `unblock_response`.
98
99
 
99
100
  Do not return `blocked` for a human decision and do not invent a second interaction shape.
100
101
 
101
102
  ## Return contract
102
103
 
103
- Return one compact handoff using the schema below; cite exact commands with exit codes and test counts, blockers with `path:line`, and scratch paths, and never restate the task, the spec text, or unchanged file contents. Any requested `## Key Learnings` block follows it.
104
+ Return one compact handoff using the schema below; cite exact commands with exit codes and test counts, blockers with `path:line`, and scratch paths, and never restate the task, the spec text, or unchanged file contents.
104
105
 
105
106
  ```text
106
107
  status: completed | partial | blocked | interaction_required
@@ -86,9 +86,29 @@ export function init(ctx) {
86
86
  /**
87
87
  * A board's frame or one of its size frames (canvas-sizes.js): comment mode never reaches the system board.
88
88
  * `inspect`: Technical details is on, so the frame measures the hovered element for the token inspector.
89
+ * `colors`: the theme's outline colors (outlineColors), left out when they cannot be read.
89
90
  */
90
91
  function sendMode(surface) {
91
- surface.frame.contentWindow?.postMessage({ type: "gd:mode", enabled: state.commenting && !actions.ownerOf(surface).system, inspect: state.technical }, "*");
92
+ const colors = outlineColors();
93
+ surface.frame.contentWindow?.postMessage({ type: "gd:mode", enabled: state.commenting && !actions.ownerOf(surface).system, inspect: state.technical, ...(colors ? { colors } : {}) }, "*");
94
+ }
95
+
96
+ /**
97
+ * The Comment mode outlines inside an artboard are canvas chrome, so they take the theme's colors, read from
98
+ * canvas.css as they apply now: the hover's border, both outlines' fill and the selected one's border. null when
99
+ * the page cannot compute them (no stylesheet yet): the frame keeps the colors it has.
100
+ */
101
+ function outlineColors() {
102
+ if (typeof win.getComputedStyle !== "function") return null;
103
+ const style = win.getComputedStyle(doc.documentElement);
104
+ const colors = { accent: style.getPropertyValue("--gd-accent").trim(), wash: style.getPropertyValue("--gd-highlight-wash").trim(), focus: style.getPropertyValue("--gd-focus").trim() };
105
+ return Object.values(colors).every(Boolean) ? colors : null;
106
+ }
107
+
108
+ /** A change of theme: only the outline colors (gd:colors), so the frame's mode, outlines and inspector stay as they are. */
109
+ function sendColors(surface) {
110
+ const colors = outlineColors();
111
+ if (colors) surface.frame.contentWindow?.postMessage({ type: "gd:colors", colors }, "*");
92
112
  }
93
113
 
94
114
  function boardUrl(board) {
@@ -452,5 +472,5 @@ export function init(ctx) {
452
472
  for (const [option, slug] of invalidOptions) option.textContent = T.invalidDesign(slug);
453
473
  }
454
474
 
455
- return { refreshDesigns, sendMode, boardUrl, loadManifest, reloadBoard, onSystemChange, showDesign, start, relabel };
475
+ return { refreshDesigns, sendMode, sendColors, boardUrl, loadManifest, reloadBoard, onSystemChange, showDesign, start, relabel };
456
476
  }
@@ -60,6 +60,7 @@ import * as popover from "./canvas-popover.js";
60
60
  import * as rail from "./canvas-rail.js";
61
61
  import * as sizes from "./canvas-sizes.js";
62
62
  import { createStore } from "./canvas-store.js";
63
+ import * as theme from "./canvas-theme.js";
63
64
  import * as tokens from "./canvas-tokens.js";
64
65
  import * as ui from "./canvas-ui.js";
65
66
  import * as view from "./canvas-view.js";
@@ -72,7 +73,7 @@ import * as view from "./canvas-view.js";
72
73
  * the popover's (leave Comment mode). The checks come before the layout: their Esc clears
73
74
  * the ring of Show before the selected artboard.
74
75
  */
75
- const MODULES = [view, focus, boards, handoffs, parts, tokens, compare, events, comments, menu, rail, sizes, exporter, checks, layout, minimap, popover, messages];
76
+ const MODULES = [view, focus, boards, handoffs, parts, tokens, compare, events, comments, menu, theme, rail, sizes, exporter, checks, layout, minimap, popover, messages];
76
77
 
77
78
  export function boot(win, doc) {
78
79
  const config = JSON.parse(doc.getElementById("gd-config").textContent);
@@ -200,6 +201,7 @@ export function boot(win, doc) {
200
201
  else win.addEventListener("resize", viewportResized);
201
202
 
202
203
  ctx.i18n.startLanguage();
204
+ actions.startTheme();
203
205
  actions.setMode(actions.storedMode());
204
206
  actions.startRail();
205
207
  actions.startSizes();
@@ -47,6 +47,11 @@ export const ES = Object.freeze({
47
47
  auto: "Igual que el navegador",
48
48
  languageNote: "Los mensajes al agente siguen en inglés.",
49
49
  },
50
+ theme: {
51
+ theme: "Tema",
52
+ gentleman: "Gentleman",
53
+ neutral: "Neutro",
54
+ },
50
55
  focus: {
51
56
  navigating: "Navegando",
52
57
  using: (title) => `Usando: ${title} · Mayús+Esc para salir`,
@@ -30,7 +30,7 @@ export function init(ctx) {
30
30
  * One item of a menu. action: { label, icon?, shortcut?, disabled?, checked? }; a disabled
31
31
  * item (nothing to act on) is announced as unavailable and choosing it does nothing. An action
32
32
  * with `checked` (true or false) is a checkbox item, with a check mark shown while it is on;
33
- * with `radio: true` too, a radio item, one of the menu's choices (Settings: the language).
33
+ * with `radio: true` too, a radio item, one of the menu's choices (Settings: the theme, the language).
34
34
  */
35
35
  function menuItem(action) {
36
36
  const checkbox = typeof action.checked === "boolean";
@@ -80,25 +80,31 @@ export function init(ctx) {
80
80
  /**
81
81
  * Builds the menu from `actions` under `button`, named `label`, with focus on its first
82
82
  * (or `last`) item; `run(button)` is what choosing an action does. `{ separator: true }`
83
- * is a separator, `{ note }` a line of text the menu's radio items are described by, and
83
+ * is a separator, `{ note }` a line of text the radio items of the group right before it are described by, and
84
84
  * `{ group, actions }` a named group: its visible heading `group` names it and is no item.
85
85
  */
86
86
  function showMenu(button, actions, label, last = false, beside = false) {
87
87
  const items = [];
88
88
  const byItem = new Map();
89
+ // The groups built so far (each heading's id is unique), and the radio items of the last one, which a note describes.
90
+ let groups = 0;
91
+ let lastRadios = [];
89
92
  const build = (action) => {
90
93
  if (action.group) {
94
+ const id = groups++ ? `gd-menu-heading-${groups}` : "gd-menu-heading";
91
95
  const group = doc.createElement("div");
92
96
  group.className = "gd-menu-group";
93
97
  group.setAttribute("role", "group");
94
- group.setAttribute("aria-labelledby", "gd-menu-heading");
98
+ group.setAttribute("aria-labelledby", id);
95
99
  const heading = doc.createElement("p");
96
- heading.id = "gd-menu-heading";
100
+ heading.id = id;
97
101
  heading.className = "gd-menu-heading";
98
102
  // Read once, as the group's name, never as a stop of its own.
99
103
  heading.setAttribute("aria-hidden", "true");
100
104
  heading.textContent = action.group;
101
- group.append(heading, ...action.actions.map(build));
105
+ const children = action.actions.map(build);
106
+ group.append(heading, ...children);
107
+ lastRadios = children.filter((child) => child.getAttribute?.("role") === "menuitemradio");
102
108
  return group;
103
109
  }
104
110
  if (action.separator || action.note) {
@@ -109,6 +115,8 @@ export function init(ctx) {
109
115
  // Presentational, since a menu owns only items, groups and separators; its text still describes the radios.
110
116
  node.setAttribute("role", "none");
111
117
  node.textContent = action.note;
118
+ // It reaches screen readers as the description of the radios it is about, since a menu owns only items, separators and groups.
119
+ for (const radio of lastRadios) radio.setAttribute("aria-describedby", "gd-menu-note");
112
120
  } else node.setAttribute("role", "separator");
113
121
  return node;
114
122
  }
@@ -119,8 +127,6 @@ export function init(ctx) {
119
127
  return item;
120
128
  };
121
129
  const nodes = actions.map(build);
122
- // A menu owns only items, separators and groups: the note reaches screen readers as the radio items' description.
123
- if (actions.some((action) => action.note)) items.filter((item) => item.getAttribute("role") === "menuitemradio").forEach((item) => item.setAttribute("aria-describedby", "gd-menu-note"));
124
130
  openMenu(button, els.menu, nodes, items, label, last ? items[items.length - 1] : items[0], beside, byItem);
125
131
  }
126
132
 
@@ -2,7 +2,7 @@
2
2
  // iframes sandboxed with scripts only, so each one has an opaque origin; messages
3
3
  // are trusted only by matching event.source to a known artboard's frame or, in All
4
4
  // sizes, one of its size frames (canvas-sizes.js). The canvas's own messages to
5
- // artboards (gd:mode, gd:focus, gd:size, gd:pins, gd:pick-at, gd:hover-at, gd:highlight,
5
+ // artboards (gd:mode, gd:colors, gd:focus, gd:size, gd:pins, gd:pick-at, gd:hover-at, gd:highlight,
6
6
  // gd:clear, gd:run-checks) are posted by the module that owns each state. gd:inspect (the element under the
7
7
  // pointer, measured) belongs to the token inspector (canvas-tokens.js), and gd:checks (the page's
8
8
  // accessibility checks) and gd:located (where the element of a check's ring is now) to canvas-checks.js.
@@ -1,6 +1,6 @@
1
1
  // The tool rail on the left: Move and Comment (one pressed pair over Comment
2
2
  // mode), Overview (Fit) and Settings (a menu with the design system board, the
3
- // keyboard shortcuts, Technical details, which turns the token inspector on, and the language). Its single-key shortcuts, and the ? list where a person
3
+ // keyboard shortcuts, Technical details, which turns the token inspector on, the theme and the language). Its single-key shortcuts, and the ? list where a person
4
4
  // gives any of them another single key, saved in this browser for every design
5
5
  // the canvas server shows (per address: a restarted server has a new port).
6
6
 
@@ -257,7 +257,7 @@ export function init(ctx) {
257
257
  els.railSettings.focus();
258
258
  }
259
259
 
260
- /** What Settings offers: the design system board (when there is one, and not over Compare), the keyboard shortcuts, Technical details and the language. */
260
+ /** What Settings offers: the design system board (when there is one, and not over Compare), the keyboard shortcuts, Technical details, the theme and the language. */
261
261
  function settingsActions() {
262
262
  return [
263
263
  // Checked again when chosen: a live reload may have removed the board while the menu was open.
@@ -267,6 +267,9 @@ export function init(ctx) {
267
267
  { label: T.keys, icon: "i-keys", shortcut: keyText(shortcutKey(shortcutById("help"))), run: openShortcuts },
268
268
  // A checkbox: the token inspector in Comment mode (canvas-tokens.js).
269
269
  { label: T.technical, icon: "i-code", checked: state.technical, run: () => actions.setTechnical(!state.technical) },
270
+ // The theme: radios under their heading, applied at once (canvas-theme.js).
271
+ { separator: true },
272
+ ...actions.themeActions(),
270
273
  // The language: radios under their heading, applied at once (canvas-i18n.js), and what stays English.
271
274
  { separator: true },
272
275
  { group: T.language, actions: LANGUAGES.map(([choice, label]) => ({ label: T[label], radio: true, checked: state.languageChoice === choice, run: () => ctx.i18n.setLanguage(choice) })) },
@@ -80,6 +80,8 @@ export function createStore(initial = {}) {
80
80
  // The canvas language (canvas-i18n.js): the one it shows, "es" or "en", and the choice in Settings, "es", "en" or "auto" (the browser's).
81
81
  language: "en",
82
82
  languageChoice: "auto",
83
+ // The canvas theme (canvas-theme.js): "neutral" (:root's palette) or "gentleman".
84
+ theme: "neutral",
83
85
  };
84
86
  const read = Object.freeze(Object.defineProperties({}, Object.fromEntries(Object.keys(state).map((key) => [key, { enumerable: true, get: () => state[key] }]))));
85
87
 
@@ -126,6 +128,7 @@ export function createStore(initial = {}) {
126
128
  state.languageChoice = choice;
127
129
  state.language = language;
128
130
  },
131
+ setTheme(theme) { state.theme = theme; },
129
132
  });
130
133
  }
131
134
 
@@ -0,0 +1,69 @@
1
+ // The canvas theme: Gentleman (the Gentleman brand's pink on plum) or Neutral (the gray and blue
2
+ // of :root, the default), chosen in the rail's Settings, saved in this browser and applied at once.
3
+ // canvas.css holds the palettes: Neutral is :root's own --gd-* tokens, Gentleman is
4
+ // :root[data-theme="gentleman"], which sets every one of them; artboards keep their own colors, but the
5
+ // Comment mode outlines drawn inside them are canvas chrome: gd:mode carries the theme's (canvas-boards.js),
6
+ // and a change of theme sends only the new colors (gd:colors) to every frame. theme-early.js, a classic script in index.html's <head>,
7
+ // paints a saved Gentleman before the first frame; startTheme() stays the source of truth for the store.
8
+
9
+ // Every string the theme shows, in English; canvas-i18n-es.js has the Spanish. Gentleman is a name and stays as is.
10
+ const TEXT = Object.freeze({
11
+ theme: "Theme",
12
+ gentleman: "Gentleman",
13
+ neutral: "Neutral",
14
+ });
15
+
16
+ // The choice in this browser, for every design at this canvas address: "gentleman" or "neutral".
17
+ const THEME_KEY = "gentle-design:theme";
18
+ // Settings' theme radios, in order: the choice, its label and its icon.
19
+ const THEMES = [["gentleman", "gentleman", "i-mustache"], ["neutral", "neutral", "i-contrast"]];
20
+ const CHOICES = THEMES.map(([choice]) => choice);
21
+ const DEFAULT_THEME = "neutral";
22
+
23
+ export function init(ctx) {
24
+ const { win, doc, store, actions } = ctx;
25
+ const { state } = store;
26
+ const T = ctx.i18n.text("theme", TEXT);
27
+
28
+ /** The saved choice; an unreadable or unknown one is Neutral. */
29
+ function storedTheme() {
30
+ try {
31
+ const choice = win.localStorage.getItem(THEME_KEY);
32
+ return CHOICES.includes(choice) ? choice : DEFAULT_THEME;
33
+ } catch {
34
+ return DEFAULT_THEME;
35
+ }
36
+ }
37
+
38
+ /** Neutral is :root's own palette, so it needs no attribute. */
39
+ function apply(choice) {
40
+ store.setTheme(choice);
41
+ if (choice === DEFAULT_THEME) doc.documentElement.removeAttribute("data-theme");
42
+ else doc.documentElement.setAttribute("data-theme", choice);
43
+ }
44
+
45
+ /** The choice made in Settings: saved in this browser (or for this page only, when storage refuses it) and applied at once. */
46
+ function setTheme(choice) {
47
+ if (!CHOICES.includes(choice)) return;
48
+ try {
49
+ win.localStorage.setItem(THEME_KEY, choice);
50
+ } catch {
51
+ // Storage refused it: the choice holds for this page.
52
+ }
53
+ apply(choice);
54
+ // The outlines inside every frame, All sizes frames included, take the new colors at once.
55
+ actions.allBoards().flatMap(actions.surfacesOf).forEach(actions.sendColors);
56
+ }
57
+
58
+ /** The saved theme, before anything renders. */
59
+ function startTheme() {
60
+ apply(storedTheme());
61
+ }
62
+
63
+ /** Settings' theme radios under their heading (canvas-rail.js). */
64
+ function themeActions() {
65
+ return [{ group: T.theme, actions: THEMES.map(([choice, label, icon]) => ({ label: T[label], icon, radio: true, checked: state.theme === choice, run: () => setTheme(choice) })) }];
66
+ }
67
+
68
+ return { setTheme, startTheme, themeActions };
69
+ }
@@ -8,6 +8,10 @@
8
8
  --gd-muted: #a9abb2;
9
9
  --gd-accent: #8ab4ff;
10
10
  --gd-accent-text: #0b1220;
11
+ /* A faint accent over an artboard under the pointer. */
12
+ --gd-accent-wash: rgba(138, 180, 255, 0.06);
13
+ /* The fill of the Comment mode outlines inside an artboard (inspector.js, sent with gd:mode). */
14
+ --gd-highlight-wash: rgba(138, 180, 255, 0.12);
11
15
  --gd-danger: #ff9b9b;
12
16
  --gd-focus: #ffd479;
13
17
  --gd-pin: #8ab4ff;
@@ -19,6 +23,27 @@
19
23
  font-size: 14px;
20
24
  }
21
25
 
26
+ /* The Gentleman theme (Settings > Theme, canvas-theme.js): the Gentleman brand's pink on plum. It sets every
27
+ color token of :root, so nothing falls back to the Neutral palette; the states keep their meaning. */
28
+ :root[data-theme="gentleman"] {
29
+ --gd-bg: #1a1218;
30
+ --gd-stage: #20161e;
31
+ --gd-panel: #241822;
32
+ --gd-border: #342230;
33
+ --gd-text: #f6eff3;
34
+ --gd-muted: #a78e9b;
35
+ --gd-accent: #f095c8;
36
+ --gd-accent-text: #1a1218;
37
+ --gd-accent-wash: rgba(240, 149, 200, 0.08);
38
+ --gd-highlight-wash: rgba(240, 149, 200, 0.12);
39
+ --gd-danger: #ff718f;
40
+ --gd-focus: #e0c27a;
41
+ --gd-pin: #f095c8;
42
+ --gd-pin-resolved: #76616b;
43
+ --gd-success: #b4e7c7;
44
+ --gd-paper: #fff;
45
+ }
46
+
22
47
  * { box-sizing: border-box; }
23
48
 
24
49
  html, body {
@@ -321,7 +346,7 @@ button:focus-visible, select:focus-visible, textarea:focus-visible, .gd-viewport
321
346
  .gd-shield[hidden] { display: none; }
322
347
 
323
348
  .gd-shield:hover, .gd-shield:focus-visible {
324
- background: rgba(138, 180, 255, 0.06);
349
+ background: var(--gd-accent-wash);
325
350
  box-shadow: inset 0 0 0 calc(2px * var(--gd-inv-zoom, 1)) var(--gd-accent);
326
351
  }
327
352
 
@@ -450,7 +475,7 @@ button:focus-visible, select:focus-visible, textarea:focus-visible, .gd-viewport
450
475
  min-height: 26px;
451
476
  padding: 0 6px;
452
477
  border-radius: 13px 13px 13px 2px;
453
- border: 2px solid #0b1220;
478
+ border: 2px solid var(--gd-accent-text);
454
479
  background: var(--gd-pin);
455
480
  color: var(--gd-accent-text);
456
481
  font-weight: 700;
@@ -5,6 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1">
6
6
  <meta name="referrer" content="no-referrer">
7
7
  <title>Gentle Design</title>
8
+ <script src="{{BASE}}assets/theme-early.js"></script>
8
9
  <link rel="stylesheet" href="{{BASE}}assets/canvas.css">
9
10
  <script id="gd-config" type="application/json">{{CONFIG}}</script>
10
11
  <script type="module" src="{{BASE}}assets/canvas.js"></script>
@@ -26,6 +27,8 @@
26
27
  <symbol id="i-devices" viewBox="0 0 24 24"><rect x="2" y="4" width="13" height="10" rx="1.5"/><path d="M5 18h7"/><rect x="17" y="8" width="5" height="12" rx="1"/></symbol>
27
28
  <symbol id="i-width" viewBox="0 0 24 24"><path d="M3 12h18M7 8l-4 4 4 4M17 8l4 4-4 4"/></symbol>
28
29
  <symbol id="i-check" viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></symbol>
30
+ <symbol id="i-mustache" viewBox="0 0 355 122"><path fill="currentColor" stroke="none" d="M0 38 6 37 14 43 28 48 43 47 54 42 99 8 112 2 121 0 138 0 149 3 159 8 177 22 191 10 206 2 215 0 233 0 244 3 257 10 296 40 310 47 325 48 339 43 348 37 353 37 354 47 351 57 344 72 329 93 321 101 307 111 291 118 275 121 246 121 229 118 216 113 201 105 192 98 177 83 168 94 160 101 140 113 137 113 132 116 121 119 92 122 91 121 80 121 62 117 47 110 32 99 15 78 9 67 1 46Z"/></symbol>
31
+ <symbol id="i-contrast" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><path fill="currentColor" stroke="none" d="M12 3a9 9 0 0 1 0 18z"/></symbol>
29
32
  <symbol id="i-code" viewBox="0 0 24 24"><path d="m16 18 6-6-6-6"/><path d="m8 6-6 6 6 6"/></symbol>
30
33
  <symbol id="i-more" viewBox="0 0 24 24"><circle cx="5" cy="12" r="1"/><circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/></symbol>
31
34
  <symbol id="i-image" viewBox="0 0 24 24"><rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-5-5L5 21"/></symbol>
@@ -51,7 +51,13 @@
51
51
  let locating = null;
52
52
  let locateQueued = false;
53
53
 
54
- function makeBox(color) {
54
+ // The outlines' colors are the canvas theme's (gd:mode `colors`): the hover's border (accent), both fills (wash)
55
+ // and the selected one's border (focus). Until the canvas sends them, Neutral's.
56
+ const colors = { accent: "#8ab4ff", wash: "rgba(138, 180, 255, 0.12)", focus: "#ffd479" };
57
+ // Only a plain color reaches a style: #rgb, #rgba, #rrggbb, #rrggbbaa, or rgb()/rgba() with numbers.
58
+ const COLOR = /^(?:#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})|rgba?\(\d{1,3}(?:\.\d+)?, ?\d{1,3}(?:\.\d+)?, ?\d{1,3}(?:\.\d+)?(?:, ?(?:0|1|0?\.\d+))?\))$/i;
59
+
60
+ function makeBox() {
55
61
  const box = document.createElement("div");
56
62
  box.setAttribute(MARK, "");
57
63
  box.setAttribute("aria-hidden", "true");
@@ -59,8 +65,6 @@
59
65
  position: "fixed",
60
66
  pointerEvents: "none",
61
67
  zIndex: "2147483647",
62
- border: `2px solid ${color}`,
63
- background: "rgba(138, 180, 255, 0.12)",
64
68
  borderRadius: "2px",
65
69
  display: "none",
66
70
  margin: "0",
@@ -70,8 +74,24 @@
70
74
  }
71
75
 
72
76
  // Attached to <html>, not <body>, so body child positions (and selectors) stay unchanged.
73
- const hoverBox = makeBox("#8ab4ff");
74
- const selectedBox = makeBox("#ffd479");
77
+ const hoverBox = makeBox();
78
+ const selectedBox = makeBox();
79
+ paintBoxes();
80
+
81
+ function paintBoxes() {
82
+ Object.assign(hoverBox.style, { border: `2px solid ${colors.accent}`, background: colors.wash });
83
+ Object.assign(selectedBox.style, { border: `2px solid ${colors.focus}`, background: colors.wash });
84
+ }
85
+
86
+ /** The theme's colors from gd:mode: each one that is a plain color replaces the current one; anything else is ignored. */
87
+ function setColors(next) {
88
+ if (!next || typeof next !== "object") return;
89
+ for (const key of Object.keys(colors)) {
90
+ const value = next[key];
91
+ if (typeof value === "string" && value.length <= 64 && COLOR.test(value)) colors[key] = value;
92
+ }
93
+ paintBoxes();
94
+ }
75
95
 
76
96
  function place(box, element) {
77
97
  if (!element || !element.isConnected) {
@@ -689,9 +709,12 @@
689
709
  window.addEventListener("message", (event) => {
690
710
  if (event.source !== window.parent || !event.data || typeof event.data !== "object") return;
691
711
  if (event.data.type === "gd:mode") {
712
+ setColors(event.data.colors);
692
713
  inspecting = event.data.inspect === true;
693
714
  setEnabled(event.data.enabled === true);
694
715
  }
716
+ // A change of theme: new outline colors only; the mode and the outlines shown stay.
717
+ else if (event.data.type === "gd:colors") setColors(event.data.colors);
695
718
  else if (event.data.type === "gd:pins") setPins(event.data.pins);
696
719
  else if (event.data.type === "gd:highlight") highlight(event.data);
697
720
  else if (event.data.type === "gd:run-checks") {
@@ -0,0 +1,10 @@
1
+ // The canvas theme, before the first frame: a classic script loaded synchronously in index.html's <head>
2
+ // (the canvas CSP allows no inline script), so a saved Gentleman never shows Neutral for a frame on reload.
3
+ // The same rule as canvas-theme.js's storedTheme(): only an exact "gentleman" under gentle-design:theme sets
4
+ // data-theme; anything else, or any error, leaves :root's Neutral. canvas-theme.js (startTheme) then applies
5
+ // the saved theme again and keeps it in the store: it stays the source of truth.
6
+ try {
7
+ if (localStorage.getItem("gentle-design:theme") === "gentleman") document.documentElement.setAttribute("data-theme", "gentleman");
8
+ } catch {
9
+ // Storage blocked or unavailable: Neutral.
10
+ }