@skillcdn/console 0.4.7 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -14
- package/SKILLCDN.md +5 -3
- package/dist/agent-page.d.ts +44 -0
- package/dist/agent-page.d.ts.map +1 -0
- package/dist/agent-page.js +415 -0
- package/dist/agent-page.js.map +1 -0
- package/dist/agent-stream.d.ts +52 -0
- package/dist/agent-stream.d.ts.map +1 -0
- package/dist/agent-stream.js +155 -0
- package/dist/agent-stream.js.map +1 -0
- package/dist/api.d.ts +12 -6
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +11 -5
- package/dist/api.js.map +1 -1
- package/dist/avatar.d.ts +137 -0
- package/dist/avatar.d.ts.map +1 -0
- package/dist/avatar.js +1216 -0
- package/dist/avatar.js.map +1 -0
- package/dist/charts.d.ts +103 -0
- package/dist/charts.d.ts.map +1 -0
- package/dist/charts.js +182 -0
- package/dist/charts.js.map +1 -0
- package/dist/cli/cli.d.ts +39 -1
- package/dist/cli/cli.d.ts.map +1 -1
- package/dist/cli/cli.js +2424 -296
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/command-words.d.ts +20 -0
- package/dist/cli/command-words.d.ts.map +1 -0
- package/dist/cli/command-words.js +51 -0
- package/dist/cli/command-words.js.map +1 -0
- package/dist/cli/credentials.d.ts +59 -5
- package/dist/cli/credentials.d.ts.map +1 -1
- package/dist/cli/credentials.js +128 -16
- package/dist/cli/credentials.js.map +1 -1
- package/dist/cli/directory.d.ts +19 -4
- package/dist/cli/directory.d.ts.map +1 -1
- package/dist/cli/directory.js +16 -8
- package/dist/cli/directory.js.map +1 -1
- package/dist/cli/format.d.ts +91 -8
- package/dist/cli/format.d.ts.map +1 -1
- package/dist/cli/format.js +386 -57
- package/dist/cli/format.js.map +1 -1
- package/dist/cli/help.d.ts +13 -4
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +202 -62
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/main.js +94 -0
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/pack.d.ts +69 -36
- package/dist/cli/pack.d.ts.map +1 -1
- package/dist/cli/pack.js +241 -188
- package/dist/cli/pack.js.map +1 -1
- package/dist/cli/plugin-check.d.ts +42 -0
- package/dist/cli/plugin-check.d.ts.map +1 -1
- package/dist/cli/plugin-check.js +221 -36
- package/dist/cli/plugin-check.js.map +1 -1
- package/dist/cli/plugin-cli.d.ts +6 -1
- package/dist/cli/plugin-cli.d.ts.map +1 -1
- package/dist/cli/plugin-cli.js +21 -4
- package/dist/cli/plugin-cli.js.map +1 -1
- package/dist/cli/plugin-main.js +1 -0
- package/dist/cli/plugin-main.js.map +1 -1
- package/dist/cli/runner-host.d.ts +36 -0
- package/dist/cli/runner-host.d.ts.map +1 -0
- package/dist/cli/runner-host.js +154 -0
- package/dist/cli/runner-host.js.map +1 -0
- package/dist/cli/serve.d.ts +33 -1
- package/dist/cli/serve.d.ts.map +1 -1
- package/dist/cli/serve.js +275 -6
- package/dist/cli/serve.js.map +1 -1
- package/dist/cli/setup-machine.d.ts +36 -0
- package/dist/cli/setup-machine.d.ts.map +1 -0
- package/dist/cli/setup-machine.js +109 -0
- package/dist/cli/setup-machine.js.map +1 -0
- package/dist/client.d.ts +189 -10
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +192 -57
- package/dist/client.js.map +1 -1
- package/dist/compat.d.ts +1 -1
- package/dist/compat.js +2 -2
- package/dist/components/agent-page.d.ts +384 -0
- package/dist/components/agent-page.d.ts.map +1 -0
- package/dist/components/agent-page.js +985 -0
- package/dist/components/agent-page.js.map +1 -0
- package/dist/components/agents.d.ts +102 -0
- package/dist/components/agents.d.ts.map +1 -0
- package/dist/components/agents.js +246 -0
- package/dist/components/agents.js.map +1 -0
- package/dist/components/calendar.d.ts +17 -17
- package/dist/components/calendar.d.ts.map +1 -1
- package/dist/components/calendar.js +7 -2
- package/dist/components/calendar.js.map +1 -1
- package/dist/components/charts.d.ts +157 -0
- package/dist/components/charts.d.ts.map +1 -0
- package/dist/components/charts.js +182 -0
- package/dist/components/charts.js.map +1 -0
- package/dist/components/comments.d.ts +2 -0
- package/dist/components/comments.d.ts.map +1 -1
- package/dist/components/comments.js +1 -1
- package/dist/components/comments.js.map +1 -1
- package/dist/components/connect.d.ts.map +1 -1
- package/dist/components/connect.js +7 -2
- package/dist/components/connect.js.map +1 -1
- package/dist/components/decision-form.d.ts +21 -0
- package/dist/components/decision-form.d.ts.map +1 -1
- package/dist/components/decision-form.js +20 -6
- package/dist/components/decision-form.js.map +1 -1
- package/dist/components/decision-list.d.ts +24 -0
- package/dist/components/decision-list.d.ts.map +1 -1
- package/dist/components/decision-list.js +54 -5
- package/dist/components/decision-list.js.map +1 -1
- package/dist/components/desk-records.d.ts +102 -0
- package/dist/components/desk-records.d.ts.map +1 -0
- package/dist/components/desk-records.js +221 -0
- package/dist/components/desk-records.js.map +1 -0
- package/dist/components/desk.d.ts +85 -0
- package/dist/components/desk.d.ts.map +1 -0
- package/dist/components/desk.js +135 -0
- package/dist/components/desk.js.map +1 -0
- package/dist/components/event-feed.d.ts.map +1 -1
- package/dist/components/event-feed.js +26 -1
- package/dist/components/event-feed.js.map +1 -1
- package/dist/components/home.d.ts +12 -1
- package/dist/components/home.d.ts.map +1 -1
- package/dist/components/home.js +175 -16
- package/dist/components/home.js.map +1 -1
- package/dist/components/my-decisions.d.ts +5 -0
- package/dist/components/my-decisions.d.ts.map +1 -1
- package/dist/components/my-decisions.js +3 -3
- package/dist/components/my-decisions.js.map +1 -1
- package/dist/components/people.d.ts +17 -0
- package/dist/components/people.d.ts.map +1 -1
- package/dist/components/people.js +55 -19
- package/dist/components/people.js.map +1 -1
- package/dist/components/picker.d.ts +2 -0
- package/dist/components/picker.d.ts.map +1 -1
- package/dist/components/picker.js +1 -1
- package/dist/components/picker.js.map +1 -1
- package/dist/components/pictures.d.ts +38 -10
- package/dist/components/pictures.d.ts.map +1 -1
- package/dist/components/pictures.js +195 -40
- package/dist/components/pictures.js.map +1 -1
- package/dist/components/plugin-events.d.ts +29 -0
- package/dist/components/plugin-events.d.ts.map +1 -0
- package/dist/components/plugin-events.js +139 -0
- package/dist/components/plugin-events.js.map +1 -0
- package/dist/components/plugin-frame.d.ts.map +1 -1
- package/dist/components/plugin-frame.js +14 -37
- package/dist/components/plugin-frame.js.map +1 -1
- package/dist/components/plugin-settings.d.ts.map +1 -1
- package/dist/components/plugin-settings.js +58 -7
- package/dist/components/plugin-settings.js.map +1 -1
- package/dist/components/projects.d.ts.map +1 -1
- package/dist/components/projects.js +30 -10
- package/dist/components/projects.js.map +1 -1
- package/dist/components/rules.d.ts +8 -10
- package/dist/components/rules.d.ts.map +1 -1
- package/dist/components/rules.js +36 -14
- package/dist/components/rules.js.map +1 -1
- package/dist/components/sessions.d.ts.map +1 -1
- package/dist/components/sessions.js +8 -4
- package/dist/components/sessions.js.map +1 -1
- package/dist/components/setup.d.ts +59 -0
- package/dist/components/setup.d.ts.map +1 -0
- package/dist/components/setup.js +93 -0
- package/dist/components/setup.js.map +1 -0
- package/dist/components/sign-in.js +1 -1
- package/dist/components/sign-in.js.map +1 -1
- package/dist/components/task-form.d.ts.map +1 -1
- package/dist/components/task-form.js +2 -2
- package/dist/components/task-form.js.map +1 -1
- package/dist/components/task-list.d.ts +7 -6
- package/dist/components/task-list.d.ts.map +1 -1
- package/dist/components/task-list.js.map +1 -1
- package/dist/components/task-view.d.ts +3 -0
- package/dist/components/task-view.d.ts.map +1 -1
- package/dist/components/task-view.js +1 -1
- package/dist/components/task-view.js.map +1 -1
- package/dist/components/ui.d.ts +78 -8
- package/dist/components/ui.d.ts.map +1 -1
- package/dist/components/ui.js +88 -9
- package/dist/components/ui.js.map +1 -1
- package/dist/components/work.d.ts +5 -5
- package/dist/components/work.d.ts.map +1 -1
- package/dist/components/work.js.map +1 -1
- package/dist/components/workspace.d.ts +17 -0
- package/dist/components/workspace.d.ts.map +1 -1
- package/dist/components/workspace.js +129 -2
- package/dist/components/workspace.js.map +1 -1
- package/dist/connect-page.d.ts.map +1 -1
- package/dist/connect-page.js +5 -2
- package/dist/connect-page.js.map +1 -1
- package/dist/console.css +7551 -4580
- package/dist/console.d.ts +20 -0
- package/dist/console.d.ts.map +1 -1
- package/dist/console.js +331 -57
- package/dist/console.js.map +1 -1
- package/dist/data.d.ts +22 -1
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +62 -34
- package/dist/data.js.map +1 -1
- package/dist/desk-page.d.ts +38 -0
- package/dist/desk-page.d.ts.map +1 -0
- package/dist/desk-page.js +184 -0
- package/dist/desk-page.js.map +1 -0
- package/dist/desk-records-page.d.ts +18 -0
- package/dist/desk-records-page.d.ts.map +1 -0
- package/dist/desk-records-page.js +130 -0
- package/dist/desk-records-page.js.map +1 -0
- package/dist/desk-records.d.ts +247 -0
- package/dist/desk-records.d.ts.map +1 -0
- package/dist/desk-records.js +543 -0
- package/dist/desk-records.js.map +1 -0
- package/dist/desk.d.ts +122 -0
- package/dist/desk.d.ts.map +1 -0
- package/dist/desk.js +211 -0
- package/dist/desk.js.map +1 -0
- package/dist/feed-stream.d.ts +39 -0
- package/dist/feed-stream.d.ts.map +1 -0
- package/dist/feed-stream.js +117 -0
- package/dist/feed-stream.js.map +1 -0
- package/dist/glances.d.ts +39 -0
- package/dist/glances.d.ts.map +1 -0
- package/dist/glances.js +94 -0
- package/dist/glances.js.map +1 -0
- package/dist/home-tiles.d.ts +69 -5
- package/dist/home-tiles.d.ts.map +1 -1
- package/dist/home-tiles.js +347 -9
- package/dist/home-tiles.js.map +1 -1
- package/dist/i18n/en.d.ts +773 -3
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +770 -9
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/ko.d.ts.map +1 -1
- package/dist/i18n/ko.js +736 -9
- package/dist/i18n/ko.js.map +1 -1
- package/dist/index.d.ts +19 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -5
- package/dist/index.js.map +1 -1
- package/dist/limits.d.ts +67 -0
- package/dist/limits.d.ts.map +1 -1
- package/dist/limits.js +67 -0
- package/dist/limits.js.map +1 -1
- package/dist/onboarding.d.ts +21 -0
- package/dist/onboarding.d.ts.map +1 -0
- package/dist/onboarding.js +43 -0
- package/dist/onboarding.js.map +1 -0
- package/dist/persona.d.ts +34 -0
- package/dist/persona.d.ts.map +1 -0
- package/dist/persona.js +71 -0
- package/dist/persona.js.map +1 -0
- package/dist/plugin/context.d.ts +42 -11
- package/dist/plugin/context.d.ts.map +1 -1
- package/dist/plugin/limits.d.ts +2 -0
- package/dist/plugin/limits.d.ts.map +1 -1
- package/dist/plugin/limits.js +2 -0
- package/dist/plugin/limits.js.map +1 -1
- package/dist/plugin/manifest.d.ts +13 -0
- package/dist/plugin/manifest.d.ts.map +1 -1
- package/dist/plugin/manifest.js +34 -4
- package/dist/plugin/manifest.js.map +1 -1
- package/dist/plugin/rest-schemas.d.ts +56 -0
- package/dist/plugin/rest-schemas.d.ts.map +1 -1
- package/dist/plugin/rest-schemas.js +42 -0
- package/dist/plugin/rest-schemas.js.map +1 -1
- package/dist/plugin/sandbox.d.ts.map +1 -1
- package/dist/plugin/sandbox.js +4 -1
- package/dist/plugin/sandbox.js.map +1 -1
- package/dist/plugin/testing.d.ts +6 -2
- package/dist/plugin/testing.d.ts.map +1 -1
- package/dist/plugin/testing.js +52 -10
- package/dist/plugin/testing.js.map +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +1 -1
- package/dist/plugin.js.map +1 -1
- package/dist/records.d.ts +283 -0
- package/dist/records.d.ts.map +1 -0
- package/dist/records.js +543 -0
- package/dist/records.js.map +1 -0
- package/dist/router.d.ts +50 -3
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +78 -7
- package/dist/router.js.map +1 -1
- package/dist/routes.d.ts +12 -2
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +14 -1
- package/dist/routes.js.map +1 -1
- package/dist/rules.d.ts +30 -11
- package/dist/rules.d.ts.map +1 -1
- package/dist/rules.js +99 -42
- package/dist/rules.js.map +1 -1
- package/dist/runner/acp.d.ts +20 -0
- package/dist/runner/acp.d.ts.map +1 -0
- package/dist/runner/acp.js +1132 -0
- package/dist/runner/acp.js.map +1 -0
- package/dist/runner/claude.d.ts +13 -0
- package/dist/runner/claude.d.ts.map +1 -0
- package/dist/runner/claude.js +615 -0
- package/dist/runner/claude.js.map +1 -0
- package/dist/runner/codex.d.ts +19 -0
- package/dist/runner/codex.d.ts.map +1 -0
- package/dist/runner/codex.js +597 -0
- package/dist/runner/codex.js.map +1 -0
- package/dist/runner/config.d.ts +35 -0
- package/dist/runner/config.d.ts.map +1 -0
- package/dist/runner/config.js +74 -0
- package/dist/runner/config.js.map +1 -0
- package/dist/runner/desk.d.ts +81 -0
- package/dist/runner/desk.d.ts.map +1 -0
- package/dist/runner/desk.js +303 -0
- package/dist/runner/desk.js.map +1 -0
- package/dist/runner/launchd.d.ts +7 -0
- package/dist/runner/launchd.d.ts.map +1 -0
- package/dist/runner/launchd.js +78 -0
- package/dist/runner/launchd.js.map +1 -0
- package/dist/runner/message.d.ts +66 -0
- package/dist/runner/message.d.ts.map +1 -0
- package/dist/runner/message.js +181 -0
- package/dist/runner/message.js.map +1 -0
- package/dist/runner/modules.d.ts +13 -0
- package/dist/runner/modules.d.ts.map +1 -0
- package/dist/runner/modules.js +30 -0
- package/dist/runner/modules.js.map +1 -0
- package/dist/runner/process.d.ts +7 -0
- package/dist/runner/process.d.ts.map +1 -0
- package/dist/runner/process.js +65 -0
- package/dist/runner/process.js.map +1 -0
- package/dist/runner/redact.d.ts +48 -0
- package/dist/runner/redact.d.ts.map +1 -0
- package/dist/runner/redact.js +214 -0
- package/dist/runner/redact.js.map +1 -0
- package/dist/runner/registry.d.ts +37 -0
- package/dist/runner/registry.d.ts.map +1 -0
- package/dist/runner/registry.js +26 -0
- package/dist/runner/registry.js.map +1 -0
- package/dist/runner/runner.d.ts +130 -0
- package/dist/runner/runner.d.ts.map +1 -0
- package/dist/runner/runner.js +1551 -0
- package/dist/runner/runner.js.map +1 -0
- package/dist/runner/slack.d.ts +16 -0
- package/dist/runner/slack.d.ts.map +1 -0
- package/dist/runner/slack.js +157 -0
- package/dist/runner/slack.js.map +1 -0
- package/dist/runner/systemd-user.d.ts +7 -0
- package/dist/runner/systemd-user.d.ts.map +1 -0
- package/dist/runner/systemd-user.js +93 -0
- package/dist/runner/systemd-user.js.map +1 -0
- package/dist/runner/task-scheduler.d.ts +38 -0
- package/dist/runner/task-scheduler.d.ts.map +1 -0
- package/dist/runner/task-scheduler.js +216 -0
- package/dist/runner/task-scheduler.js.map +1 -0
- package/dist/runner/types.d.ts +315 -0
- package/dist/runner/types.d.ts.map +1 -0
- package/dist/runner/types.js +24 -0
- package/dist/runner/types.js.map +1 -0
- package/dist/runner.d.ts +18 -0
- package/dist/runner.d.ts.map +1 -0
- package/dist/runner.js +20 -0
- package/dist/runner.js.map +1 -0
- package/dist/schemas.d.ts +6082 -1295
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +930 -31
- package/dist/schemas.js.map +1 -1
- package/dist/services.d.ts +110 -0
- package/dist/services.d.ts.map +1 -0
- package/dist/services.js +305 -0
- package/dist/services.js.map +1 -0
- package/dist/setup-guide.d.ts +64 -0
- package/dist/setup-guide.d.ts.map +1 -0
- package/dist/setup-guide.js +256 -0
- package/dist/setup-guide.js.map +1 -0
- package/dist/setup-page.d.ts +6 -0
- package/dist/setup-page.d.ts.map +1 -0
- package/dist/setup-page.js +29 -0
- package/dist/setup-page.js.map +1 -0
- package/dist/sse.d.ts +15 -0
- package/dist/sse.d.ts.map +1 -0
- package/dist/sse.js +73 -0
- package/dist/sse.js.map +1 -0
- package/dist/tab-title.d.ts +6 -0
- package/dist/tab-title.d.ts.map +1 -0
- package/dist/tab-title.js +22 -0
- package/dist/tab-title.js.map +1 -0
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +3 -0
- package/dist/tokens.js.map +1 -1
- package/dist/use-action.d.ts +5 -2
- package/dist/use-action.d.ts.map +1 -1
- package/dist/use-action.js +6 -1
- package/dist/use-action.js.map +1 -1
- package/dist/vocabulary.d.ts +84 -4
- package/dist/vocabulary.d.ts.map +1 -1
- package/dist/vocabulary.js +115 -3
- package/dist/vocabulary.js.map +1 -1
- package/docs/specs/cli.md +147 -41
- package/docs/specs/plugins.md +37 -27
- package/docs/specs/records.md +113 -0
- package/docs/specs/rest.md +155 -20
- package/docs/specs/runner.md +347 -0
- package/package.json +12 -3
- package/skills/building-a-console/SKILL.md +4 -4
- package/skills/building-a-console/references/configuring.md +1 -0
- package/skills/building-a-plugin/SKILL.md +7 -7
- package/skills/deploying-a-console/SKILL.md +4 -4
- package/skills/deploying-a-console/references/resources.md +48 -8
- package/skills/deploying-a-console/references/running-it-again.md +3 -2
- package/skills/keeping-a-desk/SKILL.md +133 -0
- package/skills/keeping-a-desk/collections.md +96 -0
- package/skills/planning-the-board/SKILL.md +14 -18
- package/skills/planning-the-board/references/a-task.md +2 -2
- package/skills/planning-the-board/references/project-rules.md +13 -14
- package/skills/planning-the-board/references/setting-up.md +22 -9
- package/skills/running-an-agent/SKILL.md +107 -0
- package/skills/running-an-agent/references/slack-app.md +61 -0
- package/skills/working-the-board/SKILL.md +66 -39
- package/skills/working-the-board/references/terms.md +9 -5
- package/skills/working-the-board/references/the-pack.md +14 -9
- package/skills/working-the-board/references/the-sentence.md +2 -2
- package/src/agent-page.tsx +1039 -0
- package/src/agent-stream.ts +199 -0
- package/src/api.ts +317 -2
- package/src/avatar.ts +1506 -0
- package/src/charts.ts +250 -0
- package/src/cli/cli.ts +3210 -503
- package/src/cli/command-words.ts +56 -0
- package/src/cli/credentials.ts +188 -16
- package/src/cli/directory.ts +28 -10
- package/src/cli/format.ts +470 -67
- package/src/cli/help.ts +233 -61
- package/src/cli/main.ts +89 -0
- package/src/cli/pack.ts +332 -263
- package/src/cli/plugin-check.ts +275 -34
- package/src/cli/plugin-cli.ts +28 -4
- package/src/cli/plugin-main.ts +1 -0
- package/src/cli/runner-host.ts +188 -0
- package/src/cli/serve.ts +320 -5
- package/src/cli/setup-machine.ts +153 -0
- package/src/client.ts +711 -126
- package/src/compat.ts +2 -2
- package/src/components/agent-page.tsx +1946 -0
- package/src/components/agents.tsx +638 -0
- package/src/components/calendar.tsx +74 -53
- package/src/components/charts.tsx +680 -0
- package/src/components/comments.tsx +3 -0
- package/src/components/connect.tsx +37 -2
- package/src/components/decision-form.tsx +89 -51
- package/src/components/decision-list.tsx +140 -4
- package/src/components/desk-records.tsx +724 -0
- package/src/components/desk.tsx +471 -0
- package/src/components/event-feed.tsx +30 -1
- package/src/components/home.tsx +353 -12
- package/src/components/my-decisions.tsx +8 -2
- package/src/components/people.tsx +300 -203
- package/src/components/picker.tsx +3 -1
- package/src/components/pictures.tsx +256 -44
- package/src/components/plugin-events.ts +159 -0
- package/src/components/plugin-frame.tsx +14 -38
- package/src/components/plugin-settings.tsx +178 -22
- package/src/components/projects.tsx +33 -15
- package/src/components/rules.tsx +96 -36
- package/src/components/sessions.tsx +7 -4
- package/src/components/setup.tsx +252 -0
- package/src/components/sign-in.tsx +1 -1
- package/src/components/task-form.tsx +11 -2
- package/src/components/task-list.tsx +7 -6
- package/src/components/task-view.tsx +4 -0
- package/src/components/ui.tsx +169 -25
- package/src/components/work.tsx +9 -9
- package/src/components/workspace.tsx +345 -4
- package/src/connect-page.tsx +15 -2
- package/src/console.tsx +657 -83
- package/src/data.ts +109 -43
- package/src/desk-page.tsx +332 -0
- package/src/desk-records-page.tsx +256 -0
- package/src/desk-records.ts +808 -0
- package/src/desk.ts +329 -0
- package/src/feed-stream.ts +144 -0
- package/src/glances.ts +132 -0
- package/src/home-tiles.ts +411 -9
- package/src/i18n/en.ts +828 -10
- package/src/i18n/ko.ts +792 -10
- package/src/index.ts +172 -3
- package/src/limits.ts +67 -0
- package/src/onboarding.ts +84 -0
- package/src/persona.ts +100 -0
- package/src/plugin/context.ts +55 -12
- package/src/plugin/limits.ts +2 -0
- package/src/plugin/manifest.ts +42 -3
- package/src/plugin/rest-schemas.ts +46 -0
- package/src/plugin/sandbox.ts +4 -1
- package/src/plugin/testing.ts +63 -12
- package/src/plugin.ts +2 -0
- package/src/records.ts +702 -0
- package/src/router.ts +120 -10
- package/src/routes.ts +17 -1
- package/src/rules.ts +109 -44
- package/src/runner/acp.ts +1267 -0
- package/src/runner/claude.ts +695 -0
- package/src/runner/codex.ts +691 -0
- package/src/runner/config.ts +97 -0
- package/src/runner/desk.ts +377 -0
- package/src/runner/launchd.ts +86 -0
- package/src/runner/message.ts +232 -0
- package/src/runner/modules.ts +30 -0
- package/src/runner/process.ts +72 -0
- package/src/runner/redact.ts +242 -0
- package/src/runner/registry.ts +67 -0
- package/src/runner/runner.ts +1879 -0
- package/src/runner/slack.ts +180 -0
- package/src/runner/systemd-user.ts +103 -0
- package/src/runner/task-scheduler.ts +236 -0
- package/src/runner/types.ts +334 -0
- package/src/runner.ts +110 -0
- package/src/schemas.ts +1183 -30
- package/src/services.ts +424 -0
- package/src/setup-guide.ts +336 -0
- package/src/setup-page.tsx +46 -0
- package/src/sse.ts +84 -0
- package/src/styles/README.md +111 -0
- package/src/styles/base.css +130 -0
- package/src/styles/console.css +85 -7095
- package/src/styles/drawn-by-pages.json +256 -0
- package/src/styles/pages/agents.css +1195 -0
- package/src/styles/pages/board.css +380 -0
- package/src/styles/pages/calendar.css +214 -0
- package/src/styles/pages/connect.css +182 -0
- package/src/styles/pages/decisions.css +370 -0
- package/src/styles/pages/desk.css +126 -0
- package/src/styles/pages/documents.css +273 -0
- package/src/styles/pages/feed.css +118 -0
- package/src/styles/pages/home.css +718 -0
- package/src/styles/pages/people.css +90 -0
- package/src/styles/pages/plugins.css +212 -0
- package/src/styles/pages/roadmap.css +377 -0
- package/src/styles/pages/settings.css +171 -0
- package/src/styles/pages/shell.css +208 -0
- package/src/styles/pages/sign-in.css +178 -0
- package/src/styles/pages/task.css +108 -0
- package/src/styles/pages/thread.css +331 -0
- package/src/styles/pages/work.css +68 -0
- package/src/styles/parts/avatar.css +82 -0
- package/src/styles/parts/badge.css +227 -0
- package/src/styles/parts/bars.css +80 -0
- package/src/styles/parts/button.css +99 -0
- package/src/styles/parts/calendar.css +547 -0
- package/src/styles/parts/callout.css +41 -0
- package/src/styles/parts/category.css +8 -0
- package/src/styles/parts/chart.css +173 -0
- package/src/styles/parts/chip.css +90 -0
- package/src/styles/parts/code.css +48 -0
- package/src/styles/parts/count.css +27 -0
- package/src/styles/parts/crumbs.css +61 -0
- package/src/styles/parts/detail.css +110 -0
- package/src/styles/parts/empty.css +21 -0
- package/src/styles/parts/eyebrow.css +9 -0
- package/src/styles/parts/facts.css +147 -0
- package/src/styles/parts/figures.css +65 -0
- package/src/styles/parts/files.css +38 -0
- package/src/styles/parts/filters.css +42 -0
- package/src/styles/parts/form.css +109 -0
- package/src/styles/parts/frame.css +45 -0
- package/src/styles/parts/input.css +243 -0
- package/src/styles/parts/legend.css +48 -0
- package/src/styles/parts/links.css +37 -0
- package/src/styles/parts/mark.css +79 -0
- package/src/styles/parts/menu.css +147 -0
- package/src/styles/parts/page.css +174 -0
- package/src/styles/parts/pager.css +19 -0
- package/src/styles/parts/panel.css +33 -0
- package/src/styles/parts/person.css +257 -0
- package/src/styles/parts/picker.css +185 -0
- package/src/styles/parts/progress.css +25 -0
- package/src/styles/parts/prose.css +128 -0
- package/src/styles/parts/rows.css +63 -0
- package/src/styles/parts/series.css +32 -0
- package/src/styles/parts/settings.css +101 -0
- package/src/styles/parts/share.css +25 -0
- package/src/styles/parts/spark.css +23 -0
- package/src/styles/parts/spinner.css +29 -0
- package/src/styles/parts/stat.css +69 -0
- package/src/styles/parts/steps.css +68 -0
- package/src/styles/parts/tabs.css +175 -0
- package/src/styles/parts/text.css +61 -0
- package/src/styles/parts/toggle.css +71 -0
- package/src/styles/parts/workers.css +37 -0
- package/src/styles/tokens.css +295 -0
- package/src/tab-title.ts +25 -0
- package/src/tokens.ts +3 -0
- package/src/use-action.ts +7 -2
- package/src/vocabulary.ts +151 -3
- package/template/desk-web/README.md +8 -0
- package/template/desk-web/index.html +13 -0
- package/template/desk-web/package.json +25 -0
- package/template/desk-web/src/main.tsx +24 -0
- package/template/desk-web/src/page.tsx +51 -0
- package/template/desk-web/tsconfig.json +16 -0
- package/template/desk-web/vite.config.ts +15 -0
package/src/cli/format.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
1
2
|
import { argUsage } from "../plugin/args.js";
|
|
2
3
|
import type {
|
|
4
|
+
RestAgent,
|
|
5
|
+
RestAgentSecret,
|
|
3
6
|
RestArtifact,
|
|
4
7
|
RestCategory,
|
|
5
8
|
RestComment,
|
|
@@ -7,6 +10,8 @@ import type {
|
|
|
7
10
|
RestDocument,
|
|
8
11
|
RestDocumentSummary,
|
|
9
12
|
RestDocuments,
|
|
13
|
+
RestEvent,
|
|
14
|
+
RestEvents,
|
|
10
15
|
RestGoal,
|
|
11
16
|
RestListing,
|
|
12
17
|
RestMember,
|
|
@@ -17,6 +22,7 @@ import type {
|
|
|
17
22
|
RestPluginDetail,
|
|
18
23
|
RestPluginGrant,
|
|
19
24
|
RestPluginInvocation,
|
|
25
|
+
RestPluginJob,
|
|
20
26
|
RestPluginOperation,
|
|
21
27
|
RestPluginRecord,
|
|
22
28
|
RestPluginRecordPage,
|
|
@@ -29,13 +35,17 @@ import type {
|
|
|
29
35
|
RestRules,
|
|
30
36
|
RestRulesPlugin,
|
|
31
37
|
RestRun,
|
|
38
|
+
RestRunBrief,
|
|
39
|
+
RestSignal,
|
|
32
40
|
RestTask,
|
|
41
|
+
RestTaskBrief,
|
|
33
42
|
RestTeam,
|
|
34
43
|
RestVersion,
|
|
35
44
|
RestVersionSummary,
|
|
36
45
|
RestWork,
|
|
37
46
|
RestWorkspace,
|
|
38
47
|
} from "../schemas.js";
|
|
48
|
+
import { reportCountOf } from "../schemas.js";
|
|
39
49
|
|
|
40
50
|
// What the command prints: one line per thing in a list, a few lines for one thing in full.
|
|
41
51
|
// Plain text, for an agent to read and a person to skim; ids are given, since the commands take
|
|
@@ -94,8 +104,8 @@ const indent = (text: string): string =>
|
|
|
94
104
|
|
|
95
105
|
const asker = (decision: RestDecision): string =>
|
|
96
106
|
decision.run === null
|
|
97
|
-
? decision.raisedBy
|
|
98
|
-
: `${decision.run.agent} for ${decision.raisedBy
|
|
107
|
+
? calledOf(decision.raisedBy)
|
|
108
|
+
: `${decision.run.agent} for ${calledOf(decision.raisedBy)}`;
|
|
99
109
|
|
|
100
110
|
/** One project: its key, its name, what the person is in it, and what waits in it. */
|
|
101
111
|
export function formatProjectLine(project: RestProject): string {
|
|
@@ -122,13 +132,145 @@ export function formatProject(project: RestProject): string {
|
|
|
122
132
|
|
|
123
133
|
/** One person: their login, their name where the host gives one, what they are in the workspace, that they are out when they are, and whom they report to where known. */
|
|
124
134
|
export function formatPersonLine(person: RestPerson, reportsTo?: string | undefined): string {
|
|
125
|
-
|
|
135
|
+
// An agent account says so, and that nobody has signed in with it yet (ADR-0084).
|
|
136
|
+
const standing = [
|
|
137
|
+
...(person.kind === "agent" ? ["agent account"] : []),
|
|
138
|
+
person.role,
|
|
139
|
+
...(person.status === "active" ? [] : ["deactivated"]),
|
|
140
|
+
...(person.invited === true ? ["not signed in yet"] : []),
|
|
141
|
+
].join(", ");
|
|
126
142
|
const line = reportsTo === undefined ? "" : `, reports to ${reportsTo}`;
|
|
127
143
|
// The work email where the console answers one: to an administrator, and for oneself.
|
|
128
144
|
const email = typeof person.email === "string" ? ` <${person.email}>` : "";
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
145
|
+
// Called by its handle too, where it has one; and by what they do, where a title says.
|
|
146
|
+
const who =
|
|
147
|
+
typeof person.handle === "string" ? `${person.login} @${person.handle}` : person.login;
|
|
148
|
+
const called = [person.name, person.title].filter(
|
|
149
|
+
(word): word is string => typeof word === "string" && word.length > 0,
|
|
150
|
+
);
|
|
151
|
+
return called.length === 0
|
|
152
|
+
? `${who}${email} (${standing}${line})`
|
|
153
|
+
: `${who} ${called.join(", ")}${email} (${standing}${line})`;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* One agent account (ADR-0084): its handle, its name and what it does, the login it signs in
|
|
158
|
+
* with, whom it reports to where the asker sees them, and that nobody signed in with it yet or
|
|
159
|
+
* that it is out, where so.
|
|
160
|
+
*/
|
|
161
|
+
export function formatAgentLine(agent: RestAgent): string {
|
|
162
|
+
const { person, manager } = agent;
|
|
163
|
+
const called = [person.name, person.title].filter(
|
|
164
|
+
(word): word is string => typeof word === "string" && word.length > 0,
|
|
165
|
+
);
|
|
166
|
+
const standing = [
|
|
167
|
+
`signs in as ${person.login}`,
|
|
168
|
+
...(manager === null ? [] : [`reports to ${calledOf(manager)}`]),
|
|
169
|
+
...(person.invited === true
|
|
170
|
+
? [
|
|
171
|
+
// At a git host, whether the host said which account the login is (ADR-0126).
|
|
172
|
+
agent.firstSignIn === undefined
|
|
173
|
+
? "not signed in yet"
|
|
174
|
+
: agent.firstSignIn === "account"
|
|
175
|
+
? "not signed in yet, its account confirmed at the host"
|
|
176
|
+
: "not signed in yet, its account not confirmed",
|
|
177
|
+
]
|
|
178
|
+
: []),
|
|
179
|
+
...(person.status === "active" ? [] : ["deactivated"]),
|
|
180
|
+
].join(", ");
|
|
181
|
+
return `@${person.handle ?? person.login} ${called.join(", ")} (${standing})`;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/** What stands for a model or an effort nobody chose: whatever the product runs with by itself. */
|
|
185
|
+
const OWN_CHOICE = "the product's own";
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* One agent account in full: its line, how it stands, what its runner last said of itself and
|
|
189
|
+
* what was chosen for it, where the asker is answered that, and whether they supervise it.
|
|
190
|
+
*/
|
|
191
|
+
export function formatAgent(agent: RestAgent): string {
|
|
192
|
+
const runner = agent.runner ?? null;
|
|
193
|
+
return [
|
|
194
|
+
formatAgentLine(agent),
|
|
195
|
+
`state: ${formatAgentState(agent)}`,
|
|
196
|
+
...(runner === null
|
|
197
|
+
? []
|
|
198
|
+
: [
|
|
199
|
+
...(runner.machine === null
|
|
200
|
+
? []
|
|
201
|
+
: [
|
|
202
|
+
`runner: ${runner.runner ?? "?"} on ${runner.machine.name} (${runner.machine.os}), as ${runner.machine.user}`,
|
|
203
|
+
]),
|
|
204
|
+
...(runner.product === null
|
|
205
|
+
? []
|
|
206
|
+
: [
|
|
207
|
+
`product: ${runner.product.name} ${runner.product.version ?? "of a version it did not say"}${runner.product.tried ? "" : ", a version the driver was not tried with"}`,
|
|
208
|
+
]),
|
|
209
|
+
`set to: model ${runner.settings.model ?? OWN_CHOICE}, effort ${runner.settings.effort ?? OWN_CHOICE}`,
|
|
210
|
+
...(runner.running === null
|
|
211
|
+
? []
|
|
212
|
+
: [
|
|
213
|
+
`runs with: model ${runner.running.model ?? OWN_CHOICE}, effort ${runner.running.effort ?? OWN_CHOICE}`,
|
|
214
|
+
]),
|
|
215
|
+
`signals: ${runner.delivered} of ${runner.latest} delivered`,
|
|
216
|
+
]),
|
|
217
|
+
...(agent.hours === undefined
|
|
218
|
+
? []
|
|
219
|
+
: [
|
|
220
|
+
`day: starts ${agent.hours.dayStart}${agent.hours.dayEnd === null ? ", with no end" : `, ends ${agent.hours.dayEnd}`}, in the workspace's time zone`,
|
|
221
|
+
]),
|
|
222
|
+
...(agent.accounts === undefined || Object.keys(agent.accounts).length === 0
|
|
223
|
+
? []
|
|
224
|
+
: [
|
|
225
|
+
`accounts elsewhere: ${Object.entries(agent.accounts)
|
|
226
|
+
.map(([service, name]) => `${service} ${name}`)
|
|
227
|
+
.join(", ")}`,
|
|
228
|
+
]),
|
|
229
|
+
agent.supervised
|
|
230
|
+
? "You supervise it: an administrator, or above it in the reporting line."
|
|
231
|
+
: "You do not supervise it.",
|
|
232
|
+
].join("\n");
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/** How an agent account stands (ADR-0085), in a few words: the state, why, and when its runner was last heard from. */
|
|
236
|
+
export function formatAgentState(agent: RestAgent): string {
|
|
237
|
+
const state = agent.state ?? null;
|
|
238
|
+
if (state === null) {
|
|
239
|
+
return "no runner has been heard from yet";
|
|
240
|
+
}
|
|
241
|
+
const reason = state.reason === null ? "" : ` (${state.reason.replaceAll("_", " ")})`;
|
|
242
|
+
const heard =
|
|
243
|
+
state.heardAt === null ? "" : `; its runner was last heard from ${moment(state.heardAt)}`;
|
|
244
|
+
return `${state.state}${reason} since ${moment(state.since)}${heard}`;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* One signal of an agent account's record (ADR-0085): its number, its kind, who sent it or where
|
|
249
|
+
* it came from, when, and the first words of what it says.
|
|
250
|
+
*/
|
|
251
|
+
export function formatSignalLine(signal: RestSignal): string {
|
|
252
|
+
const who =
|
|
253
|
+
signal.by === null
|
|
254
|
+
? `${signal.source}${signal.key === null ? "" : `: ${signal.key}`}`
|
|
255
|
+
: `${calledOf(signal.by)}${signal.agent === null ? "" : ` through ${signal.agent}`}`;
|
|
256
|
+
const set =
|
|
257
|
+
signal.set === null
|
|
258
|
+
? ""
|
|
259
|
+
: ` model ${signal.set.model ?? OWN_CHOICE}, effort ${signal.set.effort ?? OWN_CHOICE}`;
|
|
260
|
+
const words = signal.text.replaceAll(/\s+/g, " ").trim();
|
|
261
|
+
const said =
|
|
262
|
+
words.length === 0 ? "" : ` ${words.length > 120 ? `${words.slice(0, 119)}…` : words}`;
|
|
263
|
+
return `#${signal.number} ${signal.kind} ${who} ${moment(signal.at)}${set}${said}`;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/** One secret of an agent account's store (ADR-0087): its name, when it was set and by which side, and the day it ends on where one is known. Never its value. */
|
|
267
|
+
export function formatSecretLine(secret: RestAgentSecret): string {
|
|
268
|
+
const facts = [
|
|
269
|
+
`set ${moment(secret.setAt)}`,
|
|
270
|
+
...(secret.seeded ? ["seeded by a supervisor"] : []),
|
|
271
|
+
...(secret.expiresOn === null ? [] : [`ends on ${secret.expiresOn}`]),
|
|
272
|
+
];
|
|
273
|
+
return `${secret.name} (${facts.join(", ")})`;
|
|
132
274
|
}
|
|
133
275
|
|
|
134
276
|
/** The provider a listing names, as people call it. */
|
|
@@ -144,8 +286,23 @@ export function formatWorkspace(workspace: RestWorkspace): string {
|
|
|
144
286
|
const visibility = workspace.peopleVisibility ?? "everyone";
|
|
145
287
|
const zone = workspace.timeZone ?? null;
|
|
146
288
|
const token = workspace.skills.packToken ?? null;
|
|
289
|
+
const services = Object.entries(workspace.services ?? {}).filter(
|
|
290
|
+
(entry): entry is [string, Record<string, string>] => entry[1] !== undefined,
|
|
291
|
+
);
|
|
147
292
|
return [
|
|
148
293
|
`workspace ${workspace.name}`,
|
|
294
|
+
`handle: ${workspace.handle ?? "none"} domain: ${workspace.domain ?? "none"} (what a name at a service is put together from, with an agent account's handle)`,
|
|
295
|
+
...(services.length === 0
|
|
296
|
+
? ["services: none (what the agents' accounts are made at: identity, git, messenger)"]
|
|
297
|
+
: services.map(
|
|
298
|
+
([role, service]) =>
|
|
299
|
+
`service ${role}: ${[
|
|
300
|
+
service.kind ?? "?",
|
|
301
|
+
...Object.entries(service)
|
|
302
|
+
.filter(([name]) => name !== "kind")
|
|
303
|
+
.map(([name, value]) => `${name}=${value}`),
|
|
304
|
+
].join(", ")}`,
|
|
305
|
+
)),
|
|
149
306
|
`people visibility: ${visibility} (${visibility === "everyone" ? "everyone sees everyone" : "a member sees only the people they share a project with; an administrator sees everyone"})`,
|
|
150
307
|
`week begins on: ${workspace.weekStart ?? "auto"} (auto: the system default, as each device has it)`,
|
|
151
308
|
`time zone: ${zone ?? "none"} (${zone === null ? "moments are printed as the API gives them, in UTC" : "moments are printed in it, as ISO 8601 with its offset"})`,
|
|
@@ -158,7 +315,7 @@ export function formatWorkspace(workspace: RestWorkspace): string {
|
|
|
158
315
|
|
|
159
316
|
/** One member of a project: their login, what they are in it, and since when. */
|
|
160
317
|
export function formatMemberLine(member: RestMember): string {
|
|
161
|
-
return `${member.person
|
|
318
|
+
return `${calledOf(member.person)} ${member.role} (since ${moment(member.addedAt).slice(0, 10)})`;
|
|
162
319
|
}
|
|
163
320
|
|
|
164
321
|
/** The line under a page of a listing that has more after it: how to ask for the next page. */
|
|
@@ -166,12 +323,19 @@ export function formatMore(more: boolean, limit: number, offset: number): string
|
|
|
166
323
|
return more ? `\n... more: --offset ${offset + limit}` : "";
|
|
167
324
|
}
|
|
168
325
|
|
|
169
|
-
/**
|
|
170
|
-
|
|
171
|
-
|
|
326
|
+
/**
|
|
327
|
+
* What a member is called in a line: an agent account by its handle, `@mira`, which the command
|
|
328
|
+
* takes wherever it takes a login (ADR-0084), so that a line tells an agent account from a
|
|
329
|
+
* person; a person by their login.
|
|
330
|
+
*/
|
|
331
|
+
export const calledOf = (person: Pick<RestPerson, "login" | "handle">): string =>
|
|
332
|
+
typeof person.handle === "string" ? `@${person.handle}` : person.login;
|
|
333
|
+
|
|
334
|
+
/** The members at work on a task as a line calls them, in the order they came to it. */
|
|
335
|
+
const logins = (people: readonly RestPerson[]): string => people.map(calledOf).join(", ");
|
|
172
336
|
|
|
173
|
-
export function formatTaskLine(task:
|
|
174
|
-
const notes = [`owner ${task.owner
|
|
337
|
+
export function formatTaskLine(task: RestTaskBrief): string {
|
|
338
|
+
const notes = [`owner ${calledOf(task.owner)}`];
|
|
175
339
|
if (task.workers.length > 0) {
|
|
176
340
|
notes.push(`workers ${logins(task.workers)}`);
|
|
177
341
|
}
|
|
@@ -217,13 +381,16 @@ function scheduleLines(task: RestTask): string[] {
|
|
|
217
381
|
export function formatTask(
|
|
218
382
|
task: RestTask,
|
|
219
383
|
decisions?: readonly RestDecision[],
|
|
220
|
-
runs?: readonly
|
|
384
|
+
runs?: readonly RestRunBrief[],
|
|
221
385
|
comments?: readonly RestComment[],
|
|
386
|
+
/** The address of the task's page at the console, where the command knows it: what a person is given to open. */
|
|
387
|
+
page?: string,
|
|
222
388
|
): string {
|
|
223
389
|
const lines = [
|
|
224
390
|
`#${task.number} ${task.title}`,
|
|
225
|
-
`state: ${task.state} priority: ${task.priority} owner: ${task.owner
|
|
391
|
+
`state: ${task.state} priority: ${task.priority} owner: ${calledOf(task.owner)} workers: ${task.workers.length === 0 ? "nobody" : logins(task.workers)}`,
|
|
226
392
|
`id: ${task.id}${task.parentId === null ? "" : ` part of: ${task.parentId}`}`,
|
|
393
|
+
...(page === undefined ? [] : [pageLine(page)]),
|
|
227
394
|
...(task.agent == null ? [] : [`written through: ${task.agent}`]),
|
|
228
395
|
...scheduleLines(task),
|
|
229
396
|
];
|
|
@@ -263,7 +430,9 @@ export function formatTask(
|
|
|
263
430
|
*/
|
|
264
431
|
export function formatComment(comment: RestComment): string {
|
|
265
432
|
const who =
|
|
266
|
-
comment.agent === null
|
|
433
|
+
comment.agent === null
|
|
434
|
+
? calledOf(comment.author)
|
|
435
|
+
: `${calledOf(comment.author)} as ${comment.agent}`;
|
|
267
436
|
const lines = [` ${who}, ${moment(comment.createdAt)}, comment ${comment.id}:`];
|
|
268
437
|
if (comment.body.trim().length > 0) {
|
|
269
438
|
lines.push(indent(comment.body));
|
|
@@ -276,15 +445,17 @@ export function formatComment(comment: RestComment): string {
|
|
|
276
445
|
return lines.join("\n");
|
|
277
446
|
}
|
|
278
447
|
|
|
279
|
-
export function formatRunLine(run:
|
|
280
|
-
|
|
448
|
+
export function formatRunLine(run: RestRunBrief): string {
|
|
449
|
+
// A run of a listing comes without its reports, counted (`?brief=true`); a run read whole,
|
|
450
|
+
// or from a console from before the brief form, with them.
|
|
451
|
+
const notes = [plural(reportCountOf(run), "report"), plural(run.artifacts.length, "artifact")];
|
|
281
452
|
if (run.waitingFor !== null) {
|
|
282
453
|
notes.push(`waiting for decision ${run.waitingFor}`);
|
|
283
454
|
}
|
|
284
455
|
if (run.endedAt === null) {
|
|
285
456
|
notes.push(`last heard ${moment(run.lastHeardAt)}`);
|
|
286
457
|
}
|
|
287
|
-
return `${run.id} ${run.status} ${run.agent} for ${run.person
|
|
458
|
+
return `${run.id} ${run.status} ${run.agent} for ${calledOf(run.person)} task #${run.taskNumber} (${notes.join(", ")})`;
|
|
288
459
|
}
|
|
289
460
|
|
|
290
461
|
/** One run in full; with where each file handed in is read, when the caller knows. */
|
|
@@ -323,45 +494,174 @@ export function formatArtifact(
|
|
|
323
494
|
return artifact.label === null ? what : `${artifact.label}: ${what}`;
|
|
324
495
|
}
|
|
325
496
|
|
|
326
|
-
/**
|
|
327
|
-
function
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
page
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
}
|
|
497
|
+
/** When a part of the rules was written and by whom, where a page says; nothing for the console's own. */
|
|
498
|
+
function rulesFacts(page: RestRules["page"]): string {
|
|
499
|
+
return page === null
|
|
500
|
+
? ""
|
|
501
|
+
: ` (v${page.version}, by ${writer(page.updatedBy, page.agent)}; ${moment(page.updatedAt)})`;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
/** A part of the rules that has a text: what it is, who wrote it where someone did, and the text as it stands. */
|
|
505
|
+
const formatRulesPart = (head: string, page: RestRules["page"], body: string): string =>
|
|
506
|
+
`${head}${rulesFacts(page)}:\n\n${body.trimEnd()}`;
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* The workspace's rules as a console of before the parts answers them (ADR-0120): whole, the
|
|
510
|
+
* console's own until an administrator writes the organization's in their place, which is
|
|
511
|
+
* what holds on such a console. No command is named for writing them: this one writes what an
|
|
512
|
+
* organization adds, and refuses to on a console that would keep it as the whole.
|
|
513
|
+
*/
|
|
514
|
+
function formatRulesWhole(rules: RestRules): string {
|
|
336
515
|
const head =
|
|
337
516
|
rules.source === "reference"
|
|
338
|
-
?
|
|
339
|
-
: `Rules of ${
|
|
340
|
-
return `${head}\n\n${rules.body.trimEnd()}`;
|
|
517
|
+
? "Rules of the workspace: the console's own, until an administrator writes the organization's."
|
|
518
|
+
: `Rules of the workspace${rulesFacts(rules.page) || " (written)"}:`;
|
|
519
|
+
return `${head}\n\n${(rules.body ?? "").trimEnd()}`;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* The parts of the rules as they are printed for whoever reads them (ADR-0120): what the
|
|
524
|
+
* project adds where the command works in one and it adds something, the plugins' lines in the
|
|
525
|
+
* language they are read in, what the organization adds where it adds something, and the
|
|
526
|
+
* console's rules, which always hold.
|
|
527
|
+
*/
|
|
528
|
+
function rulesParts(rules: RestProjectRules | RestRules, language: string | null | undefined) {
|
|
529
|
+
const named = "workspace" in rules;
|
|
530
|
+
const workspace = named ? rules.workspace : rules;
|
|
531
|
+
const project = named && rules.project.source !== "none" ? rules.project : undefined;
|
|
532
|
+
const count = rules.plugins?.length ?? 0;
|
|
533
|
+
const added = workspace.added ?? null;
|
|
534
|
+
return {
|
|
535
|
+
/** Whether the command works in a project: its rules were asked for, whether it adds any or not. */
|
|
536
|
+
named,
|
|
537
|
+
workspace,
|
|
538
|
+
/** What the project adds, where it adds something. */
|
|
539
|
+
own: project !== undefined && project.body !== null ? project : undefined,
|
|
540
|
+
plugins:
|
|
541
|
+
rules.plugins === undefined || count === 0
|
|
542
|
+
? undefined
|
|
543
|
+
: formatRulesPlugins(rules.plugins, language),
|
|
544
|
+
pluginCount: count,
|
|
545
|
+
/** What the organization adds, where it adds something and the console says the parts. */
|
|
546
|
+
added: workspace.own === undefined || added === null ? undefined : added,
|
|
547
|
+
/** The console's rules by themselves; nothing from a console of before, which answers the whole. */
|
|
548
|
+
console: workspace.own,
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* The mark of the rules (ADR-0119): the first eight hex characters of a SHA-256 over what they
|
|
554
|
+
* say to whoever reads them: the workspace's text whole, which is the console's rules with
|
|
555
|
+
* what the organization adds (ADR-0120), what the project adds, and the plugins' lines, in the
|
|
556
|
+
* language they are read in. A session that was shown the rules holds their mark, and a later
|
|
557
|
+
* take of that session leaves out the rules the mark stands for; nothing but having been shown
|
|
558
|
+
* them gives it. When they were written and by whom is no part of it: the same rules have the
|
|
559
|
+
* same mark, and a project that adds nothing has the workspace's.
|
|
560
|
+
*/
|
|
561
|
+
export function rulesMark(
|
|
562
|
+
rules: RestProjectRules | RestRules,
|
|
563
|
+
language?: string | null | undefined,
|
|
564
|
+
): string {
|
|
565
|
+
const parts = rulesParts(rules, language);
|
|
566
|
+
return createHash("sha256")
|
|
567
|
+
.update(
|
|
568
|
+
JSON.stringify([
|
|
569
|
+
(parts.workspace.body ?? "").trimEnd(),
|
|
570
|
+
parts.own === undefined ? null : (parts.own.body ?? "").trimEnd(),
|
|
571
|
+
parts.plugins ?? null,
|
|
572
|
+
]),
|
|
573
|
+
)
|
|
574
|
+
.digest("hex")
|
|
575
|
+
.slice(0, 8);
|
|
341
576
|
}
|
|
342
577
|
|
|
578
|
+
/** How long a text of the rules is, as its first line says it. */
|
|
579
|
+
const charactersOf = (text: string | null): string => `${(text ?? "").trimEnd().length} characters`;
|
|
580
|
+
|
|
343
581
|
/**
|
|
344
|
-
* The rules that hold
|
|
345
|
-
*
|
|
582
|
+
* The rules that hold, under a first line that says what follows (ADR-0119): the mark, which
|
|
583
|
+
* parts there are and how long each is, and how a later take of the session leaves them out.
|
|
584
|
+
* What differs stands first and what always holds last (ADR-0120): what the project adds with
|
|
585
|
+
* the plugins' lines, then what the organization adds, then the console's rules. An agent that
|
|
586
|
+
* had read the long part once cut every later print at its head, and never saw what stood
|
|
587
|
+
* after it; and where they differ it is the earlier part that holds. Who adds nothing is said
|
|
588
|
+
* in a clause of the line, and has no part.
|
|
346
589
|
*/
|
|
347
590
|
export function formatRules(
|
|
348
591
|
rules: RestProjectRules | RestRules,
|
|
349
592
|
language?: string | null | undefined,
|
|
350
593
|
): string {
|
|
351
|
-
const parts =
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
}
|
|
362
|
-
|
|
594
|
+
const parts = rulesParts(rules, language);
|
|
595
|
+
const mark = rulesMark(rules, language);
|
|
596
|
+
// A console of before answers the workspace's rules whole: they are the last part then.
|
|
597
|
+
const whole = parts.console === undefined;
|
|
598
|
+
const last = whole
|
|
599
|
+
? `the workspace's (${charactersOf(parts.workspace.body)})`
|
|
600
|
+
: `the console's (${charactersOf(parts.console ?? null)})`;
|
|
601
|
+
const lastFollows = whole
|
|
602
|
+
? `the workspace's follow (${charactersOf(parts.workspace.body)})`
|
|
603
|
+
: `the console's follow (${charactersOf(parts.console ?? null)})`;
|
|
604
|
+
const plugins = `${parts.pluginCount} plugin${parts.pluginCount === 1 ? "" : "s"}`;
|
|
605
|
+
const HOLDS = "the earlier holding where they differ";
|
|
606
|
+
/** The organization's part and the last, after whatever stood before them. */
|
|
607
|
+
const rest = (first: boolean): string =>
|
|
608
|
+
parts.added === undefined
|
|
609
|
+
? last
|
|
610
|
+
: `the organization's${first ? " additions first" : ""} (${charactersOf(parts.added.body)}), then ${last}`;
|
|
611
|
+
let follows: string;
|
|
612
|
+
if (parts.own !== undefined) {
|
|
613
|
+
follows = `this project's additions first (${charactersOf(parts.own.body)})${parts.plugins === undefined ? "" : ` with its ${plugins}`}, then ${rest(false)}, ${HOLDS}${whole || parts.added !== undefined ? "" : "; the organization adds nothing"}.`;
|
|
614
|
+
} else {
|
|
615
|
+
const nobody = parts.added === undefined && !whole;
|
|
616
|
+
const lead = parts.named
|
|
617
|
+
? nobody
|
|
618
|
+
? "this project and the organization add nothing; "
|
|
619
|
+
: "this project adds nothing; "
|
|
620
|
+
: nobody
|
|
621
|
+
? "the organization adds nothing; "
|
|
622
|
+
: "";
|
|
623
|
+
const theirs = parts.named ? `its ${plugins}` : `the ${plugins} you may use`;
|
|
624
|
+
const body =
|
|
625
|
+
parts.plugins !== undefined
|
|
626
|
+
? `${theirs} first, then ${parts.added === undefined ? last : `the organization's additions (${charactersOf(parts.added.body)}), then ${last}, ${HOLDS}`}`
|
|
627
|
+
: parts.added === undefined
|
|
628
|
+
? parts.named || nobody
|
|
629
|
+
? lastFollows
|
|
630
|
+
: last
|
|
631
|
+
: `${rest(true)}, ${HOLDS}`;
|
|
632
|
+
follows = `${lead}${body}${parts.named ? "." : "; no project is named here, and a project's additions stand before them where it has some."}`;
|
|
633
|
+
}
|
|
634
|
+
// The mark ends the line bare, so that it is copied as it is.
|
|
635
|
+
const later = parts.named
|
|
636
|
+
? ` A later take in this session leaves them out: console take <number> --rules ${mark}`
|
|
637
|
+
: "";
|
|
638
|
+
return [
|
|
639
|
+
`Rules ${mark}: ${follows}${later}`,
|
|
640
|
+
...(parts.own === undefined
|
|
641
|
+
? []
|
|
642
|
+
: ["", formatRulesPart("What this project adds", parts.own.page, parts.own.body ?? "")]),
|
|
643
|
+
...(parts.plugins === undefined ? [] : ["", parts.plugins]),
|
|
644
|
+
...(parts.added === undefined
|
|
645
|
+
? []
|
|
646
|
+
: ["", formatRulesPart("What this organization adds", parts.added.page, parts.added.body)]),
|
|
647
|
+
"",
|
|
648
|
+
parts.console === undefined
|
|
649
|
+
? formatRulesWhole(parts.workspace)
|
|
650
|
+
: formatRulesPart("The console's rules, which always hold", null, parts.console),
|
|
651
|
+
].join("\n");
|
|
363
652
|
}
|
|
364
653
|
|
|
654
|
+
/** What a take says, before the task, where it was told the mark the rules have (ADR-0119): they are left out. */
|
|
655
|
+
export const formatRulesLeftOut = (mark: string): string =>
|
|
656
|
+
`Rules ${mark}: left out, since they stand as this session read them. console rules prints them.`;
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* What a take says, before the task, where it was told a mark the rules do not have (ADR-0119):
|
|
660
|
+
* the rules then follow the task whole, as they do without a mark.
|
|
661
|
+
*/
|
|
662
|
+
export const formatRulesChanged = (given: string): string =>
|
|
663
|
+
`The rules are not the ones marked ${given}: they changed since, or that mark is of another project's. They follow whole after the task, under the mark they have now.`;
|
|
664
|
+
|
|
365
665
|
/** How far a goal is, from its tasks: the done, the at work, and the rest, in one phrase. */
|
|
366
666
|
function progressOf(goal: RestGoal): string {
|
|
367
667
|
const counts = goal.taskCounts;
|
|
@@ -382,10 +682,10 @@ export function formatGoalLine(goal: RestGoal): string {
|
|
|
382
682
|
}
|
|
383
683
|
|
|
384
684
|
/** One goal in full; with the tasks that work towards it, when given. */
|
|
385
|
-
export function formatGoal(goal: RestGoal, tasks?: readonly
|
|
685
|
+
export function formatGoal(goal: RestGoal, tasks?: readonly RestTaskBrief[]): string {
|
|
386
686
|
const lines = [
|
|
387
687
|
`goal ${goal.id}: ${goal.title}`,
|
|
388
|
-
`state: ${goal.state} category: ${goal.category?.key ?? "none"} starts: ${goal.startsOn ?? "none"} due: ${goal.dueOn ?? "none"} set by: ${goal.createdBy
|
|
688
|
+
`state: ${goal.state} category: ${goal.category?.key ?? "none"} starts: ${goal.startsOn ?? "none"} due: ${goal.dueOn ?? "none"} set by: ${calledOf(goal.createdBy)}${through(goal.agent)}`,
|
|
389
689
|
`progress: ${progressOf(goal)}`,
|
|
390
690
|
];
|
|
391
691
|
if (goal.body.trim().length > 0) {
|
|
@@ -429,10 +729,10 @@ export function formatWork(work: RestWork): string {
|
|
|
429
729
|
/** Another person's plate: their open tasks, each with its project; no decisions, which wait for anyone. */
|
|
430
730
|
export function formatPersonWork(person: RestPerson, work: RestPersonWork): string {
|
|
431
731
|
if (work.tasks.length === 0) {
|
|
432
|
-
return `No open task is on ${person
|
|
732
|
+
return `No open task is on ${calledOf(person)}'s plate.`;
|
|
433
733
|
}
|
|
434
734
|
return [
|
|
435
|
-
`tasks ${person
|
|
735
|
+
`tasks ${calledOf(person)} works on:`,
|
|
436
736
|
...work.tasks.map(({ project, task }) => ` ${project.key} ${formatTaskLine(task)}`),
|
|
437
737
|
].join("\n");
|
|
438
738
|
}
|
|
@@ -449,9 +749,7 @@ const decidersOf = (decision: RestDecision): readonly RestPerson[] =>
|
|
|
449
749
|
|
|
450
750
|
/** The logins of everyone a decision is addressed to, with commas between. */
|
|
451
751
|
export const deciderLogins = (decision: RestDecision): string =>
|
|
452
|
-
decidersOf(decision)
|
|
453
|
-
.map((person) => person.login)
|
|
454
|
-
.join(", ");
|
|
752
|
+
decidersOf(decision).map(calledOf).join(", ");
|
|
455
753
|
|
|
456
754
|
/** Whom a decision is for, where that is not the one who asked alone (ADR-0042, ADR-0057). */
|
|
457
755
|
const addressed = (decision: RestDecision): string =>
|
|
@@ -459,9 +757,13 @@ const addressed = (decision: RestDecision): string =>
|
|
|
459
757
|
? ""
|
|
460
758
|
: `, for ${deciderLogins(decision)}`;
|
|
461
759
|
|
|
760
|
+
/**
|
|
761
|
+
* One decision in a line, with when it was asked: a decision that waits holds a run, and whoever
|
|
762
|
+
* is told what is on their plate is told since when each one waits.
|
|
763
|
+
*/
|
|
462
764
|
export function formatDecisionLine(decision: RestDecision): string {
|
|
463
765
|
const state = decision.answer === null ? "waiting" : `answered ${decision.answer.option}`;
|
|
464
|
-
return `${decision.id} ${state} ${decision.question} (asked by ${asker(decision)}${addressed(decision)})`;
|
|
766
|
+
return `${decision.id} ${state} ${decision.question} (asked by ${asker(decision)}${addressed(decision)}, at ${moment(decision.createdAt)})`;
|
|
465
767
|
}
|
|
466
768
|
|
|
467
769
|
/** The options, one a line; the person's own answer, when they wrote one, is the last and says so. */
|
|
@@ -482,7 +784,7 @@ export function formatAnswer(decision: RestDecision): string {
|
|
|
482
784
|
}
|
|
483
785
|
const chosen = decision.options.find((option) => option.id === answer.option);
|
|
484
786
|
const lines = [
|
|
485
|
-
`Answered: ${answer.option}) ${chosen?.label ?? answer.option}${chosen?.own === true ? ", in their own words" : ""}, by ${answer.by
|
|
787
|
+
`Answered: ${answer.option}) ${chosen?.label ?? answer.option}${chosen?.own === true ? ", in their own words" : ""}, by ${calledOf(answer.by)}${through(answer.agent)} at ${moment(answer.at)}`,
|
|
486
788
|
];
|
|
487
789
|
if (answer.note !== null && answer.note.length > 0) {
|
|
488
790
|
lines.push(`Note: ${answer.note}`);
|
|
@@ -490,6 +792,13 @@ export function formatAnswer(decision: RestDecision): string {
|
|
|
490
792
|
return lines.join("\n");
|
|
491
793
|
}
|
|
492
794
|
|
|
795
|
+
/**
|
|
796
|
+
* The address of a task's or a decision's page, on a line of its own: what an agent gives a
|
|
797
|
+
* person to open, in place of the console's front page, or of a number a git host would take
|
|
798
|
+
* for an issue of its own.
|
|
799
|
+
*/
|
|
800
|
+
export const pageLine = (page: string): string => `page: ${page}`;
|
|
801
|
+
|
|
493
802
|
/**
|
|
494
803
|
* One decision in full. A decision reached at its own address (ADR-0068), outside the project the
|
|
495
804
|
* command works in, names its files with the command that reads them there, by the decision too:
|
|
@@ -497,7 +806,11 @@ export function formatAnswer(decision: RestDecision): string {
|
|
|
497
806
|
*/
|
|
498
807
|
export function formatDecision(
|
|
499
808
|
decision: RestDecision,
|
|
500
|
-
options: {
|
|
809
|
+
options: {
|
|
810
|
+
readonly atItsAddress?: boolean;
|
|
811
|
+
/** The address of the decision's page at the console, where the command knows it. */
|
|
812
|
+
readonly page?: string | undefined;
|
|
813
|
+
} = {},
|
|
501
814
|
): string {
|
|
502
815
|
const reads = (fileId: string): string =>
|
|
503
816
|
options.atItsAddress === true
|
|
@@ -505,7 +818,8 @@ export function formatDecision(
|
|
|
505
818
|
: `console file ${fileId}`;
|
|
506
819
|
const lines = [
|
|
507
820
|
`decision ${decision.id}: ${decision.question}`,
|
|
508
|
-
`asked by ${asker(decision)}${addressed(decision)}${decision.taskNumber === null ? "" : `, about task #${decision.taskNumber}`}`,
|
|
821
|
+
`asked by ${asker(decision)}${addressed(decision)}${decision.taskNumber === null ? "" : `, about task #${decision.taskNumber}`}, at ${moment(decision.createdAt)}`,
|
|
822
|
+
...(options.page === undefined ? [] : [pageLine(options.page)]),
|
|
509
823
|
];
|
|
510
824
|
if (decision.body.trim().length > 0) {
|
|
511
825
|
lines.push("", decision.body.trimEnd());
|
|
@@ -527,7 +841,7 @@ export function formatDecision(
|
|
|
527
841
|
if (decision.outcomeBy != null && decision.outcomeAt != null) {
|
|
528
842
|
lines.push(
|
|
529
843
|
indent(
|
|
530
|
-
`written by ${decision.outcomeBy
|
|
844
|
+
`written by ${calledOf(decision.outcomeBy)}${through(decision.outcomeAgent)} at ${moment(decision.outcomeAt)}`,
|
|
531
845
|
),
|
|
532
846
|
);
|
|
533
847
|
}
|
|
@@ -537,7 +851,7 @@ export function formatDecision(
|
|
|
537
851
|
|
|
538
852
|
/** Who wrote a version, and through which agent. */
|
|
539
853
|
const writer = (by: { readonly login: string }, agent: string | null): string =>
|
|
540
|
-
agent === null ? by
|
|
854
|
+
agent === null ? calledOf(by) : `${agent} for ${calledOf(by)}`;
|
|
541
855
|
|
|
542
856
|
/** One document in a list: its path, its title, its version, who wrote it last and when. */
|
|
543
857
|
export function formatDocumentLine(document: RestDocumentSummary): string {
|
|
@@ -768,21 +1082,40 @@ export function formatPluginHelp(detail: RestPluginDetail, name: string | undefi
|
|
|
768
1082
|
return parts.join("\n");
|
|
769
1083
|
}
|
|
770
1084
|
|
|
771
|
-
/**
|
|
1085
|
+
/** When a secret was set, from where where it was sealed from an answer, and when it expires: never what it holds. */
|
|
1086
|
+
function secretStanding(standing: {
|
|
1087
|
+
readonly setAt: string | null;
|
|
1088
|
+
readonly source?: string | null | undefined;
|
|
1089
|
+
readonly expiresAt?: string | null | undefined;
|
|
1090
|
+
}): string {
|
|
1091
|
+
return `set${standing.setAt === null ? "" : ` ${moment(standing.setAt)}`}${
|
|
1092
|
+
standing.source === null || standing.source === undefined || standing.source === "administrator"
|
|
1093
|
+
? ""
|
|
1094
|
+
: ` from ${standing.source}`
|
|
1095
|
+
}${standing.expiresAt === null || standing.expiresAt === undefined ? "" : `, expires ${moment(standing.expiresAt)}`}`;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
/**
|
|
1099
|
+
* A setting in a line: its key and type, what it holds or whether it is set, and its name; for a
|
|
1100
|
+
* secret kept per key (ADR-0111), how many keys of how many, and a line under it for each key.
|
|
1101
|
+
*/
|
|
772
1102
|
export function formatPluginSettingLine(
|
|
773
1103
|
setting: RestPluginSetting,
|
|
774
1104
|
language: string | null | undefined,
|
|
775
1105
|
): string {
|
|
1106
|
+
const keys = setting.keys ?? null;
|
|
1107
|
+
if (setting.type === "secret" && keys !== null) {
|
|
1108
|
+
const max = setting.keyed?.max;
|
|
1109
|
+
const count = `${keys.length}${max === undefined ? "" : ` of ${max}`} ${keys.length === 1 && max === undefined ? "key" : "keys"}`;
|
|
1110
|
+
return [
|
|
1111
|
+
` ${setting.key} (secret, per key): ${count} ${localized(setting.name, language)}`,
|
|
1112
|
+
...keys.map((kept) => ` ${kept.key}: ${secretStanding(kept)}`),
|
|
1113
|
+
].join("\n");
|
|
1114
|
+
}
|
|
776
1115
|
const holds =
|
|
777
1116
|
setting.type === "secret"
|
|
778
1117
|
? setting.set
|
|
779
|
-
?
|
|
780
|
-
setting.source === null ||
|
|
781
|
-
setting.source === undefined ||
|
|
782
|
-
setting.source === "administrator"
|
|
783
|
-
? ""
|
|
784
|
-
: ` from ${setting.source}`
|
|
785
|
-
}${setting.expiresAt === null || setting.expiresAt === undefined ? "" : `, expires ${moment(setting.expiresAt)}`}`
|
|
1118
|
+
? secretStanding(setting)
|
|
786
1119
|
: "not set"
|
|
787
1120
|
: setting.set
|
|
788
1121
|
? setting.value === null
|
|
@@ -802,7 +1135,7 @@ export function formatPluginGrantLine(grant: RestPluginGrant): string {
|
|
|
802
1135
|
: grant.team !== null && grant.team !== undefined
|
|
803
1136
|
? `the team ${grant.team.key}`
|
|
804
1137
|
: grant.person !== null
|
|
805
|
-
? `person ${grant.person
|
|
1138
|
+
? `person ${calledOf(grant.person)}`
|
|
806
1139
|
: grant.project !== null
|
|
807
1140
|
? `the members of ${grant.project.key}`
|
|
808
1141
|
: "everyone";
|
|
@@ -816,6 +1149,68 @@ export function formatTeamLine(team: RestTeam, loginOf: ReadonlyMap<string, stri
|
|
|
816
1149
|
return `${team.key} ${team.name} ${count}${logins.length === 0 ? "" : `: ${logins.join(", ")}`}`;
|
|
817
1150
|
}
|
|
818
1151
|
|
|
1152
|
+
/**
|
|
1153
|
+
* A job of a plugin in a line (ADR-0128): its name and how often it runs, how its last run went
|
|
1154
|
+
* and since when it has failed where it keeps failing, and when it runs next.
|
|
1155
|
+
*/
|
|
1156
|
+
export function formatPluginJobLine(job: RestPluginJob): string {
|
|
1157
|
+
const schedule = `every ${job.every}${job.at === null ? "" : ` at ${job.at}`}`;
|
|
1158
|
+
const last =
|
|
1159
|
+
job.lastRunAt === null || job.lastOutcome === null
|
|
1160
|
+
? "has not run yet"
|
|
1161
|
+
: `last run ${moment(job.lastRunAt)}: ${job.lastOutcome}${
|
|
1162
|
+
job.lastOutcome === "failed" && job.failedSince !== null
|
|
1163
|
+
? `, failing since ${moment(job.failedSince)}`
|
|
1164
|
+
: ""
|
|
1165
|
+
}`;
|
|
1166
|
+
return ` ${job.name} ${schedule} ${last} next: ${job.nextAt === null ? "not scheduled" : moment(job.nextAt)}`;
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
/** What an event of a plugin says, after its kind: what failed, which command and how it ended, else what it carries. */
|
|
1170
|
+
function pluginEventSays(event: RestEvent): string {
|
|
1171
|
+
const data = event.data;
|
|
1172
|
+
if (event.kind === "plugin.failed") {
|
|
1173
|
+
return data.problem ?? "";
|
|
1174
|
+
}
|
|
1175
|
+
if (event.kind === "plugin.command") {
|
|
1176
|
+
return `${data.command ?? "?"} ${data.outcome ?? "?"}${data.code === undefined ? "" : ` (${data.code})`}${
|
|
1177
|
+
data.durationMs === undefined ? "" : `, ${data.durationMs} ms`
|
|
1178
|
+
}`;
|
|
1179
|
+
}
|
|
1180
|
+
const carried = JSON.stringify(data);
|
|
1181
|
+
return carried === "{}" ? "" : carried.length > 300 ? `${carried.slice(0, 300)}...` : carried;
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
/** One event of a plugin in a line: its number, when, its kind, who did it and through what, and what it says. */
|
|
1185
|
+
export function formatPluginEventLine(event: RestEvent): string {
|
|
1186
|
+
const who =
|
|
1187
|
+
event.actor === null
|
|
1188
|
+
? "the console"
|
|
1189
|
+
: `${calledOf(event.actor)}${event.agent === null ? "" : ` as ${event.agent}`}`;
|
|
1190
|
+
const says = pluginEventSays(event);
|
|
1191
|
+
return `#${event.id} ${moment(event.createdAt)} ${event.kind} ${who}${says === "" ? "" : ` ${says}`}`;
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
/**
|
|
1195
|
+
* A page of a plugin's events, newest first (ADR-0128), of one kind where one was asked for:
|
|
1196
|
+
* what `console plugin <key> events` prints, with how to read on. The console answers what the
|
|
1197
|
+
* caller may read and says nothing of the rest, so an empty page is said as that, and never as
|
|
1198
|
+
* a plugin that has no events.
|
|
1199
|
+
*/
|
|
1200
|
+
export function formatPluginEvents(
|
|
1201
|
+
key: string,
|
|
1202
|
+
page: RestEvents,
|
|
1203
|
+
asked: { readonly kind: string | undefined; readonly limit: number; readonly offset: number },
|
|
1204
|
+
): string {
|
|
1205
|
+
if (page.items.length === 0) {
|
|
1206
|
+
const none = `No ${asked.kind === undefined ? "" : `${asked.kind} `}event of ${key} that you may read${
|
|
1207
|
+
asked.offset > 0 ? ", that far back" : ""
|
|
1208
|
+
}.`;
|
|
1209
|
+
return `${none}${formatMore(page.more, asked.limit, asked.offset)}`;
|
|
1210
|
+
}
|
|
1211
|
+
return `${page.items.map(formatPluginEventLine).join("\n")}${formatMore(page.more, asked.limit, asked.offset)}`;
|
|
1212
|
+
}
|
|
1213
|
+
|
|
819
1214
|
/** One plugin in full: what it is, how it stands, what one may run, its skills and its settings. */
|
|
820
1215
|
export function formatPlugin(
|
|
821
1216
|
detail: RestPluginDetail,
|
|
@@ -866,6 +1261,14 @@ export function formatPlugin(
|
|
|
866
1261
|
`Skills: console plugin ${detail.key} skills lists them; console plugin ${detail.key} skill <path> reads one. Read the one that fits before the first command.`,
|
|
867
1262
|
);
|
|
868
1263
|
}
|
|
1264
|
+
// A console before 0.5.1 names no jobs: nothing is printed of them then, not an empty block.
|
|
1265
|
+
if (detail.jobs !== undefined && detail.jobs.length > 0) {
|
|
1266
|
+
lines.push(
|
|
1267
|
+
"",
|
|
1268
|
+
`Jobs (what went wrong in one: console plugin ${detail.key} events --kind plugin.failed):`,
|
|
1269
|
+
...detail.jobs.map(formatPluginJobLine),
|
|
1270
|
+
);
|
|
1271
|
+
}
|
|
869
1272
|
if (detail.settings.length > 0) {
|
|
870
1273
|
lines.push(
|
|
871
1274
|
"",
|