@skillcdn/console 0.4.7 → 0.5.1

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 (599) hide show
  1. package/README.md +74 -14
  2. package/SKILLCDN.md +5 -3
  3. package/dist/agent-page.d.ts +44 -0
  4. package/dist/agent-page.d.ts.map +1 -0
  5. package/dist/agent-page.js +415 -0
  6. package/dist/agent-page.js.map +1 -0
  7. package/dist/agent-stream.d.ts +52 -0
  8. package/dist/agent-stream.d.ts.map +1 -0
  9. package/dist/agent-stream.js +155 -0
  10. package/dist/agent-stream.js.map +1 -0
  11. package/dist/api.d.ts +12 -6
  12. package/dist/api.d.ts.map +1 -1
  13. package/dist/api.js +11 -5
  14. package/dist/api.js.map +1 -1
  15. package/dist/avatar.d.ts +137 -0
  16. package/dist/avatar.d.ts.map +1 -0
  17. package/dist/avatar.js +1216 -0
  18. package/dist/avatar.js.map +1 -0
  19. package/dist/charts.d.ts +103 -0
  20. package/dist/charts.d.ts.map +1 -0
  21. package/dist/charts.js +182 -0
  22. package/dist/charts.js.map +1 -0
  23. package/dist/cli/cli.d.ts +39 -1
  24. package/dist/cli/cli.d.ts.map +1 -1
  25. package/dist/cli/cli.js +2424 -296
  26. package/dist/cli/cli.js.map +1 -1
  27. package/dist/cli/command-words.d.ts +20 -0
  28. package/dist/cli/command-words.d.ts.map +1 -0
  29. package/dist/cli/command-words.js +51 -0
  30. package/dist/cli/command-words.js.map +1 -0
  31. package/dist/cli/credentials.d.ts +59 -5
  32. package/dist/cli/credentials.d.ts.map +1 -1
  33. package/dist/cli/credentials.js +128 -16
  34. package/dist/cli/credentials.js.map +1 -1
  35. package/dist/cli/directory.d.ts +19 -4
  36. package/dist/cli/directory.d.ts.map +1 -1
  37. package/dist/cli/directory.js +16 -8
  38. package/dist/cli/directory.js.map +1 -1
  39. package/dist/cli/format.d.ts +91 -8
  40. package/dist/cli/format.d.ts.map +1 -1
  41. package/dist/cli/format.js +386 -57
  42. package/dist/cli/format.js.map +1 -1
  43. package/dist/cli/help.d.ts +13 -4
  44. package/dist/cli/help.d.ts.map +1 -1
  45. package/dist/cli/help.js +202 -62
  46. package/dist/cli/help.js.map +1 -1
  47. package/dist/cli/main.js +94 -0
  48. package/dist/cli/main.js.map +1 -1
  49. package/dist/cli/pack.d.ts +69 -36
  50. package/dist/cli/pack.d.ts.map +1 -1
  51. package/dist/cli/pack.js +241 -188
  52. package/dist/cli/pack.js.map +1 -1
  53. package/dist/cli/plugin-check.d.ts +42 -0
  54. package/dist/cli/plugin-check.d.ts.map +1 -1
  55. package/dist/cli/plugin-check.js +221 -36
  56. package/dist/cli/plugin-check.js.map +1 -1
  57. package/dist/cli/plugin-cli.d.ts +6 -1
  58. package/dist/cli/plugin-cli.d.ts.map +1 -1
  59. package/dist/cli/plugin-cli.js +21 -4
  60. package/dist/cli/plugin-cli.js.map +1 -1
  61. package/dist/cli/plugin-main.js +1 -0
  62. package/dist/cli/plugin-main.js.map +1 -1
  63. package/dist/cli/runner-host.d.ts +36 -0
  64. package/dist/cli/runner-host.d.ts.map +1 -0
  65. package/dist/cli/runner-host.js +154 -0
  66. package/dist/cli/runner-host.js.map +1 -0
  67. package/dist/cli/serve.d.ts +33 -1
  68. package/dist/cli/serve.d.ts.map +1 -1
  69. package/dist/cli/serve.js +275 -6
  70. package/dist/cli/serve.js.map +1 -1
  71. package/dist/cli/setup-machine.d.ts +36 -0
  72. package/dist/cli/setup-machine.d.ts.map +1 -0
  73. package/dist/cli/setup-machine.js +109 -0
  74. package/dist/cli/setup-machine.js.map +1 -0
  75. package/dist/client.d.ts +189 -10
  76. package/dist/client.d.ts.map +1 -1
  77. package/dist/client.js +192 -57
  78. package/dist/client.js.map +1 -1
  79. package/dist/compat.d.ts +1 -1
  80. package/dist/compat.js +2 -2
  81. package/dist/components/agent-page.d.ts +384 -0
  82. package/dist/components/agent-page.d.ts.map +1 -0
  83. package/dist/components/agent-page.js +985 -0
  84. package/dist/components/agent-page.js.map +1 -0
  85. package/dist/components/agents.d.ts +102 -0
  86. package/dist/components/agents.d.ts.map +1 -0
  87. package/dist/components/agents.js +246 -0
  88. package/dist/components/agents.js.map +1 -0
  89. package/dist/components/calendar.d.ts +17 -17
  90. package/dist/components/calendar.d.ts.map +1 -1
  91. package/dist/components/calendar.js +7 -2
  92. package/dist/components/calendar.js.map +1 -1
  93. package/dist/components/charts.d.ts +157 -0
  94. package/dist/components/charts.d.ts.map +1 -0
  95. package/dist/components/charts.js +182 -0
  96. package/dist/components/charts.js.map +1 -0
  97. package/dist/components/comments.d.ts +2 -0
  98. package/dist/components/comments.d.ts.map +1 -1
  99. package/dist/components/comments.js +1 -1
  100. package/dist/components/comments.js.map +1 -1
  101. package/dist/components/connect.d.ts.map +1 -1
  102. package/dist/components/connect.js +7 -2
  103. package/dist/components/connect.js.map +1 -1
  104. package/dist/components/decision-form.d.ts +21 -0
  105. package/dist/components/decision-form.d.ts.map +1 -1
  106. package/dist/components/decision-form.js +20 -6
  107. package/dist/components/decision-form.js.map +1 -1
  108. package/dist/components/decision-list.d.ts +24 -0
  109. package/dist/components/decision-list.d.ts.map +1 -1
  110. package/dist/components/decision-list.js +54 -5
  111. package/dist/components/decision-list.js.map +1 -1
  112. package/dist/components/desk-records.d.ts +102 -0
  113. package/dist/components/desk-records.d.ts.map +1 -0
  114. package/dist/components/desk-records.js +221 -0
  115. package/dist/components/desk-records.js.map +1 -0
  116. package/dist/components/desk.d.ts +85 -0
  117. package/dist/components/desk.d.ts.map +1 -0
  118. package/dist/components/desk.js +135 -0
  119. package/dist/components/desk.js.map +1 -0
  120. package/dist/components/event-feed.d.ts.map +1 -1
  121. package/dist/components/event-feed.js +26 -1
  122. package/dist/components/event-feed.js.map +1 -1
  123. package/dist/components/home.d.ts +12 -1
  124. package/dist/components/home.d.ts.map +1 -1
  125. package/dist/components/home.js +175 -16
  126. package/dist/components/home.js.map +1 -1
  127. package/dist/components/my-decisions.d.ts +5 -0
  128. package/dist/components/my-decisions.d.ts.map +1 -1
  129. package/dist/components/my-decisions.js +3 -3
  130. package/dist/components/my-decisions.js.map +1 -1
  131. package/dist/components/people.d.ts +17 -0
  132. package/dist/components/people.d.ts.map +1 -1
  133. package/dist/components/people.js +55 -19
  134. package/dist/components/people.js.map +1 -1
  135. package/dist/components/picker.d.ts +2 -0
  136. package/dist/components/picker.d.ts.map +1 -1
  137. package/dist/components/picker.js +1 -1
  138. package/dist/components/picker.js.map +1 -1
  139. package/dist/components/pictures.d.ts +38 -10
  140. package/dist/components/pictures.d.ts.map +1 -1
  141. package/dist/components/pictures.js +195 -40
  142. package/dist/components/pictures.js.map +1 -1
  143. package/dist/components/plugin-events.d.ts +29 -0
  144. package/dist/components/plugin-events.d.ts.map +1 -0
  145. package/dist/components/plugin-events.js +139 -0
  146. package/dist/components/plugin-events.js.map +1 -0
  147. package/dist/components/plugin-frame.d.ts.map +1 -1
  148. package/dist/components/plugin-frame.js +14 -37
  149. package/dist/components/plugin-frame.js.map +1 -1
  150. package/dist/components/plugin-settings.d.ts.map +1 -1
  151. package/dist/components/plugin-settings.js +58 -7
  152. package/dist/components/plugin-settings.js.map +1 -1
  153. package/dist/components/projects.d.ts.map +1 -1
  154. package/dist/components/projects.js +30 -10
  155. package/dist/components/projects.js.map +1 -1
  156. package/dist/components/rules.d.ts +8 -10
  157. package/dist/components/rules.d.ts.map +1 -1
  158. package/dist/components/rules.js +36 -14
  159. package/dist/components/rules.js.map +1 -1
  160. package/dist/components/sessions.d.ts.map +1 -1
  161. package/dist/components/sessions.js +8 -4
  162. package/dist/components/sessions.js.map +1 -1
  163. package/dist/components/setup.d.ts +59 -0
  164. package/dist/components/setup.d.ts.map +1 -0
  165. package/dist/components/setup.js +93 -0
  166. package/dist/components/setup.js.map +1 -0
  167. package/dist/components/sign-in.js +1 -1
  168. package/dist/components/sign-in.js.map +1 -1
  169. package/dist/components/task-form.d.ts.map +1 -1
  170. package/dist/components/task-form.js +2 -2
  171. package/dist/components/task-form.js.map +1 -1
  172. package/dist/components/task-list.d.ts +7 -6
  173. package/dist/components/task-list.d.ts.map +1 -1
  174. package/dist/components/task-list.js.map +1 -1
  175. package/dist/components/task-view.d.ts +3 -0
  176. package/dist/components/task-view.d.ts.map +1 -1
  177. package/dist/components/task-view.js +1 -1
  178. package/dist/components/task-view.js.map +1 -1
  179. package/dist/components/ui.d.ts +78 -8
  180. package/dist/components/ui.d.ts.map +1 -1
  181. package/dist/components/ui.js +88 -9
  182. package/dist/components/ui.js.map +1 -1
  183. package/dist/components/work.d.ts +5 -5
  184. package/dist/components/work.d.ts.map +1 -1
  185. package/dist/components/work.js.map +1 -1
  186. package/dist/components/workspace.d.ts +17 -0
  187. package/dist/components/workspace.d.ts.map +1 -1
  188. package/dist/components/workspace.js +129 -2
  189. package/dist/components/workspace.js.map +1 -1
  190. package/dist/connect-page.d.ts.map +1 -1
  191. package/dist/connect-page.js +5 -2
  192. package/dist/connect-page.js.map +1 -1
  193. package/dist/console.css +7551 -4580
  194. package/dist/console.d.ts +20 -0
  195. package/dist/console.d.ts.map +1 -1
  196. package/dist/console.js +331 -57
  197. package/dist/console.js.map +1 -1
  198. package/dist/data.d.ts +22 -1
  199. package/dist/data.d.ts.map +1 -1
  200. package/dist/data.js +62 -34
  201. package/dist/data.js.map +1 -1
  202. package/dist/desk-page.d.ts +38 -0
  203. package/dist/desk-page.d.ts.map +1 -0
  204. package/dist/desk-page.js +184 -0
  205. package/dist/desk-page.js.map +1 -0
  206. package/dist/desk-records-page.d.ts +18 -0
  207. package/dist/desk-records-page.d.ts.map +1 -0
  208. package/dist/desk-records-page.js +130 -0
  209. package/dist/desk-records-page.js.map +1 -0
  210. package/dist/desk-records.d.ts +247 -0
  211. package/dist/desk-records.d.ts.map +1 -0
  212. package/dist/desk-records.js +543 -0
  213. package/dist/desk-records.js.map +1 -0
  214. package/dist/desk.d.ts +122 -0
  215. package/dist/desk.d.ts.map +1 -0
  216. package/dist/desk.js +211 -0
  217. package/dist/desk.js.map +1 -0
  218. package/dist/feed-stream.d.ts +39 -0
  219. package/dist/feed-stream.d.ts.map +1 -0
  220. package/dist/feed-stream.js +117 -0
  221. package/dist/feed-stream.js.map +1 -0
  222. package/dist/glances.d.ts +39 -0
  223. package/dist/glances.d.ts.map +1 -0
  224. package/dist/glances.js +94 -0
  225. package/dist/glances.js.map +1 -0
  226. package/dist/home-tiles.d.ts +69 -5
  227. package/dist/home-tiles.d.ts.map +1 -1
  228. package/dist/home-tiles.js +347 -9
  229. package/dist/home-tiles.js.map +1 -1
  230. package/dist/i18n/en.d.ts +773 -3
  231. package/dist/i18n/en.d.ts.map +1 -1
  232. package/dist/i18n/en.js +770 -9
  233. package/dist/i18n/en.js.map +1 -1
  234. package/dist/i18n/ko.d.ts.map +1 -1
  235. package/dist/i18n/ko.js +736 -9
  236. package/dist/i18n/ko.js.map +1 -1
  237. package/dist/index.d.ts +19 -7
  238. package/dist/index.d.ts.map +1 -1
  239. package/dist/index.js +17 -5
  240. package/dist/index.js.map +1 -1
  241. package/dist/limits.d.ts +67 -0
  242. package/dist/limits.d.ts.map +1 -1
  243. package/dist/limits.js +67 -0
  244. package/dist/limits.js.map +1 -1
  245. package/dist/onboarding.d.ts +21 -0
  246. package/dist/onboarding.d.ts.map +1 -0
  247. package/dist/onboarding.js +43 -0
  248. package/dist/onboarding.js.map +1 -0
  249. package/dist/persona.d.ts +34 -0
  250. package/dist/persona.d.ts.map +1 -0
  251. package/dist/persona.js +71 -0
  252. package/dist/persona.js.map +1 -0
  253. package/dist/plugin/context.d.ts +42 -11
  254. package/dist/plugin/context.d.ts.map +1 -1
  255. package/dist/plugin/limits.d.ts +2 -0
  256. package/dist/plugin/limits.d.ts.map +1 -1
  257. package/dist/plugin/limits.js +2 -0
  258. package/dist/plugin/limits.js.map +1 -1
  259. package/dist/plugin/manifest.d.ts +13 -0
  260. package/dist/plugin/manifest.d.ts.map +1 -1
  261. package/dist/plugin/manifest.js +34 -4
  262. package/dist/plugin/manifest.js.map +1 -1
  263. package/dist/plugin/rest-schemas.d.ts +56 -0
  264. package/dist/plugin/rest-schemas.d.ts.map +1 -1
  265. package/dist/plugin/rest-schemas.js +42 -0
  266. package/dist/plugin/rest-schemas.js.map +1 -1
  267. package/dist/plugin/sandbox.d.ts.map +1 -1
  268. package/dist/plugin/sandbox.js +4 -1
  269. package/dist/plugin/sandbox.js.map +1 -1
  270. package/dist/plugin/testing.d.ts +6 -2
  271. package/dist/plugin/testing.d.ts.map +1 -1
  272. package/dist/plugin/testing.js +52 -10
  273. package/dist/plugin/testing.js.map +1 -1
  274. package/dist/plugin.d.ts +1 -1
  275. package/dist/plugin.d.ts.map +1 -1
  276. package/dist/plugin.js +1 -1
  277. package/dist/plugin.js.map +1 -1
  278. package/dist/records.d.ts +283 -0
  279. package/dist/records.d.ts.map +1 -0
  280. package/dist/records.js +543 -0
  281. package/dist/records.js.map +1 -0
  282. package/dist/router.d.ts +50 -3
  283. package/dist/router.d.ts.map +1 -1
  284. package/dist/router.js +78 -7
  285. package/dist/router.js.map +1 -1
  286. package/dist/routes.d.ts +12 -2
  287. package/dist/routes.d.ts.map +1 -1
  288. package/dist/routes.js +14 -1
  289. package/dist/routes.js.map +1 -1
  290. package/dist/rules.d.ts +30 -11
  291. package/dist/rules.d.ts.map +1 -1
  292. package/dist/rules.js +99 -42
  293. package/dist/rules.js.map +1 -1
  294. package/dist/runner/acp.d.ts +20 -0
  295. package/dist/runner/acp.d.ts.map +1 -0
  296. package/dist/runner/acp.js +1132 -0
  297. package/dist/runner/acp.js.map +1 -0
  298. package/dist/runner/claude.d.ts +13 -0
  299. package/dist/runner/claude.d.ts.map +1 -0
  300. package/dist/runner/claude.js +615 -0
  301. package/dist/runner/claude.js.map +1 -0
  302. package/dist/runner/codex.d.ts +19 -0
  303. package/dist/runner/codex.d.ts.map +1 -0
  304. package/dist/runner/codex.js +597 -0
  305. package/dist/runner/codex.js.map +1 -0
  306. package/dist/runner/config.d.ts +35 -0
  307. package/dist/runner/config.d.ts.map +1 -0
  308. package/dist/runner/config.js +74 -0
  309. package/dist/runner/config.js.map +1 -0
  310. package/dist/runner/desk.d.ts +81 -0
  311. package/dist/runner/desk.d.ts.map +1 -0
  312. package/dist/runner/desk.js +303 -0
  313. package/dist/runner/desk.js.map +1 -0
  314. package/dist/runner/launchd.d.ts +7 -0
  315. package/dist/runner/launchd.d.ts.map +1 -0
  316. package/dist/runner/launchd.js +78 -0
  317. package/dist/runner/launchd.js.map +1 -0
  318. package/dist/runner/message.d.ts +66 -0
  319. package/dist/runner/message.d.ts.map +1 -0
  320. package/dist/runner/message.js +181 -0
  321. package/dist/runner/message.js.map +1 -0
  322. package/dist/runner/modules.d.ts +13 -0
  323. package/dist/runner/modules.d.ts.map +1 -0
  324. package/dist/runner/modules.js +30 -0
  325. package/dist/runner/modules.js.map +1 -0
  326. package/dist/runner/process.d.ts +7 -0
  327. package/dist/runner/process.d.ts.map +1 -0
  328. package/dist/runner/process.js +65 -0
  329. package/dist/runner/process.js.map +1 -0
  330. package/dist/runner/redact.d.ts +48 -0
  331. package/dist/runner/redact.d.ts.map +1 -0
  332. package/dist/runner/redact.js +214 -0
  333. package/dist/runner/redact.js.map +1 -0
  334. package/dist/runner/registry.d.ts +37 -0
  335. package/dist/runner/registry.d.ts.map +1 -0
  336. package/dist/runner/registry.js +26 -0
  337. package/dist/runner/registry.js.map +1 -0
  338. package/dist/runner/runner.d.ts +130 -0
  339. package/dist/runner/runner.d.ts.map +1 -0
  340. package/dist/runner/runner.js +1551 -0
  341. package/dist/runner/runner.js.map +1 -0
  342. package/dist/runner/slack.d.ts +16 -0
  343. package/dist/runner/slack.d.ts.map +1 -0
  344. package/dist/runner/slack.js +157 -0
  345. package/dist/runner/slack.js.map +1 -0
  346. package/dist/runner/systemd-user.d.ts +7 -0
  347. package/dist/runner/systemd-user.d.ts.map +1 -0
  348. package/dist/runner/systemd-user.js +93 -0
  349. package/dist/runner/systemd-user.js.map +1 -0
  350. package/dist/runner/task-scheduler.d.ts +38 -0
  351. package/dist/runner/task-scheduler.d.ts.map +1 -0
  352. package/dist/runner/task-scheduler.js +216 -0
  353. package/dist/runner/task-scheduler.js.map +1 -0
  354. package/dist/runner/types.d.ts +315 -0
  355. package/dist/runner/types.d.ts.map +1 -0
  356. package/dist/runner/types.js +24 -0
  357. package/dist/runner/types.js.map +1 -0
  358. package/dist/runner.d.ts +18 -0
  359. package/dist/runner.d.ts.map +1 -0
  360. package/dist/runner.js +20 -0
  361. package/dist/runner.js.map +1 -0
  362. package/dist/schemas.d.ts +6082 -1295
  363. package/dist/schemas.d.ts.map +1 -1
  364. package/dist/schemas.js +930 -31
  365. package/dist/schemas.js.map +1 -1
  366. package/dist/services.d.ts +110 -0
  367. package/dist/services.d.ts.map +1 -0
  368. package/dist/services.js +305 -0
  369. package/dist/services.js.map +1 -0
  370. package/dist/setup-guide.d.ts +64 -0
  371. package/dist/setup-guide.d.ts.map +1 -0
  372. package/dist/setup-guide.js +256 -0
  373. package/dist/setup-guide.js.map +1 -0
  374. package/dist/setup-page.d.ts +6 -0
  375. package/dist/setup-page.d.ts.map +1 -0
  376. package/dist/setup-page.js +29 -0
  377. package/dist/setup-page.js.map +1 -0
  378. package/dist/sse.d.ts +15 -0
  379. package/dist/sse.d.ts.map +1 -0
  380. package/dist/sse.js +73 -0
  381. package/dist/sse.js.map +1 -0
  382. package/dist/tab-title.d.ts +6 -0
  383. package/dist/tab-title.d.ts.map +1 -0
  384. package/dist/tab-title.js +22 -0
  385. package/dist/tab-title.js.map +1 -0
  386. package/dist/tokens.d.ts.map +1 -1
  387. package/dist/tokens.js +3 -0
  388. package/dist/tokens.js.map +1 -1
  389. package/dist/use-action.d.ts +5 -2
  390. package/dist/use-action.d.ts.map +1 -1
  391. package/dist/use-action.js +6 -1
  392. package/dist/use-action.js.map +1 -1
  393. package/dist/vocabulary.d.ts +84 -4
  394. package/dist/vocabulary.d.ts.map +1 -1
  395. package/dist/vocabulary.js +115 -3
  396. package/dist/vocabulary.js.map +1 -1
  397. package/docs/specs/cli.md +147 -41
  398. package/docs/specs/plugins.md +37 -27
  399. package/docs/specs/records.md +113 -0
  400. package/docs/specs/rest.md +155 -20
  401. package/docs/specs/runner.md +347 -0
  402. package/package.json +12 -3
  403. package/skills/building-a-console/SKILL.md +4 -4
  404. package/skills/building-a-console/references/configuring.md +1 -0
  405. package/skills/building-a-plugin/SKILL.md +7 -7
  406. package/skills/deploying-a-console/SKILL.md +4 -4
  407. package/skills/deploying-a-console/references/resources.md +48 -8
  408. package/skills/deploying-a-console/references/running-it-again.md +3 -2
  409. package/skills/keeping-a-desk/SKILL.md +133 -0
  410. package/skills/keeping-a-desk/collections.md +96 -0
  411. package/skills/planning-the-board/SKILL.md +14 -18
  412. package/skills/planning-the-board/references/a-task.md +2 -2
  413. package/skills/planning-the-board/references/project-rules.md +13 -14
  414. package/skills/planning-the-board/references/setting-up.md +22 -9
  415. package/skills/running-an-agent/SKILL.md +107 -0
  416. package/skills/running-an-agent/references/slack-app.md +61 -0
  417. package/skills/working-the-board/SKILL.md +66 -39
  418. package/skills/working-the-board/references/terms.md +9 -5
  419. package/skills/working-the-board/references/the-pack.md +14 -9
  420. package/skills/working-the-board/references/the-sentence.md +2 -2
  421. package/src/agent-page.tsx +1039 -0
  422. package/src/agent-stream.ts +199 -0
  423. package/src/api.ts +317 -2
  424. package/src/avatar.ts +1506 -0
  425. package/src/charts.ts +250 -0
  426. package/src/cli/cli.ts +3210 -503
  427. package/src/cli/command-words.ts +56 -0
  428. package/src/cli/credentials.ts +188 -16
  429. package/src/cli/directory.ts +28 -10
  430. package/src/cli/format.ts +470 -67
  431. package/src/cli/help.ts +233 -61
  432. package/src/cli/main.ts +89 -0
  433. package/src/cli/pack.ts +332 -263
  434. package/src/cli/plugin-check.ts +275 -34
  435. package/src/cli/plugin-cli.ts +28 -4
  436. package/src/cli/plugin-main.ts +1 -0
  437. package/src/cli/runner-host.ts +188 -0
  438. package/src/cli/serve.ts +320 -5
  439. package/src/cli/setup-machine.ts +153 -0
  440. package/src/client.ts +711 -126
  441. package/src/compat.ts +2 -2
  442. package/src/components/agent-page.tsx +1946 -0
  443. package/src/components/agents.tsx +638 -0
  444. package/src/components/calendar.tsx +74 -53
  445. package/src/components/charts.tsx +680 -0
  446. package/src/components/comments.tsx +3 -0
  447. package/src/components/connect.tsx +37 -2
  448. package/src/components/decision-form.tsx +89 -51
  449. package/src/components/decision-list.tsx +140 -4
  450. package/src/components/desk-records.tsx +724 -0
  451. package/src/components/desk.tsx +471 -0
  452. package/src/components/event-feed.tsx +30 -1
  453. package/src/components/home.tsx +353 -12
  454. package/src/components/my-decisions.tsx +8 -2
  455. package/src/components/people.tsx +300 -203
  456. package/src/components/picker.tsx +3 -1
  457. package/src/components/pictures.tsx +256 -44
  458. package/src/components/plugin-events.ts +159 -0
  459. package/src/components/plugin-frame.tsx +14 -38
  460. package/src/components/plugin-settings.tsx +178 -22
  461. package/src/components/projects.tsx +33 -15
  462. package/src/components/rules.tsx +96 -36
  463. package/src/components/sessions.tsx +7 -4
  464. package/src/components/setup.tsx +252 -0
  465. package/src/components/sign-in.tsx +1 -1
  466. package/src/components/task-form.tsx +11 -2
  467. package/src/components/task-list.tsx +7 -6
  468. package/src/components/task-view.tsx +4 -0
  469. package/src/components/ui.tsx +169 -25
  470. package/src/components/work.tsx +9 -9
  471. package/src/components/workspace.tsx +345 -4
  472. package/src/connect-page.tsx +15 -2
  473. package/src/console.tsx +657 -83
  474. package/src/data.ts +109 -43
  475. package/src/desk-page.tsx +332 -0
  476. package/src/desk-records-page.tsx +256 -0
  477. package/src/desk-records.ts +808 -0
  478. package/src/desk.ts +329 -0
  479. package/src/feed-stream.ts +144 -0
  480. package/src/glances.ts +132 -0
  481. package/src/home-tiles.ts +411 -9
  482. package/src/i18n/en.ts +828 -10
  483. package/src/i18n/ko.ts +792 -10
  484. package/src/index.ts +172 -3
  485. package/src/limits.ts +67 -0
  486. package/src/onboarding.ts +84 -0
  487. package/src/persona.ts +100 -0
  488. package/src/plugin/context.ts +55 -12
  489. package/src/plugin/limits.ts +2 -0
  490. package/src/plugin/manifest.ts +42 -3
  491. package/src/plugin/rest-schemas.ts +46 -0
  492. package/src/plugin/sandbox.ts +4 -1
  493. package/src/plugin/testing.ts +63 -12
  494. package/src/plugin.ts +2 -0
  495. package/src/records.ts +702 -0
  496. package/src/router.ts +120 -10
  497. package/src/routes.ts +17 -1
  498. package/src/rules.ts +109 -44
  499. package/src/runner/acp.ts +1267 -0
  500. package/src/runner/claude.ts +695 -0
  501. package/src/runner/codex.ts +691 -0
  502. package/src/runner/config.ts +97 -0
  503. package/src/runner/desk.ts +377 -0
  504. package/src/runner/launchd.ts +86 -0
  505. package/src/runner/message.ts +232 -0
  506. package/src/runner/modules.ts +30 -0
  507. package/src/runner/process.ts +72 -0
  508. package/src/runner/redact.ts +242 -0
  509. package/src/runner/registry.ts +67 -0
  510. package/src/runner/runner.ts +1879 -0
  511. package/src/runner/slack.ts +180 -0
  512. package/src/runner/systemd-user.ts +103 -0
  513. package/src/runner/task-scheduler.ts +236 -0
  514. package/src/runner/types.ts +334 -0
  515. package/src/runner.ts +110 -0
  516. package/src/schemas.ts +1183 -30
  517. package/src/services.ts +424 -0
  518. package/src/setup-guide.ts +336 -0
  519. package/src/setup-page.tsx +46 -0
  520. package/src/sse.ts +84 -0
  521. package/src/styles/README.md +111 -0
  522. package/src/styles/base.css +130 -0
  523. package/src/styles/console.css +85 -7095
  524. package/src/styles/drawn-by-pages.json +256 -0
  525. package/src/styles/pages/agents.css +1195 -0
  526. package/src/styles/pages/board.css +380 -0
  527. package/src/styles/pages/calendar.css +214 -0
  528. package/src/styles/pages/connect.css +182 -0
  529. package/src/styles/pages/decisions.css +370 -0
  530. package/src/styles/pages/desk.css +126 -0
  531. package/src/styles/pages/documents.css +273 -0
  532. package/src/styles/pages/feed.css +118 -0
  533. package/src/styles/pages/home.css +718 -0
  534. package/src/styles/pages/people.css +90 -0
  535. package/src/styles/pages/plugins.css +212 -0
  536. package/src/styles/pages/roadmap.css +377 -0
  537. package/src/styles/pages/settings.css +171 -0
  538. package/src/styles/pages/shell.css +208 -0
  539. package/src/styles/pages/sign-in.css +178 -0
  540. package/src/styles/pages/task.css +108 -0
  541. package/src/styles/pages/thread.css +331 -0
  542. package/src/styles/pages/work.css +68 -0
  543. package/src/styles/parts/avatar.css +82 -0
  544. package/src/styles/parts/badge.css +227 -0
  545. package/src/styles/parts/bars.css +80 -0
  546. package/src/styles/parts/button.css +99 -0
  547. package/src/styles/parts/calendar.css +547 -0
  548. package/src/styles/parts/callout.css +41 -0
  549. package/src/styles/parts/category.css +8 -0
  550. package/src/styles/parts/chart.css +173 -0
  551. package/src/styles/parts/chip.css +90 -0
  552. package/src/styles/parts/code.css +48 -0
  553. package/src/styles/parts/count.css +27 -0
  554. package/src/styles/parts/crumbs.css +61 -0
  555. package/src/styles/parts/detail.css +110 -0
  556. package/src/styles/parts/empty.css +21 -0
  557. package/src/styles/parts/eyebrow.css +9 -0
  558. package/src/styles/parts/facts.css +147 -0
  559. package/src/styles/parts/figures.css +65 -0
  560. package/src/styles/parts/files.css +38 -0
  561. package/src/styles/parts/filters.css +42 -0
  562. package/src/styles/parts/form.css +109 -0
  563. package/src/styles/parts/frame.css +45 -0
  564. package/src/styles/parts/input.css +243 -0
  565. package/src/styles/parts/legend.css +48 -0
  566. package/src/styles/parts/links.css +37 -0
  567. package/src/styles/parts/mark.css +79 -0
  568. package/src/styles/parts/menu.css +147 -0
  569. package/src/styles/parts/page.css +174 -0
  570. package/src/styles/parts/pager.css +19 -0
  571. package/src/styles/parts/panel.css +33 -0
  572. package/src/styles/parts/person.css +257 -0
  573. package/src/styles/parts/picker.css +185 -0
  574. package/src/styles/parts/progress.css +25 -0
  575. package/src/styles/parts/prose.css +128 -0
  576. package/src/styles/parts/rows.css +63 -0
  577. package/src/styles/parts/series.css +32 -0
  578. package/src/styles/parts/settings.css +101 -0
  579. package/src/styles/parts/share.css +25 -0
  580. package/src/styles/parts/spark.css +23 -0
  581. package/src/styles/parts/spinner.css +29 -0
  582. package/src/styles/parts/stat.css +69 -0
  583. package/src/styles/parts/steps.css +68 -0
  584. package/src/styles/parts/tabs.css +175 -0
  585. package/src/styles/parts/text.css +61 -0
  586. package/src/styles/parts/toggle.css +71 -0
  587. package/src/styles/parts/workers.css +37 -0
  588. package/src/styles/tokens.css +295 -0
  589. package/src/tab-title.ts +25 -0
  590. package/src/tokens.ts +3 -0
  591. package/src/use-action.ts +7 -2
  592. package/src/vocabulary.ts +151 -3
  593. package/template/desk-web/README.md +8 -0
  594. package/template/desk-web/index.html +13 -0
  595. package/template/desk-web/package.json +25 -0
  596. package/template/desk-web/src/main.tsx +24 -0
  597. package/template/desk-web/src/page.tsx +51 -0
  598. package/template/desk-web/tsconfig.json +16 -0
  599. package/template/desk-web/vite.config.ts +15 -0
package/src/console.tsx CHANGED
@@ -5,9 +5,11 @@ import {
5
5
  useCallback,
6
6
  useEffect,
7
7
  useMemo,
8
+ useRef,
8
9
  useState,
9
10
  } from "react";
10
11
  import { createRoot, type Root } from "react-dom/client";
12
+ import { AgentPage, AgentsNeedingYou } from "./agent-page.js";
11
13
  import {
12
14
  ApiError,
13
15
  type ConsoleClient,
@@ -15,7 +17,8 @@ import {
15
17
  type FileUpload,
16
18
  OPEN_TASK_STATES,
17
19
  PROJECT_RULES_TEMPLATE,
18
- REFERENCE_RULES,
20
+ type RestAgent,
21
+ type RestAgentProposal,
19
22
  type RestAnswerInput,
20
23
  type RestComment,
21
24
  type RestDecision,
@@ -36,21 +39,35 @@ import {
36
39
  type RestTaskInput,
37
40
  type RestToken,
38
41
  type RestTokenCreated,
39
- type RestWork,
42
+ type RestWorkBrief,
40
43
  RULES_PATH,
41
44
  RULES_TITLE,
42
45
  type TaskState,
43
46
  type WeekStart,
44
47
  } from "./api.js";
48
+ import { AVATAR_SETS, type AvatarSet } from "./avatar.js";
49
+ import {
50
+ AgentAccountForm,
51
+ type AgentAccountFormProps,
52
+ AgentAccountList,
53
+ type AgentAccountListProps,
54
+ agentAccountGroups,
55
+ } from "./components/agents.js";
45
56
  import { Board, BoardFilters, type BoardProps, byDue, filterTasks } from "./components/board.js";
46
57
  import { Calendar, type CalendarProps, Workload } from "./components/calendar.js";
47
58
  import { CategoryList, type CategoryListProps } from "./components/categories.js";
48
59
  import { ConnectWords } from "./components/connect.js";
49
60
  import { DecisionForm } from "./components/decision-form.js";
50
- import { DecisionCard, DecisionList, type DecisionListProps } from "./components/decision-list.js";
61
+ import {
62
+ type DecisionAddressing,
63
+ DecisionCard,
64
+ DecisionList,
65
+ type DecisionListProps,
66
+ } from "./components/decision-list.js";
67
+ import { DeskWords } from "./components/desk.js";
51
68
  import { EventFeed, type EventFeedProps } from "./components/event-feed.js";
52
69
  import { GoalForm, GoalList, type GoalListProps, GoalView, goalMonth } from "./components/goals.js";
53
- import { HomeGrid, type HomeGridProps } from "./components/home.js";
70
+ import { HomeGrid, type HomeGridProps, type ProjectGlance } from "./components/home.js";
54
71
  import { MyDecisions, ReachedDecision } from "./components/my-decisions.js";
55
72
  import { PackTokenWays } from "./components/pack-token.js";
56
73
  import { PAGE_SIZE } from "./components/paged.js";
@@ -58,6 +75,7 @@ import {
58
75
  ListingForm,
59
76
  PeopleList,
60
77
  type PeopleListProps,
78
+ supervisedBy,
61
79
  TeamForm,
62
80
  TeamList,
63
81
  type TeamListProps,
@@ -88,6 +106,8 @@ import { TaskList } from "./components/task-list.js";
88
106
  import { TaskView, type TaskViewProps } from "./components/task-view.js";
89
107
  import { NewToken, TokenForm, TokenList, type TokenListProps } from "./components/tokens.js";
90
108
  import {
109
+ AvatarSetsContext,
110
+ Badge,
91
111
  Button,
92
112
  Callout,
93
113
  CategoryBadge,
@@ -102,6 +122,8 @@ import {
102
122
  import { WorkList, type WorkListProps } from "./components/work.js";
103
123
  import {
104
124
  peopleVisibilityOf,
125
+ WorkspaceServicesForm,
126
+ WorkspaceServicesView,
105
127
  WorkspaceSettingsForm,
106
128
  WorkspaceSettingsView,
107
129
  weekStartOf,
@@ -110,6 +132,7 @@ import { ConnectPage } from "./connect-page.js";
110
132
  import { type ConsoleData, useConsoleData } from "./data.js";
111
133
  import { monthOf, today } from "./dates.js";
112
134
  import { DocsPage } from "./docs-page.js";
135
+ import { createGlanceReader, type GlanceReader } from "./glances.js";
113
136
  import {
114
137
  browserPack,
115
138
  chooseLanguage,
@@ -119,8 +142,13 @@ import {
119
142
  type Messages,
120
143
  useWords,
121
144
  } from "./i18n/index.js";
145
+ import { type PersonaName, proposeAgents } from "./persona.js";
122
146
  import { pluginNavItems, pluginPagesAt, pluginWordOf } from "./plugin-nav.js";
123
147
  import {
148
+ type AgentsView,
149
+ agentHref,
150
+ agentsHref,
151
+ agentWorkHref,
124
152
  boardHref,
125
153
  calendarHref,
126
154
  customPageHref,
@@ -151,6 +179,8 @@ import {
151
179
  workHref,
152
180
  } from "./router.js";
153
181
  import { projectPath } from "./routes.js";
182
+ import { SetupPage } from "./setup-page.js";
183
+ import { currentTab, tabTitle } from "./tab-title.js";
154
184
  import { errorWords, useAction } from "./use-action.js";
155
185
 
156
186
  // The composition of the default console: the pages assembled from the components, with the
@@ -168,6 +198,8 @@ export interface ConsoleComponents {
168
198
  readonly EventFeed: ComponentType<EventFeedProps>;
169
199
  readonly SignIn: ComponentType<SignInProps>;
170
200
  readonly TokenList: ComponentType<TokenListProps>;
201
+ readonly AgentAccountList: ComponentType<AgentAccountListProps>;
202
+ readonly AgentAccountForm: ComponentType<AgentAccountFormProps>;
171
203
  readonly SessionList: ComponentType<SessionListProps>;
172
204
  readonly PeopleList: ComponentType<PeopleListProps>;
173
205
  readonly TeamList: ComponentType<TeamListProps>;
@@ -188,6 +220,8 @@ export const DEFAULT_COMPONENTS: ConsoleComponents = {
188
220
  EventFeed,
189
221
  SignIn,
190
222
  TokenList,
223
+ AgentAccountList,
224
+ AgentAccountForm,
191
225
  SessionList,
192
226
  PeopleList,
193
227
  TeamList,
@@ -226,6 +260,11 @@ export interface CustomPageContext {
226
260
  /** The client, for what the data does not carry. */
227
261
  readonly client: ConsoleClient;
228
262
  readonly navigation: Navigation;
263
+ /**
264
+ * The query of the address the page is at, as the browser has it (`?view=figures`), or `""`:
265
+ * how a page of one's own is shown is said by its address, as every page's is (ADR-0010).
266
+ */
267
+ readonly search: string;
229
268
  /** The words of the language the pages speak, and its tag. */
230
269
  readonly words: Messages;
231
270
  readonly language: string;
@@ -261,6 +300,18 @@ export interface ConsoleConfig {
261
300
  readonly client?: ConsoleClient | undefined;
262
301
  /** Pages of the console's own, as tabs beside the default ones. */
263
302
  readonly pages?: readonly CustomPage[] | undefined;
303
+ /**
304
+ * What an agent account's persona is proposed and drawn from (ADR-0084), in place of the
305
+ * package's: the names a new account is proposed, in each language, and the sets of shapes the
306
+ * avatars are drawn from on this console's pages. A set keeps its version for good; a console
307
+ * that brings shapes of its own gives them versions the package does not use.
308
+ */
309
+ readonly persona?:
310
+ | {
311
+ readonly names?: readonly PersonaName[] | undefined;
312
+ readonly avatarSets?: readonly AvatarSet[] | undefined;
313
+ }
314
+ | undefined;
264
315
  }
265
316
 
266
317
  export interface ConsoleApp {
@@ -394,11 +445,13 @@ function Ground(props: { readonly children: React.ReactNode }) {
394
445
  }
395
446
 
396
447
  /**
397
- * Whether the console holds a token rather than a session: a person's own console, served from
398
- * their machine with the token the command keeps (ADR-0014). The API says so with `me.agent`.
448
+ * Whether the console holds a token rather than a browser's session: a person's own console,
449
+ * served from their machine with what the command keeps (ADR-0014), a token or the command's own
450
+ * session (ADR-0084), which is held to what a token may ask. The API says so with `me.agent`,
451
+ * and with `me.session`.
399
452
  */
400
453
  function holdsToken(data: ConsoleData): boolean {
401
- return data.me !== undefined && data.me.agent !== null;
454
+ return data.me !== undefined && (data.me.agent !== null || data.me.session?.kind === "command");
402
455
  }
403
456
 
404
457
  /**
@@ -424,7 +477,6 @@ export function languageToKeep(
424
477
  */
425
478
  export function onlyOnOwnPages(route: Route): boolean {
426
479
  return (
427
- route.name === "agents" ||
428
480
  route.name === "sessions" ||
429
481
  route.name === "new-token" ||
430
482
  route.name === "person-agents" ||
@@ -437,6 +489,46 @@ function NotWithToken() {
437
489
  return <EmptyState title={words.title} body={words.body} />;
438
490
  }
439
491
 
492
+ /**
493
+ * The boards of the projects the front page shows at a glance (ADR-0105), each in one request
494
+ * (ADR-0107): read when its tile is first shown at such a size, each time the front page is
495
+ * shown, and again when the person comes back to the window, so that what a tile says is what
496
+ * holds now. A read that fails is tried again; one the console refuses leaves the tile with the
497
+ * project's own figure.
498
+ */
499
+ function useGlances(client: ConsoleClient): {
500
+ readonly read: Readonly<Record<string, ProjectGlance>>;
501
+ readonly want: (projects: readonly RestProject[]) => void;
502
+ /** Reads every glance shown again. */
503
+ readonly renew: () => void;
504
+ } {
505
+ const [read, setRead] = useState<Readonly<Record<string, ProjectGlance>>>({});
506
+ const wanted = useRef<readonly RestProject[]>([]);
507
+ const reader = useRef<GlanceReader<RestProject> | undefined>(undefined);
508
+ useEffect(() => {
509
+ const made = createGlanceReader<RestProject, ProjectGlance>({
510
+ read: (project) => client.project(project.key).glance(),
511
+ store: (id, glance) => setRead((before) => ({ ...before, [id]: glance })),
512
+ // What the console refused it refuses again: a project that is not the person's to read.
513
+ again: (failure) =>
514
+ !(failure instanceof ApiError) || failure.status === 0 || failure.status >= 500,
515
+ });
516
+ reader.current = made;
517
+ // The grid said what it shows before this ran: a child's effect comes first.
518
+ made.want(wanted.current);
519
+ return () => {
520
+ made.stop();
521
+ reader.current = undefined;
522
+ };
523
+ }, [client]);
524
+ const want = useCallback((list: readonly RestProject[]) => {
525
+ wanted.current = list;
526
+ reader.current?.want(list);
527
+ }, []);
528
+ const renew = useCallback(() => reader.current?.renew(), []);
529
+ return { read, want, renew };
530
+ }
531
+
440
532
  function ProjectsPage(props: {
441
533
  readonly data: ConsoleData;
442
534
  readonly components: ConsoleComponents;
@@ -454,6 +546,26 @@ function ProjectsPage(props: {
454
546
  const [arranging, setArranging] = useState(false);
455
547
  const { busy, error, act } = useAction();
456
548
  const href = (project: RestProject) => projectHref(project.key);
549
+ const glances = useGlances(client);
550
+ // What waits in each project is read with the projects, once when the console opens. Each
551
+ // time the front page is shown after that, and when the person comes back to its window,
552
+ // the projects are read again, and the glances with them.
553
+ const { refreshProjects } = data.actions;
554
+ const loaded = useRef(data.loaded);
555
+ const { renew } = glances;
556
+ useEffect(() => {
557
+ if (loaded.current) {
558
+ refreshProjects().catch(() => undefined);
559
+ }
560
+ const back = () => {
561
+ if (document.visibilityState === "visible") {
562
+ refreshProjects().catch(() => undefined);
563
+ renew();
564
+ }
565
+ };
566
+ document.addEventListener("visibilitychange", back);
567
+ return () => document.removeEventListener("visibilitychange", back);
568
+ }, [refreshProjects, renew]);
457
569
  // A project is made by an administrator (ADR-0045): a member sees the list alone, the form's
458
570
  // address included.
459
571
  const administrator = data.me?.person?.role === "admin";
@@ -506,6 +618,8 @@ function ProjectsPage(props: {
506
618
  onDone={() => setArranging(false)}
507
619
  projectHref={href}
508
620
  onOpen={(project) => navigation.go(href(project))}
621
+ glances={glances.read}
622
+ onGlance={glances.want}
509
623
  nameOf={(name) => pluginWordOf(name, language)}
510
624
  renderWidget={(tile, size) =>
511
625
  me === undefined ? null : (
@@ -781,7 +895,7 @@ function TaskPage(props: {
781
895
  readonly navigation: Navigation;
782
896
  readonly busy: boolean;
783
897
  readonly error: string | undefined;
784
- readonly act: (work: () => Promise<unknown>) => Promise<void>;
898
+ readonly act: (work: () => Promise<unknown>) => Promise<unknown>;
785
899
  }) {
786
900
  const words = useWords();
787
901
  const { route, project, data, components, navigation, busy, error, act } = props;
@@ -936,6 +1050,17 @@ function TaskPage(props: {
936
1050
  onUpdateDecision={(decision, patch) =>
937
1051
  void act(() => data.actions.updateDecision(decision.id, patch))
938
1052
  }
1053
+ addressing={{
1054
+ people: data.members.map((member) => member.person),
1055
+ me: data.me?.person ?? undefined,
1056
+ onAddress: (decision, deciders) =>
1057
+ void act(() =>
1058
+ data.actions.addressDecision(
1059
+ decision.id,
1060
+ deciders.map((person) => person.id),
1061
+ ),
1062
+ ),
1063
+ }}
939
1064
  onAbandonRun={(run) => void act(() => data.actions.abandonRun(run.id))}
940
1065
  onArchive={(target) =>
941
1066
  void act(async () => {
@@ -972,7 +1097,7 @@ function ProjectPage(props: {
972
1097
  const { busy, error, act } = useAction();
973
1098
  const tasksById = useMemo(() => new Map(data.tasks.map((task) => [task.id, task])), [data.tasks]);
974
1099
  const key = project.key;
975
- const href = (task: RestTask) => taskHref(key, task.number);
1100
+ const href = (task: { readonly number: number }) => taskHref(key, task.number);
976
1101
  const toDoc = (path: string) => docHref(key, path);
977
1102
  const owner = project.role === "owner";
978
1103
 
@@ -982,6 +1107,19 @@ function ProjectPage(props: {
982
1107
  void act(() => data.actions.answerDecision(decision.id, input));
983
1108
  const onUpdate = (decision: RestDecision, patch: RestDecisionPatch) =>
984
1109
  void act(() => data.actions.updateDecision(decision.id, patch));
1110
+ // Whom a waiting decision is for, said anew (ADR-0096), by anyone who may work here: the
1111
+ // people to name are the project's members, as where a decision is raised.
1112
+ const addressing: DecisionAddressing = {
1113
+ people: data.members.map((member) => member.person),
1114
+ me: data.me?.person ?? undefined,
1115
+ onAddress: (decision, deciders) =>
1116
+ void act(() =>
1117
+ data.actions.addressDecision(
1118
+ decision.id,
1119
+ deciders.map((person) => person.id),
1120
+ ),
1121
+ ),
1122
+ };
985
1123
 
986
1124
  if (route.name === "board") {
987
1125
  const me = data.me?.person ?? undefined;
@@ -1371,6 +1509,7 @@ function ProjectPage(props: {
1371
1509
  pageHref={(page) => decisionsHref(key, page)}
1372
1510
  onAnswer={onAnswer}
1373
1511
  onUpdate={onUpdate}
1512
+ addressing={addressing}
1374
1513
  busy={busy}
1375
1514
  empty={
1376
1515
  <EmptyState title={words.decisions.empty.title} body={words.decisions.empty.body} />
@@ -1424,6 +1563,7 @@ function ProjectPage(props: {
1424
1563
  fileHref={(fileId) => projectPath(key, "files", fileId)}
1425
1564
  onAnswer={onAnswer}
1426
1565
  onUpdate={onUpdate}
1566
+ addressing={addressing}
1427
1567
  busy={busy}
1428
1568
  />
1429
1569
  )}
@@ -1908,7 +2048,7 @@ function SessionsPage(props: {
1908
2048
  * from, which whoever runs the console set. Read by everyone; the rules written by an administrator.
1909
2049
  */
1910
2050
  function WorkspaceSettingsPage(props: {
1911
- readonly form: "rules" | "workspace" | "pack-token" | undefined;
2051
+ readonly form: "rules" | "workspace" | "services" | "pack-token" | undefined;
1912
2052
  readonly data: ConsoleData;
1913
2053
  readonly navigation: Navigation;
1914
2054
  readonly language: string;
@@ -1953,7 +2093,7 @@ function WorkspaceSettingsPage(props: {
1953
2093
  <RulesForm
1954
2094
  rules={rules}
1955
2095
  scope="workspace"
1956
- template={REFERENCE_RULES}
2096
+ template=""
1957
2097
  busy={busy}
1958
2098
  onSubmit={(input) =>
1959
2099
  void act(async () => {
@@ -1969,12 +2109,6 @@ function WorkspaceSettingsPage(props: {
1969
2109
  })
1970
2110
  }
1971
2111
  onCancel={() => navigation.back(PATHS.settings)}
1972
- onReset={() =>
1973
- void act(async () => {
1974
- setRules(await data.actions.archiveRules());
1975
- navigation.replace(PATHS.settings);
1976
- })
1977
- }
1978
2112
  />
1979
2113
  )}
1980
2114
  </section>
@@ -2021,6 +2155,31 @@ function WorkspaceSettingsPage(props: {
2021
2155
  </>
2022
2156
  );
2023
2157
  }
2158
+ if (form === "services") {
2159
+ if (!administrator || workspace === undefined) {
2160
+ return <NothingHere />;
2161
+ }
2162
+ return (
2163
+ <>
2164
+ {head}
2165
+ {error !== undefined && <Callout tone="danger">{error}</Callout>}
2166
+ <section className="sc-panel sc-panel-form" aria-label={words.settings.services.aria}>
2167
+ <h2 className="sc-section-title">{words.settings.services.title}</h2>
2168
+ <WorkspaceServicesForm
2169
+ workspace={workspace}
2170
+ busy={busy}
2171
+ onSubmit={(patch) =>
2172
+ void act(async () => {
2173
+ await data.actions.updateWorkspace(patch);
2174
+ navigation.replace(PATHS.settings);
2175
+ })
2176
+ }
2177
+ onCancel={() => navigation.back(PATHS.settings)}
2178
+ />
2179
+ </section>
2180
+ </>
2181
+ );
2182
+ }
2024
2183
  if (form === "workspace") {
2025
2184
  if (!administrator || workspace === undefined) {
2026
2185
  return <NothingHere />;
@@ -2067,6 +2226,23 @@ function WorkspaceSettingsPage(props: {
2067
2226
  <WorkspaceSettingsView workspace={workspace} console={data.me?.console} />
2068
2227
  </section>
2069
2228
  )}
2229
+ {workspace !== undefined && (
2230
+ <section className="sc-panel" aria-label={words.settings.services.aria}>
2231
+ <div className="sc-section-head">
2232
+ <h2 className="sc-section-title">{words.settings.services.title}</h2>
2233
+ {administrator && (
2234
+ <a
2235
+ className="sc-button sc-button-secondary sc-button-sm"
2236
+ href={settingsHref("services")}
2237
+ >
2238
+ {words.common.edit}
2239
+ </a>
2240
+ )}
2241
+ </div>
2242
+ <p className="sc-settings-hint">{words.settings.services.intro}</p>
2243
+ <WorkspaceServicesView workspace={workspace} />
2244
+ </section>
2245
+ )}
2070
2246
  <section className="sc-panel" aria-label={words.rules.title}>
2071
2247
  <h2 className="sc-section-title">{words.rules.title}</h2>
2072
2248
  {rules === undefined ? (
@@ -2267,9 +2443,9 @@ function PersonAgentsPage(props: {
2267
2443
 
2268
2444
  /** What a plate's page shows: the tasks, open and lately closed, and the decisions waiting on the person's own. */
2269
2445
  interface Plate {
2270
- readonly tasks: RestWork["tasks"];
2271
- readonly closed?: RestWork["closed"] | undefined;
2272
- readonly decisions?: RestWork["decisions"] | undefined;
2446
+ readonly tasks: RestWorkBrief["tasks"];
2447
+ readonly closed?: RestWorkBrief["closed"] | undefined;
2448
+ readonly decisions?: RestWorkBrief["decisions"] | undefined;
2273
2449
  }
2274
2450
 
2275
2451
  /**
@@ -2287,13 +2463,43 @@ function rememberedAs<T>(key: string): T | undefined {
2287
2463
  return shownBefore.get(key) as T | undefined;
2288
2464
  }
2289
2465
 
2466
+ /** How long an answer asked for early stands for the page's own; past it, the page reads anew. */
2467
+ const EARLY_FRESH_MS = 30_000;
2468
+ /**
2469
+ * What the page the console opened on asked for along with who is signed in, by the name the
2470
+ * page takes it under: its own data a round trip sooner than once the person and the workspace
2471
+ * are known. Taken once, by the page it was asked for.
2472
+ */
2473
+ const askedEarly = new Map<string, { readonly answer: Promise<unknown>; readonly at: number }>();
2474
+ function askEarly(name: string, ask: () => Promise<unknown>): void {
2475
+ if (!askedEarly.has(name)) {
2476
+ const answer = ask();
2477
+ answer.catch(() => undefined);
2478
+ askedEarly.set(name, { answer, at: Date.now() });
2479
+ }
2480
+ }
2481
+ /** The answer asked for early under the name, once, while it is fresh; nothing otherwise. */
2482
+ function takeEarly<T>(name: string): Promise<T> | undefined {
2483
+ const asked = askedEarly.get(name);
2484
+ askedEarly.delete(name);
2485
+ return asked !== undefined && Date.now() - asked.at <= EARLY_FRESH_MS
2486
+ ? (asked.answer as Promise<T>)
2487
+ : undefined;
2488
+ }
2489
+
2290
2490
  function PlatePage(props: {
2291
2491
  readonly components: ConsoleComponents;
2292
2492
  /** Reads the plate; stable across renders, since the page reads again whenever it changes. */
2293
2493
  readonly load: (signal: AbortSignal) => Promise<Plate>;
2294
2494
  /** What the plate is remembered by, with whose it is: come back to, the page shows it at once and reads again. */
2295
2495
  readonly remember: string;
2496
+ /** The name the plate was asked for under as the console opened (`askEarly`), where it was; taken once. */
2497
+ readonly early?: string | undefined;
2296
2498
  readonly title: string;
2499
+ /** Where the plate is a view of a page with a head of its own, an agent account's: no second head. */
2500
+ readonly headless?: boolean | undefined;
2501
+ /** A line under the title: what the member whose plate it is does (ADR-0084), where a title says. */
2502
+ readonly lead?: string | undefined;
2297
2503
  /** What stands beside the title: the way back, on another person's plate. */
2298
2504
  readonly aside?: ReactNode;
2299
2505
  /** A day of the week shown at the top, from the address; today's week when it names none. */
@@ -2308,7 +2514,7 @@ function PlatePage(props: {
2308
2514
  readonly weekStart?: WeekStart | undefined;
2309
2515
  }) {
2310
2516
  const words = useWords();
2311
- const { components, load, couldNotLoad, refused, remember } = props;
2517
+ const { components, load, couldNotLoad, refused, remember, early } = props;
2312
2518
  const [plate, setPlate] = useState<Plate | undefined>(() => rememberedAs<Plate>(remember));
2313
2519
  const [problem, setProblem] = useState<string | undefined>(undefined);
2314
2520
  const [forbidden, setForbidden] = useState(false);
@@ -2317,7 +2523,9 @@ function PlatePage(props: {
2317
2523
  setPlate(rememberedAs<Plate>(remember));
2318
2524
  setProblem(undefined);
2319
2525
  setForbidden(false);
2320
- load(controller.signal)
2526
+ // What was asked for as the console opened is taken; else the plate is read now.
2527
+ const asked = early === undefined ? undefined : takeEarly<Plate>(early);
2528
+ (asked === undefined ? load(controller.signal) : asked.catch(() => load(controller.signal)))
2321
2529
  .then((answer) => {
2322
2530
  if (!controller.signal.aborted) {
2323
2531
  shownBefore.set(remember, answer);
@@ -2339,13 +2547,16 @@ function PlatePage(props: {
2339
2547
  }
2340
2548
  });
2341
2549
  return () => controller.abort();
2342
- }, [load, couldNotLoad, refused, remember]);
2550
+ }, [load, couldNotLoad, refused, remember, early]);
2343
2551
  return (
2344
2552
  <>
2345
- <div className="sc-page-head">
2346
- <h1 className="sc-page-title">{props.title}</h1>
2347
- {props.aside}
2348
- </div>
2553
+ {props.headless !== true && (
2554
+ <div className="sc-page-head">
2555
+ <h1 className="sc-page-title">{props.title}</h1>
2556
+ {props.lead !== undefined && <p className="sc-page-lead">{props.lead}</p>}
2557
+ {props.aside}
2558
+ </div>
2559
+ )}
2349
2560
  {problem !== undefined && <Callout tone="danger">{problem}</Callout>}
2350
2561
  {forbidden && refused !== undefined ? (
2351
2562
  <EmptyState
@@ -2386,7 +2597,7 @@ function PlatePage(props: {
2386
2597
  function MyDecisionPage(props: { readonly id: string; readonly data: ConsoleData }) {
2387
2598
  const words = useWords();
2388
2599
  const { id, data } = props;
2389
- const { reachDecision, answerReachedDecision } = data.actions;
2600
+ const { reachDecision, answerReachedDecision, addressDecisionIn, membersOf } = data.actions;
2390
2601
  const [reached, setReached] = useState<RestReachedDecision | undefined>(undefined);
2391
2602
  const [problem, setProblem] = useState<string | undefined>(undefined);
2392
2603
  const { busy, error, act } = useAction();
@@ -2434,6 +2645,21 @@ function MyDecisionPage(props: { readonly id: string; readonly data: ConsoleData
2434
2645
  );
2435
2646
  })
2436
2647
  }
2648
+ addressing={{
2649
+ people: () => membersOf(reached.project.key),
2650
+ me: data.me?.person ?? undefined,
2651
+ onAddress: (_decision, deciders) =>
2652
+ void act(async () => {
2653
+ const addressed = await addressDecisionIn(
2654
+ reached.project.key,
2655
+ id,
2656
+ deciders.map((person) => person.id),
2657
+ );
2658
+ setReached((current) =>
2659
+ current === undefined ? current : { ...current, decision: addressed },
2660
+ );
2661
+ }),
2662
+ }}
2437
2663
  busy={busy}
2438
2664
  />
2439
2665
  )}
@@ -2482,7 +2708,13 @@ function useMyDecisions(
2482
2708
  async (offset: number, signal?: AbortSignal) => {
2483
2709
  setBusy(true);
2484
2710
  try {
2485
- const page = await myDecisions({ raised, limit: MY_DECISIONS_PAGE, offset }, signal);
2711
+ const ask = () => myDecisions({ raised, limit: MY_DECISIONS_PAGE, offset }, signal);
2712
+ // The first page may have been asked for as the console opened: taken, else read now.
2713
+ const asked =
2714
+ offset === 0
2715
+ ? takeEarly<RestMyDecisions>(`decisions:${raised ? "raised" : "addressed"}`)
2716
+ : undefined;
2717
+ const page = asked === undefined ? await ask() : await asked.catch(ask);
2486
2718
  if (signal?.aborted === true) {
2487
2719
  return;
2488
2720
  }
@@ -2523,7 +2755,7 @@ function useMyDecisions(
2523
2755
  */
2524
2756
  function MyDecisionsPage(props: { readonly data: ConsoleData }) {
2525
2757
  const words = useWords();
2526
- const { myDecisions, answerReachedDecision } = props.data.actions;
2758
+ const { myDecisions, answerReachedDecision, addressDecisionIn, membersOf } = props.data.actions;
2527
2759
  const whose = props.data.me?.person?.id ?? "";
2528
2760
  const addressed = useMyDecisions(
2529
2761
  myDecisions,
@@ -2572,6 +2804,20 @@ function MyDecisionsPage(props: { readonly data: ConsoleData }) {
2572
2804
  : myDecisionHref(decisionId)
2573
2805
  }
2574
2806
  onAnswer={onAnswer}
2807
+ addressing={(projectKey) => ({
2808
+ people: () => membersOf(projectKey),
2809
+ me: props.data.me?.person ?? undefined,
2810
+ onAddress: (decision, deciders) =>
2811
+ void act(async () => {
2812
+ await addressDecisionIn(
2813
+ projectKey,
2814
+ decision.id,
2815
+ deciders.map((person) => person.id),
2816
+ );
2817
+ addressed.reload();
2818
+ raised.reload();
2819
+ }),
2820
+ })}
2575
2821
  busy={busy || addressed.busy || raised.busy}
2576
2822
  />
2577
2823
  )}
@@ -2585,20 +2831,24 @@ function WorkPage(props: {
2585
2831
  readonly week: string | undefined;
2586
2832
  }) {
2587
2833
  const words = useWords();
2588
- const { work } = props.data.actions;
2834
+ const { plate } = props.data.actions;
2589
2835
  return (
2590
- <PlatePage
2591
- components={props.components}
2592
- load={work}
2593
- remember={`work:${props.data.me?.person?.id ?? ""}`}
2594
- title={words.work.title}
2595
- week={props.week}
2596
- weekStart={weekStartOf(props.data.me?.workspace)}
2597
- weekHref={workHref}
2598
- loading={words.work.loading}
2599
- couldNotLoad={words.work.couldNotLoad}
2600
- empty={words.work.empty}
2601
- />
2836
+ <>
2837
+ <AgentsNeedingYou agents={props.data.agents} me={props.data.me?.person?.id} />
2838
+ <PlatePage
2839
+ components={props.components}
2840
+ load={plate}
2841
+ remember={`work:${props.data.me?.person?.id ?? ""}`}
2842
+ early="work"
2843
+ title={words.work.title}
2844
+ week={props.week}
2845
+ weekStart={weekStartOf(props.data.me?.workspace)}
2846
+ weekHref={workHref}
2847
+ loading={words.work.loading}
2848
+ couldNotLoad={words.work.couldNotLoad}
2849
+ empty={words.work.empty}
2850
+ />
2851
+ </>
2602
2852
  );
2603
2853
  }
2604
2854
 
@@ -2613,14 +2863,15 @@ function PersonWorkPage(props: {
2613
2863
  const { id, data } = props;
2614
2864
  const person = data.people.find((candidate) => candidate.id === id);
2615
2865
  const name = person === undefined ? "?" : personName(person);
2616
- const { personWork } = data.actions;
2617
- const load = useCallback((signal: AbortSignal) => personWork(id, signal), [personWork, id]);
2866
+ const { personPlate } = data.actions;
2867
+ const load = useCallback((signal: AbortSignal) => personPlate(id, signal), [personPlate, id]);
2618
2868
  return (
2619
2869
  <PlatePage
2620
2870
  components={props.components}
2621
2871
  load={load}
2622
2872
  remember={`work:${data.me?.person?.id ?? ""}:${id}`}
2623
2873
  title={words.people.workOf(name)}
2874
+ lead={person?.title ?? undefined}
2624
2875
  aside={<LinkButton href={PATHS.people}>{words.nav.people}</LinkButton>}
2625
2876
  week={props.week}
2626
2877
  weekStart={weekStartOf(data.me?.workspace)}
@@ -2633,6 +2884,146 @@ function PersonWorkPage(props: {
2633
2884
  );
2634
2885
  }
2635
2886
 
2887
+ /** An agent account's plate on its own page (ADR-0084): its work as a member's, for whoever oversees it. */
2888
+ function AgentWork(props: {
2889
+ readonly agent: RestAgent;
2890
+ readonly data: ConsoleData;
2891
+ readonly components: ConsoleComponents;
2892
+ readonly week: string | undefined;
2893
+ }) {
2894
+ const words = useWords();
2895
+ const { agent, data } = props;
2896
+ const { id } = agent.person;
2897
+ const handle = agent.person.handle ?? "";
2898
+ const name = personName(agent.person);
2899
+ const { personPlate } = data.actions;
2900
+ const load = useCallback((signal: AbortSignal) => personPlate(id, signal), [personPlate, id]);
2901
+ return (
2902
+ <PlatePage
2903
+ components={props.components}
2904
+ load={load}
2905
+ remember={`work:${data.me?.person?.id ?? ""}:${id}`}
2906
+ title={words.people.workOf(name)}
2907
+ headless
2908
+ week={props.week}
2909
+ weekStart={weekStartOf(data.me?.workspace)}
2910
+ weekHref={(day) => agentWorkHref(handle, day)}
2911
+ loading={words.people.loadingWork}
2912
+ couldNotLoad={words.people.couldNotLoadWork}
2913
+ empty={{ title: words.people.noWork.title(name), body: words.people.noWork.body }}
2914
+ refused={words.people.notOverseen}
2915
+ />
2916
+ );
2917
+ }
2918
+
2919
+ /** Seeds of the page's own for personas proposed here: twelve characters nobody chose, each. */
2920
+ function freshSeeds(count: number): string[] {
2921
+ const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
2922
+ const bytes = crypto.getRandomValues(new Uint8Array(count * 12));
2923
+ return Array.from({ length: count }, (_, index) =>
2924
+ Array.from(
2925
+ bytes.subarray(index * 12, (index + 1) * 12),
2926
+ (byte) => alphabet[byte % alphabet.length],
2927
+ ).join(""),
2928
+ );
2929
+ }
2930
+
2931
+ /** How many personas the form proposes at a time. */
2932
+ const PROPOSALS_SHOWN = 4;
2933
+
2934
+ /**
2935
+ * "Add an agent account" (ADR-0084), for an administrator: a few personas proposed, by the
2936
+ * console, or from the names a console of one's own brings; the form; and back to the accounts
2937
+ * once one is made.
2938
+ */
2939
+ function NewAgentPage(props: {
2940
+ readonly data: ConsoleData;
2941
+ readonly components: ConsoleComponents;
2942
+ readonly navigation: Navigation;
2943
+ readonly language: string;
2944
+ readonly names: readonly PersonaName[] | undefined;
2945
+ readonly avatarSets: readonly AvatarSet[] | undefined;
2946
+ }) {
2947
+ const words = useWords();
2948
+ const accounts = words.agents.accounts;
2949
+ const { data, components, navigation, language, names, avatarSets } = props;
2950
+ const { busy, error, act } = useAction();
2951
+ const [proposals, setProposals] = useState<readonly RestAgentProposal[]>([]);
2952
+ /** Whether the proposals asked for last could not be read: the form says so, and is filled in by hand. */
2953
+ const [proposalsFailed, setProposalsFailed] = useState(false);
2954
+ const [round, setRound] = useState(0);
2955
+ const { agentProposals } = data.actions;
2956
+ const taken = data.agents.map((agent) => agent.person.handle ?? "").join(" ");
2957
+ const me = data.me?.person ?? undefined;
2958
+ const administrator = me?.role === "admin";
2959
+ // biome-ignore lint/correctness/useExhaustiveDependencies: `round` is the trigger, rolled again by the form
2960
+ useEffect(() => {
2961
+ if (!administrator) {
2962
+ return;
2963
+ }
2964
+ if (names !== undefined) {
2965
+ // A console that brings names of its own proposes from them here, as the console does.
2966
+ setProposals(
2967
+ proposeAgents(freshSeeds(PROPOSALS_SHOWN), {
2968
+ names,
2969
+ lang: language,
2970
+ taken: taken.split(" "),
2971
+ sets: avatarSets,
2972
+ }),
2973
+ );
2974
+ return;
2975
+ }
2976
+ const controller = new AbortController();
2977
+ setProposalsFailed(false);
2978
+ agentProposals(PROPOSALS_SHOWN, language, controller.signal)
2979
+ .then((answer) => {
2980
+ if (!controller.signal.aborted) {
2981
+ setProposals(answer.items);
2982
+ }
2983
+ })
2984
+ .catch(() => {
2985
+ if (!controller.signal.aborted) {
2986
+ setProposalsFailed(true);
2987
+ }
2988
+ });
2989
+ return () => controller.abort();
2990
+ }, [round, administrator, names, avatarSets, language, taken, agentProposals]);
2991
+ return (
2992
+ <>
2993
+ <div className="sc-page-head">
2994
+ <h1 className="sc-page-title">{accounts.add}</h1>
2995
+ </div>
2996
+ {!administrator ? (
2997
+ <Callout tone="warning">{words.errors["auth.forbidden"]}</Callout>
2998
+ ) : (
2999
+ <section className="sc-panel sc-panel-form" aria-label={accounts.add}>
3000
+ <components.AgentAccountForm
3001
+ proposals={proposals}
3002
+ proposalsFailed={proposalsFailed}
3003
+ onRoll={() => setRound((current) => current + 1)}
3004
+ providers={data.me?.signIn ?? []}
3005
+ workspace={data.me?.workspace}
3006
+ people={data.people}
3007
+ me={me}
3008
+ projects={data.projects}
3009
+ busy={busy}
3010
+ error={error}
3011
+ onSubmit={(input) =>
3012
+ void act(async () => {
3013
+ await data.actions.createAgent(input);
3014
+ // To the account's page, which says what is next: the invitation that leads a
3015
+ // machine to it, made there.
3016
+ navigation.replace(agentHref(input.handle));
3017
+ })
3018
+ }
3019
+ onCancel={() => navigation.back(PATHS.agents)}
3020
+ />
3021
+ </section>
3022
+ )}
3023
+ </>
3024
+ );
3025
+ }
3026
+
2636
3027
  function WorkspacePage(props: {
2637
3028
  readonly route: Route;
2638
3029
  readonly data: ConsoleData;
@@ -2640,9 +3031,11 @@ function WorkspacePage(props: {
2640
3031
  readonly navigation: Navigation;
2641
3032
  readonly client: ConsoleClient;
2642
3033
  readonly language: string;
3034
+ /** The names and the shapes a console of one's own proposes and draws agent accounts with (ADR-0084). */
3035
+ readonly persona?: ConsoleConfig["persona"];
2643
3036
  }) {
2644
3037
  const words = useWords();
2645
- const { route, data, components, navigation, client, language } = props;
3038
+ const { route, data, components, navigation, client, language, persona } = props;
2646
3039
  const [fresh, setFresh] = useState<RestTokenCreated | undefined>(undefined);
2647
3040
  const { busy, error, act } = useAction();
2648
3041
  if (route.name === "plugin" && route.level === "workspace") {
@@ -2873,6 +3266,10 @@ function WorkspacePage(props: {
2873
3266
  ? (person, email) => void act(() => data.actions.updatePerson(person.id, { email }))
2874
3267
  : undefined
2875
3268
  }
3269
+ onChangeTitle={(person, title) =>
3270
+ void act(() => data.actions.updatePerson(person.id, { title }))
3271
+ }
3272
+ mayChangeTitle={(person) => administrator || supervisedBy(me, person, data.people)}
2876
3273
  onUnlist={
2877
3274
  administrator
2878
3275
  ? (listing) => void act(() => data.actions.removeListing(listing.id))
@@ -2892,6 +3289,7 @@ function WorkspacePage(props: {
2892
3289
  }
2893
3290
  workHref={oversees ? (person) => personWorkHref(person.id) : undefined}
2894
3291
  agentsHref={administrator ? (person) => personAgentsHref(person.id) : undefined}
3292
+ agentHref={(person) => agentHref(person.handle ?? "")}
2895
3293
  />
2896
3294
  )}
2897
3295
  </>
@@ -2903,47 +3301,175 @@ function WorkspacePage(props: {
2903
3301
  if (route.name === "connect") {
2904
3302
  return <ConnectPage code={route.code} data={data} navigation={navigation} />;
2905
3303
  }
3304
+ if (route.name === "agent") {
3305
+ return (
3306
+ <AgentPage
3307
+ // Keyed by the account, so that going from one account to another by the browser's
3308
+ // history begins a page of its own: no name, title or hours of the one in the other's fields.
3309
+ key={route.handle}
3310
+ handle={route.handle}
3311
+ tab={route.tab}
3312
+ session={route.session}
3313
+ client={client}
3314
+ viaToken={holdsToken(data)}
3315
+ providers={data.me?.signIn}
3316
+ work={(agent) => (
3317
+ <AgentWork agent={agent} data={data} components={components} week={route.week} />
3318
+ )}
3319
+ />
3320
+ );
3321
+ }
3322
+ if (route.name === "new-agent") {
3323
+ return (
3324
+ <NewAgentPage
3325
+ data={data}
3326
+ components={components}
3327
+ navigation={navigation}
3328
+ language={language}
3329
+ names={persona?.names}
3330
+ avatarSets={persona?.avatarSets}
3331
+ />
3332
+ );
3333
+ }
2906
3334
  if (route.name === "agents" || route.name === "new-token") {
2907
3335
  const agents = words.agents;
3336
+ const accounts = agents.accounts;
2908
3337
  const making = route.name === "new-token";
2909
3338
  const origin = typeof window === "undefined" ? "" : window.location.origin;
3339
+ const me = data.me?.person ?? undefined;
3340
+ const administrator = me?.role === "admin";
3341
+ // A console held through a token shows no tokens: the agents that act as a person are
3342
+ // listed where that person is signed in.
3343
+ const viaToken = holdsToken(data);
3344
+ const view: AgentsView = making ? "connected" : route.view;
3345
+ // The agent accounts (ADR-0084) whoever is looking manages, theirs to look after, and
3346
+ // under them, for an administrator, the ones someone else manages.
3347
+ const { managed: mine, others } = agentAccountGroups(data.agents, me, data.people);
3348
+ const views: readonly {
3349
+ readonly view: AgentsView;
3350
+ readonly label: string;
3351
+ readonly count: number;
3352
+ }[] = [
3353
+ { view: "mine", label: agents.views.mine, count: mine.length },
3354
+ ...(viaToken
3355
+ ? []
3356
+ : [
3357
+ {
3358
+ view: "connected" as const,
3359
+ label: agents.views.connected,
3360
+ count: data.tokens.length,
3361
+ },
3362
+ ]),
3363
+ ];
3364
+ if (view === "connected" && viaToken) {
3365
+ return <NothingHere />;
3366
+ }
2910
3367
  return (
2911
3368
  <>
2912
3369
  <div className="sc-page-head">
2913
3370
  <h1 className="sc-page-title">{agents.title}</h1>
2914
- {!making && (
3371
+ {view !== "connected" && administrator && (
3372
+ <LinkButton href={PATHS.newAgent} variant="primary">
3373
+ {accounts.add}
3374
+ </LinkButton>
3375
+ )}
3376
+ {view === "connected" && !making && (
2915
3377
  <LinkButton href={PATHS.newToken} variant="primary">
2916
3378
  {agents.makeByHand}
2917
3379
  </LinkButton>
2918
3380
  )}
2919
3381
  </div>
3382
+ <nav className="sc-subtabs sc-agents-views" aria-label={agents.views.aria}>
3383
+ {views.map((one) => (
3384
+ <a
3385
+ key={one.view}
3386
+ className={cx("sc-tab", one.view === view && "sc-tab-current")}
3387
+ href={agentsHref(one.view)}
3388
+ aria-current={one.view === view ? "page" : undefined}
3389
+ >
3390
+ {one.label}
3391
+ <span className="sc-tab-count">{one.count}</span>
3392
+ </a>
3393
+ ))}
3394
+ </nav>
2920
3395
  {error !== undefined && <Callout tone="danger">{error}</Callout>}
2921
- {fresh !== undefined && (
2922
- <NewToken token={fresh.token} secret={fresh.secret} onDone={() => setFresh(undefined)} />
2923
- )}
2924
- {making && (
2925
- <section className="sc-panel sc-panel-form" aria-label={agents.makeAria}>
2926
- <TokenForm
2927
- daysAtMost={data.me?.workspace.tokenDaysAtMost}
3396
+ {view !== "connected" ? (
3397
+ <>
3398
+ <section className="sc-people-group" aria-label={agents.views.mine}>
3399
+ <p className="sc-lead">{accounts.intro}</p>
3400
+ <components.AgentAccountList
3401
+ agents={mine}
3402
+ me={me}
3403
+ busy={busy}
3404
+ href={(agent) => agentHref(agent.person.handle ?? "")}
3405
+ empty={
3406
+ others.length > 0 ? (
3407
+ // The accounts under this say that there are some: a line is enough here.
3408
+ <p className="sc-field-hint">{accounts.mineEmpty.title}</p>
3409
+ ) : administrator ? (
3410
+ <EmptyState title={accounts.empty.title} body={accounts.empty.body} />
3411
+ ) : (
3412
+ <EmptyState
3413
+ title={accounts.mineEmpty.title}
3414
+ body={accounts.mineEmpty.body}
3415
+ action={<LinkButton href={PATHS.people}>{words.nav.people}</LinkButton>}
3416
+ />
3417
+ )
3418
+ }
3419
+ />
3420
+ </section>
3421
+ {others.length > 0 && (
3422
+ <section className="sc-people-group" aria-label={accounts.others}>
3423
+ <h2 className="sc-section-title">
3424
+ {accounts.others}
3425
+ <Badge kind="count">{others.length}</Badge>
3426
+ </h2>
3427
+ <p className="sc-lead">{accounts.othersIntro}</p>
3428
+ <components.AgentAccountList
3429
+ agents={others}
3430
+ me={me}
3431
+ busy={busy}
3432
+ href={(agent) => agentHref(agent.person.handle ?? "")}
3433
+ />
3434
+ </section>
3435
+ )}
3436
+ </>
3437
+ ) : (
3438
+ <section aria-label={agents.views.connected}>
3439
+ <p className="sc-lead">{accounts.yoursIntro}</p>
3440
+ {fresh !== undefined && (
3441
+ <NewToken
3442
+ token={fresh.token}
3443
+ secret={fresh.secret}
3444
+ onDone={() => setFresh(undefined)}
3445
+ />
3446
+ )}
3447
+ {making && (
3448
+ <section className="sc-panel sc-panel-form" aria-label={agents.makeAria}>
3449
+ <TokenForm
3450
+ daysAtMost={data.me?.workspace.tokenDaysAtMost}
3451
+ busy={busy}
3452
+ onSubmit={(input) =>
3453
+ void act(async () => {
3454
+ setFresh(await data.actions.createToken(input));
3455
+ navigation.replace(agentsHref("connected"));
3456
+ })
3457
+ }
3458
+ onCancel={() => navigation.back(agentsHref("connected"))}
3459
+ />
3460
+ </section>
3461
+ )}
3462
+ <components.TokenList
3463
+ tokens={data.tokens}
2928
3464
  busy={busy}
2929
- onSubmit={(input) =>
2930
- void act(async () => {
2931
- setFresh(await data.actions.createToken(input));
2932
- navigation.replace(PATHS.agents);
2933
- })
2934
- }
2935
- onCancel={() => navigation.back(PATHS.agents)}
3465
+ consoleVersion={data.me?.console?.version}
3466
+ onRevoke={(token) => void act(() => data.actions.revokeToken(token.id))}
3467
+ empty={<EmptyState title={agents.empty.title} body={agents.empty.body} />}
2936
3468
  />
3469
+ <ConnectWords origin={origin} />
3470
+ <DeskWords origin={origin} />
2937
3471
  </section>
2938
3472
  )}
2939
- <components.TokenList
2940
- tokens={data.tokens}
2941
- busy={busy}
2942
- consoleVersion={data.me?.console?.version}
2943
- onRevoke={(token) => void act(() => data.actions.revokeToken(token.id))}
2944
- empty={<EmptyState title={agents.empty.title} body={agents.empty.body} />}
2945
- />
2946
- <ConnectWords origin={origin} />
2947
3473
  </>
2948
3474
  );
2949
3475
  }
@@ -2958,6 +3484,8 @@ export function createConsole(config: ConsoleConfig = {}): ConsoleApp {
2958
3484
  const fallbackTitle = config.title ?? "Console";
2959
3485
  const languages = config.languages ?? DEFAULT_LANGUAGES;
2960
3486
  const pages = config.pages ?? [];
3487
+ /** The shapes the avatars of agent accounts are drawn from here (ADR-0084): the package's, unless this console brings its own. */
3488
+ const avatarSets = config.persona?.avatarSets ?? AVATAR_SETS;
2961
3489
 
2962
3490
  // biome-ignore lint/correctness/noComponentHookFactories: createConsole runs once, when a console is built, never during a render; App is that console's one root component, closing over its config.
2963
3491
  function App(props: { readonly initialPath?: string | undefined }) {
@@ -2969,6 +3497,22 @@ export function createConsole(config: ConsoleConfig = {}): ConsoleApp {
2969
3497
  );
2970
3498
  const projectKey = projectOf(route);
2971
3499
  const data = useConsoleData(client, projectKey);
3500
+ // The page the console opens on asks for its own data along with who is signed in, which
3501
+ // useConsoleData asks for in the same breath, rather than once that answer has come: a
3502
+ // round trip fewer before the page stands.
3503
+ // biome-ignore lint/correctness/useExhaustiveDependencies: the page the console opened on, once
3504
+ useEffect(() => {
3505
+ if (route.name === "work") {
3506
+ askEarly("work", () => client.plate());
3507
+ } else if (route.name === "my-decisions") {
3508
+ askEarly("decisions:addressed", () =>
3509
+ client.myDecisions({ limit: MY_DECISIONS_PAGE, offset: 0 }),
3510
+ );
3511
+ askEarly("decisions:raised", () =>
3512
+ client.myDecisions({ raised: true, limit: MY_DECISIONS_PAGE, offset: 0 }),
3513
+ );
3514
+ }
3515
+ }, []);
2972
3516
  const failure = signInFailureOf(location.search);
2973
3517
  const title = data.me?.workspace.name ?? fallbackTitle;
2974
3518
  const viaToken = holdsToken(data);
@@ -3008,11 +3552,12 @@ export function createConsole(config: ConsoleConfig = {}): ConsoleApp {
3008
3552
 
3009
3553
  useEffect(() => {
3010
3554
  if (typeof document !== "undefined") {
3011
- document.title = data.project === undefined ? title : `${data.project.name} · ${title}`;
3012
3555
  document.documentElement.lang = pack.tag;
3013
3556
  }
3014
- }, [title, data.project, pack.tag]);
3557
+ }, [pack.tag]);
3015
3558
 
3559
+ /** The tab the page shown is under, once the tabs are known. */
3560
+ let here: string | undefined;
3016
3561
  let content: React.ReactNode;
3017
3562
  if (data.me === undefined) {
3018
3563
  content = (
@@ -3032,6 +3577,14 @@ export function createConsole(config: ConsoleConfig = {}): ConsoleApp {
3032
3577
  </div>
3033
3578
  </Ground>
3034
3579
  );
3580
+ } else if (route.name === "setup") {
3581
+ // What an invitation's code opens is read without a sign-in (ADR-0088): the guide, and
3582
+ // nothing else of the console.
3583
+ content = (
3584
+ <Ground>
3585
+ <SetupPage client={client} code={route.code} />
3586
+ </Ground>
3587
+ );
3035
3588
  } else if (data.me.person === null) {
3036
3589
  content = (
3037
3590
  <Ground>
@@ -3070,15 +3623,15 @@ export function createConsole(config: ConsoleConfig = {}): ConsoleApp {
3070
3623
  route.name === "new-team" ||
3071
3624
  route.name === "person-agents",
3072
3625
  },
3073
- ...(viaToken
3074
- ? []
3075
- : [
3076
- {
3077
- href: PATHS.agents,
3078
- label: words.nav.agents,
3079
- current: route.name === "agents" || route.name === "new-token",
3080
- },
3081
- ]),
3626
+ {
3627
+ href: PATHS.agents,
3628
+ label: words.nav.agents,
3629
+ current:
3630
+ route.name === "agents" ||
3631
+ route.name === "new-token" ||
3632
+ route.name === "new-agent" ||
3633
+ route.name === "agent",
3634
+ },
3082
3635
  ...pages
3083
3636
  .filter((candidate) => candidate.level === "workspace")
3084
3637
  .map((candidate) => ({
@@ -3192,13 +3745,22 @@ export function createConsole(config: ConsoleConfig = {}): ConsoleApp {
3192
3745
  current: route.name === "settings",
3193
3746
  },
3194
3747
  ];
3748
+ here = currentTab(nav);
3195
3749
  /** A page of the console's own at the address, or nothing there. */
3196
3750
  const customPageOf = (key: string, level: CustomPage["level"]): ReactNode => {
3197
3751
  const found = pages.find((candidate) => candidate.key === key && candidate.level === level);
3198
3752
  return found === undefined ? (
3199
3753
  <NothingHere />
3200
3754
  ) : (
3201
- found.render({ data, project, client, navigation, words, language: pack.tag })
3755
+ found.render({
3756
+ data,
3757
+ project,
3758
+ client,
3759
+ navigation,
3760
+ search: location.search,
3761
+ words,
3762
+ language: pack.tag,
3763
+ })
3202
3764
  );
3203
3765
  };
3204
3766
  let page: ReactNode;
@@ -3232,6 +3794,7 @@ export function createConsole(config: ConsoleConfig = {}): ConsoleApp {
3232
3794
  navigation={navigation}
3233
3795
  client={client}
3234
3796
  language={pack.tag}
3797
+ persona={config.persona}
3235
3798
  />
3236
3799
  );
3237
3800
  } else if (data.projectError !== undefined) {
@@ -3318,10 +3881,21 @@ export function createConsole(config: ConsoleConfig = {}): ConsoleApp {
3318
3881
  </components.Shell>
3319
3882
  );
3320
3883
  }
3884
+ // The browser's tab is called after the page it shows. It is said again at every address,
3885
+ // not only when the words change: a plugin's page may name the tab itself (the frame's
3886
+ // `title`), and that name must not outlive the page.
3887
+ const tab = tabTitle([here, data.project?.name, title]);
3888
+ const address = `${location.pathname}${location.search}`;
3889
+ // biome-ignore lint/correctness/useExhaustiveDependencies: the address is why it is said again
3890
+ useEffect(() => {
3891
+ if (typeof document !== "undefined") {
3892
+ document.title = tab;
3893
+ }
3894
+ }, [tab, address]);
3321
3895
  return (
3322
3896
  <LanguageContext.Provider value={pack}>
3323
3897
  <RemotePicturesContext.Provider value={pictureSrc}>
3324
- {content}
3898
+ <AvatarSetsContext.Provider value={avatarSets}>{content}</AvatarSetsContext.Provider>
3325
3899
  </RemotePicturesContext.Provider>
3326
3900
  </LanguageContext.Provider>
3327
3901
  );