@skillcdn/console 0.4.5 → 0.4.7

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 (138) hide show
  1. package/README.md +4 -4
  2. package/dist/api.d.ts +2 -2
  3. package/dist/api.d.ts.map +1 -1
  4. package/dist/api.js +2 -2
  5. package/dist/api.js.map +1 -1
  6. package/dist/cli/cli.d.ts +6 -0
  7. package/dist/cli/cli.d.ts.map +1 -1
  8. package/dist/cli/cli.js +83 -42
  9. package/dist/cli/cli.js.map +1 -1
  10. package/dist/cli/format.d.ts +8 -1
  11. package/dist/cli/format.d.ts.map +1 -1
  12. package/dist/cli/format.js +11 -2
  13. package/dist/cli/format.js.map +1 -1
  14. package/dist/cli/help.d.ts.map +1 -1
  15. package/dist/cli/help.js +22 -10
  16. package/dist/cli/help.js.map +1 -1
  17. package/dist/cli/keys.d.ts +10 -0
  18. package/dist/cli/keys.d.ts.map +1 -0
  19. package/dist/cli/keys.js +59 -0
  20. package/dist/cli/keys.js.map +1 -0
  21. package/dist/cli/main.js +2 -1
  22. package/dist/cli/main.js.map +1 -1
  23. package/dist/cli/terminal.d.ts +7 -0
  24. package/dist/cli/terminal.d.ts.map +1 -1
  25. package/dist/cli/terminal.js +39 -0
  26. package/dist/cli/terminal.js.map +1 -1
  27. package/dist/client.d.ts +9 -1
  28. package/dist/client.d.ts.map +1 -1
  29. package/dist/client.js +5 -1
  30. package/dist/client.js.map +1 -1
  31. package/dist/components/plugin-frame.d.ts.map +1 -1
  32. package/dist/components/plugin-frame.js +73 -17
  33. package/dist/components/plugin-frame.js.map +1 -1
  34. package/dist/components/sessions.d.ts +15 -0
  35. package/dist/components/sessions.d.ts.map +1 -0
  36. package/dist/components/sessions.js +17 -0
  37. package/dist/components/sessions.js.map +1 -0
  38. package/dist/components/shell.d.ts.map +1 -1
  39. package/dist/components/shell.js +198 -28
  40. package/dist/components/shell.js.map +1 -1
  41. package/dist/components/workspace.d.ts +2 -0
  42. package/dist/components/workspace.d.ts.map +1 -1
  43. package/dist/components/workspace.js +19 -4
  44. package/dist/components/workspace.js.map +1 -1
  45. package/dist/console.css +228 -21
  46. package/dist/console.d.ts +5 -2
  47. package/dist/console.d.ts.map +1 -1
  48. package/dist/console.js +106 -21
  49. package/dist/console.js.map +1 -1
  50. package/dist/data.d.ts +7 -1
  51. package/dist/data.d.ts.map +1 -1
  52. package/dist/data.js +26 -5
  53. package/dist/data.js.map +1 -1
  54. package/dist/i18n/en.d.ts +24 -0
  55. package/dist/i18n/en.d.ts.map +1 -1
  56. package/dist/i18n/en.js +21 -0
  57. package/dist/i18n/en.js.map +1 -1
  58. package/dist/i18n/index.d.ts +2 -2
  59. package/dist/i18n/index.d.ts.map +1 -1
  60. package/dist/i18n/index.js +7 -3
  61. package/dist/i18n/index.js.map +1 -1
  62. package/dist/i18n/ko.d.ts.map +1 -1
  63. package/dist/i18n/ko.js +23 -2
  64. package/dist/i18n/ko.js.map +1 -1
  65. package/dist/index.d.ts +1 -0
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +1 -0
  68. package/dist/index.js.map +1 -1
  69. package/dist/plugin/bridge.d.ts +7 -3
  70. package/dist/plugin/bridge.d.ts.map +1 -1
  71. package/dist/plugin/bridge.js +1 -0
  72. package/dist/plugin/bridge.js.map +1 -1
  73. package/dist/plugin/context.d.ts +16 -1
  74. package/dist/plugin/context.d.ts.map +1 -1
  75. package/dist/plugin/define.d.ts.map +1 -1
  76. package/dist/plugin/define.js +6 -3
  77. package/dist/plugin/define.js.map +1 -1
  78. package/dist/plugin/sandbox.d.ts.map +1 -1
  79. package/dist/plugin/sandbox.js +8 -1
  80. package/dist/plugin/sandbox.js.map +1 -1
  81. package/dist/plugin/web.d.ts +16 -3
  82. package/dist/plugin/web.d.ts.map +1 -1
  83. package/dist/plugin/web.js +8 -1
  84. package/dist/plugin/web.js.map +1 -1
  85. package/dist/router.d.ts +6 -0
  86. package/dist/router.d.ts.map +1 -1
  87. package/dist/router.js +5 -0
  88. package/dist/router.js.map +1 -1
  89. package/dist/routes.d.ts +3 -1
  90. package/dist/routes.d.ts.map +1 -1
  91. package/dist/routes.js +2 -0
  92. package/dist/routes.js.map +1 -1
  93. package/dist/schemas.d.ts +38 -0
  94. package/dist/schemas.d.ts.map +1 -1
  95. package/dist/schemas.js +37 -1
  96. package/dist/schemas.js.map +1 -1
  97. package/dist/tokens.d.ts.map +1 -1
  98. package/dist/tokens.js +1 -0
  99. package/dist/tokens.js.map +1 -1
  100. package/dist/vocabulary.d.ts +6 -0
  101. package/dist/vocabulary.d.ts.map +1 -1
  102. package/dist/vocabulary.js +7 -0
  103. package/dist/vocabulary.js.map +1 -1
  104. package/docs/specs/cli.md +5 -5
  105. package/docs/specs/plugins.md +28 -15
  106. package/docs/specs/rest.md +12 -8
  107. package/package.json +1 -1
  108. package/skills/building-a-plugin/SKILL.md +3 -3
  109. package/skills/planning-the-board/references/setting-up.md +1 -1
  110. package/src/api.ts +6 -0
  111. package/src/cli/cli.ts +115 -43
  112. package/src/cli/format.ts +15 -2
  113. package/src/cli/help.ts +22 -10
  114. package/src/cli/keys.ts +69 -0
  115. package/src/cli/main.ts +2 -1
  116. package/src/cli/terminal.ts +40 -0
  117. package/src/client.ts +18 -0
  118. package/src/components/plugin-frame.tsx +92 -24
  119. package/src/components/sessions.tsx +108 -0
  120. package/src/components/shell.tsx +265 -52
  121. package/src/components/workspace.tsx +46 -2
  122. package/src/console.tsx +181 -16
  123. package/src/data.ts +33 -5
  124. package/src/i18n/en.ts +25 -0
  125. package/src/i18n/index.ts +11 -3
  126. package/src/i18n/ko.ts +27 -2
  127. package/src/index.ts +1 -0
  128. package/src/plugin/bridge.ts +8 -3
  129. package/src/plugin/context.ts +16 -1
  130. package/src/plugin/define.ts +10 -2
  131. package/src/plugin/sandbox.ts +9 -1
  132. package/src/plugin/web.ts +21 -4
  133. package/src/router.ts +7 -0
  134. package/src/routes.ts +3 -1
  135. package/src/schemas.ts +41 -0
  136. package/src/styles/console.css +228 -21
  137. package/src/tokens.ts +1 -0
  138. package/src/vocabulary.ts +9 -0
@@ -170,10 +170,10 @@ Everything a plugin does to the console is a call on `ctx`, which is a message t
170
170
  | Member | What it is | Needs |
171
171
  |---|---|---|
172
172
  | `ctx.plugin` | `{ key, version, dataVersion, settings, board, projects, grants }`: the settings without the secrets; `board` the board project's `{ id, key }` or `null`; `projects` `"all"` or the keys of the projects the plugin is on; `grants` the roles of other plugins granted to this one, each `{ plugin, role }` ([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)) | nothing |
173
- | `ctx.caller` | `{ kind: "person" \| "console" \| "plugin", person?, agent?, plugin?, for?, roles, run?, project? }`: in a command, a query or a person's endpoint, the person (`id`, `login`, `name`, `language`, `admin`), the agent's name where a token acts, their roles in this plugin, their open run in the board project if any, and the project the call is on; in a job, a hook, an upgrade or a webhook, `console`, with every role; in an `api` call another plugin made from its own job, hook or webhook, `plugin`, with that plugin's key and the roles granted to it here, and, where it acts for a person, `for` the person (`id`, `login`, `name`, `language`, `admin: false`) and the roles the plugin and the person both hold ([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)); a plugin that knows only the first two kinds refuses the third, which fails safe | nothing |
173
+ | `ctx.caller` | `{ kind: "person" \| "console" \| "plugin", person?, agent?, plugin?, for?, roles, run?, project? }`: in a command, a query or a person's endpoint, the person (`id`, `login`, `name`, `language`, `admin`), the agent's name where a token acts, their roles in this plugin, their open run in the board project if any, and the project the call is on, one the plugin acts in only where it is placed on it ([ADR-0080](../adr/0080-a-plugin-reaches-the-projects-it-is-placed-on-and-whoever-may-use-it-is-a-requester-in-its-board-project.md)); in a job, a hook, an upgrade or a webhook, `console`, with every role; in an `api` call another plugin made from its own job, hook or webhook, `plugin`, with that plugin's key and the roles granted to it here, and, where it acts for a person, `for` the person (`id`, `login`, `name`, `language`, `admin: false`) and the roles the plugin and the person both hold ([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)); a plugin that knows only the first two kinds refuses the third, which fails safe | nothing |
174
174
  | `ctx.records(collection)` | the records of a collection, by its definition (typed from the schema) or by name: `create(data, { project?, owner? })`, `get(id)` (`null` when there is none), `update(id, patch, { baseVersion? })`, `archive(id)`, `restore(id)`, `list({ where?, order?, limit?, after?, project?, archived? })`, `search(words, { where?, limit?, project? })`, `aggregate({ where?, groupBy?, count?, sum?, min?, max? })`, `versions(id)`, `link(id, target)`, `unlink(id, target)`, `links(id)`, and `files(id)` with `attach(handle, { name?, type? })`, `list()` and `remove(fileId)`; `order` is `{ field, descending? }`; a refusal is thrown as a `PluginRefusal` with the console's code | nothing; `files` for the files |
175
175
  | `ctx.sql` | `query(text, params)` and `transaction(async (tx) => ...)`, on the plugin's own role | `storage:sql` |
176
- | `ctx.console.workspace()` | the workspace's name, languages, time zone (`timeZone`, `UTC` where none is set, and `timeZoneSet`, whether an administrator set one, so that a plugin that reads a time of day says so instead of taking UTC for a choice), the day its week begins on (`weekStart`: `auto`, `monday` or `sunday`), categories, and `url`, the console's public origin (`PUBLIC_URL`) for a link to the console in what the plugin writes elsewhere, `null` where the deployment names none | nothing |
176
+ | `ctx.console.workspace()` | the workspace's name, its language (`language`, the one an administrator set for whoever has none of their own, else `en`, and `languageSet`, whether one was set, [ADR-0081](../adr/0081-a-workspace-has-a-language-for-whoever-has-none-of-their-own.md)), the languages the console speaks (`languages`, `language` first), time zone (`timeZone`, `UTC` where none is set, and `timeZoneSet`, whether an administrator set one, so that a plugin that reads a time of day says so instead of taking UTC for a choice), the day its week begins on (`weekStart`: `auto`, `monday` or `sunday`), categories, and `url`, the console's public origin (`PUBLIC_URL`) for a link to the console in what the plugin writes elsewhere, `null` where the deployment names none | nothing |
177
177
  | `ctx.console.people` | `list({ q? })` and `get(id)`: the people the caller may see, each with `managerId`, whom they report to in the directory or `null`, for a plugin to take as its default where it needs someone's manager, `language`, what they read in or `null` until the pages have seen them, and `teams`, the keys of the teams they are in ([ADR-0073](../adr/0073-a-team-is-a-name-and-its-members-a-unit-to-call-people-by-and-to-grant-a-plugins-role-to.md), [ADR-0074](../adr/0074-a-team-is-called-by-a-key-that-never-changes-one-name-among-the-projects-keys.md)); everyone for a `console` caller, or with `people:read:all`; their work `email` with `people:read:email` | `people:read` |
178
178
  | `ctx.console.teams` | `list()` and `get(key)`: the teams of the workspace ([ADR-0073](../adr/0073-a-team-is-a-name-and-its-members-a-unit-to-call-people-by-and-to-grant-a-plugins-role-to.md)), each `{ id, key, name, memberIds, createdAt }`, the members among the people the caller may see; a team is called by its `key`, which never changes | `people:read` |
179
179
  | `ctx.console.projects` | `list()`, `get(key)`, `members(key)`: the projects the caller may see; all with `projects:read:all`, but in a call for a person, the person's ([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)) | `projects:read` |
@@ -182,7 +182,7 @@ 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, and for `basic` the base64 of the pair and the password alone), `"[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 |
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
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 |
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 |
@@ -204,10 +204,10 @@ Declared in the manifest, consented to by an administrator when enabling, enforc
204
204
  | `people:read` | the people the caller may see, as the person, and among them who was granted a role of the plugin (`ctx.console.people.granted(role)`, an administrator listed only where granted it) and, for a frame, their pictures | the names, logins and pictures its role holders may see anyway |
205
205
  | `people:read:all` | everyone, for `console` callers too; and the workspace's people events (`person.joined`, `person.deactivated`, `person.reactivated`, `person.role_changed`, `person.manager_changed`, `person.email_changed`, `person.listed`, `person.unlisted`, and the teams' `team.created`, `team.renamed`, `team.removed`, `team.member_added`, `team.member_removed`) to its hooks, with their content | the directory, and when people come and go |
206
206
  | `people:read:email` | the work email of the people it may read (`email` on `ctx.console.people.list` and `get`, `null` until known; left out without it): the address a person signs in with at Google, else what an administrator wrote, by which the plugin matches them to an account elsewhere; `person.email_changed` says that one changed, never what it is | the addresses of the people its role holders may see |
207
- | `people:act` | acting for a person who did something elsewhere ([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)): `ctx.plugins.get(key).for(personId)` and `ctx.console.decisions.answer(id, answer, { for })`, within what the person may do as a member, whatever they administer, and what the plugin was granted, both; a decision only where it is on their plate; recorded as the person's through the plugin | what its role holders may do as members, done in their name from elsewhere; the decisions on their plates answered |
207
+ | `people:act` | acting for a person who did something elsewhere ([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)): `ctx.plugins.get(key).for(personId)` and `ctx.console.decisions.answer(id, answer, { for })`, within what the person may do as a member, whatever they administer, and what the plugin was granted, both; a decision only where it is on their plate, a person's own only while they are in its project ([ADR-0077](../adr/0077-a-persons-own-decision-is-its-projects-and-reaches-nobody-out-of-it.md)); recorded as the person's through the plugin | what its role holders may do as members, done in their name from elsewhere; the decisions on their plates answered |
208
208
  | `projects:read` | the projects and members the caller may see | what the person sees |
209
209
  | `projects:read:all` | every project and its members | the projects and who is in them |
210
- | `board:read` | the tasks, decisions, runs, documents and events of its board projects, and of the project a call is on | the content of those boards, to its role holders |
210
+ | `board:read` | the tasks, decisions, runs, documents and events of its board project and the projects it is placed on, for a person those among them the person may see | the content of those boards, to its role holders |
211
211
  | `board:tasks` | tasks created in its projects; its own changed, closed, commented | tasks that mislead; each marked as the plugin's, put away by anyone |
212
212
  | `board:decisions` | decisions raised in its projects; the answers to its own read | questions that mislead; never an answer of its own (an answer for a person is `people:act`) |
213
213
  | `board:documents` | pages written under `plugins/<key>/` in its projects | pages that mislead, in its folder |
@@ -252,11 +252,12 @@ With `storage:sql` consented to, enabling creates the schema `plugin_<key>` and
252
252
  ## The board
253
253
 
254
254
  - `board.needs` says whether the plugin puts things on a board. Enabling one with `required` or `optional`, the administrator makes a project from `board.defaults` (the key, name and description in the workspace's languages, edited as they like; private; they are its owner) or chooses one that exists; several plugins may bind to one project. The install keeps the project's id, and the project's settings page shows the plugins bound to it.
255
- - A plugin with `level: project` pages, or with `project: optional` or `required` collections, is on the projects the administrator names: all, or a list. A plugin on no project has no project pages. Owners do not enable plugins in their projects.
256
- - What a plugin makes on a board carries its name: the console writes the link (`plugin_links`: plugin, kind, id) when `ctx.console.tasks.create`, `decisions.ask` or `documents.write` runs, the event carries `plugin = <key>` beside `actor` and `agent`, and the pages and the feed say "through <plugin>" (`plugin` on a task, a decision and a document as the API answers them). A person's call acts as the person; a call a plugin makes for a person acts as the person, a member whatever they administer, and the event names the plugin that acted for them as `via`; a `console` caller, a job or a hook, and a plugin another calls as itself act as the administrator who enabled the plugin, who owns what it makes, within the plugin's projects alone, through no one. A plugin changes, closes, comments or reads the answer of its own items only; it reads every item of its board projects with `board:read`. Its documents go under `plugins/<key>/`; a write elsewhere is `plugin.forbidden`.
255
+ - A plugin with `level: project` pages, or with `project: optional` or `required` collections, is on the projects the administrator names: all, or a list. A plugin on no project has no project pages. Owners do not enable plugins in their projects. The projects it is on, with its board project, are the projects it reaches, as itself and for anyone, and no other ([ADR-0080](../adr/0080-a-plugin-reaches-the-projects-it-is-placed-on-and-whoever-may-use-it-is-a-requester-in-its-board-project.md)): a person's call takes it nowhere it is not placed.
256
+ - What a plugin makes on a board carries its name: the console writes the link (`plugin_links`: plugin, kind, id) when `ctx.console.tasks.create`, `decisions.ask` or `documents.write` runs, the event carries `plugin = <key>` beside `actor` and `agent`, and the pages and the feed say "through <plugin>" (`plugin` on a task, a decision and a document as the API answers them). A person's call acts as the person, in the projects of the plugin's the person may see; a call a plugin makes for a person acts as the person, a member whatever they administer, and the event names the plugin that acted for them as `via`; a `console` caller, a job or a hook, and a plugin another calls as itself act as the administrator who enabled the plugin, who owns what it makes, within the plugin's projects alone, through no one. A plugin changes, closes, comments or reads the answer of its own items only; it reads every item of its board projects with `board:read`, and by id, for a person, only what the person may see, as a listing shows them. Its documents go under `plugins/<key>/`; a write elsewhere is `plugin.forbidden`.
257
257
  - A decision a plugin raises is a decision as any ([ADR-0042](../adr/0042-a-decision-is-addressed-to-a-person-its-raiser-unless-another-is-named.md)): addressed to the person named in `deciderId`, or to the several named in `deciderIds`, any of whom may answer and the first answer ending it ([ADR-0057](../adr/0057-a-decision-may-be-addressed-to-several-people-and-the-first-answer-ends-it.md)), each an active person of the workspace, in the board project or not ([ADR-0068](../adr/0068-a-decision-reaches-whom-it-is-addressed-to-wherever-it-is-and-a-plugins-reaches-the-managers-above-them.md)), else to the administrator who enabled the plugin; answered by anyone of the project, by those it is addressed to wherever they are, and by whoever manages one of them, up the reporting line; shown among each person's decisions and in `console work`, read and answered at `/decisions/<id>` and `GET /api/v1/decisions/<id>` by a person who may not see the project, which is where a plugin's page sends them (`frame.navigate("/decisions/<id>")`). The command that raised it returns `waiting` and exits with `3`, and the agent waits as it does for `ask`. The plugin learns of the answer through `on["console:decision.answered"]`, which `about` lets it map to its record, and whose `data` names the chosen option by its label (`option`) and by the key the plugin gave it (`optionKey`), for its own decisions with `board:decisions` alone, so that it reads the answer without comparing labels or asking again; the person's own answer has no key. A plugin never answers of itself; with `people:act` it answers for a person a decision on their plate (`ctx.console.decisions.answer`).
258
- - What a plugin writes for people, a decision's question, body and labels, a task's title and body, a comment's body, is one text, in the language of whoever it is for ([ADR-0065](../adr/0065-a-plugin-writes-one-text-and-a-persons-language-is-kept-from-the-first-time-the-pages-see-them.md)). `ctx.console.people.get(id)` says a person's `language`: the one they chose, else the one the pages first saw them in, `null` until then, where the plugin decides, the first of `ctx.console.workspace().languages` by default. Where several may answer, it chooses one of them. Whoever else reads the text reads it as written, as with what a person writes.
259
- - Where a record is linked to a project and the caller may work there, `ask` and `tasks.create` may name that project instead of the board project.
258
+ - What a plugin writes for people, a decision's question, body and labels, a task's title and body, a comment's body, is one text, in the language of whoever it is for ([ADR-0065](../adr/0065-a-plugin-writes-one-text-and-a-persons-language-is-kept-from-the-first-time-the-pages-see-them.md)). `ctx.console.people.get(id)` says a person's `language`: the one they chose, else the one the pages first saw them in, `null` until then, where the plugin decides, `ctx.console.workspace().language` by default, the workspace's language, which is the first of `languages` too ([ADR-0081](../adr/0081-a-workspace-has-a-language-for-whoever-has-none-of-their-own.md)). Where several may answer, it chooses one of them. Whoever else reads the text reads it as written, as with what a person writes.
259
+ - Whoever may use the plugin is a requester in its board project ([ADR-0080](../adr/0080-a-plugin-reaches-the-projects-it-is-placed-on-and-whoever-may-use-it-is-a-requester-in-its-board-project.md)): a person's call, or a call a plugin makes for a person, raises a decision there with `ask` whether the person may see the project or not, and the decision reaches them as its raiser, at its own address and among the decisions they raised; nothing else of the project opens to them, and `tasks.create` and `documents.write` there are refused as for any project the person may not see (`plugin.not_found`).
260
+ - Where a record is linked to a project the plugin is placed on and the caller may work there, `ask` and `tasks.create` may name that project instead of the board project.
260
261
  - Two plugins on one project do not collide: each edits its own, reads all, writes in its own folder; one refers to another's work by reading, or through the other's `api`.
261
262
 
262
263
  ## Events, hooks and jobs
@@ -341,7 +342,7 @@ Under `/api/v1/plugins`. Who may call: *anyone* signed in or on a token, *roles*
341
342
  | `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 |
342
343
  | `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 |
343
344
  | `plugin <key> skills [--search <words>]`, `plugin <key> skill <path>` | `GET .../skills...` | as `console skills` and `console skill` |
344
- | `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 from standard input), `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 |
345
+ | `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 |
345
346
 
346
347
  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.
347
348
 
@@ -364,7 +365,7 @@ The rules an agent reads carry the plugins: `GET /api/v1/rules` and `GET /api/v1
364
365
  </html>
365
366
  ```
366
367
 
367
- with the headers `content-security-policy: default-src 'none'; script-src <origin>/api/v1/plugins/<key>/web/<version>/; style-src <origin>/api/v1/plugins/<key>/web/ <origin>/api/v1/plugin-runtime/; img-src <origin>/api/v1/plugins/<key>/web/ data: blob:; font-src <origin>/api/v1/plugins/<key>/web/ <origin>/api/v1/plugin-runtime/; connect-src 'none'; frame-ancestors <origin>; base-uri 'none'; form-action 'none'; sandbox allow-scripts allow-forms`, `referrer-policy: no-referrer`, `x-content-type-options: nosniff` and `cache-control: no-store`. `<origin>` is the origin of the page that embeds the frame, read from the request's `referer`: `PUBLIC_URL`'s, or the loopback a person's own console is served on by `console serve` ([ADR-0014](../adr/0014-a-persons-own-console-is-served-from-their-machine-by-the-command.md)); any other, or none, is not found. A plugin that is not enabled, or a page or a widget it does not declare, is answered 404 with a blank document under `default-src 'none'; script-src 'sha256-<its one script>'; frame-ancestors <origin>; base-uri 'none'; form-action 'none'; sandbox allow-scripts`, whose one script tells the page `unavailable`, so that a frame never shows an answer meant for a program. The console's page embeds the frame as `<iframe sandbox="allow-scripts allow-forms" referrerpolicy="origin" src=...>`. The document's origin is opaque: no cookie travels, the API is out of reach, and its scripts are the bundle's alone. `allow-forms` is there so that a page's form fires its `submit` event, which a browser drops with the submission otherwise; `form-action 'none'` keeps a submission from going anywhere, so a page handles the event itself and speaks over the bridge. The headers are proven by an integration test, and a browser is seen to enforce them by `pnpm test:browser`, a real Chromium against the console listening on this machine, apart from `pnpm check` (`apps/console/src/http/plugin-frame.browser.test.ts`). The files of the bundle, `GET .../web/<version>/<path>`, are served from the package's `web` directory with `cache-control: public, max-age=31536000, immutable` (`no-store` on the preview console of `pnpm dev:plugins`, where a plugin is rebuilt under one version and a browser that kept a build would run it against a server that answers something else), `cross-origin-resource-policy: cross-origin` and `access-control-allow-origin: *`, since the frame's origin is not the console's and a module script, as a font, is fetched with CORS; the console's stylesheet for frames carries the same two. The document links `fonts.css` before the stylesheet: the `@font-face` rules of the console's own build, their files served at `GET /api/v1/plugin-runtime/assets/<file>`, fonts alone, so that a frame reads in the console's faces; empty where the server has no build. In a frame document the stylesheet paints no background and lets the document be as tall as its content (`html[data-console]`), so that the box the console draws shows through and the frame shrinks as well as grows. A bundle holds no secret, since anyone may fetch it. The console's own pages gain `frame-src 'self'` in their policy and nothing else.
368
+ with the headers `content-security-policy: default-src 'none'; script-src <origin>/api/v1/plugins/<key>/web/<version>/; style-src <origin>/api/v1/plugins/<key>/web/ <origin>/api/v1/plugin-runtime/; img-src <origin>/api/v1/plugins/<key>/web/ data: blob:; font-src <origin>/api/v1/plugins/<key>/web/ <origin>/api/v1/plugin-runtime/; connect-src 'none'; frame-ancestors <origin>; base-uri 'none'; form-action 'none'; sandbox allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox`, `referrer-policy: no-referrer`, `x-content-type-options: nosniff` and `cache-control: no-store`. `<origin>` is the origin of the page that embeds the frame, read from the request's `referer`: `PUBLIC_URL`'s, or the loopback a person's own console is served on by `console serve` ([ADR-0014](../adr/0014-a-persons-own-console-is-served-from-their-machine-by-the-command.md)); any other, or none, is not found. A plugin that is not enabled, or a page or a widget it does not declare, is answered 404 with a blank document under `default-src 'none'; script-src 'sha256-<its one script>'; frame-ancestors <origin>; base-uri 'none'; form-action 'none'; sandbox allow-scripts`, whose one script tells the page `unavailable`, so that a frame never shows an answer meant for a program. The console's page embeds the frame as `<iframe sandbox="allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox" referrerpolicy="origin" src=...>`. The document's origin is opaque: no cookie travels, the API is out of reach, and its scripts are the bundle's alone. `allow-forms` is there so that a page's form fires its `submit` event, which a browser drops with the submission otherwise; `form-action 'none'` keeps a submission from going anywhere, so a page handles the event itself and speaks over the bridge. `allow-popups` and `allow-popups-to-escape-sandbox` are there so that a link a person presses opens in a new tab: the browser lets the frame open a window for a press in it alone, one a press, and the window is a page as any, out of the sandbox, with no opener and no referrer as `frame.open` opens it ([ADR-0078](../adr/0078-a-frame-opens-its-links-itself-and-the-browser-holds-it-to-a-press-in-it.md)); the console's page admits no frame but its own under `frame-src 'self'`, so a window a plugin opened with an opener could send the frame nowhere. The headers are proven by an integration test, and a browser is seen to enforce them by `pnpm test:browser`, a real Chromium against the console listening on this machine, apart from `pnpm check` (`apps/console/src/http/plugin-frame.browser.test.ts`). The files of the bundle, `GET .../web/<version>/<path>`, are served from the package's `web` directory with `cache-control: public, max-age=31536000, immutable` (`no-store` on the preview console of `pnpm dev:plugins`, where a plugin is rebuilt under one version and a browser that kept a build would run it against a server that answers something else), `cross-origin-resource-policy: cross-origin` and `access-control-allow-origin: *`, since the frame's origin is not the console's and a module script, as a font, is fetched with CORS; the console's stylesheet for frames carries the same two. The document links `fonts.css` before the stylesheet: the `@font-face` rules of the console's own build, their files served at `GET /api/v1/plugin-runtime/assets/<file>`, fonts alone, so that a frame reads in the console's faces; empty where the server has no build. In a frame document the stylesheet paints no background and lets the document be as tall as its content (`html[data-console]`), so that the box the console draws shows through and the frame shrinks as well as grows. Until the page has drawn, the console shows a spinner in the frame's place and the frame not at all: until the page grows past the height it had before it drew anything, which its first `resize` says, or five seconds after the frame loaded or said `ready`, whichever is first, so that a page that draws nothing is shown as it is. A bundle holds no secret, since anyone may fetch it. The console's own pages gain `frame-src 'self'` in their policy and nothing else.
368
369
 
369
370
  ### The bridge
370
371
 
@@ -372,7 +373,7 @@ The console's page and the frame speak over `postMessage`, every message `{ v: 1
372
373
 
373
374
  | From | `t` | Carries |
374
375
  |---|---|---|
375
- | the page | `init` | `plugin: { key, version }`, `page` or `widget` (with `size`, the size the widget has, [ADR-0059](../adr/0059-a-person-arranges-the-front-pages-widgets-from-the-sizes-each-comes-in.md)), `project?: { key, name }`, `person: { id, login, name, language, admin }`, `workspace: { name, languages, timeZone, weekStart, firstDay }` (`firstDay` the day a week begins on with the workspace's setting applied, 1 for Monday, 7 for Sunday, for a calendar to start from; none from a console older than it), `roles`, `path` (what follows the page in the address), `language`, `theme: { [token]: value }` |
376
+ | the page | `init` | `plugin: { key, version }`, `page` or `widget` (with `size`, the size the widget has, [ADR-0059](../adr/0059-a-person-arranges-the-front-pages-widgets-from-the-sizes-each-comes-in.md)), `project?: { key, name }`, `person: { id, login, name, language, admin }`, `workspace: { name, language, languages, timeZone, weekStart, firstDay }` (`language` the workspace's language, `en` where none is set, first in `languages`; none from a console older than it; `firstDay` the day a week begins on with the workspace's setting applied, 1 for Monday, 7 for Sunday, for a calendar to start from; none from a console older than it), `roles`, `path` (what follows the page in the address), `language`, `theme: { [token]: value }` |
376
377
  | the page | `result` | `id`, `ok`, `value` or `error: { code, message }` |
377
378
  | the page | `event` | `kind: "records" \| "command" \| "plugin"`, `data`: something of this plugin changed. `command` and `records` come from the project's feed, on every `plugin.command` of the plugin on the project the page is on; `plugin` from `GET .../plugin-events`, asked for every few seconds while a frame listens |
378
379
  | the page | `theme` | the tokens, when the console's look changes |
@@ -385,16 +386,17 @@ The console's page and the frame speak over `postMessage`, every message `{ v: 1
385
386
  | the frame | `resize` | `height`, which the page gives a page's frame; a widget fills the cells its size gives it, and its height is not read |
386
387
  | the frame | `title` | `text`, for the document's title |
387
388
  | the frame | `download` | `id` of a file, which the page downloads |
388
- | the frame | `open` | `url`, a web or a mail address (`https:`, `http:`, `mailto:`) a person pressed, which the page opens in a new tab with no opener and no referrer, only right after a press ([ADR-0067](../adr/0067-a-link-a-person-presses-in-a-frame-opens-in-a-new-tab-through-the-bridge.md)); anything else is dropped unread, an address of the console's own origin among it, since a path of the console's is `navigate`'s |
389
+ | the frame | `open` | `url`, a web or a mail address (`https:`, `http:`, `mailto:`) a person pressed, from a bundle built before 0.4.6, whose sandbox opened no window: the page opens it in a new tab with no opener and no referrer, as far as it can tell of a press in that frame, while a press is recent and the frame holds the page's focus, one tab a press, the page taking the focus back as it opens one ([ADR-0067](../adr/0067-a-link-a-person-presses-in-a-frame-opens-in-a-new-tab-through-the-bridge.md), [ADR-0078](../adr/0078-a-frame-opens-its-links-itself-and-the-browser-holds-it-to-a-press-in-it.md)); a frame since opens its links itself, and the message goes at the next line; anything else is dropped unread, an address of the console's own origin among it, since a path of the console's is `navigate`'s |
389
390
  | the frame | `subscribe` | `kinds`, to receive `event` |
390
391
 
391
392
  The page performs every `call` with the person's session under `/api/v1/plugins/<key>/` only; a method or a path outside it is refused before any request, as `plugin.forbidden`. A page thus holds exactly the authority of its plugin's server module, as the person using it.
392
393
 
393
- `@skillcdn/console/plugin/web` is the frame's side: `connect()` says `ready`, waits for `init`, and resolves to `{ context, call, command, query, records, files, people, navigate, open, download, setTitle, onEvent, onTheme, onPath, close }`, applies the tokens to `:root` and the language to the document, and watches the body's height; it depends on nothing, and a refusal arrives as a `PluginBridgeError` with the console's code. `@skillcdn/console/plugin/web/react` adds `usePlugin()` for a plugin that chooses React. `people.picture(id)` answers a `blob:` address for an image, or `null` for a person with no picture to show. A page renders nothing a person wrote as HTML, as the console's own pages do not.
394
+ `@skillcdn/console/plugin/web` is the frame's side: `connect()` says `ready`, waits for `init`, and resolves to `{ context, call, command, query, records, files, people, navigate, open, download, setTitle, onEvent, onTheme, onPath, close }`, applies the tokens to `:root` and the language to the document, and watches the body's height; it depends on nothing, and a refusal arrives as a `PluginBridgeError` with the console's code. `open(url)` opens a web or a mail address in a new tab from the frame itself, with no opener and no referrer, for a link a person pressed: the browser holds the frame to a press in it, as it holds any page that opens a window, so that no window opens on the frame's own time or for a press elsewhere on the page, and the call is refused with no recent press where the browser can say so ([ADR-0078](../adr/0078-a-frame-opens-its-links-itself-and-the-browser-holds-it-to-a-press-in-it.md)); it needs a console from 0.4.6, which a plugin that calls it says in its manifest's `console`. `@skillcdn/console/plugin/web/react` adds `usePlugin()` for a plugin that chooses React. `people.picture(id)` answers a `blob:` address for an image, or `null` for a person with no picture to show. A page renders nothing a person wrote as HTML, as the console's own pages do not.
394
395
 
395
396
  ### Tabs, sub-tabs and addresses
396
397
 
397
- - At the workspace, after the console's own tabs and the organization's pages, and before Settings, which is last, come the groups that hold a plugin the person has a role in; in a project the same, before the project's settings. A group with one plugin is a tab with the plugin's name, leading to its first page; a group with several is a tab with the group's name that opens the list of its plugins, each leading to its first page (a `<details>`, as the person's menu is; `NavItem.children`). The groups the console knows have names in every language pack; a group a plugin declares has the plugin's. Groups and plugins are ordered by `menu.order`, then by key.
398
+ - At the workspace, after the console's own tabs and the organization's pages, and before Settings, which is last, come the groups that hold a plugin the person has a role in; in a project the same, before the project's settings. A group with one plugin is a tab with the plugin's name, leading to its first page; a group with several is a tab with the group's name that opens the list of its plugins, each leading to its first page (a button whose list is a popover in the top layer, placed under the tab, so that the row of tabs, which scrolls sideways and clips what hangs out of it, clips nothing of the list; `NavItem.children`; a mouse resting on the tab opens the list, leaving the tab and the list closes it, and the mouse's click on the tab leads where the tab leads, the group's first page, while a finger, a pen or a key opens and closes the list by a press), and the person's menu lists the group's plugins one by one under the group's name. The groups the console knows have names in every language pack; a group a plugin declares has the plugin's. Groups and plugins are ordered by `menu.order`, then by key.
399
+ - A group's list names each plugin alone. A tab's name longer than about 28 characters, a group's or a plugin's, may stop with an ellipsis where the row has no room for it, and the tab's title says it whole; a plugin's `name` is at most 40 characters, and one of a word or two reads best in a tab, in English as in the other languages; its `description` is read on its settings page, and by an agent in the rules where it has no `agentNote`.
398
400
  - A plugin with several pages at a level has a row of sub-tabs the console draws above the frame, in the manifest's order, joined to the header's tabs; a page's `wide` widens the frame as `CustomPage.wide` does. Views within a page are the plugin's own: `sc-subtabs` around `sc-tab`s, links or buttons, with `sc-tab-current` on the one shown, is the console's view switch.
399
401
  - Addresses: `/plugins/<key>` is the first page, `/plugins/<key>/<page>` a page, `/plugins/<key>/<page>/<rest>` a page with `<rest>` handed to the frame as `path`; on a project, `/projects/<pkey>/plugins/<key>[/<page>[/<rest>]]`. The custom pages of a console keep `/pages/<key>` ([ADR-0010](../adr/0010-the-default-uis-addresses-name-what-they-show-and-every-page-and-form-has-one.md)).
400
402
  - On a project, the tab row gains the same, for the plugins on that project with `level: project` pages, to the members who hold a role.
@@ -437,6 +439,17 @@ The install path is the first line (a release of the deployment, from a lockfile
437
439
 
438
440
  **The reach, by capability,** is the last column of the catalogue above. In sum: a plugin reaches what its role holders may see through it and what its consented capabilities open; sending anything out needs an `outbound` capability the administrator consented to; what it does on a board is marked and reversible.
439
441
 
442
+ **Who may do what on the board** is one model ([ADR-0080](../adr/0080-a-plugin-reaches-the-projects-it-is-placed-on-and-whoever-may-use-it-is-a-requester-in-its-board-project.md)), each rule the shape of one in wide use, and a new rule is weighed against them:
443
+
444
+ | Rule | On the board |
445
+ |---|---|
446
+ | A principal's own permission is what was granted to it | a person: their standing in the workspace and in each project; a plugin: the capabilities an administrator consented to, the roles granted to it, its board project and the projects it is placed on, read on every call |
447
+ | A plugin reaches its board project and the projects it is placed on, and no other | as itself and for anyone; a person's call takes it nowhere else |
448
+ | Acting for a person is the intersection, recorded with the actor | what the plugin may do and what the person may do as a member, both, never the person's administration; the event names the person, the plugin whose code acted and the plugin that acted for them, `via` ([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), [ADR-0076](../adr/0076-a-plugin-acting-for-a-person-stands-as-a-member-and-answers-only-what-is-on-their-plate.md)) |
449
+ | A decision reaches its parties | whoever may work in its project; whom it is addressed to and who raised it; the managers above a decider, for a plugin's; a person's own within its project alone ([ADR-0068](../adr/0068-a-decision-reaches-whom-it-is-addressed-to-wherever-it-is-and-a-plugins-reaches-the-managers-above-them.md), [ADR-0077](../adr/0077-a-persons-own-decision-is-its-projects-and-reaches-nobody-out-of-it.md)) |
450
+ | Whoever may use a plugin is a requester in its board project | they raise a decision there through the plugin, themselves or through a plugin acting for them, and read it as its raiser; nothing else of the project opens to them |
451
+ | A plugin's own acts are the console's, through no one | recorded as the administrator who enabled it, with the plugin's key beside; an identity of the plugin's own on the board is an open question ([architecture.md](../architecture.md)) |
452
+
440
453
  **What is checked, not enforced.** The hardening of a thread is defence in depth: a sandbox of its own would be a host container without egress, left to later. `console-plugin check` scans a plugin for what the host refuses, so that an author learns before an administrator does.
441
454
 
442
455
  **The pages.** A frame's code runs in an opaque origin and reaches the console through the bridge alone, which performs its plugin's own routes and nothing else; it holds the person's authority within its plugin, exactly as the plugin's server does. A file of its bundle, which a frame may go to, carries a policy of its own and runs nothing as a document. A frame holds no WebRTC either, which `connect-src` does not govern and no policy a browser honours closes: every script of a bundle is served beginning with a line that takes it out of wherever the script runs, the frame or a frame made inside it ([ADR-0064](../adr/0064-a-frame-holds-no-webrtc-every-script-of-a-bundle-begins-by-taking-it-out.md)). A plugin that holds `outbound:webrtc` is served its scripts without that line; no host opens it, and it opens no host. One that lists it as optional is served its scripts uncached, so that it is gone from the next time a frame loads once it is withdrawn; a consent a new version no longer asks opens nothing, and a frame runs its own version's scripts alone ([ADR-0066](../adr/0066-webrtc-is-a-way-out-a-plugin-asks-for-and-how-a-frame-is-held-stays-in-one-place.md)). Nothing a plugin writes is rendered as HTML by the console's pages: a tab, a sub-tab and a widget's name are text.
@@ -11,7 +11,7 @@ The API is the board as its members see it: the people, the projects, and in eac
11
11
  - Every answer is `cache-control: no-store`: it is one person's, or it changes.
12
12
  - A request that changes something (`POST`, `PATCH`, `DELETE`) on a session must carry the session cookie **and** come from the console's own pages: the browser's `origin` header must be `PUBLIC_URL`. The cookie is `SameSite=Lax`, so another site's request does not carry it in the first place; the origin is the second fence.
13
13
  - A token ([`POST /api/v1/tokens`](#get-apiv1tokens-and-post-apiv1tokens)) is presented as `Authorization: Bearer <secret>` on any route, by an agent, a script or a console of a person's own. It is then the credential: a cookie beside it is not looked at, and no origin is needed, since nothing attaches a token but whoever holds it. A token that is nothing is refused, whatever cookie travels with it. What a token does is attributed to its person, and the event names the agent: the token's name, or what the agent called itself on its run.
14
- - A token configures as its person does ([ADR-0021](../adr/0021-a-token-configures-as-its-person-does.md)): every request a session may make, a token may make, within the same roles, except the tokens themselves and the approval of a connection, which stay a person's own doing, signed in on the console's own pages; the one thing a token does about the tokens is give itself up (`DELETE /api/v1/me/token`).
14
+ - A token configures as its person does ([ADR-0021](../adr/0021-a-token-configures-as-its-person-does.md)): every request a session may make, a token may make, within the same roles, except the tokens themselves, the sessions and the approval of a connection, which stay a person's own doing, signed in on the console's own pages; the one thing a token does about the tokens is give itself up (`DELETE /api/v1/me/token`).
15
15
  - An agent connects without anyone copying a token ([ADR-0011](../adr/0011-an-agent-connects-with-a-short-code-a-person-approves-and-the-token-is-never-shown.md)): [`POST /api/v1/connect`](#connecting-an-agent) is nobody's, the approval is a person's own doing on the console's own pages, and the claim is the command's, with the secret it was given.
16
16
  - The command names its version on every request, as the product token of its `user-agent` (`skillcdn-console/0.1.18 (cli; node 24.11.0; linux)`), and every answer under `/api` says the console's version (`console-version`) and the range of command versions it takes (`console-client-range`, as npm spells one: `>=0.1.18 <0.2.0`) ([ADR-0025](../adr/0025-the-command-names-its-version-on-every-request-and-the-console-holds-it-to-the-range-it-takes.md)). Before 1.0 the range is the console's line, every patch of its major.minor, from the floor the console names where a release raised one: the oldest command whose requests and answers still fit it, raised only by a release that changed what passes between them ([ADR-0038](../adr/0038-the-command-and-the-console-go-together-within-a-line-and-a-release-that-changes-what-passes-between-them-raises-the-floors.md)); from 1.0, the console's major and a minor within one, either way. A command outside the range is refused with `426` before anything else is asked of its request, `client.outdated` or `client.too_new`, the message naming both versions and the range. The command holds the console to a floor of its own the same way, and refuses a console below it itself, as `console.outdated`, in this same form. A request that names no command, a browser's, a script's, is held to nothing.
17
17
  - Request bodies are JSON, at most 256 KiB, and parsed once with the package's input schema. Text is trimmed where it is a line, bounded everywhere (`MAX_TITLE_LENGTH` and the rest of `@skillcdn/console/api`), and refused when it carries control or invisible characters. Links are `https` URLs only.
@@ -49,12 +49,12 @@ The API is the board as its members see it: the people, the projects, and in eac
49
49
  | 401 | `auth.required` | Nobody is signed in, or the session has ended, or the token is nothing. The cookie is taken away when the operator no longer lists the login. |
50
50
  | 403 | `auth.forbidden_origin` | A request that changes something on a session did not come from the console's own pages. |
51
51
  | 403 | `auth.forbidden` | A member asked for what only an administrator, or only an owner of the project, may do. |
52
- | 403 | `auth.session_required` | A token asked for what only a person signed in may do: the tokens themselves, and the approval of an agent's connection, which makes one. |
52
+ | 403 | `auth.session_required` | A token asked for what only a person signed in may do: the tokens themselves, the sessions, and the approval of an agent's connection, which makes one. |
53
53
  | 403 | `auth.deactivated` | A token the console knows, for a person deactivated: the token is kept, refused on every route while they are out, `GET /api/v1/me` included, and theirs again when they are taken back in ([ADR-0044](../adr/0044-a-token-of-a-person-who-is-out-is-kept-and-refused-with-the-reason-until-they-are-back-in.md)). |
54
54
  | 403 | `auth.not_admitted` | A token the console knows, for a person no longer let in: what let them in, the domain or the organization, is no longer named. Kept and refused the same way, and theirs again when they are back in. |
55
55
  | 403 | `run.not_yours` | The run is another person's. |
56
56
  | 404 | `project.not_found` | No project has that key, or it is not the asker's to see: the two are one answer. The key is checked before anything is asked. |
57
- | 404 | `task.not_found`, `decision.not_found`, `goal.not_found`, `token.not_found`, `person.not_found`, `run.not_found`, `run.task_not_found`, `member.not_found` | No such id in the project (or in the workspace, for a token, a person); for a token, none of the asker's. An id that is not a UUID is not found either, except a task's number. |
57
+ | 404 | `task.not_found`, `decision.not_found`, `goal.not_found`, `token.not_found`, `session.not_found`, `person.not_found`, `run.not_found`, `run.task_not_found`, `member.not_found` | No such id in the project (or in the workspace, for a token, a session, a person); for a token or a session, none of the asker's. An id that is not a UUID is not found either, except a task's number. |
58
58
  | 404 | `category.not_found` | No category of the workspace has that key; a key that is not one is not found either. |
59
59
  | 404 | `listing.not_found` | No login let in and not signed in with yet has that id; one somebody signed in with is the person's, and goes with their deactivation. |
60
60
  | 404 | `file.not_found` | No file handed in, or attached to the page, has that id in the project; a link handed in is not a file. |
@@ -95,7 +95,7 @@ The API is the board as its members see it: the people, the projects, and in eac
95
95
 
96
96
  ### `GET /api/v1/me`
97
97
 
98
- `{ "workspace": { "name", "tokenDaysAtMost", "skills": { "source", "address", "packToken" }, "peopleVisibility" }, "person": ... | null, "agent": "..." | null, "language": "..." | null, "signIn": [{ "key", "label", "admits": { "organization", "domains" } }, ...], "console": { "version", "clientRange" }, "decisions": { "waiting" } | null }`: what the board is called, the most days a token may be good for here (or `null` where a person chooses), where the organization's skills come from (`source`, the origin of the SkillCDN deployment they are read through, and `address`, the organization's, canonical, which a project without one of its own reads, or `null`; and `packToken`, when the SkillCDN token the organization's pack is read with was set, `{ setAt }`, or `null`), who sees whom on the People page (`peopleVisibility`: `everyone`, or `shared_projects`, where a member sees only the people they share a project with and an administrator everyone; [ADR-0035](../adr/0035-who-may-see-whom-is-decided-by-one-policy-and-the-workspace-keeps-its-settings.md); read as optional, for a console from before the setting), the day the calendars begin a week on and this week is counted by (`weekStart`: `auto`, as the language of the pages has it, or `monday`, `sunday`; [ADR-0039](../adr/0039-this-week-is-the-plans-unit-and-the-week-begins-as-the-workspace-says.md)) and the workspace's time zone (`timeZone`: an IANA name, in which the command prints moments, or `null` for none; both optional the same way), who the session cookie or the token says is asking (`id`, `login`, `name` or `null`, `avatar` or `null`, `role`), with what (`agent`: the name of the token when a token asks, as its person called it, so that a console of a person's own knows it holds one and offers nothing a token cannot do; `null` on a session), the language the person reads in (`language`, a tag: the one they chose, else the one the pages first saw them in, [ADR-0065](../adr/0065-a-plugin-writes-one-text-and-a-persons-language-is-kept-from-the-first-time-the-pages-see-them.md); `null` until then), their own arrangement of the front page's widgets (`home`, [ADR-0059](../adr/0059-a-person-arranges-the-front-pages-widgets-from-the-sizes-each-comes-in.md): `[{ plugin, widget, size, place? }]` in order, or `null` for the manifests'; answered from 0.4.4 and read as optional), and the identity providers people sign in through (`gh`, `google`, each with the label of its button and, in `admits`, who gets in through it: the organization at the git host whose members are in, or `null`, and the Workspace domains whose accounts are, which a sign-in page says under the button; answered from 0.4.1 and read as optional), none where nobody can; and the console's own version with the range of command versions it takes (`console`, [ADR-0025](../adr/0025-the-command-names-its-version-on-every-request-and-the-console-holds-it-to-the-range-it-takes.md)), for a console built on the package to compare itself with; and how many decisions wait for the person's answer across the projects they may see (`decisions.waiting`, [ADR-0042](../adr/0042-a-decision-is-addressed-to-a-person-its-raiser-unless-another-is-named.md); `null` for nobody; answered from 0.4.3 and read as optional), which the pages say beside My decisions and read again when a decision is raised or answered. Nobody is an answer, not an error; the pages ask this once to decide what to show, and the command once, at `login`, to see that the console knows the token. A token the console knows whose person is out is refused here as on every route, `auth.deactivated` or `auth.not_admitted`, so that the agent learns why ([ADR-0044](../adr/0044-a-token-of-a-person-who-is-out-is-kept-and-refused-with-the-reason-until-they-are-back-in.md)).
98
+ `{ "workspace": { "name", "tokenDaysAtMost", "skills": { "source", "address", "packToken" }, "peopleVisibility", "weekStart", "timeZone", "language" }, "person": ... | null, "agent": "..." | null, "language": "..." | null, "signIn": [{ "key", "label", "admits": { "organization", "domains" } }, ...], "console": { "version", "clientRange" }, "decisions": { "waiting" } | null }`: what the board is called, the most days a token may be good for here (or `null` where a person chooses), where the organization's skills come from (`source`, the origin of the SkillCDN deployment they are read through, and `address`, the organization's, canonical, which a project without one of its own reads, or `null`; and `packToken`, when the SkillCDN token the organization's pack is read with was set, `{ setAt }`, or `null`), who sees whom on the People page (`peopleVisibility`: `everyone`, or `shared_projects`, where a member sees only the people they share a project with and an administrator everyone; [ADR-0035](../adr/0035-who-may-see-whom-is-decided-by-one-policy-and-the-workspace-keeps-its-settings.md); read as optional, for a console from before the setting), the day the calendars begin a week on and this week is counted by (`weekStart`: `auto`, as the language of the pages has it, or `monday`, `sunday`; [ADR-0039](../adr/0039-this-week-is-the-plans-unit-and-the-week-begins-as-the-workspace-says.md)) and the workspace's time zone (`timeZone`: an IANA name, in which the command prints moments, or `null` for none; `language`: the workspace's language, the tag of one the console speaks, for whoever has none of their own, the pages after the browser's languages and the plugins' calls ([ADR-0081](../adr/0081-a-workspace-has-a-language-for-whoever-has-none-of-their-own.md)), or `null` for none, English then; both optional the same way), who the session cookie or the token says is asking (`id`, `login`, `name` or `null`, `avatar` or `null`, `role`), with what (`agent`: the name of the token when a token asks, as its person called it, so that a console of a person's own knows it holds one and offers nothing a token cannot do; `null` on a session), the language the person reads in (`language`, a tag: the one they chose, else the one the pages first saw them in, [ADR-0065](../adr/0065-a-plugin-writes-one-text-and-a-persons-language-is-kept-from-the-first-time-the-pages-see-them.md); `null` until then), their own arrangement of the front page's widgets (`home`, [ADR-0059](../adr/0059-a-person-arranges-the-front-pages-widgets-from-the-sizes-each-comes-in.md): `[{ plugin, widget, size, place? }]` in order, or `null` for the manifests'; answered from 0.4.4 and read as optional), and the identity providers people sign in through (`gh`, `google`, each with the label of its button and, in `admits`, who gets in through it: the organization at the git host whose members are in, or `null`, and the Workspace domains whose accounts are, which a sign-in page says under the button; answered from 0.4.1 and read as optional), none where nobody can; and the console's own version with the range of command versions it takes (`console`, [ADR-0025](../adr/0025-the-command-names-its-version-on-every-request-and-the-console-holds-it-to-the-range-it-takes.md)), for a console built on the package to compare itself with; and how many decisions wait for the person's answer across the projects they may see (`decisions.waiting`, [ADR-0042](../adr/0042-a-decision-is-addressed-to-a-person-its-raiser-unless-another-is-named.md); `null` for nobody; answered from 0.4.3 and read as optional), which the pages say beside My decisions and read again when a decision is raised or answered. Nobody is an answer, not an error; the pages ask this once to decide what to show, and the command once, at `login`, to see that the console knows the token. A token the console knows whose person is out is refused here as on every route, `auth.deactivated` or `auth.not_admitted`, so that the agent learns why ([ADR-0044](../adr/0044-a-token-of-a-person-who-is-out-is-kept-and-refused-with-the-reason-until-they-are-back-in.md)).
99
99
 
100
100
  ### `GET /api/v1/people?login=`
101
101
 
@@ -136,7 +136,7 @@ Keeps the language the person reads in ([ADR-0012](../adr/0012-the-pages-speak-t
136
136
 
137
137
  ### `PATCH /api/v1/workspace`
138
138
 
139
- The workspace's settings, which an administrator keeps on the Settings page ([ADR-0035](../adr/0035-who-may-see-whom-is-decided-by-one-policy-and-the-workspace-keeps-its-settings.md)), from the console's own pages or through their agent's token ([ADR-0021](../adr/0021-a-token-configures-as-its-person-does.md)): `{ "peopleVisibility": "everyone" | "shared_projects", "weekStart": "auto" | "monday" | "sunday", "timeZone": "Asia/Seoul" | null }`, which of the settings to change, at least one, a time zone being a name the console knows (`request.invalid` otherwise, as for a patch that names nothing); answers the `workspace` as `GET /api/v1/me` describes it, and writes `workspace.updated` with the `fields` that changed; what is already so writes nothing. `auth.forbidden` for a member. The setting holds from the next request on, for everyone: nothing of it is kept in memory.
139
+ The workspace's settings, which an administrator keeps on the Settings page ([ADR-0035](../adr/0035-who-may-see-whom-is-decided-by-one-policy-and-the-workspace-keeps-its-settings.md)), from the console's own pages or through their agent's token ([ADR-0021](../adr/0021-a-token-configures-as-its-person-does.md)): `{ "peopleVisibility": "everyone" | "shared_projects", "weekStart": "auto" | "monday" | "sunday", "timeZone": "Asia/Seoul" | null, "language": "en" | "ko" | null }`, which of the settings to change, at least one, a time zone being a name the console knows and a language one it speaks (`request.invalid` otherwise, as for a patch that names nothing); answers the `workspace` as `GET /api/v1/me` describes it, and writes `workspace.updated` with the `fields` that changed; what is already so writes nothing. `auth.forbidden` for a member. The setting holds from the next request on, for everyone: nothing of it is kept in memory.
140
140
 
141
141
  ### `PUT /api/v1/workspace/pack-token` and `DELETE .../pack-token`
142
142
 
@@ -160,15 +160,15 @@ The rules of the board ([ADR-0023](../adr/0023-the-rules-of-a-board-are-pages-th
160
160
 
161
161
  ### `GET /api/v1/work`
162
162
 
163
- `{ "tasks": [{ "project": { "key", "name", "color", "symbol", "icon" }, "task" }, ...], "closed": [{ "project", "task" }, ...], "decisions": [{ "project", "decision" }, ...] }`: what is on the asker's plate across the projects they may see ([ADR-0019](../adr/0019-a-task-is-planned-in-days-the-board-keeps-its-moments-and-goals-and-categories-give-the-work-its-shape.md)): the open tasks they are at work on, the sooner due first and those with no day last; `closed`, the tasks they are at work on that are done or dropped and not yet put away, the last closed first, so that the week on the plate's page shows them on their days as a project's calendar does; and the decisions that wait for the asker's answer ([ADR-0042](../adr/0042-a-decision-is-addressed-to-a-person-its-raiser-unless-another-is-named.md)), the longest waiting first; each with the project it belongs to, so that a page says and links it. A task put away is in neither list ([ADR-0030](../adr/0030-a-task-is-put-away-from-any-state.md)). At most `LIST_LIMIT` of each.
163
+ `{ "tasks": [{ "project": { "key", "name", "color", "symbol", "icon" }, "task" }, ...], "closed": [{ "project", "task" }, ...], "decisions": [{ "project", "decision" }, ...] }`: what is on the asker's plate across the projects they may see ([ADR-0019](../adr/0019-a-task-is-planned-in-days-the-board-keeps-its-moments-and-goals-and-categories-give-the-work-its-shape.md)): the open tasks they are at work on, the sooner due first and those with no day last; `closed`, the tasks they are at work on that are done or dropped and not yet put away, the last closed first, so that the week on the plate's page shows them on their days as a project's calendar does; and the decisions that wait for the asker's answer ([ADR-0042](../adr/0042-a-decision-is-addressed-to-a-person-its-raiser-unless-another-is-named.md)), a plugin's wherever it is and a person's own while the asker is in its project ([ADR-0077](../adr/0077-a-persons-own-decision-is-its-projects-and-reaches-nobody-out-of-it.md)), the longest waiting first; each with the project it belongs to, so that a page says and links it. A task put away is in neither list ([ADR-0030](../adr/0030-a-task-is-put-away-from-any-state.md)). At most `LIST_LIMIT` of each.
164
164
 
165
165
  ### `GET /api/v1/decisions?open=&raised=&limit=&offset=`
166
166
 
167
- `{ "items": [{ "project": { "key", "name", "color", "symbol", "icon" }, "decision" }, ...], "more": boolean }`: the decisions addressed to the asker ([ADR-0042](../adr/0042-a-decision-is-addressed-to-a-person-its-raiser-unless-another-is-named.md)), alone or among others ([ADR-0057](../adr/0057-a-decision-may-be-addressed-to-several-people-and-the-first-answer-ends-it.md)), wherever they are, in a project the asker may see or not ([ADR-0068](../adr/0068-a-decision-reaches-whom-it-is-addressed-to-wherever-it-is-and-a-plugins-reaches-the-managers-above-them.md); the project's key, name and mark come with one from elsewhere, and nothing else of it), a page at a time as the tasks are (`limit`, `offset`, `more`): the ones that wait first, the longest waiting first among them, then the answered, newest first, as the record; `open=true` keeps only those that wait, and `raised=true` answers instead the decisions the asker raised, through their agent or themselves, for someone else. Each decision comes with the project it belongs to, as the plate's things do, so that a page says and links it. What a person's own page of decisions reads, in both kinds, and `console decisions --mine` and `--raised`.
167
+ `{ "items": [{ "project": { "key", "name", "color", "symbol", "icon" }, "decision" }, ...], "more": boolean }`: the decisions addressed to the asker ([ADR-0042](../adr/0042-a-decision-is-addressed-to-a-person-its-raiser-unless-another-is-named.md)), alone or among others ([ADR-0057](../adr/0057-a-decision-may-be-addressed-to-several-people-and-the-first-answer-ends-it.md)), a plugin's wherever it is, in a project the asker may see or not ([ADR-0068](../adr/0068-a-decision-reaches-whom-it-is-addressed-to-wherever-it-is-and-a-plugins-reaches-the-managers-above-them.md); the project's key, name and mark come with one from elsewhere, and nothing else of it), and a person's own while the asker is in its project ([ADR-0077](../adr/0077-a-persons-own-decision-is-its-projects-and-reaches-nobody-out-of-it.md)), a page at a time as the tasks are (`limit`, `offset`, `more`): the ones that wait first, the longest waiting first among them, then the answered, newest first, as the record; `open=true` keeps only those that wait, and `raised=true` answers instead the decisions the asker raised, through their agent or themselves, for someone else, held to the same. Each decision comes with the project it belongs to, as the plate's things do, so that a page says and links it. What a person's own page of decisions reads, in both kinds, and `console decisions --mine` and `--raised`.
168
168
 
169
169
  ### `GET /api/v1/decisions/<id>?wait=` and `POST /api/v1/decisions/<id>/answer`
170
170
 
171
- One decision by its id, wherever it is ([ADR-0068](../adr/0068-a-decision-reaches-whom-it-is-addressed-to-wherever-it-is-and-a-plugins-reaches-the-managers-above-them.md)): `{ "project": { "key", "name", "color", "symbol", "icon" }, "decision", "mayAnswer" }`, for whoever it reaches: anyone who may see its project; and, from outside the project, the people it is addressed to, the person who raised it, and, for a decision a plugin raised, whoever manages one of the people it is addressed to, directly or up the reporting line. `wait` holds the request as the project's route does. `mayAnswer` says whether the asker may answer it: anyone who may work in the project, those it is addressed to and the managers above them for a plugin's; the raiser reads alone. `POST .../answer` takes what the project's route takes and writes the answer for whoever `mayAnswer` is true for (`auth.forbidden` otherwise). A decision out of the asker's reach is `decision.not_found`, not told apart from one that is not there; nothing else of a project the asker may not see opens through it.
171
+ One decision by its id, wherever it is ([ADR-0068](../adr/0068-a-decision-reaches-whom-it-is-addressed-to-wherever-it-is-and-a-plugins-reaches-the-managers-above-them.md)): `{ "project": { "key", "name", "color", "symbol", "icon" }, "decision", "mayAnswer" }`, for whoever it reaches: anyone who may see its project; and, for a decision a plugin raised, from outside its project, the people it is addressed to, the person who raised it, a requester who raised it through the plugin's command in a board project they may not see as much as anyone ([ADR-0080](../adr/0080-a-plugin-reaches-the-projects-it-is-placed-on-and-whoever-may-use-it-is-a-requester-in-its-board-project.md)), and whoever manages one of the people it is addressed to, directly or up the reporting line. A person's own decision is its project's: out of the project, those it is addressed to and the person who raised it reach it no more ([ADR-0077](../adr/0077-a-persons-own-decision-is-its-projects-and-reaches-nobody-out-of-it.md)). `wait` holds the request as the project's route does. `mayAnswer` says whether the asker may answer it: anyone who may work in the project, and for a plugin's, those it is addressed to and the managers above them; the raiser reads alone. `POST .../answer` takes what the project's route takes and writes the answer for whoever `mayAnswer` is true for (`auth.forbidden` otherwise). A decision out of the asker's reach is `decision.not_found`, not told apart from one that is not there; nothing else of a project the asker may not see opens through it.
172
172
 
173
173
  ### `GET /api/v1/decisions/<id>/files/<file id>`
174
174
 
@@ -186,6 +186,10 @@ Takes one of the asker's tokens away, whoever holds it, and answers `204`. A tok
186
186
 
187
187
  The token the request is made with gives itself up, so that it is good for nothing from now on, and the answer is `204`: what `console logout` does, so that a token forgotten on a machine does not outlive it. The one thing a token does about the tokens; with a session, which has none to give, it is `request.invalid`. A token whose person is out is refused here as everywhere ([ADR-0044](../adr/0044-a-token-of-a-person-who-is-out-is-kept-and-refused-with-the-reason-until-they-are-back-in.md)): the console keeps it for when they are back in, and the command forgets it on the machine.
188
188
 
189
+ ### `GET /api/v1/sessions`, `DELETE /api/v1/sessions/<id>` and `DELETE /api/v1/sessions/others`
190
+
191
+ The browsers whoever is signed in is signed in on: for a person signed in on the console's own pages, never with a token (`auth.session_required`), so that a token which leaks reaches no browser of its person's. `GET` answers `{ "items": [session, ...], "idleDays": 30 }`, the current session first and then the last used first: `id`, `current` (whether it is the session this request was made on), `createdAt`, `lastSeenAt` (noted at most hourly), `expiresAt` (the idle limit from the last use; `idleDays` says it in days, the deployment's `SESSION_TTL_DAYS`), `browser` and `platform` (what the browser called itself when the session began, read as families, `Chrome` on `Windows`, or `null` for either the console does not know), `address` (where the browser last came from, as the server saw it behind a trusted proxy or not, noted with the last use, or `null`), and never the cookie's token. `DELETE .../<id>` ends one of the asker's sessions and answers `204`; the current one ends with its cookie, which the answer takes away; another person's, or one already ended, is `session.not_found`. `DELETE .../others` ends every session of the asker but the one the request is made on, and answers `204`. A session not used for `SESSION_TTL_DAYS` ends on its own, which is the one policy for a session left alone.
192
+
189
193
  ### `GET /api/v1/people/<id>/tokens` and `DELETE /api/v1/people/<id>/tokens/<token id>`
190
194
 
191
195
  An administrator's sight of everyone's agents ([ADR-0011](../adr/0011-an-agent-connects-with-a-short-code-a-person-approves-and-the-token-is-never-shown.md)): the live tokens of any person, as `GET /api/v1/tokens` lists one's own, and the way to take one away, from the console's own pages; `auth.forbidden` for a member, `person.not_found` for an id that is nobody's, `token.not_found` for a token that is not that person's.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skillcdn/console",
3
- "version": "0.4.5",
3
+ "version": "0.4.7",
4
4
  "description": "What a custom SkillCDN console is built from: the API client and schemas, the components, the composition of the default console, and the console command agents work the board with.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/skillcdn/console#readme",
@@ -71,7 +71,7 @@ Produces the **design**: one table, a row per thing the feature does, saying who
71
71
  |---|---|
72
72
  | An agent does it for a person, and something changes | A **command**: `defineCommand({ about, args, roles, run })`. Its `text` answer is for people, its `data` for agents (`--json`); it does one thing and does it again safely where it can. |
73
73
  | An agent, or a page, looks something up | A **query**: `defineQuery(...)`, which writes nothing; a query may answer a file. |
74
- | A person must approve, choose or confirm | A **decision** the command raises with `ctx.console.decisions.ask`, with options, addressed to the person a setting or the record names (`deciderId`), or to several of them (`deciderIds`, any of whom may answer), anyone active of the workspace, in the board project or not: they find it among their decisions and answer it there, and whoever manages them up the reporting line may answer it too ([ADR-0068](/docs/adr/0068-a-decision-reaches-whom-it-is-addressed-to-wherever-it-is-and-a-plugins-reaches-the-managers-above-them.md)); a page sends a person to it with `frame.navigate("/decisions/<id>")`, which opens for them though the project does not; `about` the record it is for, its question, body and labels written once, in the language of whoever is to answer: `ctx.console.people.get(id)` says it as `language`, and where that is `null`, a person who has not opened the console yet, the plugin writes in the first of `ctx.console.workspace().languages` ([ADR-0065](/docs/adr/0065-a-plugin-writes-one-text-and-a-persons-language-is-kept-from-the-first-time-the-pages-see-them.md)); the command answers `waiting`, the agent waits as the console's own `ask` is waited for, and the plugin hears the answer in a hook on `console:decision.answered` and goes on. The plugin never answers one, and never computes what a person must choose. |
74
+ | A person must approve, choose or confirm | A **decision** the command raises with `ctx.console.decisions.ask`, with options, addressed to the person a setting or the record names (`deciderId`), or to several of them (`deciderIds`, any of whom may answer), anyone active of the workspace, in the board project or not: they find it among their decisions and answer it there, and whoever manages them up the reporting line may answer it too ([ADR-0068](/docs/adr/0068-a-decision-reaches-whom-it-is-addressed-to-wherever-it-is-and-a-plugins-reaches-the-managers-above-them.md)); raised in the board project for whoever called the command, in the project or not, who reads it back as its raiser and nothing else of the project, so that a requester needs no place in the project ([ADR-0080](/docs/adr/0080-a-plugin-reaches-the-projects-it-is-placed-on-and-whoever-may-use-it-is-a-requester-in-its-board-project.md)); a page sends a person to it with `frame.navigate("/decisions/<id>")`, which opens for them though the project does not; `about` the record it is for, its question, body and labels written once, in the language of whoever is to answer: `ctx.console.people.get(id)` says it as `language`, and where that is `null`, a person who has not opened the console yet, the plugin writes in `ctx.console.workspace().language`, the workspace's language, `en` where an administrator set none as `languageSet` says ([ADR-0065](/docs/adr/0065-a-plugin-writes-one-text-and-a-persons-language-is-kept-from-the-first-time-the-pages-see-them.md), [ADR-0081](/docs/adr/0081-a-workspace-has-a-language-for-whoever-has-none-of-their-own.md)); the command answers `waiting`, the agent waits as the console's own `ask` is waited for, and the plugin hears the answer in a hook on `console:decision.answered` and goes on. The plugin never answers one, and never computes what a person must choose. |
75
75
  | Someone must do something later | A **task** on the board project with `ctx.console.tasks.create`, marked as the plugin's, worked by whoever takes it; its title and body, and a comment on it, one text each, written as a decision's words are, in the language of whoever it is for. |
76
76
  | The console must tell the plugin something happened | A **hook**, `on["console:<kind>"]` (`events:console`): the plugin's board project, the projects it is on and the items it made are what it hears of. Delivery is at least once: a handler reads the record first and does nothing twice, and the event's `id` (one across both streams) with its `attempt` is what it keeps to tell a delivery repeated; a service that says to come back later is told to the console as `retryAfterMs` on the refusal, and the next try waits that long. A collection that grows with every event, deliveries, log lines, gets `retention: { days }` and `history: false`, so that it never reaches the quota. |
77
77
  | Another plugin must tell it | A **hook** on `plugin:<key>:<kind>` (`events:plugins`), or a call on the other's `api` (`plugins:<key>`). |
@@ -90,7 +90,7 @@ Then the capabilities: the list the split needs, each read as the sentence the a
90
90
 
91
91
  Produces the **plugin as source**. `console-plugin init <dir> --key <key> --name "<Name>"` writes the smallest complete plugin: the manifest, a server module with one collection, one command and one query, a web bundle with one page and one widget, one skill with its `SKILLCDN.md`, the tests, the build and a README that says where things are; `--console` names the version of `@skillcdn/console` it depends on, the command's own unless said, and for a plugin written for a deployed console, the version that console runs (`console whoami` says it), and the manifest's `console` is written from it, the line of that version (`>=0.4.3 <0.5.0`): the consoles the plugin runs on, which the console checks when it reads the plugin and `console-plugin check` holds the dependency to; narrow it to the patch that brought what the plugin depends on, and widen it to the next line once the plugin is built against it; `--package <name>` the package's name where it is not `console-plugin-<key>`, a scoped one (`@<scope>/console-plugin-<key>`) for a repository of several plugins, published as public; `--repository <url>` with `--directory <path>` where the plugin lives in a repository, which fill `repository`, `homepage` and `bugs` and the manifest's `store`; and `--languages en,ko` the languages of its words, `en` first, which gives every language map and both manifests' translations the others as English words to translate, of which `console-plugin check` warns while they stay English. Then, in `<dir>`: `npm install`, `npm run build`, `npm test`, `npm run check`, all green before a line is changed, and `git init`.
92
92
 
93
- Then the design goes in, file by file: the manifest `console-plugin.json` from the design, its `key`, names and descriptions per language, `agentNote`, `capabilities`, `roles` (a role for managers is `follows: "reports"`, held by whoever someone reports to and granted by nobody) and `defaultRole`, `board`, `settings`, `menu`, `pages`, `widgets`, `dataVersion`; the server module `src/server/index.ts`, one `defineCollection` per collection, one `defineCommand` or `defineQuery` per row, `endpoints`, `on`, `jobs`, `api`, `onEnable` and `onDisable` where the design has them, exported by name for the tests and gathered in `definePlugin(...)` as the default export; the web bundle `src/web/index.ts` and `index.css`, where `connect()` gives the page the context (who looks, at what, in which language), `command`, `query`, `records`, `files`, `navigate` (a path of the console's), `open` (a link to the web or to mail, from the press itself, which the console's page opens in a new tab), `download`, `setTitle` and the events, every class prefixed `pl-<key>-`, the console's `sc-` classes and `--sc-*` tokens for the look, and every word a person wrote put in as text; the skills under `skills/<name>/SKILL.md`, one per kind of work, in the SkillCDN Format, and the README of the package. The server module imports only what the host allows and bundles everything it imports; it keeps no state between calls but in records, since its thread is started afresh after a fault. Where the design has `storage:sql`, `migrations/0001-<words>.sql` makes the tables, and `manifest.migrations` names the directory.
93
+ Then the design goes in, file by file: the manifest `console-plugin.json` from the design, its `key`, names and descriptions per language (a name of a word or two, which a tab shows and stops short with an ellipsis past about 28 characters; the description is what the plugin's settings page says of it, and what an agent reads in the rules where there is no `agentNote`), `agentNote`, `capabilities`, `roles` (a role for managers is `follows: "reports"`, held by whoever someone reports to and granted by nobody) and `defaultRole`, `board`, `settings`, `menu`, `pages`, `widgets`, `dataVersion`; the server module `src/server/index.ts`, one `defineCollection` per collection, one `defineCommand` or `defineQuery` per row, `endpoints`, `on`, `jobs`, `api`, `onEnable` and `onDisable` where the design has them, exported by name for the tests and gathered in `definePlugin(...)` as the default export; the web bundle `src/web/index.ts` and `index.css`, where `connect()` gives the page the context (who looks, at what, in which language), `command`, `query`, `records`, `files`, `navigate` (a path of the console's), `open` (a link to the web or to mail, from the press itself, which the console's page opens in a new tab), `download`, `setTitle` and the events, every class prefixed `pl-<key>-`, the console's `sc-` classes and `--sc-*` tokens for the look, and every word a person wrote put in as text; the skills under `skills/<name>/SKILL.md`, one per kind of work, in the SkillCDN Format, and the README of the package. The server module imports only what the host allows and bundles everything it imports; it keeps no state between calls but in records, since its thread is started afresh after a fault. Where the design has `storage:sql`, `migrations/0001-<words>.sql` makes the tables, and `manifest.migrations` names the directory.
94
94
 
95
95
  ### Phase 3: Test it as the console runs it
96
96
 
@@ -119,7 +119,7 @@ The hand-over is a task on the deployment's board, written as [planning-the-boar
119
119
 
120
120
  - People decide: a plugin raises decisions and waits; it never answers one, never acts as a person it is not, and never computes an approval. What it makes on a board carries its name and is reversible by people.
121
121
  - The fewest capabilities: each one in the manifest has a row of the design that needs it, and the sentence an administrator reads for it is true of the code. `check` warns of one no definition uses; it is dropped.
122
- - A secret is a `secret` setting the administrator sets or the console seals from an answer (`seal`), put into a request by the console within the `hosts` the setting names, or verified by it (`use: "verify"` for one that verifies alone); the plugin never reads its value, logs it, keeps it in a record, or puts it in the repository, the tests or the chat.
122
+ - A secret is a `secret` setting the administrator sets or the console seals from an answer (`seal`), put into a request by the console within the `hosts` the setting names, or verified by it (`use: "verify"` for one that verifies alone); the plugin never reads its value, logs it, keeps it in a record, or puts it in the repository, the tests or the chat. Every form of a secret a request carried, base64 included, is taken out of the answer the plugin reads ([ADR-0079](/docs/adr/0079-a-secret-is-taken-out-of-an-answer-in-the-encodings-a-service-sends-it-back-in.md)), so a value a service sends back by design, a client id inside a token it issues, say, is no secret: it is a plain setting.
123
123
  - A plugin acting for a person acts within what that person may do as a member and what the plugin was granted, both, and never answers a decision itself; it never calls its own api (`plugins:<its key>` is refused); a callee reads `ctx.caller.kind === "plugin"` and refuses where its rules need a person at the keyboard.
124
124
  - Everything a person wrote is shown as text, in the pages and in a command's answer; the frame renders no HTML from a record, and its classes are prefixed `pl-<key>-`.
125
125
  - The server module imports nothing the host refuses, reaches no network but `ctx.fetch`, no file but its own, and keeps no state between calls but in records; a hook does nothing twice.
@@ -10,7 +10,7 @@ What an administrator or an owner does on the pages, their agent does here with
10
10
 
11
11
  ## A plugin's board project, for an administrator
12
12
 
13
- A plugin the deployment installed ([building-a-plugin](/skills/building-a-plugin/SKILL.md) writes one; the deployment installs it) does nothing until an administrator enables it, consenting to what it requires and turning on what they choose of what it can go without (`console plugin <key> capabilities` says which, and turns them on or off later), and one that puts decisions, tasks and pages on a board names its project then: `console plugin <key> enable --consent <capability>,... --board new|<key> [--projects all|<key>,...] [--set <setting>=<value>]...`, `new` making a private project from the plugin's own defaults (its key, name and description, which `console plugin <key>` shows beforehand, with what each capability opens), `<key>` binding a project that exists; several plugins may share one. `--consent` must name every capability the manifest asks, each read as the sentence it is: what the plugin may do and reach. The project's members are listed as any project's; the plugin's own roles are granted apart, `console plugin <key> grant <role> --person <login>|--project <key>|--everyone`, and taken back with `console plugin <key> revoke <grant>`; `console plugin <key> settings --set <setting>=<value>` fills its settings, and a secret is read from standard input by `console plugin <key> secret <name>`, never an argument. From then on the rules an agent reads in that project end with `## Plugins`, naming it ([working-the-board](/skills/working-the-board/SKILL.md)), and what the plugin writes there carries its name beside the person's. `console plugin <key> disable` stops it and keeps its data. An owner who is not an administrator enables no plugin: the step goes back to the administrator, with the command.
13
+ A plugin the deployment installed ([building-a-plugin](/skills/building-a-plugin/SKILL.md) writes one; the deployment installs it) does nothing until an administrator enables it, consenting to what it requires and turning on what they choose of what it can go without (`console plugin <key> capabilities` says which, and turns them on or off later), and one that puts decisions, tasks and pages on a board names its project then: `console plugin <key> enable --consent <capability>,... --board new|<key> [--projects all|<key>,...] [--set <setting>=<value>]...`, `new` making a private project from the plugin's own defaults (its key, name and description, which `console plugin <key>` shows beforehand, with what each capability opens), `<key>` binding a project that exists; several plugins may share one. `--consent` must name every capability the manifest asks, each read as the sentence it is: what the plugin may do and reach. The project's members are listed as any project's; the plugin's own roles are granted apart, `console plugin <key> grant <role> --person <login>|--project <key>|--everyone`, and taken back with `console plugin <key> revoke <grant>`; `console plugin <key> settings --set <setting>=<value>` fills its settings, and a secret is set by a person: typed unseen at the prompt of `console plugin <key> secret <name>` in their own terminal, or on the plugin's settings page; never an argument, which a shell keeps, and never through an agent, whose transcript would keep it (a script redirects a file into the command). From then on the rules an agent reads in that project end with `## Plugins`, naming it ([working-the-board](/skills/working-the-board/SKILL.md)), and what the plugin writes there carries its name beside the person's. `console plugin <key> disable` stops it and keeps its data. An owner who is not an administrator enables no plugin: the step goes back to the administrator, with the command.
14
14
 
15
15
  ## The members, for an owner
16
16
 
package/src/api.ts CHANGED
@@ -239,6 +239,8 @@ export {
239
239
  type RestRunEndInput,
240
240
  type RestRunInput,
241
241
  type RestRuns,
242
+ type RestSession,
243
+ type RestSessions,
242
244
  type RestSkill,
243
245
  type RestSkillBrowse,
244
246
  type RestSkillFile,
@@ -345,6 +347,8 @@ export {
345
347
  restRunInputSchema,
346
348
  restRunSchema,
347
349
  restRunsSchema,
350
+ restSessionSchema,
351
+ restSessionsSchema,
348
352
  restSkillBrowseSchema,
349
353
  restSkillFileSchema,
350
354
  restSkillFindSchema,
@@ -383,6 +387,7 @@ export {
383
387
  COLOR_NAMES,
384
388
  CONSOLE_LANGUAGES,
385
389
  type ColorName,
390
+ type ConsoleLanguage,
386
391
  EVENT_KINDS,
387
392
  type EventKind,
388
393
  GOAL_STATES,
@@ -390,6 +395,7 @@ export {
390
395
  isProviderKey,
391
396
  LINK_SOURCES,
392
397
  type LinkSource,
398
+ languagesFirst,
393
399
  MEMBERSHIP_SOURCES,
394
400
  type MembershipSource,
395
401
  OPEN_GOAL_STATES,