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
package/src/cli/cmd_Review.ts
CHANGED
|
@@ -6,31 +6,11 @@ import type { AnswerKind } from '../review/model.ts'
|
|
|
6
6
|
import { holdsThread, laneOfCaller, maySee } from '../review/parties.ts'
|
|
7
7
|
import { realGit } from '../core/git.ts'
|
|
8
8
|
import { ageWords } from '../core/words.ts'
|
|
9
|
+
import { hereAt, hereStore, noRepo, openHere, partiesFor, pull, recordedStores, refused, reviewRoot, type Here } from './review-here.ts'
|
|
9
10
|
|
|
10
11
|
const DETAILS = `threads, the one exchange with the owner (wiki tools/shipkit/threads.md): one thread per subject, found by its address <kind>:<key>, for its whole life. sk thread post <address> sends a version into it, linked by the tool; ask, propose, reply and update write in it, and start it when no thread owns the address. He answers in the hub's threads page; you read his answer with watch, inbox or the inbox hook, then mark it seen. What he, a player or a rule raises is an item of the same store with its own state, closed with sk thread fixed. The store: .shipkit/review/ of each repo, or the daemon's rows (sk thread move). SK_AGENT names your lane.`
|
|
11
12
|
|
|
12
13
|
type Ctx = { stdout: NodeJS.WritableStream; stderr: NodeJS.WritableStream }
|
|
13
|
-
type Unit = import('../review/unit.ts').ReviewUnit
|
|
14
|
-
type Say = import('../review/format.ts').Say
|
|
15
|
-
|
|
16
|
-
/** what a verb works on: the store, its repo's unit (null when the verb reads no unit, or the repo has none), and how the unit's lines print */
|
|
17
|
-
interface Here {
|
|
18
|
-
dir: string
|
|
19
|
-
unit: Unit | null
|
|
20
|
-
say: Say
|
|
21
|
-
out: (l: string) => void
|
|
22
|
-
err: (l: string) => void
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/** the shipkit repo the cwd stands in: only its store reaches a hub, so anywhere else an item is refused before a
|
|
26
|
-
* stray .shipkit/review/ is made where nobody looks */
|
|
27
|
-
async function reviewRoot(cwd: string): Promise<string | null> {
|
|
28
|
-
const { findRepoRoot } = await import('../ts/config.ts')
|
|
29
|
-
const { existsSync } = await import('node:fs')
|
|
30
|
-
const { join } = await import('node:path')
|
|
31
|
-
const root = findRepoRoot(cwd)
|
|
32
|
-
return existsSync(join(root, 'repo.config.ts')) ? root : null
|
|
33
|
-
}
|
|
34
14
|
|
|
35
15
|
/** the store of the repo this runs in, its unit read when the verb needs it, and the body; a refusal is one FAIL line with its reason, exit 1 */
|
|
36
16
|
async function run(context: Ctx, body: (h: Here) => Promise<number> | number, o: { unit?: boolean } = {}): Promise<number> {
|
|
@@ -41,7 +21,7 @@ async function run(context: Ctx, body: (h: Here) => Promise<number> | number, o:
|
|
|
41
21
|
const argv = process.argv.slice(2)
|
|
42
22
|
if (argv[0] === 'review' && !argv.includes('--hook') && !argv.includes('--json')) err(`sk review is now sk thread: sk thread ${argv.slice(1).map((a) => (/^[\w./=,@:+#-]+$/.test(a) ? a : JSON.stringify(a))).join(' ')}`)
|
|
43
23
|
const root = await reviewRoot(process.cwd())
|
|
44
|
-
if (root == null) throw new Error(
|
|
24
|
+
if (root == null) throw new Error(noRepo(process.cwd()))
|
|
45
25
|
// a repo where an agent writes in a thread needs a next session that hears it; the gate's repair wires the hook
|
|
46
26
|
if (WRITING_VERBS.has(argv[1] ?? '')) {
|
|
47
27
|
const { inboxHookLacks } = await import('../review/inbox-read.ts')
|
|
@@ -52,15 +32,9 @@ async function run(context: Ctx, body: (h: Here) => Promise<number> | number, o:
|
|
|
52
32
|
const { storeDir } = await import('../review/store.ts')
|
|
53
33
|
return await body({ dir: storeDir(root), unit: null, say: { spec: (await import('../review/model.ts')).NO_SPEC, more: () => [] }, out, err })
|
|
54
34
|
}
|
|
55
|
-
|
|
56
|
-
const { specOf } = await import('../review/store.ts')
|
|
57
|
-
const { dir, unit } = await openReview(root)
|
|
58
|
-
return await body({ dir, unit, say: { spec: specOf(dir), more: (x) => factLines(unit, x) }, out, err })
|
|
35
|
+
return await body(await openHere(root, out, err))
|
|
59
36
|
} catch (e) {
|
|
60
|
-
|
|
61
|
-
// a walk of the items' database runs: run it again once it ends
|
|
62
|
-
const { isStoreRefused, WAIT_EXIT } = await import('../core/machine-db.ts')
|
|
63
|
-
return isStoreRefused(e) && e.wait ? WAIT_EXIT : 1
|
|
37
|
+
return refused(e, err)
|
|
64
38
|
}
|
|
65
39
|
}
|
|
66
40
|
|
|
@@ -140,25 +114,21 @@ async function idOrOpen(h: Here, ref: string, title: string, as: string | undefi
|
|
|
140
114
|
return x.id
|
|
141
115
|
}
|
|
142
116
|
|
|
117
|
+
/** a reply by address answers his newest open note of the thread (review/threads.ts replyTargetOf); an id stays exact */
|
|
118
|
+
async function replyTarget(h: Here, ref: string, id: string): Promise<string> {
|
|
119
|
+
const { ID_RE } = await import('../review/model.ts')
|
|
120
|
+
if (ID_RE.test(ref) || !ref.includes(':') || /^\w+#\d+$/.test(ref)) return id
|
|
121
|
+
const { readAll } = await import('../review/store.ts')
|
|
122
|
+
const { replyTargetOf, threadOfItem, threadsOf } = await import('../review/threads.ts')
|
|
123
|
+
const t = threadOfItem(id, threadsOf(readAll(h.dir).items, h.say.spec))
|
|
124
|
+
return t ? replyTargetOf(t) : id
|
|
125
|
+
}
|
|
126
|
+
|
|
143
127
|
/** why a version that names no subject is refused: a thread is found by its address, so a version without one would
|
|
144
128
|
* start a thread nobody finds again */
|
|
145
129
|
const NO_ADDRESS =
|
|
146
130
|
'a version names the subject he judges, so it goes into that subject\'s one thread: sk thread post <kind>:<key> --title "…" --what "…" <media> (screen:<screen>, asset:<asset>, page:<page>, or a kind this repo\'s review unit declares; --trailer and --draft name their own). Page: wiki tools/shipkit/threads.md, The model'
|
|
147
131
|
|
|
148
|
-
/** the sources pulled before a read: a line per source down, said once a process and a store */
|
|
149
|
-
const downSaid = new Map<string, Set<string>>()
|
|
150
|
-
async function pull(h: Here): Promise<void> {
|
|
151
|
-
if (!h.unit?.sources?.length) return
|
|
152
|
-
const { pullSources } = await import('../review/project.ts')
|
|
153
|
-
const now = new Set<string>()
|
|
154
|
-
const said = downSaid.get(h.dir)
|
|
155
|
-
const got = await pullSources(h.dir, h.unit, (l) => {
|
|
156
|
-
now.add(l)
|
|
157
|
-
if (!said?.has(l)) h.err(l)
|
|
158
|
-
})
|
|
159
|
-
downSaid.set(h.dir, now)
|
|
160
|
-
if (got.length > 0) h.err(`review: ${got.length} new items pulled`)
|
|
161
|
-
}
|
|
162
132
|
|
|
163
133
|
/** a gallery tile as given: `<label>=<file>`, or a file labelled by its name */
|
|
164
134
|
/** one tile of `--gallery`: `[<row>/]<label>=[<before>,]<after>`, or a bare file named by its own name */
|
|
@@ -815,8 +785,8 @@ async function choiceAsQuestion(h: Here, o: Record<string, string>, views: reado
|
|
|
815
785
|
|
|
816
786
|
async function saidIntoThread(h: Here, item: import('../review/model.ts').Item, typed: boolean): Promise<void> {
|
|
817
787
|
const { readAll } = await import('../review/store.ts')
|
|
818
|
-
const { ownAddressOf,
|
|
819
|
-
const { threadOfItem, threadsOf } = await import('../review/threads.ts')
|
|
788
|
+
const { ownAddressOf, verdictOf } = await import('../review/model.ts')
|
|
789
|
+
const { openNotesOf, threadOfItem, threadsOf } = await import('../review/threads.ts')
|
|
820
790
|
const items = readAll(h.dir).items
|
|
821
791
|
const t = threadOfItem(item.id, threadsOf(items, h.say.spec))
|
|
822
792
|
const own = ownAddressOf(item, h.say.spec)
|
|
@@ -825,8 +795,7 @@ async function saidIntoThread(h: Here, item: import('../review/model.ts').Item,
|
|
|
825
795
|
const waited = verdictOf(before) === null && before.item.views.length > 0
|
|
826
796
|
h.err(`into its thread ${own ?? ''}: the next version after ${before.item.id} "${before.item.title}"${waited ? ', which waited on his answer: only this one takes his marks now' : ''}. A subject he judges on its own takes its own address: --on ${own ?? '<kind>:<key>'}/<part>`)
|
|
827
797
|
}
|
|
828
|
-
const
|
|
829
|
-
const open = notes.filter((x) => stateOf(x, false).state !== 'closed' && !(item.answers ?? []).includes(x.item.id))
|
|
798
|
+
const open = (t ? openNotesOf(t) : []).filter((x) => !(item.answers ?? []).includes(x.item.id))
|
|
830
799
|
if (open.length > 0) h.err(`his notes in the thread stay open: ${open.map((x) => `${x.item.id} "${x.item.title}"`).join('; ')}. Close one once done: sk thread fixed <id> "<what was done>"; or name it on the version: --answers <id>`)
|
|
831
800
|
}
|
|
832
801
|
|
|
@@ -1025,47 +994,25 @@ export class ReviewInboxCommand extends Command {
|
|
|
1025
994
|
session = Option.String('--session', { description: "only the threads that session holds" })
|
|
1026
995
|
subject = Option.String('--subject', { description: 'only items of this subject kind (frame, shot…)' })
|
|
1027
996
|
all = Option.Boolean('--all', false, { description: 'a plain approval too, not only the counted line' })
|
|
1028
|
-
hook = Option.Boolean('--hook', false, { description: 'run as a Claude Code hook (UserPromptSubmit, Stop, SubagentStop): the hook input on stdin, its json answer on stdout. A thread whose holder is gone passes on first (a lane that ended → its session); the unseen answers join a prompt as context, and a turn does not end while one is unseen, or while a thread of his turn has no watch to hear it' })
|
|
997
|
+
hook = Option.Boolean('--hook', false, { description: 'run as a Claude Code hook (SessionStart, UserPromptSubmit, Stop, SubagentStop): the hook input on stdin, its json answer on stdout. At the start of a session: who hears the threads of the project and which hold a word nobody hears, three lines at most. A thread whose holder is gone passes on first (a lane that ended → its session); the unseen answers join a prompt as context, and a turn does not end while one is unseen, or while a thread of his turn has no watch to hear it' })
|
|
1029
998
|
|
|
1030
999
|
async execute(): Promise<number> {
|
|
1031
|
-
const {
|
|
1032
|
-
|
|
1033
|
-
const input = this.hook ? parseHookInput(process.stdin.isTTY === true ? '' : await new Response(Bun.stdin.stream()).text().catch(() => '')) : null
|
|
1000
|
+
const { hookPasses } = await import('../review/inbox-hook.ts')
|
|
1001
|
+
const input = this.hook ? await (await import('./inbox-hook-run.ts')).readHookInput() : null
|
|
1034
1002
|
if (input != null && hookPasses(input)) return 0
|
|
1035
1003
|
return run(this.context, async (h) => {
|
|
1036
1004
|
const { BUILTIN_KINDS, untakenOf } = await import('../review/model.ts')
|
|
1037
1005
|
const kinds = [...Object.keys(h.say.spec.kinds), ...Object.keys(BUILTIN_KINDS)]
|
|
1038
1006
|
if (this.subject !== undefined && Object.keys(h.say.spec.kinds).length > 0 && !kinds.includes(this.subject)) throw new Error(`--subject: one of ${kinds.join(', ')}`)
|
|
1039
|
-
|
|
1007
|
+
// as a hook: the same run as the hook's own boot (cli.ts)
|
|
1008
|
+
if (input != null) return (await import('./inbox-hook-run.ts')).inboxHook(h, input)
|
|
1009
|
+
const { selectInbox, selectedText } = await import('../review/inbox-read.ts')
|
|
1040
1010
|
const { followedIds, hears, listenersOf, sinceHeLeft, threadByItem, threadsOf } = await import('../review/threads.ts')
|
|
1041
1011
|
const { untakenLine } = await import('../review/format.ts')
|
|
1042
1012
|
const { liveWatchers } = await import('../review/watchers.ts')
|
|
1043
1013
|
await pull(h)
|
|
1044
1014
|
const here = await hereStore(h)
|
|
1045
1015
|
for (const b of here.broken) h.err(`review: FAIL ${b.id}: ${b.error}`)
|
|
1046
|
-
if (input != null) {
|
|
1047
|
-
// as a hook: what this session hears, in its own repo and in every store it or its lanes wrote in
|
|
1048
|
-
const session = hookSession(input)
|
|
1049
|
-
const { noteHanded, noteSession } = await import('../agent-time/registry.ts')
|
|
1050
|
-
if (session !== null) noteSession(h.dir)
|
|
1051
|
-
let stores = [here, ...(session === null ? [] : await storesOf(session, h.dir))]
|
|
1052
|
-
// a SubagentStop fires at every turn a lane ends, one that waits on its background work too: the
|
|
1053
|
-
// registry reads which (agent-time/registry.ts readParties, stopped)
|
|
1054
|
-
const parties = await partiesFor(stores, session, endedAgentOf(input))
|
|
1055
|
-
// rule 2 as a write: a thread whose holder is gone passes on now (review/hand-over.ts)
|
|
1056
|
-
const { handOver, handedLines } = await import('../review/hand-over.ts')
|
|
1057
|
-
const handed = session === null ? [] : stores.flatMap((s) => handOver(s.dir, s.say.spec, parties, s.repo, { onHanded: noteHanded }))
|
|
1058
|
-
if (input.hook_event_name === 'SubagentStop') return 0
|
|
1059
|
-
if (handed.length > 0) stores = [await hereStore(h), ...(session === null ? [] : await storesOf(session, h.dir))]
|
|
1060
|
-
const me = { lane: null, session }
|
|
1061
|
-
// the session's own watch in a store, or its one house watch for all of them
|
|
1062
|
-
const { laneWatchesOf, watchedBy } = await import('../review/watchers.ts')
|
|
1063
|
-
const watchedIn = watchedBy(session, stores.map((s) => s.dir))
|
|
1064
|
-
const laneWatches = session === null ? [] : laneWatchesOf(session, stores.map((s) => s.dir))
|
|
1065
|
-
const answer = hookReply({ input, me, stores, parties, onHanded: noteHanded, handed: handedLines(handed.filter((x) => x.to === session)), watchedIn, laneWatches })
|
|
1066
|
-
if (answer != null) h.out(answer)
|
|
1067
|
-
return 0
|
|
1068
|
-
}
|
|
1069
1016
|
const session = await sessionOf(this.mine, this.session)
|
|
1070
1017
|
const lane = this.mine ? callerLane(undefined) : null
|
|
1071
1018
|
const parties = session === null && lane === null ? null : await partiesFor([here], session)
|
|
@@ -1104,67 +1051,6 @@ export class ReviewInboxCommand extends Command {
|
|
|
1104
1051
|
}
|
|
1105
1052
|
}
|
|
1106
1053
|
|
|
1107
|
-
/** the store the verb stands in, read for the inbox */
|
|
1108
|
-
async function hereStore(h: Here): Promise<import('../review/inbox-read.ts').StoreRead> {
|
|
1109
|
-
const { readAll } = await import('../review/store.ts')
|
|
1110
|
-
const { repoNameOf } = await import('../agent-time/registry.ts')
|
|
1111
|
-
const { dirname } = await import('node:path')
|
|
1112
|
-
const root = dirname(dirname(h.dir))
|
|
1113
|
-
return { repo: repoNameOf(root), root, dir: h.dir, here: true, ...readAll(h.dir), say: h.say }
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
/** every other store this session or its lanes wrote in (agent-time/registry.ts), each with its repo's unit bound */
|
|
1117
|
-
async function storesOf(session: string, hereDir: string): Promise<import('../review/inbox-read.ts').StoreRead[]> {
|
|
1118
|
-
const { repoNameOf } = await import('../agent-time/registry.ts')
|
|
1119
|
-
const { readAll } = await import('../review/store.ts')
|
|
1120
|
-
const { dirname, resolve } = await import('node:path')
|
|
1121
|
-
const out: import('../review/inbox-read.ts').StoreRead[] = []
|
|
1122
|
-
for (const dir of await recordedStores(session, (d) => resolve(d) === resolve(hereDir))) {
|
|
1123
|
-
const root = dirname(dirname(dir))
|
|
1124
|
-
try {
|
|
1125
|
-
const { say } = await hereAt(dir, () => {}, () => {})
|
|
1126
|
-
out.push({ repo: repoNameOf(root), root, dir, here: false, ...readAll(dir), say })
|
|
1127
|
-
} catch {
|
|
1128
|
-
// a store that does not read now: its own repo's hook and inbox say why
|
|
1129
|
-
}
|
|
1130
|
-
}
|
|
1131
|
-
return out
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
/** the stores the session's record names, but those `skip` keeps out; only a store its commands run in (`sk thread
|
|
1135
|
-
* seen` there refuses a folder that is no shipkit repo), the others leave its record */
|
|
1136
|
-
async function recordedStores(session: string, skip: (dir: string) => boolean): Promise<string[]> {
|
|
1137
|
-
const { forgetStores, readSessionRecord, scratchStore } = await import('../agent-time/registry.ts')
|
|
1138
|
-
const { existsSync } = await import('node:fs')
|
|
1139
|
-
const { dirname } = await import('node:path')
|
|
1140
|
-
const dirs: string[] = []
|
|
1141
|
-
const gone: string[] = []
|
|
1142
|
-
for (const d of (readSessionRecord(session)?.stores ?? []).filter((x) => !skip(x))) (!scratchStore(d) && existsSync(d) && (await reviewRoot(dirname(dirname(d)))) !== null ? dirs : gone).push(d)
|
|
1143
|
-
forgetStores(session, gone)
|
|
1144
|
-
return dirs
|
|
1145
|
-
}
|
|
1146
|
-
|
|
1147
|
-
/** the store at `dir` of another repo as a verb works on it, its repo's unit bound */
|
|
1148
|
-
async function hereAt(dir: string, out: (l: string) => void, err: (l: string) => void): Promise<Here> {
|
|
1149
|
-
const { openReview, factLines } = await import('../review/project.ts')
|
|
1150
|
-
const { specOf } = await import('../review/store.ts')
|
|
1151
|
-
const { dirname } = await import('node:path')
|
|
1152
|
-
const { unit } = await openReview(dirname(dirname(dir)))
|
|
1153
|
-
return { dir, unit, say: { spec: specOf(dir), more: (x) => factLines(unit, x) }, out, err }
|
|
1154
|
-
}
|
|
1155
|
-
|
|
1156
|
-
/** the parties these stores' threads name: their holders' sessions and the caller's, with each store's live watches */
|
|
1157
|
-
async function partiesFor(stores: readonly import('../review/inbox-read.ts').StoreRead[], self: string | null, stopped: string | null = null): Promise<import('../review/parties.ts').Parties> {
|
|
1158
|
-
const { readParties } = await import('../agent-time/registry.ts')
|
|
1159
|
-
const { holderOf, threadsOf } = await import('../review/threads.ts')
|
|
1160
|
-
const { liveWatchers } = await import('../review/watchers.ts')
|
|
1161
|
-
const ids = new Set<string>()
|
|
1162
|
-
for (const s of stores) for (const t of threadsOf(s.items, s.say.spec)) {
|
|
1163
|
-
const hs = holderOf(t)?.session
|
|
1164
|
-
if (hs) ids.add(hs)
|
|
1165
|
-
}
|
|
1166
|
-
return readParties({ sessions: [...ids], watchers: stores.flatMap((s) => liveWatchers(s.dir)), self, stopped })
|
|
1167
|
-
}
|
|
1168
1054
|
|
|
1169
1055
|
/** the lane that acts on a reply or a seen, by this process's SK_AGENT (review/parties.ts laneOfCaller) */
|
|
1170
1056
|
const callerLane = (as: string | undefined): string | null => laneOfCaller(as, process.env.SK_AGENT)
|
|
@@ -1194,7 +1080,9 @@ async function callerParties(dir: string, t: import('../review/threads.ts').Thre
|
|
|
1194
1080
|
const { liveWatchers } = await import('../review/watchers.ts')
|
|
1195
1081
|
const me = { lane: callerLane(as), session: sessionId() }
|
|
1196
1082
|
const hs = t ? holderOf(t)?.session : undefined
|
|
1197
|
-
|
|
1083
|
+
const { hearingHolders } = await import('../orchestrator/role.ts')
|
|
1084
|
+
const { placeParties } = await import('../orchestrator/places.ts')
|
|
1085
|
+
return { me, parties: await readParties({ sessions: hs ? [hs] : [], watchers: liveWatchers(dir), self: me.session, roles: hearingHolders, places: placeParties }) }
|
|
1198
1086
|
}
|
|
1199
1087
|
|
|
1200
1088
|
/** the caller holds the item's thread (review/parties.ts holdsThread): it may close what that thread's lane claimed */
|
|
@@ -1273,7 +1161,10 @@ export class ReviewSeenCommand extends Command {
|
|
|
1273
1161
|
for (const [i, [ref, id]] of ids.entries()) {
|
|
1274
1162
|
if (markSeen(h.dir, id, new Date(), scopes[i]!.only)) h.out(`${ref}: seen`)
|
|
1275
1163
|
else {
|
|
1276
|
-
|
|
1164
|
+
// say which: an item that does not exist, none of the owner's words on it is the caller's, or none unseen
|
|
1165
|
+
const { readItem } = await import('../review/store.ts')
|
|
1166
|
+
const why = readItem(h.dir, id) === null ? 'no such item' : scopes[i]!.only?.length === 0 ? `none of the owner's words on it is yours to mark: its holder marks them, or take it first (sk thread take ${ref})` : 'nothing of the owner unseen on it'
|
|
1167
|
+
h.err(`FAIL: review: ${ref}: ${why}`)
|
|
1277
1168
|
bad++
|
|
1278
1169
|
}
|
|
1279
1170
|
}
|
|
@@ -1355,7 +1246,8 @@ export class ThreadTakeCommand extends Command {
|
|
|
1355
1246
|
const hearing = after ? hearingOfThread(after, parties, repoNameOf(dirname(dirname(h.dir)))) : null
|
|
1356
1247
|
const wasText = was === null ? 'nobody held it' : `it was held by ${was.lane ?? sessionLabel(was.session, parties)}`
|
|
1357
1248
|
h.out(`${this.ref}: yours now (${hearing?.chip ?? lane ?? 'this session'}), ${wasText}; ${hearing?.words ?? ''}`)
|
|
1358
|
-
|
|
1249
|
+
const { IN_BACKGROUND, WATCH } = await import('../review/inbox-hook.ts')
|
|
1250
|
+
if (hearing && hearing.light !== 'hears') h.err(`review: no watch of yours hears it now: ${WATCH('sk')} ${IN_BACKGROUND}, one watch for every repo where you hold threads`)
|
|
1359
1251
|
return 0
|
|
1360
1252
|
})
|
|
1361
1253
|
}
|
|
@@ -1366,7 +1258,7 @@ export class ThreadAssignCommand extends Command {
|
|
|
1366
1258
|
static override usage = Command.Usage({
|
|
1367
1259
|
category: 'Review',
|
|
1368
1260
|
description: 'give a thread to a lane: it holds it, a trace line names who gave it',
|
|
1369
|
-
details: `${DETAILS}\n\
|
|
1261
|
+
details: `${DETAILS}\n\nA session's answer to the owner's « start a lane »: on a thread nobody holds, sk thread take it first; then SendMessage to a live lane, or start a sub-agent with the thread as its brief (nothing starts a process for you); then assign the thread to that lane. The lane holds it (a take under its name, the state left as it is), and its trace line reads « L65 took the thread: assigned by app main ». The request clears at the lane's first act there: tell it to say \`sk thread working <address> "…"\` first (wiki tools/shipkit/threads-how-it-fits.md, A lane he asks for).`,
|
|
1370
1262
|
examples: [['a lane for the thread he asked one on', 'sk thread assign screen:orders/list L65']],
|
|
1371
1263
|
})
|
|
1372
1264
|
ref = Option.String({ name: 'address | id' })
|
|
@@ -1396,7 +1288,7 @@ export class ThreadAssignCommand extends Command {
|
|
|
1396
1288
|
export class ReviewReplyCommand extends Command {
|
|
1397
1289
|
static override paths = [['review', 'reply']]
|
|
1398
1290
|
static essential = { args: '<address | id> <text>' }
|
|
1399
|
-
static override usage = Command.Usage({ category: 'Review', description: "your message in a thread: what you changed, the answer to his question", details: DETAILS })
|
|
1291
|
+
static override usage = Command.Usage({ category: 'Review', description: "your message in a thread: what you changed, the answer to his question", details: `${DETAILS}\n\nBy address, the words answer his newest open note in the thread (the one sk thread fixed closes), else its newest version; by id, that item.` })
|
|
1400
1292
|
id = Option.String({ name: 'address | id' })
|
|
1401
1293
|
text = Option.String()
|
|
1402
1294
|
image = Option.String('--image', { description: 'an image beside the words' })
|
|
@@ -1418,7 +1310,7 @@ export class ReviewReplyCommand extends Command {
|
|
|
1418
1310
|
h.out(`${r.id}: ${m.id} supersedes ${r.replaces}`)
|
|
1419
1311
|
return 0
|
|
1420
1312
|
}
|
|
1421
|
-
const id = await idOrOpen(h, this.id, this.text, this.as)
|
|
1313
|
+
const id = await replyTarget(h, this.id, await idOrOpen(h, this.id, this.text, this.as))
|
|
1422
1314
|
const m = await wordsIn(h.dir, id, callerLane(this.as) ?? agentName(), this.text, this.verdict, this.image)
|
|
1423
1315
|
if (this.urgent) await urgentOn(h.dir, id, callerLane(this.as) ?? agentName())
|
|
1424
1316
|
h.out(`${id}: ${m.id}`)
|
|
@@ -1672,6 +1564,10 @@ function actCommand(op: ActOp, description: string, o: { note?: 'required' | 'op
|
|
|
1672
1564
|
const { postAsk } = await import('../review/store.ts')
|
|
1673
1565
|
const { askStateText } = await import('../review/answer-kinds.ts')
|
|
1674
1566
|
if (!this.words?.trim()) throw new Error(`ask <address | id> "<what you ask>" ${k.label}`)
|
|
1567
|
+
if (k.kind === 'secret') {
|
|
1568
|
+
const joined = (await import('../review/instruction-guards.ts')).joinedSecretAsk(this.words)
|
|
1569
|
+
if (joined !== null) throw new Error(`« ${joined} » asks him for two values as one: one field a value, so ask twice, a --secret each with its own name (wiki tools/shipkit/threads-instructions.md, A field inside a step)`)
|
|
1570
|
+
}
|
|
1675
1571
|
if (k.kind === 'secret' && this.secret) {
|
|
1676
1572
|
const who = await (await import('../secrets/who-reads.ts')).whoReads([this.secret], process.cwd())
|
|
1677
1573
|
if (who[this.secret]?.registered !== true) throw new Error(`--secret ${this.secret}: no row in the secret registry, so the vault would refuse the value he types. Add its row first (the name, what it is for, its scope: wiki identities/_common/secrets-registry.md), then ask again`)
|
|
@@ -1807,10 +1703,10 @@ export class ReviewFixedCommand extends Command {
|
|
|
1807
1703
|
})
|
|
1808
1704
|
}
|
|
1809
1705
|
}
|
|
1810
|
-
export const ReviewDispatchCommand = actCommand('dispatch', 'the dispatcher sends a raised item to a topic', { note: 'optional', topic: 'required', named: true, examples: [['to a topic', 'sk thread dispatch <id> lieux --as
|
|
1811
|
-
export const ReviewAskCommand = actCommand('ask', 'a question he answers in one click, with your pick; it starts the thread when none owns the address', { text: 'question', named: true, examples: [['one click, your pick on the second', 'sk thread ask messages:tui/u1 "which hook line ?" --option "Run any workflow" --option "Your workflow, one command" --pick 2'], ["the dispatcher's question on a raised item (no --option)", 'sk thread ask <id> "which tower?" --as
|
|
1812
|
-
export const ReviewDropCommand = actCommand('drop', 'the dispatcher closes a raised item with the reason (a duplicate, already fixed)', { note: 'required', named: true, examples: [['a duplicate', 'sk thread drop <id> --note "same as <other id>" --as
|
|
1813
|
-
export const ReviewReassignCommand = actCommand('reassign', 'the dispatcher takes a claim back, or sends the item to another topic', { note: 'optional', topic: 'optional', named: true, examples: [['a stale claim', 'sk thread reassign <id> --as
|
|
1706
|
+
export const ReviewDispatchCommand = actCommand('dispatch', 'the dispatcher sends a raised item to a topic', { note: 'optional', topic: 'required', named: true, examples: [['to a topic', 'sk thread dispatch <id> lieux --as dispatcher']] })
|
|
1707
|
+
export const ReviewAskCommand = actCommand('ask', 'a question he answers in one click, with your pick; it starts the thread when none owns the address', { text: 'question', named: true, examples: [['one click, your pick on the second', 'sk thread ask messages:tui/u1 "which hook line ?" --option "Run any workflow" --option "Your workflow, one command" --pick 2'], ["the dispatcher's question on a raised item (no --option)", 'sk thread ask <id> "which tower?" --as dispatcher']] })
|
|
1708
|
+
export const ReviewDropCommand = actCommand('drop', 'the dispatcher closes a raised item with the reason (a duplicate, already fixed)', { note: 'required', named: true, examples: [['a duplicate', 'sk thread drop <id> --note "same as <other id>" --as dispatcher']] })
|
|
1709
|
+
export const ReviewReassignCommand = actCommand('reassign', 'the dispatcher takes a claim back, or sends the item to another topic', { note: 'optional', topic: 'optional', named: true, examples: [['a stale claim', 'sk thread reassign <id> --as dispatcher']] })
|
|
1814
1710
|
|
|
1815
1711
|
export class ReviewDispatcherCommand extends Command {
|
|
1816
1712
|
static override paths = [['review', 'dispatcher']]
|
|
@@ -1818,7 +1714,7 @@ export class ReviewDispatcherCommand extends Command {
|
|
|
1818
1714
|
category: 'Review',
|
|
1819
1715
|
description: 'take the dispatcher role: one session at a time routes what is raised',
|
|
1820
1716
|
details: `${DETAILS}\n\nRefused while another holder acted in the last 30 minutes, unless --take. Only in a repo whose review unit declares a dispatcher.`,
|
|
1821
|
-
examples: [['take the role', 'sk thread dispatcher --as
|
|
1717
|
+
examples: [['take the role', 'sk thread dispatcher --as dispatcher']],
|
|
1822
1718
|
})
|
|
1823
1719
|
as = Option.String('--as', { description: 'who takes it (else SK_AGENT)' })
|
|
1824
1720
|
take = Option.Boolean('--take', false, { description: 'take it from an active holder' })
|
|
@@ -2186,10 +2082,10 @@ export class ReviewWatchCommand extends Command {
|
|
|
2186
2082
|
static override usage = Command.Usage({
|
|
2187
2083
|
category: 'Review',
|
|
2188
2084
|
description: 'one line per verdict, reply or raised note as it lands; every unseen one first; ends with its owner',
|
|
2189
|
-
details: `${DETAILS}\n\nRun it
|
|
2085
|
+
details: `${DETAILS}\n\nRun it with --once as a background command (the Bash tool with run_in_background), and again after each burst it prints: it has no 30 minute cap, where the Monitor tool stops after 30 minutes with no word. Unfiltered (a grep holds a burst's last line). It registers itself, so the hub shows who listens. It exits within 2 s once a process above it at start is gone or nothing reads its output. An item nobody takes prints 2 minutes after its last message, then every 2 hours.\n\n--house: one watch for every repo where the session holds threads, each line headed [<repo>]; it reads the session's record every 2 s, so a repo where it takes a thread later joins with no restart, and the inbox hook counts it as the session's watch in every repo.`,
|
|
2190
2086
|
examples: [
|
|
2191
|
-
['the
|
|
2192
|
-
['the threads this session holds, in
|
|
2087
|
+
['the ear of a session: its threads in every repo, one burst, in a background Bash', 'sk thread watch --mine --house --once'],
|
|
2088
|
+
['the threads this session holds, in this repo', 'sk thread watch --mine --once'],
|
|
2193
2089
|
["one lane's items", 'sk thread watch --lane interaction'],
|
|
2194
2090
|
],
|
|
2195
2091
|
})
|
|
@@ -2197,6 +2093,8 @@ export class ReviewWatchCommand extends Command {
|
|
|
2197
2093
|
session = Option.String('--session', { description: "only the threads that session holds" })
|
|
2198
2094
|
lane = Option.String('--lane', { description: "only that lane's items" })
|
|
2199
2095
|
house = Option.Boolean('--house', false, { description: 'with --mine or --session: every repo where the session holds threads, one joined later too, each line headed [<repo>]' })
|
|
2096
|
+
once = Option.Boolean('--once', false, { description: 'print the first burst of new lines, then exit 0: the form for a background Bash, never capped at 30 minutes; a line it printed is never printed again by the next one' })
|
|
2097
|
+
json = Option.Boolean('--json', false, { description: 'each line as one JSON object: text, kind, repo, item, message, who, address (what a shipkit channel reads)' })
|
|
2200
2098
|
|
|
2201
2099
|
async execute(): Promise<number> {
|
|
2202
2100
|
return run(this.context, async (h) => {
|
|
@@ -2220,21 +2118,23 @@ export class ReviewWatchCommand extends Command {
|
|
|
2220
2118
|
await restartWatchOnModelMove(h)
|
|
2221
2119
|
// the one stream for every store this watch hears, its own lines untagged
|
|
2222
2120
|
await watchFeed(h.err)
|
|
2223
|
-
const f = { session, lane, by, house: this.house }
|
|
2121
|
+
const f = { session, lane, by, house: this.house, json: this.json, once: this.once }
|
|
2224
2122
|
if (!this.house || session === null) {
|
|
2225
2123
|
await hearStore(h, f)
|
|
2226
2124
|
return new Promise<number>(() => {})
|
|
2227
2125
|
}
|
|
2228
2126
|
// one process, one loop a store: the store it starts in, then each one the session's record names
|
|
2229
2127
|
const { noteSession, repoNameOf } = await import('../agent-time/registry.ts')
|
|
2128
|
+
const { canonicalStore } = await import('../review/item-db.ts')
|
|
2230
2129
|
const { dirname, resolve } = await import('node:path')
|
|
2231
2130
|
noteSession(h.dir)
|
|
2131
|
+
// one store a loop, by its canonical folder: the checkout of a worktree it starts in, never both
|
|
2232
2132
|
const heard = new Set<string>()
|
|
2233
2133
|
const retry = new Map<string, number>()
|
|
2234
2134
|
const hear = async (x: Here): Promise<string> => {
|
|
2235
|
-
heard.add(
|
|
2135
|
+
heard.add(canonicalStore(x.dir))
|
|
2236
2136
|
const repo = repoNameOf(dirname(dirname(x.dir)))
|
|
2237
|
-
const tagged = (print: (l: string) => void) => (l: string) => print(l.split('\n').map((y) => `[${repo}] ${y}`).join('\n'))
|
|
2137
|
+
const tagged = (print: (l: string) => void) => (l: string) => print(this.json && l.startsWith('{') ? JSON.stringify({ ...(JSON.parse(l) as object), repo }) : l.split('\n').map((y) => `[${repo}] ${y}`).join('\n'))
|
|
2238
2138
|
await hearStore({ ...x, out: tagged(h.out), err: tagged(h.err) }, f)
|
|
2239
2139
|
return repo
|
|
2240
2140
|
}
|
|
@@ -2244,7 +2144,7 @@ export class ReviewWatchCommand extends Command {
|
|
|
2244
2144
|
busy = true
|
|
2245
2145
|
const joined: string[] = []
|
|
2246
2146
|
try {
|
|
2247
|
-
for (const dir of await recordedStores(session, (d) => heard.has(
|
|
2147
|
+
for (const dir of await recordedStores(session, (d) => heard.has(d) || (retry.get(resolve(d)) ?? 0) > Date.now())) {
|
|
2248
2148
|
try {
|
|
2249
2149
|
joined.push(await hear(await hereAt(dir, h.out, h.err)))
|
|
2250
2150
|
} catch (e) {
|
|
@@ -2258,7 +2158,8 @@ export class ReviewWatchCommand extends Command {
|
|
|
2258
2158
|
}
|
|
2259
2159
|
return joined
|
|
2260
2160
|
}
|
|
2261
|
-
const
|
|
2161
|
+
const home = canonicalStore(h.dir)
|
|
2162
|
+
const first = [await hear(home === resolve(h.dir) ? h : await hereAt(home, h.out, h.err)), ...(await more())]
|
|
2262
2163
|
h.err(`review watch: hears ${first.join(', ')}; a repo where this session takes a thread joins within 2 s`)
|
|
2263
2164
|
setInterval(
|
|
2264
2165
|
() =>
|
|
@@ -2272,6 +2173,33 @@ export class ReviewWatchCommand extends Command {
|
|
|
2272
2173
|
}
|
|
2273
2174
|
}
|
|
2274
2175
|
|
|
2176
|
+
/** the saves of every store a `--once` watch hears, run as it exits */
|
|
2177
|
+
const onceSaves: (() => void)[] = []
|
|
2178
|
+
|
|
2179
|
+
/** what the earlier `--once` runs of one party printed in one store (review/watchers.ts onceFile) */
|
|
2180
|
+
async function onceMemory(dir: string, session: string | null, lane: string | null): Promise<{ printed: string[]; save: (shown: ReadonlySet<string>) => void }> {
|
|
2181
|
+
const { dirname } = await import('node:path')
|
|
2182
|
+
const { mkdirSync, readFileSync } = await import('node:fs')
|
|
2183
|
+
const { atomicWriteJson } = await import('../core/atomic-write.ts')
|
|
2184
|
+
const { onceFile } = await import('../review/watchers.ts')
|
|
2185
|
+
const file = onceFile(dir, session, lane)
|
|
2186
|
+
const folder = dirname(file)
|
|
2187
|
+
let printed: string[] = []
|
|
2188
|
+
try {
|
|
2189
|
+
const v = JSON.parse(readFileSync(file, 'utf8')) as unknown
|
|
2190
|
+
if (Array.isArray(v)) printed = v.filter((x): x is string => typeof x === 'string')
|
|
2191
|
+
} catch {}
|
|
2192
|
+
return {
|
|
2193
|
+
printed,
|
|
2194
|
+
save: (shown) => {
|
|
2195
|
+
try {
|
|
2196
|
+
mkdirSync(folder, { recursive: true })
|
|
2197
|
+
atomicWriteJson(file, [...shown].slice(-2000))
|
|
2198
|
+
} catch {}
|
|
2199
|
+
},
|
|
2200
|
+
}
|
|
2201
|
+
}
|
|
2202
|
+
|
|
2275
2203
|
/** a watch outlives a change of the thread model: once a read fails on an item the new model wrote, it runs again with
|
|
2276
2204
|
* its args, same pid, onto code that loads (review/model-moved.ts) */
|
|
2277
2205
|
async function restartWatchOnModelMove(h: Here): Promise<void> {
|
|
@@ -2292,8 +2220,23 @@ async function restartWatchOnModelMove(h: Here): Promise<void> {
|
|
|
2292
2220
|
}
|
|
2293
2221
|
|
|
2294
2222
|
/** one store heard by a watch of filter `f`, until the process ends: registered beside it, its lines printed through `h` */
|
|
2295
|
-
async function hearStore(h: Here, f: { session: string | null; lane: string | null; by: string | null; house: boolean }): Promise<void> {
|
|
2223
|
+
async function hearStore(h: Here, f: { session: string | null; lane: string | null; by: string | null; house: boolean; json?: boolean; once?: boolean }): Promise<void> {
|
|
2296
2224
|
const { session, lane, by } = f
|
|
2225
|
+
// --once: what an earlier run of this party printed is never printed again, and the process exits 0 once a burst
|
|
2226
|
+
// of new lines settled (400 ms), so a background Bash hears it with no 30 minute cap and no loop of turns
|
|
2227
|
+
const once = f.once === true ? await onceMemory(h.dir, session, lane) : null
|
|
2228
|
+
let settle: ReturnType<typeof setTimeout> | null = null
|
|
2229
|
+
// one line out: its text, or under --json the object a shipkit channel reads (orchestrator/channel.ts)
|
|
2230
|
+
const say = (text: string, m: { kind: string; item?: string; message?: string; who?: string; address?: string }): void => {
|
|
2231
|
+
h.out(f.json === true ? JSON.stringify({ text, ...m }) : text)
|
|
2232
|
+
if (once === null) return
|
|
2233
|
+
if (settle) clearTimeout(settle)
|
|
2234
|
+
// every store of a --house watch saves what it printed, then the process exits
|
|
2235
|
+
settle = setTimeout(() => {
|
|
2236
|
+
for (const save of onceSaves) save()
|
|
2237
|
+
process.exit(0)
|
|
2238
|
+
}, 400)
|
|
2239
|
+
}
|
|
2297
2240
|
const { existsSync, mkdirSync, watch } = await import('node:fs')
|
|
2298
2241
|
const { mediaDir, readAll, scanStamp } = await import('../review/store.ts')
|
|
2299
2242
|
const { modelWatch } = await import('../review/model-moved.ts')
|
|
@@ -2302,11 +2245,15 @@ async function hearStore(h: Here, f: { session: string | null; lane: string | nu
|
|
|
2302
2245
|
const { followedIds, unseen } = await import('../review/threads.ts')
|
|
2303
2246
|
const { raisedLine, untakenLine, watchLines } = await import('../review/format.ts')
|
|
2304
2247
|
const { liveWatchers, registerWatch } = await import('../review/watchers.ts')
|
|
2305
|
-
const { hears, holderOf, listenersOf, threadByItem, threadsOf, wordReaches } = await import('../review/threads.ts')
|
|
2248
|
+
const { hears, holderOf, listenersOf, ownAddressesOf, threadByItem, threadsOf, wordReaches } = await import('../review/threads.ts')
|
|
2306
2249
|
let byItem = new Map<string, import('../review/threads.ts').Thread>()
|
|
2307
2250
|
// who hears what: the registry, read again every 30 s, so a lane's threads reach its session's watch once it ends
|
|
2308
2251
|
const { noteHanded, readParties, repoNameOf } = await import('../agent-time/registry.ts')
|
|
2309
2252
|
const { laneAsksFor, resumeOf } = await import('../review/inbox-read.ts')
|
|
2253
|
+
const { hearingHolders, readRole } = await import('../orchestrator/role.ts')
|
|
2254
|
+
const { placeParties, placeWatchers } = await import('../orchestrator/places.ts')
|
|
2255
|
+
const { withOtherPlaces } = await import('../review/parties.ts')
|
|
2256
|
+
const { shareOf, shareText } = await import('../orchestrator/share.ts')
|
|
2310
2257
|
const { dirname } = await import('node:path')
|
|
2311
2258
|
let parties: import('../review/parties.ts').Parties | null = null
|
|
2312
2259
|
const mine = (x: Parameters<typeof coversItem>[1]): boolean => hears({ session, lane }, x, byItem, parties)
|
|
@@ -2318,17 +2265,26 @@ async function hearStore(h: Here, f: { session: string | null; lane: string | nu
|
|
|
2318
2265
|
if (session === null && lane === null) return
|
|
2319
2266
|
const all = readAll(h.dir)
|
|
2320
2267
|
const ids = new Set(threadsOf(all.items, h.say.spec).flatMap((t) => [...(t.head.item.origin.by === 'agent' && t.head.item.origin.session ? [t.head.item.origin.session] : []), ...(holderOf(t)?.session ?? [])]))
|
|
2321
|
-
parties = await readParties({ sessions: [...ids, ...(session ? [session] : [])], watchers: liveWatchers(h.dir), self: by })
|
|
2268
|
+
parties = await readParties({ sessions: [...ids, ...(session ? [session] : [])], watchers: liveWatchers(h.dir), self: by, roles: hearingHolders, places: placeParties })
|
|
2322
2269
|
// a lane's watch ends with its lane: its threads pass to its session, whose hook or watch hears them
|
|
2323
2270
|
const me = lane !== null && by !== null ? parties.lanes.filter((l) => l.name === lane && l.session === by) : []
|
|
2324
2271
|
if (me.length > 0 && !me.some((l) => l.live)) {
|
|
2325
2272
|
h.err(`review watch: exits, its lane ${lane} ended: its threads pass to its session`)
|
|
2326
2273
|
process.exit(0)
|
|
2327
2274
|
}
|
|
2275
|
+
// one ear a session: its shipkit channel, once proven, hears for it, so a plain watch of it leaves
|
|
2276
|
+
if (lane === null && session !== null && process.env.SHIPKIT_CHANNEL_EAR !== '1') {
|
|
2277
|
+
const { channelHears } = await import('../orchestrator/role.ts')
|
|
2278
|
+
if (channelHears(session)) {
|
|
2279
|
+
h.err(`review watch: exits, this session's shipkit channel hears for it: nothing to arm again`)
|
|
2280
|
+
process.exit(0)
|
|
2281
|
+
}
|
|
2282
|
+
}
|
|
2328
2283
|
}
|
|
2329
2284
|
await known().catch(() => {})
|
|
2330
2285
|
setInterval(() => void known().catch(() => {}), 30_000)
|
|
2331
|
-
const shown = new Set<string>()
|
|
2286
|
+
const shown = new Set<string>(once?.printed ?? [])
|
|
2287
|
+
if (once !== null) onceSaves.push(() => once.save(shown))
|
|
2332
2288
|
// a store refused for a while (a fold or a way back of the daemon file walks): one line, and the next poll
|
|
2333
2289
|
// reads again; never a watch that dies and hears nothing more
|
|
2334
2290
|
let refused: string | null = null
|
|
@@ -2359,28 +2315,49 @@ async function hearStore(h: Here, f: { session: string | null; lane: string | nu
|
|
|
2359
2315
|
for (const l of laneAsksFor({ repo: repoNameOf(dirname(dirname(h.dir))), root: dirname(dirname(h.dir)), dir: h.dir, here: true, ...all, say: h.say }, { session, lane: null }, parties ?? { sessions: [], lanes: [] })) {
|
|
2360
2316
|
if (shown.has(l)) continue
|
|
2361
2317
|
shown.add(l)
|
|
2362
|
-
|
|
2318
|
+
say(l, { kind: 'lane_ask' })
|
|
2363
2319
|
}
|
|
2364
2320
|
}
|
|
2365
2321
|
for (const x of unseen(all.items, to).filter(mine)) {
|
|
2366
2322
|
const fresh = watchLines(x, all.items, mediaDir(h.dir), to).filter((l) => !shown.has(l.key))
|
|
2323
|
+
const t0 = byItem.get(x.item.id)
|
|
2324
|
+
const address = (t0 ? ownAddressesOf(t0, h.say.spec)[0] : undefined) ?? x.item.id
|
|
2367
2325
|
for (const l of fresh) {
|
|
2368
2326
|
shown.add(l.key)
|
|
2369
|
-
|
|
2327
|
+
const message = l.key.split('#')[1]
|
|
2328
|
+
const who = message === undefined ? 'owner' : (x.thread.find((m) => m.id === message)?.who ?? 'owner')
|
|
2329
|
+
say(l.text, { kind: 'word', item: x.item.id, ...(message ? { message } : {}), who, address })
|
|
2370
2330
|
}
|
|
2371
2331
|
// a session's watch, his message on its ended lane's thread: the way back to that lane
|
|
2372
2332
|
const t = byItem.get(x.item.id)
|
|
2373
2333
|
const r = fresh.length > 0 && lane === null && t && parties ? resumeOf(h, t, parties) : null
|
|
2374
2334
|
if (r) {
|
|
2375
|
-
|
|
2335
|
+
say(` ${r.line}`, { kind: 'resume', item: x.item.id })
|
|
2376
2336
|
noteHanded(r.lane, r.session, r.thread)
|
|
2377
2337
|
}
|
|
2378
2338
|
}
|
|
2339
|
+
// the orchestrator role's share: while this session holds the role of this store's project, the owner's words no
|
|
2340
|
+
// other live watch hears, here or on another place of the project, since its claim, each once, and of those the
|
|
2341
|
+
// ones this place answers for (orchestrator/share.ts)
|
|
2342
|
+
if (lane === null && session !== null && parties !== null) {
|
|
2343
|
+
const repo = repoNameOf(dirname(dirname(h.dir)))
|
|
2344
|
+
const r = readRole(repo)
|
|
2345
|
+
if (r?.holder?.session === session) {
|
|
2346
|
+
const others = [...liveWatchers(h.dir), ...placeWatchers(repo)].filter((w) => !(w.lane === null && (w.session === session || w.by === session)))
|
|
2347
|
+
// the other places as the view says them now, not as the last read of the parties (30 s ago at most)
|
|
2348
|
+
const placed = withOtherPlaces({ sessions: parties.sessions.filter((s) => s.place === undefined), lanes: parties.lanes }, placeParties())
|
|
2349
|
+
for (const l of shareOf({ items: all.items, spec: h.say.spec, parties: placed, watchers: others, media: mediaDir(h.dir), since: r.holder.since, me: { session, repo } })) {
|
|
2350
|
+
if (shown.has(l.key)) continue
|
|
2351
|
+
shown.add(l.key)
|
|
2352
|
+
say(shareText(l), { kind: 'share', item: l.item, ...(l.message ? { message: l.message } : {}), who: l.player ? 'player' : 'owner', address: l.address })
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
}
|
|
2379
2356
|
for (const x of all.items.filter(mine)) {
|
|
2380
2357
|
const l = raisedLine(x)
|
|
2381
2358
|
if (l === null || shown.has(l.key)) continue
|
|
2382
2359
|
shown.add(l.key)
|
|
2383
|
-
|
|
2360
|
+
say(l.text, { kind: 'raised', item: x.item.id, who: x.item.origin.by })
|
|
2384
2361
|
}
|
|
2385
2362
|
// an item nobody takes: a --lane watch hears its own lane's, an unfiltered or --mine watch every one
|
|
2386
2363
|
const now = new Date()
|
|
@@ -2394,7 +2371,7 @@ async function hearStore(h: Here, f: { session: string | null; lane: string | nu
|
|
|
2394
2371
|
const key = `untaken ${x.item.id} ${why} ${round}`
|
|
2395
2372
|
if (shown.has(key)) continue
|
|
2396
2373
|
shown.add(key)
|
|
2397
|
-
|
|
2374
|
+
say(untakenLine(x, why, lane), { kind: 'untaken', item: x.item.id })
|
|
2398
2375
|
}
|
|
2399
2376
|
}
|
|
2400
2377
|
tick()
|