@skillcdn/console 0.6.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (415) hide show
  1. package/README.md +7 -7
  2. package/dist/agent-page.d.ts.map +1 -1
  3. package/dist/agent-page.js +58 -35
  4. package/dist/agent-page.js.map +1 -1
  5. package/dist/agent-usage.d.ts +51 -0
  6. package/dist/agent-usage.d.ts.map +1 -0
  7. package/dist/agent-usage.js +77 -0
  8. package/dist/agent-usage.js.map +1 -0
  9. package/dist/api.d.ts +4 -2
  10. package/dist/api.d.ts.map +1 -1
  11. package/dist/api.js +4 -2
  12. package/dist/api.js.map +1 -1
  13. package/dist/cli/cli.d.ts +9 -2
  14. package/dist/cli/cli.d.ts.map +1 -1
  15. package/dist/cli/cli.js +491 -125
  16. package/dist/cli/cli.js.map +1 -1
  17. package/dist/cli/format.d.ts +46 -4
  18. package/dist/cli/format.d.ts.map +1 -1
  19. package/dist/cli/format.js +163 -45
  20. package/dist/cli/format.js.map +1 -1
  21. package/dist/cli/help.d.ts.map +1 -1
  22. package/dist/cli/help.js +62 -13
  23. package/dist/cli/help.js.map +1 -1
  24. package/dist/cli/machine-check.d.ts +24 -5
  25. package/dist/cli/machine-check.d.ts.map +1 -1
  26. package/dist/cli/machine-check.js +128 -16
  27. package/dist/cli/machine-check.js.map +1 -1
  28. package/dist/cli/pack.d.ts +11 -8
  29. package/dist/cli/pack.d.ts.map +1 -1
  30. package/dist/cli/pack.js +63 -28
  31. package/dist/cli/pack.js.map +1 -1
  32. package/dist/cli/runner-host.d.ts +2 -0
  33. package/dist/cli/runner-host.d.ts.map +1 -1
  34. package/dist/cli/runner-host.js +1 -0
  35. package/dist/cli/runner-host.js.map +1 -1
  36. package/dist/cli/secret-notes.d.ts.map +1 -1
  37. package/dist/cli/secret-notes.js +9 -1
  38. package/dist/cli/secret-notes.js.map +1 -1
  39. package/dist/cli/terminal.d.ts +10 -2
  40. package/dist/cli/terminal.d.ts.map +1 -1
  41. package/dist/cli/terminal.js +16 -4
  42. package/dist/cli/terminal.js.map +1 -1
  43. package/dist/client.d.ts +30 -7
  44. package/dist/client.d.ts.map +1 -1
  45. package/dist/client.js +13 -1
  46. package/dist/client.js.map +1 -1
  47. package/dist/components/agent-page.d.ts +76 -18
  48. package/dist/components/agent-page.d.ts.map +1 -1
  49. package/dist/components/agent-page.js +183 -53
  50. package/dist/components/agent-page.js.map +1 -1
  51. package/dist/components/agents.d.ts +2 -0
  52. package/dist/components/agents.d.ts.map +1 -1
  53. package/dist/components/agents.js +6 -5
  54. package/dist/components/agents.js.map +1 -1
  55. package/dist/components/calendar.d.ts +24 -4
  56. package/dist/components/calendar.d.ts.map +1 -1
  57. package/dist/components/calendar.js +79 -36
  58. package/dist/components/calendar.js.map +1 -1
  59. package/dist/components/categories.js +2 -2
  60. package/dist/components/categories.js.map +1 -1
  61. package/dist/components/comments.js +2 -2
  62. package/dist/components/comments.js.map +1 -1
  63. package/dist/components/decision-list.d.ts.map +1 -1
  64. package/dist/components/decision-list.js +5 -5
  65. package/dist/components/decision-list.js.map +1 -1
  66. package/dist/components/documents.d.ts.map +1 -1
  67. package/dist/components/documents.js +4 -4
  68. package/dist/components/documents.js.map +1 -1
  69. package/dist/components/event-feed.d.ts +2 -3
  70. package/dist/components/event-feed.d.ts.map +1 -1
  71. package/dist/components/event-feed.js +4 -184
  72. package/dist/components/event-feed.js.map +1 -1
  73. package/dist/components/goals.d.ts.map +1 -1
  74. package/dist/components/goals.js +3 -3
  75. package/dist/components/goals.js.map +1 -1
  76. package/dist/components/home.js +9 -9
  77. package/dist/components/home.js.map +1 -1
  78. package/dist/components/icon.d.ts.map +1 -1
  79. package/dist/components/icon.js +11 -2
  80. package/dist/components/icon.js.map +1 -1
  81. package/dist/components/notifications.d.ts +65 -0
  82. package/dist/components/notifications.d.ts.map +1 -0
  83. package/dist/components/notifications.js +162 -0
  84. package/dist/components/notifications.js.map +1 -0
  85. package/dist/components/pack-connect.js +1 -1
  86. package/dist/components/pack-connect.js.map +1 -1
  87. package/dist/components/pack-token.js +1 -1
  88. package/dist/components/pack-token.js.map +1 -1
  89. package/dist/components/people.js +2 -2
  90. package/dist/components/people.js.map +1 -1
  91. package/dist/components/pictures.js +1 -1
  92. package/dist/components/pictures.js.map +1 -1
  93. package/dist/components/plugin-settings.d.ts +22 -1
  94. package/dist/components/plugin-settings.d.ts.map +1 -1
  95. package/dist/components/plugin-settings.js +63 -11
  96. package/dist/components/plugin-settings.js.map +1 -1
  97. package/dist/components/projects.js +1 -1
  98. package/dist/components/projects.js.map +1 -1
  99. package/dist/components/roadmap.js +2 -2
  100. package/dist/components/roadmap.js.map +1 -1
  101. package/dist/components/rules.js +2 -2
  102. package/dist/components/rules.js.map +1 -1
  103. package/dist/components/runs.d.ts.map +1 -1
  104. package/dist/components/runs.js +1 -1
  105. package/dist/components/runs.js.map +1 -1
  106. package/dist/components/sessions.js +1 -1
  107. package/dist/components/sessions.js.map +1 -1
  108. package/dist/components/shell.d.ts +2 -0
  109. package/dist/components/shell.d.ts.map +1 -1
  110. package/dist/components/shell.js +1 -1
  111. package/dist/components/shell.js.map +1 -1
  112. package/dist/components/sign-in.js +2 -2
  113. package/dist/components/sign-in.js.map +1 -1
  114. package/dist/components/skills.d.ts.map +1 -1
  115. package/dist/components/skills.js +1 -1
  116. package/dist/components/skills.js.map +1 -1
  117. package/dist/components/task-view.d.ts +6 -0
  118. package/dist/components/task-view.d.ts.map +1 -1
  119. package/dist/components/task-view.js +3 -2
  120. package/dist/components/task-view.js.map +1 -1
  121. package/dist/components/tokens.js +1 -1
  122. package/dist/components/tokens.js.map +1 -1
  123. package/dist/components/ui.d.ts +21 -2
  124. package/dist/components/ui.d.ts.map +1 -1
  125. package/dist/components/ui.js +24 -3
  126. package/dist/components/ui.js.map +1 -1
  127. package/dist/components/work.js +1 -1
  128. package/dist/components/work.js.map +1 -1
  129. package/dist/console.css +506 -289
  130. package/dist/console.d.ts.map +1 -1
  131. package/dist/console.js +193 -16
  132. package/dist/console.js.map +1 -1
  133. package/dist/data.d.ts +17 -1
  134. package/dist/data.d.ts.map +1 -1
  135. package/dist/data.js +31 -0
  136. package/dist/data.js.map +1 -1
  137. package/dist/desk-page.js +5 -5
  138. package/dist/desk-page.js.map +1 -1
  139. package/dist/feed-words.d.ts +5 -0
  140. package/dist/feed-words.d.ts.map +1 -0
  141. package/dist/feed-words.js +193 -0
  142. package/dist/feed-words.js.map +1 -0
  143. package/dist/i18n/en.d.ts +93 -1
  144. package/dist/i18n/en.d.ts.map +1 -1
  145. package/dist/i18n/en.js +103 -15
  146. package/dist/i18n/en.js.map +1 -1
  147. package/dist/i18n/ko.d.ts.map +1 -1
  148. package/dist/i18n/ko.js +105 -22
  149. package/dist/i18n/ko.js.map +1 -1
  150. package/dist/icons/glyphs.d.ts +370 -104
  151. package/dist/icons/glyphs.d.ts.map +1 -1
  152. package/dist/icons/glyphs.js +72 -66
  153. package/dist/icons/glyphs.js.map +1 -1
  154. package/dist/icons/index.d.ts.map +1 -1
  155. package/dist/icons/index.js +9 -1
  156. package/dist/icons/index.js.map +1 -1
  157. package/dist/index.d.ts +3 -2
  158. package/dist/index.d.ts.map +1 -1
  159. package/dist/index.js +3 -2
  160. package/dist/index.js.map +1 -1
  161. package/dist/limits.d.ts +7 -0
  162. package/dist/limits.d.ts.map +1 -1
  163. package/dist/limits.js +7 -0
  164. package/dist/limits.js.map +1 -1
  165. package/dist/notifications.d.ts +124 -0
  166. package/dist/notifications.d.ts.map +1 -0
  167. package/dist/notifications.js +147 -0
  168. package/dist/notifications.js.map +1 -0
  169. package/dist/onboarding.d.ts.map +1 -1
  170. package/dist/onboarding.js +7 -12
  171. package/dist/onboarding.js.map +1 -1
  172. package/dist/plugin/capabilities.d.ts +1 -1
  173. package/dist/plugin/capabilities.d.ts.map +1 -1
  174. package/dist/plugin/capabilities.js +10 -0
  175. package/dist/plugin/capabilities.js.map +1 -1
  176. package/dist/plugin/context.d.ts +85 -1
  177. package/dist/plugin/context.d.ts.map +1 -1
  178. package/dist/plugin/limits.d.ts +7 -0
  179. package/dist/plugin/limits.d.ts.map +1 -1
  180. package/dist/plugin/limits.js +7 -0
  181. package/dist/plugin/limits.js.map +1 -1
  182. package/dist/plugin/manifest.d.ts +8 -0
  183. package/dist/plugin/manifest.d.ts.map +1 -1
  184. package/dist/plugin/manifest.js +13 -0
  185. package/dist/plugin/manifest.js.map +1 -1
  186. package/dist/plugin/rest-schemas.d.ts +22 -0
  187. package/dist/plugin/rest-schemas.d.ts.map +1 -1
  188. package/dist/plugin/rest-schemas.js +19 -3
  189. package/dist/plugin/rest-schemas.js.map +1 -1
  190. package/dist/plugin/testing.d.ts +2 -0
  191. package/dist/plugin/testing.d.ts.map +1 -1
  192. package/dist/plugin/testing.js +2 -0
  193. package/dist/plugin/testing.js.map +1 -1
  194. package/dist/plugin.d.ts +1 -1
  195. package/dist/plugin.d.ts.map +1 -1
  196. package/dist/plugin.js +1 -1
  197. package/dist/plugin.js.map +1 -1
  198. package/dist/router.d.ts +6 -0
  199. package/dist/router.d.ts.map +1 -1
  200. package/dist/router.js +5 -0
  201. package/dist/router.js.map +1 -1
  202. package/dist/routes.d.ts +2 -0
  203. package/dist/routes.d.ts.map +1 -1
  204. package/dist/routes.js +2 -0
  205. package/dist/routes.js.map +1 -1
  206. package/dist/rules.js +1 -1
  207. package/dist/rules.js.map +1 -1
  208. package/dist/runner/acp.d.ts.map +1 -1
  209. package/dist/runner/acp.js +12 -97
  210. package/dist/runner/acp.js.map +1 -1
  211. package/dist/runner/browser.d.ts +50 -0
  212. package/dist/runner/browser.d.ts.map +1 -0
  213. package/dist/runner/browser.js +104 -0
  214. package/dist/runner/browser.js.map +1 -0
  215. package/dist/runner/claude.d.ts +1 -2
  216. package/dist/runner/claude.d.ts.map +1 -1
  217. package/dist/runner/claude.js +352 -13
  218. package/dist/runner/claude.js.map +1 -1
  219. package/dist/runner/codex.d.ts +9 -10
  220. package/dist/runner/codex.d.ts.map +1 -1
  221. package/dist/runner/codex.js +809 -346
  222. package/dist/runner/codex.js.map +1 -1
  223. package/dist/runner/config.d.ts +14 -3
  224. package/dist/runner/config.d.ts.map +1 -1
  225. package/dist/runner/config.js +27 -7
  226. package/dist/runner/config.js.map +1 -1
  227. package/dist/runner/desk.d.ts +3 -1
  228. package/dist/runner/desk.d.ts.map +1 -1
  229. package/dist/runner/desk.js +17 -5
  230. package/dist/runner/desk.js.map +1 -1
  231. package/dist/runner/message.d.ts +53 -3
  232. package/dist/runner/message.d.ts.map +1 -1
  233. package/dist/runner/message.js +201 -20
  234. package/dist/runner/message.js.map +1 -1
  235. package/dist/runner/registry.d.ts +6 -0
  236. package/dist/runner/registry.d.ts.map +1 -1
  237. package/dist/runner/registry.js.map +1 -1
  238. package/dist/runner/rpc.d.ts +31 -0
  239. package/dist/runner/rpc.d.ts.map +1 -0
  240. package/dist/runner/rpc.js +102 -0
  241. package/dist/runner/rpc.js.map +1 -0
  242. package/dist/runner/runner.d.ts +41 -1
  243. package/dist/runner/runner.d.ts.map +1 -1
  244. package/dist/runner/runner.js +695 -52
  245. package/dist/runner/runner.js.map +1 -1
  246. package/dist/runner/slack.d.ts +17 -8
  247. package/dist/runner/slack.d.ts.map +1 -1
  248. package/dist/runner/slack.js +1250 -78
  249. package/dist/runner/slack.js.map +1 -1
  250. package/dist/runner/types.d.ts +160 -8
  251. package/dist/runner/types.d.ts.map +1 -1
  252. package/dist/runner/types.js.map +1 -1
  253. package/dist/runner/usage.d.ts +105 -0
  254. package/dist/runner/usage.d.ts.map +1 -0
  255. package/dist/runner/usage.js +218 -0
  256. package/dist/runner/usage.js.map +1 -0
  257. package/dist/runner.d.ts +4 -4
  258. package/dist/runner.d.ts.map +1 -1
  259. package/dist/runner.js +3 -3
  260. package/dist/runner.js.map +1 -1
  261. package/dist/schemas.d.ts +673 -0
  262. package/dist/schemas.d.ts.map +1 -1
  263. package/dist/schemas.js +205 -1
  264. package/dist/schemas.js.map +1 -1
  265. package/dist/services.js +3 -3
  266. package/dist/services.js.map +1 -1
  267. package/dist/setup-guide.d.ts +4 -3
  268. package/dist/setup-guide.d.ts.map +1 -1
  269. package/dist/setup-guide.js +11 -13
  270. package/dist/setup-guide.js.map +1 -1
  271. package/dist/text.d.ts +7 -0
  272. package/dist/text.d.ts.map +1 -1
  273. package/dist/text.js +18 -0
  274. package/dist/text.js.map +1 -1
  275. package/dist/vocabulary.d.ts +4 -2
  276. package/dist/vocabulary.d.ts.map +1 -1
  277. package/dist/vocabulary.js +4 -1
  278. package/dist/vocabulary.js.map +1 -1
  279. package/docs/specs/cli.md +26 -19
  280. package/docs/specs/plugins.md +16 -10
  281. package/docs/specs/rest.md +28 -10
  282. package/docs/specs/runner.md +132 -44
  283. package/package.json +4 -4
  284. package/skills/building-a-console/SKILL.md +2 -2
  285. package/skills/building-a-console/references/configuring.md +1 -1
  286. package/skills/building-a-plugin/SKILL.md +4 -4
  287. package/skills/planning-the-board/SKILL.md +1 -1
  288. package/skills/planning-the-board/references/setting-up.md +2 -2
  289. package/skills/running-an-agent/SKILL.md +15 -64
  290. package/skills/running-an-agent/references/preparing-the-machine.md +17 -0
  291. package/skills/running-an-agent/references/several-tasks.md +37 -0
  292. package/skills/running-an-agent/references/slack-app.md +70 -13
  293. package/skills/running-an-agent/references/the-account-and-the-invitation.md +5 -0
  294. package/skills/running-an-agent/references/what-was-not-seen-run-yet.md +3 -0
  295. package/skills/running-an-agent/references/when-the-agent-could-not-go-on.md +16 -0
  296. package/skills/running-an-agent/references/your-first-task.md +14 -0
  297. package/skills/working-the-board/SKILL.md +9 -12
  298. package/skills/working-the-board/references/a-pack-skills-questions.md +3 -0
  299. package/skills/working-the-board/references/a-plugins-commands.md +3 -0
  300. package/skills/working-the-board/references/a-review.md +3 -0
  301. package/skills/working-the-board/references/an-open-run.md +3 -0
  302. package/skills/working-the-board/references/requirements.md +7 -0
  303. package/skills/working-the-board/references/the-pack.md +2 -2
  304. package/skills/working-the-board/references/what-they-were-told.md +3 -0
  305. package/skills/working-the-board/references/work-given-in-chat.md +5 -0
  306. package/src/agent-page.tsx +76 -47
  307. package/src/agent-usage.ts +113 -0
  308. package/src/api.ts +62 -0
  309. package/src/cli/cli.ts +634 -162
  310. package/src/cli/format.ts +190 -47
  311. package/src/cli/help.ts +77 -12
  312. package/src/cli/machine-check.ts +182 -29
  313. package/src/cli/pack.ts +81 -40
  314. package/src/cli/runner-host.ts +3 -0
  315. package/src/cli/secret-notes.ts +9 -1
  316. package/src/cli/terminal.ts +20 -4
  317. package/src/client.ts +94 -6
  318. package/src/components/agent-page.tsx +280 -63
  319. package/src/components/agents.tsx +23 -3
  320. package/src/components/calendar.tsx +93 -37
  321. package/src/components/categories.tsx +2 -2
  322. package/src/components/comments.tsx +5 -5
  323. package/src/components/decision-list.tsx +13 -10
  324. package/src/components/documents.tsx +13 -8
  325. package/src/components/event-feed.tsx +4 -203
  326. package/src/components/goals.tsx +6 -4
  327. package/src/components/home.tsx +12 -12
  328. package/src/components/icon.tsx +16 -3
  329. package/src/components/notifications.tsx +419 -0
  330. package/src/components/pack-connect.tsx +1 -1
  331. package/src/components/pack-token.tsx +5 -5
  332. package/src/components/people.tsx +3 -3
  333. package/src/components/pictures.tsx +1 -1
  334. package/src/components/plugin-settings.tsx +128 -23
  335. package/src/components/projects.tsx +1 -1
  336. package/src/components/roadmap.tsx +2 -2
  337. package/src/components/rules.tsx +2 -2
  338. package/src/components/runs.tsx +6 -3
  339. package/src/components/sessions.tsx +2 -2
  340. package/src/components/shell.tsx +3 -0
  341. package/src/components/sign-in.tsx +3 -3
  342. package/src/components/skills.tsx +5 -3
  343. package/src/components/task-view.tsx +18 -7
  344. package/src/components/tokens.tsx +2 -2
  345. package/src/components/ui.tsx +70 -5
  346. package/src/components/work.tsx +2 -2
  347. package/src/console.tsx +269 -12
  348. package/src/data.ts +54 -0
  349. package/src/desk-page.tsx +5 -5
  350. package/src/feed-words.ts +214 -0
  351. package/src/i18n/en.ts +114 -15
  352. package/src/i18n/ko.ts +115 -22
  353. package/src/icons/glyphs.ts +74 -68
  354. package/src/icons/index.ts +9 -1
  355. package/src/index.ts +11 -0
  356. package/src/limits.ts +7 -0
  357. package/src/notifications.ts +205 -0
  358. package/src/onboarding.ts +10 -14
  359. package/src/plugin/capabilities.ts +13 -0
  360. package/src/plugin/context.ts +87 -0
  361. package/src/plugin/limits.ts +7 -0
  362. package/src/plugin/manifest.ts +14 -0
  363. package/src/plugin/rest-schemas.ts +27 -3
  364. package/src/plugin/testing.ts +4 -0
  365. package/src/plugin.ts +2 -0
  366. package/src/router.ts +7 -0
  367. package/src/routes.ts +2 -0
  368. package/src/rules.ts +1 -1
  369. package/src/runner/acp.ts +12 -118
  370. package/src/runner/browser.ts +128 -0
  371. package/src/runner/claude.ts +399 -12
  372. package/src/runner/codex.ts +904 -400
  373. package/src/runner/config.ts +30 -7
  374. package/src/runner/desk.ts +22 -6
  375. package/src/runner/message.ts +251 -21
  376. package/src/runner/registry.ts +6 -0
  377. package/src/runner/rpc.ts +140 -0
  378. package/src/runner/runner.ts +863 -53
  379. package/src/runner/slack.ts +1535 -85
  380. package/src/runner/types.ts +150 -5
  381. package/src/runner/usage.ts +299 -0
  382. package/src/runner.ts +16 -1
  383. package/src/schemas.ts +249 -0
  384. package/src/services.ts +3 -3
  385. package/src/setup-guide.ts +12 -14
  386. package/src/styles/README.md +11 -7
  387. package/src/styles/console.css +2 -0
  388. package/src/styles/drawn-by-pages.json +7 -82
  389. package/src/styles/pages/agents.css +46 -35
  390. package/src/styles/pages/calendar.css +0 -1
  391. package/src/styles/pages/connect.css +0 -14
  392. package/src/styles/pages/decisions.css +2 -43
  393. package/src/styles/pages/documents.css +0 -29
  394. package/src/styles/pages/home.css +4 -16
  395. package/src/styles/pages/people.css +2 -17
  396. package/src/styles/pages/plugins.css +9 -12
  397. package/src/styles/pages/roadmap.css +0 -16
  398. package/src/styles/pages/settings.css +0 -28
  399. package/src/styles/pages/sign-in.css +2 -17
  400. package/src/styles/pages/thread.css +4 -50
  401. package/src/styles/pages/work.css +0 -5
  402. package/src/styles/parts/button.css +31 -0
  403. package/src/styles/parts/count.css +10 -0
  404. package/src/styles/parts/divider.css +17 -0
  405. package/src/styles/parts/frame.css +12 -0
  406. package/src/styles/parts/icon.css +39 -0
  407. package/src/styles/parts/menu.css +184 -0
  408. package/src/styles/parts/panel.css +7 -0
  409. package/src/styles/parts/progress.css +63 -0
  410. package/src/styles/parts/settings.css +2 -0
  411. package/src/styles/parts/sheet.css +28 -0
  412. package/src/styles/parts/text.css +34 -0
  413. package/src/text.ts +19 -0
  414. package/src/vocabulary.ts +4 -1
  415. package/template/plugin/package.json +1 -1
package/src/cli/pack.ts CHANGED
@@ -169,9 +169,14 @@ type Ready<T> = Extract<T, { readonly status: "ready" }>;
169
169
  * from what the pack says of itself in the one answer the console already has (ADR-0118, point
170
170
  * 5): the console's API takes no search without words, and a listing asked page by page through
171
171
  * a console that may be far would be several requests for the answer one gives. A folder's
172
- * README is marked as its overview by the rule @skillcdn/core exports.
172
+ * README is marked as its overview by the rule @skillcdn/core exports. With `limit`, as many of
173
+ * them from where `cursor` says, and the cursor of the next where more follow: the pages the
174
+ * command prints a long listing in (ADR-0124) are cut here, from the one answer.
173
175
  */
174
- function listingOf(mount: RestMount): Ready<RestFind> {
176
+ function listingOf(
177
+ mount: RestMount,
178
+ page: { readonly cursor?: string | undefined; readonly limit?: number | undefined } = {},
179
+ ): Ready<RestFind> {
175
180
  const { index } = mount;
176
181
  if (index.status !== "ready") {
177
182
  throw new PackError(503, `index.${index.status}`, "The pack is not ready to read.");
@@ -200,18 +205,50 @@ function listingOf(mount: RestMount): Ready<RestFind> {
200
205
  ...(path.ok && isReadmePath(path.value) ? { overview: true } : {}),
201
206
  });
202
207
  }
208
+ const from = listingStart(page.cursor, mount.commit, items.length);
209
+ const end =
210
+ page.limit === undefined
211
+ ? items.length
212
+ : Math.min(items.length, from + Math.max(1, page.limit));
203
213
  return {
204
214
  status: "ready",
205
215
  query: null,
206
216
  commit: mount.commit,
207
- items,
217
+ items: items.slice(from, end),
208
218
  diagnostics: index.diagnostics,
209
- // The counts stand in the instructions above; without totals here, nothing suggests a cursor.
219
+ // The counts stand in the instructions above the first page.
210
220
  totals: null,
211
- nextCursor: null,
221
+ nextCursor: end < items.length ? listingCursor(end, mount.commit) : null,
212
222
  };
213
223
  }
214
224
 
225
+ /** What of a commit a cursor of the listing carries: enough to tell one index from the next. */
226
+ const commitMark = (commit: string): string => commit.replace(/[^0-9A-Za-z]/g, "").slice(0, 12);
227
+
228
+ /** The cursor of the listing's page that begins at `offset`, of the index at `commit`. */
229
+ const listingCursor = (offset: number, commit: string): string => `${offset}-${commitMark(commit)}`;
230
+
231
+ /**
232
+ * Where the page a cursor names begins, or the start without one. A cursor is of one index, as
233
+ * the pack's own are: one of another commit, or that is none, is refused in the pack's words, so
234
+ * that a page never goes on from a listing in another order.
235
+ */
236
+ function listingStart(cursor: string | undefined, commit: string, count: number): number {
237
+ if (cursor === undefined) {
238
+ return 0;
239
+ }
240
+ const match = /^([0-9]{1,7})-([0-9A-Za-z]{0,12})$/.exec(cursor);
241
+ const offset = match === null ? Number.NaN : Number(match[1]);
242
+ if (match === null || match[2] !== commitMark(commit) || offset < 1 || offset >= count) {
243
+ throw new PackError(
244
+ 400,
245
+ "request.invalid",
246
+ "This continuation does not match the repository snapshot. Start again without a cursor.",
247
+ );
248
+ }
249
+ return offset;
250
+ }
251
+
215
252
  /**
216
253
  * A document's outline with the reads of its tables and its code blocks named as commands
217
254
  * (ADR-0100): where the console said an address of its own for one, the command that reads it,
@@ -249,14 +286,6 @@ const MAX_PAGES = 64;
249
286
  export interface ConsolePack extends Pack {
250
287
  /** The console's answer to the last read made of the pack: what `--json` prints around the pack's own answer, and what a refusal is said from. */
251
288
  answered(): PackAnswer | undefined;
252
- /**
253
- * How many pages of a skill follow the page that named `cursor` as the next, where the pack
254
- * said (`pagesLeft`, SkillCDN 0.6.1): what the command says of a part that ends there.
255
- * Nothing for a cursor no page of this pack named, or a pack that counts none.
256
- */
257
- pagesAfter(cursor: string): number | undefined;
258
- /** Whether the last page of a skill this pack answered was the skill's last. */
259
- skillEnded(): boolean;
260
289
  }
261
290
 
262
291
  /**
@@ -280,9 +309,6 @@ export function consolePack(
280
309
  }
281
310
  let last: PackAnswer | undefined;
282
311
  let pages = 0;
283
- /** By the cursor a page of a skill named as the next: how many pages the pack said follow that page. */
284
- const left = new Map<string, number>();
285
- let ended = false;
286
312
  /** One more page of a read the command joins, within what one command follows. */
287
313
  const another = (what: string, path: string | undefined): void => {
288
314
  pages += 1;
@@ -335,7 +361,7 @@ export function consolePack(
335
361
  },
336
362
  find: async (query: FindQuery): Promise<RestFind> =>
337
363
  query.query === undefined
338
- ? listingOf(mount)
364
+ ? listingOf(mount, { cursor: query.cursor, limit: query.limit })
339
365
  : ready(
340
366
  "search",
341
367
  await reader.skillFind(query.query, {
@@ -353,16 +379,8 @@ export function consolePack(
353
379
  "The pack answers more pages of a skill than one read takes.",
354
380
  );
355
381
  }
356
- const read = ready("skill", await reader.skill(path, cursor));
357
- const { nextCursor, pagesLeft, complete } = read.skill;
358
- if (typeof nextCursor === "string" && pagesLeft !== undefined) {
359
- left.set(nextCursor, pagesLeft);
360
- }
361
- ended = complete === true;
362
- return read;
382
+ return ready("skill", await reader.skill(path, cursor));
363
383
  },
364
- pagesAfter: (cursor: string) => left.get(cursor),
365
- skillEnded: () => ended,
366
384
  file: async (query: FileQuery): Promise<RestFile> =>
367
385
  taken(
368
386
  "file",
@@ -393,22 +411,45 @@ export function formatSkills(
393
411
  owner: PackOwner = "project",
394
412
  words: ToolWords = CONSOLE_WORDS,
395
413
  ): string {
396
- const own =
397
- ownSkills === undefined
398
- ? []
399
- : ["", `The console's own skills, for working the board and keeping a desk: ${ownSkills}`];
414
+ const around = skillsAround(skills, ownSkills, words);
400
415
  if (text === undefined || skills.status !== "ready") {
401
- return [refusalWords("skills", skills, owner), ...own].join("\n");
402
- }
403
- const lines = [head("skills", skills), "", text];
404
- if (skills.page !== null) {
405
- lines.push(
406
- "",
407
- `A host with a SkillCDN connection of its own loads a skill by its URI, which a person makes at ${skills.page}; through the console, ${words.load} takes the URI too. --json adds the page of each skill, for a person.`,
408
- );
416
+ return [
417
+ refusalWords("skills", skills, owner),
418
+ ...around.own.flatMap((line) => ["", line]),
419
+ ].join("\n");
409
420
  }
410
- lines.push(...own);
411
- return lines.join("\n");
421
+ return [
422
+ around.head,
423
+ "",
424
+ text,
425
+ ...[...around.host, ...around.own].flatMap((line) => ["", line]),
426
+ ].join("\n");
427
+ }
428
+
429
+ /**
430
+ * The console's own lines around a listing, each where it has one to say: the line above it,
431
+ * where a person connects an agent of their own, and where the console's own skills are on this
432
+ * machine. A listing printed in pages has them above its first page (ADR-0124), so that the
433
+ * page ends with the command that lists the rest.
434
+ */
435
+ export function skillsAround(
436
+ skills: RestSkills,
437
+ ownSkills?: string,
438
+ words: ToolWords = CONSOLE_WORDS,
439
+ ): { readonly head: string; readonly host: readonly string[]; readonly own: readonly string[] } {
440
+ return {
441
+ head: head("skills", skills),
442
+ host:
443
+ skills.page === null
444
+ ? []
445
+ : [
446
+ `A host with a SkillCDN connection of its own loads a skill by its URI, which a person makes at ${skills.page}; through the console, ${words.load} takes the URI too. --json adds the page of each skill, for a person.`,
447
+ ],
448
+ own:
449
+ ownSkills === undefined
450
+ ? []
451
+ : [`The console's own skills, for working the board and keeping a desk: ${ownSkills}`],
452
+ };
412
453
  }
413
454
 
414
455
  /**
@@ -18,6 +18,8 @@ export interface RunnerHost {
18
18
  /** The operating system as it calls itself, and the OS account the runner runs in. */
19
19
  readonly os: string;
20
20
  readonly user: string;
21
+ /** The system as the runtime names it (`darwin`, `linux`, `win32`); left out by a host that touches no machine. */
22
+ readonly platform?: string | undefined;
21
23
  /** A file under the desk, as text; nothing where there is none. */
22
24
  readText(path: string): Promise<string | undefined>;
23
25
  /** Writes a file under the desk for its owner alone, its folders made on the way: a text, or bytes as they are. */
@@ -92,6 +94,7 @@ export function createRunnerHost(
92
94
  spawn: createSpawn(env),
93
95
  os: `${osType()} ${release()}`,
94
96
  user: user.length === 0 ? "unknown" : user,
97
+ platform: process.platform,
95
98
  async readText(path) {
96
99
  try {
97
100
  return await readFile(under(path), "utf8");
@@ -4,7 +4,7 @@
4
4
  // or another value pasted in its place, is otherwise found out when a push fails. Nothing of the
5
5
  // value is said: what a note names is its shape.
6
6
 
7
- /** What a secret's name says of its value's shape, for the names the package itself reads. */
7
+ /** What a secret's name says of its value's shape, for the names the package itself reads or has an agent keep. */
8
8
  const SHAPES: readonly {
9
9
  readonly name: string;
10
10
  /** The kind of git host the shape holds for, where it is one host's own. */
@@ -17,6 +17,14 @@ const SHAPES: readonly {
17
17
  shape: /^xapp-/,
18
18
  says: "an app-level token of Slack begins with xapp-",
19
19
  },
20
+ {
21
+ // The same app's other token, which the agent sends with itself. The two are copied unseen,
22
+ // one after the other, and the package never reads this one: nothing else here would say
23
+ // that the wrong one was kept.
24
+ name: "slack.user_token",
25
+ shape: /^xoxp-/,
26
+ says: "a member's token of Slack begins with xoxp-",
27
+ },
20
28
  {
21
29
  name: "git.token",
22
30
  host: "github",
@@ -1,4 +1,4 @@
1
- import { readFile, stat, writeFile } from "node:fs/promises";
1
+ import { chmod, readFile, stat, writeFile } from "node:fs/promises";
2
2
  import { join, resolve } from "node:path";
3
3
  import process from "node:process";
4
4
  import { secretKeys } from "./keys.js";
@@ -70,10 +70,26 @@ export function readBytesAt(path: string): Promise<Uint8Array> {
70
70
 
71
71
  /**
72
72
  * A file read from the console, written at the path, or into it under the file's name when
73
- * the path is a directory; says where it went, in full.
73
+ * the path is a directory; says where it went, in full. With `private`, the file is the OS
74
+ * account's alone to read (mode 600), one that was there before too: what holds a line that is
75
+ * shown once is no other account's of the machine to read. Windows keeps a file to its account's
76
+ * own folders by itself and has no such mode. With `after`, the bytes go after what the file
77
+ * holds and nothing of it is taken away: a path is tried so, with no bytes, before what is to
78
+ * be written there exists.
74
79
  */
75
- export async function writeBytesAt(path: string, bytes: Uint8Array, name: string): Promise<string> {
80
+ export async function writeBytesAt(
81
+ path: string,
82
+ bytes: Uint8Array,
83
+ name: string,
84
+ options: { readonly private?: boolean; readonly after?: boolean } = {},
85
+ ): Promise<string> {
76
86
  const target = (await stat(path).catch(() => undefined))?.isDirectory() ? join(path, name) : path;
77
- await writeFile(target, bytes);
87
+ const flag = options.after === true ? "a" : "w";
88
+ if (options.private === true) {
89
+ await writeFile(target, bytes, { mode: 0o600, flag });
90
+ await chmod(target, 0o600);
91
+ } else {
92
+ await writeFile(target, bytes, { flag });
93
+ }
78
94
  return resolve(target);
79
95
  }
package/src/client.ts CHANGED
@@ -68,6 +68,12 @@ import {
68
68
  type RestMembers,
69
69
  type RestMePatch,
70
70
  type RestMyDecisions,
71
+ type RestNotificationSettings,
72
+ type RestNotificationSettingsInput,
73
+ type RestNotifications,
74
+ type RestNotificationsRead,
75
+ type RestNotificationsReadInput,
76
+ type RestOwnResetInput,
71
77
  type RestOwnWakeInput,
72
78
  type RestOwnWakeRaised,
73
79
  type RestOwnWakes,
@@ -125,6 +131,7 @@ import {
125
131
  type RestSkills,
126
132
  type RestTask,
127
133
  type RestTaskBriefs,
134
+ type RestTaskFollow,
128
135
  type RestTaskInput,
129
136
  type RestTaskPatch,
130
137
  type RestTasks,
@@ -149,6 +156,8 @@ import {
149
156
  type RestWorkspace,
150
157
  type RestWorkspacePackConnect,
151
158
  type RestWorkspacePatch,
159
+ type RestWriters,
160
+ type RestWritersInput,
152
161
  restAgentInvitationMadeSchema,
153
162
  restAgentInvitationStateSchema,
154
163
  restAgentProposalsSchema,
@@ -183,6 +192,9 @@ import {
183
192
  restMembersSchema,
184
193
  restMeSchema,
185
194
  restMyDecisionsSchema,
195
+ restNotificationSettingsSchema,
196
+ restNotificationsReadSchema,
197
+ restNotificationsSchema,
186
198
  restOwnWakeRaisedSchema,
187
199
  restOwnWakesSchema,
188
200
  restPackConnectSchema,
@@ -222,6 +234,7 @@ import {
222
234
  restSkillRowsSchema,
223
235
  restSkillsSchema,
224
236
  restTaskBriefsSchema,
237
+ restTaskFollowSchema,
225
238
  restTaskSchema,
226
239
  restTasksSchema,
227
240
  restTeamSchema,
@@ -239,6 +252,7 @@ import {
239
252
  restWorkSchema,
240
253
  restWorkspacePackConnectSchema,
241
254
  restWorkspaceSchema,
255
+ restWritersSchema,
242
256
  } from "./schemas.js";
243
257
  import { readSse } from "./sse.js";
244
258
  import type { GoalState, TaskState } from "./vocabulary.js";
@@ -410,12 +424,15 @@ export interface ProjectClient {
410
424
  tasks(filter?: TaskFilter, signal?: AbortSignal): Promise<RestTasks>;
411
425
  /**
412
426
  * The same page of the board without the tasks' bodies (`?brief=true`), for what lists tasks
413
- * and shows no body. A console from before the brief form answers the tasks whole, and they
414
- * read the same.
427
+ * and shows no body.
415
428
  */
416
429
  taskBriefs(filter?: TaskFilter, signal?: AbortSignal): Promise<RestTaskBriefs>;
417
430
  /** One task, by its id or by its number. */
418
431
  task(ref: string, signal?: AbortSignal): Promise<RestTask>;
432
+ /** Whether a task tells the asker anything (ADR-0157), and whether their settings alone would have it so. By its id or its number. */
433
+ taskFollow(ref: string, signal?: AbortSignal): Promise<RestTaskFollow>;
434
+ /** Turns a task's notifications on or off for the asker. */
435
+ followTask(ref: string, on: boolean): Promise<RestTaskFollow>;
419
436
  createTask(input: RestTaskInput): Promise<RestTask>;
420
437
  updateTask(id: string, patch: RestTaskPatch): Promise<RestTask>;
421
438
  /** Puts a done or dropped task away (ADR-0029), or brings one back. */
@@ -448,8 +465,7 @@ export interface ProjectClient {
448
465
  ): Promise<RestRuns>;
449
466
  /**
450
467
  * The same page of the runs without their reports, counted (`?brief=true`), for what lists
451
- * runs and shows no report. A console from before the brief form answers the runs whole,
452
- * which reads the same: `reportCountOf` says how many reports a run has either way.
468
+ * runs and shows no report: `reportCountOf` says how many reports a run has.
453
469
  */
454
470
  runBriefs(
455
471
  filter?: { readonly task?: string; readonly open?: boolean; readonly mine?: boolean } & Page,
@@ -705,8 +721,7 @@ export interface PluginClient {
705
721
  * The plugin's events the asker may read, newest first, a page at a time: every one for an
706
722
  * administrator; for anyone else those of the projects they may see, their own doing, and the
707
723
  * console's word of the plugin, the rest left out with no word that it is there. Of one kind
708
- * where one is named (ADR-0128), which a console before 0.5.1 does not narrow by and answers
709
- * every kind.
724
+ * where one is named (ADR-0128).
710
725
  */
711
726
  events(
712
727
  page?: Page & { readonly kind?: string | undefined },
@@ -826,12 +841,24 @@ export interface ConsoleClient {
826
841
  signalStream(after: number, signal: AbortSignal): AsyncIterable<RestSignal>;
827
842
  /** Raises a wake of the runner's own, from a wake source on its machine: it comes back in order on the stream. */
828
843
  raiseWake(input: Omit<RestRunnerWake, "kind">): Promise<RestSignal>;
844
+ /**
845
+ * Who accounts at a messenger are to the agent account that asks (ADR-0164): the member each
846
+ * is, as a plugin that holds `people:accounts` said it, and whether they supervise the
847
+ * account. A console older than the route answers that there is none (`404`).
848
+ */
849
+ writers(input: RestWritersInput, signal?: AbortSignal): Promise<RestWriters>;
829
850
  /** An agent account raises a wake for itself (ADR-0145), by its own command: now, or kept for a moment to come. */
830
851
  raiseOwnWake(input: RestOwnWakeInput): Promise<RestOwnWakeRaised>;
831
852
  /** The wakes an agent account keeps for later, the soonest first; for its supervisors, and as `me` for the account. */
832
853
  ownWakes(handle: string, signal?: AbortSignal): Promise<RestOwnWakes>;
833
854
  /** Takes a wake kept for later away, by what it is called; the account's own. */
834
855
  cancelOwnWake(key: string): Promise<void>;
856
+ /**
857
+ * An agent account begins a new conversation for itself (ADR-0154), by its own command: a
858
+ * `reset` of its record, sent by the account, which its runner takes when the turn under way
859
+ * is over, with the words that say why.
860
+ */
861
+ sendOwnReset(input: RestOwnResetInput): Promise<RestSignal>;
835
862
  /** The runner begins a session (ADR-0086): the one that was open is taken over. */
836
863
  beginAgentSession(input: RestAgentSessionInput): Promise<RestAgentSession>;
837
864
  /** The runner reports a batch of a session's events, in order; the same number sent again changes nothing. */
@@ -942,6 +969,19 @@ export interface ConsoleClient {
942
969
  filter?: { readonly open?: boolean; readonly raised?: boolean } & Page,
943
970
  signal?: AbortSignal,
944
971
  ): Promise<RestMyDecisions>;
972
+ /** What the asker is told of (ADR-0157): a page of their notifications, the newest first, with `unread` those they have not read alone. */
973
+ notifications(
974
+ filter?: { readonly unread?: boolean } & Page,
975
+ signal?: AbortSignal,
976
+ ): Promise<RestNotifications>;
977
+ /** Marks notifications as read: those named, or all of the asker's. */
978
+ readNotifications(input: RestNotificationsReadInput): Promise<RestNotificationsRead>;
979
+ /** What the asker is told of: each kind on or off, the projects turned off, whether their own agents count. */
980
+ notificationSettings(signal?: AbortSignal): Promise<RestNotificationSettings>;
981
+ /** Changes what the asker is told of, or puts it back to what a member who chose nothing has. */
982
+ updateNotificationSettings(
983
+ input: RestNotificationSettingsInput,
984
+ ): Promise<RestNotificationSettings>;
945
985
  /**
946
986
  * One decision by its id, wherever it is (ADR-0068): in a project the asker may see, or one
947
987
  * that reaches them from elsewhere, addressed to them, raised by them, or a plugin's addressed
@@ -1295,6 +1335,16 @@ export function createClient(options: ClientOptions = {}): ConsoleClient {
1295
1335
  ),
1296
1336
  task: (ref, signal) =>
1297
1337
  request("GET", `${base}${at("tasks", ref)}`, undefined, restTaskSchema, signal),
1338
+ taskFollow: (ref, signal) =>
1339
+ request(
1340
+ "GET",
1341
+ `${base}${at("tasks", ref)}/follow`,
1342
+ undefined,
1343
+ restTaskFollowSchema,
1344
+ signal,
1345
+ ),
1346
+ followTask: (ref, on) =>
1347
+ request("PUT", `${base}${at("tasks", ref)}/follow`, { on }, restTaskFollowSchema),
1298
1348
  createTask: (input) => request("POST", `${base}${at("tasks")}`, input, restTaskSchema),
1299
1349
  updateTask: (id, patch) =>
1300
1350
  request("PATCH", `${base}${at("tasks", id)}`, patch, restTaskSchema),
@@ -1762,6 +1812,8 @@ export function createClient(options: ClientOptions = {}): ConsoleClient {
1762
1812
  { kind: "wake", ...input },
1763
1813
  restSignalSchema,
1764
1814
  ),
1815
+ writers: (input, signal) =>
1816
+ request("POST", `${base}${agentPath("me", "writers")}`, input, restWritersSchema, signal),
1765
1817
  raiseOwnWake: (input) =>
1766
1818
  request("POST", `${base}${agentPath("me", "wakes")}`, input, restOwnWakeRaisedSchema),
1767
1819
  ownWakes: (handle, signal) =>
@@ -1774,6 +1826,8 @@ export function createClient(options: ClientOptions = {}): ConsoleClient {
1774
1826
  restOwnWakesSchema,
1775
1827
  );
1776
1828
  },
1829
+ sendOwnReset: (input) =>
1830
+ request("POST", `${base}${agentPath("me", "reset")}`, input, restSignalSchema),
1777
1831
  async *signalStream(after, signal) {
1778
1832
  let response: Response;
1779
1833
  try {
@@ -1998,6 +2052,40 @@ export function createClient(options: ClientOptions = {}): ConsoleClient {
1998
2052
  restMyDecisionsSchema,
1999
2053
  signal,
2000
2054
  ),
2055
+ notifications: (filter = {}, signal) =>
2056
+ request(
2057
+ "GET",
2058
+ withQuery(REST_ROUTES.notifications, {
2059
+ unread: filter.unread === true ? "true" : undefined,
2060
+ limit: number(filter.limit),
2061
+ offset: number(filter.offset),
2062
+ }),
2063
+ undefined,
2064
+ restNotificationsSchema,
2065
+ signal,
2066
+ ),
2067
+ readNotifications: (input) =>
2068
+ request(
2069
+ "POST",
2070
+ `${base}${REST_ROUTES.notifications}/read`,
2071
+ input,
2072
+ restNotificationsReadSchema,
2073
+ ),
2074
+ notificationSettings: (signal) =>
2075
+ request(
2076
+ "GET",
2077
+ `${base}${REST_ROUTES.notifications}/settings`,
2078
+ undefined,
2079
+ restNotificationSettingsSchema,
2080
+ signal,
2081
+ ),
2082
+ updateNotificationSettings: (input) =>
2083
+ request(
2084
+ "PUT",
2085
+ `${base}${REST_ROUTES.notifications}/settings`,
2086
+ input,
2087
+ restNotificationSettingsSchema,
2088
+ ),
2001
2089
  decision: (id, signal) =>
2002
2090
  request("GET", `${base}${decisionPath(id)}`, undefined, restReachedDecisionSchema, signal),
2003
2091
  awaitDecision: (id, waitSeconds, signal) =>