@skillcdn/console 0.1.17 → 0.1.18

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 (100) hide show
  1. package/README.md +3 -3
  2. package/dist/api.d.ts +2 -1
  3. package/dist/api.d.ts.map +1 -1
  4. package/dist/api.js +1 -0
  5. package/dist/api.js.map +1 -1
  6. package/dist/cli/cli.d.ts +10 -0
  7. package/dist/cli/cli.d.ts.map +1 -1
  8. package/dist/cli/cli.js +145 -14
  9. package/dist/cli/cli.js.map +1 -1
  10. package/dist/cli/format.d.ts +1 -1
  11. package/dist/cli/format.d.ts.map +1 -1
  12. package/dist/cli/format.js +8 -3
  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 +7 -5
  16. package/dist/cli/help.js.map +1 -1
  17. package/dist/cli/install.d.ts +21 -0
  18. package/dist/cli/install.d.ts.map +1 -0
  19. package/dist/cli/install.js +87 -0
  20. package/dist/cli/install.js.map +1 -0
  21. package/dist/cli/main.js +22 -3
  22. package/dist/cli/main.js.map +1 -1
  23. package/dist/cli/notices.d.ts +13 -0
  24. package/dist/cli/notices.d.ts.map +1 -0
  25. package/dist/cli/notices.js +31 -0
  26. package/dist/cli/notices.js.map +1 -0
  27. package/dist/client.d.ts +15 -2
  28. package/dist/client.d.ts.map +1 -1
  29. package/dist/client.js +8 -3
  30. package/dist/client.js.map +1 -1
  31. package/dist/compat.d.ts +66 -0
  32. package/dist/compat.d.ts.map +1 -0
  33. package/dist/compat.js +115 -0
  34. package/dist/compat.js.map +1 -0
  35. package/dist/components/calendar.d.ts +3 -1
  36. package/dist/components/calendar.d.ts.map +1 -1
  37. package/dist/components/calendar.js +21 -2
  38. package/dist/components/calendar.js.map +1 -1
  39. package/dist/components/goals.d.ts +3 -1
  40. package/dist/components/goals.d.ts.map +1 -1
  41. package/dist/components/goals.js +23 -11
  42. package/dist/components/goals.js.map +1 -1
  43. package/dist/components/roadmap.d.ts +37 -0
  44. package/dist/components/roadmap.d.ts.map +1 -0
  45. package/dist/components/roadmap.js +76 -0
  46. package/dist/components/roadmap.js.map +1 -0
  47. package/dist/components/tokens.d.ts +2 -0
  48. package/dist/components/tokens.d.ts.map +1 -1
  49. package/dist/components/tokens.js +13 -3
  50. package/dist/components/tokens.js.map +1 -1
  51. package/dist/console.css +204 -0
  52. package/dist/console.d.ts.map +1 -1
  53. package/dist/console.js +8 -7
  54. package/dist/console.js.map +1 -1
  55. package/dist/data.js +1 -1
  56. package/dist/data.js.map +1 -1
  57. package/dist/i18n/en.d.ts +24 -0
  58. package/dist/i18n/en.d.ts.map +1 -1
  59. package/dist/i18n/en.js +24 -0
  60. package/dist/i18n/en.js.map +1 -1
  61. package/dist/i18n/ko.d.ts.map +1 -1
  62. package/dist/i18n/ko.js +24 -0
  63. package/dist/i18n/ko.js.map +1 -1
  64. package/dist/index.d.ts +2 -1
  65. package/dist/index.d.ts.map +1 -1
  66. package/dist/index.js +2 -1
  67. package/dist/index.js.map +1 -1
  68. package/dist/router.d.ts +6 -1
  69. package/dist/router.d.ts.map +1 -1
  70. package/dist/router.js +10 -1
  71. package/dist/router.js.map +1 -1
  72. package/dist/schemas.d.ts +42 -0
  73. package/dist/schemas.d.ts.map +1 -1
  74. package/dist/schemas.js +18 -0
  75. package/dist/schemas.js.map +1 -1
  76. package/docs/specs/cli.md +9 -6
  77. package/docs/specs/rest.md +9 -5
  78. package/package.json +3 -2
  79. package/skills/working-the-board/SKILL.md +4 -3
  80. package/src/api.ts +23 -0
  81. package/src/cli/cli.ts +178 -15
  82. package/src/cli/format.ts +8 -3
  83. package/src/cli/help.ts +7 -5
  84. package/src/cli/install.ts +111 -0
  85. package/src/cli/main.ts +23 -3
  86. package/src/cli/notices.ts +48 -0
  87. package/src/client.ts +31 -6
  88. package/src/compat.ts +173 -0
  89. package/src/components/calendar.tsx +41 -1
  90. package/src/components/goals.tsx +86 -7
  91. package/src/components/roadmap.tsx +242 -0
  92. package/src/components/tokens.tsx +38 -1
  93. package/src/console.tsx +19 -0
  94. package/src/data.ts +1 -1
  95. package/src/i18n/en.ts +24 -0
  96. package/src/i18n/ko.ts +24 -0
  97. package/src/index.ts +8 -0
  98. package/src/router.ts +13 -2
  99. package/src/schemas.ts +20 -0
  100. package/src/styles/console.css +204 -0
package/README.md CHANGED
@@ -33,7 +33,7 @@ const { items } = await client.tasks({ state: "ready" });
33
33
  - **The bounds** every input is held to (`MAX_TITLE_LENGTH`, `MAX_BODY_LENGTH`, `MAX_OPTIONS`, ...), so that a page can say so before a request is made.
34
34
  - **The routes:** `REST_ROUTES` (the workspace's resources), `AUTH_ROUTES`, and the helpers that build a path (`projectPath(key, collection, id)` for everything under a project, `projectIconPath(key, icon)` for a project's image, `restPath`, `loginPath`, `signInPath`). The API itself is described in [docs/specs/rest.md](https://github.com/skillcdn/console/blob/main/docs/specs/rest.md).
35
35
  - **The schemas,** in the mini build of zod, which runs in a browser: what the server answers (`restProjectSchema`, `restMemberSchema`, `restTaskSchema`, `restDecisionSchema`, `restEventSchema`, `restMeSchema`, ...) and what it is sent (`restProjectInputSchema`, `restTaskInputSchema`, `restTaskPatchSchema`, `restDecisionInputSchema`, `restAnswerInputSchema`, ...). Absent values are `null` on the wire, never missing keys. The server validates with the input schemas and is tested against the others.
36
- - **The client:** `createClient({ baseUrl, fetch })` answers typed values parsed with those schemas, and throws an `ApiError` with the server's stable `code` (or `network`, `invalid_response`) for anything else. It takes a `fetch` and reads nothing else. With `token`, a token a person made on their Agents page, every request carries `Authorization: Bearer` and no cookie: how a script or a console of a person's own acts as that person, configuring included (`createProject`, `updatePerson`, a project's `update`, `setIcon`, `addMember`, `updateMember` and `removeMember`, `createCategory`, `updateCategory` and `removeCategory`), within the person's own roles; only the tokens themselves and the approval of a connection are a session's, except that a token gives itself up with `giveUpToken` ([ADR-0021](https://github.com/skillcdn/console/blob/main/docs/adr/0021-a-token-configures-as-its-person-does.md)). The board is a project's: `client.projects()` lists those the person may see, and `client.project(key)` is the client of one, with its tasks, decisions, goals, runs, files, events, skills, documents, settings, members and image (`setIcon`, `removeIcon`). `tasks(filter)` narrows the board (`TaskFilter`: a state, the open ones, a category's key, a goal, an assignee, a day tasks are due by) and pages it (`Page`: `limit` and `offset`; the answer carries `more`), as `decisions(filter)` and `runs(filter)` are paged; a task carries its `category`, `goalId`, its plan (`startsOn`, `dueOn`) and its moments (`startedAt`, `doneAt`). The roadmap is `goals()`, `goal(id)`, `createGoal` and `updateGoal`; the workspace's categories are `client.categories()`, `createCategory`, `updateCategory` and `removeCategory`; `client.work()` is what is on the person's plate across their projects ([ADR-0019](https://github.com/skillcdn/console/blob/main/docs/adr/0019-a-task-is-planned-in-days-the-board-keeps-its-moments-and-goals-and-categories-give-the-work-its-shape.md)). The documents go by path: `documents({ folder })` lists a folder, `documents({ q })` finds pages by their words, `document(path)` reads one with its links both ways and its files, `writeDocument(path, { title, body, baseVersion })` writes a version, `archiveDocument`, `restoreDocument`, `documentVersions`, `documentVersion(path, n)`, `attachFile(path, upload)` and `documentFileUrl(path, id)` do the rest; `updateDecision(id, { outcome })` grows a decision's record. The rules of the board ([ADR-0023](https://github.com/skillcdn/console/blob/main/docs/adr/0023-the-rules-of-a-board-are-pages-the-workspace-and-its-projects-keep-read-first-by-every-agent.md)) are `client.rules()`, `writeRules`, `archiveRules` and `rulesVersions`, for the workspace's, and a project's `rules()`, which answers the workspace's with the project's own; a project's are written as the page `rules`. `REFERENCE_RULES` is what holds where an organization wrote none, and `isReferenceRules` tells it from a text; `fillRules` fills `{language}` (`RULES_LANGUAGE_PLACEHOLDER`) with the name of a person's language, which `languageNameOf` gives from its tag. `agentLabel` is an agent's name before where it runs, what the pages show of "Claude Code on a laptop". `connect`, `connectRequest`, `approveConnection`, `denyConnection` and `claimConnection` are the two sides of an agent connecting with a code a person approves (ADR-0011), and `personTokens` and `revokePersonToken` an administrator's sight of everyone's agents. An `EventSource` cannot carry a header, so a stream read with a token is a `fetch` of `eventStreamUrl(after)`. `handInFile` sends a file as a form, and `fileUrl` says where its bytes are read back. `events(after, { task })` is everything that happened to one task.
36
+ - **The client:** `createClient({ baseUrl, fetch })` answers typed values parsed with those schemas, and throws an `ApiError` with the server's stable `code` (or `network`, `invalid_response`) for anything else. It takes a `fetch` and reads nothing else. With `userAgent`, every request names the client: the command sends `skillcdn-console/<version>`, by which the console holds it to the versions it takes ([ADR-0025](https://github.com/skillcdn/console/blob/main/docs/adr/0025-the-command-names-its-version-on-every-request-and-the-console-holds-it-to-the-range-it-takes.md)); `me()` answers the console's version and that range as `console`, and the `compat` module (`parseVersion`, `compareVersions`, `judgeClient`, `clientRange`, `commonRange`, `userAgentOf`, `clientVersionOf`, the headers `VERSION_HEADER` and `CLIENT_RANGE_HEADER`, and `CLIENT_POLICY`, by which the package narrows the common rule and never widens it) is exported for a console or a script that compares itself with it. With `token`, a token a person made on their Agents page, every request carries `Authorization: Bearer` and no cookie: how a script or a console of a person's own acts as that person, configuring included (`createProject`, `updatePerson`, a project's `update`, `setIcon`, `addMember`, `updateMember` and `removeMember`, `createCategory`, `updateCategory` and `removeCategory`), within the person's own roles; only the tokens themselves and the approval of a connection are a session's, except that a token gives itself up with `giveUpToken` ([ADR-0021](https://github.com/skillcdn/console/blob/main/docs/adr/0021-a-token-configures-as-its-person-does.md)). The board is a project's: `client.projects()` lists those the person may see, and `client.project(key)` is the client of one, with its tasks, decisions, goals, runs, files, events, skills, documents, settings, members and image (`setIcon`, `removeIcon`). `tasks(filter)` narrows the board (`TaskFilter`: a state, the open ones, a category's key, a goal, an assignee, a day tasks are due by) and pages it (`Page`: `limit` and `offset`; the answer carries `more`), as `decisions(filter)` and `runs(filter)` are paged; a task carries its `category`, `goalId`, its plan (`startsOn`, `dueOn`) and its moments (`startedAt`, `doneAt`). The roadmap is `goals()`, `goal(id)`, `createGoal` and `updateGoal`; the workspace's categories are `client.categories()`, `createCategory`, `updateCategory` and `removeCategory`; `client.work()` is what is on the person's plate across their projects ([ADR-0019](https://github.com/skillcdn/console/blob/main/docs/adr/0019-a-task-is-planned-in-days-the-board-keeps-its-moments-and-goals-and-categories-give-the-work-its-shape.md)). The documents go by path: `documents({ folder })` lists a folder, `documents({ q })` finds pages by their words, `document(path)` reads one with its links both ways and its files, `writeDocument(path, { title, body, baseVersion })` writes a version, `archiveDocument`, `restoreDocument`, `documentVersions`, `documentVersion(path, n)`, `attachFile(path, upload)` and `documentFileUrl(path, id)` do the rest; `updateDecision(id, { outcome })` grows a decision's record. The rules of the board ([ADR-0023](https://github.com/skillcdn/console/blob/main/docs/adr/0023-the-rules-of-a-board-are-pages-the-workspace-and-its-projects-keep-read-first-by-every-agent.md)) are `client.rules()`, `writeRules`, `archiveRules` and `rulesVersions`, for the workspace's, and a project's `rules()`, which answers the workspace's with the project's own; a project's are written as the page `rules`. `REFERENCE_RULES` is what holds where an organization wrote none, and `isReferenceRules` tells it from a text; `fillRules` fills `{language}` (`RULES_LANGUAGE_PLACEHOLDER`) with the name of a person's language, which `languageNameOf` gives from its tag. `agentLabel` is an agent's name before where it runs, what the pages show of "Claude Code on a laptop". `connect`, `connectRequest`, `approveConnection`, `denyConnection` and `claimConnection` are the two sides of an agent connecting with a code a person approves (ADR-0011), and `personTokens` and `revokePersonToken` an administrator's sight of everyone's agents. An `EventSource` cannot carry a header, so a stream read with a token is a `fetch` of `eventStreamUrl(after)`. `handInFile` sends a file as a form, and `fileUrl` says where its bytes are read back. `events(after, { task })` is everything that happened to one task.
37
37
 
38
38
  ### The command line
39
39
 
@@ -55,7 +55,7 @@ console finish --summary "Done: the parser refuses empty input."
55
55
  console serve dist # a console of your own, built from this package, served for you
56
56
  ```
57
57
 
58
- - **`console`** is the agent's side of the console ([docs/specs/cli.md](https://github.com/skillcdn/console/blob/main/docs/specs/cli.md)): a thin client of the REST API with no logic of its own, no dependencies beyond the package's, and no cost to an agent until it is used. The package states Node.js 24 as its floor and is tested on it; 22 runs the command today, checked by hand on each release. `console help` says everything an agent needs and `console --version` which version this is; `--json` answers with the console's own JSON; the exit code says whether the console did it (`0`), refused or could not be reached (`1`), did not understand (`2`), or a decision still waits (`3`).
58
+ - **`console`** is the agent's side of the console ([docs/specs/cli.md](https://github.com/skillcdn/console/blob/main/docs/specs/cli.md)): a thin client of the REST API with no logic of its own, no dependencies beyond the package's, and no cost to an agent until it is used. The package states Node.js 24 as its floor and is tested on it; 22 runs the command today, checked by hand on each release. `console help` says everything an agent needs and `console --version` which version this is; `--json` answers with the console's own JSON; the exit code says whether the console did it (`0`), refused or could not be reached (`1`), did not understand (`2`), or a decision still waits (`3`), or the command and the console do not go together (`4`: the console refuses a command outside the versions it takes, and the command prints the update to make where it is installed, for the machine, in the project or fetched for the run; `console whoami` says both versions and the install, and a command behind or ahead within the range is told once a day on stderr).
59
59
  - **A person signs it in once:** `login` checks the token against the console and keeps it, with the console's address, in `$XDG_CONFIG_HOME/skillcdn-console/credentials.json` (`~/.config` when unset). `CONSOLE_URL` and `CONSOLE_TOKEN` in the environment win over the file, for a hook or a job. A token is never taken on the command line.
60
60
  - **Configuring, as the person** ([ADR-0021](https://github.com/skillcdn/console/blob/main/docs/adr/0021-a-token-configures-as-its-person-does.md)): `people`, `person role`, `person add`, `person remove`, `person deactivate`, `person reactivate`, `project new`, `project edit`, `project icon`, `members`, `member add`, `member role`, `member remove`, `category new`, `category edit`, `category remove` and `rules write` do what an administrator or an owner does on the pages, with the same refusals (`auth.forbidden` where the person may not), and the event names the agent beside the person. The tokens themselves have no command but `logout`, which gives the command's own up: they are made and removed on the Agents page, signed in.
61
61
  - **The project's documents** are the agent's to read and write: `docs`, `doc`, `write`, `attach`, `archive` and `restore`, by path; a link in a body to a page's path refers to the page.
@@ -75,7 +75,7 @@ createConsole({
75
75
  }).mount(document.getElementById("root"));
76
76
  ```
77
77
 
78
- - **The components** take their data as props and nothing from the network: `Board` (one column per state, the sooner due first), `TaskCard`, `BoardFilters` with `filterTasks` and `byDue` (the board narrowed by category, goal, person and one's own), `TaskList` (tasks as rows, a page at a time), `TaskView` (one task with its plan, its moments, its decisions and its parts), `TaskForm` (with the `categories` and the `goals` to choose from), `Calendar` and `Workload` with `workloadOf` (a month with each task across its planned days, a bar in a lane of its own, or on its one day, a due day or a start, the person who has each before its title, with a legend of the colours of the `categories` given, and who has what; `weekSegments` lays the bars; `TaskTip` is the task under the pointer in full, with the facts its page lists, within its item and above or below it as `placeTip` says, where there is more room, its goal named from the `goals` given; the composition narrows the page with `BoardFilters` as it does the board, the address carrying the filter with the month), `GoalList`, `GoalView` and `GoalForm` (the roadmap, one goal with its tasks by state, and the way to set one), `WorkList` (a person's own work across projects), `CategoryList` (the categories, with the ways an administrator keeps them), `DecisionList` and `DecisionCard` (the waiting ones as cards, each with the way to answer; the answered ones as the record, `DecisionLog`, a row each, a page at a time), `DecisionForm`, `EventFeed` (a sentence per event, newest first, a page at a time; `describeEvent` makes the sentence), `Shell` (the header with the workspace, the project, the tabs of the pages and the person's menu), `SignIn` (one button per provider the deployment offers), `TokenList`, `TokenForm` and `NewToken` (the agents a person connected, as the tokens they hold, the way to make one by hand, and the one just made with its secret shown once), `ConnectCodeForm`, `ConnectApproval` and `ConnectWords` (an agent connecting with a code: where the code is typed, what asks under it with the way to approve or refuse it, and what to tell the agent; `ConnectPage` composes the first two for a code), `PeopleList` (everyone in, with what each is and what let them in, the logins let in that nobody signed in with yet, and the deactivated, with the ways for an administrator to change a role, take a person out or back in, and take a listing away) and `ListingForm` (where an administrator lets someone in by login), `ProjectMark` (a project's mark: its own image when it has one, else its symbol on its colour, or the ones chosen from its key and its name; `sm`, `md` or `lg`), `ProjectList`, `ProjectForm` and `MemberList` (the projects a person may see with what they are in each, the way to make or change one, its mark included, with an image chosen for it (`onSubmit` gets the file, or `null` to take the image away), and those listed in a project with the way for an owner to add, change and remove them; `ProjectRoleBadge`, `PROJECT_ROLE_LABELS`, `VISIBILITY_LABELS` and `keyOf` with them), `SkillList` (a project's skills as SkillCDN serves them at its address, each with where a person reads it and what an agent loads it by, and how an agent is connected to it), `RulesView` and `RulesForm` (the rules of the board, ADR-0023: what holds and where it comes from, the console's own, a page written or none, with `{language}` filled with the language the pages speak, folded under its facts where asked, and the ways to write them, put them away and go back to the console's own for whoever may; the form starts from what holds and saves nothing that would change nothing), `FolderView`, `DocumentList`, `DocumentSearch`, `DocumentView`, `DocumentForm`, `DocumentFiles` and `DocumentCrumbs` (a project's documents: a folder's folders and pages, the way to find pages by their words, one page with its versions, what it links to, what refers to it and its files, and the forms to write and attach; `DocsPage` composes them for a path), `RunList` and `RunCard` (an agent's run on a task: what it reported, what it handed in, links and files alike, what it waits for, and when an open one was last heard from; `RunStatusBadge` and `RUN_STATUS_LABELS` with them, and `fileHref` for where a file is read), `TaskThread`, `CommentCard` and `CommentForm` (the discussion on a task, ADR-0024: the comments, the runs and the decisions as one thread in the order they came, which `threadOf` orders, each comment with who said it, through which agent, its text with the pictures it names in place and its other files after it, pictures being what `isPicture` says, and the form at the end, where a picture pasted in goes with the comment; `TaskView` shows the thread given `comments` and `onComment`, and its `fileHref` names any file of the project by its id), and `Markdown`, which renders what people and agents wrote as elements, never as HTML, with links to the web only and pictures over https only, or, given `fileSrc`, from the file of that name, and, given `docHref`, a link to a page's path as a link to the page. `DecisionCard` reads as a record, with the context, the rationale and what followed, which `onUpdate` lets a person write. The small blocks (`Button`, `CopyButton` (a text put on the clipboard), `Badge`, `Avatar` (`xs` to `lg`), `PersonChip` with `personName` (a person by the name the host gives, the login where there is none), `Callout`, `EmptyState`, `Spinner`, `Time`, `Day`, `CategoryBadge`, `DueBadge`, `GoalStateBadge`, `ProgressBar`, and `ShowMore` with `usePaged` and `PAGE_SIZE`, a long list a page at a time), the words of the vocabulary (`STATE_LABELS`, `PRIORITY_LABELS`, `ROLE_LABELS`, with `RoleBadge`) and the day helpers (`today`, `addDays`, `daysBetween`, `monthGrid`, `formatDay`, `formatMonth` and the rest, days being the strings the API spells them as) are exported too.
78
+ - **The components** take their data as props and nothing from the network: `Board` (one column per state, the sooner due first), `TaskCard`, `BoardFilters` with `filterTasks` and `byDue` (the board narrowed by category, goal, person and one's own), `TaskList` (tasks as rows, a page at a time), `TaskView` (one task with its plan, its moments, its decisions and its parts), `TaskForm` (with the `categories` and the `goals` to choose from), `Calendar` and `Workload` with `workloadOf` (a month with each task across its planned days, a bar in a lane of its own, or on its one day, a due day or a start, the person who has each before its title, with a legend of the colours of the `categories` given, and who has what; `weekSegments` lays the bars; `TaskTip` is the task under the pointer in full, with the facts its page lists, within its item and above or below it as `placeTip` says, where there is more room, its goal named from the `goals` given; the composition narrows the page with `BoardFilters` as it does the board, the address carrying the filter with the month), `GoalList`, `GoalView` and `GoalForm` (the roadmap, one goal with its tasks by state, and the way to set one, with the `categories` to sort it into and its start and target days, ADR-0026), `GoalTimeline` with `timelineBars` (the roadmap as months: six from the month given, each goal planned in days a bar from its start to its target in the colour of its category, filled as far as its tasks are done, today marked, and the goals without days named below; `Calendar` given `goalHref` marks each goal's target day on the month), `WorkList` (a person's own work across projects), `CategoryList` (the categories, with the ways an administrator keeps them), `DecisionList` and `DecisionCard` (the waiting ones as cards, each with the way to answer; the answered ones as the record, `DecisionLog`, a row each, a page at a time), `DecisionForm`, `EventFeed` (a sentence per event, newest first, a page at a time; `describeEvent` makes the sentence), `Shell` (the header with the workspace, the project, the tabs of the pages and the person's menu), `SignIn` (one button per provider the deployment offers), `TokenList`, `TokenForm` and `NewToken` (the agents a person connected, as the tokens they hold, the way to make one by hand, and the one just made with its secret shown once), `ConnectCodeForm`, `ConnectApproval` and `ConnectWords` (an agent connecting with a code: where the code is typed, what asks under it with the way to approve or refuse it, and what to tell the agent; `ConnectPage` composes the first two for a code), `PeopleList` (everyone in, with what each is and what let them in, the logins let in that nobody signed in with yet, and the deactivated, with the ways for an administrator to change a role, take a person out or back in, and take a listing away) and `ListingForm` (where an administrator lets someone in by login), `ProjectMark` (a project's mark: its own image when it has one, else its symbol on its colour, or the ones chosen from its key and its name; `sm`, `md` or `lg`), `ProjectList`, `ProjectForm` and `MemberList` (the projects a person may see with what they are in each, the way to make or change one, its mark included, with an image chosen for it (`onSubmit` gets the file, or `null` to take the image away), and those listed in a project with the way for an owner to add, change and remove them; `ProjectRoleBadge`, `PROJECT_ROLE_LABELS`, `VISIBILITY_LABELS` and `keyOf` with them), `SkillList` (a project's skills as SkillCDN serves them at its address, each with where a person reads it and what an agent loads it by, and how an agent is connected to it), `RulesView` and `RulesForm` (the rules of the board, ADR-0023: what holds and where it comes from, the console's own, a page written or none, with `{language}` filled with the language the pages speak, folded under its facts where asked, and the ways to write them, put them away and go back to the console's own for whoever may; the form starts from what holds and saves nothing that would change nothing), `FolderView`, `DocumentList`, `DocumentSearch`, `DocumentView`, `DocumentForm`, `DocumentFiles` and `DocumentCrumbs` (a project's documents: a folder's folders and pages, the way to find pages by their words, one page with its versions, what it links to, what refers to it and its files, and the forms to write and attach; `DocsPage` composes them for a path), `RunList` and `RunCard` (an agent's run on a task: what it reported, what it handed in, links and files alike, what it waits for, and when an open one was last heard from; `RunStatusBadge` and `RUN_STATUS_LABELS` with them, and `fileHref` for where a file is read), `TaskThread`, `CommentCard` and `CommentForm` (the discussion on a task, ADR-0024: the comments, the runs and the decisions as one thread in the order they came, which `threadOf` orders, each comment with who said it, through which agent, its text with the pictures it names in place and its other files after it, pictures being what `isPicture` says, and the form at the end, where a picture pasted in goes with the comment; `TaskView` shows the thread given `comments` and `onComment`, and its `fileHref` names any file of the project by its id), and `Markdown`, which renders what people and agents wrote as elements, never as HTML, with links to the web only and pictures over https only, or, given `fileSrc`, from the file of that name, and, given `docHref`, a link to a page's path as a link to the page. `DecisionCard` reads as a record, with the context, the rationale and what followed, which `onUpdate` lets a person write. The small blocks (`Button`, `CopyButton` (a text put on the clipboard), `Badge`, `Avatar` (`xs` to `lg`), `PersonChip` with `personName` (a person by the name the host gives, the login where there is none), `Callout`, `EmptyState`, `Spinner`, `Time`, `Day`, `CategoryBadge`, `DueBadge`, `GoalStateBadge`, `ProgressBar`, and `ShowMore` with `usePaged` and `PAGE_SIZE`, a long list a page at a time), the words of the vocabulary (`STATE_LABELS`, `PRIORITY_LABELS`, `ROLE_LABELS`, with `RoleBadge`) and the day helpers (`today`, `addDays`, `daysBetween`, `monthGrid`, `formatDay`, `formatMonth` and the rest, days being the strings the API spells them as) are exported too.
79
79
  - **The composition:** `createConsole(config)` returns `{ App, mount }`. `App` is the whole console as one component; `mount(container)` renders it and returns the way to take it down. `config.baseUrl` is the origin of the API (the page's own when left out), `config.components` the pieces to replace (`ConsoleComponents` names them with the props each takes), `config.languages` the packs the pages speak, `config.brand` the addresses of a symbol and a wordmark to show beside the name (ADR-0013; the default console passes those of `@skillcdn/brand`, the main repository's package of its marks), `config.client` a client of your own, for tests. The SkillCDN name and marks are trademarks of KDX Labs under the main repository's trademark policy, not under this package's MIT license; a custom console brings its own marks through the same slot. A console that holds a token rather than a session (one of your own, served by `console serve`) is told so by the API (`me.agent`, the token's name) and offers nothing a token cannot do: no agents page and no sign-out, since the tokens themselves are a person's own doing; everything else, configuring included, it does on the token as the person (ADR-0021), and it keeps the choice of language on the person. The pages route in the browser and every form has an address (ADR-0010): the projects at `/`, the person's own work at `/work`, the workspace's settings at `/settings` (its rules, its categories at `/categories`, where its skills come from), a project's pages under `/projects/<key>` (its roadmap, calendar and settings among them), a task by its number, a goal and a decision by their ids, a document by its path, and the query for how a page is shown, the board's filters, the calendar's month, the week of the person's work and the settings' forms among it (`matchRoute(pathname, search)`, `PATHS`, `projectHref`, `boardHref`, `taskHref`, `goalHref`, `calendarHref`, `workHref`, `personWorkHref`, `decisionHref`, `docHref`, `settingsHref`, `projectSettingsHref`, `newTaskHref`, `newGoalHref`, `newDecisionHref`, and `movedFrom` for the addresses of before); every link to one of them is followed in place, with one history entry per step; the workspace is loaded once and the project the page is on whole, kept current by the project's stream (`useConsoleData(client, projectKey)`, for a composition of your own).
80
80
  - **Pages of your own:** `config.pages` adds tabs beside the console's. Each is a `CustomPage`: a `key` (what the address says: `/pages/<key>` on the workspace, `/projects/<project>/pages/<key>` on a project), a `label` (one word, or a word by language tag with `en` standing in), a `level` (`workspace`, or `project` for a tab on every project), `wide` for a page that takes the whole window, and `render(context)`, which gets what the default pages get: the `data` of `useConsoleData` with its actions, the `project` the page is on, the `client`, the `navigation`, the `words` and the `language`. `customPageHref` names the address and `customPageLabel` the tab's word. A page that is not among the pages given shows nothing there.
81
81
  - **The languages:** every word the pages show is in a pack (`Messages`, keyed as `en` is), English and Korean ship (`ENGLISH`, `KOREAN`, `DEFAULT_LANGUAGES`), and a component takes its words from the language above it (`useWords`, `useLanguage`, `LanguageContext`), English where there is none. The person's choice is kept on them (`client.updateMe({ language })`) and the browser's languages decide before one (`chooseLanguage`, `packFor`). `createConsole({ languages })` replaces the packs the default console speaks, so that a custom console adds a language of its own; a pack is complete by type.
package/dist/api.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { agentLabel } from "./agent-name.js";
2
- export { ApiError, type ClientOptions, type CommentInput, type ConsoleClient, createClient, type DocumentFilter, type EventFilter, type FetchLike, type FileRead, type FileUpload, type Page, type ProjectClient, type TaskFilter, } from "./client.js";
2
+ export { ApiError, type ClientOptions, type CommentInput, type ConsoleClient, createClient, type DocumentFilter, type EventFilter, type FetchLike, type FileRead, type FileUpload, type GoalFilter, type Page, type ProjectClient, type TaskFilter, } from "./client.js";
3
+ export { CLIENT_POLICY, CLIENT_PRODUCT, CLIENT_RANGE_HEADER, type ClientJudgement, type ClientPolicy, type ClientVerdict, clientRange, clientVersionOf, commonRange, compareVersions, formatRange, formatVersion, inRange, judgeClient, parseRange, parseVersion, userAgentOf, VERSION_HEADER, type Version, type VersionRange, } from "./compat.js";
3
4
  export { CONNECT_CODE_ALPHABET, CONNECT_CODE_LENGTH, isConnectCode, normalizeConnectCode, } from "./connect.js";
4
5
  export { DOCUMENT_PATH, documentPathsIn, folderOf, foldersAbove, isDocumentPath, isFolderPath, nameOf, } from "./documents.js";
5
6
  export { DEFAULT_PAGE_LIMIT, DEFAULT_TOKEN_DAYS, EVENTS_PAGE_LIMIT, LIST_LIMIT, MAX_AGENT_LENGTH, MAX_ARTIFACTS_PER_RUN, MAX_BODY_LENGTH, MAX_CATEGORIES, MAX_CATEGORY_KEY_LENGTH, MAX_CATEGORY_NAME_LENGTH, MAX_COMMENTS_PER_TASK, MAX_DOCUMENT_LENGTH, MAX_DOCUMENT_PATH_LENGTH, MAX_DOCUMENT_SEGMENT_LENGTH, MAX_FILE_BYTES, MAX_FILE_NAME_LENGTH, MAX_FILES_PER_COMMENT, MAX_FILES_PER_DOCUMENT, MAX_LANGUAGE_TAG_LENGTH, MAX_LINK_LABEL_LENGTH, MAX_LINKS, MAX_LOGIN_LENGTH, MAX_NOTE_LENGTH, MAX_OPTION_LABEL_LENGTH, MAX_OPTIONS, MAX_PROJECT_DESCRIPTION_LENGTH, MAX_PROJECT_ICON_BYTES, MAX_PROJECT_KEY_LENGTH, MAX_PROJECT_NAME_LENGTH, MAX_PROJECT_SYMBOL_LENGTH, MAX_QUESTION_LENGTH, MAX_REPORTS_PER_RUN, MAX_RULES_LENGTH, MAX_SEARCH_LENGTH, MAX_SECRET_LENGTH, MAX_SKILLS_ADDRESS_LENGTH, MAX_SUMMARY_LENGTH, MAX_TITLE_LENGTH, MAX_TOKEN_DAYS, MAX_TOKEN_NAME_LENGTH, MAX_TOKENS_PER_PERSON, MAX_URL_LENGTH, MAX_VERSIONS_PER_DOCUMENT, MIN_OPTIONS, } from "./limits.js";
package/dist/api.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EACL,QAAQ,EACR,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,YAAY,EACZ,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,IAAI,EACT,KAAK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EACjB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,wBAAwB,EACxB,kBAAkB,EAClB,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EACL,cAAc,EACd,KAAK,YAAY,EACjB,eAAe,EACf,KAAK,aAAa,EAClB,WAAW,EACX,KAAK,SAAS,EACd,WAAW,EACX,KAAK,SAAS,EACd,WAAW,EACX,KAAK,SAAS,EACd,aAAa,EACb,YAAY,EACZ,KAAK,UAAU,EACf,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,kBAAkB,EAClB,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,aAAa,EACb,WAAW,EACX,YAAY,EACZ,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,eAAe,EACf,KAAK,YAAY,EACjB,eAAe,EACf,WAAW,EACX,KAAK,YAAY,EACjB,KAAK,SAAS,GACf,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EACL,QAAQ,EACR,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,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ACpB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,aAAa,EACb,WAAW,EACX,YAAY,EACZ,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,eAAe,EACf,KAAK,YAAY,EACjB,eAAe,EACf,WAAW,EACX,KAAK,YAAY,EACjB,KAAK,SAAS,GACf,MAAM,iBAAiB,CAAC"}
package/dist/api.js CHANGED
@@ -4,6 +4,7 @@
4
4
  // here: the server and the command line import this entry point, and nothing of the pages.
5
5
  export { agentLabel } from "./agent-name.js";
6
6
  export { ApiError, createClient, } from "./client.js";
7
+ export { CLIENT_POLICY, CLIENT_PRODUCT, CLIENT_RANGE_HEADER, clientRange, clientVersionOf, commonRange, compareVersions, formatRange, formatVersion, inRange, judgeClient, parseRange, parseVersion, userAgentOf, VERSION_HEADER, } from "./compat.js";
7
8
  export { CONNECT_CODE_ALPHABET, CONNECT_CODE_LENGTH, isConnectCode, normalizeConnectCode, } from "./connect.js";
8
9
  export { DOCUMENT_PATH, documentPathsIn, folderOf, foldersAbove, isDocumentPath, isFolderPath, nameOf, } from "./documents.js";
9
10
  export { DEFAULT_PAGE_LIMIT, DEFAULT_TOKEN_DAYS, EVENTS_PAGE_LIMIT, LIST_LIMIT, MAX_AGENT_LENGTH, MAX_ARTIFACTS_PER_RUN, MAX_BODY_LENGTH, MAX_CATEGORIES, MAX_CATEGORY_KEY_LENGTH, MAX_CATEGORY_NAME_LENGTH, MAX_COMMENTS_PER_TASK, MAX_DOCUMENT_LENGTH, MAX_DOCUMENT_PATH_LENGTH, MAX_DOCUMENT_SEGMENT_LENGTH, MAX_FILE_BYTES, MAX_FILE_NAME_LENGTH, MAX_FILES_PER_COMMENT, MAX_FILES_PER_DOCUMENT, MAX_LANGUAGE_TAG_LENGTH, MAX_LINK_LABEL_LENGTH, MAX_LINKS, MAX_LOGIN_LENGTH, MAX_NOTE_LENGTH, MAX_OPTION_LABEL_LENGTH, MAX_OPTIONS, MAX_PROJECT_DESCRIPTION_LENGTH, MAX_PROJECT_ICON_BYTES, MAX_PROJECT_KEY_LENGTH, MAX_PROJECT_NAME_LENGTH, MAX_PROJECT_SYMBOL_LENGTH, MAX_QUESTION_LENGTH, MAX_REPORTS_PER_RUN, MAX_RULES_LENGTH, MAX_SEARCH_LENGTH, MAX_SECRET_LENGTH, MAX_SKILLS_ADDRESS_LENGTH, MAX_SUMMARY_LENGTH, MAX_TITLE_LENGTH, MAX_TOKEN_DAYS, MAX_TOKEN_NAME_LENGTH, MAX_TOKENS_PER_PERSON, MAX_URL_LENGTH, MAX_VERSIONS_PER_DOCUMENT, MIN_OPTIONS, } from "./limits.js";
package/dist/api.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,8FAA8F;AAC9F,+FAA+F;AAC/F,2FAA2F;AAE3F,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EACL,QAAQ,EAIR,YAAY,GASb,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,EACb,oBAAoB,GACrB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,aAAa,EACb,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,MAAM,GACP,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACnB,wBAAwB,EACxB,2BAA2B,EAC3B,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,W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mB,EACnB,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,sBAAsB,EACtB,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,wBAAwB,EACxB,kBAAkB,EAClB,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EACL,cAAc,EAEd,eAAe,EAEf,WAAW,EAEX,WAAW,EAEX,WAAW,EAEX,aAAa,EACb,YAAY,EAEZ,kBAAkB,EAElB,gBAAgB,EAChB,YAAY,EACZ,eAAe,EAGf,kBAAkB,EAClB,aAAa,EACb,oBAAoB,EACpB,aAAa,EAKb,aAAa,EACb,WAAW,EACX,YAAY,EAIZ,eAAe,EAEf,eAAe,EACf,WAAW,GAGZ,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,8FAA8F;AAC9F,+FAA+F;AAC/F,2FAA2F;AAE3F,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAC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,EAClB,aAAa,EACb,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,wBAAwB,EACxB,kBAAkB,EAClB,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EACL,cAAc,EAEd,eAAe,EAEf,WAAW,EAEX,WAAW,EAEX,WAAW,EAEX,aAAa,EACb,YAAY,EAEZ,kBAAkB,EAElB,gBAAgB,EAChB,YAAY,EACZ,eAAe,EAGf,kBAAkB,EAClB,aAAa,EACb,oBAAoB,EACpB,aAAa,EAKb,aAAa,EACb,WAAW,EACX,YAAY,EAIZ,eAAe,EAEf,eAAe,EACf,WAAW,GAGZ,MAAM,iBAAiB,CAAC"}
package/dist/cli/cli.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { type FetchLike } from "../client.js";
2
2
  import type { CredentialStore } from "./credentials.js";
3
3
  import type { DirectoryStore } from "./directory.js";
4
+ import { type Install } from "./install.js";
5
+ import type { NoticeStore } from "./notices.js";
4
6
  import { type Listen } from "./serve.js";
5
7
  /** The exit codes of the command, for whoever runs it: a shell, a hook, an agent. */
6
8
  export declare const EXIT: {
@@ -11,6 +13,8 @@ export declare const EXIT: {
11
13
  readonly usage: 2;
12
14
  /** The decision still waits for a person. */
13
15
  readonly waiting: 3;
16
+ /** The command and the console do not go together (ADR-0025): stderr says which to update, and how. */
17
+ readonly incompatible: 4;
14
18
  };
15
19
  export interface CliIo {
16
20
  readonly env: Readonly<Record<string, string | undefined>>;
@@ -34,6 +38,12 @@ export interface CliIo {
34
38
  readonly now: () => number;
35
39
  /** The version of the package the command runs from, when the entry point knows it. */
36
40
  readonly version?: string | undefined;
41
+ /** What the command calls itself on every request (ADR-0025); nothing when it does not know its version. */
42
+ readonly userAgent?: string | undefined;
43
+ /** Where the command is installed, so that an update is told the way it takes effect; nothing when unknown. */
44
+ readonly install?: Install | undefined;
45
+ /** What the command last said of the versions; left out, it says it every time. */
46
+ readonly notices?: NoticeStore | undefined;
37
47
  /** Where the console's own skills are on this machine, shipped with the package; nothing when they are not there. */
38
48
  readonly skillsDir?: string | undefined;
39
49
  /** How `serve` listens on the loopback (ADR-0014); left out, the command cannot serve. */
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli/cli.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,SAAS,EAEf,MAAM,cAAc,CAAC;AA8BtB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AA8BrD,OAAO,EAA0C,KAAK,MAAM,EAAE,MAAM,YAAY,CAAC;AAQjF,qFAAqF;AACrF,eAAO,MAAM,IAAI;aACf,EAAE,EAAE,CAAC;IACL,6EAA6E;aAC7E,MAAM,EAAE,CAAC;IACT,sCAAsC;aACtC,KAAK,EAAE,CAAC;IACR,6CAA6C;aAC7C,OAAO,EAAE,CAAC;CACF,CAAC;AAWX,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IAC3D,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,iFAAiF;IACjF,QAAQ,CAAC,SAAS,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1C,yFAAyF;IACzF,QAAQ,CAAC,QAAQ,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AAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACxF,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAChC,+EAA+E;IAC/E,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,QAAQ,CAAC,GAAG,EAAE,MAAM,MAAM,CAAC;IAC3B,uFAAuF;IACvF,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,4GAA4G;IAC5G,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,+GAA+G;IAC/G,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACvC,mFAAmF;IACnF,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC3C,qHAAqH;IACrH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,0FAA0F;IAC1F,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC;AAuiED,yFAAyF;AACzF,wBAAsB,MAAM,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAiDhF"}
package/dist/cli/cli.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { basename, extname } from "node:path";
2
2
  import { parseArgs } from "node:util";
3
3
  import { ApiError, createClient, } from "../client.js";
4
+ import { CLIENT_RANGE_HEADER, judgeClient, parseVersion, VERSION_HEADER } from "../compat.js";
4
5
  import { addDays, dayOf as dayOfDate, isDay } from "../dates.js";
5
6
  import { DEFAULT_PAGE_LIMIT, LIST_LIMIT, MAX_OPTIONS, MIN_OPTIONS } from "../limits.js";
6
7
  import { fillRules, RULES_PATH, RULES_TITLE } from "../rules.js";
@@ -9,6 +10,7 @@ import { COLOR_NAMES, GOAL_STATES, PERSON_ROLES, PROJECT_ROLES, PROJECT_VISIBILI
9
10
  import { loadWebRoot, WebRootError } from "../web.js";
10
11
  import { formatAnswer, formatCategoryLine, formatComment, formatDecision, formatDecisionLine, formatDocument, formatDocuments, formatGoal, formatGoalLine, formatListingLine, formatMemberLine, formatMore, formatOptions, formatPersonLine, formatPersonWork, formatProject, formatProjectLine, formatRules, formatRun, formatRunLine, formatSkills, formatTask, formatTaskLine, formatVersion, formatVersionLine, formatWork, } from "./format.js";
11
12
  import { COMMAND_HELP, helpFor, usage } from "./help.js";
13
+ import { describeInstall, updateCommandFor } from "./install.js";
12
14
  import { createServeHandler, DEFAULT_SERVE_PORT } from "./serve.js";
13
15
  // The `console` command (docs/specs/cli.md): the agent's side of the console. A thin client of
14
16
  // the REST API with no logic of its own: every command is one or two requests and the words to
@@ -24,7 +26,11 @@ export const EXIT = {
24
26
  usage: 2,
25
27
  /** The decision still waits for a person. */
26
28
  waiting: 3,
29
+ /** The command and the console do not go together (ADR-0025): stderr says which to update, and how. */
30
+ incompatible: 4,
27
31
  };
32
+ /** A day, for how often the command repeats what it noticed of the versions. */
33
+ const DAY_MS = 86_400_000;
28
34
  /** How long one request for a decision's answer asks the console to hold it: what the server allows. */
29
35
  const WAIT_STEP_SECONDS = 50;
30
36
  /** A breath between two such requests, should the console answer at once. */
@@ -83,7 +89,7 @@ async function open(io, values) {
83
89
  if (url === undefined || token === undefined) {
84
90
  throw failed("Not signed in. A person signs the command in: console login --url <the console's origin>");
85
91
  }
86
- const client = createClient({ baseUrl: url, token, fetch: io.fetch });
92
+ const client = clientOf(io, url, token);
87
93
  const projectKey = async () => text(values, "project") ?? io.env.CONSOLE_PROJECT ?? (await io.directory.load())?.project;
88
94
  return {
89
95
  client,
@@ -323,7 +329,7 @@ async function settle(io, session, project, decision, seconds, shown = false) {
323
329
  }
324
330
  /** Checks a token against the console, keeps it with the address, and says who it is. */
325
331
  async function keep(io, url, token, agent) {
326
- const me = await createClient({ baseUrl: url, token, fetch: io.fetch }).me();
332
+ const me = await clientOf(io, url, token).me();
327
333
  const person = me.person;
328
334
  if (person === null) {
329
335
  throw failed("The console does not know this token. Make one on your Agents page and try again.");
@@ -349,7 +355,7 @@ const login = async (args, io) => {
349
355
  }
350
356
  // A connection (ADR-0011): a code a person approves on the console's own pages, and the token
351
357
  // handed over here once, never shown.
352
- const client = createClient({ baseUrl: url, fetch: io.fetch });
358
+ const client = clientOf(io, url);
353
359
  // "<agent> on <machine>": the pages say the agent and keep the machine for a hover.
354
360
  const agent = text(values, "agent") ?? agentOf(io.env) ?? "An agent";
355
361
  const begun = await client.connect({
@@ -387,7 +393,7 @@ const logout = async (args, io) => {
387
393
  // Agents page, and the person is told so.
388
394
  let gone = true;
389
395
  try {
390
- await createClient({ baseUrl: url, token, fetch: io.fetch }).giveUpToken();
396
+ await clientOf(io, url, token).giveUpToken();
391
397
  }
392
398
  catch (error) {
393
399
  if (!(error instanceof ApiError && error.code === "auth.required")) {
@@ -422,7 +428,31 @@ const whoami = async (args, io) => {
422
428
  throw failed("The console does not know this token. Sign in again: console login");
423
429
  }
424
430
  const key = await session.projectKey();
425
- answer(io, session, { ...me, project: key ?? null }, () => `${person.login} (${person.role}) at ${me.workspace.name}, ${session.url}${key === undefined ? "; no project named here" : `; project ${key}`}`);
431
+ const command = parseVersion(io.version);
432
+ const server = parseVersion(me.console?.version);
433
+ const verdict = command === undefined || server === undefined
434
+ ? undefined
435
+ : judgeClient(command, server).verdict;
436
+ // A console from before the rule says nothing of itself; the command says so instead.
437
+ const consoleWords = me.console === undefined
438
+ ? "the console does not say its version, so it is older than 0.1.18"
439
+ : `the console is ${me.console.version} and takes ${me.console.clientRange}`;
440
+ answer(io, session, {
441
+ ...me,
442
+ console: me.console ?? null,
443
+ project: key ?? null,
444
+ command: { version: io.version ?? null, install: io.install ?? null },
445
+ }, () => [
446
+ `${person.login} (${person.role}) at ${me.workspace.name}, ${session.url}${key === undefined ? "; no project named here" : `; project ${key}`}`,
447
+ `This command is ${io.version ?? "of a version it does not know"}${io.install === undefined ? "" : `, ${describeInstall(io.install)}`}; ${consoleWords}.`,
448
+ ...(verdict === "behind"
449
+ ? [`A newer command exists. Update it: ${updateWords(io, me.console?.version)}`]
450
+ : verdict === "ahead"
451
+ ? [
452
+ `This command is newer than the console: what the console has not got yet is refused as not found. To match the console: ${updateWords(io, me.console?.version)}`,
453
+ ]
454
+ : []),
455
+ ].join("\n"));
426
456
  return EXIT.ok;
427
457
  };
428
458
  const projects = async (args, io) => {
@@ -1077,25 +1107,40 @@ const restore = async (args, io) => {
1077
1107
  return EXIT.ok;
1078
1108
  };
1079
1109
  const goals = async (args, io) => {
1080
- const { values } = parse(args, {}, false);
1110
+ const { values } = parse(args, { category: { type: "string" }, state: { type: "string" } }, false);
1111
+ const state = goalStateOf(text(values, "state"));
1112
+ const category = text(values, "category");
1081
1113
  const session = await open(io, values);
1082
1114
  const project = await session.project();
1083
- const found = await project.goals();
1115
+ const found = await project.goals({
1116
+ ...(state === undefined ? {} : { state }),
1117
+ ...(category === undefined ? {} : { category }),
1118
+ });
1084
1119
  answer(io, session, found, () => found.items.length === 0
1085
- ? "No goals. An owner sets one: console goal new <title> --due <day>"
1120
+ ? state === undefined && category === undefined
1121
+ ? "No goals. An owner sets one: console goal new <title> --due <day>"
1122
+ : "No goal matches."
1086
1123
  : found.items.map(formatGoalLine).join("\n"));
1087
1124
  return EXIT.ok;
1088
1125
  };
1089
1126
  const GOAL_FIELDS = {
1090
1127
  state: { type: "string" },
1128
+ category: { type: "string" },
1129
+ starts: { type: "string" },
1091
1130
  due: { type: "string" },
1092
1131
  body: { type: "string" },
1093
1132
  file: { type: "string" },
1094
1133
  };
1134
+ /** A category's key as a flag names one, or `null` for `none` where the field may be cleared. */
1135
+ function categoryOf(value, clearable = false) {
1136
+ return clearable && value === "none" ? null : value;
1137
+ }
1095
1138
  const newGoal = async (args, io) => {
1096
1139
  const { values, positionals } = parse(args, GOAL_FIELDS);
1097
1140
  const title = theOne(positionals, 'Say the title: console goal new "<title>" [--due <day>]');
1098
1141
  const state = goalStateOf(text(values, "state"));
1142
+ const category = categoryOf(text(values, "category"));
1143
+ const startsOn = dayOf(io, text(values, "starts"));
1099
1144
  const dueOn = dayOf(io, text(values, "due"));
1100
1145
  const body = await bodyOf(io, values, text(values, "body"));
1101
1146
  const session = await open(io, values);
@@ -1104,6 +1149,8 @@ const newGoal = async (args, io) => {
1104
1149
  title,
1105
1150
  ...(body === undefined ? {} : { body }),
1106
1151
  ...(state === undefined ? {} : { state }),
1152
+ ...(category === undefined ? {} : { category }),
1153
+ ...(startsOn === undefined ? {} : { startsOn }),
1107
1154
  ...(dueOn === undefined ? {} : { dueOn }),
1108
1155
  });
1109
1156
  answer(io, session, made, () => `Goal set: ${made.title}\nid: ${made.id}`);
@@ -1114,16 +1161,20 @@ const editGoal = async (args, io) => {
1114
1161
  const id = theOne(positionals, "Say which goal: console goal edit <id> --state <state> ...");
1115
1162
  const title = text(values, "title");
1116
1163
  const state = goalStateOf(text(values, "state"));
1164
+ const category = categoryOf(text(values, "category"), true);
1165
+ const startsOn = dayOf(io, text(values, "starts"), true);
1117
1166
  const dueOn = dayOf(io, text(values, "due"), true);
1118
1167
  const body = await bodyOf(io, values, text(values, "body"));
1119
1168
  const patch = {
1120
1169
  ...(title === undefined ? {} : { title }),
1121
1170
  ...(body === undefined ? {} : { body }),
1122
1171
  ...(state === undefined ? {} : { state }),
1172
+ ...(category === undefined ? {} : { category }),
1173
+ ...(startsOn === undefined ? {} : { startsOn }),
1123
1174
  ...(dueOn === undefined ? {} : { dueOn }),
1124
1175
  };
1125
1176
  if (Object.keys(patch).length === 0) {
1126
- throw misuse("Say what to change: --title, --body, --state or --due; --due none clears the day.");
1177
+ throw misuse("Say what to change: --title, --body, --state, --category, --starts or --due; none clears a category or a day.");
1127
1178
  }
1128
1179
  const session = await open(io, values);
1129
1180
  const project = await session.project();
@@ -1577,9 +1628,67 @@ function help(io, name) {
1577
1628
  io.stdout(found);
1578
1629
  return EXIT.ok;
1579
1630
  }
1631
+ /** A client of the console at `url`, naming the command on every request (ADR-0025). */
1632
+ function clientOf(io, url, token) {
1633
+ return createClient({
1634
+ baseUrl: url,
1635
+ fetch: io.fetch,
1636
+ ...(token === undefined ? {} : { token }),
1637
+ ...(io.userAgent === undefined ? {} : { userAgent: io.userAgent }),
1638
+ });
1639
+ }
1640
+ /** The command that puts the console's version where this command is installed. */
1641
+ function updateWords(io, version) {
1642
+ const wanted = version ?? "latest";
1643
+ if (io.install === undefined) {
1644
+ return `npm install -g @skillcdn/console@${wanted}`;
1645
+ }
1646
+ const command = updateCommandFor(io.install, wanted);
1647
+ return io.install.kind === "project" ? `${command} (in ${io.install.root})` : command;
1648
+ }
1649
+ /**
1650
+ * What the command says of the versions once the console answered: that a newer command exists,
1651
+ * or that this one is newer than the console; once a day for one pair of versions, on stderr,
1652
+ * so that the console's JSON stays what it is. What is out of the range never gets here: the
1653
+ * console refused it, and the refusal says what to do.
1654
+ */
1655
+ async function noticeVersions(io, seen) {
1656
+ const command = parseVersion(io.version);
1657
+ const server = parseVersion(seen.version);
1658
+ if (io.version === undefined ||
1659
+ seen.version === undefined ||
1660
+ command === undefined ||
1661
+ server === undefined) {
1662
+ return;
1663
+ }
1664
+ const { verdict } = judgeClient(command, server);
1665
+ if (verdict !== "behind" && verdict !== "ahead") {
1666
+ return;
1667
+ }
1668
+ const previous = await io.notices?.load();
1669
+ const now = io.now();
1670
+ if (previous !== undefined &&
1671
+ previous.command === io.version &&
1672
+ previous.console === seen.version &&
1673
+ now - Date.parse(previous.shownAt) < DAY_MS) {
1674
+ return;
1675
+ }
1676
+ io.stderr(verdict === "behind"
1677
+ ? `A newer command exists: the console runs ${seen.version}, this command is ${io.version}. Update it: ${updateWords(io, seen.version)}\n`
1678
+ : `This command (${io.version}) is newer than the console (${seen.version}, which takes ${seen.range ?? "an older line"}): what the console has not got yet is refused as not found. The console's operator updates it; to match the console meanwhile: ${updateWords(io, seen.version)}\n`);
1679
+ await io.notices?.save({
1680
+ command: io.version,
1681
+ console: seen.version,
1682
+ shownAt: new Date(now).toISOString(),
1683
+ });
1684
+ }
1580
1685
  /** What a refusal of the console is followed by, when there is something to do about it. */
1581
- function hintFor(error) {
1686
+ function hintFor(error, io, seen) {
1582
1687
  switch (error.code) {
1688
+ case "client.outdated":
1689
+ return `Update the command: ${updateWords(io, seen.version)}\n`;
1690
+ case "client.too_new":
1691
+ return `Install the console's version: ${updateWords(io, seen.version)}; or ask the console's operator to update the console.\n`;
1583
1692
  case "auth.required":
1584
1693
  return "The token is not one the console knows, any more or at all. A person signs the command in again: console login\n";
1585
1694
  case "project.not_found":
@@ -1598,6 +1707,10 @@ function hintFor(error) {
1598
1707
  return "The due day is before the start. Say a due day on or after it.\n";
1599
1708
  case "goal.not_found":
1600
1709
  return "No goal of this project has that id. console goals lists them.\n";
1710
+ case "goal.invalid_category":
1711
+ return "No category has that key. console categories lists them.\n";
1712
+ case "goal.invalid_dates":
1713
+ return "The target day is before the start. Say a target day on or after it.\n";
1601
1714
  case "auth.forbidden":
1602
1715
  return "What was asked is an administrator's, or an owner's of the project, and the person this token acts as is not one here. Hand the step to them.\n";
1603
1716
  case "project.key_taken":
@@ -1637,9 +1750,21 @@ function hintFor(error) {
1637
1750
  /** Runs the command and answers with its exit code. What it prints goes through `io`. */
1638
1751
  export async function runCli(argv, io) {
1639
1752
  const [name, ...rest] = argv;
1753
+ // Every answer of the console says its version and the range it takes; the command reads
1754
+ // them off the answers it gets anyway, and asks nothing more (ADR-0025).
1755
+ const seen = {};
1756
+ const watched = {
1757
+ ...io,
1758
+ fetch: async (input, init) => {
1759
+ const response = await io.fetch(input, init);
1760
+ seen.version = response.headers.get(VERSION_HEADER) ?? seen.version;
1761
+ seen.range = response.headers.get(CLIENT_RANGE_HEADER) ?? seen.range;
1762
+ return response;
1763
+ },
1764
+ };
1640
1765
  try {
1641
1766
  if (name === "--version" || name === "-v" || name === "version") {
1642
- io.stdout(`console ${io.version ?? "(version unknown)"} (@skillcdn/console)\n`);
1767
+ io.stdout(`console ${io.version ?? "(version unknown)"} (@skillcdn/console)${io.install === undefined ? "" : `, ${describeInstall(io.install)}`}\n`);
1643
1768
  return EXIT.ok;
1644
1769
  }
1645
1770
  if (name === undefined || name === "help" || name === "--help" || name === "-h") {
@@ -1652,7 +1777,11 @@ export async function runCli(argv, io) {
1652
1777
  if (command === undefined) {
1653
1778
  throw misuse(`Not a command: ${name}. Run: console help`);
1654
1779
  }
1655
- return await command(rest, io);
1780
+ const exit = await command(rest, watched);
1781
+ if (name !== "whoami") {
1782
+ await noticeVersions(io, seen);
1783
+ }
1784
+ return exit;
1656
1785
  }
1657
1786
  catch (error) {
1658
1787
  if (error instanceof CliExit) {
@@ -1660,8 +1789,10 @@ export async function runCli(argv, io) {
1660
1789
  return error.exit;
1661
1790
  }
1662
1791
  if (error instanceof ApiError) {
1663
- io.stderr(`${error.code}: ${error.message}\n${hintFor(error)}`);
1664
- return EXIT.failed;
1792
+ io.stderr(`${error.code}: ${error.message}\n${hintFor(error, io, seen)}`);
1793
+ return error.code === "client.outdated" || error.code === "client.too_new"
1794
+ ? EXIT.incompatible
1795
+ : EXIT.failed;
1665
1796
  }
1666
1797
  throw error;
1667
1798
  }