@skillcdn/console 0.4.7 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -14
- package/SKILLCDN.md +5 -3
- package/dist/agent-page.d.ts +44 -0
- package/dist/agent-page.d.ts.map +1 -0
- package/dist/agent-page.js +415 -0
- package/dist/agent-page.js.map +1 -0
- package/dist/agent-stream.d.ts +52 -0
- package/dist/agent-stream.d.ts.map +1 -0
- package/dist/agent-stream.js +155 -0
- package/dist/agent-stream.js.map +1 -0
- package/dist/api.d.ts +12 -6
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +11 -5
- package/dist/api.js.map +1 -1
- package/dist/avatar.d.ts +137 -0
- package/dist/avatar.d.ts.map +1 -0
- package/dist/avatar.js +1216 -0
- package/dist/avatar.js.map +1 -0
- package/dist/charts.d.ts +103 -0
- package/dist/charts.d.ts.map +1 -0
- package/dist/charts.js +182 -0
- package/dist/charts.js.map +1 -0
- package/dist/cli/cli.d.ts +39 -1
- package/dist/cli/cli.d.ts.map +1 -1
- package/dist/cli/cli.js +2424 -296
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/command-words.d.ts +20 -0
- package/dist/cli/command-words.d.ts.map +1 -0
- package/dist/cli/command-words.js +51 -0
- package/dist/cli/command-words.js.map +1 -0
- package/dist/cli/credentials.d.ts +59 -5
- package/dist/cli/credentials.d.ts.map +1 -1
- package/dist/cli/credentials.js +128 -16
- package/dist/cli/credentials.js.map +1 -1
- package/dist/cli/directory.d.ts +19 -4
- package/dist/cli/directory.d.ts.map +1 -1
- package/dist/cli/directory.js +16 -8
- package/dist/cli/directory.js.map +1 -1
- package/dist/cli/format.d.ts +91 -8
- package/dist/cli/format.d.ts.map +1 -1
- package/dist/cli/format.js +386 -57
- package/dist/cli/format.js.map +1 -1
- package/dist/cli/help.d.ts +13 -4
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +202 -62
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/main.js +94 -0
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/pack.d.ts +69 -36
- package/dist/cli/pack.d.ts.map +1 -1
- package/dist/cli/pack.js +241 -188
- package/dist/cli/pack.js.map +1 -1
- package/dist/cli/plugin-check.d.ts +42 -0
- package/dist/cli/plugin-check.d.ts.map +1 -1
- package/dist/cli/plugin-check.js +221 -36
- package/dist/cli/plugin-check.js.map +1 -1
- package/dist/cli/plugin-cli.d.ts +6 -1
- package/dist/cli/plugin-cli.d.ts.map +1 -1
- package/dist/cli/plugin-cli.js +21 -4
- package/dist/cli/plugin-cli.js.map +1 -1
- package/dist/cli/plugin-main.js +1 -0
- package/dist/cli/plugin-main.js.map +1 -1
- package/dist/cli/runner-host.d.ts +36 -0
- package/dist/cli/runner-host.d.ts.map +1 -0
- package/dist/cli/runner-host.js +154 -0
- package/dist/cli/runner-host.js.map +1 -0
- package/dist/cli/serve.d.ts +33 -1
- package/dist/cli/serve.d.ts.map +1 -1
- package/dist/cli/serve.js +275 -6
- package/dist/cli/serve.js.map +1 -1
- package/dist/cli/setup-machine.d.ts +36 -0
- package/dist/cli/setup-machine.d.ts.map +1 -0
- package/dist/cli/setup-machine.js +109 -0
- package/dist/cli/setup-machine.js.map +1 -0
- package/dist/client.d.ts +189 -10
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +192 -57
- package/dist/client.js.map +1 -1
- package/dist/compat.d.ts +1 -1
- package/dist/compat.js +2 -2
- package/dist/components/agent-page.d.ts +384 -0
- package/dist/components/agent-page.d.ts.map +1 -0
- package/dist/components/agent-page.js +985 -0
- package/dist/components/agent-page.js.map +1 -0
- package/dist/components/agents.d.ts +102 -0
- package/dist/components/agents.d.ts.map +1 -0
- package/dist/components/agents.js +246 -0
- package/dist/components/agents.js.map +1 -0
- package/dist/components/calendar.d.ts +17 -17
- package/dist/components/calendar.d.ts.map +1 -1
- package/dist/components/calendar.js +7 -2
- package/dist/components/calendar.js.map +1 -1
- package/dist/components/charts.d.ts +157 -0
- package/dist/components/charts.d.ts.map +1 -0
- package/dist/components/charts.js +182 -0
- package/dist/components/charts.js.map +1 -0
- package/dist/components/comments.d.ts +2 -0
- package/dist/components/comments.d.ts.map +1 -1
- package/dist/components/comments.js +1 -1
- package/dist/components/comments.js.map +1 -1
- package/dist/components/connect.d.ts.map +1 -1
- package/dist/components/connect.js +7 -2
- package/dist/components/connect.js.map +1 -1
- package/dist/components/decision-form.d.ts +21 -0
- package/dist/components/decision-form.d.ts.map +1 -1
- package/dist/components/decision-form.js +20 -6
- package/dist/components/decision-form.js.map +1 -1
- package/dist/components/decision-list.d.ts +24 -0
- package/dist/components/decision-list.d.ts.map +1 -1
- package/dist/components/decision-list.js +54 -5
- package/dist/components/decision-list.js.map +1 -1
- package/dist/components/desk-records.d.ts +102 -0
- package/dist/components/desk-records.d.ts.map +1 -0
- package/dist/components/desk-records.js +221 -0
- package/dist/components/desk-records.js.map +1 -0
- package/dist/components/desk.d.ts +85 -0
- package/dist/components/desk.d.ts.map +1 -0
- package/dist/components/desk.js +135 -0
- package/dist/components/desk.js.map +1 -0
- package/dist/components/event-feed.d.ts.map +1 -1
- package/dist/components/event-feed.js +26 -1
- package/dist/components/event-feed.js.map +1 -1
- package/dist/components/home.d.ts +12 -1
- package/dist/components/home.d.ts.map +1 -1
- package/dist/components/home.js +175 -16
- package/dist/components/home.js.map +1 -1
- package/dist/components/my-decisions.d.ts +5 -0
- package/dist/components/my-decisions.d.ts.map +1 -1
- package/dist/components/my-decisions.js +3 -3
- package/dist/components/my-decisions.js.map +1 -1
- package/dist/components/people.d.ts +17 -0
- package/dist/components/people.d.ts.map +1 -1
- package/dist/components/people.js +55 -19
- package/dist/components/people.js.map +1 -1
- package/dist/components/picker.d.ts +2 -0
- package/dist/components/picker.d.ts.map +1 -1
- package/dist/components/picker.js +1 -1
- package/dist/components/picker.js.map +1 -1
- package/dist/components/pictures.d.ts +38 -10
- package/dist/components/pictures.d.ts.map +1 -1
- package/dist/components/pictures.js +195 -40
- package/dist/components/pictures.js.map +1 -1
- package/dist/components/plugin-events.d.ts +29 -0
- package/dist/components/plugin-events.d.ts.map +1 -0
- package/dist/components/plugin-events.js +139 -0
- package/dist/components/plugin-events.js.map +1 -0
- package/dist/components/plugin-frame.d.ts.map +1 -1
- package/dist/components/plugin-frame.js +14 -37
- package/dist/components/plugin-frame.js.map +1 -1
- package/dist/components/plugin-settings.d.ts.map +1 -1
- package/dist/components/plugin-settings.js +58 -7
- package/dist/components/plugin-settings.js.map +1 -1
- package/dist/components/projects.d.ts.map +1 -1
- package/dist/components/projects.js +30 -10
- package/dist/components/projects.js.map +1 -1
- package/dist/components/rules.d.ts +8 -10
- package/dist/components/rules.d.ts.map +1 -1
- package/dist/components/rules.js +36 -14
- package/dist/components/rules.js.map +1 -1
- package/dist/components/sessions.d.ts.map +1 -1
- package/dist/components/sessions.js +8 -4
- package/dist/components/sessions.js.map +1 -1
- package/dist/components/setup.d.ts +59 -0
- package/dist/components/setup.d.ts.map +1 -0
- package/dist/components/setup.js +93 -0
- package/dist/components/setup.js.map +1 -0
- package/dist/components/sign-in.js +1 -1
- package/dist/components/sign-in.js.map +1 -1
- package/dist/components/task-form.d.ts.map +1 -1
- package/dist/components/task-form.js +2 -2
- package/dist/components/task-form.js.map +1 -1
- package/dist/components/task-list.d.ts +7 -6
- package/dist/components/task-list.d.ts.map +1 -1
- package/dist/components/task-list.js.map +1 -1
- package/dist/components/task-view.d.ts +3 -0
- package/dist/components/task-view.d.ts.map +1 -1
- package/dist/components/task-view.js +1 -1
- package/dist/components/task-view.js.map +1 -1
- package/dist/components/ui.d.ts +78 -8
- package/dist/components/ui.d.ts.map +1 -1
- package/dist/components/ui.js +88 -9
- package/dist/components/ui.js.map +1 -1
- package/dist/components/work.d.ts +5 -5
- package/dist/components/work.d.ts.map +1 -1
- package/dist/components/work.js.map +1 -1
- package/dist/components/workspace.d.ts +17 -0
- package/dist/components/workspace.d.ts.map +1 -1
- package/dist/components/workspace.js +129 -2
- package/dist/components/workspace.js.map +1 -1
- package/dist/connect-page.d.ts.map +1 -1
- package/dist/connect-page.js +5 -2
- package/dist/connect-page.js.map +1 -1
- package/dist/console.css +7551 -4580
- package/dist/console.d.ts +20 -0
- package/dist/console.d.ts.map +1 -1
- package/dist/console.js +331 -57
- package/dist/console.js.map +1 -1
- package/dist/data.d.ts +22 -1
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +62 -34
- package/dist/data.js.map +1 -1
- package/dist/desk-page.d.ts +38 -0
- package/dist/desk-page.d.ts.map +1 -0
- package/dist/desk-page.js +184 -0
- package/dist/desk-page.js.map +1 -0
- package/dist/desk-records-page.d.ts +18 -0
- package/dist/desk-records-page.d.ts.map +1 -0
- package/dist/desk-records-page.js +130 -0
- package/dist/desk-records-page.js.map +1 -0
- package/dist/desk-records.d.ts +247 -0
- package/dist/desk-records.d.ts.map +1 -0
- package/dist/desk-records.js +543 -0
- package/dist/desk-records.js.map +1 -0
- package/dist/desk.d.ts +122 -0
- package/dist/desk.d.ts.map +1 -0
- package/dist/desk.js +211 -0
- package/dist/desk.js.map +1 -0
- package/dist/feed-stream.d.ts +39 -0
- package/dist/feed-stream.d.ts.map +1 -0
- package/dist/feed-stream.js +117 -0
- package/dist/feed-stream.js.map +1 -0
- package/dist/glances.d.ts +39 -0
- package/dist/glances.d.ts.map +1 -0
- package/dist/glances.js +94 -0
- package/dist/glances.js.map +1 -0
- package/dist/home-tiles.d.ts +69 -5
- package/dist/home-tiles.d.ts.map +1 -1
- package/dist/home-tiles.js +347 -9
- package/dist/home-tiles.js.map +1 -1
- package/dist/i18n/en.d.ts +773 -3
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +770 -9
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/ko.d.ts.map +1 -1
- package/dist/i18n/ko.js +736 -9
- package/dist/i18n/ko.js.map +1 -1
- package/dist/index.d.ts +19 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -5
- package/dist/index.js.map +1 -1
- package/dist/limits.d.ts +67 -0
- package/dist/limits.d.ts.map +1 -1
- package/dist/limits.js +67 -0
- package/dist/limits.js.map +1 -1
- package/dist/onboarding.d.ts +21 -0
- package/dist/onboarding.d.ts.map +1 -0
- package/dist/onboarding.js +43 -0
- package/dist/onboarding.js.map +1 -0
- package/dist/persona.d.ts +34 -0
- package/dist/persona.d.ts.map +1 -0
- package/dist/persona.js +71 -0
- package/dist/persona.js.map +1 -0
- package/dist/plugin/context.d.ts +42 -11
- package/dist/plugin/context.d.ts.map +1 -1
- package/dist/plugin/limits.d.ts +2 -0
- package/dist/plugin/limits.d.ts.map +1 -1
- package/dist/plugin/limits.js +2 -0
- package/dist/plugin/limits.js.map +1 -1
- package/dist/plugin/manifest.d.ts +13 -0
- package/dist/plugin/manifest.d.ts.map +1 -1
- package/dist/plugin/manifest.js +34 -4
- package/dist/plugin/manifest.js.map +1 -1
- package/dist/plugin/rest-schemas.d.ts +56 -0
- package/dist/plugin/rest-schemas.d.ts.map +1 -1
- package/dist/plugin/rest-schemas.js +42 -0
- package/dist/plugin/rest-schemas.js.map +1 -1
- package/dist/plugin/sandbox.d.ts.map +1 -1
- package/dist/plugin/sandbox.js +4 -1
- package/dist/plugin/sandbox.js.map +1 -1
- package/dist/plugin/testing.d.ts +6 -2
- package/dist/plugin/testing.d.ts.map +1 -1
- package/dist/plugin/testing.js +52 -10
- package/dist/plugin/testing.js.map +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +1 -1
- package/dist/plugin.js.map +1 -1
- package/dist/records.d.ts +283 -0
- package/dist/records.d.ts.map +1 -0
- package/dist/records.js +543 -0
- package/dist/records.js.map +1 -0
- package/dist/router.d.ts +50 -3
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +78 -7
- package/dist/router.js.map +1 -1
- package/dist/routes.d.ts +12 -2
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +14 -1
- package/dist/routes.js.map +1 -1
- package/dist/rules.d.ts +30 -11
- package/dist/rules.d.ts.map +1 -1
- package/dist/rules.js +99 -42
- package/dist/rules.js.map +1 -1
- package/dist/runner/acp.d.ts +20 -0
- package/dist/runner/acp.d.ts.map +1 -0
- package/dist/runner/acp.js +1132 -0
- package/dist/runner/acp.js.map +1 -0
- package/dist/runner/claude.d.ts +13 -0
- package/dist/runner/claude.d.ts.map +1 -0
- package/dist/runner/claude.js +615 -0
- package/dist/runner/claude.js.map +1 -0
- package/dist/runner/codex.d.ts +19 -0
- package/dist/runner/codex.d.ts.map +1 -0
- package/dist/runner/codex.js +597 -0
- package/dist/runner/codex.js.map +1 -0
- package/dist/runner/config.d.ts +35 -0
- package/dist/runner/config.d.ts.map +1 -0
- package/dist/runner/config.js +74 -0
- package/dist/runner/config.js.map +1 -0
- package/dist/runner/desk.d.ts +81 -0
- package/dist/runner/desk.d.ts.map +1 -0
- package/dist/runner/desk.js +303 -0
- package/dist/runner/desk.js.map +1 -0
- package/dist/runner/launchd.d.ts +7 -0
- package/dist/runner/launchd.d.ts.map +1 -0
- package/dist/runner/launchd.js +78 -0
- package/dist/runner/launchd.js.map +1 -0
- package/dist/runner/message.d.ts +66 -0
- package/dist/runner/message.d.ts.map +1 -0
- package/dist/runner/message.js +181 -0
- package/dist/runner/message.js.map +1 -0
- package/dist/runner/modules.d.ts +13 -0
- package/dist/runner/modules.d.ts.map +1 -0
- package/dist/runner/modules.js +30 -0
- package/dist/runner/modules.js.map +1 -0
- package/dist/runner/process.d.ts +7 -0
- package/dist/runner/process.d.ts.map +1 -0
- package/dist/runner/process.js +65 -0
- package/dist/runner/process.js.map +1 -0
- package/dist/runner/redact.d.ts +48 -0
- package/dist/runner/redact.d.ts.map +1 -0
- package/dist/runner/redact.js +214 -0
- package/dist/runner/redact.js.map +1 -0
- package/dist/runner/registry.d.ts +37 -0
- package/dist/runner/registry.d.ts.map +1 -0
- package/dist/runner/registry.js +26 -0
- package/dist/runner/registry.js.map +1 -0
- package/dist/runner/runner.d.ts +130 -0
- package/dist/runner/runner.d.ts.map +1 -0
- package/dist/runner/runner.js +1551 -0
- package/dist/runner/runner.js.map +1 -0
- package/dist/runner/slack.d.ts +16 -0
- package/dist/runner/slack.d.ts.map +1 -0
- package/dist/runner/slack.js +157 -0
- package/dist/runner/slack.js.map +1 -0
- package/dist/runner/systemd-user.d.ts +7 -0
- package/dist/runner/systemd-user.d.ts.map +1 -0
- package/dist/runner/systemd-user.js +93 -0
- package/dist/runner/systemd-user.js.map +1 -0
- package/dist/runner/task-scheduler.d.ts +38 -0
- package/dist/runner/task-scheduler.d.ts.map +1 -0
- package/dist/runner/task-scheduler.js +216 -0
- package/dist/runner/task-scheduler.js.map +1 -0
- package/dist/runner/types.d.ts +315 -0
- package/dist/runner/types.d.ts.map +1 -0
- package/dist/runner/types.js +24 -0
- package/dist/runner/types.js.map +1 -0
- package/dist/runner.d.ts +18 -0
- package/dist/runner.d.ts.map +1 -0
- package/dist/runner.js +20 -0
- package/dist/runner.js.map +1 -0
- package/dist/schemas.d.ts +6082 -1295
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +930 -31
- package/dist/schemas.js.map +1 -1
- package/dist/services.d.ts +110 -0
- package/dist/services.d.ts.map +1 -0
- package/dist/services.js +305 -0
- package/dist/services.js.map +1 -0
- package/dist/setup-guide.d.ts +64 -0
- package/dist/setup-guide.d.ts.map +1 -0
- package/dist/setup-guide.js +256 -0
- package/dist/setup-guide.js.map +1 -0
- package/dist/setup-page.d.ts +6 -0
- package/dist/setup-page.d.ts.map +1 -0
- package/dist/setup-page.js +29 -0
- package/dist/setup-page.js.map +1 -0
- package/dist/sse.d.ts +15 -0
- package/dist/sse.d.ts.map +1 -0
- package/dist/sse.js +73 -0
- package/dist/sse.js.map +1 -0
- package/dist/tab-title.d.ts +6 -0
- package/dist/tab-title.d.ts.map +1 -0
- package/dist/tab-title.js +22 -0
- package/dist/tab-title.js.map +1 -0
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +3 -0
- package/dist/tokens.js.map +1 -1
- package/dist/use-action.d.ts +5 -2
- package/dist/use-action.d.ts.map +1 -1
- package/dist/use-action.js +6 -1
- package/dist/use-action.js.map +1 -1
- package/dist/vocabulary.d.ts +84 -4
- package/dist/vocabulary.d.ts.map +1 -1
- package/dist/vocabulary.js +115 -3
- package/dist/vocabulary.js.map +1 -1
- package/docs/specs/cli.md +147 -41
- package/docs/specs/plugins.md +37 -27
- package/docs/specs/records.md +113 -0
- package/docs/specs/rest.md +155 -20
- package/docs/specs/runner.md +347 -0
- package/package.json +12 -3
- package/skills/building-a-console/SKILL.md +4 -4
- package/skills/building-a-console/references/configuring.md +1 -0
- package/skills/building-a-plugin/SKILL.md +7 -7
- package/skills/deploying-a-console/SKILL.md +4 -4
- package/skills/deploying-a-console/references/resources.md +48 -8
- package/skills/deploying-a-console/references/running-it-again.md +3 -2
- package/skills/keeping-a-desk/SKILL.md +133 -0
- package/skills/keeping-a-desk/collections.md +96 -0
- package/skills/planning-the-board/SKILL.md +14 -18
- package/skills/planning-the-board/references/a-task.md +2 -2
- package/skills/planning-the-board/references/project-rules.md +13 -14
- package/skills/planning-the-board/references/setting-up.md +22 -9
- package/skills/running-an-agent/SKILL.md +107 -0
- package/skills/running-an-agent/references/slack-app.md +61 -0
- package/skills/working-the-board/SKILL.md +66 -39
- package/skills/working-the-board/references/terms.md +9 -5
- package/skills/working-the-board/references/the-pack.md +14 -9
- package/skills/working-the-board/references/the-sentence.md +2 -2
- package/src/agent-page.tsx +1039 -0
- package/src/agent-stream.ts +199 -0
- package/src/api.ts +317 -2
- package/src/avatar.ts +1506 -0
- package/src/charts.ts +250 -0
- package/src/cli/cli.ts +3210 -503
- package/src/cli/command-words.ts +56 -0
- package/src/cli/credentials.ts +188 -16
- package/src/cli/directory.ts +28 -10
- package/src/cli/format.ts +470 -67
- package/src/cli/help.ts +233 -61
- package/src/cli/main.ts +89 -0
- package/src/cli/pack.ts +332 -263
- package/src/cli/plugin-check.ts +275 -34
- package/src/cli/plugin-cli.ts +28 -4
- package/src/cli/plugin-main.ts +1 -0
- package/src/cli/runner-host.ts +188 -0
- package/src/cli/serve.ts +320 -5
- package/src/cli/setup-machine.ts +153 -0
- package/src/client.ts +711 -126
- package/src/compat.ts +2 -2
- package/src/components/agent-page.tsx +1946 -0
- package/src/components/agents.tsx +638 -0
- package/src/components/calendar.tsx +74 -53
- package/src/components/charts.tsx +680 -0
- package/src/components/comments.tsx +3 -0
- package/src/components/connect.tsx +37 -2
- package/src/components/decision-form.tsx +89 -51
- package/src/components/decision-list.tsx +140 -4
- package/src/components/desk-records.tsx +724 -0
- package/src/components/desk.tsx +471 -0
- package/src/components/event-feed.tsx +30 -1
- package/src/components/home.tsx +353 -12
- package/src/components/my-decisions.tsx +8 -2
- package/src/components/people.tsx +300 -203
- package/src/components/picker.tsx +3 -1
- package/src/components/pictures.tsx +256 -44
- package/src/components/plugin-events.ts +159 -0
- package/src/components/plugin-frame.tsx +14 -38
- package/src/components/plugin-settings.tsx +178 -22
- package/src/components/projects.tsx +33 -15
- package/src/components/rules.tsx +96 -36
- package/src/components/sessions.tsx +7 -4
- package/src/components/setup.tsx +252 -0
- package/src/components/sign-in.tsx +1 -1
- package/src/components/task-form.tsx +11 -2
- package/src/components/task-list.tsx +7 -6
- package/src/components/task-view.tsx +4 -0
- package/src/components/ui.tsx +169 -25
- package/src/components/work.tsx +9 -9
- package/src/components/workspace.tsx +345 -4
- package/src/connect-page.tsx +15 -2
- package/src/console.tsx +657 -83
- package/src/data.ts +109 -43
- package/src/desk-page.tsx +332 -0
- package/src/desk-records-page.tsx +256 -0
- package/src/desk-records.ts +808 -0
- package/src/desk.ts +329 -0
- package/src/feed-stream.ts +144 -0
- package/src/glances.ts +132 -0
- package/src/home-tiles.ts +411 -9
- package/src/i18n/en.ts +828 -10
- package/src/i18n/ko.ts +792 -10
- package/src/index.ts +172 -3
- package/src/limits.ts +67 -0
- package/src/onboarding.ts +84 -0
- package/src/persona.ts +100 -0
- package/src/plugin/context.ts +55 -12
- package/src/plugin/limits.ts +2 -0
- package/src/plugin/manifest.ts +42 -3
- package/src/plugin/rest-schemas.ts +46 -0
- package/src/plugin/sandbox.ts +4 -1
- package/src/plugin/testing.ts +63 -12
- package/src/plugin.ts +2 -0
- package/src/records.ts +702 -0
- package/src/router.ts +120 -10
- package/src/routes.ts +17 -1
- package/src/rules.ts +109 -44
- package/src/runner/acp.ts +1267 -0
- package/src/runner/claude.ts +695 -0
- package/src/runner/codex.ts +691 -0
- package/src/runner/config.ts +97 -0
- package/src/runner/desk.ts +377 -0
- package/src/runner/launchd.ts +86 -0
- package/src/runner/message.ts +232 -0
- package/src/runner/modules.ts +30 -0
- package/src/runner/process.ts +72 -0
- package/src/runner/redact.ts +242 -0
- package/src/runner/registry.ts +67 -0
- package/src/runner/runner.ts +1879 -0
- package/src/runner/slack.ts +180 -0
- package/src/runner/systemd-user.ts +103 -0
- package/src/runner/task-scheduler.ts +236 -0
- package/src/runner/types.ts +334 -0
- package/src/runner.ts +110 -0
- package/src/schemas.ts +1183 -30
- package/src/services.ts +424 -0
- package/src/setup-guide.ts +336 -0
- package/src/setup-page.tsx +46 -0
- package/src/sse.ts +84 -0
- package/src/styles/README.md +111 -0
- package/src/styles/base.css +130 -0
- package/src/styles/console.css +85 -7095
- package/src/styles/drawn-by-pages.json +256 -0
- package/src/styles/pages/agents.css +1195 -0
- package/src/styles/pages/board.css +380 -0
- package/src/styles/pages/calendar.css +214 -0
- package/src/styles/pages/connect.css +182 -0
- package/src/styles/pages/decisions.css +370 -0
- package/src/styles/pages/desk.css +126 -0
- package/src/styles/pages/documents.css +273 -0
- package/src/styles/pages/feed.css +118 -0
- package/src/styles/pages/home.css +718 -0
- package/src/styles/pages/people.css +90 -0
- package/src/styles/pages/plugins.css +212 -0
- package/src/styles/pages/roadmap.css +377 -0
- package/src/styles/pages/settings.css +171 -0
- package/src/styles/pages/shell.css +208 -0
- package/src/styles/pages/sign-in.css +178 -0
- package/src/styles/pages/task.css +108 -0
- package/src/styles/pages/thread.css +331 -0
- package/src/styles/pages/work.css +68 -0
- package/src/styles/parts/avatar.css +82 -0
- package/src/styles/parts/badge.css +227 -0
- package/src/styles/parts/bars.css +80 -0
- package/src/styles/parts/button.css +99 -0
- package/src/styles/parts/calendar.css +547 -0
- package/src/styles/parts/callout.css +41 -0
- package/src/styles/parts/category.css +8 -0
- package/src/styles/parts/chart.css +173 -0
- package/src/styles/parts/chip.css +90 -0
- package/src/styles/parts/code.css +48 -0
- package/src/styles/parts/count.css +27 -0
- package/src/styles/parts/crumbs.css +61 -0
- package/src/styles/parts/detail.css +110 -0
- package/src/styles/parts/empty.css +21 -0
- package/src/styles/parts/eyebrow.css +9 -0
- package/src/styles/parts/facts.css +147 -0
- package/src/styles/parts/figures.css +65 -0
- package/src/styles/parts/files.css +38 -0
- package/src/styles/parts/filters.css +42 -0
- package/src/styles/parts/form.css +109 -0
- package/src/styles/parts/frame.css +45 -0
- package/src/styles/parts/input.css +243 -0
- package/src/styles/parts/legend.css +48 -0
- package/src/styles/parts/links.css +37 -0
- package/src/styles/parts/mark.css +79 -0
- package/src/styles/parts/menu.css +147 -0
- package/src/styles/parts/page.css +174 -0
- package/src/styles/parts/pager.css +19 -0
- package/src/styles/parts/panel.css +33 -0
- package/src/styles/parts/person.css +257 -0
- package/src/styles/parts/picker.css +185 -0
- package/src/styles/parts/progress.css +25 -0
- package/src/styles/parts/prose.css +128 -0
- package/src/styles/parts/rows.css +63 -0
- package/src/styles/parts/series.css +32 -0
- package/src/styles/parts/settings.css +101 -0
- package/src/styles/parts/share.css +25 -0
- package/src/styles/parts/spark.css +23 -0
- package/src/styles/parts/spinner.css +29 -0
- package/src/styles/parts/stat.css +69 -0
- package/src/styles/parts/steps.css +68 -0
- package/src/styles/parts/tabs.css +175 -0
- package/src/styles/parts/text.css +61 -0
- package/src/styles/parts/toggle.css +71 -0
- package/src/styles/parts/workers.css +37 -0
- package/src/styles/tokens.css +295 -0
- package/src/tab-title.ts +25 -0
- package/src/tokens.ts +3 -0
- package/src/use-action.ts +7 -2
- package/src/vocabulary.ts +151 -3
- package/template/desk-web/README.md +8 -0
- package/template/desk-web/index.html +13 -0
- package/template/desk-web/package.json +25 -0
- package/template/desk-web/src/main.tsx +24 -0
- package/template/desk-web/src/page.tsx +51 -0
- package/template/desk-web/tsconfig.json +16 -0
- package/template/desk-web/vite.config.ts +15 -0
package/src/home-tiles.ts
CHANGED
|
@@ -12,8 +12,10 @@ import type {
|
|
|
12
12
|
// The front page as a person arranges it (ADR-0061): one grid of square cells, on which the
|
|
13
13
|
// projects and the plugins' widgets are tiles alike, each at a place of its own. What there is
|
|
14
14
|
// comes from what the person may see; where each stands comes from what they kept, one layout
|
|
15
|
-
// for each width of the grid.
|
|
16
|
-
// and
|
|
15
|
+
// for each width of the grid. Someone who has arranged nothing sees the page composed edge to
|
|
16
|
+
// edge, and a width nobody arranged when another was is closed up from the sizes the tiles come
|
|
17
|
+
// in (ADR-0082); on one they arranged, what is new takes the first room. What they took off stays
|
|
18
|
+
// off, and what they may no longer see waits out of sight for its place. Pure functions, so that the
|
|
17
19
|
// page and the tests read the same arrangement.
|
|
18
20
|
|
|
19
21
|
/** The grid's columns at each width: wide, a laptop's, a tablet's, a phone's. */
|
|
@@ -68,7 +70,95 @@ export interface PlacedTile {
|
|
|
68
70
|
readonly size: HomeTileSize;
|
|
69
71
|
}
|
|
70
72
|
|
|
71
|
-
|
|
73
|
+
/**
|
|
74
|
+
* A project comes as an icon, a card, and at a glance of its board in three shapes (ADR-0105):
|
|
75
|
+
* `medium` 4×2, `large` 4×4 and `wide` 8×2. Not `full`: at 8×4 a glance had more room than it
|
|
76
|
+
* has things to say.
|
|
77
|
+
*/
|
|
78
|
+
const PROJECT_SIZES: readonly HomeTileSize[] = ["icon", "small", "medium", "large", "wide"];
|
|
79
|
+
/** The sizes the projects take together where a width is closed up: the small ones a person kept them at before a glance existed. */
|
|
80
|
+
const PROJECT_ALIKE_SIZES: readonly HomeTileSize[] = ["icon", "small"];
|
|
81
|
+
|
|
82
|
+
/** Whether a project at a size shows a glance of its board: what is at work in it, and its roadmap (ADR-0105). */
|
|
83
|
+
export function isGlanceSize(size: HomeTileSize): boolean {
|
|
84
|
+
return size === "medium" || size === "large" || size === "wide";
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** The projects a page shows at a glance, in its order: the ones whose boards are read for it. */
|
|
88
|
+
export function glanceProjects(
|
|
89
|
+
shown: readonly { readonly tile: HomeTile; readonly size: HomeTileSize }[],
|
|
90
|
+
): RestProject[] {
|
|
91
|
+
return shown.flatMap(({ tile, size }) =>
|
|
92
|
+
tile.kind === "project" && isGlanceSize(size) ? [tile.project] : [],
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The heights a glance is laid out with, in rem, which its stylesheet gives the same parts: a
|
|
98
|
+
* list's heading, a task's row, a goal's row of two lines, the line that says how many more, and
|
|
99
|
+
* the room between two lists, a hairline in it.
|
|
100
|
+
*/
|
|
101
|
+
export const GLANCE_REM = { heading: 1.5, task: 2.25, goal: 3, more: 1.5, between: 1.5 } as const;
|
|
102
|
+
|
|
103
|
+
/** The room a glance's lists are taken to have before it is laid out, in rem, by the size of the tile. */
|
|
104
|
+
export const GLANCE_ROOM_GUESS: Partial<Record<HomeTileSize, number>> = {
|
|
105
|
+
medium: 6,
|
|
106
|
+
large: 20,
|
|
107
|
+
wide: 12,
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
/** A list of a glance: the rows it could show, how many there are in all, and the height of a row, in rem. */
|
|
111
|
+
export interface GlanceList {
|
|
112
|
+
readonly rows: number;
|
|
113
|
+
readonly total: number;
|
|
114
|
+
readonly row: number;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** The height a list takes with so many rows shown: nothing with none, the line of how many more while some are left out. */
|
|
118
|
+
function listHeight(shown: number, list: GlanceList): number {
|
|
119
|
+
return shown === 0
|
|
120
|
+
? 0
|
|
121
|
+
: GLANCE_REM.heading + shown * list.row + (shown < list.total ? GLANCE_REM.more : 0);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* The rows of a glance's lists, one under the other, that a room holds, each row whole (ADR-0105):
|
|
126
|
+
* the steps give rows in turn, each step a list and the rows it may have by then, so that the
|
|
127
|
+
* lists that matter most are seen first and the others as the room allows. A list with no rows to
|
|
128
|
+
* show takes no room.
|
|
129
|
+
*/
|
|
130
|
+
export function glanceFit(
|
|
131
|
+
room: number,
|
|
132
|
+
lists: readonly GlanceList[],
|
|
133
|
+
steps: readonly (readonly [number, number])[],
|
|
134
|
+
): number[] {
|
|
135
|
+
const shown = lists.map(() => 0);
|
|
136
|
+
if (!Number.isFinite(room)) {
|
|
137
|
+
return shown;
|
|
138
|
+
}
|
|
139
|
+
const height = (counts: readonly number[]): number => {
|
|
140
|
+
const used = lists.map((list, at) => listHeight(counts[at] ?? 0, list));
|
|
141
|
+
const showing = used.filter((value) => value > 0).length;
|
|
142
|
+
return (
|
|
143
|
+
used.reduce((sum, value) => sum + value, 0) + Math.max(0, showing - 1) * GLANCE_REM.between
|
|
144
|
+
);
|
|
145
|
+
};
|
|
146
|
+
for (const [at, upTo] of steps) {
|
|
147
|
+
const list = lists[at];
|
|
148
|
+
if (list === undefined) {
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
const limit = Math.min(upTo, list.rows);
|
|
152
|
+
while ((shown[at] ?? 0) < limit) {
|
|
153
|
+
const next = shown.map((count, index) => (index === at ? count + 1 : count));
|
|
154
|
+
if (height(next) > room) {
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
shown[at] = (shown[at] ?? 0) + 1;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return shown;
|
|
161
|
+
}
|
|
72
162
|
|
|
73
163
|
/**
|
|
74
164
|
* Every tile the person may see: the widgets of the plugins that are on, which they hold a role
|
|
@@ -237,12 +327,111 @@ function keptAt(
|
|
|
237
327
|
return { entries: [], placed: false };
|
|
238
328
|
}
|
|
239
329
|
|
|
330
|
+
/** A tile waiting for a place on a width nobody arranged, and the size it would rather have. */
|
|
331
|
+
interface Wanted {
|
|
332
|
+
readonly tile: HomeTile;
|
|
333
|
+
readonly size: HomeTileSize;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/** The size combinations tried at most, so that a page of many widgets is still laid out at once. */
|
|
337
|
+
const MOST_COMBINATIONS = 4096;
|
|
338
|
+
|
|
339
|
+
/** Whether one score comes before another, read from its first number. */
|
|
340
|
+
function lessThan(score: readonly number[], than: readonly number[]): boolean {
|
|
341
|
+
const at = score.findIndex((value, index) => value !== than[index]);
|
|
342
|
+
return at >= 0 && (score[at] ?? 0) < (than[at] ?? 0);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/** The tiles in order, each at its size, at the first room reading from the top. */
|
|
346
|
+
function packed(
|
|
347
|
+
wanted: readonly Wanted[],
|
|
348
|
+
sizes: readonly HomeTileSize[],
|
|
349
|
+
columns: number,
|
|
350
|
+
): PlacedTile[] {
|
|
351
|
+
const taken = new Set<number>();
|
|
352
|
+
return wanted.map(({ tile }, at) => {
|
|
353
|
+
const size = sizes[at] ?? startingSizeAt(tile, columns);
|
|
354
|
+
const shape = footprintOf(size, columns);
|
|
355
|
+
const place = firstRoom(taken, shape, columns);
|
|
356
|
+
occupy(taken, place, shape, columns);
|
|
357
|
+
return { tile, size, ...place };
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
|
|
240
361
|
/**
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
362
|
+
* A width nobody arranged, closed up (ADR-0082): the same order, each tile at one of the sizes it
|
|
363
|
+
* comes in here, chosen so that the fewest cells stand empty within the page, then so that the
|
|
364
|
+
* fewest tiles leave the size they would rather have, then so that the page is the shortest. The
|
|
365
|
+
* projects take one size together, so that they line up as a row of the same tiles; a widget
|
|
366
|
+
* takes any of its own. A page that cannot close leaves the fewest cells empty it can.
|
|
367
|
+
*/
|
|
368
|
+
function closedUp(wanted: readonly Wanted[], columns: number): PlacedTile[] {
|
|
369
|
+
const projects = wanted.flatMap((entry, at) => (entry.tile.kind === "project" ? [at] : []));
|
|
370
|
+
// The choices: for each widget its sizes, the one it would rather have first; for the projects
|
|
371
|
+
// together, each its own, then each of the sizes a project comes in, all alike.
|
|
372
|
+
const choices: { readonly at: readonly number[]; readonly options: HomeTileSize[][] }[] = [];
|
|
373
|
+
if (projects.length > 0) {
|
|
374
|
+
const own = projects.map((at) => wanted[at]?.size ?? "icon");
|
|
375
|
+
const alike = PROJECT_ALIKE_SIZES.filter(
|
|
376
|
+
(size) => HOME_TILE_CELLS[size].columns <= columns,
|
|
377
|
+
).map((size) => projects.map(() => size));
|
|
378
|
+
const options = [own, ...alike].filter(
|
|
379
|
+
(option, index, all) => all.findIndex((other) => other.join() === option.join()) === index,
|
|
380
|
+
);
|
|
381
|
+
choices.push({ at: projects, options });
|
|
382
|
+
}
|
|
383
|
+
let combinations = choices[0]?.options.length ?? 1;
|
|
384
|
+
wanted.forEach((entry, at) => {
|
|
385
|
+
if (entry.tile.kind !== "widget") {
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
const others = sizesAt(entry.tile, columns).filter((size) => size !== entry.size);
|
|
389
|
+
const all = [entry.size, ...others];
|
|
390
|
+
// Past what can be tried at once, a widget keeps the size it would rather have.
|
|
391
|
+
const options = combinations * all.length <= MOST_COMBINATIONS ? all : [entry.size];
|
|
392
|
+
combinations *= options.length;
|
|
393
|
+
choices.push({ at: [at], options: options.map((size) => [size]) });
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
const preferred = wanted.map((entry) => entry.size);
|
|
397
|
+
let best: { readonly placed: PlacedTile[]; readonly score: readonly number[] } | undefined;
|
|
398
|
+
const trying = (index: number, sizes: HomeTileSize[], changed: number): void => {
|
|
399
|
+
const choice = choices[index];
|
|
400
|
+
if (choice === undefined) {
|
|
401
|
+
const placed = packed(wanted, sizes, columns);
|
|
402
|
+
const rows = rowsOf(placed, columns);
|
|
403
|
+
const filled = placed.reduce((cells, { size }) => {
|
|
404
|
+
const { w, h } = footprintOf(size, columns);
|
|
405
|
+
return cells + w * h;
|
|
406
|
+
}, 0);
|
|
407
|
+
const score = [rows * columns - filled, changed, rows];
|
|
408
|
+
if (best === undefined || lessThan(score, best.score)) {
|
|
409
|
+
best = { placed, score };
|
|
410
|
+
}
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
choice.options.forEach((option) => {
|
|
414
|
+
const next = [...sizes];
|
|
415
|
+
choice.at.forEach((at, nth) => {
|
|
416
|
+
next[at] = option[nth] ?? (preferred[at] as HomeTileSize);
|
|
417
|
+
});
|
|
418
|
+
const differs = choice.at.some((at) => next[at] !== preferred[at]) ? 1 : 0;
|
|
419
|
+
trying(index + 1, next, changed + differs);
|
|
420
|
+
});
|
|
421
|
+
};
|
|
422
|
+
trying(0, [...preferred], 0);
|
|
423
|
+
return best?.placed ?? packed(wanted, preferred, columns);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* The page as it stands on the grid: what the person kept for this width where they stand; for
|
|
428
|
+
* someone who has arranged nothing, the composed page on the cells nearest it; for a width nobody
|
|
429
|
+
* arranged when another was, the order kept there, closed up so that no cell stands empty where
|
|
430
|
+
* the sizes the tiles come in allow it (ADR-0082). A tile they may no longer
|
|
431
|
+
* see stays out, a size it no longer comes in, or that is too wide for this grid, becomes the one
|
|
432
|
+
* it starts at here, and a tile on another's cells moves to the nearest room. What they have not
|
|
433
|
+
* seen yet takes the first room of a width they arranged, a plugin's widgets as soon as it is on;
|
|
434
|
+
* what they took off stays off.
|
|
246
435
|
*/
|
|
247
436
|
export function arranged(
|
|
248
437
|
tiles: readonly HomeTile[],
|
|
@@ -252,6 +441,40 @@ export function arranged(
|
|
|
252
441
|
const byId = new Map(tiles.map((tile) => [tile.id, tile]));
|
|
253
442
|
const hidden = new Set(home?.hidden ?? []);
|
|
254
443
|
const { entries, placed: keepsPlaces } = keptAt(home, columns);
|
|
444
|
+
if (nobodyArranged(home)) {
|
|
445
|
+
// Arranging starts from the page as it was composed, each tile on the cells nearest it: a
|
|
446
|
+
// project on the very cell it stood on (ADR-0108), a lead alone on its own (ADR-0110).
|
|
447
|
+
const taken = new Set<number>();
|
|
448
|
+
return composed(tiles, home, columns).map(({ tile, size, x, y }) => {
|
|
449
|
+
const shape = footprintOf(size, columns);
|
|
450
|
+
const near = { x: Math.round(x), y: Math.round(y) };
|
|
451
|
+
const place = fits(taken, near, shape, columns)
|
|
452
|
+
? near
|
|
453
|
+
: nearestRoom(taken, shape, near, columns);
|
|
454
|
+
occupy(taken, place, shape, columns);
|
|
455
|
+
return { tile, size, ...place };
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
if (!keepsPlaces) {
|
|
459
|
+
const wanted: Wanted[] = [];
|
|
460
|
+
const seen = new Set<string>();
|
|
461
|
+
for (const entry of entries) {
|
|
462
|
+
const tile = byId.get(entry.tile);
|
|
463
|
+
if (tile !== undefined && !hidden.has(tile.id) && !seen.has(tile.id)) {
|
|
464
|
+
const size = sizesAt(tile, columns).includes(entry.size)
|
|
465
|
+
? entry.size
|
|
466
|
+
: startingSizeAt(tile, columns);
|
|
467
|
+
wanted.push({ tile, size });
|
|
468
|
+
seen.add(tile.id);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
for (const tile of tiles) {
|
|
472
|
+
if (!hidden.has(tile.id) && !seen.has(tile.id)) {
|
|
473
|
+
wanted.push({ tile, size: startingSizeAt(tile, columns) });
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
return closedUp(wanted, columns);
|
|
477
|
+
}
|
|
255
478
|
const taken = new Set<number>();
|
|
256
479
|
const placed: PlacedTile[] = [];
|
|
257
480
|
const seen = new Set<string>();
|
|
@@ -273,7 +496,7 @@ export function arranged(
|
|
|
273
496
|
const size = sizesAt(tile, columns).includes(entry.size)
|
|
274
497
|
? entry.size
|
|
275
498
|
: startingSizeAt(tile, columns);
|
|
276
|
-
put(tile, size,
|
|
499
|
+
put(tile, size, { x: entry.x, y: entry.y });
|
|
277
500
|
}
|
|
278
501
|
}
|
|
279
502
|
for (const tile of tiles) {
|
|
@@ -289,6 +512,185 @@ export function rowsOf(placed: readonly PlacedTile[], columns: number): number {
|
|
|
289
512
|
return Math.max(0, ...placed.map((tile) => tile.y + footprintOf(tile.size, columns).h));
|
|
290
513
|
}
|
|
291
514
|
|
|
515
|
+
/** Whether the person has arranged no width of the page, whatever they took off it. */
|
|
516
|
+
export function nobodyArranged(home: RestHome | null | undefined): boolean {
|
|
517
|
+
return home === null || home === undefined || Object.keys(home.layouts).length === 0;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
/** The page put back as composed: no width arranged, nothing taken off (ADR-0109). */
|
|
521
|
+
export const COMPOSED_HOME: RestHome = { hidden: [], layouts: {} };
|
|
522
|
+
|
|
523
|
+
/** Whether the page stands as composed, nothing taken off: nothing for putting it back to undo. */
|
|
524
|
+
export function standsComposed(home: RestHome | null | undefined): boolean {
|
|
525
|
+
return nobodyArranged(home) && (home?.hidden.length ?? 0) === 0;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* A tile of the composed page: where it stands and how far it reaches, in cells, which need not
|
|
530
|
+
* be whole, and the size its frame is told, the one of its own nearest that shape.
|
|
531
|
+
*/
|
|
532
|
+
export interface ComposedTile extends PlacedTile {
|
|
533
|
+
readonly w: number;
|
|
534
|
+
readonly h: number;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
/** The rows a widget beside the lead takes, and those the lead takes at least. */
|
|
538
|
+
const SIDE_ROWS = 2;
|
|
539
|
+
const LEAD_ROWS = 4;
|
|
540
|
+
/** The widgets that stand beside the lead at most; the others stand below, two to a row. */
|
|
541
|
+
const MOST_BESIDE = 2;
|
|
542
|
+
/** The rows of projects the column beside the lead holds at most; more go below, across the page. */
|
|
543
|
+
const MOST_PROJECT_ROWS_BESIDE = 2;
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* Of the sizes a tile comes in on this grid, the one nearest a shape; on a tie the one that fits
|
|
547
|
+
* within it, so that a frame is never told of more room than it has, then its own, then the smaller.
|
|
548
|
+
*/
|
|
549
|
+
function nearestSize(tile: HomeTile, w: number, h: number, columns: number): HomeTileSize {
|
|
550
|
+
if (tile.kind === "project") {
|
|
551
|
+
return "icon";
|
|
552
|
+
}
|
|
553
|
+
const away = (size: HomeTileSize) => {
|
|
554
|
+
const cells = footprintOf(size, columns);
|
|
555
|
+
return Math.abs(cells.w - w) + Math.abs(cells.h - h);
|
|
556
|
+
};
|
|
557
|
+
const within = (size: HomeTileSize) => {
|
|
558
|
+
const cells = footprintOf(size, columns);
|
|
559
|
+
return cells.w <= w && cells.h <= h;
|
|
560
|
+
};
|
|
561
|
+
const area = (size: HomeTileSize) => HOME_TILE_CELLS[size].columns * HOME_TILE_CELLS[size].rows;
|
|
562
|
+
return [...sizesAt(tile, columns)].sort(
|
|
563
|
+
(a, b) =>
|
|
564
|
+
away(a) - away(b) ||
|
|
565
|
+
Number(within(b)) - Number(within(a)) ||
|
|
566
|
+
Number(b === tile.defaultSize) - Number(a === tile.defaultSize) ||
|
|
567
|
+
area(a) - area(b),
|
|
568
|
+
)[0] as HomeTileSize;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* The page of someone who has arranged nothing, composed (ADR-0082): the first widget leads,
|
|
573
|
+
* half the page wide, and beside it stand the next two widgets and the projects, the column as
|
|
574
|
+
* high as the lead; on a grid of six columns or fewer they stand one under the other. With nothing
|
|
575
|
+
* beside it, the lead stands at a size it comes in, and the projects follow it in the columns it
|
|
576
|
+
* leaves (ADR-0110). The projects are icons, one to a cell, in rows as long as their column has
|
|
577
|
+
* cells, so that a project is never drawn in a shape it does not come in and the page is the one
|
|
578
|
+
* arranging starts from (ADR-0108); the last row may end short. The other widgets stand below, two
|
|
579
|
+
* to a row.
|
|
580
|
+
*/
|
|
581
|
+
export function composed(
|
|
582
|
+
tiles: readonly HomeTile[],
|
|
583
|
+
home: RestHome | null | undefined,
|
|
584
|
+
columns: HomeColumns,
|
|
585
|
+
): ComposedTile[] {
|
|
586
|
+
const hidden = new Set(home?.hidden ?? []);
|
|
587
|
+
const shown = tiles.filter((tile) => !hidden.has(tile.id));
|
|
588
|
+
const widgets = shown.filter((tile): tile is HomeWidgetTile => tile.kind === "widget");
|
|
589
|
+
const top = widgets.filter((tile) => tile.widget.place === "home:top");
|
|
590
|
+
const bottom = widgets.filter((tile) => tile.widget.place !== "home:top");
|
|
591
|
+
const projects = shown.filter((tile) => tile.kind === "project");
|
|
592
|
+
const boxes: ComposedTile[] = [];
|
|
593
|
+
const put = (tile: HomeTile, x: number, y: number, w: number, h: number) => {
|
|
594
|
+
boxes.push({ tile, size: nearestSize(tile, w, h, columns), x, y, w, h });
|
|
595
|
+
};
|
|
596
|
+
/** The rows the projects take in a column so wide: as many to a row as a cell each allows. */
|
|
597
|
+
const projectRows = (width: number) =>
|
|
598
|
+
projects.length === 0 ? 0 : Math.ceil(projects.length / Math.max(1, Math.floor(width)));
|
|
599
|
+
/** The projects in rows from a place, one to a cell, each row as long as the width has cells. */
|
|
600
|
+
const putProjects = (x: number, y: number, width: number): number => {
|
|
601
|
+
const across = Math.max(1, Math.floor(width));
|
|
602
|
+
projects.forEach((tile, nth) => {
|
|
603
|
+
put(tile, x + (nth % across), y + Math.floor(nth / across), 1, 1);
|
|
604
|
+
});
|
|
605
|
+
return projectRows(width);
|
|
606
|
+
};
|
|
607
|
+
/**
|
|
608
|
+
* The projects beside a tile in the page's corner, so wide and so high: one to a cell in the
|
|
609
|
+
* columns it leaves, no lower than it reaches, then across the page below it. The row after them.
|
|
610
|
+
*/
|
|
611
|
+
const putProjectsBeside = (w: number, h: number): number => {
|
|
612
|
+
const across = columns - w;
|
|
613
|
+
const beside = Math.min(projects.length, across * h);
|
|
614
|
+
projects.forEach((tile, nth) => {
|
|
615
|
+
const below = nth - beside;
|
|
616
|
+
if (below < 0) {
|
|
617
|
+
put(tile, w + (nth % across), Math.floor(nth / across), 1, 1);
|
|
618
|
+
} else {
|
|
619
|
+
put(tile, below % columns, h + Math.floor(below / columns), 1, 1);
|
|
620
|
+
}
|
|
621
|
+
});
|
|
622
|
+
const left = projects.length - beside;
|
|
623
|
+
return h + Math.ceil(left / columns);
|
|
624
|
+
};
|
|
625
|
+
/** Widgets two to a row across the page, one alone as wide as the page. */
|
|
626
|
+
const putInPairs = (list: readonly HomeTile[], from: number): number => {
|
|
627
|
+
let y = from;
|
|
628
|
+
for (let at = 0; at < list.length; at += 2) {
|
|
629
|
+
const first = list[at];
|
|
630
|
+
const second = list[at + 1];
|
|
631
|
+
if (first !== undefined && second !== undefined) {
|
|
632
|
+
put(first, 0, y, columns / 2, SIDE_ROWS);
|
|
633
|
+
put(second, columns / 2, y, columns / 2, SIDE_ROWS);
|
|
634
|
+
} else if (first !== undefined) {
|
|
635
|
+
put(first, 0, y, columns, SIDE_ROWS);
|
|
636
|
+
}
|
|
637
|
+
y += SIDE_ROWS;
|
|
638
|
+
}
|
|
639
|
+
return y;
|
|
640
|
+
};
|
|
641
|
+
|
|
642
|
+
const [lead, ...others] = top;
|
|
643
|
+
const beside = others.slice(0, MOST_BESIDE);
|
|
644
|
+
let y = 0;
|
|
645
|
+
if (lead !== undefined && beside.length > 0 && columns >= 8) {
|
|
646
|
+
const half = columns / 2;
|
|
647
|
+
const projectsBeside = projectRows(half) <= MOST_PROJECT_ROWS_BESIDE;
|
|
648
|
+
const besideRows = beside.length * SIDE_ROWS + (projectsBeside ? projectRows(half) : 0);
|
|
649
|
+
const height = Math.max(besideRows, LEAD_ROWS);
|
|
650
|
+
// A column shorter than the lead gives its widgets the rows left over, alike.
|
|
651
|
+
const widgetRows = SIDE_ROWS + (height - besideRows) / beside.length;
|
|
652
|
+
put(lead, 0, 0, half, height);
|
|
653
|
+
let at = 0;
|
|
654
|
+
for (const tile of beside) {
|
|
655
|
+
put(tile, half, at, half, widgetRows);
|
|
656
|
+
at += widgetRows;
|
|
657
|
+
}
|
|
658
|
+
if (projectsBeside) {
|
|
659
|
+
putProjects(half, at, half);
|
|
660
|
+
}
|
|
661
|
+
y = height;
|
|
662
|
+
if (!projectsBeside) {
|
|
663
|
+
y += putProjects(0, y, columns);
|
|
664
|
+
}
|
|
665
|
+
y = putInPairs([...others.slice(MOST_BESIDE), ...bottom], y);
|
|
666
|
+
} else {
|
|
667
|
+
let projectsPut = false;
|
|
668
|
+
if (lead !== undefined) {
|
|
669
|
+
// Nothing beside it, the lead is drawn at the size it is told, on that size's cells, and
|
|
670
|
+
// never stretched to the page's width and four rows (ADR-0110).
|
|
671
|
+
const size = nearestSize(lead, columns, LEAD_ROWS, columns);
|
|
672
|
+
const shape = footprintOf(size, columns);
|
|
673
|
+
boxes.push({ tile: lead, size, x: 0, y: 0, ...shape });
|
|
674
|
+
y = shape.h;
|
|
675
|
+
if (shape.w < columns && projects.length > 0) {
|
|
676
|
+
y = putProjectsBeside(shape.w, shape.h);
|
|
677
|
+
projectsPut = true;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
y = putInPairs(others, y);
|
|
681
|
+
if (!projectsPut) {
|
|
682
|
+
y += putProjects(0, y, columns);
|
|
683
|
+
}
|
|
684
|
+
putInPairs(bottom, y);
|
|
685
|
+
}
|
|
686
|
+
return boxes;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
/** How many rows the composed page takes, which need not be whole. */
|
|
690
|
+
export function composedRows(boxes: readonly ComposedTile[]): number {
|
|
691
|
+
return Math.max(0, ...boxes.map((box) => box.y + box.h));
|
|
692
|
+
}
|
|
693
|
+
|
|
292
694
|
const sameTile = (a: PlacedTile, b: PlacedTile): boolean => a.tile.id === b.tile.id;
|
|
293
695
|
|
|
294
696
|
const overlapping = (a: PlacedTile, b: PlacedTile, columns: number): boolean => {
|