@skillcdn/console 0.5.0 → 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 (345) hide show
  1. package/README.md +68 -11
  2. package/SKILLCDN.md +3 -3
  3. package/dist/agent-page.d.ts.map +1 -1
  4. package/dist/agent-page.js +3 -2
  5. package/dist/agent-page.js.map +1 -1
  6. package/dist/api.d.ts +7 -6
  7. package/dist/api.d.ts.map +1 -1
  8. package/dist/api.js +6 -5
  9. package/dist/api.js.map +1 -1
  10. package/dist/charts.d.ts +103 -0
  11. package/dist/charts.d.ts.map +1 -0
  12. package/dist/charts.js +182 -0
  13. package/dist/charts.js.map +1 -0
  14. package/dist/cli/cli.d.ts +26 -2
  15. package/dist/cli/cli.d.ts.map +1 -1
  16. package/dist/cli/cli.js +1304 -383
  17. package/dist/cli/cli.js.map +1 -1
  18. package/dist/cli/command-words.d.ts +20 -0
  19. package/dist/cli/command-words.d.ts.map +1 -0
  20. package/dist/cli/command-words.js +51 -0
  21. package/dist/cli/command-words.js.map +1 -0
  22. package/dist/cli/credentials.d.ts +54 -5
  23. package/dist/cli/credentials.d.ts.map +1 -1
  24. package/dist/cli/credentials.js +126 -20
  25. package/dist/cli/credentials.js.map +1 -1
  26. package/dist/cli/directory.d.ts +19 -4
  27. package/dist/cli/directory.d.ts.map +1 -1
  28. package/dist/cli/directory.js +16 -8
  29. package/dist/cli/directory.js.map +1 -1
  30. package/dist/cli/format.d.ts +65 -8
  31. package/dist/cli/format.d.ts.map +1 -1
  32. package/dist/cli/format.js +242 -37
  33. package/dist/cli/format.js.map +1 -1
  34. package/dist/cli/help.d.ts +13 -4
  35. package/dist/cli/help.d.ts.map +1 -1
  36. package/dist/cli/help.js +92 -54
  37. package/dist/cli/help.js.map +1 -1
  38. package/dist/cli/main.js +76 -2
  39. package/dist/cli/main.js.map +1 -1
  40. package/dist/cli/pack.d.ts +69 -60
  41. package/dist/cli/pack.d.ts.map +1 -1
  42. package/dist/cli/pack.js +241 -270
  43. package/dist/cli/pack.js.map +1 -1
  44. package/dist/cli/plugin-check.d.ts +42 -0
  45. package/dist/cli/plugin-check.d.ts.map +1 -1
  46. package/dist/cli/plugin-check.js +221 -36
  47. package/dist/cli/plugin-check.js.map +1 -1
  48. package/dist/cli/plugin-cli.d.ts +6 -1
  49. package/dist/cli/plugin-cli.d.ts.map +1 -1
  50. package/dist/cli/plugin-cli.js +21 -4
  51. package/dist/cli/plugin-cli.js.map +1 -1
  52. package/dist/cli/plugin-main.js +1 -0
  53. package/dist/cli/plugin-main.js.map +1 -1
  54. package/dist/cli/serve.d.ts +33 -1
  55. package/dist/cli/serve.d.ts.map +1 -1
  56. package/dist/cli/serve.js +252 -3
  57. package/dist/cli/serve.js.map +1 -1
  58. package/dist/client.d.ts +48 -9
  59. package/dist/client.d.ts.map +1 -1
  60. package/dist/client.js +72 -80
  61. package/dist/client.js.map +1 -1
  62. package/dist/components/agent-page.d.ts +64 -1
  63. package/dist/components/agent-page.d.ts.map +1 -1
  64. package/dist/components/agent-page.js +244 -96
  65. package/dist/components/agent-page.js.map +1 -1
  66. package/dist/components/charts.d.ts +157 -0
  67. package/dist/components/charts.d.ts.map +1 -0
  68. package/dist/components/charts.js +182 -0
  69. package/dist/components/charts.js.map +1 -0
  70. package/dist/components/desk-records.d.ts +102 -0
  71. package/dist/components/desk-records.d.ts.map +1 -0
  72. package/dist/components/desk-records.js +221 -0
  73. package/dist/components/desk-records.js.map +1 -0
  74. package/dist/components/desk.d.ts +85 -0
  75. package/dist/components/desk.d.ts.map +1 -0
  76. package/dist/components/desk.js +135 -0
  77. package/dist/components/desk.js.map +1 -0
  78. package/dist/components/event-feed.d.ts.map +1 -1
  79. package/dist/components/event-feed.js +4 -1
  80. package/dist/components/event-feed.js.map +1 -1
  81. package/dist/components/home.d.ts.map +1 -1
  82. package/dist/components/home.js +4 -2
  83. package/dist/components/home.js.map +1 -1
  84. package/dist/components/plugin-settings.d.ts.map +1 -1
  85. package/dist/components/plugin-settings.js +54 -3
  86. package/dist/components/plugin-settings.js.map +1 -1
  87. package/dist/components/projects.d.ts.map +1 -1
  88. package/dist/components/projects.js +27 -7
  89. package/dist/components/projects.js.map +1 -1
  90. package/dist/components/rules.d.ts +8 -10
  91. package/dist/components/rules.d.ts.map +1 -1
  92. package/dist/components/rules.js +35 -13
  93. package/dist/components/rules.js.map +1 -1
  94. package/dist/components/setup.d.ts +9 -3
  95. package/dist/components/setup.d.ts.map +1 -1
  96. package/dist/components/setup.js +10 -4
  97. package/dist/components/setup.js.map +1 -1
  98. package/dist/console.css +677 -7
  99. package/dist/console.d.ts +5 -0
  100. package/dist/console.d.ts.map +1 -1
  101. package/dist/console.js +14 -8
  102. package/dist/console.js.map +1 -1
  103. package/dist/data.d.ts.map +1 -1
  104. package/dist/data.js +32 -33
  105. package/dist/data.js.map +1 -1
  106. package/dist/desk-page.d.ts +38 -0
  107. package/dist/desk-page.d.ts.map +1 -0
  108. package/dist/desk-page.js +184 -0
  109. package/dist/desk-page.js.map +1 -0
  110. package/dist/desk-records-page.d.ts +18 -0
  111. package/dist/desk-records-page.d.ts.map +1 -0
  112. package/dist/desk-records-page.js +130 -0
  113. package/dist/desk-records-page.js.map +1 -0
  114. package/dist/desk-records.d.ts +247 -0
  115. package/dist/desk-records.d.ts.map +1 -0
  116. package/dist/desk-records.js +543 -0
  117. package/dist/desk-records.js.map +1 -0
  118. package/dist/desk.d.ts +122 -0
  119. package/dist/desk.d.ts.map +1 -0
  120. package/dist/desk.js +211 -0
  121. package/dist/desk.js.map +1 -0
  122. package/dist/feed-stream.d.ts +39 -0
  123. package/dist/feed-stream.d.ts.map +1 -0
  124. package/dist/feed-stream.js +117 -0
  125. package/dist/feed-stream.js.map +1 -0
  126. package/dist/home-tiles.d.ts +10 -3
  127. package/dist/home-tiles.d.ts.map +1 -1
  128. package/dist/home-tiles.js +54 -31
  129. package/dist/home-tiles.js.map +1 -1
  130. package/dist/i18n/en.d.ts +180 -5
  131. package/dist/i18n/en.d.ts.map +1 -1
  132. package/dist/i18n/en.js +184 -7
  133. package/dist/i18n/en.js.map +1 -1
  134. package/dist/i18n/ko.d.ts.map +1 -1
  135. package/dist/i18n/ko.js +169 -6
  136. package/dist/i18n/ko.js.map +1 -1
  137. package/dist/index.d.ts +8 -0
  138. package/dist/index.d.ts.map +1 -1
  139. package/dist/index.js +8 -0
  140. package/dist/index.js.map +1 -1
  141. package/dist/limits.d.ts +11 -0
  142. package/dist/limits.d.ts.map +1 -1
  143. package/dist/limits.js +11 -0
  144. package/dist/limits.js.map +1 -1
  145. package/dist/onboarding.d.ts +6 -0
  146. package/dist/onboarding.d.ts.map +1 -1
  147. package/dist/onboarding.js +3 -3
  148. package/dist/onboarding.js.map +1 -1
  149. package/dist/plugin/context.d.ts +42 -11
  150. package/dist/plugin/context.d.ts.map +1 -1
  151. package/dist/plugin/limits.d.ts +2 -0
  152. package/dist/plugin/limits.d.ts.map +1 -1
  153. package/dist/plugin/limits.js +2 -0
  154. package/dist/plugin/limits.js.map +1 -1
  155. package/dist/plugin/manifest.d.ts +13 -0
  156. package/dist/plugin/manifest.d.ts.map +1 -1
  157. package/dist/plugin/manifest.js +30 -3
  158. package/dist/plugin/manifest.js.map +1 -1
  159. package/dist/plugin/rest-schemas.d.ts +55 -0
  160. package/dist/plugin/rest-schemas.d.ts.map +1 -1
  161. package/dist/plugin/rest-schemas.js +37 -0
  162. package/dist/plugin/rest-schemas.js.map +1 -1
  163. package/dist/plugin/sandbox.d.ts.map +1 -1
  164. package/dist/plugin/sandbox.js +4 -1
  165. package/dist/plugin/sandbox.js.map +1 -1
  166. package/dist/plugin/testing.d.ts +6 -2
  167. package/dist/plugin/testing.d.ts.map +1 -1
  168. package/dist/plugin/testing.js +52 -10
  169. package/dist/plugin/testing.js.map +1 -1
  170. package/dist/plugin.d.ts +1 -1
  171. package/dist/plugin.d.ts.map +1 -1
  172. package/dist/plugin.js +1 -1
  173. package/dist/plugin.js.map +1 -1
  174. package/dist/records.d.ts +283 -0
  175. package/dist/records.d.ts.map +1 -0
  176. package/dist/records.js +543 -0
  177. package/dist/records.js.map +1 -0
  178. package/dist/routes.d.ts +3 -1
  179. package/dist/routes.d.ts.map +1 -1
  180. package/dist/routes.js +3 -1
  181. package/dist/routes.js.map +1 -1
  182. package/dist/rules.d.ts +30 -11
  183. package/dist/rules.d.ts.map +1 -1
  184. package/dist/rules.js +98 -45
  185. package/dist/rules.js.map +1 -1
  186. package/dist/runner/acp.d.ts +1 -1
  187. package/dist/runner/acp.d.ts.map +1 -1
  188. package/dist/runner/acp.js +31 -20
  189. package/dist/runner/acp.js.map +1 -1
  190. package/dist/runner/claude.d.ts +1 -1
  191. package/dist/runner/claude.d.ts.map +1 -1
  192. package/dist/runner/claude.js +85 -15
  193. package/dist/runner/claude.js.map +1 -1
  194. package/dist/runner/codex.d.ts +1 -1
  195. package/dist/runner/codex.d.ts.map +1 -1
  196. package/dist/runner/codex.js +19 -16
  197. package/dist/runner/codex.js.map +1 -1
  198. package/dist/runner/desk.d.ts +43 -2
  199. package/dist/runner/desk.d.ts.map +1 -1
  200. package/dist/runner/desk.js +166 -10
  201. package/dist/runner/desk.js.map +1 -1
  202. package/dist/runner/process.d.ts.map +1 -1
  203. package/dist/runner/process.js +11 -4
  204. package/dist/runner/process.js.map +1 -1
  205. package/dist/runner/redact.d.ts +39 -4
  206. package/dist/runner/redact.d.ts.map +1 -1
  207. package/dist/runner/redact.js +81 -5
  208. package/dist/runner/redact.js.map +1 -1
  209. package/dist/runner/runner.d.ts +15 -1
  210. package/dist/runner/runner.d.ts.map +1 -1
  211. package/dist/runner/runner.js +231 -33
  212. package/dist/runner/runner.js.map +1 -1
  213. package/dist/runner/task-scheduler.d.ts +20 -0
  214. package/dist/runner/task-scheduler.d.ts.map +1 -1
  215. package/dist/runner/task-scheduler.js +34 -4
  216. package/dist/runner/task-scheduler.js.map +1 -1
  217. package/dist/runner/types.d.ts +36 -1
  218. package/dist/runner/types.d.ts.map +1 -1
  219. package/dist/runner/types.js +17 -0
  220. package/dist/runner/types.js.map +1 -1
  221. package/dist/runner.d.ts +6 -6
  222. package/dist/runner.d.ts.map +1 -1
  223. package/dist/runner.js +5 -5
  224. package/dist/runner.js.map +1 -1
  225. package/dist/schemas.d.ts +509 -5
  226. package/dist/schemas.d.ts.map +1 -1
  227. package/dist/schemas.js +76 -16
  228. package/dist/schemas.js.map +1 -1
  229. package/dist/services.d.ts +22 -5
  230. package/dist/services.d.ts.map +1 -1
  231. package/dist/services.js +35 -15
  232. package/dist/services.js.map +1 -1
  233. package/dist/setup-guide.d.ts +3 -1
  234. package/dist/setup-guide.d.ts.map +1 -1
  235. package/dist/setup-guide.js +7 -4
  236. package/dist/setup-guide.js.map +1 -1
  237. package/dist/vocabulary.d.ts +14 -3
  238. package/dist/vocabulary.d.ts.map +1 -1
  239. package/dist/vocabulary.js +13 -3
  240. package/dist/vocabulary.js.map +1 -1
  241. package/docs/specs/cli.md +64 -38
  242. package/docs/specs/plugins.md +27 -20
  243. package/docs/specs/records.md +113 -0
  244. package/docs/specs/rest.md +20 -13
  245. package/docs/specs/runner.md +23 -17
  246. package/package.json +7 -2
  247. package/skills/building-a-console/SKILL.md +4 -4
  248. package/skills/building-a-plugin/SKILL.md +6 -6
  249. package/skills/deploying-a-console/SKILL.md +4 -4
  250. package/skills/deploying-a-console/references/resources.md +41 -4
  251. package/skills/deploying-a-console/references/running-it-again.md +3 -2
  252. package/skills/keeping-a-desk/SKILL.md +133 -0
  253. package/skills/keeping-a-desk/collections.md +96 -0
  254. package/skills/planning-the-board/SKILL.md +14 -18
  255. package/skills/planning-the-board/references/a-task.md +2 -2
  256. package/skills/planning-the-board/references/project-rules.md +13 -14
  257. package/skills/planning-the-board/references/setting-up.md +15 -13
  258. package/skills/running-an-agent/SKILL.md +10 -9
  259. package/skills/working-the-board/SKILL.md +62 -44
  260. package/skills/working-the-board/references/terms.md +9 -5
  261. package/skills/working-the-board/references/the-pack.md +12 -10
  262. package/skills/working-the-board/references/the-sentence.md +2 -2
  263. package/src/agent-page.tsx +3 -1
  264. package/src/api.ts +77 -2
  265. package/src/charts.ts +250 -0
  266. package/src/cli/cli.ts +1698 -476
  267. package/src/cli/command-words.ts +56 -0
  268. package/src/cli/credentials.ts +181 -20
  269. package/src/cli/directory.ts +28 -10
  270. package/src/cli/format.ts +301 -46
  271. package/src/cli/help.ts +102 -54
  272. package/src/cli/main.ts +72 -2
  273. package/src/cli/pack.ts +333 -372
  274. package/src/cli/plugin-check.ts +275 -34
  275. package/src/cli/plugin-cli.ts +28 -4
  276. package/src/cli/plugin-main.ts +1 -0
  277. package/src/cli/serve.ts +295 -2
  278. package/src/client.ts +192 -177
  279. package/src/components/agent-page.tsx +489 -243
  280. package/src/components/charts.tsx +680 -0
  281. package/src/components/desk-records.tsx +724 -0
  282. package/src/components/desk.tsx +471 -0
  283. package/src/components/event-feed.tsx +5 -1
  284. package/src/components/home.tsx +12 -0
  285. package/src/components/plugin-settings.tsx +171 -12
  286. package/src/components/projects.tsx +29 -12
  287. package/src/components/rules.tsx +94 -34
  288. package/src/components/setup.tsx +18 -3
  289. package/src/console.tsx +17 -9
  290. package/src/data.ts +37 -34
  291. package/src/desk-page.tsx +332 -0
  292. package/src/desk-records-page.tsx +256 -0
  293. package/src/desk-records.ts +808 -0
  294. package/src/desk.ts +329 -0
  295. package/src/feed-stream.ts +144 -0
  296. package/src/home-tiles.ts +55 -35
  297. package/src/i18n/en.ts +196 -9
  298. package/src/i18n/ko.ts +178 -8
  299. package/src/index.ts +118 -0
  300. package/src/limits.ts +11 -0
  301. package/src/onboarding.ts +12 -4
  302. package/src/plugin/context.ts +55 -12
  303. package/src/plugin/limits.ts +2 -0
  304. package/src/plugin/manifest.ts +38 -2
  305. package/src/plugin/rest-schemas.ts +41 -0
  306. package/src/plugin/sandbox.ts +4 -1
  307. package/src/plugin/testing.ts +63 -12
  308. package/src/plugin.ts +2 -0
  309. package/src/records.ts +702 -0
  310. package/src/routes.ts +3 -1
  311. package/src/rules.ts +108 -47
  312. package/src/runner/acp.ts +47 -29
  313. package/src/runner/claude.ts +113 -23
  314. package/src/runner/codex.ts +35 -25
  315. package/src/runner/desk.ts +198 -12
  316. package/src/runner/process.ts +11 -4
  317. package/src/runner/redact.ts +92 -6
  318. package/src/runner/runner.ts +275 -34
  319. package/src/runner/task-scheduler.ts +36 -4
  320. package/src/runner/types.ts +47 -1
  321. package/src/runner.ts +27 -2
  322. package/src/schemas.ts +83 -15
  323. package/src/services.ts +49 -14
  324. package/src/setup-guide.ts +6 -2
  325. package/src/styles/README.md +11 -1
  326. package/src/styles/console.css +9 -0
  327. package/src/styles/pages/desk.css +126 -0
  328. package/src/styles/pages/documents.css +5 -0
  329. package/src/styles/parts/bars.css +80 -0
  330. package/src/styles/parts/chart.css +173 -0
  331. package/src/styles/parts/figures.css +65 -0
  332. package/src/styles/parts/legend.css +48 -0
  333. package/src/styles/parts/series.css +32 -0
  334. package/src/styles/parts/share.css +25 -0
  335. package/src/styles/parts/spark.css +23 -0
  336. package/src/styles/parts/stat.css +69 -0
  337. package/src/styles/tokens.css +13 -7
  338. package/src/vocabulary.ts +16 -3
  339. package/template/desk-web/README.md +8 -0
  340. package/template/desk-web/index.html +13 -0
  341. package/template/desk-web/package.json +25 -0
  342. package/template/desk-web/src/main.tsx +24 -0
  343. package/template/desk-web/src/page.tsx +51 -0
  344. package/template/desk-web/tsconfig.json +16 -0
  345. package/template/desk-web/vite.config.ts +15 -0
@@ -58,7 +58,7 @@
58
58
  | `requires` | `{ [key]: range }` | other plugins this one needs, by a semver range of their version; they are enabled first and cannot be disabled while this one is |
59
59
  | `grants` | `{ [key]: { roles, why } }` | the roles of other plugins the plugin asks to hold as itself ([ADR-0072](../adr/0072-a-plugin-is-a-principal-it-holds-roles-granted-to-it-calls-as-itself-and-acts-for-a-person-within-what-both-may-do.md)): up to 10 plugins, each with `why`, localized, for the administrator who grants them when enabling or on the plugin's page; never of itself |
60
60
  | `board` | `{ needs, defaults? }` | `needs` is `required`, `optional` or `none`; `defaults` the `key`, `name` and `description` per language of the project an administrator may make for it |
61
- | `settings` | Setting[] | up to 50, each `{ key, type, name, description?, required?, default?, min?, max?, options?, of? }`; `key` a lowercase letter followed by letters and digits (`daysPerYear`), as code and `--set` name it; types `text`, `markdown`, `number`, `boolean`, `enum` (with `options`, each `{ value, name }`), `day`, `time` (`HH:MM`, read in the workspace's time zone), `person`, `project`, `secret`, `list` (with `of`, any type but `secret` and `list`); `min` and `max` bound a number, the length of a text or the items of a list; `default` fits the type, and `person`, `project` and `secret` have none; `group` names one of `settingGroups`, under which the form shows the setting; a `secret` may name `hosts`, the hosts it goes into a request to, and is sealed from the answers of, and no other (`slack.com`, `*.example.com`, as `outbound:<host>` names them), and `use: "verify"`, a secret that verifies signatures and signs nothing ([ADR-0070](../adr/0070-a-secret-is-sealed-by-the-console-from-an-answer-and-goes-where-its-setting-says.md)) |
61
+ | `settings` | Setting[] | up to 50, each `{ key, type, name, description?, required?, default?, min?, max?, options?, of? }`; `key` a lowercase letter followed by letters and digits (`daysPerYear`), as code and `--set` name it; types `text`, `markdown`, `number`, `boolean`, `enum` (with `options`, each `{ value, name }`), `day`, `time` (`HH:MM`, read in the workspace's time zone), `person`, `project`, `secret`, `list` (with `of`, any type but `secret` and `list`); `min` and `max` bound a number, the length of a text or the items of a list; `default` fits the type, and `person`, `project` and `secret` have none; `group` names one of `settingGroups`, under which the form shows the setting; a `secret` may name `hosts`, the hosts it goes into a request to, and is sealed from the answers of, and no other (`slack.com`, `*.example.com`, as `outbound:<host>` names them), and `use: "verify"`, a secret that verifies signatures and signs nothing ([ADR-0070](../adr/0070-a-secret-is-sealed-by-the-console-from-an-answer-and-goes-where-its-setting-says.md)); and `keyed: { max }`, a secret that keeps one value per key, up to `max` keys (1 to 1,000), a key being letters, digits, `_` and `-` up to 64 and no secret, never `required` and taking no `use` ([ADR-0111](../adr/0111-a-secret-setting-may-keep-one-value-per-key.md)) |
62
62
  | `settingGroups` | Group[] | up to 10, each `{ key, name, description? }`, in the order the form shows them; the settings without a `group` come above them |
63
63
  | `menu` | `{ group, order?, name? }` | the tab the plugin is under: a group of the console's (`people`, `customers`, `money`, `operations`, `marketing`, `engineering`, `reports`), or one the plugin declares with a `name` per language; `order` within the row, default 100 |
64
64
  | `pages` | Page[] | up to 12, each `{ key, name, level, roles?, wide? }`; `level` is `workspace` or `project`; page keys as `key`, and not `frame`, `web` or `x` |
@@ -152,7 +152,7 @@ export default definePlugin({
152
152
  | Part | Shape | Notes |
153
153
  |---|---|---|
154
154
  | `collections` | `[defineCollection(name, { schema, indexes?, search?, owner?, project?, read?, readOwn?, history?, retention? })]` | a list; `name` as `key`; `schema` is a zod object (any schema that follows Standard Schema), checked in the plugin's thread on every write; `indexes` (up to 8) are the fields `where`, `order` and `aggregate` may name, beside `id`, `owner` and `project`, which always may; `search` the fields searched as words; `owner` an indexed field holding a person's id, for `readOwn`; `project` is `none` (unless said), `optional` or `required`; `read` and `readOwn` name roles; `history` keeps a version per write, `true` unless said otherwise; `retention: { days, by? }` forgets a record `days` (1 to 3650) after the moment `by` names, `createdAt` unless said, `updatedAt`, or an indexed field holding a day or an instant as ISO 8601 text, which with `history: false` makes a light collection for logs and deliveries; up to 50 collections. The definition is what `ctx.records(requests)` takes, and types the records from the schema |
155
- | `commands` | `defineCommand({ about, args, roles?, run })` | `about` one line; `args` named definers, positional where `positional: true`, in declaration order; `run(ctx, args)` returns `{ text, data?, waiting? }`: `text` is what the command prints, `data` what `--json` prints, `waiting` the id of a decision the caller waits for; up to 100 commands and queries together, named as `key` and not as a subcommand of the command (`help`, `records`, `skills`, `skill`, `enable`, `disable`, `settings`, `secret`, `grant`, `revoke`) |
155
+ | `commands` | `defineCommand({ about, args, roles?, run })` | `about` one line; `args` named definers, positional where `positional: true`, in declaration order; `run(ctx, args)` returns `{ text, data?, waiting? }`: `text` is what the command prints, `data` what `--json` prints, `waiting` the id of a decision the caller waits for; up to 100 commands and queries together, named as `key` and not as a subcommand of the command (`help`, `records`, `events`, `skills`, `skill`, `enable`, `disable`, `capabilities`, `settings`, `secret`, `grant`, `revoke`) |
156
156
  | `queries` | `defineQuery({ about, args, roles?, run })` | reads only; `run` returns JSON up to 4 MiB, or `{ file: { name, type, bytes } }` for an export |
157
157
  | `endpoints` | `defineEndpoint({ auth, roles?, secret?, methods?, run })` | with the `endpoints` capability; `auth` is `person` (a session or a token, with `roles`) or `webhook` (nobody; `secret` names the setting the plugin verifies the signature with); `run(ctx, request)`, the request `{ method, path, query, headers, body }` with the headers `content-type` and those the definition names and the body text up to 1 MiB, returns `{ status, headers?, body? }`, the headers among `content-type`, `location` and `cache-control`, the body a string or JSON up to 4 MiB |
158
158
  | `on` | `{ "console:<kind>": handler, "plugin:<key>:<name>": handler }` | hooks; `console:` kinds need `events:console`, `plugin:` ones `events:plugins`; `handler(ctx, event)`, the event `{ id, attempt, source, kind, at, plugin, project, data }`; idempotent, since delivery is at least once: `id` names the event once across both streams (`console:<number>`, `plugin:<number>`) and `attempt` which delivery this is, so that a handler that must not act twice keeps the ids it acted on and passes over one it has seen |
@@ -182,8 +182,8 @@ Everything a plugin does to the console is a call on `ctx`, which is a message t
182
182
  | `ctx.console.documents` | `list(project, folder)`, `read(project, path)`, `write(project, path, { title, body })` under `plugins/<key>/` | `board:read`; `board:documents` |
183
183
  | `ctx.console.runs` | `list(project)`, `get(id)` | `board:read` |
184
184
  | `ctx.events.emit(kind, data)` | an event of the plugin's own, for its frames and for other plugins' hooks; `kind` as `key`, `data` JSON up to 16 KiB | nothing |
185
- | `ctx.fetch(url, init)` | an outbound request, its `method` `GET` (the default), `HEAD`, `POST`, `PUT`, `PATCH`, `DELETE` or `OPTIONS` and no other (`TRACE`, which has a server send the request back, is `plugin.invalid_args`), answered `{ status, headers, bytes, sealed?, text(), json() }`, a redirect as it came, never followed; `init` may carry `secret: { name, as }` or `secrets: [...]`, five at most, `as` one of `header:<name>`, `bearer` (`Authorization: Bearer`), `query:<name>`, `basic` (`user:password`) and `body:<field>` (a field of a JSON object or a form body), and the console puts each secret there, within the `hosts` its setting names and before its expiry, and takes it out of the answer's headers and body in every form it knows (as placed, escaped as JSON, URL-encoded with the hex digits big or small, each with its slashes escaped or not, and in base64, a header's alphabet or a URL's, whole or inside a longer run of it, of the value and of what the request carried for it, a query's, a form's or a JSON body's spelling, for a value of 8 bytes or more; for `basic`, the base64 of the pair and the password alone too, [ADR-0079](../adr/0079-a-secret-is-taken-out-of-an-answer-in-the-encodings-a-service-sends-it-back-in.md)), `"[withheld]"` in its place, so that a server that echoes the request, or a redirect that carries its URL, hands the plugin none; and `seal: { <setting>: "$.path" \| { path, expiresIn } }`, five at most, values of the answer's JSON the console seals as the plugin's secret settings before the plugin reads the answer, which says `"[sealed]"` in their place, `expiresIn` the seconds they last or a path to them, a setting with `hosts` sealed from their answers alone (`plugin.forbidden` before the request goes out otherwise). Sealing fails closed, and `sealed` says what became of each value named, by its setting: `sealed`; `absent`, nothing at the path (no such key, `null` or an empty string), nothing taken out, so that a service's error stays readable; `not_a_string`, `too_long` (over 4,096 characters) or `echoed` (holding a secret the request carried from another setting), never sealed, `"[withheld]"` in its place; `not_json`, an answer that is no JSON object or array, whose body is withheld whole, the plugin reading its status and headers alone (a token endpoint that answers a form unless asked otherwise is asked with `accept: application/json`). A value sealed or withheld is taken out of the rest of the answer too ([ADR-0070](../adr/0070-a-secret-is-sealed-by-the-console-from-an-answer-and-goes-where-its-setting-says.md)) | `outbound:<host>` for the URL's host |
186
- | `ctx.secrets` | `has(name)`, whether it is set and not past its expiry; `status(name)`, `{ set, setAt, expiresAt, source }`, `source` being `administrator` or the host of the answer it was sealed from; `sign(name, payload, algorithm)` and `verify(name, payload, signature, algorithm)` with `hmac-sha256`; a secret declared `use: "verify"` signs nothing and goes into no request; never the value | nothing |
185
+ | `ctx.fetch(url, init)` | an outbound request, its `method` `GET` (the default), `HEAD`, `POST`, `PUT`, `PATCH`, `DELETE` or `OPTIONS` and no other (`TRACE`, which has a server send the request back, is `plugin.invalid_args`), answered `{ status, headers, bytes, sealed?, text(), json() }`, a redirect as it came, never followed; `init` may carry `secret: { name, key?, as }` or `secrets: [...]`, five at most, `key` the key of a keyed secret and of no other ([ADR-0111](../adr/0111-a-secret-setting-may-keep-one-value-per-key.md)), `as` one of `header:<name>`, `bearer` (`Authorization: Bearer`), `query:<name>`, `basic` (`user:password`) and `body:<field>` (a field of a JSON object or a form body), and the console puts each secret there, within the `hosts` its setting names and before its expiry, and takes it out of the answer's headers and body in every form it knows (as placed, escaped as JSON, URL-encoded with the hex digits big or small, each with its slashes escaped or not, and in base64, a header's alphabet or a URL's, whole or inside a longer run of it, of the value and of what the request carried for it, a query's, a form's or a JSON body's spelling, for a value of 8 bytes or more; for `basic`, the base64 of the pair and the password alone too, [ADR-0079](../adr/0079-a-secret-is-taken-out-of-an-answer-in-the-encodings-a-service-sends-it-back-in.md)), `"[withheld]"` in its place, so that a server that echoes the request, or a redirect that carries its URL, hands the plugin none; and `seal: { <setting>: "$.path" \| { path, expiresIn?, key? } }`, five at most, values of the answer's JSON the console seals as the plugin's secret settings before the plugin reads the answer, which says `"[sealed]"` in their place, `expiresIn` the seconds they last or a path to them, `key` for a keyed secret and no other the key it is sealed under, a path into the same answer (`$.team.id`) or the key itself, a setting with `hosts` sealed from their answers alone (`plugin.forbidden` before the request goes out otherwise). Sealing fails closed, and `sealed` says what became of each value named, by its setting: `sealed`; `absent`, nothing at the path (no such key, `null` or an empty string), nothing taken out, so that a service's error stays readable; `not_a_string`, `too_long` (over 4,096 characters), `echoed` (holding a secret the request carried from another setting, or from another key of the same), `no_key` (for a keyed secret, a key the answer does not hold at the path, or holds not spelled as one) or `too_many` (a key the keyed secret does not keep yet, where it keeps `max`), never sealed, `"[withheld]"` in its place; `not_json`, an answer that is no JSON object or array, whose body is withheld whole, the plugin reading its status and headers alone (a token endpoint that answers a form unless asked otherwise is asked with `accept: application/json`). A value sealed or withheld is taken out of the rest of the answer too ([ADR-0070](../adr/0070-a-secret-is-sealed-by-the-console-from-an-answer-and-goes-where-its-setting-says.md)) | `outbound:<host>` for the URL's host |
186
+ | `ctx.secrets` | `has(name, key?)`, whether it is set and not past its expiry; `status(name, key?)`, `{ set, setAt, expiresAt, source }`, `source` being `administrator` or the host of the answer it was sealed from; for a keyed secret ([ADR-0111](../adr/0111-a-secret-setting-may-keep-one-value-per-key.md)), `key` names the value, and without one they answer for the value it kept from before it was keyed; `keys(name)`, each key a keyed secret keeps with how its value stands, `{ key, set, setAt, expiresAt, source }`; `forget(name, key)`, the value under a key removed where what it stood for is gone, answering whether there was one; `move(name, key)`, the value kept from before the setting was keyed put under a key as it was sealed, for an upgrade, answering whether there was one, a new key past `max` refused (`plugin.too_many`) and the value left where it was; `sign(name, payload, algorithm)` and `verify(name, payload, signature, algorithm)` with `hmac-sha256`; a secret declared `use: "verify"` signs nothing and goes into no request, and a keyed one is used in requests alone; never the value | nothing |
187
187
  | `ctx.plugins.get(key)` | `{ version, api: { [name]: (input) => Promise<unknown> }, for(personId) }` of another plugin, never of itself (`plugin.forbidden`): a person's call passed through as the person; the console's own call as this plugin, with the roles granted to it there; `for(personId)` the same api for a person who did something elsewhere, with the roles both hold, in their language ([ADR-0072](../adr/0072-a-plugin-is-a-principal-it-holds-roles-granted-to-it-calls-as-itself-and-acts-for-a-person-within-what-both-may-do.md)) | `plugins:<key>`; `people:act` for `for` |
188
188
  | `ctx.endpoints.url(name)` | the full address of an endpoint the plugin defines, under the console's public origin (`<PUBLIC_URL>/api/v1/plugins/<key>/x/<name>`), to register a callback or a webhook with a service elsewhere; `plugin.not_found` for a name it does not define, `plugin.unavailable` where the console has no public address | nothing |
189
189
  | `ctx.log` | `info`, `warn` and `error` lines, written to the console's log with the plugin's key and the caller; up to 100 lines a minute | nothing |
@@ -233,7 +233,7 @@ Declared in the manifest, consented to by an administrator when enabling, enforc
233
233
 
234
234
  ## Settings
235
235
 
236
- The form on `/settings/plugins/<key>` and `console plugin <key> settings --set` come from the manifest's `settings`. A `secret` is sealed with the deployment's secret (`AUTH_SECRET`, with the purpose `plugin-secret`), never returned by any route or shown in any form (only whether and when it was set), and used by the console where the plugin names it: `ctx.fetch`'s `secret` and `secrets`, `ctx.secrets.sign` and `verify`, a webhook's `secret`. A secret is set by an administrator, or sealed by the console from an answer the plugin received (`ctx.fetch`'s `seal`, [ADR-0070](../adr/0070-a-secret-is-sealed-by-the-console-from-an-answer-and-goes-where-its-setting-says.md)); the page and `console plugin <key> settings` say which, with the host it came from and when it expires, and a secret past its expiry stands unset until it is set or sealed again. A deployment without `AUTH_SECRET` refuses settings of type `secret`. `person` and `project` settings hold ids and are shown as names, chosen on the page among the workspace's people and projects; a person who left or a project put away makes the setting invalid, which the pages show. A `time` is `HH:MM`, read in the workspace's time zone, which the form says beside it; where the workspace has none, a plugin with a `time` setting or a job at a time of day runs on UTC, and the plugin's settings page and `console plugin <key> enable` tell the administrator so (`needsTimeZone` on `GET /api/v1/plugins/<key>`), with the way to set one. A job's next time follows the zone: set or changed, the next run is computed again at the job's time of day in the new zone. A `list` has a control for its kind of item: a list of an `enum` is a pill per choice (a column of boxes past eight), a list of `person` or `project` the chips of those chosen with one choice to add another, a list of anything else the items as chips with a field that adds one, `min` and `max` bounding how many; `--set` takes a list with commas between, as before. The form is divided into the `settingGroups` the manifest declares, a titled block each in the manifest's order, the settings without a group above them. Settings are the workspace's; a plugin that needs a value per project keeps a record linked to the project.
236
+ The form on `/settings/plugins/<key>` and `console plugin <key> settings --set` come from the manifest's `settings`. A `secret` is sealed with the deployment's secret (`AUTH_SECRET`, with the purpose `plugin-secret`), never returned by any route or shown in any form (only whether and when it was set), and used by the console where the plugin names it: `ctx.fetch`'s `secret` and `secrets`, `ctx.secrets.sign` and `verify`, a webhook's `secret`. A secret is set by an administrator, or sealed by the console from an answer the plugin received (`ctx.fetch`'s `seal`, [ADR-0070](../adr/0070-a-secret-is-sealed-by-the-console-from-an-answer-and-goes-where-its-setting-says.md)); the page and `console plugin <key> settings` say which, with the host it came from and when it expires, and a secret past its expiry stands unset until it is set or sealed again. A secret declared `keyed` keeps a value per key, a workspace of a service say, each sealed, placed, listed and removed by its key; the page and `console plugin <key> settings` list its keys with how each value stands, and an administrator sets or removes one key at a time ([ADR-0111](../adr/0111-a-secret-setting-may-keep-one-value-per-key.md)). A deployment without `AUTH_SECRET` refuses settings of type `secret`. `person` and `project` settings hold ids and are shown as names, chosen on the page among the workspace's people and projects; a person who left or a project put away makes the setting invalid, which the pages show. A `time` is `HH:MM`, read in the workspace's time zone, which the form says beside it; where the workspace has none, a plugin with a `time` setting or a job at a time of day runs on UTC, and the plugin's settings page and `console plugin <key> enable` tell the administrator so (`needsTimeZone` on `GET /api/v1/plugins/<key>`), with the way to set one. A job's next time follows the zone: set or changed, the next run is computed again at the job's time of day in the new zone. A `list` has a control for its kind of item: a list of an `enum` is a pill per choice (a column of boxes past eight), a list of `person` or `project` the chips of those chosen with one choice to add another, a list of anything else the items as chips with a field that adds one, `min` and `max` bounding how many; `--set` takes a list with commas between, as before. The form is divided into the `settingGroups` the manifest declares, a titled block each in the manifest's order, the settings without a group above them. Settings are the workspace's; a plugin that needs a value per project keeps a record linked to the project.
237
237
 
238
238
  ## Records
239
239
 
@@ -247,7 +247,11 @@ The console keeps a plugin's records in `plugin_records` (id UUIDv7, plugin, col
247
247
 
248
248
  ## SQL
249
249
 
250
- With `storage:sql` consented to, enabling creates the schema `plugin_<key>` and the login role `plugin_<key>`, grants the role `USAGE` and `CREATE` on that schema and nothing on any other, sets its `search_path` to the schema, its `statement_timeout` to ten seconds and its connection limit to four, and gives it a password the console draws at every boot and keeps in memory alone. The plugin's `migrations/*.sql`, in the order of their names, are applied as the plugin's role by the `migrate` role under the console's migration lock, those applied recorded in `plugin_<key>._migrations`. `ctx.sql.query` and `transaction` run on a pool of the plugin's role in the parent, and a result is bounded to 10,000 rows and 4 MiB. The console's own tables are in `public`, where the role holds no right. Purge drops the schema with everything in it, and the role. The console's database user needs `CREATEROLE`; without it, `GET /api/v1/plugins` says `storage:sql` is unavailable in this deployment, and a plugin that declares it cannot be enabled (`plugin.unavailable`).
250
+ With `storage:sql` consented to, enabling creates the schema `plugin_<key>` and the login role `plugin_<key>`, grants the role `USAGE` and `CREATE` on that schema, which `PUBLIC` is left nothing on, sets its `search_path` to the schema, its `statement_timeout` to ten seconds and its connection limit to four, and gives it a password the console draws at every boot and keeps in memory alone. Where the database refuses to make the role or to change it, provisioning is refused (`plugin.unavailable`) in words that name the role and give the database's code and words, and never the statement, which carries the password: enabling is refused so, and a plugin enabled before is held failed with those words as its problem. The plugin's `migrations/*.sql`, in the order of their names, are applied as the plugin's role by the `migrate` role under the console's migration lock, those applied recorded in `plugin_<key>._migrations`. `ctx.sql.query` and `transaction` run on a pool of the plugin's role in the parent, and a result is bounded to 10,000 rows and 4 MiB. Purge drops the schema with everything in it, and the role.
251
+
252
+ The role may use no schema of the console's, `public` (its tables), `drizzle` (the record of its migrations), `transcript` and `feed_order` (the feeds' order), nor another plugin's: a role that may use a schema can name a table in it, and naming one can hold it up before any right on it is asked for, the board's writes and reads, its feeds and the console's migrations with it ([ADR-0125](../adr/0125-a-feed-is-read-no-further-than-its-settled-end-which-its-writers-hold-a-lock-for.md), [ADR-0133](../adr/0133-the-consoles-schemas-are-closed-to-every-role-when-a-plugin-first-gets-a-schema-of-its-own.md)). Every role of a new database may use `public` through `PUBLIC`, so provisioning (at enabling, at every boot and in the `migrate` role) first takes from `PUBLIC` whatever it holds on those schemas and says so in the log (`PUBLIC may no longer use these schemas`); from then on every other role of the database uses them only by a grant of its own. Only a schema's owner may take that from `PUBLIC`: where the console's user does not own `public`, provisioning is refused (`plugin.unavailable`) with nothing made, in words that give the statement the database's owner runs once, `GRANT USAGE, CREATE ON SCHEMA "public" TO "<the console's user>"; REVOKE ALL ON SCHEMA "public" FROM PUBLIC;`. Enabling the plugin is refused so, and a plugin enabled before is held failed at the next boot with those words as its problem, its statements refused. A right on those schemas given to the plugin's role by name is taken back, and refused the same way where the console's user may not.
253
+
254
+ What the deployment must allow: the console's database user holds `CREATEROLE`, and owns the database or the schema `public` ([deploy/README.md](../../deploy/README.md#plugins-in-the-image)). Without `CREATEROLE`, `GET /api/v1/plugins` says `storage:sql` is unavailable in this deployment, and a plugin that declares it cannot be enabled (`plugin.unavailable`).
251
255
 
252
256
  ## The board
253
257
 
@@ -263,10 +267,10 @@ With `storage:sql` consented to, enabling creates the schema `plugin_<key>` and
263
267
 
264
268
  ## Events, hooks and jobs
265
269
 
266
- - New kinds of the console's events: `plugin.enabled`, `plugin.disabled`, `plugin.configured`, `plugin.granted`, `plugin.revoked`, `plugin.upgraded`, `plugin.command`, `plugin.failed`, `plugin.purged`. `events.plugin` names the plugin on every event a plugin caused, its own kinds and the board's. `plugin.configured` names the fields that changed and, for a secret, its `source`: `administrator`, or the host of the answer the console sealed it from. `plugin.granted` and `plugin.revoked` name a `grantee` where the role went to a plugin. An event a plugin caused for a person names the person as its actor and that plugin as `via`, beside `plugin` ([ADR-0072](../adr/0072-a-plugin-is-a-principal-it-holds-roles-granted-to-it-calls-as-itself-and-acts-for-a-person-within-what-both-may-do.md)). `plugin.command` records the plugin, the command, the arguments (the secret ones as `[hidden]`), the outcome (`ok`, `refused` with its code, `waiting`, `failed`), the duration and the caller's run. They are in the board project's feed where there is one, and always at `GET /api/v1/plugins/<key>/events`.
270
+ - New kinds of the console's events: `plugin.enabled`, `plugin.disabled`, `plugin.configured`, `plugin.granted`, `plugin.revoked`, `plugin.upgraded`, `plugin.command`, `plugin.failed`, `plugin.purged`. `events.plugin` names the plugin on every event a plugin caused, its own kinds and the board's. `plugin.configured` names the fields that changed and, for a secret, its `source`: `administrator`, or the host of the answer the console sealed it from. `plugin.granted` and `plugin.revoked` name a `grantee` where the role went to a plugin. An event a plugin caused for a person names the person as its actor and that plugin as `via`, beside `plugin` ([ADR-0072](../adr/0072-a-plugin-is-a-principal-it-holds-roles-granted-to-it-calls-as-itself-and-acts-for-a-person-within-what-both-may-do.md)). `plugin.command` records the plugin, the command, the arguments (the secret ones as `[hidden]`), the outcome (`ok`, `refused` with its code, `waiting`, `failed`), the duration and the caller's run. They are in the board project's feed where there is one, and always at `GET /api/v1/plugins/<key>/events`, for whoever may read them there ("REST").
267
271
  - A plugin's own events (`ctx.events.emit`, the kind named as a `key`, the data JSON up to 16 KiB) go to `plugin_events` (plugin, kind, data, at; 100,000 kept, for ninety days, the janitor sweeping the rest), reach the frames of that plugin that subscribed, read at `GET .../plugin-events?after=&limit=` by its role holders, and the hooks of plugins with `events:plugins` on `plugin:<key>:<kind>`. They are not the board's feed.
268
- - Hooks run in the `worker` role's host. A dispatcher reads the console's events and `plugin_events` from a cursor per plugin (`plugin_cursors`, begun at the end of both streams when the plugin is enabled, so that it is not told of everything that ever happened), each plugin under an advisory lock of its own, so that one process dispatches to a plugin at a time and two processes to two plugins at once. The lock is held by a transaction the server lets idle for as long as a pass may take on the plugin, its time, the hook begun last and a minute more, in place of the thirty seconds an idle transaction has otherwise, and it is taken with two keys, which no job's lock of one key can be. A process delivers to a few plugins side by side, a quarter as many as it has database connections, at least one and four at most (one at a time in the `worker` role, whose pool has four), since each holds a connection for its lock and takes more for its queries and its hook's calls on `ctx`: a plugin whose hook waits on a slow service, or waits out its backoff, holds up no plugin delivered to beside it, and the pool keeps room for the rest, the API's requests where the `api` role carries the worker. A plugin that has had twenty seconds of a pass leaves the rest of its events to the next. It delivers each event to the handler that named its kind; a console event is delivered for the plugin's board project, the projects it is on, the items it made and what it caused, and, for a plugin with `people:read:all`, the workspace's people events (`person.*`), teams' events (`team.*`) and agent accounts' events (`agent.*`: how one stands now, `agent.state_changed`, [ADR-0085](../adr/0085-a-runner-on-the-agents-machine-is-told-by-signals-and-runs-one-session-at-a-time.md)), with the kind, the ids and the time, and the content and the actor with `board:read`, or with `people:read:all` for a people event, since the directory is its to read. Delivery is at least once and in order: a handler that fails is retried five times with doubling backoff, then the event is skipped with a `plugin.failed` event; a handler has thirty seconds. Every delivery carries the event's `id` and the `attempt`, 1 the first time, so that a hook keeps from acting twice by the id alone, where before it had to make a key of the kind, the record and the time. A hook told to come back later by the service it called, a rate limit or an outage, says so with `retryAfterMs` in the data of its refusal (`throw new PluginError("rate_limited", message, { retryAfterMs })`), and the next try waits that long, within an hour, in place of the backoff; the try still counts.
269
- - Jobs run in the `worker` role's host, with the `jobs` capability, each under an advisory lock, never two at once, the lock held by a transaction the server lets idle for the job's five minutes and a minute more, in place of the thirty seconds an idle transaction has otherwise; `plugin_jobs` keeps the last run, its outcome and the next time, the first run one period after the scheduler first sees the job, `at` read in the workspace's time zone; a failed job is a `plugin.failed` event, at most one an hour per job, and a line in the log every time. A job has five minutes.
272
+ - Hooks run in the `worker` role's host. A dispatcher reads the console's events and `plugin_events` from a cursor per plugin (`plugin_cursors`, begun at the end of both streams when the plugin is enabled, so that it is not told of everything that ever happened), each plugin under an advisory lock of its own, so that one process dispatches to a plugin at a time and two processes to two plugins at once. The lock is held by a transaction the server lets idle for as long as a pass may take on the plugin, its time, the hook begun last and a minute more, in place of the thirty seconds an idle transaction has otherwise, and it is taken with two keys, which no job's lock of one key can be. A process delivers to a few plugins side by side, a quarter as many as it has database connections, at least one and four at most (one at a time in the `worker` role, whose pool has four), since each holds a connection for its lock and takes more for its queries and its hook's calls on `ctx`: a plugin whose hook waits on a slow service, or waits out its backoff, holds up no plugin delivered to beside it, and the pool keeps room for the rest, the API's requests where the `api` role carries the worker. A plugin that has had twenty seconds of a pass leaves the rest of its events to the next. It delivers each event to the handler that named its kind; a console event is delivered for the plugin's board project, the projects it is on, the items it made and what it caused, and, for a plugin with `people:read:all`, the workspace's people events (`person.*`), teams' events (`team.*`) and agent accounts' events (`agent.*`: how one stands now, `agent.state_changed`, [ADR-0085](../adr/0085-a-runner-on-the-agents-machine-is-told-by-signals-and-runs-one-session-at-a-time.md)), with the kind, the ids and the time, and the content and the actor with `board:read`, or with `people:read:all` for a people event, since the directory is its to read. Delivery is at least once and in order: a handler that fails is retried five times with doubling backoff, then the event is skipped with a `plugin.failed` event; a handler has thirty seconds. A try in which the console itself could not make the event ready, or could not call the hook, counts as a try the hook failed, so that an event it can never deliver is skipped the same way and does not hold the plugin at it. Each stream is read no further than its settled end, the highest number below which no change is still under way ([ADR-0125](../adr/0125-a-feed-is-read-no-further-than-its-settled-end-which-its-writers-hold-a-lock-for.md)), and a cursor begins there: an event numbered before another and committed after it is delivered once it is there, in the order of the numbers, and never passed over. Every delivery carries the event's `id` and the `attempt`, 1 the first time, so that a hook keeps from acting twice by the id alone, where before it had to make a key of the kind, the record and the time. A hook told to come back later by the service it called, a rate limit or an outage, says so with `retryAfterMs` in the data of its refusal (`throw new PluginError("rate_limited", message, { retryAfterMs })`), and the next try waits that long, within an hour, in place of the backoff; the try still counts.
273
+ - Jobs run in the `worker` role's host, with the `jobs` capability, each under an advisory lock, never two at once, the lock held by a transaction the server lets idle for the job's five minutes and a minute more, in place of the thirty seconds an idle transaction has otherwise; `plugin_jobs` keeps the last run, its outcome and the next time, the first run one period after the scheduler first sees the job, `at` read in the workspace's time zone; a failed job is a `plugin.failed` event, at most one an hour per job, and a line in the log every time. A job has five minutes. The jobs are seen ([ADR-0128](../adr/0128-a-plugins-jobs-are-seen-and-one-that-keeps-failing-is-a-problem-of-its-plugin.md)): `plugin_jobs` keeps since when a job has failed, run after run, its first failure after it went well, cleared when it goes well again; `GET /api/v1/plugins/<key>` answers each job the module declares with how often it runs, its last run and outcome, its next time and that moment (`jobs`), and a job that failed twice running is a problem of its plugin, `the job <name> has failed since <moment>`, among `problems` on both routes until its next run goes well, for whoever lists the plugins and on the settings pages. One failure is not said there: a host away for a moment fails a run and the next goes well. A job the code no longer declares, and a plugin that is not enabled with `jobs`, have no such problem, and no next time.
270
274
  - `WORKER_IN_PROCESS` puts hooks and jobs in the `api` role's host.
271
275
 
272
276
  ## Between plugins
@@ -307,12 +311,13 @@ Under `/api/v1/plugins`. Who may call: *anyone* signed in or on a token, *roles*
307
311
  | Route | Who | What |
308
312
  |---|---|---|
309
313
  | `GET /api/v1/plugins` | anyone | the plugins a member may know of (the enabled ones; every state for an administrator): key, name, description, version, the consoles it declares it runs on (`console`, or `null`), state and reasons, the caller's roles, the menu, the pages and widgets the caller may see, the board project's key; and whether `storage:sql` is available in this deployment |
310
- | `GET /api/v1/plugins/<key>` | anyone | one plugin: the above, its commands and queries (name, about, args), its skills address, its settings without the secrets (whether each is set, and for a secret `setAt`, `expiresAt`, `source`, `hosts` and `use`), `needsTimeZone`, whether the plugin reads a time of day while the workspace has no time zone, and `keeps`, the collections it forgets after a while with their days; for an administrator the consent, the grants, the projects and `asks`, how the roles it asks of other plugins stand |
314
+ | `GET /api/v1/plugins/<key>` | anyone | one plugin: the above, its commands and queries (name, about, args), its skills address, its settings without the secrets (whether each is set, and for a secret `setAt`, `expiresAt`, `source`, `hosts` and `use`; for a keyed one `keyed` and `keys`, each `{ key, setAt, expiresAt, source }`), `needsTimeZone`, whether the plugin reads a time of day while the workspace has no time zone, `keeps`, the collections it forgets after a while with their days, and `jobs`, each job its module declares as the scheduler keeps it, `{ name, every, at, lastRunAt, lastOutcome, nextAt, failedSince }` ([ADR-0128](../adr/0128-a-plugins-jobs-are-seen-and-one-that-keeps-failing-is-a-problem-of-its-plugin.md)); for an administrator the consent, the grants, the projects and `asks`, how the roles it asks of other plugins stand |
311
315
  | `POST .../enable` | admin | `{ consent: [...], board: { create: { key, name, description } } \| { project: "<key>" } \| null, projects: "all" \| [...], settings: {...} }` |
312
316
  | `POST .../disable` | admin | |
313
317
  | `PATCH .../consent` | admin | `{ consent: [...] }`: what an enabled plugin holds from now on, every capability it requires named again and the optional ones to keep on; a `plugin.configured` event with `capabilities` |
314
318
  | `PATCH .../settings` | admin | `{ values }`, without secrets |
315
319
  | `PUT .../secrets/<name>`, `DELETE .../secrets/<name>` | admin | `{ value }`; never read |
320
+ | `PUT .../secrets/<name>/keys/<key>`, `DELETE .../secrets/<name>/keys/<key>` | admin | the value of a keyed secret under one key ([ADR-0111](../adr/0111-a-secret-setting-may-keep-one-value-per-key.md)): `{ value }`, never read; a new key past `max` is `plugin.too_many` |
316
321
  | `GET .../grants`, `POST .../grants`, `DELETE .../grants/<id>` | admin | `{ role, person?: id, project?: key, plugin?: key, team?: key, everyone?: true }`, one of the five; a grant answers `plugin`, or `team` as `{ key, name }`, where the role went to one |
317
322
  | `POST .../invoke` | roles | `{ argv: [...], files?: [handles], project?: key, run?: id }`: the words as typed, the command's or the query's name first, parsed by the console against the definition (`parseArgv`: the positionals in declaration order, `--name value` or `--name=value`, a boolean flag alone, a list as the flag repeated or with commas between, `--` ending the flags; a person by login or `me`, a project by key and a file by its handle resolved to what the caller may see or uploaded); the handles of the files uploaded for its `file` arguments, in declaration order; the project the call is on; the run it is for, one of the caller's open in the board project, where several are. `{ kind: "command" \| "query", text, data, waiting, project }`, `project` the key of the project the decision named in `waiting` waits in, the one it was raised in, its board or another, where the caller reaches the decision and `null` where they do not; with nothing waiting, the key of the plugin's board project, or `null`; a query's file as `data.file` with `name`, `type`, `bytes` and `base64`; or the refusal |
318
323
  | `POST .../commands/<name>` | roles | `{ args, project?, run? }`, the arguments as JSON by name, for the pages; the same answer |
@@ -321,8 +326,8 @@ Under `/api/v1/plugins`. Who may call: *anyone* signed in or on a token, *roles*
321
326
  | `GET .../records/<collection>/<id>[?version=]`, `GET .../records/<collection>/<id>/versions` | roles | one record, a version of it, its versions |
322
327
  | `POST .../files`, `GET .../files/<id>` | roles | a file for a command (a handle, good for an hour); a record's file |
323
328
  | `GET .../people/<id>/picture` | roles, `people:read` | the picture of a person the asker may see, or of anyone with `people:read:all`; it names the person, never an address ([ADR-0063](../adr/0063-a-frame-reads-a-persons-picture-by-the-person-and-a-plugin-reads-who-it-granted-a-role.md)) |
324
- | `GET .../events?limit=&offset=` | roles | the plugin's events |
325
- | `GET .../plugin-events?after=&limit=` | roles | the events the plugin emitted (`ctx.events.emit`), after a number, oldest first: `{ items: [{ id, kind, data, at }], more, newest }`, `newest` the number of the plugin's newest event, 0 where it has none, so that a frame reads the stream from where it stands |
329
+ | `GET .../events?limit=&offset=&kind=` | *admin*, every event of the plugin; anyone else who may know of the plugin, only the events of a project they may see, as that project's own feed shows them, and of the events that belong to no project only those that tell nothing of another person's doing | the plugin's events the caller may read, newest first, whether or not it has a board project. Of the events that belong to no project, someone who is no administrator reads their own doing, a `plugin.command` they ran among it, and what the console says of the plugin with nobody in it, `plugin.failed` and `plugin.upgraded`; never another person's command, which carries who ran it and its arguments, whom a role went to, or an administrator's act. A token reads as its person. What the caller may not read takes no place in a page and is not counted in `more`, with no word that it is there. Of one kind where `kind` names one, `plugin.failed` for what went wrong in it, a word that is no kind of event refused (`invalid`); a console before 0.5.1 takes no `kind` and answers every one |
330
+ | `GET .../plugin-events?after=&limit=` | roles | the events the plugin emitted (`ctx.events.emit`), after a number, oldest first: `{ items: [{ id, kind, data, at }], more, newest }`, `newest` the number of the plugin's newest event, 0 where it has none, so that a frame reads the stream from where it stands; both within the stream's settled end ([ADR-0125](../adr/0125-a-feed-is-read-no-further-than-its-settled-end-which-its-writers-hold-a-lock-for.md)), so that a frame that comes back with a number has passed over nothing; `503` with `feed.unsettled` and `retry-after: 1` from a process that has not seen the stream settle while an event is being written, where `newest` would be the stream's beginning: a frame asks again at its next tick |
326
331
  | `GET .../skills`, `.../skills/one?path=&cursor=`, `.../skills/file?path=&offset=&limit=`, `.../skills/browse?path=&cursor=&limit=`, `.../skills/find?query=&path=&cursor=&limit=`, `.../skills/rows?path=&heading=&cursor=&limit=`, `.../skills/code?path=&heading=&cursor=&limit=` | anyone who may know of the plugin | the plugin's skills, a pack of its own at `/local/plugins/<key>`, read from its package on the console's machine as a `local` pack is ([ADR-0031](../adr/0031-the-console-reads-a-pack-as-the-skillcdn-command-does-and-a-local-one-from-a-directory.md)), answered as a project's reads are, the tables and the code blocks of its documents as data among them ([ADR-0100](../adr/0100-a-packs-tables-and-code-blocks-are-had-as-data-through-the-console.md)); `status: none` for a plugin that ships none |
327
332
  | `ANY .../x/<name>[/<rest>]` | a person, or nobody | an endpoint, with `endpoints`: a `person` endpoint for whoever is signed in or presents a token and holds a role it names (a browser's session asking for what is not a read, from elsewhere than the console's own pages, counts for nobody; the session of a command signed in as the account itself is presented as a token is and taken as one), a `webhook` endpoint for nobody, run as the console with every role and held to 600 requests a minute per plugin (`plugin.rate_limited`). The request's body up to 1 MiB, its headers cut to `content-type` and those the definition names; the answer's status, its `content-type`, `location` and `cache-control`, and its body, under the console's own `nosniff`, `no-store` and a sandboxing policy. A method the definition does not name is `plugin.invalid_args` |
328
333
  | `GET .../export` | admin | JSON Lines, and the list of the files |
@@ -340,14 +345,15 @@ Under `/api/v1/plugins`. Who may call: *anyone* signed in or on a token, *roles*
340
345
  | Command | Asks | Says |
341
346
  |---|---|---|
342
347
  | `plugins` | `GET /api/v1/plugins` | a line per plugin: key, name, version, state, the caller's roles |
343
- | `plugin <key>` | `GET /api/v1/plugins/<key>` | the description and the agent note; a line per command and query, its usage in brief, the positionals and the required flags, the rest as `[options]`, since an agent reads this whole at every first use; the skills (`console plugin <key> skills`); the board project; the settings an agent should know |
348
+ | `plugin <key>` | `GET /api/v1/plugins/<key>` | the description and the agent note; its problems, a job that keeps failing among them; a line per command and query, its usage in brief, the positionals and the required flags, the rest as `[options]`, since an agent reads this whole at every first use; the skills (`console plugin <key> skills`); the board project; a line per job, how often it runs, how its last run went and since when it has failed, and when it runs next, where the console names them; the settings an agent should know |
344
349
  | `plugin <key> help [<command>]` | the same | one command whole, in the form of `console help <command>`: the forms, every argument, the limits, the refusals; without a command, every one in the brief form |
345
350
  | `plugin <key> <command> [args] [--<flag> <value>]... [--file <path> \| -] [--run <id>] [--json]` | `POST .../files` where `--file` or `-`, then `POST .../invoke` with the words as typed, the handle, the project the command works in and the run named | the command's `text`, or its `data` with `--json`; a query's answer as JSON, a file it answers saved under its name; exit `0`; `3` with `waiting`, printing the decision's id, the project it waits in and `console decision <id> --wait`, which reads the decision wherever it is, from a checkout bound to another project or none; `1` on a refusal, in the console's form. `--json`, `--url`, `--account`, `--project`, `--file` and `--run` are the command's own wherever they stand; every other word is the plugin's |
346
351
  | `plugin <key> records <collection> [<id>] [--where <field>=<value>]... [--search <words>] [--project <key>] [--order <field>[:desc]] [--limit <n>] [--after <cursor>] [--archived] [--versions]` | `GET .../records/...` | the records, one a line, or one whole, or its versions |
352
+ | `plugin <key> events [--kind <kind>] [--limit <n>] [--offset <n>]` | `GET .../events` | the plugin's events the caller may read ("REST": every one for an administrator; for anyone else those of the projects they may see, their own commands, and the console's word of the plugin), newest first, one a line: its number, when, its kind, who did it and through what, and what it says, the problem of a `plugin.failed`, the command and how it ended of a `plugin.command`; `--kind plugin.failed` for the failures alone, which is where a job's failure says why; a page of up to 100, 50 unless said; where the console answers none, `No event of <key> that you may read`, which says nothing of whether the plugin has others. On a console before 0.5.1, which does not narrow by kind, the command keeps the kind asked for of the page it read, and says so |
347
353
  | `plugin <key> skills [--search <words>]`, `plugin <key> skill <path>` | `GET .../skills...` | as `console skills` and `console skill` |
348
- | `plugin <key> enable [--consent <capability>,...] [--board new\|<key>] [--projects all\|<key>,...] [--set <key>=<value>]...`, `plugin <key> disable`, `plugin <key> capabilities [--consent <capability>,...|none]`, `plugin <key> settings [--set ...]`, `plugin <key> secret <name>` (the value typed unseen at the terminal, or piped in; never an argument), `plugin <key> grant <role> --person <login>\|--project <key>\|--everyone`, `plugin <key> revoke <grant>` | the administrator's routes | what changed; `enable` prints what each capability opens before asking the console, and refuses without `--consent` naming every capability the manifest requires; `capabilities` says what the plugin holds, and with `--consent` which of the optional ones it holds from now on |
354
+ | `plugin <key> enable [--consent <capability>,...] [--board new\|<key>] [--projects all\|<key>,...] [--set <key>=<value>]...`, `plugin <key> disable`, `plugin <key> capabilities [--consent <capability>,...|none]`, `plugin <key> settings [--set ...]`, `plugin <key> secret <name> [--key <key>]` (the value typed unseen at the terminal, or piped in; never an argument; `--key` for a keyed secret, one key at a time), `plugin <key> grant <role> --person <login>\|--project <key>\|--everyone`, `plugin <key> revoke <grant>` | the administrator's routes | what changed; `enable` prints what each capability opens before asking the console, and refuses without `--consent` naming every capability the manifest requires; `capabilities` says what the plugin holds, and with `--consent` which of the optional ones it holds from now on |
349
355
 
350
- The rules an agent reads carry the plugins: `GET /api/v1/rules` and `GET /api/v1/projects/<key>/rules` answer `plugins`, each with its `key`, `name`, `agentNote` and `description` by language and the caller's `roles` in it, and `console take` and `console rules` print, after the project's rules, a section `## Plugins` with a line per plugin bound to the project (as its board project, or on it) that the caller holds a role in, `- <key> (<name>): <agentNote> Start with console plugin <key>.`, the note in the caller's language where the manifest has it, the description where it has no note; `console rules` at the workspace lists every plugin the caller may use. Nothing else of a plugin reaches an agent unasked. `console help` names the two commands in a section of their own, and `console skills` ends with where a plugin's skills are. The skill `working-the-board` says: when the rules name a plugin, read `console plugin <key>` and its skills before its first command.
356
+ The rules an agent reads carry the plugins: `GET /api/v1/rules` and `GET /api/v1/projects/<key>/rules` answer `plugins`, each with its `key`, `name`, `agentNote` and `description` by language and the caller's `roles` in it, and `console take` and `console rules` print, after what the project adds to the rules and before the rest, a section `## Plugins` with a line per plugin bound to the project (as its board project, or on it) that the caller holds a role in, `- <key> (<name>): <agentNote> Start with console plugin <key>.`, the note in the caller's language where the manifest has it, the description where it has no note; `console rules` at the workspace lists every plugin the caller may use. Nothing else of a plugin reaches an agent unasked. `console help` names the two commands in a section of their own, and `console skills` ends with where a plugin's skills are. The skill `working-the-board` says: when the rules name a plugin, read `console plugin <key>` and its skills before its first command.
351
357
 
352
358
  ## Pages
353
359
 
@@ -409,17 +415,17 @@ The page performs every `call` with the person's session under `/api/v1/plugins/
409
415
 
410
416
  The front page (`/`) is one grid of square cells on which the projects and the widgets stand as tiles ([ADR-0061](../adr/0061-the-front-page-is-one-grid-of-tiles-a-person-arranges-by-hand.md)): the widgets the person holds a role for, of the plugins that are enabled. The grid has 12 columns where the page is at least 1520 pixels wide, 8 from 900, 6 from 560 and 4 below, and a cell is as wide as that leaves it. A project is an `icon` of 1×1 cells or `small` of 2×2, or a glance at its board at `medium` 4×2, `large` 4×4 or `wide` 8×2, never `full` ([ADR-0105](../adr/0105-a-project-at-a-larger-size-is-a-glance-at-its-board.md)). A widget is at its size, `small` 2×2, `medium` 4×2, `large` 4×4, `wide` 8×2, `full` 8×4, filling the cells it has; the height it says is not read. A grid offers a tile the sizes that fit it, and one kept or started at a size too wide takes the largest it comes in that fits, each width being arranged for itself; every widget has a size at most four cells across, so that a phone has one to show ([ADR-0062](../adr/0062-a-widget-comes-in-a-size-a-phone-can-hold.md)). Each widget is a frame with the same document and bridge, `widget=<key>` in place of `page`, its name above it; `init` carries `size`, the size the widget has on this grid, and a `size` message follows when the person changes it or the page narrows past it, so that the bundle lays itself out for the cells (`frame.context.size`, `frame.onSize`).
411
417
 
412
- There is no default layout. On a width the person arranged, what they have not seen yet takes the first room reading from the top, at the size it starts at: a project made since, the widgets of a plugin as soon as it is enabled. For someone who has arranged nothing, the page is composed edge to edge ([ADR-0082](../adr/0082-the-page-of-someone-who-has-arranged-nothing-is-composed-edge-to-edge.md)): the first widget placed `home:top` leads, half the page wide, and beside it stand the next two `home:top` widgets and the projects, the column as high as the lead; the projects are icons in rows of as many as are alike, each row as wide as its column, below the lead and across the page where they would need more than two rows beside it; the other widgets, those placed `home:bottom` last, stand below, two to a row. On 6 columns or fewer, or with no second widget, they stand one under the other in the same order. A composed tile may reach fractions of a cell, and its frame is told the size of its `sizes` nearest the shape it has, one that fits within it on a tie, which may be another than its `defaultSize`. Arranging starts from the composed page, each tile on the cells nearest it. `GET /api/v1/me` answers `home`, `{ hidden: [<tile>, ...], layouts: { "12"?, "8"?, "6"?, "4"?: [{ tile, x, y, size }, ...] } }`, or `null` while they have arranged nothing: the tiles they took off, which stay off, and what they arranged at each width, a tile being `project:<id>` or `widget:<plugin>:<widget>`; `PATCH /api/v1/me` with `home` keeps it. A width nobody arranged, when another was, reads the same order closed up: each tile takes one of the sizes it comes in on the grid, chosen so that the fewest cells stand empty within the rows the page takes, then the fewest tiles leave the size kept at the other width, then the page is the shortest, the projects taking one size together.
418
+ There is no default layout. On a width the person arranged, what they have not seen yet takes the first room reading from the top, at the size it starts at: a project made since, the widgets of a plugin as soon as it is enabled. For someone who has arranged nothing, the page is composed edge to edge ([ADR-0082](../adr/0082-the-page-of-someone-who-has-arranged-nothing-is-composed-edge-to-edge.md)): the first widget placed `home:top` leads, half the page wide, and beside it stand the next two `home:top` widgets and the projects, the column as high as the lead; the projects are icons, one to a cell, in rows as long as their column has cells, the last ending short ([ADR-0108](../adr/0108-a-project-on-the-composed-page-stands-on-one-cell.md)), below the lead and across the page where they would need more than two rows beside it; the other widgets, those placed `home:bottom` last, stand below, two to a row. On 6 columns or fewer, or with no second widget, they stand one under the other in the same order, the lead at the size of its `sizes` nearest the page's width and four rows, on that size's cells, and where it leaves columns the projects follow it there, then across the page below it, before the other widgets ([ADR-0110](../adr/0110-a-lead-with-nothing-beside-it-stands-at-a-size-it-comes-in.md)). Any other composed widget may reach fractions of a cell, and its frame is told the size of its `sizes` nearest the shape it has, one that fits within it on a tie, which may be another than its `defaultSize`. Arranging starts from the composed page, each tile on the cells nearest it; while arranging, a button puts the page back as composed, every width unarranged and every tile taken off back on it, which Done keeps as `{ hidden: [], layouts: {} }` and Cancel lets go ([ADR-0109](../adr/0109-arranging-can-put-the-page-back-as-composed.md)). `GET /api/v1/me` answers `home`, `{ hidden: [<tile>, ...], layouts: { "12"?, "8"?, "6"?, "4"?: [{ tile, x, y, size }, ...] } }`, or `null` while they have arranged nothing: the tiles they took off, which stay off, and what they arranged at each width, a tile being `project:<id>` or `widget:<plugin>:<widget>`; `PATCH /api/v1/me` with `home` keeps it. A width nobody arranged, when another was, reads the same order closed up: each tile takes one of the sizes it comes in on the grid, chosen so that the fewest cells stand empty within the rows the page takes, then the fewest tiles leave the size kept at the other width, then the page is the shortest, the projects taking one size together.
413
419
 
414
420
  Edit layout opens nothing on the page. A tile is taken in hand with the mouse, or with a finger that rests on it a moment first, and put down on any cell; empty cells stay empty. Where it would land shows the tile, faint, and those in the way slide aside as it comes, the nearest first. On a tile of its own shape, the tiles of that shape between the two places each move one place towards the one it left; a smaller tile gives way to the nearest room, and a larger one stays, the tile landing beside it. The arrow keys move the tile with the focus a cell, and Delete takes it off. Each tile carries the way off the page and the sizes it comes in, what was taken off is listed to add back, Done keeps it all and Cancel lets it go. A tile the person may no longer see, for a role gone or a plugin disabled, is out of sight and comes back where it stood.
415
421
 
416
422
  ### The look
417
423
 
418
- The console's page reads its computed `--sc-*` tokens (the list is `CONSOLE_TOKENS` in the package) and sends them in `init.theme` and in `theme`; the frame's SDK sets them on `:root`, so that a custom console's look reaches its plugins' pages. `GET /api/v1/plugin-runtime/console.css` is the package's `console.css`, so that the `sc-*` classes work in a frame. Tokens added to the console's set for plugins: `--sc-color-info` and `--sc-color-info-subtle`; `--sc-color-neutral` and `--sc-color-neutral-subtle`, a state neither good nor bad; `--sc-series-1` to `--sc-series-6`, a palette for figures; `--sc-numeric`, the font features for tabular numerals. A plugin's own classes begin with `pl-<key>-`; `console-plugin check` warns of others. A page pads itself by `--sc-space-4` on every side, for the shadows of what is in it, which the frame would cut; the frame of a page stands that far outside the page's column, so that the page's first words line up with the tabs above it. A widget pads nothing: the box the console draws around it does. The frame's `lang` is the person's language, and the console shows the manifest's names in it; the words inside the frame are the plugin's, from `init.language`.
424
+ The console's page reads its computed `--sc-*` tokens (the list is `CONSOLE_TOKENS` in the package) and sends them in `init.theme` and in `theme`; the frame's SDK sets them on `:root`, so that a custom console's look reaches its plugins' pages. `GET /api/v1/plugin-runtime/console.css` is the package's `console.css`, so that the `sc-*` classes work in a frame. Tokens added to the console's set for plugins: `--sc-color-info` and `--sc-color-info-subtle`; `--sc-color-neutral` and `--sc-color-neutral-subtle`, a state neither good nor bad; `--sc-series-1` to `--sc-series-6`, the colours a series of a chart is drawn in; `--sc-numeric`, the font features for tabular numerals. Figures are drawn with the console's charts, parts like the others (the rows `series` to `figures` of the package's catalogue, `src/styles/README.md`; [ADR-0123](../adr/0123-charts-are-parts-placed-by-measures-and-drawn-by-the-stylesheet.md)): the frame's `console.css` carries their classes, every measure of a chart is an attribute of an SVG, since the frame's policy lets no style be set on an element, and `@skillcdn/console/charts` computes the measures for a plain bundle, where a bundle of React takes the components from `@skillcdn/console`. A plugin's own classes begin with `pl-<key>-`; `console-plugin check` warns of others, and holds the `sc-*` classes a bundle uses to the parts of the catalogue: a class of one of the console's own pages lays that page out, is that page's alone and changes with it, and is refused in a plugin's. A page pads itself by `--sc-space-4` on every side, for the shadows of what is in it, which the frame would cut; the frame of a page stands that far outside the page's column, so that the page's first words line up with the tabs above it. A widget pads nothing: the box the console draws around it does. The frame's `lang` is the person's language, and the console shows the manifest's names in it; the words inside the frame are the plugin's, from `init.language`.
419
425
 
420
426
  ### The settings pages
421
427
 
422
- The Settings page lists the plugins with their state, for an administrator, each leading to its own page, and `/settings/plugins` is that list alone; `/settings/plugins/<key>` is one, read at a glance and with as few words as it takes: its name, key, version and state in the head, with the way to disable it; why it cannot run, where it cannot; a row each for its board project, the projects it is on, the capabilities it holds, those it can go without each with a box to turn it on or off, its commands and queries, and what agents read of it; where it is not enabled, the form that enables it, in three parts: the capabilities, each by the name the pages give it in the person's language with one sentence of what it opens (the packs' `plugins.capability`; the catalogue above is what they say), in two lists: those it requires, on and not the administrator's to turn off, one a new version asks marked as new, and those it can go without, off until turned on, those consented to before on already; the board project, to make (the form filled from `board.defaults`) or to choose; the projects, all or some; the settings form from the manifest, and each secret with when it was set, never its value; the roles the plugin declares, each with what it is for and who holds it, every member for `defaultRole`, each grant (a person, a project's members, everyone) a chip with the way to revoke it, and one choice to grant the role to someone not holding it yet; the plugin's events; export and purge, the latter offered once the plugin is disabled and asking for the key to be typed. Administrators only; no plugin code runs on these pages.
428
+ The Settings page lists the plugins with their state, for an administrator, one that runs with a problem marked beside it, each leading to its own page, and `/settings/plugins` is that list alone; `/settings/plugins/<key>` is one, read at a glance and with as few words as it takes: its name, key, version and state in the head, with the way to disable it; why it cannot run, where it cannot, and its problems where it runs with one, a job that keeps failing ([ADR-0128](../adr/0128-a-plugins-jobs-are-seen-and-one-that-keeps-failing-is-a-problem-of-its-plugin.md)); a row each for its board project, the projects it is on, the capabilities it holds, those it can go without each with a box to turn it on or off, its jobs, each with how its last run went, since when it has failed and when it runs next, its commands and queries, and what agents read of it; where it is not enabled, the form that enables it, in three parts: the capabilities, each by the name the pages give it in the person's language with one sentence of what it opens (the packs' `plugins.capability`; the catalogue above is what they say), in two lists: those it requires, on and not the administrator's to turn off, one a new version asks marked as new, and those it can go without, off until turned on, those consented to before on already; the board project, to make (the form filled from `board.defaults`) or to choose; the projects, all or some; the settings form from the manifest, and each secret with when it was set, never its value, a keyed one with each of its keys, how its value stands and the way to remove it, and a key and a value to set one; the roles the plugin declares, each with what it is for and who holds it, every member for `defaultRole`, each grant (a person, a project's members, everyone) a chip with the way to revoke it, and one choice to grant the role to someone not holding it yet; the plugin's events; export and purge, the latter offered once the plugin is disabled and asking for the key to be typed. Administrators only; no plugin code runs on these pages.
423
429
 
424
430
  ## Security model
425
431
 
@@ -430,7 +436,7 @@ The install path is the first line (a release of the deployment, from a lockfile
430
436
  | | Held by |
431
437
  |---|---|
432
438
  | read a secret, a credential or the environment | the host's empty environment; secrets used by the parent, never sent, and taken out of what an answer sends back; what an answer is to give up, withheld where it cannot be sealed |
433
- | reach the database | no connection in the host; `ctx.sql` on the plugin's own role |
439
+ | reach the database | no connection in the host; `ctx.sql` on the plugin's own role, which may use its own schema and no other of the console's or the plugins' (["SQL"](#sql)) |
434
440
  | read a file outside its own directory, or write any file | the permission model |
435
441
  | start a process, load an addon, open a socket | the permission model, the module hook, the removed globals |
436
442
  | answer a decision, or act as a person it is not | no such call; every call is the caller's or the console's |
@@ -476,6 +482,7 @@ The install path is the first line (a release of the deployment, from a lockfile
476
482
  | collections; commands and queries; endpoints; pages; widgets; roles; settings; groups of settings; indexes of a collection | 50; 100; 20; 12; 4; 10; 50; 10; 8 |
477
483
  | SQL: a statement; a result; connections | 10 s; 10,000 rows and 4 MiB; 4 |
478
484
  | a page of a list | 200 |
485
+ | a file of a plugin's package as `console-plugin check` reads it | 4 MiB; one larger is refused by its size and not read |
479
486
 
480
487
  | Status | `code` | When |
481
488
  |---|---|---|
@@ -498,7 +505,7 @@ The install path is the first line (a release of the deployment, from a lockfile
498
505
 
499
506
  - `console-plugin init <dir> --key <key> [--name <name>] [--console <dependency>] [--package <name>] [--repository <url> [--directory <path>]] [--languages <tags>]` writes a plugin from the template in the package (`template/plugin`, the words `__package__`, `__key__`, `__name__`, `__console__` and `__consoleRange__` replaced in its files and their names; `--console` is the `devDependency` on `@skillcdn/console`, `^<the command's version>` unless said, and the manifest's `console` is the line of the version it names, `>=0.4.3 <0.5.0` for `^0.4.3`, left out where the dependency names no version, as `workspace:*` does not): the manifest, a server module with one collection, one command and one query, the source of a web bundle with the bridge client, one page and one widget, one skill with `SKILLCDN.md`, tests against `@skillcdn/console/plugin/testing` and of the package as a console reads it, and the build with esbuild (`build.mjs`: the server module, the web bundle and its stylesheet). `examples/plugin-hello` in the repository is that result, built, and the check holds the two equal.
500
507
  - `init` takes beside the key what a plugin bound for a repository or a registry would otherwise have adapted by hand: `--package <name>`, the package's name (`console-plugin-<key>` unless said; a scoped name, `@<scope>/console-plugin-<key>`, gets `publishConfig.access: "public"`); `--repository <url>` with `--directory <path>` in a repository of several, which fill `package.json`'s `repository`, `homepage` and `bugs` and the manifest's `store.homepage` and `store.repository`; and `--languages en,ko`, the languages of the plugin's words, `en` first, which gives every language map of the manifest and the `translations` of `SKILLCDN.md` and of the skill the other languages as the English words, for the author to translate. `check` warns of a translation left the same as English.
501
- - `console-plugin check [<dir>]` reads the package as the console would and fails on: an invalid manifest; a reserved or malformed key; a `pluginApi` the command does not know; a `devDependency` on `@skillcdn/console` outside the consoles the manifest's `console` declares; a server module that does not load under the host's hardening, or yields a definition naming a role, a setting, a collection or a page that is not declared; a built-in the host refuses, imported anywhere in the server bundle; a web bundle that is not self-contained (a script, a style or an import from elsewhere; `fetch`, `XMLHttpRequest`, `WebSocket` or `document.cookie` in it); a class without the `pl-<key>-` prefix; skills that `skillcdn check` refuses; a license that is not permissive; a `files` field that leaves out what runs. It is what a store would ask of a plugin. It needs Node.js 24 or newer; it warns, and does not fail, on a private package, a class without the prefix, a capability no definition uses, skills left out, and a `console` range that leaves out the console the command belongs to; it exits `1` with every problem, `0` with a summary.
508
+ - `console-plugin check [<dir>]` reads the package as the console would and fails on: an invalid manifest; a reserved or malformed key; a `pluginApi` the command does not know; a `devDependency` on `@skillcdn/console` outside the consoles the manifest's `console` declares; a server module that does not load under the host's hardening, or yields a definition naming a role, a setting, a collection or a page that is not declared; a built-in the host refuses, imported anywhere in the server bundle; a web bundle that is not self-contained (a script, a style or an import from elsewhere; `fetch`, `XMLHttpRequest`, `WebSocket` or `document.cookie` in it); a class of one of the console's own pages, which is no part, used in any script or stylesheet of the web bundle, the entry, its chunks and its styles (the parts are the rows of the catalogue the package ships, `src/styles/README.md`, which the command reads there, so that a part added is one a plugin may use; [ADR-0106](../adr/0106-a-look-is-a-part-with-a-file-and-a-row-and-a-page-places-its-parts.md)); a class without the `pl-<key>-` prefix; skills that `skillcdn check` refuses; a license that is not permissive; a `files` field that leaves out what runs; a file of the package larger than 4 MiB, a manifest, the server module, a script or a stylesheet of the web bundle or a skill, which the check says by its size and does not read, since it reads a file whole and a plugin's files are a fraction of that (the example's server module, with what it bundles, is under 1 MiB). What it reads, it reads in a time that grows with the file's size, whatever the file holds. It is what a store would ask of a plugin. It needs Node.js 24 or newer; it warns, and does not fail, on a private package, a class without the prefix, a name in the console's prefix that nothing of the console styles, a capability no definition uses, skills left out, and a `console` range that leaves out the console the command belongs to; it exits `1` with every problem, `0` with a summary.
502
509
  - `createTestContext({ collections?, plugin?, caller?, console?, sql?, fetch?, secrets?, plugins?, publicUrl?, endpoints?, now?, language? })` from `@skillcdn/console/plugin/testing` is a `ctx` for a plugin's own tests (`publicUrl` and `endpoints`, the origin and the names `ctx.endpoints.url` answers from): records in memory, checked against the schema and the indexes as the console checks them, versions, links and files kept; the console answering what the test provided and refusing the rest as `plugin.forbidden`; `emitted` and `logged` to assert on; `all(collection)` for every record; `as(caller)` for the same store as someone else.
503
510
  - The skill `skills/building-a-plugin` is the map: what to ask, how to split a feature into commands, queries, decisions, tasks and jobs so that agents work and people decide, records or SQL, running a local console with the plugin linked into `PLUGINS_DIR`, the tests, `check`, publishing or tagging, and handing the install to the deployment as a task. It names this document for every field and bound, and repeats none.
504
511
  - Before 1.0 the plugin API moves with the console's line; `pluginApi` is raised when the contract breaks, and the console names the majors it serves; a plugin is rebuilt against the console it runs on, and names the consoles it runs on in `console`, which carries the patch floor a feature of the console's puts under it (an option's `key`, say, which 0.4.3 brought), where `pluginApi` cannot. The generic routes and the command are in the REST snapshot, so an addition stays an addition.
@@ -0,0 +1,113 @@
1
+ # Spec: a desk's records
2
+
3
+ - Status: **Built** ([ADR-0117](../adr/0117-a-desk-keeps-records-of-what-its-member-made-as-files-the-desks-pages-read.md), as [ADR-0122](../adr/0122-a-desk-is-given-its-least-and-grown-by-what-its-member-asks.md) amends it).
4
+ - Where things live: the format's schemas, its bounds and the check in `packages/console/src/records.ts`, exported from `@skillcdn/console/api`; the page that says the format to an agent, `skills/keeping-a-desk/collections.md`, whose examples a test reads by the schemas; `console desk check` and `console serve --records` in `packages/console/src/cli/` ([cli.md](cli.md#a-desk-of-ones-own)).
5
+
6
+ A desk is a member's own repository, a person's or an agent account's ([runner.md](runner.md#the-desk)). What it keeps lives under `records/`, in the shape that fits it: plain files, JSON an agent writes with its file tools and the files themselves, as the member asks and as the desk's `AGENTS.md` then says. Nothing is generated and nothing needs a build, and `console serve --records` serves whatever is there to the desk's pages ([below](#serving)).
7
+
8
+ This spec is one shape the package has ready, **collections**: a set of things the member made, with where each was used and how it did by day. A desk takes it where its member asks for exactly that, and nothing of it is written into a desk, checked or shown otherwise: `console desk` writes no file under `records/`, and the skill `keeping-a-desk` says the form to an agent on a page of its own (`collections.md`). `console desk check` says whether a desk's collections read right, with no page and no console, and the ready page `deskPage()` shows them.
9
+
10
+ ## The files
11
+
12
+ ```
13
+ records/
14
+ index.json the collections
15
+ <key>/
16
+ collection.json what the collection is, and how its items are read
17
+ items.json what was made: a list of items
18
+ uses.json where an item was used: a list (optional)
19
+ metrics.json how an item did, by day: a list (optional)
20
+ files/ the files themselves: what was made, of any kind and size
21
+ <anything else> the desk's own, in a shape of its own: not read by the check
22
+ ```
23
+
24
+ A key is lowercase letters, digits and hyphens, beginning with a letter or a digit, and it is the folder's name. A day is written `2026-11-15`. An address begins with `https://`. Everything else a person reads there is text, and is shown as text: a line (a title, a label, where an item was used) has no line break in it, and no text holds a control character or one that makes a string look like another. A key of a file the format does not name is read past by the schemas, so that a page built on an older format still reads a newer file, and said by the check, since a field spelled wrong is otherwise taken as left out.
25
+
26
+ ## `index.json`
27
+
28
+ `{ "collections": [ { "key", "title" } ] }`: the collections of the desk, in the order they are shown, each with the key its folder is called by. No command writes it: the first record does.
29
+
30
+ ## `collection.json`
31
+
32
+ | Field | What it is |
33
+ |---|---|
34
+ | `title` | What the collection is called |
35
+ | `description` | A few words on what it keeps (optional) |
36
+ | `statuses` | `[ { "key", "label" } ]`: the words an item's `status` may be, one for each state an item can be in, such as used and not used. Left out, an item has none |
37
+ | `fields` | `[ { "key", "label", "kind" } ]`: what every item says beside its title; `kind` is `text`, `number`, `day` or `link` |
38
+ | `metrics` | `[ { "key", "label", "unit", "currency" } ]`: the figures an item is measured in, by day; `unit` is `count`, `currency`, `percent` or `seconds`, and `currency`, three capital letters such as `KRW`, says which where it is one (optional) |
39
+ | `ratios` | `[ { "key", "label", "of", "per", "as" } ]`: a figure worked out from the totals of two metrics, `of` for each `per`, such as clicks per impression; `as` is `percent` or `number`. A rate is shown only where it is a ratio |
40
+
41
+ ## An item, a use, a row of figures
42
+
43
+ An item, an entry of `items.json`:
44
+
45
+ | Field | What it is |
46
+ |---|---|
47
+ | `id` | Letters, digits and hyphens: what the uses and the figures name the item by. Never changed |
48
+ | `title` | What it is called |
49
+ | `madeOn` | The day it was made |
50
+ | `status` | One of the collection's statuses. Where the collection names any, every item carries one: the schema reads an item without, and the check notes it |
51
+ | `preview` | A picture of it, by its path under the collection's `files/`: `png`, `jpg`, `jpeg`, `webp`, `gif`, `avif` or `svg` (optional) |
52
+ | `files` | `[ { "label", "path" } ]`: the files themselves, each by its path under the collection's `files/` (optional) |
53
+ | `links` | `[ { "label", "url" } ]`: where it is elsewhere (optional) |
54
+ | `task` | `{ "project", "number" }`: a task of the board, where the member ties the item to one (optional). Nothing asks for it, and nothing forbids it |
55
+ | `fields` | `{ "<field key>": value }`: text, a number, a day or an address, as the field's `kind` says (optional) |
56
+ | `note` | A few words (optional) |
57
+
58
+ A use, an entry of `uses.json`: `item`, the item's id; `on`, a day; `where`, the campaign, the channel, the page; `note` (optional). A row of figures, an entry of `metrics.json`: `item`; `on`, a day; `values`, `{ "<metric key>": number }` for each metric the day has a figure for.
59
+
60
+ ## The files themselves
61
+
62
+ A desk keeps what was made: pictures, video, sound, documents, of any size. A path begins with `files/`, and every part of it is a name that begins with no full stop, ends with neither a full stop nor a space, and holds none of `\ / : * ? " < > |`. What is large goes in with git LFS, which the desk's member sets up for the kinds they keep; a file that LFS has not fetched on a machine is a few lines of text in its place, a pointer, which the check notes and the serving refuses by name.
63
+
64
+ No secret goes into a record or among its files: a token, a key, a password. A desk's repository is private. What else a desk may hold is its member's to say, and its organization's where its rules say so.
65
+
66
+ ## Bounds
67
+
68
+ | What | At most |
69
+ |---|---|
70
+ | Collections of a desk | 100 |
71
+ | Items of a collection | 5,000 |
72
+ | Uses of a collection | 20,000 |
73
+ | Rows of figures of a collection | 50,000 |
74
+ | Statuses of a collection | 20 |
75
+ | Fields, metrics and ratios of a collection | 30 each |
76
+ | Files an item names | 50 |
77
+ | Links an item carries | 20 |
78
+ | A key or an item's id | 64 characters |
79
+ | A title, a label, where an item was used | 200 characters |
80
+ | A description, a note, a field that is text | 2,000 characters |
81
+ | An address | 2,048 characters |
82
+ | A path under `files/` | 300 characters |
83
+ | A JSON file of the records | 8 MiB |
84
+ | A file under `files/` | no bound |
85
+
86
+ The names of the bounds are the package's (`MAX_RECORD_ITEMS` and the rest), and the schemas hold them.
87
+
88
+ ## The check
89
+
90
+ `console desk check [<directory>]` reads the collections of the desk in the directory, the current one unless another is named, and asks nothing of a console: it needs no sign-in. It says each problem on a line, with the file and what is wrong:
91
+
92
+ - a file that is no JSON, or not in the format: a field missing or of another kind, a key or an id spelled otherwise, a day that is none, an address that does not begin with `https://`, a path that leaves `files/`, a text over its bound;
93
+ - a collection the index names twice, or whose `collection.json` is not there; a folder of `records/` that holds a `collection.json` and that the index leaves out, or that is there with no index at all; a status, a field, a metric or a ratio named twice; a ratio worked out from what is no metric;
94
+ - an id given to more than one item; a status that is not one of the collection's; a field the collection does not name, or of another kind than it says; a key that is no part of an item or of a collection;
95
+ - a preview or a file that is not there; a use or a row of figures of an item that is not there; a figure for what is no metric;
96
+ - a JSON file over its bound, which is not read.
97
+
98
+ A file an item names that is a git LFS pointer is said as a note, `note: …`, and is no problem; so is a use or a row of figures dated before its item was made, which is most often a day written wrong and now and then a thing used before it was recorded: only the member knows; and so is an item that carries no status where its collection names some. With any problem the command ends in 1; with none it says how many collections read and what each keeps, and where `records/index.json` is not there, that the desk keeps no collection, which is no failure. What else a desk keeps under `records/`, in a shape of its own, is not read and is no problem ([ADR-0122](../adr/0122-a-desk-is-given-its-least-and-grown-by-what-its-member-asks.md)). At most 20 problems of one file and 200 in all are said. `--json` answers `{ "directory", "found", "problems": [ { "file", "problem" } ], "notes", "collections": [ { "key", "items", "uses", "metricRows" } ] }`.
99
+
100
+ ## Serving
101
+
102
+ `console serve [<dir>] [--port <n>] [--records <dir>]` serves what the directory named holds at `/records/`, beside the build and the API ([cli.md](cli.md#a-console-of-ones-own)), collections and whatever else the desk keeps alike: `records/index.json` of the desk is `GET /records/index.json`. On the loopback alone, as everything the command serves, and to no request that the browser says comes from another site's page.
103
+
104
+ - **Read when asked.** Every request reads the file as it is then, and is answered with `Cache-Control: no-store`: a record an agent just wrote is what the page shows.
105
+ - **`GET` alone.** Any other method is `405`, `records.read_only`.
106
+ - **Nothing outside the directory.** A path with a part that is empty, `.` or `..`, that begins with a full stop, or that holds a backslash; a file reached through a link that leaves the directory; a folder: each is `404`, `records.not_found`, as a file that is not there is, and nothing is listed.
107
+ - **By its kind.** JSON, a picture (`png`, `jpg`, `jpeg`, `webp`, `gif`, `avif`), a video (`mp4`, `m4v`, `webm`, `mov`, `ogv`), a sound (`mp3`, `m4a`, `aac`, `wav`, `ogg`, `oga`, `flac`) and a PDF are answered with their own content type, so that a page shows them in place. An `svg` is answered as a picture and as a download at once (`Content-Disposition: attachment`, and a policy that runs nothing), so that a page shows it and nothing opens it as a document of the pages' origin. Anything else is handed over as a download: `application/octet-stream`, `Content-Disposition: attachment` with its name. Every answer says `X-Content-Type-Options: nosniff` and `Cross-Origin-Resource-Policy: same-origin`.
108
+ - **A part of a file.** A request for one range of bytes (`Range: bytes=…`) is answered with `206` and that part, so that a video is played from where it is looked at; a range the file does not have is `416`.
109
+ - **A file git LFS has not fetched** is `409`, `records.not_fetched`, with what fetches it: `git lfs pull` in the desk.
110
+ - **A directory that is not there yet** is served as one that holds nothing: every path is `404`, `records.not_found`, until the directory is there. It is looked for at each request, so that the first thing a desk keeps is served with no restart ([ADR-0122](../adr/0122-a-desk-is-given-its-least-and-grown-by-what-its-member-asks.md)). What is there and is no directory is refused before anything listens.
111
+ - **Without `--records`,** every path under `/records/` is `404`, `records.not_served`, and never the build's page.
112
+
113
+ A refusal is `{ "error": { "code", "message" } }`, as the API's are. The pages of the build are served under the policy of every build ([ADR-0014](../adr/0014-a-persons-own-console-is-served-from-their-machine-by-the-command.md)): what is of the same origin is shown, so a picture, a video and a sound of `/records/` are, and a PDF in a frame; nothing of another origin is.