rvlib-shipkit 2.27.0 → 2.28.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 +16 -0
- package/package.json +1 -1
- package/src/agent-time/hooks.ts +10 -3
- package/src/agent-time/live.ts +11 -5
- package/src/agent-time/registry.ts +289 -0
- package/src/agent-time/store.ts +2 -2
- package/src/annex/born.ts +2 -2
- package/src/annex/offload.ts +12 -11
- package/src/asks/ask-after.ts +6 -2
- package/src/asks/ask-bar-fold.ts +57 -0
- package/src/asks/ask-migrate.ts +280 -0
- package/src/asks/ask-steps-fold.ts +166 -0
- package/src/asks/ask-store.ts +586 -0
- package/src/assets/kits/identity-kit.ts +106 -38
- package/src/assets/kits/poster-thumbnail.ts +282 -0
- package/src/checks/SK003-claude-md-shape.check.ts +92 -25
- package/src/checks/SK004-gitignore-policy.check.ts +8 -4
- package/src/checks/SK013-one-way-in-policy.check.ts +10 -0
- package/src/checks/SK026-asks-autoclose.check.ts +9 -23
- package/src/checks/SK038-speaks-as.check.ts +3 -3
- package/src/checks/SK042-post-kinds.check.ts +26 -24
- package/src/checks/SK049-thread-answers-hook.check.ts +81 -0
- package/src/checks/SK050-retired-commands.check.ts +127 -0
- package/src/cli/cmd_Asks.ts +204 -53
- package/src/cli/cmd_Backup.ts +151 -8
- package/src/cli/cmd_Calls.ts +1 -0
- package/src/cli/cmd_Commands.ts +140 -34
- package/src/cli/cmd_Contracts.ts +1 -0
- package/src/cli/cmd_Keys.ts +1 -0
- package/src/cli/cmd_Lanes.ts +15 -4
- package/src/cli/cmd_Messages.ts +152 -1
- package/src/cli/cmd_Needs.ts +1 -0
- package/src/cli/cmd_Review.ts +931 -229
- package/src/cli/cmd_Secret.ts +255 -34
- package/src/cli/cmd_Social.ts +36 -33
- package/src/cli/cmd_SocialDrafts.ts +235 -0
- package/src/cli/cmd_Sound.ts +22 -1
- package/src/cli/cmd_Start.ts +3 -2
- package/src/cli/cmd_ThreadHolds.ts +34 -0
- package/src/cli/cmd_ThreadKinds.ts +146 -0
- package/src/cli/cmd_ThreadReflect.ts +83 -0
- package/src/cli/cmd_ThreadSyncNeeds.ts +62 -0
- package/src/cli/cmd_Vault.ts +1 -1
- package/src/cli/cmd_When.ts +1 -0
- package/src/cli/family-help.ts +2 -2
- package/src/cli/family-pages.ts +1 -1
- package/src/cli/kit/builtins.ts +1 -0
- package/src/cli/kit/verb.ts +6 -2
- package/src/cli/registry.ts +21 -2
- package/src/cli.ts +5 -2
- package/src/collections/actions.ts +25 -74
- package/src/collections/collection-types.ts +9 -5
- package/src/collections/md-body.ts +5 -3
- package/src/collections/pings.ts +13 -6
- package/src/collections/providers.ts +53 -61
- package/src/collections/reflections.ts +9 -4
- package/src/core/discover-checks.ts +18 -3
- package/src/core/git.ts +31 -0
- package/src/core/house-layout.ts +17 -0
- package/src/core/layout.ts +10 -5
- package/src/core/locked-write.ts +4 -1
- package/src/core/machine-db.ts +5 -3
- package/src/core/migrate-layout.ts +8 -10
- package/src/home/activity.ts +8 -15
- package/src/home/daemon-jobs.ts +13 -1
- package/src/home/home-paths.ts +6 -3
- package/src/home/home-routes.ts +8 -0
- package/src/home/inbox-shape.ts +233 -100
- package/src/home/inbox.ts +26 -71
- package/src/home/machine-fold.ts +10 -15
- package/src/home/machine-host.ts +19 -1
- package/src/home/other-macs.ts +2 -2
- package/src/home/serve-web.ts +6 -5
- package/src/home/space-page.ts +1 -1
- package/src/home/vault-page.ts +51 -17
- package/src/home/vault-words.ts +2 -2
- package/src/hooks/one-way-in-guard.ts +24 -2
- package/src/hq/files-send.ts +27 -28
- package/src/hq/hq-db.ts +4 -1
- package/src/hq/hq-local.ts +37 -4
- package/src/hq/hq-routes.ts +10 -2
- package/src/hq/hq-store.ts +6 -2
- package/src/hq/kinds/ask.ts +6 -6
- package/src/hq/outbox.ts +5 -3
- package/src/hq/replica.ts +1 -2
- package/src/hq/vault-route.ts +112 -0
- package/src/identities/collection.ts +2 -2
- package/src/identities/identities.ts +9 -8
- package/src/identities/machine-route.ts +8 -3
- package/src/ledger/db.ts +8 -1
- package/src/media-store/backup/daemon.ts +48 -8
- package/src/media-store/backup/keys.ts +1 -1
- package/src/media-store/backup/manifest.ts +20 -2
- package/src/media-store/backup/prune.ts +365 -0
- package/src/media-store/backup/retention.ts +122 -0
- package/src/media-store/backup/run.ts +14 -8
- package/src/media-store/backup/sources.ts +18 -17
- package/src/media-store/backup/thread-copy.ts +340 -0
- package/src/media-store/copy/config.ts +3 -4
- package/src/media-store/copy/store.ts +2 -2
- package/src/media-store/db.ts +2 -2
- package/src/media-store/forget.ts +118 -0
- package/src/media-store/purge.ts +3 -2
- package/src/media-store/space-listing.ts +20 -4
- package/src/media-store/space.ts +6 -5
- package/src/messages/guard.ts +49 -0
- package/src/messages/model.ts +1 -1
- package/src/messages/objects.ts +201 -0
- package/src/messages/routes.ts +2 -2
- package/src/messages/score.ts +1 -1
- package/src/messages/write.ts +285 -0
- package/src/pages/frame-client.ts +181 -4
- package/src/reflections/reflections-queue.ts +1 -1
- package/src/release/gate-checkout.ts +2 -1
- package/src/release/git-facts.ts +3 -2
- package/src/release/public-clean.ts +3 -2
- package/src/repo-config.ts +40 -18
- package/src/review/anim.ts +1 -1
- package/src/review/answer-kinds.ts +131 -0
- package/src/review/band.ts +53 -0
- package/src/review/branch-hold.ts +84 -0
- package/src/review/card-db.ts +16 -6
- package/src/review/card-rows.ts +4 -3
- package/src/review/cells.ts +297 -65
- package/src/review/close.ts +92 -0
- package/src/review/draft-card.ts +8 -16
- package/src/review/draft-model.ts +2 -2
- package/src/review/events.ts +171 -0
- package/src/review/format.ts +128 -14
- package/src/review/glyphs.ts +63 -0
- package/src/review/gone.ts +1 -1
- package/src/review/holds-sync.ts +62 -0
- package/src/review/holds.ts +85 -0
- package/src/review/house-kind-defs.ts +41 -0
- package/src/review/inbox-hook.ts +22 -9
- package/src/review/inbox-read.ts +201 -0
- package/src/review/instructions.ts +199 -0
- package/src/review/kind-apply.ts +61 -0
- package/src/review/kind-catalog.ts +96 -0
- package/src/review/kinds.ts +278 -0
- package/src/review/lane-ask.ts +109 -0
- package/src/review/model.ts +396 -86
- package/src/review/move.ts +3 -3
- package/src/review/need-address.ts +15 -0
- package/src/review/need-threads.ts +93 -0
- package/src/review/object-card.ts +48 -0
- package/src/review/object-read.ts +31 -0
- package/src/review/owner-verdict.ts +36 -0
- package/src/review/parties.ts +182 -0
- package/src/review/previews.ts +3 -1
- package/src/review/projections.ts +235 -0
- package/src/review/referring.ts +54 -0
- package/src/review/reflection-object.ts +195 -0
- package/src/review/routes.ts +137 -32
- package/src/review/secret-route.ts +80 -0
- package/src/review/snooze.ts +38 -0
- package/src/review/stage-card.ts +4 -4
- package/src/review/store.ts +366 -85
- package/src/review/supersede.ts +116 -0
- package/src/review/take-back.ts +52 -0
- package/src/review/thread-fold.ts +20 -7
- package/src/review/threads.ts +236 -39
- package/src/review/traces.ts +218 -0
- package/src/review/trailer-card.ts +2 -2
- package/src/review/unit.ts +71 -5
- package/src/review/verdict-items.ts +73 -0
- package/src/review/verdict-write.ts +15 -0
- package/src/review/wait.ts +85 -0
- package/src/review/watchers.ts +22 -9
- package/src/scaffold/files/claude-settings-local.json +2 -0
- package/src/secrets/archive-mark.ts +52 -0
- package/src/secrets/archive.ts +83 -0
- package/src/secrets/copy.ts +14 -14
- package/src/secrets/keychain-write.ts +48 -0
- package/src/secrets/keychain.ts +8 -5
- package/src/secrets/lapse-mark.ts +33 -0
- package/src/secrets/lapse.ts +60 -0
- package/src/secrets/list.ts +16 -22
- package/src/secrets/manager.ts +31 -16
- package/src/secrets/read.ts +161 -33
- package/src/secrets/tail.ts +31 -0
- package/src/serve/hub-app/asks-page.tsx +2 -1
- package/src/serve/hub-app/auto-text.tsx +14 -6
- package/src/serve/hub-app/benign-errors.ts +15 -1
- package/src/serve/hub-app/card-head.tsx +49 -0
- package/src/serve/hub-app/check-view.tsx +3 -2
- package/src/serve/hub-app/code-copy.ts +35 -0
- package/src/serve/hub-app/col-card.tsx +31 -40
- package/src/serve/hub-app/col-list-page.tsx +5 -2
- package/src/serve/hub-app/col-tables-view.tsx +7 -4
- package/src/serve/hub-app/col-tables.ts +5 -5
- package/src/serve/hub-app/cols-svc.ts +4 -79
- package/src/serve/hub-app/commands/commands-page.tsx +2 -1
- package/src/serve/hub-app/controls.css +83 -0
- package/src/serve/hub-app/frames-st.ts +17 -1
- package/src/serve/hub-app/git-view.tsx +3 -2
- package/src/serve/hub-app/home-st.ts +57 -6
- package/src/serve/hub-app/home-strip.css +1 -6
- package/src/serve/hub-app/home-strip.tsx +2 -1
- package/src/serve/hub-app/home.html +3 -0
- package/src/serve/hub-app/house-wiki-view.tsx +20 -0
- package/src/serve/hub-app/hub-app.tsx +48 -32
- package/src/serve/hub-app/hub-types.ts +2 -0
- package/src/serve/hub-app/hub.css +50 -61
- package/src/serve/hub-app/icons.tsx +14 -4
- package/src/serve/hub-app/identities-view.tsx +4 -3
- package/src/serve/hub-app/inbox-st.ts +203 -42
- package/src/serve/hub-app/inbox-view.tsx +189 -101
- package/src/serve/hub-app/inbox.css +47 -44
- package/src/serve/hub-app/index.html +3 -0
- package/src/serve/hub-app/instructions.css +30 -0
- package/src/serve/hub-app/keys.ts +5 -3
- package/src/serve/hub-app/machine-st.ts +2 -2
- package/src/serve/hub-app/machines-view.tsx +4 -11
- package/src/serve/hub-app/machines.css +0 -9
- package/src/serve/hub-app/markdown.css +51 -0
- package/src/serve/hub-app/md-copy.tsx +18 -40
- package/src/serve/hub-app/md.ts +25 -9
- package/src/serve/hub-app/media-view.tsx +2 -2
- package/src/serve/hub-app/messages/messages-page.tsx +2 -1
- package/src/serve/hub-app/messages/messages-st.ts +1 -1
- package/src/serve/hub-app/messages.css +0 -1
- package/src/serve/hub-app/objects.css +51 -0
- package/src/serve/hub-app/page-keys.ts +1 -1
- package/src/serve/hub-app/pages-frames.tsx +11 -1
- package/src/serve/hub-app/palette-st.ts +4 -4
- package/src/serve/hub-app/pane-boundary.tsx +72 -0
- package/src/serve/hub-app/pane-errors.ts +54 -0
- package/src/serve/hub-app/plan-view.tsx +3 -2
- package/src/serve/hub-app/planned-view.tsx +3 -3
- package/src/serve/hub-app/planned.css +0 -4
- package/src/serve/hub-app/processes-view.tsx +3 -2
- package/src/serve/hub-app/project-list.css +5 -13
- package/src/serve/hub-app/project-list.tsx +3 -6
- package/src/serve/hub-app/projects-svc.ts +6 -2
- package/src/serve/hub-app/readme.css +9 -15
- package/src/serve/hub-app/reflections-page.tsx +54 -1
- package/src/serve/hub-app/releases/releases-page.tsx +3 -2
- package/src/serve/hub-app/releases.css +0 -1
- package/src/serve/hub-app/review/code-colors.ts +30 -0
- package/src/serve/hub-app/review/diff-view.tsx +75 -0
- package/src/serve/hub-app/review/dock.tsx +104 -0
- package/src/serve/hub-app/review/draft-card.tsx +2 -2
- package/src/serve/hub-app/review/group-block.tsx +209 -0
- package/src/serve/hub-app/review/instructions-view.tsx +116 -0
- package/src/serve/hub-app/review/item-verdict.tsx +38 -0
- package/src/serve/hub-app/review/kind-states.tsx +193 -0
- package/src/serve/hub-app/review/kind-view.tsx +1 -37
- package/src/serve/hub-app/review/kit.tsx +57 -54
- package/src/serve/hub-app/review/lane-bar.tsx +64 -0
- package/src/serve/hub-app/review/object-card.tsx +62 -0
- package/src/serve/hub-app/review/object-panel.tsx +179 -0
- package/src/serve/hub-app/review/question-views.tsx +385 -0
- package/src/serve/hub-app/review/review-cells.tsx +86 -105
- package/src/serve/hub-app/review/review-list.tsx +104 -47
- package/src/serve/hub-app/review/review-page.tsx +5 -4
- package/src/serve/hub-app/review/review-st.ts +68 -28
- package/src/serve/hub-app/review/review-thread.tsx +171 -40
- package/src/serve/hub-app/review/review-views.tsx +35 -31
- package/src/serve/hub-app/review/thread-close.tsx +124 -0
- package/src/serve/hub-app/review/thread-control.tsx +4 -4
- package/src/serve/hub-app/review/thread-st.ts +222 -22
- package/src/serve/hub-app/review/trailer-card.tsx +1 -1
- package/src/serve/hub-app/review/trailer-timeline.tsx +2 -2
- package/src/serve/hub-app/review.css +216 -57
- package/src/serve/hub-app/section-head.tsx +51 -0
- package/src/serve/hub-app/social/calendar.tsx +5 -11
- package/src/serve/hub-app/social/comms-page.tsx +23 -10
- package/src/serve/hub-app/social/kit.tsx +8 -15
- package/src/serve/hub-app/social/next-release.tsx +3 -5
- package/src/serve/hub-app/social/post-card.tsx +3 -0
- package/src/serve/hub-app/social/post-page.tsx +80 -0
- package/src/serve/hub-app/social/problems.tsx +5 -9
- package/src/serve/hub-app/social/social-model.ts +13 -5
- package/src/serve/hub-app/social/social-page.tsx +1 -1
- package/src/serve/hub-app/social/social-st.ts +42 -5
- package/src/serve/hub-app/social.css +7 -17
- package/src/serve/hub-app/space.css +1 -1
- package/src/serve/hub-app/stores/stores-page.tsx +6 -2
- package/src/serve/hub-app/thread-row.tsx +101 -0
- 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 +2 -5
- package/src/serve/hub-app/tree-row.tsx +1 -9
- package/src/serve/hub-app/vault-view.tsx +4 -4
- package/src/serve/hub-app/veille/veille-page.tsx +2 -11
- package/src/serve/hub-app/veille.css +0 -1
- package/src/serve/hub-app/waiting-svc.ts +4 -4
- package/src/serve/hub-app/when-view.tsx +6 -3
- package/src/serve/hub-app/wiki-st.ts +30 -4
- package/src/serve/hub-app/wikis-view.tsx +4 -3
- package/src/serve/hub-runtime.ts +20 -6
- package/src/serve/project-gutter-route.ts +16 -6
- package/src/serve/project-gutter.ts +6 -53
- package/src/serve/same-origin.ts +3 -0
- package/src/serve/secret-gate.ts +21 -0
- package/src/serve/serve-hub.ts +29 -20
- package/src/serve/tailnet-caller.ts +117 -0
- package/src/shipkit.ts +2 -2
- package/src/site/desk.ts +2 -2
- package/src/smoke/run-smoke.ts +3 -4
- package/src/social/brands.ts +4 -0
- package/src/social/card-drafts.ts +11 -19
- package/src/social/desk-index.ts +34 -13
- package/src/social/drafts.ts +4 -4
- package/src/social/import-drafts.ts +244 -0
- package/src/social/kind-pages.ts +3 -3
- package/src/social/kinds.ts +1 -1
- package/src/social/load.ts +89 -64
- package/src/social/media-kind.ts +68 -161
- package/src/social/media-of.ts +5 -4
- package/src/social/open.ts +3 -2
- package/src/social/post-object.ts +120 -0
- package/src/social/post-sources.ts +136 -0
- package/src/social/post-text.ts +103 -0
- package/src/social/posts.ts +378 -0
- package/src/social/presence.ts +7 -5
- package/src/social/publish/index.ts +17 -5
- package/src/social/publish/secret.ts +2 -2
- package/src/social/release-stage.ts +58 -57
- package/src/social/routes.ts +64 -24
- package/src/social/stage.ts +42 -57
- package/src/social/text.ts +4 -3
- package/src/social/thumbnail.ts +135 -43
- package/src/social/tracker.ts +1 -1
- package/src/social/writes.ts +12 -29
- package/src/stores/desk.ts +16 -11
- package/src/stores/unit.ts +2 -2
- package/src/trailer/sound/eleven.ts +33 -3
- package/src/urls/rows.ts +1 -1
- package/src/vault/vault-http.ts +11 -3
- package/src/vault/vault-import.ts +6 -1
- package/src/veille/identity.ts +2 -2
- package/src/wiki/graph-pages.ts +13 -1
- package/src/wiki/scan-md.ts +1 -1
- package/src/asks/asks-queue.ts +0 -424
- package/src/messages/suggest.ts +0 -96
- package/src/social/migrate.ts +0 -123
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// the owner closes a thread from the hub, or opens it again (wiki tools/shipkit/threads-page.md, Close and reopen): the
|
|
2
|
+
// verbs the CLI has on the thread's head. An item he, a player or a rule raised takes `fixed`, `wontfix` and `reopen`;
|
|
3
|
+
// an agent's version that waits on the owner's verdict closes by the verdict (done is OK, not doing it is archive) and opens
|
|
4
|
+
// again by taking the verdict back; one that owes work after a « fix » or « no » takes `done` or `wontfix`. An ask's
|
|
5
|
+
// thread closes its ask too (done, or declined with the owner's reason) through the ask store, never by a message written here.
|
|
6
|
+
// Every one is a message of the thread, so the holder's watch hears it
|
|
7
|
+
import { declineAsk, doneAsk, findAsk, isClosed, reopenAsk } from '../asks/ask-store.ts'
|
|
8
|
+
import { LAYOUT } from '../core/layout.ts'
|
|
9
|
+
import { heldOpen } from './holds.ts'
|
|
10
|
+
import { isAskItem, stateOf, type ReviewItem } from './model.ts'
|
|
11
|
+
import { ownerVerdict, releaseFollows, statusNow } from './owner-verdict.ts'
|
|
12
|
+
import { act, appendMessage, readAll, readItem, reopen } from './store.ts'
|
|
13
|
+
import { isFollowed, membersOf, threadOfItem, threadsOf } from './threads.ts'
|
|
14
|
+
import type { ReviewUnit } from './unit.ts'
|
|
15
|
+
|
|
16
|
+
export type CloseHow = 'done' | 'wontfix' | 'reopen'
|
|
17
|
+
export const CLOSE_HOWS: readonly CloseHow[] = ['done', 'wontfix', 'reopen']
|
|
18
|
+
|
|
19
|
+
/** the repo a store folder belongs to */
|
|
20
|
+
export function rootOfStore(dir: string): string {
|
|
21
|
+
const tail = `/${LAYOUT.review}`
|
|
22
|
+
if (!dir.endsWith(tail)) throw new Error(`${dir}: not a repo's review store`)
|
|
23
|
+
return dir.slice(0, -tail.length)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** the ask of an ask's thread moved the way `how` says, its words in the ask's words: false when it already stood so.
|
|
27
|
+
* The hub's close and the cli's `wontfix` on an ask's thread both go through it, never through the item's own state */
|
|
28
|
+
export function moveAsk(dir: string, on: string, how: CloseHow, words: string): boolean {
|
|
29
|
+
const root = rootOfStore(dir)
|
|
30
|
+
const a = findAsk(root, on)
|
|
31
|
+
if (how === 'reopen') {
|
|
32
|
+
if (!isClosed(a.status)) return false
|
|
33
|
+
reopenAsk(root, a.id, { who: 'owner' })
|
|
34
|
+
return true
|
|
35
|
+
}
|
|
36
|
+
if (isClosed(a.status)) return false
|
|
37
|
+
if (how === 'done') doneAsk(root, a.id, { who: 'owner', ...(words ? { why: words } : {}) })
|
|
38
|
+
else declineAsk(root, a.id, words || 'not doing it')
|
|
39
|
+
return true
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** what the close did, in the words of the verb it took; his close wins over the objects that hold the thread open: it
|
|
43
|
+
* releases them and names them (wiki tools/shipkit/threads-how-it-fits.md, The model). A verdict it writes is followed
|
|
44
|
+
* as the verdict buttons' is (owner-verdict.ts), so `unit` is the repo's, for its kinds' apply */
|
|
45
|
+
export async function closeThread(dir: string, id: string, how: CloseHow, note: string | undefined, unit: Pick<ReviewUnit, 'kinds'> | null): Promise<{ did: string }> {
|
|
46
|
+
const x = readItem(dir, id)
|
|
47
|
+
if (!x) throw new Error(`no item ${id}`)
|
|
48
|
+
const items = readAll(dir).items
|
|
49
|
+
const s = stateOf(x, isFollowed(id, items))
|
|
50
|
+
const t = how === 'reopen' ? null : threadOfItem(id, threadsOf(items))
|
|
51
|
+
const holds = t === null ? [] : heldOpen(membersOf(t)).map((h) => h.address)
|
|
52
|
+
const released = holds.length === 0 ? '' : `released ${holds.join(', ')}`
|
|
53
|
+
if (holds.length > 0) appendMessage(dir, id, { who: 'owner', unhold: holds, note: `you closed it while ${holds.join(', ')} held it open` })
|
|
54
|
+
if (s.state === 'closed' && holds.length > 0) return { did: `closed: ${released}` }
|
|
55
|
+
const was = statusNow(dir, id)
|
|
56
|
+
const did = await closeAct(dir, id, x, s, how, note, unit)
|
|
57
|
+
if (!did.followed) void releaseFollows(dir, id, was)
|
|
58
|
+
return { did: released === '' ? did.did : `${did.did}, ${released}` }
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
type Did = { did: string; followed?: true }
|
|
62
|
+
|
|
63
|
+
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> {
|
|
64
|
+
const words = note?.trim() ?? ''
|
|
65
|
+
const agent = x.item.origin.by === 'agent'
|
|
66
|
+
const asked = isAskItem(x.item) && moveAsk(dir, x.item.on!, how, words)
|
|
67
|
+
if (how === 'reopen') {
|
|
68
|
+
if (s.state !== 'closed') {
|
|
69
|
+
if (asked) return { did: 'reopened: the ask' }
|
|
70
|
+
throw new Error(`${id} is not closed, it is ${s.state}`)
|
|
71
|
+
}
|
|
72
|
+
if (agent && (s.why === 'approved' || s.why === 'archived')) {
|
|
73
|
+
if (!reopen(dir, id, { who: 'owner' })) throw new Error(`${id}: no verdict to take back`)
|
|
74
|
+
return { did: 'reopened: the verdict taken back' }
|
|
75
|
+
}
|
|
76
|
+
act(dir, id, 'reopen', 'owner', { holds: true })
|
|
77
|
+
return { did: 'reopened' }
|
|
78
|
+
}
|
|
79
|
+
if (s.state === 'closed') {
|
|
80
|
+
if (asked) return { did: how === 'done' ? 'closed: the ask done' : 'closed: the ask declined' }
|
|
81
|
+
throw new Error(`${id} is closed already (${s.why ?? 'closed'})`)
|
|
82
|
+
}
|
|
83
|
+
if (agent && (s.state === 'asks' || s.state === 'draft')) {
|
|
84
|
+
const r = await ownerVerdict(dir, unit, id, { status: how === 'done' ? 'approved' : 'archived', ...(words ? { text: words } : {}) })
|
|
85
|
+
if (!r.ok) throw new Error(r.errors.join('; '))
|
|
86
|
+
return { did: how === 'done' ? 'closed: OK' : 'closed: not doing it', followed: true }
|
|
87
|
+
}
|
|
88
|
+
const op = how === 'done' ? (agent && s.state === 'claimed' ? 'done' : 'fixed') : 'wontfix'
|
|
89
|
+
// wontfix says why: the owner's word, else the plain reason the button gives
|
|
90
|
+
act(dir, id, op, 'owner', { ...(words ? { note: words } : op === 'wontfix' ? { note: 'not doing it' } : {}), holds: true })
|
|
91
|
+
return { did: `closed: ${op}` }
|
|
92
|
+
}
|
package/src/review/draft-card.ts
CHANGED
|
@@ -1,33 +1,25 @@
|
|
|
1
1
|
// a draft card as `sk thread add --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
|
-
import {
|
|
5
|
-
import { accountOf, draftsDir, findDraft, type Desk, type Draft } from '../social/load.ts'
|
|
4
|
+
import { accountOf, findDraft, type Desk, type Draft } from '../social/load.ts'
|
|
6
5
|
import { pinOf } from './draft-model.ts'
|
|
7
6
|
import type { DraftCard } from './model.ts'
|
|
8
7
|
|
|
9
|
-
/** the loader's lines on one
|
|
10
|
-
const linesOn = (desk: Desk,
|
|
8
|
+
/** the loader's lines on one group: each starts with its address */
|
|
9
|
+
const linesOn = (desk: Desk, address: string): string[] => desk.errors.filter((e) => e.startsWith(`${address}:`) || e.startsWith(`${address} `))
|
|
11
10
|
|
|
12
|
-
/** the draft `ref` names (its
|
|
13
|
-
*
|
|
11
|
+
/** the draft `ref` names (its slug or its topic) as a card pins it; throws on a draft the loader reports an error on,
|
|
12
|
+
* and one with no post to judge */
|
|
14
13
|
export function draftCardOf(desk: Desk, ref: string, cwd: string): { card: DraftCard; draft: Draft } {
|
|
15
|
-
const where = relative(desk.root, draftsDir(desk.root))
|
|
16
14
|
let draft: Draft
|
|
17
15
|
try {
|
|
18
16
|
draft = findDraft(desk, ref, cwd)
|
|
19
17
|
} catch (e) {
|
|
20
|
-
|
|
21
|
-
const name = ref.replace(/\/(draft\.md)?$/, '').split('/').pop() ?? ref
|
|
22
|
-
const said = desk.errors.filter((l) => {
|
|
23
|
-
const folder = l.startsWith(`${where}/`) ? (l.slice(where.length + 1).split(/[/:]/)[0] ?? '') : null
|
|
24
|
-
return folder !== null && (folder === name || folder.replace(/^\d{8}-\d{6}-/, '') === name)
|
|
25
|
-
})
|
|
26
|
-
throw new Error(said.length > 0 ? refusal(ref, said) : `--draft ${ref}: ${(e as Error).message}`)
|
|
18
|
+
throw new Error(`--draft ${ref}: ${(e as Error).message}`)
|
|
27
19
|
}
|
|
28
|
-
const said = linesOn(desk,
|
|
20
|
+
const said = linesOn(desk, draft.file)
|
|
29
21
|
if (said.length > 0) throw new Error(refusal(ref, said))
|
|
30
|
-
if (draft.posts.length === 0) throw new Error(`--draft ${ref}: ${draft.
|
|
22
|
+
if (draft.posts.length === 0) throw new Error(`--draft ${ref}: ${draft.slug} holds no post, so nothing he could judge: sk social draft save ${draft.slug} with a \`## <account>\` heading makes one`)
|
|
31
23
|
const card = pinOf(draft, (p) => {
|
|
32
24
|
try {
|
|
33
25
|
return accountOf(desk, p.identity, p.platform)
|
|
@@ -73,6 +73,6 @@ export const postChange = (c: DraftChange | null, key: string): 'changed' | 'new
|
|
|
73
73
|
export function changeLine(c: DraftChange): string {
|
|
74
74
|
const names = [...c.changed.map((p) => p.name), ...c.added.map((p) => `${p.name}, new`), ...c.gone.map((p) => `${p.name}, gone`)]
|
|
75
75
|
const n = names.length
|
|
76
|
-
if (n === 0) return 'the draft changed since this
|
|
77
|
-
return `the draft changed since this
|
|
76
|
+
if (n === 0) return 'the draft changed since this version: its head or its angle, no place'
|
|
77
|
+
return `the draft changed since this version: ${n} place${n > 1 ? 's' : ''} (${names.join(' · ')})${c.head ? ', and its head or its angle' : ''}`
|
|
78
78
|
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
// the thread's events (wiki tools/shipkit/threads-events.md): one append only table in the daemon's database (whatever
|
|
2
|
+
// the switch cards-in-db says), Matrix's shape, the truth of every object a thread holds; the kinds' tables are
|
|
3
|
+
// projections written in the same transaction (projections.ts). The one constraint a reader breaks first: no verb updates
|
|
4
|
+
// or deletes a row; an edit, a new state or a reaction is a new event that relates to the old one
|
|
5
|
+
import type { Database } from 'bun:sqlite'
|
|
6
|
+
import { cardsDb, nextSeq, repoIdOf } from './card-db.ts'
|
|
7
|
+
import { projectEvent } from './projections.ts'
|
|
8
|
+
|
|
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
|
+
export const EVENT_TYPES = ['post-group', 'post', 'link', 'reaction', 'draft'] as const
|
|
12
|
+
export type EventType = (typeof EVENT_TYPES)[number]
|
|
13
|
+
export const RELS = ['replace', 'reply', 'annotation'] as const
|
|
14
|
+
export type Rel = (typeof RELS)[number]
|
|
15
|
+
|
|
16
|
+
/** a file an event names, by its facts: its bytes are in the Space under `key` */
|
|
17
|
+
export interface Attachment {
|
|
18
|
+
/** as the object names it: `media/clip-vertical.mp4` */
|
|
19
|
+
name: string
|
|
20
|
+
size: number
|
|
21
|
+
sha?: string
|
|
22
|
+
/** its key in the owner's Space; none, no file holds it yet */
|
|
23
|
+
key?: string
|
|
24
|
+
type?: string
|
|
25
|
+
/** a `draft` event's: from the repo's root, or absolute */
|
|
26
|
+
path?: string
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** the shape of an event's content: a reader of an older shape reads it by this number. 2: an attachment names its Space
|
|
30
|
+
* `key` and its `type`, its `path` only on a `draft` event (1, the first import, kept as history) */
|
|
31
|
+
export const CONTENT_V = 2
|
|
32
|
+
|
|
33
|
+
/** what every event carries, whatever its type: the hub draws it one way */
|
|
34
|
+
export interface Standard {
|
|
35
|
+
v?: number
|
|
36
|
+
title?: string
|
|
37
|
+
/** markdown */
|
|
38
|
+
body?: string
|
|
39
|
+
attachments?: Attachment[]
|
|
40
|
+
/** a lane, a session, `owner` */
|
|
41
|
+
mentions?: string[]
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type Content = Standard & { [type: string]: unknown }
|
|
45
|
+
|
|
46
|
+
export interface ThreadEvent {
|
|
47
|
+
repo: string
|
|
48
|
+
/** `e<seq>-<8 hex>`: unique across machines, its number the order on this one */
|
|
49
|
+
id: string
|
|
50
|
+
/** the thread's key, resolved at read as a note's address is: its own address, else an item id of it; empty for an
|
|
51
|
+
* object's own state (a post, a group), which threads refer to by a link */
|
|
52
|
+
thread: string
|
|
53
|
+
seq: number
|
|
54
|
+
type: EventType
|
|
55
|
+
sender: string
|
|
56
|
+
at: number
|
|
57
|
+
relates: string | null
|
|
58
|
+
rel: Rel | null
|
|
59
|
+
stateKey: string | null
|
|
60
|
+
content: Content
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const MAX_CONTENT = 256 * 1024
|
|
64
|
+
|
|
65
|
+
// thread_events every event, never rewritten
|
|
66
|
+
// thread_post_groups, thread_posts the posts' projections: one row a group, one a post, for Communications
|
|
67
|
+
export const EVENTS_SCHEMA = `
|
|
68
|
+
create table if not exists thread_events (repo text not null, id text not null, thread text not null, seq integer not null, type text not null, sender text not null, at integer not null, relates text, rel text, state_key text, content text not null, primary key (repo, id)) without rowid;
|
|
69
|
+
create index if not exists thread_events_line on thread_events (repo, thread, seq);
|
|
70
|
+
create index if not exists thread_events_state on thread_events (repo, type, state_key, seq);
|
|
71
|
+
create index if not exists thread_events_seq on thread_events (seq);
|
|
72
|
+
create table if not exists thread_post_groups (repo text not null, slug text not null, title text not null, kind text not null, identity text not null, rating text not null, release text not null, drafts integer not null, posted integer not null, dropped integer not null, version integer not null, first_seq integer not null, last_seq integer not null, first_at integer not null, last_at integer not null, event text not null, primary key (repo, slug)) without rowid;
|
|
73
|
+
create table if not exists thread_posts (repo text not null, slug text not null, key text not null, platform text not null, place text not null, state text not null, url text not null, posted_at integer, title text not null, version integer not null, first_seq integer not null, last_seq integer not null, first_at integer not null, last_at integer not null, event text not null, primary key (repo, slug, key)) without rowid;
|
|
74
|
+
create index if not exists thread_posts_state on thread_posts (repo, state, last_seq);
|
|
75
|
+
`
|
|
76
|
+
|
|
77
|
+
/** the tables of the events, for the backups' cut and the fold */
|
|
78
|
+
export const EVENT_TABLES = ['thread_events', 'thread_post_groups', 'thread_posts'] as const
|
|
79
|
+
|
|
80
|
+
type Row = { repo: string; id: string; thread: string; seq: number; type: string; sender: string; at: number; relates: string | null; rel: string | null; state_key: string | null; content: string }
|
|
81
|
+
|
|
82
|
+
export const eventOfRow = (r: Row): ThreadEvent => ({
|
|
83
|
+
repo: r.repo,
|
|
84
|
+
id: r.id,
|
|
85
|
+
thread: r.thread,
|
|
86
|
+
seq: r.seq,
|
|
87
|
+
type: r.type as EventType,
|
|
88
|
+
sender: r.sender,
|
|
89
|
+
at: r.at,
|
|
90
|
+
relates: r.relates,
|
|
91
|
+
rel: r.rel as Rel | null,
|
|
92
|
+
stateKey: r.state_key,
|
|
93
|
+
content: JSON.parse(r.content) as Content,
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
export type NewEvent = Omit<ThreadEvent, 'repo' | 'id' | 'seq' | 'at' | 'relates' | 'rel' | 'stateKey' | 'thread'> & {
|
|
97
|
+
thread?: string
|
|
98
|
+
relates?: string | null
|
|
99
|
+
rel?: Rel | null
|
|
100
|
+
stateKey?: string | null
|
|
101
|
+
at?: number
|
|
102
|
+
/** an object's state event: the threads that refer to it from this call on, a link into each written in the same
|
|
103
|
+
* transaction (rule 5: an agent's new object names one at least) */
|
|
104
|
+
attach?: readonly string[]
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** the object types and the address a thread refers to each by */
|
|
108
|
+
const OBJECT_ADDRESS: Partial<Record<EventType, (stateKey: string) => string>> = { 'post-group': (k) => `draft:${k}` }
|
|
109
|
+
|
|
110
|
+
/** the owner and the machine's own syncs; any other sender is an agent (its lane or session) */
|
|
111
|
+
export const isAgentSender = (sender: string): boolean => sender !== 'owner' && sender !== 'machine'
|
|
112
|
+
|
|
113
|
+
/** the repo id a repo's events are filed under: the thread store's own (one repo, one id, worktrees included) */
|
|
114
|
+
export const eventsRepo = (storeDir: string): string => repoIdOf(storeDir)
|
|
115
|
+
|
|
116
|
+
/** the newest state event of one object, null when it has none */
|
|
117
|
+
export function stateOf(repo: string, type: EventType, stateKey: string, db: Database = cardsDb()): ThreadEvent | null {
|
|
118
|
+
const r = db.query('select * from thread_events where repo = ? and type = ? and state_key = ? order by seq desc limit 1').get(repo, type, stateKey) as Row | null
|
|
119
|
+
return r == null ? null : eventOfRow(r)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** appends one event and moves its kind's projection in the same transaction. Refuses a type off the list, a content
|
|
123
|
+
* past 256 KB, a relation to no event of the repo, a post of no group, and an agent's new object no thread refers to.
|
|
124
|
+
* An object has no home thread: `attach` links it into each thread that refers to it, in the same transaction */
|
|
125
|
+
export function appendEvent(repo: string, e: NewEvent, db: Database = cardsDb()): ThreadEvent {
|
|
126
|
+
if (!(EVENT_TYPES as readonly string[]).includes(e.type)) throw new Error(`${e.type}: no event type of ${EVENT_TYPES.join(', ')}`)
|
|
127
|
+
if (e.rel != null && !(RELS as readonly string[]).includes(e.rel)) throw new Error(`${e.rel}: no relation of ${RELS.join(', ')}`)
|
|
128
|
+
if ((e.rel == null) !== (e.relates == null)) throw new Error('an event that relates names both the event and how (relates, rel)')
|
|
129
|
+
const content = JSON.stringify({ v: CONTENT_V, ...e.content })
|
|
130
|
+
if (content.length > MAX_CONTENT) throw new Error(`${e.type} event of ${content.length} bytes: ${MAX_CONTENT} at most`)
|
|
131
|
+
return db
|
|
132
|
+
.transaction((): ThreadEvent => {
|
|
133
|
+
const thread = e.thread ?? ''
|
|
134
|
+
if (e.relates != null && db.query('select 1 from thread_events where repo = ? and id = ?').get(repo, e.relates) == null) throw new Error(`${e.relates}: no event of this repo to relate to`)
|
|
135
|
+
const attach = [...new Set(e.attach ?? [])]
|
|
136
|
+
const address = OBJECT_ADDRESS[e.type]
|
|
137
|
+
if (attach.length > 0 && (address == null || e.stateKey == null)) throw new Error(`${e.type}: only an object's state event attaches to a thread`)
|
|
138
|
+
if (e.type === 'post' && e.stateKey != null) {
|
|
139
|
+
const group = e.stateKey.slice(0, e.stateKey.indexOf('/'))
|
|
140
|
+
if (stateOf(repo, 'post-group', group, db) == null) throw new Error(`post ${e.stateKey}: its group ${group} has no event, so the post would stand in no group`)
|
|
141
|
+
}
|
|
142
|
+
if (address != null && e.stateKey != null && attach.length === 0 && isAgentSender(e.sender) && stateOf(repo, e.type, e.stateKey, db) == null)
|
|
143
|
+
throw new Error(`${e.sender} creates ${address(e.stateKey)} with no thread referring to it: an agent's new object is attached in the same call to the thread it works in (attach)`)
|
|
144
|
+
const seq = nextSeq(db)
|
|
145
|
+
const ev: ThreadEvent = { repo, id: `e${seq}-${crypto.randomUUID().slice(0, 8)}`, thread, seq, type: e.type, sender: e.sender, at: e.at ?? Date.now(), relates: e.relates ?? null, rel: e.rel ?? null, stateKey: e.stateKey ?? null, content: { v: CONTENT_V, ...e.content } }
|
|
146
|
+
db.query('insert into thread_events (repo, id, thread, seq, type, sender, at, relates, rel, state_key, content) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)').run(repo, ev.id, ev.thread, seq, ev.type, ev.sender, ev.at, ev.relates, ev.rel, ev.stateKey, content)
|
|
147
|
+
projectEvent(db, ev)
|
|
148
|
+
for (const thread of attach) {
|
|
149
|
+
const a = address!(e.stateKey!)
|
|
150
|
+
if (db.query("select 1 from thread_events where repo = ? and type = 'link' and thread = ? and json_extract(content, '$.link.address') = ?").get(repo, thread, a) != null) continue
|
|
151
|
+
appendEvent(repo, { type: 'link', sender: e.sender, thread, at: ev.at, content: { title: e.content.title ?? '', link: { address: a, type: e.type, key: e.stateKey! } } }, db)
|
|
152
|
+
}
|
|
153
|
+
return ev
|
|
154
|
+
})
|
|
155
|
+
.immediate()
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** every event of a thread, in its line's order */
|
|
159
|
+
export function eventsOfThread(repo: string, thread: string, db: Database = cardsDb()): ThreadEvent[] {
|
|
160
|
+
return (db.query('select * from thread_events where repo = ? and thread = ? order by seq').all(repo, thread) as Row[]).map(eventOfRow)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** every state event of one object, oldest first: its history */
|
|
164
|
+
export function historyOf(repo: string, type: EventType, stateKey: string, db: Database = cardsDb()): ThreadEvent[] {
|
|
165
|
+
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)
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/** the events that relate to one, oldest first: its edits, replies, reactions */
|
|
169
|
+
export function relatedTo(repo: string, id: string, db: Database = cardsDb()): ThreadEvent[] {
|
|
170
|
+
return (db.query('select * from thread_events where repo = ? and relates = ? order by seq').all(repo, id) as Row[]).map(eventOfRow)
|
|
171
|
+
}
|
package/src/review/format.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
// what `sk thread inbox`, `show`, `watch`, `next` and `board` print of an item and its answer (wiki tools/shipkit/threads.md):
|
|
2
2
|
// one record per thread, rectangles normalized and in pixels, a frame note's cut, shot and time into it, and the lines the
|
|
3
3
|
// repo's unit adds (a kind's facts, a source's), handed in as `more` so this module stays pure
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { kindOfValue } from './kinds.ts'
|
|
5
|
+
import { askOpen, askStateText, kindAnswerLine, kindOfAsk, questionWords } from './answer-kinds.ts'
|
|
6
|
+
import { toAcknowledge, aboutText, appliedFields, ownAddressOf, partyOf, proposeFields, proposeOpen, isFrame, isOpening, isGallery, isPair, NO_SPEC, placeText, stateOf, takenBackOf, unreadBy, updateTag, verdictOf, type DraftCard, type Message, type Rect, type ReviewItem, type ReviewStatus, type Spec, type Subject } from './model.ts'
|
|
7
|
+
import { answererOf, conversationOf, membersOf, openingOf, ownAddressesOf, waits, type Thread } from './threads.ts'
|
|
8
|
+
import { itemTitle, replacersOf, titleOf } from './supersede.ts'
|
|
9
|
+
import { itemVerdictLine } from './verdict-items.ts'
|
|
7
10
|
|
|
8
11
|
/** what a message is in a thread beyond its words: ` [update 2 (still broken)]` on an agent's update, ` (on update 2
|
|
9
12
|
* (still broken))` on his hint about one */
|
|
@@ -59,18 +62,80 @@ export const refOf = (x: ReviewItem): string => (x.item.origin.by === 'player' ?
|
|
|
59
62
|
function answerLine(x: ReviewItem, m: Message): string | null {
|
|
60
63
|
const asked = m.answer && m.re ? x.thread.find((y) => y.id === m.re) : undefined
|
|
61
64
|
if (!asked || !m.answer) return null
|
|
65
|
+
const kinded = asked.ask ? kindAnswerLine(x.item.id, x.thread, asked, m, flat) : null
|
|
66
|
+
if (kinded !== null) return kinded
|
|
62
67
|
if (asked.ask && m.answer.option !== undefined) {
|
|
63
68
|
const label = asked.ask.options[m.answer.option] ?? `option ${m.answer.option + 1}`
|
|
64
69
|
const words = (m.text ?? '').startsWith(label) ? (m.text ?? '').slice(label.length).replace(/^:\s*/, '') : (m.text ?? '')
|
|
65
70
|
return `${x.item.id} answered "${flat(asked.text ?? '')}": picked ${m.answer.option + 1} « ${label} »${asked.ask.pick === m.answer.option ? ' (your pick)' : ''}${words ? `: ${flat(words)}` : ''}`
|
|
66
71
|
}
|
|
67
|
-
if (asked.propose && m.answer.apply)
|
|
72
|
+
if (asked.propose && m.answer.apply) {
|
|
73
|
+
const fields = proposeFields(asked.propose)
|
|
74
|
+
const f = fields.find((y) => y.key === (m.answer?.field ?? '')) ?? fields[0]!
|
|
75
|
+
const value = m.answer.value ?? m.text ?? f.after
|
|
76
|
+
const words = m.text !== undefined && m.text !== value ? `, the owner's words: ${flat(m.text)}` : ''
|
|
77
|
+
if (fields.length === 1) return `${x.item.id} applied your change of ${asked.propose.on}: land this ${kindOfValue(f.type).file ? 'file' : 'value'}: ${flat(value)}${words}`
|
|
78
|
+
if (m.answer.field !== undefined) return `${x.item.id} applied ${m.answer.field} of ${asked.propose.on}: land ${flat(value)}${words}`
|
|
79
|
+
return `${x.item.id} applied every field of ${asked.propose.on}: land ${fields.map((y) => `${y.key} ${flat(y.after)}`).join(' · ')}`
|
|
80
|
+
}
|
|
81
|
+
return null
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** the owner's words on a question with no option clicked: none of them, and why */
|
|
85
|
+
function noneLine(x: ReviewItem, m: Message): string | null {
|
|
86
|
+
const asked = m.answer === undefined && m.re && partyOf(m.who) === 'owner' ? x.thread.find((y) => y.id === m.re) : undefined
|
|
87
|
+
if (asked?.ask && kindOfAsk(asked) === 'checklist') return `${x.item.id} on your ${asked.instructions ? 'instructions' : 'checklist'} "${flat(questionWords(asked))}": ${flat(m.text ?? '')}`
|
|
88
|
+
if (asked?.ask) return `${x.item.id} answered "${flat(questionWords(asked))}": none: ${flat(m.text ?? '')}`
|
|
89
|
+
if (asked?.propose) return `${x.item.id} on your change of ${asked.propose.on}: ${flat(m.text ?? '')}`
|
|
68
90
|
return null
|
|
69
91
|
}
|
|
70
92
|
|
|
93
|
+
/** an ask's state as its thread says it (its newest askState), null on an item that is no ask's */
|
|
94
|
+
function askLine(x: ReviewItem): string | null {
|
|
95
|
+
if (!x.item.on?.startsWith('ask:')) return null
|
|
96
|
+
const last = x.thread.filter((m) => m.askState !== undefined).at(-1)
|
|
97
|
+
const s = last?.askState
|
|
98
|
+
return ` ask ${s?.state ?? 'open'}${s?.why ? `: ${flat(s.why)}` : ''}${last ? ` (${last.at})` : ''}`
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** each question and proposed change an agent put on the item, open or answered: its options and the agent's pick, its
|
|
102
|
+
* fields and which the owner applied; one a newer object superseded, or that its closed ask closed, says so */
|
|
103
|
+
function asksText(x: ReviewItem): string[] {
|
|
104
|
+
const out: string[] = []
|
|
105
|
+
const gone = replacersOf([x])
|
|
106
|
+
const ask = askLine(x)
|
|
107
|
+
const closed = ask !== null && !ask.startsWith(' ask open')
|
|
108
|
+
if (ask !== null) out.push(ask)
|
|
109
|
+
if (gone.has(x.item.id)) out.push(` its first instructions (« ${x.item.title} ») superseded by ${gone.get(x.item.id)!.id} « ${titleOf(gone.get(x.item.id)!)} »`)
|
|
110
|
+
const state = (m: Message, open: boolean): string => {
|
|
111
|
+
const by = gone.get(m.id)
|
|
112
|
+
return by ? (by.op === 'withdraw' ? `${titleOf(by)}, ${by.id}` : `superseded by ${by.id} « ${titleOf(by)} »`) : closed ? (open ? 'closed with the ask' : 'answered') : open ? 'open' : 'answered'
|
|
113
|
+
}
|
|
114
|
+
for (const m of x.thread) {
|
|
115
|
+
if (partyOf(m.who) !== 'agent') continue
|
|
116
|
+
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(' ')}` : ''}`)
|
|
117
|
+
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)}`)
|
|
118
|
+
else if (m.ask) {
|
|
119
|
+
const answered = x.thread.some((y) => y.re === m.id && partyOf(y.who) === 'owner')
|
|
120
|
+
out.push(` question ${m.at} (${state(m, !answered)}): "${flat(m.text ?? '')}" ${m.ask.options.map((o, i) => `${i + 1} ${o}${m.ask!.views?.[i] != null ? ' [media]' : ''}${m.ask!.pick === i ? ' (your pick)' : ''}`).join(' · ')}`)
|
|
121
|
+
}
|
|
122
|
+
if (m.propose) {
|
|
123
|
+
const applied = appliedFields(x.thread, m)
|
|
124
|
+
out.push(` proposed change ${m.at} (${state(m, proposeOpen(x.thread, m))}) of ${m.propose.on}: ${proposeFields(m.propose).map((f) => `${f.key || 'the value'} ${applied.has(f.key) ? 'applied' : 'waits'}`).join(' · ')}`)
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return out
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** the owner's click on one of the kind's actions: what the holder does next */
|
|
131
|
+
const actionLine = (x: ReviewItem, m: Message): string | null =>
|
|
132
|
+
m.action ? `${x.item.id} action ${m.action.name} "${x.item.title}"${m.text && m.text !== m.action.name ? `: ${flat(m.text)}` : ''}` : null
|
|
133
|
+
|
|
71
134
|
export const replyLine = (x: ReviewItem, m: Message, card: ReviewItem | null = null): string =>
|
|
135
|
+
actionLine(x, m) ??
|
|
72
136
|
answerLine(x, m) ??
|
|
73
|
-
|
|
137
|
+
noneLine(x, m) ??
|
|
138
|
+
`${(card ?? x).item.id} reply "${itemTitle(card ?? x)}"${card ? ` (on ${refOf(x)})` : ''}${updateText(x, m)}: ${flat(m.text ?? '')}${m.image ? ` [image thread/${m.image}]` : ''}`
|
|
74
139
|
|
|
75
140
|
const TOOK: Record<ReviewStatus, string> = { approved: 'approval', 'approved-with-fix': '« ok with a fix »', rejected: 'rejection', archived: '« archived, later »' }
|
|
76
141
|
|
|
@@ -78,19 +143,35 @@ const TOOK: Record<ReviewStatus, string> = { approved: 'approval', 'approved-wit
|
|
|
78
143
|
export const takeBackTexts = (x: ReviewItem): { m: Message; text: string }[] =>
|
|
79
144
|
takenBackOf(x).map(({ m, took, given }) => ({
|
|
80
145
|
m,
|
|
81
|
-
text: `he took his ${TOOK[took]} back (given ${given}): the
|
|
146
|
+
text: `he took his ${TOOK[took]} back (given ${given}): the version waits for the owner's answer again and that ${TOOK[took]} no longer holds; hold or undo what you did on it, then sk thread seen ${x.item.id}`,
|
|
82
147
|
}))
|
|
83
148
|
|
|
149
|
+
/** the end of a line of his new content: the agent says it read it, then what it does (wiki
|
|
150
|
+
* tools/shipkit/threads-how-it-fits.md, Read and on it) */
|
|
151
|
+
export const markIt = (ref: string, bin = 'sk'): string => ` · mark it: ${bin} thread seen ${ref}, then ${bin} thread working ${ref} "…"`
|
|
152
|
+
|
|
84
153
|
/** what watch prints of an item, each with the key it prints once under: a verdict he took back, an unseen feedback (again
|
|
85
154
|
* when sent again), each unseen reply */
|
|
86
155
|
export function watchLines(x: ReviewItem, items: readonly ReviewItem[] = []): { key: string; text: string }[] {
|
|
87
156
|
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}` }))
|
|
88
157
|
const f = verdictOf(x)
|
|
89
|
-
if (f && !f.seen) out.push({ key: `${x.item.id}@${f.at}`, text: line(x) })
|
|
158
|
+
if (f && !f.seen) out.push({ key: `${x.item.id}@${f.at}`, text: `${line(x)}${markIt(x.item.id)}` })
|
|
90
159
|
const card = x.item.origin.by === 'agent' ? null : answererOf(x.item.id, items)
|
|
91
160
|
// the words that raised an item the card answers are what the card answers
|
|
92
161
|
const opening = card ? openingOf(x) : undefined
|
|
93
|
-
|
|
162
|
+
// the owner's verdict on a message that asked it reads as that verdict; every other word as a reply
|
|
163
|
+
for (const m of unreadBy(x, 'agent')) if (m !== opening) out.push({ key: `${x.item.id}#${m.id}`, text: `${(m.verdict !== undefined ? itemVerdictLine(x, m) : null) ?? replyLine(x, m, card)}${markIt(x.item.id)}` })
|
|
164
|
+
// his « set aside » and his close of an ask: heard, owed nothing, so never an unread word that holds a stop
|
|
165
|
+
const pending = new Set(toAcknowledge(x, 'agent'))
|
|
166
|
+
for (const m of x.thread) {
|
|
167
|
+
if (!pending.has(m.id) || partyOf(m.who) !== 'owner') continue
|
|
168
|
+
if (m.snooze) out.push({ key: `${x.item.id}#${m.id}`, text: m.snooze.until === null ? `${x.item.id} back "${x.item.title}": he brought it back` : `${x.item.id} set aside "${x.item.title}" until ${m.snooze.until}` })
|
|
169
|
+
if (m.askState) out.push({ key: `${x.item.id}#${m.id}`, text: `${x.item.id} ask ${m.askState.state} "${itemTitle(x)}"${m.askState.why ? `: ${flat(m.askState.why)}` : ''}` })
|
|
170
|
+
// the owner's close of the whole thread from the hub; a reopen of an agent's verdict prints above, as a take back
|
|
171
|
+
if (m.op === 'fixed' || m.op === 'done') out.push({ key: `${x.item.id}#${m.id}`, text: `${x.item.id} closed as done by the owner "${x.item.title}"${m.note ? `: ${flat(m.note)}` : ''}` })
|
|
172
|
+
if (m.op === 'wontfix') out.push({ key: `${x.item.id}#${m.id}`, text: `${x.item.id} closed by the owner, not doing it "${x.item.title}"${m.note ? `: ${flat(m.note)}` : ''}` })
|
|
173
|
+
if (m.op === 'reopen' && x.item.origin.by !== 'agent') out.push({ key: `${x.item.id}#${m.id}`, text: `${x.item.id} reopened by the owner "${x.item.title}": it waits on its holder again` })
|
|
174
|
+
}
|
|
94
175
|
return out
|
|
95
176
|
}
|
|
96
177
|
|
|
@@ -110,7 +191,8 @@ export const untakenLine = (x: ReviewItem, why: string, lane: string | null): st
|
|
|
110
191
|
export function threadDetail(t: Thread, dir: string, full = false, say: Say = PLAIN): string {
|
|
111
192
|
if (t.answers.length === 0 && t.versions.length === 1 && !full) return detail(t.head, dir, false, false, say)
|
|
112
193
|
const out: string[] = []
|
|
113
|
-
|
|
194
|
+
// a note joined by its address alone keeps its own state: no version answered it
|
|
195
|
+
for (const r of t.answers) out.push(`${t.joined.has(r.item.id) ? 'his note' : 'answers'} ${refOf(r)}:`, detail(r, dir, false, !t.joined.has(r.item.id), say), '')
|
|
114
196
|
out.push(detail(t.head, dir, full, false, say))
|
|
115
197
|
const older = t.versions.slice(1)
|
|
116
198
|
if (older.length > 0) out.push(` versions: ${older.map((x) => x.item.id).join(' ')}`)
|
|
@@ -126,6 +208,32 @@ export function threadDetail(t: Thread, dir: string, full = false, say: Say = PL
|
|
|
126
208
|
return out.join('\n')
|
|
127
209
|
}
|
|
128
210
|
|
|
211
|
+
/** a thread as the inbox reads it out: each item of it that holds something for the agent (his answer, his note), by
|
|
212
|
+
* its own id and state, so his answer on an older version names that version; then the newest version, when it is none
|
|
213
|
+
* of them, as what it is: sent after his answer, waiting for him, never his answer */
|
|
214
|
+
export function newsDetail(t: Thread, news: readonly ReviewItem[], dir: string, say: Say = PLAIN): string {
|
|
215
|
+
const ids = new Set(news.map((x) => x.item.id))
|
|
216
|
+
const own = ownAddressesOf(t, say.spec)[0]
|
|
217
|
+
const nOf = (x: ReviewItem): string => {
|
|
218
|
+
const i = t.versions.indexOf(x)
|
|
219
|
+
return i < 0 || t.versions.length < 2 ? '' : `v${t.versions.length - i} `
|
|
220
|
+
}
|
|
221
|
+
const out: string[] = [`thread ${own ?? t.head.item.id}:`]
|
|
222
|
+
for (const x of membersOf(t).filter((y) => ids.has(y.item.id)).sort((a, b) => a.item.created.localeCompare(b.item.created))) {
|
|
223
|
+
const raised = x.item.origin.by !== 'agent'
|
|
224
|
+
if (raised) out.push(`${t.joined.has(x.item.id) ? 'his note' : 'answers'} ${refOf(x)}:`)
|
|
225
|
+
else if (nOf(x) !== '') out.push(`his answer on ${nOf(x)}of ${t.versions.length}:`)
|
|
226
|
+
out.push(detail(x, dir, false, raised && !t.joined.has(x.item.id), say))
|
|
227
|
+
}
|
|
228
|
+
if (!ids.has(t.head.item.id) && t.head.item.origin.by === 'agent') {
|
|
229
|
+
const h = t.head
|
|
230
|
+
const v = verdictOf(h)
|
|
231
|
+
const where = waits(h) ? 'sent after his answer, waits for a verdict: nothing to act on' : v ? `verdict ${v.status}${v.seen ? ', seen' : ''}` : stateOf(h, false).state
|
|
232
|
+
out.push(` newest: ${nOf(h)}${h.item.id} "${itemTitle(h)}", ${where}`)
|
|
233
|
+
}
|
|
234
|
+
return out.join('\n')
|
|
235
|
+
}
|
|
236
|
+
|
|
129
237
|
/** `m:ss.cc` */
|
|
130
238
|
const clock = (t: number): string => `${Math.floor(t / 60)}:${(t % 60).toFixed(2).padStart(5, '0')}`
|
|
131
239
|
|
|
@@ -136,7 +244,7 @@ function subjectText(s: Subject): string | null {
|
|
|
136
244
|
}
|
|
137
245
|
|
|
138
246
|
/** a draft card's draft: its file, and each message the card pinned by name, the names his answers come back under */
|
|
139
|
-
const draftText = (d: DraftCard): string => `
|
|
247
|
+
const draftText = (d: DraftCard): string => ` posts: draft:${d.slug}, ${d.posts.length} place${d.posts.length > 1 ? 's' : ''}: ${d.posts.map((p) => p.name).join(', ')}`
|
|
140
248
|
|
|
141
249
|
const boxText = (b: { x0: number; y0: number; x1: number; y1: number }): string => `${b.x0},${b.y0}..${b.x1},${b.y1}`
|
|
142
250
|
|
|
@@ -158,10 +266,15 @@ const raisedBy = (o: ReviewItem['item']['origin']): string =>
|
|
|
158
266
|
export function detail(x: ReviewItem, dir: string, full = false, followed = false, say: Say = PLAIN): string {
|
|
159
267
|
const f = verdictOf(x)
|
|
160
268
|
const r = x.item
|
|
161
|
-
const
|
|
269
|
+
const own = ownAddressOf(r, say.spec)
|
|
270
|
+
const head = ` "${itemTitle(x)}" (${aboutText(r, say.spec)})${own !== null ? `\n address: ${own}` : ''}`
|
|
162
271
|
const frame = subjectText(r.subject)
|
|
163
272
|
const sub = [...(frame ? [frame] : []), ...(r.draft ? [draftText(r.draft)] : []), ...say.more(x)]
|
|
164
|
-
const replies = unreadBy(x, 'agent').map((m) =>
|
|
273
|
+
const replies = unreadBy(x, 'agent').map((m) => {
|
|
274
|
+
const answer = answerLine(x, m) ?? noneLine(x, m)
|
|
275
|
+
return answer ? ` ${answer.slice(r.id.length + 1)} (${m.at})` : ` reply ${m.at}${updateText(x, m)}: ${m.text}${m.image ? ` [image ${dir}/${r.id}/thread/${m.image}]` : ''}`
|
|
276
|
+
})
|
|
277
|
+
const asked = asksText(x)
|
|
165
278
|
if (r.origin.by !== 'agent') {
|
|
166
279
|
const st = stateOf(x, followed)
|
|
167
280
|
const said = x.thread.filter((m) => m.who === 'owner' || m.who === 'player')
|
|
@@ -173,6 +286,7 @@ export function detail(x: ReviewItem, dir: string, full = false, followed = fals
|
|
|
173
286
|
`${r.id} ${st.state.toUpperCase()}${st.why ? ` (${st.why})` : ''} raised by ${raisedBy(r.origin)} ${r.created}${r.commit ? ` at ${r.commit}` : ''}`,
|
|
174
287
|
head,
|
|
175
288
|
...sub,
|
|
289
|
+
...asked,
|
|
176
290
|
...(r.what ? r.what.split('\n').map((l) => ` ${l}`) : []),
|
|
177
291
|
...(st.topic ? [` topic ${st.topic}${st.worker ? `, claimed by ${st.worker}` : ''}${r.origin.by === 'owner' && r.origin.kind ? `, ${r.origin.kind}` : ''}`] : []),
|
|
178
292
|
...words.map((m) => ` ${m.who} ${m.at}${m.op ? ` ${m.op}${m.topic ? ` ${m.topic}` : ''}` : ''}: ${m.text ?? m.note ?? ''}${m.fix ? ` (${m.fix.commit})` : ''}`),
|
|
@@ -181,9 +295,9 @@ export function detail(x: ReviewItem, dir: string, full = false, followed = fals
|
|
|
181
295
|
].join('\n')
|
|
182
296
|
}
|
|
183
297
|
const back = takeBackTexts(x).map((t) => ` taken back ${t.m.at}: ${t.text}`)
|
|
184
|
-
if (!f) return [`${r.id} ${back.length > 0 ? 'TAKEN BACK, NO VERDICT NOW' : 'NO VERDICT YET'}`, head, ...sub, ...back, ...replies].join('\n')
|
|
298
|
+
if (!f) return [`${r.id} ${back.length > 0 ? 'TAKEN BACK, NO VERDICT NOW' : isOpening(r) ? 'OPENED WITH WORDS, NO VERDICT ASKED' : 'NO VERDICT YET'}`, head, ...sub, ...asked, ...back, ...replies].join('\n')
|
|
185
299
|
const pick = pickText(x)
|
|
186
|
-
const out = [`${r.id} ${f.status.toUpperCase()} ${f.at}`, head, ...sub, ...back, ...(pick ? [` ${pick}`] : []), ` comment: ${f.comment || '(none)'}`]
|
|
300
|
+
const out = [`${r.id} ${f.status.toUpperCase()} ${f.at}`, head, ...sub, ...asked, ...back, ...(pick ? [` ${pick}`] : []), ` comment: ${f.comment || '(none)'}`]
|
|
187
301
|
for (const t of reactionTexts(x)) out.push(` ${r.draft ? 'place' : 'view'} ${t}`)
|
|
188
302
|
const px = (v: number, of: number): number => Math.round(v * of)
|
|
189
303
|
const views = r.views
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// the icons of a thread (wiki tools/shipkit/threads-how-it-fits.md, Kinds): a kind's `icon` and a message type's are SVG
|
|
2
|
+
// path data on the hub's 20 unit grid, stroked in the text colour at one weight by the hub's one renderer (hub-app
|
|
3
|
+
// icons.tsx Icon), the contract a project page's `icon` already follows. Path data, never markup: the hub draws a
|
|
4
|
+
// repo's declaration without running or injecting it
|
|
5
|
+
|
|
6
|
+
/** path data the hub can draw: move first, path commands and numbers only */
|
|
7
|
+
export const isGlyph = (s: string | undefined): s is string => s !== undefined && s.length <= 2000 && /^\s*[Mm][\d\s.,eMmLlHhVvCcSsQqTtAaZz+-]*$/.test(s)
|
|
8
|
+
|
|
9
|
+
/** what a kind with no icon draws: a plain square with a dot, so a missing icon reads as missing */
|
|
10
|
+
export const DEFAULT_GLYPH = 'M4 4h12v12H4zM10 10h.01'
|
|
11
|
+
|
|
12
|
+
/** a kind's icon as the hub draws it: its own when it is path data, else the neutral default (an emoji too) */
|
|
13
|
+
export const glyphOf = (kind: { icon?: string } | undefined): string => (isGlyph(kind?.icon) ? kind.icon : DEFAULT_GLYPH)
|
|
14
|
+
|
|
15
|
+
/** the colours a kind's icon takes: a hue each, 15 degrees apart; each theme sets one muted saturation and lightness
|
|
16
|
+
* for all of them (hub.css --kind-s, --kind-l), so every hue reads in every theme and none shouts. The colour lives on
|
|
17
|
+
* the icon only, never as a filled pill or a row's background */
|
|
18
|
+
export const KIND_HUES = {
|
|
19
|
+
red: 0, vermilion: 15, orange: 30, amber: 45, yellow: 60, chartreuse: 75, lime: 90, leaf: 105,
|
|
20
|
+
green: 120, emerald: 135, jade: 150, teal: 165, cyan: 180, sky: 195, azure: 210, blue: 225,
|
|
21
|
+
cobalt: 240, indigo: 255, violet: 270, purple: 285, plum: 300, magenta: 315, pink: 330, rose: 345,
|
|
22
|
+
} as const
|
|
23
|
+
|
|
24
|
+
export type KindColor = keyof typeof KIND_HUES
|
|
25
|
+
export const KIND_COLORS = Object.keys(KIND_HUES) as KindColor[]
|
|
26
|
+
export const isKindColor = (c: unknown): c is KindColor => typeof c === 'string' && c in KIND_HUES
|
|
27
|
+
|
|
28
|
+
/** a kind's hue, or null: a kind with no colour draws its icon in the muted text colour */
|
|
29
|
+
export const hueOf = (kind: { color?: string } | undefined): number | null => (isKindColor(kind?.color) ? KIND_HUES[kind.color] : null)
|
|
30
|
+
|
|
31
|
+
/** the hue as one fixed colour, for a file that knows no theme (the objects page's icons): mid tone, read on a light
|
|
32
|
+
* ground and a dark one */
|
|
33
|
+
export function hueHex(h: number, s = 0.5, l = 0.52): string {
|
|
34
|
+
const k = (n: number): number => (n + h / 30) % 12
|
|
35
|
+
const a = s * Math.min(l, 1 - l)
|
|
36
|
+
const f = (n: number): number => l - a * Math.max(-1, Math.min(k(n) - 3, Math.min(9 - k(n), 1)))
|
|
37
|
+
return `#${[f(0), f(8), f(4)].map((x) => Math.round(x * 255).toString(16).padStart(2, '0')).join('')}`
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** an icon as a standalone SVG file, stroked in one colour */
|
|
41
|
+
export const glyphSvg = (d: string, color: string): string =>
|
|
42
|
+
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20" fill="none" stroke="${color}" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>\n`
|
|
43
|
+
|
|
44
|
+
/** the types of message a thread holds, each one icon at its head */
|
|
45
|
+
export const MESSAGE_TYPES = {
|
|
46
|
+
version: { label: 'version', shows: "what an agent made, as the owner sees it: pictures, a before and after, a clip, a sound, two states; the owner's verdict", icon: 'M10 3 17 6.5 10 10 3 6.5zM3 10l7 3.5 7-3.5M3 13.5 10 17l7-3.5' },
|
|
47
|
+
verdict: { label: 'verdict', shows: "the owner's answer to a version: OK, fix or no, the owner's notes and rectangles", icon: 'M10 3.5v13M6 16.5h8M4 6h12M4 6l-2 5h4zM16 6l-2 5h4z' },
|
|
48
|
+
message: { label: 'message', shows: "words of an agent or of the owner", icon: 'M3 4h14v9H8l-4 3.5V13H3z' },
|
|
49
|
+
question: { label: 'question', shows: "a question the owner answers with a click or a word: a choice, a confirm, a text, a url, a file", icon: 'M3 4h14v9H8l-4 3.5V13H3zM8.3 7.2a1.8 1.8 0 1 1 2.5 1.6c-.5.3-.8.6-.8 1.1M10 11.3h.01' },
|
|
50
|
+
checklist: { label: 'checklist', shows: "steps the owner ticks one by one", icon: 'M3.5 5l1.5 1.5L7.5 4M10 5.5h6.5M3.5 10.5 5 12l2.5-2.5M10 11h6.5M3.5 16h4M10 16h6.5' },
|
|
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
|
+
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
|
+
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
|
+
answer: { label: 'answer', shows: "the owner's answer to a question", icon: 'M3 4h14v9H8l-4 3.5V13H3zM7 8.5l2 2 4-4' },
|
|
55
|
+
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
|
+
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' },
|
|
57
|
+
note: { label: 'note', shows: "what the owner or a player raised, with its rectangles", icon: 'M4 3.5h12V12l-4.5 4.5H4zM11.5 16.5V12H16' },
|
|
58
|
+
action: { label: 'action', shows: "the owner's click on an object's action (accept, rework, discard)", icon: 'M5 3l10 6-4.5 1.5L8.5 15z' },
|
|
59
|
+
link: { label: 'link', shows: "an object an agent linked into the thread: a card that opens it whole", icon: 'M8.5 11.5a3.5 3.5 0 0 0 5 0l2.5-2.5a3.5 3.5 0 0 0-5-5l-1 1M11.5 8.5a3.5 3.5 0 0 0-5 0L4 11a3.5 3.5 0 0 0 5 5l1-1' },
|
|
60
|
+
trace: { label: 'trace', shows: "a muted line: who did what, when", icon: 'M3.5 10a6.5 6.5 0 1 0 1.9-4.6M3 3.5v3h3M10 6.5V10l2.5 1.5' },
|
|
61
|
+
} as const satisfies Record<string, { label: string; shows: string; icon: string }>
|
|
62
|
+
|
|
63
|
+
export type MessageType = keyof typeof MESSAGE_TYPES
|
package/src/review/gone.ts
CHANGED
|
@@ -20,7 +20,7 @@ export function goneDir(dir: string): boolean {
|
|
|
20
20
|
const s = lstatSync(join(dir, GONE), { throwIfNoEntry: false })
|
|
21
21
|
if (s == null) return false
|
|
22
22
|
// a file in the way, as the disk says it: a card the hq deleted waits until the folder is one again
|
|
23
|
-
if (!s.isDirectory()) throw Object.assign(new Error(`${join(dir, GONE)} is not a folder (${s.isSymbolicLink() ? 'a link' : 'a file'}): no
|
|
23
|
+
if (!s.isDirectory()) throw Object.assign(new Error(`${join(dir, GONE)} is not a folder (${s.isSymbolicLink() ? 'a link' : 'a file'}): no item is set aside, swept or sent through it`), { code: 'ENOTDIR' })
|
|
24
24
|
return true
|
|
25
25
|
}
|
|
26
26
|
const realGone = (dir: string): boolean => {
|