teamsmith 0.0.0-stage → 0.1.2

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 (245) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +158 -2
  3. package/bin/team.mjs +59 -0
  4. package/install.sh +94 -0
  5. package/package.json +37 -4
  6. package/skills/teamsmith/CHANGELOG.md +763 -0
  7. package/skills/teamsmith/SKILL.md +312 -0
  8. package/skills/teamsmith/extension/team-bg.ts +435 -0
  9. package/skills/teamsmith/extension/team-inbox-watch.ts +1412 -0
  10. package/skills/teamsmith/extension/team-notify.ts +663 -0
  11. package/skills/teamsmith/references/agent-adapters.md +643 -0
  12. package/skills/teamsmith/references/config.md +477 -0
  13. package/skills/teamsmith/references/meeting.md +124 -0
  14. package/skills/teamsmith/references/memory.md +133 -0
  15. package/skills/teamsmith/references/migration.md +227 -0
  16. package/skills/teamsmith/references/openspec.md +222 -0
  17. package/skills/teamsmith/references/philosophy.md +95 -0
  18. package/skills/teamsmith/references/protocol.md +712 -0
  19. package/skills/teamsmith/references/troubleshooting.md +1384 -0
  20. package/skills/teamsmith/references/workflows.md +448 -0
  21. package/skills/teamsmith/scripts/lib/cmd-agents.sh +1709 -0
  22. package/skills/teamsmith/scripts/lib/cmd-bg.sh +284 -0
  23. package/skills/teamsmith/scripts/lib/cmd-bootstrap.sh +311 -0
  24. package/skills/teamsmith/scripts/lib/cmd-config.sh +1156 -0
  25. package/skills/teamsmith/scripts/lib/cmd-death.sh +562 -0
  26. package/skills/teamsmith/scripts/lib/cmd-docs.sh +149 -0
  27. package/skills/teamsmith/scripts/lib/cmd-draft.sh +124 -0
  28. package/skills/teamsmith/scripts/lib/cmd-init.sh +212 -0
  29. package/skills/teamsmith/scripts/lib/cmd-meeting.sh +904 -0
  30. package/skills/teamsmith/scripts/lib/cmd-outbox.sh +196 -0
  31. package/skills/teamsmith/scripts/lib/cmd-project.sh +642 -0
  32. package/skills/teamsmith/scripts/lib/cmd-review.sh +1393 -0
  33. package/skills/teamsmith/scripts/lib/cmd-status.sh +1399 -0
  34. package/skills/teamsmith/scripts/lib/cmd-update.sh +191 -0
  35. package/skills/teamsmith/scripts/lib/cmd-watch.sh +1681 -0
  36. package/skills/teamsmith/scripts/lib/common.sh +4964 -0
  37. package/skills/teamsmith/scripts/lib/draft-entry.sh +51 -0
  38. package/skills/teamsmith/scripts/lib/outbox.sh +2042 -0
  39. package/skills/teamsmith/scripts/lib/tmux-argv.sh +165 -0
  40. package/skills/teamsmith/scripts/monitor.mjs +616 -0
  41. package/skills/teamsmith/scripts/panel/README.md +192 -0
  42. package/skills/teamsmith/scripts/panel/build.sh +47 -0
  43. package/skills/teamsmith/scripts/panel/bun.lock +109 -0
  44. package/skills/teamsmith/scripts/panel/draft-send.sh +68 -0
  45. package/skills/teamsmith/scripts/panel/package.json +24 -0
  46. package/skills/teamsmith/scripts/panel/panel.js +388 -0
  47. package/skills/teamsmith/scripts/panel/src/App.tsx +2150 -0
  48. package/skills/teamsmith/scripts/panel/src/clipboard.ts +154 -0
  49. package/skills/teamsmith/scripts/panel/src/compose.ts +691 -0
  50. package/skills/teamsmith/scripts/panel/src/data.ts +555 -0
  51. package/skills/teamsmith/scripts/panel/src/format.ts +50 -0
  52. package/skills/teamsmith/scripts/panel/src/layout.ts +2562 -0
  53. package/skills/teamsmith/scripts/panel/src/main.tsx +894 -0
  54. package/skills/teamsmith/scripts/panel/src/markdown.ts +340 -0
  55. package/skills/teamsmith/scripts/panel/src/sanitize.ts +42 -0
  56. package/skills/teamsmith/scripts/panel/src/settings.ts +154 -0
  57. package/skills/teamsmith/scripts/panel/src/strings/en.ts +416 -0
  58. package/skills/teamsmith/scripts/panel/src/strings/index.ts +65 -0
  59. package/skills/teamsmith/scripts/panel/src/strings/types.ts +9 -0
  60. package/skills/teamsmith/scripts/panel/src/strings/zh.ts +414 -0
  61. package/skills/teamsmith/scripts/panel/src/theme.ts +116 -0
  62. package/skills/teamsmith/scripts/panel/src/types.ts +652 -0
  63. package/skills/teamsmith/scripts/panel/src/width.ts +105 -0
  64. package/skills/teamsmith/scripts/panel/tsconfig.json +16 -0
  65. package/skills/teamsmith/scripts/shim/signal-gate +156 -0
  66. package/skills/teamsmith/scripts/shim/tmux +403 -0
  67. package/skills/teamsmith/scripts/team +143 -0
  68. package/skills/teamsmith/templates/AGENTS.section.md.tmpl +147 -0
  69. package/skills/teamsmith/templates/BOARD.md.tmpl +18 -0
  70. package/skills/teamsmith/templates/DECISIONS.md.tmpl +22 -0
  71. package/skills/teamsmith/templates/OWNERSHIP.md.tmpl +25 -0
  72. package/skills/teamsmith/templates/PROTOCOL.md.tmpl +84 -0
  73. package/skills/teamsmith/templates/ROADMAP.md.tmpl +29 -0
  74. package/skills/teamsmith/templates/config.sh.tmpl +106 -0
  75. package/skills/teamsmith/templates/memory-seed.md.tmpl +46 -0
  76. package/skills/teamsmith/templates/pm-prompt.md.tmpl +110 -0
  77. package/skills/teamsmith/templates/report.md.tmpl +36 -0
  78. package/skills/teamsmith/templates/task.md.tmpl +65 -0
  79. package/skills/teamsmith/templates/threads-README.md +17 -0
  80. package/skills/teamsmith/tests/bg-ledger-harness.mjs +682 -0
  81. package/skills/teamsmith/tests/bg-ledger.sh +307 -0
  82. package/skills/teamsmith/tests/checkout-shape-probe.sh +800 -0
  83. package/skills/teamsmith/tests/config-cli.sh +1562 -0
  84. package/skills/teamsmith/tests/container-tmux.sh +493 -0
  85. package/skills/teamsmith/tests/coverage-inventory.sh +173 -0
  86. package/skills/teamsmith/tests/death-cause.sh +564 -0
  87. package/skills/teamsmith/tests/delivery-truth.sh +1231 -0
  88. package/skills/teamsmith/tests/fake-tui.py +450 -0
  89. package/skills/teamsmith/tests/fixtures/delivery-truth-real/README.md +60 -0
  90. package/skills/teamsmith/tests/fixtures/delivery-truth-real/judge-second.py +139 -0
  91. package/skills/teamsmith/tests/fixtures/delivery-truth-real/mock-server.py +29 -0
  92. package/skills/teamsmith/tests/fixtures/delivery-truth-real/observe.ts +20 -0
  93. package/skills/teamsmith/tests/fixtures/delivery-truth-real/run-case.sh +79 -0
  94. package/skills/teamsmith/tests/fixtures/delivery-truth-real/scenario.sh +175 -0
  95. package/skills/teamsmith/tests/fixtures/p55/flip-p49.sh +229 -0
  96. package/skills/teamsmith/tests/fixtures/p71-incident/README.md +22 -0
  97. package/skills/teamsmith/tests/fixtures/p71-incident/dev2.seen +8 -0
  98. package/skills/teamsmith/tests/fixtures/p71-incident/dev2.wake +9 -0
  99. package/skills/teamsmith/tests/fixtures/p71-incident/pm-nudges.wake +3 -0
  100. package/skills/teamsmith/tests/fixtures/signal-lint-cases.txt +40 -0
  101. package/skills/teamsmith/tests/flip-glue.sh +162 -0
  102. package/skills/teamsmith/tests/flip-m12-26c.sh +129 -0
  103. package/skills/teamsmith/tests/flip-m12.sh +185 -0
  104. package/skills/teamsmith/tests/flip-m16.sh +166 -0
  105. package/skills/teamsmith/tests/flip-m17.sh +204 -0
  106. package/skills/teamsmith/tests/flip-m33.sh +284 -0
  107. package/skills/teamsmith/tests/flip-m34.sh +96 -0
  108. package/skills/teamsmith/tests/flip-m37.sh +185 -0
  109. package/skills/teamsmith/tests/flip-m4.3.sh +375 -0
  110. package/skills/teamsmith/tests/flip-m43.sh +128 -0
  111. package/skills/teamsmith/tests/flip-m44.sh +262 -0
  112. package/skills/teamsmith/tests/flip-m45.sh +244 -0
  113. package/skills/teamsmith/tests/flip-m46.sh +238 -0
  114. package/skills/teamsmith/tests/flip-m48.sh +304 -0
  115. package/skills/teamsmith/tests/flip-m6.2.sh +205 -0
  116. package/skills/teamsmith/tests/flip-m6.3.sh +283 -0
  117. package/skills/teamsmith/tests/flip-m6.4.sh +267 -0
  118. package/skills/teamsmith/tests/flip-m6.5.sh +113 -0
  119. package/skills/teamsmith/tests/flip-m7.1.sh +135 -0
  120. package/skills/teamsmith/tests/flip-m7.2.sh +321 -0
  121. package/skills/teamsmith/tests/flip-p144.sh +112 -0
  122. package/skills/teamsmith/tests/flip-p156.sh +133 -0
  123. package/skills/teamsmith/tests/flip-p158.sh +301 -0
  124. package/skills/teamsmith/tests/flip-p160.sh +182 -0
  125. package/skills/teamsmith/tests/flip-p171.sh +249 -0
  126. package/skills/teamsmith/tests/flip-p18.1.sh +95 -0
  127. package/skills/teamsmith/tests/flip-p20.sh +286 -0
  128. package/skills/teamsmith/tests/flip-p201.sh +249 -0
  129. package/skills/teamsmith/tests/flip-p210.sh +239 -0
  130. package/skills/teamsmith/tests/flip-p211.sh +152 -0
  131. package/skills/teamsmith/tests/flip-p217.sh +288 -0
  132. package/skills/teamsmith/tests/flip-p22.sh +123 -0
  133. package/skills/teamsmith/tests/flip-p23.sh +239 -0
  134. package/skills/teamsmith/tests/flip-p25.sh +165 -0
  135. package/skills/teamsmith/tests/flip-p71.sh +184 -0
  136. package/skills/teamsmith/tests/flip-p72.sh +202 -0
  137. package/skills/teamsmith/tests/frames/README.md +176 -0
  138. package/skills/teamsmith/tests/frames/p78-conversation-rule-below-box.txt +6 -0
  139. package/skills/teamsmith/tests/frames/p78-cursor-mid-draft.txt +6 -0
  140. package/skills/teamsmith/tests/frames/p78-draft-rule-below-cursor-line.txt +6 -0
  141. package/skills/teamsmith/tests/frames/p78-draft-rule-below-cursor.txt +6 -0
  142. package/skills/teamsmith/tests/frames/p78-draft-rule-blank-region.txt +6 -0
  143. package/skills/teamsmith/tests/frames/p78-draft-rule-only.txt +5 -0
  144. package/skills/teamsmith/tests/frames/p78-spinner-row-below-cursor.txt +6 -0
  145. package/skills/teamsmith/tests/frames/p78-wider-rule-below-cursor.txt +6 -0
  146. package/skills/teamsmith/tests/frames/p86-f1-mixed-width-disjoint-box.txt +8 -0
  147. package/skills/teamsmith/tests/frames/p86-f1-narrower-width-disjoint-box.txt +8 -0
  148. package/skills/teamsmith/tests/frames/p86-f1-spinner-top-disjoint-box.txt +8 -0
  149. package/skills/teamsmith/tests/frames/pi-0.85.1-update-banner.txt +30 -0
  150. package/skills/teamsmith/tests/frames/pi-0.87.0-draft-half-sentence.txt +30 -0
  151. package/skills/teamsmith/tests/frames/pi-0.87.0-empty-box.txt +30 -0
  152. package/skills/teamsmith/tests/frames/pi-0.87.0-one-line-draft.txt +30 -0
  153. package/skills/teamsmith/tests/frames/pi-0.87.0-project-trust-prompt.txt +30 -0
  154. package/skills/teamsmith/tests/frames/pi-0.99.2-empty-editor.txt +32 -0
  155. package/skills/teamsmith/tests/frames/pi-0.99.2-human-draft.txt +32 -0
  156. package/skills/teamsmith/tests/frames/pi-1.0.0-git-error-in-box.txt +32 -0
  157. package/skills/teamsmith/tests/gate-guard.sh +112 -0
  158. package/skills/teamsmith/tests/guard-matrix.sh +233 -0
  159. package/skills/teamsmith/tests/install-shape.sh +731 -0
  160. package/skills/teamsmith/tests/ledger-ban.sh +612 -0
  161. package/skills/teamsmith/tests/lib/box-judge.sh +68 -0
  162. package/skills/teamsmith/tests/lib/checkout-shape.sh +129 -0
  163. package/skills/teamsmith/tests/lib/loop-scan.awk +114 -0
  164. package/skills/teamsmith/tests/lib/pty-wait.sh +676 -0
  165. package/skills/teamsmith/tests/lib/section-guard.sh +855 -0
  166. package/skills/teamsmith/tests/lib/shell-lex.pl +261 -0
  167. package/skills/teamsmith/tests/lib/tmp-root.sh +528 -0
  168. package/skills/teamsmith/tests/lib/tmux-cap.sh +35 -0
  169. package/skills/teamsmith/tests/lib/tmux-iso-call-probe.sh +81 -0
  170. package/skills/teamsmith/tests/lib/tmux-iso-probe.sh +46 -0
  171. package/skills/teamsmith/tests/lib/tmux-iso.sh +381 -0
  172. package/skills/teamsmith/tests/load-experiment.sh +290 -0
  173. package/skills/teamsmith/tests/loop-inventory.tsv +84 -0
  174. package/skills/teamsmith/tests/panel-b2-slow-stub.sh +19 -0
  175. package/skills/teamsmith/tests/panel-b2.sh +1183 -0
  176. package/skills/teamsmith/tests/panel-b3-pty-mouse.py +240 -0
  177. package/skills/teamsmith/tests/panel-b3-pty-tmux-mouse.py +138 -0
  178. package/skills/teamsmith/tests/panel-b3-stub.sh +279 -0
  179. package/skills/teamsmith/tests/panel-b3.sh +1301 -0
  180. package/skills/teamsmith/tests/panel-choices.sh +572 -0
  181. package/skills/teamsmith/tests/panel-clipboard-model.ts +187 -0
  182. package/skills/teamsmith/tests/panel-compose-model.ts +290 -0
  183. package/skills/teamsmith/tests/panel-contrast.mjs +81 -0
  184. package/skills/teamsmith/tests/panel-cpu-premise.sh +173 -0
  185. package/skills/teamsmith/tests/panel-cpu.sh +391 -0
  186. package/skills/teamsmith/tests/panel-flip-m54.sh +207 -0
  187. package/skills/teamsmith/tests/panel-flip-p123.sh +278 -0
  188. package/skills/teamsmith/tests/panel-flip-p125.sh +318 -0
  189. package/skills/teamsmith/tests/panel-flip-p128.sh +259 -0
  190. package/skills/teamsmith/tests/panel-keyprobe-pty.py +99 -0
  191. package/skills/teamsmith/tests/panel-keyprobe-stub.sh +41 -0
  192. package/skills/teamsmith/tests/panel-keyprobe.sh +82 -0
  193. package/skills/teamsmith/tests/panel-keyprobe.tsx +116 -0
  194. package/skills/teamsmith/tests/panel-knobs.sh +83 -0
  195. package/skills/teamsmith/tests/panel-p21.sh +2181 -0
  196. package/skills/teamsmith/tests/panel-snapshots.sh +802 -0
  197. package/skills/teamsmith/tests/panel-strings.mjs +195 -0
  198. package/skills/teamsmith/tests/perf.sh +740 -0
  199. package/skills/teamsmith/tests/pm-box-real.sh +350 -0
  200. package/skills/teamsmith/tests/pulse-nudge-key.sh +563 -0
  201. package/skills/teamsmith/tests/routes.sh +1652 -0
  202. package/skills/teamsmith/tests/section-budgets.tsv +150 -0
  203. package/skills/teamsmith/tests/section-guard.sh +231 -0
  204. package/skills/teamsmith/tests/section-needs-audit.sh +94 -0
  205. package/skills/teamsmith/tests/section-paths.tsv +142 -0
  206. package/skills/teamsmith/tests/section-select.sh +655 -0
  207. package/skills/teamsmith/tests/signal-gate.sh +366 -0
  208. package/skills/teamsmith/tests/signal-lint-legacy.txt +14 -0
  209. package/skills/teamsmith/tests/signal-lint.pl +416 -0
  210. package/skills/teamsmith/tests/skill-load.mjs +65 -0
  211. package/skills/teamsmith/tests/smoke.sh +19711 -0
  212. package/skills/teamsmith/tests/snapshots/zh-dark-120-detail.txt +32 -0
  213. package/skills/teamsmith/tests/snapshots/zh-dark-120-p4.txt +32 -0
  214. package/skills/teamsmith/tests/snapshots/zh-dark-120.txt +32 -0
  215. package/skills/teamsmith/tests/snapshots/zh-dark-160-p4.txt +32 -0
  216. package/skills/teamsmith/tests/snapshots/zh-dark-160.txt +32 -0
  217. package/skills/teamsmith/tests/snapshots/zh-dark-59-detail.txt +32 -0
  218. package/skills/teamsmith/tests/snapshots/zh-dark-59-p4.txt +32 -0
  219. package/skills/teamsmith/tests/snapshots/zh-dark-59.txt +32 -0
  220. package/skills/teamsmith/tests/snapshots/zh-dark-99-p4.txt +32 -0
  221. package/skills/teamsmith/tests/snapshots/zh-dark-99.txt +32 -0
  222. package/skills/teamsmith/tests/snapshots/zh-light-120-detail.txt +32 -0
  223. package/skills/teamsmith/tests/snapshots/zh-light-120-p4.txt +32 -0
  224. package/skills/teamsmith/tests/snapshots/zh-light-120.txt +32 -0
  225. package/skills/teamsmith/tests/snapshots/zh-light-160-p4.txt +32 -0
  226. package/skills/teamsmith/tests/snapshots/zh-light-160.txt +32 -0
  227. package/skills/teamsmith/tests/snapshots/zh-light-59-detail.txt +32 -0
  228. package/skills/teamsmith/tests/snapshots/zh-light-59-p4.txt +32 -0
  229. package/skills/teamsmith/tests/snapshots/zh-light-59.txt +32 -0
  230. package/skills/teamsmith/tests/snapshots/zh-light-99-p4.txt +32 -0
  231. package/skills/teamsmith/tests/snapshots/zh-light-99.txt +32 -0
  232. package/skills/teamsmith/tests/spec-ledger-refs.tsv +78 -0
  233. package/skills/teamsmith/tests/spec-refs.sh +826 -0
  234. package/skills/teamsmith/tests/task-header-model.sh +267 -0
  235. package/skills/teamsmith/tests/team-bg-flip.sh +239 -0
  236. package/skills/teamsmith/tests/team-bg-harness.mjs +392 -0
  237. package/skills/teamsmith/tests/team-bg-stop.sh +434 -0
  238. package/skills/teamsmith/tests/team-inbox-watch-flip.sh +191 -0
  239. package/skills/teamsmith/tests/team-inbox-watch-harness.mjs +1559 -0
  240. package/skills/teamsmith/tests/tmp-hygiene.sh +1190 -0
  241. package/skills/teamsmith/tests/tmux-lint-legacy.txt +31 -0
  242. package/skills/teamsmith/tests/tmux-lint.pl +604 -0
  243. package/skills/teamsmith-init/SKILL.md +100 -0
  244. package/skills/teamsmith-init/references/bootstrap.md +74 -0
  245. package/skills/teamsmith-init/templates/bootstrap-prompt.md.tmpl +46 -0
@@ -0,0 +1,652 @@
1
+ // The wire contract between the bash data command (`team __panel-data`) and this renderer.
2
+ //
3
+ // `PanelData` is the **machine exits'** contract (`--print` / `--json`): the fields the pre-console
4
+ // panel had, unchanged apart from additive fields. The console-only readers (board rows, changes,
5
+ // specs, decisions, deliveries, the outbox list, inbox/threads, the patrol log, health) land in
6
+ // `PanelBlocks`, which the machine exits never render and `--json` never carries.
7
+ //
8
+ // Everything here is data; `layout.ts` is the only consumer and it is pure.
9
+
10
+ export type PmState = 'running' | 'starting' | 'absent' | 'foreign' | 'unknown'
11
+ export type AgentState = 'running' | 'exited' | 'absent'
12
+
13
+ /** The four console pages (TUI-only; `--print`/`--json` render the overview). */
14
+ export type PageId = 1 | 2 | 3 | 4
15
+
16
+ /**
17
+ * The board's six lanes in the fixed order BOARD.md's header legend declares (P123). Both the layout
18
+ * and the `state/panel.conf` fold lists order themselves by this one list.
19
+ */
20
+ export const BOARD_LANES = ['todo', 'wip', 'review', 'done', 'blocked', 'dropped'] as const
21
+ export type Density = 'comfortable' | 'compact'
22
+ export type ThemeName = 'dark' | 'light'
23
+ export type ThemeChoice = ThemeName | 'auto'
24
+
25
+ /** The settings overlay's five preferences (plus the pinned `theme`, which is not an overlay item). */
26
+ export type PrefName = 'lang' | 'defaultPage' | 'activity' | 'mouse' | 'density'
27
+
28
+ export interface PanelStandby {
29
+ on: boolean
30
+ reason: string
31
+ }
32
+
33
+ export interface PanelPm {
34
+ state: PmState
35
+ /** Short human detail behind the state (window name, command, "空提示符" …). */
36
+ detail: string
37
+ /** The evidence string the pulse uses for the same state (may be empty). */
38
+ evidence: string
39
+ /** M46: why the PM session has no inbox-watch registration ('' = the watch lane is fine). */
40
+ delivery_warning?: string
41
+ }
42
+
43
+ export interface PanelPending {
44
+ inbox: number
45
+ reports: number
46
+ todo: number
47
+ wip: number
48
+ review: number
49
+ blocked: number
50
+ stopped: number
51
+ total: number
52
+ /** `team_pending_text`'s human summary ('' when there is nothing). */
53
+ text: string
54
+ }
55
+
56
+ export interface PanelOutbox {
57
+ queued: number
58
+ held: number
59
+ oldest_age_s: number | null
60
+ forced: number
61
+ /** delivery-truth D2: held entries whose reason is geometry-untrusted / queue-stalled. */
62
+ impeded?: number
63
+ impediments?: Impediment[]
64
+ }
65
+
66
+ /** One read-only delivery impediment (never a pane capture or a queue action). */
67
+ export interface Impediment {
68
+ entry: string
69
+ target: string
70
+ reason: string
71
+ /** The sidecar's last observation time, or '' when the diagnostic is unreadable. */
72
+ last_observed: string
73
+ durable_text_path: string
74
+ diagnostic: 'available' | 'unavailable'
75
+ }
76
+
77
+ export interface PanelDiskEntry {
78
+ path: string
79
+ /** null when the figure could not be read (the band renders `—`, never a number). */
80
+ avail_mb: number | null
81
+ /** null when the figure is unreadable or the filesystem reports no inode table. */
82
+ free_inodes: number | null
83
+ readable: boolean
84
+ }
85
+
86
+ export interface PanelCapacity {
87
+ ram_avail_mb: number
88
+ swap_free_mb: number
89
+ agents: number
90
+ /** P144: one entry per judged filesystem (temp root + worktrees root). */
91
+ disk?: PanelDiskEntry[]
92
+ spark: number[]
93
+ /** `team_capacity_line` verbatim (the one-line fallback when the height folds it). */
94
+ line: string
95
+ }
96
+
97
+ export interface PanelAgent {
98
+ name: string
99
+ state: AgentState
100
+ task: string
101
+ branch: string
102
+ dirty: boolean
103
+ /** Commits ahead of the protected branch; null when it cannot be evaluated. */
104
+ ahead: number | null
105
+ upstream_ahead: string
106
+ model: string
107
+ session_tokens: number
108
+ session_window: number
109
+ session_text: string
110
+ /** agent-death-reason: classified cause of an abnormal death (absent on a healthy seat). */
111
+ cause?: string
112
+ /** Where the cause was read from; absent when there is no readable source. */
113
+ cause_source?: 'pane' | 'session' | 'recorded'
114
+ /** The raw evidence line beside the cause (sanitized, single line). */
115
+ cause_line?: string
116
+ /** The record time of the evidence, when known. */
117
+ cause_time?: string
118
+ /** Filled from the data layer's block for this agent (JSON only, not a table column). */
119
+ elapsed?: string
120
+ idle?: string
121
+ idle_s?: number | null
122
+ events?: number | null
123
+ }
124
+
125
+ export interface ActivityEvent {
126
+ ts?: string
127
+ kind?: string
128
+ text?: string
129
+ }
130
+
131
+ export interface ActivityBlock {
132
+ name?: string
133
+ status?: string
134
+ source?: string
135
+ available?: boolean
136
+ truncated?: boolean
137
+ tail_limit?: number
138
+ count?: number
139
+ events?: ActivityEvent[]
140
+ idle?: string
141
+ elapsed?: string
142
+ branch?: string
143
+ [key: string]: unknown
144
+ }
145
+
146
+ export interface PanelData {
147
+ /** Filled by the `frame` block; absent means that block is degraded (rendered as `—`). */
148
+ project?: string
149
+ timestamp?: string
150
+ interval?: number
151
+ standby?: PanelStandby
152
+ pm?: PanelPm
153
+ pending?: PanelPending
154
+ outbox?: PanelOutbox
155
+ capacity?: PanelCapacity
156
+ agents?: PanelAgent[]
157
+ recent?: string[]
158
+ /** TEAM_AGENT_LOG_GLOB when it is set (the activity column's source hint). */
159
+ activity_source?: string
160
+ }
161
+
162
+ // ------------------------------------------------------------------ console-only readers
163
+
164
+ /** One BOARD.md row (the raw status token; `done` rows collapse in the layout). */
165
+ export interface BoardRow {
166
+ id: string
167
+ title: string
168
+ agent: string
169
+ branch: string
170
+ deps: string
171
+ state: string
172
+ /** The task brief's `phase:` header (`-` when there is no brief or no header) — console-only. */
173
+ phase?: string
174
+ }
175
+
176
+ /** A recent delivery (a report file, newest first) for the overview's delivery block. */
177
+ export interface Delivery {
178
+ id: string
179
+ agent: string
180
+ /** The report's mtime as a timestamp (the frame renders its clock — see the bash reader). */
181
+ at: string
182
+ }
183
+
184
+ export interface BoardBlock {
185
+ rows: BoardRow[]
186
+ counts: Record<string, number>
187
+ total: number
188
+ /** Newest report files, already trimmed by the reader. */
189
+ deliveries: Delivery[]
190
+ }
191
+
192
+ /** One task token of a change (P45/B2): the mapping's `<ID> <board-status>` plus its verdict. */
193
+ export interface ChangeTaskToken {
194
+ id: string
195
+ phase: string
196
+ /** The BOARD row's status, or `-` when the id has no row. */
197
+ board: string
198
+ /** The review record's verdict (PASS/FAIL/…/none/missing), straight from team_review_verdict. */
199
+ verdict: string
200
+ }
201
+
202
+ export interface ChangeRow {
203
+ id: string
204
+ done: number
205
+ total: number
206
+ /** The `openspec list` age token (`44m ago`), verbatim. */
207
+ age: string
208
+ /** explore | propose | apply | verify — derived from the artifacts on disk. */
209
+ phase: string
210
+ /** The change's mapped tasks (P45/B2). Absent on a reader that predates the field. */
211
+ tasks?: ChangeTaskToken[]
212
+ /** Mapped tasks beyond the token bound (`+N`); 0 when none. */
213
+ tasks_more?: number
214
+ }
215
+
216
+ export interface ChangesBlock {
217
+ /** False when neither the CLI nor the change directory could be read. */
218
+ available: boolean
219
+ source: string
220
+ changes: ChangeRow[]
221
+ count: number
222
+ }
223
+
224
+ export interface SpecRow {
225
+ name: string
226
+ requirements: number
227
+ }
228
+
229
+ export interface SpecsBlock {
230
+ available: boolean
231
+ count: number
232
+ requirements: number
233
+ specs: SpecRow[]
234
+ }
235
+
236
+ export interface DecisionsBlock {
237
+ count: number
238
+ /** The newest decision headings, newest first (`D26 · 2026-09-16 · 决定 — …`). */
239
+ recent: string[]
240
+ }
241
+
242
+ /** One outbox entry for the messages page; `text` is the sanitized payload (read-only). */
243
+ export interface QueueEntry {
244
+ name: string
245
+ state: 'queued' | 'held'
246
+ age_s: number | null
247
+ target: string
248
+ kind: string
249
+ from: string
250
+ reason: string
251
+ text: string
252
+ }
253
+
254
+ export interface OutboxListBlock {
255
+ entries: QueueEntry[]
256
+ queued: number
257
+ held: number
258
+ }
259
+
260
+ export interface InboxRow {
261
+ agent: string
262
+ inbox_new: number
263
+ inbox_lines: number
264
+ inbox_age_s: number | null
265
+ inbox_tail: string
266
+ thread_lines: number
267
+ thread_age_s: number | null
268
+ thread_tail: string
269
+ }
270
+
271
+ export interface InboxBlock {
272
+ agents: InboxRow[]
273
+ }
274
+
275
+ export interface PatrolBlock {
276
+ /** watchdog.log tail, oldest first. */
277
+ lines: string[]
278
+ count: number
279
+ }
280
+
281
+ export interface HealthBlock {
282
+ version: string
283
+ doc_version: string
284
+ /** ok | warn | fail | unavailable. */
285
+ doctor: string
286
+ /** Always `—` in v1 (no gate record point; tasks.md 4.2 / design §8). */
287
+ gates: string
288
+ }
289
+
290
+ /** One contract key as `team config list --json` reports it (P22/B2). */
291
+ export interface SettingsKey {
292
+ name: string
293
+ /** apply | restart | refuse — the owning command's closed vocabulary. */
294
+ class: 'apply' | 'restart' | 'refuse'
295
+ kind: string
296
+ /** plain | export — the assignment form the writer produces. */
297
+ form: string
298
+ /** The file's value ('' when the file does not carry the key). */
299
+ value: string
300
+ default: string
301
+ /** Whether the file itself carries the key. */
302
+ set: boolean
303
+ /** The line's own inline comment, verbatim (may be empty). */
304
+ comment: string
305
+ /** A command-side warning (an unknown seat token in TEAM_AGENT_MODELS, …). */
306
+ warning: string
307
+ /** The refusal's route for a read-only key (`team add-agent`, hand-edit the file, …). */
308
+ route?: string
309
+ /**
310
+ * The key's schema-derived choice set (M55), verbatim from `team config list --json`. The
311
+ * console reads its options from here and from nowhere else: a key or a value added to the
312
+ * command's schema appears without rebuilding the bundle. Absent against an older command.
313
+ */
314
+ choices?: SettingsChoices
315
+ /**
316
+ * The key's functional domain (P30): the schema row's tenth column, verbatim from `team config
317
+ * list --json` ('' for a key the schema does not know, and for a schema row that declares none).
318
+ * The view's headings are looked up by this token (`group_<token>`); the bundle keeps no
319
+ * key→group table. Absent against an older command.
320
+ */
321
+ group?: string
322
+ /** False for a key in the file the schema does not know (read-only row). */
323
+ known?: boolean
324
+ }
325
+
326
+ /** One key's choice set as the owning command reports it (M55). */
327
+ export interface SettingsChoices {
328
+ /** schema | known | none — where the vocabulary came from. */
329
+ source: string
330
+ /** The ordered vocabulary; `[]` when the kind has none. */
331
+ values: string[]
332
+ /** The numeric kinds' accepted lower bound as a string ('' = unbounded). */
333
+ min: string
334
+ /** The numeric kinds' accepted upper bound as a string ('' = unbounded). */
335
+ max: string
336
+ /** True when the writer accepts the empty value for this key (decides a clear entry). */
337
+ empty: boolean
338
+ /** The command's own note; a `path` kind carries its existence rule (file|dir|exec|any). */
339
+ note: string
340
+ }
341
+
342
+ /** One drawn entry of the choice picker (M55). */
343
+ export interface SettingsChoiceEntry {
344
+ /** The value the entry carries ('' for keep-unset/clear/free). */
345
+ value: string
346
+ /** What the entry is: a special action or a value from the command's own vocabulary. */
347
+ kind: 'keep-unset' | 'current' | 'default' | 'value' | 'clear' | 'free'
348
+ /** What the compose editor opens with when this entry is accepted (defaults to `value`). */
349
+ seed?: string
350
+ /** The path kind's existence mark (the command's note carries the rule). */
351
+ mark?: 'exists' | 'missing' | 'not-exec'
352
+ }
353
+
354
+ /** The open choice picker: the row it edits, the kind and the command's entries. */
355
+ export interface SettingsChoicePicker {
356
+ /** The row index in the filtered settings row list (the focus returns here on `esc`). */
357
+ row: number
358
+ /** The raw key of the row being edited. */
359
+ key: string
360
+ /** The schema kind the entries were built for (drives the labels and the reason line). */
361
+ kind: string
362
+ /** The entries in the order the requirement fixes: keep-unset? current? default? values… then kind actions. */
363
+ entries: SettingsChoiceEntry[]
364
+ /** The selected entry. */
365
+ index: number
366
+ /** The accepted interval the numeric kinds display (null when the kind names none). */
367
+ interval: { min: string; max: string } | null
368
+ }
369
+
370
+ /** One seat's displayed model and its CLI-computed source (P22/B4). */
371
+ export interface SettingsSeat {
372
+ agent: string
373
+ model: string
374
+ source: 'config' | 'explicit' | 'record'
375
+ override: boolean
376
+ }
377
+
378
+ /** The `settings` block: exactly `team config list --json` (P22/B2). */
379
+ export interface SettingsBlock {
380
+ path: string
381
+ fingerprint: string
382
+ mtime: string
383
+ keys: SettingsKey[]
384
+ models: { default: string; known: string[]; seats: SettingsSeat[] }
385
+ audit: string[]
386
+ }
387
+
388
+ /** One file discovered for an entry's detail view (read-only, P18/B3). */
389
+ export interface DetailFile {
390
+ /** The tab label: `brief`, `report:<agent>`, `review` or `review:<suffix>`. */
391
+ tab: string
392
+ /** The file's basename. */
393
+ name: string
394
+ /** The repo-relative path — the only value the reader's `--file` accepts. */
395
+ path: string
396
+ /** Bytes on disk. */
397
+ size: number
398
+ /** True when the file is over the 128 KiB read cap. */
399
+ truncated: boolean
400
+ }
401
+
402
+ /** The on-demand `detail` block: the discovered file list plus the served file's text. */
403
+ export interface DetailBlock {
404
+ id: string
405
+ count: number
406
+ /** The repo-relative path whose text this block carries (`''` when the entry has no files). */
407
+ file: string
408
+ /** The served file's text, capped at 128 KiB by the reader. */
409
+ text: string
410
+ /** True when the served file was cut at the cap. */
411
+ truncated: boolean
412
+ files: DetailFile[]
413
+ }
414
+
415
+ /** The console-only readers, keyed by their block name; absent = that source failed. */
416
+ export interface PanelBlocks {
417
+ board?: BoardBlock
418
+ changes?: ChangesBlock
419
+ specs?: SpecsBlock
420
+ decisions?: DecisionsBlock
421
+ outbox_list?: OutboxListBlock
422
+ inbox?: InboxBlock
423
+ patrol?: PatrolBlock
424
+ health?: HealthBlock
425
+ /** The project-settings view's on-demand reader (P22/B2); absent while the view is closed. */
426
+ settings?: SettingsBlock
427
+ /** Built only while the detail view is open (design §8); never spawned on a parked page. */
428
+ detail?: DetailBlock
429
+ }
430
+
431
+ // ------------------------------------------------------------------ layout
432
+
433
+ export type Tone =
434
+ | 'title'
435
+ | 'text'
436
+ | 'dim'
437
+ | 'heading'
438
+ | 'accent'
439
+ | 'ok'
440
+ | 'warn'
441
+ | 'err'
442
+ | 'selected'
443
+
444
+ export interface Segment {
445
+ text: string
446
+ tone: Tone
447
+ /**
448
+ * True for the title band's clock: the App's own 1s ticker owns that text in the TUI (the `now`
449
+ * state re-feeds `panel.timestamp` every second), while `--print`/`--json`/snapshots render
450
+ * `text` verbatim. It must never be merged into a neighbour, and a frame whose only difference
451
+ * is this segment is "unchanged" (`frameSignature`) — that is what keeps the redraw off the CPU
452
+ * red line.
453
+ */
454
+ clock?: boolean
455
+ }
456
+
457
+ export type Line = Segment[]
458
+
459
+ /** A clickable span on a rendered row. */
460
+ export interface Hit {
461
+ start: number
462
+ end: number
463
+ action: Action
464
+ }
465
+
466
+ export type Action =
467
+ | { kind: 'compose' }
468
+ | { kind: 'flush' }
469
+ | { kind: 'standby' }
470
+ | { kind: 'settings' }
471
+ | { kind: 'page'; page: PageId }
472
+ | { kind: 'page-cycle' }
473
+ | { kind: 'scroll'; delta: number }
474
+ | { kind: 'quit' }
475
+ | { kind: 'close-overlay' }
476
+ | { kind: 'toggle'; pref: PrefName }
477
+ | { kind: 'view-entry'; index: number }
478
+ | { kind: 'queue-list' }
479
+ /** Board page: put the focus on this card (a click on an unfocused card). */
480
+ | { kind: 'focus'; lane: string; id: string; nth?: number }
481
+ /** Board page: open the focused card's detail view (a click on the already focused card). */
482
+ | { kind: 'open-focused'; lane: string }
483
+ /** Board page: move the focus one lane left/right (the key band's `←`/`→` chip). */
484
+ | { kind: 'lane-move'; delta: number }
485
+ /** Board page: move the focus one card up/down inside its lane (the `↑`/`↓` chip). */
486
+ | { kind: 'card-move'; delta: number }
487
+ /** Board page: the wheel's lane hit — scroll this lane's window (never the focus). */
488
+ | { kind: 'lane-scroll'; lane: string; delta: number }
489
+ /** Board page: toggle this lane's fold (the `c` chip or a click on the lane's header line).
490
+ * `scroll` names the wheel region the same line keeps when the tier batches every lane into one
491
+ * window (the grouped form); absent = the lane's own window. */
492
+ | { kind: 'lane-fold'; lane: string; scroll?: string }
493
+ /** Detail view: switch to the file tab at `index` (a click on the tab row). */
494
+ | { kind: 'detail-tab'; index: number }
495
+ /** Detail view: move the file tab one step (the key band's ←/→ chip). */
496
+ | { kind: 'detail-tab-move'; delta: number }
497
+ /** Detail view: scroll the document (the ↑/↓ chip). */
498
+ | { kind: 'detail-scroll'; delta: number }
499
+ /** Detail view: leave it (Esc/q) without collapsing the console. */
500
+ | { kind: 'detail-close' }
501
+ /** Project-settings view: close it (Esc) back to the overlay it was opened from. */
502
+ | { kind: 'settings-close' }
503
+ /** Project-settings view: focus a row (a click on an unfocused row). */
504
+ | { kind: 'settings-focus'; index: number }
505
+ /** Project-settings view: open the focused row (Enter / a click on the focused row). */
506
+ | { kind: 'settings-open'; index: number }
507
+ /** Project-settings view: open the filter line (the `/` chip). */
508
+ | { kind: 'settings-filter' }
509
+ /** Project-settings view: scroll the row window by the wheel (the focus stays). */
510
+ | { kind: 'settings-scroll'; delta: number }
511
+ /** The choice picker (M55): accept the focused entry (index -1) or the one clicked. */
512
+ | { kind: 'choice-pick'; index: number }
513
+ /** The choice picker: move the selection (↑/↓ and the wheel — the window follows the selection). */
514
+ | { kind: 'choice-move'; delta: number }
515
+ /** The choice picker: close it back to the row list (the row focus is preserved). */
516
+ | { kind: 'choice-close' }
517
+ /** The settings overlay's navigation row: open the project-settings view. */
518
+ | { kind: 'settings-open-view' }
519
+ /** The seat picker: choose option `index` (a click on a picker row). */
520
+ | { kind: 'seat-pick'; index: number }
521
+ /** The seat picker: move the selection (the ↑/↓ chips). */
522
+ | { kind: 'seat-move'; delta: number }
523
+
524
+ export interface PlacedLine {
525
+ line: Line
526
+ hits?: Hit[]
527
+ }
528
+
529
+ /**
530
+ * The board focus's identity (M48): the entry id **plus which row of that id** — an id may name
531
+ * several BOARD.md rows (the file's history has shared ids), and a bare id makes the cursor freeze
532
+ * on the first of them. `nth` is the 0-based duplicate ordinal in BOARD.md order; absent = 0, so a
533
+ * focus written by an older build (or a hand-made fixture) still resolves.
534
+ */
535
+ export interface FocusRef {
536
+ lane: string
537
+ id: string
538
+ nth?: number
539
+ }
540
+
541
+ /** A lane's window as the frame rendered it (the App's arrow keys and wheel clamp against this). */
542
+ export interface LaneWindow {
543
+ lane: string
544
+ offset: number
545
+ visible: number
546
+ count: number
547
+ }
548
+
549
+ /** The detail view's document window as the frame rendered it (the App's arrows/wheel clamp). */
550
+ export interface DetailWindow {
551
+ /** The rendered tab index. */
552
+ index: number
553
+ /** Document rows at the rendered width. */
554
+ total: number
555
+ /** Rows the window shows. */
556
+ visible: number
557
+ /** The first visible row (clamped by the layout). */
558
+ offset: number
559
+ }
560
+
561
+ /** The project-settings view's row window as the frame rendered it (P22/B2). */
562
+ export interface SettingsWindow {
563
+ /** The focused focusable row (an index into the filtered row list). */
564
+ focus: number
565
+ /** The first drawn focusable row. */
566
+ offset: number
567
+ /** Focusable rows the window shows. */
568
+ visible: number
569
+ /** Focusable rows in the filtered list. */
570
+ count: number
571
+ }
572
+
573
+ /** A rendered frame: the rows plus the click targets resolved to absolute rows. */
574
+ export interface Frame {
575
+ rows: Line[]
576
+ targets: { row: number; hit: Hit }[]
577
+ /** The board page's lane windows (absent on the other pages). */
578
+ lanes?: LaneWindow[]
579
+ /** The detail view's document window (absent while the view is closed). */
580
+ detail?: DetailWindow
581
+ /** The project-settings view's row window (absent while the view is closed). */
582
+ settings?: SettingsWindow
583
+ /** The work page's board rows in the order they were drawn (the App's `↑`/`↓` walk this). */
584
+ boardOrder?: FocusRef[]
585
+ }
586
+
587
+ export interface FrameInput {
588
+ panel: PanelData
589
+ /** The data layer's blocks (`monitor.mjs --json`), already sanitized. */
590
+ activityBlocks: ActivityBlock[]
591
+ /** The console-only readers. */
592
+ blocks: PanelBlocks
593
+ /** Blocks whose source failed in this assembly; their block renders `—`. */
594
+ degraded?: string[]
595
+ width: number
596
+ height: number
597
+ /** Whether the activity column is on for this frame. */
598
+ activity: boolean
599
+ }
600
+
601
+ /** The console's UI state (TUI-only; the machine exits use the defaults). */
602
+ export interface ViewState {
603
+ page: PageId
604
+ density: Density
605
+ /** The active language table's id (`zh` | `en`). */
606
+ lang: string
607
+ /** The mouse preference as the frame is drawn (targets exist regardless; this drives the hint). */
608
+ mouseOn: boolean
609
+ /** True in the TUI renderer — the page tabs, targets and the overlay only exist there. */
610
+ tui: boolean
611
+ overlay: boolean
612
+ /** The selected row inside the settings overlay. */
613
+ overlayIndex: number
614
+ /** The queue entry shown in full on the messages page, or null for the list. */
615
+ viewEntry: number | null
616
+ scroll: number
617
+ /** The kanban's focused card, keyed by entry id + duplicate ordinal (a vanished id falls back). */
618
+ focus?: FocusRef | null
619
+ /** Per-lane window offsets (the board page's wheel); absent lanes anchor on their newest cards. */
620
+ laneOffset?: Record<string, number>
621
+ /** The board's explicitly folded lanes (P123, legend order); empty/absent = none. */
622
+ boardFold?: string[]
623
+ /** The board's explicitly shown lanes (P123, legend order): they stay unfolded even when empty. */
624
+ boardShow?: string[]
625
+ /** The empty-lane fold default (P123): `undefined`/`true` folds an empty lane nobody showed. */
626
+ boardEmptyFold?: boolean
627
+ /** The entry id whose read-only detail view is open (null = the page itself is showing). */
628
+ detail?: string | null
629
+ /** The open detail view's file tab (clamped by the layout; 0 = the first file). */
630
+ detailIndex?: number
631
+ /** The detail document's first visible row. */
632
+ detailScroll?: number
633
+ /** True while the project-settings view replaces the page's blocks (P22/B2). */
634
+ settings?: boolean
635
+ /** The focused row in the filtered project-settings row list. */
636
+ settingsFocus?: number
637
+ /** The filter text (`''` = no filter). */
638
+ settingsFilter?: string
639
+ /**
640
+ * The view's own row-window offset (P30/D5): `undefined`/`null` = unset (the window follows the
641
+ * focus); a number pins the window's first visible focusable row (the wheel's own offset).
642
+ */
643
+ settingsOffset?: number | null
644
+ /** The open setting editor's draft: the row it edits, the text and the insertion point. */
645
+ settingsDraft?: { row: number; text: string; cursor: number } | null
646
+ /** The pending write confirmation (the first Enter of a two-step write). */
647
+ settingsConfirm?: { row: number; key: string; old: string; next: string; danger: boolean } | null
648
+ /** The open seat picker: the seat's agent, its option list and the selection. */
649
+ seatPicker?: { agent: string; row: number; models: string[]; index: number } | null
650
+ /** The open choice picker (M55): the row, its schema-derived entries and the selection. */
651
+ choicePicker?: SettingsChoicePicker | null
652
+ }