@skillcdn/console 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +87 -12
- package/SKILLCDN.md +3 -3
- package/dist/agent-page.d.ts.map +1 -1
- package/dist/agent-page.js +7 -6
- package/dist/agent-page.js.map +1 -1
- package/dist/api.d.ts +9 -7
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +8 -6
- package/dist/api.js.map +1 -1
- 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 +58 -2
- package/dist/cli/cli.d.ts.map +1 -1
- package/dist/cli/cli.js +1742 -472
- 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 +54 -5
- package/dist/cli/credentials.d.ts.map +1 -1
- package/dist/cli/credentials.js +126 -20
- 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 +70 -9
- package/dist/cli/format.d.ts.map +1 -1
- package/dist/cli/format.js +267 -40
- 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 +101 -58
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/machine-check.d.ts +36 -0
- package/dist/cli/machine-check.d.ts.map +1 -0
- package/dist/cli/machine-check.js +151 -0
- package/dist/cli/machine-check.js.map +1 -0
- package/dist/cli/main.js +76 -2
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/pack.d.ts +69 -60
- package/dist/cli/pack.d.ts.map +1 -1
- package/dist/cli/pack.js +241 -270
- 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 +7 -0
- package/dist/cli/runner-host.d.ts.map +1 -1
- package/dist/cli/runner-host.js +2 -0
- package/dist/cli/runner-host.js.map +1 -1
- package/dist/cli/secret-notes.d.ts +8 -0
- package/dist/cli/secret-notes.d.ts.map +1 -0
- package/dist/cli/secret-notes.js +48 -0
- package/dist/cli/secret-notes.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 +252 -3
- package/dist/cli/serve.js.map +1 -1
- package/dist/client.d.ts +54 -9
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +77 -80
- package/dist/client.js.map +1 -1
- package/dist/components/agent-page.d.ts +164 -8
- package/dist/components/agent-page.d.ts.map +1 -1
- package/dist/components/agent-page.js +588 -151
- package/dist/components/agent-page.js.map +1 -1
- package/dist/components/agents.d.ts.map +1 -1
- package/dist/components/agents.js +1 -1
- package/dist/components/agents.js.map +1 -1
- package/dist/components/board.d.ts.map +1 -1
- package/dist/components/board.js +3 -2
- package/dist/components/board.js.map +1 -1
- package/dist/components/categories.js +1 -1
- package/dist/components/categories.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/decision-list.d.ts.map +1 -1
- package/dist/components/decision-list.js +1 -1
- 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 +7 -3
- package/dist/components/event-feed.js.map +1 -1
- package/dist/components/goals.d.ts +2 -0
- package/dist/components/goals.d.ts.map +1 -1
- package/dist/components/goals.js +1 -1
- package/dist/components/goals.js.map +1 -1
- package/dist/components/home.d.ts.map +1 -1
- package/dist/components/home.js +14 -6
- package/dist/components/home.js.map +1 -1
- package/dist/components/icon.d.ts +31 -0
- package/dist/components/icon.d.ts.map +1 -0
- package/dist/components/icon.js +169 -0
- package/dist/components/icon.js.map +1 -0
- package/dist/components/markdown.d.ts +6 -0
- package/dist/components/markdown.d.ts.map +1 -1
- package/dist/components/markdown.js +10 -2
- package/dist/components/markdown.js.map +1 -1
- package/dist/components/people.js +1 -1
- package/dist/components/people.js.map +1 -1
- package/dist/components/plugin-frame.d.ts.map +1 -1
- package/dist/components/plugin-frame.js +7 -0
- 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 +54 -3
- package/dist/components/plugin-settings.js.map +1 -1
- package/dist/components/projects.d.ts +17 -4
- package/dist/components/projects.d.ts.map +1 -1
- package/dist/components/projects.js +51 -12
- 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 +35 -13
- package/dist/components/rules.js.map +1 -1
- package/dist/components/sessions.d.ts.map +1 -1
- package/dist/components/sessions.js +3 -2
- package/dist/components/sessions.js.map +1 -1
- package/dist/components/setup.d.ts +9 -3
- package/dist/components/setup.d.ts.map +1 -1
- package/dist/components/setup.js +12 -6
- package/dist/components/setup.js.map +1 -1
- package/dist/components/shell.d.ts.map +1 -1
- package/dist/components/shell.js +3 -2
- package/dist/components/shell.js.map +1 -1
- package/dist/components/tokens.js +1 -1
- package/dist/components/tokens.js.map +1 -1
- package/dist/components/ui.d.ts +5 -2
- package/dist/components/ui.d.ts.map +1 -1
- package/dist/components/ui.js +10 -7
- package/dist/components/ui.js.map +1 -1
- package/dist/connect-page.js +1 -1
- package/dist/connect-page.js.map +1 -1
- package/dist/console.css +1172 -106
- package/dist/console.d.ts +5 -0
- package/dist/console.d.ts.map +1 -1
- package/dist/console.js +52 -39
- package/dist/console.js.map +1 -1
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +32 -33
- 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/home-tiles.d.ts +19 -3
- package/dist/home-tiles.d.ts.map +1 -1
- package/dist/home-tiles.js +147 -42
- package/dist/home-tiles.js.map +1 -1
- package/dist/i18n/en.d.ts +228 -6
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +309 -9
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/ko.d.ts.map +1 -1
- package/dist/i18n/ko.js +366 -85
- package/dist/i18n/ko.js.map +1 -1
- package/dist/i18n/particles.d.ts +7 -0
- package/dist/i18n/particles.d.ts.map +1 -0
- package/dist/i18n/particles.js +72 -0
- package/dist/i18n/particles.js.map +1 -0
- package/dist/icons/glyphs.d.ts +605 -0
- package/dist/icons/glyphs.d.ts.map +1 -0
- package/dist/icons/glyphs.js +104 -0
- package/dist/icons/glyphs.js.map +1 -0
- package/dist/icons/index.d.ts +59 -0
- package/dist/icons/index.d.ts.map +1 -0
- package/dist/icons/index.js +157 -0
- package/dist/icons/index.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/limits.d.ts +20 -0
- package/dist/limits.d.ts.map +1 -1
- package/dist/limits.js +20 -0
- package/dist/limits.js.map +1 -1
- package/dist/marks.d.ts +9 -0
- package/dist/marks.d.ts.map +1 -1
- package/dist/marks.js +9 -0
- package/dist/marks.js.map +1 -1
- package/dist/onboarding.d.ts +6 -0
- package/dist/onboarding.d.ts.map +1 -1
- package/dist/onboarding.js +5 -5
- package/dist/onboarding.js.map +1 -1
- 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 +30 -3
- package/dist/plugin/manifest.js.map +1 -1
- package/dist/plugin/rest-schemas.d.ts +55 -0
- package/dist/plugin/rest-schemas.d.ts.map +1 -1
- package/dist/plugin/rest-schemas.js +37 -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/web.d.ts +3 -0
- package/dist/plugin/web.d.ts.map +1 -1
- package/dist/plugin/web.js +5 -1
- package/dist/plugin/web.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/routes.d.ts +3 -1
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +3 -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 +98 -45
- package/dist/rules.js.map +1 -1
- package/dist/runner/acp.d.ts +1 -1
- package/dist/runner/acp.d.ts.map +1 -1
- package/dist/runner/acp.js +32 -21
- package/dist/runner/acp.js.map +1 -1
- package/dist/runner/awake.d.ts +35 -0
- package/dist/runner/awake.d.ts.map +1 -0
- package/dist/runner/awake.js +95 -0
- package/dist/runner/awake.js.map +1 -0
- package/dist/runner/claude.d.ts +1 -1
- package/dist/runner/claude.d.ts.map +1 -1
- package/dist/runner/claude.js +100 -18
- package/dist/runner/claude.js.map +1 -1
- package/dist/runner/codex.d.ts +1 -1
- package/dist/runner/codex.d.ts.map +1 -1
- package/dist/runner/codex.js +20 -17
- package/dist/runner/codex.js.map +1 -1
- package/dist/runner/config.d.ts +5 -0
- package/dist/runner/config.d.ts.map +1 -1
- package/dist/runner/config.js +9 -0
- package/dist/runner/config.js.map +1 -1
- package/dist/runner/desk.d.ts +43 -2
- package/dist/runner/desk.d.ts.map +1 -1
- package/dist/runner/desk.js +168 -13
- package/dist/runner/desk.js.map +1 -1
- package/dist/runner/process.d.ts.map +1 -1
- package/dist/runner/process.js +11 -4
- package/dist/runner/process.js.map +1 -1
- package/dist/runner/redact.d.ts +39 -4
- package/dist/runner/redact.d.ts.map +1 -1
- package/dist/runner/redact.js +81 -5
- package/dist/runner/redact.js.map +1 -1
- package/dist/runner/runner.d.ts +28 -3
- package/dist/runner/runner.d.ts.map +1 -1
- package/dist/runner/runner.js +371 -54
- package/dist/runner/runner.js.map +1 -1
- package/dist/runner/slack.d.ts.map +1 -1
- package/dist/runner/slack.js +10 -4
- package/dist/runner/slack.js.map +1 -1
- package/dist/runner/task-scheduler.d.ts +20 -0
- package/dist/runner/task-scheduler.d.ts.map +1 -1
- package/dist/runner/task-scheduler.js +34 -4
- package/dist/runner/task-scheduler.js.map +1 -1
- package/dist/runner/types.d.ts +51 -1
- package/dist/runner/types.d.ts.map +1 -1
- package/dist/runner/types.js +26 -0
- package/dist/runner/types.js.map +1 -1
- package/dist/runner.d.ts +6 -6
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +5 -5
- package/dist/runner.js.map +1 -1
- package/dist/schemas.d.ts +603 -6
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +156 -20
- package/dist/schemas.js.map +1 -1
- package/dist/services.d.ts +22 -5
- package/dist/services.d.ts.map +1 -1
- package/dist/services.js +41 -17
- package/dist/services.js.map +1 -1
- package/dist/setup-guide.d.ts +17 -4
- package/dist/setup-guide.d.ts.map +1 -1
- package/dist/setup-guide.js +48 -41
- package/dist/setup-guide.js.map +1 -1
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +5 -1
- package/dist/tokens.js.map +1 -1
- package/dist/vocabulary.d.ts +21 -3
- package/dist/vocabulary.d.ts.map +1 -1
- package/dist/vocabulary.js +19 -3
- package/dist/vocabulary.js.map +1 -1
- package/docs/specs/cli.md +73 -44
- package/docs/specs/plugins.md +40 -22
- package/docs/specs/records.md +113 -0
- package/docs/specs/rest.md +30 -21
- package/docs/specs/runner.md +46 -22
- package/package.json +11 -2
- package/skills/building-a-console/SKILL.md +4 -4
- package/skills/building-a-plugin/SKILL.md +6 -6
- package/skills/deploying-a-console/SKILL.md +4 -4
- package/skills/deploying-a-console/references/resources.md +41 -4
- 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 +15 -13
- package/skills/running-an-agent/SKILL.md +47 -56
- package/skills/working-the-board/SKILL.md +63 -44
- package/skills/working-the-board/references/terms.md +9 -5
- package/skills/working-the-board/references/the-pack.md +12 -10
- package/skills/working-the-board/references/the-sentence.md +2 -2
- package/src/agent-page.tsx +16 -2
- package/src/api.ts +109 -3
- package/src/charts.ts +250 -0
- package/src/cli/cli.ts +2226 -580
- package/src/cli/command-words.ts +56 -0
- package/src/cli/credentials.ts +181 -20
- package/src/cli/directory.ts +28 -10
- package/src/cli/format.ts +332 -49
- package/src/cli/help.ts +113 -57
- package/src/cli/machine-check.ts +223 -0
- package/src/cli/main.ts +72 -2
- package/src/cli/pack.ts +333 -372
- 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 +8 -0
- package/src/cli/secret-notes.ts +63 -0
- package/src/cli/serve.ts +295 -2
- package/src/client.ts +215 -177
- package/src/components/agent-page.tsx +1044 -281
- package/src/components/agents.tsx +9 -5
- package/src/components/board.tsx +3 -15
- package/src/components/categories.tsx +2 -2
- package/src/components/charts.tsx +680 -0
- package/src/components/decision-list.tsx +11 -7
- package/src/components/desk-records.tsx +724 -0
- package/src/components/desk.tsx +471 -0
- package/src/components/event-feed.tsx +12 -3
- package/src/components/goals.tsx +33 -25
- package/src/components/home.tsx +42 -6
- package/src/components/icon.tsx +337 -0
- package/src/components/markdown.tsx +22 -2
- package/src/components/people.tsx +1 -1
- package/src/components/plugin-frame.tsx +7 -0
- package/src/components/plugin-settings.tsx +171 -12
- package/src/components/projects.tsx +68 -17
- package/src/components/rules.tsx +94 -34
- package/src/components/sessions.tsx +2 -13
- package/src/components/setup.tsx +20 -5
- package/src/components/shell.tsx +3 -20
- package/src/components/tokens.tsx +1 -1
- package/src/components/ui.tsx +16 -8
- package/src/connect-page.tsx +1 -1
- package/src/console.tsx +104 -62
- package/src/data.ts +37 -34
- 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/home-tiles.ts +170 -46
- package/src/i18n/en.ts +323 -11
- package/src/i18n/ko.ts +378 -87
- package/src/i18n/particles.ts +79 -0
- package/src/icons/glyphs.ts +112 -0
- package/src/icons/index.ts +195 -0
- package/src/index.ts +125 -0
- package/src/limits.ts +20 -0
- package/src/marks.ts +12 -0
- package/src/onboarding.ts +14 -6
- package/src/plugin/context.ts +55 -12
- package/src/plugin/limits.ts +2 -0
- package/src/plugin/manifest.ts +38 -2
- package/src/plugin/rest-schemas.ts +41 -0
- package/src/plugin/sandbox.ts +4 -1
- package/src/plugin/testing.ts +63 -12
- package/src/plugin/web.ts +9 -2
- package/src/plugin.ts +2 -0
- package/src/records.ts +702 -0
- package/src/routes.ts +3 -1
- package/src/rules.ts +108 -47
- package/src/runner/acp.ts +49 -30
- package/src/runner/awake.ts +135 -0
- package/src/runner/claude.ts +131 -26
- package/src/runner/codex.ts +37 -26
- package/src/runner/config.ts +9 -0
- package/src/runner/desk.ts +200 -15
- package/src/runner/process.ts +11 -4
- package/src/runner/redact.ts +92 -6
- package/src/runner/runner.ts +457 -56
- package/src/runner/slack.ts +10 -4
- package/src/runner/task-scheduler.ts +36 -4
- package/src/runner/types.ts +67 -1
- package/src/runner.ts +27 -2
- package/src/schemas.ts +177 -18
- package/src/services.ts +55 -16
- package/src/setup-guide.ts +49 -40
- package/src/styles/README.md +16 -5
- package/src/styles/base.css +17 -0
- package/src/styles/console.css +10 -0
- package/src/styles/drawn-by-pages.json +1 -1
- package/src/styles/pages/agents.css +103 -1
- package/src/styles/pages/board.css +0 -10
- package/src/styles/pages/calendar.css +1 -1
- package/src/styles/pages/connect.css +0 -10
- package/src/styles/pages/decisions.css +3 -1
- package/src/styles/pages/desk.css +126 -0
- package/src/styles/pages/documents.css +5 -0
- package/src/styles/pages/feed.css +5 -2
- package/src/styles/pages/home.css +5 -0
- package/src/styles/pages/roadmap.css +2 -2
- package/src/styles/pages/settings.css +11 -0
- package/src/styles/pages/task.css +0 -20
- package/src/styles/pages/thread.css +1 -1
- package/src/styles/parts/bars.css +80 -0
- package/src/styles/parts/calendar.css +1 -1
- package/src/styles/parts/callout.css +1 -0
- package/src/styles/parts/chart.css +173 -0
- package/src/styles/parts/detail.css +22 -0
- package/src/styles/parts/empty.css +2 -0
- package/src/styles/parts/eyebrow.css +1 -1
- package/src/styles/parts/facts.css +1 -1
- package/src/styles/parts/figures.css +65 -0
- package/src/styles/parts/form.css +2 -1
- package/src/styles/parts/icon.css +191 -0
- package/src/styles/parts/input.css +14 -4
- package/src/styles/parts/legend.css +48 -0
- package/src/styles/parts/mark.css +36 -0
- package/src/styles/parts/menu.css +1 -7
- package/src/styles/parts/page.css +1 -1
- package/src/styles/parts/panel.css +10 -0
- package/src/styles/parts/person.css +5 -2
- package/src/styles/parts/progress.css +5 -2
- package/src/styles/parts/rows.css +1 -0
- package/src/styles/parts/series.css +32 -0
- package/src/styles/parts/settings.css +5 -0
- package/src/styles/parts/share.css +25 -0
- package/src/styles/parts/spark.css +23 -0
- package/src/styles/parts/stat.css +69 -0
- package/src/styles/tokens.css +31 -10
- package/src/tokens.ts +5 -1
- package/src/vocabulary.ts +25 -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,6 +1,8 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
1
2
|
import { argUsage } from "../plugin/args.js";
|
|
2
3
|
import type {
|
|
3
4
|
RestAgent,
|
|
5
|
+
RestAgentRunner,
|
|
4
6
|
RestAgentSecret,
|
|
5
7
|
RestArtifact,
|
|
6
8
|
RestCategory,
|
|
@@ -9,9 +11,12 @@ import type {
|
|
|
9
11
|
RestDocument,
|
|
10
12
|
RestDocumentSummary,
|
|
11
13
|
RestDocuments,
|
|
14
|
+
RestEvent,
|
|
15
|
+
RestEvents,
|
|
12
16
|
RestGoal,
|
|
13
17
|
RestListing,
|
|
14
18
|
RestMember,
|
|
19
|
+
RestOwnWake,
|
|
15
20
|
RestPerson,
|
|
16
21
|
RestPersonWork,
|
|
17
22
|
RestPlugin,
|
|
@@ -19,6 +24,7 @@ import type {
|
|
|
19
24
|
RestPluginDetail,
|
|
20
25
|
RestPluginGrant,
|
|
21
26
|
RestPluginInvocation,
|
|
27
|
+
RestPluginJob,
|
|
22
28
|
RestPluginOperation,
|
|
23
29
|
RestPluginRecord,
|
|
24
30
|
RestPluginRecordPage,
|
|
@@ -31,14 +37,17 @@ import type {
|
|
|
31
37
|
RestRules,
|
|
32
38
|
RestRulesPlugin,
|
|
33
39
|
RestRun,
|
|
40
|
+
RestRunBrief,
|
|
34
41
|
RestSignal,
|
|
35
42
|
RestTask,
|
|
43
|
+
RestTaskBrief,
|
|
36
44
|
RestTeam,
|
|
37
45
|
RestVersion,
|
|
38
46
|
RestVersionSummary,
|
|
39
47
|
RestWork,
|
|
40
48
|
RestWorkspace,
|
|
41
49
|
} from "../schemas.js";
|
|
50
|
+
import { reportCountOf } from "../schemas.js";
|
|
42
51
|
|
|
43
52
|
// What the command prints: one line per thing in a list, a few lines for one thing in full.
|
|
44
53
|
// Plain text, for an agent to read and a person to skim; ids are given, since the commands take
|
|
@@ -114,7 +123,7 @@ export function formatProject(project: RestProject): string {
|
|
|
114
123
|
const lines = [
|
|
115
124
|
`project ${project.key}: ${project.name}`,
|
|
116
125
|
`visibility: ${project.visibility} role: ${project.role} skills: ${project.skillsAddress ?? "the organization's"}`,
|
|
117
|
-
`color: ${project.color ?? "none"} symbol: ${project.symbol ?? "none"} image: ${project.icon === null ? "none" : project.icon.contentType}`,
|
|
126
|
+
`color: ${project.color ?? "none"} symbol: ${project.symbol ?? "none"} glyph: ${project.glyph ?? "none"} image: ${project.icon === null ? "none" : project.icon.contentType}`,
|
|
118
127
|
`pack token: ${project.packToken === null ? "none" : `set ${moment(project.packToken.setAt)}`}`,
|
|
119
128
|
];
|
|
120
129
|
if (project.description.trim().length > 0) {
|
|
@@ -159,7 +168,16 @@ export function formatAgentLine(agent: RestAgent): string {
|
|
|
159
168
|
const standing = [
|
|
160
169
|
`signs in as ${person.login}`,
|
|
161
170
|
...(manager === null ? [] : [`reports to ${calledOf(manager)}`]),
|
|
162
|
-
...(person.invited === true
|
|
171
|
+
...(person.invited === true
|
|
172
|
+
? [
|
|
173
|
+
// At a git host, whether the host said which account the login is (ADR-0126).
|
|
174
|
+
agent.firstSignIn === undefined
|
|
175
|
+
? "not signed in yet"
|
|
176
|
+
: agent.firstSignIn === "account"
|
|
177
|
+
? "not signed in yet, its account confirmed at the host"
|
|
178
|
+
: "not signed in yet, its account not confirmed",
|
|
179
|
+
]
|
|
180
|
+
: []),
|
|
163
181
|
...(person.status === "active" ? [] : ["deactivated"]),
|
|
164
182
|
].join(", ");
|
|
165
183
|
return `@${person.handle ?? person.login} ${called.join(", ")} (${standing})`;
|
|
@@ -197,6 +215,11 @@ export function formatAgent(agent: RestAgent): string {
|
|
|
197
215
|
`runs with: model ${runner.running.model ?? OWN_CHOICE}, effort ${runner.running.effort ?? OWN_CHOICE}`,
|
|
198
216
|
]),
|
|
199
217
|
`signals: ${runner.delivered} of ${runner.latest} delivered`,
|
|
218
|
+
...(runner.sources === undefined || runner.sources.length === 0
|
|
219
|
+
? []
|
|
220
|
+
: [
|
|
221
|
+
`wake sources beside the console: ${runner.sources.map(formatWakeSource).join("; ")}`,
|
|
222
|
+
]),
|
|
200
223
|
]),
|
|
201
224
|
...(agent.hours === undefined
|
|
202
225
|
? []
|
|
@@ -216,6 +239,22 @@ export function formatAgent(agent: RestAgent): string {
|
|
|
216
239
|
].join("\n");
|
|
217
240
|
}
|
|
218
241
|
|
|
242
|
+
/** A wake source as its runner last said it stands (ADR-0144): listening and since when, or not, and why. */
|
|
243
|
+
export function formatWakeSource(source: NonNullable<RestAgentRunner["sources"]>[number]): string {
|
|
244
|
+
const why = source.why === undefined ? "" : ` (${source.why})`;
|
|
245
|
+
return source.state === "connected"
|
|
246
|
+
? `${source.name} connected since ${moment(source.since)}`
|
|
247
|
+
: `${source.name} ${source.state}${why} since ${moment(source.since)}`;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/** A wake an agent account keeps for later (ADR-0145): what it is called, when it is raised, and the first words of what it says. */
|
|
251
|
+
export function formatOwnWakeLine(wake: RestOwnWake): string {
|
|
252
|
+
const words = wake.text.replaceAll(/\s+/g, " ").trim();
|
|
253
|
+
const said =
|
|
254
|
+
words.length === 0 ? "" : ` ${words.length > 120 ? `${words.slice(0, 119)}…` : words}`;
|
|
255
|
+
return `to come ${wake.key} ${moment(wake.at)}${said}`;
|
|
256
|
+
}
|
|
257
|
+
|
|
219
258
|
/** How an agent account stands (ADR-0085), in a few words: the state, why, and when its runner was last heard from. */
|
|
220
259
|
export function formatAgentState(agent: RestAgent): string {
|
|
221
260
|
const state = agent.state ?? null;
|
|
@@ -232,7 +271,7 @@ export function formatAgentState(agent: RestAgent): string {
|
|
|
232
271
|
* One signal of an agent account's record (ADR-0085): its number, its kind, who sent it or where
|
|
233
272
|
* it came from, when, and the first words of what it says.
|
|
234
273
|
*/
|
|
235
|
-
export function formatSignalLine(signal: RestSignal): string {
|
|
274
|
+
export function formatSignalLine(signal: RestSignal, delivered?: number): string {
|
|
236
275
|
const who =
|
|
237
276
|
signal.by === null
|
|
238
277
|
? `${signal.source}${signal.key === null ? "" : `: ${signal.key}`}`
|
|
@@ -244,7 +283,12 @@ export function formatSignalLine(signal: RestSignal): string {
|
|
|
244
283
|
const words = signal.text.replaceAll(/\s+/g, " ").trim();
|
|
245
284
|
const said =
|
|
246
285
|
words.length === 0 ? "" : ` ${words.length > 120 ? `${words.slice(0, 119)}…` : words}`;
|
|
247
|
-
|
|
286
|
+
// Whether it is delivered, where the record says how far it is (ADR-0131): the product took
|
|
287
|
+
// it or the record says what became of it, or it waits for that. A console that does not
|
|
288
|
+
// say, one before 0.5.2 and the answer to a signal just sent, has nothing said here.
|
|
289
|
+
const state =
|
|
290
|
+
delivered === undefined ? "" : signal.number <= delivered ? "delivered " : "waiting ";
|
|
291
|
+
return `#${signal.number} ${signal.kind} ${state}${who} ${moment(signal.at)}${set}${said}`;
|
|
248
292
|
}
|
|
249
293
|
|
|
250
294
|
/** 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. */
|
|
@@ -318,7 +362,7 @@ export const calledOf = (person: Pick<RestPerson, "login" | "handle">): string =
|
|
|
318
362
|
/** The members at work on a task as a line calls them, in the order they came to it. */
|
|
319
363
|
const logins = (people: readonly RestPerson[]): string => people.map(calledOf).join(", ");
|
|
320
364
|
|
|
321
|
-
export function formatTaskLine(task:
|
|
365
|
+
export function formatTaskLine(task: RestTaskBrief): string {
|
|
322
366
|
const notes = [`owner ${calledOf(task.owner)}`];
|
|
323
367
|
if (task.workers.length > 0) {
|
|
324
368
|
notes.push(`workers ${logins(task.workers)}`);
|
|
@@ -365,13 +409,16 @@ function scheduleLines(task: RestTask): string[] {
|
|
|
365
409
|
export function formatTask(
|
|
366
410
|
task: RestTask,
|
|
367
411
|
decisions?: readonly RestDecision[],
|
|
368
|
-
runs?: readonly
|
|
412
|
+
runs?: readonly RestRunBrief[],
|
|
369
413
|
comments?: readonly RestComment[],
|
|
414
|
+
/** The address of the task's page at the console, where the command knows it: what a person is given to open. */
|
|
415
|
+
page?: string,
|
|
370
416
|
): string {
|
|
371
417
|
const lines = [
|
|
372
418
|
`#${task.number} ${task.title}`,
|
|
373
419
|
`state: ${task.state} priority: ${task.priority} owner: ${calledOf(task.owner)} workers: ${task.workers.length === 0 ? "nobody" : logins(task.workers)}`,
|
|
374
420
|
`id: ${task.id}${task.parentId === null ? "" : ` part of: ${task.parentId}`}`,
|
|
421
|
+
...(page === undefined ? [] : [pageLine(page)]),
|
|
375
422
|
...(task.agent == null ? [] : [`written through: ${task.agent}`]),
|
|
376
423
|
...scheduleLines(task),
|
|
377
424
|
];
|
|
@@ -426,8 +473,10 @@ export function formatComment(comment: RestComment): string {
|
|
|
426
473
|
return lines.join("\n");
|
|
427
474
|
}
|
|
428
475
|
|
|
429
|
-
export function formatRunLine(run:
|
|
430
|
-
|
|
476
|
+
export function formatRunLine(run: RestRunBrief): string {
|
|
477
|
+
// A run of a listing comes without its reports, counted (`?brief=true`); a run read whole,
|
|
478
|
+
// or from a console from before the brief form, with them.
|
|
479
|
+
const notes = [plural(reportCountOf(run), "report"), plural(run.artifacts.length, "artifact")];
|
|
431
480
|
if (run.waitingFor !== null) {
|
|
432
481
|
notes.push(`waiting for decision ${run.waitingFor}`);
|
|
433
482
|
}
|
|
@@ -473,45 +522,174 @@ export function formatArtifact(
|
|
|
473
522
|
return artifact.label === null ? what : `${artifact.label}: ${what}`;
|
|
474
523
|
}
|
|
475
524
|
|
|
476
|
-
/**
|
|
477
|
-
function
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
page
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
}
|
|
525
|
+
/** When a part of the rules was written and by whom, where a page says; nothing for the console's own. */
|
|
526
|
+
function rulesFacts(page: RestRules["page"]): string {
|
|
527
|
+
return page === null
|
|
528
|
+
? ""
|
|
529
|
+
: ` (v${page.version}, by ${writer(page.updatedBy, page.agent)}; ${moment(page.updatedAt)})`;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/** A part of the rules that has a text: what it is, who wrote it where someone did, and the text as it stands. */
|
|
533
|
+
const formatRulesPart = (head: string, page: RestRules["page"], body: string): string =>
|
|
534
|
+
`${head}${rulesFacts(page)}:\n\n${body.trimEnd()}`;
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* The workspace's rules as a console of before the parts answers them (ADR-0120): whole, the
|
|
538
|
+
* console's own until an administrator writes the organization's in their place, which is
|
|
539
|
+
* what holds on such a console. No command is named for writing them: this one writes what an
|
|
540
|
+
* organization adds, and refuses to on a console that would keep it as the whole.
|
|
541
|
+
*/
|
|
542
|
+
function formatRulesWhole(rules: RestRules): string {
|
|
486
543
|
const head =
|
|
487
544
|
rules.source === "reference"
|
|
488
|
-
?
|
|
489
|
-
: `Rules of ${
|
|
490
|
-
return `${head}\n\n${rules.body.trimEnd()}`;
|
|
545
|
+
? "Rules of the workspace: the console's own, until an administrator writes the organization's."
|
|
546
|
+
: `Rules of the workspace${rulesFacts(rules.page) || " (written)"}:`;
|
|
547
|
+
return `${head}\n\n${(rules.body ?? "").trimEnd()}`;
|
|
491
548
|
}
|
|
492
549
|
|
|
493
550
|
/**
|
|
494
|
-
* The
|
|
495
|
-
*
|
|
551
|
+
* The parts of the rules as they are printed for whoever reads them (ADR-0120): what the
|
|
552
|
+
* project adds where the command works in one and it adds something, the plugins' lines in the
|
|
553
|
+
* language they are read in, what the organization adds where it adds something, and the
|
|
554
|
+
* console's rules, which always hold.
|
|
555
|
+
*/
|
|
556
|
+
function rulesParts(rules: RestProjectRules | RestRules, language: string | null | undefined) {
|
|
557
|
+
const named = "workspace" in rules;
|
|
558
|
+
const workspace = named ? rules.workspace : rules;
|
|
559
|
+
const project = named && rules.project.source !== "none" ? rules.project : undefined;
|
|
560
|
+
const count = rules.plugins?.length ?? 0;
|
|
561
|
+
const added = workspace.added ?? null;
|
|
562
|
+
return {
|
|
563
|
+
/** Whether the command works in a project: its rules were asked for, whether it adds any or not. */
|
|
564
|
+
named,
|
|
565
|
+
workspace,
|
|
566
|
+
/** What the project adds, where it adds something. */
|
|
567
|
+
own: project !== undefined && project.body !== null ? project : undefined,
|
|
568
|
+
plugins:
|
|
569
|
+
rules.plugins === undefined || count === 0
|
|
570
|
+
? undefined
|
|
571
|
+
: formatRulesPlugins(rules.plugins, language),
|
|
572
|
+
pluginCount: count,
|
|
573
|
+
/** What the organization adds, where it adds something and the console says the parts. */
|
|
574
|
+
added: workspace.own === undefined || added === null ? undefined : added,
|
|
575
|
+
/** The console's rules by themselves; nothing from a console of before, which answers the whole. */
|
|
576
|
+
console: workspace.own,
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* The mark of the rules (ADR-0119): the first eight hex characters of a SHA-256 over what they
|
|
582
|
+
* say to whoever reads them: the workspace's text whole, which is the console's rules with
|
|
583
|
+
* what the organization adds (ADR-0120), what the project adds, and the plugins' lines, in the
|
|
584
|
+
* language they are read in. A session that was shown the rules holds their mark, and a later
|
|
585
|
+
* take of that session leaves out the rules the mark stands for; nothing but having been shown
|
|
586
|
+
* them gives it. When they were written and by whom is no part of it: the same rules have the
|
|
587
|
+
* same mark, and a project that adds nothing has the workspace's.
|
|
588
|
+
*/
|
|
589
|
+
export function rulesMark(
|
|
590
|
+
rules: RestProjectRules | RestRules,
|
|
591
|
+
language?: string | null | undefined,
|
|
592
|
+
): string {
|
|
593
|
+
const parts = rulesParts(rules, language);
|
|
594
|
+
return createHash("sha256")
|
|
595
|
+
.update(
|
|
596
|
+
JSON.stringify([
|
|
597
|
+
(parts.workspace.body ?? "").trimEnd(),
|
|
598
|
+
parts.own === undefined ? null : (parts.own.body ?? "").trimEnd(),
|
|
599
|
+
parts.plugins ?? null,
|
|
600
|
+
]),
|
|
601
|
+
)
|
|
602
|
+
.digest("hex")
|
|
603
|
+
.slice(0, 8);
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
/** How long a text of the rules is, as its first line says it. */
|
|
607
|
+
const charactersOf = (text: string | null): string => `${(text ?? "").trimEnd().length} characters`;
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* The rules that hold, under a first line that says what follows (ADR-0119): the mark, which
|
|
611
|
+
* parts there are and how long each is, and how a later take of the session leaves them out.
|
|
612
|
+
* What differs stands first and what always holds last (ADR-0120): what the project adds with
|
|
613
|
+
* the plugins' lines, then what the organization adds, then the console's rules. An agent that
|
|
614
|
+
* had read the long part once cut every later print at its head, and never saw what stood
|
|
615
|
+
* after it; and where they differ it is the earlier part that holds. Who adds nothing is said
|
|
616
|
+
* in a clause of the line, and has no part.
|
|
496
617
|
*/
|
|
497
618
|
export function formatRules(
|
|
498
619
|
rules: RestProjectRules | RestRules,
|
|
499
620
|
language?: string | null | undefined,
|
|
500
621
|
): string {
|
|
501
|
-
const parts =
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
}
|
|
512
|
-
|
|
622
|
+
const parts = rulesParts(rules, language);
|
|
623
|
+
const mark = rulesMark(rules, language);
|
|
624
|
+
// A console of before answers the workspace's rules whole: they are the last part then.
|
|
625
|
+
const whole = parts.console === undefined;
|
|
626
|
+
const last = whole
|
|
627
|
+
? `the workspace's (${charactersOf(parts.workspace.body)})`
|
|
628
|
+
: `the console's (${charactersOf(parts.console ?? null)})`;
|
|
629
|
+
const lastFollows = whole
|
|
630
|
+
? `the workspace's follow (${charactersOf(parts.workspace.body)})`
|
|
631
|
+
: `the console's follow (${charactersOf(parts.console ?? null)})`;
|
|
632
|
+
const plugins = `${parts.pluginCount} plugin${parts.pluginCount === 1 ? "" : "s"}`;
|
|
633
|
+
const HOLDS = "the earlier holding where they differ";
|
|
634
|
+
/** The organization's part and the last, after whatever stood before them. */
|
|
635
|
+
const rest = (first: boolean): string =>
|
|
636
|
+
parts.added === undefined
|
|
637
|
+
? last
|
|
638
|
+
: `the organization's${first ? " additions first" : ""} (${charactersOf(parts.added.body)}), then ${last}`;
|
|
639
|
+
let follows: string;
|
|
640
|
+
if (parts.own !== undefined) {
|
|
641
|
+
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"}.`;
|
|
642
|
+
} else {
|
|
643
|
+
const nobody = parts.added === undefined && !whole;
|
|
644
|
+
const lead = parts.named
|
|
645
|
+
? nobody
|
|
646
|
+
? "this project and the organization add nothing; "
|
|
647
|
+
: "this project adds nothing; "
|
|
648
|
+
: nobody
|
|
649
|
+
? "the organization adds nothing; "
|
|
650
|
+
: "";
|
|
651
|
+
const theirs = parts.named ? `its ${plugins}` : `the ${plugins} you may use`;
|
|
652
|
+
const body =
|
|
653
|
+
parts.plugins !== undefined
|
|
654
|
+
? `${theirs} first, then ${parts.added === undefined ? last : `the organization's additions (${charactersOf(parts.added.body)}), then ${last}, ${HOLDS}`}`
|
|
655
|
+
: parts.added === undefined
|
|
656
|
+
? parts.named || nobody
|
|
657
|
+
? lastFollows
|
|
658
|
+
: last
|
|
659
|
+
: `${rest(true)}, ${HOLDS}`;
|
|
660
|
+
follows = `${lead}${body}${parts.named ? "." : "; no project is named here, and a project's additions stand before them where it has some."}`;
|
|
661
|
+
}
|
|
662
|
+
// The mark ends the line bare, so that it is copied as it is.
|
|
663
|
+
const later = parts.named
|
|
664
|
+
? ` A later take in this session leaves them out: console take <number> --rules ${mark}`
|
|
665
|
+
: "";
|
|
666
|
+
return [
|
|
667
|
+
`Rules ${mark}: ${follows}${later}`,
|
|
668
|
+
...(parts.own === undefined
|
|
669
|
+
? []
|
|
670
|
+
: ["", formatRulesPart("What this project adds", parts.own.page, parts.own.body ?? "")]),
|
|
671
|
+
...(parts.plugins === undefined ? [] : ["", parts.plugins]),
|
|
672
|
+
...(parts.added === undefined
|
|
673
|
+
? []
|
|
674
|
+
: ["", formatRulesPart("What this organization adds", parts.added.page, parts.added.body)]),
|
|
675
|
+
"",
|
|
676
|
+
parts.console === undefined
|
|
677
|
+
? formatRulesWhole(parts.workspace)
|
|
678
|
+
: formatRulesPart("The console's rules, which always hold", null, parts.console),
|
|
679
|
+
].join("\n");
|
|
513
680
|
}
|
|
514
681
|
|
|
682
|
+
/** What a take says, before the task, where it was told the mark the rules have (ADR-0119): they are left out. */
|
|
683
|
+
export const formatRulesLeftOut = (mark: string): string =>
|
|
684
|
+
`Rules ${mark}: left out, since they stand as this session read them. console rules prints them.`;
|
|
685
|
+
|
|
686
|
+
/**
|
|
687
|
+
* What a take says, before the task, where it was told a mark the rules do not have (ADR-0119):
|
|
688
|
+
* the rules then follow the task whole, as they do without a mark.
|
|
689
|
+
*/
|
|
690
|
+
export const formatRulesChanged = (given: string): string =>
|
|
691
|
+
`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.`;
|
|
692
|
+
|
|
515
693
|
/** How far a goal is, from its tasks: the done, the at work, and the rest, in one phrase. */
|
|
516
694
|
function progressOf(goal: RestGoal): string {
|
|
517
695
|
const counts = goal.taskCounts;
|
|
@@ -532,7 +710,7 @@ export function formatGoalLine(goal: RestGoal): string {
|
|
|
532
710
|
}
|
|
533
711
|
|
|
534
712
|
/** One goal in full; with the tasks that work towards it, when given. */
|
|
535
|
-
export function formatGoal(goal: RestGoal, tasks?: readonly
|
|
713
|
+
export function formatGoal(goal: RestGoal, tasks?: readonly RestTaskBrief[]): string {
|
|
536
714
|
const lines = [
|
|
537
715
|
`goal ${goal.id}: ${goal.title}`,
|
|
538
716
|
`state: ${goal.state} category: ${goal.category?.key ?? "none"} starts: ${goal.startsOn ?? "none"} due: ${goal.dueOn ?? "none"} set by: ${calledOf(goal.createdBy)}${through(goal.agent)}`,
|
|
@@ -607,9 +785,13 @@ const addressed = (decision: RestDecision): string =>
|
|
|
607
785
|
? ""
|
|
608
786
|
: `, for ${deciderLogins(decision)}`;
|
|
609
787
|
|
|
788
|
+
/**
|
|
789
|
+
* One decision in a line, with when it was asked: a decision that waits holds a run, and whoever
|
|
790
|
+
* is told what is on their plate is told since when each one waits.
|
|
791
|
+
*/
|
|
610
792
|
export function formatDecisionLine(decision: RestDecision): string {
|
|
611
793
|
const state = decision.answer === null ? "waiting" : `answered ${decision.answer.option}`;
|
|
612
|
-
return `${decision.id} ${state} ${decision.question} (asked by ${asker(decision)}${addressed(decision)})`;
|
|
794
|
+
return `${decision.id} ${state} ${decision.question} (asked by ${asker(decision)}${addressed(decision)}, at ${moment(decision.createdAt)})`;
|
|
613
795
|
}
|
|
614
796
|
|
|
615
797
|
/** The options, one a line; the person's own answer, when they wrote one, is the last and says so. */
|
|
@@ -630,7 +812,7 @@ export function formatAnswer(decision: RestDecision): string {
|
|
|
630
812
|
}
|
|
631
813
|
const chosen = decision.options.find((option) => option.id === answer.option);
|
|
632
814
|
const lines = [
|
|
633
|
-
`Answered: ${answer.option}) ${chosen?.label ?? answer.option}${chosen?.own === true ? ", in their own words" : ""}, by ${calledOf(answer.by)}${through(answer.agent)} at ${answer.at}`,
|
|
815
|
+
`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)}`,
|
|
634
816
|
];
|
|
635
817
|
if (answer.note !== null && answer.note.length > 0) {
|
|
636
818
|
lines.push(`Note: ${answer.note}`);
|
|
@@ -638,6 +820,13 @@ export function formatAnswer(decision: RestDecision): string {
|
|
|
638
820
|
return lines.join("\n");
|
|
639
821
|
}
|
|
640
822
|
|
|
823
|
+
/**
|
|
824
|
+
* The address of a task's or a decision's page, on a line of its own: what an agent gives a
|
|
825
|
+
* person to open, in place of the console's front page, or of a number a git host would take
|
|
826
|
+
* for an issue of its own.
|
|
827
|
+
*/
|
|
828
|
+
export const pageLine = (page: string): string => `page: ${page}`;
|
|
829
|
+
|
|
641
830
|
/**
|
|
642
831
|
* One decision in full. A decision reached at its own address (ADR-0068), outside the project the
|
|
643
832
|
* command works in, names its files with the command that reads them there, by the decision too:
|
|
@@ -645,7 +834,11 @@ export function formatAnswer(decision: RestDecision): string {
|
|
|
645
834
|
*/
|
|
646
835
|
export function formatDecision(
|
|
647
836
|
decision: RestDecision,
|
|
648
|
-
options: {
|
|
837
|
+
options: {
|
|
838
|
+
readonly atItsAddress?: boolean;
|
|
839
|
+
/** The address of the decision's page at the console, where the command knows it. */
|
|
840
|
+
readonly page?: string | undefined;
|
|
841
|
+
} = {},
|
|
649
842
|
): string {
|
|
650
843
|
const reads = (fileId: string): string =>
|
|
651
844
|
options.atItsAddress === true
|
|
@@ -653,7 +846,8 @@ export function formatDecision(
|
|
|
653
846
|
: `console file ${fileId}`;
|
|
654
847
|
const lines = [
|
|
655
848
|
`decision ${decision.id}: ${decision.question}`,
|
|
656
|
-
`asked by ${asker(decision)}${addressed(decision)}${decision.taskNumber === null ? "" : `, about task #${decision.taskNumber}`}`,
|
|
849
|
+
`asked by ${asker(decision)}${addressed(decision)}${decision.taskNumber === null ? "" : `, about task #${decision.taskNumber}`}, at ${moment(decision.createdAt)}`,
|
|
850
|
+
...(options.page === undefined ? [] : [pageLine(options.page)]),
|
|
657
851
|
];
|
|
658
852
|
if (decision.body.trim().length > 0) {
|
|
659
853
|
lines.push("", decision.body.trimEnd());
|
|
@@ -675,7 +869,7 @@ export function formatDecision(
|
|
|
675
869
|
if (decision.outcomeBy != null && decision.outcomeAt != null) {
|
|
676
870
|
lines.push(
|
|
677
871
|
indent(
|
|
678
|
-
`written by ${calledOf(decision.outcomeBy)}${through(decision.outcomeAgent)} at ${decision.outcomeAt}`,
|
|
872
|
+
`written by ${calledOf(decision.outcomeBy)}${through(decision.outcomeAgent)} at ${moment(decision.outcomeAt)}`,
|
|
679
873
|
),
|
|
680
874
|
);
|
|
681
875
|
}
|
|
@@ -916,21 +1110,40 @@ export function formatPluginHelp(detail: RestPluginDetail, name: string | undefi
|
|
|
916
1110
|
return parts.join("\n");
|
|
917
1111
|
}
|
|
918
1112
|
|
|
919
|
-
/**
|
|
1113
|
+
/** When a secret was set, from where where it was sealed from an answer, and when it expires: never what it holds. */
|
|
1114
|
+
function secretStanding(standing: {
|
|
1115
|
+
readonly setAt: string | null;
|
|
1116
|
+
readonly source?: string | null | undefined;
|
|
1117
|
+
readonly expiresAt?: string | null | undefined;
|
|
1118
|
+
}): string {
|
|
1119
|
+
return `set${standing.setAt === null ? "" : ` ${moment(standing.setAt)}`}${
|
|
1120
|
+
standing.source === null || standing.source === undefined || standing.source === "administrator"
|
|
1121
|
+
? ""
|
|
1122
|
+
: ` from ${standing.source}`
|
|
1123
|
+
}${standing.expiresAt === null || standing.expiresAt === undefined ? "" : `, expires ${moment(standing.expiresAt)}`}`;
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
/**
|
|
1127
|
+
* A setting in a line: its key and type, what it holds or whether it is set, and its name; for a
|
|
1128
|
+
* secret kept per key (ADR-0111), how many keys of how many, and a line under it for each key.
|
|
1129
|
+
*/
|
|
920
1130
|
export function formatPluginSettingLine(
|
|
921
1131
|
setting: RestPluginSetting,
|
|
922
1132
|
language: string | null | undefined,
|
|
923
1133
|
): string {
|
|
1134
|
+
const keys = setting.keys ?? null;
|
|
1135
|
+
if (setting.type === "secret" && keys !== null) {
|
|
1136
|
+
const max = setting.keyed?.max;
|
|
1137
|
+
const count = `${keys.length}${max === undefined ? "" : ` of ${max}`} ${keys.length === 1 && max === undefined ? "key" : "keys"}`;
|
|
1138
|
+
return [
|
|
1139
|
+
` ${setting.key} (secret, per key): ${count} ${localized(setting.name, language)}`,
|
|
1140
|
+
...keys.map((kept) => ` ${kept.key}: ${secretStanding(kept)}`),
|
|
1141
|
+
].join("\n");
|
|
1142
|
+
}
|
|
924
1143
|
const holds =
|
|
925
1144
|
setting.type === "secret"
|
|
926
1145
|
? setting.set
|
|
927
|
-
?
|
|
928
|
-
setting.source === null ||
|
|
929
|
-
setting.source === undefined ||
|
|
930
|
-
setting.source === "administrator"
|
|
931
|
-
? ""
|
|
932
|
-
: ` from ${setting.source}`
|
|
933
|
-
}${setting.expiresAt === null || setting.expiresAt === undefined ? "" : `, expires ${moment(setting.expiresAt)}`}`
|
|
1146
|
+
? secretStanding(setting)
|
|
934
1147
|
: "not set"
|
|
935
1148
|
: setting.set
|
|
936
1149
|
? setting.value === null
|
|
@@ -964,6 +1177,68 @@ export function formatTeamLine(team: RestTeam, loginOf: ReadonlyMap<string, stri
|
|
|
964
1177
|
return `${team.key} ${team.name} ${count}${logins.length === 0 ? "" : `: ${logins.join(", ")}`}`;
|
|
965
1178
|
}
|
|
966
1179
|
|
|
1180
|
+
/**
|
|
1181
|
+
* A job of a plugin in a line (ADR-0128): its name and how often it runs, how its last run went
|
|
1182
|
+
* and since when it has failed where it keeps failing, and when it runs next.
|
|
1183
|
+
*/
|
|
1184
|
+
export function formatPluginJobLine(job: RestPluginJob): string {
|
|
1185
|
+
const schedule = `every ${job.every}${job.at === null ? "" : ` at ${job.at}`}`;
|
|
1186
|
+
const last =
|
|
1187
|
+
job.lastRunAt === null || job.lastOutcome === null
|
|
1188
|
+
? "has not run yet"
|
|
1189
|
+
: `last run ${moment(job.lastRunAt)}: ${job.lastOutcome}${
|
|
1190
|
+
job.lastOutcome === "failed" && job.failedSince !== null
|
|
1191
|
+
? `, failing since ${moment(job.failedSince)}`
|
|
1192
|
+
: ""
|
|
1193
|
+
}`;
|
|
1194
|
+
return ` ${job.name} ${schedule} ${last} next: ${job.nextAt === null ? "not scheduled" : moment(job.nextAt)}`;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
/** What an event of a plugin says, after its kind: what failed, which command and how it ended, else what it carries. */
|
|
1198
|
+
function pluginEventSays(event: RestEvent): string {
|
|
1199
|
+
const data = event.data;
|
|
1200
|
+
if (event.kind === "plugin.failed") {
|
|
1201
|
+
return data.problem ?? "";
|
|
1202
|
+
}
|
|
1203
|
+
if (event.kind === "plugin.command") {
|
|
1204
|
+
return `${data.command ?? "?"} ${data.outcome ?? "?"}${data.code === undefined ? "" : ` (${data.code})`}${
|
|
1205
|
+
data.durationMs === undefined ? "" : `, ${data.durationMs} ms`
|
|
1206
|
+
}`;
|
|
1207
|
+
}
|
|
1208
|
+
const carried = JSON.stringify(data);
|
|
1209
|
+
return carried === "{}" ? "" : carried.length > 300 ? `${carried.slice(0, 300)}...` : carried;
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
/** One event of a plugin in a line: its number, when, its kind, who did it and through what, and what it says. */
|
|
1213
|
+
export function formatPluginEventLine(event: RestEvent): string {
|
|
1214
|
+
const who =
|
|
1215
|
+
event.actor === null
|
|
1216
|
+
? "the console"
|
|
1217
|
+
: `${calledOf(event.actor)}${event.agent === null ? "" : ` as ${event.agent}`}`;
|
|
1218
|
+
const says = pluginEventSays(event);
|
|
1219
|
+
return `#${event.id} ${moment(event.createdAt)} ${event.kind} ${who}${says === "" ? "" : ` ${says}`}`;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
/**
|
|
1223
|
+
* A page of a plugin's events, newest first (ADR-0128), of one kind where one was asked for:
|
|
1224
|
+
* what `console plugin <key> events` prints, with how to read on. The console answers what the
|
|
1225
|
+
* caller may read and says nothing of the rest, so an empty page is said as that, and never as
|
|
1226
|
+
* a plugin that has no events.
|
|
1227
|
+
*/
|
|
1228
|
+
export function formatPluginEvents(
|
|
1229
|
+
key: string,
|
|
1230
|
+
page: RestEvents,
|
|
1231
|
+
asked: { readonly kind: string | undefined; readonly limit: number; readonly offset: number },
|
|
1232
|
+
): string {
|
|
1233
|
+
if (page.items.length === 0) {
|
|
1234
|
+
const none = `No ${asked.kind === undefined ? "" : `${asked.kind} `}event of ${key} that you may read${
|
|
1235
|
+
asked.offset > 0 ? ", that far back" : ""
|
|
1236
|
+
}.`;
|
|
1237
|
+
return `${none}${formatMore(page.more, asked.limit, asked.offset)}`;
|
|
1238
|
+
}
|
|
1239
|
+
return `${page.items.map(formatPluginEventLine).join("\n")}${formatMore(page.more, asked.limit, asked.offset)}`;
|
|
1240
|
+
}
|
|
1241
|
+
|
|
967
1242
|
/** One plugin in full: what it is, how it stands, what one may run, its skills and its settings. */
|
|
968
1243
|
export function formatPlugin(
|
|
969
1244
|
detail: RestPluginDetail,
|
|
@@ -1014,6 +1289,14 @@ export function formatPlugin(
|
|
|
1014
1289
|
`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.`,
|
|
1015
1290
|
);
|
|
1016
1291
|
}
|
|
1292
|
+
// A console before 0.5.1 names no jobs: nothing is printed of them then, not an empty block.
|
|
1293
|
+
if (detail.jobs !== undefined && detail.jobs.length > 0) {
|
|
1294
|
+
lines.push(
|
|
1295
|
+
"",
|
|
1296
|
+
`Jobs (what went wrong in one: console plugin ${detail.key} events --kind plugin.failed):`,
|
|
1297
|
+
...detail.jobs.map(formatPluginJobLine),
|
|
1298
|
+
);
|
|
1299
|
+
}
|
|
1017
1300
|
if (detail.settings.length > 0) {
|
|
1018
1301
|
lines.push(
|
|
1019
1302
|
"",
|