@skillcdn/console 0.5.0 → 0.5.2

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 (490) hide show
  1. package/README.md +87 -12
  2. package/SKILLCDN.md +3 -3
  3. package/dist/agent-page.d.ts.map +1 -1
  4. package/dist/agent-page.js +7 -6
  5. package/dist/agent-page.js.map +1 -1
  6. package/dist/api.d.ts +9 -7
  7. package/dist/api.d.ts.map +1 -1
  8. package/dist/api.js +8 -6
  9. package/dist/api.js.map +1 -1
  10. package/dist/charts.d.ts +103 -0
  11. package/dist/charts.d.ts.map +1 -0
  12. package/dist/charts.js +182 -0
  13. package/dist/charts.js.map +1 -0
  14. package/dist/cli/cli.d.ts +58 -2
  15. package/dist/cli/cli.d.ts.map +1 -1
  16. package/dist/cli/cli.js +1742 -472
  17. package/dist/cli/cli.js.map +1 -1
  18. package/dist/cli/command-words.d.ts +20 -0
  19. package/dist/cli/command-words.d.ts.map +1 -0
  20. package/dist/cli/command-words.js +51 -0
  21. package/dist/cli/command-words.js.map +1 -0
  22. package/dist/cli/credentials.d.ts +54 -5
  23. package/dist/cli/credentials.d.ts.map +1 -1
  24. package/dist/cli/credentials.js +126 -20
  25. package/dist/cli/credentials.js.map +1 -1
  26. package/dist/cli/directory.d.ts +19 -4
  27. package/dist/cli/directory.d.ts.map +1 -1
  28. package/dist/cli/directory.js +16 -8
  29. package/dist/cli/directory.js.map +1 -1
  30. package/dist/cli/format.d.ts +70 -9
  31. package/dist/cli/format.d.ts.map +1 -1
  32. package/dist/cli/format.js +267 -40
  33. package/dist/cli/format.js.map +1 -1
  34. package/dist/cli/help.d.ts +13 -4
  35. package/dist/cli/help.d.ts.map +1 -1
  36. package/dist/cli/help.js +101 -58
  37. package/dist/cli/help.js.map +1 -1
  38. package/dist/cli/machine-check.d.ts +36 -0
  39. package/dist/cli/machine-check.d.ts.map +1 -0
  40. package/dist/cli/machine-check.js +151 -0
  41. package/dist/cli/machine-check.js.map +1 -0
  42. package/dist/cli/main.js +76 -2
  43. package/dist/cli/main.js.map +1 -1
  44. package/dist/cli/pack.d.ts +69 -60
  45. package/dist/cli/pack.d.ts.map +1 -1
  46. package/dist/cli/pack.js +241 -270
  47. package/dist/cli/pack.js.map +1 -1
  48. package/dist/cli/plugin-check.d.ts +42 -0
  49. package/dist/cli/plugin-check.d.ts.map +1 -1
  50. package/dist/cli/plugin-check.js +221 -36
  51. package/dist/cli/plugin-check.js.map +1 -1
  52. package/dist/cli/plugin-cli.d.ts +6 -1
  53. package/dist/cli/plugin-cli.d.ts.map +1 -1
  54. package/dist/cli/plugin-cli.js +21 -4
  55. package/dist/cli/plugin-cli.js.map +1 -1
  56. package/dist/cli/plugin-main.js +1 -0
  57. package/dist/cli/plugin-main.js.map +1 -1
  58. package/dist/cli/runner-host.d.ts +7 -0
  59. package/dist/cli/runner-host.d.ts.map +1 -1
  60. package/dist/cli/runner-host.js +2 -0
  61. package/dist/cli/runner-host.js.map +1 -1
  62. package/dist/cli/secret-notes.d.ts +8 -0
  63. package/dist/cli/secret-notes.d.ts.map +1 -0
  64. package/dist/cli/secret-notes.js +48 -0
  65. package/dist/cli/secret-notes.js.map +1 -0
  66. package/dist/cli/serve.d.ts +33 -1
  67. package/dist/cli/serve.d.ts.map +1 -1
  68. package/dist/cli/serve.js +252 -3
  69. package/dist/cli/serve.js.map +1 -1
  70. package/dist/client.d.ts +54 -9
  71. package/dist/client.d.ts.map +1 -1
  72. package/dist/client.js +77 -80
  73. package/dist/client.js.map +1 -1
  74. package/dist/components/agent-page.d.ts +164 -8
  75. package/dist/components/agent-page.d.ts.map +1 -1
  76. package/dist/components/agent-page.js +588 -151
  77. package/dist/components/agent-page.js.map +1 -1
  78. package/dist/components/agents.d.ts.map +1 -1
  79. package/dist/components/agents.js +1 -1
  80. package/dist/components/agents.js.map +1 -1
  81. package/dist/components/board.d.ts.map +1 -1
  82. package/dist/components/board.js +3 -2
  83. package/dist/components/board.js.map +1 -1
  84. package/dist/components/categories.js +1 -1
  85. package/dist/components/categories.js.map +1 -1
  86. package/dist/components/charts.d.ts +157 -0
  87. package/dist/components/charts.d.ts.map +1 -0
  88. package/dist/components/charts.js +182 -0
  89. package/dist/components/charts.js.map +1 -0
  90. package/dist/components/decision-list.d.ts.map +1 -1
  91. package/dist/components/decision-list.js +1 -1
  92. package/dist/components/decision-list.js.map +1 -1
  93. package/dist/components/desk-records.d.ts +102 -0
  94. package/dist/components/desk-records.d.ts.map +1 -0
  95. package/dist/components/desk-records.js +221 -0
  96. package/dist/components/desk-records.js.map +1 -0
  97. package/dist/components/desk.d.ts +85 -0
  98. package/dist/components/desk.d.ts.map +1 -0
  99. package/dist/components/desk.js +135 -0
  100. package/dist/components/desk.js.map +1 -0
  101. package/dist/components/event-feed.d.ts.map +1 -1
  102. package/dist/components/event-feed.js +7 -3
  103. package/dist/components/event-feed.js.map +1 -1
  104. package/dist/components/goals.d.ts +2 -0
  105. package/dist/components/goals.d.ts.map +1 -1
  106. package/dist/components/goals.js +1 -1
  107. package/dist/components/goals.js.map +1 -1
  108. package/dist/components/home.d.ts.map +1 -1
  109. package/dist/components/home.js +14 -6
  110. package/dist/components/home.js.map +1 -1
  111. package/dist/components/icon.d.ts +31 -0
  112. package/dist/components/icon.d.ts.map +1 -0
  113. package/dist/components/icon.js +169 -0
  114. package/dist/components/icon.js.map +1 -0
  115. package/dist/components/markdown.d.ts +6 -0
  116. package/dist/components/markdown.d.ts.map +1 -1
  117. package/dist/components/markdown.js +10 -2
  118. package/dist/components/markdown.js.map +1 -1
  119. package/dist/components/people.js +1 -1
  120. package/dist/components/people.js.map +1 -1
  121. package/dist/components/plugin-frame.d.ts.map +1 -1
  122. package/dist/components/plugin-frame.js +7 -0
  123. package/dist/components/plugin-frame.js.map +1 -1
  124. package/dist/components/plugin-settings.d.ts.map +1 -1
  125. package/dist/components/plugin-settings.js +54 -3
  126. package/dist/components/plugin-settings.js.map +1 -1
  127. package/dist/components/projects.d.ts +17 -4
  128. package/dist/components/projects.d.ts.map +1 -1
  129. package/dist/components/projects.js +51 -12
  130. package/dist/components/projects.js.map +1 -1
  131. package/dist/components/rules.d.ts +8 -10
  132. package/dist/components/rules.d.ts.map +1 -1
  133. package/dist/components/rules.js +35 -13
  134. package/dist/components/rules.js.map +1 -1
  135. package/dist/components/sessions.d.ts.map +1 -1
  136. package/dist/components/sessions.js +3 -2
  137. package/dist/components/sessions.js.map +1 -1
  138. package/dist/components/setup.d.ts +9 -3
  139. package/dist/components/setup.d.ts.map +1 -1
  140. package/dist/components/setup.js +12 -6
  141. package/dist/components/setup.js.map +1 -1
  142. package/dist/components/shell.d.ts.map +1 -1
  143. package/dist/components/shell.js +3 -2
  144. package/dist/components/shell.js.map +1 -1
  145. package/dist/components/tokens.js +1 -1
  146. package/dist/components/tokens.js.map +1 -1
  147. package/dist/components/ui.d.ts +5 -2
  148. package/dist/components/ui.d.ts.map +1 -1
  149. package/dist/components/ui.js +10 -7
  150. package/dist/components/ui.js.map +1 -1
  151. package/dist/connect-page.js +1 -1
  152. package/dist/connect-page.js.map +1 -1
  153. package/dist/console.css +1172 -106
  154. package/dist/console.d.ts +5 -0
  155. package/dist/console.d.ts.map +1 -1
  156. package/dist/console.js +52 -39
  157. package/dist/console.js.map +1 -1
  158. package/dist/data.d.ts.map +1 -1
  159. package/dist/data.js +32 -33
  160. package/dist/data.js.map +1 -1
  161. package/dist/desk-page.d.ts +38 -0
  162. package/dist/desk-page.d.ts.map +1 -0
  163. package/dist/desk-page.js +184 -0
  164. package/dist/desk-page.js.map +1 -0
  165. package/dist/desk-records-page.d.ts +18 -0
  166. package/dist/desk-records-page.d.ts.map +1 -0
  167. package/dist/desk-records-page.js +130 -0
  168. package/dist/desk-records-page.js.map +1 -0
  169. package/dist/desk-records.d.ts +247 -0
  170. package/dist/desk-records.d.ts.map +1 -0
  171. package/dist/desk-records.js +543 -0
  172. package/dist/desk-records.js.map +1 -0
  173. package/dist/desk.d.ts +122 -0
  174. package/dist/desk.d.ts.map +1 -0
  175. package/dist/desk.js +211 -0
  176. package/dist/desk.js.map +1 -0
  177. package/dist/feed-stream.d.ts +39 -0
  178. package/dist/feed-stream.d.ts.map +1 -0
  179. package/dist/feed-stream.js +117 -0
  180. package/dist/feed-stream.js.map +1 -0
  181. package/dist/home-tiles.d.ts +19 -3
  182. package/dist/home-tiles.d.ts.map +1 -1
  183. package/dist/home-tiles.js +147 -42
  184. package/dist/home-tiles.js.map +1 -1
  185. package/dist/i18n/en.d.ts +228 -6
  186. package/dist/i18n/en.d.ts.map +1 -1
  187. package/dist/i18n/en.js +309 -9
  188. package/dist/i18n/en.js.map +1 -1
  189. package/dist/i18n/ko.d.ts.map +1 -1
  190. package/dist/i18n/ko.js +366 -85
  191. package/dist/i18n/ko.js.map +1 -1
  192. package/dist/i18n/particles.d.ts +7 -0
  193. package/dist/i18n/particles.d.ts.map +1 -0
  194. package/dist/i18n/particles.js +72 -0
  195. package/dist/i18n/particles.js.map +1 -0
  196. package/dist/icons/glyphs.d.ts +605 -0
  197. package/dist/icons/glyphs.d.ts.map +1 -0
  198. package/dist/icons/glyphs.js +104 -0
  199. package/dist/icons/glyphs.js.map +1 -0
  200. package/dist/icons/index.d.ts +59 -0
  201. package/dist/icons/index.d.ts.map +1 -0
  202. package/dist/icons/index.js +157 -0
  203. package/dist/icons/index.js.map +1 -0
  204. package/dist/index.d.ts +9 -0
  205. package/dist/index.d.ts.map +1 -1
  206. package/dist/index.js +9 -0
  207. package/dist/index.js.map +1 -1
  208. package/dist/limits.d.ts +20 -0
  209. package/dist/limits.d.ts.map +1 -1
  210. package/dist/limits.js +20 -0
  211. package/dist/limits.js.map +1 -1
  212. package/dist/marks.d.ts +9 -0
  213. package/dist/marks.d.ts.map +1 -1
  214. package/dist/marks.js +9 -0
  215. package/dist/marks.js.map +1 -1
  216. package/dist/onboarding.d.ts +6 -0
  217. package/dist/onboarding.d.ts.map +1 -1
  218. package/dist/onboarding.js +5 -5
  219. package/dist/onboarding.js.map +1 -1
  220. package/dist/plugin/context.d.ts +42 -11
  221. package/dist/plugin/context.d.ts.map +1 -1
  222. package/dist/plugin/limits.d.ts +2 -0
  223. package/dist/plugin/limits.d.ts.map +1 -1
  224. package/dist/plugin/limits.js +2 -0
  225. package/dist/plugin/limits.js.map +1 -1
  226. package/dist/plugin/manifest.d.ts +13 -0
  227. package/dist/plugin/manifest.d.ts.map +1 -1
  228. package/dist/plugin/manifest.js +30 -3
  229. package/dist/plugin/manifest.js.map +1 -1
  230. package/dist/plugin/rest-schemas.d.ts +55 -0
  231. package/dist/plugin/rest-schemas.d.ts.map +1 -1
  232. package/dist/plugin/rest-schemas.js +37 -0
  233. package/dist/plugin/rest-schemas.js.map +1 -1
  234. package/dist/plugin/sandbox.d.ts.map +1 -1
  235. package/dist/plugin/sandbox.js +4 -1
  236. package/dist/plugin/sandbox.js.map +1 -1
  237. package/dist/plugin/testing.d.ts +6 -2
  238. package/dist/plugin/testing.d.ts.map +1 -1
  239. package/dist/plugin/testing.js +52 -10
  240. package/dist/plugin/testing.js.map +1 -1
  241. package/dist/plugin/web.d.ts +3 -0
  242. package/dist/plugin/web.d.ts.map +1 -1
  243. package/dist/plugin/web.js +5 -1
  244. package/dist/plugin/web.js.map +1 -1
  245. package/dist/plugin.d.ts +1 -1
  246. package/dist/plugin.d.ts.map +1 -1
  247. package/dist/plugin.js +1 -1
  248. package/dist/plugin.js.map +1 -1
  249. package/dist/records.d.ts +283 -0
  250. package/dist/records.d.ts.map +1 -0
  251. package/dist/records.js +543 -0
  252. package/dist/records.js.map +1 -0
  253. package/dist/routes.d.ts +3 -1
  254. package/dist/routes.d.ts.map +1 -1
  255. package/dist/routes.js +3 -1
  256. package/dist/routes.js.map +1 -1
  257. package/dist/rules.d.ts +30 -11
  258. package/dist/rules.d.ts.map +1 -1
  259. package/dist/rules.js +98 -45
  260. package/dist/rules.js.map +1 -1
  261. package/dist/runner/acp.d.ts +1 -1
  262. package/dist/runner/acp.d.ts.map +1 -1
  263. package/dist/runner/acp.js +32 -21
  264. package/dist/runner/acp.js.map +1 -1
  265. package/dist/runner/awake.d.ts +35 -0
  266. package/dist/runner/awake.d.ts.map +1 -0
  267. package/dist/runner/awake.js +95 -0
  268. package/dist/runner/awake.js.map +1 -0
  269. package/dist/runner/claude.d.ts +1 -1
  270. package/dist/runner/claude.d.ts.map +1 -1
  271. package/dist/runner/claude.js +100 -18
  272. package/dist/runner/claude.js.map +1 -1
  273. package/dist/runner/codex.d.ts +1 -1
  274. package/dist/runner/codex.d.ts.map +1 -1
  275. package/dist/runner/codex.js +20 -17
  276. package/dist/runner/codex.js.map +1 -1
  277. package/dist/runner/config.d.ts +5 -0
  278. package/dist/runner/config.d.ts.map +1 -1
  279. package/dist/runner/config.js +9 -0
  280. package/dist/runner/config.js.map +1 -1
  281. package/dist/runner/desk.d.ts +43 -2
  282. package/dist/runner/desk.d.ts.map +1 -1
  283. package/dist/runner/desk.js +168 -13
  284. package/dist/runner/desk.js.map +1 -1
  285. package/dist/runner/process.d.ts.map +1 -1
  286. package/dist/runner/process.js +11 -4
  287. package/dist/runner/process.js.map +1 -1
  288. package/dist/runner/redact.d.ts +39 -4
  289. package/dist/runner/redact.d.ts.map +1 -1
  290. package/dist/runner/redact.js +81 -5
  291. package/dist/runner/redact.js.map +1 -1
  292. package/dist/runner/runner.d.ts +28 -3
  293. package/dist/runner/runner.d.ts.map +1 -1
  294. package/dist/runner/runner.js +371 -54
  295. package/dist/runner/runner.js.map +1 -1
  296. package/dist/runner/slack.d.ts.map +1 -1
  297. package/dist/runner/slack.js +10 -4
  298. package/dist/runner/slack.js.map +1 -1
  299. package/dist/runner/task-scheduler.d.ts +20 -0
  300. package/dist/runner/task-scheduler.d.ts.map +1 -1
  301. package/dist/runner/task-scheduler.js +34 -4
  302. package/dist/runner/task-scheduler.js.map +1 -1
  303. package/dist/runner/types.d.ts +51 -1
  304. package/dist/runner/types.d.ts.map +1 -1
  305. package/dist/runner/types.js +26 -0
  306. package/dist/runner/types.js.map +1 -1
  307. package/dist/runner.d.ts +6 -6
  308. package/dist/runner.d.ts.map +1 -1
  309. package/dist/runner.js +5 -5
  310. package/dist/runner.js.map +1 -1
  311. package/dist/schemas.d.ts +603 -6
  312. package/dist/schemas.d.ts.map +1 -1
  313. package/dist/schemas.js +156 -20
  314. package/dist/schemas.js.map +1 -1
  315. package/dist/services.d.ts +22 -5
  316. package/dist/services.d.ts.map +1 -1
  317. package/dist/services.js +41 -17
  318. package/dist/services.js.map +1 -1
  319. package/dist/setup-guide.d.ts +17 -4
  320. package/dist/setup-guide.d.ts.map +1 -1
  321. package/dist/setup-guide.js +48 -41
  322. package/dist/setup-guide.js.map +1 -1
  323. package/dist/tokens.d.ts.map +1 -1
  324. package/dist/tokens.js +5 -1
  325. package/dist/tokens.js.map +1 -1
  326. package/dist/vocabulary.d.ts +21 -3
  327. package/dist/vocabulary.d.ts.map +1 -1
  328. package/dist/vocabulary.js +19 -3
  329. package/dist/vocabulary.js.map +1 -1
  330. package/docs/specs/cli.md +73 -44
  331. package/docs/specs/plugins.md +40 -22
  332. package/docs/specs/records.md +113 -0
  333. package/docs/specs/rest.md +30 -21
  334. package/docs/specs/runner.md +46 -22
  335. package/package.json +11 -2
  336. package/skills/building-a-console/SKILL.md +4 -4
  337. package/skills/building-a-plugin/SKILL.md +6 -6
  338. package/skills/deploying-a-console/SKILL.md +4 -4
  339. package/skills/deploying-a-console/references/resources.md +41 -4
  340. package/skills/deploying-a-console/references/running-it-again.md +3 -2
  341. package/skills/keeping-a-desk/SKILL.md +133 -0
  342. package/skills/keeping-a-desk/collections.md +96 -0
  343. package/skills/planning-the-board/SKILL.md +14 -18
  344. package/skills/planning-the-board/references/a-task.md +2 -2
  345. package/skills/planning-the-board/references/project-rules.md +13 -14
  346. package/skills/planning-the-board/references/setting-up.md +15 -13
  347. package/skills/running-an-agent/SKILL.md +47 -56
  348. package/skills/working-the-board/SKILL.md +63 -44
  349. package/skills/working-the-board/references/terms.md +9 -5
  350. package/skills/working-the-board/references/the-pack.md +12 -10
  351. package/skills/working-the-board/references/the-sentence.md +2 -2
  352. package/src/agent-page.tsx +16 -2
  353. package/src/api.ts +109 -3
  354. package/src/charts.ts +250 -0
  355. package/src/cli/cli.ts +2226 -580
  356. package/src/cli/command-words.ts +56 -0
  357. package/src/cli/credentials.ts +181 -20
  358. package/src/cli/directory.ts +28 -10
  359. package/src/cli/format.ts +332 -49
  360. package/src/cli/help.ts +113 -57
  361. package/src/cli/machine-check.ts +223 -0
  362. package/src/cli/main.ts +72 -2
  363. package/src/cli/pack.ts +333 -372
  364. package/src/cli/plugin-check.ts +275 -34
  365. package/src/cli/plugin-cli.ts +28 -4
  366. package/src/cli/plugin-main.ts +1 -0
  367. package/src/cli/runner-host.ts +8 -0
  368. package/src/cli/secret-notes.ts +63 -0
  369. package/src/cli/serve.ts +295 -2
  370. package/src/client.ts +215 -177
  371. package/src/components/agent-page.tsx +1044 -281
  372. package/src/components/agents.tsx +9 -5
  373. package/src/components/board.tsx +3 -15
  374. package/src/components/categories.tsx +2 -2
  375. package/src/components/charts.tsx +680 -0
  376. package/src/components/decision-list.tsx +11 -7
  377. package/src/components/desk-records.tsx +724 -0
  378. package/src/components/desk.tsx +471 -0
  379. package/src/components/event-feed.tsx +12 -3
  380. package/src/components/goals.tsx +33 -25
  381. package/src/components/home.tsx +42 -6
  382. package/src/components/icon.tsx +337 -0
  383. package/src/components/markdown.tsx +22 -2
  384. package/src/components/people.tsx +1 -1
  385. package/src/components/plugin-frame.tsx +7 -0
  386. package/src/components/plugin-settings.tsx +171 -12
  387. package/src/components/projects.tsx +68 -17
  388. package/src/components/rules.tsx +94 -34
  389. package/src/components/sessions.tsx +2 -13
  390. package/src/components/setup.tsx +20 -5
  391. package/src/components/shell.tsx +3 -20
  392. package/src/components/tokens.tsx +1 -1
  393. package/src/components/ui.tsx +16 -8
  394. package/src/connect-page.tsx +1 -1
  395. package/src/console.tsx +104 -62
  396. package/src/data.ts +37 -34
  397. package/src/desk-page.tsx +332 -0
  398. package/src/desk-records-page.tsx +256 -0
  399. package/src/desk-records.ts +808 -0
  400. package/src/desk.ts +329 -0
  401. package/src/feed-stream.ts +144 -0
  402. package/src/home-tiles.ts +170 -46
  403. package/src/i18n/en.ts +323 -11
  404. package/src/i18n/ko.ts +378 -87
  405. package/src/i18n/particles.ts +79 -0
  406. package/src/icons/glyphs.ts +112 -0
  407. package/src/icons/index.ts +195 -0
  408. package/src/index.ts +125 -0
  409. package/src/limits.ts +20 -0
  410. package/src/marks.ts +12 -0
  411. package/src/onboarding.ts +14 -6
  412. package/src/plugin/context.ts +55 -12
  413. package/src/plugin/limits.ts +2 -0
  414. package/src/plugin/manifest.ts +38 -2
  415. package/src/plugin/rest-schemas.ts +41 -0
  416. package/src/plugin/sandbox.ts +4 -1
  417. package/src/plugin/testing.ts +63 -12
  418. package/src/plugin/web.ts +9 -2
  419. package/src/plugin.ts +2 -0
  420. package/src/records.ts +702 -0
  421. package/src/routes.ts +3 -1
  422. package/src/rules.ts +108 -47
  423. package/src/runner/acp.ts +49 -30
  424. package/src/runner/awake.ts +135 -0
  425. package/src/runner/claude.ts +131 -26
  426. package/src/runner/codex.ts +37 -26
  427. package/src/runner/config.ts +9 -0
  428. package/src/runner/desk.ts +200 -15
  429. package/src/runner/process.ts +11 -4
  430. package/src/runner/redact.ts +92 -6
  431. package/src/runner/runner.ts +457 -56
  432. package/src/runner/slack.ts +10 -4
  433. package/src/runner/task-scheduler.ts +36 -4
  434. package/src/runner/types.ts +67 -1
  435. package/src/runner.ts +27 -2
  436. package/src/schemas.ts +177 -18
  437. package/src/services.ts +55 -16
  438. package/src/setup-guide.ts +49 -40
  439. package/src/styles/README.md +16 -5
  440. package/src/styles/base.css +17 -0
  441. package/src/styles/console.css +10 -0
  442. package/src/styles/drawn-by-pages.json +1 -1
  443. package/src/styles/pages/agents.css +103 -1
  444. package/src/styles/pages/board.css +0 -10
  445. package/src/styles/pages/calendar.css +1 -1
  446. package/src/styles/pages/connect.css +0 -10
  447. package/src/styles/pages/decisions.css +3 -1
  448. package/src/styles/pages/desk.css +126 -0
  449. package/src/styles/pages/documents.css +5 -0
  450. package/src/styles/pages/feed.css +5 -2
  451. package/src/styles/pages/home.css +5 -0
  452. package/src/styles/pages/roadmap.css +2 -2
  453. package/src/styles/pages/settings.css +11 -0
  454. package/src/styles/pages/task.css +0 -20
  455. package/src/styles/pages/thread.css +1 -1
  456. package/src/styles/parts/bars.css +80 -0
  457. package/src/styles/parts/calendar.css +1 -1
  458. package/src/styles/parts/callout.css +1 -0
  459. package/src/styles/parts/chart.css +173 -0
  460. package/src/styles/parts/detail.css +22 -0
  461. package/src/styles/parts/empty.css +2 -0
  462. package/src/styles/parts/eyebrow.css +1 -1
  463. package/src/styles/parts/facts.css +1 -1
  464. package/src/styles/parts/figures.css +65 -0
  465. package/src/styles/parts/form.css +2 -1
  466. package/src/styles/parts/icon.css +191 -0
  467. package/src/styles/parts/input.css +14 -4
  468. package/src/styles/parts/legend.css +48 -0
  469. package/src/styles/parts/mark.css +36 -0
  470. package/src/styles/parts/menu.css +1 -7
  471. package/src/styles/parts/page.css +1 -1
  472. package/src/styles/parts/panel.css +10 -0
  473. package/src/styles/parts/person.css +5 -2
  474. package/src/styles/parts/progress.css +5 -2
  475. package/src/styles/parts/rows.css +1 -0
  476. package/src/styles/parts/series.css +32 -0
  477. package/src/styles/parts/settings.css +5 -0
  478. package/src/styles/parts/share.css +25 -0
  479. package/src/styles/parts/spark.css +23 -0
  480. package/src/styles/parts/stat.css +69 -0
  481. package/src/styles/tokens.css +31 -10
  482. package/src/tokens.ts +5 -1
  483. package/src/vocabulary.ts +25 -3
  484. package/template/desk-web/README.md +8 -0
  485. package/template/desk-web/index.html +13 -0
  486. package/template/desk-web/package.json +25 -0
  487. package/template/desk-web/src/main.tsx +24 -0
  488. package/template/desk-web/src/page.tsx +51 -0
  489. package/template/desk-web/tsconfig.json +16 -0
  490. package/template/desk-web/vite.config.ts +15 -0
@@ -12,6 +12,7 @@ import type {
12
12
  RestPluginEnableInput,
13
13
  RestPluginGrant,
14
14
  RestPluginGrantInput,
15
+ RestPluginJob,
15
16
  RestPluginSetting,
16
17
  RestProject,
17
18
  RestTeam,
@@ -122,6 +123,10 @@ export function PluginSettingsList(props: PluginSettingsListProps) {
122
123
  </span>
123
124
  </a>
124
125
  <span className="sc-task-row-meta">
126
+ {/* A plugin that runs with something wrong in it, a job that keeps failing say (ADR-0128). */}
127
+ {plugin.problems.length > 0 && plugin.state !== "failed" && (
128
+ <Badge tone="danger">{settings.hasProblems}</Badge>
129
+ )}
125
130
  <Badge tone={STATE_TONES[plugin.state]}>
126
131
  {words.vocabulary.pluginState[plugin.state] ?? plugin.state}
127
132
  </Badge>
@@ -194,6 +199,32 @@ function TickRow(props: {
194
199
  );
195
200
  }
196
201
 
202
+ /**
203
+ * How a job stands, in a line (ADR-0128): when it last ran and how that went, since when it has
204
+ * failed where it failed more than once running, and when it runs next.
205
+ */
206
+ function jobStanding(
207
+ settings: Messages["plugins"]["settings"],
208
+ job: RestPluginJob,
209
+ language: string,
210
+ ): string {
211
+ const parts: string[] = [];
212
+ if (job.lastRunAt === null || job.lastOutcome === null) {
213
+ parts.push(settings.jobNotRun);
214
+ } else if (job.lastOutcome === "ok") {
215
+ parts.push(settings.jobRan(formatInstant(job.lastRunAt, language)));
216
+ } else {
217
+ parts.push(settings.jobFailed(formatInstant(job.lastRunAt, language)));
218
+ if (job.failedSince !== null && job.failedSince !== job.lastRunAt) {
219
+ parts.push(settings.jobFailingSince(formatInstant(job.failedSince, language)));
220
+ }
221
+ }
222
+ if (job.nextAt !== null) {
223
+ parts.push(settings.jobNext(formatInstant(job.nextAt, language)));
224
+ }
225
+ return parts.join(" \u00b7 ");
226
+ }
227
+
197
228
  /** What the plugin is on and holds, a row each; nothing where there is nothing to say yet. */
198
229
  function Overview(props: {
199
230
  readonly detail: RestPluginDetail;
@@ -311,6 +342,26 @@ function Overview(props: {
311
342
  ),
312
343
  });
313
344
  }
345
+ // The jobs as the scheduler keeps them (ADR-0128); a console before 0.5.1 names none.
346
+ if (detail.jobs !== undefined && detail.jobs.length > 0) {
347
+ rows.push({
348
+ key: "jobs",
349
+ name: settings.jobs,
350
+ value: (
351
+ <ul className="sc-plugin-held">
352
+ {detail.jobs.map((job) => (
353
+ <li key={job.name}>
354
+ <span className="sc-plugin-tick-name">
355
+ <code>{job.name}</code>
356
+ {job.lastOutcome === "failed" && <Badge tone="danger">{settings.jobFailing}</Badge>}
357
+ </span>
358
+ <span className="sc-plugin-tick-under"> {jobStanding(settings, job, language)}</span>
359
+ </li>
360
+ ))}
361
+ </ul>
362
+ ),
363
+ });
364
+ }
314
365
  if (detail.operations.length > 0) {
315
366
  rows.push({
316
367
  key: "operations",
@@ -790,7 +841,11 @@ function SettingsForm(props: {
790
841
  */
791
842
  function secretStanding(
792
843
  settings: Messages["plugins"]["settings"],
793
- setting: RestPluginSetting,
844
+ setting: {
845
+ readonly setAt: string | null;
846
+ readonly source?: string | null | undefined;
847
+ readonly expiresAt?: string | null | undefined;
848
+ },
794
849
  language: string,
795
850
  ): string {
796
851
  const when = formatInstant(setting.setAt ?? "", language);
@@ -879,6 +934,96 @@ function SecretRow(props: {
879
934
  );
880
935
  }
881
936
 
937
+ /**
938
+ * A secret kept per key (ADR-0111): how many keys hold a value of how many it may keep, each key
939
+ * on a line with how its value stands and the way to remove it, and a key and a value to set one
940
+ * by hand. The values are never shown; the keys are no secret.
941
+ */
942
+ function KeyedSecretRow(props: {
943
+ readonly setting: RestPluginSetting;
944
+ readonly language: string;
945
+ readonly busy: boolean;
946
+ readonly onSet: (key: string, value: string) => void;
947
+ readonly onRemove: (key: string) => void;
948
+ }) {
949
+ const words = useWords();
950
+ const settings = words.plugins.settings;
951
+ const [key, setKey] = useState("");
952
+ const [value, setValue] = useState("");
953
+ const id = useId();
954
+ const { setting } = props;
955
+ const keys = setting.keys ?? [];
956
+ const max = setting.keyed?.max ?? keys.length;
957
+ return (
958
+ <div className="sc-settings-row">
959
+ <div>
960
+ <label className="sc-settings-label" htmlFor={id}>
961
+ {pluginWord(setting.name, props.language)}
962
+ </label>
963
+ <p className="sc-settings-hint">
964
+ {keys.length === 0 ? settings.secretKeysNone : settings.secretKeys(keys.length, max)}
965
+ </p>
966
+ {setting.hosts !== null && setting.hosts !== undefined && setting.hosts.length > 0 && (
967
+ <p className="sc-settings-hint">{settings.secretHosts(setting.hosts.join(", "))}</p>
968
+ )}
969
+ {setting.description !== null && (
970
+ <p className="sc-settings-hint">{pluginWord(setting.description, props.language)}</p>
971
+ )}
972
+ </div>
973
+ <div className="sc-settings-control">
974
+ {keys.map((kept) => (
975
+ <div key={kept.key} className="sc-plugin-line">
976
+ <div>
977
+ <code className="sc-project-key">{kept.key}</code>
978
+ <p className="sc-settings-hint">{secretStanding(settings, kept, props.language)}</p>
979
+ </div>
980
+ <Button
981
+ variant="ghost"
982
+ size="sm"
983
+ disabled={props.busy}
984
+ aria-label={settings.secretKeyRemove(kept.key)}
985
+ onClick={() => props.onRemove(kept.key)}
986
+ >
987
+ {words.common.remove}
988
+ </Button>
989
+ </div>
990
+ ))}
991
+ <input
992
+ id={id}
993
+ className="sc-input"
994
+ autoComplete="off"
995
+ spellCheck={false}
996
+ placeholder={settings.secretKeyNew}
997
+ aria-label={settings.secretKeyNew}
998
+ value={key}
999
+ onChange={(event) => setKey(event.target.value)}
1000
+ />
1001
+ <div className="sc-plugin-line">
1002
+ <input
1003
+ className="sc-input sc-plugin-line-input"
1004
+ type="password"
1005
+ autoComplete="off"
1006
+ placeholder={settings.secretNew}
1007
+ aria-label={settings.secretNew}
1008
+ value={value}
1009
+ onChange={(event) => setValue(event.target.value)}
1010
+ />
1011
+ <Button
1012
+ disabled={props.busy || key.trim().length === 0 || value.length === 0}
1013
+ onClick={() => {
1014
+ props.onSet(key.trim(), value);
1015
+ setKey("");
1016
+ setValue("");
1017
+ }}
1018
+ >
1019
+ {words.common.save}
1020
+ </Button>
1021
+ </div>
1022
+ </div>
1023
+ </div>
1024
+ );
1025
+ }
1026
+
882
1027
  /**
883
1028
  * Enabling: the capabilities the plugin requires, on and not the administrator's to turn off, and
884
1029
  * those it can go without, off until chosen, those consented to before on already (ADR-0060); the
@@ -1508,7 +1653,10 @@ export function PluginSettingsView(props: PluginSettingsViewProps) {
1508
1653
  <p className="sc-lead">{pluginWord(detail.description, language)}</p>
1509
1654
  {error !== undefined && <Callout tone="danger">{error}</Callout>}
1510
1655
  {detail.problems.length > 0 && (
1511
- <Callout tone="danger" title={settings.problems}>
1656
+ <Callout
1657
+ tone="danger"
1658
+ title={detail.state === "failed" ? settings.problems : settings.problemsRunning}
1659
+ >
1512
1660
  <ul className="sc-plugin-problems">
1513
1661
  {detail.problems.map((problem) => (
1514
1662
  <li key={problem}>{problem}</li>
@@ -1564,16 +1712,27 @@ export function PluginSettingsView(props: PluginSettingsViewProps) {
1564
1712
  />
1565
1713
  {detail.settings
1566
1714
  .filter((setting) => setting.type === "secret")
1567
- .map((setting) => (
1568
- <SecretRow
1569
- key={setting.key}
1570
- setting={setting}
1571
- language={language}
1572
- busy={busy}
1573
- onSet={(value) => change(() => plugin.setSecret(setting.key, value))}
1574
- onRemove={() => change(() => plugin.removeSecret(setting.key))}
1575
- />
1576
- ))}
1715
+ .map((setting) =>
1716
+ setting.keyed !== null && setting.keyed !== undefined ? (
1717
+ <KeyedSecretRow
1718
+ key={setting.key}
1719
+ setting={setting}
1720
+ language={language}
1721
+ busy={busy}
1722
+ onSet={(key, value) => change(() => plugin.setSecret(setting.key, value, key))}
1723
+ onRemove={(key) => change(() => plugin.removeSecret(setting.key, key))}
1724
+ />
1725
+ ) : (
1726
+ <SecretRow
1727
+ key={setting.key}
1728
+ setting={setting}
1729
+ language={language}
1730
+ busy={busy}
1731
+ onSet={(value) => change(() => plugin.setSecret(setting.key, value))}
1732
+ onRemove={() => change(() => plugin.removeSecret(setting.key))}
1733
+ />
1734
+ ),
1735
+ )}
1577
1736
  </div>
1578
1737
  </section>
1579
1738
  )}
@@ -1,8 +1,10 @@
1
- import { type FormEvent, type ReactNode, useEffect, useMemo, useState } from "react";
1
+ import { type FormEvent, type ReactNode, useEffect, useState } from "react";
2
2
  import {
3
3
  COLOR_NAMES,
4
4
  type ColorName,
5
+ type IconName,
5
6
  MAX_PROJECT_DESCRIPTION_LENGTH,
7
+ MAX_PROJECT_ICON_BYTES,
6
8
  MAX_PROJECT_KEY_LENGTH,
7
9
  MAX_PROJECT_NAME_LENGTH,
8
10
  MAX_PROJECT_SYMBOL_LENGTH,
@@ -13,6 +15,7 @@ import {
13
15
  type ProjectRole,
14
16
  type ProjectVisibility,
15
17
  projectColorOf,
18
+ projectGlyphOf,
16
19
  projectIconPath,
17
20
  projectSymbolOf,
18
21
  type RestMember,
@@ -23,13 +26,15 @@ import {
23
26
  type RestProjectPatch,
24
27
  } from "../api.js";
25
28
  import { useWords } from "../i18n/index.js";
29
+ import { Icon, IconPicker } from "./icon.js";
26
30
  import { Picker } from "./picker.js";
27
31
  import { peopleSearch } from "./searches.js";
28
32
  import { Badge, Button, cx, PersonChip, PersonOption, personName, Time } from "./ui.js";
29
33
 
30
34
  /**
31
- * A project's mark: its symbol on its colour, so that projects tell apart at a glance; its own
32
- * image over the symbol where it has one, so that the mark is never empty while the image loads.
35
+ * A project's mark: its symbol on its colour, so that projects tell apart at a glance, or an
36
+ * icon of the pack in the symbol's place where it names one (ADR-0142); its own image over
37
+ * either where it has one, so that the mark is never empty while the image loads.
33
38
  */
34
39
  export function ProjectMark(props: {
35
40
  readonly project: {
@@ -37,7 +42,9 @@ export function ProjectMark(props: {
37
42
  readonly name: string;
38
43
  readonly color: ColorName | null;
39
44
  readonly symbol: string | null;
40
- /** The project's own image, when it has one; the symbol on the colour otherwise. */
45
+ /** The icon of the pack shown in the symbol's place, by its name, where the project names one. */
46
+ readonly glyph?: string | null | undefined;
47
+ /** The project's own image, when it has one; the symbol or the icon on the colour otherwise. */
41
48
  readonly icon?: { readonly sha256: string } | null | undefined;
42
49
  };
43
50
  readonly size?: "sm" | "md" | "lg";
@@ -53,6 +60,7 @@ export function ProjectMark(props: {
53
60
  const [shown, setShown] = useState<string | undefined>(undefined);
54
61
  const [failed, setFailed] = useState<string | undefined>(undefined);
55
62
  const pictured = src !== undefined && failed !== src;
63
+ const glyph = projectGlyphOf(props.project);
56
64
  return (
57
65
  <span
58
66
  className={cx(
@@ -63,7 +71,8 @@ export function ProjectMark(props: {
63
71
  )}
64
72
  aria-hidden="true"
65
73
  >
66
- {(!pictured || shown !== src) && projectSymbolOf(props.project)}
74
+ {(!pictured || shown !== src) &&
75
+ (glyph === undefined ? projectSymbolOf(props.project) : <Icon name={glyph} />)}
67
76
  {pictured && (
68
77
  <img
69
78
  className="sc-mark-image"
@@ -127,6 +136,20 @@ export function keyOf(name: string): string {
127
136
  .slice(0, MAX_PROJECT_KEY_LENGTH);
128
137
  }
129
138
 
139
+ /**
140
+ * What a save says of a project's icon: the one chosen where the form changed it, and nothing
141
+ * where it did not. A console older than the field refuses nothing it was not sent, a project
142
+ * that never had an icon is sent none, and an icon this page's pack does not have, one of a
143
+ * newer console's, which the form shows as none, stays the project's when something else is
144
+ * saved.
145
+ */
146
+ export function glyphChange(
147
+ before: IconName | null,
148
+ chosen: IconName | null,
149
+ ): { readonly glyph?: IconName | null } {
150
+ return chosen === before ? {} : { glyph: chosen };
151
+ }
152
+
130
153
  export function ProjectForm(props: ProjectFormProps) {
131
154
  const words = useWords();
132
155
  const form = words.projects.form;
@@ -139,20 +162,40 @@ export function ProjectForm(props: ProjectFormProps) {
139
162
  const [skillsAddress, setSkillsAddress] = useState(project?.skillsAddress ?? "");
140
163
  const [color, setColor] = useState<ColorName | "">(project?.color ?? "");
141
164
  const [symbol, setSymbol] = useState(project?.symbol ?? "");
165
+ /** The icon the project has, where this page's pack has it: what the form begins with, and what a save is held against. */
166
+ const glyphBefore: IconName | null =
167
+ project === undefined ? null : (projectGlyphOf(project) ?? null);
168
+ const [glyph, setGlyph] = useState<IconName | null>(glyphBefore);
142
169
  /** The image for the mark: a file chosen, `null` for none any more, nothing to keep the project's. */
143
170
  const [icon, setIcon] = useState<File | null | undefined>(undefined);
144
- const chosenSrc = useMemo(
145
- () => (icon instanceof File ? URL.createObjectURL(icon) : undefined),
146
- [icon],
147
- );
148
- useEffect(
149
- () => () => {
150
- if (chosenSrc !== undefined) {
151
- URL.revokeObjectURL(chosenSrc);
171
+ // The image chosen, as an address the mark can show before it is saved: the file's own bytes,
172
+ // read here. The pages' policy lets an image come from the console or from a `data:` address
173
+ // and from nowhere else, so an address of the browser's own for the file (`blob:`) is refused
174
+ // and the mark would stay its symbol. A file larger than an icon may be is not read: the
175
+ // console refuses it when the form is sent.
176
+ const [chosenSrc, setChosenSrc] = useState<string | undefined>(undefined);
177
+ useEffect(() => {
178
+ setChosenSrc(undefined);
179
+ if (
180
+ !(icon instanceof File) ||
181
+ icon.size > MAX_PROJECT_ICON_BYTES ||
182
+ typeof FileReader === "undefined"
183
+ ) {
184
+ return;
185
+ }
186
+ const reader = new FileReader();
187
+ reader.onload = () => {
188
+ if (typeof reader.result === "string") {
189
+ setChosenSrc(reader.result);
152
190
  }
153
- },
154
- [chosenSrc],
155
- );
191
+ };
192
+ reader.readAsDataURL(icon);
193
+ // Another file chosen, or the form gone, before this one was read: its answer is dropped.
194
+ return () => {
195
+ reader.onload = null;
196
+ reader.abort();
197
+ };
198
+ }, [icon]);
156
199
  const kept = icon === undefined ? (project?.icon ?? null) : null;
157
200
  /** The mark as it will be, from what is typed and chosen so far. */
158
201
  const preview = {
@@ -160,6 +203,7 @@ export function ProjectForm(props: ProjectFormProps) {
160
203
  name: name.trim() === "" ? "?" : name.trim(),
161
204
  color: color === "" ? null : color,
162
205
  symbol: symbol.trim() === "" ? null : symbol.trim(),
206
+ glyph,
163
207
  icon: icon instanceof File ? { sha256: "chosen" } : kept,
164
208
  };
165
209
 
@@ -172,6 +216,7 @@ export function ProjectForm(props: ProjectFormProps) {
172
216
  skillsAddress: skillsAddress.trim() === "" ? null : skillsAddress.trim(),
173
217
  color: preview.color,
174
218
  symbol: preview.symbol,
219
+ ...glyphChange(glyphBefore, glyph),
175
220
  };
176
221
  props.onSubmit(
177
222
  project === undefined ? { key: key.trim(), ...settings, name: name.trim() } : settings,
@@ -261,6 +306,10 @@ export function ProjectForm(props: ProjectFormProps) {
261
306
  </div>
262
307
  <div className="sc-field-row sc-mark-row">
263
308
  <ProjectMark project={preview} size="lg" iconSrc={chosenSrc} />
309
+ <div className="sc-field">
310
+ <span className="sc-field-label">{form.icon}</span>
311
+ <IconPicker value={glyph} label={form.icon} onChange={setGlyph} />
312
+ </div>
264
313
  <label className="sc-field">
265
314
  <span className="sc-field-label">{form.symbol}</span>
266
315
  <input
@@ -400,7 +449,9 @@ export function MemberList(props: MemberListProps) {
400
449
  {member.person.name ?? ""}
401
450
  <span className="sc-muted">
402
451
  {" "}
403
- {members.since} <Time iso={member.addedAt} />
452
+ {members.since.before}
453
+ <Time iso={member.addedAt} />
454
+ {members.since.after}
404
455
  </span>
405
456
  </span>
406
457
  {props.onChangeRole === undefined || member.person.role === "admin" ? (
@@ -1,23 +1,24 @@
1
1
  import { type FormEvent, useState } from "react";
2
- import { fillRules, isReferenceRules, MAX_RULES_LENGTH, type RestRules } from "../api.js";
2
+ import { fillRules, MAX_RULES_LENGTH, type RestRules } from "../api.js";
3
3
  import { useLanguage, useWords } from "../i18n/index.js";
4
4
  import { Writer } from "./documents.js";
5
5
  import { Markdown } from "./markdown.js";
6
6
  import { Button, Callout, Time } from "./ui.js";
7
7
 
8
- // The rules of the board (ADR-0023), as the settings pages show them: what holds, where it
9
- // comes from (the console's own, a page written, or none), who wrote the page and when, and
10
- // the ways to change them for whoever may. Each takes its data as props and nothing from the
11
- // network; the rules are Markdown rendered to elements, never HTML, with `{language}` filled
12
- // with the language the pages speak, as the command fills it with the person's.
8
+ // The rules of the board (ADR-0023, ADR-0120), as the settings pages show them. At the
9
+ // workspace: the console's rules as they hold, read and never edited, and below them what the
10
+ // organization adds, with who wrote it and when, and the ways to change it for whoever may. At
11
+ // a project: what it adds, or that it adds none. Each takes its data as props and nothing from
12
+ // the network; the rules are Markdown rendered to elements, never HTML, with `{language}`
13
+ // filled with the language the pages speak, as the command fills it with the person's.
13
14
 
14
15
  export interface RulesViewProps {
15
16
  readonly rules: RestRules;
16
17
  /** Whose rules: the workspace's, or a project's, which add to the workspace's. */
17
18
  readonly scope: "workspace" | "project";
18
- /** Where the rules are written; left out, they are read here and not changed. */
19
+ /** Where what is added is written; left out, the rules are read here and not changed. */
19
20
  readonly editHref?: string | undefined;
20
- /** Called to put the written rules away; left out, they stay. */
21
+ /** Called to put what is added away; left out, it stays. */
21
22
  readonly onArchive?: (() => void) | undefined;
22
23
  readonly busy?: boolean | undefined;
23
24
  /** Where a page of the project is read, by its path, for the links a project's rules make. */
@@ -30,6 +31,9 @@ export function RulesView(props: RulesViewProps) {
30
31
  const words = useWords();
31
32
  const language = useLanguage().tag;
32
33
  const { rules, scope } = props;
34
+ if (scope === "workspace" && rules.own !== undefined && props.folded !== true) {
35
+ return <WorkspaceRules {...props} own={rules.own} />;
36
+ }
33
37
  const page = rules.page;
34
38
  if (rules.source === "none" || rules.body === null) {
35
39
  return (
@@ -46,10 +50,13 @@ export function RulesView(props: RulesViewProps) {
46
50
  );
47
51
  }
48
52
  const text = <Markdown source={fillRules(rules.body, language)} docHref={props.docHref} />;
53
+ // A project's own are changed here. The workspace's come this way folded, on a project's
54
+ // page, or whole from a console of before, which says no parts: read, and changed elsewhere.
55
+ const changed = scope === "project";
49
56
  return (
50
57
  <div>
51
58
  {rules.source === "reference" ? (
52
- <Callout tone="info">{words.rules.reference}</Callout>
59
+ <Callout tone="info">{words.rules.console}</Callout>
53
60
  ) : (
54
61
  page !== null && (
55
62
  <p className="sc-rules-facts">
@@ -66,16 +73,58 @@ export function RulesView(props: RulesViewProps) {
66
73
  ) : (
67
74
  text
68
75
  )}
69
- {(props.editHref !== undefined || props.onArchive !== undefined) && (
76
+ {changed && (props.editHref !== undefined || props.onArchive !== undefined) && (
70
77
  <div className="sc-rules-actions">
71
78
  {props.editHref !== undefined && (
72
79
  <a className="sc-button sc-button-secondary" href={props.editHref}>
73
- {rules.source === "reference" ? words.rules.writeOrganizations : words.common.edit}
80
+ {words.common.edit}
74
81
  </a>
75
82
  )}
76
- {rules.source === "written" && props.onArchive !== undefined && (
83
+ {props.onArchive !== undefined && (
77
84
  <Button variant="ghost" onClick={props.onArchive} disabled={props.busy === true}>
78
- {scope === "workspace" ? words.rules.useReference : words.common.remove}
85
+ {words.common.remove}
86
+ </Button>
87
+ )}
88
+ </div>
89
+ )}
90
+ </div>
91
+ );
92
+ }
93
+
94
+ /** The workspace's rules where they are kept: the console's as they hold, then what the organization adds. */
95
+ function WorkspaceRules(props: RulesViewProps & { readonly own: string }) {
96
+ const words = useWords();
97
+ const language = useLanguage().tag;
98
+ const added = props.rules.added ?? null;
99
+ return (
100
+ <div>
101
+ <Callout tone="info">{words.rules.console}</Callout>
102
+ <Markdown source={fillRules(props.own, language)} docHref={props.docHref} />
103
+ <div className="sc-rules-added">
104
+ <h3 className="sc-section-title">{words.rules.added}</h3>
105
+ {added === null ? (
106
+ <p className="sc-muted">{words.rules.nothingAdded}</p>
107
+ ) : (
108
+ <>
109
+ <p className="sc-rules-facts">
110
+ {words.docs.version(added.page.version)} · {words.docs.writtenBy}{" "}
111
+ <Writer by={added.page.updatedBy} agent={added.page.agent} />{" "}
112
+ <Time iso={added.page.updatedAt} />
113
+ </p>
114
+ <Markdown source={fillRules(added.body, language)} docHref={props.docHref} />
115
+ </>
116
+ )}
117
+ </div>
118
+ {(props.editHref !== undefined || (added !== null && props.onArchive !== undefined)) && (
119
+ <div className="sc-rules-actions">
120
+ {props.editHref !== undefined && (
121
+ <a className="sc-button sc-button-secondary" href={props.editHref}>
122
+ {added === null ? words.rules.add : words.common.edit}
123
+ </a>
124
+ )}
125
+ {added !== null && props.onArchive !== undefined && (
126
+ <Button variant="ghost" onClick={props.onArchive} disabled={props.busy === true}>
127
+ {words.common.remove}
79
128
  </Button>
80
129
  )}
81
130
  </div>
@@ -85,10 +134,10 @@ export function RulesView(props: RulesViewProps) {
85
134
  }
86
135
 
87
136
  export interface RulesFormProps {
88
- /** The rules as they hold now: what the form starts from when a page is written. */
137
+ /** The rules as they hold now: what the form starts from where something is written. */
89
138
  readonly rules: RestRules;
90
139
  readonly scope: "workspace" | "project";
91
- /** What the form starts from when a project adds none yet: the headings, and nothing an agent could mistake for a rule. */
140
+ /** What the form starts from where nothing is written yet: a project's headings; nothing at the workspace. */
92
141
  readonly template: string;
93
142
  readonly busy?: boolean | undefined;
94
143
  readonly error?: string | undefined;
@@ -97,25 +146,29 @@ export interface RulesFormProps {
97
146
  readonly baseVersion?: number | undefined;
98
147
  }) => void;
99
148
  readonly onCancel?: (() => void) | undefined;
100
- /** Called to put the organization's page away, so that the console's own rules hold again; offered while one is written. */
101
- readonly onReset?: (() => void) | undefined;
102
149
  }
103
150
 
104
151
  /**
105
- * The form the rules are written on: prefilled with what holds (the console's own, for a
106
- * workspace that wrote none), and saving nothing that would change nothing: the text as it
107
- * is, or the console's own rules where they hold already. Where the organization's are
108
- * written, the console's own saved as they stand put the page away, as the reset does.
152
+ * The form what is added to the rules is written on. At the workspace it holds what the
153
+ * organization adds and nothing of the console's rules, which are read above it: empty until
154
+ * something is added. At a project it starts from the project's page, or from the headings.
155
+ * It saves nothing that would change nothing.
109
156
  */
110
157
  export function RulesForm(props: RulesFormProps) {
111
158
  const words = useWords();
159
+ const language = useLanguage().tag;
112
160
  const { rules, scope } = props;
113
- /** What holds now: the page written, or the console's own; nothing for a project that adds none. */
114
- const current = rules.source === "none" ? undefined : (rules.body ?? undefined);
161
+ // A console of before says the whole and no parts, and takes the whole back.
162
+ const parts = scope === "workspace" && rules.own !== undefined;
163
+ /** What is written now: what the organization adds, or the page as it holds; nothing where nothing is. */
164
+ const current = parts
165
+ ? rules.added?.body
166
+ : rules.source === "none"
167
+ ? undefined
168
+ : (rules.body ?? undefined);
169
+ const page = parts ? (rules.added?.page ?? null) : rules.page;
115
170
  const [body, setBody] = useState(current ?? props.template);
116
- const unchanged =
117
- body.trim() === (current ?? "").trim() ||
118
- (scope === "workspace" && rules.source === "reference" && isReferenceRules(body));
171
+ const unchanged = body.trim() === (current ?? "").trim();
119
172
  const ready = !unchanged && body.trim().length > 0;
120
173
 
121
174
  const submit = (event: FormEvent) => {
@@ -125,14 +178,22 @@ export function RulesForm(props: RulesFormProps) {
125
178
  }
126
179
  props.onSubmit({
127
180
  body,
128
- ...(rules.page === null ? {} : { baseVersion: rules.page.version }),
181
+ ...(page === null ? {} : { baseVersion: page.version }),
129
182
  });
130
183
  };
131
184
 
132
185
  return (
133
186
  <form className="sc-form" onSubmit={submit}>
187
+ {parts && rules.own !== undefined && (
188
+ <details className="sc-rules-fold">
189
+ <summary>{words.rules.readConsole}</summary>
190
+ <Markdown source={fillRules(rules.own, language)} />
191
+ </details>
192
+ )}
134
193
  <label className="sc-field">
135
- <span className="sc-field-label">{words.rules.form.body}</span>
194
+ <span className="sc-field-label">
195
+ {scope === "workspace" ? words.rules.added : words.rules.form.body}
196
+ </span>
136
197
  <textarea
137
198
  className="sc-input sc-textarea sc-doc-editor"
138
199
  value={body}
@@ -140,7 +201,11 @@ export function RulesForm(props: RulesFormProps) {
140
201
  rows={20}
141
202
  onChange={(event) => setBody(event.target.value)}
142
203
  />
143
- <span className="sc-muted">{words.rules.form.hint(MAX_RULES_LENGTH)}</span>
204
+ <span className="sc-muted">
205
+ {scope === "workspace"
206
+ ? words.rules.form.hintAdded(MAX_RULES_LENGTH)
207
+ : words.rules.form.hint(MAX_RULES_LENGTH)}
208
+ </span>
144
209
  </label>
145
210
  {props.error !== undefined && (
146
211
  <p className="sc-form-error" role="alert">
@@ -156,11 +221,6 @@ export function RulesForm(props: RulesFormProps) {
156
221
  {words.common.cancel}
157
222
  </Button>
158
223
  )}
159
- {props.onReset !== undefined && rules.source === "written" && (
160
- <Button variant="ghost" onClick={props.onReset} disabled={props.busy === true}>
161
- {words.rules.useReference}
162
- </Button>
163
- )}
164
224
  </div>
165
225
  </form>
166
226
  );
@@ -1,6 +1,7 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { RestSession } from "../api.js";
3
3
  import { useWords } from "../i18n/index.js";
4
+ import { Icon } from "./icon.js";
4
5
  import { Badge, Button, cx, Time } from "./ui.js";
5
6
 
6
7
  // The browsers a person is signed in on (board #309), on a page of the settings of their own: each
@@ -26,19 +27,7 @@ const HANDHELD: ReadonlySet<string> = new Set(["iOS", "Android"]);
26
27
  function DeviceIcon(props: { readonly handheld: boolean }) {
27
28
  return (
28
29
  <span className="sc-session-icon">
29
- <svg viewBox="0 0 20 20" aria-hidden="true">
30
- {props.handheld ? (
31
- <>
32
- <rect x="5.5" y="2.5" width="9" height="15" rx="2" />
33
- <path d="M9 14.75h2" />
34
- </>
35
- ) : (
36
- <>
37
- <rect x="2.5" y="3.5" width="15" height="10" rx="1.5" />
38
- <path d="M7 16.5h6M10 13.5v3" />
39
- </>
40
- )}
41
- </svg>
30
+ <Icon name={props.handheld ? "handheld" : "desktop"} />
42
31
  </span>
43
32
  );
44
33
  }