teamsmith 0.1.2 → 0.3.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/README.md +13 -7
- package/package.json +1 -1
- package/skills/teamsmith/CHANGELOG.md +67 -0
- package/skills/teamsmith/SKILL.md +26 -8
- package/skills/teamsmith/extension/team-notify.ts +37 -6
- package/skills/teamsmith/extension/team.ts +438 -0
- package/skills/teamsmith/references/agent-adapters.md +7 -7
- package/skills/teamsmith/references/config.md +65 -18
- package/skills/teamsmith/references/migration.md +220 -34
- package/skills/teamsmith/references/protocol.md +250 -25
- package/skills/teamsmith/references/troubleshooting.md +124 -7
- package/skills/teamsmith/references/workflows.md +66 -20
- package/skills/teamsmith/scripts/lib/cmd-agents.sh +525 -90
- package/skills/teamsmith/scripts/lib/cmd-bootstrap.sh +71 -10
- package/skills/teamsmith/scripts/lib/cmd-config.sh +562 -128
- package/skills/teamsmith/scripts/lib/cmd-death.sh +2 -15
- package/skills/teamsmith/scripts/lib/cmd-docs.sh +6 -3
- package/skills/teamsmith/scripts/lib/cmd-draft.sh +4 -4
- package/skills/teamsmith/scripts/lib/cmd-help.sh +677 -0
- package/skills/teamsmith/scripts/lib/cmd-init.sh +157 -5
- package/skills/teamsmith/scripts/lib/cmd-interrupt.sh +461 -0
- package/skills/teamsmith/scripts/lib/cmd-meeting.sh +2 -25
- package/skills/teamsmith/scripts/lib/cmd-project.sh +149 -105
- package/skills/teamsmith/scripts/lib/cmd-reap.sh +277 -0
- package/skills/teamsmith/scripts/lib/cmd-reply.sh +96 -0
- package/skills/teamsmith/scripts/lib/cmd-review.sh +188 -40
- package/skills/teamsmith/scripts/lib/cmd-status.sh +268 -30
- package/skills/teamsmith/scripts/lib/cmd-update.sh +36 -7
- package/skills/teamsmith/scripts/lib/cmd-watch.sh +634 -54
- package/skills/teamsmith/scripts/lib/common.sh +1560 -109
- package/skills/teamsmith/scripts/lib/gate-lock.sh +544 -0
- package/skills/teamsmith/scripts/monitor.mjs +34 -3
- package/skills/teamsmith/scripts/panel/README.md +22 -11
- package/skills/teamsmith/scripts/panel/draft-send.sh +11 -1
- package/skills/teamsmith/scripts/panel/panel.js +226 -224
- package/skills/teamsmith/scripts/panel/src/App.tsx +478 -184
- package/skills/teamsmith/scripts/panel/src/clipboard.ts +11 -5
- package/skills/teamsmith/scripts/panel/src/compose.ts +6 -3
- package/skills/teamsmith/scripts/panel/src/data.ts +95 -7
- package/skills/teamsmith/scripts/panel/src/layout.ts +703 -152
- package/skills/teamsmith/scripts/panel/src/main.tsx +129 -19
- package/skills/teamsmith/scripts/panel/src/settings.ts +1 -1
- package/skills/teamsmith/scripts/panel/src/strings/en.ts +76 -31
- package/skills/teamsmith/scripts/panel/src/strings/zh.ts +78 -33
- package/skills/teamsmith/scripts/panel/src/types.ts +204 -17
- package/skills/teamsmith/scripts/replies.mjs +896 -0
- package/skills/teamsmith/scripts/shim/tmux +18 -0
- package/skills/teamsmith/scripts/strings/commands.tsv +86 -0
- package/skills/teamsmith/scripts/strings/help.en.tsv +503 -0
- package/skills/teamsmith/scripts/strings/help.zh.tsv +489 -0
- package/skills/teamsmith/scripts/team +20 -6
- package/skills/teamsmith/templates/AGENTS.section.md.tmpl +23 -3
- package/skills/teamsmith/templates/BOARD.md.tmpl +2 -2
- package/skills/teamsmith/templates/OWNERSHIP.md.tmpl +7 -3
- package/skills/teamsmith/templates/PROTOCOL.md.tmpl +17 -0
- package/skills/teamsmith/templates/config.sh.tmpl +29 -5
- package/skills/teamsmith/templates/memory-seed.md.tmpl +3 -0
- package/skills/teamsmith/templates/pm-prompt.md.tmpl +41 -1
- package/skills/teamsmith/templates/report.md.tmpl +12 -0
- package/skills/teamsmith/templates/task.md.tmpl +4 -0
- package/skills/teamsmith/tests/bg-ledger-harness.mjs +464 -40
- package/skills/teamsmith/tests/bg-ledger.sh +168 -10
- package/skills/teamsmith/tests/checkout-shape-probe.sh +3 -1
- package/skills/teamsmith/tests/config-cli.sh +320 -300
- package/skills/teamsmith/tests/death-cause.sh +5 -2
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/scenario.sh +7 -1
- package/skills/teamsmith/tests/fixtures/p287/lint-good.sh.in +3 -0
- package/skills/teamsmith/tests/fixtures/p287/lint-hardcoded.sh.in +3 -0
- package/skills/teamsmith/tests/fixtures/p287/lint-no-ns.sh.in +3 -0
- package/skills/teamsmith/tests/fixtures/p55/flip-p49.sh +18 -6
- package/skills/teamsmith/tests/flip-m33.sh +5 -3
- package/skills/teamsmith/tests/flip-m37.sh +4 -1
- package/skills/teamsmith/tests/flip-m4.3.sh +4 -1
- package/skills/teamsmith/tests/flip-m6.3.sh +4 -1
- package/skills/teamsmith/tests/flip-m6.5.sh +4 -1
- package/skills/teamsmith/tests/flip-m7.2.sh +4 -1
- package/skills/teamsmith/tests/flip-p158.sh +2 -1
- package/skills/teamsmith/tests/flip-p210.sh +4 -1
- package/skills/teamsmith/tests/flip-p217.sh +4 -1
- package/skills/teamsmith/tests/flip-p287-lock.sh +342 -0
- package/skills/teamsmith/tests/flip-p287-name.sh +279 -0
- package/skills/teamsmith/tests/flip-p304-read-side.sh +98 -0
- package/skills/teamsmith/tests/flip-p308-skip-not-pass.sh +151 -0
- package/skills/teamsmith/tests/flip-p309-p162-deep.sh +122 -0
- package/skills/teamsmith/tests/flip-p310-lock.sh +216 -0
- package/skills/teamsmith/tests/flip-p310-socket.sh +125 -0
- package/skills/teamsmith/tests/help-surface.sh +1664 -0
- package/skills/teamsmith/tests/install-shape.sh +283 -22
- package/skills/teamsmith/tests/key-replies-pty.sh +374 -0
- package/skills/teamsmith/tests/key-replies-ui.sh +325 -0
- package/skills/teamsmith/tests/key-replies.sh +1314 -0
- package/skills/teamsmith/tests/ledger-ban.sh +9 -8
- package/skills/teamsmith/tests/ledger-claim.sh +248 -0
- package/skills/teamsmith/tests/lib/bounded-spin.sh +90 -0
- package/skills/teamsmith/tests/lib/model-policy.sh +30 -0
- package/skills/teamsmith/tests/lib/model-routing-boundary.sh +420 -0
- package/skills/teamsmith/tests/lib/model-routing-expansion.sh +155 -0
- package/skills/teamsmith/tests/lib/model-routing-flips.py +187 -0
- package/skills/teamsmith/tests/lib/model-routing-roles.sh +250 -0
- package/skills/teamsmith/tests/lib/proc-io.sh +103 -0
- package/skills/teamsmith/tests/lib/reply-fixture.sh +367 -0
- package/skills/teamsmith/tests/lib/section-guard.sh +258 -13
- package/skills/teamsmith/tests/lib/tmp-root.sh +139 -27
- package/skills/teamsmith/tests/lib/tmux-cap.sh +10 -1
- package/skills/teamsmith/tests/lib/tmux-iso.sh +39 -13
- package/skills/teamsmith/tests/loop-inventory.tsv +59 -47
- package/skills/teamsmith/tests/panel-b2.sh +107 -4
- package/skills/teamsmith/tests/panel-b3-stub.sh +139 -4
- package/skills/teamsmith/tests/panel-b3.sh +189 -29
- package/skills/teamsmith/tests/panel-choices.sh +81 -63
- package/skills/teamsmith/tests/panel-cpu.sh +3 -2
- package/skills/teamsmith/tests/panel-knobs.sh +7 -1
- package/skills/teamsmith/tests/panel-p21.sh +445 -241
- package/skills/teamsmith/tests/panel-snapshots.sh +41 -225
- package/skills/teamsmith/tests/panel-strings.mjs +33 -18
- package/skills/teamsmith/tests/perf.sh +122 -31
- package/skills/teamsmith/tests/pm-box-real.sh +1 -1
- package/skills/teamsmith/tests/pulse-nudge-key.sh +1 -1
- package/skills/teamsmith/tests/routes.sh +364 -109
- package/skills/teamsmith/tests/seat-interrupt.sh +1002 -0
- package/skills/teamsmith/tests/seat-visibility.sh +675 -0
- package/skills/teamsmith/tests/section-budgets.tsv +26 -12
- package/skills/teamsmith/tests/section-guard.sh +6 -1
- package/skills/teamsmith/tests/section-needs-audit.sh +24 -7
- package/skills/teamsmith/tests/section-paths.tsv +42 -26
- package/skills/teamsmith/tests/section-select.sh +90 -7
- package/skills/teamsmith/tests/slash-team-e2e.sh +323 -0
- package/skills/teamsmith/tests/slash-team.sh +617 -0
- package/skills/teamsmith/tests/smoke.sh +3762 -628
- package/skills/teamsmith/tests/snapshots/zh-dark-120-detail.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-dark-120-p4.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-dark-120.txt +9 -9
- package/skills/teamsmith/tests/snapshots/zh-dark-160-p4.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-dark-160.txt +9 -9
- package/skills/teamsmith/tests/snapshots/zh-dark-59-detail.txt +1 -1
- package/skills/teamsmith/tests/snapshots/zh-dark-59-p4.txt +1 -1
- package/skills/teamsmith/tests/snapshots/zh-dark-59.txt +5 -5
- package/skills/teamsmith/tests/snapshots/zh-dark-99-p4.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-dark-99.txt +5 -5
- package/skills/teamsmith/tests/snapshots/zh-light-120-detail.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-light-120-p4.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-light-120.txt +9 -9
- package/skills/teamsmith/tests/snapshots/zh-light-160-p4.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-light-160.txt +9 -9
- package/skills/teamsmith/tests/snapshots/zh-light-59-detail.txt +1 -1
- package/skills/teamsmith/tests/snapshots/zh-light-59-p4.txt +1 -1
- package/skills/teamsmith/tests/snapshots/zh-light-59.txt +5 -5
- package/skills/teamsmith/tests/snapshots/zh-light-99-p4.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-light-99.txt +5 -5
- package/skills/teamsmith/tests/task-header-model.sh +2 -1
- package/skills/teamsmith/tests/task-model-routing.sh +1511 -0
- package/skills/teamsmith/tests/tmp-hygiene.sh +782 -45
- package/skills/teamsmith/tests/tmux-identity-leak.sh +773 -0
- package/skills/teamsmith/tests/tmux-lint-legacy.txt +12 -18
- package/skills/teamsmith/tests/upgrade-recipe.sh +537 -0
- package/skills/teamsmith-init/SKILL.md +43 -43
- package/skills/teamsmith-init/references/bootstrap.md +8 -6
- package/skills/teamsmith-init/templates/bootstrap-prompt.md.tmpl +9 -5
|
@@ -12,13 +12,32 @@
|
|
|
12
12
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
13
13
|
import { writeSync } from 'node:fs'
|
|
14
14
|
import { Box, Text, useApp, useCursor, useInput } from 'ink'
|
|
15
|
-
import { layout, resolveFocus, focusRefOf, focusRow, rowKey, settingsViewRows } from './layout.js'
|
|
16
|
-
import type { LayoutInput } from './layout.js'
|
|
15
|
+
import { layout, resolveFocus, focusRefOf, focusRow, rowKey, settingsRowFocusable, settingsViewRows, boardFocusRef, rowSourceOf } from './layout.js'
|
|
16
|
+
import type { LayoutInput, SettingsRow } from './layout.js'
|
|
17
17
|
import { clockOf } from './format.js'
|
|
18
18
|
import { fill, stringsFor, type Strings } from './strings/index.js'
|
|
19
19
|
import { composeKey, cpLength, cursorView, insertAt, intake, killSpan, moveCursor, popUndo, pushKill, pushUndo, receiptLine, resetKillDirection, ringEntry, type ComposeMode, type ComposeView, type KillRing, type Receipt, type UndoSnapshot } from './compose.js'
|
|
20
20
|
import type { Settings } from './settings.js'
|
|
21
|
-
import type {
|
|
21
|
+
import type {
|
|
22
|
+
Action,
|
|
23
|
+
DetailWindow,
|
|
24
|
+
DetailSource,
|
|
25
|
+
FocusRef,
|
|
26
|
+
FrameInput,
|
|
27
|
+
PageId,
|
|
28
|
+
PrefName,
|
|
29
|
+
ReplyDocWindow,
|
|
30
|
+
ReplyEntry,
|
|
31
|
+
ReplyWindow,
|
|
32
|
+
Segment,
|
|
33
|
+
SettingsBlock,
|
|
34
|
+
SettingsCategory,
|
|
35
|
+
SettingsChoiceEntry,
|
|
36
|
+
SettingsChoicePicker,
|
|
37
|
+
SettingsKey,
|
|
38
|
+
SettingsWindow,
|
|
39
|
+
ViewState,
|
|
40
|
+
} from './types.js'
|
|
22
41
|
import type { Palette } from './theme.js'
|
|
23
42
|
import { dispWidth } from './width.js'
|
|
24
43
|
|
|
@@ -27,13 +46,17 @@ const TRAY_TR = '╮'
|
|
|
27
46
|
const TRAY_H = '─'
|
|
28
47
|
const TRAY_V = '│'
|
|
29
48
|
|
|
49
|
+
/** The focusable row of the view as the App walks it (headings are skipped). */
|
|
50
|
+
type SettingsFocusRow = Extract<SettingsRow, { kind: 'key' | 'category' | 'assignment' | 'pm-launch' }>
|
|
51
|
+
|
|
30
52
|
/**
|
|
31
53
|
* The kinds whose editor is the choice picker (M55). `enum` joins only when the command reports
|
|
32
54
|
* values (an enum with no constraints has no choice set: R3's visible fallback names the reason),
|
|
33
55
|
* and a key the command reports without a `choices` object falls back to the compose editor — the
|
|
34
|
-
* bundle works against an older command instead of inventing options.
|
|
56
|
+
* bundle works against an older command instead of inventing options. `task-model-map` is
|
|
57
|
+
* deliberately absent: its editor is the categories block (P232), never a composed pair list.
|
|
35
58
|
*/
|
|
36
|
-
const CHOICE_KINDS = new Set(['bool', 'enum', 'int', 'seconds', 'mb', 'bytes', 'pct', 'path', 'model', '
|
|
59
|
+
const CHOICE_KINDS = new Set(['bool', 'enum', 'int', 'seconds', 'mb', 'bytes', 'pct', 'path', 'model', 'winlist', 'pattern'])
|
|
37
60
|
const NUMERIC_KINDS = new Set(['int', 'seconds', 'mb', 'bytes', 'pct'])
|
|
38
61
|
|
|
39
62
|
function hasChoiceEditor(key: SettingsKey): boolean {
|
|
@@ -59,8 +82,10 @@ function composeTrayTop(title: string, width: number): string {
|
|
|
59
82
|
/** The console's own actions, owned by main.tsx (file I/O, subprocesses, the editor relay). */
|
|
60
83
|
export interface PanelApi {
|
|
61
84
|
readDraft(): string
|
|
62
|
-
|
|
63
|
-
|
|
85
|
+
/** Persist the draft; false when the file could not be written (the settle reads this). */
|
|
86
|
+
writeDraft(text: string): boolean
|
|
87
|
+
/** Empty `state/draft.md`; false when the file could not be emptied (P249). */
|
|
88
|
+
clearDraft(): boolean
|
|
64
89
|
send(text: string): Promise<Receipt>
|
|
65
90
|
flushQueue(): Promise<{ ok: boolean; line: string }>
|
|
66
91
|
setStandby(on: boolean, reason: string): Promise<{ ok: boolean; line: string }>
|
|
@@ -93,9 +118,18 @@ export interface PanelApi {
|
|
|
93
118
|
/**
|
|
94
119
|
* Tell the cache which entry's detail view is open (null = closed). While an id is set the
|
|
95
120
|
* `detail` block joins the wanted set; `file` selects the repo-relative path to serve (the first
|
|
96
|
-
* discovered file when omitted)
|
|
121
|
+
* discovered file when omitted) and `source` the read-only preview family the id addresses
|
|
122
|
+
* (P249; absent/`entry` is the original entry-id discovery). All three are cached options, so an
|
|
123
|
+
* unchanged call rebuilds nothing.
|
|
124
|
+
*/
|
|
125
|
+
setDetail(id: string | null, file?: string | null, source?: DetailSource | null): void
|
|
126
|
+
/**
|
|
127
|
+
* Page 5's demand reads (pulse-key-replies): the list cursor (`before`, null = the newest page and
|
|
128
|
+
* null also drops the list from the wanted set when the page is parked) and the open viewer's
|
|
129
|
+
* number (`no`, null = closed). Both are request keys: changing one clears the cached block, kills
|
|
130
|
+
* the child still in flight and makes a late response for the old key a no-op.
|
|
97
131
|
*/
|
|
98
|
-
|
|
132
|
+
setReply(opts: { list: boolean; before: number | null; no: number | null }): void
|
|
99
133
|
/** Rebuild the patrol window as the headless tick loop (`team pulse collapse`). */
|
|
100
134
|
collapse(): Promise<{ ok: boolean; line: string }>
|
|
101
135
|
/** Represents one `team config set` result: the exit code (the machine contract) + one line. */
|
|
@@ -110,9 +144,9 @@ export interface PanelApi {
|
|
|
110
144
|
* next interaction sees. Never awaited on the interaction path.
|
|
111
145
|
*/
|
|
112
146
|
refreshSettingsSoon(): void
|
|
113
|
-
/** One `team config set-
|
|
114
|
-
|
|
115
|
-
|
|
147
|
+
/** One `team config set-task-model <category> <model>` invocation (P232). */
|
|
148
|
+
setTaskModel(
|
|
149
|
+
category: string,
|
|
116
150
|
model: string,
|
|
117
151
|
opts: { dryRun?: boolean; fingerprint?: string | null },
|
|
118
152
|
): Promise<{ code: number; line: string }>
|
|
@@ -259,8 +293,17 @@ export function App({
|
|
|
259
293
|
// The open detail view's entry id (the board page's Enter / a click on the focused card), its
|
|
260
294
|
// tab and its document scroll. The view is read-only: no key of its own beyond navigation.
|
|
261
295
|
const [detailId, setDetailId] = useState<string | null>(null)
|
|
296
|
+
const [detailSource, setDetailSource] = useState<DetailSource>('entry')
|
|
262
297
|
const [detailIndex, setDetailIndex] = useState(0)
|
|
263
298
|
const [detailScroll, setDetailScroll] = useState(0)
|
|
299
|
+
// Page 5 (pulse-key-replies): the cursor chain, the stable-number focus, the open body and the
|
|
300
|
+
// document's scroll. `replyStack` is the chain `Newer` walks back through — no full-history load.
|
|
301
|
+
const [replyFocus, setReplyFocus] = useState<number | null>(null)
|
|
302
|
+
const [replyCursor, setReplyCursor] = useState<number | null>(null)
|
|
303
|
+
const [replyStack, setReplyStack] = useState<number[]>([])
|
|
304
|
+
const [replyBody, setReplyBody] = useState<number | null>(null)
|
|
305
|
+
const [replyScroll, setReplyScroll] = useState(0)
|
|
306
|
+
const [replyOffset, setReplyOffset] = useState<number | null>(null)
|
|
264
307
|
// P22/B2: the project-settings view (opened from the overlay's navigation row), its window and
|
|
265
308
|
// its filter. The view is a view, not a page: the four-page composition and `state/panel-page`
|
|
266
309
|
// keep their meaning, and `esc` lands back on the overlay row it was opened from.
|
|
@@ -276,9 +319,7 @@ export function App({
|
|
|
276
319
|
const [settingsOffset, setSettingsOffset] = useState<number | null>(null)
|
|
277
320
|
/** The pending two-step write confirmation ({danger} = the command answered 7). */
|
|
278
321
|
const [settingConfirm, setSettingConfirm] = useState<{ key: string; next: string; danger: boolean } | null>(null)
|
|
279
|
-
/** The
|
|
280
|
-
const [seatPicker, setSeatPicker] = useState<{ agent: string; row: number; models: string[]; index: number } | null>(null)
|
|
281
|
-
/** The choice picker (M55): the key's schema-derived entries and the selection. */
|
|
322
|
+
/** The choice picker (M55/P232): the row's schema-derived entries and the selection. */
|
|
282
323
|
const [choicePicker, setChoicePicker] = useState<SettingsChoicePicker | null>(null)
|
|
283
324
|
const { exit } = useApp()
|
|
284
325
|
const scrollRef = useRef(0)
|
|
@@ -299,6 +340,17 @@ export function App({
|
|
|
299
340
|
const pasteOpenRef = useRef(false)
|
|
300
341
|
const settingsRef = useRef(settings)
|
|
301
342
|
const pageRef = useRef(page)
|
|
343
|
+
const replyFocusRef = useRef(replyFocus)
|
|
344
|
+
replyFocusRef.current = replyFocus
|
|
345
|
+
const replyCursorRef = useRef(replyCursor)
|
|
346
|
+
replyCursorRef.current = replyCursor
|
|
347
|
+
const replyStackRef = useRef(replyStack)
|
|
348
|
+
replyStackRef.current = replyStack
|
|
349
|
+
const replyBodyRef = useRef(replyBody)
|
|
350
|
+
replyBodyRef.current = replyBody
|
|
351
|
+
/** Page 5's list window / the viewer's document window as the last frame rendered them. */
|
|
352
|
+
const replyListRef = useRef<ReplyWindow | null>(null)
|
|
353
|
+
const replyDocRef = useRef<ReplyDocWindow | null>(null)
|
|
302
354
|
const targetsRef = useRef<{ row: number; hit: { start: number; end: number; action: Action } }[]>([])
|
|
303
355
|
const overlayIndexRef = useRef(0)
|
|
304
356
|
const focusRef = useRef<FocusRef | null>(null)
|
|
@@ -316,10 +368,12 @@ export function App({
|
|
|
316
368
|
const settingsOffsetRef = useRef<number | null>(null)
|
|
317
369
|
/** The row window the last frame drew (the wheel and the focus keys clamp against it). */
|
|
318
370
|
const settingsWindowRef = useRef<SettingsWindow | null>(null)
|
|
319
|
-
/**
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
371
|
+
/**
|
|
372
|
+
* The row the open `setting` editor writes (the fingerprint was pinned when it opened).
|
|
373
|
+
* `category` is set when the row is a task category: the same editor then writes through
|
|
374
|
+
* `team config set-task-model <category> <model>` instead of `team config set <KEY>` (P232).
|
|
375
|
+
*/
|
|
376
|
+
const settingRowRef = useRef<{ row: number; key: string; value: string; cls: string; fingerprint: string; category?: string; kind?: string; choices?: SettingsKey['choices'] } | null>(null)
|
|
323
377
|
const choicePickerRef = useRef<SettingsChoicePicker | null>(null)
|
|
324
378
|
choicePickerRef.current = choicePicker
|
|
325
379
|
const settingConfirmRef = useRef<{ key: string; next: string; danger: boolean } | null>(null)
|
|
@@ -360,10 +414,24 @@ export function App({
|
|
|
360
414
|
|
|
361
415
|
const goPage = useCallback(
|
|
362
416
|
(next: PageId) => {
|
|
417
|
+
const previous = pageRef.current
|
|
363
418
|
pageRef.current = next
|
|
364
419
|
setPage(next)
|
|
420
|
+
// Page 5's demand reads follow the page: entering it starts a fresh newest chain, leaving it
|
|
421
|
+
// closes the viewer — which is what drops the `reply_body` request (design §4: no body read
|
|
422
|
+
// after leaving page 5).
|
|
423
|
+
if (next === 5 && previous !== 5) {
|
|
424
|
+
setReplyCursor(null)
|
|
425
|
+
setReplyStack([])
|
|
426
|
+
setReplyFocus(null)
|
|
427
|
+
setReplyOffset(null)
|
|
428
|
+
setReplyBody(null)
|
|
429
|
+
} else if (next !== 5) {
|
|
430
|
+
setReplyBody(null)
|
|
431
|
+
}
|
|
365
432
|
setViewEntry(null)
|
|
366
433
|
setDetailId(null)
|
|
434
|
+
setDetailSource('entry')
|
|
367
435
|
setDetailIndex(0)
|
|
368
436
|
setDetailScroll(0)
|
|
369
437
|
api.savePage(next)
|
|
@@ -521,12 +589,18 @@ export function App({
|
|
|
521
589
|
const conf = settingConfirmRef.current
|
|
522
590
|
const timing =
|
|
523
591
|
target.cls === 'restart' ? stringsRef.current.settingTimingRestart : stringsRef.current.settingTimingApply
|
|
524
|
-
|
|
525
|
-
|
|
592
|
+
// P232: a category row keeps the same editor, but its write is the CLI's per-category
|
|
593
|
+
// command (`set-task-model`) — the console never composes the pair list.
|
|
526
594
|
const call = (dryRun: boolean, allowDanger: boolean): Promise<{ code: number; line: string }> =>
|
|
527
|
-
|
|
528
|
-
? api.
|
|
595
|
+
target.category
|
|
596
|
+
? api.setTaskModel(target.category, text, { dryRun, fingerprint: target.fingerprint })
|
|
529
597
|
: api.setSetting(target.key, text, { dryRun, fingerprint: target.fingerprint, allowDanger })
|
|
598
|
+
const written = (): string =>
|
|
599
|
+
target.category
|
|
600
|
+
? fill(stringsRef.current.settingCategoryWritten, { category: target.category, value: text })
|
|
601
|
+
: target.key === 'TEAM_PM_MODEL'
|
|
602
|
+
? fill(stringsRef.current.settingPmWritten, { value: text })
|
|
603
|
+
: fill(stringsRef.current.settingWritten, { key: target.key, value: text, timing })
|
|
530
604
|
if (!conf) {
|
|
531
605
|
const r = await call(true, false)
|
|
532
606
|
if (r.code === 0) {
|
|
@@ -534,11 +608,11 @@ export function App({
|
|
|
534
608
|
setSettingConfirm(settingConfirmRef.current)
|
|
535
609
|
setReceipt(null)
|
|
536
610
|
setStatus(
|
|
537
|
-
|
|
538
|
-
? fill(stringsRef.current.
|
|
539
|
-
|
|
611
|
+
target.category
|
|
612
|
+
? fill(stringsRef.current.settingCategoryConfirm, {
|
|
613
|
+
category: target.category,
|
|
540
614
|
old: target.value || stringsRef.current.dash,
|
|
541
|
-
next:
|
|
615
|
+
next: text,
|
|
542
616
|
})
|
|
543
617
|
: fill(stringsRef.current.settingConfirm, {
|
|
544
618
|
key: target.key,
|
|
@@ -570,14 +644,7 @@ export function App({
|
|
|
570
644
|
const r = await call(false, conf.danger)
|
|
571
645
|
if (r.code === 0) {
|
|
572
646
|
setReceipt(null)
|
|
573
|
-
|
|
574
|
-
setStatus(
|
|
575
|
-
isSeat
|
|
576
|
-
? seatModel === '-'
|
|
577
|
-
? fill(stringsRef.current.settingSeatRemoved, { seat: target.seat as string, value: fallback || stringsRef.current.dash })
|
|
578
|
-
: fill(stringsRef.current.settingSeatWritten, { seat: target.seat as string, value: seatModel })
|
|
579
|
-
: fill(stringsRef.current.settingWritten, { key: target.key, value: text, timing }),
|
|
580
|
-
)
|
|
647
|
+
setStatus(written())
|
|
581
648
|
settingRowRef.current = null
|
|
582
649
|
settingConfirmRef.current = null
|
|
583
650
|
setSettingConfirm(null)
|
|
@@ -632,14 +699,24 @@ export function App({
|
|
|
632
699
|
setBusy(true)
|
|
633
700
|
try {
|
|
634
701
|
const r = await api.send(text)
|
|
635
|
-
setReceipt(r.state === 'error' ? r : { ...r, detail: '' })
|
|
636
702
|
setStatus(null)
|
|
637
|
-
if (r.state
|
|
703
|
+
if (r.state === 'error') {
|
|
704
|
+
// The error class keeps every word and stays in the editor: nothing durable holds the text,
|
|
705
|
+
// so the input line is the retry handle and the next Enter tries again (the receipt rides
|
|
706
|
+
// the hint row while the compose stays open).
|
|
707
|
+
setReceipt(r)
|
|
708
|
+
} else if (api.clearDraft()) {
|
|
709
|
+
// Settled and the file is empty: the input line may follow it (memory = disk).
|
|
638
710
|
updateDraft('', false)
|
|
639
711
|
setPoint(0)
|
|
640
|
-
|
|
712
|
+
setReceipt({ ...r, detail: '' })
|
|
713
|
+
setComposing(false)
|
|
714
|
+
} else {
|
|
715
|
+
// Settled, but `state/draft.md` could not be emptied: the memory copy must not be dropped
|
|
716
|
+
// (that was the ghost draft), so the words stay in the editor and the receipt names the
|
|
717
|
+
// file it could not empty.
|
|
718
|
+
setReceipt({ ...r, detail: fill(stringsRef.current.draftNotCleared, { file: 'state/draft.md' }) })
|
|
641
719
|
}
|
|
642
|
-
setComposing(false)
|
|
643
720
|
} finally {
|
|
644
721
|
sendingRef.current = false
|
|
645
722
|
setBusy(false)
|
|
@@ -745,9 +822,10 @@ export function App({
|
|
|
745
822
|
next.lang = cur.lang === 'zh' ? 'en' : 'zh'
|
|
746
823
|
break
|
|
747
824
|
case 'defaultPage':
|
|
748
|
-
//
|
|
749
|
-
//
|
|
750
|
-
|
|
825
|
+
// Five pages since pulse-key-replies: the cycle covers 1–5 and wraps (a cycle that still
|
|
826
|
+
// stopped at 4 would leave 5 unreachable as a remembered default and reset it on the next
|
|
827
|
+
// launch — the silent reset this branch exists to avoid).
|
|
828
|
+
next.defaultPage = cur.defaultPage === 5 ? 1 : ((cur.defaultPage + 1) as PageId)
|
|
751
829
|
goPage(next.defaultPage)
|
|
752
830
|
break
|
|
753
831
|
case 'activity':
|
|
@@ -870,8 +948,9 @@ export function App({
|
|
|
870
948
|
const cur = focusRef.current
|
|
871
949
|
let idx = -1
|
|
872
950
|
if (cur) {
|
|
873
|
-
|
|
874
|
-
|
|
951
|
+
// The row is matched by its block scope too: two blocks may draw the same id (P249).
|
|
952
|
+
idx = order.findIndex((r) => r.lane === cur.lane && r.id === cur.id && (r.nth ?? 0) === (cur.nth ?? 0))
|
|
953
|
+
if (idx < 0) idx = order.findIndex((r) => r.lane === cur.lane && r.id === cur.id)
|
|
875
954
|
}
|
|
876
955
|
if (idx < 0) {
|
|
877
956
|
setFocus(order[0])
|
|
@@ -887,30 +966,35 @@ export function App({
|
|
|
887
966
|
setLaneOffset((prev) => ({ ...prev, [lane]: Math.max(0, Math.min(max, (prev[lane] ?? (win?.offset ?? 0)) + delta)) }))
|
|
888
967
|
}, [])
|
|
889
968
|
|
|
890
|
-
/** Open an entry's detail view: the first tab, from the top (the board page's Enter / a click).
|
|
891
|
-
|
|
969
|
+
/** Open an entry's detail view: the first tab, from the top (the board page's Enter / a click).
|
|
970
|
+
* The source is fixed by the surface that opened it (P249) and rides every reader request. */
|
|
971
|
+
const openDetail = useCallback((id: string, source: DetailSource = 'entry') => {
|
|
892
972
|
setDetailIndex(0)
|
|
893
973
|
setDetailScroll(0)
|
|
974
|
+
setDetailSource(source)
|
|
894
975
|
setDetailId(id)
|
|
895
976
|
}, [])
|
|
896
977
|
|
|
897
|
-
/** Enter on the work page: open the focused row (or the first drawn one, when it left the board).
|
|
978
|
+
/** Enter on the work page: open the focused row (or the first drawn one, when it left the board).
|
|
979
|
+
* The page-wide order carries each row's block scope, and the scope picks the reader's source. */
|
|
898
980
|
const openWorkFocused = useCallback(() => {
|
|
899
981
|
const order = boardOrderRef.current
|
|
900
982
|
if (!order.length) return
|
|
901
983
|
const cur = focusRef.current
|
|
902
984
|
const hit = cur
|
|
903
|
-
? order.find((r) => r.id === cur.id && (r.nth ?? 0) === (cur.nth ?? 0)) ??
|
|
985
|
+
? order.find((r) => r.lane === cur.lane && r.id === cur.id && (r.nth ?? 0) === (cur.nth ?? 0)) ??
|
|
986
|
+
order.find((r) => r.lane === cur.lane && r.id === cur.id)
|
|
904
987
|
: undefined
|
|
905
|
-
|
|
988
|
+
const row = hit ?? order[0]
|
|
989
|
+
openDetail(row.id, rowSourceOf(row.lane))
|
|
906
990
|
}, [openDetail])
|
|
907
991
|
|
|
908
992
|
// ---- project settings (P22/B2): the view's focus walk, its origin and its row opening.
|
|
909
993
|
|
|
910
994
|
/** The view's focusable rows as the last assembly saw them (the walk must match the screen). */
|
|
911
|
-
const settingsRowsNow = useCallback(():
|
|
995
|
+
const settingsRowsNow = useCallback((): SettingsFocusRow[] => {
|
|
912
996
|
const rows = settingsViewRows(dataRef.current.blocks?.settings, settingsFilterRef.current, stringsRef.current)
|
|
913
|
-
return rows.filter(
|
|
997
|
+
return rows.filter(settingsRowFocusable)
|
|
914
998
|
}, [])
|
|
915
999
|
|
|
916
1000
|
const moveSettingsFocus = useCallback(
|
|
@@ -991,7 +1075,7 @@ export function App({
|
|
|
991
1075
|
pushValue(key.value, 'current')
|
|
992
1076
|
pushValue(key.default, 'default')
|
|
993
1077
|
for (const v of values) pushValue(v, 'value')
|
|
994
|
-
if (kind === 'bool' || kind === 'enum'
|
|
1078
|
+
if (kind === 'bool' || kind === 'enum') return out
|
|
995
1079
|
if (kind === 'path') {
|
|
996
1080
|
if (ch.empty) out.push({ value: '', kind: 'clear' })
|
|
997
1081
|
out.push({ value: '', kind: 'free', seed: base })
|
|
@@ -1018,6 +1102,21 @@ export function App({
|
|
|
1018
1102
|
const choiceTarget = useCallback(
|
|
1019
1103
|
(picker: SettingsChoicePicker): NonNullable<typeof settingRowRef.current> => {
|
|
1020
1104
|
const rows = settingsRowsNow()
|
|
1105
|
+
const fingerprint = dataRef.current.blocks?.settings?.fingerprint ?? ''
|
|
1106
|
+
if (picker.category) {
|
|
1107
|
+
// P232: a category picker writes `set-task-model <category> <model>`; its "current" value is
|
|
1108
|
+
// the future policy's model for that category — read from the row the picker was opened on.
|
|
1109
|
+
const catNow = rows.find((r) => r.kind === 'category' && r.category.category === picker.key)
|
|
1110
|
+
return {
|
|
1111
|
+
row: picker.row,
|
|
1112
|
+
key: picker.key,
|
|
1113
|
+
value: catNow && catNow.kind === 'category' ? catNow.category.model : '',
|
|
1114
|
+
cls: 'apply',
|
|
1115
|
+
fingerprint,
|
|
1116
|
+
category: picker.key,
|
|
1117
|
+
kind: picker.kind,
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1021
1120
|
// By key name, not by index: the picker's row index is a focus index and the row list can be
|
|
1022
1121
|
// replaced by a settle re-read while the picker is open.
|
|
1023
1122
|
const rowNow = rows.find((r) => r.kind === 'key' && r.key.name === picker.key) ?? rows[picker.row]
|
|
@@ -1027,7 +1126,7 @@ export function App({
|
|
|
1027
1126
|
key: picker.key,
|
|
1028
1127
|
value: keyNow?.value ?? '',
|
|
1029
1128
|
cls: keyNow?.class ?? 'apply',
|
|
1030
|
-
fingerprint
|
|
1129
|
+
fingerprint,
|
|
1031
1130
|
kind: picker.kind,
|
|
1032
1131
|
choices: keyNow?.choices,
|
|
1033
1132
|
}
|
|
@@ -1051,11 +1150,23 @@ export function App({
|
|
|
1051
1150
|
setBusy(true)
|
|
1052
1151
|
const timing =
|
|
1053
1152
|
target.cls === 'restart' ? stringsRef.current.settingTimingRestart : stringsRef.current.settingTimingApply
|
|
1153
|
+
// P232: a category accept writes through the CLI's per-category command; a key accept keeps
|
|
1154
|
+
// the contract-set path. Both are the owning command's subprocess — never a direct write.
|
|
1155
|
+
const call = (dryRun: boolean, allowDanger: boolean): Promise<{ code: number; line: string }> =>
|
|
1156
|
+
target.category
|
|
1157
|
+
? api.setTaskModel(target.category, value, { dryRun, fingerprint: target.fingerprint })
|
|
1158
|
+
: api.setSetting(target.key, value, { dryRun, fingerprint: target.fingerprint, allowDanger })
|
|
1159
|
+
const writtenLine = (): string =>
|
|
1160
|
+
target.category
|
|
1161
|
+
? fill(stringsRef.current.settingCategoryWritten, { category: target.category, value })
|
|
1162
|
+
: target.key === 'TEAM_PM_MODEL'
|
|
1163
|
+
? fill(stringsRef.current.settingPmWritten, { value })
|
|
1164
|
+
: fill(stringsRef.current.settingWritten, { key: target.key, value, timing })
|
|
1054
1165
|
try {
|
|
1055
1166
|
const danger = choiceDangerRef.current
|
|
1056
1167
|
const dangerAccept = Boolean(danger && danger.key === target.key && danger.value === value)
|
|
1057
1168
|
if (!dangerAccept) {
|
|
1058
|
-
const dry = await
|
|
1169
|
+
const dry = await call(true, false)
|
|
1059
1170
|
if (dry.code === 7) {
|
|
1060
1171
|
choiceDangerRef.current = { key: target.key, value }
|
|
1061
1172
|
setReceipt(null)
|
|
@@ -1079,15 +1190,11 @@ export function App({
|
|
|
1079
1190
|
return
|
|
1080
1191
|
}
|
|
1081
1192
|
}
|
|
1082
|
-
const r = await
|
|
1083
|
-
dryRun: false,
|
|
1084
|
-
fingerprint: target.fingerprint,
|
|
1085
|
-
allowDanger: dangerAccept,
|
|
1086
|
-
})
|
|
1193
|
+
const r = await call(false, dangerAccept)
|
|
1087
1194
|
choiceDangerRef.current = null
|
|
1088
1195
|
if (r.code === 0) {
|
|
1089
1196
|
setReceipt(null)
|
|
1090
|
-
setStatus(
|
|
1197
|
+
setStatus(writtenLine())
|
|
1091
1198
|
settingRowRef.current = null
|
|
1092
1199
|
setChoicePicker(null)
|
|
1093
1200
|
choicePickerRef.current = null
|
|
@@ -1121,29 +1228,30 @@ export function App({
|
|
|
1121
1228
|
)
|
|
1122
1229
|
|
|
1123
1230
|
/**
|
|
1124
|
-
* The
|
|
1125
|
-
*
|
|
1126
|
-
* the
|
|
1127
|
-
* on screen.
|
|
1231
|
+
* The whole-map row's editor is the categories block (P232): `enter` moves the focus to the first
|
|
1232
|
+
* category row — no compose editor, no option list, and the pair list is never composed here. A
|
|
1233
|
+
* filter that hides the block is dropped, because otherwise "focus the categories block" would
|
|
1234
|
+
* name a row that is not on screen. When the policy carries no category at all (a legacy or empty
|
|
1235
|
+
* map) the block has nothing to focus: the CLI route is named instead, and nothing is written.
|
|
1128
1236
|
*/
|
|
1129
|
-
const
|
|
1237
|
+
const routeCategories = useCallback(() => {
|
|
1130
1238
|
const rows = settingsRowsNow()
|
|
1131
|
-
let
|
|
1132
|
-
if (
|
|
1239
|
+
let at = rows.findIndex((r) => r.kind === 'category')
|
|
1240
|
+
if (at < 0) {
|
|
1133
1241
|
settingsFilterRef.current = ''
|
|
1134
1242
|
setSettingsFilter('')
|
|
1135
1243
|
// The focus index counts focusable rows, not the group headings `settingsViewRows` also
|
|
1136
1244
|
// returns — counting those would land the cursor on the wrong row (or past the end).
|
|
1137
|
-
const all =
|
|
1138
|
-
|
|
1139
|
-
)
|
|
1140
|
-
seat = all.findIndex((r) => r.kind === 'seat')
|
|
1245
|
+
const all = settingsRowsNow()
|
|
1246
|
+
at = all.findIndex((r) => r.kind === 'category')
|
|
1141
1247
|
}
|
|
1142
1248
|
setChoicePicker(null)
|
|
1143
1249
|
choicePickerRef.current = null
|
|
1144
|
-
if (
|
|
1250
|
+
if (at >= 0) setSettingsFocus(at)
|
|
1145
1251
|
setReceipt(null)
|
|
1146
|
-
setStatus(
|
|
1252
|
+
setStatus(
|
|
1253
|
+
at >= 0 ? stringsRef.current.settingsCategoryMapHint : stringsRef.current.settingsCategoryMapEmpty,
|
|
1254
|
+
)
|
|
1147
1255
|
}, [settingsRowsNow])
|
|
1148
1256
|
|
|
1149
1257
|
/**
|
|
@@ -1232,8 +1340,6 @@ export function App({
|
|
|
1232
1340
|
setSettingsOffset(null)
|
|
1233
1341
|
settingsOffsetRef.current = null
|
|
1234
1342
|
settingsWindowRef.current = null
|
|
1235
|
-
setSeatPicker(null)
|
|
1236
|
-
seatPickerRef.current = null
|
|
1237
1343
|
setChoicePicker(null)
|
|
1238
1344
|
choicePickerRef.current = null
|
|
1239
1345
|
api.setSettingsOpen(false)
|
|
@@ -1243,9 +1349,40 @@ export function App({
|
|
|
1243
1349
|
overlayIndexRef.current = settingsOrigin
|
|
1244
1350
|
}, [api, settingsOrigin])
|
|
1245
1351
|
|
|
1352
|
+
/**
|
|
1353
|
+
* Builds the entries of a category picker (P232). The vocabulary is exactly the project's own:
|
|
1354
|
+
* the policy's model for the category when there is one, then the models the command reports as
|
|
1355
|
+
* known — plus the free-text entry. The machine's Pi catalogue is not a source here, and there is
|
|
1356
|
+
* no removal entry: the writer has no per-category delete, so the console must not invent one.
|
|
1357
|
+
*/
|
|
1358
|
+
const buildCategoryEntries = useCallback(
|
|
1359
|
+
(cat: SettingsCategory): SettingsChoiceEntry[] => {
|
|
1360
|
+
const known = dataRef.current.blocks?.settings?.models?.known ?? []
|
|
1361
|
+
const synthetic: SettingsKey = {
|
|
1362
|
+
name: cat.category,
|
|
1363
|
+
class: 'apply',
|
|
1364
|
+
kind: 'model',
|
|
1365
|
+
form: 'plain',
|
|
1366
|
+
value: cat.model,
|
|
1367
|
+
default: '',
|
|
1368
|
+
set: cat.model !== '',
|
|
1369
|
+
comment: '',
|
|
1370
|
+
warning: '',
|
|
1371
|
+
route: '',
|
|
1372
|
+
choices: { source: 'known', values: [...known], min: '', max: '', empty: false, note: '' },
|
|
1373
|
+
group: 'task-model',
|
|
1374
|
+
known: true,
|
|
1375
|
+
}
|
|
1376
|
+
return buildChoiceEntries(synthetic)
|
|
1377
|
+
},
|
|
1378
|
+
[buildChoiceEntries],
|
|
1379
|
+
)
|
|
1380
|
+
|
|
1246
1381
|
/**
|
|
1247
1382
|
* Enter on a view row: a `refuse` row opens no editor and surfaces the owning command's route;
|
|
1248
|
-
* an editable row opens the value editor (the compose line's `setting` mode, B3)
|
|
1383
|
+
* an editable row opens the value editor (the compose line's `setting` mode, B3); a category row
|
|
1384
|
+
* opens its own picker (P232); a committed assignment is read-only and only names the route that
|
|
1385
|
+
* decides it.
|
|
1249
1386
|
*/
|
|
1250
1387
|
const openSettingsRow = useCallback(
|
|
1251
1388
|
(index: number) => {
|
|
@@ -1255,20 +1392,45 @@ export function App({
|
|
|
1255
1392
|
const at = index < 0 ? settingsFocusRef.current : index
|
|
1256
1393
|
const row = rows[at]
|
|
1257
1394
|
if (!row) return
|
|
1258
|
-
if (row.kind === '
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1395
|
+
if (row.kind === 'category') {
|
|
1396
|
+
const entries = buildCategoryEntries(row.category)
|
|
1397
|
+
const picker: SettingsChoicePicker = {
|
|
1398
|
+
row: at,
|
|
1399
|
+
key: row.category.category,
|
|
1400
|
+
kind: 'model',
|
|
1401
|
+
entries,
|
|
1402
|
+
index: 0,
|
|
1403
|
+
interval: null,
|
|
1404
|
+
category: true,
|
|
1405
|
+
}
|
|
1406
|
+
choiceDangerRef.current = null
|
|
1407
|
+
setChoicePicker(picker)
|
|
1408
|
+
choicePickerRef.current = picker
|
|
1264
1409
|
setReceipt(null)
|
|
1265
1410
|
setStatus(null)
|
|
1266
1411
|
return
|
|
1267
1412
|
}
|
|
1413
|
+
if (row.kind === 'assignment' || row.kind === 'pm-launch') {
|
|
1414
|
+
// Read-only: the actual model is the committed record's, decided by dispatch/resume. The
|
|
1415
|
+
// console offers no editor for it (and never a "restart this seat" action).
|
|
1416
|
+
setReceipt(null)
|
|
1417
|
+
setChoicePicker(null)
|
|
1418
|
+
choicePickerRef.current = null
|
|
1419
|
+
setStatus(row.kind === 'assignment' ? stringsRef.current.settingsAssignmentHint : stringsRef.current.settingsPmLaunchHint)
|
|
1420
|
+
return
|
|
1421
|
+
}
|
|
1268
1422
|
const key = row.key
|
|
1269
1423
|
if (key.class === 'refuse') {
|
|
1270
1424
|
setReceipt(null)
|
|
1271
|
-
|
|
1425
|
+
// P266: the route speaks in plain language; the raw key only leads when the row has no other
|
|
1426
|
+
// name for itself (a key the schema does not know — its row's own text is that raw name).
|
|
1427
|
+
const named = key.known === false ? `${key.name} · ` : ''
|
|
1428
|
+
setStatus(`${named}${key.route || key.warning || stringsRef.current.settingsRefusedRoute}`)
|
|
1429
|
+
return
|
|
1430
|
+
}
|
|
1431
|
+
// The whole-map row's editor is the categories block, never a composed pair list (P232).
|
|
1432
|
+
if (String(key.kind ?? '') === 'task-model-map') {
|
|
1433
|
+
routeCategories()
|
|
1272
1434
|
return
|
|
1273
1435
|
}
|
|
1274
1436
|
// M65/D11: the editor opens on the `settings` block already on screen — no `config list` or
|
|
@@ -1276,10 +1438,6 @@ export function App({
|
|
|
1276
1438
|
// is that block's, so a contract changed underneath is the owning command's conflict verdict
|
|
1277
1439
|
// (CAS), not a reason to re-read before every action.
|
|
1278
1440
|
if (hasChoiceEditor(key)) {
|
|
1279
|
-
if (String(key.kind ?? '') === 'pairlist') {
|
|
1280
|
-
routePairlist()
|
|
1281
|
-
return
|
|
1282
|
-
}
|
|
1283
1441
|
const entries = buildChoiceEntries(key)
|
|
1284
1442
|
if (entries.length) {
|
|
1285
1443
|
const kind = String(key.kind ?? '')
|
|
@@ -1300,7 +1458,7 @@ export function App({
|
|
|
1300
1458
|
}
|
|
1301
1459
|
}
|
|
1302
1460
|
settingRowRef.current = {
|
|
1303
|
-
row:
|
|
1461
|
+
row: at,
|
|
1304
1462
|
key: key.name,
|
|
1305
1463
|
value: key.value,
|
|
1306
1464
|
cls: key.class,
|
|
@@ -1317,63 +1475,9 @@ export function App({
|
|
|
1317
1475
|
setStatus(fill(stringsRef.current.settingsChoiceNoChoice, { kind: String(key.kind ?? '') }))
|
|
1318
1476
|
}
|
|
1319
1477
|
},
|
|
1320
|
-
[buildChoiceEntries, openCompose,
|
|
1321
|
-
)
|
|
1322
|
-
|
|
1323
|
-
/**
|
|
1324
|
-
* One picker choice: a model opens the editor holding it, `-` opens it holding the removal,
|
|
1325
|
-
* the free-text row opens it empty. The editor's two Enter presses are the confirmation.
|
|
1326
|
-
*/
|
|
1327
|
-
/** Resolve a picker index (or -1 = the selected one) into the picker + its option. */
|
|
1328
|
-
const pickerIndex = useCallback(
|
|
1329
|
-
(index: number): { picker: { agent: string; row: number; models: string[]; index: number }; option: string } | null => {
|
|
1330
|
-
const p = seatPickerRef.current
|
|
1331
|
-
if (!p) return null
|
|
1332
|
-
const options = [...p.models, '-', '']
|
|
1333
|
-
const i = index < 0 ? p.index : index
|
|
1334
|
-
if (i < 0 || i >= options.length) return null
|
|
1335
|
-
return { picker: p, option: options[i] }
|
|
1336
|
-
},
|
|
1337
|
-
[],
|
|
1338
|
-
)
|
|
1339
|
-
|
|
1340
|
-
const chooseSeatOption = useCallback(
|
|
1341
|
-
(index: number) => {
|
|
1342
|
-
const picker = pickerIndex(index)
|
|
1343
|
-
if (!picker) return
|
|
1344
|
-
const { picker: p, option } = picker
|
|
1345
|
-
const seat = p.agent
|
|
1346
|
-
// M65/D11: the editor opens from the block already on screen (no read on the interaction
|
|
1347
|
-
// path); its fingerprint is that block's, so CAS catches a contract changed underneath.
|
|
1348
|
-
const block = dataRef.current.blocks?.settings
|
|
1349
|
-
const seatRow = (block?.models?.seats ?? []).find((x) => x.agent === seat)
|
|
1350
|
-
const initial = option === '' ? '' : option
|
|
1351
|
-
settingRowRef.current = {
|
|
1352
|
-
row: p.row,
|
|
1353
|
-
key: seat,
|
|
1354
|
-
value: seatRow?.model ?? '',
|
|
1355
|
-
cls: 'restart',
|
|
1356
|
-
fingerprint: block?.fingerprint ?? '',
|
|
1357
|
-
seat,
|
|
1358
|
-
}
|
|
1359
|
-
settingConfirmRef.current = null
|
|
1360
|
-
setSettingConfirm(null)
|
|
1361
|
-
setSeatPicker(null)
|
|
1362
|
-
seatPickerRef.current = null
|
|
1363
|
-
openCompose('setting', initial)
|
|
1364
|
-
},
|
|
1365
|
-
[openCompose, pickerIndex],
|
|
1478
|
+
[buildCategoryEntries, buildChoiceEntries, openCompose, routeCategories, settingsRowsNow],
|
|
1366
1479
|
)
|
|
1367
1480
|
|
|
1368
|
-
const moveSeatPicker = useCallback((delta: number) => {
|
|
1369
|
-
const p = seatPickerRef.current
|
|
1370
|
-
if (!p) return
|
|
1371
|
-
const count = p.models.length + 2
|
|
1372
|
-
const next = { ...p, index: Math.max(0, Math.min(count - 1, p.index + delta)) }
|
|
1373
|
-
seatPickerRef.current = next
|
|
1374
|
-
setSeatPicker(next)
|
|
1375
|
-
}, [])
|
|
1376
|
-
|
|
1377
1481
|
/** The detail view's file tabs: `←`/`→` clamp at the ends (no wrap — the row shows the order). */
|
|
1378
1482
|
const moveDetailTab = useCallback((delta: number) => {
|
|
1379
1483
|
const files = dataRef.current.blocks?.detail?.files ?? []
|
|
@@ -1403,8 +1507,96 @@ export function App({
|
|
|
1403
1507
|
return
|
|
1404
1508
|
}
|
|
1405
1509
|
const files = detailBlockData?.files ?? []
|
|
1406
|
-
api.setDetail(detailId, files[detailIndexRef.current]?.path ?? null)
|
|
1407
|
-
}, [api, detailId, detailIndex, detailBlockData])
|
|
1510
|
+
api.setDetail(detailId, files[detailIndexRef.current]?.path ?? null, detailSource)
|
|
1511
|
+
}, [api, detailId, detailIndex, detailSource, detailBlockData])
|
|
1512
|
+
|
|
1513
|
+
/** Page 5's slots as the last snapshot carries them (never a re-read of the store). */
|
|
1514
|
+
const replyEntries = useCallback((): ReplyEntry[] => dataRef.current.blocks?.reply_list?.entries ?? [], [])
|
|
1515
|
+
|
|
1516
|
+
/** Page 5's `↑`/`↓`: the focus walks the drawn rows; the window follows it (offset = null). */
|
|
1517
|
+
const moveReplyFocus = useCallback(
|
|
1518
|
+
(delta: number) => {
|
|
1519
|
+
const entries = replyEntries()
|
|
1520
|
+
if (!entries.length) return
|
|
1521
|
+
const at = entries.findIndex((e) => e.no === replyFocusRef.current)
|
|
1522
|
+
const next = Math.max(0, Math.min(entries.length - 1, (at < 0 ? 0 : at) + delta))
|
|
1523
|
+
setReplyFocus(entries[next].no)
|
|
1524
|
+
setReplyOffset(null)
|
|
1525
|
+
},
|
|
1526
|
+
[replyEntries],
|
|
1527
|
+
)
|
|
1528
|
+
|
|
1529
|
+
/**
|
|
1530
|
+
* Page 5's `Older`/`Newer`. Older fetches the page's own `next_before` and pushes the cursor the
|
|
1531
|
+
* current page was fetched with onto the chain; Newer pops it — the retained chain is what lets
|
|
1532
|
+
* the user walk back without a full-history load, and `0` in the chain means "the newest page".
|
|
1533
|
+
*/
|
|
1534
|
+
const replyPage = useCallback(
|
|
1535
|
+
(dir: -1 | 1) => {
|
|
1536
|
+
const list = dataRef.current.blocks?.reply_list
|
|
1537
|
+
if (!list) return
|
|
1538
|
+
if (dir === 1) {
|
|
1539
|
+
const stack = replyStackRef.current
|
|
1540
|
+
if (!stack.length) return
|
|
1541
|
+
const back = stack[stack.length - 1]
|
|
1542
|
+
setReplyStack(stack.slice(0, -1))
|
|
1543
|
+
setReplyCursor(back === 0 ? null : back)
|
|
1544
|
+
} else {
|
|
1545
|
+
const older = list.next_before
|
|
1546
|
+
if (!older) return
|
|
1547
|
+
setReplyStack([...replyStackRef.current, replyCursorRef.current ?? 0])
|
|
1548
|
+
setReplyCursor(older)
|
|
1549
|
+
}
|
|
1550
|
+
setReplyFocus(null)
|
|
1551
|
+
setReplyOffset(null)
|
|
1552
|
+
},
|
|
1553
|
+
[],
|
|
1554
|
+
)
|
|
1555
|
+
|
|
1556
|
+
/** `r` on page 5: drop the chain and fetch the newest page again. */
|
|
1557
|
+
const replyReset = useCallback(() => {
|
|
1558
|
+
setReplyCursor(null)
|
|
1559
|
+
setReplyStack([])
|
|
1560
|
+
setReplyFocus(null)
|
|
1561
|
+
setReplyOffset(null)
|
|
1562
|
+
}, [])
|
|
1563
|
+
|
|
1564
|
+
/** Open a numbered body (a click on the focused row, or Enter on it). */
|
|
1565
|
+
const openReply = useCallback(
|
|
1566
|
+
(index?: number) => {
|
|
1567
|
+
const entries = replyEntries()
|
|
1568
|
+
const entry = index != null ? entries[index] : (entries.find((e) => e.no === replyFocusRef.current) ?? entries[0])
|
|
1569
|
+
if (!entry || !entry.available) return
|
|
1570
|
+
setReplyBody(entry.no)
|
|
1571
|
+
setReplyScroll(0)
|
|
1572
|
+
},
|
|
1573
|
+
[replyEntries],
|
|
1574
|
+
)
|
|
1575
|
+
|
|
1576
|
+
/** The viewer document's scroll, clamped against the window the last frame reported. */
|
|
1577
|
+
const scrollReply = useCallback((delta: number) => {
|
|
1578
|
+
const win = replyDocRef.current
|
|
1579
|
+
const max = win ? Math.max(0, win.total - win.visible) : 0
|
|
1580
|
+
setReplyScroll((v) => Math.max(0, Math.min(max, v + delta)))
|
|
1581
|
+
}, [])
|
|
1582
|
+
|
|
1583
|
+
/**
|
|
1584
|
+
* Page 5's demand reads (design §4): the list is wanted only on page 5 — and only for the cursor
|
|
1585
|
+
* in view — while the body is wanted only while the viewer is open. Leaving the page clears both,
|
|
1586
|
+
* so a parked console spawns neither child. `setReply` is idempotent for an unchanged pair, so
|
|
1587
|
+
* this effect (and a re-render) never forces a rebuild of what is already on screen.
|
|
1588
|
+
*/
|
|
1589
|
+
const replyListData = data.blocks?.reply_list
|
|
1590
|
+
const replyBodyData = data.blocks?.reply_body
|
|
1591
|
+
useEffect(() => {
|
|
1592
|
+
api.setReply({ list: page === 5 && replyBody == null, before: replyCursor, no: replyBody })
|
|
1593
|
+
}, [api, page, replyCursor, replyBody])
|
|
1594
|
+
|
|
1595
|
+
// A body that left the store between the click and the read: keep the list usable rather than
|
|
1596
|
+
// pinning the viewer on a number the readers refuse (the viewer itself renders the notice).
|
|
1597
|
+
useEffect(() => {
|
|
1598
|
+
if (replyBody != null && replyBodyData == null) return
|
|
1599
|
+
}, [replyBody, replyBodyData])
|
|
1408
1600
|
|
|
1409
1601
|
const dispatch = useCallback(
|
|
1410
1602
|
(action: Action) => {
|
|
@@ -1426,7 +1618,7 @@ export function App({
|
|
|
1426
1618
|
goPage(action.page)
|
|
1427
1619
|
return
|
|
1428
1620
|
case 'page-cycle':
|
|
1429
|
-
goPage(pageRef.current ===
|
|
1621
|
+
goPage(pageRef.current === 5 ? 1 : ((pageRef.current + 1) as PageId))
|
|
1430
1622
|
return
|
|
1431
1623
|
case 'scroll':
|
|
1432
1624
|
updateScroll((v) => v + action.delta)
|
|
@@ -1449,6 +1641,47 @@ export function App({
|
|
|
1449
1641
|
case 'focus':
|
|
1450
1642
|
setFocus({ lane: action.lane, id: action.id, nth: action.nth ?? 0 })
|
|
1451
1643
|
return
|
|
1644
|
+
case 'reply-click': {
|
|
1645
|
+
// One action, two behaviours (the kanban's rule): a click on an unfocused row focuses it,
|
|
1646
|
+
// a click on the already focused row opens its body.
|
|
1647
|
+
const entries = replyEntries()
|
|
1648
|
+
const entry = entries[action.index]
|
|
1649
|
+
if (!entry) return
|
|
1650
|
+
if (replyFocusRef.current === entry.no) openReply(action.index)
|
|
1651
|
+
else {
|
|
1652
|
+
setReplyFocus(entry.no)
|
|
1653
|
+
setReplyOffset(null)
|
|
1654
|
+
}
|
|
1655
|
+
return
|
|
1656
|
+
}
|
|
1657
|
+
case 'reply-move':
|
|
1658
|
+
moveReplyFocus(action.delta)
|
|
1659
|
+
return
|
|
1660
|
+
case 'reply-page':
|
|
1661
|
+
replyPage(action.dir)
|
|
1662
|
+
return
|
|
1663
|
+
case 'reply-reset':
|
|
1664
|
+
replyReset()
|
|
1665
|
+
return
|
|
1666
|
+
case 'reply-open':
|
|
1667
|
+
openReply(action.index)
|
|
1668
|
+
return
|
|
1669
|
+
case 'reply-scroll':
|
|
1670
|
+
scrollReply(action.delta)
|
|
1671
|
+
return
|
|
1672
|
+
case 'reply-close':
|
|
1673
|
+
// Back to the list with its cursor, focus and viewport untouched.
|
|
1674
|
+
setReplyBody(null)
|
|
1675
|
+
return
|
|
1676
|
+
case 'reply-open-latest':
|
|
1677
|
+
replyReset()
|
|
1678
|
+
goPage(5)
|
|
1679
|
+
if (action.no) {
|
|
1680
|
+
setReplyFocus(action.no)
|
|
1681
|
+
setReplyBody(action.no)
|
|
1682
|
+
setReplyScroll(0)
|
|
1683
|
+
}
|
|
1684
|
+
return
|
|
1452
1685
|
case 'open-focused': {
|
|
1453
1686
|
// One action kind, two pages: the kanban resolves its lane/card focus, the work page the
|
|
1454
1687
|
// drawn row order (P20/B5).
|
|
@@ -1456,7 +1689,11 @@ export function App({
|
|
|
1456
1689
|
openWorkFocused()
|
|
1457
1690
|
return
|
|
1458
1691
|
}
|
|
1459
|
-
|
|
1692
|
+
// A preview row's ref (lane = a preview block's scope) is not a kanban card: no cursor is
|
|
1693
|
+
// drawn for it and Enter opens nothing; a step re-anchors to the board (P249).
|
|
1694
|
+
const focus = focusRef.current
|
|
1695
|
+
if (focus && !boardFocusRef(focus)) return
|
|
1696
|
+
const current = resolveFocus(boardRows(), focus)
|
|
1460
1697
|
if (current) openDetail(current.id)
|
|
1461
1698
|
return
|
|
1462
1699
|
}
|
|
@@ -1516,16 +1753,9 @@ export function App({
|
|
|
1516
1753
|
case 'choice-close':
|
|
1517
1754
|
closeChoicePicker()
|
|
1518
1755
|
return
|
|
1519
|
-
case 'seat-pick':
|
|
1520
|
-
if (action.index < 0) chooseSeatOption(-1)
|
|
1521
|
-
else chooseSeatOption(action.index)
|
|
1522
|
-
return
|
|
1523
|
-
case 'seat-move':
|
|
1524
|
-
moveSeatPicker(action.delta)
|
|
1525
|
-
return
|
|
1526
1756
|
}
|
|
1527
1757
|
},
|
|
1528
|
-
[boardRows, chooseChoiceOption, closeChoicePicker, closeSettingsView, collapse, cyclePref, goPage, moveBoardFocus, moveChoicePicker, moveDetailTab, moveFocus,
|
|
1758
|
+
[boardRows, chooseChoiceOption, closeChoicePicker, closeSettingsView, collapse, cyclePref, goPage, moveBoardFocus, moveChoicePicker, moveDetailTab, moveFocus, moveSettingsFocus, openCompose, openDetail, openSettingsRow, openSettingsView, openWorkFocused, runAction, scrollDetail, scrollLane, scrollSettings, toggleLaneFold, updateScroll],
|
|
1529
1759
|
)
|
|
1530
1760
|
|
|
1531
1761
|
const effectiveActivity = activityPinned ? data.activity : settings.activity
|
|
@@ -1563,6 +1793,10 @@ export function App({
|
|
|
1563
1793
|
// command's refusal) rides the hint row *above* the input so the input line stays last
|
|
1564
1794
|
// (the IME cursor anchor rule) while the editor stays open with its draft.
|
|
1565
1795
|
...(status && (mode === 'setting' || mode === 'filter') ? [status] : []),
|
|
1796
|
+
// P249: a message send that could not settle cleanly (the error class, or a draft file the
|
|
1797
|
+
// console could not empty) keeps the compose open, so its receipt rides the same row — the
|
|
1798
|
+
// words and the reason are visible together.
|
|
1799
|
+
...(mode === 'message' && receipt ? [receiptLine(receipt, strings)] : []),
|
|
1566
1800
|
mode === 'message'
|
|
1567
1801
|
? strings.composeHint
|
|
1568
1802
|
: mode === 'reason'
|
|
@@ -1597,8 +1831,13 @@ export function App({
|
|
|
1597
1831
|
settingsFocus,
|
|
1598
1832
|
settingsFilter,
|
|
1599
1833
|
settingsOffset,
|
|
1600
|
-
seatPicker,
|
|
1601
1834
|
choicePicker,
|
|
1835
|
+
replyFocus,
|
|
1836
|
+
replyCursor,
|
|
1837
|
+
replyBody,
|
|
1838
|
+
replyScroll,
|
|
1839
|
+
replyOffset,
|
|
1840
|
+
replyBodyFailed: Boolean(data.replyBodyFailed) && replyBodyData == null,
|
|
1602
1841
|
}
|
|
1603
1842
|
// The geometry comes from the live terminal, not from the frame's snapshot of it: a resize must
|
|
1604
1843
|
// re-lay out the next frame (the spec's "A resize re-lays out live"), and `data.width` is frozen
|
|
@@ -1619,6 +1858,8 @@ export function App({
|
|
|
1619
1858
|
boardOrderRef.current = themed.boardOrder ?? []
|
|
1620
1859
|
detailRef.current = themed.detail ?? null
|
|
1621
1860
|
settingsWindowRef.current = themed.settings ?? null
|
|
1861
|
+
replyListRef.current = themed.replyList ?? null
|
|
1862
|
+
replyDocRef.current = themed.replyDoc ?? null
|
|
1622
1863
|
return { frame: themed, input, hint, bottom, pad, boxed, inputView }
|
|
1623
1864
|
}, [
|
|
1624
1865
|
data,
|
|
@@ -1643,8 +1884,12 @@ export function App({
|
|
|
1643
1884
|
settingsFocus,
|
|
1644
1885
|
settingsFilter,
|
|
1645
1886
|
settingsOffset,
|
|
1646
|
-
seatPicker,
|
|
1647
1887
|
choicePicker,
|
|
1888
|
+
replyFocus,
|
|
1889
|
+
replyCursor,
|
|
1890
|
+
replyBody,
|
|
1891
|
+
replyScroll,
|
|
1892
|
+
replyOffset,
|
|
1648
1893
|
size,
|
|
1649
1894
|
composing,
|
|
1650
1895
|
mode,
|
|
@@ -1742,16 +1987,10 @@ export function App({
|
|
|
1742
1987
|
// on the page the view was opened from (the work page's rows open it too, P20/B5).
|
|
1743
1988
|
if (choicePickerRef.current) {
|
|
1744
1989
|
// The choice picker's entries may outrun the budget: the wheel walks the list like
|
|
1745
|
-
// ↑/↓ (the window follows the selection
|
|
1990
|
+
// ↑/↓ (the window follows the selection).
|
|
1746
1991
|
moveChoicePicker(delta)
|
|
1747
1992
|
return
|
|
1748
1993
|
}
|
|
1749
|
-
if (seatPickerRef.current) {
|
|
1750
|
-
// P30/D5: the seat picker's wheel used to fall through to the page. It walks its
|
|
1751
|
-
// entries now, exactly like the choice picker, and the page still does not move.
|
|
1752
|
-
moveSeatPicker(delta)
|
|
1753
|
-
return
|
|
1754
|
-
}
|
|
1755
1994
|
if (settingsViewRef.current) {
|
|
1756
1995
|
// P30/D5: while the project-settings view is open the wheel is its region — the row
|
|
1757
1996
|
// window moves one row per notch, the focus stays, and the page behind it is untouched.
|
|
@@ -1762,6 +2001,22 @@ export function App({
|
|
|
1762
2001
|
scrollDetail(delta)
|
|
1763
2002
|
return
|
|
1764
2003
|
}
|
|
2004
|
+
if (pageRef.current === 5 && replyBodyRef.current != null) {
|
|
2005
|
+
// The reply viewer's document is the one scrollable region on page 5.
|
|
2006
|
+
scrollReply(delta)
|
|
2007
|
+
return
|
|
2008
|
+
}
|
|
2009
|
+
if (pageRef.current === 5) {
|
|
2010
|
+
// Page 5's list: the wheel moves the *viewport*, never the focus (the documented rule),
|
|
2011
|
+
// and never fetches hidden history.
|
|
2012
|
+
const win = replyListRef.current
|
|
2013
|
+
setReplyOffset((v) => {
|
|
2014
|
+
const base = v ?? win?.offset ?? 0
|
|
2015
|
+
const max = win ? Math.max(0, win.count - win.visible) : 0
|
|
2016
|
+
return Math.max(0, Math.min(max, base + delta))
|
|
2017
|
+
})
|
|
2018
|
+
return
|
|
2019
|
+
}
|
|
1765
2020
|
// On the board page the wheel scrolls the lane under the cursor (a card hit carries its
|
|
1766
2021
|
// lane, the lane's own hover target covers the rest); elsewhere it scrolls the page's list.
|
|
1767
2022
|
if (pageRef.current === 4) {
|
|
@@ -1952,22 +2207,6 @@ export function App({
|
|
|
1952
2207
|
}
|
|
1953
2208
|
return
|
|
1954
2209
|
}
|
|
1955
|
-
if (seatPickerRef.current) {
|
|
1956
|
-
if (key.escape) {
|
|
1957
|
-
setSeatPicker(null)
|
|
1958
|
-
seatPickerRef.current = null
|
|
1959
|
-
return
|
|
1960
|
-
}
|
|
1961
|
-
if (key.upArrow || key.downArrow) {
|
|
1962
|
-
moveSeatPicker(key.upArrow ? -1 : 1)
|
|
1963
|
-
return
|
|
1964
|
-
}
|
|
1965
|
-
if (key.return) {
|
|
1966
|
-
chooseSeatOption(-1)
|
|
1967
|
-
return
|
|
1968
|
-
}
|
|
1969
|
-
return
|
|
1970
|
-
}
|
|
1971
2210
|
if (key.escape) {
|
|
1972
2211
|
closeSettingsView()
|
|
1973
2212
|
return
|
|
@@ -2008,16 +2247,51 @@ export function App({
|
|
|
2008
2247
|
}
|
|
2009
2248
|
// Enter adds no action here (no write operation), and the page keys stay live below.
|
|
2010
2249
|
}
|
|
2250
|
+
// The reply viewer (page 5) is read-only and full-page: Esc or `q` backs out to the same list
|
|
2251
|
+
// cursor, focus and viewport — never collapses. `↑`/`↓`, PgUp/PgDn, Home/End and the wheel
|
|
2252
|
+
// scroll the whole document; the page keys stay live below (they replace the viewer's page).
|
|
2253
|
+
if (page === 5 && replyBodyRef.current != null) {
|
|
2254
|
+
if (key.escape || (input === 'q' && !key.ctrl)) {
|
|
2255
|
+
setReplyBody(null)
|
|
2256
|
+
return
|
|
2257
|
+
}
|
|
2258
|
+
const step = Math.max(1, (size.rows || 10) - 4)
|
|
2259
|
+
if (key.upArrow) {
|
|
2260
|
+
scrollReply(-1)
|
|
2261
|
+
return
|
|
2262
|
+
}
|
|
2263
|
+
if (key.downArrow) {
|
|
2264
|
+
scrollReply(1)
|
|
2265
|
+
return
|
|
2266
|
+
}
|
|
2267
|
+
if (key.pageUp) {
|
|
2268
|
+
scrollReply(-step)
|
|
2269
|
+
return
|
|
2270
|
+
}
|
|
2271
|
+
if (key.pageDown) {
|
|
2272
|
+
scrollReply(step)
|
|
2273
|
+
return
|
|
2274
|
+
}
|
|
2275
|
+
if (key.home) {
|
|
2276
|
+
setReplyScroll(0)
|
|
2277
|
+
return
|
|
2278
|
+
}
|
|
2279
|
+
if (key.end) {
|
|
2280
|
+
const win = replyDocRef.current
|
|
2281
|
+
setReplyScroll(win ? Math.max(0, win.total - win.visible) : 0)
|
|
2282
|
+
return
|
|
2283
|
+
}
|
|
2284
|
+
}
|
|
2011
2285
|
if (input === 'q' || (key.ctrl && input === 'c')) {
|
|
2012
2286
|
void collapse()
|
|
2013
2287
|
return
|
|
2014
2288
|
}
|
|
2015
2289
|
if (busy) return
|
|
2016
2290
|
if (key.tab) {
|
|
2017
|
-
goPage(pageRef.current ===
|
|
2291
|
+
goPage(pageRef.current === 5 ? 1 : ((pageRef.current + 1) as PageId))
|
|
2018
2292
|
return
|
|
2019
2293
|
}
|
|
2020
|
-
if (input === '1' || input === '2' || input === '3' || input === '4') {
|
|
2294
|
+
if (input === '1' || input === '2' || input === '3' || input === '4' || input === '5') {
|
|
2021
2295
|
goPage(Number(input) as PageId)
|
|
2022
2296
|
return
|
|
2023
2297
|
}
|
|
@@ -2039,12 +2313,29 @@ export function App({
|
|
|
2039
2313
|
return
|
|
2040
2314
|
}
|
|
2041
2315
|
if (input === 'r') {
|
|
2042
|
-
// `r` is the human asking for it: rebuild every block now, not "when its TTL is up".
|
|
2316
|
+
// `r` is the human asking for it: rebuild every block now, not "when its TTL is up". On
|
|
2317
|
+
// page 5 it is the documented "back to the newest page" key instead (design §5).
|
|
2318
|
+
if (page === 5) {
|
|
2319
|
+
replyReset()
|
|
2320
|
+
return
|
|
2321
|
+
}
|
|
2043
2322
|
setReceipt(null)
|
|
2044
2323
|
setStatus(null)
|
|
2045
2324
|
api.refreshNow()
|
|
2046
2325
|
return
|
|
2047
2326
|
}
|
|
2327
|
+
if (page === 5 && (key.leftArrow || key.rightArrow)) {
|
|
2328
|
+
replyPage(key.leftArrow ? -1 : 1)
|
|
2329
|
+
return
|
|
2330
|
+
}
|
|
2331
|
+
if (page === 5 && (key.upArrow || key.downArrow)) {
|
|
2332
|
+
moveReplyFocus(key.upArrow ? -1 : 1)
|
|
2333
|
+
return
|
|
2334
|
+
}
|
|
2335
|
+
if (page === 5 && key.return) {
|
|
2336
|
+
openReply()
|
|
2337
|
+
return
|
|
2338
|
+
}
|
|
2048
2339
|
if (page === 4 && input === 'c' && !detailId) {
|
|
2049
2340
|
// P123: `c` folds/unfolds the lane the focus names. The detail view and the settings
|
|
2050
2341
|
// surfaces own the page region and never reach here (their branches returned above).
|
|
@@ -2065,7 +2356,10 @@ export function App({
|
|
|
2065
2356
|
return
|
|
2066
2357
|
}
|
|
2067
2358
|
if (page === 4 && key.return) {
|
|
2068
|
-
|
|
2359
|
+
// Same rule as the click path: a preview row's ref neither draws nor opens on the kanban.
|
|
2360
|
+
const focus = focusRef.current
|
|
2361
|
+
if (focus && !boardFocusRef(focus)) return
|
|
2362
|
+
const current = resolveFocus(boardRows(), focus)
|
|
2069
2363
|
if (current) openDetail(current.id)
|
|
2070
2364
|
return
|
|
2071
2365
|
}
|