@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/dist/desk.d.ts
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { RestRunBrief, RestTaskBrief, RestWorkBrief } from "./api.js";
|
|
2
|
+
import type { ProjectClient } from "./client.js";
|
|
3
|
+
/** How many of a person's projects one visit reads: the rest are named as not read. */
|
|
4
|
+
export declare const DESK_PROJECTS = 12;
|
|
5
|
+
/** How many tasks of a listing a project gives one visit at once. */
|
|
6
|
+
export declare const DESK_TASKS = 100;
|
|
7
|
+
/** How many runs a project gives one visit at once: a run carries its reports, so fewer. */
|
|
8
|
+
export declare const DESK_RUNS = 30;
|
|
9
|
+
/** How many weeks the figures count back, this week among them. */
|
|
10
|
+
export declare const DESK_WEEKS = 8;
|
|
11
|
+
/** How many words a search of the archive takes; the rest are dropped. */
|
|
12
|
+
export declare const DESK_WORDS = 8;
|
|
13
|
+
/** A project as a row names it: what the plate says of one, which a project's own answer carries too. */
|
|
14
|
+
export type DeskProject = RestWorkBrief["tasks"][number]["project"];
|
|
15
|
+
/** A task of the person's with the project it is in. */
|
|
16
|
+
export interface DeskTask {
|
|
17
|
+
readonly project: DeskProject;
|
|
18
|
+
readonly task: RestTaskBrief;
|
|
19
|
+
}
|
|
20
|
+
/** A run of the person's with the project it is in and, where the visit read its task, the task's title. */
|
|
21
|
+
export interface DeskRun {
|
|
22
|
+
readonly project: DeskProject;
|
|
23
|
+
/** The run without its reports, which a desk never shows: what a listing in the brief form answers. */
|
|
24
|
+
readonly run: RestRunBrief;
|
|
25
|
+
readonly title: string | undefined;
|
|
26
|
+
}
|
|
27
|
+
/** The states of open work, in the order a desk shows them: what is at hand first. */
|
|
28
|
+
export declare const DESK_STATES: readonly ["in_progress", "in_review", "ready", "idea"];
|
|
29
|
+
/** The open tasks by state, in the desk's order, each group in the order the tasks came (the sooner due first). */
|
|
30
|
+
export declare function standingOf(tasks: readonly DeskTask[]): readonly {
|
|
31
|
+
readonly state: (typeof DESK_STATES)[number];
|
|
32
|
+
readonly tasks: readonly DeskTask[];
|
|
33
|
+
}[];
|
|
34
|
+
/** How a run can have ended. */
|
|
35
|
+
export declare const DESK_ENDINGS: readonly ["finished", "failed", "abandoned"];
|
|
36
|
+
export type DeskEnding = (typeof DESK_ENDINGS)[number];
|
|
37
|
+
/** One week of the figures: its first and last day, and how many tasks were done in it. */
|
|
38
|
+
export interface DeskWeek {
|
|
39
|
+
readonly start: string;
|
|
40
|
+
readonly end: string;
|
|
41
|
+
readonly done: number;
|
|
42
|
+
}
|
|
43
|
+
/** A category as a task carries it. */
|
|
44
|
+
export type DeskCategory = NonNullable<RestTaskBrief["category"]>;
|
|
45
|
+
export interface DeskFigures {
|
|
46
|
+
/** The weeks counted, the oldest first; the last is the week of `today`. */
|
|
47
|
+
readonly weeks: readonly DeskWeek[];
|
|
48
|
+
/** The tasks done within those weeks, in all. */
|
|
49
|
+
readonly done: number;
|
|
50
|
+
/** The runs that ended within those weeks, by how they ended. */
|
|
51
|
+
readonly runs: Readonly<Record<DeskEnding, number>>;
|
|
52
|
+
/** The same by project, the most done first; a project with neither is left out. */
|
|
53
|
+
readonly byProject: readonly {
|
|
54
|
+
readonly project: DeskProject;
|
|
55
|
+
readonly done: number;
|
|
56
|
+
readonly runs: number;
|
|
57
|
+
}[];
|
|
58
|
+
/** The tasks done by category, the most first; those sorted into none last, under `null`. */
|
|
59
|
+
readonly byCategory: readonly {
|
|
60
|
+
readonly category: DeskCategory | null;
|
|
61
|
+
readonly done: number;
|
|
62
|
+
}[];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The figures of a stretch of weeks, counted from what a visit read: the tasks by the day they
|
|
66
|
+
* were done, the runs by the day they ended, both as the browser's clock has the day. A task
|
|
67
|
+
* that is not done, or a run still open, counts nowhere.
|
|
68
|
+
*/
|
|
69
|
+
export declare function figuresOf(input: {
|
|
70
|
+
readonly tasks: readonly DeskTask[];
|
|
71
|
+
readonly runs: readonly DeskRun[];
|
|
72
|
+
readonly today: string;
|
|
73
|
+
/** The weekday a week begins on: 1 for Monday, 7 for Sunday. */
|
|
74
|
+
readonly firstDay?: number | undefined;
|
|
75
|
+
readonly weeks?: number | undefined;
|
|
76
|
+
}): DeskFigures;
|
|
77
|
+
/** The words of a search, as they are looked for: lowercased, without what is between them, `DESK_WORDS` at most. */
|
|
78
|
+
export declare function wordsOf(query: string): readonly string[];
|
|
79
|
+
/** Whether a run is found by every word: in its task's title or number, or in what it said at its end. */
|
|
80
|
+
export declare function runHolds(run: DeskRun, words: readonly string[]): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* What a desk reads of the console: a project at a time, its tasks and its runs, each in the
|
|
83
|
+
* brief form, without the bodies and the reports a desk does not show.
|
|
84
|
+
*/
|
|
85
|
+
export interface DeskReader {
|
|
86
|
+
project(key: string): Pick<ProjectClient, "taskBriefs" | "runBriefs">;
|
|
87
|
+
}
|
|
88
|
+
/** A page of a person's closed work: what one visit read, and whether the console has more. */
|
|
89
|
+
export interface DeskHistory {
|
|
90
|
+
/** The tasks the person worked on that are done, dropped or put away, the last closed first. */
|
|
91
|
+
readonly tasks: readonly DeskTask[];
|
|
92
|
+
/** The person's runs that ended, the last ended first. */
|
|
93
|
+
readonly runs: readonly DeskRun[];
|
|
94
|
+
/** Whether a project has more of either than this page read. */
|
|
95
|
+
readonly more: boolean;
|
|
96
|
+
/** How many projects were read, and how many the person may see. */
|
|
97
|
+
readonly read: number;
|
|
98
|
+
readonly of: number;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* A page of the person's closed work, across their projects: from each of the first
|
|
102
|
+
* `DESK_PROJECTS`, the closed tasks they worked on that are on the board, those put away, and
|
|
103
|
+
* the runs that ended, of which theirs are kept. Three requests a project, each bounded;
|
|
104
|
+
* `words` narrows the tasks at the console and the runs here; `page` is which page of each.
|
|
105
|
+
*/
|
|
106
|
+
export declare function readHistory(reader: DeskReader, input: {
|
|
107
|
+
readonly projects: readonly DeskProject[];
|
|
108
|
+
readonly personId: string;
|
|
109
|
+
readonly words?: string | undefined;
|
|
110
|
+
readonly page?: number | undefined;
|
|
111
|
+
}, signal?: AbortSignal): Promise<DeskHistory>;
|
|
112
|
+
/** Two pages of a person's closed work as one: the later after the earlier, nothing twice, ordered anew. */
|
|
113
|
+
export declare function withHistory(earlier: DeskHistory, later: DeskHistory): DeskHistory;
|
|
114
|
+
/**
|
|
115
|
+
* The person's runs that are open, in the projects where a task on their plate says one is:
|
|
116
|
+
* one request a project, `DESK_PROJECTS` at most, each run with its task's title from the plate.
|
|
117
|
+
*/
|
|
118
|
+
export declare function readOpenRuns(reader: DeskReader, input: {
|
|
119
|
+
readonly tasks: readonly DeskTask[];
|
|
120
|
+
readonly personId: string;
|
|
121
|
+
}, signal?: AbortSignal): Promise<readonly DeskRun[]>;
|
|
122
|
+
//# sourceMappingURL=desk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"desk.d.ts","sourceRoot":"","sources":["../src/desk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAwB,MAAM,UAAU,CAAC;AACjG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAUjD,uFAAuF;AACvF,eAAO,MAAM,aAAa,KAAK,CAAC;AAChC,qEAAqE;AACrE,eAAO,MAAM,UAAU,MAAM,CAAC;AAC9B,4FAA4F;AAC5F,eAAO,MAAM,SAAS,KAAK,CAAC;AAC5B,mEAAmE;AACnE,eAAO,MAAM,UAAU,IAAI,CAAC;AAC5B,0EAA0E;AAC1E,eAAO,MAAM,UAA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
|
2
|
+
// The board's side of a desk's page (ADR-0116): what a member's own console shows of their own
|
|
3
|
+
// work on the board, across the projects they may see. Three views: what stands now, the
|
|
4
|
+
// figures, and the archive. Each is read from the console when it is looked at, a project at a
|
|
5
|
+
// time through the routes there are, and what one visit reads is bounded here. This module is
|
|
6
|
+
// the reading and the counting, with no React in it; the views are `components/desk.tsx` and
|
|
7
|
+
// the page that composes them, with the desk's records before them, is `desk-page.tsx`.
|
|
8
|
+
/** How many of a person's projects one visit reads: the rest are named as not read. */
|
|
9
|
+
export const DESK_PROJECTS = 12;
|
|
10
|
+
/** How many tasks of a listing a project gives one visit at once. */
|
|
11
|
+
export const DESK_TASKS = 100;
|
|
12
|
+
/** How many runs a project gives one visit at once: a run carries its reports, so fewer. */
|
|
13
|
+
export const DESK_RUNS = 30;
|
|
14
|
+
/** How many weeks the figures count back, this week among them. */
|
|
15
|
+
export const DESK_WEEKS = 8;
|
|
16
|
+
/** How many words a search of the archive takes; the rest are dropped. */
|
|
17
|
+
export const DESK_WORDS = 8;
|
|
18
|
+
/** The states of open work, in the order a desk shows them: what is at hand first. */
|
|
19
|
+
export const DESK_STATES = [
|
|
20
|
+
"in_progress",
|
|
21
|
+
"in_review",
|
|
22
|
+
"ready",
|
|
23
|
+
"idea",
|
|
24
|
+
];
|
|
25
|
+
/** The open tasks by state, in the desk's order, each group in the order the tasks came (the sooner due first). */
|
|
26
|
+
export function standingOf(tasks) {
|
|
27
|
+
return DESK_STATES.map((state) => ({
|
|
28
|
+
state,
|
|
29
|
+
tasks: tasks.filter((item) => item.task.state === state),
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
/** How a run can have ended. */
|
|
33
|
+
export const DESK_ENDINGS = [
|
|
34
|
+
"finished",
|
|
35
|
+
"failed",
|
|
36
|
+
"abandoned",
|
|
37
|
+
];
|
|
38
|
+
/**
|
|
39
|
+
* The figures of a stretch of weeks, counted from what a visit read: the tasks by the day they
|
|
40
|
+
* were done, the runs by the day they ended, both as the browser's clock has the day. A task
|
|
41
|
+
* that is not done, or a run still open, counts nowhere.
|
|
42
|
+
*/
|
|
43
|
+
export function figuresOf(input) {
|
|
44
|
+
const count = Math.max(1, input.weeks ?? DESK_WEEKS);
|
|
45
|
+
const thisWeek = weekOf(input.today, input.firstDay ?? 1);
|
|
46
|
+
const last = thisWeek[0] ?? input.today;
|
|
47
|
+
const weeks = Array.from({ length: count }, (_, index) => {
|
|
48
|
+
const start = addDays(last, (index - (count - 1)) * 7);
|
|
49
|
+
return { start, end: addDays(start, 6), done: 0 };
|
|
50
|
+
});
|
|
51
|
+
const from = weeks[0]?.start ?? input.today;
|
|
52
|
+
const until = weeks.at(-1)?.end ?? input.today;
|
|
53
|
+
const within = (instant) => {
|
|
54
|
+
if (instant === null) {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
const date = new Date(instant);
|
|
58
|
+
if (Number.isNaN(date.getTime())) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
const day = dayOf(date);
|
|
62
|
+
return day >= from && day <= until ? day : undefined;
|
|
63
|
+
};
|
|
64
|
+
const projects = new Map();
|
|
65
|
+
const projectOf = (project) => {
|
|
66
|
+
const found = projects.get(project.key) ?? { project, done: 0, runs: 0 };
|
|
67
|
+
projects.set(project.key, found);
|
|
68
|
+
return found;
|
|
69
|
+
};
|
|
70
|
+
const categories = new Map();
|
|
71
|
+
let done = 0;
|
|
72
|
+
const seen = new Set();
|
|
73
|
+
for (const { project, task } of input.tasks) {
|
|
74
|
+
const day = task.state === "done" ? within(task.doneAt) : undefined;
|
|
75
|
+
if (day === undefined || seen.has(task.id)) {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
seen.add(task.id);
|
|
79
|
+
const week = weeks.find((candidate) => day >= candidate.start && day <= candidate.end);
|
|
80
|
+
if (week !== undefined) {
|
|
81
|
+
week.done += 1;
|
|
82
|
+
}
|
|
83
|
+
done += 1;
|
|
84
|
+
projectOf(project).done += 1;
|
|
85
|
+
const key = task.category?.key ?? "";
|
|
86
|
+
const category = categories.get(key) ?? { category: task.category, done: 0 };
|
|
87
|
+
category.done += 1;
|
|
88
|
+
categories.set(key, category);
|
|
89
|
+
}
|
|
90
|
+
const runs = { finished: 0, failed: 0, abandoned: 0 };
|
|
91
|
+
for (const { project, run } of input.runs) {
|
|
92
|
+
const ending = DESK_ENDINGS.find((candidate) => candidate === run.status);
|
|
93
|
+
if (ending === undefined || within(run.endedAt) === undefined || seen.has(run.id)) {
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
seen.add(run.id);
|
|
97
|
+
runs[ending] += 1;
|
|
98
|
+
projectOf(project).runs += 1;
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
weeks,
|
|
102
|
+
done,
|
|
103
|
+
runs,
|
|
104
|
+
byProject: [...projects.values()].sort((a, b) => b.done - a.done || b.runs - a.runs || a.project.name.localeCompare(b.project.name)),
|
|
105
|
+
byCategory: [...categories.values()].sort((a, b) => Number(a.category === null) - Number(b.category === null) ||
|
|
106
|
+
b.done - a.done ||
|
|
107
|
+
(a.category?.name ?? "").localeCompare(b.category?.name ?? "")),
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/** The words of a search, as they are looked for: lowercased, without what is between them, `DESK_WORDS` at most. */
|
|
111
|
+
export function wordsOf(query) {
|
|
112
|
+
return query
|
|
113
|
+
.toLowerCase()
|
|
114
|
+
.split(/\s+/)
|
|
115
|
+
.filter((word) => word.length > 0)
|
|
116
|
+
.slice(0, DESK_WORDS);
|
|
117
|
+
}
|
|
118
|
+
/** Whether a run is found by every word: in its task's title or number, or in what it said at its end. */
|
|
119
|
+
export function runHolds(run, words) {
|
|
120
|
+
if (words.length === 0) {
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
const text = `#${run.run.taskNumber} ${run.title ?? ""} ${run.run.summary ?? ""} ${run.run.agent}`.toLowerCase();
|
|
124
|
+
return words.every((word) => text.includes(word));
|
|
125
|
+
}
|
|
126
|
+
/** When a task was closed, as the archive orders it: put away, else done, else last changed. */
|
|
127
|
+
function closedAt(task) {
|
|
128
|
+
return task.archivedAt ?? task.doneAt ?? task.updatedAt;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* A page of the person's closed work, across their projects: from each of the first
|
|
132
|
+
* `DESK_PROJECTS`, the closed tasks they worked on that are on the board, those put away, and
|
|
133
|
+
* the runs that ended, of which theirs are kept. Three requests a project, each bounded;
|
|
134
|
+
* `words` narrows the tasks at the console and the runs here; `page` is which page of each.
|
|
135
|
+
*/
|
|
136
|
+
export async function readHistory(reader, input, signal) {
|
|
137
|
+
const projects = input.projects.slice(0, DESK_PROJECTS);
|
|
138
|
+
const page = Math.max(0, input.page ?? 0);
|
|
139
|
+
const words = wordsOf(input.words ?? "");
|
|
140
|
+
const q = words.length === 0 ? undefined : words.join(" ");
|
|
141
|
+
const read = await Promise.all(projects.map(async (project) => {
|
|
142
|
+
const client = reader.project(project.key);
|
|
143
|
+
const filter = {
|
|
144
|
+
worker: input.personId,
|
|
145
|
+
q,
|
|
146
|
+
limit: DESK_TASKS,
|
|
147
|
+
offset: page * DESK_TASKS,
|
|
148
|
+
};
|
|
149
|
+
const [closed, away, ended] = await Promise.all([
|
|
150
|
+
client.taskBriefs({ ...filter, open: false }, signal),
|
|
151
|
+
client.taskBriefs({ ...filter, archived: true }, signal),
|
|
152
|
+
client.runBriefs({ open: false, limit: DESK_RUNS, offset: page * DESK_RUNS }, signal),
|
|
153
|
+
]);
|
|
154
|
+
const tasks = [...closed.items, ...away.items];
|
|
155
|
+
const titles = new Map(tasks.map((task) => [task.id, task.title]));
|
|
156
|
+
return {
|
|
157
|
+
tasks: tasks.map((task) => ({ project, task })),
|
|
158
|
+
runs: ended.items
|
|
159
|
+
.filter((run) => run.person.id === input.personId)
|
|
160
|
+
.map((run) => ({ project, run, title: titles.get(run.taskId) }))
|
|
161
|
+
.filter((run) => runHolds(run, words)),
|
|
162
|
+
more: closed.more || away.more || ended.more,
|
|
163
|
+
};
|
|
164
|
+
}));
|
|
165
|
+
return {
|
|
166
|
+
tasks: read
|
|
167
|
+
.flatMap((one) => one.tasks)
|
|
168
|
+
.sort((a, b) => closedAt(b.task).localeCompare(closedAt(a.task))),
|
|
169
|
+
runs: read
|
|
170
|
+
.flatMap((one) => one.runs)
|
|
171
|
+
.sort((a, b) => (b.run.endedAt ?? "").localeCompare(a.run.endedAt ?? "")),
|
|
172
|
+
more: read.some((one) => one.more),
|
|
173
|
+
read: projects.length,
|
|
174
|
+
of: input.projects.length,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
/** Two pages of a person's closed work as one: the later after the earlier, nothing twice, ordered anew. */
|
|
178
|
+
export function withHistory(earlier, later) {
|
|
179
|
+
const tasks = new Map([...earlier.tasks, ...later.tasks].map((item) => [item.task.id, item]));
|
|
180
|
+
const runs = new Map([...earlier.runs, ...later.runs].map((item) => [item.run.id, item]));
|
|
181
|
+
return {
|
|
182
|
+
tasks: [...tasks.values()].sort((a, b) => closedAt(b.task).localeCompare(closedAt(a.task))),
|
|
183
|
+
runs: [...runs.values()].sort((a, b) => (b.run.endedAt ?? "").localeCompare(a.run.endedAt ?? "")),
|
|
184
|
+
more: later.more,
|
|
185
|
+
read: later.read,
|
|
186
|
+
of: later.of,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* The person's runs that are open, in the projects where a task on their plate says one is:
|
|
191
|
+
* one request a project, `DESK_PROJECTS` at most, each run with its task's title from the plate.
|
|
192
|
+
*/
|
|
193
|
+
export async function readOpenRuns(reader, input, signal) {
|
|
194
|
+
const projects = new Map();
|
|
195
|
+
for (const { project, task } of input.tasks) {
|
|
196
|
+
if (task.openRuns > 0 && !projects.has(project.key)) {
|
|
197
|
+
projects.set(project.key, project);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
const titles = new Map(input.tasks.map(({ task }) => [task.id, task.title]));
|
|
201
|
+
const read = await Promise.all([...projects.values()].slice(0, DESK_PROJECTS).map(async (project) => {
|
|
202
|
+
const open = await reader
|
|
203
|
+
.project(project.key)
|
|
204
|
+
.runBriefs({ open: true, limit: DESK_RUNS }, signal);
|
|
205
|
+
return open.items
|
|
206
|
+
.filter((run) => run.person.id === input.personId)
|
|
207
|
+
.map((run) => ({ project, run, title: titles.get(run.taskId) }));
|
|
208
|
+
}));
|
|
209
|
+
return read.flat().sort((a, b) => b.run.lastHeardAt.localeCompare(a.run.lastHeardAt));
|
|
210
|
+
}
|
|
211
|
+
//# sourceMappingURL=desk.js.map
|
package/dist/desk.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"desk.js","sourceRoot":"","sources":["../src/desk.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpD,+FAA+F;AAC/F,yFAAyF;AACzF,+FAA+F;AAC/F,8FAA8F;AAC9F,6FAA6F;AAC7F,wFAAwF;AAExF,uFAAuF;AACvF,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAChC,qEAAqE;AACrE,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,CAAC;AAC9B,4FAA4F;AAC5F,MAAM,CAAC,MAAM,SAAS,GAAG,EAAE,CAAC;AAC5B,mEAAmE;AACnE,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC;AAC5B,0EAA0E;AAC1E,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC;AAmB5B,sFAAsF;AACtF,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,aAAa;IACb,WAAW;IACX,OAAO;IACP,MAAM;CACiC,CAAC;AAE1C,mHAAmH;AACnH,MAAM,UAAU,UAAU,CAAC,KAA0B;IAInD,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACjC,KAAK;QACL,KAAK,EAAE,KAA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C,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC;AACxF,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type StreamSource } from "./agent-stream.js";
|
|
2
|
+
import { type RestEvent } from "./api.js";
|
|
3
|
+
/** How long a read of the feed waits before it asks again, where the console could not say where the feed stands. */
|
|
4
|
+
export declare const FEED_UNSETTLED_RETRY_MS = 1000;
|
|
5
|
+
/** How many times such a read asks before it gives the refusal to whoever asked. */
|
|
6
|
+
export declare const FEED_UNSETTLED_TRIES = 10;
|
|
7
|
+
/**
|
|
8
|
+
* A read of the feed, asked again while the console answers that it cannot be read yet
|
|
9
|
+
* (`feed.unsettled`, a 503): a process of the console that has not seen the feed settle since
|
|
10
|
+
* it began, while a change is still under way, cannot say where the feed stands, and says so in
|
|
11
|
+
* place of an empty page. An empty page would be a board on which nothing ever happened, and the
|
|
12
|
+
* page's stream would go on from the beginning and be sent the whole history. It is over within a
|
|
13
|
+
* moment: the change ends, or another process answers. Any other refusal is whoever asked's at
|
|
14
|
+
* once, and so is this one after `FEED_UNSETTLED_TRIES`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function whileFeedSettles<T>(read: () => Promise<T>, options?: {
|
|
17
|
+
readonly signal?: AbortSignal | undefined;
|
|
18
|
+
/** How a wait is made: a timer where left out. */
|
|
19
|
+
readonly sleep?: ((milliseconds: number) => Promise<void>) | undefined;
|
|
20
|
+
}): Promise<T>;
|
|
21
|
+
export interface FollowFeedOptions {
|
|
22
|
+
/** Where the stream is, for what happens after an event's number. */
|
|
23
|
+
readonly url: (after: number) => string;
|
|
24
|
+
/** The number of the last event read: the stream begins after it. */
|
|
25
|
+
readonly after: number;
|
|
26
|
+
/** An event not handed over before, in the order they were numbered. */
|
|
27
|
+
readonly onEvent: (event: RestEvent) => void;
|
|
28
|
+
/** Whether the stream is open, said each time it opens and each time it is lost. */
|
|
29
|
+
readonly onLive: (live: boolean) => void;
|
|
30
|
+
/** What opens a stream: the browser's `EventSource` where left out, and no stream where there is none. */
|
|
31
|
+
readonly EventSource?: (new (url: string) => StreamSource) | undefined;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Follows a project's feed until the function it answers is called: opens the stream after the
|
|
35
|
+
* last event read, and opens it again from there whenever the browser gave it up, a few seconds
|
|
36
|
+
* later and further apart while the console does not answer.
|
|
37
|
+
*/
|
|
38
|
+
export declare function followFeed(options: FollowFeedOptions): () => void;
|
|
39
|
+
//# sourceMappingURL=feed-stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feed-stream.d.ts","sourceRoot":"","sources":["../src/feed-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyC,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC7F,OAAO,EAAyB,KAAK,SAAS,EAAmB,MAAM,UAAU,CAAC;AAclF,qHAAqH;AACrH,eAAO,MAAM,uBAAuB,OAAQ,CAAC;AAC7C,oFAAoF;AACpF,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,EACtC,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACtB,OAAO,GAAE;IACP,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC1C,kDAAkD;IAClD,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC;CACnE,GACL,OAAO,CAAC,CAAC,CAAC,CAeZ;AAED,MAAM,WAAW,iBAAiB;IAChC,qEAAqE;IACrE,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACxC,qEAAqE;IACrE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,wEAAwE;IACxE,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IAC7C,oFAAoF;IACpF,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,0GAA0G;IAC1G,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,KAAK,GAAG,EAAE,MAAM,KAAK,YAAY,CAAC,GAAG,SAAS,CAAC;CACxE;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,IAAI,CAwEjE"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { STREAM_RETRY_MOST_MS, STREAM_RETRY_MS } from "./agent-stream.js";
|
|
2
|
+
import { ApiError, EVENT_KINDS, restEventSchema } from "./api.js";
|
|
3
|
+
// How a project's page follows its board: the feed is read as it stands, and what happens
|
|
4
|
+
// after arrives by a stream, numbered, which the console begins after the event it is told. A
|
|
5
|
+
// browser opens a stream again by itself after it was cut, and gives it up for good once it is
|
|
6
|
+
// answered something that is no stream, a gateway's error while the console restarts say. The
|
|
7
|
+
// stream is then opened again here, after the last event read, so that a board a person keeps
|
|
8
|
+
// open does not stand still for good without a word; the console sends what happened while it
|
|
9
|
+
// was away. As an agent's conversation is followed (`agent-stream.ts`). No React here: the
|
|
10
|
+
// page hands in what it does with what arrives, and a test drives it with a stream of its own.
|
|
11
|
+
/** `EventSource.CLOSED`: the browser gave the stream up and opens it no more. */
|
|
12
|
+
const CLOSED = 2;
|
|
13
|
+
/** How long a read of the feed waits before it asks again, where the console could not say where the feed stands. */
|
|
14
|
+
export const FEED_UNSETTLED_RETRY_MS = 1_000;
|
|
15
|
+
/** How many times such a read asks before it gives the refusal to whoever asked. */
|
|
16
|
+
export const FEED_UNSETTLED_TRIES = 10;
|
|
17
|
+
/**
|
|
18
|
+
* A read of the feed, asked again while the console answers that it cannot be read yet
|
|
19
|
+
* (`feed.unsettled`, a 503): a process of the console that has not seen the feed settle since
|
|
20
|
+
* it began, while a change is still under way, cannot say where the feed stands, and says so in
|
|
21
|
+
* place of an empty page. An empty page would be a board on which nothing ever happened, and the
|
|
22
|
+
* page's stream would go on from the beginning and be sent the whole history. It is over within a
|
|
23
|
+
* moment: the change ends, or another process answers. Any other refusal is whoever asked's at
|
|
24
|
+
* once, and so is this one after `FEED_UNSETTLED_TRIES`.
|
|
25
|
+
*/
|
|
26
|
+
export async function whileFeedSettles(read, options = {}) {
|
|
27
|
+
const sleep = options.sleep ??
|
|
28
|
+
((milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds)));
|
|
29
|
+
for (let asked = 1;; asked += 1) {
|
|
30
|
+
try {
|
|
31
|
+
return await read();
|
|
32
|
+
}
|
|
33
|
+
catch (failure) {
|
|
34
|
+
const unsettled = failure instanceof ApiError && failure.code === "feed.unsettled";
|
|
35
|
+
if (!unsettled || asked >= FEED_UNSETTLED_TRIES || options.signal?.aborted === true) {
|
|
36
|
+
throw failure;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
await sleep(FEED_UNSETTLED_RETRY_MS);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Follows a project's feed until the function it answers is called: opens the stream after the
|
|
44
|
+
* last event read, and opens it again from there whenever the browser gave it up, a few seconds
|
|
45
|
+
* later and further apart while the console does not answer.
|
|
46
|
+
*/
|
|
47
|
+
export function followFeed(options) {
|
|
48
|
+
const Source = options.EventSource ??
|
|
49
|
+
(typeof EventSource === "undefined"
|
|
50
|
+
? undefined
|
|
51
|
+
: EventSource);
|
|
52
|
+
if (Source === undefined) {
|
|
53
|
+
return () => undefined;
|
|
54
|
+
}
|
|
55
|
+
let stopped = false;
|
|
56
|
+
let last = options.after;
|
|
57
|
+
let source;
|
|
58
|
+
let retry;
|
|
59
|
+
let wait = STREAM_RETRY_MS;
|
|
60
|
+
const arrived = (message) => {
|
|
61
|
+
let parsed;
|
|
62
|
+
try {
|
|
63
|
+
parsed = restEventSchema.safeParse(JSON.parse(String(message.data)));
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
// What does not read as an event is left out.
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (!parsed.success || parsed.data.id <= last) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
last = parsed.data.id;
|
|
73
|
+
options.onEvent(parsed.data);
|
|
74
|
+
};
|
|
75
|
+
const open = () => {
|
|
76
|
+
const stream = new Source(options.url(last));
|
|
77
|
+
source = stream;
|
|
78
|
+
stream.onopen = () => {
|
|
79
|
+
if (stopped || source !== stream) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
wait = STREAM_RETRY_MS;
|
|
83
|
+
options.onLive(true);
|
|
84
|
+
};
|
|
85
|
+
stream.onerror = () => {
|
|
86
|
+
if (stopped || source !== stream) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
options.onLive(false);
|
|
90
|
+
if (stream.readyState !== CLOSED) {
|
|
91
|
+
// The browser is opening it again by itself, and says where it was.
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
// The browser opens it no more: it is opened again here, after the last event read.
|
|
95
|
+
stream.close();
|
|
96
|
+
source = undefined;
|
|
97
|
+
retry = setTimeout(() => {
|
|
98
|
+
retry = undefined;
|
|
99
|
+
if (!stopped) {
|
|
100
|
+
open();
|
|
101
|
+
}
|
|
102
|
+
}, wait);
|
|
103
|
+
wait = Math.min(wait * 2, STREAM_RETRY_MOST_MS);
|
|
104
|
+
};
|
|
105
|
+
for (const kind of EVENT_KINDS) {
|
|
106
|
+
stream.addEventListener(kind, arrived);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
open();
|
|
110
|
+
return () => {
|
|
111
|
+
stopped = true;
|
|
112
|
+
clearTimeout(retry);
|
|
113
|
+
source?.close();
|
|
114
|
+
source = undefined;
|
|
115
|
+
};
|
|
116
|
+
}
|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 +1,39 @@
|
|
|
1
|
+
/** How long after a read that failed the next is tried, doubling from the first to the longest. */
|
|
2
|
+
export declare const GLANCE_RETRY_MS = 3000;
|
|
3
|
+
export declare const GLANCE_RETRY_MAX_MS = 60000;
|
|
4
|
+
export interface GlanceReaderOptions<Project extends {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
}, Glance> {
|
|
7
|
+
/** Reads one project's glance. */
|
|
8
|
+
readonly read: (project: Project) => Promise<Glance>;
|
|
9
|
+
/** Takes a glance that was read, by the project's id. */
|
|
10
|
+
readonly store: (projectId: string, glance: Glance) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Whether a read that failed is worth another: not one the console refused, which it would
|
|
13
|
+
* refuse again. Left out, every failure is.
|
|
14
|
+
*/
|
|
15
|
+
readonly again?: ((failure: unknown) => boolean) | undefined;
|
|
16
|
+
/** Runs something later and answers the way to call it off; `setTimeout`, left out. */
|
|
17
|
+
readonly later?: ((run: () => void, ms: number) => () => void) | undefined;
|
|
18
|
+
}
|
|
19
|
+
export interface GlanceReader<Project> {
|
|
20
|
+
/**
|
|
21
|
+
* The projects shown at a glance now, none where no tile is: each is read once for a reading,
|
|
22
|
+
* whatever is asked again while it is.
|
|
23
|
+
*/
|
|
24
|
+
want(projects: readonly Project[]): void;
|
|
25
|
+
/** A new reading: every project shown at a glance is read again, and what was on its way is dropped. */
|
|
26
|
+
renew(): void;
|
|
27
|
+
/** Ends it: nothing is stored after, and nothing is tried again. */
|
|
28
|
+
stop(): void;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Reads the glances a front page shows. A project is read once for each reading; an answer is
|
|
32
|
+
* kept only if it is still the reading it was asked for, so that a slow one never writes over a
|
|
33
|
+
* newer one; and a read that failed is tried again, a little later each time, for as long as the
|
|
34
|
+
* project is shown at a glance, so that one bad moment does not leave a tile empty for good.
|
|
35
|
+
*/
|
|
36
|
+
export declare function createGlanceReader<Project extends {
|
|
37
|
+
readonly id: string;
|
|
38
|
+
}, Glance>(options: GlanceReaderOptions<Project, Glance>): GlanceReader<Project>;
|
|
39
|
+
//# sourceMappingURL=glances.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glances.d.ts","sourceRoot":"","sources":["../src/glances.ts"],"names":[],"mappings":"AAKA,mGAAmG;AACnG,eAAO,MAAM,eAAe,OAAQ,CAAC;AACrC,eAAO,MAAM,mBAAmB,QAAS,CAAC;AAE1C,MAAM,WAAW,mBAAmB,CAAC,OAAO,SAAS;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,MAAM;IAClF,kCAAkC;IAClC,QAAQ,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACrD,yDAAyD;IACzD,QAAQ,CAAC,KAAK,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5D;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,GAAG,SAAS,CAAC;IAC7D,uFAAuF;IACvF,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,IAAI,EAAE,EAAE,EAAE,MAAM,KAAK,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;CAC5E;AAED,MAAM,WAAW,YAAY,CAAC,OAAO;IACnC;;;OAGG;IACH,IAAI,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI,CAAC;IACzC,wGAAwG;IACxG,KAAK,IAAI,IAAI,CAAC;IACd,oEAAoE;IACpE,IAAI,IAAI,IAAI,CAAC;CACd;AAOD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,SAAS;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,MAAM,EAChF,OAAO,EAAE,mBAAmB,CAAC,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