@defrex/autobuild 1.10.0 → 1.11.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 (250) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +738 -68
  3. package/bin/ab-dispatch-generation.ts +3 -1
  4. package/docs/accounts.md +2 -1
  5. package/docs/answering-blocked-builds.md +20 -0
  6. package/docs/architecture.md +155 -25
  7. package/docs/build-store.md +10 -7
  8. package/docs/cli.md +33 -1
  9. package/docs/configuration-overview.md +4 -1
  10. package/docs/configuration.md +381 -29
  11. package/docs/dispatcher.md +63 -4
  12. package/docs/forges.md +7 -0
  13. package/docs/integration-tree.md +2 -2
  14. package/docs/operating.md +4 -2
  15. package/docs/operator-api.md +134 -6
  16. package/docs/operator-surfaces.md +85 -0
  17. package/docs/optimization-nodes.md +69 -11
  18. package/docs/plugin-authoring.md +37 -1
  19. package/docs/remote-store-protocol.md +94 -13
  20. package/docs/remote-ticket-protocol.md +40 -0
  21. package/docs/restacking.md +20 -4
  22. package/docs/setup.md +14 -2
  23. package/docs/ticket-dependencies.md +10 -3
  24. package/docs/ticket-sources.md +24 -2
  25. package/docs/tickets.md +7 -1
  26. package/docs/troubleshooting.md +8 -0
  27. package/docs/verification.md +4 -3
  28. package/docs/workspaces.md +3 -0
  29. package/package.json +9 -5
  30. package/packages/core/src/cli/accounts.ts +7 -2
  31. package/packages/core/src/cli/attention.ts +3 -1
  32. package/packages/core/src/cli/binary-direct.ts +2 -0
  33. package/packages/core/src/cli/binary-lifecycle.ts +2 -1
  34. package/packages/core/src/cli/build-control.ts +79 -1
  35. package/packages/core/src/cli/context.ts +4 -0
  36. package/packages/core/src/cli/dashboard/facts.ts +49 -53
  37. package/packages/core/src/cli/dashboard/header.ts +101 -0
  38. package/packages/core/src/cli/dashboard/model.ts +31 -39
  39. package/packages/core/src/cli/dashboard/objective-row.ts +46 -14
  40. package/packages/core/src/cli/dashboard/poll.ts +178 -76
  41. package/packages/core/src/cli/dashboard/render.ts +129 -230
  42. package/packages/core/src/cli/dashboard/row-text.ts +538 -0
  43. package/packages/core/src/cli/dashboard/timeline.ts +288 -0
  44. package/packages/core/src/cli/dashboard/vocabulary.ts +188 -0
  45. package/packages/core/src/cli/dispatch-args.ts +44 -1
  46. package/packages/core/src/cli/dispatch-frontend.ts +29 -38
  47. package/packages/core/src/cli/dispatch-launch-stop.ts +18 -0
  48. package/packages/core/src/cli/dispatch-launcher.ts +20 -7
  49. package/packages/core/src/cli/dispatch-web.ts +155 -0
  50. package/packages/core/src/cli/dispatch.ts +200 -34
  51. package/packages/core/src/cli/help.ts +87 -3
  52. package/packages/core/src/cli/init-validation.ts +3 -3
  53. package/packages/core/src/cli/main.ts +70 -6
  54. package/packages/core/src/cli/mcp.ts +35 -3
  55. package/packages/core/src/cli/objective.ts +1 -1
  56. package/packages/core/src/cli/operator-preference.ts +57 -0
  57. package/packages/core/src/cli/repo-lease.ts +2 -0
  58. package/packages/core/src/cli/repo-state.ts +56 -6
  59. package/packages/core/src/cli/repository-status.ts +97 -43
  60. package/packages/core/src/cli/status.ts +82 -1
  61. package/packages/core/src/cli/terminal-restore.ts +32 -7
  62. package/packages/core/src/cli/ticket.ts +98 -36
  63. package/packages/core/src/cli/wait.ts +14 -6
  64. package/packages/core/src/cli/watch.ts +20 -4
  65. package/packages/core/src/cli/web.ts +139 -0
  66. package/packages/core/src/config/live.ts +99 -14
  67. package/packages/core/src/config/load.ts +61 -20
  68. package/packages/core/src/config/local.ts +212 -0
  69. package/packages/core/src/config/pipeline-source.ts +2 -0
  70. package/packages/core/src/config/reference.ts +18 -0
  71. package/packages/core/src/config/schema.ts +45 -10
  72. package/packages/core/src/events/catalog.ts +4 -0
  73. package/packages/core/src/events/payloads.ts +97 -0
  74. package/packages/core/src/events/policy.ts +10 -0
  75. package/packages/core/src/events/repository.ts +46 -3
  76. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +316 -0
  77. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/017d8dd5bb6dd80b.json.gz +0 -0
  78. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/178e12f1759b7552.json.gz +0 -0
  79. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/4932c70a2af97faf.json.gz +0 -0
  80. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/536085773daf6b58.json.gz +0 -0
  81. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/6bd6275061aaffa5.json.gz +0 -0
  82. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/89625654b02e9ac1.json.gz +0 -0
  83. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/a98af134be2da8a9.json.gz +0 -0
  84. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/d5d5ccca80a893d8.json.gz +0 -0
  85. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/f8155387eb5f375c.json.gz +0 -0
  86. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/3c27f918b194e3b3.json +465 -0
  87. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/79f0e0f4ccd43ba2.json +455 -0
  88. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/859c09edac738823.json +1086 -0
  89. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a283c1f3462b1cc1.json +81 -0
  90. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a6e570fb126991ff.json +36 -0
  91. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a8acf22c968b6e3d.json +81 -0
  92. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/ba7b85895bf6698e.json +1153 -0
  93. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/fc66408cde0b6b04.json +637 -0
  94. package/packages/core/src/kernel/build-roster.ts +230 -0
  95. package/packages/core/src/kernel/dispatch-capacity.ts +4 -2
  96. package/packages/core/src/kernel/engine.ts +43 -5
  97. package/packages/core/src/kernel/execution-intervals.ts +61 -0
  98. package/packages/core/src/kernel/generators/optimization-log.ts +101 -0
  99. package/packages/core/src/kernel/generators/repository-journals.ts +13 -0
  100. package/packages/core/src/kernel/leaf-restack-base.ts +33 -7
  101. package/packages/core/src/kernel/leaf-restack-state.ts +82 -3
  102. package/packages/core/src/kernel/log-index.ts +19 -0
  103. package/packages/core/src/kernel/optimization-admission.ts +244 -3
  104. package/packages/core/src/kernel/optimization.ts +183 -4
  105. package/packages/core/src/kernel/phase-failures.ts +121 -0
  106. package/packages/core/src/kernel/published-branch-head.ts +60 -0
  107. package/packages/core/src/kernel/reducer-registry.ts +27 -8
  108. package/packages/core/src/kernel/reducer-revisions.ts +25 -0
  109. package/packages/core/src/kernel/reducer.ts +63 -4
  110. package/packages/core/src/kernel/rollup.ts +61 -0
  111. package/packages/core/src/kernel/setup-streak.ts +38 -0
  112. package/packages/core/src/kernel/step-durations.ts +257 -0
  113. package/packages/core/src/kernel/target-observation.ts +6 -1
  114. package/packages/core/src/kernel/target-rewrite-recovery.ts +116 -0
  115. package/packages/core/src/kernel/verify-diff-base.ts +5 -0
  116. package/packages/core/src/kernel/verify-stages.ts +13 -3
  117. package/packages/core/src/ontology.ts +5 -0
  118. package/packages/core/src/operator/agent-context-serve.ts +631 -0
  119. package/packages/core/src/operator/annotations.ts +75 -5
  120. package/packages/core/src/operator/attention.ts +470 -0
  121. package/packages/core/src/operator/canonical-skills.ts +35 -0
  122. package/packages/core/src/operator/cli-equivalents.ts +270 -0
  123. package/packages/core/src/operator/context-prompts.ts +61 -0
  124. package/packages/core/src/operator/index.ts +49 -1
  125. package/packages/core/src/operator/landings.ts +28 -19
  126. package/packages/core/src/operator/optimization.ts +7 -0
  127. package/packages/core/src/operator/protocol.ts +3 -0
  128. package/packages/core/src/operator/query.ts +122 -72
  129. package/packages/core/src/operator/read-view.ts +5 -2
  130. package/packages/core/src/operator/registry.ts +406 -46
  131. package/packages/core/src/operator/requests.ts +20 -18
  132. package/packages/core/src/operator/sandbox-host.ts +107 -11
  133. package/packages/core/src/operator/sandbox-resolver.ts +253 -0
  134. package/packages/core/src/operator/sandbox.ts +778 -82
  135. package/packages/core/src/operator/ticket-asset-list.ts +77 -0
  136. package/packages/core/src/operator/ticket-assets.ts +167 -0
  137. package/packages/core/src/operator/tickets.ts +33 -2
  138. package/packages/core/src/plugin-sdk/index.ts +22 -0
  139. package/packages/core/src/plugins/manifest.ts +1 -1
  140. package/packages/core/src/ports/forge/fake.ts +92 -1
  141. package/packages/core/src/ports/forge/git-blob.ts +15 -0
  142. package/packages/core/src/ports/forge/github.ts +82 -0
  143. package/packages/core/src/ports/forge/local-git.ts +61 -1
  144. package/packages/core/src/ports/forge-failure.ts +24 -0
  145. package/packages/core/src/ports/runner/antigravity-test.fixture.ts +149 -0
  146. package/packages/core/src/ports/runner/claude-test.fixture.ts +71 -0
  147. package/packages/core/src/ports/runner/codex-test.fixture.ts +63 -0
  148. package/packages/core/src/ports/tickets/contract.ts +71 -0
  149. package/packages/core/src/ports/tickets/fake.ts +11 -0
  150. package/packages/core/src/ports/tickets/file.ts +18 -0
  151. package/packages/core/src/ports/tickets/github-fake.ts +136 -4
  152. package/packages/core/src/ports/tickets/github.ts +387 -30
  153. package/packages/core/src/ports/tickets/hosted-index.ts +10 -0
  154. package/packages/core/src/ports/tickets/linear.ts +130 -0
  155. package/packages/core/src/ports/tickets/priority.ts +9 -0
  156. package/packages/core/src/ports/tickets/remote-protocol.ts +34 -0
  157. package/packages/core/src/ports/tickets/remote.ts +70 -6
  158. package/packages/core/src/ports/tickets/search.ts +139 -0
  159. package/packages/core/src/ports/types.ts +104 -2
  160. package/packages/core/src/ports/workspace/builtin-capabilities.ts +9 -0
  161. package/packages/core/src/ports/workspace/create.ts +15 -1
  162. package/packages/core/src/ports/workspace/fake.ts +340 -12
  163. package/packages/core/src/ports/workspace/git-worktree.ts +833 -42
  164. package/packages/core/src/ports/workspace/operator-sandbox.ts +129 -12
  165. package/packages/core/src/ports/workspace/process-group.ts +48 -0
  166. package/packages/core/src/ports/workspace/vercel-sandbox.ts +1260 -123
  167. package/packages/core/src/processes/agent-context-assemble.ts +576 -0
  168. package/packages/core/src/processes/agent-context.ts +469 -0
  169. package/packages/core/src/processes/build-runner.ts +387 -236
  170. package/packages/core/src/processes/dispatcher.ts +211 -55
  171. package/packages/core/src/processes/execution-no-progress.ts +4 -0
  172. package/packages/core/src/processes/optimization-activity.ts +120 -0
  173. package/packages/core/src/processes/phase-failure-budget.ts +1 -0
  174. package/packages/core/src/processes/repo-view.ts +78 -2
  175. package/packages/core/src/processes/sandbox-state.ts +53 -6
  176. package/packages/core/src/processes/tick-publication.ts +2 -0
  177. package/packages/core/src/processes/workspace-preparation.ts +76 -0
  178. package/packages/core/src/scenarios/harness.ts +0 -5
  179. package/packages/core/src/store/account-redaction.ts +1 -0
  180. package/packages/core/src/store/adapter.ts +52 -1
  181. package/packages/core/src/store/agent-context.ts +432 -0
  182. package/packages/core/src/store/build-feed.ts +291 -0
  183. package/packages/core/src/store/build-scope.ts +19 -1
  184. package/packages/core/src/store/contract.ts +911 -14
  185. package/packages/core/src/store/digest.ts +19 -6
  186. package/packages/core/src/store/histogram.ts +113 -0
  187. package/packages/core/src/store/local/schema.ts +62 -0
  188. package/packages/core/src/store/local/store.ts +628 -22
  189. package/packages/core/src/store/local/ticket-asset-heads.ts +23 -0
  190. package/packages/core/src/store/memory.ts +461 -69
  191. package/packages/core/src/store/open-builds.ts +19 -0
  192. package/packages/core/src/store/phase-session.ts +32 -4
  193. package/packages/core/src/store/reduced-reads.ts +14 -4
  194. package/packages/core/src/store/reducer-value-shapes.json +6987 -5749
  195. package/packages/core/src/store/reducer-values.ts +6 -1
  196. package/packages/core/src/store/remote/client.ts +208 -2
  197. package/packages/core/src/store/remote/compatibility.ts +1 -1
  198. package/packages/core/src/store/remote/index.ts +33 -0
  199. package/packages/core/src/store/remote/protocol.ts +69 -0
  200. package/packages/core/src/store/remote/released-clients.json +11 -0
  201. package/packages/core/src/store/remote/released-reducer-values/1.11.0.json +35680 -0
  202. package/packages/core/src/store/remote/released-reducer-values/index.ts +18 -16
  203. package/packages/core/src/store/retention.ts +23 -1
  204. package/packages/core/src/store/rollups.ts +337 -0
  205. package/packages/core/src/store/session-handle.ts +20 -2
  206. package/packages/core/src/store/snapshots.ts +10 -0
  207. package/packages/core/src/store/types.ts +108 -9
  208. package/packages/core/src/testing/dispatch-read-budget.ts +1092 -2
  209. package/packages/core/src/testing/git-config-isolation.ts +7 -5
  210. package/packages/core/src/testing/index.ts +27 -0
  211. package/packages/core/src/testing/memory-operator-sandbox.ts +346 -0
  212. package/packages/core/src/testing/reduced-read-budget.ts +1873 -98
  213. package/packages/core/src/web/analytics-source.ts +303 -0
  214. package/packages/core/src/web/assets/Atkinson-OFL.txt +93 -0
  215. package/packages/core/src/web/assets/AtkinsonHyperlegibleNext.latin.woff2 +0 -0
  216. package/packages/core/src/web/assets/JetBrains-OFL.txt +93 -0
  217. package/packages/core/src/web/assets/JetBrainsMono.latin.woff2 +0 -0
  218. package/packages/core/src/web/assets/app.css +1 -0
  219. package/packages/core/src/web/assets/app.js +9 -0
  220. package/packages/core/src/web/assets/manifest.json +31 -0
  221. package/packages/core/src/web/assets/theme.js +1 -0
  222. package/packages/core/src/web/bounded.ts +31 -0
  223. package/packages/core/src/web/http.ts +315 -0
  224. package/packages/core/src/web/hub.ts +160 -0
  225. package/packages/core/src/web/options.ts +38 -0
  226. package/packages/core/src/web/overview-source.ts +322 -0
  227. package/packages/core/src/web/page.ts +56 -0
  228. package/packages/core/src/web/protocol.ts +151 -0
  229. package/packages/core/src/web/read-only.ts +23 -0
  230. package/packages/core/src/web/repository-source.ts +35 -0
  231. package/packages/core/src/web/server.ts +97 -0
  232. package/skills/code-review/SKILL.md +10 -2
  233. package/skills/guide/SKILL.md +366 -52
  234. package/skills/guide/references/accounts.md +2 -1
  235. package/skills/guide/references/integration-tree.md +2 -2
  236. package/skills/guide/references/operator-api.md +134 -6
  237. package/skills/guide/references/optimization-nodes.md +69 -11
  238. package/skills/guide/references/plugin-authoring.md +37 -1
  239. package/skills/guide/references/remote-store-protocol.md +94 -13
  240. package/skills/guide/references/remote-ticket-protocol.md +40 -0
  241. package/skills/guide/references/restacking.md +20 -4
  242. package/skills/guide/references/setup.md +14 -2
  243. package/skills/guide/references/ticket-dependencies.md +10 -3
  244. package/skills/implement/SKILL.md +23 -4
  245. package/skills/operate/SKILL.md +134 -32
  246. package/skills/plan/SKILL.md +10 -4
  247. package/skills/plan-review/SKILL.md +9 -2
  248. package/skills/spec/SKILL.md +34 -8
  249. package/skills/tickets/SKILL.md +51 -5
  250. package/templates/hosted-service/package.json +2 -2
@@ -2,8 +2,7 @@ import { formatRollback } from './rollback'
2
2
  import { formatHandoff } from './handoff'
3
3
  import { handPushedLabel, handPushedText } from './hand-pushed'
4
4
  import { integrationBarCells } from './integration-row'
5
- import { capacityExplanation } from '../../kernel/dispatch-capacity'
6
- import { NO_DISPATCHER_RUN_LINE, activeCounterText } from './configuration'
5
+ import { NO_DISPATCHER_RUN_LINE } from './configuration'
7
6
  import { treeVocabulary, consentQueue } from './tree'
8
7
  import { objectiveElapsedHours, objectiveParts, type ObjectiveRow } from './objective-row'
9
8
  /**
@@ -35,12 +34,7 @@ import type {
35
34
  DashboardSelection,
36
35
  PipelineStep,
37
36
  } from './model'
38
- import {
39
- landingPolicyDisplay,
40
- mergeVocabulary,
41
- mergeSummary,
42
- mergedChildren,
43
- } from './landing-display'
37
+ import { landingPolicyDisplay, mergeVocabulary } from './landing-display'
44
38
  import { dashboardBuildControl, pauseResumeHelp } from './actions'
45
39
  import type { DashboardSession } from './detail'
46
40
  import type { TranscriptPresentation, TranscriptTurn } from './transcript'
@@ -49,6 +43,25 @@ import type { SessionDashboardView } from './model'
49
43
  import { dashboardSelections, sameSelection } from './selection'
50
44
  import { displayText, layoutComposer, packAtomic, wrapDisplay } from './composer'
51
45
  import { cellWidth, graphemes, padEndCells } from './cells'
46
+ import {
47
+ HARVEST_TITLE,
48
+ projectHarvestRowText,
49
+ projectHeaderText,
50
+ projectProgress,
51
+ projectRowText,
52
+ reviewRoundCeilingText,
53
+ type RowAttention,
54
+ } from './row-text'
55
+ import {
56
+ PROGRESS_VERIFIED,
57
+ statusText,
58
+ stepLine,
59
+ stepTone,
60
+ viewerLabel,
61
+ type DashboardTone,
62
+ } from './vocabulary'
63
+
64
+ export { formatDuration } from './vocabulary'
52
65
 
53
66
  export interface RenderOpts {
54
67
  /** ANSI on. False ⇒ not a single `\x1b` in the output (the `--plain` AC). */
@@ -110,6 +123,15 @@ const CODES = {
110
123
  } as const
111
124
  type ColorName = keyof typeof CODES
112
125
 
126
+ /** The terminal's colour for each shared tone. */
127
+ const TONE_COLOR: Record<DashboardTone, ColorName> = {
128
+ ok: 'green',
129
+ live: 'cyan',
130
+ held: 'yellow',
131
+ alert: 'red',
132
+ pending: 'dim',
133
+ }
134
+
113
135
  function paint(text: string, color: ColorName, on: boolean): string {
114
136
  return on ? `${ESC}${CODES[color]}m${text}${RESET}` : text
115
137
  }
@@ -252,73 +274,15 @@ function objectiveTokens(
252
274
 
253
275
  // ── Steps ────────────────────────────────────────────────────────────────────
254
276
 
255
- const GLYPH: Record<PipelineStep['state'], string> = {
256
- done: '[x]',
257
- current: '[>]',
258
- provisional: '[~]',
259
- pending: '[ ]',
260
- }
261
-
262
- const STEP_COLOR: Record<PipelineStep['state'], ColorName> = {
263
- done: 'green',
264
- current: 'cyan',
265
- provisional: 'yellow',
266
- pending: 'dim',
267
- }
268
-
269
- /**
270
- * Elapsed duration, ASCII only: `Xs` under a minute, `MmSSs` under an hour,
271
- * `HhMMmSSs` above — seconds/minutes zero-padded when a larger unit precedes, so
272
- * the field width is stable as it ticks (`38s`, `4m12s`, `1h04m07s`).
273
- */
274
- export function formatDuration(ms: number): string {
275
- const totalSec = Math.max(0, Math.floor(ms / 1000))
276
- if (totalSec < 60) return `${totalSec}s`
277
- const totalMin = Math.floor(totalSec / 60)
278
- if (totalMin < 60) return `${totalMin}m${String(totalSec % 60).padStart(2, '0')}s`
279
- return `${Math.floor(totalMin / 60)}h${String(totalMin % 60).padStart(2, '0')}m${String(totalSec % 60).padStart(2, '0')}s`
280
- }
281
-
282
277
  function renderStep(step: PipelineStep, color: boolean, now: number): string {
283
- const parts: string[] = []
284
- if (step.qualifier !== undefined) parts.push(step.qualifier)
285
- // The elapsed segment can only be composed here — it depends on the
286
- // render-time clock. A running step's open interval grows with `now`; a
287
- // frozen or done step has none, so its elapsed is stable across repaints.
288
- // `count` rides the time as `/n` (AC 7); with no time in scope it is not
289
- // shown (a fresh/restarted step should not carry a stale round).
290
- if (step.timing !== undefined) {
291
- const { accumulatedMs, runningSince } = step.timing
292
- const elapsedMs =
293
- accumulatedMs + (runningSince !== undefined ? Math.max(0, now - runningSince) : 0)
294
- const count = step.count !== undefined && step.count > 1 ? `/${step.count}` : ''
295
- parts.push(`${formatDuration(elapsedMs)}${count}`)
296
- }
297
- const note = parts.length > 0 ? `(${parts.join(', ')})` : ''
298
- const reason = step.reason !== undefined ? ` — ${step.reason}` : ''
299
- const text = `${GLYPH[step.state]} ${step.label}${note}${reason}`
300
- const painted = paint(text, STEP_COLOR[step.state], color)
278
+ // The elapsed segment depends on the render-time clock: a running step's
279
+ // open interval grows with `now`, a frozen or done step's is stable.
280
+ const painted = paint(stepLine(step, now, 'row'), TONE_COLOR[stepTone(step.state)], color)
301
281
  return step.state === 'current' ? paint(painted, 'bold', color) : painted
302
282
  }
303
283
 
304
284
  // ── Builds ───────────────────────────────────────────────────────────────────
305
285
 
306
- const STATUS_COLOR: Record<DashboardBuild['status'] | DashboardHarvest['status'], ColorName> = {
307
- queued: 'cyan',
308
- running: 'green',
309
- collecting: 'cyan',
310
- pausing: 'yellow',
311
- paused: 'yellow',
312
- suspended: 'yellow',
313
- resuming: 'cyan',
314
- blocked: 'red',
315
- waiting: 'yellow',
316
- aborting: 'red',
317
- cleaning: 'yellow',
318
- escalated: 'yellow',
319
- failed: 'red',
320
- }
321
-
322
286
  /** The marker is one shared visual grammar for every selectable row. */
323
287
  function selectionMarker(selected: boolean, selecting: boolean, color: boolean): string {
324
288
  // The marker owns a fixed two-column lane even when keyboard selection is
@@ -355,19 +319,6 @@ function buildHeader(
355
319
  return `${left}${' '.repeat(Math.max(0, width - visibleLength(left) - visibleLength(pinned)))}${pinned}`
356
320
  }
357
321
 
358
- function reviewRoundCeilingText(build: DashboardBuild): string | undefined {
359
- if (build.reviewRoundCeilings === undefined) return undefined
360
- const values = [
361
- ...(build.reviewRoundCeilings.plan !== undefined
362
- ? [`plan ${build.reviewRoundCeilings.plan}`]
363
- : []),
364
- ...(build.reviewRoundCeilings.code !== undefined
365
- ? [`code ${build.reviewRoundCeilings.code}`]
366
- : []),
367
- ]
368
- return values.length === 0 ? undefined : `review round ceiling: ${values.join(', ')}`
369
- }
370
-
371
322
  function renderBuild(
372
323
  build: DashboardBuild,
373
324
  repositoryPaused: boolean,
@@ -377,6 +328,8 @@ function renderBuild(
377
328
  selecting: boolean,
378
329
  ): string[] {
379
330
  const { color, width, now } = opts
331
+ const text = projectRowText(build, { repositoryPaused })
332
+ const statusColor = TONE_COLOR[text.status.tone]
380
333
 
381
334
  // ── The slug line: TICKET-ID slug … <right cluster> ──────────────────────
382
335
  //
@@ -390,140 +343,99 @@ function renderBuild(
390
343
  // with no ticket (AC 2). No column at all when the frame has zero ticket ids.
391
344
  const marker = selectionMarker(selected, selecting, color)
392
345
  const ticketCol =
393
- widths.ticket > 0 ? paint(padEndCells(build.ticketId ?? '', widths.ticket), 'blue', color) : ''
346
+ widths.ticket > 0 ? paint(padEndCells(text.ticketId ?? '', widths.ticket), 'blue', color) : ''
394
347
  const leftPrefix = `${marker}${ticketCol === '' ? '' : `${ticketCol} `}`
395
348
 
396
- // Right cluster, rightmost last: [PR] [(paused)] STATUS. `padStart`
349
+ // Right cluster, rightmost last: [merge] [PR] [(flags)] STATUS. `padStart`
397
350
  // right-justifies the status word so it is never truncated and always ends at
398
- // the frame's right edge (AC 3, AC 5).
351
+ // the frame's right edge (AC 3, AC 5). The merge state is ALWAYS drawn —
352
+ // including `off` — so consent is never conveyed by the absence of a token.
399
353
  const rightTokens: string[] = []
400
- // The state is ALWAYS drawn — including `off` — so consent is never conveyed
401
- // by the absence of a token alone. Legacy repository defaults have no
402
- // effect on a landing or its presentation.
403
- {
404
- const autoColor: ColorName =
405
- build.autoMerge === 'enabled'
406
- ? 'green'
407
- : build.autoMerge === 'requested' || build.autoMerge === 'polling'
408
- ? 'cyan'
409
- : build.autoMerge === 'cancelling' || build.autoMerge === 'human-merge'
410
- ? 'yellow'
411
- : 'dim'
412
- if (build.kind !== 'integration') rightTokens.push(paint(mergeSummary(build), autoColor, color))
413
- }
414
- if (build.pr !== undefined) rightTokens.push(link(build.pr.url, `PR ${build.pr.state}`, color))
415
- // A repository hold changes no build lifecycle state. Keep QUEUED literal
416
- // and annotate only the rows the hold prevents from launching.
417
- if (repositoryPaused && build.status === 'queued') {
418
- rightTokens.push(paint('(held)', 'yellow', color))
419
- }
420
- // Blocked overrides paused visually, but the pause is still a fact the
421
- // operator needs — so it rides along rather than being overwritten.
422
- if (build.draining) rightTokens.push(paint('(draining)', 'yellow', color))
423
- if (build.alsoPaused) rightTokens.push(paint('(paused)', 'yellow', color))
424
- rightTokens.push(
425
- paint(build.status.toUpperCase().padStart(widths.status), STATUS_COLOR[build.status], color),
426
- )
354
+ if (text.merge !== undefined)
355
+ rightTokens.push(paint(text.merge.text, TONE_COLOR[text.merge.tone], color))
356
+ if (text.pr !== undefined) rightTokens.push(link(text.pr.url, text.pr.text, color))
357
+ for (const flag of text.flags)
358
+ rightTokens.push(paint(`(${flag.term})`, TONE_COLOR[flag.tone], color))
359
+ rightTokens.push(paint(text.status.word.padStart(widths.status), statusColor, color))
427
360
  const rightStr = rightTokens.join(' ')
428
361
 
429
362
  // The slug is the sole flexible segment; narrow frames truncate it before
430
363
  // the right-pinned lifecycle status.
431
- const destination = build.integrationRow?.destination ?? build.target
432
- const suffix = build.integrationRow?.parentDistance ?? build.targetDistance ?? '+?'
433
- const target = destination
434
- ? ` → ${displayText(destination)}${suffix ? ` ${paint(suffix, 'dim', color)}` : ''}`
364
+ const target = text.target
365
+ ? ` → ${displayText(text.target.destination)}${text.target.distance ? ` ${paint(text.target.distance, 'dim', color)}` : ''}`
435
366
  : ''
436
367
  const lines = [
437
368
  buildHeader(
438
369
  leftPrefix,
439
- paint(build.slug, 'bold', color),
370
+ paint(text.slug, 'bold', color),
440
371
  target,
441
372
  rightStr,
442
373
  width,
443
- paint(build.status.toUpperCase(), STATUS_COLOR[build.status], color),
374
+ paint(text.status.word, statusColor, color),
444
375
  ),
445
376
  ]
446
- if (build.integrationRow) {
447
- const row = build.integrationRow
448
- const { bar, counts } = integrationProgress(row, color)
377
+ if (text.progress !== undefined) {
378
+ const { bar, counts } = integrationProgress(text.progress, color)
449
379
  lines.push(
450
380
  ...packLines(
451
- [bar, ...counts, ...(row.verified ? [paint('· verified', 'green', color)] : [])],
381
+ [
382
+ bar,
383
+ ...counts,
384
+ ...(text.progress.verified ? [paint(`· ${PROGRESS_VERIFIED}`, 'green', color)] : []),
385
+ ],
452
386
  width,
453
387
  ' ',
454
388
  ),
455
389
  )
456
- if (build.objectiveRow)
390
+ if (text.objective)
457
391
  lines.push(
458
- ...packLines(objectiveTokens(build.objectiveRow, now, width, ' ', color), width, ' '),
392
+ ...packLines(objectiveTokens(text.objective, now, width, ' ', color), width, ' '),
459
393
  )
460
394
  lines.push(
461
395
  ...packLines(
462
- row.steps.map((s) => renderStep(s, color, now)),
396
+ text.steps.map((s) => renderStep(s, color, now)),
463
397
  width,
464
398
  ' ',
465
399
  ),
466
400
  )
467
- if (row.alert)
468
- for (const line of wrappedText(row.alert.text, Math.max(1, width - 4), ''))
469
- lines.push(paint(` ! ${line}`, row.alert.tone, color))
401
+ for (const item of text.attention) lines.push(...attentionLines(item, width, color))
470
402
  return lines
471
403
  }
472
- if (build.tree && (build.kind === 'integration' || build.tree.consent)) {
473
- const tree = build.tree
474
- for (const text of [
475
- `${tree.branch ?? 'unknown branch'} · ${treeVocabulary.restack} ${tree.restack} · ${treeVocabulary.verify} ${tree.verification.current ? treeVocabulary.current : treeVocabulary.pending} · ${tree.reason ?? (tree.ready ? treeVocabulary.readyToLand : treeVocabulary.notReady)}`,
476
- ...(tree.kind === 'node'
477
- ? [
478
- `${treeVocabulary.children} ${tree.children?.length ?? 'unknown'} · ${tree.completeness}${tree.diagnostics?.length ? ` · ${tree.diagnostics.join('; ')}` : ''}`,
479
- ]
480
- : []),
481
- ])
482
- for (const line of wrappedText(text, width - 4, ''))
483
- lines.push(truncate(` ${line}`, width))
484
- }
485
- const ceiling = reviewRoundCeilingText(build)
486
- if (ceiling !== undefined) lines.push(truncate(` ${ceiling}`, width))
487
-
488
- if (build.abortProgress !== undefined) {
489
- for (const line of wrappedText(build.abortProgress, width - 4, '')) {
490
- lines.push(truncate(paint(` ! ${line}`, STATUS_COLOR[build.status], color), width))
491
- }
492
- } else if (build.dispatch !== undefined) {
493
- for (const line of wrappedText(build.dispatch, width - 4, '')) {
494
- lines.push(truncate(paint(` ! ${line}`, STATUS_COLOR[build.status], color), width))
404
+ for (const line of text.tree ?? [])
405
+ for (const wrapped of wrappedText(line, width - 4, ''))
406
+ lines.push(truncate(` ${wrapped}`, width))
407
+ if (text.ceiling !== undefined) lines.push(truncate(` ${text.ceiling}`, width))
408
+
409
+ if (text.notice !== undefined) {
410
+ for (const line of wrappedText(text.notice.text, width - 4, '')) {
411
+ lines.push(truncate(paint(` ! ${line}`, TONE_COLOR[text.notice.tone], color), width))
495
412
  }
496
413
  } else {
497
414
  // The progress row wraps rather than truncating: the tail is `finalize` and
498
415
  // `merge waiting`, which the ACs require and the operator is waiting on.
499
416
  lines.push(
500
417
  ...packLines(
501
- build.steps.map((s) => renderStep(s, color, now)),
418
+ text.steps.map((s) => renderStep(s, color, now)),
502
419
  width,
503
420
  ' ',
504
421
  ),
505
422
  )
506
423
  }
507
- if (build.alert)
508
- for (const line of wrappedText(build.alert.text, Math.max(1, width - 4), ''))
509
- lines.push(paint(` ! ${line}`, build.alert.tone, color))
510
- // A ticket wait is held work, not a blocker: one yellow line naming the
511
- // tickets, never a red question preview.
512
- if (build.wait)
513
- for (const line of wrappedText(build.wait.text, Math.max(1, width - 4), ''))
514
- lines.push(paint(` ! ${line}`, 'yellow', color))
515
- // Setup failures and blocker questions are dense-list previews. Their model
516
- // strings remain untouched; newline-aware wrapping and capping happen only
517
- // at this presentation seam.
518
- if (build.setupError !== undefined) {
519
- lines.push(...prefixedMessagePreview(build.setupError, width, 'red', color, true))
520
- }
521
- for (const blocker of build.blockers) {
522
- lines.push(...prefixedMessagePreview(blocker, width, 'red', color, true))
523
- }
424
+ for (const item of text.attention) lines.push(...attentionLines(item, width, color))
524
425
  return lines
525
426
  }
526
427
 
428
+ /** A row's attention line. Alerts and ticket waits wrap whole; setup failures
429
+ * and blocker questions are dense-list previews whose model strings remain
430
+ * untouched, wrapped and capped only at this presentation seam. */
431
+ function attentionLines(item: RowAttention, width: number, color: boolean): string[] {
432
+ if (item.kind === 'setup-error' || item.kind === 'escalation')
433
+ return prefixedMessagePreview(item.text, width, TONE_COLOR[item.tone], color, true)
434
+ return wrappedText(item.text, Math.max(1, width - 4), '').map((line) =>
435
+ paint(` ! ${line}`, TONE_COLOR[item.tone], color),
436
+ )
437
+ }
438
+
527
439
  function renderHarvest(
528
440
  harvest: DashboardHarvest,
529
441
  opts: RenderOpts,
@@ -532,25 +444,34 @@ function renderHarvest(
532
444
  selecting: boolean,
533
445
  ): string[] {
534
446
  const { color, width, now } = opts
447
+ const text = projectHarvestRowText(harvest)
535
448
  const marker = selectionMarker(selected, selecting, color)
536
449
  // Harvest has no ticket id, so its title takes the ticket column itself —
537
450
  // aligned with the ids, not the slugs — and the observation count sits in
538
451
  // the flexible slug slot, keeping one row grammar across mixed frames.
539
- const title = widths.ticket > 0 ? padEndCells(HARVEST_TITLE, widths.ticket) : HARVEST_TITLE
452
+ const title = widths.ticket > 0 ? padEndCells(text.title, widths.ticket) : text.title
540
453
  const leftPrefix = `${marker}${paint(title, 'bold', color)} `
541
- const identity = paint(`${harvest.observations} observations`, 'dim', color)
542
- const statusColor = STATUS_COLOR[harvest.status]
543
- const status = paint(harvest.status.toUpperCase().padStart(widths.status), statusColor, color)
454
+ const identity = paint(text.observations, 'dim', color)
455
+ const statusColor = TONE_COLOR[text.status.tone]
456
+ const status = paint(text.status.word.padStart(widths.status), statusColor, color)
544
457
  const lines = [rightPinnedLine(leftPrefix, identity, status, width)]
545
458
  lines.push(
546
459
  ...packLines(
547
- harvest.steps.map((item) => renderStep(item, color, now)),
460
+ text.steps.map((item) => renderStep(item, color, now)),
548
461
  width,
549
462
  ' ',
550
463
  ),
551
464
  )
552
- if (harvest.detail !== undefined) {
553
- lines.push(...prefixedMessagePreview(harvest.detail, width, statusColor, color, false))
465
+ if (text.detail !== undefined) {
466
+ lines.push(
467
+ ...prefixedMessagePreview(
468
+ text.detail.text,
469
+ width,
470
+ TONE_COLOR[text.detail.tone],
471
+ color,
472
+ false,
473
+ ),
474
+ )
554
475
  }
555
476
  return lines
556
477
  }
@@ -560,8 +481,6 @@ interface Widths {
560
481
  status: number
561
482
  }
562
483
 
563
- const HARVEST_TITLE = 'Harvest'
564
-
565
484
  /** Pad ticket id and status to the widest in the FRAME, so columns line up down
566
485
  * the whole dashboard rather than per-row. `ticket` is 0 when no build in the
567
486
  * frame has a ticket id — then there is no ticket column at all. The Harvest
@@ -578,8 +497,8 @@ function frameWidths(builds: DashboardBuild[], harvest: DashboardHarvest | undef
578
497
  ),
579
498
  status: Math.max(
580
499
  0,
581
- ...builds.map((b) => cellWidth(b.status)),
582
- ...(harvest !== undefined ? [cellWidth(harvest.status)] : []),
500
+ ...builds.map((b) => cellWidth(statusText(b.status).word)),
501
+ ...(harvest !== undefined ? [cellWidth(statusText(harvest.status).word)] : []),
583
502
  ),
584
503
  }
585
504
  }
@@ -711,23 +630,7 @@ function wrappedText(value: string, width: number, indent = ''): string[] {
711
630
  }
712
631
 
713
632
  function detailStep(step: PipelineStep, opts: RenderOpts): string {
714
- const { color, now } = opts
715
- const notes: string[] = []
716
- if (step.qualifier !== undefined) notes.push(step.qualifier)
717
- if (step.count !== undefined) {
718
- const kind =
719
- step.label.startsWith('verify:') || step.label === 'reconcile' ? 'attempt' : 'round'
720
- notes.push(`${kind} ${step.count}`)
721
- }
722
- if (step.timing !== undefined) {
723
- const elapsed =
724
- step.timing.accumulatedMs +
725
- (step.timing.runningSince !== undefined ? Math.max(0, now - step.timing.runningSince) : 0)
726
- notes.push(formatDuration(elapsed))
727
- }
728
- const note = notes.length > 0 ? ` (${notes.join(', ')})` : ''
729
- const reason = step.reason !== undefined ? ` — ${step.reason}` : ''
730
- return paint(`${GLYPH[step.state]} ${step.label}${note}${reason}`, STEP_COLOR[step.state], color)
633
+ return paint(stepLine(step, opts.now, 'detail'), TONE_COLOR[stepTone(step.state)], opts.color)
731
634
  }
732
635
 
733
636
  function sessionLines(session: DashboardSession, selected: boolean, opts: RenderOpts): string[] {
@@ -778,24 +681,20 @@ interface DetailBodyLayout {
778
681
 
779
682
  export type DetailFocusTarget = 'session' | 'message'
780
683
 
781
- function integrationProgress(row: NonNullable<DashboardBuild['integrationRow']>, color: boolean) {
782
- const children = row.children
684
+ function integrationProgress(progress: ReturnType<typeof projectProgress>, color: boolean) {
685
+ const children = progress.children
783
686
  let bar = paint('┄'.repeat(22), 'dim', color)
784
- let counts = [paint('children unknown', 'dim', color)]
785
687
  if (children.known) {
786
688
  const cells = integrationBarCells(children.landed, children.building, children.queued)
787
689
  bar =
788
690
  paint('━'.repeat(cells[0]!), 'green', color) +
789
691
  paint('━'.repeat(cells[1]!), 'cyan', color) +
790
692
  paint('─'.repeat(children.total ? cells[2]! : 22), 'dim', color)
791
- counts = children.total
792
- ? [
793
- paint(mergedChildren(children.landed, children.total), 'green', color),
794
- ...(children.building ? [paint(`· ${children.building} building`, 'cyan', color)] : []),
795
- ...(children.queued ? [paint(`· ${children.queued} queued`, 'dim', color)] : []),
796
- ]
797
- : [paint('no children yet', 'dim', color)]
798
693
  }
694
+ // The separator rides inside each later count's paint.
695
+ const counts = progress.counts.map((count, index) =>
696
+ paint(index === 0 ? count.text : `· ${count.text}`, TONE_COLOR[count.tone], color),
697
+ )
799
698
  return { bar, counts }
800
699
  }
801
700
 
@@ -842,7 +741,7 @@ function detailBody(
842
741
  const field = (label: string, text: string) =>
843
742
  body.push(...wrapDisplay(`${label} ${text}`, width, ' '))
844
743
  field('Integration', detail.destination)
845
- const progress = integrationProgress(build.integrationRow, color)
744
+ const progress = integrationProgress(projectProgress(build.integrationRow), color)
846
745
  body.push(...packLines(['Progress', progress.bar, ...progress.counts], width, ' '))
847
746
  if (build.objectiveRow)
848
747
  body.push(
@@ -1035,7 +934,12 @@ function detailGeometry(
1035
934
  if (view?.kind !== 'detail') return undefined
1036
935
  const build = model.builds.find((candidate) => candidate.slug === view.slug)
1037
936
  if (build === undefined) return undefined
1038
- const layout = detailBody(build, view, { color: false, width, height, now: 0 })
937
+ const layout = detailBody(build, view, {
938
+ color: false,
939
+ width,
940
+ height,
941
+ now: 0,
942
+ })
1039
943
  const topLength =
1040
944
  2 +
1041
945
  (model.standby === undefined ? 0 : 1) +
@@ -1046,7 +950,11 @@ function detailGeometry(
1046
950
  ? dashboardControls(model, false, width, controlsCapacity(height, topLength))
1047
951
  : [buildLegend(build, true)]
1048
952
  const capacity = Math.max(0, height - topLength - 2 - controls.length)
1049
- return { ...layout, capacity, limit: Math.max(0, layout.body.length - capacity) }
953
+ return {
954
+ ...layout,
955
+ capacity,
956
+ limit: Math.max(0, layout.body.length - capacity),
957
+ }
1050
958
  }
1051
959
 
1052
960
  export function detailScrollLimit(model: DashboardModel, width: number, height: number): number {
@@ -1097,7 +1005,7 @@ function renderDetail(model: DashboardModel, opts: RenderOpts): string[] {
1097
1005
  const top = [
1098
1006
  truncate(`${paint('Build', 'bold', color)} ${displayText(build.slug)}`, width),
1099
1007
  truncate(
1100
- ` status ${paint(build.status.toUpperCase(), STATUS_COLOR[build.status], color)}${paused}${draining}`,
1008
+ ` status ${paint(statusText(build.status).word, TONE_COLOR[statusText(build.status).tone], color)}${paused}${draining}`,
1101
1009
  width,
1102
1010
  ),
1103
1011
  ...standbyLine(model, color, width),
@@ -1406,7 +1314,10 @@ export function resumeKeysRows(width: number): string[] {
1406
1314
  width,
1407
1315
  )
1408
1316
  const short = layoutBindings(
1409
- RESUME_BINDINGS.map((b) => ({ key: b.keyShort ?? b.key, action: b.action })),
1317
+ RESUME_BINDINGS.map((b) => ({
1318
+ key: b.keyShort ?? b.key,
1319
+ action: b.action,
1320
+ })),
1410
1321
  width,
1411
1322
  )
1412
1323
  // Fewer rows wins; a tie goes to the long form, so `Shift+Enter` is named
@@ -1685,22 +1596,14 @@ function renderDashboardContent(model: DashboardModel, opts: RenderOpts): string
1685
1596
  const selecting = model.selection !== undefined
1686
1597
  const globalSelection = { kind: 'global' } as const
1687
1598
  const marker = selectionMarker(sameSelection(globalSelection, model.selection), selecting, color)
1688
- const intake = model.drained
1689
- ? paint('intake OFF', 'yellow', color)
1690
- : paint('intake ON', 'green', color)
1691
- const harvestGate = model.harvestPaused
1692
- ? paint('harvest OFF', 'yellow', color)
1693
- : paint('harvest ON', 'green', color)
1694
- const repositoryPause = model.repositoryPaused
1695
- ? paint('repository PAUSED', 'yellow', color)
1696
- : undefined
1599
+ const header = projectHeaderText(model)
1697
1600
  const summary = truncate(
1698
1601
  `${marker}${[
1699
1602
  paint('Autobuild', 'bold', color),
1700
1603
  displayText(basename(model.repo)),
1701
1604
  paint(
1702
- `triage ${model.triage ?? '–'} | queue ${model.queued} | ` +
1703
- `active ${activeCounterText(model)}${model.configuration === 'no-dispatcher-run' ? '' : capacityExplanation(model.capacity)}`,
1605
+ header.counts.map((count) => `${count.label} ${count.value}`).join(' | ') +
1606
+ (header.capacityNote !== undefined ? ` ${header.capacityNote}` : ''),
1704
1607
  'dim',
1705
1608
  color,
1706
1609
  ),
@@ -1711,8 +1614,8 @@ function renderDashboardContent(model: DashboardModel, opts: RenderOpts): string
1711
1614
  // marker prefix aligns the first toggle with the title while keeping the
1712
1615
  // selection lane empty.
1713
1616
  const toggles = truncate(
1714
- ` ${[intake, harvestGate, repositoryPause]
1715
- .filter((token): token is string => token !== undefined)
1617
+ ` ${header.gates
1618
+ .map((gate) => paint(`${gate.label} ${gate.word}`, TONE_COLOR[gate.tone], color))
1716
1619
  .join(' ')}`,
1717
1620
  width,
1718
1621
  )
@@ -1929,11 +1832,7 @@ export function renderViewerNotice(
1929
1832
  }
1930
1833
 
1931
1834
  export function viewerIndicator(viewer: { dispatchedBy?: string }, width: number): string {
1932
- const label =
1933
- viewer.dispatchedBy === undefined
1934
- ? 'viewer'
1935
- : `viewer · dispatched by ${displayText(viewer.dispatchedBy)}`
1936
- return width >= 6 && width < 9 ? 'viewer' : truncate(label, width)
1835
+ return width >= 6 && width < 9 ? 'viewer' : truncate(viewerLabel(viewer), width)
1937
1836
  }
1938
1837
 
1939
1838
  export function renderDashboard(model: DashboardModel, opts: RenderOpts): string[] {