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,147 @@
|
|
|
1
|
+
// the ONE connection a hub page holds to its server: a WebSocket at GET /api/live. On it the server says what a page
|
|
2
|
+
// never asks for: the lines of its terminals' parts (terminal-route.ts PageFrame) and the notices of the stores
|
|
3
|
+
// (review/push.ts); and the page says what he types into a terminal. Why a WebSocket: a browser gives a host six HTTP
|
|
4
|
+
// connections for ALL its tabs. A page held two long requests at rest (its terminals' stream, the push stream), so
|
|
5
|
+
// three hub tabs filled the six and no key, act or page read of any tab left the browser (measured: no answer in 8 s).
|
|
6
|
+
// A WebSocket is none of the six, and a browser allows hundreds a host.
|
|
7
|
+
// The one constraint a reader breaks first: a WebSocket is not bound by the same origin policy, so a page of any site
|
|
8
|
+
// can open one to localhost, and a program of this Mac too. What he types on it is a word as the owner, so the upgrade
|
|
9
|
+
// is taken from a page of the hub in a browser alone, by the gate on the owner's acts that every loopbackServe runs
|
|
10
|
+
// before its fetch (http/owner-word.ts PAGE_SOCKET): a server that mounts this socket is opened through
|
|
11
|
+
// loopbackServe, never beside it. What types into a terminal passes the terminal's own gate at the upgrade on top
|
|
12
|
+
import type { PageNotice } from '../home/page-build.ts'
|
|
13
|
+
import { PAGE_SOCKET } from '../http/owner-word.ts'
|
|
14
|
+
import { PUSH_CLOSED_RETRY_MS, type ThreadPush } from '../review/push.ts'
|
|
15
|
+
import { terminalRefusal } from './terminal-guard.ts'
|
|
16
|
+
import { type PageFrame, pageOpen, PAGES_MAX, type PageSend, pageTake } from './terminal-route.ts'
|
|
17
|
+
|
|
18
|
+
export const LIVE_PATH = '/api/live'
|
|
19
|
+
/** the socket's address as a page behind the web names it: the home's own, or under a repo's base (one repo's page
|
|
20
|
+
* alone in another tool's frame, `/r/<repo>/embed/`). Both are the daemon's one socket: its notices name their repo */
|
|
21
|
+
export const livePath = (path: string): boolean => PAGE_SOCKET.test(path)
|
|
22
|
+
/** the web's word to the daemon, on a socket it brings: why that socket may not reach a terminal. The web is the hop
|
|
23
|
+
* that sees the browser's peer and headers; a client's own tag can only take the terminal away from itself */
|
|
24
|
+
export const NO_TERMINAL_HEADER = 'x-shipkit-no-terminal'
|
|
25
|
+
/** a page's build as a frame of its socket: the server that builds the page says each build (page-build.ts) */
|
|
26
|
+
export const pageFrame = (n: PageNotice): string => JSON.stringify({ p: 'page', d: JSON.stringify(n) } satisfies LiveFrame)
|
|
27
|
+
/** a server with no store notices (a stand in) says the beat they would say (review/push.ts PUSH_BEAT_MS): a page
|
|
28
|
+
* finds a dead socket by its silence */
|
|
29
|
+
export const LIVE_BEAT_MS = 5_000
|
|
30
|
+
|
|
31
|
+
/** one frame of a page's socket: a frame of its terminals, or a notice of the stores by its event's name (`hello`,
|
|
32
|
+
* `beat`, `src`, `page`, `closed`; `message`: a store's own notice) with its data as json text */
|
|
33
|
+
export type LiveFrame = PageFrame | { p: string; d: string }
|
|
34
|
+
|
|
35
|
+
/** what a server keeps for one socket. `refusal`: why this socket may not reach a terminal (another machine, the
|
|
36
|
+
* tailnet), null when it may */
|
|
37
|
+
export type Live = { refusal: string | null; /** a hop's one repo (hq/terminal-hop.ts): its parts are of that repo alone, and it hears no store */ scope: string | null; /** a hop's judge, run again while it is open, and when it last said yes */ judge: (() => string | null) | null; judged: number; page: { id: string; end(): void } | null; off: (() => void) | null; beat: ReturnType<typeof setInterval> | null }
|
|
38
|
+
|
|
39
|
+
type Sock = { data: Live; send(text: string): number; close(code?: number, reason?: string): void }
|
|
40
|
+
|
|
41
|
+
export type LiveDeps = {
|
|
42
|
+
/** the store notices of this server, null where it has none (a stand in) */
|
|
43
|
+
push: () => Pick<ThreadPush, 'attach'> | null
|
|
44
|
+
/** the page this server builds itself (a hub of its own): its builds are said on the socket too. Behind the web,
|
|
45
|
+
* the web says them (serve-web.ts) */
|
|
46
|
+
page?: () => { readonly notice: PageNotice | null; on(fn: (n: PageNotice) => void): () => void } | null
|
|
47
|
+
/** a socket the web brought as a terminal hop of the hq Mac's page (hq/terminal-hop.ts hopOfSocket): why it may
|
|
48
|
+
* not reach a terminal and the repo it is bound to; null for any other socket. Absent: no hop is taken */
|
|
49
|
+
hop?: (req: Request) => { refusal: string | null; scope: string; judge: () => string | null } | null
|
|
50
|
+
/** how old a hop's last yes may be when a keystroke comes on it: HOP_RECHECK_MS (a test: 0, each keystroke) */
|
|
51
|
+
hopRecheckMs?: number
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** a keystroke on a hop is typed on a yes at most this old: the switch turned off or the key forgotten stops it within
|
|
55
|
+
* a second, and the beat closes the hop that types nothing */
|
|
56
|
+
export const HOP_RECHECK_MS = 1_000
|
|
57
|
+
|
|
58
|
+
/** the socket's two halves for a server: `upgrade` in its fetch for GET /api/live, `websocket` its handler */
|
|
59
|
+
export function liveSockets(d: LiveDeps) {
|
|
60
|
+
/** a frame that could not be said ends the socket: a page that missed a line of a terminal, or a notice, would
|
|
61
|
+
* show a screen that is not the terminal's and call it live. Closed, it opens another and reads everything again */
|
|
62
|
+
const say = (ws: Sock, f: LiveFrame): boolean => {
|
|
63
|
+
let sent = false
|
|
64
|
+
try {
|
|
65
|
+
// -1: the frame waits in the socket's buffer, which is no loss; 0: dropped, or the socket is gone
|
|
66
|
+
sent = ws.send(JSON.stringify(f)) !== 0
|
|
67
|
+
} catch { /* said below */ }
|
|
68
|
+
if (!sent) {
|
|
69
|
+
try { ws.close(1011, 'a frame could not be sent') } catch { /* closed already */ }
|
|
70
|
+
}
|
|
71
|
+
return sent
|
|
72
|
+
}
|
|
73
|
+
/** a hop still may type: its judge says yes, or said it less than `within` ms ago. On a no it closes, and every
|
|
74
|
+
* part of it ends with it */
|
|
75
|
+
const stillHop = (ws: Sock, within: number): boolean => {
|
|
76
|
+
const judge = ws.data.judge
|
|
77
|
+
if (judge == null) return true
|
|
78
|
+
const now = Date.now()
|
|
79
|
+
if (now - ws.data.judged < within) return true
|
|
80
|
+
const why = judge()
|
|
81
|
+
if (why == null) return (ws.data.judged = now, true)
|
|
82
|
+
// a no stays a no: its parts end now, before the socket's own close comes
|
|
83
|
+
ws.data.judge = () => why
|
|
84
|
+
ws.data.judged = Number.NEGATIVE_INFINITY
|
|
85
|
+
ws.data.page?.end()
|
|
86
|
+
try { ws.close(1008, why.slice(0, 120)) } catch { /* closed already */ }
|
|
87
|
+
return false
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
/** the request upgraded: undefined once it is a socket, else the answer */
|
|
91
|
+
upgrade(req: Request, srv: { requestIP(r: Request): { address: string } | null; upgrade(r: Request, o: { data: Live }): boolean }): Response | undefined {
|
|
92
|
+
const hop = d.hop?.(req) ?? null
|
|
93
|
+
// a hop is a socket for a terminal or nothing: refused, it hears no store either
|
|
94
|
+
if (hop?.refusal != null) return new Response(`refused: ${hop.refusal}`, { status: 403, headers: { 'cache-control': 'no-store' } })
|
|
95
|
+
const refusal = hop != null ? null : (req.headers.get(NO_TERMINAL_HEADER) ?? terminalRefusal(req, srv.requestIP(req)?.address ?? null, 'the terminal', { socket: true }))
|
|
96
|
+
if (srv.upgrade(req, { data: { refusal, scope: hop?.scope ?? null, judge: hop?.judge ?? null, judged: Date.now(), page: null, off: null, beat: null } })) return undefined
|
|
97
|
+
return new Response('this address answers a WebSocket only', { status: 426, headers: { upgrade: 'websocket', 'cache-control': 'no-store' } })
|
|
98
|
+
},
|
|
99
|
+
websocket: {
|
|
100
|
+
open(ws: Sock): void {
|
|
101
|
+
// a socket that may not reach a terminal still hears the stores (his phone): it is given no id, so no
|
|
102
|
+
// part can be asked on it
|
|
103
|
+
if (ws.data.refusal == null) {
|
|
104
|
+
ws.data.page = pageOpen((f) => void say(ws, f), () => {
|
|
105
|
+
// said as the stores' cap says it (review/push.ts): the page waits before it opens another
|
|
106
|
+
say(ws, { p: 'closed', d: JSON.stringify({ why: `more than ${PAGES_MAX} pages hold a socket on this server: the oldest closed`, retryMs: PUSH_CLOSED_RETRY_MS }) })
|
|
107
|
+
ws.close(1000, 'too many pages')
|
|
108
|
+
}, ws.data.scope)
|
|
109
|
+
}
|
|
110
|
+
else say(ws, { t: 'hello', id: '' })
|
|
111
|
+
// a hop carries terminals and nothing else of this machine: its beat, never a notice of a store
|
|
112
|
+
if (ws.data.scope != null) {
|
|
113
|
+
ws.data.beat = setInterval(() => void (stillHop(ws, 0) && say(ws, { p: 'beat', d: '{}' })), LIVE_BEAT_MS)
|
|
114
|
+
return
|
|
115
|
+
}
|
|
116
|
+
const push = d.push()
|
|
117
|
+
if (push != null) ws.data.off = push.attach((event, data) => say(ws, { p: event ?? 'message', d: JSON.stringify(data) }), () => ws.close(1000, 'the server closed this stream'))
|
|
118
|
+
else ws.data.beat = setInterval(() => void say(ws, { p: 'beat', d: '{}' }), LIVE_BEAT_MS)
|
|
119
|
+
const page = d.page?.()
|
|
120
|
+
if (page == null) return
|
|
121
|
+
// after the hello: the page knows the socket is up before it hears the build
|
|
122
|
+
if (page.notice != null) ws.send(pageFrame(page.notice))
|
|
123
|
+
const offPush = ws.data.off
|
|
124
|
+
const offPage = page.on((n) => void ws.send(pageFrame(n)))
|
|
125
|
+
ws.data.off = () => (offPush?.(), offPage())
|
|
126
|
+
},
|
|
127
|
+
message(ws: Sock, m: string | Buffer): void {
|
|
128
|
+
const page = ws.data.page
|
|
129
|
+
if (page == null || typeof m !== 'string') return
|
|
130
|
+
if (!stillHop(ws, d.hopRecheckMs ?? HOP_RECHECK_MS)) return
|
|
131
|
+
let b: unknown
|
|
132
|
+
try {
|
|
133
|
+
b = JSON.parse(m)
|
|
134
|
+
} catch {
|
|
135
|
+
return
|
|
136
|
+
}
|
|
137
|
+
if (b != null && typeof b === 'object') pageTake(page.id, b as PageSend)
|
|
138
|
+
},
|
|
139
|
+
close(ws: Sock): void {
|
|
140
|
+
ws.data.page?.end()
|
|
141
|
+
ws.data.off?.()
|
|
142
|
+
if (ws.data.beat != null) clearInterval(ws.data.beat)
|
|
143
|
+
ws.data.page = ws.data.off = ws.data.beat = null
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -21,9 +21,11 @@ import {
|
|
|
21
21
|
recordOf, recordStamp, RELEASE_TAGS, renderOrder, versionOf, vscodeStoragePath, type CheckState, type Gate, type LastRow, type WiredRepo,
|
|
22
22
|
} from '../house/project-gutter.ts'
|
|
23
23
|
import { readLastStatusReadonly } from '../ledger/run-log.ts'
|
|
24
|
+
import { fileURLToPath } from 'url'
|
|
25
|
+
import { guiColorOf } from '../core/repo-gui-color.ts'
|
|
24
26
|
import { identityOfText, identityProblem, type Identity } from '../core/identity-color.ts'
|
|
25
27
|
import { writeIdentity } from '../core/identity.ts'
|
|
26
|
-
import { appIconOf, appIconPngs, identityOfRoot } from '../core/app-icon.ts'
|
|
28
|
+
import { appIconOf, appIconPngs, frameOfRoot, identityOfRoot } from '../core/app-icon.ts'
|
|
27
29
|
import { waitingThreads } from '../collections/review.ts'
|
|
28
30
|
import { voicesWaiting } from '../review/trailer-voices.ts'
|
|
29
31
|
import { storeDir, warmStore } from '../review/store.ts'
|
|
@@ -112,6 +114,9 @@ export type ProjectRow = {
|
|
|
112
114
|
identity: Identity | null
|
|
113
115
|
/** the identity it speaks as (wiki tools/shipkit/social.md): its `speaksAs`, else the default; null when none holds it */
|
|
114
116
|
speaksAs: string | null
|
|
117
|
+
/** its window colour, #rrggbb (core/repo-gui-color.ts guiColorOf: its `guiColor`, else Peacock's, else its name's): its
|
|
118
|
+
* app's chrome and its rail tile */
|
|
119
|
+
guiColor: string
|
|
115
120
|
/** its app icon cropped to the plate (core/app-icon.ts), what the folded rail draws; null with no mark */
|
|
116
121
|
appIcon: string | null
|
|
117
122
|
/** epoch ms of the newest of: the last commit, the last shipkit run, the
|
|
@@ -146,6 +151,10 @@ export type GutterDeps = {
|
|
|
146
151
|
open?: (path: string) => void
|
|
147
152
|
/** opens a folder in Fork, the git client; throws with the reason it could not */
|
|
148
153
|
fork?: (path: string) => void
|
|
154
|
+
/** opens a repo's own macOS app, built first when missing, `hub` on its hub tab; rejects with the reason it could not */
|
|
155
|
+
openApp?: (r: { name: string; path: string }, hub: boolean) => Promise<void>
|
|
156
|
+
/** a page was asked of that repo's own app: said to the open pages, so its window takes it at once */
|
|
157
|
+
asked?: (repo: string) => void
|
|
149
158
|
warn?: (line: string) => void
|
|
150
159
|
now?: () => number
|
|
151
160
|
/** where the rail order lives, default orderFile(home) */
|
|
@@ -166,6 +175,25 @@ const runCmd: Run = async (cmd, cwd) => {
|
|
|
166
175
|
return { code: await p.exited, out }
|
|
167
176
|
}
|
|
168
177
|
|
|
178
|
+
/** a repo's own app (home/open-app.ts --project), in its own short process so this one never loads the app build.
|
|
179
|
+
* `hub`: the app shows its hub tab, where the page asked of it is drawn */
|
|
180
|
+
export async function openAsApp(r: { name: string; path: string }, hub = false): Promise<void> {
|
|
181
|
+
const script = fileURLToPath(new URL('../home/open-app.ts', import.meta.url))
|
|
182
|
+
const p = Bun.spawn([process.execPath, script, '--project', JSON.stringify({ name: r.name, root: r.path, ...(hub ? { hub } : {}) })], { stdout: 'ignore', stderr: 'pipe' })
|
|
183
|
+
if ((await p.exited) !== 0) throw new Error((await new Response(p.stderr).text()).trim() || `the app of ${r.name} did not open`)
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** a page asked of a repo's own app waits this long for a window of it: an app built first takes about a minute */
|
|
187
|
+
export const ASKED_PAGE_MS = 120_000
|
|
188
|
+
|
|
189
|
+
/** `page` as an address of that repo's own hub (`/r/<repo>/`, its search, its hash), or null: never another site,
|
|
190
|
+
* another repo or a page of the home */
|
|
191
|
+
export function ownPage(repo: string, page: unknown): string | null {
|
|
192
|
+
if (typeof page !== 'string' || !page.startsWith('/') || page.startsWith('//') || page.includes('\\')) return null
|
|
193
|
+
const u = new URL(page, 'http://hub.invalid')
|
|
194
|
+
return u.origin === 'http://hub.invalid' && u.pathname === `/r/${encodeURIComponent(repo)}/` ? `${u.pathname}${u.search}${u.hash}` : null
|
|
195
|
+
}
|
|
196
|
+
|
|
169
197
|
export function openInCode(path: string): void {
|
|
170
198
|
const code = Bun.which('code')
|
|
171
199
|
if (code != null) {
|
|
@@ -246,6 +274,8 @@ export function projectGutter(d: GutterDeps) {
|
|
|
246
274
|
let folders: { mtime: number; list: string[] } | null = null
|
|
247
275
|
const releases = new Map<string, { stamp: string | null; at: number; release: Release; commitAt: number | null; dirty: number | null }>()
|
|
248
276
|
const records = new Map<string, { stamp: string; rows: LastRow[] }>()
|
|
277
|
+
/** the page a jump asked a repo's own app to show, until that app's window takes it */
|
|
278
|
+
const asked = new Map<string, { page: string; at: number }>()
|
|
249
279
|
/** a repo's last gate and check colour, its record opened only when it
|
|
250
280
|
* moved, counted over the checks it declares today */
|
|
251
281
|
const gateOfRepo = (r: WiredRepo): { gate: Gate; checks: CheckState } => {
|
|
@@ -427,6 +457,7 @@ export function projectGutter(d: GutterDeps) {
|
|
|
427
457
|
live: liveUrlOf(config),
|
|
428
458
|
identity,
|
|
429
459
|
speaksAs: speakerIdOf(speaksAsOfText(config), ids),
|
|
460
|
+
guiColor: guiColorOf(r.path, r.name).color,
|
|
430
461
|
appIcon,
|
|
431
462
|
activity: lastActivity(facts[i]!.commitAt, lastRunAt(r.path), transcripts.get(r.path)),
|
|
432
463
|
commit: facts[i]!.commitAt,
|
|
@@ -511,7 +542,8 @@ export function projectGutter(d: GutterDeps) {
|
|
|
511
542
|
}
|
|
512
543
|
return new Response(new Uint8Array(await png), { headers: { 'content-type': 'image/png', 'cache-control': 'max-age=86400' } })
|
|
513
544
|
}
|
|
514
|
-
|
|
545
|
+
// the rim the repo's app wears, none for a mark with its own frame
|
|
546
|
+
const [png] = await appIconPngs(await readFile(icon), id, [PREVIEW_PX], 'canvas', { frame: frameOfRoot(r.path) })
|
|
515
547
|
return new Response(new Uint8Array(png!), { headers: { 'content-type': 'image/png', 'cache-control': 'max-age=60' } })
|
|
516
548
|
} catch (e) {
|
|
517
549
|
return new Response(`could not draw the icon from ${icon}: ${(e as Error).message}`, { status: 422 })
|
|
@@ -572,6 +604,35 @@ export function projectGutter(d: GutterDeps) {
|
|
|
572
604
|
}
|
|
573
605
|
return Response.json({ ok: true })
|
|
574
606
|
}
|
|
607
|
+
// a repo's own app: built when missing, a running one brought to the front (the home's row, a jump in a project
|
|
608
|
+
// app). `page`: the page of that repo to show there, kept until its window takes it (asked-page below)
|
|
609
|
+
if (path === '/api/projects/open-app' && req.method === 'POST') {
|
|
610
|
+
if (repos.length === 0) await answer()
|
|
611
|
+
const b = (await req.json().catch(() => ({}))) as { name?: string; page?: unknown }
|
|
612
|
+
const r = find(b.name ?? '')
|
|
613
|
+
if (r == null) return new Response(`not a wired repo: ${b.name ?? ''}`, { status: 404 })
|
|
614
|
+
if (b.page != null) {
|
|
615
|
+
const page = ownPage(r.name, b.page)
|
|
616
|
+
if (page == null) return new Response(`not a page of ${r.name}: ${String(b.page)}`, { status: 400 })
|
|
617
|
+
asked.set(r.name, { page, at: now() })
|
|
618
|
+
// a window already open goes there now, while its app comes forward
|
|
619
|
+
d.asked?.(r.name)
|
|
620
|
+
}
|
|
621
|
+
try {
|
|
622
|
+
await (d.openApp ?? openAsApp)(r, b.page != null)
|
|
623
|
+
} catch (e) {
|
|
624
|
+
asked.delete(r.name)
|
|
625
|
+
return new Response((e as Error).message, { status: 400 })
|
|
626
|
+
}
|
|
627
|
+
return Response.json({ ok: true })
|
|
628
|
+
}
|
|
629
|
+
// a project's window takes the page asked of it, once: the first window that asks goes there
|
|
630
|
+
if (path === '/api/projects/asked-page' && req.method === 'POST') {
|
|
631
|
+
const b = (await req.json().catch(() => ({}))) as { name?: string }
|
|
632
|
+
const a = asked.get(b.name ?? '')
|
|
633
|
+
asked.delete(b.name ?? '')
|
|
634
|
+
return Response.json({ page: a != null && now() - a.at <= ASKED_PAGE_MS ? a.page : null })
|
|
635
|
+
}
|
|
575
636
|
if (path === '/api/projects/open' && req.method === 'POST') {
|
|
576
637
|
if (repos.length === 0) await answer()
|
|
577
638
|
const b = (await req.json().catch(() => ({}))) as { name?: string }
|
package/src/serve/read-worker.ts
CHANGED
|
@@ -7,11 +7,16 @@ import { loadKit, type ResolvedKit } from '../assets/kit-config.ts'
|
|
|
7
7
|
import { scanComfyWorkflows } from '../comfy/comfy-panel.ts'
|
|
8
8
|
import { loadRepoConfig, type RepoConfig } from '../repo-config.ts'
|
|
9
9
|
import { computeRows, configStamp, graphMounts, hubCollections } from './hub-collections.ts'
|
|
10
|
-
import {
|
|
10
|
+
import { hubParties } from '../orchestrator/places.ts'
|
|
11
|
+
import { installOneLib } from '../core/one-lib.ts'
|
|
11
12
|
import type { ReadAsk, ReadReply } from './read-thread.ts'
|
|
12
13
|
|
|
13
14
|
declare const self: Worker
|
|
14
15
|
|
|
16
|
+
// a thread never inherits its process's resolver hook: without its own, a repo config here resolves the lib through
|
|
17
|
+
// the repo's node_modules, and a repo with no install fails to load
|
|
18
|
+
installOneLib()
|
|
19
|
+
|
|
15
20
|
type Repo = { stamp: string; c: RepoConfig; kit: ResolvedKit | null; comfy: boolean }
|
|
16
21
|
const repos = new Map<string, Repo>()
|
|
17
22
|
|
|
@@ -40,7 +45,7 @@ async function repoAt(root: string, reset: boolean): Promise<Repo> {
|
|
|
40
45
|
|
|
41
46
|
async function answer(a: ReadAsk): Promise<ReadReply> {
|
|
42
47
|
try {
|
|
43
|
-
if (a.kind === 'parties') return { id: a.id, answer: await
|
|
48
|
+
if (a.kind === 'parties') return { id: a.id, answer: await hubParties(a.dir) }
|
|
44
49
|
const r = await repoAt(a.root, a.reset)
|
|
45
50
|
return { id: a.id, answer: await computeRows(hubCollections(a.root, r.c, r.kit, graphMounts(a.root, r.c), r.comfy)) }
|
|
46
51
|
} catch (e) {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// what a hub says of its runs on the push stream (review/push.ts, the `runs` source): every open page reads
|
|
2
|
+
// house-runs.json when it moves, so it moves on what a page draws anew, a run or a check that starts or ends.
|
|
3
|
+
// the one constraint a reader breaks first: the record's file is no such stamp. A run in flight writes its heartbeat
|
|
4
|
+
// every few seconds and a test run a row a file, so the file moves about once a second while a gate runs
|
|
5
|
+
import { recordStamp } from '../house/project-gutter.ts'
|
|
6
|
+
import { readTransitionsReadonly } from '../ledger/run-log.ts'
|
|
7
|
+
|
|
8
|
+
/** while the stamp holds a run in flight, how often its writer is looked at with no move of the file to say so */
|
|
9
|
+
export const RUN_ALIVE_MS = 2_000
|
|
10
|
+
|
|
11
|
+
/** the `runs` stamp of the record at `path`, '' when the repo keeps none. The record is opened only when its file
|
|
12
|
+
* moved, and a record busy at that moment is read at the next tick. A run in flight whose process is killed writes
|
|
13
|
+
* nothing more, so while one flies the record is also read every RUN_ALIVE_MS: the stamp then says it is gone, and
|
|
14
|
+
* no page has to ask on a timer */
|
|
15
|
+
export function runsPushStamp(path: string, o: { now?: () => number; alive?: (pid: number) => boolean } = {}): () => string {
|
|
16
|
+
let file = ''
|
|
17
|
+
let said = ''
|
|
18
|
+
let readAt = 0
|
|
19
|
+
const clock = o.now ?? Date.now
|
|
20
|
+
const flying = (): boolean => /(^|\|)[^|#]*:r:/.test(said.split('#')[0] ?? '')
|
|
21
|
+
return () => {
|
|
22
|
+
if (path === '') return ''
|
|
23
|
+
const now = recordStamp(path)
|
|
24
|
+
const t = clock()
|
|
25
|
+
if (now === file && !(flying() && t - readAt >= RUN_ALIVE_MS)) return said
|
|
26
|
+
const moved = readTransitionsReadonly(path, t, o.alive)
|
|
27
|
+
if (moved === null) return said
|
|
28
|
+
file = now
|
|
29
|
+
said = moved
|
|
30
|
+
readAt = t
|
|
31
|
+
return said
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
// the secrets page's read (the hub's secrets entry): every name the house's registry, the repo's own config and the
|
|
2
|
+
// store know, joined into one view (secrets/secrets-view.ts), and the two routes that answer it:
|
|
3
|
+
// GET /api/secrets.json the view; `?fresh=1` reads the store again past what the daemon keeps
|
|
4
|
+
// GET /api/secrets/one?name=<name> one name's tail and account, read at the click
|
|
5
|
+
// The constraint a reader breaks first: a value is read in this process for its tail alone (secrets/tail.ts maskOf)
|
|
6
|
+
// and never leaves it: no value in an answer, a log or an error, and the tail only past the gate a secret field
|
|
7
|
+
// passes (secret-gate.ts)
|
|
8
|
+
import type { CheckVerdict } from '../collections/providers.ts'
|
|
9
|
+
import { missingFrom, probeOf } from '../collections/providers.ts'
|
|
10
|
+
import type { ScopeHouse } from '../core/scope.ts'
|
|
11
|
+
import { heldOf, type SecretRow as StoreRow } from '../home/vault-words.ts'
|
|
12
|
+
import type { TailnetWho } from '../http/tailnet-caller.ts'
|
|
13
|
+
import { lapsedNameOf } from '../secrets/lapse-mark.ts'
|
|
14
|
+
import type { Cred } from '../secrets/list.ts'
|
|
15
|
+
import { SECRET_NAME } from '../secrets/name.ts'
|
|
16
|
+
import { isTemplate, rowOfName } from '../secrets/name-template.ts'
|
|
17
|
+
import type { Read } from '../secrets/read.ts'
|
|
18
|
+
import type { SecretDetail, SecretRow, SecretState, SecretsView } from '../secrets/secrets-view.ts'
|
|
19
|
+
import { maskOf, maskText } from '../secrets/tail.ts'
|
|
20
|
+
import { secretRefusal } from '../http/secret-gate.ts'
|
|
21
|
+
|
|
22
|
+
/** what the store said of its names (home/vault-page.ts): null when it could not be read at all */
|
|
23
|
+
export type StoreRead = { rows: StoreRow[]; here: boolean; notes: string[] } | null
|
|
24
|
+
|
|
25
|
+
export type ViewInputs = {
|
|
26
|
+
at: number
|
|
27
|
+
repo: string
|
|
28
|
+
house: boolean
|
|
29
|
+
identity: string | null
|
|
30
|
+
machine: string | null
|
|
31
|
+
scopes: ScopeHouse
|
|
32
|
+
/** the house's registry rows, the archived ones included */
|
|
33
|
+
registry: readonly Cred[]
|
|
34
|
+
/** the rows the repo shown declares itself: each wins over a registry row of its name, and is its own by default */
|
|
35
|
+
own: readonly Cred[]
|
|
36
|
+
store: StoreRead
|
|
37
|
+
/** the last runs of the repo's checks: what proves a secret, and what found one missing */
|
|
38
|
+
verdicts: CheckVerdict[]
|
|
39
|
+
setCommand: string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const lists = (c: Cred | undefined): SecretRow['scope'] => ({ repos: c?.for?.repos ?? [], identities: c?.for?.identities ?? [], machines: c?.for?.machines ?? [] })
|
|
43
|
+
|
|
44
|
+
/** the view of one repo, from what was read: pure, so a test feeds it made up rows */
|
|
45
|
+
export function secretsViewOf(i: ViewInputs): SecretsView {
|
|
46
|
+
const rows = new Map<string, Cred>()
|
|
47
|
+
for (const c of i.registry) rows.set(c.name, c)
|
|
48
|
+
if (!i.house) for (const c of i.own) rows.set(c.name, { ...c, for: c.for ?? { repos: [i.repo] } })
|
|
49
|
+
const stored = new Map((i.store?.rows ?? []).map((r) => [r.name, r]))
|
|
50
|
+
const byId = new Map(i.verdicts.map((v) => [v.checkId, v]))
|
|
51
|
+
const proved = missingFrom(i.verdicts)
|
|
52
|
+
const names = [...new Set([...rows.keys(), ...stored.keys()])].filter((n) => !isTemplate(n)).sort()
|
|
53
|
+
const out = names.map((name): SecretRow => {
|
|
54
|
+
const c = rows.get(name) ?? rowOfName([...rows.values()], name)
|
|
55
|
+
const s = stored.get(name)
|
|
56
|
+
const held = s == null || i.store == null ? 'unknown' : heldOf(s, i.store.here)
|
|
57
|
+
const state: SecretState = c?.archived != null ? 'archived' : proved.has(name) ? 'missing' : held === 'vault' || held === 'keychain' ? 'present' : held === 'missing' || held === 'absent' ? 'missing' : 'unread'
|
|
58
|
+
const v = c?.probedBy == null ? null : byId.get(c.probedBy)
|
|
59
|
+
// a check of another repo proves nothing here: said as it is, never as a warning of this repo
|
|
60
|
+
const p = c?.probedBy == null ? null : v == null ? { probe: 'unmeasured' as const, words: `its check ${c.probedBy} does not run in ${i.repo}` } : probeOf(name, c.probedBy, byId, i.at)
|
|
61
|
+
const note = state === 'archived' ? null
|
|
62
|
+
: proved.has(name) ? proved.get(name)!.text
|
|
63
|
+
: held === 'absent' ? 'not in the vault; a copy may sit in this Mac\'s keychain, which the page does not read (sk vault compare)'
|
|
64
|
+
: held === 'unknown' ? (s == null ? 'the store was not read for it' : 'the store was not read')
|
|
65
|
+
: (s?.note ?? null)
|
|
66
|
+
return {
|
|
67
|
+
name,
|
|
68
|
+
service: c?.service ?? s?.for ?? '',
|
|
69
|
+
scope: c != null ? lists(c) : (s?.scope ?? lists(undefined)),
|
|
70
|
+
registered: c != null,
|
|
71
|
+
state,
|
|
72
|
+
level: c == null ? null : (c.level ?? 'used'),
|
|
73
|
+
place: state !== 'present' ? null : held === 'vault' ? 'vault' : 'keychain',
|
|
74
|
+
written: s?.written ?? null,
|
|
75
|
+
version: s?.version ?? null,
|
|
76
|
+
archived: c?.archived ?? null,
|
|
77
|
+
probe: p == null || p.probe === 'none' ? null : { check: c!.probedBy!, verdict: lapsedNameOf(p.words) === name ? 'lapsed' : p.probe, words: p.words },
|
|
78
|
+
refresh: c?.lapses?.refresh ?? null,
|
|
79
|
+
mintUrl: c?.mintUrl ?? null,
|
|
80
|
+
ask: s?.ask ?? null,
|
|
81
|
+
note,
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
return { at: i.at, repo: i.repo, house: i.house, identity: i.identity, machine: i.machine, repos: i.scopes.repos, identities: i.scopes.identities, rows: out, notes: i.store == null ? ['the store could not be read on this machine: sk vault status says why'] : i.store.notes, setCommand: i.setCommand }
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** the page's two reads: a hub of a test passes its own */
|
|
88
|
+
export type SecretsReads = {
|
|
89
|
+
view: (fresh: boolean) => Promise<SecretsView>
|
|
90
|
+
/** one read of a name for the repo shown, as `sk secret tail` makes it; `account` the same of its account */
|
|
91
|
+
read: (name: string, field: 'get' | 'account') => Promise<Read>
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** the reads of this machine for the repo at `root`; `verdicts` the last runs of its checks */
|
|
95
|
+
export function secretsReadsHere(root: string, verdicts: () => Promise<CheckVerdict[]>): SecretsReads {
|
|
96
|
+
return {
|
|
97
|
+
view: async (fresh) => {
|
|
98
|
+
const [{ secretsWhere, managerTemplate }, { scopeHouse }, { houseRootOf }, { vaultDeps, vaultPage }] = await Promise.all([
|
|
99
|
+
import('../secrets/manager.ts'),
|
|
100
|
+
import('../secrets/who-reads.ts'),
|
|
101
|
+
import('../home/home-start.ts'),
|
|
102
|
+
import('../home/vault-page.ts'),
|
|
103
|
+
])
|
|
104
|
+
const w = await secretsWhere(root)
|
|
105
|
+
const houseRoot = houseRootOf(root)
|
|
106
|
+
const registry = w.house?.creds ?? []
|
|
107
|
+
const keys = registry.some((r) => (r.for?.repos ?? []).some((x) => x.includes('/')))
|
|
108
|
+
const [scopes, store, vs] = await Promise.all([
|
|
109
|
+
scopeHouse(root, { keys }).catch((): ScopeHouse => ({ repos: [], identities: [] })),
|
|
110
|
+
vaultDeps(houseRoot, { fresh, seal: 'skip' }).then(vaultPage).then((p): StoreRead => ({ rows: p.secrets, here: p.here, notes: p.notes.filter((n) => n.tone === 'warn' || n.tone === 'danger').map((n) => n.text) }), () => null),
|
|
111
|
+
verdicts().catch(() => []),
|
|
112
|
+
])
|
|
113
|
+
const house = w.own != null && w.house === w.own
|
|
114
|
+
return secretsViewOf({ at: Date.now(), repo: w.repos[0]!, house, identity: w.identity, machine: w.machine ?? null, scopes, registry, own: w.own?.creds ?? [], store, verdicts: vs, setCommand: managerTemplate(w, 'credsCommand') ?? 'sk secret set {name}' })
|
|
115
|
+
},
|
|
116
|
+
read: async (name, field) => (await import('../secrets/read.ts')).readSecretHere({ name, field, cwd: root, say: () => {} }),
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** one read's words with no value in them: a refusal keeps its reason, a miss says it is not held */
|
|
121
|
+
const whyNot = (r: Read): string => ('refused' in r ? r.refused.replace(/^REFUSED\s+/, '') : 'missing' in r ? ('locked' in r && r.locked === true ? 'this Mac\'s keychain is locked to this session' : 'no value is held on this machine') : '')
|
|
122
|
+
|
|
123
|
+
/** one name's tail and account: the value is read here and only its mask leaves */
|
|
124
|
+
export async function secretDetail(reads: SecretsReads, name: string): Promise<SecretDetail> {
|
|
125
|
+
const [r, a] = await Promise.all([reads.read(name, 'get'), reads.read(name, 'account').catch((): Read => ({ missing: '' }))])
|
|
126
|
+
const account = 'value' in a && a.value !== '' ? a.value : null
|
|
127
|
+
if (!('value' in r)) return { name, tail: null, account, from: null, why: whyNot(r) }
|
|
128
|
+
return { name, tail: maskText(maskOf(r.value)), account, from: r.from, why: null }
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const NO_STORE = { 'cache-control': 'no-store' }
|
|
132
|
+
|
|
133
|
+
/** the secrets routes of one repo's hub; null for any other path */
|
|
134
|
+
export async function secretsRoutes(req: Request, path: string, reads: SecretsReads, o: { who?: TailnetWho } = {}): Promise<Response | null> {
|
|
135
|
+
if (req.method !== 'GET') return null
|
|
136
|
+
if (path === '/api/secrets.json') {
|
|
137
|
+
try {
|
|
138
|
+
return Response.json(await reads.view(new URL(req.url).searchParams.get('fresh') === '1'), { headers: NO_STORE })
|
|
139
|
+
} catch {
|
|
140
|
+
// our own words, never the error's: it may quote what it read
|
|
141
|
+
return Response.json({ error: 'the secrets of this repo could not be read: sk secret list says why' }, { status: 503, headers: NO_STORE })
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (path === '/api/secrets/one') {
|
|
145
|
+
const name = new URL(req.url).searchParams.get('name') ?? ''
|
|
146
|
+
if (!SECRET_NAME.test(name)) return Response.json({ error: 'one secret is named: ?name=<secret name>' }, { status: 400, headers: NO_STORE })
|
|
147
|
+
const refused = await secretRefusal(req, o)
|
|
148
|
+
if (refused != null) return Response.json({ name, tail: null, account: null, from: null, why: refused } satisfies SecretDetail, { headers: NO_STORE })
|
|
149
|
+
try {
|
|
150
|
+
return Response.json(await secretDetail(reads, name), { headers: NO_STORE })
|
|
151
|
+
} catch {
|
|
152
|
+
return Response.json({ name, tail: null, account: null, from: null, why: 'it could not be read: sk secret tail says why' } satisfies SecretDetail, { headers: NO_STORE })
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return null
|
|
156
|
+
}
|