@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/api.ts
CHANGED
|
@@ -43,6 +43,7 @@ export {
|
|
|
43
43
|
type FileRead,
|
|
44
44
|
type FileUpload,
|
|
45
45
|
type GoalFilter,
|
|
46
|
+
type PackClient,
|
|
46
47
|
type Page,
|
|
47
48
|
type ProjectClient,
|
|
48
49
|
type TaskFilter,
|
|
@@ -87,6 +88,22 @@ export {
|
|
|
87
88
|
isFolderPath,
|
|
88
89
|
nameOf,
|
|
89
90
|
} from "./documents.js";
|
|
91
|
+
export {
|
|
92
|
+
findIcons,
|
|
93
|
+
GLYPHS,
|
|
94
|
+
type GlyphShape,
|
|
95
|
+
type GlyphTag,
|
|
96
|
+
ICON_GRID,
|
|
97
|
+
ICON_GROUP_LIST,
|
|
98
|
+
ICON_NAMES,
|
|
99
|
+
type IconGroup,
|
|
100
|
+
type IconName,
|
|
101
|
+
type IconSection,
|
|
102
|
+
iconElement,
|
|
103
|
+
iconPlace,
|
|
104
|
+
iconStep,
|
|
105
|
+
isIconName,
|
|
106
|
+
} from "./icons/index.js";
|
|
90
107
|
export {
|
|
91
108
|
DEFAULT_DAY_START,
|
|
92
109
|
DEFAULT_PAGE_LIMIT,
|
|
@@ -100,6 +117,8 @@ export {
|
|
|
100
117
|
MAX_AGENT_SECRET_BYTES,
|
|
101
118
|
MAX_AGENT_SECRET_NAME_LENGTH,
|
|
102
119
|
MAX_AGENT_SECRETS,
|
|
120
|
+
MAX_AGENT_SESSIONS_PER_HOUR,
|
|
121
|
+
MAX_AGENT_STATE_CHANGES_PER_HOUR,
|
|
103
122
|
MAX_ARTIFACTS_PER_RUN,
|
|
104
123
|
MAX_BODY_LENGTH,
|
|
105
124
|
MAX_CATEGORIES,
|
|
@@ -127,6 +146,9 @@ export {
|
|
|
127
146
|
MAX_NOTE_LENGTH,
|
|
128
147
|
MAX_OPTION_LABEL_LENGTH,
|
|
129
148
|
MAX_OPTIONS,
|
|
149
|
+
MAX_OWN_WAKE_DAYS,
|
|
150
|
+
MAX_OWN_WAKES,
|
|
151
|
+
MAX_OWN_WAKES_PER_HOUR,
|
|
130
152
|
MAX_PERSON_NAME_LENGTH,
|
|
131
153
|
MAX_PERSON_TITLE_LENGTH,
|
|
132
154
|
MAX_PROJECT_DESCRIPTION_LENGTH,
|
|
@@ -140,6 +162,8 @@ export {
|
|
|
140
162
|
MAX_RULES_LENGTH,
|
|
141
163
|
MAX_RUNNER_LINE_LENGTH,
|
|
142
164
|
MAX_RUNNER_OFFERS,
|
|
165
|
+
MAX_RUNNER_SOURCES,
|
|
166
|
+
MAX_RUNNER_WAKES_PER_HOUR,
|
|
143
167
|
MAX_RUNS_PER_TASK,
|
|
144
168
|
MAX_SEAL_REASON_LENGTH,
|
|
145
169
|
MAX_SEARCH_LENGTH,
|
|
@@ -166,6 +190,7 @@ export {
|
|
|
166
190
|
MAX_TRANSCRIPT_ATTACHMENTS,
|
|
167
191
|
MAX_TRANSCRIPT_BATCH,
|
|
168
192
|
MAX_TRANSCRIPT_BATCH_BYTES,
|
|
193
|
+
MAX_TRANSCRIPT_EVENTS_PER_HOUR,
|
|
169
194
|
MAX_TRANSCRIPT_FACT_LENGTH,
|
|
170
195
|
MAX_TRANSCRIPT_FACT_NAME_LENGTH,
|
|
171
196
|
MAX_TRANSCRIPT_FACTS,
|
|
@@ -177,12 +202,13 @@ export {
|
|
|
177
202
|
MAX_WORKERS,
|
|
178
203
|
MIN_HANDLE_LENGTH,
|
|
179
204
|
MIN_OPTIONS,
|
|
205
|
+
OWN_WAKE_KEY,
|
|
180
206
|
SESSIONS_PAGE_LIMIT,
|
|
181
207
|
SIGNALS_PAGE_LIMIT,
|
|
182
208
|
TRANSCRIPT_INLINE_BYTES,
|
|
183
209
|
TRANSCRIPT_PAGE_LIMIT,
|
|
184
210
|
} from "./limits.js";
|
|
185
|
-
export { projectColorOf, projectSymbolOf } from "./marks.js";
|
|
211
|
+
export { projectColorOf, projectGlyphOf, projectSymbolOf } from "./marks.js";
|
|
186
212
|
export {
|
|
187
213
|
type OnboardingInput,
|
|
188
214
|
onboardingOf,
|
|
@@ -197,6 +223,64 @@ export {
|
|
|
197
223
|
proposeAgents,
|
|
198
224
|
} from "./persona.js";
|
|
199
225
|
export * from "./plugin/rest-schemas.js";
|
|
226
|
+
export {
|
|
227
|
+
checkRecords,
|
|
228
|
+
isLfsPointer,
|
|
229
|
+
isRecordDay,
|
|
230
|
+
isRecordFilePath,
|
|
231
|
+
isRecordLink,
|
|
232
|
+
isRecordPreviewPath,
|
|
233
|
+
MAX_LFS_POINTER_BYTES,
|
|
234
|
+
MAX_RECORD_COLLECTIONS,
|
|
235
|
+
MAX_RECORD_FIELDS,
|
|
236
|
+
MAX_RECORD_FILE_BYTES,
|
|
237
|
+
MAX_RECORD_ITEM_FILES,
|
|
238
|
+
MAX_RECORD_ITEMS,
|
|
239
|
+
MAX_RECORD_KEY_LENGTH,
|
|
240
|
+
MAX_RECORD_LINE_LENGTH,
|
|
241
|
+
MAX_RECORD_LINKS,
|
|
242
|
+
MAX_RECORD_METRIC_ROWS,
|
|
243
|
+
MAX_RECORD_METRICS,
|
|
244
|
+
MAX_RECORD_PATH_LENGTH,
|
|
245
|
+
MAX_RECORD_RATIOS,
|
|
246
|
+
MAX_RECORD_STATUSES,
|
|
247
|
+
MAX_RECORD_TEXT_LENGTH,
|
|
248
|
+
MAX_RECORD_URL_LENGTH,
|
|
249
|
+
MAX_RECORD_USES,
|
|
250
|
+
RECORD_FIELD_KINDS,
|
|
251
|
+
RECORD_METRIC_UNITS,
|
|
252
|
+
RECORD_PREVIEW_KINDS,
|
|
253
|
+
RECORD_RATIO_FORMS,
|
|
254
|
+
RECORDS_COLLECTION_FILE,
|
|
255
|
+
RECORDS_DIR,
|
|
256
|
+
RECORDS_FILES_DIR,
|
|
257
|
+
RECORDS_INDEX_FILE,
|
|
258
|
+
RECORDS_ITEMS_FILE,
|
|
259
|
+
RECORDS_METRICS_FILE,
|
|
260
|
+
RECORDS_USES_FILE,
|
|
261
|
+
type RecordsCheck,
|
|
262
|
+
type RecordsCollection,
|
|
263
|
+
type RecordsFiles,
|
|
264
|
+
type RecordsIndex,
|
|
265
|
+
type RecordsItem,
|
|
266
|
+
type RecordsMetricRow,
|
|
267
|
+
type RecordsProblem,
|
|
268
|
+
type RecordsRead,
|
|
269
|
+
type RecordsUse,
|
|
270
|
+
readRecords,
|
|
271
|
+
recordsCollectionSchema,
|
|
272
|
+
recordsFieldSchema,
|
|
273
|
+
recordsIndexSchema,
|
|
274
|
+
recordsItemSchema,
|
|
275
|
+
recordsItemsSchema,
|
|
276
|
+
recordsMetricRowSchema,
|
|
277
|
+
recordsMetricSchema,
|
|
278
|
+
recordsMetricsSchema,
|
|
279
|
+
recordsRatioSchema,
|
|
280
|
+
recordsStatusSchema,
|
|
281
|
+
recordsUseSchema,
|
|
282
|
+
recordsUsesSchema,
|
|
283
|
+
} from "./records.js";
|
|
200
284
|
export {
|
|
201
285
|
AUTH_ROUTES,
|
|
202
286
|
agentPath,
|
|
@@ -224,14 +308,16 @@ export {
|
|
|
224
308
|
signInPath,
|
|
225
309
|
} from "./routes.js";
|
|
226
310
|
export {
|
|
311
|
+
ADDED_RULES_HEADING,
|
|
312
|
+
addedRulesOf,
|
|
313
|
+
CONSOLE_RULES,
|
|
227
314
|
fillRules,
|
|
228
|
-
isReferenceRules,
|
|
229
315
|
languageNameOf,
|
|
230
316
|
PROJECT_RULES_TEMPLATE,
|
|
231
|
-
REFERENCE_RULES,
|
|
232
317
|
RULES_LANGUAGE_PLACEHOLDER,
|
|
233
318
|
RULES_PATH,
|
|
234
319
|
RULES_TITLE,
|
|
320
|
+
rulesWith,
|
|
235
321
|
} from "./rules.js";
|
|
236
322
|
export {
|
|
237
323
|
CONNECT_AS,
|
|
@@ -327,6 +413,10 @@ export {
|
|
|
327
413
|
type RestMePatch,
|
|
328
414
|
type RestMyDecisions,
|
|
329
415
|
type RestOrganization,
|
|
416
|
+
type RestOwnWake,
|
|
417
|
+
type RestOwnWakeInput,
|
|
418
|
+
type RestOwnWakeRaised,
|
|
419
|
+
type RestOwnWakes,
|
|
330
420
|
type RestPackConnect,
|
|
331
421
|
type RestPackConnectStarted,
|
|
332
422
|
type RestPackRefusal,
|
|
@@ -351,6 +441,8 @@ export {
|
|
|
351
441
|
type RestRulesInput,
|
|
352
442
|
type RestRulesPlugin,
|
|
353
443
|
type RestRun,
|
|
444
|
+
type RestRunBrief,
|
|
445
|
+
type RestRunBriefs,
|
|
354
446
|
type RestRunEndInput,
|
|
355
447
|
type RestRunInput,
|
|
356
448
|
type RestRunnerHeartbeat,
|
|
@@ -372,6 +464,7 @@ export {
|
|
|
372
464
|
type RestSkills,
|
|
373
465
|
type RestTask,
|
|
374
466
|
type RestTaskBrief,
|
|
467
|
+
type RestTaskBriefs,
|
|
375
468
|
type RestTaskCounts,
|
|
376
469
|
type RestTaskInput,
|
|
377
470
|
type RestTaskLink,
|
|
@@ -404,6 +497,7 @@ export {
|
|
|
404
497
|
type RestWorkspacePatch,
|
|
405
498
|
type RestWorkspaceService,
|
|
406
499
|
type RestWorkspaceServices,
|
|
500
|
+
reportCountOf,
|
|
407
501
|
restAgentChoiceSchema,
|
|
408
502
|
restAgentElsewhereSchema,
|
|
409
503
|
restAgentHoursSchema,
|
|
@@ -488,6 +582,10 @@ export {
|
|
|
488
582
|
restMeSchema,
|
|
489
583
|
restMyDecisionsSchema,
|
|
490
584
|
restOrganizationSchema,
|
|
585
|
+
restOwnWakeInputSchema,
|
|
586
|
+
restOwnWakeRaisedSchema,
|
|
587
|
+
restOwnWakeSchema,
|
|
588
|
+
restOwnWakesSchema,
|
|
491
589
|
restPackConnectSchema,
|
|
492
590
|
restPackConnectStartedSchema,
|
|
493
591
|
restPackRefusalSchema,
|
|
@@ -511,6 +609,8 @@ export {
|
|
|
511
609
|
restRulesInputSchema,
|
|
512
610
|
restRulesPluginSchema,
|
|
513
611
|
restRulesSchema,
|
|
612
|
+
restRunBriefSchema,
|
|
613
|
+
restRunBriefsSchema,
|
|
514
614
|
restRunEndInputSchema,
|
|
515
615
|
restRunInputSchema,
|
|
516
616
|
restRunnerHeartbeatInputSchema,
|
|
@@ -532,6 +632,7 @@ export {
|
|
|
532
632
|
restSkillSchema,
|
|
533
633
|
restSkillsSchema,
|
|
534
634
|
restTaskBriefSchema,
|
|
635
|
+
restTaskBriefsSchema,
|
|
535
636
|
restTaskCountsSchema,
|
|
536
637
|
restTaskInputSchema,
|
|
537
638
|
restTaskLinkSchema,
|
|
@@ -570,6 +671,7 @@ export {
|
|
|
570
671
|
serviceProblemOf,
|
|
571
672
|
} from "./schemas.js";
|
|
572
673
|
export {
|
|
674
|
+
agentAddressOf,
|
|
573
675
|
agentLoginOf,
|
|
574
676
|
describeService,
|
|
575
677
|
deskRemoteOf,
|
|
@@ -612,6 +714,8 @@ export {
|
|
|
612
714
|
type ConsoleLanguage,
|
|
613
715
|
EVENT_KINDS,
|
|
614
716
|
type EventKind,
|
|
717
|
+
FIRST_SIGN_INS,
|
|
718
|
+
type FirstSignIn,
|
|
615
719
|
GOAL_STATES,
|
|
616
720
|
type GoalState,
|
|
617
721
|
isProviderKey,
|
|
@@ -672,6 +776,8 @@ export {
|
|
|
672
776
|
TRANSCRIPT_PICTURE_TYPES,
|
|
673
777
|
type TranscriptKind,
|
|
674
778
|
type TranscriptPictureType,
|
|
779
|
+
WAKE_SOURCE_STATES,
|
|
780
|
+
type WakeSourceState,
|
|
675
781
|
WEEK_STARTS,
|
|
676
782
|
type WeekStart,
|
|
677
783
|
} from "./vocabulary.js";
|
package/src/charts.ts
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
// The measures of the charts (ADR-0123): how long a bar is, where a part of a whole stands, how
|
|
2
|
+
// high a column rises and where a line runs, each as a share of a hundred. An SVG's attributes
|
|
3
|
+
// take a share as they take a number, so a chart is sized by the box a stylesheet gives it and
|
|
4
|
+
// nothing here is a style: the parts' classes draw, these place. Pure, and with no dependency:
|
|
5
|
+
// the components (`components/charts.tsx`) draw with them on a console's pages, and a plugin's
|
|
6
|
+
// plain bundle draws the same classes with them (`@skillcdn/console/charts`).
|
|
7
|
+
|
|
8
|
+
/** How many series a chart tells apart by colour; what is past them wears the neutral. */
|
|
9
|
+
export const CHART_SERIES = 6;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The least a mark that stands for an amount is drawn at, of a hundred: an amount beside one a
|
|
13
|
+
* thousand times its size is still something, and is drawn as something.
|
|
14
|
+
*/
|
|
15
|
+
export const CHART_MIN_MARK = 1;
|
|
16
|
+
|
|
17
|
+
/** The room, in letters, the labels under a chart are thinned for: a phone's width, and a pane's. */
|
|
18
|
+
export const CHART_LABEL_ROOM = { narrow: 36, wide: 90 } as const;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The class a series is drawn in, by its place from nought: one of the six colours, or the
|
|
22
|
+
* neutral for what is past them, since a seventh series is never a seventh hue but the rest
|
|
23
|
+
* folded into one.
|
|
24
|
+
*/
|
|
25
|
+
export function seriesClass(index: number): string {
|
|
26
|
+
return Number.isInteger(index) && index >= 0 && index < CHART_SERIES
|
|
27
|
+
? `sc-series-${index + 1}`
|
|
28
|
+
: "sc-series-rest";
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** An amount a chart can place: a finite number. Anything else is nothing. */
|
|
32
|
+
function amountOf(value: number | undefined): number | undefined {
|
|
33
|
+
return typeof value === "number" && Number.isFinite(value) ? value : undefined;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** A share of a hundred as an attribute says it, to three places at most. */
|
|
37
|
+
export function chartMeasure(share: number): string {
|
|
38
|
+
const amount = amountOf(share) ?? 0;
|
|
39
|
+
return `${Math.round(amount * 1000) / 1000}%`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* How long each bar of a list is, of a hundred: its amount of the largest, or of `whole` where
|
|
44
|
+
* one is given. What is no amount, or below nothing, draws no bar; a small amount keeps the
|
|
45
|
+
* least a mark is drawn at.
|
|
46
|
+
*/
|
|
47
|
+
export function barLengths(
|
|
48
|
+
values: readonly (number | undefined)[],
|
|
49
|
+
whole?: number | undefined,
|
|
50
|
+
): readonly number[] {
|
|
51
|
+
const amounts = values.map((value) => Math.max(0, amountOf(value) ?? 0));
|
|
52
|
+
const given = amountOf(whole);
|
|
53
|
+
const full = given !== undefined && given > 0 ? given : Math.max(0, ...amounts);
|
|
54
|
+
return amounts.map((amount) =>
|
|
55
|
+
amount === 0 || full === 0 ? 0 : Math.min(100, Math.max(CHART_MIN_MARK, (amount * 100) / full)),
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** A part of a whole in a bar: where it starts and how wide it is, of a hundred, and its share of one. */
|
|
60
|
+
export interface SharePart {
|
|
61
|
+
readonly start: number;
|
|
62
|
+
readonly width: number;
|
|
63
|
+
readonly share: number;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The parts of a whole, one after the other, each as wide as its share; nothing where the whole
|
|
68
|
+
* is nothing. A part that is something keeps the least a mark is drawn at, which the largest
|
|
69
|
+
* part gives up: its `share` stays what it is.
|
|
70
|
+
*/
|
|
71
|
+
export function shareParts(values: readonly (number | undefined)[]): readonly SharePart[] {
|
|
72
|
+
const amounts = values.map((value) => Math.max(0, amountOf(value) ?? 0));
|
|
73
|
+
const total = amounts.reduce((sum, amount) => sum + amount, 0);
|
|
74
|
+
const widths = amounts.map((amount) =>
|
|
75
|
+
amount === 0 || total === 0 ? 0 : Math.max(CHART_MIN_MARK, (amount * 100) / total),
|
|
76
|
+
);
|
|
77
|
+
const over = widths.reduce((sum, width) => sum + width, 0) - 100;
|
|
78
|
+
const largest = widths.indexOf(Math.max(...widths));
|
|
79
|
+
let start = 0;
|
|
80
|
+
return amounts.map((amount, index) => {
|
|
81
|
+
const width =
|
|
82
|
+
index === largest && over > 0 ? (widths[index] ?? 0) - over : (widths[index] ?? 0);
|
|
83
|
+
const part = { start, width, share: total === 0 ? 0 : amount / total };
|
|
84
|
+
start += width;
|
|
85
|
+
return part;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** The scale of a chart: from where to where it measures, and the round amounts it marks. */
|
|
90
|
+
export interface ChartScale {
|
|
91
|
+
readonly min: number;
|
|
92
|
+
readonly max: number;
|
|
93
|
+
readonly ticks: readonly number[];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** A step and its multiples without the noise of the arithmetic: 0.6, never 0.6000000000000001. */
|
|
97
|
+
function round(value: number): number {
|
|
98
|
+
return Number(value.toPrecision(12)) + 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* The scale that holds some amounts: from zero, or from below it where an amount is, to a round
|
|
103
|
+
* number past the largest, marked in about `steps` round steps (1, 2, 2.5 or 5 of a power of
|
|
104
|
+
* ten; whole steps where every amount is whole). Zero to one where there is nothing to measure.
|
|
105
|
+
*/
|
|
106
|
+
export function chartScale(values: readonly (number | undefined)[], steps = 4): ChartScale {
|
|
107
|
+
const amounts = values.flatMap((value) => {
|
|
108
|
+
const amount = amountOf(value);
|
|
109
|
+
return amount === undefined ? [] : [amount];
|
|
110
|
+
});
|
|
111
|
+
const low = Math.min(0, ...amounts);
|
|
112
|
+
const high = Math.max(0, ...amounts);
|
|
113
|
+
const span = high - low;
|
|
114
|
+
if (span === 0) {
|
|
115
|
+
return { min: 0, max: 1, ticks: [0, 1] };
|
|
116
|
+
}
|
|
117
|
+
const rough = span / Math.max(1, steps);
|
|
118
|
+
const magnitude = 10 ** Math.floor(Math.log10(rough));
|
|
119
|
+
const whole = amounts.every((amount) => Number.isInteger(amount));
|
|
120
|
+
const step =
|
|
121
|
+
[1, 2, 2.5, 5, 10]
|
|
122
|
+
.map((nice) => round(nice * magnitude))
|
|
123
|
+
.find((nice) => nice >= rough && (!whole || Number.isInteger(nice))) ??
|
|
124
|
+
Math.max(1, round(10 * magnitude));
|
|
125
|
+
const min = round(Math.floor(round(low / step)) * step);
|
|
126
|
+
const max = round(Math.ceil(round(high / step)) * step);
|
|
127
|
+
const count = Math.round((max - min) / step);
|
|
128
|
+
return {
|
|
129
|
+
min,
|
|
130
|
+
max,
|
|
131
|
+
ticks: Array.from({ length: count + 1 }, (_, index) => round(min + index * step)),
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** Where a chart puts what it draws, each place a share of a hundred of the plot. */
|
|
136
|
+
export interface ChartLayout {
|
|
137
|
+
readonly scale: ChartScale;
|
|
138
|
+
/** The scale's marks from the top down, each with how far from the top its line stands. */
|
|
139
|
+
readonly ticks: readonly { readonly value: number; readonly at: number }[];
|
|
140
|
+
/** How far from the top zero stands: where a column starts. */
|
|
141
|
+
readonly zero: number;
|
|
142
|
+
/** How far across each point stands: the middle of its share of the width. */
|
|
143
|
+
readonly across: readonly number[];
|
|
144
|
+
/** For each series, how far from the top each point's amount stands, or nothing where it has none. */
|
|
145
|
+
readonly series: readonly (readonly (number | undefined)[])[];
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* The places of a chart of `points` points: one scale for every series, each amount as far from
|
|
150
|
+
* the top as it is from the scale's largest mark. A series is read for as many points as there
|
|
151
|
+
* are and no further.
|
|
152
|
+
*/
|
|
153
|
+
export function chartLayout(
|
|
154
|
+
points: number,
|
|
155
|
+
series: readonly (readonly (number | undefined)[])[],
|
|
156
|
+
steps?: number | undefined,
|
|
157
|
+
): ChartLayout {
|
|
158
|
+
const count = Math.max(0, Math.floor(amountOf(points) ?? 0));
|
|
159
|
+
const read = series.map((values) =>
|
|
160
|
+
Array.from({ length: count }, (_, index) => amountOf(values[index])),
|
|
161
|
+
);
|
|
162
|
+
const scale = chartScale(read.flat(), steps);
|
|
163
|
+
const span = scale.max - scale.min;
|
|
164
|
+
const at = (value: number) => ((scale.max - value) * 100) / span;
|
|
165
|
+
return {
|
|
166
|
+
scale,
|
|
167
|
+
ticks: [...scale.ticks].reverse().map((value) => ({ value, at: at(value) })),
|
|
168
|
+
zero: at(0),
|
|
169
|
+
across: Array.from({ length: count }, (_, index) => ((index + 0.5) * 100) / count),
|
|
170
|
+
series: read.map((values) =>
|
|
171
|
+
values.map((value) => (value === undefined ? undefined : at(value))),
|
|
172
|
+
),
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** A column: how far from the top it starts, how tall it is, and whether it hangs below zero. */
|
|
177
|
+
export interface ChartColumn {
|
|
178
|
+
readonly top: number;
|
|
179
|
+
readonly height: number;
|
|
180
|
+
readonly down: boolean;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* The column of an amount that stands `at` from the top, where zero stands at `zero`: from zero
|
|
185
|
+
* up to it, or down to it where it is below. Nothing at zero, and nothing where there is no
|
|
186
|
+
* amount; a small amount keeps the least a mark is drawn at.
|
|
187
|
+
*/
|
|
188
|
+
export function columnOf(at: number | undefined, zero: number): ChartColumn | undefined {
|
|
189
|
+
if (at === undefined || at === zero) {
|
|
190
|
+
return undefined;
|
|
191
|
+
}
|
|
192
|
+
const down = at > zero;
|
|
193
|
+
const height = Math.max(CHART_MIN_MARK, Math.abs(zero - at));
|
|
194
|
+
return { top: down ? zero : zero - height, height, down };
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* The points of a sparkline, of a hundred each way: from the first amount to the last, the
|
|
199
|
+
* largest near the top and the smallest near the bottom, with room left for the line's own
|
|
200
|
+
* width. One amount is a point in the middle; amounts that are all one are a level line.
|
|
201
|
+
*/
|
|
202
|
+
export function sparkPoints(
|
|
203
|
+
values: readonly (number | undefined)[],
|
|
204
|
+
): readonly { readonly x: number; readonly y: number }[] {
|
|
205
|
+
const amounts = values.flatMap((value) => {
|
|
206
|
+
const amount = amountOf(value);
|
|
207
|
+
return amount === undefined ? [] : [amount];
|
|
208
|
+
});
|
|
209
|
+
const low = Math.min(...amounts);
|
|
210
|
+
const span = Math.max(...amounts) - low;
|
|
211
|
+
return amounts.map((amount, index) => ({
|
|
212
|
+
x: amounts.length === 1 ? 50 : (index * 100) / (amounts.length - 1),
|
|
213
|
+
y: span === 0 ? 50 : 88 - ((amount - low) * 76) / span,
|
|
214
|
+
}));
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/** How much room a label takes, in letters: a wide letter, a Hangul syllable say, counts as two. */
|
|
218
|
+
function lettersOf(label: string): number {
|
|
219
|
+
let letters = 0;
|
|
220
|
+
for (const letter of label) {
|
|
221
|
+
letters += (letter.codePointAt(0) ?? 0) >= 0x1100 ? 2 : 1;
|
|
222
|
+
}
|
|
223
|
+
return letters;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* How many points apart the labels under a chart stand where there is room for `room` letters:
|
|
228
|
+
* as near as they fit with two letters between them. One where every label fits.
|
|
229
|
+
*/
|
|
230
|
+
export function labelStep(labels: readonly string[], room: number): number {
|
|
231
|
+
if (labels.length === 0) {
|
|
232
|
+
return 1;
|
|
233
|
+
}
|
|
234
|
+
const longest = Math.max(...labels.map(lettersOf));
|
|
235
|
+
const fit = Math.max(1, Math.floor((amountOf(room) ?? 0) / (longest + 2)));
|
|
236
|
+
return Math.ceil(labels.length / fit);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* The points labelled, of `count`, where every `step`th is: counted back from the last, which
|
|
241
|
+
* always is, since the latest is what a reader looks for.
|
|
242
|
+
*/
|
|
243
|
+
export function labelledPoints(count: number, step: number): ReadonlySet<number> {
|
|
244
|
+
const shown = new Set<number>();
|
|
245
|
+
const every = Math.max(1, Math.floor(amountOf(step) ?? 1));
|
|
246
|
+
for (let index = Math.floor(amountOf(count) ?? 0) - 1; index >= 0; index -= every) {
|
|
247
|
+
shown.add(index);
|
|
248
|
+
}
|
|
249
|
+
return shown;
|
|
250
|
+
}
|