rvlib-shipkit 2.29.0 → 2.31.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 +35 -1
- package/README.md +15 -0
- package/package.json +2 -1
- package/src/advisors/acts.ts +174 -83
- package/src/advisors/advice.ts +201 -24
- package/src/advisors/advisor-view.ts +60 -12
- package/src/advisors/app-graph.ts +8 -2
- package/src/advisors/cf-api.ts +44 -0
- package/src/advisors/copy-truth.ts +49 -0
- package/src/advisors/dir-bucket.ts +69 -0
- package/src/advisors/door-child.ts +112 -0
- package/src/advisors/door-probe.ts +88 -0
- package/src/advisors/door-serve.ts +52 -0
- package/src/advisors/door.ts +82 -23
- package/src/advisors/edge/api.ts +14 -7
- package/src/advisors/edge/bucket.ts +10 -1
- package/src/advisors/edge/handler.ts +85 -44
- package/src/advisors/edge/here.ts +63 -0
- package/src/advisors/edge/pages.ts +87 -0
- package/src/advisors/edge/shell.ts +5 -3
- package/src/advisors/edge/sign-in.ts +144 -0
- package/src/advisors/edge/status.ts +28 -6
- package/src/advisors/edge/types.ts +25 -17
- package/src/advisors/expose.ts +226 -116
- package/src/advisors/here.ts +66 -0
- package/src/advisors/invite-send.ts +176 -0
- package/src/advisors/invite.ts +49 -0
- package/src/advisors/job.ts +89 -11
- package/src/advisors/login.ts +66 -0
- package/src/advisors/owner-name.ts +37 -0
- package/src/advisors/owner-store.ts +267 -62
- package/src/advisors/photos.ts +10 -50
- package/src/advisors/project.ts +92 -48
- package/src/advisors/rights.ts +152 -0
- package/src/advisors/routes.ts +342 -83
- package/src/advisors/scan.ts +39 -2
- package/src/advisors/setup-run.ts +132 -0
- package/src/advisors/share-trace.ts +78 -0
- package/src/advisors/sync.ts +197 -82
- package/src/advisors/tunnel.ts +118 -0
- package/src/advisors/users-router.ts +186 -0
- package/src/agent-time/accounts-usage-disk.ts +45 -3
- package/src/agent-time/accounts-usage.ts +8 -0
- package/src/agent-time/claude-sessions.ts +92 -0
- package/src/agent-time/hooks.ts +1 -1
- package/src/agent-time/live.ts +5 -2
- package/src/agent-time/registry.ts +287 -106
- package/src/agent-time/store.ts +199 -34
- package/src/annex/born.ts +2 -9
- package/src/asks/ask-carry.ts +14 -7
- package/src/asks/ask-doc.ts +2 -2
- package/src/asks/ask-edit.ts +49 -0
- package/src/asks/ask-since.ts +74 -0
- package/src/asks/ask-store.ts +91 -35
- package/src/asks/ask-words-fold.ts +2 -2
- package/src/check.ts +9 -1
- package/src/checks/SK001-package-json-shape.check.ts +13 -3
- package/src/checks/SK003-claude-md-shape.check.ts +78 -19
- package/src/checks/SK004-gitignore-policy.check.ts +15 -6
- package/src/checks/SK008-reviewer-agent.check.ts +5 -8
- package/src/checks/SK012-config-barrel-import.check.ts +1 -1
- 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/SK032-ignored-inputs.check.ts +9 -5
- package/src/checks/SK033-global-contribution.check.ts +1 -0
- package/src/checks/SK034-commit-gates-armed.check.ts +1 -0
- package/src/checks/SK036-draft-media-size.check.ts +4 -3
- package/src/checks/SK038-speaks-as.check.ts +6 -5
- package/src/checks/SK039-vscode-watch-generated.check.ts +6 -25
- package/src/checks/SK044-behind-upstream.check.ts +2 -1
- 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/checks/SK052-url-old-words.check.ts +56 -0
- package/src/checks/SK053-tools.check.ts +46 -0
- package/src/checks/SK054-agent-allow-list.check.ts +142 -0
- package/src/cli/clip.ts +44 -0
- package/src/cli/cmd_Advisors.ts +322 -133
- package/src/cli/cmd_Annex.ts +1 -1
- package/src/cli/cmd_Asks.ts +125 -23
- package/src/cli/cmd_Assets.ts +1 -1
- package/src/cli/cmd_Backup.ts +29 -66
- package/src/cli/cmd_BackupTargets.ts +106 -0
- package/src/cli/cmd_Bump.ts +1 -1
- package/src/cli/cmd_CacheAudit.ts +2 -2
- package/src/cli/cmd_Calls.ts +1 -1
- package/src/cli/cmd_Capacity.ts +1 -1
- package/src/cli/cmd_Check.ts +2 -2
- package/src/cli/cmd_Checks.ts +2 -1
- package/src/cli/cmd_Ci.ts +1 -1
- package/src/cli/cmd_Commands.ts +1 -1
- package/src/cli/cmd_ConfigKeys.ts +1 -1
- package/src/cli/cmd_Contracts.ts +1 -1
- package/src/cli/cmd_CrossRepoActivity.ts +1 -6
- package/src/cli/cmd_Db.ts +47 -3
- package/src/cli/cmd_Drill.ts +1 -1
- package/src/cli/cmd_Drive.ts +259 -0
- package/src/cli/cmd_Fleet.ts +1 -1
- package/src/cli/cmd_FleetContext.ts +45 -0
- package/src/cli/cmd_FleetPush.ts +1 -1
- package/src/cli/cmd_FleetUpdate.ts +104 -0
- package/src/cli/cmd_GlobalContext.ts +1 -1
- package/src/cli/cmd_GlobalProcesses.ts +7 -4
- package/src/cli/cmd_History.ts +8 -27
- package/src/cli/cmd_Home.ts +16 -9
- package/src/cli/cmd_Hooks.ts +4 -13
- package/src/cli/cmd_Hq.ts +80 -63
- package/src/cli/cmd_Init.ts +1 -1
- package/src/cli/cmd_Insights.ts +1 -1
- package/src/cli/cmd_Keys.ts +1 -1
- package/src/cli/cmd_Lanes.ts +20 -7
- package/src/cli/cmd_Machines.ts +1 -1
- package/src/cli/cmd_Media.ts +14 -22
- package/src/cli/cmd_Messages.ts +1 -1
- package/src/cli/cmd_Mv.ts +1 -1
- package/src/cli/cmd_Needs.ts +1 -1
- package/src/cli/cmd_Orchestrator.ts +245 -85
- package/src/cli/cmd_OrchestratorRole.ts +152 -0
- package/src/cli/cmd_Overview.ts +1 -1
- package/src/cli/cmd_Pb.ts +1 -1
- package/src/cli/cmd_Planned.ts +1 -1
- package/src/cli/cmd_Rec.ts +1 -1
- package/src/cli/cmd_Reflect.ts +3 -3
- package/src/cli/cmd_Release.ts +1 -1
- package/src/cli/cmd_Releases.ts +1 -1
- package/src/cli/cmd_Review.ts +430 -339
- package/src/cli/cmd_Secret.ts +128 -16
- package/src/cli/cmd_Serve.ts +1 -1
- package/src/cli/cmd_Setup.ts +30 -0
- package/src/cli/cmd_Shot.ts +3 -5
- package/src/cli/cmd_Sign.ts +1 -1
- package/src/cli/cmd_Smoke.ts +1 -1
- package/src/cli/cmd_Social.ts +6 -3
- package/src/cli/cmd_SocialDrafts.ts +20 -6
- package/src/cli/cmd_Sound.ts +2 -1
- package/src/cli/cmd_Space.ts +4 -4
- package/src/cli/cmd_Start.ts +1 -1
- package/src/cli/cmd_Status.ts +1 -1
- package/src/cli/cmd_ThreadHolds.ts +1 -1
- package/src/cli/cmd_ThreadKinds.ts +1 -1
- package/src/cli/cmd_ThreadReflect.ts +3 -3
- package/src/cli/cmd_ThreadSyncNeeds.ts +1 -1
- package/src/cli/cmd_Time.ts +1 -1
- package/src/cli/cmd_Tmp.ts +1 -1
- package/src/cli/cmd_TraceAudit.ts +1 -1
- package/src/cli/cmd_Trailer.ts +1 -1
- package/src/cli/cmd_Tui.ts +1 -1
- package/src/cli/cmd_Urls.ts +61 -9
- package/src/cli/cmd_Vault.ts +1 -1
- package/src/cli/cmd_Veille.ts +1 -1
- package/src/cli/cmd_When.ts +1 -1
- package/src/cli/cmd_Wiki.ts +5 -2
- package/src/cli/cmd_Worktrees.ts +1 -1
- package/src/cli/family-pages.ts +1 -0
- package/src/cli/inbox-hook-run.ts +135 -0
- package/src/cli/line.ts +131 -0
- package/src/cli/registry-cli.ts +100 -0
- package/src/cli/registry-heads.ts +448 -0
- package/src/cli/registry.ts +385 -250
- package/src/cli/review-here.ts +136 -0
- package/src/cli.ts +65 -22
- package/src/collections/actions.ts +5 -4
- package/src/collections/checks.ts +5 -0
- package/src/collections/collection-types.ts +7 -3
- package/src/collections/pings.ts +4 -1
- package/src/collections/providers.ts +10 -5
- package/src/collections/review.ts +3 -4
- package/src/collections/tests.ts +7 -4
- package/src/context/context-line.ts +29 -0
- package/src/context/context-view.ts +34 -0
- package/src/context/project-context.ts +144 -0
- package/src/core/agent-allow-policy.ts +99 -0
- package/src/core/agent-spawn.ts +2 -0
- 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/capacity.ts +3 -2
- package/src/core/check-ctx.ts +38 -4
- package/src/core/check-pass.ts +7 -0
- package/src/core/daemon-port.ts +10 -0
- package/src/core/es2022.ts +19 -0
- package/src/core/footprint.ts +35 -0
- package/src/core/foreign.ts +87 -0
- package/src/core/git-bin.ts +18 -0
- package/src/core/git-root.ts +40 -4
- package/src/core/git.ts +22 -0
- package/src/core/gui-color.ts +75 -0
- package/src/core/hard-reset.ts +7 -1
- package/src/core/house-config-text.ts +47 -0
- package/src/core/house-layout.ts +4 -0
- package/src/core/hub-theme.ts +1 -3
- package/src/core/identities-path.ts +67 -0
- package/src/core/identities-root.ts +26 -0
- package/src/core/instance.ts +1 -1
- package/src/core/jobs.ts +1 -4
- package/src/core/layout.ts +6 -0
- package/src/core/loop-watch.ts +28 -5
- package/src/core/machine-commit.ts +9 -1
- package/src/core/machine-db.ts +1 -8
- package/src/core/machine-name.ts +31 -0
- package/src/core/memory-watch.ts +56 -8
- package/src/core/on-loop.ts +10 -7
- 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/pid-alive.ts +11 -0
- package/src/core/proc-path.ts +42 -0
- package/src/core/repo-gui-color.ts +16 -0
- package/src/core/retention.ts +2 -2
- package/src/core/role-policy.ts +16 -0
- package/src/core/run-dirs.ts +2 -5
- package/src/core/runs.ts +5 -3
- package/src/core/scope.ts +50 -3
- package/src/core/scratch-objects.ts +1 -1
- package/src/core/slot-env.ts +4 -0
- package/src/core/slots.ts +2 -2
- package/src/core/spawn-timeout.ts +9 -3
- package/src/core/tmux-policy.ts +264 -0
- package/src/core/tools.ts +20 -0
- package/src/core/tree-watch.ts +304 -0
- package/src/core/unit-icon.ts +43 -0
- package/src/core/window-policy.ts +132 -0
- package/src/drives/context.ts +29 -0
- package/src/drives/drives-view.ts +121 -0
- package/src/drives/file.ts +89 -0
- package/src/drives/local-folder.ts +107 -0
- package/src/drives/login.ts +181 -0
- package/src/drives/named.ts +33 -0
- package/src/drives/rclone.ts +100 -0
- package/src/drives/reach.ts +73 -0
- package/src/drives/routes.ts +89 -0
- package/src/drives/shares.ts +292 -0
- package/src/fleet/context-fleet.ts +83 -0
- package/src/fleet/follow.ts +172 -0
- package/src/fleet/push-fleet.ts +2 -0
- package/src/fleet/scan-fleet.ts +3 -0
- package/src/gate/builtin-checks-dir.ts +32 -0
- package/src/gate/cache-audit.ts +7 -1
- package/src/gate/discover-checks.ts +9 -32
- package/src/gate/gate-checks.ts +14 -9
- package/src/gate/pre-commit-discovery.ts +214 -24
- package/src/gate/run-fix.ts +30 -5
- package/src/gate/run-fixers.ts +16 -3
- package/src/home/activity-shape.ts +2 -0
- package/src/home/activity.ts +2 -1
- package/src/home/advisors-tunnel-start.ts +9 -0
- package/src/home/autostart.ts +61 -17
- package/src/home/backup-status.ts +366 -0
- package/src/home/backup-verdict.ts +19 -0
- package/src/home/daemon-guard.ts +20 -2
- package/src/home/daemon-jobs.ts +203 -52
- package/src/home/database-words.ts +19 -2
- package/src/home/databases.ts +72 -25
- package/src/home/drives-deps.ts +54 -0
- package/src/home/follow-run.ts +146 -0
- package/src/home/global-context.ts +26 -22
- package/src/home/global-units.ts +3 -1
- package/src/home/gui-app/ShipkitGui.swift +3732 -286
- package/src/home/gui-app/icon.svg +8 -0
- package/src/home/gui-app.ts +93 -33
- package/src/home/handoff.ts +5 -3
- package/src/home/handover.ts +2 -10
- package/src/home/home-paths.ts +16 -7
- package/src/home/home-routes.ts +152 -38
- package/src/home/home-start.ts +27 -3
- package/src/home/inbox-shape.ts +9 -5
- package/src/home/log-follow.ts +117 -0
- package/src/home/machine-fold.ts +3 -11
- package/src/home/machine-host.ts +3 -17
- package/src/home/machine-stores.ts +8 -7
- package/src/home/open-app.ts +9 -3
- package/src/home/owner-switch-route.ts +33 -0
- package/src/home/page-build.ts +25 -5
- package/src/home/page-files.ts +79 -0
- package/src/home/page-held.ts +1 -1
- package/src/home/pm-config.ts +0 -8
- package/src/home/pm-switch.ts +10 -0
- package/src/home/pm.ts +74 -5
- package/src/home/process-apps.ts +82 -23
- package/src/home/process-rows.ts +16 -1
- package/src/home/push-sources.ts +31 -14
- package/src/home/resources.ts +16 -7
- package/src/home/resume.ts +8 -6
- package/src/home/run-daemon.ts +73 -7
- package/src/home/run-pm.ts +4 -4
- package/src/home/secrets-context.ts +119 -0
- package/src/home/serve-daemon.ts +13 -4
- package/src/home/serve-web.ts +152 -23
- package/src/home/shipkit-mark.ts +26 -0
- package/src/home/space-page.ts +4 -4
- package/src/home/space-route.ts +5 -12
- package/src/home/supervise.ts +4 -10
- package/src/home/vault-page.ts +41 -19
- package/src/home/vault-reveal.ts +2 -1
- package/src/home/web-places.ts +241 -0
- package/src/home/widgets.ts +16 -2
- package/src/hooks/commit-message.ts +11 -9
- package/src/hooks/commit-run.ts +420 -0
- package/src/hooks/git-hook.ts +49 -0
- package/src/hooks/held-calls.ts +104 -0
- package/src/hooks/hook-config.ts +104 -0
- package/src/hooks/hook-gates.ts +15 -9
- package/src/hooks/leak-guard.ts +15 -14
- package/src/hooks/one-way-in-guard.ts +156 -70
- package/src/hooks/pre-commit-checks.ts +64 -0
- package/src/hooks/root-identity.ts +15 -18
- package/src/hooks/run-hooks.ts +130 -293
- package/src/hooks/shared-file.ts +277 -84
- package/src/hooks/shell-writes.ts +526 -0
- package/src/hooks/staged.ts +245 -18
- package/src/hooks/write-log.ts +243 -0
- package/src/house/project-gutter.ts +32 -8
- package/src/hq/backup-targets.ts +74 -0
- package/src/hq/daemon-db.ts +177 -0
- package/src/hq/door-route.ts +68 -12
- package/src/hq/door.ts +71 -24
- package/src/hq/files-send.ts +23 -17
- package/src/hq/follow-fact.ts +66 -0
- package/src/hq/forgotten-log.ts +3 -1
- package/src/hq/history-check.ts +9 -0
- package/src/hq/history-send.ts +9 -23
- package/src/hq/holds-shape.ts +42 -0
- package/src/hq/hq-db.ts +25 -28
- package/src/hq/hq-holds.ts +181 -0
- package/src/hq/hq-local.ts +87 -49
- package/src/hq/hq-role.ts +150 -0
- package/src/hq/hq-routes.ts +18 -4
- package/src/hq/hq-store.ts +52 -13
- package/src/hq/item-direct.ts +57 -0
- package/src/hq/item-shapes.ts +54 -0
- package/src/hq/kinds/index.ts +3 -1
- package/src/hq/kinds/item-gone.ts +20 -12
- package/src/hq/kinds/item-msg.ts +21 -6
- package/src/hq/kinds/item.ts +22 -13
- package/src/hq/kinds/items-read.ts +4 -0
- package/src/hq/kinds/kind.ts +18 -4
- package/src/hq/kinds/presence-rule.ts +56 -0
- package/src/hq/kinds/presence.ts +228 -0
- package/src/hq/kinds/prompt.ts +1 -0
- package/src/hq/kinds/reflection.ts +1 -0
- package/src/hq/kinds/report.ts +13 -5
- package/src/hq/kinds/thread-event.ts +105 -0
- package/src/hq/lead-order.ts +68 -0
- package/src/hq/machine-key.ts +10 -3
- package/src/hq/machine-notes.ts +3 -2
- package/src/hq/outbox.ts +9 -153
- package/src/hq/owner-switch.ts +61 -0
- package/src/hq/replica.ts +168 -23
- package/src/hq/report-facts.ts +39 -9
- package/src/hq/report.ts +71 -2
- package/src/hq/shapes-words.ts +31 -0
- package/src/hq/switch.ts +29 -59
- package/src/hq/terminal-hop.ts +64 -0
- package/src/hq/thread-events.ts +91 -0
- package/src/hq/thread-sync.ts +39 -51
- package/src/http/door-forward.ts +13 -15
- 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 +133 -0
- package/src/http/same-origin.ts +12 -0
- package/src/{serve → http}/secret-gate.ts +3 -3
- package/src/identities/collection.ts +2 -3
- package/src/identities/identities.ts +43 -6
- package/src/init-repo.ts +12 -0
- package/src/ledger/db.ts +19 -6
- package/src/ledger/git-scan.ts +23 -9
- package/src/ledger/live-runs.ts +1 -12
- package/src/ledger/record-kept.ts +40 -12
- package/src/ledger/run-log.ts +25 -0
- package/src/media-store/backup/daemon.ts +37 -22
- package/src/media-store/backup/facts.ts +63 -0
- package/src/media-store/backup/prune.ts +2 -5
- package/src/media-store/backup/restore.ts +15 -4
- package/src/media-store/backup/retention.ts +2 -2
- package/src/media-store/backup/sources.ts +33 -68
- package/src/media-store/backup/ssh-space.ts +202 -0
- package/src/media-store/backup/ssh-target.ts +74 -0
- package/src/media-store/backup/target-send.ts +162 -0
- package/src/media-store/backup/watch.ts +26 -19
- package/src/media-store/copy/config.ts +15 -13
- package/src/media-store/copy/copy.ts +11 -6
- package/src/media-store/copy/proof.ts +17 -10
- package/src/media-store/copy/snapshot.ts +29 -22
- package/src/media-store/copy/store.ts +2 -10
- package/src/media-store/copy/stream.ts +7 -2
- package/src/media-store/daemon.ts +13 -7
- package/src/media-store/db.ts +6 -1
- package/src/media-store/forget-one.ts +14 -3
- package/src/media-store/hq-find.ts +1 -3
- package/src/media-store/hq-send.ts +4 -5
- 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/guards.ts +9 -3
- package/src/orchestrator/host.ts +35 -0
- package/src/orchestrator/lead-shape.ts +87 -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 +208 -0
- package/src/orchestrator/places-shape.ts +166 -0
- package/src/orchestrator/places.ts +50 -0
- package/src/orchestrator/presence-shape.ts +13 -2
- package/src/orchestrator/presence.ts +41 -20
- package/src/orchestrator/push.ts +5 -10
- package/src/orchestrator/role-shape.ts +261 -0
- package/src/orchestrator/role.ts +191 -0
- package/src/orchestrator/routes.ts +155 -41
- package/src/orchestrator/sessions-shape.ts +123 -0
- package/src/orchestrator/sessions.ts +83 -0
- package/src/orchestrator/share.ts +71 -0
- package/src/orchestrator/start-notice.ts +61 -0
- package/src/orchestrator/start.ts +130 -0
- package/src/orchestrator/started.ts +55 -0
- package/src/orchestrator/stuck.ts +196 -0
- package/src/orchestrator/talk-key.ts +21 -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/recordings/recorder-app/Editor.swift +6 -0
- package/src/recordings/recorder-app/main.swift +3 -0
- package/src/reflections/reflection-close.ts +2 -1
- package/src/reflections/reflections-queue.ts +9 -6
- package/src/release/public-clean.ts +40 -15
- package/src/release/run-bump.ts +26 -5
- package/src/release/run-release.ts +34 -14
- package/src/repo-config.ts +54 -14
- package/src/review/answer-kinds.ts +15 -3
- package/src/review/aside-at.ts +19 -0
- package/src/review/band.ts +53 -16
- package/src/review/cell-copy.ts +27 -0
- package/src/review/cells.ts +246 -35
- package/src/review/doc-save.ts +1 -1
- package/src/review/events.ts +24 -4
- package/src/review/expect.ts +128 -0
- package/src/review/file-tags.ts +9 -0
- package/src/review/folders.ts +216 -0
- package/src/review/format.ts +113 -25
- package/src/review/gone.ts +10 -86
- package/src/review/hook-ask.ts +58 -0
- package/src/review/inbox-hook.ts +17 -6
- package/src/review/inbox-read.ts +99 -18
- package/src/review/instruction-guards.ts +192 -0
- package/src/review/instructions.ts +38 -2
- package/src/review/item-db.ts +157 -23
- package/src/review/item-hq.ts +119 -0
- package/src/review/item-rows.ts +96 -52
- package/src/review/kind-catalog.ts +2 -0
- package/src/review/kinds.ts +7 -4
- package/src/review/live-post.ts +20 -6
- package/src/review/live-view.ts +18 -1
- package/src/review/media-away.ts +35 -0
- package/src/review/mentions.ts +9 -10
- package/src/review/model.ts +126 -13
- package/src/review/notes.ts +4 -4
- package/src/review/object-read.ts +26 -7
- package/src/review/parties.ts +104 -19
- package/src/review/phone-push.ts +11 -10
- package/src/review/previews-job.ts +49 -0
- package/src/review/previews.ts +50 -28
- package/src/review/push.ts +56 -55
- package/src/review/referring.ts +2 -2
- package/src/review/reflection-object.ts +24 -11
- package/src/review/refs.ts +143 -0
- package/src/review/reply-guards.ts +71 -0
- package/src/review/routes.ts +99 -35
- package/src/review/search-index.ts +6 -10
- package/src/review/search-job.ts +4 -6
- package/src/review/search-ocr.ts +1 -1
- package/src/review/secret-route.ts +18 -14
- package/src/review/snooze.ts +1 -16
- package/src/review/store-index.ts +1 -1
- package/src/review/store-parties.ts +4 -2
- package/src/review/store.ts +171 -556
- package/src/review/supersede.ts +3 -3
- package/src/review/take-back.ts +1 -1
- package/src/review/thread-code.ts +101 -0
- package/src/review/thread-md.ts +127 -0
- package/src/review/thread-query.ts +67 -0
- package/src/review/threads.ts +104 -18
- package/src/review/traces.ts +17 -5
- package/src/review/unit.ts +3 -2
- package/src/review/verdict-items.ts +4 -4
- package/src/review/view-layout.ts +11 -1
- package/src/review/wait.ts +2 -2
- package/src/review/wakes.ts +7 -3
- package/src/review/watchers.ts +26 -14
- package/src/review/working-guards.ts +39 -0
- package/src/scaffold/jsonc-spans.ts +42 -0
- package/src/scaffold/starter-house.ts +85 -0
- package/src/secrets/about-words.ts +33 -0
- package/src/secrets/archive.ts +2 -2
- package/src/secrets/audit-run.ts +53 -0
- package/src/secrets/audit.ts +407 -0
- package/src/secrets/changed-mark.ts +15 -0
- package/src/secrets/clip.ts +29 -0
- package/src/secrets/held.ts +4 -4
- package/src/secrets/key-pair.ts +14 -0
- package/src/secrets/lapse.ts +3 -3
- package/src/secrets/list.ts +9 -4
- 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 +15 -7
- package/src/secrets/ref-state.ts +18 -0
- package/src/secrets/registry-rows.ts +18 -0
- package/src/secrets/secret-ref.ts +42 -0
- package/src/secrets/secrets-view.ts +299 -0
- package/src/secrets/token-siblings.ts +60 -0
- package/src/secrets/who-reads.ts +27 -21
- package/src/serve/frame-part.ts +50 -0
- package/src/serve/hook-thread.ts +37 -0
- package/src/serve/hook-work.ts +92 -0
- package/src/serve/hook-worker.ts +57 -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 +16 -15
- package/src/serve/hub-app/admin-view.tsx +7 -6
- package/src/serve/hub-app/advice-box.tsx +6 -5
- package/src/serve/hub-app/advisor-app.tsx +78 -13
- package/src/serve/hub-app/advisor-face.tsx +22 -7
- package/src/serve/hub-app/advisor-host.ts +102 -10
- package/src/serve/hub-app/advisor.html +1 -0
- package/src/serve/hub-app/advisors-model.ts +234 -0
- package/src/serve/hub-app/advisors-rights.tsx +66 -0
- package/src/serve/hub-app/advisors-st.ts +430 -34
- package/src/serve/hub-app/advisors-view.tsx +334 -195
- package/src/serve/hub-app/advisors.css +135 -18
- package/src/serve/hub-app/app-bridge.ts +124 -8
- package/src/serve/hub-app/ask-steps.tsx +6 -3
- 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 +50 -8
- package/src/serve/hub-app/backups-st.ts +55 -0
- package/src/serve/hub-app/backups-view.tsx +115 -0
- package/src/serve/hub-app/backups.css +33 -0
- package/src/serve/hub-app/card-head.tsx +3 -2
- package/src/serve/hub-app/check-view.tsx +16 -15
- 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 +6 -5
- package/src/serve/hub-app/col-list-page.tsx +14 -7
- 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 +5 -18
- 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 +9 -8
- package/src/serve/hub-app/commands/commands-page.tsx +6 -5
- package/src/serve/hub-app/commands/commands-st.ts +2 -2
- package/src/serve/hub-app/controls.css +91 -24
- package/src/serve/hub-app/cycle-button.tsx +3 -2
- package/src/serve/hub-app/database-st.ts +41 -12
- package/src/serve/hub-app/database-view.tsx +71 -4
- package/src/serve/hub-app/database.css +3 -0
- 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 +20 -13
- package/src/serve/hub-app/drives-page.tsx +309 -0
- package/src/serve/hub-app/drives-st.ts +486 -0
- package/src/serve/hub-app/drives.css +122 -0
- package/src/serve/hub-app/editor/doc-editor.tsx +4 -3
- 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 -15
- package/src/serve/hub-app/frame-refusal.ts +13 -0
- package/src/serve/hub-app/geometry-view.tsx +4 -3
- package/src/serve/hub-app/git-view.tsx +3 -2
- package/src/serve/hub-app/hash-route.ts +25 -6
- package/src/serve/hub-app/header-bar.tsx +54 -36
- package/src/serve/hub-app/home-pages.ts +40 -0
- package/src/serve/hub-app/home-st.ts +138 -14
- package/src/serve/hub-app/home-strip.css +24 -13
- package/src/serve/hub-app/home-strip.tsx +151 -84
- package/src/serve/hub-app/home.html +6 -0
- package/src/serve/hub-app/hub-app.tsx +108 -103
- package/src/serve/hub-app/hub.css +133 -99
- package/src/serve/hub-app/icons.tsx +24 -0
- package/src/serve/hub-app/identities-st.ts +19 -54
- package/src/serve/hub-app/identities-view.tsx +29 -27
- 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 +26 -19
- package/src/serve/hub-app/inbox.css +1 -0
- package/src/serve/hub-app/index.html +6 -0
- package/src/serve/hub-app/insights-view.tsx +11 -10
- 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 +143 -45
- package/src/serve/hub-app/layout-st.ts +113 -100
- package/src/serve/hub-app/lightbox-zoom.css +46 -0
- package/src/serve/hub-app/list-filter.tsx +58 -8
- 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 +280 -0
- package/src/serve/hub-app/live-sources.ts +260 -0
- package/src/serve/hub-app/live-svc.ts +2 -2
- package/src/serve/hub-app/machine-groups.ts +87 -0
- package/src/serve/hub-app/machine-st.ts +75 -14
- package/src/serve/hub-app/machines-st.ts +100 -3
- package/src/serve/hub-app/machines-view.tsx +50 -3
- package/src/serve/hub-app/machines.css +22 -0
- package/src/serve/hub-app/main-panel.css +217 -0
- package/src/serve/hub-app/main-panel.tsx +257 -0
- package/src/serve/hub-app/markdown.css +12 -2
- package/src/serve/hub-app/md.ts +64 -22
- package/src/serve/hub-app/media-svc.ts +5 -5
- package/src/serve/hub-app/media-view.tsx +32 -22
- package/src/serve/hub-app/messages/messages-page.tsx +22 -12
- 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 +136 -107
- package/src/serve/hub-app/orchestrator-line.tsx +115 -45
- package/src/serve/hub-app/orchestrator-places.tsx +112 -0
- package/src/serve/hub-app/orchestrator.css +62 -5
- package/src/serve/hub-app/page-keys.ts +109 -67
- package/src/serve/hub-app/page-reload.ts +46 -6
- package/src/serve/hub-app/pages-frames.tsx +42 -4
- package/src/serve/hub-app/pages-svc.ts +3 -1
- package/src/serve/hub-app/palette-st.ts +450 -70
- package/src/serve/hub-app/palette-view.tsx +123 -21
- package/src/serve/hub-app/pane-boundary.tsx +3 -2
- 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 +206 -0
- package/src/serve/hub-app/panel-tint.ts +8 -0
- package/src/serve/hub-app/panel-walk.ts +107 -0
- package/src/serve/hub-app/pic.tsx +37 -0
- package/src/serve/hub-app/pick-kinds.ts +101 -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 +109 -0
- package/src/serve/hub-app/plan-view.tsx +4 -3
- package/src/serve/hub-app/planned-view.tsx +6 -5
- package/src/serve/hub-app/polled.ts +25 -4
- package/src/serve/hub-app/presence-st.ts +74 -32
- package/src/serve/hub-app/processes-view.tsx +18 -12
- package/src/serve/hub-app/project-bar.tsx +172 -0
- package/src/serve/hub-app/project-list.css +20 -173
- package/src/serve/hub-app/project-list.tsx +27 -307
- package/src/serve/hub-app/projects-svc.ts +102 -45
- 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 +145 -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 +42 -70
- package/src/serve/hub-app/recordings.css +0 -2
- package/src/serve/hub-app/ref-list-slot.ts +10 -0
- package/src/serve/hub-app/ref-pill.ts +58 -0
- package/src/serve/hub-app/reflections-page.tsx +12 -8
- package/src/serve/hub-app/releases/releases-page.tsx +11 -10
- package/src/serve/hub-app/repo-mark.tsx +29 -0
- package/src/serve/hub-app/repo-sections.ts +137 -41
- package/src/serve/hub-app/repo-st.ts +116 -42
- package/src/serve/hub-app/review/advisor-add.tsx +155 -0
- package/src/serve/hub-app/review/advisor-bar.tsx +93 -22
- package/src/serve/hub-app/review/advisor-invite.tsx +66 -0
- package/src/serve/hub-app/review/ask-proof.tsx +80 -0
- package/src/serve/hub-app/review/attach-view.tsx +16 -14
- package/src/serve/hub-app/review/box-view.ts +496 -0
- package/src/serve/hub-app/review/box-zoom.tsx +70 -0
- package/src/serve/hub-app/review/copy-button.tsx +29 -0
- package/src/serve/hub-app/review/diff-mode.ts +41 -0
- package/src/serve/hub-app/review/diff-view.tsx +95 -21
- package/src/serve/hub-app/review/doc-body.tsx +4 -3
- package/src/serve/hub-app/review/dock.tsx +54 -25
- package/src/serve/hub-app/review/draft-body.tsx +6 -5
- package/src/serve/hub-app/review/faces.tsx +0 -8
- package/src/serve/hub-app/review/group-block.tsx +11 -10
- package/src/serve/hub-app/review/heard-line.tsx +4 -3
- package/src/serve/hub-app/review/instructions-view.tsx +6 -11
- package/src/serve/hub-app/review/item-verdict.tsx +41 -40
- package/src/serve/hub-app/review/kind-states.tsx +5 -4
- package/src/serve/hub-app/review/kind-view.tsx +13 -19
- package/src/serve/hub-app/review/kit.tsx +37 -9
- 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/line-window.ts +51 -8
- package/src/serve/hub-app/review/live-bar.tsx +11 -7
- package/src/serve/hub-app/review/live-view.tsx +14 -13
- package/src/serve/hub-app/review/mention-st.ts +9 -38
- package/src/serve/hub-app/review/object-card.tsx +2 -1
- package/src/serve/hub-app/review/object-panel.tsx +49 -23
- package/src/serve/hub-app/review/outbox-st.ts +200 -0
- package/src/serve/hub-app/review/pano-view.tsx +4 -3
- package/src/serve/hub-app/review/phone-top.tsx +2 -1
- package/src/serve/hub-app/review/question-views.tsx +176 -43
- package/src/serve/hub-app/review/review-cells.tsx +215 -57
- package/src/serve/hub-app/review/review-host.ts +13 -1
- package/src/serve/hub-app/review/review-kit.ts +28 -10
- package/src/serve/hub-app/review/review-list.tsx +136 -129
- package/src/serve/hub-app/review/review-page.tsx +8 -7
- package/src/serve/hub-app/review/review-st.ts +138 -28
- package/src/serve/hub-app/review/review-thread.tsx +444 -228
- package/src/serve/hub-app/review/review-views.tsx +248 -235
- package/src/serve/hub-app/review/secret-facts.ts +2 -1
- package/src/serve/hub-app/review/share-lines.tsx +40 -0
- package/src/serve/hub-app/review/space3d.tsx +17 -9
- package/src/serve/hub-app/review/start-st.ts +137 -0
- package/src/serve/hub-app/review/start-thread.tsx +104 -0
- package/src/serve/hub-app/review/superseded-runs.ts +20 -2
- package/src/serve/hub-app/review/thread-close.tsx +24 -32
- package/src/serve/hub-app/review/thread-control.tsx +5 -4
- package/src/serve/hub-app/review/thread-st.ts +293 -65
- package/src/serve/hub-app/review/thread-views.ts +3 -2
- package/src/serve/hub-app/review/trailer-body.tsx +7 -6
- package/src/serve/hub-app/review/trailer-page.tsx +46 -44
- 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 +31 -30
- package/src/serve/hub-app/review/zoom-still.tsx +60 -0
- package/src/serve/hub-app/review.css +319 -79
- package/src/serve/hub-app/row-acts.tsx +128 -0
- package/src/serve/hub-app/row-face.tsx +28 -0
- package/src/serve/hub-app/run-page.tsx +236 -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 +4 -3
- package/src/serve/hub-app/secret-cli.tsx +32 -0
- package/src/serve/hub-app/secret-readable.tsx +59 -0
- package/src/serve/hub-app/secret-refs.ts +173 -0
- 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 +5 -2
- package/src/serve/hub-app/seen-rows.ts +72 -0
- package/src/serve/hub-app/session-chips.tsx +55 -0
- package/src/serve/hub-app/shared-faces.tsx +32 -0
- package/src/serve/hub-app/shell.ts +56 -0
- package/src/serve/hub-app/side-frame-view.tsx +115 -0
- package/src/serve/hub-app/side-frame.ts +120 -0
- package/src/serve/hub-app/site/site-part.tsx +12 -11
- 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 +8 -7
- package/src/serve/hub-app/social/comms-page.tsx +32 -29
- package/src/serve/hub-app/social/copy-forms.ts +31 -0
- package/src/serve/hub-app/social/group-editor.tsx +2 -1
- package/src/serve/hub-app/social/kit.tsx +48 -28
- package/src/serve/hub-app/social/next-release.tsx +3 -2
- package/src/serve/hub-app/social/post-card.tsx +26 -25
- package/src/serve/hub-app/social/post-page.tsx +4 -3
- package/src/serve/hub-app/social/problems.tsx +3 -2
- package/src/serve/hub-app/social/social-page.tsx +58 -37
- package/src/serve/hub-app/social/social-st.ts +12 -4
- package/src/serve/hub-app/social/stage-popup.tsx +15 -14
- package/src/serve/hub-app/social.css +14 -6
- package/src/serve/hub-app/source-acts.ts +79 -0
- package/src/serve/hub-app/source-page.tsx +19 -0
- package/src/serve/hub-app/space-view.tsx +8 -7
- package/src/serve/hub-app/stores/stores-page.tsx +32 -29
- 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-gone.tsx +41 -0
- package/src/serve/hub-app/terminal-history-st.ts +115 -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 +328 -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 +155 -0
- package/src/serve/hub-app/terminal-panel.tsx +62 -11
- package/src/serve/hub-app/terminal-picture.ts +78 -0
- package/src/serve/hub-app/terminal-sources.tsx +605 -0
- package/src/serve/hub-app/terminal-st.ts +503 -168
- package/src/serve/hub-app/terminal-stream.ts +233 -0
- package/src/serve/hub-app/terminal-tab.tsx +65 -0
- package/src/serve/hub-app/terminal-widths.ts +30 -0
- package/src/serve/hub-app/terminal.css +55 -4
- package/src/serve/hub-app/test-view.tsx +7 -5
- package/src/serve/hub-app/tests-view.tsx +19 -18
- package/src/serve/hub-app/theme-st.ts +5 -0
- package/src/serve/hub-app/thread-row.tsx +49 -31
- package/src/serve/hub-app/time-ago.tsx +3 -2
- package/src/serve/hub-app/time-charts.tsx +3 -2
- package/src/serve/hub-app/time-pages.tsx +3 -2
- package/src/serve/hub-app/time-view.tsx +8 -6
- 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 +22 -13
- 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 +87 -0
- package/src/serve/hub-app/url-forms.tsx +275 -0
- package/src/serve/hub-app/url-needs.ts +31 -0
- package/src/serve/hub-app/urls-svc.ts +321 -21
- package/src/serve/hub-app/urls-view.tsx +114 -78
- package/src/serve/hub-app/urls.css +85 -2
- package/src/serve/hub-app/vault-view.tsx +18 -17
- package/src/serve/hub-app/veille/veille-page.tsx +42 -40
- package/src/serve/hub-app/veille/veille-st.ts +6 -3
- package/src/serve/hub-app/view-layout.css +5 -3
- package/src/serve/hub-app/when-view.tsx +6 -5
- package/src/serve/hub-app/wikis-view.tsx +7 -6
- package/src/serve/hub-app/word-refs.ts +12 -0
- package/src/serve/hub-app/words.tsx +30 -6
- 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/picture-types.ts +10 -0
- package/src/serve/project-gutter-route.ts +81 -15
- package/src/serve/read-thread.ts +31 -12
- package/src/serve/read-worker.ts +14 -2
- package/src/serve/runs-stamp.ts +33 -0
- package/src/serve/secret-ref-routes.ts +71 -0
- package/src/serve/secrets-read.ts +156 -0
- package/src/serve/serve-hub.ts +97 -23
- package/src/serve/terminal-claudes.ts +222 -0
- package/src/serve/terminal-guard.ts +15 -6
- package/src/serve/terminal-host.ts +521 -0
- package/src/serve/terminal-paste.ts +49 -0
- package/src/serve/terminal-record.ts +110 -0
- package/src/serve/terminal-route.ts +479 -103
- package/src/serve/terminal-shells.ts +3 -0
- package/src/serve/terminal-watch.ts +102 -0
- package/src/serve/tracked-watch.ts +13 -11
- package/src/setup-house.ts +333 -0
- package/src/shipkit-files.ts +23 -7
- package/src/shot/client.ts +4 -9
- package/src/shot/film-box.ts +1 -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/discord-layout.ts +1 -1
- package/src/social/kind-pages.ts +11 -5
- package/src/social/media-limit.ts +18 -8
- package/src/social/media-of.ts +5 -5
- package/src/social/publish/discord.ts +1 -1
- package/src/social/routes.ts +8 -5
- package/src/social/writes.ts +3 -0
- package/src/start-repo.ts +5 -0
- package/src/suite/judge-suites.ts +9 -51
- package/src/suite/red-alone.ts +69 -0
- package/src/suite/suite-cli.ts +27 -26
- package/src/suite/test-units.ts +6 -2
- package/src/trailer/sound/eleven.ts +1 -0
- package/src/trailer/titles.ts +2 -2
- package/src/urls/added.ts +130 -0
- package/src/urls/fill.ts +127 -0
- package/src/urls/frame.ts +39 -0
- package/src/urls/icons.ts +294 -0
- package/src/urls/places.ts +145 -0
- package/src/urls/routes.ts +43 -13
- package/src/urls/rows.ts +133 -25
- package/src/urls/totp.ts +121 -0
- package/src/urls/unit.ts +123 -10
- package/src/urls/write-routes.ts +323 -0
- package/src/vault/vault-destroy.ts +2 -1
- package/src/vault/vault-import.ts +6 -20
- package/src/vault/vault-init.ts +2 -1
- package/src/vault/vault-restore.ts +4 -11
- package/src/veille/chrome.ts +7 -2
- package/src/veille/identity.ts +12 -5
- 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/wiki/graph-page.ts +27 -37
- package/src/wiki/graph-positions.ts +13 -3
- package/src/wiki/graph-sim.ts +77 -0
- package/src/wiki/run-wiki.ts +12 -1
- package/src/advisors/edge/certs.ts +0 -20
- package/src/advisors/edge/jwt.ts +0 -76
- package/src/advisors/edge/worker.ts +0 -52
- package/src/advisors/r2.ts +0 -48
- package/src/media-store/backup/thread-copy.ts +0 -339
- 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/review/move.ts +0 -492
- 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
package/src/hq/thread-sync.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
// the daemon's side of the items in the hq (wiki tools/shipkit/threads-store.md): the
|
|
2
|
-
// its copy of the hq's rows. Out: every head and message the hq lacks, by its rev, goes to the outbox. In:
|
|
3
|
-
// of the feed is written as the
|
|
4
|
-
// The one constraint a reader breaks first:
|
|
1
|
+
// the daemon's side of the items in the hq (wiki tools/shipkit/threads-store.md): the rows of this machine's daemon
|
|
2
|
+
// file are its copy of the hq's rows. Out: every head and message the hq lacks, by its rev, goes to the outbox. In:
|
|
3
|
+
// every row of the feed is written as the row it is, through the review store. Every reader reads the local rows.
|
|
4
|
+
// The one constraint a reader breaks first: a row of the feed lands through its kind (hq/kinds), which calls the
|
|
5
|
+
// store's landHead or landMessage, never a write of the rows here
|
|
5
6
|
import { Database } from 'bun:sqlite'
|
|
7
|
+
import { existsSync } from 'node:fs'
|
|
6
8
|
import { basename, dirname } from 'node:path'
|
|
7
9
|
import { itemProblems, messageProblems } from '../review/model.ts'
|
|
8
|
-
import { itemIds, itemStamp, GONE, goneCreated, goneEntries, hasReplaced, MAX_ID_LENGTH, rawHead, rawMessage, revOf, storeDir,
|
|
10
|
+
import { itemIds, itemStamp, GONE, goneCreated, goneEntries, hasReplaced, MAX_ID_LENGTH, rawHead, rawMessage, revOf, storeDir, storeStamp, threadIds } from '../review/store.ts'
|
|
9
11
|
import type { FeedLink } from './hq-routes.ts'
|
|
10
12
|
import { MAX_ROW_BYTES, type Grant, type Refused } from './hq-store.ts'
|
|
11
13
|
import { kindOf } from './kinds/index.ts'
|
|
@@ -15,14 +17,15 @@ import { ITEM_MAX_ROW_BYTES, itemName } from './kinds/item.ts'
|
|
|
15
17
|
import { Ledger, readFeed, type FeedRead } from './ledger.ts'
|
|
16
18
|
import { leaseHolder, tryLease } from '../core/locked-write.ts'
|
|
17
19
|
import type { RetryCap } from './ledger.ts'
|
|
18
|
-
import {
|
|
20
|
+
import { flush, OUTBOX_MAX_ROWS, Outbox, type Flushed, type HqLink } from './outbox.ts'
|
|
21
|
+
import { daemonDbPath, daemonTablesReady, lookDaemonDb, openDaemonDb } from './daemon-db.ts'
|
|
19
22
|
import { repoKey } from './report.ts'
|
|
20
23
|
import { withItemsDb } from '../review/item-db.ts'
|
|
24
|
+
import { HELD_REPOS } from '../review/item-hq.ts'
|
|
21
25
|
|
|
22
26
|
import { machineDelete, machineGet, machineSet, openMachineFile } from '../core/machine-db.ts'
|
|
23
|
-
import {
|
|
27
|
+
import { isForeign } from '../core/foreign.ts'
|
|
24
28
|
|
|
25
|
-
export { threadsOn, HQ_THREADS, setThreadsOn } from './switch.ts'
|
|
26
29
|
|
|
27
30
|
/** the rows put in the outbox before it is sent, so the outbox stays far under its cap during a first run */
|
|
28
31
|
export const OUT_CHUNK = 1000
|
|
@@ -31,16 +34,18 @@ export const OUT_CHUNK = 1000
|
|
|
31
34
|
export type HeldRepo = { id: string; name: string; path: string }
|
|
32
35
|
|
|
33
36
|
/** each repo of this machine by its key, its remote as host and path. Two folders of one key (two clones of one remote)
|
|
34
|
-
* are carried by neither: a row of the feed would have two homes. A repo with no remote is not carried (`left`)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
* are carried by neither: a row of the feed would have two homes. A repo with no remote is not carried (`left`), nor a
|
|
38
|
+
* foreign one, whose items never leave this Mac (`foreign`, core/foreign.ts) */
|
|
39
|
+
export async function heldRepos(repos: readonly { name: string; path: string }[], keyOf: (path: string) => Promise<string | undefined> = repoKey): Promise<{ held: HeldRepo[]; twice: string[]; left: string[]; foreign: string[] }> {
|
|
40
|
+
const outside = repos.filter((r) => isForeign(r.path))
|
|
41
|
+
const keyed = await Promise.all(repos.filter((r) => !outside.includes(r)).map(async (r) => ({ key: await keyOf(r.path), name: r.name, path: r.path })))
|
|
37
42
|
// a repo with no remote has no name two machines share: two repos of one folder name would share their items
|
|
38
43
|
const left = keyed.filter((r) => r.key == null).map((r) => r.name)
|
|
39
44
|
const all = keyed.flatMap((r) => (r.key == null ? [] : [{ id: r.key, name: r.name, path: r.path }]))
|
|
40
45
|
const count = new Map<string, number>()
|
|
41
46
|
for (const r of all) count.set(r.id, (count.get(r.id) ?? 0) + 1)
|
|
42
47
|
const twice = [...count].filter(([, n]) => n > 1).map(([id]) => id)
|
|
43
|
-
return { held: all.filter((r) => count.get(r.id) === 1), twice, left }
|
|
48
|
+
return { held: all.filter((r) => count.get(r.id) === 1), twice, left, foreign: outside.map((r) => r.name) }
|
|
44
49
|
}
|
|
45
50
|
|
|
46
51
|
/** may a node of this grant write and read that repo: `all`, or a repo grant that names it exactly. A grant not
|
|
@@ -313,10 +318,9 @@ export function tickLines(t: ThreadsTick, dry: boolean): { lines: string[]; warn
|
|
|
313
318
|
return { lines, warns: t.warns }
|
|
314
319
|
}
|
|
315
320
|
|
|
316
|
-
/** the job's body, in its child
|
|
321
|
+
/** the job's body, in its child */
|
|
317
322
|
export async function hqThreadsTick(o: { repos: { name: string; path: string }[]; print: (l: string) => void; printErr: (l: string) => void; dry?: boolean }): Promise<number> {
|
|
318
323
|
const dry = o.dry === true
|
|
319
|
-
if (!dry && !threadsOn()) return 0
|
|
320
324
|
// one look at a time: a look run by hand beside the daemon's own would send the same rows twice
|
|
321
325
|
const lease = dry ? null : tryThreadsLease('hq threads')
|
|
322
326
|
if (!dry && lease == null) {
|
|
@@ -370,7 +374,6 @@ export async function giveBack(o: { db: Database; link: HqLink & FeedLink; repos
|
|
|
370
374
|
* look's lease (a look of the daemon at work is waited for); its one line */
|
|
371
375
|
export async function giveBackHere(lost: number | null, o: { waitMs?: number } = {}): Promise<string> {
|
|
372
376
|
const after = '; the feed is read again from its start at the next look of hq threads, and gives back what the hq holds then'
|
|
373
|
-
if (!threadsOn()) return `the switch hq-cards is off: nothing came back from the hq${lost == null ? '' : `, ${lost} rows lost`}`
|
|
374
377
|
const { myHq } = await import('./hq-local.ts')
|
|
375
378
|
const hq = myHq()
|
|
376
379
|
if ('refused' in hq) return `the hq is not reached (${hq.refused})${after}`
|
|
@@ -405,15 +408,15 @@ async function oneLook(o: { repos: { name: string; path: string }[]; print: (l:
|
|
|
405
408
|
o.printErr(`WARN hq threads: ${hq.refused}`)
|
|
406
409
|
return 1
|
|
407
410
|
}
|
|
408
|
-
const db = dry ?
|
|
411
|
+
const db = dry ? lookDaemonDb() : openDaemonDb()
|
|
409
412
|
if (db == null) {
|
|
410
413
|
o.printErr("WARN hq threads: the daemon's own database does not open, nothing is sent")
|
|
411
414
|
return 1
|
|
412
415
|
}
|
|
413
416
|
try {
|
|
414
|
-
const { held, twice, left } = await heldRepos(o.repos)
|
|
417
|
+
const { held, twice, left, foreign } = await heldRepos(o.repos)
|
|
415
418
|
// said when it changes: the job runs every 30 s
|
|
416
|
-
const leftLine = left.length === 0 ? '' : `the repos with no remote stay on this machine: ${left.join(', ')}`
|
|
419
|
+
const leftLine = [left.length === 0 ? '' : `the repos with no remote stay on this machine: ${left.join(', ')}`, foreign.length === 0 ? '' : `the foreign repos stay on this machine: ${foreign.join(', ')}`].filter((l) => l !== '').join('; ')
|
|
417
420
|
if (!dry && new Ledger(db, new Map()).word('cards-left') !== leftLine) {
|
|
418
421
|
if (leftLine !== '') o.print(`ok: hq threads: ${leftLine}`)
|
|
419
422
|
new Ledger(db, new Map()).setWord('cards-left', leftLine)
|
|
@@ -421,6 +424,7 @@ async function oneLook(o: { repos: { name: string; path: string }[]; print: (l:
|
|
|
421
424
|
const now = Date.now()
|
|
422
425
|
const stores = held.map((r) => storeDir(r.path))
|
|
423
426
|
if (!dry && JSON.stringify(machineGet<string[]>(STORES) ?? []) !== JSON.stringify(stores)) machineSet(STORES, stores)
|
|
427
|
+
if (!dry && JSON.stringify(machineGet<HeldRepo[]>(HELD_REPOS) ?? []) !== JSON.stringify(held)) machineSet(HELD_REPOS, held)
|
|
424
428
|
const w = walkSet(stores, new Ledger(db, new Map()), now)
|
|
425
429
|
const t = await threadsTick({ db, link: hq, repos: held, now, dry, ...(w.walk == null ? {} : { walk: w.walk }) })
|
|
426
430
|
if (!dry && t.warns.length === 0) w.done()
|
|
@@ -434,21 +438,6 @@ async function oneLook(o: { repos: { name: string; path: string }[]; print: (l:
|
|
|
434
438
|
}
|
|
435
439
|
}
|
|
436
440
|
|
|
437
|
-
/** the daemon's database for a dry look: read only, or an empty one in memory while it is older than the ledger, so
|
|
438
|
-
* a look never changes it */
|
|
439
|
-
function lookDb(): Database {
|
|
440
|
-
try {
|
|
441
|
-
const db = openMachineFile(daemonDbPath(), { readonly: true })
|
|
442
|
-
if (daemonTablesReady(db)) return db
|
|
443
|
-
db.close()
|
|
444
|
-
} catch {
|
|
445
|
-
// no file yet: the look starts from nothing
|
|
446
|
-
}
|
|
447
|
-
const mem = new Database(':memory:')
|
|
448
|
-
mem.exec(DAEMON_DB_SCHEMA)
|
|
449
|
-
return mem
|
|
450
|
-
}
|
|
451
|
-
|
|
452
441
|
/** the daemon's cursor in the feed, read only: null before the ledger exists */
|
|
453
442
|
export function readCursor(path: string = daemonDbPath()): { gen: string; n: number } | null {
|
|
454
443
|
try {
|
|
@@ -464,19 +453,20 @@ export function readCursor(path: string = daemonDbPath()): { gen: string; n: num
|
|
|
464
453
|
}
|
|
465
454
|
}
|
|
466
455
|
|
|
467
|
-
/** the rows of the feed that wait for this machine's disk, and since when the oldest, read only
|
|
468
|
-
* daemon's file does not read */
|
|
469
|
-
export function waitingRows(path: string = daemonDbPath()): { n: number; since: number | null } |
|
|
456
|
+
/** the rows of the feed that wait for this machine's disk, and since when the oldest, read only: none before the
|
|
457
|
+
* daemon's file or its ledger exists, `unread` with the reason when the file is there and does not read */
|
|
458
|
+
export function waitingRows(path: string = daemonDbPath()): { n: number; since: number | null } | { unread: string } {
|
|
459
|
+
if (!existsSync(path)) return { n: 0, since: null }
|
|
470
460
|
try {
|
|
471
461
|
const db = openMachineFile(path, { readonly: true })
|
|
472
462
|
try {
|
|
473
|
-
if (!daemonTablesReady(db)) return null
|
|
463
|
+
if (!daemonTablesReady(db)) return { n: 0, since: null }
|
|
474
464
|
return new Ledger(db, new Map()).retryState()
|
|
475
465
|
} finally {
|
|
476
466
|
db.close()
|
|
477
467
|
}
|
|
478
|
-
} catch {
|
|
479
|
-
return
|
|
468
|
+
} catch (e) {
|
|
469
|
+
return { unread: (e as Error).message }
|
|
480
470
|
}
|
|
481
471
|
}
|
|
482
472
|
|
|
@@ -492,7 +482,7 @@ const WALK = 'hq-cards-walk:'
|
|
|
492
482
|
export const WALK_ALL_MS = 5 * 60_000
|
|
493
483
|
|
|
494
484
|
/** the review folders the job walks this look, null for all of them: the first look, and one each WALK_ALL_MS. The
|
|
495
|
-
* daemon's due notes the folders it saw move in its own process; a folder
|
|
485
|
+
* daemon's due notes the folders it saw move in its own process; a folder is also walked when its rows moved
|
|
496
486
|
* since this ledger's last walk of it, so a look run by hand or right after a daemon starts misses no write */
|
|
497
487
|
export function walkSet(stores: readonly string[], ledger: Ledger, now: number): { walk: Set<string> | null; done: () => void } {
|
|
498
488
|
const all = now - Number(ledger.word('walked-all') ?? '0') >= WALK_ALL_MS
|
|
@@ -500,7 +490,7 @@ export function walkSet(stores: readonly string[], ledger: Ledger, now: number):
|
|
|
500
490
|
const v = machineGet<string>(`${WALK}${d}`)
|
|
501
491
|
return v == null ? [] : [[d, v] as const]
|
|
502
492
|
}))
|
|
503
|
-
const rows =
|
|
493
|
+
const rows = new Map(stores.map((d) => [d, storeStamp(d)] as const))
|
|
504
494
|
const moved = [...rows].filter(([d, s]) => ledger.word(`${WALKED}${d}`) !== s).map(([d]) => d)
|
|
505
495
|
const walk = all ? null : new Set([...seen.keys(), ...moved])
|
|
506
496
|
return {
|
|
@@ -518,7 +508,6 @@ const WALKED = 'walked:'
|
|
|
518
508
|
/** the due of the job in the daemon's process: the review folders the job last held, from the machine db (the
|
|
519
509
|
* job writes them, so the due never lists the house) */
|
|
520
510
|
export async function threadsDueHere(_root: string, now: number): Promise<boolean> {
|
|
521
|
-
if (!threadsOn()) return false
|
|
522
511
|
const { myHq } = await import('./hq-local.ts')
|
|
523
512
|
return threadsDue({ stores: machineGet<string[]>(STORES) ?? [], link: myHq(), cursor: () => readCursor(), now }, dueHeld)
|
|
524
513
|
}
|
|
@@ -532,17 +521,14 @@ export const giveUpAfter = (ms: number): GiveUp => (abort) => {
|
|
|
532
521
|
return () => clearTimeout(t)
|
|
533
522
|
}
|
|
534
523
|
|
|
535
|
-
/** is a look of the job due, in the daemon's loop, in a few ms: the
|
|
536
|
-
*
|
|
537
|
-
*
|
|
538
|
-
* that missed an event. No walk and no stat of an item here */
|
|
524
|
+
/** is a look of the job due, in the daemon's loop, in a few ms: the rows' stamp of each review folder, one small call
|
|
525
|
+
* that tells whether the feed moved past this daemon's cursor, and every WALK_ALL_MS anyway: the job's child then
|
|
526
|
+
* walks every folder. No walk and no read of an item here */
|
|
539
527
|
export async function threadsDue(o: { stores: readonly string[]; link: FeedLink | Refused; cursor: () => { gen: string; n: number } | null; now?: number; giveUp?: GiveUp }, held: { stamps: Map<string, string>; at?: number }): Promise<boolean> {
|
|
540
|
-
if (!threadsOn()) return false
|
|
541
528
|
const now = o.now ?? Date.now()
|
|
542
|
-
const { storeMoved } = await import('../review/store.ts')
|
|
543
529
|
let moved = false
|
|
544
530
|
for (const d of o.stores) {
|
|
545
|
-
const s =
|
|
531
|
+
const s = storeStamp(d)
|
|
546
532
|
if (held.stamps.get(d) === s) continue
|
|
547
533
|
held.stamps.set(d, s)
|
|
548
534
|
machineSet(`${WALK}${d}`, s)
|
|
@@ -566,7 +552,8 @@ export async function threadsDue(o: { stores: readonly string[]; link: FeedLink
|
|
|
566
552
|
/** one repo compared with the hq: the names on this machine the hq lacks, the ones the hq holds this machine lacks,
|
|
567
553
|
* and the ones both hold at two revs. Each is named by its wire kind (the stored names): a head `card <id>`, a message
|
|
568
554
|
* `card-msg <id>/<message>` */
|
|
569
|
-
|
|
555
|
+
/** `heads`, `messages`: what this machine holds of the repo */
|
|
556
|
+
export type RepoDiff = { repo: string; heads: number; messages: number; onlyHere: string[]; onlyHq: string[]; differ: string[]; replaced: string[] }
|
|
570
557
|
|
|
571
558
|
/** every head and message of each repo of this machine and the grant, against what the hq holds of it, by rev */
|
|
572
559
|
export async function threadsDiff(link: HqLink & FeedLink, repos: readonly HeldRepo[]): Promise<RepoDiff[] | Refused> {
|
|
@@ -596,7 +583,8 @@ export async function threadsDiff(link: HqLink & FeedLink, repos: readonly HeldR
|
|
|
596
583
|
for (const r of theirs.revs['card-gone'] ?? []) deleted.set(r.name, [...(deleted.get(r.name) ?? []), r.rev])
|
|
597
584
|
for (const [kind, rows] of Object.entries(theirs.revs)) if (kind !== 'card-gone') for (const r of rows) hq.set(`${kind} ${r.name}`, r.rev)
|
|
598
585
|
for (const [id, created] of deleted) if (here.has(`card ${id}`) && (created.includes('') || created.includes(made.get(id) ?? ''))) here.set(`card ${id}`, 'deleted in the hq')
|
|
599
|
-
const
|
|
586
|
+
const keys = [...here.keys()]
|
|
587
|
+
const d: RepoDiff = { repo: repo.id, heads: keys.filter((k) => k.startsWith('card ')).length, messages: keys.filter((k) => k.startsWith('card-msg ')).length, onlyHere: [], onlyHq: [], differ: [], replaced: itemIds(dir).filter((id) => hasReplaced(dir, id)) }
|
|
600
588
|
for (const [k, rev] of here) {
|
|
601
589
|
const h = hq.get(k)
|
|
602
590
|
if (h == null) d.onlyHere.push(k)
|
package/src/http/door-forward.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
// the
|
|
1
|
+
// the hq's proxy to a machine's local url (wiki tools/shipkit/hq.md, The hq's proxy): the address a process gets on the hq's home
|
|
2
2
|
// (`<process>.<machine>.localhost`, an origin of its own), what crosses each hop and what never does. The same hop
|
|
3
3
|
// frames a declared url behind http basic auth at `<url id>--<repo>.localhost`, its login added on the server
|
|
4
4
|
// (wiki tools/shipkit/urls.md). Light on purpose: the web imports it. The one constraint a reader breaks first: the
|
|
5
5
|
// target's origin always comes from a lookup (hq/door.ts, urls/frame.ts), never from the request; the request gives a
|
|
6
6
|
// path and names, never an address
|
|
7
|
-
import { DNS_LABEL, doorOrigin, loopbackOrigin, machineLabel,
|
|
7
|
+
import { DNS_LABEL, doorOrigin, loopbackOrigin, machineLabel, urlFrameOrigin, urlLabelOf } from './door-names.ts'
|
|
8
8
|
import { createHmac } from 'crypto'
|
|
9
9
|
import { readFileSync } from 'fs'
|
|
10
10
|
import { join } from 'path'
|
|
@@ -39,29 +39,26 @@ export const doorPolicy = (host: string): string => `default-src 'self' 'unsafe-
|
|
|
39
39
|
const LABEL = DNS_LABEL
|
|
40
40
|
const PROCESS_ID = /^[a-z][a-z0-9-]*$/
|
|
41
41
|
|
|
42
|
-
/** the process and machine a Host names, `<process>.<machine>.localhost[:port]`; null for any other name
|
|
42
|
+
/** the process and machine a Host names, `<process>.<machine>.localhost[:port]`; null for any other name. A label
|
|
43
|
+
* with `--` is a url a place declares, `<url id>--<repo>` (urlLabelOf), never a process: `process` holds it whole */
|
|
43
44
|
export function doorHostOf(host: string | null): { process: string; machine: string } | null {
|
|
44
45
|
if (host == null) return null
|
|
45
46
|
const name = host.trim().toLowerCase().replace(/:\d+$/, '').replace(/\.$/, '')
|
|
46
47
|
const parts = name.split('.')
|
|
47
48
|
if (parts.length !== 3 || parts[2] !== 'localhost') return null
|
|
48
49
|
const [process, machine] = parts as [string, string]
|
|
49
|
-
|
|
50
|
+
const named = process.includes('--') ? urlLabelOf(process) != null : PROCESS_ID.test(process)
|
|
51
|
+
return LABEL.test(process) && named && LABEL.test(machine) ? { process, machine } : null
|
|
50
52
|
}
|
|
51
53
|
|
|
52
|
-
export { doorOrigin, loopbackOrigin, machineLabel, urlFrameOrigin }
|
|
54
|
+
export { doorOrigin, loopbackOrigin, machineLabel, urlFrameOrigin, urlLabelOf }
|
|
53
55
|
|
|
54
56
|
/** the declared url a Host names, `<url id>--<repo>.localhost[:port]` (urlFrameLabel); null for any other name */
|
|
55
57
|
export function urlHostOf(host: string | null): { id: string; repo: string } | null {
|
|
56
58
|
if (host == null) return null
|
|
57
59
|
const parts = host.trim().toLowerCase().replace(/:\d+$/, '').replace(/\.$/, '').split('.')
|
|
58
60
|
if (parts.length !== 2 || parts[1] !== 'localhost') return null
|
|
59
|
-
|
|
60
|
-
const cut = label.lastIndexOf('--')
|
|
61
|
-
if (cut < 1) return null
|
|
62
|
-
const id = label.slice(0, cut)
|
|
63
|
-
const repo = label.slice(cut + 2)
|
|
64
|
-
return urlFrameLabel(id, repo) === label && machineLabel(repo) === repo ? { id, repo } : null
|
|
61
|
+
return urlLabelOf(parts[0]!)
|
|
65
62
|
}
|
|
66
63
|
|
|
67
64
|
/** the hub page's own origins on a port: the three loopback names the home's page is opened by on this Mac */
|
|
@@ -114,9 +111,10 @@ export function loginHop(url: string, target: string): boolean {
|
|
|
114
111
|
/** whether an answer asks for an http basic login */
|
|
115
112
|
export const basicChallenge = (r: Response): boolean => r.status === 401 && /(^|,)\s*basic(\s|$|,)/i.test(r.headers.get('www-authenticate') ?? '')
|
|
116
113
|
|
|
117
|
-
/** a door's `/door/<id>/<rest>` path read: the process id
|
|
114
|
+
/** a door's `/door/<id>/<rest>` path read: the process id (or a url's label, `<url id>--<repo>`) and the rest, which
|
|
115
|
+
* starts with `/`; null for another path */
|
|
118
116
|
export function doorPathOf(path: string): { id: string; rest: string } | null {
|
|
119
|
-
const m = /^\/door\/([a-
|
|
117
|
+
const m = /^\/door\/([a-z0-9][a-z0-9-]*)(\/.*)?$/.exec(path)
|
|
120
118
|
return m == null ? null : { id: m[1]!, rest: m[2] ?? '/' }
|
|
121
119
|
}
|
|
122
120
|
|
|
@@ -146,7 +144,7 @@ export function broughtByProxy(req: Request): boolean {
|
|
|
146
144
|
export function foreignOrigin(req: Request, own: string): string | null {
|
|
147
145
|
const origin = req.headers.get('origin')
|
|
148
146
|
if (origin == null || origin === own) return null
|
|
149
|
-
return `refused: a request from ${origin.slice(0, 80)} does not reach a process through the
|
|
147
|
+
return `refused: a request from ${origin.slice(0, 80)} does not reach a process through the proxy, only one of its own page`
|
|
150
148
|
}
|
|
151
149
|
|
|
152
150
|
/** the headers a hop sends on: the browser's minus DROP, `Origin` the process's own when the browser named the door's.
|
|
@@ -259,7 +257,7 @@ export async function forwardHop(req: Request, url: string, o: { target: string;
|
|
|
259
257
|
if (!/^text\/html/i.test(r.headers.get('content-type') ?? '') || req.method === 'HEAD') return new Response(r.body, { status: r.status, statusText: r.statusText, headers: back })
|
|
260
258
|
return new Response(o.page!(await r.text()), { status: r.status, statusText: r.statusText, headers: back })
|
|
261
259
|
} catch (e) {
|
|
262
|
-
return new Response(`the process does not answer through the
|
|
260
|
+
return new Response(`the process does not answer through the proxy (${(e as Error).message.slice(0, 200)})`, { status: 502, headers: { 'content-type': 'text/plain; charset=utf-8', 'cache-control': 'no-store', [DOWN_HEADER]: 'down' } })
|
|
263
261
|
}
|
|
264
262
|
}
|
|
265
263
|
|
package/src/http/door-names.ts
CHANGED
|
@@ -22,6 +22,15 @@ export function urlFrameLabel(id: string, repo: string): string | null {
|
|
|
22
22
|
return /^[a-z0-9][a-z0-9-]*$/.test(id) && machineLabel(repo) !== '' && DNS_LABEL.test(label) ? label : null
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
/** the url id and repo label a url's label names, split at its last `--`; null for a label that is none */
|
|
26
|
+
export function urlLabelOf(label: string): { id: string; repo: string } | null {
|
|
27
|
+
const cut = label.lastIndexOf('--')
|
|
28
|
+
if (cut < 1) return null
|
|
29
|
+
const id = label.slice(0, cut)
|
|
30
|
+
const repo = label.slice(cut + 2)
|
|
31
|
+
return urlFrameLabel(id, repo) === label && machineLabel(repo) === repo ? { id, repo } : null
|
|
32
|
+
}
|
|
33
|
+
|
|
25
34
|
/** the address of a declared url the home frames: `<url id>--<repo>.localhost` on the home's port */
|
|
26
35
|
export function urlFrameOrigin(id: string, repo: string, port: number | string): string | null {
|
|
27
36
|
const label = urlFrameLabel(id, repo)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// a terminal hop, its web half (wiki tools/shipkit/hub.md, A terminal of another place): the path a place's web
|
|
2
|
+
// answers the hq Mac's web on, the tags it writes on what it brings to its daemon, and who may call it. Light: the web
|
|
3
|
+
// imports it. The daemon's half, the key and the switch, is hq/terminal-hop.ts.
|
|
4
|
+
// The one constraint a reader breaks first: the caller is tailscale's whois of the address tailscaled wrote, never a
|
|
5
|
+
// header, and it must be the hq's Mac: a phone, a tagged device, another Mac of the owner and the place itself never type
|
|
6
|
+
import { isPhone, ownersDevice, servedCaller, type TailnetWho } from './tailnet-caller.ts'
|
|
7
|
+
|
|
8
|
+
export { HOP_DEVICE_HEADER, HOP_HEADER, HOP_PATH, HOP_REPO_HEADER, HOP_VERBS, type HopVerb, hopVerb } from './hop-names.ts'
|
|
9
|
+
|
|
10
|
+
/** the device that calls a hop, by tailscale's whois of the address tailscaled wrote: an untagged device of this
|
|
11
|
+
* Mac's owner that is a Mac, not this one. Whether it is the hq's Mac is the daemon's word (it knows the hq it
|
|
12
|
+
* joined): its MagicDNS name goes on as the tag */
|
|
13
|
+
export async function hopCaller(req: Request, who: TailnetWho): Promise<{ device: string } | { refused: string }> {
|
|
14
|
+
const caller = servedCaller(req.headers)
|
|
15
|
+
if ('refused' in caller) return { refused: `a terminal of this machine is reached over the tailnet only: ${caller.refused}` }
|
|
16
|
+
const self = await who.self()
|
|
17
|
+
if (self == null) return { refused: 'tailscale does not answer on this machine' }
|
|
18
|
+
const peer = await ownersDevice(who, self, caller)
|
|
19
|
+
if ('refused' in peer) return peer
|
|
20
|
+
if (peer.id === self.id) return { refused: 'a machine never hops into its own terminals' }
|
|
21
|
+
if (isPhone(peer)) return { refused: 'a phone never types into a terminal of another machine' }
|
|
22
|
+
return { device: peer.node.toLowerCase() }
|
|
23
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// a terminal hop's names (wiki tools/shipkit/hq.md, A terminal hop), with no import: the Bash guard reads them
|
|
2
|
+
// (core/owner-word-policy.ts) as well as the webs (http/hop-caller.ts) and the daemon (hq/terminal-hop.ts)
|
|
3
|
+
|
|
4
|
+
/** the hop's paths on a place's web: `live` (its socket), `open`, `watch`, `close`, `window`, `history`, `paste`.
|
|
5
|
+
* Under the door's `/door/`, never a process's (an id holds no `_`) */
|
|
6
|
+
export const HOP_PATH = '/door/_terminal/'
|
|
7
|
+
export const HOP_VERBS = ['live', 'open', 'watch', 'close', 'window', 'history', 'paste'] as const
|
|
8
|
+
export type HopVerb = (typeof HOP_VERBS)[number]
|
|
9
|
+
export const hopVerb = (v: string): HopVerb | null => ((HOP_VERBS as readonly string[]).includes(v) ? (v as HopVerb) : null)
|
|
10
|
+
|
|
11
|
+
/** the place's web's tags on a hop it brings to its daemon: that it is one, the device tailscale named, the repo */
|
|
12
|
+
export const HOP_HEADER = 'x-shipkit-hop'
|
|
13
|
+
export const HOP_DEVICE_HEADER = 'x-shipkit-hop-device'
|
|
14
|
+
export const HOP_REPO_HEADER = 'x-shipkit-hop-repo'
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
// the one way the house opens a server (wiki tools/shipkit/home.md, Every server on loopback): on 127.0.0.1, behind
|
|
2
|
-
// the Host check and `
|
|
3
|
-
// the owner
|
|
4
|
-
//
|
|
5
|
-
|
|
2
|
+
// the Host check, `sameOrigin` and `socketOrigin` of same-origin.ts (a write, and a socket's upgrade, from this
|
|
3
|
+
// server's own page), a write as the owner and a hub page's socket from a page of the hub only (owner-word.ts),
|
|
4
|
+
// and a write that came over the tailnet from an untagged device of the owner only; RV040 refuses a bare Bun.serve.
|
|
5
|
+
// The one constraint a reader breaks first: every request passes `fetch`, so a server never takes Bun's static
|
|
6
|
+
// `routes`, which skip it
|
|
7
|
+
import { ownerWordRefusal, type TestPage } from './owner-word.ts'
|
|
8
|
+
import { HOST_HEADER, hostName, loopbackName, REACH_HEADER, reachOfCaller, sameOrigin, socketOrigin } from './same-origin.ts'
|
|
6
9
|
import { tailnetRefusal, type TailnetWho } from './tailnet-caller.ts'
|
|
7
10
|
|
|
8
11
|
/** what a server adds to the loopback guard. `hosts`: the other names it answers by (the web's tailnet name, the hq
|
|
@@ -11,21 +14,40 @@ import { tailnetRefusal, type TailnetWho } from './tailnet-caller.ts'
|
|
|
11
14
|
export type LoopbackGuard = {
|
|
12
15
|
hosts?: (name: string) => boolean
|
|
13
16
|
crossSite?: (req: Request) => boolean
|
|
17
|
+
/** a request the server hands whole to another app under a name of that app (a hop): its paths are that app's,
|
|
18
|
+
* so none is a route of the owner's (owner-word.ts) */
|
|
19
|
+
otherApp?: (req: Request) => boolean
|
|
20
|
+
/** the server a browser reaches first (the web): it decides a write as the owner on the browser's own headers,
|
|
21
|
+
* and a tag of the web on a request it receives is a client's own word, never read */
|
|
22
|
+
front?: true
|
|
23
|
+
/** a server no browser reaches (the daemon, behind the web): it reads a write as the owner by the web's tags
|
|
24
|
+
* alone, and what the web did not bring carries no mark of a browser, whatever headers it shows */
|
|
25
|
+
behind?: true
|
|
26
|
+
/** the server was started by a test: its clients stand in for a page of the hub with that test's token
|
|
27
|
+
* (owner-word.ts TestPage). No server the product starts has one */
|
|
28
|
+
testPage?: TestPage
|
|
14
29
|
/** a write over the tailnet: from an untagged device of the owner (the default), or the server's own guard (the
|
|
15
30
|
* hq port and the web's `/door/`: each node's token, the door key); a function decides per request */
|
|
16
31
|
tailnetWrites?: TailnetWrites | ((req: Request) => TailnetWrites)
|
|
17
32
|
/** who calls over the tailnet; absent, this Mac's tailscale (a test passes its own) */
|
|
18
33
|
who?: TailnetWho
|
|
34
|
+
/** a terminal hop of the hq Mac's page that passed its own guard (hq/terminal-hop.ts): a word as the owner on a
|
|
35
|
+
* terminal's path or a page's socket that no browser of this machine brings (the daemon's) */
|
|
36
|
+
terminalHop?: (req: Request) => boolean
|
|
19
37
|
}
|
|
20
38
|
|
|
21
39
|
/** why a request does not reach a server of this machine, null when it does: a Host that is no loopback name nor one
|
|
22
|
-
* the server declares is a page of another site rebound to 127.0.0.1; a write from another site's page is refused
|
|
40
|
+
* the server declares is a page of another site rebound to 127.0.0.1; a write from another site's page is refused,
|
|
41
|
+
* a socket it opens too, and a write as the owner from anything but a page of the hub. `crossSite` never lifts that
|
|
42
|
+
* last one */
|
|
23
43
|
export function loopbackRefusal(req: Request, g: LoopbackGuard = {}): string | null {
|
|
24
44
|
const host = req.headers.get('host') ?? new URL(req.url).host
|
|
25
45
|
const name = hostName(host)
|
|
26
46
|
if (!loopbackName(name) && g.hosts?.(name) !== true) return `refused: this server answers to a loopback name, never to ${host === '' ? 'a request with no Host' : host.slice(0, 80)}`
|
|
27
47
|
if (!sameOrigin(req) && g.crossSite?.(req) !== true) return "refused: a request that changes something comes from this server's own page"
|
|
28
|
-
|
|
48
|
+
// a hop to another app keeps that app's own rule on who opens its sockets
|
|
49
|
+
if (!socketOrigin(req) && g.crossSite?.(req) !== true && g.otherApp?.(req) !== true) return "refused: a socket is opened by this server's own page, never by another site's"
|
|
50
|
+
return g.otherApp?.(req) === true ? null : ownerWordRefusal(req, { front: g.front === true, behind: g.behind === true, ...(g.testPage == null ? {} : { testPage: g.testPage }), ...(g.terminalHop == null ? {} : { hop: g.terminalHop }) })
|
|
29
51
|
}
|
|
30
52
|
|
|
31
53
|
/** what a server of the house declares: no hostname (always 127.0.0.1), no static `routes` (every request passes
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// the gate on the owner's own acts (wiki tools/shipkit/home.md, Every server on loopback): the routes that write a
|
|
2
|
+
// word as the owner (a reply, a verdict, an answer, a new thread, a confirm of an advisor's advice) take it from a
|
|
3
|
+
// page of the hub in a browser, and refuse a program's request. The routes are the data below; `loopbackRefusal`
|
|
4
|
+
// (loopback-serve.ts) runs the decision before every server's fetch, so no route file holds a copy.
|
|
5
|
+
// What he types into a terminal of the hub is a word as the owner too (a line typed into a Claude Code session is a
|
|
6
|
+
// prompt with his permissions): the terminal's routes are a family below, and a hub page's one socket (PAGE_SOCKET,
|
|
7
|
+
// on which his keys go) is opened under the same rule.
|
|
8
|
+
// It guards these routes and nothing else. A word as the owner has doors it does not hold: tmux itself (a command to
|
|
9
|
+
// its socket), the cli run with no agent variable, a browser a program drives, a write straight into the store.
|
|
10
|
+
// The one constraint a reader breaks first: the web drops the browser's Origin and Sec-Fetch-Site as it forwards, so
|
|
11
|
+
// the WEB is the hop that decides (`front`), on the browser's real headers, and it tags what it read (ORIGIN_HEADER,
|
|
12
|
+
// FETCH_SITE_HEADER). Behind it the daemon (`behind`) refuses a request the web did not bring; one the web brought it
|
|
13
|
+
// reads by those tags. The web's tags are headers too: a program that writes them by hand to the daemon's port
|
|
14
|
+
// passes, and the Bash guard is what refuses that command (core/owner-word-policy.ts)
|
|
15
|
+
import { HOST_HEADER, REACH_HEADER, reachOfCaller } from './same-origin.ts'
|
|
16
|
+
|
|
17
|
+
/** the web's tag of the browser's Origin on what it forwards to the daemon */
|
|
18
|
+
export const ORIGIN_HEADER = 'x-shipkit-origin'
|
|
19
|
+
/** the web's tag of the browser's Sec-Fetch-Site on what it forwards to the daemon */
|
|
20
|
+
export const FETCH_SITE_HEADER = 'x-shipkit-fetch-site'
|
|
21
|
+
|
|
22
|
+
/** a family of routes whose every write is the owner's act: `under` a path below a hub's base, `not` the paths under
|
|
23
|
+
* it a program calls by design, behind a guard of their own */
|
|
24
|
+
export type OwnerRoutes = { under: string; what: string; not?: readonly string[] }
|
|
25
|
+
|
|
26
|
+
export const OWNER_WORD_ROUTES: readonly OwnerRoutes[] = [
|
|
27
|
+
{ under: '/api/review', what: 'a thread: his reply, the delete of his own message, answer, verdict, close, reopen, snooze, mute, attach, lane ask, note, raised item, rating, action, read mark, staged draft, file, share, secret' },
|
|
28
|
+
{ under: '/api/trailer', what: 'a trailer: his note on a frame, its state and words, his voice takes' },
|
|
29
|
+
{ under: '/api/act', what: "an ask's done, decline, proof and remark, his act on a reflection, a note on an asset" },
|
|
30
|
+
{ under: '/api/docs', what: 'the editor: his save of a document, a picture he drops into it' },
|
|
31
|
+
{ under: '/api/stores', what: 'a store page: his note in its thread, its texts, his paste ticks' },
|
|
32
|
+
{ under: '/api/social', what: 'the social desk: publish, a draft moved or posted, a setup step, a secret', not: ['/api/social/tracker'] },
|
|
33
|
+
{ under: '/api/veille', what: 'the Veille: his reply to a post, a review raised, a post handled', not: ['/api/veille/batch'] },
|
|
34
|
+
{ under: '/api/messages', what: 'the messages store: his suggestion of a message or a phrasing' },
|
|
35
|
+
{ under: '/api/home/orchestrators', what: "a session made the default, a project placed, a new thread's words, its files and the session it goes to" },
|
|
36
|
+
{ under: '/api/home/advisors', what: "the advisors: a person made or removed, a thread shared or its share ended, a project's access, the rights, an advice confirmed, a proposal accepted, the advisors page set up" },
|
|
37
|
+
{ under: '/api/home/quiet', what: 'his quiet mode: no push to his phone' },
|
|
38
|
+
{ under: '/api/home/switches', what: "a switch that opens this machine to the hq's (its terminals, its urls), at this machine's own hub" },
|
|
39
|
+
{ under: '/api/home/follow', what: 'a place asked to follow main at once (« update now »)', not: ['/api/home/follow/ask'] },
|
|
40
|
+
{ under: '/api/urls', what: 'a url added, edited or removed, how it opens, a login typed, a url opened in Chrome', not: ['/api/urls/copy'] },
|
|
41
|
+
{ under: '/api/drives', what: "a share added, its words, a share removed, a Google login begun" },
|
|
42
|
+
{ under: '/api/secrets/reveal', what: "a page's secret ref: its value shown or copied at the owner's click" },
|
|
43
|
+
{ under: '/api/home/vault/reveal', what: "the vault page's show: one secret's value at the owner's click, read as any house repo in its scope" },
|
|
44
|
+
{ under: '/api/terminal', what: "the terminal: a part asked on a page's socket (a terminal, a list), an act on a terminal (a new one, Claude Code started, one closed), its history" },
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
/** a hub page's one socket (serve/page-live.ts), under a hub alone or under the home's `/r/<repo>`: what he types
|
|
48
|
+
* into a terminal goes on it, so it is opened as a word as the owner is written */
|
|
49
|
+
export const PAGE_SOCKET = /^(?:\/r\/[^/]+)?\/api\/live$/
|
|
50
|
+
|
|
51
|
+
/** a test's stand in for a page of the hub. A check's bun client sends none of a browser's marks, so a hub a TEST
|
|
52
|
+
* started takes this header with the token that test made, in place of the marks. A hub started with none (every
|
|
53
|
+
* hub the product starts) never reads the header. `from` is the one file that makes one: no code of the product
|
|
54
|
+
* can, and the value comes from no variable, file or flag a program could give a running hub
|
|
55
|
+
* (tests/test-page.test.ts reads the source for it) */
|
|
56
|
+
export const TEST_PAGE_HEADER = 'x-shipkit-test-page'
|
|
57
|
+
export type TestPage = { readonly token: string; readonly from: 'tests/test-hub.ts' }
|
|
58
|
+
|
|
59
|
+
const below = (path: string, under: string): boolean => path === under || path.startsWith(`${under}/`)
|
|
60
|
+
/** a path as a hub alone names it: the home's `/r/<repo>` gone */
|
|
61
|
+
const underHub = (path: string): string => path.replace(/^\/r\/[^/]+(?=\/api\/)/, '')
|
|
62
|
+
|
|
63
|
+
/** whether a path, under a hub alone or under the home's `/r/<repo>`, is one of the owner's routes */
|
|
64
|
+
export function ownerWordPath(path: string): boolean {
|
|
65
|
+
const p = underHub(path)
|
|
66
|
+
return OWNER_WORD_ROUTES.some((r) => below(p, r.under) && !(r.not ?? []).some((n) => below(p, n)))
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const READS = new Set(['GET', 'HEAD', 'OPTIONS'])
|
|
70
|
+
|
|
71
|
+
/** `front`: the server a browser reaches first (the web). There a tag is a client's own word and is never read.
|
|
72
|
+
* `behind`: a server no browser reaches (the daemon): what the web did not bring carries no mark, whatever headers
|
|
73
|
+
* of a browser it shows. `testPage`: this server was started by a test */
|
|
74
|
+
export type Hop = { front?: boolean; behind?: boolean; testPage?: TestPage; /** a terminal hop that passed its own guard (the daemon's) */ hop?: (req: Request) => boolean }
|
|
75
|
+
|
|
76
|
+
/** whether tailscaled brought the request: by its own headers at the web, by the web's tag behind it. At the web the
|
|
77
|
+
* tag is whatever the client wrote, so it counts for nothing there */
|
|
78
|
+
export const broughtByTailnet = (req: Request, o: Hop = {}): boolean => (o.front !== true && req.headers.get(REACH_HEADER) === 'tailnet') || reachOfCaller(req) === 'tailnet'
|
|
79
|
+
|
|
80
|
+
/** what the browser said of the request, at the hop that sees the browser or behind the web: its Sec-Fetch-Site, its
|
|
81
|
+
* Origin, and the host it asked (a proxy that frames the page under its own origin passes that host on).
|
|
82
|
+
* `forwarded`: the web brought it, so its marks are the web's tags */
|
|
83
|
+
export function browserMarks(req: Request, o: Hop = {}): { site: string | null; origin: string | null; host: string; forwarded: boolean } {
|
|
84
|
+
const h = req.headers
|
|
85
|
+
const own = h.get('origin')
|
|
86
|
+
const ownSite = h.get('sec-fetch-site')
|
|
87
|
+
// the web strips both and tags what it read: a request that carries either is read by its own headers
|
|
88
|
+
const forwarded = o.front !== true && own == null && ownSite == null && h.has(REACH_HEADER)
|
|
89
|
+
const host = h.get('x-forwarded-host') ?? (forwarded ? h.get(HOST_HEADER) : null) ?? h.get('host') ?? new URL(req.url).host
|
|
90
|
+
if (o.behind === true && !forwarded) return { site: null, origin: null, host: host.toLowerCase(), forwarded }
|
|
91
|
+
return { site: forwarded ? h.get(FETCH_SITE_HEADER) : ownSite, origin: forwarded ? h.get(ORIGIN_HEADER) : own, host: host.toLowerCase(), forwarded }
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** whether a read came from a page of the hub: what a read must be before it writes anything in the owner's name (the
|
|
95
|
+
* secret field's read answers its question once the store holds the value). A browser sends no Origin on its page's
|
|
96
|
+
* own read, so its Sec-Fetch-Site decides; a request tailscaled brought keeps the rule it had */
|
|
97
|
+
export function ownerPageRead(req: Request): boolean {
|
|
98
|
+
const { site } = browserMarks(req)
|
|
99
|
+
return site === 'same-origin' || (broughtByTailnet(req) && (site == null || site === 'none'))
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** read by two: the owner, when the page itself is refused (it draws these words under what was written, which
|
|
103
|
+
* stays in its box), and a program */
|
|
104
|
+
export const OWNER_WORD_REFUSED = "refused: a word as the owner comes from a page of the hub in a browser, and this request carried no mark of one. At the page: reload it, or open the hub in its app; your words stay in the box. A program writes as itself: sk thread reply"
|
|
105
|
+
|
|
106
|
+
/** read by a program, and by the owner where a page shows why its terminal did not open */
|
|
107
|
+
export const PAGE_ONLY_REFUSED = "refused: a hub page's socket and its terminals answer a page of the hub in a browser, and this request carried no mark of one. At the page: reload it. A program reads the stores' notices with sk thread watch and runs its commands in its own shell"
|
|
108
|
+
|
|
109
|
+
/** whether the request carries the token of the test that started this server */
|
|
110
|
+
const fromTestPage = (req: Request, o: Hop): boolean => o.testPage != null && o.testPage.token.length >= 32 && req.headers.get(TEST_PAGE_HEADER) === o.testPage.token
|
|
111
|
+
|
|
112
|
+
/** why a request may not write as the owner, null when it may or when it is no write of his: a browser's own same
|
|
113
|
+
* origin request (Sec-Fetch-Site same-origin, and an Origin of the host it asked). A request tailscaled brought keeps
|
|
114
|
+
* the tailnet's rule (loopback-serve.ts `tailnetWriteRefusal`): the device is tailscale's word.
|
|
115
|
+
* A page's socket is judged at its upgrade, whatever its method and from any reach (over the tailnet it reaches no
|
|
116
|
+
* terminal, page-live.ts): an Origin of the host it asked, which a browser names on every socket; Sec-Fetch-Site
|
|
117
|
+
* only where the browser sent one (Chrome sends none on a socket) */
|
|
118
|
+
export function ownerWordRefusal(req: Request, o: Hop = {}): string | null {
|
|
119
|
+
const path = new URL(req.url).pathname
|
|
120
|
+
const socket = PAGE_SOCKET.test(path)
|
|
121
|
+
if (!socket && (READS.has(req.method) || !ownerWordPath(path))) return null
|
|
122
|
+
if (fromTestPage(req, o)) return null
|
|
123
|
+
const terminal = socket || below(underHub(path), '/api/terminal')
|
|
124
|
+
if (terminal && o.hop?.(req) === true) return null
|
|
125
|
+
if (!socket && broughtByTailnet(req, o)) return null
|
|
126
|
+
const refused = terminal ? PAGE_ONLY_REFUSED : OWNER_WORD_REFUSED
|
|
127
|
+
const { site, origin, host } = browserMarks(req, o)
|
|
128
|
+
if (origin == null || (socket && site == null ? false : site !== 'same-origin')) return refused
|
|
129
|
+
try {
|
|
130
|
+
if (new URL(origin).host === host) return null
|
|
131
|
+
} catch { /* a malformed origin is no page of the hub */ }
|
|
132
|
+
return refused
|
|
133
|
+
}
|
package/src/http/same-origin.ts
CHANGED
|
@@ -53,3 +53,15 @@ export function sameOrigin(req: Request): boolean {
|
|
|
53
53
|
try { return new URL(origin).host === host } catch { return false }
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
|
|
57
|
+
/** a WebSocket's upgrade is a GET that no same origin policy binds: a page of any site can open one to localhost and
|
|
58
|
+
* read what it says. A browser always names its page's origin on it, so the server reads it: true for the server's
|
|
59
|
+
* own page, and for a program, which names none (the web's pipe to the daemon, a client in a terminal). A hub
|
|
60
|
+
* page's own socket asks more: owner-word.ts. Bun upgrades on a list too (`websocket, x`), so the word is searched */
|
|
61
|
+
export function socketOrigin(req: Request): boolean {
|
|
62
|
+
if (!/\bwebsocket\b/i.test(req.headers.get('upgrade') ?? '')) return true
|
|
63
|
+
const origin = req.headers.get('origin')
|
|
64
|
+
if (origin == null) return true
|
|
65
|
+
const host = req.headers.get('x-forwarded-host') ?? new URL(req.url).host
|
|
66
|
+
try { return new URL(origin).host === host } catch { return false }
|
|
67
|
+
}
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
// desk's setup step both pass it.
|
|
5
5
|
// The one constraint a reader breaks first: a tailnet request passes on headers tailscaled wrote, so a relay to the
|
|
6
6
|
// home that keeps a caller's headers and has no tailscaled in front of it lets that caller pass as the phone
|
|
7
|
-
import { broughtByProxy } from '
|
|
8
|
-
import { loopbackHost, reachOf, sameOrigin } from '
|
|
9
|
-
import { tailnetRefusal, type TailnetWho } from '
|
|
7
|
+
import { broughtByProxy } from './door-forward.ts'
|
|
8
|
+
import { loopbackHost, reachOf, sameOrigin } from './same-origin.ts'
|
|
9
|
+
import { tailnetRefusal, type TailnetWho } from './tailnet-caller.ts'
|
|
10
10
|
|
|
11
11
|
export const SECRET_WHERE = 'a secret is typed in the hub on the Mac that runs it, or on your phone over the tailnet'
|
|
12
12
|
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
// that do not show what the folder holds now. Listed in the house repo alone, where the identities live, so no repo
|
|
4
4
|
// says it twice
|
|
5
5
|
import { existsSync } from 'node:fs'
|
|
6
|
-
import { join } from 'node:path'
|
|
7
6
|
import { type Collection, type Instance } from '../collections/collection-types.ts'
|
|
8
|
-
import {
|
|
7
|
+
import { identitiesRoot } from '../core/identities-root.ts'
|
|
9
8
|
import { DEFAULT_HOME_PORT } from '../home/home-paths.ts'
|
|
10
9
|
import { identityAddress } from '../serve/hub-app/identity-address.ts'
|
|
11
10
|
import { readIdentities, type Identities } from './identities.ts'
|
|
@@ -43,7 +42,7 @@ export function pictureNeeds(ids: Identities, home = `http://127.0.0.1:${DEFAULT
|
|
|
43
42
|
|
|
44
43
|
/** only in the repo that holds the identities folder, the house repo */
|
|
45
44
|
export function picturesCollection(root: string): Collection | null {
|
|
46
|
-
const dir =
|
|
45
|
+
const dir = identitiesRoot(root, { env: undefined })
|
|
47
46
|
if (!existsSync(dir)) return null
|
|
48
47
|
return { id: PICTURES_COL, title: 'pictures', kind: 'ask', media: 'text', list: async () => pictureNeeds(readIdentities(dir)) }
|
|
49
48
|
}
|