rvlib-shipkit 2.32.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.
Files changed (54) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/package.json +1 -1
  3. package/src/advisors/advisor-view.ts +28 -7
  4. package/src/advisors/edge/api.ts +1 -30
  5. package/src/advisors/project.ts +3 -3
  6. package/src/advisors/sync.ts +7 -3
  7. package/src/advisors/users-router.ts +13 -11
  8. package/src/cli/cmd_Capacity.ts +6 -2
  9. package/src/cli/cmd_Ci.ts +2 -1
  10. package/src/cli/cmd_Shot.ts +26 -4
  11. package/src/cli.ts +13 -2
  12. package/src/core/admission.ts +268 -0
  13. package/src/core/code-lines.ts +36 -21
  14. package/src/core/machine-read.ts +5 -2
  15. package/src/core/peer-sk.ts +8 -0
  16. package/src/gate/admit-heavy.ts +150 -0
  17. package/src/gate/check-runner.ts +6 -0
  18. package/src/gate/head-gate.ts +1 -1
  19. package/src/gate/job-run.ts +2 -1
  20. package/src/gate/pre-commit-discovery.ts +6 -3
  21. package/src/gate/run-check.ts +3 -0
  22. package/src/gate/run-ci.ts +4 -0
  23. package/src/home/run-daemon.ts +3 -1
  24. package/src/hooks/commit-msg-run.ts +61 -0
  25. package/src/hooks/commit-run.ts +16 -166
  26. package/src/hooks/gate-outcome.ts +108 -0
  27. package/src/hooks/git-hook.ts +9 -9
  28. package/src/hooks/hook-config.ts +2 -1
  29. package/src/hooks/pre-commit-checks.ts +1 -1
  30. package/src/hooks/run-hooks.ts +2 -1
  31. package/src/hooks/shared-file.ts +3 -2
  32. package/src/plan/planner.ts +3 -2
  33. package/src/repo-config.ts +8 -1
  34. package/src/review/answer-kinds.ts +2 -0
  35. package/src/review/cells.ts +34 -7
  36. package/src/review/format.ts +1 -1
  37. package/src/review/model.ts +3 -3
  38. package/src/review/routes.ts +2 -28
  39. package/src/review/store-parties.ts +28 -0
  40. package/src/review/store.ts +9 -1
  41. package/src/review/thread-state.ts +9 -3
  42. package/src/secrets/copy.ts +4 -4
  43. package/src/serve/hub-app/dock-st.ts +1 -1
  44. package/src/serve/hub-app/review/question-views.tsx +28 -17
  45. package/src/serve/hub-app/review/review-host.ts +6 -2
  46. package/src/serve/hub-app/review/review-list.tsx +8 -5
  47. package/src/serve/hub-app/review/review-st.ts +2 -2
  48. package/src/serve/hub-app/review/review-views.tsx +10 -7
  49. package/src/serve/hub-app/review/thread-st.ts +17 -9
  50. package/src/serve/hub-app/review/tone-bar.tsx +27 -24
  51. package/src/serve/hub-app/review/tones.ts +18 -0
  52. package/src/serve/hub-app/review.css +11 -2
  53. package/src/shot/client.ts +2 -1
  54. package/src/shot/on-place.ts +141 -0
@@ -929,6 +929,37 @@ function rowOf(t: Thread, now: Date, code: string): ThreadRow {
929
929
 
930
930
  const TURN_RANK: Record<Turn, number> = { yours: 0, aside: 1, agents: 2, done: 3 }
931
931
 
932
+ /** the list's order: his turn, set aside, the agents', done; in each, the newest activity first */
933
+ const listOrder = <E extends { row: ThreadRow }>(entries: readonly E[]): E[] =>
934
+ entries
935
+ .map((e, i) => ({ e, i }))
936
+ .sort((a, b) => TURN_RANK[a.e.row.state.turn] - TURN_RANK[b.e.row.state.turn] || b.e.row.updated.localeCompare(a.e.row.updated) || a.i - b.i)
937
+ .map(({ e }) => e)
938
+
939
+ /** what a page of the list reads of an index: the rows in the list's order with their search text, a code's row, the
940
+ * counts and the filters' choices. The store's index (threadIndex) is one, the rows a person may see another */
941
+ export type ListIndex = Pick<ThreadIndex, 'counts' | 'subjects' | 'lanes' | 'since'> & {
942
+ entries: readonly { row: ThreadRow; text: string }[]
943
+ byCode: (code: string) => { row: ThreadRow } | null
944
+ }
945
+
946
+ /** the list over rows a reader of the advisors' port may see, each its search text: the hub's order and counts, a code
947
+ * found by the rows' own codes, what moved since the reader's last act as the port reads it */
948
+ export function listIndexOf(rows: readonly { row: ThreadRow; text: string }[], since: ThreadPage['since'] = null): ListIndex {
949
+ const entries = listOrder(rows)
950
+ return {
951
+ entries,
952
+ byCode: (code) => {
953
+ const c = code.toLowerCase().replace(/^#/, '')
954
+ return entries.find((e) => e.row.code !== '' && e.row.code === c) ?? null
955
+ },
956
+ counts: { threads: entries.length, active: entries.filter((e) => e.row.state.active).length, waiting: entries.filter((e) => e.row.state.turn === 'yours').length, unread: entries.filter((e) => e.row.unread && countsUnread(e.row.state.turn)).length },
957
+ subjects: [...new Set(entries.map((e) => e.row.subject))].sort(),
958
+ lanes: [],
959
+ since,
960
+ }
961
+ }
962
+
932
963
  /** what a search reads of a thread: every item's title, words and id, and every message's words */
933
964
  const textOf = (t: Thread): string =>
934
965
  membersOf(t)
@@ -992,11 +1023,7 @@ export function threadLinks(ix: ThreadIndex, t: Thread): Pick<ThreadView, 'refs'
992
1023
  * item id of the store, a broken one too, which the codes are given over (review/thread-code.ts) */
993
1024
  export function threadIndex(items: readonly ReviewItem[], now = new Date(), ids: Iterable<string> = items.map((x) => x.item.id)): ThreadIndex {
994
1025
  const codes = codesOf(ids)
995
- const entries = orderedThreads(items)
996
- .map((t) => ({ t, row: rowOf(t, now, threadCode(codes, idsOf(t))), text: textOf(t) }))
997
- .map((e, i) => ({ e, i }))
998
- .sort((a, b) => TURN_RANK[a.e.row.state.turn] - TURN_RANK[b.e.row.state.turn] || b.e.row.updated.localeCompare(a.e.row.updated) || a.i - b.i)
999
- .map(({ e }) => e)
1026
+ const entries = listOrder(orderedThreads(items).map((t) => ({ t, row: rowOf(t, now, threadCode(codes, idsOf(t))), text: textOf(t) })))
1000
1027
  const waiting = new Set(entries.filter((e) => e.row.state.turn === 'yours').map((e) => e.row.head))
1001
1028
  const byItem = new Map<string, (typeof entries)[number]>()
1002
1029
  for (const e of entries) for (const id of e.row.ids) byItem.set(id, e)
@@ -1019,7 +1046,7 @@ export function threadIndex(items: readonly ReviewItem[], now = new Date(), ids:
1019
1046
  }
1020
1047
 
1021
1048
  /** where the kept row sits among a page's rows: in the index's own order, after the last row that comes before it */
1022
- function keptAt(ix: ThreadIndex, rows: readonly ThreadRow[], kept: ThreadRow): number {
1049
+ function keptAt(ix: ListIndex, rows: readonly ThreadRow[], kept: ThreadRow): number {
1023
1050
  const order = new Map(ix.entries.map((e, i) => [e.row, i]))
1024
1051
  const at = order.get(kept)!
1025
1052
  const i = rows.findIndex((r) => order.get(r)! > at)
@@ -1030,7 +1057,7 @@ function keptAt(ix: ThreadIndex, rows: readonly ThreadRow[], kept: ThreadRow): n
1030
1057
  const whoseOf = (t: Turn): Move => (t === 'yours' || t === 'aside' ? 'owner' : t === 'agents' ? 'agents' : 'none')
1031
1058
 
1032
1059
  /** one page of the index for a query; the open thread's row (`keep`) in it whatever the filters */
1033
- export function pageOf(ix: ThreadIndex, q: ThreadQuery, broken: ThreadPage['broken'] = []): ThreadPage {
1060
+ export function pageOf(ix: ListIndex, q: ThreadQuery, broken: ThreadPage['broken'] = []): ThreadPage {
1034
1061
  // words, `t:<tag>` each a thread must carry, a thread's code (review/thread-query.ts)
1035
1062
  const { words, tags, codes } = parseSearch(q.q)
1036
1063
  // a thread's code, `#k7m2` or bare, finds that thread first, whatever the filters but its tags
@@ -127,7 +127,7 @@ function answerLine(x: ReviewItem, m: Message): string | null {
127
127
 
128
128
  /** what his tone on a question with no option asks of the agent */
129
129
  const QUESTION_TONE_WORDS: Record<QuestionTone, string> = {
130
- rework: 'none of these, a rework: offer other options in the same direction',
130
+ rework: 'none of these: read the owner\'s words for what he wants instead, then ask again or build it',
131
131
  'wrong-direction': 'wrong direction: stop, rethink the question itself, and ask again before you build',
132
132
  'your-call': 'your call: decide yourself if it still holds, else drop it, and say what you chose',
133
133
  'no-answer': 'no answer: he left it unanswered, nothing owed',
@@ -744,9 +744,9 @@ export const isApproved = (s: ReviewStatus): boolean => s === 'approved' || s ==
744
744
  /** the tones that give the version back to its agent with work owed: every one but ok and archived */
745
745
  export const OWES_WORK: ReadonlySet<ReviewStatus> = new Set(['approved-with-fix', 'rework', 'wrong-direction', 'your-call'])
746
746
 
747
- /** the tones a choice question takes besides a pick and a pick with a remark: none of its options right, said as a
748
- * rework (other options, the same direction) or a wrong direction; « your call » takes the agent's pick if it still holds;
749
- * « no answer » leaves it unanswered */
747
+ /** the tones a choice question takes besides a pick and a pick with a remark: « none of these » (a rework, the owner's
748
+ * words), « your call » (the agent's pick if it still holds), « no answer »; `wrong-direction` the hub no longer offers on a
749
+ * question, kept to read and write the rows that hold it */
750
750
  export const QUESTION_TONES = ['rework', 'wrong-direction', 'your-call', 'no-answer'] as const satisfies readonly ReviewStatus[]
751
751
  export type QuestionTone = (typeof QUESTION_TONES)[number]
752
752
 
@@ -37,7 +37,7 @@ import type { HeldOf } from '../secrets/held.ts'
37
37
  import type { SecretStore } from '../secrets/manager.ts'
38
38
  import { specData, type ReviewUnit } from './unit.ts'
39
39
  import { liveWatchers } from './watchers.ts'
40
- import { storeParties, type StoreParties } from './store-parties.ts'
40
+ import { partiesOfStore } from './store-parties.ts'
41
41
  import { repoNameOf } from '../agent-time/registry.ts'
42
42
  import { harvestedOf, objectReaderOf, objectsTag } from './object-read.ts'
43
43
  import { orchestratorOf } from './lane-ask.ts'
@@ -73,33 +73,7 @@ async function mentionsOf(dir: string, id: string): Promise<MentionCandidate[]>
73
73
  return mentionCandidates({ members: membersOf(t), parties, repo, holder: h === null ? null : { ...(h.lane ? { lane: h.lane } : {}), ...(h.session ? { session: h.session } : {}) }, advisors })
74
74
  }
75
75
 
76
- /** a store's parties as the page reads them, read again at most every few seconds: the registry reads transcripts. A
77
- * held answer stands only while the stamp it was read under holds: the page asks on the stream's notice that the
78
- * parties moved, and nothing asks again after that answer */
79
- const PARTIES_MS = 4000
80
- const partiesHeld = new Map<string, { at: number; stamp: string; value: Promise<StoreParties> }>()
81
- /** the cheap sign that a store's parties moved, given by the hub (serve/serve-hub.ts): its stream follows the same */
82
- let partiesStampOf: (dir: string) => string = () => ''
83
- export const partiesStampWith = (stamp: (dir: string) => string): void => {
84
- partiesStampOf = stamp
85
- }
86
- /** who reads them: this process, or the daemon's read thread (serve/read-thread.ts), off the loop every page waits on */
87
- let partiesReader: (dir: string) => Promise<StoreParties> = storeParties
88
- export const readPartiesWith = (reader: (dir: string) => Promise<StoreParties>): void => {
89
- partiesReader = reader
90
- }
91
- export function partiesOfStore(dir: string, now = Date.now()): Promise<StoreParties> {
92
- const held = partiesHeld.get(dir)
93
- const stamp = partiesStampOf(dir)
94
- if (held && now - held.at < PARTIES_MS && held.stamp === stamp) return held.value
95
- const value = partiesReader(dir)
96
- // a read that failed is asked again by the next caller, never kept for its few seconds
97
- value.catch(() => {
98
- if (partiesHeld.get(dir)?.value === value) partiesHeld.delete(dir)
99
- })
100
- partiesHeld.set(dir, { at: now, stamp, value })
101
- return value
102
- }
76
+ export { partiesOfStore, partiesStampWith, readPartiesWith } from './store-parties.ts'
103
77
  import { autoRulesOf } from '../veille/auto.ts'
104
78
  import { draftsOfThread } from '../social/thread-drafts.ts'
105
79
  import { itemsDb } from './item-db.ts'
@@ -20,3 +20,31 @@ export async function storeParties(dir: string, o: Pick<Parameters<typeof readPa
20
20
  for (const r of readSessionRecords()) if (r.stores.includes(dir)) ids.add(r.session)
21
21
  return { repo: repoNameOf(dirname(dirname(dir))), parties: await readParties({ sessions: [...ids], watchers: liveWatchers(dir), ...o }) }
22
22
  }
23
+
24
+ /** a store's parties as the page reads them, read again at most every few seconds: the registry reads transcripts. A
25
+ * held answer stands only while the stamp it was read under holds: the page asks on the stream's notice that the
26
+ * parties moved, and nothing asks again after that answer */
27
+ const PARTIES_MS = 4000
28
+ const partiesHeld = new Map<string, { at: number; stamp: string; value: Promise<StoreParties> }>()
29
+ /** the cheap sign that a store's parties moved, given by the hub (serve/serve-hub.ts): its stream follows the same */
30
+ let partiesStampOf: (dir: string) => string = () => ''
31
+ export const partiesStampWith = (stamp: (dir: string) => string): void => {
32
+ partiesStampOf = stamp
33
+ }
34
+ /** who reads them: this process, or the daemon's read thread (serve/read-thread.ts), off the loop every page waits on */
35
+ let partiesReader: (dir: string) => Promise<StoreParties> = storeParties
36
+ export const readPartiesWith = (reader: (dir: string) => Promise<StoreParties>): void => {
37
+ partiesReader = reader
38
+ }
39
+ export function partiesOfStore(dir: string, now = Date.now()): Promise<StoreParties> {
40
+ const held = partiesHeld.get(dir)
41
+ const stamp = partiesStampOf(dir)
42
+ if (held && now - held.at < PARTIES_MS && held.stamp === stamp) return held.value
43
+ const value = partiesReader(dir)
44
+ // a read that failed is asked again by the next caller, never kept for its few seconds
45
+ value.catch(() => {
46
+ if (partiesHeld.get(dir)?.value === value) partiesHeld.delete(dir)
47
+ })
48
+ partiesHeld.set(dir, { at: now, stamp, value })
49
+ return value
50
+ }
@@ -1162,7 +1162,8 @@ export async function postPropose(dir: string, id: string, p: { who: string; tex
1162
1162
 
1163
1163
  /** the owner's answer to a question (an option) or to a proposed change (apply one field, the value as proposed or the owner's
1164
1164
  * edit of it in `value`), with the owner's words; `tone` on a choice: none of its options right (a rework, a wrong
1165
- * direction), or his « your call », which takes the agent's pick if it still holds (model.ts QUESTION_TONES) */
1165
+ * direction), or his « your call », which takes the agent's pick if it still holds (model.ts QUESTION_TONES); on a
1166
+ * text or a url: your call or no answer; on a confirm: no answer */
1166
1167
  export function answerAsk(dir: string, id: string, a: { re: string; option?: number; apply?: boolean; field?: string; value?: string; text?: string; tick?: boolean; pick?: number; opens?: number; tone?: QuestionTone; now?: Date }): Message {
1167
1168
  const x = readItem(dir, id)
1168
1169
  if (!x) throw new Error(`no item ${id}`)
@@ -1173,6 +1174,13 @@ export function answerAsk(dir: string, id: string, a: { re: string; option?: num
1173
1174
  const kind = m.ask?.kind ?? 'choice'
1174
1175
  if (m.ask && kind === 'secret') throw new Error('a secret is typed into its own field of the hub, and its value never goes into a thread')
1175
1176
  if (m.ask && kind === 'file') throw new Error('a file question is answered by the file he drops')
1177
+ // a text or a url takes the question's row too: your call or no answer; a confirm, a step only the owner does, no
1178
+ // answer alone; words alone say none
1179
+ if (m.ask && a.tone !== undefined && (kind === 'confirm' || kind === 'text' || kind === 'url')) {
1180
+ if (kind === 'confirm' && a.tone !== 'no-answer') throw new Error("tone: no-answer alone on a confirm, a step only the owner does; the owner's words alone answer it otherwise")
1181
+ if (a.tone !== 'your-call' && a.tone !== 'no-answer') throw new Error(`tone: your-call or no-answer on a ${kind}; the owner's words alone answer it otherwise`)
1182
+ return appendMessage(dir, id, { who: 'owner', re: a.re, verdict: a.tone, text: words === '' ? STATUS_LABEL[a.tone] : words }, at)
1183
+ }
1176
1184
  if (m.ask && (kind === 'checklist' || kind === 'confirm')) {
1177
1185
  const lines = linesOf(m)
1178
1186
  const o = kind === 'confirm' ? 0 : a.option
@@ -145,6 +145,9 @@ export interface ThreadState {
145
145
  recap: RecapState | null
146
146
  /** the newest message of any of its items (no read mark, no hand over), else the head's time: the row's time */
147
147
  updated: string
148
+ /** a person's copy alone (personState): whether a live agent works it now, read from the owner's parties, which
149
+ * never reach them; the band reads it in place of the holder and the parties */
150
+ works?: boolean
148
151
  }
149
152
 
150
153
  const kept = new WeakMap<Thread, { members: number; messages: number; now: number; s: ThreadState }>()
@@ -367,7 +370,7 @@ export const validatedOf = (f: { turn: Turn; status: string; ask?: AskState }):
367
370
  * the copy's state `copy`. The owner's turn reads « waits for the owner » (aside) to them, unless he deferred the thread
368
371
  * to them; when the copy's head is an older version (`headKept` false), nothing of it waits and its status is the
369
372
  * thread's only once the thread is done */
370
- export function personState(real: ThreadState, copy: ThreadState, o: { deferred: boolean; headKept: boolean }): ThreadState {
373
+ export function personState(real: ThreadState, copy: ThreadState, o: { deferred: boolean; headKept: boolean; works?: boolean }): ThreadState {
371
374
  const turn: Turn = o.deferred && real.turn === 'aside' ? 'yours' : real.turn === 'yours' || real.turn === 'aside' ? 'aside' : real.turn
372
375
  return {
373
376
  ...copy,
@@ -378,6 +381,9 @@ export function personState(real: ThreadState, copy: ThreadState, o: { deferred:
378
381
  waitsOwner: o.headKept ? copy.waitsOwner : copy.waitsOwner.filter((w) => w.what !== 'version'),
379
382
  active: turn !== 'done',
380
383
  validated: copy.validated && (o.headKept || real.turn === 'done'),
384
+ // what they must do: a verdict, an answer; a step of the owner's hands is never theirs, nothing once it is done
385
+ verbs: turn === 'done' ? [] : copy.verbs.filter((v) => v !== 'do'),
386
+ works: o.works ?? false,
381
387
  }
382
388
  }
383
389
 
@@ -389,7 +395,7 @@ export type Band = (typeof BANDS)[number]
389
395
  export const BAND_WORDS: Record<Band, string> = { yours: 'your turn', aside: 'set aside', working: 'an agent works on it', waiting: 'waiting for an agent', done: 'done' }
390
396
 
391
397
  /** what the band reads of a thread's state */
392
- export type BandFacts = Pick<ThreadState, 'turn' | 'holder' | 'working' | 'laneAsk' | 'next'>
398
+ export type BandFacts = Pick<ThreadState, 'turn' | 'holder' | 'working' | 'laneAsk' | 'next' | 'works'>
393
399
 
394
400
  const laneOf = (p: Parties, name: string, session: string | undefined) => p.lanes.find((l) => l.name === name && (session === undefined || l.session === session))
395
401
 
@@ -415,7 +421,7 @@ export function worksNow(f: BandFacts, p: Parties, now = new Date()): boolean {
415
421
  /** the band: the turn, an agent's move split by whether a live agent works it now (wiki tools/shipkit/threads-how-it-fits.md,
416
422
  * The bands) */
417
423
  export const bandOf = (f: BandFacts, p: Parties, now = new Date()): Band =>
418
- f.turn !== 'agents' ? f.turn : (f.laneAsk != null && laneAskOwed(f.laneAsk, p)) || !worksNow(f, p, now) ? 'waiting' : 'working'
424
+ f.turn !== 'agents' ? f.turn : f.works !== undefined ? (f.works ? 'working' : 'waiting') : (f.laneAsk != null && laneAskOwed(f.laneAsk, p)) || !worksNow(f, p, now) ? 'waiting' : 'working'
419
425
 
420
426
  /** a `working` line past its time on the agents' move, as the owner's row says it (« said working 14 h ago, nothing since »);
421
427
  * a promised version counts its own time; null while it counts or on any other turn */
@@ -1,6 +1,7 @@
1
1
  // secrets copied to another Mac over ssh: each read through the lib's one read and written by the peer's own
2
2
  // `sk secret set`, from the house checkout at the same place under its home. A value only ever travels on ssh's
3
3
  // stdin: never an argv, a file or a printed line. A secret the peer already answers is left as it is.
4
+ import { peerSk, shq } from '../core/peer-sk.ts'
4
5
 
5
6
  export type Copied = { name: string; did: 'copied' | 'there' | 'not here' | 'failed'; why?: string }
6
7
 
@@ -18,11 +19,10 @@ const spawnRun: Run = async (argv, stdin) => {
18
19
  return { code: await p.exited, out, err }
19
20
  }
20
21
 
21
- /** a word quoted for the peer's sh */
22
- const q = (s: string): string => `'${s.replaceAll("'", `'\\''`)}'`
22
+ const q = shq
23
23
 
24
- /** the line the peer's shell runs: an ssh command shell reads no rc file, so the tools' folders are named */
25
- export const peerLine = (houseRel: string, args: string): string => `cd ~/${houseRel} && PATH="$HOME/.local/bin:$HOME/.bun/bin:$PATH" sk secret ${args}`
24
+ /** the line the peer's shell runs for `sk secret <args>` */
25
+ export const peerLine = (houseRel: string, args: string): string => peerSk(houseRel, `secret ${args}`)
26
26
 
27
27
  /** the unlock a locked peer needs, said once */
28
28
  export const unlockHint = (to: string): string => `the login keychain of ${to} is locked to ssh, and an unlock holds for its own ssh session only: run \`sk secret copy --to ${to} --unlock\` from your terminal (it asks for that Mac's login password once)`
@@ -151,7 +151,7 @@ export function dockPills(view: HouseView | null, size: DockSize): DockPill[] {
151
151
  const d = line.match(DEFERRED)
152
152
  if (m != null) settling.push(`${m[1]} ${m[2]}`)
153
153
  else if (d != null) deferred.push({ short: `${d[1]} ${d[2]}`, line })
154
- else out.push({ key: `held:${held++}`, tone: 'warn', text: line.replace(/ on \d+ cores$/, ''), title: line })
154
+ else out.push({ key: `held:${held++}`, tone: 'warn', text: line.replace(/ on \d+ cores(?=$|, most by )/, '').replace(/(, most by .*) \([^()]*\)$/, '$1'), title: line })
155
155
  }
156
156
  // a save held behind a gate someone started is the plan working as meant: one dim pill, each sentence on hover
157
157
  if (deferred.length > 0)
@@ -1,8 +1,8 @@
1
1
  // what an agent asks of the owner in a thread, answered in one click (wiki tools/shipkit/threads.md, A question, A proposed
2
2
  // change): a question's options, each words or a media drawn as a view, and a proposed change, each field drawn by its
3
- // type and applied alone. A choice answers in the five tones of a verdict (tones.ts): an option or the agent's pick (ok),
4
- // one with the owner's remark (ok with a fix), none of them in the owner's words (rework, wrong direction), or your call; its bar is the
5
- // verdict's (tone-bar.tsx)
3
+ // type and applied alone. A question answers in question words, never a verdict's (tones.ts questionTones): a click on an
4
+ // option picks it, its pencil picks it with the owner's remark; under the options one row, none of these in the owner's words,
5
+ // your call, no answer (tone-bar.tsx)
6
6
  import { observer } from 'mobx-react-lite'
7
7
  import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
8
8
  import type { PersonPick, ReplyCell } from '../../../review/cells.ts'
@@ -12,9 +12,9 @@ import { CodeHunk, Swatches, WordDiff } from './diff-view.tsx'
12
12
  import { AutoText } from '../auto-text.tsx'
13
13
  import { renderMdInline } from '../md.ts'
14
14
  import { WordsInline } from '../words.tsx'
15
- import { keepFocus, toneOf } from './kit.tsx'
15
+ import { keepFocus } from './kit.tsx'
16
16
  import { ToneBar, ToneMark } from './tone-bar.tsx'
17
- import { toneOfStatus } from './tones.ts'
17
+ import { questionToneClass, questionTones, toneOfStatus, type Tone } from './tones.ts'
18
18
  import type { ReviewSt } from './review-st.ts'
19
19
  import { secretFacts } from './secret-facts.ts'
20
20
  import { ReadableLine } from '../secret-readable.tsx'
@@ -26,6 +26,12 @@ import { tip } from '../tips.ts'
26
26
 
27
27
  type Field = NonNullable<ReplyCell['propose']>['fields'][number]
28
28
 
29
+ /** his answer in words alone as the question's row names it: none of these unless he named your call or no answer */
30
+ const questionAnswerTone = (tone: string | undefined): Tone => {
31
+ const row = questionTones('row', null)
32
+ return row.find((t) => t.status === tone) ?? row[0]!
33
+ }
34
+
29
35
  /** an option's or a field's media, a view of the item the message sits on, drawn read only; an option's name is its
30
36
  * button's, so its view draws no caption of its own (`named`) */
31
37
  const MessageView = observer(({ rv, thread, c, i, named = true }: { rv: ReviewSt; thread: ThreadSt; c: ReplyCell; i: number; named?: boolean }) => {
@@ -119,9 +125,9 @@ const PickLines = observer(({ rv, thread, c, ask }: { rv: ReviewSt; thread: Thre
119
125
  )
120
126
  })
121
127
 
122
- /** an agent's question, answered in the five tones of a verdict (tones.ts): a click on an option picks it (ok); its
123
- * « pick with a remark » mark opens a box under it, the option and the owner's words sent together (ok with a fix); the
124
- * bar under the options takes the agent's pick, answers none of them in the owner's words, or leaves it to the agent. Its media over each option, the agent's pick marked as
128
+ /** an agent's question, answered in question words (tones.ts questionTones): a click on an option picks it; its « pick
129
+ * with a remark » mark opens a box under it, the option and the owner's words sent together; the row under the options
130
+ * answers none of these in the owner's words, your call, or no answer. Its media over each option, the agent's pick marked as
125
131
  * a suggestion. Answered, his answer is the one lit in its tone, his remark under its option. A person's pick shows in
126
132
  * the question's lines (PickLines), never above the thread */
127
133
  export const AskBody = observer(({ rv, thread, c, ask }: { rv: ReviewSt; thread: ThreadSt; c: ReplyCell; ask: NonNullable<ReplyCell['ask']> }) => {
@@ -170,7 +176,7 @@ export const AskBody = observer(({ rv, thread, c, ask }: { rv: ReviewSt; thread:
170
176
  <button type="button" className={`rv-askremark${remarking === i ? ' open' : ''}`} aria-label={`pick ${i + 1} with a remark`} aria-expanded={remarking === i} data-check="pick-remark"
171
177
  {...tip(`pick ${i + 1} with a remark: a box opens for your words, and the agent reads the option and your words together`)} onMouseDown={keepFocus}
172
178
  onClick={() => thread.setRemarking(c.id, remarking === i ? null : i)}>
173
- <span className="st-approved-with-fix"><ToneMark t={toneOfStatus('approved-with-fix')!} /></span>
179
+ <span className="st-remark"><ToneMark t={toneOfStatus('approved-with-fix')!} /></span>
174
180
  </button>
175
181
  ) : null
176
182
  const choice = (o: string, i: number) => (
@@ -181,17 +187,17 @@ export const AskBody = observer(({ rv, thread, c, ask }: { rv: ReviewSt; thread:
181
187
  )
182
188
  const remarkBox = remarking !== undefined && remarking < ask.options.length ? <RemarkBox thread={thread} c={c} i={remarking} /> : null
183
189
  const remarkSaid = (i: number) => (mine(i) && remark !== '' ? <div className="rv-askremarksaid" {...tip('your remark with this pick')}>« {remark} »</div> : null)
184
- // his answer in words alone: a rework (none of these), a wrong direction or your call, in its tone
185
- const given = toneOfStatus(ask.tone ?? 'rework')!
190
+ // his answer in words alone, in the question's words: none of these (an older wrong direction too), your call, no answer
191
+ const given = questionAnswerTone(ask.tone)
186
192
  const said = his !== null && 'words' in his ? (
187
- <button key="words" className={`rv-askopt picked none words ${toneOf(given.status)}`} disabled {...tip(`your answer, ${given.word}: « ${his.words} »`)}>
188
- <span className="rv-asknonelabel"><ToneMark t={given} /> {given.status === 'rework' ? 'none of these' : given.word}</span>
189
- {his.words !== given.word ? <span className="rv-askoptlabel">« {his.words} »</span> : null}
193
+ <button key="words" className={`rv-askopt picked none words ${questionToneClass(given.status)}`} disabled {...tip(`your answer, ${given.word}: « ${his.words} »`)}>
194
+ <span className="rv-asknonelabel"><ToneMark t={given} /> {given.word}</span>
195
+ {his.words !== given.word && his.words !== toneOfStatus(given.status)?.word ? <span className="rv-askoptlabel">« {his.words} »</span> : null}
190
196
  <span className="rv-yours">✓ yours</span>
191
197
  </button>
192
198
  ) : null
193
- // the answer bar under the options (tone-bar.tsx): ok and a fix take the agent's pick, rework and wrong direction
194
- // answer none of them in the owner's words, your call leaves it to the agent; a step of an ask's instructions keeps its words
199
+ // the question's row under the options (tone-bar.tsx): none of these in the owner's words, your call (the agent's
200
+ // pick), no answer; a pick is a click on its option. A step of an ask's instructions keeps its words
195
201
  const bar = c.step === undefined && !c.superseded ? <ToneBar thread={thread} on={c.id} question={c} pick={ask.pick !== undefined ? (ask.options[ask.pick] ?? `option ${ask.pick + 1}`) : null} /> : null
196
202
  // a step's escape hatch: « none of these », the owner's words instead of an option. Answered in words, it holds the
197
203
  // words, selected
@@ -287,6 +293,10 @@ const KindAskBody = observer(({ rv, thread, c, ask }: { rv: ReviewSt; thread: Th
287
293
  const words = (thread.hints[c.id] ?? '').trim() !== ''
288
294
  // answered with the owner's words alone: they stand where its control stood, in green, never over the question
289
295
  const inWords = ask.none !== undefined && ask.kind !== 'checklist' && !ask.open
296
+ // a confirm, a text or a url: its own control, then the question's row (your call on a text or a url, no answer), kept once answered
297
+ // so the question keeps its layout, as a choice keeps its row
298
+ const row = thread.questionCell(c.id) !== undefined && !c.superseded ? <ToneBar thread={thread} on={c.id} question={c} pick={null} /> : null
299
+ const toned = inWords && ask.tone !== undefined ? questionAnswerTone(ask.tone) : null
290
300
  return (
291
301
  <div className={`rv-ask rv-ask-${ask.kind}`}>
292
302
  {ask.kind === 'checklist' ? <Checklist thread={thread} c={c} ask={ask} /> : null}
@@ -294,7 +304,7 @@ const KindAskBody = observer(({ rv, thread, c, ask }: { rv: ReviewSt; thread: Th
294
304
  {(ask.kind === 'text' || ask.kind === 'url') && !inWords ? <ValueField thread={thread} c={c} ask={ask} /> : null}
295
305
  {ask.kind === 'secret' ? <SecretPlace rv={rv} thread={thread} c={c} ask={ask} /> : null}
296
306
  {ask.kind === 'file' && !inWords ? <div className="rv-dim">{ask.value ? `his file: view ${(ask.value.view ?? 0) + 1}` : 'a file he drops: not built in the hub yet'}</div> : null}
297
- {inWords ? (
307
+ {inWords && toned !== null ? null : inWords ? (
298
308
  <div className="rv-askfield rv-askvalue given">
299
309
  <AutoText className="rv-answerwords rv-askgiven" readOnly value={ask.none ?? ''} onText={() => undefined} />
300
310
  <button className="rv-askopt pick picked" disabled {...tip('your answer, in your words')}>✓ in your words</button>
@@ -311,6 +321,7 @@ const KindAskBody = observer(({ rv, thread, c, ask }: { rv: ReviewSt; thread: Th
311
321
  ) : null}
312
322
  </div>
313
323
  ) : null}
324
+ {row}
314
325
  </div>
315
326
  )
316
327
  })
@@ -4,6 +4,7 @@
4
4
  // the one constraint a reader breaks first: a control the role refuses is not drawn, never drawn disabled, and the
5
5
  // page never reaches the owner's repo but through `owner`, null for an advisor
6
6
  import type { ReactNode } from 'react'
7
+ import { OWNER_WAITS, type OwnerWait } from '../../../review/thread-state.ts'
7
8
  import type { FrameCache } from '../frames-st.ts'
8
9
  import type { LayoutSt } from '../layout-st.ts'
9
10
  import type { RepoSt } from '../repo-st.ts'
@@ -15,7 +16,7 @@ export type ReviewRole = 'owner' | 'advisor'
15
16
  /** every act a control of the page offers, by what it does */
16
17
  export const REVIEW_ACTS = [
17
18
  // an advisor's, each one an advice that waits for the owner
18
- 'approve', 'fix', 'reply', 'pick', 'files', 'start', 'read', 'search',
19
+ 'approve', 'fix', 'reply', 'pick', 'files', 'start', 'read', 'search', 'must',
19
20
  // the owner's alone
20
21
  'reject', 'rects', 'react', 'close', 'snooze', 'reopen', 'stage', 'publish', 'action', 'apply', 'answer', 'secret',
21
22
  'lane', 'share', 'reveal', 'holds', 'attach', 'note', 'filter', 'copy', 'trailer', 'social', 'live',
@@ -23,11 +24,14 @@ export const REVIEW_ACTS = [
23
24
  ] as const
24
25
  export type ReviewAct = (typeof REVIEW_ACTS)[number]
25
26
 
26
- const ADVISOR: ReadonlySet<ReviewAct> = new Set<ReviewAct>(['approve', 'fix', 'reply', 'pick', 'files', 'start', 'read', 'search'])
27
+ const ADVISOR: ReadonlySet<ReviewAct> = new Set<ReviewAct>(['approve', 'fix', 'reply', 'pick', 'files', 'start', 'read', 'search', 'must'])
27
28
 
28
29
  /** whether a role may do an act: the owner every one, an advisor what becomes an advice */
29
30
  export const canOf = (role: ReviewRole, act: ReviewAct): boolean => role === 'owner' || ADVISOR.has(act)
30
31
 
32
+ /** the verbs of « what I must do » a role reads: an advisor judges and answers, a step of the owner's hands is his alone */
33
+ export const waitsOf = (role: ReviewRole): readonly OwnerWait[] => (role === 'owner' ? OWNER_WAITS : OWNER_WAITS.filter((w) => w !== 'do'))
34
+
31
35
  /** the home the page sits in: its frames, its columns, whether another tool frames it */
32
36
  export interface ReviewHome {
33
37
  readonly embedded: boolean
@@ -19,7 +19,8 @@ import { Icon, ICON } from '../icons.tsx'
19
19
  import { SectionHead } from '../section-head.tsx'
20
20
  import { ThreadRow as ThreadRowView, VerbGlyph } from '../thread-row.tsx'
21
21
  import { tip } from '../tips.ts'
22
- import { staleWorkingOf, waitingWords, type Band, isOwnerWait, OWNER_WAITS, type OwnerWait } from '../../../review/thread-state.ts'
22
+ import { staleWorkingOf, waitingWords, type Band, isOwnerWait, type OwnerWait } from '../../../review/thread-state.ts'
23
+ import { waitsOf } from './review-host.ts'
23
24
 
24
25
  const ALL = ''
25
26
 
@@ -48,10 +49,11 @@ export const ReviewList = observer(({ rv, place = 'left', tools, top }: { rv: Re
48
49
  </Pop>
49
50
  {tools}
50
51
  </div> : rv.can('search') ? <div className="rv-filters">
51
- <ListFilter value={rv.query} set={(v) => rv.setQuery(v)} keep={(el) => { rv.searchEl = el }} placeholder="search these threads" label="search these threads" />
52
+ <ListFilter value={rv.query} set={(v) => rv.setQuery(v)} keep={(el) => { rv.searchEl = el }} placeholder="search every version and message" label="search every version and message" />
53
+ <ListToggle on={rv.hideHandled} set={(v) => rv.setHideHandled(v)} icon={ICON.hideHandled} label="hide handled" says={rv.hideHandled ? 'hide handled: on, the threads you answered are hidden' : 'hide handled: off, every thread shows'} />
52
54
  </div> : null}
53
55
  <Everywhere rv={rv} />
54
- {rv.can('filter') ? <MustDo rv={rv} /> : null}
56
+ {rv.can('must') ? <MustDo rv={rv} /> : null}
55
57
  {rv.can('start') && rv.newThread !== null && rv.newThread.starts.length > 0 ? <StartThread rv={rv} st={rv.newThread} /> : null}
56
58
  {rv.since && rv.since.moved > 0 ? <div className="rv-since" {...tip(`${sinceWords(rv.since)}\nsince your last act here, ${new Date(rv.since.at).toLocaleString()}`)}><span className="sincelead">since you left: </span>{rv.since.moved}<span className="sincew"> moved</span>, <b>{rv.since.yours}<span className="sincew"> yours</span></b></div> : null}
57
59
  </div>
@@ -93,11 +95,12 @@ const MustDo = observer(({ rv }: { rv: ReviewSt }) => {
93
95
  const n = (w: OwnerWait): number => rv.page?.byWait[w] ?? 0
94
96
  const says = (w: OwnerWait): string => `${w}${n(w) > 0 ? ` (${n(w)})` : ''}: ${MUST_SAYS[w]}`
95
97
  const picked = rv.waits ?? []
98
+ const verbs = waitsOf(rv.host.role)
96
99
  return (
97
100
  <>
98
101
  <div className="verbs seg" role="group" aria-label="what I must do">
99
102
  <button className={rv.waits === null ? 'on' : ''} {...tip('every thread')} onClick={() => rv.setFilter({ waits: null })}>all</button>
100
- {OWNER_WAITS.map((w) => (
103
+ {verbs.map((w) => (
101
104
  <button key={w} className={picked.includes(w) ? 'on' : ''} aria-pressed={picked.includes(w)} aria-label={w} {...tip(says(w))} onClick={() => rv.toggleWait(w)}>
102
105
  <VerbGlyph verb={w} says={says(w)} />
103
106
  <span className="verbw">{w}</span>
@@ -111,7 +114,7 @@ const MustDo = observer(({ rv }: { rv: ReviewSt }) => {
111
114
  {(close) => (
112
115
  <>
113
116
  <button type="button" className="rv-menuitem" data-check="must" data-wait="" aria-pressed={picked.length === 0} {...tip('every thread, whatever it waits on')} onClick={() => { close(); rv.setFilter({ waits: null }) }}>all</button>
114
- {OWNER_WAITS.map((w) => (
117
+ {verbs.map((w) => (
115
118
  <button key={w} type="button" className="rv-menuitem" data-check="must" data-wait={w} aria-pressed={picked.includes(w)} {...tip(MUST_SAYS[w])} onClick={() => { close(); rv.toggleWait(w) }}>
116
119
  <span className="trverb"><Icon d={ICON[w]} /></span>
117
120
  <span>{w}</span>
@@ -10,7 +10,7 @@ import { MOVE_LABEL, pasteBase, pasteBlock, STATUS_LABEL, type Move, type Review
10
10
  import { cellCopy, type CopyCell } from '../../../review/cell-copy.ts'
11
11
  import type { PasteHosts } from '../../../review/paste.ts'
12
12
  import type { RepoSt } from '../repo-st.ts'
13
- import { ADVISOR_WHO, type ReviewHost } from './review-host.ts'
13
+ import { ADVISOR_WHO, waitsOf, type ReviewHost } from './review-host.ts'
14
14
  import { answeredAs, copyText, etagLoader, READ_MS, StoreWait, kept, threadPageLoader, postJson, TILE_H, ZOOMS, boxScale, isBoxZoom, type BoxZoom, type EtagLoader, type Zoom } from './review-kit.ts'
15
15
  import { ThreadSt, type Draft } from './thread-st.ts'
16
16
  import { HELD_THREADS, ThreadViews } from './thread-views.ts'
@@ -718,7 +718,7 @@ export class ReviewSt {
718
718
  toggleWait(w: OwnerWait): void {
719
719
  const on = this.waits ?? []
720
720
  const next = on.includes(w) ? on.filter((x) => x !== w) : [...on, w]
721
- this.setFilter({ waits: next.length === OWNER_WAITS.length ? null : next })
721
+ this.setFilter({ waits: next.length === waitsOf(this.host.role).length ? null : next })
722
722
  }
723
723
 
724
724
  // ── the address ──
@@ -25,7 +25,7 @@ import { AnimPanel } from './kind-view.tsx'
25
25
  import { KindBox, KindViewFrames } from './kind-states.tsx'
26
26
  import { Lightbox } from './lightbox.tsx'
27
27
  import { ToneBar } from './tone-bar.tsx'
28
- import { toneKey } from './tones.ts'
28
+ import { questionTones, toneKey } from './tones.ts'
29
29
  import { renderMdInline } from '../md.ts'
30
30
  import { LiveBody, LiveTile } from './live-view.tsx'
31
31
  import { repoIdentity } from '../side-frame-view.tsx'
@@ -855,8 +855,10 @@ export function boxKey(rv: ReviewSt, thread: ThreadSt, view: BoxView, e: Pick<Ke
855
855
  if (field && thread.note !== null) return false
856
856
  const { at, ver, can, step, tile, opt } = x
857
857
  const said = boxReaction(e.key)
858
- // an option's picture: 1 to 5 (V F R X Y) open that tone's box for the option shown, as the thread's keys do
859
- const toned = opt ? toneKey(e.key, /^Digit[1-5]$/.test(e.code ?? '') ? e.code!.slice(5) : undefined) : null
858
+ // an option's picture: the keys of its side panel's answers (tones.ts questionTones) open that answer's box for the
859
+ // option shown, as the thread's keys do
860
+ const keyed = opt ? toneKey(e.key, /^Digit[1-6]$/.test(e.code ?? '') ? e.code!.slice(5) : undefined) : null
861
+ const toned = keyed !== null && questionTones('option', null).some((t) => t.status === keyed) ? keyed : null
860
862
  if (e.key === 'Escape') thread.closeBox()
861
863
  else if (opt && toned !== null) {
862
864
  if (thread.can(toned === 'approved' || toned === 'approved-with-fix' ? 'pick' : 'answer')) thread.face(opt.c.id, toned, opt.i)
@@ -998,8 +1000,9 @@ export const BoxFrame = observer(({ rv, thread, stage, view }: { rv: ReviewSt; t
998
1000
 
999
1001
  /** the side panel of the lightbox on an option's picture: every option of the question as a small picture (the one
1000
1002
  * shown lit, his pick and the agent's marked, a click shows it), then the option shown, its number and label whole,
1001
- * « my pick » on the agent's, his remark with it, the question's words, and the five tones for THAT option (tone-bar.tsx):
1002
- * he compares and answers without closing. ← → step the options, 1 to 5 open a tone, Escape closes */
1003
+ * « my pick » on the agent's, his remark with it, the question's words, then THAT option's pick and pick with a remark
1004
+ * over the question's row (tone-bar.tsx): he compares and answers without closing. ← → step the options, a digit opens
1005
+ * its answer, Escape closes */
1003
1006
  const OptionSide = observer(({ rv, thread, cell, opt }: { rv: ReviewSt; thread: ThreadSt; cell: VersionCell; opt: { c: ReplyCell; i: number; order: number[] } }) => {
1004
1007
  const { c, i, order } = opt
1005
1008
  const ask = c.ask!
@@ -1032,8 +1035,8 @@ const OptionSide = observer(({ rv, thread, cell, opt }: { rv: ReviewSt; thread:
1032
1035
  {ask.row ? <b className="rv-siderow">{ask.row.label}</b> : null}
1033
1036
  <Words text={c.text} className="rv-sideqwords" />
1034
1037
  </div>
1035
- {answers ? <ToneBar thread={thread} on={c.id} question={c} pick={label} option={i} /> : null}
1036
- <div className="rv-sidekeys rv-dim"><Key k="←" /><Key k="→" /> the options · <Key k="1" />…<Key k="5" /> a tone · <Key k="esc" /> closes</div>
1038
+ {answers ? <ToneBar thread={thread} on={c.id} question={c} pick={ask.pick !== undefined ? (ask.options[ask.pick] ?? `option ${ask.pick + 1}`) : null} option={i} /> : null}
1039
+ <div className="rv-sidekeys rv-dim"><Key k="←" /><Key k="→" /> the options · <Key k="1" /> pick · <Key k="2" /> with a remark · <Key k="esc" /> closes</div>
1037
1040
  </aside>
1038
1041
  )
1039
1042
  })
@@ -43,7 +43,7 @@ import { ADVISOR_WHO, type ReviewAct } from './review-host.ts'
43
43
  import { TrailerSt } from './trailer-st.ts'
44
44
  import { laneNotes, notesNow, sortedDraft, type LaneNote } from '../../../review/trailer-notes.ts'
45
45
  import { ITEM_VERDICTS, type ItemVerdict } from '../../../review/verdict-items.ts'
46
- import { toneOfStatus } from './tones.ts'
46
+ import { questionTones, toneOfStatus } from './tones.ts'
47
47
  import { versionActs } from '../../../review/settle.ts'
48
48
  import type { LaneMark } from '../../../review/trailer-model.ts'
49
49
  import { KeptFolds } from '../kept-folds.ts'
@@ -173,6 +173,9 @@ export const requestState = (c: ReplyCell, waiting: boolean): 'superseded' | 'wa
173
173
 
174
174
  /** the owner's answer on a choice's row: the option clicked, else the owner's words alone, one more option at the
175
175
  * row's end; null while none */
176
+ /** the kinds of question that draw the question's row (none of these on a choice, your call, no answer) */
177
+ const BAR_KINDS: ReadonlySet<string> = new Set(['choice', 'confirm', 'text', 'url'])
178
+
176
179
  export const ownerChoice = (a: NonNullable<ReplyCell['ask']>): { option: number } | { words: string } | null =>
177
180
  a.answered ? { option: a.answered.option } : a.none !== undefined ? { words: a.none } : null
178
181
 
@@ -695,7 +698,12 @@ export class ThreadSt {
695
698
  judgeKey(status: ItemVerdict): Promise<void> | void {
696
699
  const c = [...this.openRequests].reverse().find((x) => x.judge?.open === true || this.questionCell(x.id) !== undefined)
697
700
  const v = this.verdictAbove
698
- if (c !== undefined && (v === null || c.at >= v.at)) return this.face(c.id, status)
701
+ if (c !== undefined && (v === null || c.at >= v.at)) {
702
+ // a question's keys are its row's alone: a pick is a click on its option
703
+ const q = this.questionCell(c.id)
704
+ if (q !== undefined && !questionTones('row', null, q.ask!.kind ?? 'choice').some((t) => t.status === status)) return
705
+ return this.face(c.id, status)
706
+ }
699
707
  // a version answered by its kind's acts (a draft) takes no verdict, by key either
700
708
  const h = this.head
701
709
  if (h?.kind !== 'version' || versionActs(h.item) !== null || !this.takesVerdict) return
@@ -757,10 +765,11 @@ export class ThreadSt {
757
765
  return null
758
766
  }
759
767
 
760
- /** the question `on` names when the bar answers it: a choice of one thing, no step of an ask's instructions */
768
+ /** the question `on` names when its bar answers it (tone-bar.tsx QuestionBar): a choice, a confirm, a text or a url,
769
+ * no step of an ask's instructions */
761
770
  questionCell(on: string): ReplyCell | undefined {
762
771
  const c = this.askingCell(on)
763
- return c?.ask !== undefined && (c.ask.kind === undefined || c.ask.kind === 'choice') && c.step === undefined && c.judge === undefined ? c : undefined
772
+ return c?.ask !== undefined && BAR_KINDS.has(c.ask.kind ?? 'choice') && c.step === undefined && c.judge === undefined ? c : undefined
764
773
  }
765
774
 
766
775
  /** the tone the owner's answer to a question gives, the one on its way first: a pick ok, a pick with the owner's words a fix, words
@@ -774,13 +783,12 @@ export class ThreadSt {
774
783
  return a.none !== undefined ? 'rework' : undefined
775
784
  }
776
785
 
777
- /** the owner's tone on a question (sendNote): ok takes the agent's pick, a fix the pick with the owner's words; a rework, a wrong
778
- * direction or your call goes as his answer in that tone (store.ts answerAsk `tone`) */
786
+ /** the owner's answer from a question's bar (sendNote, tones.ts questionTones): a pick or a pick with a remark of the
787
+ * option `option`; none of these, your call or no answer goes as his answer in that tone (store.ts answerAsk `tone`) */
779
788
  private answerTone(c: ReplyCell, status: ItemVerdict, text: string, option?: number): Promise<void> {
780
- const pick = option ?? c.ask?.pick
781
- if ((status === 'approved' || status === 'approved-with-fix') && pick !== undefined) return this.pickOption(c, pick, status === 'approved' ? '' : text)
782
789
  if (status === 'approved' || status === 'approved-with-fix') {
783
- this.failed = { on: c.id, why: 'the agent named no pick: click an option above' }
790
+ if (option !== undefined) return this.pickOption(c, option, status === 'approved' ? '' : text)
791
+ this.failed = { on: c.id, why: 'click an option above to pick it' }
784
792
  return Promise.resolve()
785
793
  }
786
794
  return this.save(c.id, status, () => postJson(this.rv.url(`/api/review/${c.on}/answer`), { re: c.id.slice(c.on.length + 1), tone: status, ...(text !== '' ? { text } : {}) }), false)