teamsmith 0.2.0 → 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.
Files changed (117) hide show
  1. package/README.md +4 -4
  2. package/package.json +1 -1
  3. package/skills/teamsmith/CHANGELOG.md +28 -0
  4. package/skills/teamsmith/SKILL.md +14 -7
  5. package/skills/teamsmith/extension/team-notify.ts +37 -6
  6. package/skills/teamsmith/extension/team.ts +438 -0
  7. package/skills/teamsmith/references/config.md +39 -6
  8. package/skills/teamsmith/references/migration.md +197 -47
  9. package/skills/teamsmith/references/protocol.md +176 -19
  10. package/skills/teamsmith/references/troubleshooting.md +124 -7
  11. package/skills/teamsmith/references/workflows.md +36 -2
  12. package/skills/teamsmith/scripts/lib/cmd-agents.sh +318 -23
  13. package/skills/teamsmith/scripts/lib/cmd-bootstrap.sh +2 -2
  14. package/skills/teamsmith/scripts/lib/cmd-config.sh +349 -67
  15. package/skills/teamsmith/scripts/lib/cmd-draft.sh +4 -4
  16. package/skills/teamsmith/scripts/lib/cmd-help.sh +677 -0
  17. package/skills/teamsmith/scripts/lib/cmd-init.sh +157 -5
  18. package/skills/teamsmith/scripts/lib/cmd-interrupt.sh +461 -0
  19. package/skills/teamsmith/scripts/lib/cmd-meeting.sh +2 -25
  20. package/skills/teamsmith/scripts/lib/cmd-project.sh +30 -103
  21. package/skills/teamsmith/scripts/lib/cmd-reap.sh +277 -0
  22. package/skills/teamsmith/scripts/lib/cmd-reply.sh +3 -3
  23. package/skills/teamsmith/scripts/lib/cmd-review.sh +175 -30
  24. package/skills/teamsmith/scripts/lib/cmd-status.sh +226 -17
  25. package/skills/teamsmith/scripts/lib/cmd-update.sh +36 -7
  26. package/skills/teamsmith/scripts/lib/cmd-watch.sh +564 -46
  27. package/skills/teamsmith/scripts/lib/common.sh +773 -48
  28. package/skills/teamsmith/scripts/lib/gate-lock.sh +544 -0
  29. package/skills/teamsmith/scripts/panel/draft-send.sh +11 -1
  30. package/skills/teamsmith/scripts/panel/panel.js +207 -207
  31. package/skills/teamsmith/scripts/panel/src/App.tsx +58 -21
  32. package/skills/teamsmith/scripts/panel/src/clipboard.ts +11 -5
  33. package/skills/teamsmith/scripts/panel/src/compose.ts +6 -3
  34. package/skills/teamsmith/scripts/panel/src/data.ts +11 -3
  35. package/skills/teamsmith/scripts/panel/src/layout.ts +209 -69
  36. package/skills/teamsmith/scripts/panel/src/main.tsx +33 -8
  37. package/skills/teamsmith/scripts/panel/src/strings/en.ts +39 -29
  38. package/skills/teamsmith/scripts/panel/src/strings/zh.ts +41 -31
  39. package/skills/teamsmith/scripts/panel/src/types.ts +28 -3
  40. package/skills/teamsmith/scripts/replies.mjs +4 -1
  41. package/skills/teamsmith/scripts/shim/tmux +18 -0
  42. package/skills/teamsmith/scripts/strings/commands.tsv +86 -0
  43. package/skills/teamsmith/scripts/strings/help.en.tsv +503 -0
  44. package/skills/teamsmith/scripts/strings/help.zh.tsv +489 -0
  45. package/skills/teamsmith/scripts/team +19 -6
  46. package/skills/teamsmith/templates/AGENTS.section.md.tmpl +8 -1
  47. package/skills/teamsmith/templates/config.sh.tmpl +20 -1
  48. package/skills/teamsmith/templates/pm-prompt.md.tmpl +21 -0
  49. package/skills/teamsmith/tests/bg-ledger-harness.mjs +464 -40
  50. package/skills/teamsmith/tests/bg-ledger.sh +168 -10
  51. package/skills/teamsmith/tests/checkout-shape-probe.sh +3 -1
  52. package/skills/teamsmith/tests/config-cli.sh +160 -14
  53. package/skills/teamsmith/tests/fixtures/delivery-truth-real/scenario.sh +7 -1
  54. package/skills/teamsmith/tests/fixtures/p287/lint-good.sh.in +3 -0
  55. package/skills/teamsmith/tests/fixtures/p287/lint-hardcoded.sh.in +3 -0
  56. package/skills/teamsmith/tests/fixtures/p287/lint-no-ns.sh.in +3 -0
  57. package/skills/teamsmith/tests/fixtures/p55/flip-p49.sh +18 -6
  58. package/skills/teamsmith/tests/flip-m33.sh +5 -3
  59. package/skills/teamsmith/tests/flip-m37.sh +4 -1
  60. package/skills/teamsmith/tests/flip-m4.3.sh +4 -1
  61. package/skills/teamsmith/tests/flip-m6.3.sh +4 -1
  62. package/skills/teamsmith/tests/flip-m6.5.sh +4 -1
  63. package/skills/teamsmith/tests/flip-m7.2.sh +4 -1
  64. package/skills/teamsmith/tests/flip-p158.sh +2 -1
  65. package/skills/teamsmith/tests/flip-p210.sh +4 -1
  66. package/skills/teamsmith/tests/flip-p217.sh +4 -1
  67. package/skills/teamsmith/tests/flip-p287-lock.sh +342 -0
  68. package/skills/teamsmith/tests/flip-p287-name.sh +279 -0
  69. package/skills/teamsmith/tests/flip-p304-read-side.sh +98 -0
  70. package/skills/teamsmith/tests/flip-p308-skip-not-pass.sh +151 -0
  71. package/skills/teamsmith/tests/flip-p309-p162-deep.sh +122 -0
  72. package/skills/teamsmith/tests/flip-p310-lock.sh +216 -0
  73. package/skills/teamsmith/tests/flip-p310-socket.sh +125 -0
  74. package/skills/teamsmith/tests/help-surface.sh +1664 -0
  75. package/skills/teamsmith/tests/install-shape.sh +279 -20
  76. package/skills/teamsmith/tests/key-replies-pty.sh +9 -10
  77. package/skills/teamsmith/tests/key-replies-ui.sh +0 -7
  78. package/skills/teamsmith/tests/key-replies.sh +240 -1
  79. package/skills/teamsmith/tests/ledger-ban.sh +5 -4
  80. package/skills/teamsmith/tests/ledger-claim.sh +2 -1
  81. package/skills/teamsmith/tests/lib/bounded-spin.sh +90 -0
  82. package/skills/teamsmith/tests/lib/model-policy.sh +4 -0
  83. package/skills/teamsmith/tests/lib/model-routing-flips.py +51 -0
  84. package/skills/teamsmith/tests/lib/reply-fixture.sh +4 -9
  85. package/skills/teamsmith/tests/lib/section-guard.sh +258 -13
  86. package/skills/teamsmith/tests/lib/tmp-root.sh +139 -27
  87. package/skills/teamsmith/tests/lib/tmux-cap.sh +10 -1
  88. package/skills/teamsmith/tests/lib/tmux-iso.sh +31 -13
  89. package/skills/teamsmith/tests/loop-inventory.tsv +59 -47
  90. package/skills/teamsmith/tests/panel-b2.sh +106 -3
  91. package/skills/teamsmith/tests/panel-b3-stub.sh +112 -4
  92. package/skills/teamsmith/tests/panel-b3.sh +175 -19
  93. package/skills/teamsmith/tests/panel-choices.sh +11 -6
  94. package/skills/teamsmith/tests/panel-cpu.sh +2 -1
  95. package/skills/teamsmith/tests/panel-knobs.sh +7 -1
  96. package/skills/teamsmith/tests/panel-p21.sh +156 -73
  97. package/skills/teamsmith/tests/panel-snapshots.sh +41 -225
  98. package/skills/teamsmith/tests/panel-strings.mjs +33 -18
  99. package/skills/teamsmith/tests/perf.sh +121 -30
  100. package/skills/teamsmith/tests/routes.sh +327 -93
  101. package/skills/teamsmith/tests/seat-interrupt.sh +1002 -0
  102. package/skills/teamsmith/tests/seat-visibility.sh +675 -0
  103. package/skills/teamsmith/tests/section-budgets.tsv +20 -10
  104. package/skills/teamsmith/tests/section-guard.sh +6 -1
  105. package/skills/teamsmith/tests/section-needs-audit.sh +24 -7
  106. package/skills/teamsmith/tests/section-paths.tsv +19 -13
  107. package/skills/teamsmith/tests/section-select.sh +8 -1
  108. package/skills/teamsmith/tests/slash-team-e2e.sh +323 -0
  109. package/skills/teamsmith/tests/slash-team.sh +617 -0
  110. package/skills/teamsmith/tests/smoke.sh +2972 -440
  111. package/skills/teamsmith/tests/task-model-routing.sh +507 -10
  112. package/skills/teamsmith/tests/tmp-hygiene.sh +782 -45
  113. package/skills/teamsmith/tests/tmux-identity-leak.sh +773 -0
  114. package/skills/teamsmith/tests/tmux-lint-legacy.txt +12 -18
  115. package/skills/teamsmith/tests/upgrade-recipe.sh +537 -0
  116. package/skills/teamsmith-init/SKILL.md +12 -12
  117. package/skills/teamsmith-init/references/bootstrap.md +3 -3
@@ -12,7 +12,7 @@
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, settingsRowFocusable, settingsViewRows } from './layout.js'
15
+ import { layout, resolveFocus, focusRefOf, focusRow, rowKey, settingsRowFocusable, settingsViewRows, boardFocusRef, rowSourceOf } from './layout.js'
16
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'
@@ -21,6 +21,7 @@ import type { Settings } from './settings.js'
21
21
  import type {
22
22
  Action,
23
23
  DetailWindow,
24
+ DetailSource,
24
25
  FocusRef,
25
26
  FrameInput,
26
27
  PageId,
@@ -81,8 +82,10 @@ function composeTrayTop(title: string, width: number): string {
81
82
  /** The console's own actions, owned by main.tsx (file I/O, subprocesses, the editor relay). */
82
83
  export interface PanelApi {
83
84
  readDraft(): string
84
- writeDraft(text: string): void
85
- clearDraft(): void
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
86
89
  send(text: string): Promise<Receipt>
87
90
  flushQueue(): Promise<{ ok: boolean; line: string }>
88
91
  setStandby(on: boolean, reason: string): Promise<{ ok: boolean; line: string }>
@@ -115,9 +118,11 @@ export interface PanelApi {
115
118
  /**
116
119
  * Tell the cache which entry's detail view is open (null = closed). While an id is set the
117
120
  * `detail` block joins the wanted set; `file` selects the repo-relative path to serve (the first
118
- * discovered file when omitted). Both are cached options, so an unchanged call rebuilds nothing.
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.
119
124
  */
120
- setDetail(id: string | null, file?: string | null): void
125
+ setDetail(id: string | null, file?: string | null, source?: DetailSource | null): void
121
126
  /**
122
127
  * Page 5's demand reads (pulse-key-replies): the list cursor (`before`, null = the newest page and
123
128
  * null also drops the list from the wanted set when the page is parked) and the open viewer's
@@ -288,6 +293,7 @@ export function App({
288
293
  // The open detail view's entry id (the board page's Enter / a click on the focused card), its
289
294
  // tab and its document scroll. The view is read-only: no key of its own beyond navigation.
290
295
  const [detailId, setDetailId] = useState<string | null>(null)
296
+ const [detailSource, setDetailSource] = useState<DetailSource>('entry')
291
297
  const [detailIndex, setDetailIndex] = useState(0)
292
298
  const [detailScroll, setDetailScroll] = useState(0)
293
299
  // Page 5 (pulse-key-replies): the cursor chain, the stable-number focus, the open body and the
@@ -425,6 +431,7 @@ export function App({
425
431
  }
426
432
  setViewEntry(null)
427
433
  setDetailId(null)
434
+ setDetailSource('entry')
428
435
  setDetailIndex(0)
429
436
  setDetailScroll(0)
430
437
  api.savePage(next)
@@ -692,14 +699,24 @@ export function App({
692
699
  setBusy(true)
693
700
  try {
694
701
  const r = await api.send(text)
695
- setReceipt(r.state === 'error' ? r : { ...r, detail: '' })
696
702
  setStatus(null)
697
- if (r.state !== 'error') {
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).
698
710
  updateDraft('', false)
699
711
  setPoint(0)
700
- api.clearDraft()
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' }) })
701
719
  }
702
- setComposing(false)
703
720
  } finally {
704
721
  sendingRef.current = false
705
722
  setBusy(false)
@@ -931,8 +948,9 @@ export function App({
931
948
  const cur = focusRef.current
932
949
  let idx = -1
933
950
  if (cur) {
934
- idx = order.findIndex((r) => r.id === cur.id && (r.nth ?? 0) === (cur.nth ?? 0))
935
- if (idx < 0) idx = order.findIndex((r) => r.id === cur.id)
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)
936
954
  }
937
955
  if (idx < 0) {
938
956
  setFocus(order[0])
@@ -948,22 +966,27 @@ export function App({
948
966
  setLaneOffset((prev) => ({ ...prev, [lane]: Math.max(0, Math.min(max, (prev[lane] ?? (win?.offset ?? 0)) + delta)) }))
949
967
  }, [])
950
968
 
951
- /** Open an entry's detail view: the first tab, from the top (the board page's Enter / a click). */
952
- const openDetail = useCallback((id: string) => {
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') => {
953
972
  setDetailIndex(0)
954
973
  setDetailScroll(0)
974
+ setDetailSource(source)
955
975
  setDetailId(id)
956
976
  }, [])
957
977
 
958
- /** 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. */
959
980
  const openWorkFocused = useCallback(() => {
960
981
  const order = boardOrderRef.current
961
982
  if (!order.length) return
962
983
  const cur = focusRef.current
963
984
  const hit = cur
964
- ? order.find((r) => r.id === cur.id && (r.nth ?? 0) === (cur.nth ?? 0)) ?? order.find((r) => r.id === cur.id)
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)
965
987
  : undefined
966
- openDetail((hit ?? order[0]).id)
988
+ const row = hit ?? order[0]
989
+ openDetail(row.id, rowSourceOf(row.lane))
967
990
  }, [openDetail])
968
991
 
969
992
  // ---- project settings (P22/B2): the view's focus walk, its origin and its row opening.
@@ -1399,7 +1422,10 @@ export function App({
1399
1422
  const key = row.key
1400
1423
  if (key.class === 'refuse') {
1401
1424
  setReceipt(null)
1402
- setStatus(`${key.name} · ${key.route || key.warning || stringsRef.current.settingsRefusedRoute}`)
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}`)
1403
1429
  return
1404
1430
  }
1405
1431
  // The whole-map row's editor is the categories block, never a composed pair list (P232).
@@ -1481,8 +1507,8 @@ export function App({
1481
1507
  return
1482
1508
  }
1483
1509
  const files = detailBlockData?.files ?? []
1484
- api.setDetail(detailId, files[detailIndexRef.current]?.path ?? null)
1485
- }, [api, detailId, detailIndex, detailBlockData])
1510
+ api.setDetail(detailId, files[detailIndexRef.current]?.path ?? null, detailSource)
1511
+ }, [api, detailId, detailIndex, detailSource, detailBlockData])
1486
1512
 
1487
1513
  /** Page 5's slots as the last snapshot carries them (never a re-read of the store). */
1488
1514
  const replyEntries = useCallback((): ReplyEntry[] => dataRef.current.blocks?.reply_list?.entries ?? [], [])
@@ -1663,7 +1689,11 @@ export function App({
1663
1689
  openWorkFocused()
1664
1690
  return
1665
1691
  }
1666
- const current = resolveFocus(boardRows(), focusRef.current)
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)
1667
1697
  if (current) openDetail(current.id)
1668
1698
  return
1669
1699
  }
@@ -1763,6 +1793,10 @@ export function App({
1763
1793
  // command's refusal) rides the hint row *above* the input so the input line stays last
1764
1794
  // (the IME cursor anchor rule) while the editor stays open with its draft.
1765
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)] : []),
1766
1800
  mode === 'message'
1767
1801
  ? strings.composeHint
1768
1802
  : mode === 'reason'
@@ -2322,7 +2356,10 @@ export function App({
2322
2356
  return
2323
2357
  }
2324
2358
  if (page === 4 && key.return) {
2325
- const current = resolveFocus(boardRows(), focusRef.current)
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)
2326
2363
  if (current) openDetail(current.id)
2327
2364
  return
2328
2365
  }
@@ -9,7 +9,6 @@
9
9
  import { randomUUID } from 'node:crypto'
10
10
  import { spawn } from 'node:child_process'
11
11
  import { writeFileSync } from 'node:fs'
12
- import { tmpdir } from 'node:os'
13
12
  import { join } from 'node:path'
14
13
 
15
14
  /** One bounded subprocess: rc plus the stdout bytes; `null` = the executable does not exist. */
@@ -86,10 +85,17 @@ export async function readClipboard(run: ClipboardRunner): Promise<ClipboardRead
86
85
  return null
87
86
  }
88
87
 
89
- /** The temporary path the paste writes: `${TMPDIR:-/tmp}/teamsmith-paste-<uuid>.<ext>`. */
90
- export function pasteFilePath(mime: string, dir = process.env.TMPDIR || tmpdir(), uuid?: string): string | null {
88
+ /**
89
+ * The temporary path the paste writes: `<resolved temp root>/teamsmith-paste-<uuid>.<ext>`.
90
+ *
91
+ * P309: the directory is **given** by the caller — the same `team_tmp_root` answer the rest of the
92
+ * tool prints (`capacity.temp_root` in the panel data). Deriving it here again would be a second
93
+ * implementation of the resolution order (`process.env.TMPDIR || tmpdir()` was exactly that), and
94
+ * two answers is how the paste file ends up outside the root `--status`/`--sweep` judge.
95
+ */
96
+ export function pasteFilePath(mime: string, dir: string | undefined, uuid?: string): string | null {
91
97
  const ext = imageExt(mime)
92
- if (!ext) return null
98
+ if (!ext || !dir) return null
93
99
  return join(dir, `teamsmith-paste-${uuid ?? randomUUID()}.${ext}`)
94
100
  }
95
101
 
@@ -97,7 +103,7 @@ export function pasteFilePath(mime: string, dir = process.env.TMPDIR || tmpdir()
97
103
  * Write the clipboard image bytes to the temporary path and return it. The panel never deletes the
98
104
  * file (the requirement) and the path is the whole edit the console makes.
99
105
  */
100
- export function writePasteFile(bytes: Buffer, mime: string, dir?: string, uuid?: string): string | null {
106
+ export function writePasteFile(bytes: Buffer, mime: string, dir: string | undefined, uuid?: string): string | null {
101
107
  const file = pasteFilePath(mime, dir, uuid)
102
108
  if (!file) return null
103
109
  writeFileSync(file, bytes)
@@ -678,13 +678,16 @@ export function parseSendResult(stdout: string): { rc: number; outcome: string;
678
678
 
679
679
  /** The one-line receipt shown under the frame, in the active language's voice. */
680
680
  export function receiptLine(receipt: Receipt, s: Strings): string {
681
+ // A settled receipt normally shows its canonical one-liner; the App puts a non-empty detail here
682
+ // for the one settle that could not go through cleanly — a draft file it could not empty — so the
683
+ // frame names the file instead of claiming the draft is gone (P249).
681
684
  switch (receipt.state) {
682
685
  case 'delivered':
683
- return s.receiptDelivered
686
+ return receipt.detail || s.receiptDelivered
684
687
  case 'queued':
685
- return s.receiptQueued
688
+ return receipt.detail || s.receiptQueued
686
689
  case 'held':
687
- return s.receiptHeld
690
+ return receipt.detail || s.receiptHeld
688
691
  default:
689
692
  return fill(s.receiptError, { detail: receipt.detail || s.sendUnconfirmed })
690
693
  }
@@ -22,7 +22,7 @@ import { appendFileSync, existsSync, readFileSync, writeFileSync } from 'node:fs
22
22
  import { dirname, join, resolve } from 'node:path'
23
23
  import { fileURLToPath } from 'node:url'
24
24
  import { sanitizeDeep } from './sanitize.js'
25
- import type { ActivityBlock, PanelBlocks, PanelData } from './types.js'
25
+ import type { ActivityBlock, DetailSource, PanelBlocks, PanelData } from './types.js'
26
26
 
27
27
  /**
28
28
  * M40 — the panel's identity is its own root (`--root`, else cwd), never an inherited `TEAM_*`.
@@ -120,6 +120,12 @@ export interface DataOptions {
120
120
  blocks?: readonly BlockName[]
121
121
  /** The detail view's entry id; while set, `detail` joins the wanted set (null/absent = parked). */
122
122
  detailId?: string | null
123
+ /**
124
+ * The read-only preview source the open detail view addresses (change:
125
+ * panel-preview-and-compose). Absent/`entry` keeps the original entry-id discovery; the other
126
+ * three become an explicit `--source` on the reader's argv.
127
+ */
128
+ detailSource?: DetailSource | null
123
129
  /** True while the project-settings view is open; only then does `settings` join the wanted set. */
124
130
  settingsOpen?: boolean
125
131
  /** The detail file to serve with `--file` (must be one of the discovered paths). */
@@ -187,14 +193,16 @@ const BLOCK_SPECS: Record<BlockName, BlockSpec> = {
187
193
  patrol: { ttlMs: 15000, timeoutMs: 10000 },
188
194
  health: { ttlMs: 600000, timeoutMs: 30000 },
189
195
  // The detail reader rides the open view: the App forces it on open and on a tab switch, so its TTL
190
- // only covers a stale refresh while the view stays open. The `--id`/`--file` arguments come from
191
- // the live options; both are cleared when the view closes.
196
+ // only covers a stale refresh while the view stays open. The `--id`/`--source`/`--file` arguments
197
+ // come from the live options; all are cleared when the view closes. The `entry` source stays
198
+ // implicit so an existing caller's argv is byte-identical.
192
199
  detail: {
193
200
  ttlMs: 15000,
194
201
  timeoutMs: 10000,
195
202
  extraArgs: (opts) => {
196
203
  if (!opts.detailId) return []
197
204
  const args = ['--id', String(opts.detailId)]
205
+ if (opts.detailSource && opts.detailSource !== 'entry') args.push('--source', opts.detailSource)
198
206
  if (opts.detailFile) args.push('--file', String(opts.detailFile))
199
207
  return args
200
208
  },