@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
@@ -1,4 +1,6 @@
1
+ import { createHash } from "node:crypto";
1
2
  import { argUsage } from "../plugin/args.js";
3
+ import { reportCountOf } from "../schemas.js";
2
4
  // What the command prints: one line per thing in a list, a few lines for one thing in full.
3
5
  // Plain text, for an agent to read and a person to skim; ids are given, since the commands take
4
6
  // them, and the words are the vocabulary's own, since the options take those.
@@ -48,8 +50,8 @@ const indent = (text) => text
48
50
  .map((line) => ` ${line}`)
49
51
  .join("\n");
50
52
  const asker = (decision) => decision.run === null
51
- ? decision.raisedBy.login
52
- : `${decision.run.agent} for ${decision.raisedBy.login}`;
53
+ ? calledOf(decision.raisedBy)
54
+ : `${decision.run.agent} for ${calledOf(decision.raisedBy)}`;
53
55
  /** One project: its key, its name, what the person is in it, and what waits in it. */
54
56
  export function formatProjectLine(project) {
55
57
  const notes = [project.role];
@@ -73,13 +75,130 @@ export function formatProject(project) {
73
75
  }
74
76
  /** One person: their login, their name where the host gives one, what they are in the workspace, that they are out when they are, and whom they report to where known. */
75
77
  export function formatPersonLine(person, reportsTo) {
76
- const standing = person.status === "active" ? person.role : `${person.role}, deactivated`;
78
+ // An agent account says so, and that nobody has signed in with it yet (ADR-0084).
79
+ const standing = [
80
+ ...(person.kind === "agent" ? ["agent account"] : []),
81
+ person.role,
82
+ ...(person.status === "active" ? [] : ["deactivated"]),
83
+ ...(person.invited === true ? ["not signed in yet"] : []),
84
+ ].join(", ");
77
85
  const line = reportsTo === undefined ? "" : `, reports to ${reportsTo}`;
78
86
  // The work email where the console answers one: to an administrator, and for oneself.
79
87
  const email = typeof person.email === "string" ? ` <${person.email}>` : "";
80
- return person.name === null
81
- ? `${person.login}${email} (${standing}${line})`
82
- : `${person.login} ${person.name}${email} (${standing}${line})`;
88
+ // Called by its handle too, where it has one; and by what they do, where a title says.
89
+ const who = typeof person.handle === "string" ? `${person.login} @${person.handle}` : person.login;
90
+ const called = [person.name, person.title].filter((word) => typeof word === "string" && word.length > 0);
91
+ return called.length === 0
92
+ ? `${who}${email} (${standing}${line})`
93
+ : `${who} ${called.join(", ")}${email} (${standing}${line})`;
94
+ }
95
+ /**
96
+ * One agent account (ADR-0084): its handle, its name and what it does, the login it signs in
97
+ * with, whom it reports to where the asker sees them, and that nobody signed in with it yet or
98
+ * that it is out, where so.
99
+ */
100
+ export function formatAgentLine(agent) {
101
+ const { person, manager } = agent;
102
+ const called = [person.name, person.title].filter((word) => typeof word === "string" && word.length > 0);
103
+ const standing = [
104
+ `signs in as ${person.login}`,
105
+ ...(manager === null ? [] : [`reports to ${calledOf(manager)}`]),
106
+ ...(person.invited === true
107
+ ? [
108
+ // At a git host, whether the host said which account the login is (ADR-0126).
109
+ agent.firstSignIn === undefined
110
+ ? "not signed in yet"
111
+ : agent.firstSignIn === "account"
112
+ ? "not signed in yet, its account confirmed at the host"
113
+ : "not signed in yet, its account not confirmed",
114
+ ]
115
+ : []),
116
+ ...(person.status === "active" ? [] : ["deactivated"]),
117
+ ].join(", ");
118
+ return `@${person.handle ?? person.login} ${called.join(", ")} (${standing})`;
119
+ }
120
+ /** What stands for a model or an effort nobody chose: whatever the product runs with by itself. */
121
+ const OWN_CHOICE = "the product's own";
122
+ /**
123
+ * One agent account in full: its line, how it stands, what its runner last said of itself and
124
+ * what was chosen for it, where the asker is answered that, and whether they supervise it.
125
+ */
126
+ export function formatAgent(agent) {
127
+ const runner = agent.runner ?? null;
128
+ return [
129
+ formatAgentLine(agent),
130
+ `state: ${formatAgentState(agent)}`,
131
+ ...(runner === null
132
+ ? []
133
+ : [
134
+ ...(runner.machine === null
135
+ ? []
136
+ : [
137
+ `runner: ${runner.runner ?? "?"} on ${runner.machine.name} (${runner.machine.os}), as ${runner.machine.user}`,
138
+ ]),
139
+ ...(runner.product === null
140
+ ? []
141
+ : [
142
+ `product: ${runner.product.name} ${runner.product.version ?? "of a version it did not say"}${runner.product.tried ? "" : ", a version the driver was not tried with"}`,
143
+ ]),
144
+ `set to: model ${runner.settings.model ?? OWN_CHOICE}, effort ${runner.settings.effort ?? OWN_CHOICE}`,
145
+ ...(runner.running === null
146
+ ? []
147
+ : [
148
+ `runs with: model ${runner.running.model ?? OWN_CHOICE}, effort ${runner.running.effort ?? OWN_CHOICE}`,
149
+ ]),
150
+ `signals: ${runner.delivered} of ${runner.latest} delivered`,
151
+ ]),
152
+ ...(agent.hours === undefined
153
+ ? []
154
+ : [
155
+ `day: starts ${agent.hours.dayStart}${agent.hours.dayEnd === null ? ", with no end" : `, ends ${agent.hours.dayEnd}`}, in the workspace's time zone`,
156
+ ]),
157
+ ...(agent.accounts === undefined || Object.keys(agent.accounts).length === 0
158
+ ? []
159
+ : [
160
+ `accounts elsewhere: ${Object.entries(agent.accounts)
161
+ .map(([service, name]) => `${service} ${name}`)
162
+ .join(", ")}`,
163
+ ]),
164
+ agent.supervised
165
+ ? "You supervise it: an administrator, or above it in the reporting line."
166
+ : "You do not supervise it.",
167
+ ].join("\n");
168
+ }
169
+ /** How an agent account stands (ADR-0085), in a few words: the state, why, and when its runner was last heard from. */
170
+ export function formatAgentState(agent) {
171
+ const state = agent.state ?? null;
172
+ if (state === null) {
173
+ return "no runner has been heard from yet";
174
+ }
175
+ const reason = state.reason === null ? "" : ` (${state.reason.replaceAll("_", " ")})`;
176
+ const heard = state.heardAt === null ? "" : `; its runner was last heard from ${moment(state.heardAt)}`;
177
+ return `${state.state}${reason} since ${moment(state.since)}${heard}`;
178
+ }
179
+ /**
180
+ * One signal of an agent account's record (ADR-0085): its number, its kind, who sent it or where
181
+ * it came from, when, and the first words of what it says.
182
+ */
183
+ export function formatSignalLine(signal) {
184
+ const who = signal.by === null
185
+ ? `${signal.source}${signal.key === null ? "" : `: ${signal.key}`}`
186
+ : `${calledOf(signal.by)}${signal.agent === null ? "" : ` through ${signal.agent}`}`;
187
+ const set = signal.set === null
188
+ ? ""
189
+ : ` model ${signal.set.model ?? OWN_CHOICE}, effort ${signal.set.effort ?? OWN_CHOICE}`;
190
+ const words = signal.text.replaceAll(/\s+/g, " ").trim();
191
+ const said = words.length === 0 ? "" : ` ${words.length > 120 ? `${words.slice(0, 119)}…` : words}`;
192
+ return `#${signal.number} ${signal.kind} ${who} ${moment(signal.at)}${set}${said}`;
193
+ }
194
+ /** One secret of an agent account's store (ADR-0087): its name, when it was set and by which side, and the day it ends on where one is known. Never its value. */
195
+ export function formatSecretLine(secret) {
196
+ const facts = [
197
+ `set ${moment(secret.setAt)}`,
198
+ ...(secret.seeded ? ["seeded by a supervisor"] : []),
199
+ ...(secret.expiresOn === null ? [] : [`ends on ${secret.expiresOn}`]),
200
+ ];
201
+ return `${secret.name} (${facts.join(", ")})`;
83
202
  }
84
203
  /** The provider a listing names, as people call it. */
85
204
  const HOST_NAMES = { gh: "GitHub", google: "Google" };
@@ -92,8 +211,18 @@ export function formatWorkspace(workspace) {
92
211
  const visibility = workspace.peopleVisibility ?? "everyone";
93
212
  const zone = workspace.timeZone ?? null;
94
213
  const token = workspace.skills.packToken ?? null;
214
+ const services = Object.entries(workspace.services ?? {}).filter((entry) => entry[1] !== undefined);
95
215
  return [
96
216
  `workspace ${workspace.name}`,
217
+ `handle: ${workspace.handle ?? "none"} domain: ${workspace.domain ?? "none"} (what a name at a service is put together from, with an agent account's handle)`,
218
+ ...(services.length === 0
219
+ ? ["services: none (what the agents' accounts are made at: identity, git, messenger)"]
220
+ : services.map(([role, service]) => `service ${role}: ${[
221
+ service.kind ?? "?",
222
+ ...Object.entries(service)
223
+ .filter(([name]) => name !== "kind")
224
+ .map(([name, value]) => `${name}=${value}`),
225
+ ].join(", ")}`)),
97
226
  `people visibility: ${visibility} (${visibility === "everyone" ? "everyone sees everyone" : "a member sees only the people they share a project with; an administrator sees everyone"})`,
98
227
  `week begins on: ${workspace.weekStart ?? "auto"} (auto: the system default, as each device has it)`,
99
228
  `time zone: ${zone ?? "none"} (${zone === null ? "moments are printed as the API gives them, in UTC" : "moments are printed in it, as ISO 8601 with its offset"})`,
@@ -105,16 +234,22 @@ export function formatWorkspace(workspace) {
105
234
  }
106
235
  /** One member of a project: their login, what they are in it, and since when. */
107
236
  export function formatMemberLine(member) {
108
- return `${member.person.login} ${member.role} (since ${moment(member.addedAt).slice(0, 10)})`;
237
+ return `${calledOf(member.person)} ${member.role} (since ${moment(member.addedAt).slice(0, 10)})`;
109
238
  }
110
239
  /** The line under a page of a listing that has more after it: how to ask for the next page. */
111
240
  export function formatMore(more, limit, offset) {
112
241
  return more ? `\n... more: --offset ${offset + limit}` : "";
113
242
  }
114
- /** The logins of the people at work on a task, in the order they came to it. */
115
- const logins = (people) => people.map((person) => person.login).join(", ");
243
+ /**
244
+ * What a member is called in a line: an agent account by its handle, `@mira`, which the command
245
+ * takes wherever it takes a login (ADR-0084), so that a line tells an agent account from a
246
+ * person; a person by their login.
247
+ */
248
+ export const calledOf = (person) => typeof person.handle === "string" ? `@${person.handle}` : person.login;
249
+ /** The members at work on a task as a line calls them, in the order they came to it. */
250
+ const logins = (people) => people.map(calledOf).join(", ");
116
251
  export function formatTaskLine(task) {
117
- const notes = [`owner ${task.owner.login}`];
252
+ const notes = [`owner ${calledOf(task.owner)}`];
118
253
  if (task.workers.length > 0) {
119
254
  notes.push(`workers ${logins(task.workers)}`);
120
255
  }
@@ -155,11 +290,14 @@ function scheduleLines(task) {
155
290
  return lines;
156
291
  }
157
292
  /** One task in full; with the decisions about it and the runs on it, when given. */
158
- export function formatTask(task, decisions, runs, comments) {
293
+ export function formatTask(task, decisions, runs, comments,
294
+ /** The address of the task's page at the console, where the command knows it: what a person is given to open. */
295
+ page) {
159
296
  const lines = [
160
297
  `#${task.number} ${task.title}`,
161
- `state: ${task.state} priority: ${task.priority} owner: ${task.owner.login} workers: ${task.workers.length === 0 ? "nobody" : logins(task.workers)}`,
298
+ `state: ${task.state} priority: ${task.priority} owner: ${calledOf(task.owner)} workers: ${task.workers.length === 0 ? "nobody" : logins(task.workers)}`,
162
299
  `id: ${task.id}${task.parentId === null ? "" : ` part of: ${task.parentId}`}`,
300
+ ...(page === undefined ? [] : [pageLine(page)]),
163
301
  ...(task.agent == null ? [] : [`written through: ${task.agent}`]),
164
302
  ...scheduleLines(task),
165
303
  ];
@@ -197,7 +335,9 @@ export function formatTask(task, decisions, runs, comments) {
197
335
  * when, the whole word, and each file put in it with the command that reads it.
198
336
  */
199
337
  export function formatComment(comment) {
200
- const who = comment.agent === null ? comment.author.login : `${comment.author.login} as ${comment.agent}`;
338
+ const who = comment.agent === null
339
+ ? calledOf(comment.author)
340
+ : `${calledOf(comment.author)} as ${comment.agent}`;
201
341
  const lines = [` ${who}, ${moment(comment.createdAt)}, comment ${comment.id}:`];
202
342
  if (comment.body.trim().length > 0) {
203
343
  lines.push(indent(comment.body));
@@ -208,14 +348,16 @@ export function formatComment(comment) {
208
348
  return lines.join("\n");
209
349
  }
210
350
  export function formatRunLine(run) {
211
- const notes = [plural(run.reports.length, "report"), plural(run.artifacts.length, "artifact")];
351
+ // A run of a listing comes without its reports, counted (`?brief=true`); a run read whole,
352
+ // or from a console from before the brief form, with them.
353
+ const notes = [plural(reportCountOf(run), "report"), plural(run.artifacts.length, "artifact")];
212
354
  if (run.waitingFor !== null) {
213
355
  notes.push(`waiting for decision ${run.waitingFor}`);
214
356
  }
215
357
  if (run.endedAt === null) {
216
358
  notes.push(`last heard ${moment(run.lastHeardAt)}`);
217
359
  }
218
- return `${run.id} ${run.status} ${run.agent} for ${run.person.login} task #${run.taskNumber} (${notes.join(", ")})`;
360
+ return `${run.id} ${run.status} ${run.agent} for ${calledOf(run.person)} task #${run.taskNumber} (${notes.join(", ")})`;
219
361
  }
220
362
  /** One run in full; with where each file handed in is read, when the caller knows. */
221
363
  export function formatRun(run, fileUrl) {
@@ -247,37 +389,151 @@ export function formatArtifact(artifact, fileUrl) {
247
389
  : `${artifact.file.name} (${artifact.file.size} bytes, ${artifact.file.contentType}${fileUrl === undefined ? "" : `; read at ${fileUrl(artifact.id)}`}; console file ${artifact.id})`;
248
390
  return artifact.label === null ? what : `${artifact.label}: ${what}`;
249
391
  }
250
- /** One half of the rules: where it comes from, and the text as it stands. */
251
- function formatRulesHalf(where, rules) {
252
- const page = rules.page;
253
- const facts = page === null
254
- ? undefined
255
- : `v${page.version}, by ${writer(page.updatedBy, page.agent)}; ${moment(page.updatedAt)}`;
256
- if (rules.source === "none" || rules.body === null) {
257
- return `Rules of ${where}: none of its own; the workspace's hold.`;
258
- }
392
+ /** When a part of the rules was written and by whom, where a page says; nothing for the console's own. */
393
+ function rulesFacts(page) {
394
+ return page === null
395
+ ? ""
396
+ : ` (v${page.version}, by ${writer(page.updatedBy, page.agent)}; ${moment(page.updatedAt)})`;
397
+ }
398
+ /** A part of the rules that has a text: what it is, who wrote it where someone did, and the text as it stands. */
399
+ const formatRulesPart = (head, page, body) => `${head}${rulesFacts(page)}:\n\n${body.trimEnd()}`;
400
+ /**
401
+ * The workspace's rules as a console of before the parts answers them (ADR-0120): whole, the
402
+ * console's own until an administrator writes the organization's in their place, which is
403
+ * what holds on such a console. No command is named for writing them: this one writes what an
404
+ * organization adds, and refuses to on a console that would keep it as the whole.
405
+ */
406
+ function formatRulesWhole(rules) {
259
407
  const head = rules.source === "reference"
260
- ? `Rules of ${where}: the console's own, until an administrator writes the organization's (console rules write --workspace).`
261
- : `Rules of ${where} (${facts ?? "written"}):`;
262
- return `${head}\n\n${rules.body.trimEnd()}`;
408
+ ? "Rules of the workspace: the console's own, until an administrator writes the organization's."
409
+ : `Rules of the workspace${rulesFacts(rules.page) || " (written)"}:`;
410
+ return `${head}\n\n${(rules.body ?? "").trimEnd()}`;
411
+ }
412
+ /**
413
+ * The parts of the rules as they are printed for whoever reads them (ADR-0120): what the
414
+ * project adds where the command works in one and it adds something, the plugins' lines in the
415
+ * language they are read in, what the organization adds where it adds something, and the
416
+ * console's rules, which always hold.
417
+ */
418
+ function rulesParts(rules, language) {
419
+ const named = "workspace" in rules;
420
+ const workspace = named ? rules.workspace : rules;
421
+ const project = named && rules.project.source !== "none" ? rules.project : undefined;
422
+ const count = rules.plugins?.length ?? 0;
423
+ const added = workspace.added ?? null;
424
+ return {
425
+ /** Whether the command works in a project: its rules were asked for, whether it adds any or not. */
426
+ named,
427
+ workspace,
428
+ /** What the project adds, where it adds something. */
429
+ own: project !== undefined && project.body !== null ? project : undefined,
430
+ plugins: rules.plugins === undefined || count === 0
431
+ ? undefined
432
+ : formatRulesPlugins(rules.plugins, language),
433
+ pluginCount: count,
434
+ /** What the organization adds, where it adds something and the console says the parts. */
435
+ added: workspace.own === undefined || added === null ? undefined : added,
436
+ /** The console's rules by themselves; nothing from a console of before, which answers the whole. */
437
+ console: workspace.own,
438
+ };
439
+ }
440
+ /**
441
+ * The mark of the rules (ADR-0119): the first eight hex characters of a SHA-256 over what they
442
+ * say to whoever reads them: the workspace's text whole, which is the console's rules with
443
+ * what the organization adds (ADR-0120), what the project adds, and the plugins' lines, in the
444
+ * language they are read in. A session that was shown the rules holds their mark, and a later
445
+ * take of that session leaves out the rules the mark stands for; nothing but having been shown
446
+ * them gives it. When they were written and by whom is no part of it: the same rules have the
447
+ * same mark, and a project that adds nothing has the workspace's.
448
+ */
449
+ export function rulesMark(rules, language) {
450
+ const parts = rulesParts(rules, language);
451
+ return createHash("sha256")
452
+ .update(JSON.stringify([
453
+ (parts.workspace.body ?? "").trimEnd(),
454
+ parts.own === undefined ? null : (parts.own.body ?? "").trimEnd(),
455
+ parts.plugins ?? null,
456
+ ]))
457
+ .digest("hex")
458
+ .slice(0, 8);
263
459
  }
460
+ /** How long a text of the rules is, as its first line says it. */
461
+ const charactersOf = (text) => `${(text ?? "").trimEnd().length} characters`;
264
462
  /**
265
- * The rules that hold: the workspace's, and what the project adds when the command works in one;
266
- * then the plugins the console names after them, a line each, where there are any.
463
+ * The rules that hold, under a first line that says what follows (ADR-0119): the mark, which
464
+ * parts there are and how long each is, and how a later take of the session leaves them out.
465
+ * What differs stands first and what always holds last (ADR-0120): what the project adds with
466
+ * the plugins' lines, then what the organization adds, then the console's rules. An agent that
467
+ * had read the long part once cut every later print at its head, and never saw what stood
468
+ * after it; and where they differ it is the earlier part that holds. Who adds nothing is said
469
+ * in a clause of the line, and has no part.
267
470
  */
268
471
  export function formatRules(rules, language) {
269
- const parts = "workspace" in rules
270
- ? [
271
- formatRulesHalf("the workspace", rules.workspace),
272
- "",
273
- formatRulesHalf("this project", rules.project),
274
- ]
275
- : [formatRulesHalf("the workspace", rules)];
276
- if (rules.plugins !== undefined && rules.plugins.length > 0) {
277
- parts.push("", formatRulesPlugins(rules.plugins, language));
472
+ const parts = rulesParts(rules, language);
473
+ const mark = rulesMark(rules, language);
474
+ // A console of before answers the workspace's rules whole: they are the last part then.
475
+ const whole = parts.console === undefined;
476
+ const last = whole
477
+ ? `the workspace's (${charactersOf(parts.workspace.body)})`
478
+ : `the console's (${charactersOf(parts.console ?? null)})`;
479
+ const lastFollows = whole
480
+ ? `the workspace's follow (${charactersOf(parts.workspace.body)})`
481
+ : `the console's follow (${charactersOf(parts.console ?? null)})`;
482
+ const plugins = `${parts.pluginCount} plugin${parts.pluginCount === 1 ? "" : "s"}`;
483
+ const HOLDS = "the earlier holding where they differ";
484
+ /** The organization's part and the last, after whatever stood before them. */
485
+ const rest = (first) => parts.added === undefined
486
+ ? last
487
+ : `the organization's${first ? " additions first" : ""} (${charactersOf(parts.added.body)}), then ${last}`;
488
+ let follows;
489
+ if (parts.own !== undefined) {
490
+ follows = `this project's additions first (${charactersOf(parts.own.body)})${parts.plugins === undefined ? "" : ` with its ${plugins}`}, then ${rest(false)}, ${HOLDS}${whole || parts.added !== undefined ? "" : "; the organization adds nothing"}.`;
278
491
  }
279
- return parts.join("\n");
492
+ else {
493
+ const nobody = parts.added === undefined && !whole;
494
+ const lead = parts.named
495
+ ? nobody
496
+ ? "this project and the organization add nothing; "
497
+ : "this project adds nothing; "
498
+ : nobody
499
+ ? "the organization adds nothing; "
500
+ : "";
501
+ const theirs = parts.named ? `its ${plugins}` : `the ${plugins} you may use`;
502
+ const body = parts.plugins !== undefined
503
+ ? `${theirs} first, then ${parts.added === undefined ? last : `the organization's additions (${charactersOf(parts.added.body)}), then ${last}, ${HOLDS}`}`
504
+ : parts.added === undefined
505
+ ? parts.named || nobody
506
+ ? lastFollows
507
+ : last
508
+ : `${rest(true)}, ${HOLDS}`;
509
+ follows = `${lead}${body}${parts.named ? "." : "; no project is named here, and a project's additions stand before them where it has some."}`;
510
+ }
511
+ // The mark ends the line bare, so that it is copied as it is.
512
+ const later = parts.named
513
+ ? ` A later take in this session leaves them out: console take <number> --rules ${mark}`
514
+ : "";
515
+ return [
516
+ `Rules ${mark}: ${follows}${later}`,
517
+ ...(parts.own === undefined
518
+ ? []
519
+ : ["", formatRulesPart("What this project adds", parts.own.page, parts.own.body ?? "")]),
520
+ ...(parts.plugins === undefined ? [] : ["", parts.plugins]),
521
+ ...(parts.added === undefined
522
+ ? []
523
+ : ["", formatRulesPart("What this organization adds", parts.added.page, parts.added.body)]),
524
+ "",
525
+ parts.console === undefined
526
+ ? formatRulesWhole(parts.workspace)
527
+ : formatRulesPart("The console's rules, which always hold", null, parts.console),
528
+ ].join("\n");
280
529
  }
530
+ /** What a take says, before the task, where it was told the mark the rules have (ADR-0119): they are left out. */
531
+ export const formatRulesLeftOut = (mark) => `Rules ${mark}: left out, since they stand as this session read them. console rules prints them.`;
532
+ /**
533
+ * What a take says, before the task, where it was told a mark the rules do not have (ADR-0119):
534
+ * the rules then follow the task whole, as they do without a mark.
535
+ */
536
+ export const formatRulesChanged = (given) => `The rules are not the ones marked ${given}: they changed since, or that mark is of another project's. They follow whole after the task, under the mark they have now.`;
281
537
  /** How far a goal is, from its tasks: the done, the at work, and the rest, in one phrase. */
282
538
  function progressOf(goal) {
283
539
  const counts = goal.taskCounts;
@@ -299,7 +555,7 @@ export function formatGoalLine(goal) {
299
555
  export function formatGoal(goal, tasks) {
300
556
  const lines = [
301
557
  `goal ${goal.id}: ${goal.title}`,
302
- `state: ${goal.state} category: ${goal.category?.key ?? "none"} starts: ${goal.startsOn ?? "none"} due: ${goal.dueOn ?? "none"} set by: ${goal.createdBy.login}${through(goal.agent)}`,
558
+ `state: ${goal.state} category: ${goal.category?.key ?? "none"} starts: ${goal.startsOn ?? "none"} due: ${goal.dueOn ?? "none"} set by: ${calledOf(goal.createdBy)}${through(goal.agent)}`,
303
559
  `progress: ${progressOf(goal)}`,
304
560
  ];
305
561
  if (goal.body.trim().length > 0) {
@@ -338,10 +594,10 @@ export function formatWork(work) {
338
594
  /** Another person's plate: their open tasks, each with its project; no decisions, which wait for anyone. */
339
595
  export function formatPersonWork(person, work) {
340
596
  if (work.tasks.length === 0) {
341
- return `No open task is on ${person.login}'s plate.`;
597
+ return `No open task is on ${calledOf(person)}'s plate.`;
342
598
  }
343
599
  return [
344
- `tasks ${person.login} works on:`,
600
+ `tasks ${calledOf(person)} works on:`,
345
601
  ...work.tasks.map(({ project, task }) => ` ${project.key} ${formatTaskLine(task)}`),
346
602
  ].join("\n");
347
603
  }
@@ -352,16 +608,18 @@ const decidersOf = (decision) => decision.deciders !== undefined && decision.dec
352
608
  ? decision.deciders
353
609
  : [decision.decider];
354
610
  /** The logins of everyone a decision is addressed to, with commas between. */
355
- export const deciderLogins = (decision) => decidersOf(decision)
356
- .map((person) => person.login)
357
- .join(", ");
611
+ export const deciderLogins = (decision) => decidersOf(decision).map(calledOf).join(", ");
358
612
  /** Whom a decision is for, where that is not the one who asked alone (ADR-0042, ADR-0057). */
359
613
  const addressed = (decision) => decidersOf(decision).every((person) => person.id === decision.raisedBy.id)
360
614
  ? ""
361
615
  : `, for ${deciderLogins(decision)}`;
616
+ /**
617
+ * One decision in a line, with when it was asked: a decision that waits holds a run, and whoever
618
+ * is told what is on their plate is told since when each one waits.
619
+ */
362
620
  export function formatDecisionLine(decision) {
363
621
  const state = decision.answer === null ? "waiting" : `answered ${decision.answer.option}`;
364
- return `${decision.id} ${state} ${decision.question} (asked by ${asker(decision)}${addressed(decision)})`;
622
+ return `${decision.id} ${state} ${decision.question} (asked by ${asker(decision)}${addressed(decision)}, at ${moment(decision.createdAt)})`;
365
623
  }
366
624
  /** The options, one a line; the person's own answer, when they wrote one, is the last and says so. */
367
625
  export function formatOptions(decision) {
@@ -377,13 +635,19 @@ export function formatAnswer(decision) {
377
635
  }
378
636
  const chosen = decision.options.find((option) => option.id === answer.option);
379
637
  const lines = [
380
- `Answered: ${answer.option}) ${chosen?.label ?? answer.option}${chosen?.own === true ? ", in their own words" : ""}, by ${answer.by.login}${through(answer.agent)} at ${answer.at}`,
638
+ `Answered: ${answer.option}) ${chosen?.label ?? answer.option}${chosen?.own === true ? ", in their own words" : ""}, by ${calledOf(answer.by)}${through(answer.agent)} at ${moment(answer.at)}`,
381
639
  ];
382
640
  if (answer.note !== null && answer.note.length > 0) {
383
641
  lines.push(`Note: ${answer.note}`);
384
642
  }
385
643
  return lines.join("\n");
386
644
  }
645
+ /**
646
+ * The address of a task's or a decision's page, on a line of its own: what an agent gives a
647
+ * person to open, in place of the console's front page, or of a number a git host would take
648
+ * for an issue of its own.
649
+ */
650
+ export const pageLine = (page) => `page: ${page}`;
387
651
  /**
388
652
  * One decision in full. A decision reached at its own address (ADR-0068), outside the project the
389
653
  * command works in, names its files with the command that reads them there, by the decision too:
@@ -395,7 +659,8 @@ export function formatDecision(decision, options = {}) {
395
659
  : `console file ${fileId}`;
396
660
  const lines = [
397
661
  `decision ${decision.id}: ${decision.question}`,
398
- `asked by ${asker(decision)}${addressed(decision)}${decision.taskNumber === null ? "" : `, about task #${decision.taskNumber}`}`,
662
+ `asked by ${asker(decision)}${addressed(decision)}${decision.taskNumber === null ? "" : `, about task #${decision.taskNumber}`}, at ${moment(decision.createdAt)}`,
663
+ ...(options.page === undefined ? [] : [pageLine(options.page)]),
399
664
  ];
400
665
  if (decision.body.trim().length > 0) {
401
666
  lines.push("", decision.body.trimEnd());
@@ -409,13 +674,13 @@ export function formatDecision(decision, options = {}) {
409
674
  if (decision.outcome !== null && decision.outcome.trim().length > 0) {
410
675
  lines.push("", "what followed:", indent(decision.outcome));
411
676
  if (decision.outcomeBy != null && decision.outcomeAt != null) {
412
- lines.push(indent(`written by ${decision.outcomeBy.login}${through(decision.outcomeAgent)} at ${decision.outcomeAt}`));
677
+ lines.push(indent(`written by ${calledOf(decision.outcomeBy)}${through(decision.outcomeAgent)} at ${moment(decision.outcomeAt)}`));
413
678
  }
414
679
  }
415
680
  return lines.join("\n");
416
681
  }
417
682
  /** Who wrote a version, and through which agent. */
418
- const writer = (by, agent) => agent === null ? by.login : `${agent} for ${by.login}`;
683
+ const writer = (by, agent) => agent === null ? calledOf(by) : `${agent} for ${calledOf(by)}`;
419
684
  /** One document in a list: its path, its title, its version, who wrote it last and when. */
420
685
  export function formatDocumentLine(document) {
421
686
  const notes = [`v${document.version}`, `by ${writer(document.updatedBy, document.agent)}`];
@@ -607,15 +872,29 @@ export function formatPluginHelp(detail, name) {
607
872
  : "Prints what the command says; --json prints its data. A command that raised a decision prints its id and exits with 3: console decision <id> --wait 100 waits for the answer.", "", "Refusals:", ...PLUGIN_COMMAND_REFUSALS.map((refusal) => ` ${refusal}`));
608
873
  return parts.join("\n");
609
874
  }
610
- /** A setting in a line: its key and type, what it holds or whether it is set, and its name. */
875
+ /** When a secret was set, from where where it was sealed from an answer, and when it expires: never what it holds. */
876
+ function secretStanding(standing) {
877
+ return `set${standing.setAt === null ? "" : ` ${moment(standing.setAt)}`}${standing.source === null || standing.source === undefined || standing.source === "administrator"
878
+ ? ""
879
+ : ` from ${standing.source}`}${standing.expiresAt === null || standing.expiresAt === undefined ? "" : `, expires ${moment(standing.expiresAt)}`}`;
880
+ }
881
+ /**
882
+ * A setting in a line: its key and type, what it holds or whether it is set, and its name; for a
883
+ * secret kept per key (ADR-0111), how many keys of how many, and a line under it for each key.
884
+ */
611
885
  export function formatPluginSettingLine(setting, language) {
886
+ const keys = setting.keys ?? null;
887
+ if (setting.type === "secret" && keys !== null) {
888
+ const max = setting.keyed?.max;
889
+ const count = `${keys.length}${max === undefined ? "" : ` of ${max}`} ${keys.length === 1 && max === undefined ? "key" : "keys"}`;
890
+ return [
891
+ ` ${setting.key} (secret, per key): ${count} ${localized(setting.name, language)}`,
892
+ ...keys.map((kept) => ` ${kept.key}: ${secretStanding(kept)}`),
893
+ ].join("\n");
894
+ }
612
895
  const holds = setting.type === "secret"
613
896
  ? setting.set
614
- ? `set${setting.setAt === null ? "" : ` ${moment(setting.setAt)}`}${setting.source === null ||
615
- setting.source === undefined ||
616
- setting.source === "administrator"
617
- ? ""
618
- : ` from ${setting.source}`}${setting.expiresAt === null || setting.expiresAt === undefined ? "" : `, expires ${moment(setting.expiresAt)}`}`
897
+ ? secretStanding(setting)
619
898
  : "not set"
620
899
  : setting.set
621
900
  ? setting.value === null
@@ -633,7 +912,7 @@ export function formatPluginGrantLine(grant) {
633
912
  : grant.team !== null && grant.team !== undefined
634
913
  ? `the team ${grant.team.key}`
635
914
  : grant.person !== null
636
- ? `person ${grant.person.login}`
915
+ ? `person ${calledOf(grant.person)}`
637
916
  : grant.project !== null
638
917
  ? `the members of ${grant.project.key}`
639
918
  : "everyone";
@@ -645,6 +924,52 @@ export function formatTeamLine(team, loginOf) {
645
924
  const count = team.memberIds.length === 1 ? "1 member" : `${team.memberIds.length} members`;
646
925
  return `${team.key} ${team.name} ${count}${logins.length === 0 ? "" : `: ${logins.join(", ")}`}`;
647
926
  }
927
+ /**
928
+ * A job of a plugin in a line (ADR-0128): its name and how often it runs, how its last run went
929
+ * and since when it has failed where it keeps failing, and when it runs next.
930
+ */
931
+ export function formatPluginJobLine(job) {
932
+ const schedule = `every ${job.every}${job.at === null ? "" : ` at ${job.at}`}`;
933
+ const last = job.lastRunAt === null || job.lastOutcome === null
934
+ ? "has not run yet"
935
+ : `last run ${moment(job.lastRunAt)}: ${job.lastOutcome}${job.lastOutcome === "failed" && job.failedSince !== null
936
+ ? `, failing since ${moment(job.failedSince)}`
937
+ : ""}`;
938
+ return ` ${job.name} ${schedule} ${last} next: ${job.nextAt === null ? "not scheduled" : moment(job.nextAt)}`;
939
+ }
940
+ /** What an event of a plugin says, after its kind: what failed, which command and how it ended, else what it carries. */
941
+ function pluginEventSays(event) {
942
+ const data = event.data;
943
+ if (event.kind === "plugin.failed") {
944
+ return data.problem ?? "";
945
+ }
946
+ if (event.kind === "plugin.command") {
947
+ return `${data.command ?? "?"} ${data.outcome ?? "?"}${data.code === undefined ? "" : ` (${data.code})`}${data.durationMs === undefined ? "" : `, ${data.durationMs} ms`}`;
948
+ }
949
+ const carried = JSON.stringify(data);
950
+ return carried === "{}" ? "" : carried.length > 300 ? `${carried.slice(0, 300)}...` : carried;
951
+ }
952
+ /** One event of a plugin in a line: its number, when, its kind, who did it and through what, and what it says. */
953
+ export function formatPluginEventLine(event) {
954
+ const who = event.actor === null
955
+ ? "the console"
956
+ : `${calledOf(event.actor)}${event.agent === null ? "" : ` as ${event.agent}`}`;
957
+ const says = pluginEventSays(event);
958
+ return `#${event.id} ${moment(event.createdAt)} ${event.kind} ${who}${says === "" ? "" : ` ${says}`}`;
959
+ }
960
+ /**
961
+ * A page of a plugin's events, newest first (ADR-0128), of one kind where one was asked for:
962
+ * what `console plugin <key> events` prints, with how to read on. The console answers what the
963
+ * caller may read and says nothing of the rest, so an empty page is said as that, and never as
964
+ * a plugin that has no events.
965
+ */
966
+ export function formatPluginEvents(key, page, asked) {
967
+ if (page.items.length === 0) {
968
+ const none = `No ${asked.kind === undefined ? "" : `${asked.kind} `}event of ${key} that you may read${asked.offset > 0 ? ", that far back" : ""}.`;
969
+ return `${none}${formatMore(page.more, asked.limit, asked.offset)}`;
970
+ }
971
+ return `${page.items.map(formatPluginEventLine).join("\n")}${formatMore(page.more, asked.limit, asked.offset)}`;
972
+ }
648
973
  /** One plugin in full: what it is, how it stands, what one may run, its skills and its settings. */
649
974
  export function formatPlugin(detail, language) {
650
975
  const name = localized(detail.name, language);
@@ -686,6 +1011,10 @@ export function formatPlugin(detail, language) {
686
1011
  if (detail.skills !== null) {
687
1012
  lines.push("", `Skills: console plugin ${detail.key} skills lists them; console plugin ${detail.key} skill <path> reads one. Read the one that fits before the first command.`);
688
1013
  }
1014
+ // A console before 0.5.1 names no jobs: nothing is printed of them then, not an empty block.
1015
+ if (detail.jobs !== undefined && detail.jobs.length > 0) {
1016
+ lines.push("", `Jobs (what went wrong in one: console plugin ${detail.key} events --kind plugin.failed):`, ...detail.jobs.map(formatPluginJobLine));
1017
+ }
689
1018
  if (detail.settings.length > 0) {
690
1019
  lines.push("", "Settings:", ...detail.settings.map((setting) => formatPluginSettingLine(setting, language)));
691
1020
  }