@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/dist/console.js CHANGED
@@ -1,20 +1,24 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { StrictMode, useCallback, useEffect, useMemo, useState, } from "react";
2
+ import { StrictMode, useCallback, useEffect, useMemo, useRef, useState, } from "react";
3
3
  import { createRoot } from "react-dom/client";
4
- import { ApiError, createClient, OPEN_TASK_STATES, PROJECT_RULES_TEMPLATE, REFERENCE_RULES, RULES_PATH, RULES_TITLE, } from "./api.js";
4
+ import { AgentPage, AgentsNeedingYou } from "./agent-page.js";
5
+ import { ApiError, createClient, OPEN_TASK_STATES, PROJECT_RULES_TEMPLATE, RULES_PATH, RULES_TITLE, } from "./api.js";
6
+ import { AVATAR_SETS } from "./avatar.js";
7
+ import { AgentAccountForm, AgentAccountList, agentAccountGroups, } from "./components/agents.js";
5
8
  import { Board, BoardFilters, byDue, filterTasks } from "./components/board.js";
6
9
  import { Calendar, Workload } from "./components/calendar.js";
7
10
  import { CategoryList } from "./components/categories.js";
8
11
  import { ConnectWords } from "./components/connect.js";
9
12
  import { DecisionForm } from "./components/decision-form.js";
10
- import { DecisionCard, DecisionList } from "./components/decision-list.js";
13
+ import { DecisionCard, DecisionList, } from "./components/decision-list.js";
14
+ import { DeskWords } from "./components/desk.js";
11
15
  import { EventFeed } from "./components/event-feed.js";
12
16
  import { GoalForm, GoalList, GoalView, goalMonth } from "./components/goals.js";
13
17
  import { HomeGrid } from "./components/home.js";
14
18
  import { MyDecisions, ReachedDecision } from "./components/my-decisions.js";
15
19
  import { PackTokenWays } from "./components/pack-token.js";
16
20
  import { PAGE_SIZE } from "./components/paged.js";
17
- import { ListingForm, PeopleList, TeamForm, TeamList, } from "./components/people.js";
21
+ import { ListingForm, PeopleList, supervisedBy, TeamForm, TeamList, } from "./components/people.js";
18
22
  import { PluginFrame } from "./components/plugin-frame.js";
19
23
  import { PluginSettingsList, PluginSettingsView } from "./components/plugin-settings.js";
20
24
  import { MemberList, ProjectForm, ProjectMark, } from "./components/projects.js";
@@ -29,17 +33,21 @@ import { TaskForm } from "./components/task-form.js";
29
33
  import { TaskList } from "./components/task-list.js";
30
34
  import { TaskView } from "./components/task-view.js";
31
35
  import { NewToken, TokenForm, TokenList } from "./components/tokens.js";
32
- import { Button, Callout, CategoryBadge, cx, EmptyState, LinkButton, personName, Spinner, StateBadge, Time, } from "./components/ui.js";
36
+ import { AvatarSetsContext, Badge, Button, Callout, CategoryBadge, cx, EmptyState, LinkButton, personName, Spinner, StateBadge, Time, } from "./components/ui.js";
33
37
  import { WorkList } from "./components/work.js";
34
- import { peopleVisibilityOf, WorkspaceSettingsForm, WorkspaceSettingsView, weekStartOf, } from "./components/workspace.js";
38
+ import { peopleVisibilityOf, WorkspaceServicesForm, WorkspaceServicesView, WorkspaceSettingsForm, WorkspaceSettingsView, weekStartOf, } from "./components/workspace.js";
35
39
  import { ConnectPage } from "./connect-page.js";
36
40
  import { useConsoleData } from "./data.js";
37
41
  import { monthOf, today } from "./dates.js";
38
42
  import { DocsPage } from "./docs-page.js";
43
+ import { createGlanceReader } from "./glances.js";
39
44
  import { browserPack, chooseLanguage, DEFAULT_LANGUAGES, LanguageContext, useWords, } from "./i18n/index.js";
45
+ import { proposeAgents } from "./persona.js";
40
46
  import { pluginNavItems, pluginPagesAt, pluginWordOf } from "./plugin-nav.js";
41
- import { boardHref, calendarHref, customPageHref, decisionHref, decisionsHref, docHref, goalHref, matchRoute, myDecisionHref, newDecisionHref, newGoalHref, newTaskHref, PATHS, personAgentsHref, personWorkHref, pluginHref, pluginSettingsHref, projectHref, projectSettingsHref, roadmapHref, settingsHref, signInFailureOf, taskHref, withoutSignInParam, workHref, } from "./router.js";
47
+ import { agentHref, agentsHref, agentWorkHref, boardHref, calendarHref, customPageHref, decisionHref, decisionsHref, docHref, goalHref, matchRoute, myDecisionHref, newDecisionHref, newGoalHref, newTaskHref, PATHS, personAgentsHref, personWorkHref, pluginHref, pluginSettingsHref, projectHref, projectSettingsHref, roadmapHref, settingsHref, signInFailureOf, taskHref, withoutSignInParam, workHref, } from "./router.js";
42
48
  import { projectPath } from "./routes.js";
49
+ import { SetupPage } from "./setup-page.js";
50
+ import { currentTab, tabTitle } from "./tab-title.js";
43
51
  import { errorWords, useAction } from "./use-action.js";
44
52
  export const DEFAULT_COMPONENTS = {
45
53
  Shell,
@@ -49,6 +57,8 @@ export const DEFAULT_COMPONENTS = {
49
57
  EventFeed,
50
58
  SignIn,
51
59
  TokenList,
60
+ AgentAccountList,
61
+ AgentAccountForm,
52
62
  SessionList,
53
63
  PeopleList,
54
64
  TeamList,
@@ -182,11 +192,13 @@ function Ground(props) {
182
192
  return (_jsx("div", { className: "sc-shell", children: _jsx("main", { className: "sc-main", children: props.children }) }));
183
193
  }
184
194
  /**
185
- * Whether the console holds a token rather than a session: a person's own console, served from
186
- * their machine with the token the command keeps (ADR-0014). The API says so with `me.agent`.
195
+ * Whether the console holds a token rather than a browser's session: a person's own console,
196
+ * served from their machine with what the command keeps (ADR-0014), a token or the command's own
197
+ * session (ADR-0084), which is held to what a token may ask. The API says so with `me.agent`,
198
+ * and with `me.session`.
187
199
  */
188
200
  function holdsToken(data) {
189
- return data.me !== undefined && data.me.agent !== null;
201
+ return data.me !== undefined && (data.me.agent !== null || data.me.session?.kind === "command");
190
202
  }
191
203
  /**
192
204
  * The language to keep for a person the pages see for the first time (ADR-0065): the one their
@@ -205,8 +217,7 @@ export function languageToKeep(me, browser, packs) {
205
217
  * (ADR-0021).
206
218
  */
207
219
  export function onlyOnOwnPages(route) {
208
- return (route.name === "agents" ||
209
- route.name === "sessions" ||
220
+ return (route.name === "sessions" ||
210
221
  route.name === "new-token" ||
211
222
  route.name === "person-agents" ||
212
223
  route.name === "connect");
@@ -215,6 +226,39 @@ function NotWithToken() {
215
226
  const words = useWords().common.notWithToken;
216
227
  return _jsx(EmptyState, { title: words.title, body: words.body });
217
228
  }
229
+ /**
230
+ * The boards of the projects the front page shows at a glance (ADR-0105), each in one request
231
+ * (ADR-0107): read when its tile is first shown at such a size, each time the front page is
232
+ * shown, and again when the person comes back to the window, so that what a tile says is what
233
+ * holds now. A read that fails is tried again; one the console refuses leaves the tile with the
234
+ * project's own figure.
235
+ */
236
+ function useGlances(client) {
237
+ const [read, setRead] = useState({});
238
+ const wanted = useRef([]);
239
+ const reader = useRef(undefined);
240
+ useEffect(() => {
241
+ const made = createGlanceReader({
242
+ read: (project) => client.project(project.key).glance(),
243
+ store: (id, glance) => setRead((before) => ({ ...before, [id]: glance })),
244
+ // What the console refused it refuses again: a project that is not the person's to read.
245
+ again: (failure) => !(failure instanceof ApiError) || failure.status === 0 || failure.status >= 500,
246
+ });
247
+ reader.current = made;
248
+ // The grid said what it shows before this ran: a child's effect comes first.
249
+ made.want(wanted.current);
250
+ return () => {
251
+ made.stop();
252
+ reader.current = undefined;
253
+ };
254
+ }, [client]);
255
+ const want = useCallback((list) => {
256
+ wanted.current = list;
257
+ reader.current?.want(list);
258
+ }, []);
259
+ const renew = useCallback(() => reader.current?.renew(), []);
260
+ return { read, want, renew };
261
+ }
218
262
  function ProjectsPage(props) {
219
263
  const words = useWords().projects;
220
264
  const homeWords = useWords().home;
@@ -224,6 +268,26 @@ function ProjectsPage(props) {
224
268
  const [arranging, setArranging] = useState(false);
225
269
  const { busy, error, act } = useAction();
226
270
  const href = (project) => projectHref(project.key);
271
+ const glances = useGlances(client);
272
+ // What waits in each project is read with the projects, once when the console opens. Each
273
+ // time the front page is shown after that, and when the person comes back to its window,
274
+ // the projects are read again, and the glances with them.
275
+ const { refreshProjects } = data.actions;
276
+ const loaded = useRef(data.loaded);
277
+ const { renew } = glances;
278
+ useEffect(() => {
279
+ if (loaded.current) {
280
+ refreshProjects().catch(() => undefined);
281
+ }
282
+ const back = () => {
283
+ if (document.visibilityState === "visible") {
284
+ refreshProjects().catch(() => undefined);
285
+ renew();
286
+ }
287
+ };
288
+ document.addEventListener("visibilitychange", back);
289
+ return () => document.removeEventListener("visibilitychange", back);
290
+ }, [refreshProjects, renew]);
227
291
  // A project is made by an administrator (ADR-0045): a member sees the list alone, the form's
228
292
  // address included.
229
293
  const administrator = data.me?.person?.role === "admin";
@@ -231,7 +295,7 @@ function ProjectsPage(props) {
231
295
  return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "sc-page-head", children: [_jsx("h1", { className: "sc-page-title", children: words.title }), !arranging && (_jsxs("div", { className: "sc-page-actions", children: [me !== undefined && me.person !== null && (_jsx(Button, { size: "sm", variant: "ghost", onClick: () => setArranging(true), children: homeWords.edit })), administrator && !making && (_jsx(LinkButton, { href: PATHS.newProject, variant: "primary", children: words.newProject }))] }))] }), error !== undefined && _jsx(Callout, { tone: "danger", children: error }), making && (_jsx("section", { className: "sc-panel sc-panel-form", "aria-label": words.form.aria, children: _jsx(ProjectForm, { busy: busy, skillsSource: data.me?.workspace.skills.source, organizationAddress: data.me?.workspace.skills.address ?? null, onSubmit: (input, icon) => void act(async () => {
232
296
  const made = await data.actions.createProject(input, icon instanceof File ? uploadOf(icon) : undefined);
233
297
  navigation.replace(projectHref(made.key));
234
- }), onCancel: () => navigation.back(PATHS.projects) }) })), _jsx(components.HomeGrid, { projects: data.projects, plugins: data.plugins, home: me?.home, editing: arranging, onSave: (home) => data.actions.updateMe({ home }), onDone: () => setArranging(false), projectHref: href, onOpen: (project) => navigation.go(href(project)), nameOf: (name) => pluginWordOf(name, language), renderWidget: (tile, size) => me === undefined ? null : (_jsx(PluginFrame, { plugin: tile.plugin, widget: tile.widget.key, size: size, me: me, language: language, client: client, navigation: navigation, title: pluginWordOf(tile.widget.name, language) })), empty: _jsx(EmptyState, { title: words.empty.title, body: administrator ? words.empty.body : words.empty.bodyMember, action: administrator ? (_jsx(LinkButton, { href: PATHS.newProject, children: words.newProject })) : undefined }) })] }));
298
+ }), onCancel: () => navigation.back(PATHS.projects) }) })), _jsx(components.HomeGrid, { projects: data.projects, plugins: data.plugins, home: me?.home, editing: arranging, onSave: (home) => data.actions.updateMe({ home }), onDone: () => setArranging(false), projectHref: href, onOpen: (project) => navigation.go(href(project)), glances: glances.read, onGlance: glances.want, nameOf: (name) => pluginWordOf(name, language), renderWidget: (tile, size) => me === undefined ? null : (_jsx(PluginFrame, { plugin: tile.plugin, widget: tile.widget.key, size: size, me: me, language: language, client: client, navigation: navigation, title: pluginWordOf(tile.widget.name, language) })), empty: _jsx(EmptyState, { title: words.empty.title, body: administrator ? words.empty.body : words.empty.bodyMember, action: administrator ? (_jsx(LinkButton, { href: PATHS.newProject, children: words.newProject })) : undefined }) })] }));
235
299
  }
236
300
  /**
237
301
  * A plugin's page (ADR-0054): the sub-tabs of its pages at the level, where it has several, above
@@ -447,7 +511,11 @@ function TaskPage(props) {
447
511
  }), onMove: (target, state) => void act(() => data.actions.updateTask(target.id, { state })), onRaiseDecision: (input, files) => void act(async () => {
448
512
  await data.actions.raiseDecision(input, uploadsOf(files));
449
513
  navigation.replace(here);
450
- }), onAnswer: (decision, input) => void act(() => data.actions.answerDecision(decision.id, input)), onUpdateDecision: (decision, patch) => void act(() => data.actions.updateDecision(decision.id, patch)), onAbandonRun: (run) => void act(() => data.actions.abandonRun(run.id)), onArchive: (target) => void act(async () => {
514
+ }), onAnswer: (decision, input) => void act(() => data.actions.answerDecision(decision.id, input)), onUpdateDecision: (decision, patch) => void act(() => data.actions.updateDecision(decision.id, patch)), addressing: {
515
+ people: data.members.map((member) => member.person),
516
+ me: data.me?.person ?? undefined,
517
+ onAddress: (decision, deciders) => void act(() => data.actions.addressDecision(decision.id, deciders.map((person) => person.id))),
518
+ }, onAbandonRun: (run) => void act(() => data.actions.abandonRun(run.id)), onArchive: (target) => void act(async () => {
451
519
  await data.actions.archiveTask(target.id);
452
520
  navigation.go(projectHref(key, "archive"));
453
521
  }), onRestore: (target) => void act(async () => {
@@ -469,6 +537,13 @@ function ProjectPage(props) {
469
537
  const onMove = (task, state) => void act(() => data.actions.updateTask(task.id, { state }));
470
538
  const onAnswer = (decision, input) => void act(() => data.actions.answerDecision(decision.id, input));
471
539
  const onUpdate = (decision, patch) => void act(() => data.actions.updateDecision(decision.id, patch));
540
+ // Whom a waiting decision is for, said anew (ADR-0096), by anyone who may work here: the
541
+ // people to name are the project's members, as where a decision is raised.
542
+ const addressing = {
543
+ people: data.members.map((member) => member.person),
544
+ me: data.me?.person ?? undefined,
545
+ onAddress: (decision, deciders) => void act(() => data.actions.addressDecision(decision.id, deciders.map((person) => person.id))),
546
+ };
472
547
  if (route.name === "board") {
473
548
  const me = data.me?.person ?? undefined;
474
549
  const shown = filterTasks(data.tasks, route.filter, me);
@@ -544,7 +619,7 @@ function ProjectPage(props) {
544
619
  return (_jsx(DocsPage, { project: project, path: route.path, view: route.view, data: data, navigation: navigation }));
545
620
  }
546
621
  if (route.name === "decisions") {
547
- return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "sc-page-head", children: [_jsx("h1", { className: "sc-page-title", children: words.decisions.title }), _jsx(LinkButton, { href: newDecisionHref(key), variant: "primary", children: words.decisions.raise })] }), error !== undefined && _jsx(Callout, { tone: "danger", children: error }), _jsx(components.DecisionList, { decisions: data.decisions, tasks: tasksById, taskHref: href, docHref: toDoc, fileHref: (fileId) => projectPath(key, "files", fileId), decisionHref: (decision) => decisionHref(key, decision.id), page: route.page, pageHref: (page) => decisionsHref(key, page), onAnswer: onAnswer, onUpdate: onUpdate, busy: busy, empty: _jsx(EmptyState, { title: words.decisions.empty.title, body: words.decisions.empty.body }) })] }));
622
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "sc-page-head", children: [_jsx("h1", { className: "sc-page-title", children: words.decisions.title }), _jsx(LinkButton, { href: newDecisionHref(key), variant: "primary", children: words.decisions.raise })] }), error !== undefined && _jsx(Callout, { tone: "danger", children: error }), _jsx(components.DecisionList, { decisions: data.decisions, tasks: tasksById, taskHref: href, docHref: toDoc, fileHref: (fileId) => projectPath(key, "files", fileId), decisionHref: (decision) => decisionHref(key, decision.id), page: route.page, pageHref: (page) => decisionsHref(key, page), onAnswer: onAnswer, onUpdate: onUpdate, addressing: addressing, busy: busy, empty: _jsx(EmptyState, { title: words.decisions.empty.title, body: words.decisions.empty.body }) })] }));
548
623
  }
549
624
  if (route.name === "new-decision") {
550
625
  return (_jsxs(_Fragment, { children: [_jsx("div", { className: "sc-page-head", children: _jsx("h1", { className: "sc-page-title", children: words.decisions.raise }) }), error !== undefined && _jsx(Callout, { tone: "danger", children: error }), _jsx("section", { className: "sc-panel sc-panel-form", "aria-label": words.decisions.raiseAria, children: _jsx(DecisionForm, { findTasks: data.actions.findTasks, deciders: data.members.map((member) => member.person), me: data.me?.person ?? undefined, busy: busy, onSubmit: (input, files) => void act(async () => {
@@ -554,7 +629,7 @@ function ProjectPage(props) {
554
629
  }
555
630
  if (route.name === "decision") {
556
631
  const decision = data.decisions.find((candidate) => candidate.id === route.id);
557
- return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "sc-page-head", children: [_jsx("h1", { className: "sc-page-title", children: words.decisions.one }), _jsx(LinkButton, { href: projectHref(key, "decisions"), children: words.decisions.all })] }), error !== undefined && _jsx(Callout, { tone: "danger", children: error }), decision === undefined ? (_jsx(EmptyState, { title: words.decisions.noSuch.title, body: words.decisions.noSuch.body })) : (_jsx(DecisionCard, { decision: decision, task: decision.taskId === null ? undefined : tasksById.get(decision.taskId), taskHref: href, docHref: toDoc, fileHref: (fileId) => projectPath(key, "files", fileId), onAnswer: onAnswer, onUpdate: onUpdate, busy: busy }))] }));
632
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "sc-page-head", children: [_jsx("h1", { className: "sc-page-title", children: words.decisions.one }), _jsx(LinkButton, { href: projectHref(key, "decisions"), children: words.decisions.all })] }), error !== undefined && _jsx(Callout, { tone: "danger", children: error }), decision === undefined ? (_jsx(EmptyState, { title: words.decisions.noSuch.title, body: words.decisions.noSuch.body })) : (_jsx(DecisionCard, { decision: decision, task: decision.taskId === null ? undefined : tasksById.get(decision.taskId), taskHref: href, docHref: toDoc, fileHref: (fileId) => projectPath(key, "files", fileId), onAnswer: onAnswer, onUpdate: onUpdate, addressing: addressing, busy: busy }))] }));
558
633
  }
559
634
  if (route.name === "archive") {
560
635
  return _jsx(ArchivePage, { project: project, data: data });
@@ -770,7 +845,7 @@ function WorkspaceSettingsPage(props) {
770
845
  if (!administrator) {
771
846
  return _jsx(NothingHere, {});
772
847
  }
773
- return (_jsxs(_Fragment, { children: [head, error !== undefined && _jsx(Callout, { tone: "danger", children: error }), _jsx("section", { className: "sc-panel sc-panel-form", "aria-label": words.rules.title, children: rules === undefined ? (_jsx(Spinner, { label: words.rules.loading })) : (_jsx(RulesForm, { rules: rules, scope: "workspace", template: REFERENCE_RULES, busy: busy, onSubmit: (input) => void act(async () => {
848
+ return (_jsxs(_Fragment, { children: [head, error !== undefined && _jsx(Callout, { tone: "danger", children: error }), _jsx("section", { className: "sc-panel sc-panel-form", "aria-label": words.rules.title, children: rules === undefined ? (_jsx(Spinner, { label: words.rules.loading })) : (_jsx(RulesForm, { rules: rules, scope: "workspace", template: "", busy: busy, onSubmit: (input) => void act(async () => {
774
849
  setRules(await data.actions.writeRules({
775
850
  body: input.body,
776
851
  ...(input.baseVersion === undefined
@@ -778,10 +853,7 @@ function WorkspaceSettingsPage(props) {
778
853
  : { baseVersion: input.baseVersion }),
779
854
  }));
780
855
  navigation.replace(PATHS.settings);
781
- }), onCancel: () => navigation.back(PATHS.settings), onReset: () => void act(async () => {
782
- setRules(await data.actions.archiveRules());
783
- navigation.replace(PATHS.settings);
784
- }) })) })] }));
856
+ }), onCancel: () => navigation.back(PATHS.settings) })) })] }));
785
857
  }
786
858
  if (form === "pack-token") {
787
859
  if (!administrator || workspace === undefined) {
@@ -798,6 +870,15 @@ function WorkspaceSettingsPage(props) {
798
870
  navigation.replace(PATHS.settings);
799
871
  }), onBack: () => navigation.back(PATHS.settings) })] }));
800
872
  }
873
+ if (form === "services") {
874
+ if (!administrator || workspace === undefined) {
875
+ return _jsx(NothingHere, {});
876
+ }
877
+ return (_jsxs(_Fragment, { children: [head, error !== undefined && _jsx(Callout, { tone: "danger", children: error }), _jsxs("section", { className: "sc-panel sc-panel-form", "aria-label": words.settings.services.aria, children: [_jsx("h2", { className: "sc-section-title", children: words.settings.services.title }), _jsx(WorkspaceServicesForm, { workspace: workspace, busy: busy, onSubmit: (patch) => void act(async () => {
878
+ await data.actions.updateWorkspace(patch);
879
+ navigation.replace(PATHS.settings);
880
+ }), onCancel: () => navigation.back(PATHS.settings) })] })] }));
881
+ }
801
882
  if (form === "workspace") {
802
883
  if (!administrator || workspace === undefined) {
803
884
  return _jsx(NothingHere, {});
@@ -807,7 +888,7 @@ function WorkspaceSettingsPage(props) {
807
888
  navigation.replace(PATHS.settings);
808
889
  }), onCancel: () => navigation.back(PATHS.settings) })] })] }));
809
890
  }
810
- return (_jsxs(_Fragment, { children: [head, !holdsToken(data) && _jsx(SettingsViews, { on: "workspace" }), error !== undefined && _jsx(Callout, { tone: "danger", children: error }), workspace !== undefined && (_jsxs("section", { className: "sc-panel", "aria-label": words.settings.workspace.aria, children: [_jsxs("div", { className: "sc-section-head", children: [_jsx("h2", { className: "sc-section-title", children: words.settings.workspace.title }), administrator && (_jsx("a", { className: "sc-button sc-button-secondary sc-button-sm", href: settingsHref("workspace"), children: words.common.edit }))] }), _jsx(WorkspaceSettingsView, { workspace: workspace, console: data.me?.console })] })), _jsxs("section", { className: "sc-panel", "aria-label": words.rules.title, children: [_jsx("h2", { className: "sc-section-title", children: words.rules.title }), rules === undefined ? (_jsx(Spinner, { label: words.rules.loading })) : (_jsx(RulesView, { rules: rules, scope: "workspace", editHref: administrator ? settingsHref("rules") : undefined, onArchive: administrator
891
+ return (_jsxs(_Fragment, { children: [head, !holdsToken(data) && _jsx(SettingsViews, { on: "workspace" }), error !== undefined && _jsx(Callout, { tone: "danger", children: error }), workspace !== undefined && (_jsxs("section", { className: "sc-panel", "aria-label": words.settings.workspace.aria, children: [_jsxs("div", { className: "sc-section-head", children: [_jsx("h2", { className: "sc-section-title", children: words.settings.workspace.title }), administrator && (_jsx("a", { className: "sc-button sc-button-secondary sc-button-sm", href: settingsHref("workspace"), children: words.common.edit }))] }), _jsx(WorkspaceSettingsView, { workspace: workspace, console: data.me?.console })] })), workspace !== undefined && (_jsxs("section", { className: "sc-panel", "aria-label": words.settings.services.aria, children: [_jsxs("div", { className: "sc-section-head", children: [_jsx("h2", { className: "sc-section-title", children: words.settings.services.title }), administrator && (_jsx("a", { className: "sc-button sc-button-secondary sc-button-sm", href: settingsHref("services"), children: words.common.edit }))] }), _jsx("p", { className: "sc-settings-hint", children: words.settings.services.intro }), _jsx(WorkspaceServicesView, { workspace: workspace })] })), _jsxs("section", { className: "sc-panel", "aria-label": words.rules.title, children: [_jsx("h2", { className: "sc-section-title", children: words.rules.title }), rules === undefined ? (_jsx(Spinner, { label: words.rules.loading })) : (_jsx(RulesView, { rules: rules, scope: "workspace", editHref: administrator ? settingsHref("rules") : undefined, onArchive: administrator
811
892
  ? () => void act(async () => {
812
893
  setRules(await data.actions.archiveRules());
813
894
  })
@@ -874,9 +955,32 @@ const shownBefore = new Map();
874
955
  function rememberedAs(key) {
875
956
  return shownBefore.get(key);
876
957
  }
958
+ /** How long an answer asked for early stands for the page's own; past it, the page reads anew. */
959
+ const EARLY_FRESH_MS = 30_000;
960
+ /**
961
+ * What the page the console opened on asked for along with who is signed in, by the name the
962
+ * page takes it under: its own data a round trip sooner than once the person and the workspace
963
+ * are known. Taken once, by the page it was asked for.
964
+ */
965
+ const askedEarly = new Map();
966
+ function askEarly(name, ask) {
967
+ if (!askedEarly.has(name)) {
968
+ const answer = ask();
969
+ answer.catch(() => undefined);
970
+ askedEarly.set(name, { answer, at: Date.now() });
971
+ }
972
+ }
973
+ /** The answer asked for early under the name, once, while it is fresh; nothing otherwise. */
974
+ function takeEarly(name) {
975
+ const asked = askedEarly.get(name);
976
+ askedEarly.delete(name);
977
+ return asked !== undefined && Date.now() - asked.at <= EARLY_FRESH_MS
978
+ ? asked.answer
979
+ : undefined;
980
+ }
877
981
  function PlatePage(props) {
878
982
  const words = useWords();
879
- const { components, load, couldNotLoad, refused, remember } = props;
983
+ const { components, load, couldNotLoad, refused, remember, early } = props;
880
984
  const [plate, setPlate] = useState(() => rememberedAs(remember));
881
985
  const [problem, setProblem] = useState(undefined);
882
986
  const [forbidden, setForbidden] = useState(false);
@@ -885,7 +989,9 @@ function PlatePage(props) {
885
989
  setPlate(rememberedAs(remember));
886
990
  setProblem(undefined);
887
991
  setForbidden(false);
888
- load(controller.signal)
992
+ // What was asked for as the console opened is taken; else the plate is read now.
993
+ const asked = early === undefined ? undefined : takeEarly(early);
994
+ (asked === undefined ? load(controller.signal) : asked.catch(() => load(controller.signal)))
889
995
  .then((answer) => {
890
996
  if (!controller.signal.aborted) {
891
997
  shownBefore.set(remember, answer);
@@ -906,8 +1012,8 @@ function PlatePage(props) {
906
1012
  }
907
1013
  });
908
1014
  return () => controller.abort();
909
- }, [load, couldNotLoad, refused, remember]);
910
- return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "sc-page-head", children: [_jsx("h1", { className: "sc-page-title", children: props.title }), props.aside] }), problem !== undefined && _jsx(Callout, { tone: "danger", children: problem }), forbidden && refused !== undefined ? (_jsx(EmptyState, { title: refused.title, body: refused.body, action: _jsx(LinkButton, { href: PATHS.work, children: words.nav.work }) })) : plate === undefined ? (problem === undefined && (_jsx("div", { className: "sc-loading", children: _jsx(Spinner, { label: props.loading }) }))) : plate.tasks.length === 0 &&
1015
+ }, [load, couldNotLoad, refused, remember, early]);
1016
+ return (_jsxs(_Fragment, { children: [props.headless !== true && (_jsxs("div", { className: "sc-page-head", children: [_jsx("h1", { className: "sc-page-title", children: props.title }), props.lead !== undefined && _jsx("p", { className: "sc-page-lead", children: props.lead }), props.aside] })), problem !== undefined && _jsx(Callout, { tone: "danger", children: problem }), forbidden && refused !== undefined ? (_jsx(EmptyState, { title: refused.title, body: refused.body, action: _jsx(LinkButton, { href: PATHS.work, children: words.nav.work }) })) : plate === undefined ? (problem === undefined && (_jsx("div", { className: "sc-loading", children: _jsx(Spinner, { label: props.loading }) }))) : plate.tasks.length === 0 &&
911
1017
  (plate.closed?.length ?? 0) === 0 &&
912
1018
  (plate.decisions?.length ?? 0) === 0 ? (_jsx(EmptyState, { title: props.empty.title, body: props.empty.body })) : (_jsx(components.WorkList, { work: plate, week: props.week, weekStart: props.weekStart, taskHref: (projectKey, task) => taskHref(projectKey, task.number), decisionHref: (projectKey, decisionId) => decisionHref(projectKey, decisionId), weekHref: props.weekHref }))] }));
913
1019
  }
@@ -920,7 +1026,7 @@ function PlatePage(props) {
920
1026
  function MyDecisionPage(props) {
921
1027
  const words = useWords();
922
1028
  const { id, data } = props;
923
- const { reachDecision, answerReachedDecision } = data.actions;
1029
+ const { reachDecision, answerReachedDecision, addressDecisionIn, membersOf } = data.actions;
924
1030
  const [reached, setReached] = useState(undefined);
925
1031
  const [problem, setProblem] = useState(undefined);
926
1032
  const { busy, error, act } = useAction();
@@ -944,7 +1050,14 @@ function MyDecisionPage(props) {
944
1050
  return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "sc-page-head", children: [_jsx("h1", { className: "sc-page-title", children: words.decisions.one }), _jsx(LinkButton, { href: PATHS.decisions, children: words.myDecisions.title })] }), shown !== undefined && _jsx(Callout, { tone: "danger", children: shown }), reached === undefined ? (shown === undefined && (_jsx("div", { className: "sc-loading", children: _jsx(Spinner, { label: words.myDecisions.loading }) }))) : (_jsx(ReachedDecision, { reached: reached, onAnswer: (_decision, input) => void act(async () => {
945
1051
  const answered = await answerReachedDecision(id, input);
946
1052
  setReached((current) => current === undefined ? current : { ...current, decision: answered });
947
- }), busy: busy }))] }));
1053
+ }), addressing: {
1054
+ people: () => membersOf(reached.project.key),
1055
+ me: data.me?.person ?? undefined,
1056
+ onAddress: (_decision, deciders) => void act(async () => {
1057
+ const addressed = await addressDecisionIn(reached.project.key, id, deciders.map((person) => person.id));
1058
+ setReached((current) => current === undefined ? current : { ...current, decision: addressed });
1059
+ }),
1060
+ }, busy: busy }))] }));
948
1061
  }
949
1062
  /** What is on the person's own plate, across their projects. */
950
1063
  /** How many of a person's decisions are read at a time. */
@@ -959,7 +1072,12 @@ remember) {
959
1072
  const read = useCallback(async (offset, signal) => {
960
1073
  setBusy(true);
961
1074
  try {
962
- const page = await myDecisions({ raised, limit: MY_DECISIONS_PAGE, offset }, signal);
1075
+ const ask = () => myDecisions({ raised, limit: MY_DECISIONS_PAGE, offset }, signal);
1076
+ // The first page may have been asked for as the console opened: taken, else read now.
1077
+ const asked = offset === 0
1078
+ ? takeEarly(`decisions:${raised ? "raised" : "addressed"}`)
1079
+ : undefined;
1080
+ const page = asked === undefined ? await ask() : await asked.catch(ask);
963
1081
  if (signal?.aborted === true) {
964
1082
  return;
965
1083
  }
@@ -999,7 +1117,7 @@ remember) {
999
1117
  */
1000
1118
  function MyDecisionsPage(props) {
1001
1119
  const words = useWords();
1002
- const { myDecisions, answerReachedDecision } = props.data.actions;
1120
+ const { myDecisions, answerReachedDecision, addressDecisionIn, membersOf } = props.data.actions;
1003
1121
  const whose = props.data.me?.person?.id ?? "";
1004
1122
  const addressed = useMyDecisions(myDecisions, false, words.myDecisions.couldNotLoad, `decisions:${whose}:addressed`);
1005
1123
  const raised = useMyDecisions(myDecisions, true, words.myDecisions.couldNotLoad, `decisions:${whose}:raised`);
@@ -1015,12 +1133,20 @@ function MyDecisionsPage(props) {
1015
1133
  });
1016
1134
  return (_jsxs(_Fragment, { children: [_jsx("div", { className: "sc-page-head", children: _jsx("h1", { className: "sc-page-title", children: words.myDecisions.title }) }), problem !== undefined && _jsx(Callout, { tone: "danger", children: problem }), addressed.items === undefined || raised.items === undefined ? (problem === undefined && (_jsx("div", { className: "sc-loading", children: _jsx(Spinner, { label: words.myDecisions.loading }) }))) : addressed.items.length === 0 && raised.items.length === 0 ? (_jsx(EmptyState, { title: words.myDecisions.empty.title, body: words.myDecisions.empty.body })) : (_jsx(MyDecisions, { addressed: { items: addressed.items, more: addressed.more, onMore: addressed.readMore }, raised: { items: raised.items, more: raised.more, onMore: raised.readMore }, decisionHref: (projectKey, decisionId) => props.data.projects.some((project) => project.key === projectKey)
1017
1135
  ? decisionHref(projectKey, decisionId)
1018
- : myDecisionHref(decisionId), onAnswer: onAnswer, busy: busy || addressed.busy || raised.busy }))] }));
1136
+ : myDecisionHref(decisionId), onAnswer: onAnswer, addressing: (projectKey) => ({
1137
+ people: () => membersOf(projectKey),
1138
+ me: props.data.me?.person ?? undefined,
1139
+ onAddress: (decision, deciders) => void act(async () => {
1140
+ await addressDecisionIn(projectKey, decision.id, deciders.map((person) => person.id));
1141
+ addressed.reload();
1142
+ raised.reload();
1143
+ }),
1144
+ }), busy: busy || addressed.busy || raised.busy }))] }));
1019
1145
  }
1020
1146
  function WorkPage(props) {
1021
1147
  const words = useWords();
1022
- const { work } = props.data.actions;
1023
- return (_jsx(PlatePage, { components: props.components, load: work, remember: `work:${props.data.me?.person?.id ?? ""}`, title: words.work.title, week: props.week, weekStart: weekStartOf(props.data.me?.workspace), weekHref: workHref, loading: words.work.loading, couldNotLoad: words.work.couldNotLoad, empty: words.work.empty }));
1148
+ const { plate } = props.data.actions;
1149
+ return (_jsxs(_Fragment, { children: [_jsx(AgentsNeedingYou, { agents: props.data.agents, me: props.data.me?.person?.id }), _jsx(PlatePage, { components: props.components, load: plate, remember: `work:${props.data.me?.person?.id ?? ""}`, early: "work", title: words.work.title, week: props.week, weekStart: weekStartOf(props.data.me?.workspace), weekHref: workHref, loading: words.work.loading, couldNotLoad: words.work.couldNotLoad, empty: words.work.empty })] }));
1024
1150
  }
1025
1151
  /** Another person's plate, for whoever oversees them: an administrator, or an owner of a project they are in. */
1026
1152
  function PersonWorkPage(props) {
@@ -1028,13 +1154,87 @@ function PersonWorkPage(props) {
1028
1154
  const { id, data } = props;
1029
1155
  const person = data.people.find((candidate) => candidate.id === id);
1030
1156
  const name = person === undefined ? "?" : personName(person);
1031
- const { personWork } = data.actions;
1032
- const load = useCallback((signal) => personWork(id, signal), [personWork, id]);
1033
- return (_jsx(PlatePage, { components: props.components, load: load, remember: `work:${data.me?.person?.id ?? ""}:${id}`, title: words.people.workOf(name), aside: _jsx(LinkButton, { href: PATHS.people, children: words.nav.people }), week: props.week, weekStart: weekStartOf(data.me?.workspace), weekHref: (day) => personWorkHref(id, day), loading: words.people.loadingWork, couldNotLoad: words.people.couldNotLoadWork, empty: { title: words.people.noWork.title(name), body: words.people.noWork.body }, refused: words.people.notOverseen }));
1157
+ const { personPlate } = data.actions;
1158
+ const load = useCallback((signal) => personPlate(id, signal), [personPlate, id]);
1159
+ return (_jsx(PlatePage, { components: props.components, load: load, remember: `work:${data.me?.person?.id ?? ""}:${id}`, title: words.people.workOf(name), lead: person?.title ?? undefined, aside: _jsx(LinkButton, { href: PATHS.people, children: words.nav.people }), week: props.week, weekStart: weekStartOf(data.me?.workspace), weekHref: (day) => personWorkHref(id, day), loading: words.people.loadingWork, couldNotLoad: words.people.couldNotLoadWork, empty: { title: words.people.noWork.title(name), body: words.people.noWork.body }, refused: words.people.notOverseen }));
1160
+ }
1161
+ /** An agent account's plate on its own page (ADR-0084): its work as a member's, for whoever oversees it. */
1162
+ function AgentWork(props) {
1163
+ const words = useWords();
1164
+ const { agent, data } = props;
1165
+ const { id } = agent.person;
1166
+ const handle = agent.person.handle ?? "";
1167
+ const name = personName(agent.person);
1168
+ const { personPlate } = data.actions;
1169
+ const load = useCallback((signal) => personPlate(id, signal), [personPlate, id]);
1170
+ return (_jsx(PlatePage, { components: props.components, load: load, remember: `work:${data.me?.person?.id ?? ""}:${id}`, title: words.people.workOf(name), headless: true, week: props.week, weekStart: weekStartOf(data.me?.workspace), weekHref: (day) => agentWorkHref(handle, day), loading: words.people.loadingWork, couldNotLoad: words.people.couldNotLoadWork, empty: { title: words.people.noWork.title(name), body: words.people.noWork.body }, refused: words.people.notOverseen }));
1171
+ }
1172
+ /** Seeds of the page's own for personas proposed here: twelve characters nobody chose, each. */
1173
+ function freshSeeds(count) {
1174
+ const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
1175
+ const bytes = crypto.getRandomValues(new Uint8Array(count * 12));
1176
+ return Array.from({ length: count }, (_, index) => Array.from(bytes.subarray(index * 12, (index + 1) * 12), (byte) => alphabet[byte % alphabet.length]).join(""));
1177
+ }
1178
+ /** How many personas the form proposes at a time. */
1179
+ const PROPOSALS_SHOWN = 4;
1180
+ /**
1181
+ * "Add an agent account" (ADR-0084), for an administrator: a few personas proposed, by the
1182
+ * console, or from the names a console of one's own brings; the form; and back to the accounts
1183
+ * once one is made.
1184
+ */
1185
+ function NewAgentPage(props) {
1186
+ const words = useWords();
1187
+ const accounts = words.agents.accounts;
1188
+ const { data, components, navigation, language, names, avatarSets } = props;
1189
+ const { busy, error, act } = useAction();
1190
+ const [proposals, setProposals] = useState([]);
1191
+ /** Whether the proposals asked for last could not be read: the form says so, and is filled in by hand. */
1192
+ const [proposalsFailed, setProposalsFailed] = useState(false);
1193
+ const [round, setRound] = useState(0);
1194
+ const { agentProposals } = data.actions;
1195
+ const taken = data.agents.map((agent) => agent.person.handle ?? "").join(" ");
1196
+ const me = data.me?.person ?? undefined;
1197
+ const administrator = me?.role === "admin";
1198
+ // biome-ignore lint/correctness/useExhaustiveDependencies: `round` is the trigger, rolled again by the form
1199
+ useEffect(() => {
1200
+ if (!administrator) {
1201
+ return;
1202
+ }
1203
+ if (names !== undefined) {
1204
+ // A console that brings names of its own proposes from them here, as the console does.
1205
+ setProposals(proposeAgents(freshSeeds(PROPOSALS_SHOWN), {
1206
+ names,
1207
+ lang: language,
1208
+ taken: taken.split(" "),
1209
+ sets: avatarSets,
1210
+ }));
1211
+ return;
1212
+ }
1213
+ const controller = new AbortController();
1214
+ setProposalsFailed(false);
1215
+ agentProposals(PROPOSALS_SHOWN, language, controller.signal)
1216
+ .then((answer) => {
1217
+ if (!controller.signal.aborted) {
1218
+ setProposals(answer.items);
1219
+ }
1220
+ })
1221
+ .catch(() => {
1222
+ if (!controller.signal.aborted) {
1223
+ setProposalsFailed(true);
1224
+ }
1225
+ });
1226
+ return () => controller.abort();
1227
+ }, [round, administrator, names, avatarSets, language, taken, agentProposals]);
1228
+ return (_jsxs(_Fragment, { children: [_jsx("div", { className: "sc-page-head", children: _jsx("h1", { className: "sc-page-title", children: accounts.add }) }), !administrator ? (_jsx(Callout, { tone: "warning", children: words.errors["auth.forbidden"] })) : (_jsx("section", { className: "sc-panel sc-panel-form", "aria-label": accounts.add, children: _jsx(components.AgentAccountForm, { proposals: proposals, proposalsFailed: proposalsFailed, onRoll: () => setRound((current) => current + 1), providers: data.me?.signIn ?? [], workspace: data.me?.workspace, people: data.people, me: me, projects: data.projects, busy: busy, error: error, onSubmit: (input) => void act(async () => {
1229
+ await data.actions.createAgent(input);
1230
+ // To the account's page, which says what is next: the invitation that leads a
1231
+ // machine to it, made there.
1232
+ navigation.replace(agentHref(input.handle));
1233
+ }), onCancel: () => navigation.back(PATHS.agents) }) }))] }));
1034
1234
  }
1035
1235
  function WorkspacePage(props) {
1036
1236
  const words = useWords();
1037
- const { route, data, components, navigation, client, language } = props;
1237
+ const { route, data, components, navigation, client, language, persona } = props;
1038
1238
  const [fresh, setFresh] = useState(undefined);
1039
1239
  const { busy, error, act } = useAction();
1040
1240
  if (route.name === "plugin" && route.level === "workspace") {
@@ -1116,13 +1316,13 @@ function WorkspacePage(props) {
1116
1316
  ? (person, managerId) => void act(() => data.actions.updatePerson(person.id, { managerId }))
1117
1317
  : undefined, onChangeEmail: administrator
1118
1318
  ? (person, email) => void act(() => data.actions.updatePerson(person.id, { email }))
1119
- : undefined, onUnlist: administrator
1319
+ : undefined, onChangeTitle: (person, title) => void act(() => data.actions.updatePerson(person.id, { title })), mayChangeTitle: (person) => administrator || supervisedBy(me, person, data.people), onUnlist: administrator
1120
1320
  ? (listing) => void act(() => data.actions.removeListing(listing.id))
1121
1321
  : undefined, teams: data.teams, onJoinTeam: administrator
1122
1322
  ? (person, team) => void act(() => data.actions.addTeamMember(team.key, person.id))
1123
1323
  : undefined, onLeaveTeam: administrator
1124
1324
  ? (person, team) => void act(() => data.actions.removeTeamMember(team.key, person.id))
1125
- : undefined, workHref: oversees ? (person) => personWorkHref(person.id) : undefined, agentsHref: administrator ? (person) => personAgentsHref(person.id) : undefined }))] }));
1325
+ : undefined, workHref: oversees ? (person) => personWorkHref(person.id) : undefined, agentsHref: administrator ? (person) => personAgentsHref(person.id) : undefined, agentHref: (person) => agentHref(person.handle ?? "") }))] }));
1126
1326
  }
1127
1327
  if (route.name === "person-agents") {
1128
1328
  return _jsx(PersonAgentsPage, { id: route.id, data: data, components: components });
@@ -1130,14 +1330,48 @@ function WorkspacePage(props) {
1130
1330
  if (route.name === "connect") {
1131
1331
  return _jsx(ConnectPage, { code: route.code, data: data, navigation: navigation });
1132
1332
  }
1333
+ if (route.name === "agent") {
1334
+ return (_jsx(AgentPage
1335
+ // Keyed by the account, so that going from one account to another by the browser's
1336
+ // history begins a page of its own: no name, title or hours of the one in the other's fields.
1337
+ , { handle: route.handle, tab: route.tab, session: route.session, client: client, viaToken: holdsToken(data), providers: data.me?.signIn, work: (agent) => (_jsx(AgentWork, { agent: agent, data: data, components: components, week: route.week })) }, route.handle));
1338
+ }
1339
+ if (route.name === "new-agent") {
1340
+ return (_jsx(NewAgentPage, { data: data, components: components, navigation: navigation, language: language, names: persona?.names, avatarSets: persona?.avatarSets }));
1341
+ }
1133
1342
  if (route.name === "agents" || route.name === "new-token") {
1134
1343
  const agents = words.agents;
1344
+ const accounts = agents.accounts;
1135
1345
  const making = route.name === "new-token";
1136
1346
  const origin = typeof window === "undefined" ? "" : window.location.origin;
1137
- return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "sc-page-head", children: [_jsx("h1", { className: "sc-page-title", children: agents.title }), !making && (_jsx(LinkButton, { href: PATHS.newToken, variant: "primary", children: agents.makeByHand }))] }), error !== undefined && _jsx(Callout, { tone: "danger", children: error }), fresh !== undefined && (_jsx(NewToken, { token: fresh.token, secret: fresh.secret, onDone: () => setFresh(undefined) })), making && (_jsx("section", { className: "sc-panel sc-panel-form", "aria-label": agents.makeAria, children: _jsx(TokenForm, { daysAtMost: data.me?.workspace.tokenDaysAtMost, busy: busy, onSubmit: (input) => void act(async () => {
1138
- setFresh(await data.actions.createToken(input));
1139
- navigation.replace(PATHS.agents);
1140
- }), onCancel: () => navigation.back(PATHS.agents) }) })), _jsx(components.TokenList, { tokens: data.tokens, busy: busy, consoleVersion: data.me?.console?.version, onRevoke: (token) => void act(() => data.actions.revokeToken(token.id)), empty: _jsx(EmptyState, { title: agents.empty.title, body: agents.empty.body }) }), _jsx(ConnectWords, { origin: origin })] }));
1347
+ const me = data.me?.person ?? undefined;
1348
+ const administrator = me?.role === "admin";
1349
+ // A console held through a token shows no tokens: the agents that act as a person are
1350
+ // listed where that person is signed in.
1351
+ const viaToken = holdsToken(data);
1352
+ const view = making ? "connected" : route.view;
1353
+ // The agent accounts (ADR-0084) whoever is looking manages, theirs to look after, and
1354
+ // under them, for an administrator, the ones someone else manages.
1355
+ const { managed: mine, others } = agentAccountGroups(data.agents, me, data.people);
1356
+ const views = [
1357
+ { view: "mine", label: agents.views.mine, count: mine.length },
1358
+ ...(viaToken
1359
+ ? []
1360
+ : [
1361
+ {
1362
+ view: "connected",
1363
+ label: agents.views.connected,
1364
+ count: data.tokens.length,
1365
+ },
1366
+ ]),
1367
+ ];
1368
+ if (view === "connected" && viaToken) {
1369
+ return _jsx(NothingHere, {});
1370
+ }
1371
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "sc-page-head", children: [_jsx("h1", { className: "sc-page-title", children: agents.title }), view !== "connected" && administrator && (_jsx(LinkButton, { href: PATHS.newAgent, variant: "primary", children: accounts.add })), view === "connected" && !making && (_jsx(LinkButton, { href: PATHS.newToken, variant: "primary", children: agents.makeByHand }))] }), _jsx("nav", { className: "sc-subtabs sc-agents-views", "aria-label": agents.views.aria, children: views.map((one) => (_jsxs("a", { className: cx("sc-tab", one.view === view && "sc-tab-current"), href: agentsHref(one.view), "aria-current": one.view === view ? "page" : undefined, children: [one.label, _jsx("span", { className: "sc-tab-count", children: one.count })] }, one.view))) }), error !== undefined && _jsx(Callout, { tone: "danger", children: error }), view !== "connected" ? (_jsxs(_Fragment, { children: [_jsxs("section", { className: "sc-people-group", "aria-label": agents.views.mine, children: [_jsx("p", { className: "sc-lead", children: accounts.intro }), _jsx(components.AgentAccountList, { agents: mine, me: me, busy: busy, href: (agent) => agentHref(agent.person.handle ?? ""), empty: others.length > 0 ? (_jsx("p", { className: "sc-field-hint", children: accounts.mineEmpty.title })) : administrator ? (_jsx(EmptyState, { title: accounts.empty.title, body: accounts.empty.body })) : (_jsx(EmptyState, { title: accounts.mineEmpty.title, body: accounts.mineEmpty.body, action: _jsx(LinkButton, { href: PATHS.people, children: words.nav.people }) })) })] }), others.length > 0 && (_jsxs("section", { className: "sc-people-group", "aria-label": accounts.others, children: [_jsxs("h2", { className: "sc-section-title", children: [accounts.others, _jsx(Badge, { kind: "count", children: others.length })] }), _jsx("p", { className: "sc-lead", children: accounts.othersIntro }), _jsx(components.AgentAccountList, { agents: others, me: me, busy: busy, href: (agent) => agentHref(agent.person.handle ?? "") })] }))] })) : (_jsxs("section", { "aria-label": agents.views.connected, children: [_jsx("p", { className: "sc-lead", children: accounts.yoursIntro }), fresh !== undefined && (_jsx(NewToken, { token: fresh.token, secret: fresh.secret, onDone: () => setFresh(undefined) })), making && (_jsx("section", { className: "sc-panel sc-panel-form", "aria-label": agents.makeAria, children: _jsx(TokenForm, { daysAtMost: data.me?.workspace.tokenDaysAtMost, busy: busy, onSubmit: (input) => void act(async () => {
1372
+ setFresh(await data.actions.createToken(input));
1373
+ navigation.replace(agentsHref("connected"));
1374
+ }), onCancel: () => navigation.back(agentsHref("connected")) }) })), _jsx(components.TokenList, { tokens: data.tokens, busy: busy, consoleVersion: data.me?.console?.version, onRevoke: (token) => void act(() => data.actions.revokeToken(token.id)), empty: _jsx(EmptyState, { title: agents.empty.title, body: agents.empty.body }) }), _jsx(ConnectWords, { origin: origin }), _jsx(DeskWords, { origin: origin })] }))] }));
1141
1375
  }
1142
1376
  return _jsx(NothingHere, {});
1143
1377
  }
@@ -1149,6 +1383,8 @@ export function createConsole(config = {}) {
1149
1383
  const fallbackTitle = config.title ?? "Console";
1150
1384
  const languages = config.languages ?? DEFAULT_LANGUAGES;
1151
1385
  const pages = config.pages ?? [];
1386
+ /** The shapes the avatars of agent accounts are drawn from here (ADR-0084): the package's, unless this console brings its own. */
1387
+ const avatarSets = config.persona?.avatarSets ?? AVATAR_SETS;
1152
1388
  // 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.
1153
1389
  function App(props) {
1154
1390
  const { location, navigation } = useNavigation(props.initialPath);
@@ -1156,6 +1392,19 @@ export function createConsole(config = {}) {
1156
1392
  const route = useMemo(() => matchRoute(location.pathname, location.search), [location.pathname, location.search]);
1157
1393
  const projectKey = projectOf(route);
1158
1394
  const data = useConsoleData(client, projectKey);
1395
+ // The page the console opens on asks for its own data along with who is signed in, which
1396
+ // useConsoleData asks for in the same breath, rather than once that answer has come: a
1397
+ // round trip fewer before the page stands.
1398
+ // biome-ignore lint/correctness/useExhaustiveDependencies: the page the console opened on, once
1399
+ useEffect(() => {
1400
+ if (route.name === "work") {
1401
+ askEarly("work", () => client.plate());
1402
+ }
1403
+ else if (route.name === "my-decisions") {
1404
+ askEarly("decisions:addressed", () => client.myDecisions({ limit: MY_DECISIONS_PAGE, offset: 0 }));
1405
+ askEarly("decisions:raised", () => client.myDecisions({ raised: true, limit: MY_DECISIONS_PAGE, offset: 0 }));
1406
+ }
1407
+ }, []);
1159
1408
  const failure = signInFailureOf(location.search);
1160
1409
  const title = data.me?.workspace.name ?? fallbackTitle;
1161
1410
  const viaToken = holdsToken(data);
@@ -1179,14 +1428,20 @@ export function createConsole(config = {}) {
1179
1428
  }, [route, navigation]);
1180
1429
  useEffect(() => {
1181
1430
  if (typeof document !== "undefined") {
1182
- document.title = data.project === undefined ? title : `${data.project.name} · ${title}`;
1183
1431
  document.documentElement.lang = pack.tag;
1184
1432
  }
1185
- }, [title, data.project, pack.tag]);
1433
+ }, [pack.tag]);
1434
+ /** The tab the page shown is under, once the tabs are known. */
1435
+ let here;
1186
1436
  let content;
1187
1437
  if (data.me === undefined) {
1188
1438
  content = (_jsx(Ground, { children: _jsx("div", { className: "sc-loading", children: data.error === undefined ? (_jsx(Spinner, { label: words.common.loading })) : (_jsx(Callout, { tone: "danger", title: words.common.couldNotReach, action: _jsx(Button, { onClick: data.reload, children: words.common.tryAgain }), children: errorWords(data.failure, data.error, words) })) }) }));
1189
1439
  }
1440
+ else if (route.name === "setup") {
1441
+ // What an invitation's code opens is read without a sign-in (ADR-0088): the guide, and
1442
+ // nothing else of the console.
1443
+ content = (_jsx(Ground, { children: _jsx(SetupPage, { client: client, code: route.code }) }));
1444
+ }
1190
1445
  else if (data.me.person === null) {
1191
1446
  content = (_jsx(Ground, { children: _jsx(components.SignIn, { title: title, brand: config.brand, providers: data.me.signIn, returnTo: withoutSignInParam(location.pathname, location.search), failure: failure }) }));
1192
1447
  }
@@ -1215,15 +1470,14 @@ export function createConsole(config = {}) {
1215
1470
  route.name === "new-team" ||
1216
1471
  route.name === "person-agents",
1217
1472
  },
1218
- ...(viaToken
1219
- ? []
1220
- : [
1221
- {
1222
- href: PATHS.agents,
1223
- label: words.nav.agents,
1224
- current: route.name === "agents" || route.name === "new-token",
1225
- },
1226
- ]),
1473
+ {
1474
+ href: PATHS.agents,
1475
+ label: words.nav.agents,
1476
+ current: route.name === "agents" ||
1477
+ route.name === "new-token" ||
1478
+ route.name === "new-agent" ||
1479
+ route.name === "agent",
1480
+ },
1227
1481
  ...pages
1228
1482
  .filter((candidate) => candidate.level === "workspace")
1229
1483
  .map((candidate) => ({
@@ -1328,10 +1582,19 @@ export function createConsole(config = {}) {
1328
1582
  current: route.name === "settings",
1329
1583
  },
1330
1584
  ];
1585
+ here = currentTab(nav);
1331
1586
  /** A page of the console's own at the address, or nothing there. */
1332
1587
  const customPageOf = (key, level) => {
1333
1588
  const found = pages.find((candidate) => candidate.key === key && candidate.level === level);
1334
- return found === undefined ? (_jsx(NothingHere, {})) : (found.render({ data, project, client, navigation, words, language: pack.tag }));
1589
+ return found === undefined ? (_jsx(NothingHere, {})) : (found.render({
1590
+ data,
1591
+ project,
1592
+ client,
1593
+ navigation,
1594
+ search: location.search,
1595
+ words,
1596
+ language: pack.tag,
1597
+ }));
1335
1598
  };
1336
1599
  let page;
1337
1600
  if (!data.loaded || route.name === "moved") {
@@ -1347,7 +1610,7 @@ export function createConsole(config = {}) {
1347
1610
  page = customPageOf(route.page, "workspace");
1348
1611
  }
1349
1612
  else if (projectKey === undefined) {
1350
- page = (_jsx(WorkspacePage, { route: route, data: data, components: components, navigation: navigation, client: client, language: pack.tag }));
1613
+ page = (_jsx(WorkspacePage, { route: route, data: data, components: components, navigation: navigation, client: client, language: pack.tag, persona: config.persona }));
1351
1614
  }
1352
1615
  else if (data.projectError !== undefined) {
1353
1616
  page = (_jsx(EmptyState, { title: words.common.noSuchProject.title, body: words.common.noSuchProject.body, action: _jsx(LinkButton, { href: PATHS.projects, children: words.nav.projects }) }));
@@ -1386,7 +1649,18 @@ export function createConsole(config = {}) {
1386
1649
  void data.actions.signOut();
1387
1650
  }, children: page }));
1388
1651
  }
1389
- return (_jsx(LanguageContext.Provider, { value: pack, children: _jsx(RemotePicturesContext.Provider, { value: pictureSrc, children: content }) }));
1652
+ // The browser's tab is called after the page it shows. It is said again at every address,
1653
+ // not only when the words change: a plugin's page may name the tab itself (the frame's
1654
+ // `title`), and that name must not outlive the page.
1655
+ const tab = tabTitle([here, data.project?.name, title]);
1656
+ const address = `${location.pathname}${location.search}`;
1657
+ // biome-ignore lint/correctness/useExhaustiveDependencies: the address is why it is said again
1658
+ useEffect(() => {
1659
+ if (typeof document !== "undefined") {
1660
+ document.title = tab;
1661
+ }
1662
+ }, [tab, address]);
1663
+ return (_jsx(LanguageContext.Provider, { value: pack, children: _jsx(RemotePicturesContext.Provider, { value: pictureSrc, children: _jsx(AvatarSetsContext.Provider, { value: avatarSets, children: content }) }) }));
1390
1664
  }
1391
1665
  return {
1392
1666
  App,