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
|
@@ -31,11 +31,13 @@ import type {
|
|
|
31
31
|
ChangeRow,
|
|
32
32
|
Density,
|
|
33
33
|
DetailBlock,
|
|
34
|
+
DetailSource,
|
|
34
35
|
DetailWindow,
|
|
35
36
|
FocusRef,
|
|
36
37
|
Frame,
|
|
37
38
|
FrameInput,
|
|
38
39
|
Hit,
|
|
40
|
+
Impediment,
|
|
39
41
|
LaneWindow,
|
|
40
42
|
Line,
|
|
41
43
|
PageId,
|
|
@@ -45,18 +47,22 @@ import type {
|
|
|
45
47
|
PlacedLine,
|
|
46
48
|
PrefName,
|
|
47
49
|
QueueEntry,
|
|
48
|
-
|
|
50
|
+
ReplyDocWindow,
|
|
51
|
+
ReplyEntry,
|
|
52
|
+
ReplyWindow,
|
|
49
53
|
Segment,
|
|
54
|
+
SettingsAssignment,
|
|
50
55
|
SettingsBlock,
|
|
56
|
+
SettingsCategory,
|
|
51
57
|
SettingsChoiceEntry,
|
|
52
58
|
SettingsKey,
|
|
53
|
-
|
|
59
|
+
SettingsPmLaunch,
|
|
54
60
|
SettingsWindow,
|
|
55
61
|
Tone,
|
|
56
62
|
ViewState,
|
|
57
63
|
} from './types.js'
|
|
58
64
|
import { toneSgr, type Palette } from './theme.js'
|
|
59
|
-
import { cell, dispWidth, rule, truncateW, truncateWStart } from './width.js'
|
|
65
|
+
import { cell, charWidth, dispWidth, rule, truncateW, truncateWStart } from './width.js'
|
|
60
66
|
|
|
61
67
|
export const WIDTH_TWO_WIDE = 160
|
|
62
68
|
export const WIDTH_TWO_COMPACT = 100
|
|
@@ -245,6 +251,10 @@ interface Block {
|
|
|
245
251
|
detail?: DetailWindow
|
|
246
252
|
/** The project-settings view's row window as rendered (P22/B2). */
|
|
247
253
|
settings?: SettingsWindow
|
|
254
|
+
/** Page 5's list window as rendered (the App's arrows/wheel clamp against it). */
|
|
255
|
+
replyList?: ReplyWindow
|
|
256
|
+
/** The open reply viewer's document window as rendered. */
|
|
257
|
+
replyDoc?: ReplyDocWindow
|
|
248
258
|
/** The work page's board rows in the order it drew them (P20/B5: the App's `↑`/`↓` walk this). */
|
|
249
259
|
order?: FocusRef[]
|
|
250
260
|
}
|
|
@@ -284,6 +294,10 @@ interface Ctx {
|
|
|
284
294
|
* assembly's real budget: the view spends it on the row window, its tail and blank fill, so the
|
|
285
295
|
* card fills the pane — P32). */
|
|
286
296
|
settingsRows?: number
|
|
297
|
+
/** Rows page 5's reply list may draw (the assembly's budget: more pane = more rows). */
|
|
298
|
+
replyRows?: number
|
|
299
|
+
/** Document rows the open reply viewer may draw. */
|
|
300
|
+
replyDocRows?: number
|
|
287
301
|
}
|
|
288
302
|
|
|
289
303
|
export interface LayoutInput extends FrameInput {
|
|
@@ -729,8 +743,12 @@ function boardBlock(ctx: Ctx): Block | null {
|
|
|
729
743
|
// M48: the focus names a **row**, not a bare id — two rows may share one id, and matching by id
|
|
730
744
|
// highlights both at once and freezes the `↑`/`↓` walk on the first of them.
|
|
731
745
|
const ordinals = dupOrdinals(rows)
|
|
732
|
-
const
|
|
733
|
-
const
|
|
746
|
+
const scoped = boardFocusRef(ctx.view.focus)
|
|
747
|
+
const named = scoped ? focusRow(rows, scoped) : null
|
|
748
|
+
// P249: a preview row's ref never lights a board row — the page's one cursor belongs to that
|
|
749
|
+
// block; the board only draws its default (first rendered row) when nothing is focused at all.
|
|
750
|
+
const focusedRow =
|
|
751
|
+
ctx.view.focus && !scoped ? null : named && rendered.includes(named) ? named : (rendered[0] ?? null)
|
|
734
752
|
const order = rendered.map((r) => refFor(r, ordinals))
|
|
735
753
|
for (const r of rendered) {
|
|
736
754
|
const focused = r === focusedRow
|
|
@@ -945,6 +963,15 @@ function resolveFocusWith(
|
|
|
945
963
|
return null
|
|
946
964
|
}
|
|
947
965
|
|
|
966
|
+
/**
|
|
967
|
+
* The board-scoped part of a focus ref (P249): a preview row's ref (lane = a preview block's scope) never
|
|
968
|
+
* names a kanban card, so the board page neither draws a cursor for it nor opens anything from it. A
|
|
969
|
+
* missing ref keeps the board's own default (the first card of the first non-empty lane).
|
|
970
|
+
*/
|
|
971
|
+
export function boardFocusRef(focus?: FocusRef | null): FocusRef | null {
|
|
972
|
+
return focus && LANES.includes(focus.lane) ? focus : null
|
|
973
|
+
}
|
|
974
|
+
|
|
948
975
|
/**
|
|
949
976
|
* One lane's visible window. `size` is the number of card rows the frame can spend, the offset is
|
|
950
977
|
* clamped to the lane, and the focused card (when it lives in this lane) always stays inside — the
|
|
@@ -1165,7 +1192,10 @@ function kanbanBlock(ctx: Ctx): Block | null {
|
|
|
1165
1192
|
const rows = board.rows ?? []
|
|
1166
1193
|
if (!rows.length) return one([{ line: truncLine(ln(seg(` ${s.boardEmpty}`, 'dim')), ctx.width) }])
|
|
1167
1194
|
const ordinals = dupOrdinals(rows)
|
|
1168
|
-
|
|
1195
|
+
// P249: only a ref that names one of the six lanes (or no ref at all, which keeps the board's own
|
|
1196
|
+
// default cursor) resolves here; a preview row's ref puts no cursor on the kanban.
|
|
1197
|
+
const focus =
|
|
1198
|
+
ctx.view.focus && !LANES.includes(ctx.view.focus.lane) ? null : resolveFocusWith(rows, ordinals, ctx.view.focus)
|
|
1169
1199
|
// M48: one row object is the focus; every `card === target` below is O(1) and two rows sharing an
|
|
1170
1200
|
// id never both light up. The duplicate ordinals are built once per frame and shared by the
|
|
1171
1201
|
// focus/actions (no per-lane or per-card rescan of the board).
|
|
@@ -1265,11 +1295,19 @@ function detailBlock(ctx: Ctx): Block | null {
|
|
|
1265
1295
|
return one([{ line: truncLine(ln(seg(` ${s.detailLoading}`, 'dim')), width) }], { index: 0, total: 0, visible: 0, offset: 0 })
|
|
1266
1296
|
}
|
|
1267
1297
|
const files = data.files ?? []
|
|
1268
|
-
if (!files.length)
|
|
1298
|
+
if (!files.length) {
|
|
1299
|
+
// A missing target is not an error: the reader's reason names it, so the view says the source is
|
|
1300
|
+
// unavailable instead of rendering an empty document as a successful read (P249).
|
|
1301
|
+
const line = data.reason ? fill(s.detailUnavailable, { reason: data.reason }) : s.detailNoFiles
|
|
1302
|
+
return one([{ line: truncLine(ln(seg(` ${line}`, 'dim')), width) }])
|
|
1303
|
+
}
|
|
1269
1304
|
const detail = data as DetailBlock
|
|
1270
1305
|
const index = Math.max(0, Math.min(files.length - 1, Math.floor(ctx.view.detailIndex ?? 0) || 0))
|
|
1271
1306
|
const active = files[index]
|
|
1272
1307
|
const rows: PlacedLine[] = [detailTabs(ctx, files, index, width)]
|
|
1308
|
+
// The reader refused a discovery (a symbolic link): the other files still open, and the reason
|
|
1309
|
+
// names what was refused (P249).
|
|
1310
|
+
if (data.reason) rows.push({ line: truncLine(ln(seg(` ${data.reason}`, 'warn')), width) })
|
|
1273
1311
|
if (active.truncated) rows.push({ line: truncLine(ln(seg(` ${s.detailTruncated}`, 'warn')), width) })
|
|
1274
1312
|
if (detail.file !== active.path) {
|
|
1275
1313
|
// The tab was switched and its text has not arrived yet: the tabs stay live, the body says why.
|
|
@@ -1288,27 +1326,247 @@ function detailBlock(ctx: Ctx): Block | null {
|
|
|
1288
1326
|
return one(rows, { index, total: doc.length, visible: Math.min(available, Math.max(0, doc.length - offset)), offset })
|
|
1289
1327
|
}
|
|
1290
1328
|
|
|
1329
|
+
|
|
1330
|
+
// ------------------------------------------------------------------ key replies (pulse-key-replies)
|
|
1331
|
+
//
|
|
1332
|
+
// Page 5 reads the bounded `key-replies` store through three console-only blocks. The list is a
|
|
1333
|
+
// page of numbered slots (metadata only); the viewer renders one committed body through the same
|
|
1334
|
+
// markdown renderer and width plan the detail view uses. Focus is a **stable number**, the window
|
|
1335
|
+
// follows it, and the older chain is an explicit list of cursors — nothing here ever loads the
|
|
1336
|
+
// whole history, and nothing here writes (the readers are observation-only).
|
|
1337
|
+
|
|
1338
|
+
const REPLY_LIST_ROWS_DEFAULT = 12
|
|
1339
|
+
const REPLY_DOC_ROWS_DEFAULT = 16
|
|
1340
|
+
|
|
1341
|
+
/** The `#no title` cell of one list row. */
|
|
1342
|
+
function replyRowLabel(e: ReplyEntry): string {
|
|
1343
|
+
return e.available ? `#${e.no} ${e.title}` : ''
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
/** The nav row of page 5: Older / Newer / `r` (the same actions `←`/`→` and `r` fire). */
|
|
1347
|
+
function replyNavLine(ctx: Ctx, innerW: number): PlacedLine {
|
|
1348
|
+
const { s } = ctx
|
|
1349
|
+
const line: Line = [seg(' ')]
|
|
1350
|
+
const hits: Hit[] = []
|
|
1351
|
+
let x = 1
|
|
1352
|
+
const chip = (text: string, action: Action): void => {
|
|
1353
|
+
const start = x
|
|
1354
|
+
line.push(seg(text, 'accent'))
|
|
1355
|
+
x += dispWidth(text)
|
|
1356
|
+
hits.push({ start, end: x, action })
|
|
1357
|
+
line.push(seg(' '))
|
|
1358
|
+
x += 1
|
|
1359
|
+
}
|
|
1360
|
+
chip(`\u2039 ${s.replyOlder}`, { kind: 'reply-page', dir: -1 })
|
|
1361
|
+
chip(`${s.replyNewer} \u203a`, { kind: 'reply-page', dir: 1 })
|
|
1362
|
+
chip(s.keyReplyReset, { kind: 'reply-reset' })
|
|
1363
|
+
return placedWithHits(line, hits, innerW)
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
/**
|
|
1367
|
+
* Page 5's list block. It draws the nav row, the page's one-line self-description (what this page
|
|
1368
|
+
* holds and who publishes into it), the slot count (never a claim about readable replies), the tail
|
|
1369
|
+
* warning when the reader reported one, and the windowed rows. The returned window is what the App
|
|
1370
|
+
* clamps `↑`/`↓` against; `focus` is the focused slot's number.
|
|
1371
|
+
*/
|
|
1372
|
+
function replyListBlock(ctx: Ctx): Block | null {
|
|
1373
|
+
const { s, blocks, deg, view } = ctx
|
|
1374
|
+
const innerW = blockInnerW(ctx)
|
|
1375
|
+
const data = blocks.reply_list
|
|
1376
|
+
const budget = Math.max(2, ctx.replyRows ?? REPLY_LIST_ROWS_DEFAULT)
|
|
1377
|
+
const build = (lines: PlacedLine[], win?: ReplyWindow): Block => ({
|
|
1378
|
+
id: 'reply_list',
|
|
1379
|
+
full: true,
|
|
1380
|
+
priority: 1,
|
|
1381
|
+
separator: 'none',
|
|
1382
|
+
title: data ? fill(s.replyHeadingCount, { n: data.total_slots }) : s.replyHeading,
|
|
1383
|
+
lines,
|
|
1384
|
+
replyList: win,
|
|
1385
|
+
summary: { line: truncLine(ln(seg(` ${s.replyHeading}`, 'heading')), ctx.width) },
|
|
1386
|
+
})
|
|
1387
|
+
const lines: PlacedLine[] = [
|
|
1388
|
+
replyNavLine(ctx, innerW),
|
|
1389
|
+
{ line: truncLine(ln(seg(` ${s.replyPageNote}`, 'dim')), innerW) },
|
|
1390
|
+
]
|
|
1391
|
+
if (!data || deg.has('reply_list')) {
|
|
1392
|
+
lines.push({ line: truncLine(ln(seg(` ${data ? s.dash : s.replyLoading}`, 'dim')), innerW) })
|
|
1393
|
+
return build(lines, { focus: 0, offset: 0, visible: 0, count: 0 })
|
|
1394
|
+
}
|
|
1395
|
+
// An empty store says so in one line: the slot count would only repeat "0" (and it is never a
|
|
1396
|
+
// claim about readable replies when the store does have slots).
|
|
1397
|
+
if (data.state !== 'empty') {
|
|
1398
|
+
lines.push({ line: truncLine(ln(seg(` ${fill(s.replyTotalSlots, { n: data.total_slots })}`, 'dim')), innerW) })
|
|
1399
|
+
}
|
|
1400
|
+
if ((data.warnings ?? []).some((w) => w.kind === 'partial-tail')) {
|
|
1401
|
+
lines.push({ line: truncLine(ln(seg(` ${s.replyTailWarning}`, 'warn')), innerW) })
|
|
1402
|
+
}
|
|
1403
|
+
const entries = Array.isArray(data.entries) ? data.entries : []
|
|
1404
|
+
if (!entries.length) {
|
|
1405
|
+
lines.push({ line: truncLine(ln(seg(` ${s.replyEmpty}`, 'dim')), innerW) })
|
|
1406
|
+
return build(lines, { focus: 0, offset: 0, visible: 0, count: 0 })
|
|
1407
|
+
}
|
|
1408
|
+
const room = Math.max(1, budget - lines.length)
|
|
1409
|
+
const wanted = view.replyFocus ?? 0
|
|
1410
|
+
let focus = entries.findIndex((e) => e.no === wanted)
|
|
1411
|
+
if (focus < 0) focus = 0
|
|
1412
|
+
const follow = Math.max(0, focus - room + 1)
|
|
1413
|
+
const offset = Math.max(0, Math.min(Math.max(0, entries.length - room), Math.floor(view.replyOffset ?? follow) || 0))
|
|
1414
|
+
for (let i = offset; i < Math.min(entries.length, offset + room); i++) {
|
|
1415
|
+
const e = entries[i]
|
|
1416
|
+
const active = i === focus
|
|
1417
|
+
const cursor = active ? s.settingsCursor : ' '
|
|
1418
|
+
const head = ` ${cursor} `
|
|
1419
|
+
const bodyLine: Line = e.available
|
|
1420
|
+
? ln(
|
|
1421
|
+
seg(head, 'accent'),
|
|
1422
|
+
seg(replyRowLabel(e), active ? 'selected' : 'text'),
|
|
1423
|
+
seg(` · ${e.from}`, 'dim'),
|
|
1424
|
+
)
|
|
1425
|
+
: ln(
|
|
1426
|
+
seg(head, 'accent'),
|
|
1427
|
+
seg(fill(s.replySlotUnavailable, { no: e.no }), 'warn'),
|
|
1428
|
+
seg(`(${e.reason})`, 'dim'),
|
|
1429
|
+
)
|
|
1430
|
+
lines.push({
|
|
1431
|
+
line: truncLine(bodyLine, innerW),
|
|
1432
|
+
hits: ctx.view.tui ? [{ start: 1, end: Math.min(innerW, widthOf(bodyLine) + 1), action: { kind: 'reply-click', index: i } }] : undefined,
|
|
1433
|
+
})
|
|
1434
|
+
}
|
|
1435
|
+
return build(lines, {
|
|
1436
|
+
focus: entries[focus].no,
|
|
1437
|
+
offset,
|
|
1438
|
+
visible: Math.min(room, entries.length - offset),
|
|
1439
|
+
count: entries.length,
|
|
1440
|
+
})
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
/**
|
|
1444
|
+
* The open reply viewer: the committed body rendered as markdown, its declared metadata above it,
|
|
1445
|
+
* and a local unavailable notice when the body is missing or corrupt (the same return route either
|
|
1446
|
+
* way). It never fetches links, executes text or offers an editing action.
|
|
1447
|
+
*/
|
|
1448
|
+
function replyViewerBlock(ctx: Ctx): Block | null {
|
|
1449
|
+
const no = ctx.view.replyBody
|
|
1450
|
+
if (!no) return null
|
|
1451
|
+
const { s, blocks, deg } = ctx
|
|
1452
|
+
const innerW = blockInnerW(ctx)
|
|
1453
|
+
const budget = Math.max(2, ctx.replyDocRows ?? REPLY_DOC_ROWS_DEFAULT)
|
|
1454
|
+
const data = blocks.reply_body
|
|
1455
|
+
const build = (lines: PlacedLine[], doc?: ReplyDocWindow): Block => ({
|
|
1456
|
+
id: 'reply_viewer',
|
|
1457
|
+
full: true,
|
|
1458
|
+
priority: 1,
|
|
1459
|
+
separator: 'none',
|
|
1460
|
+
title: `#${no} ${s.replyHeading}`,
|
|
1461
|
+
lines,
|
|
1462
|
+
replyDoc: doc,
|
|
1463
|
+
summary: { line: truncLine(ln(seg(` ${s.replyHeading} #${no}`, 'heading')), ctx.width) },
|
|
1464
|
+
})
|
|
1465
|
+
const nav = replyNavLine(ctx, innerW)
|
|
1466
|
+
const back: Line = ln(seg(` ${s.replyBack}`, 'accent'), seg(` · ${s.keyDetailClose}`, 'dim'))
|
|
1467
|
+
const backLine: PlacedLine = {
|
|
1468
|
+
line: truncLine(back, innerW),
|
|
1469
|
+
hits: ctx.view.tui ? [{ start: 1, end: 1 + dispWidth(s.replyBack) + 2, action: { kind: 'reply-close' } }] : undefined,
|
|
1470
|
+
}
|
|
1471
|
+
if (!data || data.no !== no) {
|
|
1472
|
+
// A failed read says so and keeps its return route; only a read that is still in flight spins.
|
|
1473
|
+
const failed = ctx.view.replyBodyFailed === true || deg.has('reply_body')
|
|
1474
|
+
const notice = failed ? seg(` ${s.replyBodyMissing}`, 'warn') : seg(` ${s.replyLoading}`, 'dim')
|
|
1475
|
+
return build([nav, { line: truncLine(ln(notice), innerW) }, backLine], { no, total: 0, visible: 0, offset: 0 })
|
|
1476
|
+
}
|
|
1477
|
+
if (data.available === false) {
|
|
1478
|
+
return build([nav, { line: truncLine(ln(seg(` ${s.replyBodyMissing}`, 'warn')), innerW) }, backLine], { no, total: 0, visible: 0, offset: 0 })
|
|
1479
|
+
}
|
|
1480
|
+
const meta: PlacedLine[] = [
|
|
1481
|
+
{ line: truncLine(ln(seg(` ${data.title}`, 'heading')), innerW) },
|
|
1482
|
+
{ line: truncLine(ln(seg(` ${fill(s.replyDeclared, { from: data.from, at: data.at })}`, 'dim')), innerW) },
|
|
1483
|
+
{ line: truncLine(ln(seg(` ${s.replyBodyHint} · ${data.bytes} B`, 'dim')), innerW) },
|
|
1484
|
+
]
|
|
1485
|
+
const doc = markdownMemo(`reply:${no}`, data.display_text ?? '', innerW)
|
|
1486
|
+
const available = Math.max(1, budget - nav0Length(meta))
|
|
1487
|
+
const maxStart = Math.max(0, doc.length - available)
|
|
1488
|
+
const offset = Math.max(0, Math.min(maxStart, Math.floor(ctx.view.replyScroll ?? 0) || 0))
|
|
1489
|
+
const lines: PlacedLine[] = [nav, ...meta]
|
|
1490
|
+
for (let i = offset; i < Math.min(doc.length, offset + available); i++) lines.push(doc[i])
|
|
1491
|
+
lines.push(backLine)
|
|
1492
|
+
return build(lines, { no, total: doc.length, visible: Math.min(available, Math.max(0, doc.length - offset)), offset })
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
/** The rows the viewer spends before its document (meta + nav + the back row). */
|
|
1496
|
+
function nav0Length(meta: PlacedLine[]): number {
|
|
1497
|
+
return meta.length + 2
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
/** The overview's latest-reply entry: number, safe title and declared publisher, or empty/unavailable. */
|
|
1501
|
+
function replySummaryBlock(ctx: Ctx): Block | null {
|
|
1502
|
+
if (!ctx.view.tui) return null // console-only: `--print`/`--json` render the overview without it
|
|
1503
|
+
const { s, blocks, deg, width } = ctx
|
|
1504
|
+
const d = blocks.reply_summary
|
|
1505
|
+
const hint = ` ${s.replyLatest} `
|
|
1506
|
+
const line: Line = [seg(hint, 'heading')]
|
|
1507
|
+
const hits: Hit[] = []
|
|
1508
|
+
let x = dispWidth(hint)
|
|
1509
|
+
hits.push({ start: 1, end: x, action: { kind: 'page', page: 5 } })
|
|
1510
|
+
const entry = d && d.available && d.state === 'ok' ? d.entry : undefined
|
|
1511
|
+
if (!d || deg.has('reply_summary')) {
|
|
1512
|
+
line.push(seg(s.dash, 'dim'))
|
|
1513
|
+
} else if (entry && entry.available) {
|
|
1514
|
+
const text = `#${entry.no} ${entry.title} · ${entry.from}`
|
|
1515
|
+
line.push(seg(text, 'text'))
|
|
1516
|
+
hits.push({ start: x, end: x + dispWidth(text), action: { kind: 'reply-open-latest', no: entry.no } })
|
|
1517
|
+
x += dispWidth(text)
|
|
1518
|
+
const at = ` · ${entry.at}`
|
|
1519
|
+
line.push(seg(at, 'dim'))
|
|
1520
|
+
x += dispWidth(at)
|
|
1521
|
+
} else if (d.state === 'empty') {
|
|
1522
|
+
line.push(seg(s.replyEmpty, 'dim'))
|
|
1523
|
+
} else {
|
|
1524
|
+
line.push(seg(s.replyUnavailable, 'warn'))
|
|
1525
|
+
const reason = d.reason ? `(${d.reason})` : ''
|
|
1526
|
+
if (reason) line.push(seg(reason, 'dim'))
|
|
1527
|
+
}
|
|
1528
|
+
const chip = ` [5] `
|
|
1529
|
+
hits.push({ start: x + 1, end: x + 1 + dispWidth(chip), action: { kind: 'page', page: 5 } })
|
|
1530
|
+
line.push(seg(chip, 'accent'))
|
|
1531
|
+
return {
|
|
1532
|
+
id: 'reply_summary',
|
|
1533
|
+
title: s.replyLatest,
|
|
1534
|
+
priority: 9,
|
|
1535
|
+
lines: [placedWithHits(line, hits, width)],
|
|
1536
|
+
summary: { line: truncLine(ln(seg(` ${s.replyLatest}`, 'heading')), width) },
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1291
1540
|
// ------------------------------------------------------------------ project settings (P22/B2)
|
|
1292
1541
|
//
|
|
1293
1542
|
// The view is a listing of the contract: one row per schema key plus one per key the file carries
|
|
1294
1543
|
// that the schema does not know, grouped by the functional domain the **command** reports on the
|
|
1295
|
-
// row's `group` (P30 — the console owns no second table)
|
|
1296
|
-
//
|
|
1297
|
-
//
|
|
1298
|
-
//
|
|
1544
|
+
// row's `group` (P30 — the console owns no second table). Under the keys the view carries the two
|
|
1545
|
+
// halves of the model policy the command reports (P232): the **future** policy's category rows
|
|
1546
|
+
// (editable, one `set-task-model` per row) and the **committed** assignments plus the PM launch
|
|
1547
|
+
// record (read-only). The two halves are rendered under separate headings and never merged: a
|
|
1548
|
+
// future category model is never displayed as a seat's actual model.
|
|
1549
|
+
//
|
|
1550
|
+
// Rows, groups and classes come from the `settings` block's JSON at render time; a key added to the
|
|
1551
|
+
// command's schema shows up without rebuilding `panel.js`. The list is windowed against the height
|
|
1552
|
+
// the assembly hands over (the bounded-frame rule: more pane means more rows, never more blank).
|
|
1299
1553
|
|
|
1300
1554
|
// The row's identity column is a **label** (M49), not the key name: the table's labels are human
|
|
1301
1555
|
// sentences, so the column only has to hold the longest of them (zh is the wide language here;
|
|
1302
1556
|
// a longer en label is cut by `cell()`, the same rule the key names followed).
|
|
1303
1557
|
const SETTINGS_LABEL_W = 22
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
//
|
|
1309
|
-
//
|
|
1310
|
-
//
|
|
1311
|
-
//
|
|
1558
|
+
/** P232: the policy migration diagnosis is shown above the audit tail; the rest is counted. */
|
|
1559
|
+
const SETTINGS_DIAG_LINES = 2
|
|
1560
|
+
/** P232: how many frame lines one diagnosis line may wrap to before it is cut with an ellipsis. */
|
|
1561
|
+
const SETTINGS_DIAG_WRAP = 2
|
|
1562
|
+
// The tail the block draws under its row window: the focused row's CLI hint and, when the command
|
|
1563
|
+
// reports one, the policy migration diagnosis (P266: the audit tail is no longer drawn here — the
|
|
1564
|
+
// log stays readable through `team config list`'s own footer and `team config log`, and the console
|
|
1565
|
+
// is deliberately not one of its readers), plus `SETTINGS_COUNT_ROWS`, the pessimistic reservation
|
|
1566
|
+
// for the two hidden-row counts (`↑n`/`↓n`). Reserving **both** counts is what keeps the block inside
|
|
1567
|
+
// the frame once the list is longer than the window: with only the tail reserved, a full window
|
|
1568
|
+
// plus a full tail overflowed and the whole view degraded to its one-line summary (measured in
|
|
1569
|
+
// M55's pairlist route: the seats block the route had just focused disappeared from the frame).
|
|
1312
1570
|
//
|
|
1313
1571
|
// P32 (the user's second report, 2026-09-22): the reservation is a *ceiling*, not a fixed cost. The
|
|
1314
1572
|
// window spends what the tail does not need (a count line is only drawn when the window really
|
|
@@ -1317,21 +1575,21 @@ const SETTINGS_AUDIT_LINES = 3
|
|
|
1317
1575
|
const SETTINGS_COUNT_ROWS = 2
|
|
1318
1576
|
|
|
1319
1577
|
/**
|
|
1320
|
-
* The
|
|
1321
|
-
*
|
|
1322
|
-
*
|
|
1323
|
-
*
|
|
1324
|
-
*
|
|
1325
|
-
* records against. Their cards still fill (the pad below), so the key band stays the frame's last row.
|
|
1578
|
+
* The two pickers' *paged* list bound (M55's calibrated value, kept: a picker covers the row list, so
|
|
1579
|
+
* this reservation is its own chrome — title + interval + the two hidden-count lines + blank + hint).
|
|
1580
|
+
* A long vocabulary shows a `↑n`/`↓n` window that scrolls instead of flooding the pane, which is what
|
|
1581
|
+
* the archived `choices` fixture calibrates its twenty-eight model records against. Their cards still
|
|
1582
|
+
* fill (the pad below), so the key band stays the frame's last row.
|
|
1326
1583
|
*/
|
|
1327
|
-
const SETTINGS_TAIL_ROWS = SETTINGS_COUNT_ROWS +
|
|
1584
|
+
const SETTINGS_TAIL_ROWS = SETTINGS_COUNT_ROWS + 6
|
|
1328
1585
|
|
|
1329
1586
|
/** One drawn row of the project-settings view (group headings are not focusable). */
|
|
1330
1587
|
export type SettingsRow =
|
|
1331
1588
|
| { kind: 'group'; label: string; tone: Tone }
|
|
1332
1589
|
| { kind: 'key'; key: SettingsKey }
|
|
1333
|
-
| { kind: '
|
|
1334
|
-
| { kind: '
|
|
1590
|
+
| { kind: 'category'; category: SettingsCategory }
|
|
1591
|
+
| { kind: 'assignment'; assignment: SettingsAssignment }
|
|
1592
|
+
| { kind: 'pm-launch'; launch: SettingsPmLaunch }
|
|
1335
1593
|
|
|
1336
1594
|
export function settingsClassLabel(s: Strings, cls: string): string {
|
|
1337
1595
|
if (cls === 'restart') return s.settingsBadgeRestart
|
|
@@ -1345,6 +1603,18 @@ export function settingsClassLabel(s: Strings, cls: string): string {
|
|
|
1345
1603
|
* shout in green while the user's question is "does this need a restart?". Colour is never the only
|
|
1346
1604
|
* channel: the badge's word always carries the class (the panel's standing rule).
|
|
1347
1605
|
*/
|
|
1606
|
+
/**
|
|
1607
|
+
* The declared marker the owning command puts at the start of a fixture-only key's note
|
|
1608
|
+
* (`memory-and-deps` owns the marker). The hiding rule reads the read's data and nothing else: no
|
|
1609
|
+
* key list is baked into the bundle, so a fixture key added to the schema stays hidden and one whose
|
|
1610
|
+
* marker is removed comes back without rebuilding `panel.js`.
|
|
1611
|
+
*/
|
|
1612
|
+
const SETTINGS_FIXTURE_ONLY_MARKER = 'fixture-only: '
|
|
1613
|
+
|
|
1614
|
+
function settingsKeyHidden(k: SettingsKey): boolean {
|
|
1615
|
+
return String(k.route ?? '').startsWith(SETTINGS_FIXTURE_ONLY_MARKER)
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1348
1618
|
function settingsClassTone(cls: string): Tone {
|
|
1349
1619
|
if (cls === 'restart') return 'warn'
|
|
1350
1620
|
if (cls === 'refuse') return 'dim'
|
|
@@ -1361,23 +1631,37 @@ function groupLabel(s: Strings, token: string): string {
|
|
|
1361
1631
|
return typeof label === 'string' && label.length > 0 ? label : token
|
|
1362
1632
|
}
|
|
1363
1633
|
|
|
1364
|
-
/**
|
|
1634
|
+
/**
|
|
1635
|
+
* The CLI's own three source labels (the console invents no fourth state).
|
|
1636
|
+
*
|
|
1637
|
+
* The committed record's provenance: `selected_via`/`launch_via` are the CLI's own closed tokens
|
|
1638
|
+
* (`explicit`/`policy`/`assignment`, plus the legacy spellings it still reports). The console only
|
|
1639
|
+
* spells them; it never derives them.
|
|
1640
|
+
*/
|
|
1365
1641
|
export function settingsSourceLabel(s: Strings, source: string): string {
|
|
1366
1642
|
if (source === 'explicit') return s.seatSourceExplicit
|
|
1643
|
+
if (source === 'policy') return s.seatSourcePolicy
|
|
1644
|
+
if (source === 'assignment') return s.seatSourceAssignment
|
|
1367
1645
|
if (source === 'record') return s.seatSourceRecord
|
|
1368
|
-
return s.
|
|
1646
|
+
return source || s.dash
|
|
1369
1647
|
}
|
|
1370
1648
|
|
|
1371
1649
|
/**
|
|
1372
1650
|
* The view's filtered row list: the contract's keys grouped by the **record's** `group` (P30/D1-D3),
|
|
1373
|
-
* in the read's own order, then the
|
|
1374
|
-
* it moves the focus, so the keys can never
|
|
1651
|
+
* in the read's own order, then the future policy's category rows and the committed assignments.
|
|
1652
|
+
* Pure and exported: the App walks exactly this list when it moves the focus, so the keys can never
|
|
1653
|
+
* disagree with what is on screen.
|
|
1375
1654
|
*
|
|
1376
1655
|
* The bundle owns no key→group table and no group list: the walk opens a heading whenever the
|
|
1377
1656
|
* token changes, so a key (or a whole group) added to the command's schema appears under its
|
|
1378
1657
|
* reported heading with the committed bundle. Rows whose token is empty — a schema row that
|
|
1379
1658
|
* declares none, or a key the file carries and the schema does not know — are never dropped: they
|
|
1380
|
-
* collect into one visible trailing fallback heading, before the
|
|
1659
|
+
* collect into one visible trailing fallback heading, before the categories block.
|
|
1660
|
+
*
|
|
1661
|
+
* P232: the categories block (the future policy) comes before the assignments block (the committed
|
|
1662
|
+
* records), each with its own heading, so "what the next task will use" and "what is actually
|
|
1663
|
+
* running" are never read as the same list. A seat with no complete record still gets a row that
|
|
1664
|
+
* says so — it is never filled in from the policy above.
|
|
1381
1665
|
*/
|
|
1382
1666
|
export function settingsViewRows(block: SettingsBlock | undefined, filter: string, s: Strings): SettingsRow[] {
|
|
1383
1667
|
const out: SettingsRow[] = []
|
|
@@ -1387,8 +1671,12 @@ export function settingsViewRows(block: SettingsBlock | undefined, filter: strin
|
|
|
1387
1671
|
needle === '' || parts.some((p) => String(p ?? '').toLowerCase().includes(needle))
|
|
1388
1672
|
// The label first (what the row shows), then the raw key and the value — the three inputs a
|
|
1389
1673
|
// user may type into `/` (the label's words, `TEAM_…`, or the value on screen).
|
|
1390
|
-
|
|
1391
|
-
|
|
1674
|
+
// P266: a key the read marks fixture-only is not a row at all — no row, no heading of its own and
|
|
1675
|
+
// no `/` hit (it is dropped before the match, so not even its label or raw name can reach it).
|
|
1676
|
+
const shown = block.keys.filter(
|
|
1677
|
+
(k) =>
|
|
1678
|
+
!settingsKeyHidden(k) &&
|
|
1679
|
+
match(keyLabel(s, k.name), k.name, k.value, k.default, k.comment, k.warning, k.route ?? ''),
|
|
1392
1680
|
)
|
|
1393
1681
|
const ungrouped: SettingsKey[] = []
|
|
1394
1682
|
let openToken: string | null = null
|
|
@@ -1408,16 +1696,35 @@ export function settingsViewRows(block: SettingsBlock | undefined, filter: strin
|
|
|
1408
1696
|
out.push({ kind: 'group', label: s.settingsGroupUngrouped, tone: 'heading' })
|
|
1409
1697
|
for (const k of ungrouped) out.push({ kind: 'key', key: k })
|
|
1410
1698
|
}
|
|
1411
|
-
const
|
|
1412
|
-
match(
|
|
1699
|
+
const categories = (block.models?.policy?.categories ?? []).filter((c) =>
|
|
1700
|
+
match(fill(s.settingsCategoryRow, { category: c.category }), c.category, c.model),
|
|
1701
|
+
)
|
|
1702
|
+
if (categories.length) {
|
|
1703
|
+
out.push({ kind: 'group', label: s.settingsGroupCategories, tone: 'heading' })
|
|
1704
|
+
for (const c of categories) out.push({ kind: 'category', category: c })
|
|
1705
|
+
}
|
|
1706
|
+
// P266: the command's diagnostic is deliberately not searchable here — it never reaches the
|
|
1707
|
+
// screen, so `/` must not find a row for a string the user cannot see anywhere.
|
|
1708
|
+
const assignments = (block.models?.assignments ?? []).filter((a) =>
|
|
1709
|
+
match(a.agent, a.task, a.category, a.model, a.sid, a.selected_via, a.launch_via),
|
|
1413
1710
|
)
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1711
|
+
const launch = block.models?.pm_launch ?? {}
|
|
1712
|
+
const launchShown =
|
|
1713
|
+
Object.keys(launch).length > 0 &&
|
|
1714
|
+
match(s.settingsPmLaunchLabel, String(launch.model ?? ''), String(launch.mode ?? ''), String(launch.window ?? ''))
|
|
1715
|
+
if (assignments.length || launchShown) {
|
|
1716
|
+
out.push({ kind: 'group', label: s.settingsGroupAssignments, tone: 'heading' })
|
|
1717
|
+
for (const a of assignments) out.push({ kind: 'assignment', assignment: a })
|
|
1718
|
+
if (launchShown) out.push({ kind: 'pm-launch', launch })
|
|
1417
1719
|
}
|
|
1418
1720
|
return out
|
|
1419
1721
|
}
|
|
1420
1722
|
|
|
1723
|
+
/** True for the rows the focus walk may stop on (headings are not focusable). */
|
|
1724
|
+
export function settingsRowFocusable(row: SettingsRow): row is Exclude<SettingsRow, { kind: 'group' }> {
|
|
1725
|
+
return row.kind !== 'group'
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1421
1728
|
/**
|
|
1422
1729
|
* The badge + value column shared by a key row and a seat row. The class tone covers the **badge
|
|
1423
1730
|
* only** (P30/D4): the value beside it stays in the plain text tone, because a class meaning is
|
|
@@ -1452,37 +1759,153 @@ function settingsKeyLine(ctx: Ctx, row: SettingsKey, focused: boolean, innerW: n
|
|
|
1452
1759
|
return { line }
|
|
1453
1760
|
}
|
|
1454
1761
|
|
|
1455
|
-
|
|
1762
|
+
/**
|
|
1763
|
+
* One policy-diagnosis line, wrapped to at most `maxLines` frame lines (P232). The command's lines
|
|
1764
|
+
* are long — the reason, the retired key and the CLI route in one sentence — and a plain tail
|
|
1765
|
+
* truncation cut exactly the route off (measured: `…修法:team config upgrade-mo…` on a 160-column
|
|
1766
|
+
* pane). The text is therefore drawn **verbatim** across lines, and only a line that still does not
|
|
1767
|
+
* fit inside `maxLines` is cut, with a visible ellipsis on its last drawn line.
|
|
1768
|
+
*/
|
|
1769
|
+
/**
|
|
1770
|
+
* Cut to at most `w` columns **without** the `…` `truncateW` appends: the wrapping primitive below
|
|
1771
|
+
* draws every cell itself and only marks a line that really had to be dropped.
|
|
1772
|
+
*/
|
|
1773
|
+
function cutW(s: string, w: number): string {
|
|
1774
|
+
let used = 0
|
|
1775
|
+
let out = ''
|
|
1776
|
+
for (const ch of String(s)) {
|
|
1777
|
+
const cw = charWidth(ch)
|
|
1778
|
+
if (used + cw > w) break
|
|
1779
|
+
used += cw
|
|
1780
|
+
out += ch
|
|
1781
|
+
}
|
|
1782
|
+
return out
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
/**
|
|
1786
|
+
* One policy-diagnosis line, wrapped to at most `maxLines` frame lines (P232). The command's lines
|
|
1787
|
+
* are long — the reason, the retired key and the CLI route in one sentence — and a plain tail
|
|
1788
|
+
* truncation cut exactly the route off (measured: `…修法:team config upgrade-mo…` on a 160-column
|
|
1789
|
+
* pane). The text is therefore drawn **verbatim** across lines, broken at a whitespace when there
|
|
1790
|
+
* is one inside the width (so a command name stays whole instead of splitting mid-word); only text
|
|
1791
|
+
* that still does not fit inside `maxLines` is dropped, marked with a visible `…`.
|
|
1792
|
+
*/
|
|
1793
|
+
function diagnoseChunks(text: string, width: number, maxLines: number): string[] {
|
|
1794
|
+
const out: string[] = []
|
|
1795
|
+
let rest = text
|
|
1796
|
+
while (rest !== '' && out.length < maxLines) {
|
|
1797
|
+
if (dispWidth(rest) <= width) {
|
|
1798
|
+
out.push(rest)
|
|
1799
|
+
rest = ''
|
|
1800
|
+
break
|
|
1801
|
+
}
|
|
1802
|
+
let chunk = cutW(rest, width)
|
|
1803
|
+
if (chunk === '') break
|
|
1804
|
+
// Mid-word cuts only happen when no whitespace is available inside the width (a long path).
|
|
1805
|
+
if (rest.slice(chunk.length, chunk.length + 1) !== '' && rest.slice(chunk.length, chunk.length + 1) !== ' ') {
|
|
1806
|
+
const space = chunk.lastIndexOf(' ')
|
|
1807
|
+
if (space > 0) chunk = chunk.slice(0, space + 1)
|
|
1808
|
+
}
|
|
1809
|
+
out.push(chunk)
|
|
1810
|
+
rest = rest.slice(chunk.length)
|
|
1811
|
+
}
|
|
1812
|
+
if (rest !== '') {
|
|
1813
|
+
const last = out[out.length - 1] ?? ''
|
|
1814
|
+
out[out.length - 1] = cutW(last, Math.max(1, width - 1)) + '…'
|
|
1815
|
+
}
|
|
1816
|
+
return out
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1819
|
+
/**
|
|
1820
|
+
* One future-policy category row (P232). The category token is the row's identity (the project
|
|
1821
|
+
* defines it; there is no table entry for a project's own vocabulary), the value is the model the
|
|
1822
|
+
* next new task of that category will get, and the badge says "new tasks" so the row cannot be
|
|
1823
|
+
* read as a running seat. The command line under the list names the one write it offers.
|
|
1824
|
+
*/
|
|
1825
|
+
function settingsCategoryLine(ctx: Ctx, cat: SettingsCategory, focused: boolean, innerW: number): PlacedLine {
|
|
1456
1826
|
const { s } = ctx
|
|
1457
|
-
const model = seat.model || s.dash
|
|
1458
|
-
const policy = seat.override ? s.seatOverride : s.seatFallback
|
|
1459
1827
|
const line = ln(
|
|
1460
1828
|
seg(`${focused ? s.settingsCursor : ' '} `, 'accent'),
|
|
1461
|
-
seg(cell(
|
|
1462
|
-
...settingsRight(ctx,
|
|
1829
|
+
seg(cell(fill(s.settingsCategoryRow, { category: cat.category }), SETTINGS_LABEL_W), focused ? 'selected' : 'heading'),
|
|
1830
|
+
...settingsRight(ctx, cat.model || s.dash, s.settingsCategoryBadge, 'text', innerW).map((x) => x),
|
|
1463
1831
|
)
|
|
1464
1832
|
return { line }
|
|
1465
1833
|
}
|
|
1466
1834
|
|
|
1467
1835
|
/**
|
|
1468
|
-
*
|
|
1469
|
-
*
|
|
1470
|
-
*
|
|
1471
|
-
* that would be refused; a seat gets its own `set-agent-model` route. '' when nothing is focusable.
|
|
1836
|
+
* One read-only committed assignment row (P232): the seat, its actual model, the origin tokens the
|
|
1837
|
+
* CLI recorded and — on the note — the task, category and SID. `assigned=false` shows the command's
|
|
1838
|
+
* own diagnostic instead of inventing a model from the policy above.
|
|
1472
1839
|
*/
|
|
1473
|
-
function
|
|
1474
|
-
const
|
|
1475
|
-
|
|
1840
|
+
function settingsAssignmentLine(ctx: Ctx, a: SettingsAssignment, focused: boolean, innerW: number): PlacedLine {
|
|
1841
|
+
const { s } = ctx
|
|
1842
|
+
const line = ln(
|
|
1843
|
+
seg(`${focused ? s.settingsCursor : ' '} `, 'accent'),
|
|
1844
|
+
seg(cell(a.agent, SETTINGS_LABEL_W), focused ? 'selected' : 'heading'),
|
|
1845
|
+
...settingsRight(
|
|
1846
|
+
ctx,
|
|
1847
|
+
a.assigned ? a.model || s.dash : s.dash,
|
|
1848
|
+
s.settingsReadOnlyBadge,
|
|
1849
|
+
'dim',
|
|
1850
|
+
innerW,
|
|
1851
|
+
).map((x) => x),
|
|
1476
1852
|
)
|
|
1853
|
+
// P266: the command's diagnostic string never reaches the screen. The two plain reasons are chosen
|
|
1854
|
+
// from the read's own fact (`record_present`): no record file at all vs. a record that exists but
|
|
1855
|
+
// cannot be read — a seat that was used is never told it never was.
|
|
1856
|
+
const note = a.assigned
|
|
1857
|
+
? fill(s.settingsAssignmentNote, {
|
|
1858
|
+
task: a.task || s.dash,
|
|
1859
|
+
category: a.category || s.dash,
|
|
1860
|
+
sid: a.sid || s.dash,
|
|
1861
|
+
selected: settingsSourceLabel(s, a.selected_via),
|
|
1862
|
+
launch: settingsSourceLabel(s, a.launch_via),
|
|
1863
|
+
})
|
|
1864
|
+
: a.record_present === false
|
|
1865
|
+
? s.settingsAssignmentNone
|
|
1866
|
+
: s.settingsAssignmentUnreadable
|
|
1867
|
+
line.push(seg(` ${truncateW(note, Math.max(8, innerW - dispWidth(textOf(line)) - 2))}`, a.assigned ? 'dim' : 'warn'))
|
|
1868
|
+
return { line }
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1871
|
+
/** The PM's own last launch record, read-only — never a worker seat and never a policy row. */
|
|
1872
|
+
function settingsPmLaunchLine(ctx: Ctx, launch: SettingsPmLaunch, focused: boolean, innerW: number): PlacedLine {
|
|
1873
|
+
const { s } = ctx
|
|
1874
|
+
const line = ln(
|
|
1875
|
+
seg(`${focused ? s.settingsCursor : ' '} `, 'accent'),
|
|
1876
|
+
seg(cell(s.settingsPmLaunchLabel, SETTINGS_LABEL_W), focused ? 'selected' : 'heading'),
|
|
1877
|
+
...settingsRight(ctx, launch.model || s.dash, s.settingsReadOnlyBadge, 'dim', innerW).map((x) => x),
|
|
1878
|
+
)
|
|
1879
|
+
const note = fill(s.settingsPmLaunchNote, {
|
|
1880
|
+
window: launch.window || s.dash,
|
|
1881
|
+
mode: launch.mode || s.dash,
|
|
1882
|
+
time: launch.time || s.dash,
|
|
1883
|
+
})
|
|
1884
|
+
line.push(seg(` ${truncateW(note, Math.max(8, innerW - dispWidth(textOf(line)) - 2))}`, 'dim'))
|
|
1885
|
+
return { line }
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
/**
|
|
1889
|
+
* The focused row as the command line names it (M49/P232): the row's label is for reading, the raw
|
|
1890
|
+
* key or the category token is what the user types — this line is the CLI-alignment half of the
|
|
1891
|
+
* pair. A key the command does not know (schema unknown) and a read-only key are said out loud
|
|
1892
|
+
* rather than offered as a command that would be refused; a category names its own `set-task-model`
|
|
1893
|
+
* route, and a committed assignment says it is the dispatch's decision, never a console write.
|
|
1894
|
+
* '' when nothing is focusable.
|
|
1895
|
+
*/
|
|
1896
|
+
function settingsCliHint(s: Strings, rows: SettingsRow[], focus: number): string {
|
|
1897
|
+
const focusable = rows.filter(settingsRowFocusable)
|
|
1477
1898
|
const row = focusable[focus]
|
|
1478
1899
|
if (!row) return ''
|
|
1479
|
-
if (row.kind === '
|
|
1900
|
+
if (row.kind === 'category') return fill(s.settingsCategoryHint, { category: row.category.category })
|
|
1901
|
+
if (row.kind === 'assignment') return s.settingsAssignmentHint
|
|
1902
|
+
if (row.kind === 'pm-launch') return s.settingsPmLaunchHint
|
|
1480
1903
|
const key = row.key
|
|
1481
1904
|
if (key.known === false) return fill(s.settingsUnknownHint, { key: key.name })
|
|
1482
|
-
if (key.class === 'refuse') return
|
|
1483
|
-
// The
|
|
1484
|
-
// requirement names is the per-
|
|
1485
|
-
if (String(key.kind ?? '') === '
|
|
1905
|
+
if (key.class === 'refuse') return s.settingsRefusedHint
|
|
1906
|
+
// The whole-map row is not composed here: its editor is the categories block, and the command
|
|
1907
|
+
// line the requirement names is the per-category one (P232).
|
|
1908
|
+
if (String(key.kind ?? '') === 'task-model-map') return s.settingsCategoryMapHint
|
|
1486
1909
|
return fill(s.settingsCliHint, { key: key.name })
|
|
1487
1910
|
}
|
|
1488
1911
|
|
|
@@ -1518,7 +1941,7 @@ function settingsBlock(ctx: Ctx): Block | null {
|
|
|
1518
1941
|
}
|
|
1519
1942
|
const rows = settingsViewRows(block, ctx.view.settingsFilter ?? '', s)
|
|
1520
1943
|
let count = 0
|
|
1521
|
-
for (const r of rows) if (r
|
|
1944
|
+
for (const r of rows) if (settingsRowFocusable(r)) count += 1
|
|
1522
1945
|
// P32: the block's budget is the **lines** it may draw below the card frame — the assembly hands
|
|
1523
1946
|
// over everything the page's other blocks leave (`budget - fullRows - the frame's two rows`), and
|
|
1524
1947
|
// the tail is spent out of that same budget, so what the tail does not need goes to real rows
|
|
@@ -1526,10 +1949,19 @@ function settingsBlock(ctx: Ctx): Block | null {
|
|
|
1526
1949
|
const room = Math.max(3, ctx.settingsRows ?? 12)
|
|
1527
1950
|
const focus = Math.max(0, Math.min(Math.max(0, count - 1), ctx.view.settingsFocus ?? 0))
|
|
1528
1951
|
const explicitOffset = ctx.view.settingsOffset
|
|
1529
|
-
//
|
|
1530
|
-
//
|
|
1531
|
-
const
|
|
1532
|
-
|
|
1952
|
+
// P232: the command's own policy diagnosis (missing/retired keys, an unmapped category map) is
|
|
1953
|
+
// part of the view: a legacy contract must say so, with the CLI route the command itself names.
|
|
1954
|
+
const diagnosis = String(block.models?.diagnostic ?? '')
|
|
1955
|
+
.split('\n')
|
|
1956
|
+
.map((l) => l.trim())
|
|
1957
|
+
.filter((l) => l !== '')
|
|
1958
|
+
const diagShown = diagnosis.slice(0, SETTINGS_DIAG_LINES)
|
|
1959
|
+
const diagRest = diagnosis.length - diagShown.length
|
|
1960
|
+
const diagChunks = diagShown.map((d) => diagnoseChunks(d, Math.max(8, width - 3), SETTINGS_DIAG_WRAP))
|
|
1961
|
+
const diagLines = diagChunks.length ? diagChunks.reduce((n, c) => n + c.length, 0) + 1 + (diagRest > 0 ? 1 : 0) : 0
|
|
1962
|
+
// P266: the tail is the focused row's CLI hint plus the diagnosis when there is one; the audit
|
|
1963
|
+
// tail that used to sit here is no longer drawn (and no longer reads the log).
|
|
1964
|
+
const tailLines = 1 + diagLines
|
|
1533
1965
|
// The row cap: each row costs at least its own line, and the tail is already spoken for.
|
|
1534
1966
|
const desired = Math.max(1, Math.min(Math.max(1, count), Math.max(1, room - tailLines)))
|
|
1535
1967
|
const maxOffset = Math.max(0, count - desired)
|
|
@@ -1551,7 +1983,7 @@ function settingsBlock(ctx: Ctx): Block | null {
|
|
|
1551
1983
|
const units: { heading: number }[] = []
|
|
1552
1984
|
let pendingHeading = 0
|
|
1553
1985
|
for (const r of rows) {
|
|
1554
|
-
if (r
|
|
1986
|
+
if (!settingsRowFocusable(r)) {
|
|
1555
1987
|
pendingHeading = 1
|
|
1556
1988
|
continue
|
|
1557
1989
|
}
|
|
@@ -1643,7 +2075,17 @@ function settingsBlock(ctx: Ctx): Block | null {
|
|
|
1643
2075
|
}
|
|
1644
2076
|
return marks.length ? `${base} · ${marks.join(' · ')}` : base
|
|
1645
2077
|
}
|
|
1646
|
-
put(
|
|
2078
|
+
put(
|
|
2079
|
+
ln(
|
|
2080
|
+
seg(
|
|
2081
|
+
choice.category
|
|
2082
|
+
? ` ${fill(s.settingsCategoryPickerTitle, { category: choice.key })}`
|
|
2083
|
+
: ` ${fill(s.settingsChoiceTitle, { label: keyLabel(s, choice.key), key: choice.key })}`,
|
|
2084
|
+
'heading',
|
|
2085
|
+
),
|
|
2086
|
+
),
|
|
2087
|
+
)
|
|
2088
|
+
if (choice.category) put(ln(seg(` ${s.settingsCategoryPickerHint}`, 'dim')))
|
|
1647
2089
|
if (choice.interval) {
|
|
1648
2090
|
put(
|
|
1649
2091
|
ln(
|
|
@@ -1669,40 +2111,13 @@ function settingsBlock(ctx: Ctx): Block | null {
|
|
|
1669
2111
|
const entryHiddenBelow = Math.max(0, entries.length - (entryOffset + entryVisible))
|
|
1670
2112
|
if (entryHiddenBelow > 0) put(ln(seg(` ${fill(s.laneHiddenBelow, { n: String(entryHiddenBelow) })}`, 'dim')))
|
|
1671
2113
|
put(ln(seg('')))
|
|
1672
|
-
put(ln(seg(` ${s.settingsChoiceHint}`, 'dim')))
|
|
2114
|
+
put(ln(seg(` ${choice.category ? s.settingsCategoryPickerHint : s.settingsChoiceHint}`, 'dim')))
|
|
1673
2115
|
// P32: a picker covers the row list, so what its own entries do not use stays inside the card
|
|
1674
2116
|
// (the fill rule below); a short picker must not leave the pane half blank either.
|
|
1675
2117
|
while (lines.length < room) put(ln(seg('')))
|
|
1676
2118
|
return one(lines, { focus: sel, offset: entryOffset, visible: entryVisible, count: entries.length })
|
|
1677
2119
|
}
|
|
1678
2120
|
|
|
1679
|
-
// The seat picker (P22/B4): the models the command reports as known, then the removal and the
|
|
1680
|
-
// free-text line — the editor opens on whichever is chosen.
|
|
1681
|
-
const picker = ctx.view.seatPicker
|
|
1682
|
-
if (picker) {
|
|
1683
|
-
const options = [...picker.models, '-', '']
|
|
1684
|
-
const sel = Math.max(0, Math.min(options.length - 1, picker.index))
|
|
1685
|
-
const lines: PlacedLine[] = []
|
|
1686
|
-
const put = (line: Line): void => {
|
|
1687
|
-
lines.push({ line: truncLine(line, width) })
|
|
1688
|
-
}
|
|
1689
|
-
put(ln(seg(` ${fill(s.seatPickerTitle, { seat: picker.agent })}`, 'heading')))
|
|
1690
|
-
options.forEach((opt, i) => {
|
|
1691
|
-
const label = opt === '-' ? s.seatPickerRemove : opt === '' ? s.seatPickerFree : opt
|
|
1692
|
-
const row = ln(
|
|
1693
|
-
seg(`${i === sel ? s.settingsCursor : ' '} `, 'accent'),
|
|
1694
|
-
seg(label, i === sel ? 'selected' : opt === '' || opt === '-' ? 'dim' : 'text'),
|
|
1695
|
-
)
|
|
1696
|
-
const action: Action = { kind: 'seat-pick', index: i }
|
|
1697
|
-
const rowW = Math.max(2, Math.min(width, 1 + dispWidth(textOf(row))))
|
|
1698
|
-
lines.push(placedWithHits(row, ctx.view.tui ? [{ start: 1, end: rowW, action }] : undefined, width))
|
|
1699
|
-
})
|
|
1700
|
-
put(ln(seg('')))
|
|
1701
|
-
put(ln(seg(` ${s.seatPickerHint}`, 'dim')))
|
|
1702
|
-
while (lines.length < room) put(ln(seg('')))
|
|
1703
|
-
return one(lines, { focus: sel, offset: 0, visible: options.length, count: options.length })
|
|
1704
|
-
}
|
|
1705
|
-
|
|
1706
2121
|
const lines: PlacedLine[] = []
|
|
1707
2122
|
const hiddenAbove = offset
|
|
1708
2123
|
const hiddenBelow = Math.max(0, count - (offset + visible))
|
|
@@ -1713,11 +2128,18 @@ function settingsBlock(ctx: Ctx): Block | null {
|
|
|
1713
2128
|
|
|
1714
2129
|
let idx = -1
|
|
1715
2130
|
for (const r of rows) {
|
|
1716
|
-
if (r
|
|
2131
|
+
if (settingsRowFocusable(r)) {
|
|
1717
2132
|
idx += 1
|
|
1718
2133
|
if (idx < offset || idx >= offset + visible) continue
|
|
1719
2134
|
const focused = idx === focus
|
|
1720
|
-
const placed =
|
|
2135
|
+
const placed =
|
|
2136
|
+
r.kind === 'key'
|
|
2137
|
+
? settingsKeyLine(ctx, r.key, focused, width)
|
|
2138
|
+
: r.kind === 'category'
|
|
2139
|
+
? settingsCategoryLine(ctx, r.category, focused, width)
|
|
2140
|
+
: r.kind === 'assignment'
|
|
2141
|
+
? settingsAssignmentLine(ctx, r.assignment, focused, width)
|
|
2142
|
+
: settingsPmLaunchLine(ctx, r.launch, focused, width)
|
|
1721
2143
|
// The whole row is a target: a click on an unfocused row moves the focus, a second click on
|
|
1722
2144
|
// the focused row opens it (the kanban's rule).
|
|
1723
2145
|
const action: Action = focused ? { kind: 'settings-open', index: idx } : { kind: 'settings-focus', index: idx }
|
|
@@ -1728,24 +2150,19 @@ function settingsBlock(ctx: Ctx): Block | null {
|
|
|
1728
2150
|
// A heading draws only when the next focusable row is inside the window.
|
|
1729
2151
|
const next = idx + 1
|
|
1730
2152
|
if (next < offset || next >= offset + visible) continue
|
|
1731
|
-
|
|
1732
|
-
// P32 (the user's first report): a heading indented like a row reads as one more row. It is a
|
|
1733
|
-
// **section rule** instead — `── 身份与账本布局 ────…`, the shape the non-framed blocks already
|
|
1734
|
-
// use — so a heading and a key row cannot be confused in a monochrome capture either, and
|
|
1735
|
-
// consecutive groups are separated by their own headings without spending a second line.
|
|
1736
|
-
put(ruleTitle(r.label, width, r.kind === 'group' ? r.tone : 'accent'))
|
|
1737
|
-
}
|
|
2153
|
+
put(ruleTitle(r.label, width, r.tone))
|
|
1738
2154
|
}
|
|
1739
2155
|
if (hiddenBelow > 0) put(ln(seg(` ${fill(s.laneHiddenBelow, { n: String(hiddenBelow) })}`, 'dim')))
|
|
1740
2156
|
|
|
1741
2157
|
// The CLI-alignment line (M49): the row's label is for reading, the raw key is for typing.
|
|
1742
2158
|
put(ln(seg(` ${settingsCliHint(s, rows, focus)}`, 'dim')))
|
|
1743
2159
|
|
|
1744
|
-
// The
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
2160
|
+
// The policy's migration diagnosis (P232): visible, and the CLI route it names is the route.
|
|
2161
|
+
if (diagShown.length) {
|
|
2162
|
+
put(ln(seg(` ${s.settingsDiagnosisHeading}`, 'warn')))
|
|
2163
|
+
for (const chunks of diagChunks) for (const d of chunks) put(ln(seg(` ${d}`, 'warn')))
|
|
2164
|
+
if (diagRest > 0) put(ln(seg(` ${fill(s.laneHiddenBelow, { n: String(diagRest) })}`, 'dim')))
|
|
2165
|
+
}
|
|
1749
2166
|
|
|
1750
2167
|
// P32 (the bounded-frame rule's last resort, the detail view's own): the space the rows did not
|
|
1751
2168
|
// use stays **inside** the card, so the card fills the pane it was handed and the key band stays
|
|
@@ -1775,6 +2192,91 @@ function changeTasksLine(ch: ChangeRow, width: number): PlacedLine | null {
|
|
|
1775
2192
|
return widthOf(line) <= width ? { line } : null
|
|
1776
2193
|
}
|
|
1777
2194
|
|
|
2195
|
+
/**
|
|
2196
|
+
* P249 · the work page's preview blocks: the changes/specs/decisions rows are focusable on the same
|
|
2197
|
+
* terms as the board rows (one cursor, a two-stage click, a stop in the page-wide drawn order), and
|
|
2198
|
+
* the source a row hands to the detail view is fixed by the block it was drawn in.
|
|
2199
|
+
*/
|
|
2200
|
+
|
|
2201
|
+
/** The duplicate ordinal of each focusable key in a preview block (the board's `dupOrdinals` twin). */
|
|
2202
|
+
function previewOrdinals(keys: string[]): number[] {
|
|
2203
|
+
const seen = new Map<string, number>()
|
|
2204
|
+
return keys.map((key) => {
|
|
2205
|
+
const nth = seen.get(key) ?? 0
|
|
2206
|
+
seen.set(key, nth + 1)
|
|
2207
|
+
return nth
|
|
2208
|
+
})
|
|
2209
|
+
}
|
|
2210
|
+
|
|
2211
|
+
/**
|
|
2212
|
+
* The focused key's index: the exact (id, nth) when it names one of this block's rows, the id's first
|
|
2213
|
+
* row when the duplicate it named left, else the first drawn row. A ref scoped to another block (or to
|
|
2214
|
+
* a board lane) never lights a row here — each block only draws its own focus.
|
|
2215
|
+
*/
|
|
2216
|
+
function previewFocusIndex(ctx: Ctx, scope: string, keys: string[], ordinals: number[]): number {
|
|
2217
|
+
const f = ctx.view.focus
|
|
2218
|
+
if (f && f.lane === scope) {
|
|
2219
|
+
const nth = Math.max(0, f.nth ?? 0)
|
|
2220
|
+
const exact = keys.findIndex((id, i) => id === f.id && ordinals[i] === nth)
|
|
2221
|
+
if (exact >= 0) return exact
|
|
2222
|
+
const first = keys.indexOf(f.id)
|
|
2223
|
+
if (first >= 0) return first
|
|
2224
|
+
return 0
|
|
2225
|
+
}
|
|
2226
|
+
// No focus, or a focus the board owns: this block draws no cursor (the page has exactly one).
|
|
2227
|
+
return -1
|
|
2228
|
+
}
|
|
2229
|
+
|
|
2230
|
+
/** The detail source a work-page focus lane addresses (P249); a board lane stays the entry source. */
|
|
2231
|
+
export function rowSourceOf(lane: string): DetailSource {
|
|
2232
|
+
if (lane === 'changes') return 'change'
|
|
2233
|
+
if (lane === 'specs') return 'spec'
|
|
2234
|
+
if (lane === 'decisions') return 'decision'
|
|
2235
|
+
return 'entry'
|
|
2236
|
+
}
|
|
2237
|
+
|
|
2238
|
+
/**
|
|
2239
|
+
* One preview block's drawn rows with the P249 focus kit: a row whose `key` is a string is a stop —
|
|
2240
|
+
* drawn with the cursor and the `selected` tone when focused, one `open-focused`/`focus` target, and
|
|
2241
|
+
* one entry in the block's drawn-row order (the assembly concatenates the blocks' orders into the
|
|
2242
|
+
* page order); a row whose key is null is drawn but is not a stop (there is nothing to open).
|
|
2243
|
+
*/
|
|
2244
|
+
function previewLines(
|
|
2245
|
+
ctx: Ctx,
|
|
2246
|
+
scope: string,
|
|
2247
|
+
drawn: { key: string | null; content: Line }[],
|
|
2248
|
+
width: number,
|
|
2249
|
+
): { lines: PlacedLine[]; order: FocusRef[] } {
|
|
2250
|
+
const keys = drawn.filter((d) => d.key !== null).map((d) => d.key as string)
|
|
2251
|
+
const ordinals = previewOrdinals(keys)
|
|
2252
|
+
const focusIdx = keys.length ? previewFocusIndex(ctx, scope, keys, ordinals) : -1
|
|
2253
|
+
const lines: PlacedLine[] = []
|
|
2254
|
+
const order: FocusRef[] = []
|
|
2255
|
+
let k = -1
|
|
2256
|
+
for (const d of drawn) {
|
|
2257
|
+
if (d.key === null) {
|
|
2258
|
+
lines.push({ line: truncLine(d.content, width) })
|
|
2259
|
+
continue
|
|
2260
|
+
}
|
|
2261
|
+
k++
|
|
2262
|
+
const nth = ordinals[k]
|
|
2263
|
+
const focused = k === focusIdx
|
|
2264
|
+
order.push({ lane: scope, id: d.key, nth })
|
|
2265
|
+
const line = ln(focused ? seg(`${FOCUS_CURSOR} `, 'selected') : seg(' '), ...d.content)
|
|
2266
|
+
const action: Action = focused
|
|
2267
|
+
? { kind: 'open-focused', lane: scope }
|
|
2268
|
+
: { kind: 'focus', lane: scope, id: d.key, nth }
|
|
2269
|
+
lines.push(placedWithHits(line, ctx.view.tui ? [{ start: 0, end: widthOf(line), action }] : undefined, width))
|
|
2270
|
+
}
|
|
2271
|
+
return { lines, order }
|
|
2272
|
+
}
|
|
2273
|
+
|
|
2274
|
+
/** The `D<n>` a decision heading names; a heading without one is drawn but not openable. */
|
|
2275
|
+
function decisionIdOf(title: string): string | null {
|
|
2276
|
+
const m = /^D([0-9]+)(?![0-9])/.exec(String(title).trim())
|
|
2277
|
+
return m ? `D${m[1]}` : null
|
|
2278
|
+
}
|
|
2279
|
+
|
|
1778
2280
|
function changesBlock(ctx: Ctx): Block | null {
|
|
1779
2281
|
const { s, blocks, deg, width } = ctx
|
|
1780
2282
|
const c = blocks.changes
|
|
@@ -1783,22 +2285,20 @@ function changesBlock(ctx: Ctx): Block | null {
|
|
|
1783
2285
|
return { id: 'changes', title: s.changesHeading, right: true, priority: 11, lines: [{ line: ln(seg(` ${s.dash}`, 'dim')) }] }
|
|
1784
2286
|
}
|
|
1785
2287
|
if (!c.changes.length) return null // an empty block collapses and yields its space
|
|
1786
|
-
const
|
|
2288
|
+
const drawn: { key: string | null; content: Line }[] = []
|
|
1787
2289
|
for (const ch of c.changes as ChangeRow[]) {
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
),
|
|
1795
|
-
width,
|
|
1796
|
-
),
|
|
2290
|
+
drawn.push({
|
|
2291
|
+
key: ch.id,
|
|
2292
|
+
content: [
|
|
2293
|
+
seg(cell(ch.id, 18), 'accent'),
|
|
2294
|
+
seg(fill(s.changeLine, { done: ch.done, total: ch.total, phase: changePhaseText(ch.phase, s) })),
|
|
2295
|
+
],
|
|
1797
2296
|
})
|
|
1798
2297
|
const toks = changeTasksLine(ch, width)
|
|
1799
|
-
if (toks)
|
|
2298
|
+
if (toks) drawn.push({ key: null, content: toks.line })
|
|
1800
2299
|
}
|
|
1801
|
-
|
|
2300
|
+
const { lines, order } = previewLines(ctx, 'changes', drawn, width)
|
|
2301
|
+
return { id: 'changes', title: fill(s.changesHeadingCount, { n: c.count }), right: true, priority: 11, lines, order, summary: { line: truncLine(ln(seg(` ${fill(s.changesHeadingCount, { n: c.count })}`, 'heading')), width) } }
|
|
1802
2302
|
}
|
|
1803
2303
|
|
|
1804
2304
|
function specsBlock(ctx: Ctx): Block | null {
|
|
@@ -1808,13 +2308,16 @@ function specsBlock(ctx: Ctx): Block | null {
|
|
|
1808
2308
|
if (deg.has('specs') || !sp.available) {
|
|
1809
2309
|
return { id: 'specs', title: s.specsHeading, right: true, priority: 13, lines: [{ line: ln(seg(` ${s.dash}`, 'dim')) }] }
|
|
1810
2310
|
}
|
|
2311
|
+
const drawn = (sp.specs ?? []).slice(0, 6).map((row) => ({
|
|
2312
|
+
key: row.name,
|
|
2313
|
+
content: [seg(cell(row.name, Math.max(8, width - 10)), 'text'), seg(` ${row.requirements}`, 'dim')],
|
|
2314
|
+
}))
|
|
2315
|
+
const { lines: rows, order } = previewLines(ctx, 'specs', drawn, width)
|
|
1811
2316
|
const lines: PlacedLine[] = [
|
|
1812
2317
|
{ line: truncLine(ln(seg(fill(s.specsCount, { specs: sp.count, reqs: sp.requirements }), 'dim')), width) },
|
|
2318
|
+
...rows,
|
|
1813
2319
|
]
|
|
1814
|
-
|
|
1815
|
-
lines.push({ line: truncLine(ln(seg(' '), seg(cell(row.name, Math.max(8, width - 10)), 'text'), seg(` ${row.requirements}`, 'dim')), width) })
|
|
1816
|
-
}
|
|
1817
|
-
return { id: 'specs', title: s.specsHeading, right: true, priority: 13, lines, summary: { line: truncLine(ln(seg(` ${s.specsHeading}`, 'heading')), width) } }
|
|
2320
|
+
return { id: 'specs', title: s.specsHeading, right: true, priority: 13, lines, order, summary: { line: truncLine(ln(seg(` ${s.specsHeading}`, 'heading')), width) } }
|
|
1818
2321
|
}
|
|
1819
2322
|
|
|
1820
2323
|
function decisionsBlock(ctx: Ctx): Block | null {
|
|
@@ -1824,12 +2327,16 @@ function decisionsBlock(ctx: Ctx): Block | null {
|
|
|
1824
2327
|
if (deg.has('decisions')) {
|
|
1825
2328
|
return { id: 'decisions', title: s.decisionsHeading, right: true, priority: 14, lines: [{ line: ln(seg(` ${s.dash}`, 'dim')) }] }
|
|
1826
2329
|
}
|
|
2330
|
+
const drawn: { key: string | null; content: Line }[] = d.recent
|
|
2331
|
+
.slice(0, 3)
|
|
2332
|
+
.map((r) => ({ key: decisionIdOf(r), content: [seg(r, 'dim')] }))
|
|
2333
|
+
const { lines: rows, order } = previewLines(ctx, 'decisions', drawn, width)
|
|
1827
2334
|
const lines: PlacedLine[] = [
|
|
1828
2335
|
{ line: truncLine(ln(seg(fill(s.decisionsCountSuffix, { n: d.count }), 'dim')), width) },
|
|
1829
2336
|
]
|
|
1830
2337
|
if (!d.recent.length) lines.push({ line: ln(seg(` ${s.decisionsEmpty}`, 'dim')) })
|
|
1831
|
-
|
|
1832
|
-
return { id: 'decisions', title: s.decisionsHeading, right: true, priority: 14, lines, summary: { line: truncLine(ln(seg(` ${s.decisionsHeading}`, 'heading')), width) } }
|
|
2338
|
+
lines.push(...rows)
|
|
2339
|
+
return { id: 'decisions', title: s.decisionsHeading, right: true, priority: 14, lines, order, summary: { line: truncLine(ln(seg(` ${s.decisionsHeading}`, 'heading')), width) } }
|
|
1833
2340
|
}
|
|
1834
2341
|
|
|
1835
2342
|
// ------------------------------------------------------------------ body blocks (page 3)
|
|
@@ -2034,12 +2541,6 @@ function keyBandBlock(ctx: Ctx, rowsAvailable = true): Block {
|
|
|
2034
2541
|
{ text: s.keyOpen, action: { kind: 'choice-pick', index: -1 } },
|
|
2035
2542
|
{ text: s.keyDetailClose, action: { kind: 'choice-close' } },
|
|
2036
2543
|
]
|
|
2037
|
-
: ctx.view.seatPicker
|
|
2038
|
-
? [
|
|
2039
|
-
{ text: s.keyRows, action: { kind: 'seat-move', delta: 1 } },
|
|
2040
|
-
{ text: s.keySeatPick, action: { kind: 'seat-pick', index: -1 } },
|
|
2041
|
-
{ text: s.keyDetailClose, action: { kind: 'settings-close' } },
|
|
2042
|
-
]
|
|
2043
2544
|
: [
|
|
2044
2545
|
{ text: s.keyRows, action: { kind: 'settings-scroll', delta: 1 } },
|
|
2045
2546
|
{ text: s.keyOpen, action: { kind: 'settings-open', index: -1 } },
|
|
@@ -2060,6 +2561,20 @@ function keyBandBlock(ctx: Ctx, rowsAvailable = true): Block {
|
|
|
2060
2561
|
{ text: s.keyPages, action: { kind: 'page-cycle' } },
|
|
2061
2562
|
{ text: s.keyQuit, action: { kind: 'quit' } },
|
|
2062
2563
|
]
|
|
2564
|
+
: ctx.view.page === 5
|
|
2565
|
+
? ctx.view.replyBody
|
|
2566
|
+
? [
|
|
2567
|
+
{ text: s.keyDetailScroll, action: { kind: 'reply-scroll', delta: 1 } },
|
|
2568
|
+
{ text: s.keyDetailClose, action: { kind: 'reply-close' } },
|
|
2569
|
+
{ text: s.keyPages, action: { kind: 'page-cycle' } },
|
|
2570
|
+
]
|
|
2571
|
+
: [
|
|
2572
|
+
{ text: s.keyReplies, action: { kind: 'reply-page', dir: -1 } },
|
|
2573
|
+
{ text: s.keyOpen, action: { kind: 'reply-open' } },
|
|
2574
|
+
{ text: s.keyReplyReset, action: { kind: 'reply-reset' } },
|
|
2575
|
+
{ text: s.keyPages, action: { kind: 'page-cycle' } },
|
|
2576
|
+
{ text: s.keyQuit, action: { kind: 'quit' } },
|
|
2577
|
+
]
|
|
2063
2578
|
: ctx.view.page === 4
|
|
2064
2579
|
? [
|
|
2065
2580
|
{ text: s.keyLanes, action: { kind: 'lane-move', delta: 1 } },
|
|
@@ -2136,20 +2651,27 @@ function pageTabsBlock(ctx: Ctx): Block | null {
|
|
|
2136
2651
|
const line: Line = []
|
|
2137
2652
|
const hits: Hit[] = []
|
|
2138
2653
|
let x = 1
|
|
2139
|
-
const tabs: { page: PageId; text: string }[] = [
|
|
2140
|
-
{ page: 1, text: s.pageOverview },
|
|
2141
|
-
{ page: 2, text: s.pageWork },
|
|
2142
|
-
{ page: 3, text: s.pageMessages },
|
|
2143
|
-
{ page: 4, text: s.pageBoard },
|
|
2654
|
+
const tabs: { page: PageId; text: string; short: string }[] = [
|
|
2655
|
+
{ page: 1, text: s.pageOverview, short: s.pageOverviewShort },
|
|
2656
|
+
{ page: 2, text: s.pageWork, short: s.pageWorkShort },
|
|
2657
|
+
{ page: 3, text: s.pageMessages, short: s.pageMessagesShort },
|
|
2658
|
+
{ page: 4, text: s.pageBoard, short: s.pageBoardShort },
|
|
2659
|
+
{ page: 5, text: s.pageReplies, short: s.pageRepliesShort },
|
|
2144
2660
|
]
|
|
2145
2661
|
const boxed = isFramed(ctx)
|
|
2662
|
+
// 59-column tiers: the five full labels do not fit, so the band falls back to `<n><short label>`
|
|
2663
|
+
// for every page (the active one keeps its number *and* its visible label, and all five stay
|
|
2664
|
+
// reachable without horizontal overflow — the narrow-tabs requirement).
|
|
2665
|
+
const full = tabs.map((t) => fill(s.pageTab, { name: t.text })).join(' ')
|
|
2666
|
+
const narrow = dispWidth(full) > ctx.width
|
|
2146
2667
|
for (const tab of tabs) {
|
|
2147
2668
|
const active = ctx.view.page === tab.page
|
|
2669
|
+
const label = narrow ? `${tab.page}${tab.short}` : tab.text
|
|
2148
2670
|
const text = active
|
|
2149
2671
|
? boxed
|
|
2150
|
-
? `[${
|
|
2151
|
-
: fill(s.pageTabActive, { name:
|
|
2152
|
-
: fill(s.pageTab, { name:
|
|
2672
|
+
? `[${label}]`
|
|
2673
|
+
: fill(s.pageTabActive, { name: label })
|
|
2674
|
+
: fill(s.pageTab, { name: label })
|
|
2153
2675
|
const start = x
|
|
2154
2676
|
line.push(seg(text, active ? 'accent' : 'dim'))
|
|
2155
2677
|
x += dispWidth(text)
|
|
@@ -2176,7 +2698,15 @@ function overlayPrefs(ctx: Ctx): { pref: string; label: string; value: string }[
|
|
|
2176
2698
|
}
|
|
2177
2699
|
|
|
2178
2700
|
function pageName(page: PageId, s: Strings): string {
|
|
2179
|
-
return page === 1
|
|
2701
|
+
return page === 1
|
|
2702
|
+
? s.pageOverview
|
|
2703
|
+
: page === 2
|
|
2704
|
+
? s.pageWork
|
|
2705
|
+
: page === 3
|
|
2706
|
+
? s.pageMessages
|
|
2707
|
+
: page === 4
|
|
2708
|
+
? s.pageBoard
|
|
2709
|
+
: s.pageReplies
|
|
2180
2710
|
}
|
|
2181
2711
|
|
|
2182
2712
|
/** The overlay's cursor column (` › ` / ` `) and the separator that keeps the two columns apart. */
|
|
@@ -2254,6 +2784,7 @@ function pageDefinitions(ctx: Ctx): Block[] {
|
|
|
2254
2784
|
statusBlock(ctx),
|
|
2255
2785
|
capacityBlock(ctx),
|
|
2256
2786
|
progressBlock(ctx),
|
|
2787
|
+
replySummaryBlock(ctx),
|
|
2257
2788
|
deliveriesBlock(ctx),
|
|
2258
2789
|
agentsBlock(left()),
|
|
2259
2790
|
eventsBlock(right()),
|
|
@@ -2274,6 +2805,10 @@ function pageDefinitions(ctx: Ctx): Block[] {
|
|
|
2274
2805
|
// The detail view replaces the kanban's blocks (the title band, tabs and key band stay).
|
|
2275
2806
|
blocks.push(ctx.view.detail ? detailBlock(ctx) : kanbanBlock(ctx))
|
|
2276
2807
|
break
|
|
2808
|
+
case 5:
|
|
2809
|
+
// The reply viewer replaces the list exactly the way the detail view replaces the kanban.
|
|
2810
|
+
blocks.push(ctx.view.replyBody ? replyViewerBlock(ctx) : replyListBlock(ctx))
|
|
2811
|
+
break
|
|
2277
2812
|
default:
|
|
2278
2813
|
blocks.push(queueBlock(left()), inboxBlock(right()), patrolBlock(right()), trendBlock(right()), healthBlock(right()))
|
|
2279
2814
|
break
|
|
@@ -2336,14 +2871,16 @@ export function layout(input: LayoutInput): Frame {
|
|
|
2336
2871
|
const rightBlocks = middle.filter((b) => !b.full && b.right)
|
|
2337
2872
|
|
|
2338
2873
|
const framed = isFramed(ctx)
|
|
2339
|
-
|
|
2340
|
-
|
|
2874
|
+
// P249: the work page's drawn-row order is **page-wide** — each block that really draws its rows
|
|
2875
|
+
// reports them in the order it drew them and the assembly concatenates the blocks in placement
|
|
2876
|
+
// order (left column top-to-bottom, then the right column). A block degraded to its summary line
|
|
2877
|
+
// draws no row and contributes nothing.
|
|
2878
|
+
let pageOrder: FocusRef[] = []
|
|
2879
|
+
const place = (block: Block, remaining: number, colWidth: number, sink: FocusRef[] | null): PlacedLine[] => {
|
|
2341
2880
|
const kind = pickChrome(block, remaining, framed)
|
|
2342
2881
|
if (kind === null) return []
|
|
2343
2882
|
if (kind === 'summary') return [summaryLine(block, colWidth)]
|
|
2344
|
-
|
|
2345
|
-
// summary line has no row to focus (P20/B5).
|
|
2346
|
-
if (block.order) boardOrder = block.order
|
|
2883
|
+
if (block.order && sink) sink.push(...block.order)
|
|
2347
2884
|
return wrapBlock(block, colWidth, kind)
|
|
2348
2885
|
}
|
|
2349
2886
|
|
|
@@ -2351,6 +2888,8 @@ export function layout(input: LayoutInput): Frame {
|
|
|
2351
2888
|
let laneWindows: LaneWindow[] | undefined
|
|
2352
2889
|
let detailWindow: DetailWindow | undefined
|
|
2353
2890
|
let settingsWindow: SettingsWindow | undefined
|
|
2891
|
+
let replyListWindow: ReplyWindow | undefined
|
|
2892
|
+
let replyDocWindow: ReplyDocWindow | undefined
|
|
2354
2893
|
for (const b of fullBlocks) {
|
|
2355
2894
|
// The board page's lanes are told how many rows they may use (the frame is bounded): the lane
|
|
2356
2895
|
// windows then grow with the pane instead of showing blank card space (the bounded-frame rule).
|
|
@@ -2365,11 +2904,17 @@ export function layout(input: LayoutInput): Frame {
|
|
|
2365
2904
|
? (detailBlock({ ...ctx, detailRows: Math.max(2, budget - fullRows.length - (framed ? 2 : 0)) }) ?? b)
|
|
2366
2905
|
: height > 0 && b.id === 'settings'
|
|
2367
2906
|
? (settingsBlock({ ...ctx, settingsRows: Math.max(3, budget - fullRows.length - (framed ? 2 : 0)) }) ?? b)
|
|
2907
|
+
: height > 0 && b.id === 'reply_list'
|
|
2908
|
+
? (replyListBlock({ ...ctx, replyRows: Math.max(2, budget - fullRows.length - (framed ? 2 : 0)) }) ?? b)
|
|
2909
|
+
: height > 0 && b.id === 'reply_viewer'
|
|
2910
|
+
? (replyViewerBlock({ ...ctx, replyDocRows: Math.max(2, budget - fullRows.length - (framed ? 2 : 0)) }) ?? b)
|
|
2368
2911
|
: b
|
|
2369
2912
|
if (block.id === 'kanban' && block.lanes) laneWindows = block.lanes
|
|
2370
2913
|
if (block.id === 'detail' && block.detail) detailWindow = block.detail
|
|
2371
2914
|
if (block.id === 'settings' && block.settings) settingsWindow = block.settings
|
|
2372
|
-
|
|
2915
|
+
if (block.id === 'reply_list' && block.replyList) replyListWindow = block.replyList
|
|
2916
|
+
if (block.id === 'reply_viewer' && block.replyDoc) replyDocWindow = block.replyDoc
|
|
2917
|
+
const chunk = place(block, budget - fullRows.length, width, null)
|
|
2373
2918
|
for (const l of chunk) fullRows.push(l)
|
|
2374
2919
|
}
|
|
2375
2920
|
add(fullRows)
|
|
@@ -2382,6 +2927,8 @@ export function layout(input: LayoutInput): Frame {
|
|
|
2382
2927
|
// One placement pass over the page's body blocks; `cards` is re-derived so pass 2 can carry a
|
|
2383
2928
|
// board with more history visible.
|
|
2384
2929
|
const placeColumns = (cards: Block[]): [PlacedLine[], PlacedLine[]] => {
|
|
2930
|
+
// Each pass starts a fresh page order; the final pass is the one whose rows are rendered.
|
|
2931
|
+
pageOrder = []
|
|
2385
2932
|
const columns: [PlacedLine[], PlacedLine[]] = [[], []]
|
|
2386
2933
|
const ordered = [
|
|
2387
2934
|
...cards.filter((b) => !b.right).map((b) => ({ b, slot: 0 as 0 | 1 })),
|
|
@@ -2395,7 +2942,7 @@ export function layout(input: LayoutInput): Frame {
|
|
|
2395
2942
|
// had a full column of empty width. `pickChrome` keeps every column within `bodyBudget`, so
|
|
2396
2943
|
// the flush below still ends both columns on the same row.
|
|
2397
2944
|
const used = columns[slot].length
|
|
2398
|
-
const chunk = place(b, bodyBudget - used, colW)
|
|
2945
|
+
const chunk = place(b, bodyBudget - used, colW, pageOrder)
|
|
2399
2946
|
for (const l of chunk) columns[slot].push(l)
|
|
2400
2947
|
}
|
|
2401
2948
|
return columns
|
|
@@ -2456,9 +3003,10 @@ export function layout(input: LayoutInput): Frame {
|
|
|
2456
3003
|
} else {
|
|
2457
3004
|
const columnW = width
|
|
2458
3005
|
let used = 0
|
|
3006
|
+
pageOrder = []
|
|
2459
3007
|
const ordered = [...leftBlocks, ...rightBlocks].sort((x, y) => x.priority - y.priority)
|
|
2460
3008
|
for (const b of ordered) {
|
|
2461
|
-
const chunk = place(b, bodyBudget - used, columnW)
|
|
3009
|
+
const chunk = place(b, bodyBudget - used, columnW, pageOrder)
|
|
2462
3010
|
for (const l of chunk) rows.push({ line: truncLine(l.line, columnW), hits: l.hits })
|
|
2463
3011
|
used += chunk.length
|
|
2464
3012
|
}
|
|
@@ -2477,11 +3025,12 @@ export function layout(input: LayoutInput): Frame {
|
|
|
2477
3025
|
}
|
|
2478
3026
|
}
|
|
2479
3027
|
|
|
2480
|
-
// The work page's row chips are rebuilt after placement: they exist only while
|
|
2481
|
-
// really draws
|
|
2482
|
-
// (P20/B5). Both variants are one line, so the
|
|
3028
|
+
// The work page's row chips are rebuilt after placement: they exist only while at least one block
|
|
3029
|
+
// really draws a focusable row, so a degraded work page has no clickable row key that cannot open
|
|
3030
|
+
// anything (P20/B5, generalised to the preview blocks in P249). Both variants are one line, so the
|
|
3031
|
+
// budget above is unaffected.
|
|
2483
3032
|
const footerShown =
|
|
2484
|
-
ctx.view.page === 2 && !ctx.view.detail && !ctx.view.overlay && !
|
|
3033
|
+
ctx.view.page === 2 && !ctx.view.detail && !ctx.view.overlay && !pageOrder.length ? keyBandBlock(ctx, false) : footer
|
|
2485
3034
|
|
|
2486
3035
|
// The footer is the last row; when the height cannot even hold it, it is the only row kept.
|
|
2487
3036
|
if (height > 0 && rows.length + footerShown.lines.length > height) {
|
|
@@ -2519,8 +3068,10 @@ export function layout(input: LayoutInput): Frame {
|
|
|
2519
3068
|
targets,
|
|
2520
3069
|
...(laneWindows ? { lanes: laneWindows } : {}),
|
|
2521
3070
|
...(detailWindow ? { detail: detailWindow } : {}),
|
|
3071
|
+
...(replyListWindow ? { replyList: replyListWindow } : {}),
|
|
3072
|
+
...(replyDocWindow ? { replyDoc: replyDocWindow } : {}),
|
|
2522
3073
|
...(settingsWindow ? { settings: settingsWindow } : {}),
|
|
2523
|
-
...(
|
|
3074
|
+
...(pageOrder.length ? { boardOrder: pageOrder } : {}),
|
|
2524
3075
|
}
|
|
2525
3076
|
}
|
|
2526
3077
|
|