rvlib-shipkit 2.29.0 → 2.30.0
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/CHANGELOG.md +20 -1
- package/package.json +2 -1
- package/src/advisors/app-graph.ts +1 -1
- package/src/advisors/expose.ts +5 -1
- package/src/advisors/r2.ts +7 -9
- package/src/advisors/routes.ts +29 -2
- package/src/advisors/scan.ts +11 -0
- package/src/agent-time/accounts-usage.ts +8 -0
- package/src/agent-time/claude-sessions.ts +32 -0
- package/src/agent-time/hooks.ts +1 -1
- package/src/agent-time/live.ts +5 -2
- package/src/agent-time/registry.ts +186 -89
- package/src/agent-time/store.ts +6 -4
- package/src/asks/ask-doc.ts +2 -2
- package/src/asks/ask-store.ts +22 -7
- package/src/check.ts +9 -1
- package/src/checks/SK001-package-json-shape.check.ts +1 -0
- package/src/checks/SK003-claude-md-shape.check.ts +1 -0
- package/src/checks/SK004-gitignore-policy.check.ts +12 -6
- package/src/checks/SK008-reviewer-agent.check.ts +4 -7
- package/src/checks/SK013-one-way-in-policy.check.ts +1 -0
- package/src/checks/SK017-vscode-hub-task.check.ts +1 -0
- package/src/checks/SK024-identity-colors.check.ts +1 -1
- package/src/checks/SK027-agent-wiki-links.check.ts +2 -1
- package/src/checks/SK033-global-contribution.check.ts +1 -0
- package/src/checks/SK034-commit-gates-armed.check.ts +1 -0
- package/src/checks/SK039-vscode-watch-generated.check.ts +1 -0
- package/src/checks/SK049-thread-answers-hook.check.ts +9 -5
- package/src/checks/SK050-retired-commands.check.ts +1 -0
- package/src/checks/SK051-no-formatter.check.ts +1 -0
- package/src/cli/channel-run.ts +17 -0
- package/src/cli/cmd_Advisors.ts +28 -7
- package/src/cli/cmd_Asks.ts +2 -2
- package/src/cli/cmd_Backup.ts +5 -1
- package/src/cli/cmd_CacheAudit.ts +1 -1
- package/src/cli/cmd_Channel.ts +43 -0
- package/src/cli/cmd_GlobalProcesses.ts +1 -0
- package/src/cli/cmd_Home.ts +12 -5
- package/src/cli/cmd_Hooks.ts +1 -1
- package/src/cli/cmd_Hq.ts +43 -0
- package/src/cli/cmd_Lanes.ts +15 -3
- package/src/cli/cmd_Media.ts +8 -3
- package/src/cli/cmd_Orchestrator.ts +253 -84
- package/src/cli/cmd_OrchestratorRole.ts +163 -0
- package/src/cli/cmd_Review.ts +142 -165
- package/src/cli/cmd_Secret.ts +44 -14
- package/src/cli/cmd_Shot.ts +2 -4
- package/src/cli/cmd_Sound.ts +1 -0
- package/src/cli/cmd_Urls.ts +3 -3
- package/src/cli/inbox-hook-run.ts +109 -0
- package/src/cli/registry.ts +6 -2
- package/src/cli/review-here.ts +136 -0
- package/src/cli.ts +45 -14
- package/src/collections/actions.ts +5 -4
- package/src/collections/checks.ts +5 -0
- package/src/collections/collection-types.ts +4 -3
- package/src/collections/pings.ts +4 -1
- package/src/collections/providers.ts +6 -4
- package/src/collections/tests.ts +7 -4
- package/src/core/app-icon-frame.ts +62 -0
- package/src/core/app-icon.ts +179 -17
- package/src/core/archived.ts +10 -7
- package/src/core/check-ctx.ts +38 -4
- package/src/core/check-pass.ts +7 -0
- package/src/core/foreign.ts +87 -0
- package/src/core/gui-color.ts +75 -0
- package/src/core/hub-theme.ts +1 -3
- package/src/core/layout.ts +3 -0
- package/src/core/machine-commit.ts +9 -1
- package/src/core/one-lib.ts +2 -1
- package/src/core/one-way-in-policy.ts +17 -12
- package/src/core/owner-word-policy.ts +123 -0
- package/src/core/panel-shades.ts +140 -0
- package/src/core/repo-gui-color.ts +16 -0
- package/src/core/role-policy.ts +17 -0
- package/src/core/scope.ts +6 -3
- package/src/core/tmux-policy.ts +264 -0
- package/src/core/unit-icon.ts +43 -0
- package/src/fleet/push-fleet.ts +2 -0
- package/src/fleet/scan-fleet.ts +3 -0
- package/src/gate/cache-audit.ts +7 -1
- package/src/gate/gate-checks.ts +14 -9
- package/src/gate/run-fix.ts +30 -5
- package/src/gate/run-fixers.ts +8 -3
- package/src/home/activity-shape.ts +2 -0
- package/src/home/activity.ts +2 -1
- package/src/home/daemon-guard.ts +20 -2
- package/src/home/daemon-jobs.ts +26 -18
- package/src/home/gui-app/ShipkitGui.swift +2012 -144
- package/src/home/gui-app/icon.svg +8 -0
- package/src/home/gui-app.ts +94 -30
- package/src/home/home-routes.ts +53 -9
- package/src/home/home-start.ts +27 -3
- package/src/home/inbox-shape.ts +7 -3
- package/src/home/log-follow.ts +117 -0
- package/src/home/machine-fold.ts +1 -1
- package/src/home/open-app.ts +9 -3
- package/src/home/page-build.ts +5 -1
- package/src/home/page-held.ts +1 -1
- package/src/home/pm-config.ts +0 -8
- package/src/home/pm.ts +62 -5
- package/src/home/process-apps.ts +70 -23
- package/src/home/process-rows.ts +16 -1
- package/src/home/push-sources.ts +18 -13
- package/src/home/resources.ts +16 -7
- package/src/home/run-daemon.ts +4 -1
- package/src/home/run-pm.ts +1 -1
- package/src/home/serve-daemon.ts +13 -4
- package/src/home/serve-web.ts +141 -17
- package/src/home/space-page.ts +3 -3
- package/src/home/space-route.ts +2 -2
- package/src/home/supervise.ts +2 -1
- package/src/home/vault-page.ts +2 -1
- package/src/home/web-places.ts +239 -0
- package/src/home/widgets.ts +16 -2
- package/src/hooks/commit-message.ts +11 -9
- package/src/hooks/one-way-in-guard.ts +145 -68
- package/src/hooks/run-hooks.ts +15 -5
- package/src/hooks/shared-file.ts +273 -83
- package/src/hooks/shell-writes.ts +620 -0
- package/src/hooks/write-log.ts +149 -0
- package/src/hq/door-route.ts +63 -7
- package/src/hq/door.ts +45 -12
- package/src/hq/history-send.ts +3 -1
- package/src/hq/hq-db.ts +10 -3
- package/src/hq/hq-local.ts +24 -5
- package/src/hq/hq-routes.ts +3 -1
- package/src/hq/hq-store.ts +9 -3
- package/src/hq/kinds/index.ts +2 -1
- package/src/hq/kinds/kind.ts +9 -4
- package/src/hq/kinds/presence-rule.ts +56 -0
- package/src/hq/kinds/presence.ts +210 -0
- package/src/hq/kinds/report.ts +8 -5
- package/src/hq/lead-order.ts +68 -0
- package/src/hq/outbox.ts +7 -0
- package/src/hq/replica.ts +5 -7
- package/src/hq/report-facts.ts +14 -7
- package/src/hq/report.ts +47 -2
- package/src/hq/switch.ts +1 -0
- package/src/hq/terminal-hop.ts +64 -0
- package/src/hq/thread-sync.ts +13 -6
- package/src/http/door-forward.ts +10 -12
- package/src/http/door-names.ts +9 -0
- package/src/http/hop-caller.ts +23 -0
- package/src/http/hop-names.ts +14 -0
- package/src/http/loopback-serve.ts +28 -6
- package/src/http/owner-word.ts +128 -0
- package/src/http/same-origin.ts +12 -0
- package/src/{serve → http}/secret-gate.ts +3 -3
- package/src/ledger/run-log.ts +25 -1
- package/src/media-store/backup/sources.ts +53 -6
- package/src/media-store/backup/thread-copy.ts +9 -5
- package/src/media-store/copy/config.ts +10 -9
- package/src/media-store/daemon.ts +5 -2
- package/src/media-store/put.ts +3 -0
- package/src/media-store/space.ts +14 -16
- package/src/media-store/upload.ts +4 -0
- package/src/messages/collection.ts +2 -2
- package/src/messages/model.ts +6 -1
- package/src/messages/routes.ts +3 -0
- package/src/orchestrator/brief.md +8 -6
- package/src/orchestrator/channel-declare.ts +58 -0
- package/src/orchestrator/channel.ts +226 -0
- package/src/orchestrator/guards.ts +12 -3
- package/src/orchestrator/host.ts +35 -0
- package/src/orchestrator/lead-shape.ts +86 -0
- package/src/orchestrator/now.ts +88 -0
- package/src/orchestrator/phone.ts +4 -1
- package/src/orchestrator/places-file.ts +38 -0
- package/src/orchestrator/places-look.ts +180 -0
- package/src/orchestrator/places-shape.ts +151 -0
- package/src/orchestrator/places.ts +50 -0
- package/src/orchestrator/presence-shape.ts +13 -2
- package/src/orchestrator/presence.ts +26 -15
- package/src/orchestrator/push.ts +5 -10
- package/src/orchestrator/role-shape.ts +270 -0
- package/src/orchestrator/role.ts +242 -0
- package/src/orchestrator/routes.ts +136 -31
- package/src/orchestrator/sessions-shape.ts +78 -0
- package/src/orchestrator/sessions.ts +86 -0
- package/src/orchestrator/share.ts +71 -0
- package/src/orchestrator/start-notice.ts +61 -0
- package/src/orchestrator/start.ts +137 -0
- package/src/orchestrator/started.ts +55 -0
- package/src/orchestrator/stuck.ts +196 -0
- package/src/orchestrator/unheard.ts +18 -7
- package/src/pages/frame-client.ts +44 -6
- package/src/problems/failure-words.ts +80 -0
- package/src/release/run-bump.ts +26 -5
- package/src/release/run-release.ts +34 -14
- package/src/repo-config.ts +37 -9
- package/src/review/aside-at.ts +19 -0
- package/src/review/band.ts +3 -3
- package/src/review/doc-save.ts +1 -1
- package/src/review/inbox-hook.ts +12 -4
- package/src/review/inbox-read.ts +20 -7
- package/src/review/instruction-guards.ts +137 -0
- package/src/review/instructions.ts +14 -2
- package/src/review/item-db.ts +52 -2
- package/src/review/mentions.ts +6 -4
- package/src/review/model.ts +3 -2
- package/src/review/parties.ts +88 -19
- package/src/review/push.ts +32 -15
- package/src/review/routes.ts +12 -4
- package/src/review/secret-route.ts +5 -5
- package/src/review/snooze.ts +1 -16
- package/src/review/store-parties.ts +4 -2
- package/src/review/take-back.ts +2 -1
- package/src/review/threads.ts +13 -2
- package/src/review/unit.ts +3 -2
- package/src/review/view-layout.ts +8 -1
- package/src/review/watchers.ts +25 -4
- package/src/secrets/key-pair.ts +14 -0
- package/src/secrets/lapse.ts +3 -3
- package/src/secrets/manager.ts +5 -1
- package/src/secrets/name-template.ts +83 -0
- package/src/secrets/name.ts +3 -0
- package/src/secrets/read.ts +10 -6
- package/src/secrets/secrets-view.ts +299 -0
- package/src/secrets/who-reads.ts +2 -1
- package/src/serve/frame-part.ts +49 -0
- package/src/serve/hub-app/accounts-line.tsx +33 -45
- package/src/serve/hub-app/activity-st.ts +6 -5
- package/src/serve/hub-app/activity-view.tsx +10 -9
- package/src/serve/hub-app/advice-box.tsx +6 -5
- package/src/serve/hub-app/advisor-app.tsx +2 -0
- package/src/serve/hub-app/advisor-face.tsx +3 -2
- package/src/serve/hub-app/advisor.html +1 -0
- package/src/serve/hub-app/advisors-view.tsx +52 -10
- package/src/serve/hub-app/advisors.css +4 -0
- package/src/serve/hub-app/app-bridge.ts +31 -5
- package/src/serve/hub-app/asked-page.ts +24 -0
- package/src/serve/hub-app/asks-page.tsx +10 -6
- package/src/serve/hub-app/auto-text.tsx +7 -5
- package/src/serve/hub-app/card-head.tsx +3 -2
- package/src/serve/hub-app/check-view.tsx +10 -9
- package/src/serve/hub-app/checks-svc.ts +96 -32
- package/src/serve/hub-app/clock-svc.ts +24 -8
- package/src/serve/hub-app/code-copy.ts +1 -1
- package/src/serve/hub-app/col-card.tsx +2 -1
- package/src/serve/hub-app/col-list-page.tsx +12 -6
- package/src/serve/hub-app/col-list-st.ts +12 -2
- package/src/serve/hub-app/col-tables-view.tsx +8 -44
- package/src/serve/hub-app/col-tables.ts +0 -14
- package/src/serve/hub-app/cols-svc.ts +6 -12
- package/src/serve/hub-app/columns.ts +94 -0
- package/src/serve/hub-app/comfy-view.tsx +8 -7
- package/src/serve/hub-app/commands/commands-page.tsx +4 -3
- package/src/serve/hub-app/commands/commands-st.ts +2 -2
- package/src/serve/hub-app/controls.css +69 -23
- package/src/serve/hub-app/cycle-button.tsx +2 -1
- package/src/serve/hub-app/database-st.ts +1 -1
- package/src/serve/hub-app/database-view.tsx +4 -2
- package/src/serve/hub-app/deaf.tsx +27 -0
- package/src/serve/hub-app/dock-st.ts +21 -16
- package/src/serve/hub-app/dock-view.tsx +19 -12
- package/src/serve/hub-app/empty-section.tsx +30 -0
- package/src/serve/hub-app/entry-bar.css +1 -1
- package/src/serve/hub-app/entry-bar.tsx +11 -6
- package/src/serve/hub-app/entry-list.css +32 -0
- package/src/serve/hub-app/entry-list.tsx +123 -0
- package/src/serve/hub-app/entry-pick.ts +1 -1
- package/src/serve/hub-app/entry-sections.ts +140 -0
- package/src/serve/hub-app/event-stream-reader.ts +56 -0
- package/src/serve/hub-app/floating.tsx +68 -14
- package/src/serve/hub-app/geometry-view.tsx +3 -2
- package/src/serve/hub-app/git-view.tsx +3 -2
- package/src/serve/hub-app/hash-route.ts +14 -2
- package/src/serve/hub-app/header-bar.tsx +53 -36
- package/src/serve/hub-app/home-st.ts +131 -14
- package/src/serve/hub-app/home-strip.css +24 -13
- package/src/serve/hub-app/home-strip.tsx +131 -66
- package/src/serve/hub-app/home.html +5 -0
- package/src/serve/hub-app/hub-app.tsx +94 -102
- package/src/serve/hub-app/hub.css +61 -94
- package/src/serve/hub-app/icons.tsx +16 -0
- package/src/serve/hub-app/identities-st.ts +19 -54
- package/src/serve/hub-app/identities-view.tsx +25 -24
- package/src/serve/hub-app/identity-address.ts +2 -2
- package/src/serve/hub-app/in-sight.ts +10 -0
- package/src/serve/hub-app/inbox-st.ts +20 -2
- package/src/serve/hub-app/inbox-view.tsx +16 -9
- package/src/serve/hub-app/inbox.css +1 -0
- package/src/serve/hub-app/index.html +5 -0
- package/src/serve/hub-app/insights-view.tsx +6 -5
- package/src/serve/hub-app/instructions.css +4 -1
- package/src/serve/hub-app/kept-cols.tsx +83 -20
- package/src/serve/hub-app/kept-width.tsx +76 -0
- package/src/serve/hub-app/keys.ts +116 -38
- package/src/serve/hub-app/layout-st.ts +109 -99
- package/src/serve/hub-app/lightbox-zoom.css +36 -0
- package/src/serve/hub-app/list-filter.tsx +15 -6
- package/src/serve/hub-app/list-head.tsx +29 -0
- package/src/serve/hub-app/list-row.ts +8 -0
- package/src/serve/hub-app/list-walk.ts +26 -105
- package/src/serve/hub-app/live-socket.ts +274 -0
- package/src/serve/hub-app/live-sources.ts +189 -0
- package/src/serve/hub-app/live-svc.ts +2 -2
- package/src/serve/hub-app/machine-st.ts +75 -14
- package/src/serve/hub-app/main-panel.css +211 -0
- package/src/serve/hub-app/main-panel.tsx +259 -0
- package/src/serve/hub-app/md.ts +4 -4
- package/src/serve/hub-app/media-svc.ts +5 -5
- package/src/serve/hub-app/media-view.tsx +13 -12
- package/src/serve/hub-app/messages/messages-page.tsx +8 -7
- package/src/serve/hub-app/messages/messages-st.ts +5 -2
- package/src/serve/hub-app/new-thread-st.ts +170 -0
- package/src/serve/hub-app/new-thread.tsx +133 -107
- package/src/serve/hub-app/orchestrator-line.tsx +115 -45
- package/src/serve/hub-app/orchestrator-places.tsx +86 -0
- package/src/serve/hub-app/orchestrator.css +57 -5
- package/src/serve/hub-app/page-keys.ts +107 -68
- package/src/serve/hub-app/page-reload.ts +46 -6
- package/src/serve/hub-app/pages-frames.tsx +40 -3
- package/src/serve/hub-app/pages-svc.ts +3 -1
- package/src/serve/hub-app/palette-st.ts +198 -43
- package/src/serve/hub-app/palette-view.tsx +32 -8
- package/src/serve/hub-app/panel-head-action.tsx +39 -0
- package/src/serve/hub-app/panel-head.tsx +70 -0
- package/src/serve/hub-app/panel-repo.ts +42 -0
- package/src/serve/hub-app/panel-source.ts +195 -0
- package/src/serve/hub-app/panel-tint.css +6 -0
- package/src/serve/hub-app/panel-tint.ts +23 -0
- package/src/serve/hub-app/panel-walk.ts +107 -0
- package/src/serve/hub-app/pill-row.tsx +2 -1
- package/src/serve/hub-app/place-path.ts +4 -0
- package/src/serve/hub-app/places-svc.ts +75 -0
- package/src/serve/hub-app/plan-view.tsx +3 -2
- package/src/serve/hub-app/polled.ts +11 -1
- package/src/serve/hub-app/presence-st.ts +66 -32
- package/src/serve/hub-app/processes-view.tsx +2 -2
- package/src/serve/hub-app/project-bar.tsx +116 -0
- package/src/serve/hub-app/project-list.css +20 -173
- package/src/serve/hub-app/project-list.tsx +30 -298
- package/src/serve/hub-app/projects-svc.ts +59 -32
- package/src/serve/hub-app/push-sign.tsx +2 -1
- package/src/serve/hub-app/push-svc.ts +86 -69
- package/src/serve/hub-app/quiet-st.ts +5 -3
- package/src/serve/hub-app/rail-groups.ts +144 -0
- package/src/serve/hub-app/reader-chips.tsx +2 -1
- package/src/serve/hub-app/recordings-st.ts +2 -1
- package/src/serve/hub-app/recordings-view.tsx +19 -47
- package/src/serve/hub-app/recordings.css +0 -2
- package/src/serve/hub-app/reflections-page.tsx +10 -6
- package/src/serve/hub-app/releases/releases-page.tsx +6 -5
- package/src/serve/hub-app/repo-sections.ts +127 -38
- package/src/serve/hub-app/repo-st.ts +57 -36
- package/src/serve/hub-app/review/advisor-bar.tsx +3 -2
- package/src/serve/hub-app/review/ask-proof.tsx +79 -0
- package/src/serve/hub-app/review/attach-view.tsx +11 -10
- package/src/serve/hub-app/review/box-view.ts +479 -0
- package/src/serve/hub-app/review/box-zoom.tsx +70 -0
- package/src/serve/hub-app/review/diff-view.tsx +3 -2
- package/src/serve/hub-app/review/doc-body.tsx +2 -1
- package/src/serve/hub-app/review/dock.tsx +3 -2
- package/src/serve/hub-app/review/draft-body.tsx +4 -3
- package/src/serve/hub-app/review/faces.tsx +0 -8
- package/src/serve/hub-app/review/group-block.tsx +8 -7
- package/src/serve/hub-app/review/heard-line.tsx +4 -3
- package/src/serve/hub-app/review/instructions-view.tsx +3 -2
- package/src/serve/hub-app/review/item-verdict.tsx +40 -40
- package/src/serve/hub-app/review/kind-states.tsx +5 -4
- package/src/serve/hub-app/review/kit.tsx +24 -4
- package/src/serve/hub-app/review/lane-bar.tsx +30 -28
- package/src/serve/hub-app/review/lightbox.tsx +6 -4
- package/src/serve/hub-app/review/live-bar.tsx +7 -6
- package/src/serve/hub-app/review/live-view.tsx +6 -5
- package/src/serve/hub-app/review/object-card.tsx +2 -1
- package/src/serve/hub-app/review/object-panel.tsx +11 -10
- package/src/serve/hub-app/review/pano-view.tsx +3 -2
- package/src/serve/hub-app/review/question-views.tsx +6 -5
- package/src/serve/hub-app/review/review-cells.tsx +21 -20
- package/src/serve/hub-app/review/review-host.ts +3 -0
- package/src/serve/hub-app/review/review-kit.ts +7 -5
- package/src/serve/hub-app/review/review-list.tsx +98 -52
- package/src/serve/hub-app/review/review-page.tsx +3 -3
- package/src/serve/hub-app/review/review-st.ts +70 -14
- package/src/serve/hub-app/review/review-thread.tsx +234 -138
- package/src/serve/hub-app/review/review-views.tsx +166 -191
- package/src/serve/hub-app/review/space3d.tsx +17 -9
- package/src/serve/hub-app/review/thread-close.tsx +24 -32
- package/src/serve/hub-app/review/thread-st.ts +39 -25
- package/src/serve/hub-app/review/trailer-body.tsx +5 -4
- package/src/serve/hub-app/review/trailer-page.tsx +18 -16
- package/src/serve/hub-app/review/trailer-st.ts +3 -2
- package/src/serve/hub-app/review/trailer-timeline.tsx +10 -9
- package/src/serve/hub-app/review/trailer-voices.tsx +29 -28
- package/src/serve/hub-app/review.css +159 -42
- package/src/serve/hub-app/row-acts.tsx +126 -0
- package/src/serve/hub-app/row-face.tsx +29 -0
- package/src/serve/hub-app/running-rows.tsx +142 -0
- package/src/serve/hub-app/running-st.ts +110 -0
- package/src/serve/hub-app/search-view.tsx +3 -2
- package/src/serve/hub-app/secrets-page.tsx +290 -0
- package/src/serve/hub-app/secrets-st.ts +181 -0
- package/src/serve/hub-app/secrets.css +65 -0
- package/src/serve/hub-app/section-head.tsx +3 -2
- package/src/serve/hub-app/session-chips.tsx +55 -0
- package/src/serve/hub-app/shell.ts +56 -0
- package/src/serve/hub-app/site/site-part.tsx +6 -5
- package/src/serve/hub-app/site/site-st.ts +0 -6
- package/src/serve/hub-app/site.css +0 -1
- package/src/serve/hub-app/social/calendar.tsx +7 -6
- package/src/serve/hub-app/social/comms-page.tsx +29 -26
- package/src/serve/hub-app/social/group-editor.tsx +2 -1
- package/src/serve/hub-app/social/kit.tsx +12 -11
- package/src/serve/hub-app/social/next-release.tsx +3 -2
- package/src/serve/hub-app/social/post-card.tsx +21 -20
- package/src/serve/hub-app/social/post-page.tsx +2 -1
- package/src/serve/hub-app/social/problems.tsx +3 -2
- package/src/serve/hub-app/social/social-page.tsx +29 -27
- package/src/serve/hub-app/social/social-st.ts +4 -2
- package/src/serve/hub-app/social/stage-popup.tsx +11 -10
- package/src/serve/hub-app/social.css +7 -5
- package/src/serve/hub-app/source-acts.ts +79 -0
- package/src/serve/hub-app/source-page.tsx +17 -0
- package/src/serve/hub-app/space-view.tsx +5 -4
- package/src/serve/hub-app/stores/stores-page.tsx +21 -19
- package/src/serve/hub-app/stores/stores-st.ts +1 -1
- package/src/serve/hub-app/stores.css +1 -1
- package/src/serve/hub-app/terminal-history-st.ts +112 -0
- package/src/serve/hub-app/terminal-keys.ts +79 -0
- package/src/serve/hub-app/terminal-lib.ts +110 -0
- package/src/serve/hub-app/terminal-links.ts +55 -0
- package/src/serve/hub-app/terminal-list-st.ts +304 -0
- package/src/serve/hub-app/terminal-log-st.ts +242 -0
- package/src/serve/hub-app/terminal-out.ts +135 -0
- package/src/serve/hub-app/terminal-pages.tsx +115 -0
- package/src/serve/hub-app/terminal-panel.tsx +60 -9
- package/src/serve/hub-app/terminal-sources.tsx +335 -0
- package/src/serve/hub-app/terminal-st.ts +447 -167
- package/src/serve/hub-app/terminal-stream.ts +233 -0
- package/src/serve/hub-app/terminal-tab.tsx +64 -0
- package/src/serve/hub-app/terminal-widths.ts +30 -0
- package/src/serve/hub-app/terminal.css +50 -4
- package/src/serve/hub-app/test-view.tsx +5 -3
- package/src/serve/hub-app/tests-view.tsx +16 -15
- package/src/serve/hub-app/theme-st.ts +5 -0
- package/src/serve/hub-app/thread-row.tsx +39 -31
- package/src/serve/hub-app/time-ago.tsx +3 -2
- package/src/serve/hub-app/time-view.tsx +2 -1
- package/src/serve/hub-app/time.css +1 -1
- package/src/serve/hub-app/timeline-chart.tsx +5 -4
- package/src/serve/hub-app/timeline-view.tsx +10 -9
- package/src/serve/hub-app/tips.ts +247 -0
- package/src/serve/hub-app/tree-build.ts +40 -8
- package/src/serve/hub-app/tree-svc.ts +167 -134
- package/src/serve/hub-app/unit-icons.ts +26 -0
- package/src/serve/hub-app/url-address.ts +154 -0
- package/src/serve/hub-app/url-faces.ts +88 -0
- package/src/serve/hub-app/url-forms.tsx +183 -0
- package/src/serve/hub-app/urls-svc.ts +167 -5
- package/src/serve/hub-app/urls-view.tsx +56 -20
- package/src/serve/hub-app/urls.css +26 -0
- package/src/serve/hub-app/vault-view.tsx +5 -4
- package/src/serve/hub-app/veille/veille-page.tsx +34 -33
- package/src/serve/hub-app/veille/veille-st.ts +6 -3
- package/src/serve/hub-app/view-layout.css +3 -3
- package/src/serve/hub-app/when-view.tsx +5 -4
- package/src/serve/hub-app/wikis-view.tsx +6 -5
- package/src/serve/hub-app/words.tsx +9 -2
- package/src/serve/hub-runtime.ts +3 -2
- package/src/serve/orchestrator-host.ts +58 -0
- package/src/serve/page-live.ts +147 -0
- package/src/serve/project-gutter-route.ts +63 -2
- package/src/serve/read-worker.ts +7 -2
- package/src/serve/runs-stamp.ts +33 -0
- package/src/serve/secrets-read.ts +156 -0
- package/src/serve/serve-hub.ts +71 -22
- package/src/serve/terminal-claudes.ts +185 -0
- package/src/serve/terminal-guard.ts +10 -5
- package/src/serve/terminal-host.ts +517 -0
- package/src/serve/terminal-record.ts +104 -0
- package/src/serve/terminal-route.ts +466 -103
- package/src/serve/terminal-shells.ts +3 -0
- package/src/serve/terminal-watch.ts +102 -0
- package/src/shipkit-files.ts +9 -4
- package/src/shot/client.ts +4 -9
- package/src/shot/shooter.ts +2 -4
- package/src/shot/shot-ask.ts +2 -7
- package/src/shot/shot-theme.ts +6 -17
- package/src/social/routes.ts +2 -2
- package/src/social/writes.ts +3 -0
- package/src/suite/test-units.ts +6 -2
- package/src/trailer/sound/eleven.ts +1 -0
- package/src/urls/added.ts +111 -0
- package/src/urls/icons.ts +294 -0
- package/src/urls/places.ts +139 -0
- package/src/urls/routes.ts +17 -7
- package/src/urls/rows.ts +48 -15
- package/src/urls/unit.ts +57 -3
- package/src/urls/write-routes.ts +207 -0
- package/src/vault/vault-destroy.ts +2 -1
- package/src/vault/vault-import.ts +4 -11
- package/src/vault/vault-restore.ts +3 -2
- package/src/veille/chrome.ts +18 -3
- package/src/veille/identity.ts +6 -0
- package/src/view3d/cam.ts +30 -46
- package/src/view3d/lib.ts +20 -2
- package/src/view3d/viewer.ts +62 -88
- package/src/wiki/agent-paths.ts +2 -1
- package/src/orchestrator/deliver.ts +0 -81
- package/src/orchestrator/drill.ts +0 -129
- package/src/orchestrator/keeper.ts +0 -332
- package/src/orchestrator/pm.ts +0 -20
- package/src/orchestrator/state.ts +0 -92
- package/src/orchestrator/switch.ts +0 -86
- package/src/orchestrator/tmux.ts +0 -82
- package/src/serve/hub-app/rail-fly.tsx +0 -95
- package/src/serve/hub-app/side-lists.ts +0 -72
- package/src/serve/hub-app/sidebar.tsx +0 -62
- package/src/serve/hub-app/tree-row.tsx +0 -125
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// what a row of the main panel's processes, terminals and Claude sessions can do, as its acts (panel-source.ts
|
|
2
|
+
// RowActs, drawn by row-acts.tsx): the acts its page and the processes page already offer, one hover away.
|
|
3
|
+
// The one constraint a reader breaks first: a process is acted on only through pm's routes its page already calls
|
|
4
|
+
// (MachineSt processAct, openProcess), a terminal only through its list's acts (TermListSt shut, again, act): never a
|
|
5
|
+
// route of its own, and each act is his click
|
|
6
|
+
import type { TermWindow } from '../terminal-host.ts'
|
|
7
|
+
import type { HomeSt } from './home-st.ts'
|
|
8
|
+
import { ICON } from './icons.tsx'
|
|
9
|
+
import { openUrl } from './live-sources.ts'
|
|
10
|
+
import { openTab, panelRepo } from './panel-repo.ts'
|
|
11
|
+
import type { ActSaid, RowAct, RowActs, RowTab } from './panel-source.ts'
|
|
12
|
+
import type { TermListSt } from './terminal-list-st.ts'
|
|
13
|
+
|
|
14
|
+
const clock = (): string => new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false })
|
|
15
|
+
|
|
16
|
+
/** a tab of the row, as its own « in a new tab » button opens it */
|
|
17
|
+
const tabAct = (id: string, word: string, what: string, tab: RowTab | null): RowAct[] =>
|
|
18
|
+
tab == null ? [] : [{ id, word, icon: ICON.newtab, what, leaves: true, run: () => openTab(tab.href, tab.name, tab.chips) }]
|
|
19
|
+
|
|
20
|
+
type PmAct = 'start' | 'stop' | 'restart' | 'takeover' | 'open' | 'chrome' | 'app' | 'action'
|
|
21
|
+
|
|
22
|
+
/** a process pm runs for the repo: start or stop, restart, take over; its url here, in a tab, in the browser, in
|
|
23
|
+
* Chrome, as an app; its log here and alone in a tab; its declared actions; its last log line at the foot */
|
|
24
|
+
export function processActs(home: HomeSt, id: string, show: () => void, logTab: RowTab | null): RowActs | null {
|
|
25
|
+
const r = panelRepo(home)
|
|
26
|
+
const m = home.machine
|
|
27
|
+
const p = r?.globalProcesses.find((x) => x.id === id)
|
|
28
|
+
if (r == null || m == null || p == null) return null
|
|
29
|
+
const on = p.status === 'up' || p.status === 'starting'
|
|
30
|
+
const first = on ? '' : ' (pm starts it first)'
|
|
31
|
+
// pm answers once it took the act, and does it after: the state line above follows it
|
|
32
|
+
const pm = (a: PmAct, word: string, action?: string) => async (): Promise<ActSaid> =>
|
|
33
|
+
(await m.processAct(p.id, a, action)) ? { words: `${word}: asked pm at ${clock()}, the state above follows` } : { words: `${word}: pm refused, ${m.error || 'no answer'}`, bad: true }
|
|
34
|
+
const state: RowAct[] = [
|
|
35
|
+
on
|
|
36
|
+
? { id: 'stop', word: 'stop', icon: ICON.stop, on: p.status !== 'stopping' && p.canStop, what: p.canStop ? `stop ${p.label} now: pm ends it, and it stays down until you start it` : 'started outside pm, so pm cannot stop it', run: pm('stop', 'stop') }
|
|
37
|
+
: { id: 'start', word: 'start', icon: ICON.play, on: p.status !== 'unknown', what: p.status === 'unknown' ? 'pm does not know its state yet' : `start ${p.label}: pm runs it`, run: pm('start', 'start') },
|
|
38
|
+
...(p.canRestart ? [{ id: 'restart', word: 'restart', icon: ICON.restart, what: `stop ${p.label} and start it again`, run: pm('restart', 'restart') }] : []),
|
|
39
|
+
...(p.takeOver?.ok === true ? [{ id: 'takeover', word: 'take over', icon: ICON.restart, what: 'stop the copy started elsewhere and start one pm supervises', run: pm('takeover', 'take over') }] : []),
|
|
40
|
+
]
|
|
41
|
+
const u = r.urls.list.find((x) => x.process === p.id)
|
|
42
|
+
const at = p.host ?? p.url ?? ''
|
|
43
|
+
const url: RowAct[] = p.url == null ? [] : [
|
|
44
|
+
...(u == null ? [] : [{ id: 'url', word: 'open here', icon: ICON.urls, what: `${at} in this window, framed by the hub`, leaves: true, run: () => openUrl(home, u.id) }]),
|
|
45
|
+
...tabAct('url-tab', 'in a tab', `${at} in a tab of its own`, u == null ? null : r.urls.tab(u)),
|
|
46
|
+
{ id: 'browser', word: 'browser', icon: ICON.browser, what: `${at} in your default browser${first}`, run: pm('open', 'browser') },
|
|
47
|
+
{ id: 'chrome', word: 'Chrome', icon: ICON.browser, what: `${at} in Chrome${first}`, run: pm('chrome', 'Chrome') },
|
|
48
|
+
{ id: 'app', word: 'app', icon: ICON.window, on: !p.appBusy, what: p.appBusy ? `building the ${p.label} app` : `${p.label} as an app of its own, in the dock${first}`, run: pm('app', 'app') },
|
|
49
|
+
]
|
|
50
|
+
const log: RowAct[] = [
|
|
51
|
+
{ id: 'log', word: 'log', icon: ICON.terminal, what: 'its log, live, in this window', leaves: true, run: show },
|
|
52
|
+
...tabAct('log-tab', 'log in a tab', 'its log alone, in a tab of its own', logTab),
|
|
53
|
+
]
|
|
54
|
+
const actions: RowAct[] = p.actions.map((a) => ({ id: `action:${a.id}`, word: a.label, icon: ICON.process, on: p.running == null, what: p.running == null ? `run « ${a.label} », an action ${p.label} declares` : `« ${p.running} » runs now`, run: pm('action', a.label, a.id) }))
|
|
55
|
+
return { groups: [{ acts: state }, { acts: url }, { acts: log }, { acts: actions }], ...(p.lastLog == null ? {} : { foot: { text: p.lastLog, what: 'its last log line' } }) }
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** a terminal of the repo, or the one a Claude session runs in: its page, alone in a tab, close (a terminal whose
|
|
59
|
+
* program runs asks first, as its page does), its program started again once ended; one a restart ended opens a new
|
|
60
|
+
* shell there. A Claude session in no terminal of this hub (`w` null): its page alone */
|
|
61
|
+
/** `l`: the list the terminal is of, another place's for its terminals (terminal-sources.tsx) */
|
|
62
|
+
export function terminalActs(home: HomeSt, w: TermWindow | null, show: () => void, tab: RowTab | null, l: TermListSt = home.terminal.list): RowActs {
|
|
63
|
+
const open: RowAct = { id: 'page', word: 'open', icon: ICON.terminal, what: 'its page, in this window', leaves: true, run: show }
|
|
64
|
+
if (w == null) return { groups: [{ acts: [open] }] }
|
|
65
|
+
const asking = l.closing === w.id
|
|
66
|
+
const ended = w.dead || w.gone === true
|
|
67
|
+
const acts: RowAct[] = [
|
|
68
|
+
open,
|
|
69
|
+
...tabAct('tab', 'in a tab', 'that one terminal alone, in a tab of its own', tab),
|
|
70
|
+
...(w.gone === true ? [{ id: 'reopen', word: 'new shell there', icon: ICON.restart, what: `a new empty shell in ${w.dir === '' ? 'its folder' : w.dir}, under its name`, run: () => void l.act({ act: 'restart', window: w.id }) }] : []),
|
|
71
|
+
...(w.dead && w.gone !== true && w.role == null ? [{ id: 'again', word: 'start again', icon: ICON.restart, what: 'start its program again, in its folder', run: () => l.again(w.id) }] : []),
|
|
72
|
+
...(asking ? [] : [{ id: 'close', word: 'close', icon: ICON.close, what: ended ? 'close it: its last screen is gone' : 'close it: its program ends, its screen is gone (it asks first while a program runs)', run: () => l.shut(w.id) }]),
|
|
73
|
+
]
|
|
74
|
+
const ask: RowAct[] = !asking ? [] : [
|
|
75
|
+
{ id: 'close-sure', word: 'close it', icon: ICON.close, what: 'end the program that still runs, and close its terminal', run: () => l.shut(w.id, true) },
|
|
76
|
+
{ id: 'keep', word: 'keep', icon: ICON.check, what: 'leave it running, its terminal open', run: () => l.shut(w.id, false, true) },
|
|
77
|
+
]
|
|
78
|
+
return { groups: [{ acts }, { ask: 'its program still runs', acts: ask }] }
|
|
79
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// the page of a source's row in the main tab (`page:src:<section>:<id>`, panel-source.ts): the source draws it. A row
|
|
2
|
+
// gone (a terminal closed, a process stopped) or a section no module provides says so in words, never a blank page
|
|
3
|
+
import { observer } from 'mobx-react-lite'
|
|
4
|
+
import { sourceOf, type SourceSection } from './panel-source.ts'
|
|
5
|
+
import type { RepoSt } from './repo-st.ts'
|
|
6
|
+
|
|
7
|
+
const SECTIONS: readonly string[] = ['terminals', 'claude', 'processes', 'urls'] satisfies readonly SourceSection[]
|
|
8
|
+
|
|
9
|
+
export const SourcePage = observer(({ app, section, id }: { app: RepoSt; section: string; id: string }) => {
|
|
10
|
+
const src = SECTIONS.includes(section) ? sourceOf(app.home, section as SourceSection) : null
|
|
11
|
+
const row = src?.rows.find((r) => r.id === id) ?? null
|
|
12
|
+
const page = src?.page == null || row == null ? null : src.page(row)
|
|
13
|
+
if (page != null) return <>{page}</>
|
|
14
|
+
// its rows are on their way (a tab opened on this address): nothing is said gone before they are known
|
|
15
|
+
if (src?.loading === true) return <div className="stagewrap" />
|
|
16
|
+
return <div className="stagewrap"><div className="ph">{src == null ? `no ${section} in this hub` : `no ${section} named ${id} now`}</div></div>
|
|
17
|
+
})
|
|
@@ -19,6 +19,7 @@ import { type Cell, type Col, Hint, type Row, Table } from './time-charts.tsx'
|
|
|
19
19
|
import { FactRow } from './vault-view.tsx'
|
|
20
20
|
import { entryMark } from './vault-st.ts'
|
|
21
21
|
import { ageWords, bytesWords } from '../../core/words.ts'
|
|
22
|
+
import { tip } from './tips.ts'
|
|
22
23
|
|
|
23
24
|
/** what each entry of the bar holds, said beside its name on the right */
|
|
24
25
|
const ABOUT: Record<SpaceEntry, string> = {
|
|
@@ -87,10 +88,10 @@ function fileRow(st: SpaceSt, x: FileRow, depth: number, whole: number, narrow:
|
|
|
87
88
|
key: `f:${x.key}`,
|
|
88
89
|
title: x.key,
|
|
89
90
|
cells: [
|
|
90
|
-
<span className="spname"><Indent depth={depth} /><i className="spcaret" /><Named narrow={narrow} what={x.by}><span>{x.opens ? <a className="spfile" href={st.fileHref(x.key)} target="_blank" rel="noopener noreferrer">{x.named ? x.name : shortKey(x.name)}</a> : <span
|
|
91
|
+
<span className="spname"><Indent depth={depth} /><i className="spcaret" /><Named narrow={narrow} what={x.by}><span>{x.opens ? <a className="spfile" href={st.fileHref(x.key)} target="_blank" rel="noopener noreferrer">{x.named ? x.name : shortKey(x.name)}</a> : <span {...tip('its own command reads it, the page does not open it')}>{x.named ? x.name : shortKey(x.name)}</span>}{x.named && !narrow ? <span className="mcdim spkey">{shortKey(x.key)}</span> : null}</span></Named></span>,
|
|
91
92
|
{ v: x.size, text: bytesWords(x.size) },
|
|
92
93
|
{ v: x.size, text: shareWords(x.size, whole) },
|
|
93
|
-
...(narrow ? [] : [{ v: 0, text: '' }, x.modified == null ? '' : <span
|
|
94
|
+
...(narrow ? [] : [{ v: 0, text: '' }, x.modified == null ? '' : <span {...tip(day(x.modified))}>{`${ageWords(x.modified, (st.data?.at ?? Date.now()))}`}</span>, x.by ?? '']),
|
|
94
95
|
],
|
|
95
96
|
}
|
|
96
97
|
}
|
|
@@ -162,7 +163,7 @@ const Switch = observer(({ st }: { st: SpaceSt }) => {
|
|
|
162
163
|
if (all.length < 2) return null
|
|
163
164
|
return (
|
|
164
165
|
<div className="seg spswitch" role="group" aria-label="which Space">
|
|
165
|
-
{all.map((s) => <button key={s.id} type="button" aria-pressed={st.shown?.id === s.id} className={st.shown?.id === s.id ? 'on' : ''}
|
|
166
|
+
{all.map((s) => <button key={s.id} type="button" aria-pressed={st.shown?.id === s.id} className={st.shown?.id === s.id ? 'on' : ''} {...tip(s.role)} onClick={() => st.pickSpace(s.id)}>{s.id === 'space' ? 'the Space' : 'its copy'}</button>)}
|
|
166
167
|
</div>
|
|
167
168
|
)
|
|
168
169
|
})
|
|
@@ -187,7 +188,7 @@ export const SpaceView = observer(({ app }: { app: HomeSt }) => {
|
|
|
187
188
|
</div>
|
|
188
189
|
{st.error !== '' ? <div className="hnote mcerr">{st.error}</div> : null}
|
|
189
190
|
{d == null || v == null ? null : (
|
|
190
|
-
<EntryCols narrow={narrow} bar={<EntryBar label="the Space's entries" entries={SPACE_ENTRIES} current={st.entry} open={(e) => st.open(e as SpaceEntry)} mark={(e) => (e === 'files' ? { tone: '', title: '' } : entryMark(v[e as 'about' | 'health']))} tabs={narrow} head={<Switch st={st} />} />}>
|
|
191
|
+
<EntryCols narrow={narrow} fold={{ layout: app.layout, id: 'space' }} bar={<EntryBar label="the Space's entries" entries={SPACE_ENTRIES} current={st.entry} open={(e) => st.open(e as SpaceEntry)} mark={(e) => (e === 'files' ? { tone: '', title: '' } : entryMark(v[e as 'about' | 'health']))} tabs={narrow} head={<Switch st={st} />} />}>
|
|
191
192
|
{st.entry === 'files' ? <Files app={app} st={st} v={v} /> : <Facts app={app} v={v} e={st.entry} />}
|
|
192
193
|
</EntryCols>
|
|
193
194
|
)}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// a repo's stores page (`#page:stores`, wiki tools/shipkit/stores.md, The page): the stores and their state on the
|
|
2
2
|
// left, the page's texts to paste in the middle, its pictures on the right, each with the lightbox, the Finder, a
|
|
3
3
|
// note, its family made again. On a phone the three stacked
|
|
4
|
+
import { listRow } from '../list-row.ts'
|
|
4
5
|
import { observer } from 'mobx-react-lite'
|
|
5
6
|
import { useEffect, useState, type ReactNode } from 'react'
|
|
6
7
|
import { Panel, Separator } from 'react-resizable-panels'
|
|
@@ -14,6 +15,7 @@ import type { FieldView, Picture, RenderView, StoresSt, StoreView } from './stor
|
|
|
14
15
|
import { AutoText } from '../auto-text.tsx'
|
|
15
16
|
import { ThreadControl } from '../review/thread-control.tsx'
|
|
16
17
|
import { bytesWords } from '../../../core/words.ts'
|
|
18
|
+
import { tip } from '../tips.ts'
|
|
17
19
|
|
|
18
20
|
export const StoresPage = observer(({ app }: { app: RepoSt }) => {
|
|
19
21
|
const so = app.stores
|
|
@@ -66,11 +68,11 @@ const StoreList = observer(({ so }: { so: StoresSt }) => {
|
|
|
66
68
|
if (!d) return <div className="rv-empty">loading…</div>
|
|
67
69
|
return (
|
|
68
70
|
<div className="sto-list">
|
|
69
|
-
<div className="sto-seller"
|
|
71
|
+
<div className="sto-seller" {...tip('the identity this repo speaks as (speaksAs in repo.config.ts): who the store pages sell for')}>
|
|
70
72
|
<span className="rv-dim rv-small">seller</span> {d.seller ? <b>{d.seller.name}</b> : <span className="rv-dim">no speaksAs in repo.config.ts</span>}
|
|
71
73
|
</div>
|
|
72
74
|
{d.unitError ? <div className="rv-err">{d.unitError}</div> : null}
|
|
73
|
-
{so.error ? <div className="rv-err sto-close" onClick={() => so.clearError()}
|
|
75
|
+
{so.error ? <div className="rv-err sto-close" onClick={() => so.clearError()} {...tip('close')}>{so.error} ✕</div> : null}
|
|
74
76
|
{d.stores.length === 0 ? <div className="rv-empty">no store page: write {STORE_IDS.map(mainFile).join(' or ')}</div> : null}
|
|
75
77
|
{d.stores.map((s) => <StoreCard key={s.id} so={so} s={s} on={s.id === so.current?.id} />)}
|
|
76
78
|
</div>
|
|
@@ -78,7 +80,7 @@ const StoreList = observer(({ so }: { so: StoresSt }) => {
|
|
|
78
80
|
})
|
|
79
81
|
|
|
80
82
|
const StoreCard = observer(({ so, s, on }: { so: StoresSt; s: StoreView; on: boolean }) => (
|
|
81
|
-
<div className={`sto-card sto-pick${on ? ' on' : ''}`} onClick={() => so.pick(s.id)}>
|
|
83
|
+
<div className={`sto-card sto-pick${on ? ' on' : ''}`} {...listRow(s.id, on)} onClick={() => so.pick(s.id)}>
|
|
82
84
|
<div className="sto-head">
|
|
83
85
|
<b className="sto-grow">{s.name}</b>
|
|
84
86
|
<span className={`sto-badge t-${s.page === 'online' ? 'ok' : s.page === 'draft' ? 'warn' : 'dim'}`}>{s.page}</span>
|
|
@@ -111,9 +113,9 @@ const StoreCard = observer(({ so, s, on }: { so: StoresSt; s: StoreView; on: boo
|
|
|
111
113
|
<div className="sto-files">
|
|
112
114
|
{s.files.map((f) => (
|
|
113
115
|
'href' in f ? (
|
|
114
|
-
<a key={f.href} href={f.href} onClick={(e) => e.stopPropagation()}
|
|
116
|
+
<a key={f.href} href={f.href} onClick={(e) => e.stopPropagation()} {...tip('open its thread')}>{f.label} ↗</a>
|
|
115
117
|
) : (
|
|
116
|
-
<a key={f.abs} href={editorHref('', f.abs) ?? '#'} onClick={(e) => e.stopPropagation()}
|
|
118
|
+
<a key={f.abs} href={editorHref('', f.abs) ?? '#'} onClick={(e) => e.stopPropagation()} {...tip(`open ${f.abs} in VS Code`)}>{f.label} ↗</a>
|
|
117
119
|
)
|
|
118
120
|
))}
|
|
119
121
|
</div>
|
|
@@ -148,7 +150,7 @@ const StoreTexts = observer(({ so }: { so: StoresSt }) => {
|
|
|
148
150
|
})
|
|
149
151
|
|
|
150
152
|
const Count = ({ n, max, names }: { n: number; max: number; names: boolean }) => (
|
|
151
|
-
<span className={`sto-count${n > max ? ' t-red' : ' rv-dim'}`}
|
|
153
|
+
<span className={`sto-count${n > max ? ' t-red' : ' rv-dim'}`} {...tip(names ? `${n} names, the store keeps ${max}` : `${n} characters of ${max}`)}>{n}/{max}</span>
|
|
152
154
|
)
|
|
153
155
|
|
|
154
156
|
const FieldCard = observer(({ so, f }: { so: StoresSt; f: FieldView }) => {
|
|
@@ -206,7 +208,7 @@ const PastedBox = observer(({ so, asset, mark, terse = false }: { so: StoresSt;
|
|
|
206
208
|
const on = so.isPasted(asset, mark)
|
|
207
209
|
const stale = !on && mark?.stale === true && !terse
|
|
208
210
|
return (
|
|
209
|
-
<label className={`sto-pasted${on ? ' on' : ''}${stale ? ' t-warn' : ''}`}
|
|
211
|
+
<label className={`sto-pasted${on ? ' on' : ''}${stale ? ' t-warn' : ''}`} {...tip(on ? `pasted on ${day(mark?.at ?? new Date().toISOString())}; click to untick` : 'tick it once pasted on the store: it unticks itself when this changes')} onClick={(e) => e.stopPropagation()}>
|
|
210
212
|
<input type="checkbox" checked={on} onChange={(e) => void so.setPasted(asset, e.target.checked)} />
|
|
211
213
|
{stale && mark ? `changed since you pasted on ${day(mark.at)}` : 'pasted'}
|
|
212
214
|
</label>
|
|
@@ -219,7 +221,7 @@ const StaleLine = observer(({ so, asset, mark }: { so: StoresSt; asset: string;
|
|
|
219
221
|
)
|
|
220
222
|
|
|
221
223
|
const NoteToggle = observer(({ so, asset, count }: { so: StoresSt; asset: string; count: number }) => (
|
|
222
|
-
<button className={`sto-note${so.noteOpen[asset] ? ' on' : ''}`} onClick={(e) => { e.stopPropagation(); so.toggleNote(asset) }}
|
|
224
|
+
<button className={`sto-note${so.noteOpen[asset] ? ' on' : ''}`} onClick={(e) => { e.stopPropagation(); so.toggleNote(asset) }} {...tip('a note on this: it goes into its thread, an agent owes it')}>
|
|
223
225
|
note{count > 0 ? ` · ${count}` : ''}
|
|
224
226
|
</button>
|
|
225
227
|
))
|
|
@@ -230,7 +232,7 @@ const NoteBox = observer(({ so, asset, said }: { so: StoresSt; asset: string; sa
|
|
|
230
232
|
return (
|
|
231
233
|
<div className="sto-notes">
|
|
232
234
|
{said.map((n) => (
|
|
233
|
-
<button key={`${n.id}${n.at}`} className={`sto-said ns-${n.state === 'closed' ? 'done' : 'open'}`} onClick={() => so.openNote(n.id)}
|
|
235
|
+
<button key={`${n.id}${n.at}`} className={`sto-said ns-${n.state === 'closed' ? 'done' : 'open'}`} onClick={() => so.openNote(n.id)} {...tip('open it on the review page')}>
|
|
234
236
|
<span className="sto-saidstate">{n.state === 'closed' ? 'taken up' : 'in progress'}</span> {n.text}
|
|
235
237
|
{n.answer ? <div className="rv-dim">↳ {n.answer}</div> : null}
|
|
236
238
|
</button>
|
|
@@ -271,7 +273,7 @@ const MakeAgain = observer(({ so, r }: { so: StoresSt; r: RenderView | undefined
|
|
|
271
273
|
if (!r) return null
|
|
272
274
|
const run = so.render
|
|
273
275
|
return (
|
|
274
|
-
<button disabled={run?.running === true} onClick={() => void so.regenerate(r)}
|
|
276
|
+
<button disabled={run?.running === true} onClick={() => void so.regenerate(r)} {...tip(r.cmd)}>
|
|
275
277
|
{run?.family === r.family && run.running ? 'making…' : 'make again'}
|
|
276
278
|
</button>
|
|
277
279
|
)
|
|
@@ -331,7 +333,7 @@ const PictureTile = observer(({ so, pic, real, onOpen }: { so: StoresSt; pic: Pi
|
|
|
331
333
|
)
|
|
332
334
|
else if (pic.media === 'file')
|
|
333
335
|
media = (
|
|
334
|
-
<div className="sto-file"
|
|
336
|
+
<div className="sto-file" {...tip("show it in the Finder (📂), then drag it onto the store's upload box")}>
|
|
335
337
|
<b>{pic.name}</b>
|
|
336
338
|
<div className="rv-small rv-dim">upload it as it is: 📂 shows it in the Finder, drag it from there</div>
|
|
337
339
|
</div>
|
|
@@ -343,13 +345,13 @@ const PictureTile = observer(({ so, pic, real, onOpen }: { so: StoresSt; pic: Pi
|
|
|
343
345
|
<div className={real ? 'sto-scrollx' : undefined}>
|
|
344
346
|
<div className="sto-frame" onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}>
|
|
345
347
|
{media}
|
|
346
|
-
{pic.url !== null && pic.media !== 'file' && (hover || so.phone) ? <button className="sto-expand" onClick={onOpen}
|
|
348
|
+
{pic.url !== null && pic.media !== 'file' && (hover || so.phone) ? <button className="sto-expand" onClick={onOpen} {...tip('look at it large: ← → step through its family')}>⤢</button> : null}
|
|
347
349
|
</div>
|
|
348
350
|
</div>
|
|
349
351
|
<div className="sto-picrow">
|
|
350
352
|
<b className="rv-small">{pic.name}</b>
|
|
351
|
-
{pic.w !== null ? <span className={`rv-small${off.size ? ' t-red' : ' rv-dim'}`}
|
|
352
|
-
{off.alpha ? <span className="rv-small t-red"
|
|
353
|
+
{pic.w !== null ? <span className={`rv-small${off.size ? ' t-red' : ' rv-dim'}`} {...tip(off.size && pic.want ? `the store wants ${pic.want.w}x${pic.want.h}` : undefined)}>{pic.w}x{pic.h}{off.size && pic.want ? ` (wants ${pic.want.w}x${pic.want.h})` : ''}</span> : null}
|
|
354
|
+
{off.alpha ? <span className="rv-small t-red" {...tip('the store takes a 24-bit png: flatten it on a background, with no alpha channel')}>RGBA (wants no alpha)</span> : null}
|
|
353
355
|
{pic.ico ? <span className="rv-small rv-dim">sizes {pic.ico}</span> : null}
|
|
354
356
|
{pic.url !== null ? <span className="rv-small rv-dim">{bytesWords(pic.bytes)}</span> : null}
|
|
355
357
|
{pic.slot ? <span className="rv-small rv-dim">· {pic.slot}</span> : null}
|
|
@@ -357,7 +359,7 @@ const PictureTile = observer(({ so, pic, real, onOpen }: { so: StoresSt; pic: Pi
|
|
|
357
359
|
{pic.url !== null && pic.media === 'image' && !pic.name.endsWith('.ico') ? <button className="ghost" onClick={() => void so.copyImage(pic)}>copy image</button> : null}
|
|
358
360
|
{pic.url !== null ? <PastedBox so={so} asset={pic.path} mark={pic.pasted} /> : null}
|
|
359
361
|
{so.current ? <ThreadControl st={so.st} address={`store:${so.current.id}/${pic.path}`} name={pic.name} /> : null}
|
|
360
|
-
{pic.url !== null && !so.phone ? <button className="ghost" onClick={() => void so.reveal(pic)}
|
|
362
|
+
{pic.url !== null && !so.phone ? <button className="ghost" onClick={() => void so.reveal(pic)} {...tip(`show ${pic.path} in the Finder`)}>📂</button> : null}
|
|
361
363
|
<NoteToggle so={so} asset={pic.path} count={pic.said.length} />
|
|
362
364
|
</div>
|
|
363
365
|
<NoteBox so={so} asset={pic.path} said={pic.said} />
|
|
@@ -372,12 +374,12 @@ const Lightbox = observer(({ so }: { so: StoresSt }) => {
|
|
|
372
374
|
if (!at) return null
|
|
373
375
|
const pic = at.pic
|
|
374
376
|
return (
|
|
375
|
-
<div className="sto-lightbox" onClick={() => so.closeLightbox()}>
|
|
377
|
+
<div className="sto-lightbox" role="dialog" aria-modal="true" aria-label="the picture, whole" onClick={() => so.closeLightbox()}>
|
|
376
378
|
<div className="sto-lbbar" onClick={(e) => e.stopPropagation()}>
|
|
377
|
-
<button className="ghost" onClick={() => so.stepLightbox(-1)}
|
|
379
|
+
<button className="ghost" onClick={() => so.stepLightbox(-1)} {...tip('the one before', '←')}>←</button>
|
|
378
380
|
<span>{pic.name}{pic.w ? ` · ${pic.w}x${pic.h}` : ''}</span>
|
|
379
|
-
<button className="ghost" onClick={() => so.stepLightbox(1)}
|
|
380
|
-
<button className="ghost" onClick={() => so.closeLightbox()}
|
|
381
|
+
<button className="ghost" onClick={() => so.stepLightbox(1)} {...tip('the next', '→')}>→</button>
|
|
382
|
+
<button className="ghost" onClick={() => so.closeLightbox()} {...tip('close', 'Escape')}>✕</button>
|
|
381
383
|
</div>
|
|
382
384
|
{pic.media === 'clip' ? <video src={so.fileUrl(pic)} controls autoPlay className="sto-lbmedia" onClick={(e) => e.stopPropagation()} /> : <img src={so.fileUrl(pic)} alt={pic.name} className="sto-lbmedia" onClick={(e) => e.stopPropagation()} />}
|
|
383
385
|
</div>
|
|
@@ -106,7 +106,7 @@ export class StoresSt {
|
|
|
106
106
|
return sideOf({ ids: () => this.stores.map((s) => s.id), current: () => this.current?.id ?? null, open: (id) => this.pick(id as StoreId) })
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
/** the page's keys: the lightbox's arrows and Escape, j k the store before or after (
|
|
109
|
+
/** the page's keys: the lightbox's arrows and Escape, j k the store before or after (⇧↑ ⇧↓ too, the hub's: columns.ts) */
|
|
110
110
|
key(e: Pick<KeyboardEvent, 'key'>): boolean {
|
|
111
111
|
const lb = this.lightbox
|
|
112
112
|
if (lb) {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
.sto-list,.sto-colin{display:flex;flex-direction:column;gap:var(--s3);padding:var(--s3)}
|
|
7
7
|
.sto-card{background:var(--panel);border:1px solid var(--line);border-radius:6px;padding:var(--s3);display:flex;flex-direction:column;gap:var(--s2);min-width:0}
|
|
8
8
|
.sto-pick{cursor:pointer}
|
|
9
|
-
.sto-pick.on{border-color:var(--accent)
|
|
9
|
+
.sto-pick.on{border-color:var(--accent)}
|
|
10
10
|
.sto-head{display:flex;align-items:center;gap:var(--s2);min-width:0}
|
|
11
11
|
.sto-grow{flex:1;min-width:0}
|
|
12
12
|
.sto-badge{font-size:11px;padding:0 var(--s2);border-radius:999px;border:1px solid var(--tone);color:var(--tone)}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// the page's own scrollback of a terminal (terminal-st.ts): when he scrolls up, the terminal's last lines are read
|
|
2
|
+
// once from what keeps the terminal (POST /api/terminal/history: its history and its screen, colours kept) and drawn
|
|
3
|
+
// over the live terminal by a second xterm, read only: the wheel, the selection, ⌘C and the links are the page's.
|
|
4
|
+
// The live terminal goes on under it. A key, Escape, or the wheel down past the last line shows it again.
|
|
5
|
+
// The one constraint a reader breaks first: it is a picture taken when he scrolled up. What prints after is in the
|
|
6
|
+
// live terminal, and in the next picture
|
|
7
|
+
import { makeAutoObservable, runInAction } from 'mobx'
|
|
8
|
+
import type { Terminal } from '@xterm/xterm'
|
|
9
|
+
import { reach } from './reach.ts'
|
|
10
|
+
import { loadXterm, TERM_FONT, textLinks, themeOf } from './terminal-lib.ts'
|
|
11
|
+
|
|
12
|
+
/** the lines read at once: what a long run of an agent leaves, and a fraction of a second to draw */
|
|
13
|
+
export const HISTORY_PAGE = 10_000
|
|
14
|
+
|
|
15
|
+
export class TermHistorySt {
|
|
16
|
+
open = false
|
|
17
|
+
/** why nothing shows, '' for none */
|
|
18
|
+
note = ''
|
|
19
|
+
/** the hub that answers runs code from before this route: the wheel stays its terminal's own until it restarts */
|
|
20
|
+
unserved = false
|
|
21
|
+
|
|
22
|
+
term: Terminal | null = null
|
|
23
|
+
private el: HTMLDivElement | null = null
|
|
24
|
+
private loading = false
|
|
25
|
+
|
|
26
|
+
constructor() {
|
|
27
|
+
makeAutoObservable<this, 'el' | 'loading'>(this, { term: false, el: false, loading: false })
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** the history of the terminal the stream `id` looks at, over `over` (the live terminal's box), at the live
|
|
31
|
+
* terminal's size so each line wraps where it did; scrolled up by `lines` once drawn. `back`: he left it */
|
|
32
|
+
async show(o: { base: string; id: string; over: HTMLElement; cols: number; rows: number; lines: number; back: () => void }): Promise<void> {
|
|
33
|
+
if (this.open || this.loading) return
|
|
34
|
+
this.loading = true
|
|
35
|
+
try {
|
|
36
|
+
const [lib, r] = await Promise.all([loadXterm(o.base), reach(`${o.base}/api/terminal/history`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ id: o.id, lines: HISTORY_PAGE }) })])
|
|
37
|
+
if (!r.ok) {
|
|
38
|
+
const why = await r.text().catch(() => '')
|
|
39
|
+
return runInAction(() => {
|
|
40
|
+
this.unserved = r.status === 404 && why === 'not a terminal route'
|
|
41
|
+
this.note = r.status === 404 ? '' : 'the history could not be read'
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
const text = new Uint8Array(await r.arrayBuffer())
|
|
45
|
+
const term = new lib.Terminal({ ...TERM_FONT, cols: o.cols, rows: o.rows, disableStdin: true, convertEol: true, scrollback: HISTORY_PAGE + o.rows, cursorBlink: false, cursorInactiveStyle: 'none', macOptionClickForcesSelection: true, theme: themeOf(document.documentElement) })
|
|
46
|
+
const el = document.createElement('div')
|
|
47
|
+
el.className = 'termhist'
|
|
48
|
+
const pill = document.createElement('button')
|
|
49
|
+
pill.type = 'button'
|
|
50
|
+
pill.className = 'termhistback'
|
|
51
|
+
pill.textContent = 'history · esc: back to live'
|
|
52
|
+
pill.addEventListener('click', () => this.close(o.back))
|
|
53
|
+
const screen = document.createElement('div')
|
|
54
|
+
screen.className = 'termscreen'
|
|
55
|
+
el.append(screen, pill)
|
|
56
|
+
o.over.appendChild(el)
|
|
57
|
+
term.open(screen)
|
|
58
|
+
const open = (e: MouseEvent, url: string): void => {
|
|
59
|
+
if (e.metaKey && /^https?:\/\//i.test(url)) window.open(url, '_blank', 'noopener,noreferrer')
|
|
60
|
+
}
|
|
61
|
+
term.options.linkHandler = { activate: open }
|
|
62
|
+
textLinks(term, open)
|
|
63
|
+
// the wheel down past its last line, Escape or any other key: the live terminal again
|
|
64
|
+
term.attachCustomWheelEventHandler((e) => {
|
|
65
|
+
const b = term.buffer.active
|
|
66
|
+
if (e.deltaY <= 0 || b.viewportY < b.baseY) return true
|
|
67
|
+
this.close(o.back)
|
|
68
|
+
return false
|
|
69
|
+
})
|
|
70
|
+
term.attachCustomKeyEventHandler((e) => {
|
|
71
|
+
if (e.type !== 'keydown' || e.metaKey || ['Shift', 'Control', 'Alt', 'Meta'].includes(e.key)) return true
|
|
72
|
+
if (e.shiftKey && (e.key === 'PageUp' || e.key === 'PageDown')) return (term.scrollPages(e.key === 'PageUp' ? -1 : 1), false)
|
|
73
|
+
this.close(o.back)
|
|
74
|
+
return false
|
|
75
|
+
})
|
|
76
|
+
// the last line of the picture is the screen's last row: no line of its own after it
|
|
77
|
+
let end = text.length
|
|
78
|
+
while (end > 0 && text[end - 1] === 10) end--
|
|
79
|
+
term.write(text.subarray(0, end), () => {
|
|
80
|
+
term.write('\x1b[?25l')
|
|
81
|
+
term.scrollToBottom()
|
|
82
|
+
term.scrollLines(-Math.max(1, o.lines))
|
|
83
|
+
})
|
|
84
|
+
this.term = term
|
|
85
|
+
this.el = el
|
|
86
|
+
runInAction(() => {
|
|
87
|
+
this.open = true
|
|
88
|
+
this.note = ''
|
|
89
|
+
})
|
|
90
|
+
} catch {
|
|
91
|
+
runInAction(() => { this.note = 'the history could not be read' })
|
|
92
|
+
} finally {
|
|
93
|
+
this.loading = false
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** a page up or down from the keys, while it shows */
|
|
98
|
+
page(by: -1 | 1): void {
|
|
99
|
+
this.term?.scrollPages(by)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** the picture is dropped; `back`: what gives the keys to the live terminal again */
|
|
103
|
+
close(back?: () => void): void {
|
|
104
|
+
if (!this.open && this.term == null) return
|
|
105
|
+
this.term?.dispose()
|
|
106
|
+
this.term = null
|
|
107
|
+
this.el?.remove()
|
|
108
|
+
this.el = null
|
|
109
|
+
this.open = false
|
|
110
|
+
back?.()
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// the keys the terminal page adds to xterm.js (terminal-st.ts), pure so a test reads them: the bytes of a key no
|
|
2
|
+
// legacy sequence carries, and the keys pressed before the terminal can take them
|
|
3
|
+
// (wiki tools/shipkit/hub.md, The terminal panel)
|
|
4
|
+
|
|
5
|
+
export type KeyLike = { key: string; code: string; ctrlKey: boolean; shiftKey: boolean; altKey: boolean; metaKey: boolean }
|
|
6
|
+
|
|
7
|
+
/** xterm's modifier parameter: 1, plus shift 1, alt 2, ctrl 4 */
|
|
8
|
+
const other = (e: KeyLike, code: number): string => `\x1b[27;${1 + (e.shiftKey ? 1 : 0) + (e.altKey ? 2 : 0) + (e.ctrlKey ? 4 : 0)};${code}~`
|
|
9
|
+
|
|
10
|
+
/** ctrl with one of these has a control byte of its own, which every program reads */
|
|
11
|
+
const HAS_CONTROL_BYTE = /^[a-z@[\\\]^_? /2-8]$/
|
|
12
|
+
|
|
13
|
+
/** the bytes of a key that no legacy sequence tells from another key, as xterm's modifyOtherKeys writes it
|
|
14
|
+
* (`CSI 27 ; modifiers ; code ~`): ⇧⏎ and ⌃⏎ (legacy: ⏎), ⌃⇥ (legacy: ⇥), ⇧⎋, ⌃ with a letter and ⇧, ⌃ with a digit
|
|
15
|
+
* or a sign that has no control byte. null: the key keeps the bytes xterm.js gives it. `level` is what the program
|
|
16
|
+
* asked for with `CSI > 4 ; level m` (tmux asks once its extended keys are on): at 0 every key is legacy */
|
|
17
|
+
export function otherKey(e: KeyLike, level: number): string | null {
|
|
18
|
+
if (level < 1 || e.metaKey) return null
|
|
19
|
+
if (e.key === 'Enter') return e.shiftKey || e.ctrlKey ? other(e, 13) : null
|
|
20
|
+
if (e.key === 'Tab') return e.ctrlKey ? other(e, 9) : null
|
|
21
|
+
if (e.key === 'Escape') return e.shiftKey || e.ctrlKey ? other(e, 27) : null
|
|
22
|
+
if (!e.ctrlKey || e.altKey || [...e.key].length !== 1) return null
|
|
23
|
+
if (!e.shiftKey && HAS_CONTROL_BYTE.test(e.key)) return null
|
|
24
|
+
// ⌃⇧ with a sign of the digit row (⌃⇧2 is ⌃@, ⌃⇧- is ⌃_) is that sign's control byte
|
|
25
|
+
if (e.shiftKey && !/^[a-z]$/i.test(e.key)) return null
|
|
26
|
+
return other(e, e.key.codePointAt(0)!)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** a key pressed before the terminal could take it: its text when it types a sign, else the key itself */
|
|
30
|
+
export type HeldKey = { text: string } | { event: KeyboardEvent }
|
|
31
|
+
|
|
32
|
+
/** what a held key is: a sign typed with no ⌃ and no ⌥ goes in as text, every other key is pressed again */
|
|
33
|
+
export const heldKey = (e: KeyboardEvent): HeldKey => ([...e.key].length === 1 && !e.ctrlKey && !e.altKey ? { text: e.key } : { event: e })
|
|
34
|
+
|
|
35
|
+
/** elements whose keys are their own: a field, a button, the terminal's own input */
|
|
36
|
+
/** ⌥ and a digit, with or without ⇧, by the physical key: the hub's own (keys.ts pageKey, the nth url and the nth
|
|
37
|
+
* process), so a terminal beside the hub's panel lets it pass */
|
|
38
|
+
export const isNthKey = (e: KeyLike): boolean => e.altKey && !e.metaKey && !e.ctrlKey && /^Digit[1-9]$/.test(e.code)
|
|
39
|
+
|
|
40
|
+
const OWN_KEYS = 'input, textarea, select, button, [contenteditable], [role="menu"]'
|
|
41
|
+
|
|
42
|
+
/** on the terminal page every key of the page is the terminal's (`?shell=terminal`): a key pressed anywhere else
|
|
43
|
+
* goes to the terminal, and one pressed before the terminal is drawn is held, then typed in order. ⌘ keys stay the
|
|
44
|
+
* page's and the app's. `area`: the terminal's input once it is drawn; `type`: text into the terminal. The disposer
|
|
45
|
+
* ends it. The one constraint: a held key is replayed once only, by `drain`, which the terminal calls when ready */
|
|
46
|
+
export function pageKeys(doc: Document, t: { area(): HTMLTextAreaElement | null; type(text: string): void }): { drain(): void; stop(): void } {
|
|
47
|
+
const held: HeldKey[] = []
|
|
48
|
+
const again = (area: HTMLTextAreaElement, e: KeyboardEvent): boolean => {
|
|
49
|
+
// the legacy codes ride along: xterm.js reads a key by its keyCode
|
|
50
|
+
const copy = new KeyboardEvent('keydown', e)
|
|
51
|
+
area.dispatchEvent(copy)
|
|
52
|
+
return copy.defaultPrevented
|
|
53
|
+
}
|
|
54
|
+
const drain = (): void => {
|
|
55
|
+
const area = t.area()
|
|
56
|
+
if (area == null) return
|
|
57
|
+
for (const k of held.splice(0)) {
|
|
58
|
+
if ('text' in k) t.type(k.text)
|
|
59
|
+
else again(area, k.event)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const onKey = (e: KeyboardEvent): void => {
|
|
63
|
+
if (e.metaKey || e.defaultPrevented || e.isComposing) return
|
|
64
|
+
if (e.target instanceof Element && e.target.closest(OWN_KEYS) != null) return
|
|
65
|
+
// the key is the terminal's alone: the page's own keys (⌃L, ⌃K as ⌘ off a Mac) never read it
|
|
66
|
+
e.stopPropagation()
|
|
67
|
+
const area = t.area()
|
|
68
|
+
if (area == null) {
|
|
69
|
+
held.push(heldKey(e))
|
|
70
|
+
return e.preventDefault()
|
|
71
|
+
}
|
|
72
|
+
// the focus moves before the key ends: the sign it types lands in the terminal's input
|
|
73
|
+
area.focus()
|
|
74
|
+
if (again(area, e)) e.preventDefault()
|
|
75
|
+
}
|
|
76
|
+
// in capture: before the page's own listener on the document
|
|
77
|
+
doc.addEventListener('keydown', onKey, true)
|
|
78
|
+
return { drain, stop: () => doc.removeEventListener('keydown', onKey, true) }
|
|
79
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// xterm.js as the hub's pages load it: from the hub on the first terminal or log a page draws, never in the page's
|
|
2
|
+
// bundle (terminal-route.ts serves the files). One load a page, shared by the terminal (terminal-st.ts) and a
|
|
3
|
+
// process's log (terminal-log-st.ts)
|
|
4
|
+
import type { FitAddon } from '@xterm/addon-fit'
|
|
5
|
+
import type { UnicodeGraphemesAddon } from '@xterm/addon-unicode-graphemes'
|
|
6
|
+
import type { ILink, ITheme, Terminal } from '@xterm/xterm'
|
|
7
|
+
import { mixHex } from '../../core/panel-shades.ts'
|
|
8
|
+
import { linksOnRow, type ScreenRow } from './terminal-links.ts'
|
|
9
|
+
|
|
10
|
+
export type XtermLib = { Terminal: typeof Terminal; FitAddon: typeof FitAddon; Graphemes: typeof UnicodeGraphemesAddon | null }
|
|
11
|
+
|
|
12
|
+
export const TERM_FONT = { fontFamily: 'ui-monospace, Menlo, monospace', fontSize: 12.5 }
|
|
13
|
+
|
|
14
|
+
/** the class hub.css gives the dark theme's tokens to, beside `:root`: a terminal's container */
|
|
15
|
+
export const DARK_SCOPE = 'termpanel'
|
|
16
|
+
|
|
17
|
+
/** a terminal's colours from the hub's dark tokens (`token('bg')` is `--bg`): its ground, its ink, and the 16 a program
|
|
18
|
+
* names by number, which are the hub's state and kind hues, each bright one a step to the ink */
|
|
19
|
+
export function darkTheme(token: (name: string) => string): ITheme {
|
|
20
|
+
const [bg, ink, dim] = [token('bg'), token('ink'), token('dim')]
|
|
21
|
+
const hue = { red: token('red'), green: token('ok'), yellow: token('warn'), blue: token('blue'), magenta: token('k2'), cyan: token('k3') }
|
|
22
|
+
const bright = (c: string): string => mixHex(c, ink, 0.4)
|
|
23
|
+
return {
|
|
24
|
+
background: bg, foreground: ink, cursor: ink, cursorAccent: bg, selectionBackground: token('sel'),
|
|
25
|
+
black: token('line'), ...hue, white: mixHex(dim, ink, 0.5),
|
|
26
|
+
brightBlack: dim, brightRed: bright(hue.red), brightGreen: bright(hue.green), brightYellow: bright(hue.yellow), brightBlue: bright(hue.blue), brightMagenta: bright(hue.magenta), brightCyan: bright(hue.cyan), brightWhite: ink,
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** a terminal's colours, dark on a page of any theme: the tokens are read on a node of the dark scope, never on the
|
|
31
|
+
* page, so a change of the hub's theme gives the same ones */
|
|
32
|
+
export function themeOf(el: Element): ITheme {
|
|
33
|
+
const doc = el.ownerDocument
|
|
34
|
+
const probe = doc.createElement('i')
|
|
35
|
+
probe.className = DARK_SCOPE
|
|
36
|
+
probe.style.display = 'none'
|
|
37
|
+
doc.body.appendChild(probe)
|
|
38
|
+
const css = getComputedStyle(probe)
|
|
39
|
+
const theme = darkTheme((n) => css.getPropertyValue(`--${n}`).trim())
|
|
40
|
+
probe.remove()
|
|
41
|
+
return theme
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
let lib: Promise<XtermLib> | null = null
|
|
45
|
+
|
|
46
|
+
/** `base`: a repo's hub, which serves the files */
|
|
47
|
+
export function loadXterm(base: string): Promise<XtermLib> {
|
|
48
|
+
lib ??= (async () => {
|
|
49
|
+
const at = `${base}/api/terminal-lib`
|
|
50
|
+
if (document.querySelector('link[data-xterm]') == null) {
|
|
51
|
+
const l = document.createElement('link')
|
|
52
|
+
l.rel = 'stylesheet'
|
|
53
|
+
l.href = `${at}/xterm.css`
|
|
54
|
+
l.dataset.xterm = '1'
|
|
55
|
+
document.head.appendChild(l)
|
|
56
|
+
}
|
|
57
|
+
// a url the bundler leaves alone: xterm loads on the first open, never in the page's bundle
|
|
58
|
+
const xtermUrl = `${at}/xterm.mjs`
|
|
59
|
+
const fitUrl = `${at}/addon-fit.mjs`
|
|
60
|
+
const graphemesUrl = `${at}/addon-unicode-graphemes.mjs`
|
|
61
|
+
// the page is built anew at each edit, the hub that serves these files restarts later: a file the running hub
|
|
62
|
+
// does not serve yet costs its feature (the width table), never the terminal
|
|
63
|
+
const graphemes = (import(graphemesUrl) as Promise<typeof import('@xterm/addon-unicode-graphemes')>).catch(() => null)
|
|
64
|
+
const [x, f, g] = await Promise.all([import(xtermUrl) as Promise<typeof import('@xterm/xterm')>, import(fitUrl) as Promise<typeof import('@xterm/addon-fit')>, graphemes])
|
|
65
|
+
return { Terminal: x.Terminal, FitAddon: f.FitAddon, Graphemes: g?.UnicodeGraphemesAddon ?? null }
|
|
66
|
+
})()
|
|
67
|
+
// a load that failed is tried again at the next open
|
|
68
|
+
lib.catch(() => { lib = null })
|
|
69
|
+
return lib
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** the urls printed as text are links of `term`; `activate`: his click on one. xterm keeps the links of the row under
|
|
73
|
+
* the mouse until the mouse leaves that row, whatever a program writes there since: after each write its own flag
|
|
74
|
+
* for a resize makes the next move read the row again (a private field of xterm 6.0.0: the `links` case of
|
|
75
|
+
* terminal:check fails the day it no longer does) */
|
|
76
|
+
export function textLinks(term: Terminal, activate: (e: MouseEvent, url: string) => void): void {
|
|
77
|
+
term.registerLinkProvider({ provideLinks: (y, done) => done(rowLinks(term, y - 1, activate)) })
|
|
78
|
+
term.onWriteParsed(() => {
|
|
79
|
+
const core: unknown = Reflect.get(term, '_core')
|
|
80
|
+
const linkifier: unknown = typeof core === 'object' && core != null && 'linkifier' in core ? core.linkifier : null
|
|
81
|
+
if (typeof linkifier === 'object' && linkifier != null && '_wasResized' in linkifier) linkifier._wasResized = true
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** the urls printed as text on a row of the screen (terminal-links.ts), as xterm's links */
|
|
86
|
+
function rowLinks(term: Terminal, y: number, activate: (e: MouseEvent, url: string) => void): ILink[] {
|
|
87
|
+
const buf = term.buffer.active
|
|
88
|
+
// the rows around it that one url may be wrapped over: a screen's height at most
|
|
89
|
+
const first = Math.max(0, y - term.rows)
|
|
90
|
+
const rows: ScreenRow[] = []
|
|
91
|
+
for (let r = first; r < Math.min(buf.length, y + term.rows); r++) {
|
|
92
|
+
const line = buf.getLine(r)
|
|
93
|
+
const row: ScreenRow = { text: '', cells: [] }
|
|
94
|
+
for (let x = 0; line != null && x < term.cols; x++) {
|
|
95
|
+
const cell = line.getCell(x)
|
|
96
|
+
if (cell == null || cell.getWidth() === 0) continue
|
|
97
|
+
const chars = cell.getChars() || ' '
|
|
98
|
+
row.text += chars
|
|
99
|
+
for (let i = 0; i < chars.length; i++) row.cells.push(x)
|
|
100
|
+
}
|
|
101
|
+
row.text = row.text.replace(/ +$/, '')
|
|
102
|
+
row.cells.length = row.text.length
|
|
103
|
+
rows.push(row)
|
|
104
|
+
}
|
|
105
|
+
return linksOnRow(rows, y - first, term.cols).map((l) => ({
|
|
106
|
+
text: l.url,
|
|
107
|
+
range: { start: { x: l.from.cell + 1, y: first + l.from.row + 1 }, end: { x: l.to.cell + 1, y: first + l.to.row + 1 } },
|
|
108
|
+
activate,
|
|
109
|
+
}))
|
|
110
|
+
}
|