rvlib-shipkit 2.31.0 → 2.33.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 +51 -0
- package/package.json +1 -1
- package/src/advisors/acts.ts +16 -15
- package/src/advisors/advice.ts +56 -102
- package/src/advisors/advisor-view.ts +122 -76
- package/src/advisors/app-graph.ts +1 -1
- package/src/advisors/app.ts +3 -11
- package/src/advisors/cf-api.ts +1 -1
- package/src/advisors/dir-bucket.ts +4 -3
- package/src/advisors/edge/api.ts +20 -221
- package/src/advisors/edge/bucket.ts +2 -2
- package/src/advisors/edge/handler.ts +13 -155
- package/src/advisors/edge/here.ts +5 -5
- package/src/advisors/edge/pages.ts +12 -9
- package/src/advisors/edge/shell.ts +6 -5
- package/src/advisors/edge/sign-in.ts +101 -36
- package/src/advisors/edge/status.ts +19 -6
- package/src/advisors/edge/types.ts +36 -60
- package/src/advisors/expose.ts +29 -29
- package/src/advisors/here.ts +12 -12
- package/src/advisors/invite-send.ts +79 -35
- package/src/advisors/invite.ts +31 -8
- package/src/advisors/job.ts +24 -16
- package/src/advisors/login.ts +40 -15
- package/src/advisors/owner-store.ts +46 -22
- package/src/advisors/photos.ts +3 -3
- package/src/advisors/project.ts +27 -25
- package/src/advisors/reach.ts +89 -0
- package/src/advisors/rights.ts +1 -1
- package/src/advisors/routes.ts +55 -74
- package/src/advisors/scan.ts +0 -4
- package/src/advisors/setup-run.ts +14 -14
- package/src/advisors/share-trace.ts +3 -3
- package/src/advisors/{door-probe.ts → sign-in-probe.ts} +7 -6
- package/src/advisors/speaks.ts +29 -0
- package/src/advisors/sync.ts +97 -183
- package/src/advisors/tunnel.ts +6 -5
- package/src/advisors/users-listen.ts +92 -0
- package/src/advisors/users-router.ts +261 -87
- package/src/advisors/users-store.ts +81 -0
- package/src/agent-time/blocked-scan.ts +181 -0
- package/src/agent-time/registry.ts +12 -5
- package/src/agent-time/store.ts +9 -109
- package/src/asks/ask-bar-fold.ts +2 -1
- package/src/asks/ask-close.ts +2 -1
- package/src/asks/ask-doc.ts +2 -1
- package/src/asks/ask-migrate.ts +3 -2
- package/src/asks/ask-steps-fold.ts +2 -1
- package/src/asks/ask-store.ts +4 -3
- package/src/check.ts +3 -43
- package/src/checks/SK001-package-json-shape.check.ts +4 -55
- package/src/checks/SK004-gitignore-policy.check.ts +24 -69
- package/src/checks/SK013-one-way-in-policy.check.ts +3 -7
- package/src/checks/SK017-vscode-hub-task.check.ts +4 -4
- package/src/checks/SK019-tests-run-in-units.check.ts +3 -14
- package/src/checks/SK020-self-spawning-check.check.ts +5 -7
- package/src/checks/SK035-public-clean.check.ts +1 -1
- package/src/checks/SK039-vscode-watch-generated.check.ts +1 -1
- package/src/checks/SK042-post-kinds.check.ts +5 -14
- package/src/checks/SK054-agent-allow-list.check.ts +5 -74
- package/src/checks/SK055-retired-config-keys.check.ts +45 -0
- package/src/cli/cmd_Advisors.ts +11 -45
- package/src/cli/cmd_Asks.ts +3 -10
- package/src/cli/cmd_Backup.ts +25 -127
- package/src/cli/cmd_BackupTargets.ts +1 -1
- package/src/cli/cmd_Capacity.ts +6 -2
- package/src/cli/cmd_Checks.ts +0 -14
- package/src/cli/cmd_Ci.ts +2 -1
- package/src/cli/cmd_Db.ts +3 -82
- package/src/cli/cmd_Home.ts +4 -32
- package/src/cli/cmd_Hq.ts +0 -17
- package/src/cli/cmd_Releases.ts +57 -4
- package/src/cli/cmd_Review.ts +333 -354
- package/src/cli/cmd_Shot.ts +26 -4
- package/src/cli/cmd_SocialDrafts.ts +6 -13
- package/src/cli/cmd_ThreadSyncNeeds.ts +6 -2
- package/src/cli/cmd_Time.ts +1 -1
- package/src/cli/cmd_Trailer.ts +1 -1
- package/src/cli/inbox-hook-run.ts +5 -23
- package/src/cli/registry-heads.ts +5 -55
- package/src/cli/registry.ts +1 -5
- package/src/cli/review-here.ts +1 -1
- package/src/cli.ts +15 -4
- package/src/collections/collection-types.ts +1 -1
- package/src/collections/review.ts +5 -4
- package/src/core/admission.ts +268 -0
- package/src/core/agent-allow-policy.ts +32 -2
- package/src/core/agent-env.ts +8 -0
- package/src/core/allow-rows.ts +74 -0
- package/src/core/check-file-names.ts +19 -106
- package/src/core/code-lines.ts +36 -21
- package/src/core/footprint.ts +17 -13
- package/src/core/identities-root.ts +1 -4
- package/src/core/layout.ts +1 -2
- package/src/core/machine-db.ts +33 -208
- package/src/core/machine-layout.ts +14 -127
- package/src/core/machine-read.ts +5 -2
- package/src/core/mask-source.ts +60 -0
- package/src/core/memory-watch.ts +17 -14
- package/src/core/motherhome.ts +8 -35
- package/src/core/one-way-in-policy.ts +0 -3
- package/src/core/peer-sk.ts +8 -0
- package/src/core/repo-walk.ts +0 -9
- package/src/core/retention.ts +1 -9
- package/src/core/retired-checks.ts +2 -0
- package/src/core/tmux-policy.ts +1 -1
- package/src/core/tree-watch.ts +2 -2
- package/src/core/when.ts +7 -45
- package/src/gate/admit-heavy.ts +150 -0
- package/src/gate/check-runner.ts +6 -0
- package/src/gate/discover-checks.ts +42 -32
- package/src/gate/gate-checks.ts +21 -131
- package/src/gate/head-gate.ts +1 -1
- package/src/gate/job-run.ts +2 -1
- package/src/gate/pre-commit-discovery.ts +22 -28
- package/src/gate/run-check.ts +3 -4
- package/src/gate/run-ci.ts +4 -0
- package/src/gate/run-fix.ts +5 -17
- package/src/gate/run-fixers.ts +6 -42
- package/src/home/app-sign.ts +2 -2
- package/src/home/backup-status.ts +52 -92
- package/src/home/backup-verdict.ts +2 -2
- package/src/home/daemon-jobs.ts +51 -95
- package/src/home/database-words.ts +1 -2
- package/src/home/databases.ts +9 -25
- package/src/home/home-launchd.ts +0 -6
- package/src/home/home-paths.ts +8 -4
- package/src/home/home-routes.ts +3 -10
- package/src/home/home-state.ts +2 -14
- package/src/home/inbox-shape.ts +14 -15
- package/src/home/inbox.ts +1 -1
- package/src/home/machine-repair.ts +102 -103
- package/src/home/resume.ts +1 -15
- package/src/home/run-daemon.ts +7 -12
- package/src/home/space-page.ts +3 -2
- package/src/home/supervise.ts +3 -7
- package/src/hooks/commit-msg-run.ts +61 -0
- package/src/hooks/commit-run.ts +16 -166
- package/src/hooks/gate-outcome.ts +108 -0
- package/src/hooks/git-hook.ts +9 -9
- package/src/hooks/hook-config.ts +8 -8
- package/src/hooks/leak-guard.ts +1 -1
- package/src/hooks/pre-commit-checks.ts +1 -1
- package/src/hooks/run-hooks.ts +2 -6
- package/src/hooks/shared-file.ts +3 -2
- package/src/hq/daemon-db.ts +8 -8
- package/src/hq/door.ts +3 -16
- package/src/hq/hq-db.ts +4 -3
- package/src/hq/hq-local.ts +1 -2
- package/src/hq/hq-store.ts +0 -15
- package/src/hq/item-direct.ts +8 -10
- package/src/hq/item-fill.ts +37 -0
- package/src/hq/kinds/item-gone.ts +7 -10
- package/src/hq/kinds/item-msg.ts +12 -18
- package/src/hq/kinds/item.ts +13 -19
- package/src/hq/kinds/report.ts +3 -4
- package/src/hq/owner-switch.ts +3 -3
- package/src/hq/report.ts +5 -9
- package/src/hq/switch.ts +2 -11
- package/src/hq/thread-sync.ts +5 -17
- package/src/hq/{shapes-words.ts → threads-words.ts} +2 -12
- package/src/http/owner-word.ts +1 -1
- package/src/identities/machine.ts +16 -0
- package/src/init-repo.ts +0 -1
- package/src/ledger/check-stats.ts +6 -5
- package/src/ledger/db.ts +2 -4
- package/src/ledger/record-kept.ts +117 -48
- package/src/ledger/run-log.ts +21 -2
- package/src/ledger/slow-tests.ts +96 -0
- package/src/ledger/store.ts +3 -86
- package/src/ledger/suite-log.ts +8 -2
- package/src/media-store/backup/facts.ts +3 -37
- package/src/media-store/backup/keys.ts +1 -8
- package/src/media-store/backup/manifest.ts +6 -67
- package/src/media-store/backup/restore.ts +4 -13
- package/src/media-store/backup/retention.ts +13 -1
- package/src/media-store/backup/run.ts +6 -267
- package/src/media-store/backup/snapshot.ts +2 -38
- package/src/media-store/backup/sources.ts +3 -113
- package/src/media-store/backup/target-send.ts +5 -29
- package/src/media-store/db.ts +8 -7
- package/src/media-store/forget-one.ts +1 -1
- package/src/media-store/forget.ts +1 -80
- package/src/orchestrator/guards.ts +0 -1
- package/src/orchestrator/presence.ts +2 -2
- package/src/orchestrator/routes.ts +1 -1
- package/src/orchestrator/started.ts +0 -9
- package/src/orchestrator/talk-key.ts +3 -4
- package/src/orchestrator/unheard.ts +1 -1
- package/src/plan/planner.ts +3 -2
- package/src/recordings/edit.ts +3 -3
- package/src/recordings/marks-draw.ts +17 -6
- package/src/recordings/marks.ts +120 -9
- package/src/reflections/reflections-queue.ts +3 -10
- package/src/release/notes.ts +1 -1
- package/src/release/public-clean.ts +66 -6
- package/src/release/run-bump.ts +11 -0
- package/src/release/run-release.ts +4 -0
- package/src/releases/from-thread.ts +3 -3
- package/src/releases/model.ts +186 -36
- package/src/releases/store.ts +13 -3
- package/src/releases/validate.ts +83 -0
- package/src/repo-config.ts +36 -64
- package/src/review/answer-kinds.ts +63 -4
- package/src/review/blocked-guard.ts +11 -0
- package/src/review/blocked-object.ts +298 -0
- package/src/review/cells.ts +144 -230
- package/src/review/close.ts +39 -1
- package/src/review/doc-save.ts +3 -2
- package/src/review/draft-item.ts +1 -1
- package/src/review/events.ts +3 -7
- package/src/review/expect.ts +23 -39
- package/src/review/format.ts +79 -46
- package/src/review/glyphs.ts +1 -0
- package/src/review/hand-over.ts +3 -3
- package/src/review/heard.ts +1 -1
- package/src/review/holds-sync.ts +2 -1
- package/src/review/inbox-hook.ts +2 -2
- package/src/review/inbox-read.ts +39 -33
- package/src/review/instruction-guards.ts +12 -0
- package/src/review/instructions.ts +0 -1
- package/src/review/item-db.ts +13 -43
- package/src/review/item-hq.ts +2 -2
- package/src/review/item-rows.ts +3 -14
- package/src/review/kind-catalog.ts +3 -1
- package/src/review/kinds.ts +18 -8
- package/src/review/live-view.ts +3 -0
- package/src/review/media-kind.ts +1 -1
- package/src/review/mentions.ts +1 -2
- package/src/review/model.ts +158 -114
- package/src/review/move.ts +149 -0
- package/src/review/need-threads.ts +3 -2
- package/src/review/object-card.ts +11 -0
- package/src/review/object-read.ts +6 -1
- package/src/review/one-block.ts +1 -1
- package/src/review/owner-read.ts +1 -1
- package/src/review/phone-push.ts +10 -9
- package/src/review/previews.ts +32 -4
- package/src/review/push.ts +2 -2
- package/src/review/recap.ts +129 -0
- package/src/review/referring.ts +6 -3
- package/src/review/reflection-object.ts +4 -3
- package/src/review/routes.ts +51 -47
- package/src/review/secret-route.ts +3 -2
- package/src/review/settle.ts +0 -6
- package/src/review/snooze.ts +5 -3
- package/src/review/speaker.ts +68 -0
- package/src/review/start-title.ts +19 -0
- package/src/review/store-parties.ts +28 -0
- package/src/review/store.ts +94 -59
- package/src/review/{wakes.ts → thread-events.ts} +92 -7
- package/src/review/thread-md.ts +35 -14
- package/src/review/thread-state.ts +804 -0
- package/src/review/threads.ts +29 -347
- package/src/review/traces.ts +104 -7
- package/src/review/trailer-item.ts +1 -1
- package/src/review/unit.ts +7 -9
- package/src/review/verdict-items.ts +12 -10
- package/src/review/view-layout.ts +25 -1
- package/src/review/watch-feed.ts +1 -2
- package/src/review/working-guards.ts +2 -3
- package/src/rules/untrack-generated.ts +1 -15
- package/src/secrets/copy.ts +4 -4
- package/src/secrets/lapse.ts +2 -1
- package/src/serve/hub-app/advisor-app.tsx +4 -4
- package/src/serve/hub-app/advisor-face.tsx +9 -3
- package/src/serve/hub-app/advisor-host.ts +27 -27
- package/src/serve/hub-app/advisors-model.ts +17 -8
- package/src/serve/hub-app/advisors-rights.tsx +1 -1
- package/src/serve/hub-app/advisors-st.ts +15 -14
- package/src/serve/hub-app/advisors-view.tsx +13 -11
- package/src/serve/hub-app/app-bridge.ts +23 -3
- package/src/serve/hub-app/asks-page.tsx +1 -1
- package/src/serve/hub-app/auto-text.tsx +71 -16
- package/src/serve/hub-app/check-view.tsx +0 -8
- package/src/serve/hub-app/controls.css +14 -3
- package/src/serve/hub-app/database-view.tsx +1 -2
- package/src/serve/hub-app/dock-st.ts +1 -1
- package/src/serve/hub-app/git-view.tsx +3 -1
- package/src/serve/hub-app/hub.css +12 -5
- package/src/serve/hub-app/icons.tsx +1 -1
- package/src/serve/hub-app/inbox-view.tsx +1 -2
- package/src/serve/hub-app/live-sources.ts +2 -2
- package/src/serve/hub-app/main-panel.tsx +2 -1
- package/src/serve/hub-app/panel-repo.ts +0 -9
- package/src/serve/hub-app/pic.tsx +29 -12
- package/src/serve/hub-app/polled.ts +16 -2
- package/src/serve/hub-app/recordings-st.ts +23 -2
- package/src/serve/hub-app/recordings-view.tsx +68 -10
- package/src/serve/hub-app/ref-pill.ts +1 -1
- package/src/serve/hub-app/repo-st.ts +1 -2
- package/src/serve/hub-app/review/advisor-add.tsx +1 -1
- package/src/serve/hub-app/review/advisor-invite.tsx +1 -1
- package/src/serve/hub-app/review/draft-body.tsx +2 -2
- package/src/serve/hub-app/review/heard-line.tsx +1 -1
- package/src/serve/hub-app/review/instructions-view.tsx +1 -8
- package/src/serve/hub-app/review/kind-states.tsx +14 -9
- package/src/serve/hub-app/review/kit.tsx +4 -11
- package/src/serve/hub-app/review/lane-bar.tsx +3 -3
- package/src/serve/hub-app/review/lightbox.tsx +15 -11
- package/src/serve/hub-app/review/line-window.ts +4 -1
- package/src/serve/hub-app/review/live-bar-st.ts +2 -2
- package/src/serve/hub-app/review/live-view.tsx +57 -1
- package/src/serve/hub-app/review/object-panel.tsx +20 -8
- package/src/serve/hub-app/review/question-views.tsx +191 -53
- package/src/serve/hub-app/review/recap-bar.tsx +40 -0
- package/src/serve/hub-app/review/request-cell.tsx +48 -0
- package/src/serve/hub-app/review/review-cells.tsx +154 -96
- package/src/serve/hub-app/review/review-host.ts +8 -4
- package/src/serve/hub-app/review/review-kit.ts +17 -11
- package/src/serve/hub-app/review/review-list.tsx +30 -35
- package/src/serve/hub-app/review/review-st.ts +32 -42
- package/src/serve/hub-app/review/review-thread.tsx +139 -85
- package/src/serve/hub-app/review/review-views.tsx +127 -68
- package/src/serve/hub-app/review/share-lines.tsx +4 -4
- package/src/serve/hub-app/review/start-st.ts +2 -5
- package/src/serve/hub-app/review/superseded-runs.ts +4 -3
- package/src/serve/hub-app/review/thread-close.tsx +10 -7
- package/src/serve/hub-app/review/thread-st.ts +381 -202
- package/src/serve/hub-app/review/tone-bar.tsx +129 -0
- package/src/serve/hub-app/review/tones.ts +53 -0
- package/src/serve/hub-app/review/trailer-body.tsx +2 -2
- package/src/serve/hub-app/review/trailer-st.ts +3 -2
- package/src/serve/hub-app/review/trailer-voices-st.ts +3 -2
- package/src/serve/hub-app/review.css +189 -106
- package/src/serve/hub-app/search-view.tsx +1 -1
- package/src/serve/hub-app/social/social-model.ts +0 -4
- package/src/serve/hub-app/source-acts.ts +2 -1
- package/src/serve/hub-app/stores/stores-page.tsx +2 -2
- package/src/serve/hub-app/terminal-sources.tsx +2 -1
- package/src/serve/hub-app/thread-row.tsx +3 -4
- package/src/serve/hub-app/tree-build.ts +0 -4
- package/src/serve/hub-app/urls-view.tsx +2 -1
- package/src/serve/hub-app/view-layout.css +13 -3
- package/src/serve/hub-app/wikis-view.tsx +5 -2
- package/src/serve/hub-runtime.ts +7 -37
- package/src/serve/project-gutter-route.ts +6 -2
- package/src/serve/read-thread.ts +20 -2
- package/src/serve/read-worker.ts +9 -1
- package/src/serve/record-pages.ts +46 -0
- package/src/serve/serve-hub.ts +2 -2
- package/src/serve/terminal-host.ts +1 -1
- package/src/serve/terminal-route.ts +1 -3
- package/src/serve/tracked-watch.ts +1 -3
- package/src/setup-house.ts +2 -2
- package/src/shipkit-files.ts +1 -1
- package/src/shipkit.ts +1 -6
- package/src/shot/client.ts +2 -1
- package/src/shot/film-box.ts +0 -20
- package/src/shot/on-place.ts +141 -0
- package/src/social/drafts.ts +1 -1
- package/src/social/kinds.ts +6 -29
- package/src/social/load.ts +2 -2
- package/src/social/post-object.ts +3 -2
- package/src/social/release-stage.ts +1 -1
- package/src/social/stage.ts +2 -2
- package/src/stores/model.ts +4 -0
- package/src/stores/routes.ts +11 -3
- package/src/suite/judge-suites.ts +58 -0
- package/src/suite/red-alone.ts +54 -18
- package/src/suite/runner-shapes.ts +2 -2
- package/src/suite/suite-cli.ts +67 -14
- package/src/suite/test-units.ts +2 -1
- package/src/urls/fill.ts +1 -1
- package/src/urls/places.ts +1 -2
- package/src/vault/vault-config.ts +2 -2
- package/src/vault/vault-init.ts +1 -5
- package/src/wiki/graph-page.ts +14 -2
- package/src/advisors/copy-truth.ts +0 -49
- package/src/advisors/door-child.ts +0 -112
- package/src/advisors/door-serve.ts +0 -52
- package/src/advisors/door.ts +0 -118
- package/src/checks/SK016-legacy-check-shapes.check.ts +0 -189
- package/src/checks/SK029-explicit-check-files.check.ts +0 -112
- package/src/checks/SK048-one-local-file.check.ts +0 -36
- package/src/core/config-rewrite.ts +0 -111
- package/src/core/daemon-port.ts +0 -10
- package/src/core/legacy-shapes.ts +0 -263
- package/src/core/migrate-layout.ts +0 -638
- package/src/core/port-check-cli.ts +0 -52
- package/src/core/port-check-file.ts +0 -295
- package/src/core/port-check-files.ts +0 -31
- package/src/gate/discover-legacy-checks.ts +0 -26
- package/src/home/home-move.ts +0 -527
- package/src/home/machine-fold.ts +0 -810
- package/src/hq/item-shapes.ts +0 -54
- package/src/hq/kinds/items-read.ts +0 -4
- package/src/media-store/backup/daemon.ts +0 -220
- package/src/media-store/backup/kept.ts +0 -241
- package/src/media-store/backup/prune.ts +0 -359
- package/src/media-store/backup/secret.ts +0 -88
- package/src/media-store/backup/ssh-space.ts +0 -202
- package/src/media-store/backup/watch.ts +0 -117
- package/src/review/band.ts +0 -182
- package/src/review/folders.ts +0 -216
- package/src/review/hook-ask.ts +0 -58
- package/src/review/role.ts +0 -48
- package/src/review/thread-fold.ts +0 -64
- package/src/review/wait.ts +0 -91
- package/src/rules/rule.ts +0 -43
- package/src/serve/hook-thread.ts +0 -37
- package/src/serve/hook-work.ts +0 -92
- package/src/serve/hook-worker.ts +0 -57
- package/src/serve/hub-app/review/dock.tsx +0 -147
- package/src/serve/hub-app/review/faces.tsx +0 -18
- package/src/serve/hub-app/review/item-verdict.tsx +0 -112
- package/src/serve/hub-app/review/review-board.tsx +0 -48
- /package/src/{scaffold → core}/jsonc-spans.ts +0 -0
package/src/review/close.ts
CHANGED
|
@@ -10,8 +10,9 @@ import { heldOpen } from './holds.ts'
|
|
|
10
10
|
import { isAskItem, stateOf, type ReviewItem } from './model.ts'
|
|
11
11
|
import { ownerVerdict, releaseFollows, statusNow } from './owner-verdict.ts'
|
|
12
12
|
import { act, appendMessage, readAll, readItem, reopen } from './store.ts'
|
|
13
|
-
import { isFollowed, membersOf, threadOfItem, threadsOf } from './threads.ts'
|
|
13
|
+
import { isFollowed, membersOf, nameAt, threadOfItem, threadsOf } from './threads.ts'
|
|
14
14
|
import type { ReviewUnit } from './unit.ts'
|
|
15
|
+
import { agentCloseRefusal, statusOf } from './thread-state.ts'
|
|
15
16
|
|
|
16
17
|
export type CloseHow = 'done' | 'wontfix' | 'reopen'
|
|
17
18
|
export const CLOSE_HOWS: readonly CloseHow[] = ['done', 'wontfix', 'reopen']
|
|
@@ -58,6 +59,43 @@ export async function closeThread(dir: string, id: string, how: CloseHow, note:
|
|
|
58
59
|
return { did: released === '' ? did.did : `${did.did}, ${released}` }
|
|
59
60
|
}
|
|
60
61
|
|
|
62
|
+
/** an agent closes the conversation it finished (`sk thread close`): each version of words that waits on a verdict
|
|
63
|
+
* needs none (« no verdict needed: closed by <who> »), the head closes as done with the trace « <who> closed the
|
|
64
|
+
* thread: <why> », and « reopen » in the hub undoes it. Refused while something in it waits on the owner: a question,
|
|
65
|
+
* a change, words asking a verdict, a version with media to judge (a visible change keeps its verdict), a hold that
|
|
66
|
+
* waits on the owner (a branch to merge), an ask */
|
|
67
|
+
export function agentClose(dir: string, id: string, who: string, why: string, now = new Date()): { head: string; versions: string[] } {
|
|
68
|
+
const words = why.trim()
|
|
69
|
+
if (words === '') throw new Error('close <address | id> "<why, one line>": say why the thread is done')
|
|
70
|
+
const items = readAll(dir).items
|
|
71
|
+
const t = threadOfItem(id, threadsOf(items))
|
|
72
|
+
if (t === null) throw new Error(`${id}: no thread holds it`)
|
|
73
|
+
// what refuses it is the thread's state: an ask's thread, a close already, anything that waits on the owner
|
|
74
|
+
const refused = agentCloseRefusal(t, now)
|
|
75
|
+
if (refused !== null) throw new Error(refused)
|
|
76
|
+
const pending = t.versions.filter((x) => x.item.origin.by === 'agent' && statusOf(x, items) === 'pending')
|
|
77
|
+
const versions = pending.filter((x) => x !== t.head).map((x) => x.item.id)
|
|
78
|
+
// the words that opened it (his, a person's), joined to the versions' chain: answered, they wait on nobody
|
|
79
|
+
const notes = t.answers.filter((x) => t.joined.has(x.item.id) && stateOf(x, false).state !== 'closed').map((x) => x.item.id)
|
|
80
|
+
for (const v of [...versions, ...notes]) appendMessage(dir, v, { who, op: 'done', note: words, closes: 'version' }, { now })
|
|
81
|
+
appendMessage(dir, t.head.item.id, { who, op: 'done', note: words, closes: 'thread' }, { now })
|
|
82
|
+
return { head: t.head.item.id, versions }
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** the thread renamed on purpose, by an agent (`sk thread rename`) or by the owner (the head's title): one message on its head
|
|
86
|
+
* that names the old and the new name, its trace line « <who> renamed the thread: « old » → « new » » */
|
|
87
|
+
export function renameThread(dir: string, id: string, who: string, title: string, now = new Date()): { from: string; to: string } {
|
|
88
|
+
const to = title.trim().replace(/\s+/g, ' ')
|
|
89
|
+
if (to === '') throw new Error('rename <address | id> "<title>": the new name, in words')
|
|
90
|
+
const t = threadOfItem(id, threadsOf(readAll(dir).items))
|
|
91
|
+
if (t === null) throw new Error(`${id}: no thread holds it`)
|
|
92
|
+
if (isAskItem(t.head.item)) throw new Error(`${t.head.item.id} is an ask's thread: its name is its instructions' title (sk ask edit <ask>)`)
|
|
93
|
+
const from = nameAt(t).trim()
|
|
94
|
+
if (from === to) return { from, to }
|
|
95
|
+
appendMessage(dir, t.head.item.id, { who, rename: { from, to } }, { now })
|
|
96
|
+
return { from, to }
|
|
97
|
+
}
|
|
98
|
+
|
|
61
99
|
type Did = { did: string; followed?: true }
|
|
62
100
|
|
|
63
101
|
async function closeAct(dir: string, id: string, x: ReviewItem, s: ReturnType<typeof stateOf>, how: CloseHow, note: string | undefined, unit: Pick<ReviewUnit, 'kinds'> | null): Promise<Did> {
|
package/src/review/doc-save.ts
CHANGED
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
import { AGENT_RE, partyOf, toAcknowledge, type Message, type ReviewItem, type StoredState } from './model.ts'
|
|
7
7
|
import { addItem, appendMessage, readAll, specOf, storeDir } from './store.ts'
|
|
8
8
|
import { diffLines, docChangeLine, docStamp, type DocSaved, type Shown } from './doc-model.ts'
|
|
9
|
-
import { holderOf, membersOf, threadOfAddress, threadOfItem, threadsOf,
|
|
9
|
+
import { holderOf, membersOf, threadOfAddress, threadOfItem, threadsOf, type Thread } from './threads.ts'
|
|
10
10
|
import type { DocHome } from './unit.ts'
|
|
11
11
|
import { realGit } from '../core/git.ts'
|
|
12
|
+
import { waits } from './thread-state.ts'
|
|
12
13
|
|
|
13
14
|
/** who a version is written as: the agent's lane, or the machine for the owner's own save and a sync, holding the
|
|
14
15
|
* thread for nobody */
|
|
@@ -104,7 +105,7 @@ function burstOf(t: Thread, now: Date): { on: ReviewItem; last: Message; base: s
|
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
/** the owner's edit on the version `of` (an item, or a message of one: an ask's instructions): the owner's message in
|
|
107
|
-
* the thread, its line and its diff, which wakes the agent that holds the thread (
|
|
108
|
+
* the thread, its line and its diff, which wakes the agent that holds the thread (thread-events.ts `edit`); a thread no agent
|
|
108
109
|
* holds gets none, since nobody is owed it. A save that joins a burst (burstOf) lands beside the burst's edits, its
|
|
109
110
|
* diff from the text before the burst's first save, and folds the edit before it: the holder owes one look */
|
|
110
111
|
export function ownerEdit(dir: string, of: string, line: string, before: string, after: string, now = new Date()): void {
|
package/src/review/draft-item.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// a draft item as `sk thread
|
|
1
|
+
// a draft item as `sk thread post --draft` makes it (wiki tools/shipkit/threads.md, A post draft): the post draft a slug
|
|
2
2
|
// names, pinned by the hash of its head and of each message. No picture is made: the hub shows the draft itself, read
|
|
3
3
|
// live. A draft the loader does not take clean is refused in the loader's words
|
|
4
4
|
import { accountOf, findDraft, type Desk, type Draft } from '../social/load.ts'
|
package/src/review/events.ts
CHANGED
|
@@ -7,8 +7,9 @@ import { itemsDb, nextSeq, repoIdOf } from './item-db.ts'
|
|
|
7
7
|
import { projectEvent } from './projections.ts'
|
|
8
8
|
|
|
9
9
|
/** the event types, one word each: a kind of object adds its own */
|
|
10
|
-
/** `draft`: the first import of the drafts folders, kept as history, read by no projection
|
|
11
|
-
|
|
10
|
+
/** `draft`: the first import of the drafts folders, kept as history, read by no projection. `moved`: a thread that left
|
|
11
|
+
* this repo's store for another's (review/move.ts), the forward its old address and ids resolve by */
|
|
12
|
+
export const EVENT_TYPES = ['post-group', 'post', 'link', 'reaction', 'draft', 'moved'] as const
|
|
12
13
|
export type EventType = (typeof EVENT_TYPES)[number]
|
|
13
14
|
export const RELS = ['replace', 'reply', 'annotation'] as const
|
|
14
15
|
export type Rel = (typeof RELS)[number]
|
|
@@ -177,8 +178,3 @@ export function eventsOfThread(repo: string, thread: string, db: Database = item
|
|
|
177
178
|
return (db.query('select * from thread_events where repo = ? and thread = ? order by seq').all(repo, thread) as Row[]).map(eventOfRow)
|
|
178
179
|
}
|
|
179
180
|
|
|
180
|
-
/** every state event of one object, oldest first: its history */
|
|
181
|
-
export function historyOf(repo: string, type: EventType, stateKey: string, db: Database = itemsDb()): ThreadEvent[] {
|
|
182
|
-
return (db.query('select * from thread_events where repo = ? and type = ? and state_key = ? order by seq').all(repo, type, stateKey) as Row[]).map(eventOfRow)
|
|
183
|
-
}
|
|
184
|
-
|
package/src/review/expect.ts
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
// what is expected of the owner on a thread right now, in one line of plain words (wiki tools/shipkit/threads-page.md,
|
|
2
|
-
// The dock): the thread's
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
|
|
6
|
-
import { agentWords, bandOf, lateOf, staleWorkingOf, whenWords, type Band, type BandFacts } from './band.ts'
|
|
2
|
+
// The dock): the thread's state (review/thread-state.ts) read with the parties, its band and what waits on the owner,
|
|
3
|
+
// never a computation of its own. The dock draws it when nothing waits on the owner's answer, and the line an agent's
|
|
4
|
+
// verb prints reads it too, so the two never disagree. Pure and browser safe
|
|
5
|
+
import { agentWords, bandOf, lateOf, staleWorkingOf, whenWords, type Band, type ThreadState } from './thread-state.ts'
|
|
7
6
|
import type { Parties } from './parties.ts'
|
|
8
|
-
import type { ReplyCell } from './cells.ts'
|
|
9
|
-
import type { AskState } from './model.ts'
|
|
10
7
|
|
|
11
|
-
/** one thing that waits on
|
|
12
|
-
* an ask's steps or the ask itself, the version that waits for the owner's verdict */
|
|
8
|
+
/** one thing that waits on the owner, in the dock's order: an open question, a proposed change, words that ask the owner's
|
|
9
|
+
* verdict, an ask's steps or the ask itself, the version that waits for the owner's verdict */
|
|
13
10
|
export interface WaitLine {
|
|
14
11
|
/** the cell a click jumps to */
|
|
15
12
|
id: string
|
|
@@ -20,26 +17,12 @@ export interface WaitLine {
|
|
|
20
17
|
n?: number
|
|
21
18
|
}
|
|
22
19
|
|
|
23
|
-
/** the dock's
|
|
24
|
-
* an open ask with no steps
|
|
25
|
-
export function waitLinesOf(
|
|
26
|
-
const lines: WaitLine[] =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
...(c.instructions ? { title: c.instructions.title } : {}),
|
|
30
|
-
}))
|
|
31
|
-
if (ask?.state === 'open' && !lines.some((l) => l.what === 'steps')) lines.unshift({ id: ask.head, what: 'ask', title: ask.title })
|
|
32
|
-
if (version !== null) lines.push({ id: version.id, what: 'version', n: version.n })
|
|
33
|
-
return lines
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface ExpectFacts extends BandFacts {
|
|
37
|
-
/** the dock's list (waitLinesOf) */
|
|
38
|
-
waiting: readonly WaitLine[]
|
|
39
|
-
/** set aside until this time */
|
|
40
|
-
aside?: string
|
|
41
|
-
/** done with the owner's yes (band.ts validatedOf) */
|
|
42
|
-
validated?: boolean
|
|
20
|
+
/** the dock's lines, from the state: each open request (a field inside a step waits as its step), the version that waits
|
|
21
|
+
* for the owner's verdict; an open ask leads with itself only when no steps of its own list */
|
|
22
|
+
export function waitLinesOf(s: Pick<ThreadState, 'waitsOwner'>): WaitLine[] {
|
|
23
|
+
const lines: WaitLine[] = []
|
|
24
|
+
for (const w of s.waitsOwner) if (w.what !== 'note' && w.what !== 'hold' && w.step === undefined) lines.push({ id: w.id, what: w.what, ...(w.title !== undefined ? { title: w.title } : {}), ...(w.n !== undefined ? { n: w.n } : {}) })
|
|
25
|
+
return lines.some((l) => l.what === 'steps') ? lines.filter((l) => l.what !== 'ask') : lines
|
|
43
26
|
}
|
|
44
27
|
|
|
45
28
|
/** what the dock says: `words` what is expected of him, `jump` the cell a click goes to, `late` a promise past
|
|
@@ -83,31 +66,32 @@ function waitingWords(waiting: readonly WaitLine[]): string {
|
|
|
83
66
|
}
|
|
84
67
|
const [a, b, ...rest] = groups
|
|
85
68
|
if (a === undefined) return 'your answer is open: read its newest item'
|
|
86
|
-
return [phraseOf(a.first, a.n), b ? `then ${phraseOf(b.first, b.n)}` : null, rest.length > 0 ? `${rest.length} more below` : null].filter((x) => x
|
|
69
|
+
return [phraseOf(a.first, a.n), b ? `then ${phraseOf(b.first, b.n)}` : null, rest.length > 0 ? `${rest.length} more below` : null].filter((x) => x != null).join(' · ')
|
|
87
70
|
}
|
|
88
71
|
|
|
89
72
|
/** what is expected of the owner now: the owner's turn names the first thing that waits on him (a click jumps to it); on the
|
|
90
73
|
* agents' move it says « Nothing is expected of you » and why, a promised version by its number and time, a promise
|
|
91
74
|
* past its time as late with its agent; done says done */
|
|
92
|
-
export function expectOf(f:
|
|
75
|
+
export function expectOf(f: ThreadState, p: Parties, now = new Date()): Expect {
|
|
93
76
|
const band = bandOf(f, p, now)
|
|
94
|
-
const
|
|
77
|
+
const waiting = waitLinesOf(f)
|
|
78
|
+
const jump = waiting[0]?.id
|
|
95
79
|
const at = jump !== undefined ? { jump } : {}
|
|
96
|
-
if (band === 'yours') return { band, words: capital(waitingWords(
|
|
97
|
-
if (band === 'aside') return { band, words: `Set aside${f.aside ? ` until ${whenWords(f.aside, now)}` : ''}: then ${waitingWords(
|
|
80
|
+
if (band === 'yours') return { band, words: capital(waitingWords(waiting)), none: false, ...at }
|
|
81
|
+
if (band === 'aside') return { band, words: `Set aside${f.aside ? ` until ${whenWords(f.aside.until, now)}` : ''}: then ${waitingWords(waiting)}`, none: false, ...at }
|
|
98
82
|
if (band === 'done') return { band, words: `Nothing is expected of you: done${f.validated ? ', approved' : ''}`, none: true }
|
|
99
|
-
const owed =
|
|
83
|
+
const owed = waiting.length > 0 ? ` · then ${waitingWords(waiting)}` : ''
|
|
100
84
|
const n = f.next
|
|
101
|
-
if (n
|
|
85
|
+
if (n != null) {
|
|
102
86
|
const late = lateOf(n, now)
|
|
103
|
-
if (late
|
|
87
|
+
if (late != null) return { band, words: `Nothing is expected of you, but a promise is late: ${late}${owed}`, none: true, late: true, ...at }
|
|
104
88
|
const who = agentWords(n.who)
|
|
105
89
|
const words = band === 'working' ? `version ${n.n} is being written (${who}, since ${whenWords(n.at, now)}, due ${whenWords(n.until, now)})` : `version ${n.n} is coming by ${whenWords(n.until, now)} (${who})`
|
|
106
90
|
return { band, words: `Nothing is expected of you: ${words}${owed}`, none: true, ...at }
|
|
107
91
|
}
|
|
108
|
-
if (band === 'working') return { band, words: `Nothing is expected of you: ${f.working
|
|
92
|
+
if (band === 'working') return { band, words: `Nothing is expected of you: ${f.working != null ? agentWords(f.working.who) : (f.holder?.lane ?? 'an agent')} works on it${owed}`, none: true, ...at }
|
|
109
93
|
const stale = staleWorkingOf(f, now)
|
|
110
|
-
const why = f.laneAsk
|
|
94
|
+
const why = f.laneAsk != null ? 'your request for a lane waits for one' : stale != null ? `it waits for an agent (${stale})` : waiting.length > 0 ? 'an agent answers your words first' : 'it waits for an agent to answer'
|
|
111
95
|
return { band, words: `Nothing is expected of you: ${why}${owed}`, none: true, ...at }
|
|
112
96
|
}
|
|
113
97
|
|
package/src/review/format.ts
CHANGED
|
@@ -3,12 +3,15 @@
|
|
|
3
3
|
// repo's unit adds (a kind's facts, a source's), handed in as `more` so this module stays pure
|
|
4
4
|
import { kindOfValue } from './kinds.ts'
|
|
5
5
|
import { refsTail, withThreadLook, type ThreadLook } from './refs.ts'
|
|
6
|
-
import { answersTo, askOpen, askStateText, kindAnswerLine, kindOfAsk, questionWords, wordsAlone } from './answer-kinds.ts'
|
|
7
|
-
import { byMachine, openBrokenOf, placeWords, verdictLabel, toAcknowledge, aboutText, appliedFields, ownAddressOf, partyOf, withdrawnOf,proposeFields, proposeOpen,
|
|
8
|
-
import { answererOf, conversationOf, membersOf,
|
|
6
|
+
import { answersTo, askOpen, askStateText, kindAnswerLine, kindOfAsk, questionWords, remarkOf, rowsStandText, wordsAlone } from './answer-kinds.ts'
|
|
7
|
+
import { byMachine, openBrokenOf, OWES_WORK, STATUS_LABEL, type QuestionTone, placeWords, TONE_ASKS, toneAskTail, verdictLabel, toAcknowledge, aboutText, appliedFields, ownAddressOf, partyOf, withdrawnOf,proposeFields, proposeOpen, isFrame, isOpening, ownSave, isGallery, isPair, NO_SPEC, placeText, stateOf, takenBackOf, updateTag, verdictOf, type ItemDraft, type Message, type Rect, type ReviewItem, type ReviewStatus, type Spec, type Subject } from './model.ts'
|
|
8
|
+
import { answererOf, conversationOf, membersOf, ownAddressesOf, threadIdOf, type Thread } from './threads.ts'
|
|
9
9
|
import { isObject, itemTitle, replacersOf, titleOf } from './supersede.ts'
|
|
10
|
+
import { byAdvisor, byLead, notedOnce, speakerOf } from './speaker.ts'
|
|
10
11
|
import { itemVerdictLine } from './verdict-items.ts'
|
|
11
|
-
import { wakingUnread } from './
|
|
12
|
+
import { wakingUnread, openingOf } from './thread-events.ts'
|
|
13
|
+
import { recapCut, waits } from './thread-state.ts'
|
|
14
|
+
import { recapHint } from './recap.ts'
|
|
12
15
|
|
|
13
16
|
/** where a file of an item is on this disk: `media` the store's media folder (store.ts mediaDir: the repo's store, or the
|
|
14
17
|
* spool beside the daemon's file while the items are rows), never the store folder itself. Every printed path is this one */
|
|
@@ -37,6 +40,16 @@ export interface Say {
|
|
|
37
40
|
look?: ThreadLook
|
|
38
41
|
/** a thread's code, printed in its head line */
|
|
39
42
|
code?: (t: Thread) => string
|
|
43
|
+
/** every message, past a recap he accepted too (`--all`); else a thread reads from that recap on */
|
|
44
|
+
all?: boolean
|
|
45
|
+
/** what folds away before the thread's recap (review/thread-state.ts recapCut), set by a thread's reader */
|
|
46
|
+
hide?: (item: string, m: Pick<Message, 'id' | 'at'> | null) => boolean
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** `say` with the thread's recap cut, unless it reads every message: what it hid, counted by the reader */
|
|
50
|
+
const cutSay = (t: Thread, say: Say): { say: Say; cut: ReturnType<typeof recapCut> } => {
|
|
51
|
+
const cut = say.all ? null : recapCut(t)
|
|
52
|
+
return { say: cut === null ? say : { ...say, hide: cut.hidden }, cut }
|
|
40
53
|
}
|
|
41
54
|
|
|
42
55
|
const PLAIN: Say = { spec: NO_SPEC, more: () => [] }
|
|
@@ -53,7 +66,7 @@ const atText = (t: number | undefined, shot?: Rect['shot']): string =>
|
|
|
53
66
|
|
|
54
67
|
/** each reaction to one view, tile or message of a draft: its place by label, its status, its comment */
|
|
55
68
|
const reactionTexts = (x: ReviewItem, words = true): string[] =>
|
|
56
|
-
(verdictOf(x)?.reactions ?? []).map((q) => `${placeText(q, x.item.views, x.item.draft)}${q.
|
|
69
|
+
(verdictOf(x)?.reactions ?? []).map((q) => `${placeText(q, x.item.views, x.item.draft)}${q.status ? ` ${q.status}` : ''}${q.stars ? ` ★${q.stars}` : ''}${q.comment && words ? `: ${flat(q.comment)}` : ''}`)
|
|
57
70
|
|
|
58
71
|
/** the view he picked on a choice item, `picked [voice 1]`; null when he picked none */
|
|
59
72
|
const pickText = (x: ReviewItem): string | null => {
|
|
@@ -70,7 +83,7 @@ export function line(x: ReviewItem): string {
|
|
|
70
83
|
const rects = f.rects.map((q, i) => `#${i + 1}${many || q.tile !== undefined ? ` ${placeText(q, views)}` : ''}${q.side ? ` ${q.side}` : ''}${atText(q.t, q.shot)} ${flat(q.comment) || '(no comment)'}`)
|
|
71
84
|
const pick = pickText(x)
|
|
72
85
|
const parts = [...(pick ? [pick] : []), ...reactionTexts(x), ...rects]
|
|
73
|
-
return `${x.item.id} ${f.status} "${x.item.title}": ${flat(f.comment) || '(no overall comment)'}${parts.length ? ` | ${parts.join(' | ')}` : ''}`
|
|
86
|
+
return `${x.item.id} ${f.status} "${x.item.title}": ${flat(f.comment) || '(no overall comment)'}${parts.length ? ` | ${parts.join(' | ')}` : ''}${toneAskTail(f.status, x.item.id)}`
|
|
74
87
|
}
|
|
75
88
|
|
|
76
89
|
/** a raised item as the owner names it: `live#85` for a player's report, else its id */
|
|
@@ -83,10 +96,22 @@ function answerLine(x: ReviewItem, m: Message): string | null {
|
|
|
83
96
|
if (!asked || !m.answer) return null
|
|
84
97
|
const kinded = asked.ask ? kindAnswerLine(x.item.id, x.thread, asked, m, flat) : null
|
|
85
98
|
if (kinded !== null) return kinded
|
|
99
|
+
if (asked.ask && m.answer.option !== undefined && m.verdict === 'your-call') {
|
|
100
|
+
const label = asked.ask.options[m.answer.option] ?? `option ${m.answer.option + 1}`
|
|
101
|
+
const remark = remarkOf(label, m.text)
|
|
102
|
+
return `${x.item.id} answered "${flat(asked.text ?? '')}": your call: take your pick ${m.answer.option + 1} « ${label} » if it still holds, else decide yourself and say what you chose${remark ? `; the owner's words: ${flat(remark)}` : ''}`
|
|
103
|
+
}
|
|
86
104
|
if (asked.ask && m.answer.option !== undefined) {
|
|
87
105
|
const label = asked.ask.options[m.answer.option] ?? `option ${m.answer.option + 1}`
|
|
88
|
-
const
|
|
89
|
-
|
|
106
|
+
const remark = remarkOf(label, m.text)
|
|
107
|
+
const picked = `picked ${m.answer.option + 1} « ${label} »${asked.ask.pick === m.answer.option ? ' (your pick)' : ''}${remark ? ` with a remark: ${flat(remark)}` : ''}`
|
|
108
|
+
const row = asked.ask.row
|
|
109
|
+
if (row !== undefined) {
|
|
110
|
+
// one row of a question with a row per thing: the row, then every row once each has his pick
|
|
111
|
+
const all = rowsStandText(x.thread, asked, m.id, flat)
|
|
112
|
+
return `${x.item.id} answered row ${row.i + 1} « ${flat(row.label)} » of "${flat(asked.text ?? '')}": ${picked}${all}`
|
|
113
|
+
}
|
|
114
|
+
return `${x.item.id} answered "${flat(asked.text ?? '')}": ${picked}`
|
|
90
115
|
}
|
|
91
116
|
if (asked.propose && m.answer.apply) {
|
|
92
117
|
const fields = proposeFields(asked.propose)
|
|
@@ -100,10 +125,21 @@ function answerLine(x: ReviewItem, m: Message): string | null {
|
|
|
100
125
|
return null
|
|
101
126
|
}
|
|
102
127
|
|
|
128
|
+
/** what his tone on a question with no option asks of the agent */
|
|
129
|
+
const QUESTION_TONE_WORDS: Record<QuestionTone, string> = {
|
|
130
|
+
rework: 'none of these: read the owner\'s words for what he wants instead, then ask again or build it',
|
|
131
|
+
'wrong-direction': 'wrong direction: stop, rethink the question itself, and ask again before you build',
|
|
132
|
+
'your-call': 'your call: decide yourself if it still holds, else drop it, and say what you chose',
|
|
133
|
+
'no-answer': 'no answer: he left it unanswered, nothing owed',
|
|
134
|
+
}
|
|
135
|
+
|
|
103
136
|
/** the owner's words on a question with no option clicked: none of them, and why */
|
|
104
137
|
function noneLine(x: ReviewItem, m: Message): string | null {
|
|
105
138
|
const asked = m.answer === undefined && m.re && partyOf(m.who) === 'owner' ? x.thread.find((y) => y.id === m.re) : undefined
|
|
106
139
|
if (asked?.ask && kindOfAsk(asked) === 'checklist') return `${x.item.id} on your ${asked.instructions ? 'instructions' : 'checklist'} "${flat(questionWords(asked))}": ${said(m.text)}`
|
|
140
|
+
// one row of a question with a row per thing: the words name that row, then where the rows stand
|
|
141
|
+
if (asked?.ask?.row) return `${x.item.id} answered row ${asked.ask.row.i + 1} « ${flat(asked.ask.row.label)} » of "${flat(questionWords(asked))}": none of these: ${said(m.text)}${rowsStandText(x.thread, asked, m.id, flat)}`
|
|
142
|
+
if (asked?.ask && m.verdict !== undefined && m.verdict in QUESTION_TONE_WORDS) return `${x.item.id} answered "${flat(questionWords(asked))}": ${QUESTION_TONE_WORDS[m.verdict as QuestionTone]}${m.text && m.text !== STATUS_LABEL[m.verdict] ? `; the owner's words: ${said(m.text)}` : ''}`
|
|
107
143
|
if (asked?.ask) return `${x.item.id} answered "${flat(questionWords(asked))}": none: ${said(m.text)}`
|
|
108
144
|
if (asked?.propose) return `${x.item.id} on your change of ${asked.propose.on}: ${said(m.text)}`
|
|
109
145
|
return null
|
|
@@ -115,25 +151,10 @@ function wordsOf(thread: readonly Message[], m: Message): Message | undefined {
|
|
|
115
151
|
const last = kindOfAsk(m) === 'checklist' ? undefined : answersTo(thread, m).at(-1)
|
|
116
152
|
return last !== undefined && wordsAlone(last) ? last : undefined
|
|
117
153
|
}
|
|
118
|
-
if (m.propose && appliedFields(thread, m).size === 0) return thread.find((y) => y.re === m.id && y.answer === undefined && partyOf(y.who) === 'owner')
|
|
154
|
+
if (m.propose && appliedFields(thread, m).size === 0) return thread.find((y) => y.re === m.id && y.answer === undefined && partyOf(y.who) === 'owner')
|
|
119
155
|
return undefined
|
|
120
156
|
}
|
|
121
157
|
|
|
122
|
-
/** the owner's plain words that answer what an agent asked before them on the item (model.ts wordsAnswerOf). `above`: the
|
|
123
|
-
* item's record prints what they answer right above (show, inbox), so the line names it no more; alone (watch), « your
|
|
124
|
-
* question » when they answer one, else each object, a question by its first 60 characters */
|
|
125
|
-
function wordsLine(x: ReviewItem, m: Message, media: string, above = false): string | null {
|
|
126
|
-
if (m.re !== undefined && x.thread.some((y) => y.id === m.re && partyOf(y.who) === 'agent' && (y.ask !== undefined || y.propose !== undefined || y.asksVerdict === true))) return null
|
|
127
|
-
const asked = x.thread.filter((o) => wordsAnswerOf(x.thread, o)?.id === m.id)
|
|
128
|
-
if (asked.length === 0) return null
|
|
129
|
-
const words = `${toText(m)}: ${said(m.text)}${mediaText(m, media, x.item.id)}`
|
|
130
|
-
if (above) return `${x.item.id} answer${words}`
|
|
131
|
-
const short = (s: string): string => (s.length > 60 ? `${s.slice(0, 59)}…` : s)
|
|
132
|
-
const one = asked.length === 1 ? asked[0]! : null
|
|
133
|
-
const what = one?.ask ? 'your question' : one?.asksVerdict ? 'your words' : asked.map((o) => (o.propose ? `your change of ${o.propose.on}` : `"${short(flat(o.ask ? questionWords(o) : (o.text ?? '')))}"`)).join(' and ')
|
|
134
|
-
return `${x.item.id} answered ${what} in words${words}`
|
|
135
|
-
}
|
|
136
|
-
|
|
137
158
|
/** his save of the thread's object from the hub's editor: what changed, then its changed lines, one a line */
|
|
138
159
|
function editLine(x: ReviewItem, m: Message): string | null {
|
|
139
160
|
if (m.edit === undefined || partyOf(m.who) !== 'owner') return null
|
|
@@ -152,7 +173,7 @@ function askLine(x: ReviewItem): string | null {
|
|
|
152
173
|
|
|
153
174
|
/** each question and proposed change an agent put on the item, open or answered: its options and the agent's pick, its
|
|
154
175
|
* fields and which the owner applied; one a newer object superseded, or that its closed ask closed, says so */
|
|
155
|
-
function asksText(x: ReviewItem): string[] {
|
|
176
|
+
function asksText(x: ReviewItem, hide?: Say['hide']): string[] {
|
|
156
177
|
const out: string[] = []
|
|
157
178
|
const gone = replacersOf([x])
|
|
158
179
|
const ask = askLine(x)
|
|
@@ -162,11 +183,11 @@ function asksText(x: ReviewItem): string[] {
|
|
|
162
183
|
const state = (m: Message, open: boolean): string => {
|
|
163
184
|
const by = gone.get(m.id)
|
|
164
185
|
const words = open ? undefined : wordsOf(x.thread, m)
|
|
165
|
-
// the words
|
|
186
|
+
// the owner's words typed in its own box: in the thread below, said once
|
|
166
187
|
return by ? (by.op === 'withdraw' ? `${titleOf(by)}, ${by.id}` : `superseded by ${by.id} « ${titleOf(by)} »`) : closed ? (open ? 'closed with the ask' : 'answered') : open ? 'open' : words ? 'answered in words' : 'answered'
|
|
167
188
|
}
|
|
168
189
|
for (const m of x.thread) {
|
|
169
|
-
if (partyOf(m.who) !== 'agent') continue
|
|
190
|
+
if (partyOf(m.who) !== 'agent' || hide?.(x.item.id, m) === true) continue
|
|
170
191
|
if (m.instructions) out.push(` instructions ${m.at} (${gone.has(m.id) ? state(m, false) : 'current'}): « ${m.instructions.title} » ${m.id}${m.instructions.folds.length > 0 ? `, folds ${m.instructions.folds.join(' ')}` : ''}`)
|
|
171
192
|
if (m.ask && kindOfAsk(m) !== 'choice') out.push(` ${m.instructions ? 'its steps' : `question ${m.at}`} (${state(m, askOpen(x.thread, m))}): "${flat(questionWords(m))}" ${askStateText(x.thread, m)}`)
|
|
172
193
|
else if (m.ask) {
|
|
@@ -185,7 +206,7 @@ function asksText(x: ReviewItem): string[] {
|
|
|
185
206
|
export function wordText(m: Message, max = 160): string {
|
|
186
207
|
const words = flat(m.text ?? '') || (m.verdict ? `verdict ${m.verdict}` : m.askState ? `ask ${m.askState.state}` : m.answer ? 'an answer' : m.action ? `clicked ${m.action.name}` : 'no words')
|
|
187
208
|
const cut = words.length > max ? `${words.slice(0, max - 1)}…` : words
|
|
188
|
-
return `${m
|
|
209
|
+
return `${speakerOf(m) === 'owner' ? 'his' : speakerOf(m)} word of ${m.at.slice(0, 16).replace('T', ' ')} UTC: « ${cut} »`
|
|
189
210
|
}
|
|
190
211
|
|
|
191
212
|
/** the owner's click on one of the kind's actions: what the holder does next */
|
|
@@ -219,11 +240,10 @@ export const replyLine = (x: ReviewItem, m: Message, media: string, item: Review
|
|
|
219
240
|
actionLine(x, m) ??
|
|
220
241
|
answerLine(x, m) ??
|
|
221
242
|
noneLine(x, m) ??
|
|
222
|
-
wordsLine(x, m, media) ??
|
|
223
243
|
editLine(x, m) ??
|
|
224
244
|
`${(item ?? x).item.id} reply${toText(m)} "${itemTitle(item ?? x)}"${item ? ` (on ${refOf(x)})` : ''}${updateText(x, m)}: ${said(m.text)}${mediaText(m, media, x.item.id)}`
|
|
225
245
|
|
|
226
|
-
const TOOK: Record<ReviewStatus, string> = { approved: 'approval', 'approved-with-fix': '« ok with a fix »',
|
|
246
|
+
const TOOK: Record<ReviewStatus, string> = { approved: 'approval', 'approved-with-fix': '« ok with a fix »', rework: '« rework »', 'wrong-direction': '« wrong direction »', 'your-call': '« your call »', 'no-answer': '« no answer »', archived: '« archived, later »' }
|
|
227
247
|
|
|
228
248
|
/** each verdict he took back, unseen: what it was, when he gave it, and that it no longer holds */
|
|
229
249
|
export const takeBackTexts = (x: ReviewItem): { m: Message; text: string }[] =>
|
|
@@ -249,13 +269,13 @@ export function askEditHint(x: ReviewItem, m: Message): string {
|
|
|
249
269
|
export function watchLines(x: ReviewItem, items: readonly ReviewItem[], media: string, to?: (x: ReviewItem, m: Message) => boolean): { key: string; text: string }[] {
|
|
250
270
|
const out: { key: string; text: string }[] = takeBackTexts(x).map((t) => ({ key: `${x.item.id}#${t.m.id}`, text: `${x.item.id} taken back "${x.item.title}": ${t.text}` }))
|
|
251
271
|
const f = verdictOf(x)
|
|
252
|
-
if (f && !f.seen) out.push({ key: `${x.item.id}@${f.at}`, text: `${line(x)}${markIt(x.item.id)}` })
|
|
272
|
+
if (f && !f.seen) out.push({ key: `${x.item.id}@${f.at}`, text: `${byAdvisor(line(x), x.thread.find((m) => m.id === f.id))}${markIt(x.item.id)}` })
|
|
253
273
|
const item = x.item.origin.by === 'agent' ? null : answererOf(x.item.id, items)
|
|
254
274
|
// the words that raised an item the version answers are what the version answers
|
|
255
275
|
const opening = item ? openingOf(x) : undefined
|
|
256
276
|
// the owner's verdict on a message that asked it reads as that verdict; every other word as a reply
|
|
257
|
-
for (const m of wakingUnread(x, to && ((w) => to(x, w)))) if (m !== opening) out.push({ key: `${x.item.id}#${m.id}`, text: `${(m.verdict !== undefined ? itemVerdictLine(x, m) : null) ?? replyLine(x, m, media, item)}${markIt(x.item.id)}${askEditHint(x, m)}` })
|
|
258
|
-
// his « set aside », his close of a thread, an ask opened again: heard, owed nothing (review/
|
|
277
|
+
for (const m of wakingUnread(x, to && ((w) => to(x, w)))) if (m !== opening) out.push({ key: `${x.item.id}#${m.id}`, text: `${byAdvisor((m.verdict !== undefined ? itemVerdictLine(x, m) : null) ?? replyLine(x, m, media, item), m)}${markIt(x.item.id)}${askEditHint(x, m)}${recapHint(m, x.item.on ?? x.item.id)}` })
|
|
278
|
+
// his « set aside », his close of a thread, an ask opened again: heard, owed nothing (review/thread-events.ts)
|
|
259
279
|
const pending = new Set(toAcknowledge(x, 'agent'))
|
|
260
280
|
for (const m of x.thread) {
|
|
261
281
|
if (!pending.has(m.id) || partyOf(m.who) !== 'owner') continue
|
|
@@ -283,7 +303,13 @@ export const untakenLine = (x: ReviewItem, why: string, lane: string | null): st
|
|
|
283
303
|
|
|
284
304
|
/** one thread as one record: each item the version answers, then the version, its older versions, and with `full` the whole conversation */
|
|
285
305
|
export function threadDetail(t: Thread, media: string, full = false, say: Say = PLAIN): string {
|
|
286
|
-
return withThreadLook(say.look, () => wholeThread(t, media, full, say))
|
|
306
|
+
return notedOnce(withThreadLook(say.look, () => wholeThread(t, media, full, cutSay(t, say).say)))
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/** the line that says where a thread past its recap reads from, and how to read it whole */
|
|
310
|
+
const recapFrom = (t: Thread, say: Say, folded: number): string | null => {
|
|
311
|
+
const r = say.hide === undefined ? null : recapCut(t)?.recap
|
|
312
|
+
return r ? ` read from the recap ${r.id} he accepted (${r.at}): ${folded} message${folded === 1 ? '' : 's'} before it folded, what still waits or is owed kept; every one: sk thread show ${ownAddressesOf(t, say.spec)[0] ?? threadIdOf(t)} --all` : null
|
|
287
313
|
}
|
|
288
314
|
|
|
289
315
|
/** a thread's code as its head line prints it, after its id: ` #k7m2` */
|
|
@@ -297,18 +323,23 @@ function wholeThread(t: Thread, media: string, full: boolean, say: Say): string
|
|
|
297
323
|
const own = ownAddressesOf(t, say.spec)[0]
|
|
298
324
|
const out: string[] = [`thread ${threadIdOf(t)}${codeText(t, say)}${own ? ` ${own}` : ''}${t.versions.length > 1 ? ` v${t.versions.length} is ${t.head.item.id}` : ''}`, '']
|
|
299
325
|
// a note joined by its address alone keeps its own state: no version answered it
|
|
300
|
-
for (const r of t.answers) out.push(`${t.joined.has(r.item.id) ? 'his note' : 'answers'} ${refOf(r)}:`, detail(r, media, false, !t.joined.has(r.item.id), say, own), '')
|
|
326
|
+
for (const r of t.answers.filter((y) => say.hide?.(y.item.id, null) !== true)) out.push(`${t.joined.has(r.item.id) ? 'his note' : 'answers'} ${refOf(r)}:`, detail(r, media, false, !t.joined.has(r.item.id), say, own), '')
|
|
301
327
|
// with `full` the conversation below holds every word of his: the head's unread lines would say them twice
|
|
302
328
|
out.push(detail(t.head, media, full, false, full ? { ...say, to: () => false } : say, own))
|
|
303
329
|
const older = t.versions.slice(1)
|
|
304
330
|
if (older.length > 0) out.push(` versions: ${older.map((x, i) => `v${older.length - i} ${x.item.id}`).join(', ')}`)
|
|
305
331
|
if (full) {
|
|
306
|
-
const
|
|
332
|
+
const every = conversationOf(t)
|
|
333
|
+
const conv = every.filter((m) => say.hide?.(m.on, m) !== true)
|
|
334
|
+
const from = recapFrom(t, say, every.length - conv.length)
|
|
335
|
+
if (from !== null) out.push(from)
|
|
307
336
|
if (conv.length > 0) out.push(' thread:')
|
|
308
337
|
const members = membersOf(t)
|
|
309
338
|
for (const m of conv) {
|
|
310
339
|
const of = members.find((y) => y.item.id === m.on)
|
|
311
|
-
|
|
340
|
+
// a recap reads whole, its sections one a line
|
|
341
|
+
const words = m.recap === true ? `recap\n${(m.text ?? '').split('\n').map((l) => ` ${l}`).join('\n')}` : said(m.text)
|
|
342
|
+
out.push(` ${m.id} ${speakerOf(m)}${m.on === t.head.item.id ? '' : ` [on ${m.on}]`}${of ? updateText(of, m) : ''}: ${words}${mediaText(m, media, m.on)}`)
|
|
312
343
|
}
|
|
313
344
|
}
|
|
314
345
|
return out.join('\n')
|
|
@@ -329,7 +360,7 @@ export function itemIdsOf(t: Thread, objects = false): string[] {
|
|
|
329
360
|
* its own id and state, so his answer on an older version names that version; then the newest version, when it is none
|
|
330
361
|
* of them, as what it is: sent after his answer, waiting for him, never his answer */
|
|
331
362
|
export function newsDetail(t: Thread, news: readonly ReviewItem[], media: string, say: Say = PLAIN): string {
|
|
332
|
-
return withThreadLook(say.look, () => threadNews(t, news, media, say))
|
|
363
|
+
return notedOnce(withThreadLook(say.look, () => threadNews(t, news, media, cutSay(t, say).say)))
|
|
333
364
|
}
|
|
334
365
|
|
|
335
366
|
function threadNews(t: Thread, news: readonly ReviewItem[], media: string, say: Say): string {
|
|
@@ -386,7 +417,7 @@ const raisedBy = (o: ReviewItem['item']['origin']): string =>
|
|
|
386
417
|
|
|
387
418
|
/** one item: a raised one by its state and the raising words, an item by the owner's verdict; `followed`: a later item supersedes or answers it */
|
|
388
419
|
export function detail(x: ReviewItem, media: string, full = false, followed = false, say: Say = PLAIN, named?: string): string {
|
|
389
|
-
return withThreadLook(say.look, () => itemDetail(x, media, full, followed, say, named))
|
|
420
|
+
return notedOnce(withThreadLook(say.look, () => itemDetail(x, media, full, followed, say, named)))
|
|
390
421
|
}
|
|
391
422
|
|
|
392
423
|
function itemDetail(x: ReviewItem, media: string, full: boolean, followed: boolean, say: Say, named?: string): string {
|
|
@@ -398,15 +429,16 @@ function itemDetail(x: ReviewItem, media: string, full: boolean, followed: boole
|
|
|
398
429
|
const frame = subjectText(r.subject)
|
|
399
430
|
const sub = [...(frame ? [frame] : []), ...(r.draft ? [draftText(r.draft)] : []), ...say.more(x)]
|
|
400
431
|
const replies = wakingUnread(x, say.to && ((m) => say.to!(x, m))).map((m) => {
|
|
401
|
-
const answer = answerLine(x, m) ?? noneLine(x, m) ??
|
|
402
|
-
const hint = askEditHint(x, m).
|
|
403
|
-
|
|
432
|
+
const answer = answerLine(x, m) ?? noneLine(x, m) ?? askStateLine(x, m)
|
|
433
|
+
const hint = `${askEditHint(x, m)}${recapHint(m, own ?? r.id)}`.replaceAll(' · ', '\n ')
|
|
434
|
+
const by = byLead(m)
|
|
435
|
+
return answer ? ` ${by}${answer.slice(r.id.length + 1)} (${m.at})${hint}` : ` ${by}reply${toText(m)} ${m.at}${updateText(x, m)}: ${m.text}${refsTail(m.text ?? '')}${mediaText(m, media, r.id)}${hint}`
|
|
404
436
|
})
|
|
405
|
-
const asked = asksText(x)
|
|
437
|
+
const asked = asksText(x, say.hide)
|
|
406
438
|
if (r.origin.by !== 'agent') {
|
|
407
439
|
const st = stateOf(x, followed)
|
|
408
440
|
const said = x.thread.filter((m) => m.who === 'owner' || m.who === 'player')
|
|
409
|
-
const words = full ? x.thread.filter((m) => (m.text !== undefined || m.op !== undefined) && m.op !== 'seen') : said.filter((m) => m.text !== undefined && m.op === undefined)
|
|
441
|
+
const words = (full ? x.thread.filter((m) => (m.text !== undefined || m.op !== undefined) && m.op !== 'seen') : said.filter((m) => m.text !== undefined && m.op === undefined)).filter((m) => say.hide?.(r.id, m) !== true)
|
|
410
442
|
const pins = said.filter((m) => m.rects !== undefined).at(-1)
|
|
411
443
|
const first = r.views[0]
|
|
412
444
|
const image = first && !isGallery(first) ? Object.values(first.files) : []
|
|
@@ -417,7 +449,7 @@ function itemDetail(x: ReviewItem, media: string, full: boolean, followed: boole
|
|
|
417
449
|
...asked,
|
|
418
450
|
...(r.what ? r.what.split('\n').map((l) => ` ${l}`) : []),
|
|
419
451
|
...(st.topic ? [` topic ${st.topic}${st.worker ? `, claimed by ${st.worker}` : ''}${r.origin.by === 'owner' && r.origin.kind ? `, ${r.origin.kind}` : ''}`] : []),
|
|
420
|
-
...words.map((m) => ` ${m
|
|
452
|
+
...words.map((m) => ` ${speakerOf(m)} ${m.at}${m.op ? ` ${m.op}${m.topic ? ` ${m.topic}` : ''}` : ''}: ${m.text ?? m.note ?? ''}${refsTail(m.text ?? '')}${m.fix ? ` (${m.fix.commit})` : ''}`),
|
|
421
453
|
...(pins ? drawnText(pins) : []),
|
|
422
454
|
...(image.length > 0 ? [` image: ${image.map((n) => mediaPath(media, r.id, n)).join(' ')}`] : []),
|
|
423
455
|
].join('\n')
|
|
@@ -428,7 +460,8 @@ function itemDetail(x: ReviewItem, media: string, full: boolean, followed: boole
|
|
|
428
460
|
// a draft's fix on places reads « FIX ON X », its words the version's comment, said once; every other verdict its machine word
|
|
429
461
|
const label = verdictLabel(r, f.status, f.reactions)
|
|
430
462
|
const placed = f.comment === '' && r.draft !== undefined ? placeWords(f.reactions ?? [], r) : ''
|
|
431
|
-
const
|
|
463
|
+
const fm = x.thread.find((m) => m.id === f.id)
|
|
464
|
+
const out = [`${r.id} ${(label.startsWith('fix on') ? label : f.status).toUpperCase()} ${f.at}${fm && byLead(fm) !== '' ? ` ${byLead(fm).slice(0, -2)}` : ''}`, head, ...sub, ...asked, ...back, ...(pick ? [` ${pick}`] : []), ` comment: ${f.comment || placed || '(none)'}`, ...(OWES_WORK.has(f.status) ? [` asks: ${TONE_ASKS[f.status].replace('<id>', r.id)}`] : [])]
|
|
432
465
|
for (const t of reactionTexts(x, placed === '')) out.push(` ${r.draft ? 'place' : 'view'} ${t}`)
|
|
433
466
|
const px = (v: number, of: number): number => Math.round(v * of)
|
|
434
467
|
const views = r.views
|
package/src/review/glyphs.ts
CHANGED
|
@@ -51,6 +51,7 @@ export const MESSAGE_TYPES = {
|
|
|
51
51
|
secret: { label: 'secret field', shows: "a field the owner types a secret into: it goes to the vault, never shown again", icon: 'M7 7a3 3 0 1 0 0 6a3 3 0 1 0 0-6M10 10h7.5M15 10v2.5M17.5 10v2' },
|
|
52
52
|
change: { label: 'proposed change', shows: "a proposed change, field by field (words, a colour, code, a file): the owner applies or edits it", icon: 'M4.5 3h11v14h-11zM7.5 7.5h5M10 5v5M7.5 13.5h5' },
|
|
53
53
|
instructions: { label: 'instructions', shows: "an ask's steps for an act only the owner can do", icon: 'M5 2.5h10v15H5zM7.5 6h5M7.5 9h5M7.5 12h2.5' },
|
|
54
|
+
recap: { label: 'recap', shows: "an agent's recap of a long thread, in four sections (decided, live now, open, links), judged like a version; once the owner accepts it, the thread reads from it on, what came before one click away", icon: 'M3 3.5h14M3 7h14M3 10.5h14M6 14h8M8 17h4' },
|
|
54
55
|
answer: { label: 'answer', shows: "the owner's answer to a question", icon: 'M3 4h14v9H8l-4 3.5V13H3zM7 8.5l2 2 4-4' },
|
|
55
56
|
update: { label: 'update', shows: "an agent's line on where the work stands: broken, better, fixed", icon: 'M2 10h3.5l2-5 5 10 2-5H18' },
|
|
56
57
|
hint: { label: 'hint', shows: "the owner's few words on an update", icon: 'M4 16l.75-3L13 4.75l2.25 2.25L7 15.25zM11.5 6.25l2.25 2.25' },
|
package/src/review/hand-over.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// once, a `take` in the taker's name with one trace line (« studio main took the thread: from L99, which ended »). A
|
|
3
3
|
// lane that ended → its session; a holder whose session ended → the repo's live main session (parties.ts handOverOf).
|
|
4
4
|
// Run by the hook at a lane's end (SubagentStop), at each prompt and turn end, and by the hub's minute pass.
|
|
5
|
-
// the one constraint a reader breaks first: only a thread that still owes a move passes (
|
|
5
|
+
// the one constraint a reader breaks first: only a thread that still owes a move passes (its state's turn not `done`): a take
|
|
6
6
|
// is the thread's newest move, so a pass over done threads would reorder his lists; a done one passes once he writes
|
|
7
7
|
// in it again (the hearing of a done thread is already right: parties.ts hearingOf)
|
|
8
8
|
import { existsSync } from 'node:fs'
|
|
@@ -11,7 +11,7 @@ import { handOverOf, type HandedFrom, type Parties } from './parties.ts'
|
|
|
11
11
|
import type { Spec } from './model.ts'
|
|
12
12
|
import { appendMessage, readAll, specOf, storeDir } from './store.ts'
|
|
13
13
|
import { holderOf, ownAddressesOf, threadsOf } from './threads.ts'
|
|
14
|
-
import {
|
|
14
|
+
import { threadState } from './thread-state.ts'
|
|
15
15
|
|
|
16
16
|
export interface HandedOver {
|
|
17
17
|
address: string
|
|
@@ -31,7 +31,7 @@ export function handOver(dir: string, spec: Spec, p: Parties, repo: string, o: {
|
|
|
31
31
|
const out: HandedOver[] = []
|
|
32
32
|
for (const t of threadsOf(readAll(dir).items, spec)) {
|
|
33
33
|
const to = handOverOf(holderOf(t), p, repo)
|
|
34
|
-
if (to === null ||
|
|
34
|
+
if (to === null || threadState(t, now).turn === 'done') continue
|
|
35
35
|
const own = to.from.lane !== undefined && to.from.session === to.to
|
|
36
36
|
const head = t.head.item.id
|
|
37
37
|
const address = ownAddressesOf(t, spec)[0] ?? head
|
package/src/review/heard.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// first agent read of each of the owner's words that wakes one. Pure and browser safe: the cells carry it, the hub draws
|
|
3
3
|
// « seen by X · 3 s » or « waiting »
|
|
4
4
|
import { partyOf, type Message, type ReviewItem } from './model.ts'
|
|
5
|
-
import { wakeOf } from './
|
|
5
|
+
import { wakeOf } from './thread-events.ts'
|
|
6
6
|
|
|
7
7
|
/** the first agent read of one word of the owner's: who, its session, how long after the owner's word */
|
|
8
8
|
export interface Heard {
|
package/src/review/holds-sync.ts
CHANGED
|
@@ -6,13 +6,14 @@
|
|
|
6
6
|
// read must never close a thread
|
|
7
7
|
import { existsSync } from 'node:fs'
|
|
8
8
|
import { branchHold } from './branch-hold.ts'
|
|
9
|
+
import { blockedHold } from './blocked-object.ts'
|
|
9
10
|
import { heldOpen, holdsOpenOf, type Hold, type HoldState, type HoldsOpen } from './holds.ts'
|
|
10
11
|
import type { ReviewItem, Spec } from './model.ts'
|
|
11
12
|
import { appendMessage, readAll, specOf, storeDir } from './store.ts'
|
|
12
13
|
import { membersOf, threadsOf } from './threads.ts'
|
|
13
14
|
|
|
14
15
|
/** the house kinds' checks: server side, beside a declaration the hub bundles (review/kinds.ts) */
|
|
15
|
-
const HOUSE_CHECKS: Record<string, NonNullable<HoldsOpen['check']>> = { branch: branchHold }
|
|
16
|
+
const HOUSE_CHECKS: Record<string, NonNullable<HoldsOpen['check']>> = { branch: branchHold, blocked: blockedHold }
|
|
16
17
|
|
|
17
18
|
export interface HoldSync {
|
|
18
19
|
checked: number
|
package/src/review/inbox-hook.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// `sk thread inbox --hook`: the inbox as a Claude Code hook, so the owner's answers reach a session that holds no
|
|
2
2
|
// watch. On a prompt (UserPromptSubmit) the unseen answers join the turn as context; at a turn's end (Stop) the turn
|
|
3
|
-
// is refused while one is unseen, or read with no act in its thread since (review/
|
|
3
|
+
// is refused while one is unseen, or read with no act in its thread since (its owes, review/thread-state.ts), or while a
|
|
4
4
|
// thread of his turn has no watch of the session to hear it. At a lane's end (SubagentStop) it only passes the lane's
|
|
5
5
|
// threads on (review/hand-over.ts) and prints nothing. The agent marks an answer seen as it reads it, then says what it
|
|
6
6
|
// does (`sk thread working`).
|
|
@@ -95,7 +95,7 @@ export function hookAnswer(input: HookInput, unseen: string, owed: readonly stri
|
|
|
95
95
|
handed,
|
|
96
96
|
held,
|
|
97
97
|
unseen === '' ? '' : `Answers of the owner in threads, unseen or read with nothing done since (mark each seen as you read it: \`${bin} thread seen <id>\`, then \`${bin} thread working <id> "<what you do now>"\`, then act):\n${unseen}`,
|
|
98
|
-
owed.length === 0 ? '' : `Answers read but not closed (done or wontfix): ${owed.join('
|
|
98
|
+
owed.length === 0 ? '' : `Answers read but not closed (done or wontfix): ${owed.join('; ')}`,
|
|
99
99
|
nobody === '' ? '' : `Threads of this repo nobody hears now (no agent holds it, or the session that held it ended): take one when your task allows, else name it in your report. To act on one, \`${bin} thread take <address>\` makes it yours, then act and \`${bin} thread seen <id>\`:\n${nobody}`,
|
|
100
100
|
unheard(us.filter((u) => u.open > 0), bin, o.laneWatches ?? []),
|
|
101
101
|
// the project's orchestrator role (orchestrator/role.ts rolePromptLine): nobody hears it, or this session holds it deaf
|