@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
|
@@ -0,0 +1,1039 @@
|
|
|
1
|
+
import { type FormEvent, type ReactNode, useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
+
import { followSession, type StreamStanding } from "./agent-stream.js";
|
|
3
|
+
import {
|
|
4
|
+
ApiError,
|
|
5
|
+
type ConsoleClient,
|
|
6
|
+
isLoginAt,
|
|
7
|
+
type RestAgent,
|
|
8
|
+
type RestAgentInvitationMade,
|
|
9
|
+
type RestAgentSecret,
|
|
10
|
+
type RestAgentSession,
|
|
11
|
+
type RestProvider,
|
|
12
|
+
type RestSession,
|
|
13
|
+
type RestSignal,
|
|
14
|
+
type RestTranscriptEvent,
|
|
15
|
+
} from "./api.js";
|
|
16
|
+
import {
|
|
17
|
+
AgentChoice,
|
|
18
|
+
AgentControls,
|
|
19
|
+
AgentElsewhereList,
|
|
20
|
+
AgentRunnerFacts,
|
|
21
|
+
AgentSecretList,
|
|
22
|
+
AgentSessionList,
|
|
23
|
+
AgentStateBadge,
|
|
24
|
+
ChatPane,
|
|
25
|
+
SignalComposer,
|
|
26
|
+
TalkWaiting,
|
|
27
|
+
TalkWorking,
|
|
28
|
+
TranscriptView,
|
|
29
|
+
takenOf,
|
|
30
|
+
waitingOf,
|
|
31
|
+
withEarlier,
|
|
32
|
+
wordOf,
|
|
33
|
+
workingOf,
|
|
34
|
+
} from "./components/agent-page.js";
|
|
35
|
+
import { AgentPictureSave } from "./components/agents.js";
|
|
36
|
+
import { AgentInvitationPanel, AgentStartSteps } from "./components/setup.js";
|
|
37
|
+
import {
|
|
38
|
+
Avatar,
|
|
39
|
+
Button,
|
|
40
|
+
Callout,
|
|
41
|
+
cx,
|
|
42
|
+
EmptyState,
|
|
43
|
+
LinkButton,
|
|
44
|
+
PersonChip,
|
|
45
|
+
personName,
|
|
46
|
+
Spinner,
|
|
47
|
+
Time,
|
|
48
|
+
} from "./components/ui.js";
|
|
49
|
+
import { useWords } from "./i18n/index.js";
|
|
50
|
+
import { type AgentTab, agentHref, PATHS, setupHref } from "./router.js";
|
|
51
|
+
import { useAction } from "./use-action.js";
|
|
52
|
+
|
|
53
|
+
// An agent account's page (ADR-0085, ADR-0086): how it stands, what it is doing as it happens
|
|
54
|
+
// with the way to say something to it, its sessions, its plate, and what is kept of it. Its
|
|
55
|
+
// supervisors read all of it; whoever only sees the account reads how it stands.
|
|
56
|
+
|
|
57
|
+
/** How often the page asks again how the agent stands, and whether a session began. */
|
|
58
|
+
const REFRESH_MS = 10_000;
|
|
59
|
+
/** How many of a session's last events the page reads first, and how many more a step back reads. */
|
|
60
|
+
const TAIL = 200;
|
|
61
|
+
/** How many steps back the page reads for the last word the agent took, where the events it shows hold none. */
|
|
62
|
+
const LOOK_BACK_STEPS = 5;
|
|
63
|
+
|
|
64
|
+
const TABS: readonly AgentTab[] = ["live", "work", "sessions", "settings"];
|
|
65
|
+
|
|
66
|
+
/** Something read from the console and read again on a timer: what it answered last, and the way to read it now. */
|
|
67
|
+
export function useRead<T>(
|
|
68
|
+
read: (signal: AbortSignal) => Promise<T>,
|
|
69
|
+
everyMs?: number,
|
|
70
|
+
): { readonly value: T | undefined; readonly failed: unknown; readonly again: () => void } {
|
|
71
|
+
const [value, setValue] = useState<T | undefined>(undefined);
|
|
72
|
+
const [failed, setFailed] = useState<unknown>(undefined);
|
|
73
|
+
const [turn, setTurn] = useState(0);
|
|
74
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: `turn` is the trigger
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
const controller = new AbortController();
|
|
77
|
+
const once = () =>
|
|
78
|
+
read(controller.signal)
|
|
79
|
+
.then((answer) => {
|
|
80
|
+
if (!controller.signal.aborted) {
|
|
81
|
+
setValue(answer);
|
|
82
|
+
setFailed(undefined);
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
.catch((failure: unknown) => {
|
|
86
|
+
if (!controller.signal.aborted) {
|
|
87
|
+
setFailed(failure);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
void once();
|
|
91
|
+
const timer = everyMs === undefined ? undefined : setInterval(() => void once(), everyMs);
|
|
92
|
+
return () => {
|
|
93
|
+
controller.abort();
|
|
94
|
+
clearInterval(timer);
|
|
95
|
+
};
|
|
96
|
+
}, [read, everyMs, turn]);
|
|
97
|
+
return { value, failed, again: () => setTurn((current) => current + 1) };
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** What a session's events say to whoever puts something at the conversation's foot. */
|
|
101
|
+
interface SessionRead {
|
|
102
|
+
readonly events: readonly RestTranscriptEvent[];
|
|
103
|
+
/**
|
|
104
|
+
* The number of the last signal the session's events say the agent took; nothing where the
|
|
105
|
+
* events read, and a few steps before them, say none.
|
|
106
|
+
*/
|
|
107
|
+
readonly taken: number | undefined;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* The events of one session: its last ones first, the ones before on asking, and what is
|
|
112
|
+
* appended as it happens while the session is open.
|
|
113
|
+
*/
|
|
114
|
+
function SessionTranscript(props: {
|
|
115
|
+
readonly client: ConsoleClient;
|
|
116
|
+
readonly handle: string;
|
|
117
|
+
readonly session: RestAgentSession;
|
|
118
|
+
/** The account, whose picture stands beside what it said. */
|
|
119
|
+
readonly agent: RestAgent["person"];
|
|
120
|
+
/** The account's record of signals, where the page around reads it: read here where it does not. */
|
|
121
|
+
readonly signals?: readonly RestSignal[] | undefined;
|
|
122
|
+
/** What stands at the conversation's foot, from what the session's events say. */
|
|
123
|
+
readonly foot?: ((read: SessionRead) => ReactNode) | undefined;
|
|
124
|
+
/** Told when the console says the session is over. */
|
|
125
|
+
readonly onEnded?: (() => void) | undefined;
|
|
126
|
+
}) {
|
|
127
|
+
const words = useWords().agents.page.live;
|
|
128
|
+
const { client, handle, session, onEnded } = props;
|
|
129
|
+
const given = props.signals;
|
|
130
|
+
const own = given === undefined;
|
|
131
|
+
// The files that came with the signals the session was sent: what is no picture is offered to
|
|
132
|
+
// save from the signal's own address, which the account's record names.
|
|
133
|
+
const readSignals = useCallback(
|
|
134
|
+
(signal: AbortSignal) =>
|
|
135
|
+
own ? client.signals(handle, { limit: 100 }, signal) : Promise.resolve(undefined),
|
|
136
|
+
[client, handle, own],
|
|
137
|
+
);
|
|
138
|
+
const read = useRead(readSignals, own && session.ended === null ? REFRESH_MS : undefined);
|
|
139
|
+
const sent = given ?? read.value?.items;
|
|
140
|
+
const filesOf = (number: number) => sent?.find((one) => one.number === number)?.attachments;
|
|
141
|
+
const [events, setEvents] = useState<readonly RestTranscriptEvent[]>([]);
|
|
142
|
+
const [from, setFrom] = useState(0);
|
|
143
|
+
const [problem, setProblem] = useState(false);
|
|
144
|
+
/** How the stream stands: the page says so once it has been away for longer than a moment. */
|
|
145
|
+
const [standing, setStanding] = useState<StreamStanding>("waiting");
|
|
146
|
+
/** Whether the events before the first one shown are being read: asked for once at a time. */
|
|
147
|
+
const [readingEarlier, setReadingEarlier] = useState(false);
|
|
148
|
+
/** The last signal taken before the events read, once looked for: `0` where a few steps back say none. */
|
|
149
|
+
const [before, setBefore] = useState<number | undefined>(undefined);
|
|
150
|
+
const ended = useRef(onEnded);
|
|
151
|
+
ended.current = onEnded;
|
|
152
|
+
const open = session.ended === null;
|
|
153
|
+
// How many events the session holds and whether it is open are read when a session is first
|
|
154
|
+
// shown, and not followed: the page asks every few seconds how the session stands, and the
|
|
155
|
+
// count it is answered grows with every event, which is no reason to read the session again
|
|
156
|
+
// from its start under whoever is reading it. What arrives comes by the stream.
|
|
157
|
+
const count = useRef(session.events);
|
|
158
|
+
count.current = session.events;
|
|
159
|
+
const opened = useRef(open);
|
|
160
|
+
opened.current = open;
|
|
161
|
+
/** The session shown, for what is answered after another one took its place. */
|
|
162
|
+
const shown = useRef(session.id);
|
|
163
|
+
shown.current = session.id;
|
|
164
|
+
useEffect(() => {
|
|
165
|
+
const after = Math.max(0, count.current - TAIL);
|
|
166
|
+
setEvents([]);
|
|
167
|
+
setFrom(after);
|
|
168
|
+
setProblem(false);
|
|
169
|
+
setStanding("waiting");
|
|
170
|
+
setReadingEarlier(false);
|
|
171
|
+
setBefore(undefined);
|
|
172
|
+
// What is there is read, and what arrives is followed; a stream that closed for good, as
|
|
173
|
+
// one does while the console restarts, is opened again from the last event read.
|
|
174
|
+
return followSession({
|
|
175
|
+
client,
|
|
176
|
+
handle,
|
|
177
|
+
session: session.id,
|
|
178
|
+
after,
|
|
179
|
+
open: () => opened.current,
|
|
180
|
+
onEvents: (fresh) => setEvents((current) => [...current, ...fresh]),
|
|
181
|
+
onStanding: setStanding,
|
|
182
|
+
onProblem: () => setProblem(true),
|
|
183
|
+
onEnded: () => ended.current?.(),
|
|
184
|
+
});
|
|
185
|
+
}, [client, handle, session.id]);
|
|
186
|
+
// Which of the words sent still wait is read off the last signal the agent took. Where the
|
|
187
|
+
// events read hold none, a long turn since the last word say, the ones before are read a few
|
|
188
|
+
// steps back for it, and not shown.
|
|
189
|
+
const known = takenOf(events);
|
|
190
|
+
const looks = props.foot !== undefined && open && known === undefined && from > 0;
|
|
191
|
+
useEffect(() => {
|
|
192
|
+
if (!looks || before !== undefined) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
const controller = new AbortController();
|
|
196
|
+
void (async () => {
|
|
197
|
+
let upTo = from;
|
|
198
|
+
for (let step = 0; step < LOOK_BACK_STEPS && upTo > 0; step += 1) {
|
|
199
|
+
const after = Math.max(0, upTo - TAIL);
|
|
200
|
+
const page = await client.transcript(
|
|
201
|
+
handle,
|
|
202
|
+
session.id,
|
|
203
|
+
{ after, limit: upTo - after },
|
|
204
|
+
controller.signal,
|
|
205
|
+
);
|
|
206
|
+
const found = takenOf(page.items);
|
|
207
|
+
if (found !== undefined) {
|
|
208
|
+
setBefore(found);
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
upTo = after;
|
|
212
|
+
}
|
|
213
|
+
setBefore(0);
|
|
214
|
+
})().catch(() => undefined);
|
|
215
|
+
return () => controller.abort();
|
|
216
|
+
}, [looks, before, from, client, handle, session.id]);
|
|
217
|
+
const earlier = () => {
|
|
218
|
+
if (readingEarlier) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
const after = Math.max(0, from - TAIL);
|
|
222
|
+
const of = session.id;
|
|
223
|
+
setReadingEarlier(true);
|
|
224
|
+
void client
|
|
225
|
+
.transcript(handle, of, { after, limit: from - after })
|
|
226
|
+
.then((page) => {
|
|
227
|
+
// An answer that arrives once another session is shown is not this one.
|
|
228
|
+
if (shown.current !== of) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
setEvents((current) => withEarlier(current, page.items, from));
|
|
232
|
+
setFrom(after);
|
|
233
|
+
})
|
|
234
|
+
.catch(() => {
|
|
235
|
+
if (shown.current === of) {
|
|
236
|
+
setProblem(true);
|
|
237
|
+
}
|
|
238
|
+
})
|
|
239
|
+
.finally(() => {
|
|
240
|
+
if (shown.current === of) {
|
|
241
|
+
setReadingEarlier(false);
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
};
|
|
245
|
+
const taken = known ?? (before !== undefined && before > 0 ? before : undefined);
|
|
246
|
+
return (
|
|
247
|
+
<section className="sc-agent-transcript" aria-label={words.transcript}>
|
|
248
|
+
{session.away && <Callout tone="warning">{words.away}</Callout>}
|
|
249
|
+
{problem && <Callout tone="danger">{words.couldNotLoad}</Callout>}
|
|
250
|
+
{open && typeof EventSource === "undefined" && (
|
|
251
|
+
<p className="sc-field-hint">{words.notLive}</p>
|
|
252
|
+
)}
|
|
253
|
+
{from > 0 && (
|
|
254
|
+
<Button variant="ghost" size="sm" disabled={readingEarlier} onClick={earlier}>
|
|
255
|
+
{words.earlier}
|
|
256
|
+
</Button>
|
|
257
|
+
)}
|
|
258
|
+
<TranscriptView
|
|
259
|
+
key={session.id}
|
|
260
|
+
of={session.id}
|
|
261
|
+
events={events}
|
|
262
|
+
agent={props.agent}
|
|
263
|
+
fileHref={(fileId) => client.transcriptFileUrl(handle, session.id, fileId)}
|
|
264
|
+
signalFiles={filesOf}
|
|
265
|
+
signalFileHref={(number, fileId) => client.signalFileUrl(handle, number, fileId)}
|
|
266
|
+
onReadWhole={async (n) => (await client.transcriptText(handle, session.id, n)).text}
|
|
267
|
+
empty={session.away ? null : <p className="sc-field-hint">{words.empty}</p>}
|
|
268
|
+
foot={props.foot?.({ events, taken })}
|
|
269
|
+
/>
|
|
270
|
+
{/* At the conversation's end, where what is new would stand and a pane that follows it looks. */}
|
|
271
|
+
{open && standing === "lost" && (
|
|
272
|
+
<p className="sc-field-hint" role="status">
|
|
273
|
+
{words.lost}
|
|
274
|
+
</p>
|
|
275
|
+
)}
|
|
276
|
+
</section>
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* What the provider an account signs in through is called: the one of the deployment's whose
|
|
282
|
+
* logins the account's is shaped as, an address at Google, a name at the git host.
|
|
283
|
+
*/
|
|
284
|
+
export function providerOf(login: string, providers: readonly RestProvider[]): string {
|
|
285
|
+
return (
|
|
286
|
+
providers.find((one) => isLoginAt(one.key, login))?.label ??
|
|
287
|
+
(login.includes("@") ? "Google" : "GitHub")
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* An agent account's way onto a machine, for a supervisor: its invitation, read and made here,
|
|
293
|
+
* and, until its runner was heard from, the steps from an account just added to one at work.
|
|
294
|
+
*/
|
|
295
|
+
function AgentStart(props: {
|
|
296
|
+
readonly client: ConsoleClient;
|
|
297
|
+
readonly agent: RestAgent;
|
|
298
|
+
readonly handle: string;
|
|
299
|
+
/** Whether the console is held through a token, which reads no sign-in. */
|
|
300
|
+
readonly viaToken: boolean;
|
|
301
|
+
/** What the provider the account signs in through is called. */
|
|
302
|
+
readonly provider: string;
|
|
303
|
+
}) {
|
|
304
|
+
const { client, agent, handle, viaToken } = props;
|
|
305
|
+
const { busy, error, act } = useAction();
|
|
306
|
+
const readInvitation = useCallback(
|
|
307
|
+
(signal: AbortSignal) => client.agentInvitation(handle, signal),
|
|
308
|
+
[client, handle],
|
|
309
|
+
);
|
|
310
|
+
const invitation = useRead(readInvitation);
|
|
311
|
+
// The invitation just made: its code is shown this once, and is gone with the page.
|
|
312
|
+
const [made, setMade] = useState<RestAgentInvitationMade | undefined>(undefined);
|
|
313
|
+
const heard = agent.state !== null && agent.state !== undefined;
|
|
314
|
+
const readSignIns = useCallback(
|
|
315
|
+
(signal: AbortSignal) =>
|
|
316
|
+
viaToken || heard ? Promise.resolve(undefined) : client.agentSignIns(handle, signal),
|
|
317
|
+
[client, handle, viaToken, heard],
|
|
318
|
+
);
|
|
319
|
+
const signIns = useRead(readSignIns, heard ? undefined : REFRESH_MS);
|
|
320
|
+
const standing = invitation.failed === undefined ? invitation.value?.invitation : null;
|
|
321
|
+
const panel = (
|
|
322
|
+
<AgentInvitationPanel
|
|
323
|
+
invitation={standing}
|
|
324
|
+
made={made}
|
|
325
|
+
intro={heard}
|
|
326
|
+
guideHref={setupHref}
|
|
327
|
+
busy={busy}
|
|
328
|
+
onInvite={() =>
|
|
329
|
+
void act(async () => {
|
|
330
|
+
setMade(await client.inviteAgent(handle));
|
|
331
|
+
invitation.again();
|
|
332
|
+
})
|
|
333
|
+
}
|
|
334
|
+
onRevoke={() =>
|
|
335
|
+
void act(async () => {
|
|
336
|
+
await client.revokeAgentInvitation(handle);
|
|
337
|
+
setMade(undefined);
|
|
338
|
+
invitation.again();
|
|
339
|
+
})
|
|
340
|
+
}
|
|
341
|
+
/>
|
|
342
|
+
);
|
|
343
|
+
return (
|
|
344
|
+
<>
|
|
345
|
+
{error !== undefined && <Callout tone="danger">{error}</Callout>}
|
|
346
|
+
{heard ? (
|
|
347
|
+
panel
|
|
348
|
+
) : (
|
|
349
|
+
<AgentStartSteps
|
|
350
|
+
login={agent.person.login}
|
|
351
|
+
provider={props.provider}
|
|
352
|
+
signedIn={agent.person.invited !== true}
|
|
353
|
+
firstSignIn={agent.firstSignIn}
|
|
354
|
+
invited={made !== undefined || (standing !== null && standing !== undefined)}
|
|
355
|
+
onMachine={(signIns.value?.items ?? []).some((one) => one.kind === "command")}
|
|
356
|
+
heard={heard}
|
|
357
|
+
invitation={panel}
|
|
358
|
+
/>
|
|
359
|
+
)}
|
|
360
|
+
</>
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/** What the agent is doing now, and what its supervisor says to it. */
|
|
365
|
+
function AgentLive(props: {
|
|
366
|
+
readonly client: ConsoleClient;
|
|
367
|
+
readonly agent: RestAgent;
|
|
368
|
+
readonly handle: string;
|
|
369
|
+
/** Whether the console is held through a token, which reads no sign-in. */
|
|
370
|
+
readonly viaToken: boolean;
|
|
371
|
+
/** What the provider the account signs in through is called. */
|
|
372
|
+
readonly provider: string;
|
|
373
|
+
readonly onChanged: () => void;
|
|
374
|
+
}) {
|
|
375
|
+
const words = useWords().agents.page;
|
|
376
|
+
const { client, agent, handle, onChanged } = props;
|
|
377
|
+
const { busy, error, act } = useAction();
|
|
378
|
+
const [note, setNote] = useState<string | undefined>(undefined);
|
|
379
|
+
/** Counts what was said here: the pane goes to its end with each. */
|
|
380
|
+
const [said, setSaid] = useState(0);
|
|
381
|
+
const read = useCallback(
|
|
382
|
+
(signal: AbortSignal) => client.agentSessions(handle, { limit: 1 }, signal),
|
|
383
|
+
[client, handle],
|
|
384
|
+
);
|
|
385
|
+
const sessions = useRead(read, REFRESH_MS);
|
|
386
|
+
const session = sessions.value?.items[0];
|
|
387
|
+
const heard = agent.state !== null && agent.state !== undefined;
|
|
388
|
+
// The account's record of signals: what was told and not taken yet stands at the
|
|
389
|
+
// conversation's foot, and the files of a signal are named there.
|
|
390
|
+
const readSignals = useCallback(
|
|
391
|
+
(signal: AbortSignal) =>
|
|
392
|
+
heard ? client.signals(handle, { limit: 100 }, signal) : Promise.resolve(undefined),
|
|
393
|
+
[client, handle, heard],
|
|
394
|
+
);
|
|
395
|
+
const record = useRead(readSignals, heard ? REFRESH_MS : undefined);
|
|
396
|
+
const signals = record.value?.items;
|
|
397
|
+
const state = agent.state?.state;
|
|
398
|
+
const delivered = agent.runner?.delivered ?? 0;
|
|
399
|
+
const send = (kind: "stop" | "restart" | "reset", text: string) =>
|
|
400
|
+
act(async () => {
|
|
401
|
+
const sent = await client.sendSignal(handle, {
|
|
402
|
+
kind,
|
|
403
|
+
...(text.length === 0 ? {} : { text }),
|
|
404
|
+
});
|
|
405
|
+
setNote(words.tell.sent(sent.number, wordOf(words.live.signalKinds, sent.kind)));
|
|
406
|
+
onChanged();
|
|
407
|
+
sessions.again();
|
|
408
|
+
record.again();
|
|
409
|
+
});
|
|
410
|
+
/** The rows at the conversation's foot: what waits to be taken, and the sign that the agent is at work. */
|
|
411
|
+
const foot = (events: readonly RestTranscriptEvent[], taken: number | undefined): ReactNode => {
|
|
412
|
+
const open = session !== undefined && session.ended === null;
|
|
413
|
+
const working = open && state === "running" ? workingOf(events) : undefined;
|
|
414
|
+
// Signals are taken in order: everything up to the last one the record says was taken is.
|
|
415
|
+
// Where the record says none, what the runner says is delivered counts as taken: what the
|
|
416
|
+
// product took, or the record of an earlier session says was never read (ADR-0131).
|
|
417
|
+
const floor = open ? (taken ?? delivered) : Math.max(taken ?? 0, delivered);
|
|
418
|
+
const waiting = waitingOf(signals ?? [], floor);
|
|
419
|
+
const why =
|
|
420
|
+
state === "stopped"
|
|
421
|
+
? "stopped"
|
|
422
|
+
: state === "unheard"
|
|
423
|
+
? "unheard"
|
|
424
|
+
: working === undefined
|
|
425
|
+
? "soon"
|
|
426
|
+
: agent.runner?.offers?.steer === false
|
|
427
|
+
? "turn"
|
|
428
|
+
: "call";
|
|
429
|
+
return (
|
|
430
|
+
<>
|
|
431
|
+
<TalkWorking working={working} agent={agent.person} />
|
|
432
|
+
<TalkWaiting
|
|
433
|
+
signals={waiting}
|
|
434
|
+
why={why}
|
|
435
|
+
fileHref={(number, fileId) => client.signalFileUrl(handle, number, fileId)}
|
|
436
|
+
busy={busy}
|
|
437
|
+
onInterrupt={
|
|
438
|
+
working === undefined
|
|
439
|
+
? undefined
|
|
440
|
+
: () =>
|
|
441
|
+
void act(async () => {
|
|
442
|
+
await client.sendSignal(handle, { kind: "interrupt" });
|
|
443
|
+
record.again();
|
|
444
|
+
})
|
|
445
|
+
}
|
|
446
|
+
/>
|
|
447
|
+
</>
|
|
448
|
+
);
|
|
449
|
+
};
|
|
450
|
+
const composer = (
|
|
451
|
+
<SignalComposer
|
|
452
|
+
state={state}
|
|
453
|
+
images={agent.runner?.offers?.images}
|
|
454
|
+
busy={busy}
|
|
455
|
+
note={
|
|
456
|
+
error === undefined ? undefined : (
|
|
457
|
+
<span className="sc-form-error" role="alert">
|
|
458
|
+
{error}
|
|
459
|
+
</span>
|
|
460
|
+
)
|
|
461
|
+
}
|
|
462
|
+
// The box keeps what was written until this says the console took it.
|
|
463
|
+
onSend={(text, pictures) =>
|
|
464
|
+
act(async () => {
|
|
465
|
+
await client.sendSignal(handle, { kind: "tell", text }, pictures);
|
|
466
|
+
setSaid((count) => count + 1);
|
|
467
|
+
record.again();
|
|
468
|
+
onChanged();
|
|
469
|
+
sessions.again();
|
|
470
|
+
})
|
|
471
|
+
}
|
|
472
|
+
/>
|
|
473
|
+
);
|
|
474
|
+
return (
|
|
475
|
+
<div className="sc-agent-live">
|
|
476
|
+
<div className="sc-agent-live-main">
|
|
477
|
+
{sessions.value === undefined ? (
|
|
478
|
+
sessions.failed === undefined ? (
|
|
479
|
+
<div className="sc-loading">
|
|
480
|
+
<Spinner label={words.loading} />
|
|
481
|
+
</div>
|
|
482
|
+
) : (
|
|
483
|
+
<Callout tone="danger">{words.live.couldNotLoad}</Callout>
|
|
484
|
+
)
|
|
485
|
+
) : !heard ? (
|
|
486
|
+
// An account no runner has spoken for has no session to show and is told nothing yet:
|
|
487
|
+
// what stands between it and its first one is shown in its place.
|
|
488
|
+
<section className="sc-panel" aria-label={words.start.title}>
|
|
489
|
+
<h2 className="sc-section-title">{words.start.title}</h2>
|
|
490
|
+
<p className="sc-field-hint">{words.start.intro}</p>
|
|
491
|
+
<AgentStart
|
|
492
|
+
client={client}
|
|
493
|
+
agent={agent}
|
|
494
|
+
handle={handle}
|
|
495
|
+
viaToken={props.viaToken}
|
|
496
|
+
provider={props.provider}
|
|
497
|
+
/>
|
|
498
|
+
</section>
|
|
499
|
+
) : (
|
|
500
|
+
<ChatPane label={words.live.transcript} composer={composer} said={said}>
|
|
501
|
+
{session === undefined ? (
|
|
502
|
+
<TranscriptView
|
|
503
|
+
events={[]}
|
|
504
|
+
fileHref={() => ""}
|
|
505
|
+
empty={
|
|
506
|
+
<EmptyState title={words.live.noSession.title} body={words.live.noSession.body} />
|
|
507
|
+
}
|
|
508
|
+
foot={foot([], undefined)}
|
|
509
|
+
/>
|
|
510
|
+
) : (
|
|
511
|
+
<>
|
|
512
|
+
{session.ended !== null && (
|
|
513
|
+
<p className="sc-field-hint sc-agent-live-lead">{words.live.last}</p>
|
|
514
|
+
)}
|
|
515
|
+
<SessionTranscript
|
|
516
|
+
key={session.id}
|
|
517
|
+
client={client}
|
|
518
|
+
handle={handle}
|
|
519
|
+
session={session}
|
|
520
|
+
agent={agent.person}
|
|
521
|
+
signals={signals ?? []}
|
|
522
|
+
foot={({ events, taken }) => foot(events, taken)}
|
|
523
|
+
onEnded={() => {
|
|
524
|
+
sessions.again();
|
|
525
|
+
onChanged();
|
|
526
|
+
}}
|
|
527
|
+
/>
|
|
528
|
+
</>
|
|
529
|
+
)}
|
|
530
|
+
</ChatPane>
|
|
531
|
+
)}
|
|
532
|
+
</div>
|
|
533
|
+
<aside className="sc-agent-live-side">
|
|
534
|
+
{session !== undefined && (
|
|
535
|
+
<section className="sc-panel" aria-label={words.live.now}>
|
|
536
|
+
<h2 className="sc-section-title">{words.live.now}</h2>
|
|
537
|
+
<AgentSessionList
|
|
538
|
+
sessions={[session]}
|
|
539
|
+
href={(one) => agentHref(handle, "sessions", one.id)}
|
|
540
|
+
/>
|
|
541
|
+
</section>
|
|
542
|
+
)}
|
|
543
|
+
{heard && (
|
|
544
|
+
<section className="sc-panel" aria-label={words.controls.title}>
|
|
545
|
+
<h2 className="sc-section-title">{words.controls.title}</h2>
|
|
546
|
+
<AgentControls state={state} busy={busy} onSend={send} note={note} />
|
|
547
|
+
</section>
|
|
548
|
+
)}
|
|
549
|
+
<section className="sc-panel" aria-label={words.choice.title}>
|
|
550
|
+
<h2 className="sc-section-title">{words.choice.title}</h2>
|
|
551
|
+
<AgentChoice
|
|
552
|
+
runner={agent.runner}
|
|
553
|
+
busy={busy}
|
|
554
|
+
onSet={(choice) =>
|
|
555
|
+
void act(async () => {
|
|
556
|
+
const sent = await client.sendSignal(handle, { kind: "set", set: choice });
|
|
557
|
+
setNote(words.tell.sent(sent.number, wordOf(words.live.signalKinds, sent.kind)));
|
|
558
|
+
onChanged();
|
|
559
|
+
})
|
|
560
|
+
}
|
|
561
|
+
/>
|
|
562
|
+
</section>
|
|
563
|
+
</aside>
|
|
564
|
+
</div>
|
|
565
|
+
);
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
/** The agent's sessions, the newest first; or one of them, read whole. */
|
|
569
|
+
function AgentSessions(props: {
|
|
570
|
+
readonly client: ConsoleClient;
|
|
571
|
+
readonly handle: string;
|
|
572
|
+
readonly session: string | undefined;
|
|
573
|
+
/** The account, whose picture stands beside what it said. */
|
|
574
|
+
readonly agent: RestAgent["person"];
|
|
575
|
+
}) {
|
|
576
|
+
const words = useWords().agents.page;
|
|
577
|
+
const { client, handle, session } = props;
|
|
578
|
+
const [older, setOlder] = useState<readonly RestAgentSession[]>([]);
|
|
579
|
+
const [more, setMore] = useState<boolean | undefined>(undefined);
|
|
580
|
+
const read = useCallback(
|
|
581
|
+
async (signal: AbortSignal) =>
|
|
582
|
+
session === undefined
|
|
583
|
+
? { list: await client.agentSessions(handle, {}, signal), one: undefined }
|
|
584
|
+
: { list: undefined, one: await client.agentSession(handle, session, signal) },
|
|
585
|
+
[client, handle, session],
|
|
586
|
+
);
|
|
587
|
+
const found = useRead(read);
|
|
588
|
+
if (found.value === undefined) {
|
|
589
|
+
return found.failed === undefined ? (
|
|
590
|
+
<div className="sc-loading">
|
|
591
|
+
<Spinner label={words.loading} />
|
|
592
|
+
</div>
|
|
593
|
+
) : (
|
|
594
|
+
<Callout tone="danger">{words.live.couldNotLoad}</Callout>
|
|
595
|
+
);
|
|
596
|
+
}
|
|
597
|
+
if (found.value.one !== undefined) {
|
|
598
|
+
return (
|
|
599
|
+
<>
|
|
600
|
+
<nav className="sc-doc-crumbs sc-agent-crumbs" aria-label={words.sessions.title}>
|
|
601
|
+
<a href={agentHref(handle, "sessions")}>{words.sessions.back}</a>
|
|
602
|
+
</nav>
|
|
603
|
+
<div className="sc-panel sc-agent-session-panel">
|
|
604
|
+
<AgentSessionList
|
|
605
|
+
sessions={[found.value.one]}
|
|
606
|
+
href={() => agentHref(handle, "sessions", session)}
|
|
607
|
+
/>
|
|
608
|
+
</div>
|
|
609
|
+
<SessionTranscript
|
|
610
|
+
key={found.value.one.id}
|
|
611
|
+
client={client}
|
|
612
|
+
handle={handle}
|
|
613
|
+
session={found.value.one}
|
|
614
|
+
agent={props.agent}
|
|
615
|
+
onEnded={found.again}
|
|
616
|
+
/>
|
|
617
|
+
</>
|
|
618
|
+
);
|
|
619
|
+
}
|
|
620
|
+
const first = found.value.list?.items ?? [];
|
|
621
|
+
const all = [...first, ...older];
|
|
622
|
+
const hasMore = more ?? found.value.list?.more ?? false;
|
|
623
|
+
const earlier = () => {
|
|
624
|
+
const before = all.at(-1)?.startedAt;
|
|
625
|
+
void client
|
|
626
|
+
.agentSessions(handle, { before })
|
|
627
|
+
.then((page) => {
|
|
628
|
+
setOlder((current) => [...current, ...page.items]);
|
|
629
|
+
setMore(page.more);
|
|
630
|
+
})
|
|
631
|
+
.catch(() => setMore(false));
|
|
632
|
+
};
|
|
633
|
+
return (
|
|
634
|
+
<>
|
|
635
|
+
{all.length === 0 ? (
|
|
636
|
+
<EmptyState title={words.sessions.empty.title} body={words.sessions.empty.body} />
|
|
637
|
+
) : (
|
|
638
|
+
<div className="sc-panel sc-agent-session-panel">
|
|
639
|
+
<AgentSessionList sessions={all} href={(one) => agentHref(handle, "sessions", one.id)} />
|
|
640
|
+
{hasMore && (
|
|
641
|
+
<Button variant="ghost" size="sm" onClick={earlier}>
|
|
642
|
+
{words.sessions.more}
|
|
643
|
+
</Button>
|
|
644
|
+
)}
|
|
645
|
+
</div>
|
|
646
|
+
)}
|
|
647
|
+
</>
|
|
648
|
+
);
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
/** What is kept of the agent: its runner, where it is signed in, what it runs with, its secrets by name, its persona. */
|
|
652
|
+
function AgentSettings(props: {
|
|
653
|
+
readonly client: ConsoleClient;
|
|
654
|
+
readonly agent: RestAgent;
|
|
655
|
+
readonly handle: string;
|
|
656
|
+
/** Whether the console is held through a token, which reads no sign-in. */
|
|
657
|
+
readonly viaToken: boolean;
|
|
658
|
+
/** What the provider the account signs in through is called. */
|
|
659
|
+
readonly provider: string;
|
|
660
|
+
readonly onChanged: () => void;
|
|
661
|
+
}) {
|
|
662
|
+
const words = useWords();
|
|
663
|
+
const page = words.agents.page;
|
|
664
|
+
const { client, agent, handle, viaToken, onChanged } = props;
|
|
665
|
+
const { busy, error, act } = useAction();
|
|
666
|
+
const readSecrets = useCallback(
|
|
667
|
+
(signal: AbortSignal) => client.agentSecrets(handle, signal),
|
|
668
|
+
[client, handle],
|
|
669
|
+
);
|
|
670
|
+
const secrets = useRead(readSecrets);
|
|
671
|
+
const readSignIns = useCallback(
|
|
672
|
+
(signal: AbortSignal) =>
|
|
673
|
+
viaToken ? Promise.resolve(undefined) : client.agentSignIns(handle, signal),
|
|
674
|
+
[client, handle, viaToken],
|
|
675
|
+
);
|
|
676
|
+
const signIns = useRead(readSignIns);
|
|
677
|
+
const [name, setName] = useState(agent.person.name ?? "");
|
|
678
|
+
const [role, setRole] = useState(agent.person.title ?? "");
|
|
679
|
+
const [dayStart, setDayStart] = useState(agent.hours?.dayStart ?? "");
|
|
680
|
+
const [dayEnd, setDayEnd] = useState(agent.hours?.dayEnd ?? "");
|
|
681
|
+
const hoursUnchanged =
|
|
682
|
+
dayStart === (agent.hours?.dayStart ?? "") && dayEnd === (agent.hours?.dayEnd ?? "");
|
|
683
|
+
const saveHours = (event: FormEvent) => {
|
|
684
|
+
event.preventDefault();
|
|
685
|
+
void act(async () => {
|
|
686
|
+
await client.updateAgent(handle, {
|
|
687
|
+
dayStart: dayStart.length === 0 ? null : dayStart,
|
|
688
|
+
dayEnd: dayEnd.length === 0 ? null : dayEnd,
|
|
689
|
+
});
|
|
690
|
+
onChanged();
|
|
691
|
+
});
|
|
692
|
+
};
|
|
693
|
+
const kept: readonly RestAgentSecret[] = secrets.value?.items ?? [];
|
|
694
|
+
const where: readonly RestSession[] = signIns.value?.items ?? [];
|
|
695
|
+
const savePersona = (event: FormEvent) => {
|
|
696
|
+
event.preventDefault();
|
|
697
|
+
void act(async () => {
|
|
698
|
+
await client.updateAgent(handle, {
|
|
699
|
+
...(name.trim() === (agent.person.name ?? "") ? {} : { name: name.trim() }),
|
|
700
|
+
...(role.trim() === (agent.person.title ?? "")
|
|
701
|
+
? {}
|
|
702
|
+
: { title: role.trim().length === 0 ? null : role.trim() }),
|
|
703
|
+
});
|
|
704
|
+
onChanged();
|
|
705
|
+
});
|
|
706
|
+
};
|
|
707
|
+
const unchanged =
|
|
708
|
+
name.trim() === (agent.person.name ?? "") && role.trim() === (agent.person.title ?? "");
|
|
709
|
+
// Two columns where there is room: who the agent is, when it works and where it is signed in at
|
|
710
|
+
// the left, how it runs and what it holds at the right; one column, in that order, where not.
|
|
711
|
+
return (
|
|
712
|
+
<div className="sc-agent-settings">
|
|
713
|
+
{error !== undefined && <Callout tone="danger">{error}</Callout>}
|
|
714
|
+
<div className="sc-agent-settings-column">
|
|
715
|
+
<section className="sc-panel" aria-label={page.settings.persona.title}>
|
|
716
|
+
<h2 className="sc-section-title">{page.settings.persona.title}</h2>
|
|
717
|
+
<AgentPictureSave person={agent.person} busy={busy} />
|
|
718
|
+
<dl className="sc-person-facts sc-agent-runner-facts">
|
|
719
|
+
<div className="sc-person-fact">
|
|
720
|
+
<dt>{words.agents.accounts.login}</dt>
|
|
721
|
+
<dd>
|
|
722
|
+
{agent.person.login} · {props.provider}
|
|
723
|
+
</dd>
|
|
724
|
+
</div>
|
|
725
|
+
</dl>
|
|
726
|
+
<form className="sc-agent-persona" onSubmit={savePersona}>
|
|
727
|
+
<label className="sc-field">
|
|
728
|
+
<span className="sc-field-label">{page.settings.persona.name}</span>
|
|
729
|
+
<input
|
|
730
|
+
className="sc-input"
|
|
731
|
+
value={name}
|
|
732
|
+
onChange={(event) => setName(event.target.value)}
|
|
733
|
+
/>
|
|
734
|
+
</label>
|
|
735
|
+
<label className="sc-field">
|
|
736
|
+
<span className="sc-field-label">{page.settings.persona.role}</span>
|
|
737
|
+
<input
|
|
738
|
+
className="sc-input"
|
|
739
|
+
value={role}
|
|
740
|
+
onChange={(event) => setRole(event.target.value)}
|
|
741
|
+
/>
|
|
742
|
+
</label>
|
|
743
|
+
<Button type="submit" disabled={busy || unchanged || name.trim().length === 0}>
|
|
744
|
+
{page.settings.persona.save}
|
|
745
|
+
</Button>
|
|
746
|
+
</form>
|
|
747
|
+
</section>
|
|
748
|
+
<section className="sc-panel" aria-label={page.settings.hours.title}>
|
|
749
|
+
<h2 className="sc-section-title">{page.settings.hours.title}</h2>
|
|
750
|
+
<form className="sc-agent-persona" onSubmit={saveHours}>
|
|
751
|
+
<label className="sc-field">
|
|
752
|
+
<span className="sc-field-label">{page.settings.hours.start}</span>
|
|
753
|
+
<input
|
|
754
|
+
className="sc-input"
|
|
755
|
+
type="time"
|
|
756
|
+
value={dayStart}
|
|
757
|
+
onChange={(event) => setDayStart(event.target.value)}
|
|
758
|
+
/>
|
|
759
|
+
</label>
|
|
760
|
+
<label className="sc-field">
|
|
761
|
+
<span className="sc-field-label">{page.settings.hours.end}</span>
|
|
762
|
+
<input
|
|
763
|
+
className="sc-input"
|
|
764
|
+
type="time"
|
|
765
|
+
value={dayEnd}
|
|
766
|
+
onChange={(event) => setDayEnd(event.target.value)}
|
|
767
|
+
/>
|
|
768
|
+
</label>
|
|
769
|
+
<Button type="submit" disabled={busy || hoursUnchanged}>
|
|
770
|
+
{page.settings.hours.save}
|
|
771
|
+
</Button>
|
|
772
|
+
</form>
|
|
773
|
+
<p className="sc-field-hint">{page.settings.hours.intro}</p>
|
|
774
|
+
</section>
|
|
775
|
+
<section className="sc-panel" aria-label={page.settings.elsewhere.title}>
|
|
776
|
+
<h2 className="sc-section-title">{page.settings.elsewhere.title}</h2>
|
|
777
|
+
<AgentElsewhereList accounts={agent.accounts} />
|
|
778
|
+
</section>
|
|
779
|
+
<section className="sc-panel" aria-label={page.settings.signIns.title}>
|
|
780
|
+
<h2 className="sc-section-title">{page.settings.signIns.title}</h2>
|
|
781
|
+
{viaToken || signIns.failed !== undefined ? (
|
|
782
|
+
<p className="sc-field-hint">{page.settings.signIns.couldNotLoad}</p>
|
|
783
|
+
) : where.length === 0 ? (
|
|
784
|
+
<p className="sc-field-hint">{page.settings.signIns.empty}</p>
|
|
785
|
+
) : (
|
|
786
|
+
<ul className="sc-agent-secret-list">
|
|
787
|
+
{where.map((one) => (
|
|
788
|
+
<li key={one.id} className="sc-agent-secret">
|
|
789
|
+
<span>
|
|
790
|
+
{one.kind === "command"
|
|
791
|
+
? words.sessions.command(one.name ?? "")
|
|
792
|
+
: one.browser !== null && one.platform !== null
|
|
793
|
+
? words.sessions.on(one.browser, one.platform)
|
|
794
|
+
: (one.browser ?? one.platform ?? words.sessions.unknownBrowser)}
|
|
795
|
+
</span>
|
|
796
|
+
<span className="sc-muted">
|
|
797
|
+
<Time iso={one.lastSeenAt} />
|
|
798
|
+
</span>
|
|
799
|
+
<Button
|
|
800
|
+
variant="ghost"
|
|
801
|
+
size="sm"
|
|
802
|
+
disabled={busy}
|
|
803
|
+
onClick={() =>
|
|
804
|
+
void act(async () => {
|
|
805
|
+
await client.endAgentSignIn(handle, one.id);
|
|
806
|
+
signIns.again();
|
|
807
|
+
})
|
|
808
|
+
}
|
|
809
|
+
>
|
|
810
|
+
{words.sessions.end}
|
|
811
|
+
</Button>
|
|
812
|
+
</li>
|
|
813
|
+
))}
|
|
814
|
+
</ul>
|
|
815
|
+
)}
|
|
816
|
+
</section>
|
|
817
|
+
</div>
|
|
818
|
+
<div className="sc-agent-settings-column">
|
|
819
|
+
<section className="sc-panel" aria-label={page.settings.runner.title}>
|
|
820
|
+
<h2 className="sc-section-title">{page.settings.runner.title}</h2>
|
|
821
|
+
<AgentRunnerFacts runner={agent.runner} />
|
|
822
|
+
<AgentChoice
|
|
823
|
+
runner={agent.runner}
|
|
824
|
+
busy={busy}
|
|
825
|
+
onSet={(choice) =>
|
|
826
|
+
void act(async () => {
|
|
827
|
+
await client.sendSignal(handle, { kind: "set", set: choice });
|
|
828
|
+
onChanged();
|
|
829
|
+
})
|
|
830
|
+
}
|
|
831
|
+
/>
|
|
832
|
+
</section>
|
|
833
|
+
<section className="sc-panel" aria-label={page.settings.machine.title}>
|
|
834
|
+
<h2 className="sc-section-title">
|
|
835
|
+
{agent.state === null || agent.state === undefined
|
|
836
|
+
? page.start.title
|
|
837
|
+
: page.settings.machine.title}
|
|
838
|
+
</h2>
|
|
839
|
+
<AgentStart
|
|
840
|
+
client={client}
|
|
841
|
+
agent={agent}
|
|
842
|
+
handle={handle}
|
|
843
|
+
viaToken={viaToken}
|
|
844
|
+
provider={props.provider}
|
|
845
|
+
/>
|
|
846
|
+
</section>
|
|
847
|
+
<section className="sc-panel" aria-label={page.settings.secrets.title}>
|
|
848
|
+
<h2 className="sc-section-title">{page.settings.secrets.title}</h2>
|
|
849
|
+
<AgentSecretList
|
|
850
|
+
secrets={kept}
|
|
851
|
+
busy={busy}
|
|
852
|
+
onSeed={(secret, value) =>
|
|
853
|
+
void act(async () => {
|
|
854
|
+
await client.seedAgentSecret(handle, secret, { value });
|
|
855
|
+
secrets.again();
|
|
856
|
+
})
|
|
857
|
+
}
|
|
858
|
+
onRemove={(secret) =>
|
|
859
|
+
void act(async () => {
|
|
860
|
+
await client.removeAgentSecret(handle, secret);
|
|
861
|
+
secrets.again();
|
|
862
|
+
})
|
|
863
|
+
}
|
|
864
|
+
/>
|
|
865
|
+
</section>
|
|
866
|
+
</div>
|
|
867
|
+
</div>
|
|
868
|
+
);
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
export interface AgentPageProps {
|
|
872
|
+
readonly handle: string;
|
|
873
|
+
readonly tab: AgentTab;
|
|
874
|
+
readonly session: string | undefined;
|
|
875
|
+
readonly client: ConsoleClient;
|
|
876
|
+
/** Whether the console is held through a token: such a console reads no sign-in. */
|
|
877
|
+
readonly viaToken: boolean;
|
|
878
|
+
/** The providers people sign in through here, by which an account's login is said to be at one. */
|
|
879
|
+
readonly providers?: readonly RestProvider[] | undefined;
|
|
880
|
+
/** The agent's plate, which the console draws as it draws a person's. */
|
|
881
|
+
readonly work: (agent: RestAgent) => ReactNode;
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
/**
|
|
885
|
+
* What a view of an agent's page shows to whoever opens it: its work to anyone who sees the
|
|
886
|
+
* account, and the rest, what it is doing, its sessions and what is kept of it, its picture and
|
|
887
|
+
* the names of its secrets among them, to its supervisors alone. Whoever only sees the account
|
|
888
|
+
* and opens its page, from the people's list say, is shown its work, which is theirs to read;
|
|
889
|
+
* a view named in an address that is not theirs to open says so.
|
|
890
|
+
*/
|
|
891
|
+
export function agentViewOf(tab: AgentTab, supervised: boolean): AgentTab | "closed" {
|
|
892
|
+
if (supervised || tab === "work") {
|
|
893
|
+
return tab;
|
|
894
|
+
}
|
|
895
|
+
return tab === "live" ? "work" : "closed";
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
export function AgentPage(props: AgentPageProps) {
|
|
899
|
+
const all = useWords();
|
|
900
|
+
const words = all.agents.page;
|
|
901
|
+
const { handle, tab, client } = props;
|
|
902
|
+
const read = useCallback((signal: AbortSignal) => client.agent(handle, signal), [client, handle]);
|
|
903
|
+
const found = useRead(read, REFRESH_MS);
|
|
904
|
+
const agent = found.value;
|
|
905
|
+
if (agent === undefined) {
|
|
906
|
+
if (found.failed === undefined) {
|
|
907
|
+
return (
|
|
908
|
+
<div className="sc-loading">
|
|
909
|
+
<Spinner label={words.loading} />
|
|
910
|
+
</div>
|
|
911
|
+
);
|
|
912
|
+
}
|
|
913
|
+
const gone = found.failed instanceof ApiError && found.failed.status === 404;
|
|
914
|
+
return (
|
|
915
|
+
<EmptyState
|
|
916
|
+
title={gone ? words.notFound.title : words.live.couldNotLoad}
|
|
917
|
+
body={gone ? words.notFound.body : undefined}
|
|
918
|
+
action={<LinkButton href={PATHS.agents}>{all.nav.agents}</LinkButton>}
|
|
919
|
+
/>
|
|
920
|
+
);
|
|
921
|
+
}
|
|
922
|
+
const { person } = agent;
|
|
923
|
+
const labels: Readonly<Record<AgentTab, string>> = words.tabs;
|
|
924
|
+
const provider = providerOf(person.login, props.providers ?? []);
|
|
925
|
+
const view = agentViewOf(tab, agent.supervised);
|
|
926
|
+
return (
|
|
927
|
+
<>
|
|
928
|
+
<header className="sc-panel sc-agent-header">
|
|
929
|
+
<div className="sc-agent-head">
|
|
930
|
+
<Avatar person={person} size="xl" />
|
|
931
|
+
<div className="sc-agent-head-who">
|
|
932
|
+
<div className="sc-agent-head-name">
|
|
933
|
+
<h1 className="sc-page-title">{personName(person)}</h1>
|
|
934
|
+
<span className="sc-muted">@{person.handle}</span>
|
|
935
|
+
</div>
|
|
936
|
+
{(person.title ?? "") !== "" && <p className="sc-lead">{person.title}</p>}
|
|
937
|
+
<AgentStateBadge state={agent.state} full />
|
|
938
|
+
</div>
|
|
939
|
+
<dl className="sc-facts-row sc-agent-head-facts">
|
|
940
|
+
<div>
|
|
941
|
+
<dt>{all.people.manager}</dt>
|
|
942
|
+
<dd>
|
|
943
|
+
{agent.manager === null ? (
|
|
944
|
+
<span className="sc-muted">{all.agents.accounts.managerUnseen}</span>
|
|
945
|
+
) : (
|
|
946
|
+
<PersonChip person={agent.manager} />
|
|
947
|
+
)}
|
|
948
|
+
</dd>
|
|
949
|
+
</div>
|
|
950
|
+
</dl>
|
|
951
|
+
</div>
|
|
952
|
+
</header>
|
|
953
|
+
{/* Whoever only sees the account reads its plate, and is offered no view they cannot open. */}
|
|
954
|
+
{agent.supervised && (
|
|
955
|
+
<nav className="sc-subtabs sc-agent-views" aria-label={words.tabs.aria}>
|
|
956
|
+
{TABS.map((one) => (
|
|
957
|
+
<a
|
|
958
|
+
key={one}
|
|
959
|
+
className={cx("sc-tab", one === tab && "sc-tab-current")}
|
|
960
|
+
href={agentHref(handle, one)}
|
|
961
|
+
aria-current={one === tab ? "page" : undefined}
|
|
962
|
+
>
|
|
963
|
+
{labels[one]}
|
|
964
|
+
</a>
|
|
965
|
+
))}
|
|
966
|
+
</nav>
|
|
967
|
+
)}
|
|
968
|
+
{view === "work" ? (
|
|
969
|
+
props.work(agent)
|
|
970
|
+
) : view === "closed" ? (
|
|
971
|
+
<EmptyState title={words.notSupervised.title} body={words.notSupervised.body} />
|
|
972
|
+
) : view === "live" ? (
|
|
973
|
+
<AgentLive
|
|
974
|
+
client={client}
|
|
975
|
+
agent={agent}
|
|
976
|
+
handle={handle}
|
|
977
|
+
viaToken={props.viaToken}
|
|
978
|
+
provider={provider}
|
|
979
|
+
onChanged={found.again}
|
|
980
|
+
/>
|
|
981
|
+
) : view === "sessions" ? (
|
|
982
|
+
<AgentSessions
|
|
983
|
+
client={client}
|
|
984
|
+
handle={handle}
|
|
985
|
+
session={props.session}
|
|
986
|
+
agent={agent.person}
|
|
987
|
+
/>
|
|
988
|
+
) : (
|
|
989
|
+
<AgentSettings
|
|
990
|
+
client={client}
|
|
991
|
+
agent={agent}
|
|
992
|
+
handle={handle}
|
|
993
|
+
viaToken={props.viaToken}
|
|
994
|
+
provider={provider}
|
|
995
|
+
onChanged={found.again}
|
|
996
|
+
/>
|
|
997
|
+
)}
|
|
998
|
+
</>
|
|
999
|
+
);
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
/**
|
|
1003
|
+
* The agents that report to a person and are not running, on that person's plate: each with how
|
|
1004
|
+
* it stands and the way to its page, so that whoever manages several is told once where to look.
|
|
1005
|
+
*/
|
|
1006
|
+
export function AgentsNeedingYou(props: {
|
|
1007
|
+
readonly agents: readonly RestAgent[];
|
|
1008
|
+
readonly me: string | undefined;
|
|
1009
|
+
}) {
|
|
1010
|
+
const words = useWords().agents.needYou;
|
|
1011
|
+
const waiting = props.agents.filter(
|
|
1012
|
+
(agent) =>
|
|
1013
|
+
agent.manager?.id === props.me &&
|
|
1014
|
+
agent.person.status === "active" &&
|
|
1015
|
+
agent.state !== null &&
|
|
1016
|
+
agent.state !== undefined &&
|
|
1017
|
+
agent.state.state !== "running",
|
|
1018
|
+
);
|
|
1019
|
+
if (props.me === undefined || waiting.length === 0) {
|
|
1020
|
+
return null;
|
|
1021
|
+
}
|
|
1022
|
+
return (
|
|
1023
|
+
<section className="sc-panel sc-agents-need-you" aria-label={words.title}>
|
|
1024
|
+
<h2 className="sc-section-title">{words.title}</h2>
|
|
1025
|
+
<p className="sc-field-hint">{words.intro}</p>
|
|
1026
|
+
<ul className="sc-agent-secret-list">
|
|
1027
|
+
{waiting.map((agent) => (
|
|
1028
|
+
<li key={agent.person.id} className="sc-agent-secret">
|
|
1029
|
+
<a className="sc-agent-need-link" href={agentHref(agent.person.handle ?? "")}>
|
|
1030
|
+
<Avatar person={agent.person} size="sm" />
|
|
1031
|
+
{personName(agent.person)}
|
|
1032
|
+
</a>
|
|
1033
|
+
<AgentStateBadge state={agent.state} full />
|
|
1034
|
+
</li>
|
|
1035
|
+
))}
|
|
1036
|
+
</ul>
|
|
1037
|
+
</section>
|
|
1038
|
+
);
|
|
1039
|
+
}
|