@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,985 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useCallback, useEffect, useMemo, useRef, useState, } from "react";
|
|
3
|
+
import { MAX_FILE_BYTES, MAX_SIGNAL_ATTACHMENTS, MAX_SIGNAL_LENGTH, } from "../api.js";
|
|
4
|
+
import { today } from "../dates.js";
|
|
5
|
+
import { useWords } from "../i18n/index.js";
|
|
6
|
+
import { isPicture } from "./files.js";
|
|
7
|
+
import { Lightbox, PictureThumb, usePicture } from "./pictures.js";
|
|
8
|
+
import { Avatar, Badge, Button, Callout, cx, formatBytes, personName, Time } from "./ui.js";
|
|
9
|
+
// The parts of an agent account's page (ADR-0085, ADR-0086): how it stands, what it is doing as
|
|
10
|
+
// it happens, read as a conversation in a pane that follows its end, what a supervisor says to
|
|
11
|
+
// it, shown as waiting until the agent takes it, what changes how it stands, its sessions, and
|
|
12
|
+
// what its runner said of itself. Everything an agent's product printed is shown as text, in a
|
|
13
|
+
// block that keeps its spaces and its lines, and is never made markup; a picture is shown by its
|
|
14
|
+
// address at the console, and any other file is offered to save.
|
|
15
|
+
/** How an agent stands, in a word, with the tone of it. */
|
|
16
|
+
const STATE_TONES = {
|
|
17
|
+
running: "success",
|
|
18
|
+
stopped: "neutral",
|
|
19
|
+
refused: "warning",
|
|
20
|
+
failed: "danger",
|
|
21
|
+
unheard: "warning",
|
|
22
|
+
};
|
|
23
|
+
/** The state of an agent account as a badge: the word, and why and since when where there is room. */
|
|
24
|
+
export function AgentStateBadge(props) {
|
|
25
|
+
const words = useWords().agents.page.state;
|
|
26
|
+
const state = props.state ?? null;
|
|
27
|
+
if (state === null) {
|
|
28
|
+
// Where there is room, an account no runner has spoken for says so as the others say how they
|
|
29
|
+
// stand: a word in a badge, and why beside it.
|
|
30
|
+
return props.full === true ? (_jsxs("span", { className: "sc-agent-state", children: [_jsx(Badge, { tone: "neutral", kind: "state", children: words.unset }), _jsx("span", { className: "sc-agent-state-why", children: words.none })] })) : null;
|
|
31
|
+
}
|
|
32
|
+
const reasons = words.reasons;
|
|
33
|
+
const reason = state.reason === null ? undefined : (reasons[state.reason] ?? state.reason);
|
|
34
|
+
const badge = (_jsx(Badge, { tone: STATE_TONES[state.state], kind: "state", live: state.state === "running", title: reason, children: words[state.state] }));
|
|
35
|
+
if (props.full !== true) {
|
|
36
|
+
return badge;
|
|
37
|
+
}
|
|
38
|
+
return (_jsxs("span", { className: "sc-agent-state", children: [badge, _jsxs("span", { className: "sc-agent-state-why", children: [reason !== undefined && `${reason} · `, words.since.before, _jsx(Time, { iso: state.since, precision: "clock" }), words.since.after, state.heardAt !== null && (_jsxs(_Fragment, { children: [" · ", words.heard, " ", _jsx(Time, { iso: state.heardAt, precision: "clock" })] }))] })] }));
|
|
39
|
+
}
|
|
40
|
+
/** What a runner says of an event that is said apart from the rest: the tool it names. */
|
|
41
|
+
const TOOL = "tool";
|
|
42
|
+
/** The most characters of a sub-agent's name that a label shows. */
|
|
43
|
+
const MAX_SUBAGENT_LABEL = 40;
|
|
44
|
+
/**
|
|
45
|
+
* Whose an event is, where a sub-agent made it (ADR-0131): what the call that started the
|
|
46
|
+
* sub-agent called it, an empty name where the runner knew only that call, and nothing for an
|
|
47
|
+
* event of the session's own, which is every event of a runner that does not say.
|
|
48
|
+
*/
|
|
49
|
+
export function subagentOf(event) {
|
|
50
|
+
const parent = event?.data.parent;
|
|
51
|
+
if (typeof parent !== "string" || parent.length === 0) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
const name = event?.data.subagent;
|
|
55
|
+
return typeof name === "string" ? name.trim().slice(0, MAX_SUBAGENT_LABEL) : "";
|
|
56
|
+
}
|
|
57
|
+
const idOf = (event) => {
|
|
58
|
+
const id = event.data.id;
|
|
59
|
+
return typeof id === "string" && id.length > 0 ? id : undefined;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* The events of a session as the things a person reads, in order. A tool's call, what it
|
|
63
|
+
* answered and what was asked before it ran are one thing, joined by the id the product gave
|
|
64
|
+
* them; a call under an id whose call is done is another call, as an agent that numbers its
|
|
65
|
+
* calls anew at every turn has it. What carries no id joins the call before it that waits.
|
|
66
|
+
*/
|
|
67
|
+
export function talkOf(events) {
|
|
68
|
+
const items = [];
|
|
69
|
+
/** The tool things by the id they are open under, as places among the items. */
|
|
70
|
+
const open = new Map();
|
|
71
|
+
const toolAt = (at) => {
|
|
72
|
+
const item = at === undefined ? undefined : items[at];
|
|
73
|
+
return item !== undefined && item.type === "tool" ? item : undefined;
|
|
74
|
+
};
|
|
75
|
+
/** The last tool thing that still waits for what `field` names, where nothing names an id. */
|
|
76
|
+
const waiting = (field) => {
|
|
77
|
+
for (let at = items.length - 1; at >= 0; at -= 1) {
|
|
78
|
+
const item = items[at];
|
|
79
|
+
if (item === undefined || item.type !== "tool") {
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
82
|
+
if (item[field] === undefined) {
|
|
83
|
+
return at;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return undefined;
|
|
87
|
+
};
|
|
88
|
+
const put = (id, tool, at) => {
|
|
89
|
+
if (at === undefined) {
|
|
90
|
+
items.push(tool);
|
|
91
|
+
if (id !== undefined) {
|
|
92
|
+
open.set(id, items.length - 1);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
items[at] = tool;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
for (const event of events) {
|
|
100
|
+
// A sealed event says who sealed it and why, wherever it stood.
|
|
101
|
+
if (event.sealed !== null) {
|
|
102
|
+
items.push({ type: "note", event });
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if (event.kind === "person") {
|
|
106
|
+
items.push({ type: "told", event });
|
|
107
|
+
}
|
|
108
|
+
else if (event.kind === "wake") {
|
|
109
|
+
items.push({ type: "wake", event });
|
|
110
|
+
}
|
|
111
|
+
else if (event.kind === "assistant") {
|
|
112
|
+
items.push({ type: "said", event });
|
|
113
|
+
}
|
|
114
|
+
else if (event.kind === "thinking") {
|
|
115
|
+
items.push({ type: "thought", event });
|
|
116
|
+
}
|
|
117
|
+
else if (event.kind === "tool_call") {
|
|
118
|
+
const id = idOf(event);
|
|
119
|
+
const at = id === undefined ? undefined : open.get(id);
|
|
120
|
+
const held = toolAt(at);
|
|
121
|
+
if (held !== undefined && held.call === undefined) {
|
|
122
|
+
put(id, { ...held, call: event }, at);
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
put(id, { type: "tool", call: event, result: undefined, permission: undefined }, undefined);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
else if (event.kind === "tool_result") {
|
|
129
|
+
const id = idOf(event);
|
|
130
|
+
const at = id === undefined ? waiting("result") : open.get(id);
|
|
131
|
+
const held = toolAt(at);
|
|
132
|
+
if (held !== undefined && held.result === undefined) {
|
|
133
|
+
put(id, { ...held, result: event }, at);
|
|
134
|
+
if (id !== undefined) {
|
|
135
|
+
open.delete(id);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
items.push({ type: "tool", call: undefined, result: event, permission: undefined });
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
else if (event.kind === "permission") {
|
|
143
|
+
const id = idOf(event);
|
|
144
|
+
const at = id === undefined ? undefined : open.get(id);
|
|
145
|
+
const held = toolAt(at);
|
|
146
|
+
if (held !== undefined && held.permission === undefined && held.result === undefined) {
|
|
147
|
+
put(id, { ...held, permission: event }, at);
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
put(id, { type: "tool", call: undefined, result: undefined, permission: event }, undefined);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
items.push({ type: "note", event });
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return items;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Whether a turn is under way, and what the agent is at, read off a session's events alone:
|
|
161
|
+
* the record says where a turn ends (`turn: "completed"` on a status) and where the session
|
|
162
|
+
* does, so whatever follows the last of those is a turn that is not done. Nothing where the
|
|
163
|
+
* session has no event yet, or its last turn is over.
|
|
164
|
+
*/
|
|
165
|
+
export function workingOf(events) {
|
|
166
|
+
/** The calls that were answered, by the id the product gave them. */
|
|
167
|
+
const answered = new Set();
|
|
168
|
+
for (let at = events.length - 1; at >= 0; at -= 1) {
|
|
169
|
+
const event = events[at];
|
|
170
|
+
if (event === undefined || event.sealed !== null) {
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
if (event.kind === "status") {
|
|
174
|
+
if (event.data.turn === "completed" || typeof event.data.ended === "string") {
|
|
175
|
+
return undefined;
|
|
176
|
+
}
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
if (event.kind === "tool_result") {
|
|
180
|
+
const id = idOf(event);
|
|
181
|
+
if (id === undefined) {
|
|
182
|
+
return { at: "working" };
|
|
183
|
+
}
|
|
184
|
+
answered.add(id);
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
if (event.kind === "tool_call") {
|
|
188
|
+
const id = idOf(event);
|
|
189
|
+
return id !== undefined && answered.has(id)
|
|
190
|
+
? { at: "working" }
|
|
191
|
+
: { at: "tool", tool: word(event.data[TOOL]) };
|
|
192
|
+
}
|
|
193
|
+
if (event.kind === "permission") {
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
if (event.kind === "error") {
|
|
197
|
+
return undefined;
|
|
198
|
+
}
|
|
199
|
+
if (answered.size > 0) {
|
|
200
|
+
return { at: "working" };
|
|
201
|
+
}
|
|
202
|
+
return event.kind === "assistant" ? { at: "working" } : { at: "thinking" };
|
|
203
|
+
}
|
|
204
|
+
return undefined;
|
|
205
|
+
}
|
|
206
|
+
/** The number of the last signal a session's events say the agent took, or nothing where none says. */
|
|
207
|
+
export function takenOf(events) {
|
|
208
|
+
let most;
|
|
209
|
+
for (const event of events) {
|
|
210
|
+
const number = event.data.signal;
|
|
211
|
+
if ((event.kind === "person" || event.kind === "wake") &&
|
|
212
|
+
typeof number === "number" &&
|
|
213
|
+
(most === undefined || number > most)) {
|
|
214
|
+
most = number;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return most;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* The words supervisors sent that the agent has not taken: the tells, and the interrupts that
|
|
221
|
+
* carry words or files, after the last signal the record says it took, the oldest first. A
|
|
222
|
+
* signal is taken in order, so everything up to that one was.
|
|
223
|
+
*/
|
|
224
|
+
export function waitingOf(signals, taken) {
|
|
225
|
+
return signals
|
|
226
|
+
.filter((signal) => signal.number > taken &&
|
|
227
|
+
signal.source === "person" &&
|
|
228
|
+
(signal.kind === "tell" || signal.kind === "interrupt") &&
|
|
229
|
+
(signal.text.trim().length > 0 || signal.attachments.length > 0))
|
|
230
|
+
.slice()
|
|
231
|
+
.sort((a, b) => a.number - b.number);
|
|
232
|
+
}
|
|
233
|
+
/** Nothing read whole yet. */
|
|
234
|
+
export const NO_WHOLE = { of: undefined, texts: {} };
|
|
235
|
+
/**
|
|
236
|
+
* The whole text of an event, where it was read whole in the session shown. Every session
|
|
237
|
+
* numbers its events from one, so a text read in another session is another event's, and is
|
|
238
|
+
* never answered for this one.
|
|
239
|
+
*/
|
|
240
|
+
export function wholeOf(kept, of, n) {
|
|
241
|
+
return kept.of === of ? kept.texts[n] : undefined;
|
|
242
|
+
}
|
|
243
|
+
/** What is kept once a text was read whole in a session: with the others read in it, without those of another. */
|
|
244
|
+
export function withWhole(kept, of, n, text) {
|
|
245
|
+
return { of, texts: { ...(kept.of === of ? kept.texts : {}), [n]: text } };
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* A session's events with the ones before them put first: those up to where the events shown
|
|
249
|
+
* begin, and none that is shown already, so that a page read twice adds its events once.
|
|
250
|
+
*/
|
|
251
|
+
export function withEarlier(current, earlier, from) {
|
|
252
|
+
const shown = new Set(current.map((event) => event.n));
|
|
253
|
+
return [...earlier.filter((event) => event.n <= from && !shown.has(event.n)), ...current];
|
|
254
|
+
}
|
|
255
|
+
/** How far from its end a conversation may stand and still be followed, in pixels. */
|
|
256
|
+
export const FOLLOW_SLACK = 72;
|
|
257
|
+
/** Whether whoever reads a pane is at its end, give or take a line: there the pane follows what arrives. */
|
|
258
|
+
export function followsEnd(pane) {
|
|
259
|
+
return pane.scrollHeight - pane.scrollTop - pane.clientHeight <= FOLLOW_SLACK;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Whether a pane goes on following its end once it scrolled: at its end it does; away from it
|
|
263
|
+
* by the hand of whoever reads, a wheel, a finger, a key or the bar, it does not; and away from
|
|
264
|
+
* it by itself it goes on as it was. A pane moves by itself whenever the conversation changes
|
|
265
|
+
* how tall it is, taller by what arrives and shorter while it is read again, and it is told so
|
|
266
|
+
* after the fact, when the conversation may have changed once more: where the pane stands says
|
|
267
|
+
* nothing then of who moved it.
|
|
268
|
+
*/
|
|
269
|
+
export function followsAfter(following, byHand, pane) {
|
|
270
|
+
if (followsEnd(pane)) {
|
|
271
|
+
return true;
|
|
272
|
+
}
|
|
273
|
+
return byHand ? false : following;
|
|
274
|
+
}
|
|
275
|
+
/** How long after a wheel, a touch, a key or a press on the pane a scroll is taken for the reader's own, in milliseconds. */
|
|
276
|
+
export const HAND_MS = 1200;
|
|
277
|
+
/** The first line of a text, for a row that shows one: cut where it is long. */
|
|
278
|
+
function firstLine(text, most = 160) {
|
|
279
|
+
const line = text.split("\n").find((one) => one.trim().length > 0) ?? "";
|
|
280
|
+
return line.length > most ? `${line.slice(0, most)}…` : line;
|
|
281
|
+
}
|
|
282
|
+
/** A fact of an event as a word, or nothing where it is none. */
|
|
283
|
+
const word = (value) => typeof value === "string" && value.length > 0 ? value : undefined;
|
|
284
|
+
/**
|
|
285
|
+
* What the record names in a word of its own, a signal's kind, an answer, a fact's name, in the
|
|
286
|
+
* page's words: the pack's word for it, or the word as it came where the pack has none, as for
|
|
287
|
+
* what a newer runner writes. Only a word the pack itself holds counts: what a runner sends is
|
|
288
|
+
* data, and a name every object has is no word of the pack.
|
|
289
|
+
*/
|
|
290
|
+
export function wordOf(words, name) {
|
|
291
|
+
return Object.hasOwn(words, name) ? (words[name] ?? name) : name;
|
|
292
|
+
}
|
|
293
|
+
/** Whether two things of a session are the same events: a thing is made anew each time the events are read through. */
|
|
294
|
+
function sameItem(a, b) {
|
|
295
|
+
if (a.type === "tool" || b.type === "tool") {
|
|
296
|
+
return (a.type === "tool" &&
|
|
297
|
+
b.type === "tool" &&
|
|
298
|
+
a.call === b.call &&
|
|
299
|
+
a.result === b.result &&
|
|
300
|
+
a.permission === b.permission);
|
|
301
|
+
}
|
|
302
|
+
return a.type === b.type && a.event === b.event;
|
|
303
|
+
}
|
|
304
|
+
/** Whether two lists of a signal's files name the same files: the record is read again every few seconds. */
|
|
305
|
+
function sameFiles(a, b) {
|
|
306
|
+
if (a === b) {
|
|
307
|
+
return true;
|
|
308
|
+
}
|
|
309
|
+
return (a !== undefined &&
|
|
310
|
+
b !== undefined &&
|
|
311
|
+
a.length === b.length &&
|
|
312
|
+
a.every((file, index) => {
|
|
313
|
+
const other = b[index];
|
|
314
|
+
return (other !== undefined &&
|
|
315
|
+
file.id === other.id &&
|
|
316
|
+
file.name === other.name &&
|
|
317
|
+
file.size === other.size &&
|
|
318
|
+
file.contentType === other.contentType);
|
|
319
|
+
}));
|
|
320
|
+
}
|
|
321
|
+
/** Whether a line would be drawn the same: then it is not drawn again. */
|
|
322
|
+
export function sameLine(a, b) {
|
|
323
|
+
return (sameItem(a.one, b.one) &&
|
|
324
|
+
a.hands === b.hands &&
|
|
325
|
+
a.agent === b.agent &&
|
|
326
|
+
a.began === b.began &&
|
|
327
|
+
sameFiles(a.files, b.files) &&
|
|
328
|
+
a.whole === b.whole &&
|
|
329
|
+
a.wholeAnswer === b.wholeAnswer &&
|
|
330
|
+
a.reading === b.reading &&
|
|
331
|
+
a.today === b.today);
|
|
332
|
+
}
|
|
333
|
+
/** When the turn an event ends began, by the event's number: the first thing the agent was sent after the turn before. */
|
|
334
|
+
export function turnStarts(events) {
|
|
335
|
+
const starts = new Map();
|
|
336
|
+
let since;
|
|
337
|
+
for (const event of events) {
|
|
338
|
+
if (event.kind === "status" && event.data.turn === "completed") {
|
|
339
|
+
if (since !== undefined) {
|
|
340
|
+
starts.set(event.n, since);
|
|
341
|
+
}
|
|
342
|
+
since = undefined;
|
|
343
|
+
}
|
|
344
|
+
else if ((event.kind === "person" || event.kind === "wake") && since === undefined) {
|
|
345
|
+
since = event.at;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
return starts;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* What each line of a conversation is given, in order, with the number it is told apart by:
|
|
352
|
+
* its own events, and of everything the view holds only what the line itself shows, so that a
|
|
353
|
+
* line's props say the same until the line would be drawn otherwise.
|
|
354
|
+
*/
|
|
355
|
+
export function talkLinesOf(input) {
|
|
356
|
+
const { whole, of, reading } = input;
|
|
357
|
+
return input.items.flatMap((one) => {
|
|
358
|
+
const main = one.type === "tool" ? one.call : one.event;
|
|
359
|
+
const answer = one.type === "tool" ? one.result : undefined;
|
|
360
|
+
const first = one.type === "tool" ? (main ?? one.permission ?? answer) : one.event;
|
|
361
|
+
if (first === undefined) {
|
|
362
|
+
return [];
|
|
363
|
+
}
|
|
364
|
+
const signal = one.type === "told" ? one.event.data.signal : undefined;
|
|
365
|
+
return [
|
|
366
|
+
{
|
|
367
|
+
key: first.n,
|
|
368
|
+
one,
|
|
369
|
+
hands: input.hands,
|
|
370
|
+
// The account's picture stands beside what it said, and nowhere else: what a
|
|
371
|
+
// sub-agent said is a step, with no picture, and is not drawn again for one.
|
|
372
|
+
agent: one.type === "said" && subagentOf(one.event) === undefined ? input.agent : undefined,
|
|
373
|
+
began: one.type === "tool" ? undefined : input.began.get(one.event.n),
|
|
374
|
+
files: typeof signal === "number" ? input.signalFiles?.(signal) : undefined,
|
|
375
|
+
whole: main === undefined ? undefined : wholeOf(whole, of, main.n),
|
|
376
|
+
wholeAnswer: answer === undefined ? undefined : wholeOf(whole, of, answer.n),
|
|
377
|
+
reading: reading !== undefined && (reading === main?.n || reading === answer?.n)
|
|
378
|
+
? reading
|
|
379
|
+
: undefined,
|
|
380
|
+
today: input.today,
|
|
381
|
+
},
|
|
382
|
+
];
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* One line of a conversation. It is drawn again only when its own events, its own texts read
|
|
387
|
+
* whole or what it is handed changed: a session of thousands of events draws one line for an
|
|
388
|
+
* event that arrives, not all of them.
|
|
389
|
+
*/
|
|
390
|
+
const TalkLine = memo(function TalkLine(props) {
|
|
391
|
+
const all = useWords();
|
|
392
|
+
const words = all.agents.page.live;
|
|
393
|
+
const { one, hands } = props;
|
|
394
|
+
const kinds = words.kinds;
|
|
395
|
+
/** The words of an event, whole where they were read whole, with the way to read the rest. */
|
|
396
|
+
const text = (event, className, read) => {
|
|
397
|
+
const shown = read ?? event.text;
|
|
398
|
+
const readWhole = hands.readWhole;
|
|
399
|
+
return (_jsxs(_Fragment, { children: [shown.length > 0 && _jsx("pre", { className: className, children: shown }), event.whole !== null && read === undefined && (_jsxs("p", { className: "sc-talk-cut", children: [words.cutAt(formatBytes(event.whole)), " ", readWhole !== undefined && (_jsx(Button, { variant: "ghost", size: "sm", disabled: props.reading === event.n, onClick: () => readWhole(event.n), children: words.whole }))] }))] }));
|
|
400
|
+
};
|
|
401
|
+
const pictures = (event) => event === undefined || event.files.length === 0 ? null : (_jsx("ul", { className: "sc-talk-pictures", children: event.files.map((file) => (_jsx("li", { children: _jsx(PictureThumb, { picture: {
|
|
402
|
+
src: hands.fileHref(file.id),
|
|
403
|
+
alt: file.name,
|
|
404
|
+
name: file.name,
|
|
405
|
+
size: file.size,
|
|
406
|
+
}, onOpen: hands.openPicture }) }, file.id))) }));
|
|
407
|
+
const when = (event) => _jsx(Time, { iso: event.at, precision: "clock" });
|
|
408
|
+
if (one.type === "tool") {
|
|
409
|
+
const first = one.call ?? one.permission ?? one.result;
|
|
410
|
+
if (first === undefined) {
|
|
411
|
+
return null;
|
|
412
|
+
}
|
|
413
|
+
const name = word(one.call?.data[TOOL]) ?? word(one.permission?.data[TOOL]);
|
|
414
|
+
const failed = one.result?.data.error === true;
|
|
415
|
+
const answer = word(one.permission?.data.answer);
|
|
416
|
+
const refused = answer !== undefined && answer !== "allowed";
|
|
417
|
+
const line = firstLine(one.call?.text ?? one.permission?.text ?? one.result?.text ?? "");
|
|
418
|
+
// Whose the call is, where a sub-agent made it: read off the line's own events, as
|
|
419
|
+
// everything a line shows is, so that it is drawn again only when they are others.
|
|
420
|
+
const sub = subagentOf(first);
|
|
421
|
+
return (_jsxs("li", { className: cx("sc-talk-item", "sc-talk-step", "sc-talk-tool", (failed || refused) && "sc-talk-tool-failed"), "data-n": first.n, children: [_jsxs("details", { className: "sc-talk-tool-fold", children: [_jsxs("summary", { className: "sc-talk-tool-head", children: [_jsx("code", { className: "sc-talk-tool-name", children: name ?? kinds.tool_call }), _jsx("span", { className: "sc-talk-tool-line", children: line }), sub !== undefined && _jsx(Badge, { children: words.subagent(sub) }), failed && _jsx(Badge, { tone: "danger", children: words.toolFailed }), refused && _jsx(Badge, { tone: "warning", children: words.toolRefused }), one.result === undefined && one.call !== undefined && !refused && (_jsx("span", { className: "sc-muted", children: words.toolRunning })), when(first)] }), _jsxs("div", { className: "sc-talk-tool-body", children: [one.permission !== undefined && (_jsxs("p", { className: "sc-talk-note-line", children: [kinds.permission, answer === undefined ? "" : ` · ${wordOf(words.answers, answer)}`, one.permission.text.length > 0 && ` · ${one.permission.text}`] })), one.call !== undefined && text(one.call, "sc-talk-code", props.whole), one.result !== undefined &&
|
|
422
|
+
text(one.result, "sc-talk-code sc-talk-code-answer", props.wholeAnswer)] })] }), pictures(one.result)] }));
|
|
423
|
+
}
|
|
424
|
+
const { event } = one;
|
|
425
|
+
if (event.sealed !== null) {
|
|
426
|
+
return (_jsxs("li", { className: "sc-talk-item sc-talk-note", "data-n": event.n, children: [_jsx("span", { className: "sc-talk-note-line", children: words.sealed(event.sealed.by === null ? "?" : (event.sealed.by.name ?? event.sealed.by.login), event.sealed.reason) }), when(event)] }));
|
|
427
|
+
}
|
|
428
|
+
if (one.type === "told") {
|
|
429
|
+
const number = typeof event.data.signal === "number" ? event.data.signal : undefined;
|
|
430
|
+
const kind = word(event.data.kind);
|
|
431
|
+
const through = word(event.data.agent);
|
|
432
|
+
const unseen = word(event.data.unseen);
|
|
433
|
+
const others = word(event.data.files);
|
|
434
|
+
const listed = number === undefined
|
|
435
|
+
? undefined
|
|
436
|
+
: props.files?.filter((file) => !isPicture(file.contentType));
|
|
437
|
+
const who = word(event.data.by) ?? words.kinds.person;
|
|
438
|
+
// An interrupt with no words of its own stopped the turn so that what waited is read: a
|
|
439
|
+
// note of who did, and no message.
|
|
440
|
+
if (kind === "interrupt" &&
|
|
441
|
+
event.text.length === 0 &&
|
|
442
|
+
event.files.length === 0 &&
|
|
443
|
+
others === undefined) {
|
|
444
|
+
return (_jsx("li", { className: "sc-talk-item sc-talk-note", "data-n": event.n, children: _jsxs("span", { className: "sc-talk-note-line", children: [words.interrupted(who), when(event)] }) }));
|
|
445
|
+
}
|
|
446
|
+
const signalFileHref = hands.signalFileHref;
|
|
447
|
+
return (_jsxs("li", { className: "sc-talk-item sc-talk-told", "data-n": event.n, children: [_jsxs("div", { className: "sc-talk-bubble", children: [text(event, "sc-talk-text", props.whole), pictures(event), listed !== undefined && listed.length > 0 ? (_jsx("ul", { className: "sc-chosen-files", "aria-label": words.files, children: listed.map((file) => (_jsxs("li", { className: "sc-chosen-file", children: [signalFileHref === undefined || number === undefined ? (_jsx("span", { children: file.name })) : (_jsx("a", { href: signalFileHref(number, file.id), download: file.name, children: file.name })), " ", _jsx("span", { className: "sc-muted", children: formatBytes(file.size) })] }, file.id))) })) : (others !== undefined && (_jsxs("p", { className: "sc-talk-note-line", children: [words.files, ": ", others] }))), unseen !== undefined && (_jsx("p", { className: "sc-talk-note-line sc-talk-unseen", children: words.unseen(unseen) }))] }), _jsxs("div", { className: "sc-talk-meta", children: [_jsx("span", { className: "sc-talk-who", children: who }), through !== undefined && _jsx("span", { children: words.through(through) }), kind !== undefined && kind !== "tell" && (_jsx(Badge, { children: wordOf(words.signalKinds, kind) })), when(event)] }), event.data.unread === true && (_jsx("p", { className: "sc-talk-note-line sc-talk-unread", children: words.unread }))] }));
|
|
448
|
+
}
|
|
449
|
+
if (one.type === "said") {
|
|
450
|
+
const sub = subagentOf(event);
|
|
451
|
+
// What a sub-agent said is a step of the work, and not the agent's word to whoever reads:
|
|
452
|
+
// folded as a thought is, under the sub-agent's name.
|
|
453
|
+
if (sub !== undefined) {
|
|
454
|
+
return (_jsx("li", { className: "sc-talk-item sc-talk-step sc-talk-thought", "data-n": event.n, children: _jsxs("details", { className: "sc-talk-tool-fold", children: [_jsxs("summary", { className: "sc-talk-tool-head", children: [_jsx("span", { className: "sc-talk-kind", children: kinds.assistant }), _jsx("span", { className: "sc-talk-tool-line", children: firstLine(event.text) }), _jsx(Badge, { children: words.subagent(sub) }), when(event)] }), _jsxs("div", { className: "sc-talk-tool-body", children: [text(event, "sc-talk-text", props.whole), pictures(event)] })] }) }));
|
|
455
|
+
}
|
|
456
|
+
return (_jsxs("li", { className: "sc-talk-item sc-talk-said", "data-n": event.n, children: [props.agent !== undefined && _jsx(Avatar, { person: props.agent, size: "sm" }), _jsxs("div", { className: "sc-talk-prose", children: [text(event, "sc-talk-text", props.whole), pictures(event)] }), when(event)] }));
|
|
457
|
+
}
|
|
458
|
+
if (one.type === "thought") {
|
|
459
|
+
const sub = subagentOf(event);
|
|
460
|
+
return (_jsx("li", { className: "sc-talk-item sc-talk-step sc-talk-thought", "data-n": event.n, children: _jsxs("details", { className: "sc-talk-tool-fold", children: [_jsxs("summary", { className: "sc-talk-tool-head", children: [_jsx("span", { className: "sc-talk-kind", children: kinds.thinking }), _jsx("span", { className: "sc-talk-tool-line", children: firstLine(event.text) }), sub !== undefined && _jsx(Badge, { children: words.subagent(sub) }), when(event)] }), _jsx("div", { className: "sc-talk-tool-body", children: text(event, "sc-talk-text", props.whole) })] }) }));
|
|
461
|
+
}
|
|
462
|
+
// Where a turn ended: a line, with how long the agent was at it where the record says when it began.
|
|
463
|
+
if (event.kind === "status" && event.data.turn === "completed") {
|
|
464
|
+
const from = props.began;
|
|
465
|
+
const seconds = from === undefined
|
|
466
|
+
? undefined
|
|
467
|
+
: Math.max(0, Math.round((Date.parse(event.at) - Date.parse(from)) / 1000));
|
|
468
|
+
return (_jsx("li", { className: "sc-talk-item sc-talk-turn", "data-n": event.n, children: _jsxs("span", { className: "sc-talk-note-line", children: [words.turnDone(Number.isFinite(seconds) ? seconds : undefined), when(event)] }) }));
|
|
469
|
+
}
|
|
470
|
+
// A wake, a status, an error, and whatever a newer runner calls otherwise: a note between.
|
|
471
|
+
// What the note's own words say already, how a session ended, is not said twice as a fact.
|
|
472
|
+
// The id of the call that started a sub-agent is for joining, and says nothing to a reader.
|
|
473
|
+
const facts = Object.entries(event.data).filter(([name, fact]) => fact !== null &&
|
|
474
|
+
name !== "signal" &&
|
|
475
|
+
name !== "kind" &&
|
|
476
|
+
name !== "ended" &&
|
|
477
|
+
name !== "parent");
|
|
478
|
+
const lines = event.text.split("\n").filter((line) => line.trim().length > 0);
|
|
479
|
+
return (_jsxs("li", { className: cx("sc-talk-item", "sc-talk-note", event.kind === "error" && "sc-talk-note-error"), "data-n": event.n, children: [_jsxs("span", { className: "sc-talk-note-line", children: [_jsx("span", { className: "sc-talk-kind", children: kinds[event.kind] ?? event.kind }), facts.map(([name, fact]) => (_jsxs("span", { className: "sc-talk-fact", children: [wordOf(words.facts, name), " ", String(fact)] }, name))), lines.length === 1 && _jsx("span", { children: lines[0] }), when(event)] }), lines.length > 1 && text(event, "sc-talk-text sc-talk-text-note", props.whole), pictures(event)] }));
|
|
480
|
+
}, sameLine);
|
|
481
|
+
/**
|
|
482
|
+
* A session as a conversation: what the agent was told at the right, as whoever said it wrote
|
|
483
|
+
* it, with the files that came with it; what the agent said at the left, beside its picture; its
|
|
484
|
+
* thoughts folded; a tool's call and what it answered as one row that opens, the steps of a turn
|
|
485
|
+
* close together; a wake, a status and an error as notes between, and a line where a turn
|
|
486
|
+
* ended, with how long it took. A picture opens large over the page. Everything an agent's
|
|
487
|
+
* product printed is text, never markup. Each line is drawn once and again only when it
|
|
488
|
+
* changed, however long the session is.
|
|
489
|
+
*/
|
|
490
|
+
export function TranscriptView(props) {
|
|
491
|
+
const words = useWords().agents.page.live;
|
|
492
|
+
const shown = usePicture();
|
|
493
|
+
// What was read whole belongs to the session it was read in: the events of another carry the
|
|
494
|
+
// same numbers, and a view that goes on to show them must show none of this.
|
|
495
|
+
const [whole, setWhole] = useState(NO_WHOLE);
|
|
496
|
+
const [reading, setReading] = useState(undefined);
|
|
497
|
+
const of = props.of;
|
|
498
|
+
const showing = useRef(of);
|
|
499
|
+
showing.current = of;
|
|
500
|
+
// What the view is given may be made anew by whoever renders it; the lines are handed the
|
|
501
|
+
// same hands each time, which reach for what was given last.
|
|
502
|
+
const given = useRef(props);
|
|
503
|
+
given.current = props;
|
|
504
|
+
const readWhole = useCallback((n) => {
|
|
505
|
+
const load = given.current.onReadWhole;
|
|
506
|
+
if (load === undefined) {
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
setReading({ of, n });
|
|
510
|
+
void load(n)
|
|
511
|
+
.then((text) => {
|
|
512
|
+
// An answer that arrives once another session is shown is that session's no more.
|
|
513
|
+
if (showing.current === of) {
|
|
514
|
+
setWhole((current) => withWhole(current, of, n, text));
|
|
515
|
+
}
|
|
516
|
+
})
|
|
517
|
+
.catch(() => undefined)
|
|
518
|
+
.finally(() => setReading((current) => current !== undefined && current.of === of && current.n === n ? undefined : current));
|
|
519
|
+
}, [of]);
|
|
520
|
+
const reads = props.onReadWhole !== undefined;
|
|
521
|
+
const hasSignalFiles = props.signalFileHref !== undefined;
|
|
522
|
+
const openPicture = shown.open;
|
|
523
|
+
const hands = useMemo(() => ({
|
|
524
|
+
fileHref: (fileId) => given.current.fileHref(fileId),
|
|
525
|
+
signalFileHref: hasSignalFiles
|
|
526
|
+
? (number, fileId) => given.current.signalFileHref?.(number, fileId) ?? ""
|
|
527
|
+
: undefined,
|
|
528
|
+
readWhole: reads ? readWhole : undefined,
|
|
529
|
+
openPicture,
|
|
530
|
+
}), [hasSignalFiles, reads, readWhole, openPicture]);
|
|
531
|
+
const events = props.events;
|
|
532
|
+
const items = useMemo(() => talkOf(events), [events]);
|
|
533
|
+
const began = useMemo(() => turnStarts(events), [events]);
|
|
534
|
+
if (events.length === 0) {
|
|
535
|
+
return (_jsxs(_Fragment, { children: [props.empty ?? null, props.foot !== undefined && props.foot !== null && (_jsx("ol", { className: "sc-talk", "aria-label": words.transcript, children: props.foot }))] }));
|
|
536
|
+
}
|
|
537
|
+
const lines = talkLinesOf({
|
|
538
|
+
items,
|
|
539
|
+
hands,
|
|
540
|
+
agent: props.agent,
|
|
541
|
+
began,
|
|
542
|
+
signalFiles: props.signalFiles,
|
|
543
|
+
whole,
|
|
544
|
+
of,
|
|
545
|
+
reading: reading !== undefined && reading.of === of ? reading.n : undefined,
|
|
546
|
+
today: today(),
|
|
547
|
+
});
|
|
548
|
+
return (_jsxs(_Fragment, { children: [_jsxs("ol", { className: "sc-talk", "aria-label": words.transcript, children: [lines.map(({ key, ...line }) => (_jsx(TalkLine, { ...line }, key))), props.foot] }), _jsx(Lightbox, { picture: shown.shown, onClose: shown.close })] }));
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* What supervisors said and the agent has not taken yet, at the foot of the conversation: each
|
|
552
|
+
* as it will stand there, quieter, with when it is read; and under the last, while a turn is
|
|
553
|
+
* under way, the way to have them read now. Rows of the conversation's list.
|
|
554
|
+
*/
|
|
555
|
+
export function TalkWaiting(props) {
|
|
556
|
+
const words = useWords().agents.page.live;
|
|
557
|
+
const waits = words.waiting;
|
|
558
|
+
if (props.signals.length === 0) {
|
|
559
|
+
return null;
|
|
560
|
+
}
|
|
561
|
+
const stops = props.onInterrupt !== undefined && (props.why === "call" || props.why === "turn");
|
|
562
|
+
return (_jsx(_Fragment, { children: props.signals.map((signal, index) => {
|
|
563
|
+
const last = index === props.signals.length - 1;
|
|
564
|
+
const pictures = signal.attachments.filter((file) => isPicture(file.contentType));
|
|
565
|
+
const others = signal.attachments.filter((file) => !isPicture(file.contentType));
|
|
566
|
+
return (_jsxs("li", { className: "sc-talk-item sc-talk-told sc-talk-waiting", "data-signal": signal.number, children: [_jsxs("div", { className: "sc-talk-bubble", children: [signal.text.length > 0 && _jsx("pre", { className: "sc-talk-text", children: signal.text }), pictures.length > 0 && props.fileHref !== undefined && (_jsx("ul", { className: "sc-talk-pictures", children: pictures.map((file) => (_jsx("li", { children: _jsx("img", { src: props.fileHref?.(signal.number, file.id), alt: file.name, title: `${file.name} · ${formatBytes(file.size)}`, loading: "lazy" }) }, file.id))) })), others.length > 0 && (_jsx("ul", { className: "sc-chosen-files", "aria-label": words.files, children: others.map((file) => (_jsxs("li", { className: "sc-chosen-file", children: [_jsx("span", { children: file.name }), " ", _jsx("span", { className: "sc-muted", children: formatBytes(file.size) })] }, file.id))) }))] }), _jsxs("div", { className: "sc-talk-meta", children: [_jsx("span", { className: "sc-talk-who", children: signal.by === null ? words.kinds.person : personName(signal.by) }), _jsx(Time, { iso: signal.at, precision: "clock" })] }), last && (_jsxs("p", { className: "sc-talk-wait", role: "status", children: [_jsx("span", { children: waits[props.why] }), stops && (_jsx(Button, { size: "sm", disabled: props.busy === true, title: waits.interruptHint, onClick: props.onInterrupt, children: waits.interrupt }))] }))] }, signal.number));
|
|
567
|
+
}) }));
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* The sign that the agent is at work while a turn is under way: its picture, three dots, and
|
|
571
|
+
* what it is at, a thought, a tool by its name, or the work between. A row of the
|
|
572
|
+
* conversation's list; nothing where no turn is under way.
|
|
573
|
+
*/
|
|
574
|
+
export function TalkWorking(props) {
|
|
575
|
+
const words = useWords().agents.page.live.working;
|
|
576
|
+
const { working } = props;
|
|
577
|
+
if (working === undefined) {
|
|
578
|
+
return null;
|
|
579
|
+
}
|
|
580
|
+
return (_jsxs("li", { className: "sc-talk-item sc-talk-working", role: "status", children: [props.agent !== undefined && _jsx(Avatar, { person: props.agent, size: "sm" }), _jsxs("span", { className: "sc-talk-dots", "aria-hidden": "true", children: [_jsx("span", {}), _jsx("span", {}), _jsx("span", {})] }), _jsx("span", { children: working.at === "tool"
|
|
581
|
+
? working.tool === undefined
|
|
582
|
+
? words.working
|
|
583
|
+
: words.tool(working.tool)
|
|
584
|
+
: words[working.at] })] }));
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* A conversation in a pane of its own, as a chat is read: it scrolls within the pane, with the
|
|
588
|
+
* box to speak in at its foot. The pane follows the conversation's end while whoever reads is
|
|
589
|
+
* there, leaves them where they are once they scrolled up to read, and then offers the way
|
|
590
|
+
* back to the latest, saying when something arrived meanwhile.
|
|
591
|
+
*/
|
|
592
|
+
export function ChatPane(props) {
|
|
593
|
+
const words = useWords().agents.page.live;
|
|
594
|
+
const scroller = useRef(null);
|
|
595
|
+
const content = useRef(null);
|
|
596
|
+
const whole = useRef(null);
|
|
597
|
+
/** Whether the pane follows its end: true until whoever reads scrolls away from it. */
|
|
598
|
+
const follows = useRef(true);
|
|
599
|
+
/** Until when a scroll is taken for the reader's own: set by what a hand does to the pane. */
|
|
600
|
+
const hand = useRef(0);
|
|
601
|
+
const [away, setAway] = useState(false);
|
|
602
|
+
const [fresh, setFresh] = useState(false);
|
|
603
|
+
const toEnd = () => {
|
|
604
|
+
const pane = scroller.current;
|
|
605
|
+
if (pane !== null) {
|
|
606
|
+
follows.current = true;
|
|
607
|
+
pane.scrollTop = pane.scrollHeight;
|
|
608
|
+
setAway(false);
|
|
609
|
+
setFresh(false);
|
|
610
|
+
}
|
|
611
|
+
};
|
|
612
|
+
// The pane is as tall as the window leaves under what stands over it on the page, so that
|
|
613
|
+
// the box to speak in is in sight without scrolling: where it begins is measured, here and
|
|
614
|
+
// whenever the page is drawn again or the window changes, and the stylesheet takes it from there.
|
|
615
|
+
useEffect(() => {
|
|
616
|
+
const measure = () => {
|
|
617
|
+
const pane = whole.current;
|
|
618
|
+
if (pane !== null) {
|
|
619
|
+
const top = Math.round(pane.getBoundingClientRect().top + window.scrollY);
|
|
620
|
+
pane.style.setProperty("--sc-chat-top", `${top}px`);
|
|
621
|
+
}
|
|
622
|
+
};
|
|
623
|
+
measure();
|
|
624
|
+
window.addEventListener("resize", measure);
|
|
625
|
+
return () => window.removeEventListener("resize", measure);
|
|
626
|
+
});
|
|
627
|
+
useEffect(() => {
|
|
628
|
+
const pane = scroller.current;
|
|
629
|
+
const inner = content.current;
|
|
630
|
+
if (pane === null || inner === null) {
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
633
|
+
const now = () => (typeof performance === "undefined" ? Date.now() : performance.now());
|
|
634
|
+
const onHand = () => {
|
|
635
|
+
hand.current = now() + HAND_MS;
|
|
636
|
+
};
|
|
637
|
+
const onScroll = () => {
|
|
638
|
+
const byHand = now() < hand.current;
|
|
639
|
+
const goes = followsAfter(follows.current, byHand, pane);
|
|
640
|
+
follows.current = goes;
|
|
641
|
+
setAway(!goes);
|
|
642
|
+
if (goes) {
|
|
643
|
+
setFresh(false);
|
|
644
|
+
// Moved by itself while it follows: the conversation changed under it, so back to its end.
|
|
645
|
+
if (!byHand && !followsEnd(pane)) {
|
|
646
|
+
pane.scrollTop = pane.scrollHeight;
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
else if (byHand) {
|
|
650
|
+
// A finger let go goes on scrolling for a while: each step of it is still the reader's.
|
|
651
|
+
hand.current = now() + HAND_MS;
|
|
652
|
+
}
|
|
653
|
+
};
|
|
654
|
+
pane.addEventListener("scroll", onScroll, { passive: true });
|
|
655
|
+
const hands = ["wheel", "touchstart", "touchmove", "pointerdown", "keydown"];
|
|
656
|
+
for (const name of hands) {
|
|
657
|
+
pane.addEventListener(name, onHand, { passive: true });
|
|
658
|
+
}
|
|
659
|
+
// What arrives, and a picture that loads late, change how tall the conversation is: the
|
|
660
|
+
// pane goes with it while it is followed, and says that there is more where it is not.
|
|
661
|
+
const observer = typeof ResizeObserver === "undefined"
|
|
662
|
+
? undefined
|
|
663
|
+
: new ResizeObserver(() => {
|
|
664
|
+
if (follows.current) {
|
|
665
|
+
pane.scrollTop = pane.scrollHeight;
|
|
666
|
+
}
|
|
667
|
+
else {
|
|
668
|
+
setFresh(true);
|
|
669
|
+
}
|
|
670
|
+
});
|
|
671
|
+
observer?.observe(inner);
|
|
672
|
+
pane.scrollTop = pane.scrollHeight;
|
|
673
|
+
return () => {
|
|
674
|
+
pane.removeEventListener("scroll", onScroll);
|
|
675
|
+
for (const name of hands) {
|
|
676
|
+
pane.removeEventListener(name, onHand);
|
|
677
|
+
}
|
|
678
|
+
observer?.disconnect();
|
|
679
|
+
};
|
|
680
|
+
}, []);
|
|
681
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: `said` is the trigger
|
|
682
|
+
useEffect(() => {
|
|
683
|
+
if (props.said !== undefined && props.said > 0) {
|
|
684
|
+
toEnd();
|
|
685
|
+
}
|
|
686
|
+
}, [props.said]);
|
|
687
|
+
return (_jsxs("section", { className: "sc-panel sc-chat", "aria-label": props.label, ref: whole, children: [_jsx("div", { className: "sc-chat-scroll", ref: scroller, children: _jsx("div", { className: "sc-chat-content", ref: content, children: props.children }) }), away && (_jsx("div", { className: "sc-chat-latest", children: _jsx(Button, { size: "sm", onClick: toEnd, children: fresh ? words.latestNew : words.latest }) })), props.composer !== undefined && props.composer !== null && (_jsx("div", { className: "sc-chat-foot", children: props.composer }))] }));
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* The files of a tell with the ones just chosen added: a file that is there already is not
|
|
691
|
+
* added again, so that nothing is sent twice.
|
|
692
|
+
*/
|
|
693
|
+
export function withChosen(current, chosen) {
|
|
694
|
+
const same = (one, other) => one.name === other.name && one.size === other.size && one.lastModified === other.lastModified;
|
|
695
|
+
const added = [];
|
|
696
|
+
for (const file of chosen) {
|
|
697
|
+
if (![...current, ...added].some((one) => same(one, file))) {
|
|
698
|
+
added.push(file);
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
return [...current, ...added];
|
|
702
|
+
}
|
|
703
|
+
/** The files of a tell without the one at a place: what the way out of its chip leaves. */
|
|
704
|
+
export function withoutChosen(current, at) {
|
|
705
|
+
return current.filter((_, index) => index !== at);
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Whether a key pressed in the box tells what is written: Enter alone, as the boxes of agent
|
|
709
|
+
* products have it, with Shift for a new line; and never while a word is still being composed,
|
|
710
|
+
* as Korean is, where Enter ends the composing and not the message.
|
|
711
|
+
*/
|
|
712
|
+
export function tellsWith(event) {
|
|
713
|
+
// 229 is what a browser says of a key pressed while composing, where it says nothing else.
|
|
714
|
+
return (event.key === "Enter" &&
|
|
715
|
+
event.shiftKey !== true &&
|
|
716
|
+
event.isComposing !== true &&
|
|
717
|
+
event.keyCode !== 229);
|
|
718
|
+
}
|
|
719
|
+
/** A picture pasted from a clipboard is called `image.png` by every browser: a name of its own, by the moment. */
|
|
720
|
+
export function pastedName(file, at) {
|
|
721
|
+
if (file.name !== "image.png" && file.name.length > 0) {
|
|
722
|
+
return file.name;
|
|
723
|
+
}
|
|
724
|
+
const two = (value) => String(value).padStart(2, "0");
|
|
725
|
+
const stamp = `${at.getFullYear()}${two(at.getMonth() + 1)}${two(at.getDate())}-${two(at.getHours())}${two(at.getMinutes())}${two(at.getSeconds())}`;
|
|
726
|
+
const ending = file.type === "image/jpeg" ? "jpg" : (file.type.split("/")[1] ?? "png");
|
|
727
|
+
return `pasted-${stamp}.${ending}`;
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* Whether what was told was taken, by what whoever tells answered: `false`, or a request that
|
|
731
|
+
* failed, says it was not, and the box keeps what was written; anything else, nothing among it,
|
|
732
|
+
* says it was, so that a handler that answers nothing is taken at its word.
|
|
733
|
+
*/
|
|
734
|
+
export async function takenBy(answer) {
|
|
735
|
+
try {
|
|
736
|
+
return (await answer) !== false;
|
|
737
|
+
}
|
|
738
|
+
catch {
|
|
739
|
+
return false;
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* What stands in the box once what was sent from it was taken: nothing, or what was written
|
|
744
|
+
* after it while the console was asked; words changed meanwhile are another message, and stay.
|
|
745
|
+
*/
|
|
746
|
+
export function afterTold(current, sent) {
|
|
747
|
+
return current.startsWith(sent) ? current.slice(sent.length).trimStart() : current;
|
|
748
|
+
}
|
|
749
|
+
/** How tall the box grows with what is written in it, before it scrolls. */
|
|
750
|
+
const MAX_BOX_PIXELS = 280;
|
|
751
|
+
/** A picture is shown small beside its name where it is no larger than this: a larger one is named alone. */
|
|
752
|
+
const MAX_PREVIEW_BYTES = 4 * 1024 * 1024;
|
|
753
|
+
/**
|
|
754
|
+
* What a supervisor says to the agent, as the box of a chat is: one box with the words, the
|
|
755
|
+
* files chosen, pasted or dropped on it above them, a picture shown small and any other file by
|
|
756
|
+
* its name, each taken out again from its chip, and under the words the way to choose files and
|
|
757
|
+
* the way to send. Enter tells; Shift with Enter is a new line. What is told stands in the
|
|
758
|
+
* conversation at once, as waiting until the agent takes it, and the way to have it read now is
|
|
759
|
+
* there, beside it: the box has none. What changes how the agent stands, a stop, a restart, a
|
|
760
|
+
* reset, is not said here: `AgentControls` has it.
|
|
761
|
+
*/
|
|
762
|
+
export function SignalComposer(props) {
|
|
763
|
+
const words = useWords().agents.page.tell;
|
|
764
|
+
const [text, setText] = useState("");
|
|
765
|
+
const [files, setFiles] = useState([]);
|
|
766
|
+
const [previews, setPreviews] = useState({});
|
|
767
|
+
const [over, setOver] = useState(false);
|
|
768
|
+
/** Whether a tell is on its way: nothing more is sent until the console answered. */
|
|
769
|
+
const [sending, setSending] = useState(false);
|
|
770
|
+
const box = useRef(null);
|
|
771
|
+
// The box grows with what is written in it, lines that wrap among them, up to a bound.
|
|
772
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: `text` is the trigger
|
|
773
|
+
useEffect(() => {
|
|
774
|
+
const area = box.current;
|
|
775
|
+
if (area !== null) {
|
|
776
|
+
area.style.height = "auto";
|
|
777
|
+
area.style.height = `${Math.min(area.scrollHeight + 2, MAX_BOX_PIXELS)}px`;
|
|
778
|
+
}
|
|
779
|
+
}, [text]);
|
|
780
|
+
const said = text.trim();
|
|
781
|
+
const busy = props.busy === true;
|
|
782
|
+
const tooMany = files.length > MAX_SIGNAL_ATTACHMENTS;
|
|
783
|
+
const tooLarge = files.reduce((total, file) => total + file.size, 0) > MAX_FILE_BYTES;
|
|
784
|
+
const keyOf = (file) => `${file.name}-${file.size}-${file.lastModified}`;
|
|
785
|
+
const add = (chosen) => {
|
|
786
|
+
if (chosen.length === 0) {
|
|
787
|
+
return;
|
|
788
|
+
}
|
|
789
|
+
setFiles((current) => withChosen(current, chosen));
|
|
790
|
+
// A picture is read here to be shown small: the page's policy takes a picture as data.
|
|
791
|
+
for (const file of chosen) {
|
|
792
|
+
if (isPicture(file.type) &&
|
|
793
|
+
file.size <= MAX_PREVIEW_BYTES &&
|
|
794
|
+
typeof FileReader !== "undefined") {
|
|
795
|
+
const reader = new FileReader();
|
|
796
|
+
reader.onload = () => {
|
|
797
|
+
const read = reader.result;
|
|
798
|
+
if (typeof read === "string") {
|
|
799
|
+
setPreviews((current) => ({ ...current, [keyOf(file)]: read }));
|
|
800
|
+
}
|
|
801
|
+
};
|
|
802
|
+
reader.readAsDataURL(file);
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
};
|
|
806
|
+
const send = () => {
|
|
807
|
+
const written = text;
|
|
808
|
+
const sent = files;
|
|
809
|
+
const answer = props.onSend(said, sent.map((file) => ({ name: file.name, bytes: file, contentType: file.type })));
|
|
810
|
+
setSending(true);
|
|
811
|
+
// What was written stays until the console took it: a refusal, or a request that failed,
|
|
812
|
+
// leaves the words and the files where they are, with what went wrong said under them.
|
|
813
|
+
void takenBy(answer).then((taken) => {
|
|
814
|
+
setSending(false);
|
|
815
|
+
if (!taken) {
|
|
816
|
+
return;
|
|
817
|
+
}
|
|
818
|
+
setText((current) => afterTold(current, written));
|
|
819
|
+
setFiles((current) => current.filter((file) => !sent.includes(file)));
|
|
820
|
+
setPreviews((current) => Object.fromEntries(Object.entries(current).filter(([key]) => !sent.some((file) => keyOf(file) === key))));
|
|
821
|
+
});
|
|
822
|
+
};
|
|
823
|
+
const ready = said.length > 0 && !tooMany && !tooLarge && !busy && !sending;
|
|
824
|
+
const submit = (event) => {
|
|
825
|
+
event.preventDefault();
|
|
826
|
+
if (ready) {
|
|
827
|
+
send();
|
|
828
|
+
}
|
|
829
|
+
};
|
|
830
|
+
const stopped = props.state === "stopped";
|
|
831
|
+
const unseen = props.images === false && files.some((file) => isPicture(file.type));
|
|
832
|
+
return (_jsxs("form", { className: cx("sc-signal-composer", over && "sc-signal-composer-over"), "aria-label": words.aria, onSubmit: submit, onDragOver: (event) => {
|
|
833
|
+
if (event.dataTransfer.types.includes("Files")) {
|
|
834
|
+
event.preventDefault();
|
|
835
|
+
setOver(true);
|
|
836
|
+
}
|
|
837
|
+
}, onDragLeave: () => setOver(false), onDrop: (event) => {
|
|
838
|
+
if (event.dataTransfer.files.length > 0) {
|
|
839
|
+
event.preventDefault();
|
|
840
|
+
add([...event.dataTransfer.files]);
|
|
841
|
+
}
|
|
842
|
+
setOver(false);
|
|
843
|
+
}, children: [_jsxs("div", { className: "sc-signal-box", children: [files.length > 0 && (_jsx("ul", { className: "sc-chosen-files sc-signal-files", "aria-label": words.files, children: files.map((file, index) => {
|
|
844
|
+
const preview = previews[keyOf(file)];
|
|
845
|
+
return (_jsxs("li", { className: "sc-chosen-file", children: [preview !== undefined && (_jsx("img", { className: "sc-signal-thumb", src: preview, alt: "" })), _jsx("span", { className: "sc-signal-file-name", children: file.name }), " ", _jsx("span", { className: "sc-muted", children: formatBytes(file.size) }), " ", _jsx(Button, { variant: "ghost", size: "sm", "aria-label": words.removeFile(file.name), onClick: () => setFiles((current) => withoutChosen(current, index)), children: "\u00D7" })] }, keyOf(file)));
|
|
846
|
+
}) })), _jsx("textarea", { ref: box, className: "sc-signal-text", "aria-label": words.placeholder, placeholder: stopped ? words.placeholderStopped : words.placeholder, value: text, maxLength: MAX_SIGNAL_LENGTH, rows: 1, onChange: (event) => setText(event.target.value), onPaste: (event) => {
|
|
847
|
+
const pasted = [...event.clipboardData.files];
|
|
848
|
+
if (pasted.length > 0) {
|
|
849
|
+
event.preventDefault();
|
|
850
|
+
const now = new Date();
|
|
851
|
+
add(pasted.map((file) => new File([file], pastedName(file, now), { type: file.type })));
|
|
852
|
+
}
|
|
853
|
+
}, onKeyDown: (event) => {
|
|
854
|
+
// On a screen that is touched, Enter is the keyboard's new line: the button tells.
|
|
855
|
+
if (typeof window !== "undefined" &&
|
|
856
|
+
window.matchMedia?.("(pointer: coarse)").matches === true) {
|
|
857
|
+
return;
|
|
858
|
+
}
|
|
859
|
+
if (tellsWith({
|
|
860
|
+
key: event.key,
|
|
861
|
+
shiftKey: event.shiftKey,
|
|
862
|
+
isComposing: event.nativeEvent.isComposing,
|
|
863
|
+
keyCode: event.keyCode,
|
|
864
|
+
})) {
|
|
865
|
+
event.preventDefault();
|
|
866
|
+
if (ready) {
|
|
867
|
+
send();
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
} }), _jsxs("div", { className: "sc-signal-row", children: [_jsxs("label", { className: "sc-button sc-button-ghost sc-button-sm sc-file-choice", children: [words.attach, _jsx("input", { className: "sc-file-input", type: "file", multiple: true, onChange: (event) => {
|
|
871
|
+
add([...(event.target.files ?? [])]);
|
|
872
|
+
// The box is emptied, so that a file taken out can be chosen again.
|
|
873
|
+
event.target.value = "";
|
|
874
|
+
} })] }), _jsx(Button, { type: "submit", variant: "primary", size: "sm", disabled: !ready, children: words.send })] })] }), tooMany && (_jsx("p", { className: "sc-form-error", role: "alert", children: words.tooMany(MAX_SIGNAL_ATTACHMENTS) })), tooLarge && (_jsx("p", { className: "sc-form-error", role: "alert", children: words.tooLarge(formatBytes(MAX_FILE_BYTES)) })), files.length > 0 && said.length === 0 && _jsx("p", { className: "sc-field-hint", children: words.needsWords }), unseen && _jsx("p", { className: "sc-field-hint", children: words.unseen }), props.note !== undefined && _jsx("p", { className: "sc-field-hint", children: props.note })] }));
|
|
875
|
+
}
|
|
876
|
+
/**
|
|
877
|
+
* What changes how the agent stands, apart from what is said to it: a stop, which holds until
|
|
878
|
+
* it is started again; a restart, which goes on with the same conversation; a reset, which
|
|
879
|
+
* begins a new one and is asked twice. Each with words for the agent, where its supervisor has
|
|
880
|
+
* any, and with what it does said under it.
|
|
881
|
+
*/
|
|
882
|
+
export function AgentControls(props) {
|
|
883
|
+
const words = useWords().agents.page.tell;
|
|
884
|
+
const [text, setText] = useState("");
|
|
885
|
+
const [resetting, setResetting] = useState(false);
|
|
886
|
+
const busy = props.busy === true;
|
|
887
|
+
const send = (kind) => {
|
|
888
|
+
const answer = props.onSend(kind, text.trim());
|
|
889
|
+
setResetting(false);
|
|
890
|
+
// The words stay until the console took the signal, as what is told does.
|
|
891
|
+
void takenBy(answer).then((taken) => {
|
|
892
|
+
if (taken) {
|
|
893
|
+
setText("");
|
|
894
|
+
}
|
|
895
|
+
});
|
|
896
|
+
};
|
|
897
|
+
const running = props.state === "running";
|
|
898
|
+
const stopped = props.state === "stopped";
|
|
899
|
+
return (_jsxs("div", { className: "sc-agent-controls", children: [_jsxs("label", { className: "sc-field", children: [_jsx("span", { className: "sc-field-label", children: words.controlWords }), _jsx("input", { className: "sc-input", value: text, maxLength: MAX_SIGNAL_LENGTH, placeholder: words.controlWordsPlaceholder, onChange: (event) => setText(event.target.value) })] }), _jsxs("div", { className: "sc-agent-controls-ways", children: [!running && (_jsx(Button, { size: "sm", disabled: busy, onClick: () => send("restart"), children: words.restart })), !stopped && (_jsx(Button, { size: "sm", disabled: busy, onClick: () => send("stop"), children: words.stop })), resetting ? (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "danger", size: "sm", disabled: busy, onClick: () => send("reset"), children: words.resetConfirm }), _jsx(Button, { variant: "ghost", size: "sm", disabled: busy, onClick: () => setResetting(false), children: words.cancel })] })) : (_jsx(Button, { variant: "ghost", size: "sm", disabled: busy, onClick: () => setResetting(true), children: words.reset }))] }), props.note !== undefined && props.note !== null && (_jsx("p", { className: "sc-field-hint", role: "status", children: props.note })), resetting ? (_jsx(Callout, { tone: "warning", children: words.resetWarning })) : (_jsxs("ul", { className: "sc-agent-controls-says", children: [!running && (_jsxs("li", { children: [_jsx("b", { children: words.restart }), " ", words.restartHint] })), !stopped && (_jsxs("li", { children: [_jsx("b", { children: words.stop }), " ", words.stopHint] })), _jsxs("li", { children: [_jsx("b", { children: words.reset }), " ", words.resetHint] })] }))] }));
|
|
900
|
+
}
|
|
901
|
+
/** The model and the level of effort an agent runs with, chosen from what its product offers. */
|
|
902
|
+
export function AgentChoice(props) {
|
|
903
|
+
const words = useWords().agents.page.choice;
|
|
904
|
+
const runner = props.runner ?? null;
|
|
905
|
+
const offers = runner?.offers ?? null;
|
|
906
|
+
if (runner === null ||
|
|
907
|
+
offers === null ||
|
|
908
|
+
(offers.models.length === 0 && offers.efforts.length === 0)) {
|
|
909
|
+
return _jsx("p", { className: "sc-field-hint", children: words.none });
|
|
910
|
+
}
|
|
911
|
+
const select = (label, name, offered, chosen) => offered.length === 0 ? null : (_jsxs("label", { className: "sc-field sc-agent-choice-field", children: [_jsx("span", { className: "sc-field-label", children: label }), _jsxs("select", { className: "sc-input", value: chosen ?? "", disabled: props.busy === true, onChange: (event) => props.onSet({ [name]: event.target.value === "" ? null : event.target.value }), children: [_jsx("option", { value: "", children: words.own }), [...new Set([...offered, ...(chosen === null ? [] : [chosen])])].map((value) => (_jsx("option", { value: value, children: value }, value)))] })] }));
|
|
912
|
+
const running = runner.running;
|
|
913
|
+
return (_jsxs("div", { className: "sc-agent-choice", children: [select(words.model, "model", offers.models, runner.settings.model), select(words.effort, "effort", offers.efforts, runner.settings.effort), running !== null && (running.model !== null || running.effort !== null) && (_jsx("p", { className: "sc-field-hint", children: words.runsWith(running.model ?? words.own, running.effort ?? words.own) }))] }));
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* An agent account's sessions, the newest first, a row each that leads to it: when it began and
|
|
917
|
+
* ended, how it ended, what it ran and where, and how much it holds.
|
|
918
|
+
*/
|
|
919
|
+
export function AgentSessionList(props) {
|
|
920
|
+
const words = useWords().agents.page.sessions;
|
|
921
|
+
if (props.sessions.length === 0) {
|
|
922
|
+
return _jsx(_Fragment, { children: props.empty ?? null });
|
|
923
|
+
}
|
|
924
|
+
const ends = words.ends;
|
|
925
|
+
return (_jsx("ul", { className: "sc-agent-sessions", "aria-label": words.title, children: props.sessions.map((session) => (_jsxs("li", { className: "sc-agent-session", children: [_jsxs("span", { className: "sc-agent-session-when", children: [_jsx("a", { className: "sc-agent-session-link", href: props.href(session), children: _jsx(Time, { iso: session.startedAt }) }), session.endedAt !== null && (_jsxs("span", { className: "sc-agent-session-until", children: [" – ", _jsx(Time, { iso: session.endedAt, precision: "clock", against: session.startedAt })] }))] }), _jsxs("span", { className: "sc-agent-session-badges", children: [session.ended === null ? (_jsx(Badge, { tone: "success", kind: "state", children: words.open })) : (_jsx(Badge, { tone: session.ended === "crashed" ? "danger" : "neutral", children: ends[session.ended] ?? session.ended })), session.away && _jsx(Badge, { tone: "warning", children: words.away })] }), _jsx("span", { className: "sc-agent-session-facts", children: [
|
|
926
|
+
`${session.product.name}${session.product.version === null ? "" : ` ${session.product.version}`}`,
|
|
927
|
+
...(session.model === null ? [] : [session.model]),
|
|
928
|
+
...(session.resumed ? [words.resumed] : []),
|
|
929
|
+
session.machine.name,
|
|
930
|
+
].join(" · ") }), _jsx("span", { className: "sc-agent-session-count", children: words.events(session.events) })] }, session.id))) }));
|
|
931
|
+
}
|
|
932
|
+
/** What an agent's runner last said of itself: where it runs, with what, and where its record stands. */
|
|
933
|
+
export function AgentRunnerFacts(props) {
|
|
934
|
+
const words = useWords().agents.page.settings.runner;
|
|
935
|
+
const runner = props.runner ?? null;
|
|
936
|
+
if (runner === null || (runner.machine === null && runner.product === null)) {
|
|
937
|
+
return _jsx("p", { className: "sc-field-hint", children: words.none });
|
|
938
|
+
}
|
|
939
|
+
const facts = [
|
|
940
|
+
...(runner.machine === null
|
|
941
|
+
? []
|
|
942
|
+
: [
|
|
943
|
+
[words.machine, `${runner.machine.name} · ${runner.machine.os}`],
|
|
944
|
+
[words.user, runner.machine.user],
|
|
945
|
+
]),
|
|
946
|
+
...(runner.runner === null ? [] : [[words.version, runner.runner]]),
|
|
947
|
+
...(runner.product === null
|
|
948
|
+
? []
|
|
949
|
+
: [
|
|
950
|
+
[
|
|
951
|
+
words.product,
|
|
952
|
+
_jsxs("span", { className: "sc-agent-product", children: [runner.product.name, runner.product.version !== null && ` ${runner.product.version}`, !runner.product.tried && _jsx(Badge, { tone: "warning", children: words.untried })] }, "product"),
|
|
953
|
+
],
|
|
954
|
+
]),
|
|
955
|
+
[words.signals, words.delivered(runner.delivered, runner.latest)],
|
|
956
|
+
];
|
|
957
|
+
return (_jsx("dl", { className: "sc-person-facts sc-agent-runner-facts", children: facts.map(([name, value]) => (_jsxs("div", { className: "sc-person-fact", children: [_jsx("dt", { children: name }), _jsx("dd", { children: value })] }, name))) }));
|
|
958
|
+
}
|
|
959
|
+
/**
|
|
960
|
+
* The accounts an agent account holds elsewhere (ADR-0089): what it is called at each service,
|
|
961
|
+
* as it or a supervisor recorded them, and no secret. What to close when the account is taken out.
|
|
962
|
+
*/
|
|
963
|
+
export function AgentElsewhereList(props) {
|
|
964
|
+
const words = useWords().agents.page.settings.elsewhere;
|
|
965
|
+
const held = Object.entries(props.accounts ?? {});
|
|
966
|
+
return (_jsxs("div", { children: [held.length === 0 ? (_jsx("p", { className: "sc-field-hint", children: words.empty })) : (_jsx("dl", { className: "sc-person-facts sc-agent-runner-facts", "aria-label": words.title, children: held.map(([service, name]) => (_jsxs("div", { className: "sc-person-fact", children: [_jsx("dt", { children: service }), _jsx("dd", { children: name })] }, service))) })), _jsx("p", { className: "sc-field-hint", children: words.intro })] }));
|
|
967
|
+
}
|
|
968
|
+
/** The names of an agent account's secrets, and the way a supervisor seeds one or removes one. Never a value. */
|
|
969
|
+
export function AgentSecretList(props) {
|
|
970
|
+
const words = useWords().agents.page.settings.secrets;
|
|
971
|
+
const [name, setName] = useState("");
|
|
972
|
+
const [value, setValue] = useState("");
|
|
973
|
+
const busy = props.busy === true;
|
|
974
|
+
const submit = (event) => {
|
|
975
|
+
event.preventDefault();
|
|
976
|
+
if (name.trim().length === 0 || value.length === 0 || busy) {
|
|
977
|
+
return;
|
|
978
|
+
}
|
|
979
|
+
props.onSeed(name.trim(), value);
|
|
980
|
+
setName("");
|
|
981
|
+
setValue("");
|
|
982
|
+
};
|
|
983
|
+
return (_jsxs("div", { children: [props.secrets.length === 0 ? (_jsx("p", { className: "sc-field-hint", children: words.empty })) : (_jsx("ul", { className: "sc-agent-secret-list", "aria-label": words.title, children: props.secrets.map((secret) => (_jsxs("li", { className: "sc-agent-secret", children: [_jsx("code", { children: secret.name }), _jsxs("span", { className: "sc-muted", children: [_jsx(Time, { iso: secret.setAt, precision: "day" }), secret.seeded && ` · ${words.seeded}`, secret.expiresOn !== null && ` · ${words.expires(secret.expiresOn)}`] }), _jsx(Button, { variant: "ghost", size: "sm", disabled: busy, onClick: () => props.onRemove(secret.name), children: words.remove })] }, secret.name))) })), _jsxs("form", { className: "sc-agent-secret-form", "aria-label": words.seedAria, onSubmit: submit, children: [_jsx("input", { className: "sc-input", "aria-label": words.name, placeholder: words.namePlaceholder, value: name, autoComplete: "off", onChange: (event) => setName(event.target.value) }), _jsx("input", { className: "sc-input", type: "password", "aria-label": words.value, placeholder: words.value, value: value, autoComplete: "new-password", onChange: (event) => setValue(event.target.value) }), _jsx(Button, { type: "submit", disabled: busy || name.trim().length === 0 || value.length === 0, children: words.seed })] }), _jsx("p", { className: "sc-field-hint", children: words.intro })] }));
|
|
984
|
+
}
|
|
985
|
+
//# sourceMappingURL=agent-page.js.map
|