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,87 @@
|
|
|
1
|
+
// `foreign: true` in repo.config.ts (wiki tools/shipkit/home-pages.md, Foreign): the tree is not the owner's to publish, a
|
|
2
|
+
// company's or a client's repo where others commit. Nothing of it leaves this Mac through shipkit: no push, no release,
|
|
3
|
+
// nothing to the Space, nothing to the hq. Its hub, processes, urls, threads and orchestrator stay, all local. Read as
|
|
4
|
+
// TEXT like `archived` (core/archived.ts): the daemon and the cross repo passes read many configs per look.
|
|
5
|
+
// Its own tree stays the team's too: no git hook armed, no write by a check outside what git ignores, no suite
|
|
6
|
+
// of the team run from the daemon on a save (the readers: hooks/run-hooks.ts, core/check-ctx.ts, gate/run-fix.ts,
|
|
7
|
+
// gate/gate-checks.ts).
|
|
8
|
+
// The one constraint a reader breaks first: such a repo keeps its config out of git, so a linked worktree of it holds
|
|
9
|
+
// none, and its main checkout answers for it
|
|
10
|
+
import { lstatSync, readFileSync } from 'fs'
|
|
11
|
+
import { dirname, join, resolve, sep } from 'path'
|
|
12
|
+
import { flagOfText } from './archived.ts'
|
|
13
|
+
import { gitBin } from './git-bin.ts'
|
|
14
|
+
|
|
15
|
+
/** the words every refusal carries after its own verb */
|
|
16
|
+
export const FOREIGN_WHY = 'foreign: true in its repo.config.ts, nothing of it leaves this Mac through shipkit'
|
|
17
|
+
|
|
18
|
+
/** does the config text mark the repo foreign */
|
|
19
|
+
export const foreignOfText = (text: string): boolean => flagOfText(text, 'foreign')
|
|
20
|
+
|
|
21
|
+
const configText = (root: string): string | null => {
|
|
22
|
+
try {
|
|
23
|
+
return readFileSync(join(root, 'repo.config.ts'), 'utf8')
|
|
24
|
+
} catch {
|
|
25
|
+
return null
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** the main checkout of a work tree root: itself, or for a linked worktree (its `.git` a file naming
|
|
30
|
+
* `<main>/.git/worktrees/<name>`) that main. Two reads, no git */
|
|
31
|
+
export function mainCheckoutOf(root: string): string {
|
|
32
|
+
try {
|
|
33
|
+
if (!lstatSync(join(root, '.git')).isFile()) return root
|
|
34
|
+
const dir = /^gitdir:\s*(.+)$/m.exec(readFileSync(join(root, '.git'), 'utf8'))?.[1]?.trim()
|
|
35
|
+
if (dir == null) return root
|
|
36
|
+
const abs = resolve(root, dir)
|
|
37
|
+
const at = abs.lastIndexOf(`${sep}.git${sep}worktrees${sep}`)
|
|
38
|
+
return at === -1 ? root : abs.slice(0, at)
|
|
39
|
+
} catch {
|
|
40
|
+
return root
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** is the repo at `root` foreign: its own config says so, or, with none, its main checkout's */
|
|
45
|
+
export function isForeign(root: string): boolean {
|
|
46
|
+
const own = configText(root)
|
|
47
|
+
if (own != null) return foreignOfText(own)
|
|
48
|
+
const main = mainCheckoutOf(root)
|
|
49
|
+
const text = main === root ? null : configText(main)
|
|
50
|
+
return text != null && foreignOfText(text)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** what `sk ci` and `sk hooks list` say of a foreign repo's commit gates: shipkit arms none, `core.hooksPath` stays */
|
|
54
|
+
export const FOREIGN_HOOKS = "hooks: the team's (foreign), core.hooksPath left as it is"
|
|
55
|
+
|
|
56
|
+
/** a write, a process or a git verb that a foreign repo refused before it ran. The fix pass and the check
|
|
57
|
+
* runner know it by name and print its message as a skip line, never as a broken body */
|
|
58
|
+
export class ForeignRefused extends Error {
|
|
59
|
+
override name = 'ForeignRefused'
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** null when `rel` (repo relative) is a path the team's git never sees, ignored by `.gitignore` or
|
|
63
|
+
* `.git/info/exclude`, else why a write there is refused. A tracked file is never ignored, whatever matches it.
|
|
64
|
+
* One `git check-ignore` spawn; an answer git cannot give refuses */
|
|
65
|
+
export function teamPathRefusal(root: string, rel: string): string | null {
|
|
66
|
+
const p = Bun.spawnSync([gitBin(), 'check-ignore', '-q', '--', rel], { cwd: root, stdout: 'ignore', stderr: 'pipe' })
|
|
67
|
+
if (p.exitCode === 0) return null
|
|
68
|
+
if (p.exitCode === 1) return `${rel} is a path the team's git sees (not ignored, not in .git/info/exclude)`
|
|
69
|
+
return `git cannot say whether ${rel} is ignored (${p.stderr.toString().trim().split('\n')[0]?.slice(0, 120) ?? `exit ${p.exitCode}`})`
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** the main checkout of the foreign repo that holds `path`, or null: the nearest folder with a `.git` decides */
|
|
73
|
+
export function foreignRepoOf(path: string): string | null {
|
|
74
|
+
let dir = resolve(path)
|
|
75
|
+
for (;;) {
|
|
76
|
+
let st: ReturnType<typeof lstatSync> | undefined
|
|
77
|
+
try {
|
|
78
|
+
st = lstatSync(join(dir, '.git'))
|
|
79
|
+
} catch {
|
|
80
|
+
st = undefined
|
|
81
|
+
}
|
|
82
|
+
if (st != null) return isForeign(dir) ? mainCheckoutOf(dir) : null
|
|
83
|
+
const up = dirname(dir)
|
|
84
|
+
if (up === dir) return null
|
|
85
|
+
dir = up
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// a repo's window colour, as Peacock tints its VSCode window: the chrome of
|
|
2
|
+
// its app (title bar, tab bar), its rail tile in the hub, the plate of its
|
|
3
|
+
// letter icon. One answer for every surface: the repo config's `guiColor`,
|
|
4
|
+
// else its `.vscode/settings.json` `peacock.color`, else a dark tone hashed
|
|
5
|
+
// from its name.
|
|
6
|
+
//
|
|
7
|
+
// the one constraint a reader breaks first: no fs here, the hub's browser
|
|
8
|
+
// bundle imports it (textOn); the files are read by core/repo-gui-color.ts,
|
|
9
|
+
// as text, never by loading the config: the hub reads every repo's colour on
|
|
10
|
+
// each poll
|
|
11
|
+
import { configDepths, hslHex, nameHue } from './identity-color.ts'
|
|
12
|
+
|
|
13
|
+
export type GuiColorSource = 'config' | 'peacock' | 'name'
|
|
14
|
+
/** the colour and where it came from; `problem`: a declared `guiColor` that is no colour, so the next source answered,
|
|
15
|
+
* and the app build fails on it with that line */
|
|
16
|
+
export type GuiColor = { color: string; source: GuiColorSource; problem?: string }
|
|
17
|
+
|
|
18
|
+
const HEX6 = /^#[0-9a-fA-F]{6}$/
|
|
19
|
+
const HEX3 = /^#[0-9a-fA-F]{3}$/
|
|
20
|
+
/** #rgb grows to #rrggbb, lower case; anything else is null */
|
|
21
|
+
export function hexOf(v: string): string | null {
|
|
22
|
+
if (HEX6.test(v)) return v.toLowerCase()
|
|
23
|
+
if (HEX3.test(v)) return `#${[...v.slice(1)].map((c) => c + c).join('')}`.toLowerCase()
|
|
24
|
+
return null
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const KEY_RE = /(?:^|[{,])\s*(['"]?)guiColor\1\s*:\s*['"`]([^'"`]*)['"`]/gm
|
|
28
|
+
|
|
29
|
+
/** the top level `guiColor` of `defineRepo({…})`, as written: a key nested deeper, in a string or a comment is not it */
|
|
30
|
+
export function guiColorDeclared(configText: string): string | null {
|
|
31
|
+
const depth = configDepths(configText)
|
|
32
|
+
for (const m of configText.matchAll(KEY_RE)) {
|
|
33
|
+
const sep = /^[{,]/.test(m[0]) ? m.index : m.index - 1
|
|
34
|
+
if (sep >= 0 && depth[sep] === 1) return m[2]!
|
|
35
|
+
}
|
|
36
|
+
return null
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Peacock's colour in a VSCode settings text (jsonc: comments and trailing commas allowed, so read by pattern) */
|
|
40
|
+
export function peacockOf(settingsText: string): string | null {
|
|
41
|
+
const v = /"peacock\.color"\s*:\s*"([^"]*)"/.exec(settingsText)?.[1]
|
|
42
|
+
return v == null ? null : hexOf(v)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** the tone a name hashes to, as dark as a Peacock colour: light text reads on it */
|
|
46
|
+
export const guiColorOfName = (name: string): string => hslHex(nameHue(name), 0.5, 0.22)
|
|
47
|
+
|
|
48
|
+
/** the window colour from the repo's texts: its config, its VSCode settings (either '' when absent) and its name */
|
|
49
|
+
export function guiColorOfTexts(o: { config: string; settings: string; name: string; configPath?: string }): GuiColor {
|
|
50
|
+
const declared = guiColorDeclared(o.config)
|
|
51
|
+
const color = declared == null ? null : hexOf(declared)
|
|
52
|
+
if (color != null) return { color, source: 'config' }
|
|
53
|
+
const problem = declared == null ? {} : { problem: `${o.configPath ?? 'repo.config.ts'}: guiColor '${declared}' is no #rrggbb colour` }
|
|
54
|
+
const peacock = peacockOf(o.settings)
|
|
55
|
+
if (peacock != null) return { color: peacock, source: 'peacock', ...problem }
|
|
56
|
+
return { color: guiColorOfName(o.name), source: 'name', ...problem }
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const channel = (v: number): number => {
|
|
60
|
+
const c = v / 255
|
|
61
|
+
return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4
|
|
62
|
+
}
|
|
63
|
+
/** WCAG relative luminance of a #rrggbb */
|
|
64
|
+
export function luminance(hex: string): number {
|
|
65
|
+
const n = Number.parseInt(hex.slice(1), 16)
|
|
66
|
+
return 0.2126 * channel((n >> 16) & 255) + 0.7152 * channel((n >> 8) & 255) + 0.0722 * channel(n & 255)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export const LIGHT_TEXT = '#ffffff'
|
|
70
|
+
export const DARK_TEXT = '#1d1d1f'
|
|
71
|
+
/** the text colour that reads on this background: of light and dark text, the one of the higher contrast ratio */
|
|
72
|
+
export function textOn(bg: string): string {
|
|
73
|
+
const l = luminance(bg)
|
|
74
|
+
return 1.05 / (l + 0.05) >= (l + 0.05) / (luminance(DARK_TEXT) + 0.05) ? LIGHT_TEXT : DARK_TEXT
|
|
75
|
+
}
|
package/src/core/hub-theme.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// the hub's themes
|
|
1
|
+
// the hub's themes, shared by the page (hub-app/theme-st.ts) and what draws it from
|
|
2
2
|
// outside (sk shot, the browser checks): no import, so a shot never loads the hub's graph.
|
|
3
3
|
|
|
4
4
|
export const THEMES = ['dark', 'dim', 'grey', 'light', 'auto'] as const
|
|
@@ -10,7 +10,5 @@ export const schemeOf = (t: Theme): Scheme => (t === 'dark' || t === 'dim' ? 'da
|
|
|
10
10
|
|
|
11
11
|
/** the local storage key that keeps the page's pick */
|
|
12
12
|
export const THEME_KEY = 'hub:theme'
|
|
13
|
-
/** the local storage key that keeps the project list folded to its rail ('1') or open ('0') */
|
|
14
|
-
export const RAIL_KEY = 'hub:list-rail'
|
|
15
13
|
|
|
16
14
|
export const isTheme = (v: unknown): v is Theme => typeof v === 'string' && v !== 'auto' && (THEMES as readonly string[]).includes(v)
|
package/src/core/layout.ts
CHANGED
|
@@ -27,6 +27,9 @@ export const LAYOUT = {
|
|
|
27
27
|
// plans, arc boards and lane files: live state a crashed session resumes
|
|
28
28
|
// from. Tracked in a private repo only, since a board quotes the owner
|
|
29
29
|
plans: sk('plans'),
|
|
30
|
+
// the urls added from the hub, their logins (vault names, never a value) and how each opens (wiki
|
|
31
|
+
// tools/shipkit/urls.md). Tracked in a private repo only, like plans: a LAN address names a machine
|
|
32
|
+
urls: sk('urls.json'),
|
|
30
33
|
// the release files: next.md and one <version>.md a release, each change's picture a key in the Space, never a
|
|
31
34
|
// file here (wiki tools/shipkit/units.md, The release files)
|
|
32
35
|
releases: sk('releases'),
|
|
@@ -33,6 +33,9 @@ export type MachineCommit = {
|
|
|
33
33
|
message: string
|
|
34
34
|
/** absolute paths, all inside that repo */
|
|
35
35
|
paths: string[]
|
|
36
|
+
/** a path git does not track yet is added first, as an intent (`git add -N`, that path's entry alone), so the
|
|
37
|
+
* pathspec commit takes it; undone when the commit does not land */
|
|
38
|
+
add?: boolean
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
/** true when a commit landed. false means "nothing was committed", never an error */
|
|
@@ -55,13 +58,18 @@ export function machineCommit(o: MachineCommit): boolean {
|
|
|
55
58
|
const ignored = new Set(check.stdout.toString().split('\0').filter(Boolean))
|
|
56
59
|
const rels = all.filter((p) => !ignored.has(p))
|
|
57
60
|
if (rels.length === 0) return false
|
|
61
|
+
const tracked = o.add === true ? new Set(git(root, ['ls-files', '--', ...rels]).out.split('\n').filter(Boolean)) : null
|
|
62
|
+
const fresh = tracked == null ? [] : rels.filter((p) => !tracked.has(p))
|
|
63
|
+
if (fresh.length > 0 && !git(root, ['add', '-N', '--', ...fresh]).ok) return false
|
|
58
64
|
// one retry: a neighbour committing right now holds index.lock
|
|
59
65
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
60
66
|
const r = git(root, ['commit', '-m', o.message, '--', ...rels])
|
|
61
67
|
if (r.ok) return true
|
|
62
|
-
if (!r.out.includes('index.lock'))
|
|
68
|
+
if (!r.out.includes('index.lock')) break
|
|
63
69
|
Bun.sleepSync(300)
|
|
64
70
|
}
|
|
71
|
+
// the intent entries alone, never a file: the path stays on disk, untracked as it was
|
|
72
|
+
if (fresh.length > 0) git(root, ['rm', '--cached', '-q', '--', ...fresh])
|
|
65
73
|
return false
|
|
66
74
|
} catch {
|
|
67
75
|
return false
|
package/src/core/one-lib.ts
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
// and a native class only accepts instances of its own copy.
|
|
8
8
|
//
|
|
9
9
|
// the one constraint a reader breaks first: register it BEFORE the first repo
|
|
10
|
-
// config is imported. A module already loaded keeps the copy it resolved.
|
|
10
|
+
// config is imported. A module already loaded keeps the copy it resolved. A
|
|
11
|
+
// worker thread does not inherit the hook: its entry registers its own.
|
|
11
12
|
import { existsSync, readFileSync, realpathSync } from 'fs'
|
|
12
13
|
import { dirname, extname, join } from 'path'
|
|
13
14
|
import { LIB_ROOT } from './lib-root.ts'
|
|
@@ -157,26 +157,29 @@ export const LEGACY_STASH_RULE = `Bash(${GIT_STASH_HEAD}*)`
|
|
|
157
157
|
/** git's global options that take their value as the NEXT word */
|
|
158
158
|
const GIT_VALUE_OPTS = new Set(['-C', '-c', '--git-dir', '--work-tree', '--namespace', '--config-env', '--exec-path'])
|
|
159
159
|
|
|
160
|
-
const unquote = (w: string): string => w.replace(/^(['"])(.*)\1
|
|
160
|
+
export const unquote = (w: string): string => w.replace(/^(['"])(.*)\1$/s, '$2')
|
|
161
161
|
|
|
162
162
|
/** a segment's words, a quoted run kept as one word, subshell and group
|
|
163
163
|
* brackets dropped */
|
|
164
|
-
const quotedWords = (seg: string): string[] =>
|
|
164
|
+
export const quotedWords = (seg: string): string[] =>
|
|
165
165
|
(seg.match(/(?:'[^']*'|"(?:[^"\\]|\\.)*"|[^\s'"])+/g) ?? []).map((w) => w.replace(/^[({]+|[)}]+$/g, '')).filter((w) => w !== '')
|
|
166
166
|
|
|
167
|
-
/**
|
|
168
|
-
*
|
|
169
|
-
function
|
|
170
|
-
const out: string[] = []
|
|
167
|
+
/** each `$(...)` and backtick substitution a shell runs, with where it sits (`end` is its last character): outside
|
|
168
|
+
* single quotes, inside double quotes too, never one whose opener a backslash escapes */
|
|
169
|
+
export function substitutionSpans(seg: string): { start: number; end: number; body: string }[] {
|
|
170
|
+
const out: { start: number; end: number; body: string }[] = []
|
|
171
171
|
let single = false
|
|
172
|
+
let double = false
|
|
172
173
|
for (let i = 0; i < seg.length; i++) {
|
|
173
174
|
const ch = seg[i]!
|
|
174
|
-
if (ch === "'")
|
|
175
|
-
if (
|
|
175
|
+
if (single) { if (ch === "'") single = false; continue }
|
|
176
|
+
if (ch === '\\') { i++; continue }
|
|
177
|
+
if (ch === "'" && !double) { single = true; continue }
|
|
178
|
+
if (ch === '"') { double = !double; continue }
|
|
176
179
|
if (ch === '`') {
|
|
177
180
|
const end = seg.indexOf('`', i + 1)
|
|
178
181
|
if (end < 0) break
|
|
179
|
-
out.push(seg.slice(i + 1, end))
|
|
182
|
+
out.push({ start: i, end, body: seg.slice(i + 1, end) })
|
|
180
183
|
i = end
|
|
181
184
|
} else if (ch === '$' && seg[i + 1] === '(') {
|
|
182
185
|
let depth = 0
|
|
@@ -185,16 +188,18 @@ function substitutions(seg: string): string[] {
|
|
|
185
188
|
if (seg[j] === '(') depth++
|
|
186
189
|
else if (seg[j] === ')' && --depth === 0) break
|
|
187
190
|
}
|
|
188
|
-
out.push(seg.slice(i + 2, j))
|
|
191
|
+
out.push({ start: i, end: Math.min(j, seg.length - 1), body: seg.slice(i + 2, j) })
|
|
189
192
|
i = j
|
|
190
193
|
}
|
|
191
194
|
}
|
|
192
195
|
return out
|
|
193
196
|
}
|
|
194
197
|
|
|
198
|
+
const substitutions = (seg: string): string[] => substitutionSpans(seg).map((s) => s.body)
|
|
199
|
+
|
|
195
200
|
/** the script a segment hands to another shell: `bash -c '<script>'`,
|
|
196
201
|
* `sh -c`, `zsh -c`, or `eval <words>` */
|
|
197
|
-
function innerScript(words: string[], seg: string): string | null {
|
|
202
|
+
export function innerScript(words: string[], seg: string): string | null {
|
|
198
203
|
const program = words[0]?.split('/').pop() ?? ''
|
|
199
204
|
if (program === 'eval') {
|
|
200
205
|
const all = quotedWords(seg)
|
|
@@ -326,7 +331,7 @@ export function shellParts(command: string): { seg: string; op: '|' | ';' | '' }
|
|
|
326
331
|
/** the words of a segment from its program on: leading `VAR=value`
|
|
327
332
|
* assignments, then wrapper words with their own flags and durations
|
|
328
333
|
* (`timeout 60 bun test`), dropped repeatedly */
|
|
329
|
-
function programWords(seg: string): string[] {
|
|
334
|
+
export function programWords(seg: string): string[] {
|
|
330
335
|
let s = seg.trim().replace(/^[(){}\s]+/, '')
|
|
331
336
|
let wrapped = false
|
|
332
337
|
for (;;) {
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// a request to one of the owner's routes of the hub with a header written by hand to look like his browser, refused by
|
|
2
|
+
// the Bash guard (hooks/one-way-in-guard.ts). The servers take a word as the owner from a page of the hub alone
|
|
3
|
+
// (http/owner-word.ts), on headers a program can write: this is the half that tells an agent so before it tries.
|
|
4
|
+
// A hub page's socket and the terminal's routes are his word too (what he types there), so a forged upgrade is the
|
|
5
|
+
// same forgery, and so is a terminal hop to another place (`/door/_terminal/`) with the door key written by hand.
|
|
6
|
+
// A pattern, never a proof. It does not see: a script file that builds the request, a header whose name sits in a
|
|
7
|
+
// variable or a file (curl -H @file, -K), a heredoc piped into a shell, a path or a port put together by code (a
|
|
8
|
+
// variable set in another command, strings joined in a script, `/ap""i/`), a word route of a hub served alone on
|
|
9
|
+
// its own port (no `/r/<repo>`, the shape any project's dev server has too). It refuses too much in one place, by
|
|
10
|
+
// choice: a project's own `/api/live` or `/api/terminal/` on a port of 4800 to 4979, where hubs served alone sit
|
|
11
|
+
// beside the projects' own processes (no house repo has such a route). And a word as the owner has other doors
|
|
12
|
+
// no header guards: a command to tmux's own socket, a browser a program drives, a write straight into the store.
|
|
13
|
+
// The one constraint a reader breaks first: it reads only what a shell would RUN. The words of a commit, a reply, a
|
|
14
|
+
// search or a file written through a heredoc are data, so telling the forgery is never refused
|
|
15
|
+
import { HOP_PATH } from '../http/hop-names.ts'
|
|
16
|
+
import { ownerWordPath, PAGE_SOCKET } from '../http/owner-word.ts'
|
|
17
|
+
import { programWords, shellParts, substitutionSpans } from './one-way-in-policy.ts'
|
|
18
|
+
|
|
19
|
+
/** programs that send nothing: their arguments and their heredoc are words, only a substitution inside them runs */
|
|
20
|
+
const DATA_HEADS = new Set(['sk', 'shipkit', 'git', 'gh', 'echo', 'printf', 'cat', 'tee', 'grep', 'egrep', 'fgrep', 'rg', 'sed', 'awk', 'jq', 'head', 'tail', 'wc', 'ls', 'find', 'less', 'mkdir', 'touch', 'cd', 'sort', 'uniq', 'cut', 'tr', 'column', 'nl', 'pbcopy'])
|
|
21
|
+
|
|
22
|
+
const NAMES = 'origin|sec-fetch-[a-z]+|x-shipkit-[a-z-]+|x-forwarded-(?:for|host|proto)|tailscale-user-[a-z-]+'
|
|
23
|
+
/** a header only a browser, the web or tailscaled writes: as a curl flag, a wget flag, an httpie word, a key of an
|
|
24
|
+
* object, or a line of a request printed by hand (after its `\r\n`) */
|
|
25
|
+
const FORGED_KEY = new RegExp(`(?:^|[\\s'"\`{,([]|--header=|\\\\[rn])(${NAMES})['"\`]?\\]?\\s*:`, 'im')
|
|
26
|
+
/** the same as a pair: `['Origin', value]`, `headers.set('origin', value)` */
|
|
27
|
+
const FORGED_PAIR = new RegExp(`['"\`](${NAMES})['"\`]\\s*,`, 'i')
|
|
28
|
+
/** the Origin as a socket client takes it: a flag (`websocat --origin`, `wscat -o`), an argument by its name
|
|
29
|
+
* (`create_connection(url, origin='…')`) */
|
|
30
|
+
const FORGED_FLAG = /(?:^|\s)(?:--(origin)(?:[=\s]|$)|-o\s+['"]?https?:\/\/)|[(,]\s*(origin)\s*=\s*['"]/i
|
|
31
|
+
|
|
32
|
+
const LOCAL_NAME = /^(?:localhost|[\w.-]+\.localhost|[\w.-]+\.ts\.net)$/i
|
|
33
|
+
const LOCAL_ANYWHERE = /\blocalhost\b|\b127\.\d{1,3}(?:\.\d{1,3}){0,2}\b|\b0\.0\.0\.0\b|\[::1\]|\.ts\.net\b/i
|
|
34
|
+
/** what stands right before a path: a scheme, a host (a name, an address in brackets, a shell variable), a port */
|
|
35
|
+
const HOST_BEFORE = /(?:https?:\/\/)?(\[[^\]\s]+\]|\$\{?\w+\}?|[\w.-]+)(?::(?:\d+|\$\{?\w+\}?))?$/
|
|
36
|
+
|
|
37
|
+
/** the ports the house serves a hub on (home/home-paths.ts: pm 4797, the daemon 4798, the home 4799, a hub alone
|
|
38
|
+
* 4800 to 4979): right before a path, or named anywhere in the command */
|
|
39
|
+
const HUB_PORT = /:(?:479[7-9]|48\d\d|49[0-7]\d)$/
|
|
40
|
+
const HUB_PORT_NEAR = /[:\s=+(](?:479[7-9]|48\d\d|49[0-7]\d)\b/
|
|
41
|
+
/** a host or a port that is a variable of the shell: it counts as the hub's only when the command names a hub port */
|
|
42
|
+
const IN_VARIABLE = /\$\{?\w+\}?$/
|
|
43
|
+
|
|
44
|
+
/** the text as the shell and curl send its paths: quotes gone (`"…/api/"live`, `l''ive`), dot segments resolved
|
|
45
|
+
* (`/api/x/../live`, `/api/./live`), and each word of curl's first braces (`/api/{live,x}`) */
|
|
46
|
+
function asSent(text: string): string[] {
|
|
47
|
+
let t = text.replace(/['"]/g, '')
|
|
48
|
+
for (let n = 0; n < 4 && /\/\.\.?(?=\/)/.test(t); n++) t = t.replace(/\/[\w%-]+\/\.\.(?=\/)/g, '').replace(/\/\.(?=\/)/g, '')
|
|
49
|
+
const braces = /\{([\w./%-]*(?:,[\w./%-]*)+)\}/.exec(t)
|
|
50
|
+
return braces == null ? [t] : braces[1]!.split(',').slice(0, 8).map((word) => t.replace(braces[0], word))
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** whether the text names one of the owner's routes as the home serves it (`/r/<repo>/api/…`, `/api/home/…`: a bare
|
|
54
|
+
* `/api/messages` is any project's own) on a server that may be this machine's: a loopback or a tailnet name, an
|
|
55
|
+
* address in numbers, a variable, or no host beside it while the text names this machine elsewhere. A page's
|
|
56
|
+
* socket and the terminal's routes are the home's own under no repo too (`/api/live`, `/api/terminal/machine`):
|
|
57
|
+
* bare, they count on a port of the hub only, since a project's dev server may have a route of that name */
|
|
58
|
+
const ownRouteIn = (sent: string): boolean => asSent(sent).some(ownRouteInText)
|
|
59
|
+
|
|
60
|
+
/** whether the text names a terminal hop to another place: its path is the hop's on any host, the place being
|
|
61
|
+
* another machine of the tailnet (hq/terminal-hop.ts), and no project serves a path of that name */
|
|
62
|
+
const hopIn = (sent: string): boolean => asSent(sent).some((t) => t.includes(HOP_PATH))
|
|
63
|
+
|
|
64
|
+
function ownRouteInText(text: string): boolean {
|
|
65
|
+
const near = HUB_PORT_NEAR.test(text)
|
|
66
|
+
for (let i = text.indexOf('/api/'); i >= 0; i = text.indexOf('/api/', i + 1)) {
|
|
67
|
+
const path = /^\/api\/[\w/.%-]+/.exec(text.slice(i, i + 300))?.[0]
|
|
68
|
+
if (path == null || !(ownerWordPath(path) || PAGE_SOCKET.test(path))) continue
|
|
69
|
+
const raw = text.slice(Math.max(0, i - 200), i)
|
|
70
|
+
const before = raw.replace(/\/r\/[\w.%-]+$/, '')
|
|
71
|
+
if (before === raw && !path.startsWith('/api/home/')) {
|
|
72
|
+
if (!PAGE_SOCKET.test(path) && !path.startsWith('/api/terminal/')) continue
|
|
73
|
+
// a request printed by hand has no host before its path, and a url may sit in a variable: the port is then
|
|
74
|
+
// the one the command names beside it (`nc 127.0.0.1 4799`, `B=http://localhost:4799; … "$B/api/live"`)
|
|
75
|
+
if (!HUB_PORT.test(before) && !(near && (IN_VARIABLE.test(before) || HOST_BEFORE.exec(before) == null))) continue
|
|
76
|
+
}
|
|
77
|
+
if (/[)`]$/.test(before)) return true
|
|
78
|
+
const name = HOST_BEFORE.exec(before)?.[1]
|
|
79
|
+
if (name == null) {
|
|
80
|
+
if (LOCAL_ANYWHERE.test(text)) return true
|
|
81
|
+
continue
|
|
82
|
+
}
|
|
83
|
+
if (name.startsWith('$') || name.startsWith('[') || /^(?:0x[0-9a-f]+|[\d.]+)$/i.test(name) || LOCAL_NAME.test(name)) return true
|
|
84
|
+
}
|
|
85
|
+
return false
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** what a shell would run of a command: each part whose program can send, whole; of a part that only prints, the
|
|
89
|
+
* substitutions inside it, and the whole of it when it is piped into a program that can send; a heredoc when the
|
|
90
|
+
* program that reads it can send */
|
|
91
|
+
function sent(command: string, depth = 0): string[] {
|
|
92
|
+
if (depth > 3) return []
|
|
93
|
+
// bash's own sockets: what a part prints goes out with no program that sends in view
|
|
94
|
+
if (/\/dev\/(?:tcp|udp)\//.test(command)) return [command]
|
|
95
|
+
const shell = command.split(/<<-?\s*['"]?\w+/)[0] ?? command
|
|
96
|
+
const parts = shellParts(command)
|
|
97
|
+
const silent = parts.map((p) => DATA_HEADS.has(programWords(p.seg)[0]?.split('/').pop() ?? ''))
|
|
98
|
+
const out: string[] = []
|
|
99
|
+
for (const [n, { seg, op }] of parts.entries()) {
|
|
100
|
+
if (silent[n]) {
|
|
101
|
+
if (op === '|' && silent[n + 1] === false) out.push(seg)
|
|
102
|
+
else for (const s of substitutionSpans(seg)) out.push(...sent(s.body, depth + 1))
|
|
103
|
+
continue
|
|
104
|
+
}
|
|
105
|
+
out.push(n === parts.length - 1 && shell.length < command.length ? `${seg}${command.slice(shell.length)}` : seg)
|
|
106
|
+
}
|
|
107
|
+
return out
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** the header a command sets by hand on a request to one of the owner's routes, with the part that sends it; or null */
|
|
111
|
+
export function forgedOwnerWordIn(command: string): { header: string; segment: string } | null {
|
|
112
|
+
if (!command.includes('/api/') && !command.includes('_terminal')) return null
|
|
113
|
+
const parts = sent(command)
|
|
114
|
+
const text = parts.join('\n')
|
|
115
|
+
const header = (FORGED_KEY.exec(text) ?? FORGED_PAIR.exec(text))?.[1] ?? (FORGED_FLAG.test(text) ? 'origin' : undefined)
|
|
116
|
+
if (header == null || !(ownRouteIn(text) || hopIn(text))) return null
|
|
117
|
+
return { header, segment: (parts.find((p) => p.includes('/api/') || p.includes('_terminal')) ?? parts[0] ?? '').trim() }
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function forgedOwnerWordRefusal(hit: { header: string; segment: string }): string {
|
|
121
|
+
const name = hit.header.replace(/(^|-)([a-z])/g, (_, d: string, c: string) => `${d}${c.toUpperCase()}`)
|
|
122
|
+
return `\`${hit.segment.replace(/\s+/g, ' ').slice(0, 80)}\` calls one of the owner's routes of the hub, or a page's socket, with a header written by hand (${name}), which only his browser, the web or tailscale writes: a word as the owner, a key in his terminals included, comes from a page of the hub, never from a program. An agent writes as itself (\`sk thread reply <address> "…"\`, \`sk thread update\`) and runs commands in its own shell, and a test of the route builds the request in a test file (tests/owner-word.test.ts and tests/page-gate.test.ts hold the shapes). Lifting this is a change of the rule (src/core/owner-word-policy.ts, src/http/owner-word.ts), not a settings edit.`
|
|
123
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
// a project app's main panel shades, derived from the repo's window colour (guiColor) in oklch: the window chrome and
|
|
2
|
+
// the dock keep the full colour, the panel a calmer shade of it. In a dark theme: mixed toward the theme's panel, lower
|
|
3
|
+
// chroma, hover and the active row steps toward the ink. In a light theme: a light tint of the colour's hue a step
|
|
4
|
+
// under the page, its chroma from a table by lightness, hover and the active row a step darker each. The section heads
|
|
5
|
+
// are a step darker in both. Computed here, not in css, because each ink is chosen by its WCAG contrast on the shade it
|
|
6
|
+
// sits on: ink 7:1 at least, dim 4.5:1 on every surface (tests/panel-shades.test.ts)
|
|
7
|
+
import { luminance, textOn } from './gui-color.ts'
|
|
8
|
+
|
|
9
|
+
type Lch = { l: number; c: number; h: number }
|
|
10
|
+
|
|
11
|
+
const toLinear = (v: number): number => (v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4)
|
|
12
|
+
const toGamma = (v: number): number => (v <= 0.0031308 ? 12.92 * v : 1.055 * v ** (1 / 2.4) - 0.055)
|
|
13
|
+
|
|
14
|
+
/** a #rrggbb in oklch: lightness 0 to 1, chroma, hue in radians */
|
|
15
|
+
export function oklchOf(hex: string): Lch {
|
|
16
|
+
const n = Number.parseInt(hex.slice(1), 16)
|
|
17
|
+
const [r, g, b] = [(n >> 16) & 255, (n >> 8) & 255, n & 255].map((x) => toLinear(x / 255)) as [number, number, number]
|
|
18
|
+
const l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b)
|
|
19
|
+
const m = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b)
|
|
20
|
+
const s = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b)
|
|
21
|
+
const L = 0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s
|
|
22
|
+
const A = 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s
|
|
23
|
+
const B = 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s
|
|
24
|
+
return { l: L, c: Math.hypot(A, B), h: Math.atan2(B, A) }
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** linear srgb, a channel under 0 or over 1 where the colour is outside the gamut */
|
|
28
|
+
function linearOfLch({ l: L, c, h }: Lch): number[] {
|
|
29
|
+
const A = c * Math.cos(h)
|
|
30
|
+
const B = c * Math.sin(h)
|
|
31
|
+
const l = (L + 0.3963377774 * A + 0.2158037573 * B) ** 3
|
|
32
|
+
const m = (L - 0.1055613458 * A - 0.0638541728 * B) ** 3
|
|
33
|
+
const s = (L - 0.0894841775 * A - 1.291485548 * B) ** 3
|
|
34
|
+
return [4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s, -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s, -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s]
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function hexOfLch(x: Lch): string {
|
|
38
|
+
return `#${linearOfLch(x).map((v) => Math.round(Math.min(1, Math.max(0, toGamma(Math.min(1, Math.max(0, v))))) * 255).toString(16).padStart(2, '0')).join('')}`
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** the colour with as much of its chroma as srgb holds at its lightness: a clipped channel would turn its hue */
|
|
42
|
+
function inGamut(x: Lch): Lch {
|
|
43
|
+
let c = x.c
|
|
44
|
+
while (c > 0 && linearOfLch({ ...x, c }).some((v) => v < -0.0005 || v > 1.0005)) c = Math.max(0, c - 0.002)
|
|
45
|
+
return { ...x, c }
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** the WCAG contrast ratio of two #rrggbb */
|
|
49
|
+
export function contrast(a: string, b: string): number {
|
|
50
|
+
const [x, y] = [luminance(a), luminance(b)].sort((p, q) => q - p) as [number, number]
|
|
51
|
+
return (x + 0.05) / (y + 0.05)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** a mix of two colours in srgb, `t` of the second */
|
|
55
|
+
export function mixHex(a: string, b: string, t: number): string {
|
|
56
|
+
const p = (hex: string) => [16, 8, 0].map((s) => (Number.parseInt(hex.slice(1), 16) >> s) & 255)
|
|
57
|
+
const [x, y] = [p(a), p(b)]
|
|
58
|
+
return `#${x.map((v, i) => Math.round(v + (y[i]! - v) * t).toString(16).padStart(2, '0')).join('')}`
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type PanelShades = { bg: string; head: string; hover: string; cur: string; ink: string; dim: string; line: string }
|
|
62
|
+
|
|
63
|
+
/** how much of the window colour the panel keeps, mixed in oklch toward the theme's panel, and its chroma kept */
|
|
64
|
+
const KEEP = 0.5
|
|
65
|
+
const CHROMA = 0.6
|
|
66
|
+
|
|
67
|
+
/** a theme's surfaces as hub.css has them: `side` its panel background (--bg-side), `page` its page (--bg) */
|
|
68
|
+
export type ThemeBg = { side: string; page: string }
|
|
69
|
+
|
|
70
|
+
/** a theme is light where its page is: read from the page's lightness, never from the theme's name */
|
|
71
|
+
export const isLight = (theme: ThemeBg): boolean => oklchOf(theme.page).l >= 0.6
|
|
72
|
+
|
|
73
|
+
/** the panel's shades from the window colour and the theme's surfaces */
|
|
74
|
+
export const panelShades = (tint: string, theme: ThemeBg): PanelShades => (isLight(theme) ? lightShades(tint, theme.page) : darkShades(tint, theme.side))
|
|
75
|
+
|
|
76
|
+
/** the dim ink, as far toward the panel as 4.5:1 allows on the darkest of the surfaces it sits on, and the line */
|
|
77
|
+
function withInks(ink: string, s: { bg: string; head: string; hover: string; cur: string }): PanelShades {
|
|
78
|
+
let dim = ink
|
|
79
|
+
for (let k = 0.6; k > 0; k -= 0.02) {
|
|
80
|
+
const d = mixHex(ink, s.bg, k)
|
|
81
|
+
if ([s.bg, s.head, s.hover, s.cur].every((x) => contrast(d, x) >= 4.5)) {
|
|
82
|
+
dim = d
|
|
83
|
+
break
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return { ...s, ink, dim, line: mixHex(ink, s.bg, 0.8) }
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** a light tint's chroma by its lightness, [lightness, chroma] pairs: enough to name the hue, and never read from the
|
|
90
|
+
* window colour, whose own chroma leaves a dull hue (olive, brown) grey once it is light */
|
|
91
|
+
const LIGHT_CHROMA: [number, number][] = [[0.7, 0.06], [0.85, 0.045], [0.95, 0.032], [1, 0.012]]
|
|
92
|
+
function lightChroma(l: number): number {
|
|
93
|
+
const at = LIGHT_CHROMA.findIndex(([x]) => l <= x)
|
|
94
|
+
if (at <= 0) return LIGHT_CHROMA[at < 0 ? LIGHT_CHROMA.length - 1 : 0]![1]
|
|
95
|
+
const [[l0, c0], [l1, c1]] = [LIGHT_CHROMA[at - 1]!, LIGHT_CHROMA[at]!]
|
|
96
|
+
return c0 + ((l - l0) / (l1 - l0)) * (c1 - c0)
|
|
97
|
+
}
|
|
98
|
+
/** under this chroma a window colour has no hue to keep: its tint fades to a grey with it */
|
|
99
|
+
const HUELESS = 0.02
|
|
100
|
+
/** the light panel sits this far under the page's lightness, so the column still reads as a panel */
|
|
101
|
+
const UNDER_PAGE = 0.012
|
|
102
|
+
|
|
103
|
+
/** a light theme: a light tint of the colour's hue a step under the page, the heads, hover and the active row a step
|
|
104
|
+
* darker each in the same hue (the active one with more colour) */
|
|
105
|
+
function lightShades(tint: string, page: string): PanelShades {
|
|
106
|
+
const t = oklchOf(tint)
|
|
107
|
+
const ink = textOn(page)
|
|
108
|
+
const hue = Math.min(1, t.c / HUELESS)
|
|
109
|
+
const at = (l: number, more = 1): string => hexOfLch(inGamut({ l, c: lightChroma(l) * hue * more, h: t.h }))
|
|
110
|
+
const shades = (l: number) => ({ bg: at(l), head: at(l - 0.045), hover: at(l - 0.03), cur: at(l - 0.075, 1.6) })
|
|
111
|
+
let l = oklchOf(page).l - UNDER_PAGE
|
|
112
|
+
// the ink reads at 7:1 on every surface: a page too dark for it lifts the panel
|
|
113
|
+
for (let i = 0; i < 60 && Math.min(...Object.values(shades(l)).map((h) => contrast(ink, h))) < 7; i++) l += 0.01
|
|
114
|
+
return withInks(ink, shades(l))
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** a dark theme: the colour mixed toward the theme's panel background (its `--bg-side`), calmer */
|
|
118
|
+
function darkShades(tint: string, base: string): PanelShades {
|
|
119
|
+
const t = oklchOf(tint)
|
|
120
|
+
const b = oklchOf(base)
|
|
121
|
+
let bg: Lch = { l: b.l + (t.l - b.l) * KEEP, c: t.c * KEEP * CHROMA, h: t.h }
|
|
122
|
+
// the ink is the theme's: a light theme keeps a light panel, a dark one a dark panel, whatever the colour
|
|
123
|
+
const ink = textOn(base)
|
|
124
|
+
// toward the ink: +1 on a dark shade (white ink), -1 on a light one
|
|
125
|
+
const toward = ink === textOn('#000000') ? 1 : -1
|
|
126
|
+
// the heads a step darker, hover and the active row steps toward the ink (the active one with more colour)
|
|
127
|
+
const shades = (x: Lch) => ({ bg: hexOfLch(x), head: hexOfLch({ ...x, l: x.l - 0.05 }), hover: hexOfLch({ ...x, l: x.l + toward * 0.04 }), cur: hexOfLch({ ...x, l: x.l + toward * 0.08, c: x.c * 1.5 }) })
|
|
128
|
+
const worst = (x: Lch): number => Math.min(...Object.values(shades(x)).map((h) => contrast(ink, h)))
|
|
129
|
+
// the ink reads at 7:1 on every surface: the shade moves away from the ink until it does
|
|
130
|
+
for (let i = 0; i < 60 && worst(bg) < 7; i++) bg = { ...bg, l: bg.l - toward * 0.01 }
|
|
131
|
+
return withInks(ink, shades(bg))
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** each theme's surfaces, its `--bg-side` and its `--bg` in hub.css (tests/panel-shades.test.ts holds them equal) */
|
|
135
|
+
export const THEME_BG = {
|
|
136
|
+
dark: { side: '#131519', page: '#0d0e10' },
|
|
137
|
+
dim: { side: '#272b32', page: '#22262c' },
|
|
138
|
+
grey: { side: '#c5cad1', page: '#cfd3d9' },
|
|
139
|
+
light: { side: '#e6e9ee', page: '#f1f3f6' },
|
|
140
|
+
} as const satisfies Record<string, ThemeBg>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// a repo's window colour read from its files (core/gui-color.ts holds the
|
|
2
|
+
// rules and stays free of fs for the browser): its repo.config.ts, then its
|
|
3
|
+
// .vscode/settings.json, then its name
|
|
4
|
+
import { existsSync, readFileSync } from 'fs'
|
|
5
|
+
import { basename, join } from 'path'
|
|
6
|
+
import { guiColorOfTexts, type GuiColor } from './gui-color.ts'
|
|
7
|
+
|
|
8
|
+
const readOr = (f: string): string => {
|
|
9
|
+
try { return existsSync(f) ? readFileSync(f, 'utf8') : '' } catch { return '' }
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** the repo's window colour and its source: `guiColor`, else Peacock's colour, else its name's */
|
|
13
|
+
export function guiColorOf(root: string, name: string = basename(root)): GuiColor {
|
|
14
|
+
const configPath = join(root, 'repo.config.ts')
|
|
15
|
+
return guiColorOfTexts({ config: readOr(configPath), settings: readOr(join(root, '.vscode', 'settings.json')), name, configPath })
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// the default session policy of the Bash guard (hooks/one-way-in-guard.ts): a lane never runs `sk session default` or
|
|
2
|
+
// `leave` (`sk orchestrator here` and `leave`, their old names). A lane shares its session's ids, so its claim would
|
|
3
|
+
// land on its session and its watch would hear for it. Only the hook input tells a lane from its session (`agent_id`).
|
|
4
|
+
// Leaf module: no import. The words inside quotes or a heredoc body (a commit message, an echo) are no call
|
|
5
|
+
const CALL = /(?:^|[\s;&|(])(?:sk|shipkit|\S*\/cli\.ts)\s+(?:orchestrator\s+(here|leave)|session\s+(default|leave))(?=$|[\s;&|)])/
|
|
6
|
+
|
|
7
|
+
/** the verb a lane's command would run, `default` or `leave` (`here` under its old name); null for a session's call or
|
|
8
|
+
* any other command */
|
|
9
|
+
export function laneRoleCallIn(command: string, agentId: unknown): string | null {
|
|
10
|
+
if (typeof agentId !== 'string' || agentId === '') return null
|
|
11
|
+
const code = command.split('<<')[0]!.replace(/'[^']*'|"(?:\\.|[^"\\])*"/g, ' ')
|
|
12
|
+
const m = CALL.exec(code)
|
|
13
|
+
return m === null ? null : (m[1] ?? m[2] ?? null)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const laneRoleRefusal = (verb: string): string =>
|
|
17
|
+
`a lane never runs sk session ${verb === 'here' ? 'default' : verb}: the default is a top level session, and its session runs it (a lane shares its ids, so the default would land on its session and this lane's watch would hear for it). Your own threads reach you through your own watch: SK_AGENT=<lane> sk thread watch --mine --house --once, as a background command (the Bash tool with run_in_background), and again after each burst it prints. Page: wiki tools/shipkit/sessions.md`
|
package/src/core/scope.ts
CHANGED
|
@@ -53,8 +53,9 @@ export function inScope(s: Scope | undefined, a: Asker): boolean {
|
|
|
53
53
|
|
|
54
54
|
const KEYS = { repo: 'repos', identity: 'identities', machine: 'machines' } as const
|
|
55
55
|
|
|
56
|
-
/** the md cell as a scope; throws on a token that is neither `all`, `repo:`, `identity:` nor `machine
|
|
57
|
-
|
|
56
|
+
/** the md cell as a scope; throws on a token that is neither `all`, `repo:`, `identity:` nor `machine:`. `parts`: the
|
|
57
|
+
* `<x>` parts of a template row's name (secrets/name-template.ts), which a token may name in place of a name */
|
|
58
|
+
export function parseScope(cell: string, o: { parts?: readonly string[] } = {}): Scope {
|
|
58
59
|
const text = cell.replaceAll('`', '').trim()
|
|
59
60
|
if (text === '' || text === 'all') return {}
|
|
60
61
|
const s: Scope = {}
|
|
@@ -63,7 +64,9 @@ export function parseScope(cell: string): Scope {
|
|
|
63
64
|
const m = /^(repo|identity|machine):(.*)$/.exec(t)
|
|
64
65
|
if (m == null) throw new Error(`scope "${cell}": "${t}" is not repo:<name>, repo:<key>, identity:<id> or machine:<name> (or all)`)
|
|
65
66
|
const kind = m[1] as keyof typeof KEYS
|
|
66
|
-
const
|
|
67
|
+
const part = /^<([a-z][a-z0-9-]*)>$/.exec(m[2]!)?.[1]
|
|
68
|
+
if (part != null && !(o.parts ?? []).includes(part)) throw new Error(`scope "${cell}": ${t} names <${part}>, and only a template row whose name holds <${part}> may`)
|
|
69
|
+
const problem = part != null ? null : nameProblem(kind, m[2]!)
|
|
67
70
|
if (problem != null) throw new Error(`scope "${cell}": ${problem}`)
|
|
68
71
|
;(s[KEYS[kind]] ??= []).push(m[2]!)
|
|
69
72
|
}
|