@defrex/autobuild 0.14.0 → 1.0.0-beta.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 (172) hide show
  1. package/README.md +4 -2
  2. package/SPEC.md +654 -98
  3. package/docs/architecture.md +226 -5
  4. package/docs/assets/headline-wide.png +0 -0
  5. package/docs/configuration.md +112 -12
  6. package/docs/hosted-service.md +18 -0
  7. package/docs/integration-tree.md +117 -0
  8. package/docs/landing-policy.md +150 -0
  9. package/docs/mcp.md +24 -0
  10. package/docs/migration-1.0.md +68 -0
  11. package/docs/operator-api.md +19 -8
  12. package/docs/remote-store-protocol.md +30 -7
  13. package/docs/remote-ticket-protocol.md +26 -5
  14. package/docs/restacking.md +79 -0
  15. package/docs/setup.md +49 -6
  16. package/docs/ticket-dependencies.md +69 -0
  17. package/docs/ticket-migration.md +8 -0
  18. package/package.json +3 -3
  19. package/packages/core/src/cli/attention.ts +25 -2
  20. package/packages/core/src/cli/build-control.ts +65 -41
  21. package/packages/core/src/cli/context.ts +54 -2
  22. package/packages/core/src/cli/dashboard/actions.ts +6 -3
  23. package/packages/core/src/cli/dashboard/landing-display.ts +6 -0
  24. package/packages/core/src/cli/dashboard/live.ts +5 -0
  25. package/packages/core/src/cli/dashboard/model.ts +142 -18
  26. package/packages/core/src/cli/dashboard/poll.ts +15 -9
  27. package/packages/core/src/cli/dashboard/refresh.ts +176 -0
  28. package/packages/core/src/cli/dashboard/render.ts +78 -28
  29. package/packages/core/src/cli/dashboard/repository-poll.ts +57 -0
  30. package/packages/core/src/cli/dashboard/selection.ts +7 -1
  31. package/packages/core/src/cli/dashboard/tree.ts +107 -0
  32. package/packages/core/src/cli/dispatch-frontend.ts +156 -109
  33. package/packages/core/src/cli/dispatch.ts +250 -136
  34. package/packages/core/src/cli/dispatcher-liveness.ts +15 -2
  35. package/packages/core/src/cli/help.ts +49 -32
  36. package/packages/core/src/cli/init-validation.ts +43 -2
  37. package/packages/core/src/cli/keyboard.ts +6 -0
  38. package/packages/core/src/cli/landings.ts +18 -0
  39. package/packages/core/src/cli/main.ts +49 -15
  40. package/packages/core/src/cli/mcp.ts +9 -0
  41. package/packages/core/src/cli/publication-settlement.ts +168 -2
  42. package/packages/core/src/cli/repository-status.ts +11 -0
  43. package/packages/core/src/cli/status.ts +72 -5
  44. package/packages/core/src/cli/terminal-restore.ts +54 -0
  45. package/packages/core/src/cli/terminal.ts +16 -2
  46. package/packages/core/src/cli/terminals.ts +98 -79
  47. package/packages/core/src/cli/ticket-editor.ts +10 -3
  48. package/packages/core/src/cli/ticket.ts +113 -18
  49. package/packages/core/src/cli/upgrade-commit.ts +4 -0
  50. package/packages/core/src/cli/upgrade-compatibility.ts +2 -2
  51. package/packages/core/src/cli/upgrade-landing.ts +69 -0
  52. package/packages/core/src/cli/upgrade.ts +16 -0
  53. package/packages/core/src/cli/wait.ts +115 -19
  54. package/packages/core/src/cli/watch.ts +51 -12
  55. package/packages/core/src/config/landing.ts +22 -0
  56. package/packages/core/src/config/live.ts +1 -0
  57. package/packages/core/src/config/schema.ts +3 -0
  58. package/packages/core/src/events/catalog.ts +48 -3
  59. package/packages/core/src/events/payloads.ts +295 -6
  60. package/packages/core/src/events/repository.ts +31 -0
  61. package/packages/core/src/integration/harness.ts +10 -0
  62. package/packages/core/src/kernel/__snapshots__/reducer-registry.test.ts.snap +1030 -239
  63. package/packages/core/src/kernel/auto-merge-default.ts +1 -0
  64. package/packages/core/src/kernel/auto-merge.ts +12 -3
  65. package/packages/core/src/kernel/build-identity.ts +94 -0
  66. package/packages/core/src/kernel/change-presence.ts +179 -0
  67. package/packages/core/src/kernel/dispatch-status.ts +17 -1
  68. package/packages/core/src/kernel/engine.ts +89 -2
  69. package/packages/core/src/kernel/generators/build-log.ts +23 -0
  70. package/packages/core/src/kernel/generators/leaf-restack-log.ts +110 -0
  71. package/packages/core/src/kernel/generators/node-restack-log.ts +94 -0
  72. package/packages/core/src/kernel/generators/repository-journals.ts +11 -0
  73. package/packages/core/src/kernel/integration-completeness.ts +81 -0
  74. package/packages/core/src/kernel/integration-landing.ts +263 -0
  75. package/packages/core/src/kernel/integration-stack.ts +36 -0
  76. package/packages/core/src/kernel/integration-state.ts +135 -0
  77. package/packages/core/src/kernel/landing-policy.ts +47 -0
  78. package/packages/core/src/kernel/landing-publication.ts +41 -0
  79. package/packages/core/src/kernel/landing-readiness.ts +67 -0
  80. package/packages/core/src/kernel/landing-state.ts +96 -0
  81. package/packages/core/src/kernel/leaf-restack-completion.ts +24 -0
  82. package/packages/core/src/kernel/leaf-restack-state.ts +73 -0
  83. package/packages/core/src/kernel/log-index.ts +35 -5
  84. package/packages/core/src/kernel/node-landing.ts +439 -0
  85. package/packages/core/src/kernel/node-parent.ts +184 -0
  86. package/packages/core/src/kernel/node-restack-state.ts +191 -0
  87. package/packages/core/src/kernel/node-restack-transaction.ts +210 -0
  88. package/packages/core/src/kernel/node-restack.ts +274 -0
  89. package/packages/core/src/kernel/read-facts.ts +70 -3
  90. package/packages/core/src/kernel/reconcile-head.ts +51 -0
  91. package/packages/core/src/kernel/reconcile-restack.ts +560 -0
  92. package/packages/core/src/kernel/reducer-registry.ts +16 -0
  93. package/packages/core/src/kernel/reducer.ts +121 -6
  94. package/packages/core/src/kernel/snapshot-parent.ts +33 -0
  95. package/packages/core/src/ontology.ts +9 -1
  96. package/packages/core/src/operator/annotations.ts +12 -0
  97. package/packages/core/src/operator/control.ts +6 -0
  98. package/packages/core/src/operator/index.ts +4 -0
  99. package/packages/core/src/operator/landings.ts +35 -0
  100. package/packages/core/src/operator/presentation.ts +1 -0
  101. package/packages/core/src/operator/protocol.ts +12 -3
  102. package/packages/core/src/operator/query.ts +3 -1
  103. package/packages/core/src/operator/registry.ts +48 -19
  104. package/packages/core/src/operator/requests.ts +1 -8
  105. package/packages/core/src/operator/tickets.ts +55 -9
  106. package/packages/core/src/ports/forge/contract.ts +91 -3
  107. package/packages/core/src/ports/forge/fake.ts +142 -4
  108. package/packages/core/src/ports/forge/git-rewrite.ts +232 -0
  109. package/packages/core/src/ports/forge/github-readiness.ts +421 -0
  110. package/packages/core/src/ports/forge/github.ts +631 -35
  111. package/packages/core/src/ports/forge/local-git.ts +119 -5
  112. package/packages/core/src/ports/forge/readiness.ts +99 -0
  113. package/packages/core/src/ports/tickets/contract.ts +41 -0
  114. package/packages/core/src/ports/tickets/create.ts +8 -1
  115. package/packages/core/src/ports/tickets/fake.ts +32 -1
  116. package/packages/core/src/ports/tickets/file-codec.ts +7 -0
  117. package/packages/core/src/ports/tickets/file.ts +18 -1
  118. package/packages/core/src/ports/tickets/hosted-index.ts +2 -0
  119. package/packages/core/src/ports/tickets/linear.ts +124 -4
  120. package/packages/core/src/ports/tickets/migration.ts +25 -1
  121. package/packages/core/src/ports/tickets/operations.ts +7 -2
  122. package/packages/core/src/ports/tickets/remote-protocol.ts +19 -0
  123. package/packages/core/src/ports/tickets/remote.ts +10 -1
  124. package/packages/core/src/ports/tickets/revision.ts +3 -1
  125. package/packages/core/src/ports/tickets/tree.ts +148 -0
  126. package/packages/core/src/ports/tickets/update.ts +15 -2
  127. package/packages/core/src/ports/types.ts +135 -5
  128. package/packages/core/src/ports/workspace/git-worktree.ts +2 -1
  129. package/packages/core/src/ports/workspace/provider-capabilities.ts +1 -1
  130. package/packages/core/src/ports/workspace/vercel-sandbox.ts +60 -3
  131. package/packages/core/src/processes/build-runner.ts +530 -23
  132. package/packages/core/src/processes/dispatcher-selectors.ts +15 -9
  133. package/packages/core/src/processes/dispatcher.ts +2145 -203
  134. package/packages/core/src/processes/execution-no-progress.ts +46 -1
  135. package/packages/core/src/processes/publication-state.ts +30 -5
  136. package/packages/core/src/processes/repo-view.ts +21 -2
  137. package/packages/core/src/store/build-scope.ts +18 -0
  138. package/packages/core/src/store/contract.ts +658 -0
  139. package/packages/core/src/store/digest.ts +52 -4
  140. package/packages/core/src/store/local/schema.ts +25 -13
  141. package/packages/core/src/store/local/store.ts +117 -1
  142. package/packages/core/src/store/memory.ts +62 -1
  143. package/packages/core/src/store/phase-session.ts +17 -0
  144. package/packages/core/src/store/reduced-reads.ts +2 -1
  145. package/packages/core/src/store/reducer-value-shapes.json +10707 -6440
  146. package/packages/core/src/store/remote/client.ts +44 -0
  147. package/packages/core/src/store/remote/compatibility.ts +19 -9
  148. package/packages/core/src/store/remote/protocol.ts +11 -0
  149. package/packages/core/src/store/repo-state-events.ts +2 -0
  150. package/packages/core/src/store/session-handle.ts +15 -0
  151. package/packages/core/src/store/subscribe.ts +1 -1
  152. package/packages/core/src/store/types.ts +32 -4
  153. package/packages/core/src/testing/index.ts +2 -0
  154. package/packages/core/src/testing/reduced-read-budget.ts +48 -8
  155. package/packages/core/src/testing/refresh-scheduler.ts +32 -0
  156. package/skills/guide/SKILL.md +110 -61
  157. package/skills/guide/references/integration-tree.md +117 -0
  158. package/skills/guide/references/landing-policy.md +150 -0
  159. package/skills/guide/references/migration-1.0.md +68 -0
  160. package/skills/guide/references/operator-api.md +12 -5
  161. package/skills/guide/references/plugin-authoring.md +34 -0
  162. package/skills/guide/references/remote-store-protocol.md +30 -7
  163. package/skills/guide/references/remote-ticket-protocol.md +26 -5
  164. package/skills/guide/references/restacking.md +79 -0
  165. package/skills/guide/references/setup.md +49 -6
  166. package/skills/guide/references/ticket-dependencies.md +69 -0
  167. package/skills/guide/references/ticket-migration.md +8 -0
  168. package/skills/operate/SKILL.md +55 -5
  169. package/skills/reconcile/SKILL.md +55 -48
  170. package/skills/spec/SKILL.md +67 -1
  171. package/skills/tickets/SKILL.md +55 -2
  172. package/templates/autobuild.toml +3 -0
@@ -1,3 +1,13 @@
1
+ import { openTicketSource } from './ticket'
2
+ import {
3
+ inspectForgeReadiness,
4
+ formatForgeReadiness,
5
+ hardReadinessKeys,
6
+ } from '../ports/forge/readiness'
7
+ import { createReadinessRedactor } from './init-readiness-shared'
8
+ import { RepositoryPollCache } from './dashboard/repository-poll'
9
+ import { DashboardRefresh, interactionRead, presentationReader } from './dashboard/refresh'
10
+ import { FOCUS_REPORTING_MODE, installPresentationSuspension } from './terminal-restore'
1
11
  import type { BuildState } from '../kernel/reducer'
2
12
  import {
3
13
  readBuildFacts,
@@ -137,6 +147,7 @@ import { HarvestRunner, type HarvestRunnerResult } from '../processes/harvest-ru
137
147
  import {
138
148
  sampleUnclaimedObservationCount,
139
149
  evaluateHarvestPressureFromStore,
150
+ evaluateHarvestPressureFromDigests,
140
151
  } from '../processes/harvest'
141
152
  import { classifyHarvestOutcome } from '../processes/harvest-execution-state'
142
153
  import type { HarvestExecution } from '../ports/workspace/harvest-execution'
@@ -221,15 +232,6 @@ function definedEnv(env: Record<string, string | undefined>): Record<string, str
221
232
  return defined
222
233
  }
223
234
 
224
- /** Dashboard store-read cadence. `listBuilds` remains the discovery read;
225
- * the process-local display cache then polls dashboard-visible streams with
226
- * `getEvents(lastSeq)`, retaining abort cleanup until final completion and reusing unchanged
227
- * reductions/timing projections. Repository controls and Harvest are still
228
- * read fresh through the bounded journal read (AUT-489 subset; AUT-545). The
229
- * identical-frame check in `live.ts` makes an unchanged paint cost zero
230
- * terminal writes. */
231
- const DASHBOARD_POLL_MS = 500
232
-
233
235
  /** Dashboard repaint (not re-read) cadence in watch mode. A running step's
234
236
  * elapsed must advance ~1×/s even if the store poll is raised for a slow remote
235
237
  * store, so paint is decoupled from the store read and driven from this cheaper
@@ -245,6 +247,7 @@ type DashboardAction =
245
247
  | 'left'
246
248
  | 'right'
247
249
  | 'enter'
250
+ | 'hold'
248
251
  | 'auto-merge'
249
252
  | 'intake'
250
253
  | 'pause'
@@ -674,15 +677,9 @@ class DispatchLoop {
674
677
  private readonly region: LiveRegion | undefined
675
678
  /** One display-only incremental build cache for this dispatch process. */
676
679
  private readonly dashboardBuilds: DashboardBuildPollCache
677
- /** Guard against overlapping timer polls, exactly as pollingSubscribe does. */
678
- private rendering = false
679
- /** The full, warning-handled timer poll. Teardown joins this exact promise
680
- * before selecting the final frame. */
681
- private renderInFlight: Promise<void> | undefined
682
- /** Cleared at the rendering stop boundary so an already-queued timer callback
683
- * cannot open a new store read after teardown begins. */
684
- private acceptingRenderPolls = false
685
- private timer: ReturnType<typeof setInterval> | undefined
680
+ private refresh: DashboardRefresh | undefined
681
+ private suspension: ReturnType<typeof installPresentationSuspension> | undefined
682
+ private readonly presentationStore: BuildStore
686
683
  /** Watch-mode paint timer (AC 8): repaints the CACHED model against a fresh
687
684
  * clock so running elapsed ticks between store reads. Absent in `--once`. */
688
685
  private tickTimer: ReturnType<typeof setInterval> | undefined
@@ -710,6 +707,10 @@ class DispatchLoop {
710
707
  * process. Rendered ABOVE the transient warning line and never overwritten by
711
708
  * it: `setWarning` replaces the transient slot outright, so sharing it would
712
709
  * let the first tick's janitor notice erase a startup diagnostic for good. */
710
+ private forgeWarnings: string[] = []
711
+ private forgeInspected = false
712
+ private forgePublicationFailed = false
713
+ private readonly startupRootBranch: string
713
714
  private configWarnings: readonly string[] = []
714
715
  /** Last intake-enabled tick's standing queue depth, for the dashboard header. */
715
716
  private queuedCount = 0
@@ -732,6 +733,7 @@ class DispatchLoop {
732
733
  * id while it holds the repo lease, else undefined. A losing invocation
733
734
  * records `dispatcher.tick-yielded` and performs no claims, launches, or
734
735
  * publications. */
736
+ private repoLeaseValidUntil = 0
735
737
  private repoLeaseHolder: string | undefined
736
738
  private repoLeaseHeartbeat: ReturnType<typeof setInterval> | undefined
737
739
  /** Set when the store reports this supervisor's repo lease was taken over:
@@ -771,6 +773,7 @@ class DispatchLoop {
771
773
  view?: RepoViewStore,
772
774
  ) {
773
775
  const config = liveConfig.current().config
776
+ this.startupRootBranch = config.baseBranch
774
777
  // Minted exactly once per invocation: `wiring.ids` is `randomIds()` and a
775
778
  // fresh id per access would split the journal run from the lease holder.
776
779
  // abDispatch always passes `runId`, so the fallback only covers direct
@@ -785,7 +788,15 @@ class DispatchLoop {
785
788
  this.dashboard && opts.terminal !== undefined
786
789
  ? new LiveRegion(opts.terminal, this.keyboard)
787
790
  : undefined
788
- this.dashboardBuilds = new DashboardBuildPollCache(wiring.store, this.repoIdentity, config)
791
+ this.presentationStore = presentationReader(
792
+ wiring.store,
793
+ () => this.opts.once === true || (this.refresh?.admitted ?? true),
794
+ )
795
+ this.dashboardBuilds = new DashboardBuildPollCache(
796
+ this.presentationStore,
797
+ this.repoIdentity,
798
+ config,
799
+ )
789
800
 
790
801
  // `slug` is an internal pre-build role on the same runtime/model resolver. A
791
802
  // runtime without the optional capability is normal: omit the seam and let
@@ -1122,13 +1133,14 @@ class DispatchLoop {
1122
1133
  // Refresh before every watch decision. The owner publishes atomically;
1123
1134
  // everything below captures the resulting one snapshot for this tick.
1124
1135
  await this.refreshConfig()
1125
- // Every tick first tries the repository supervisor lease. Without it,
1136
+ // Every tick verifies local lease currency, reclaiming when necessary. Without it,
1126
1137
  // this invocation records the yield and performs no claims, launches,
1127
1138
  // or publications — including no tick-completed status publication.
1128
1139
  if (!(await this.ensureRepoLease(this.repoLeaseHolder ?? this.runId))) {
1129
1140
  await this.recordTickYielded()
1130
1141
  return emptyTickReport()
1131
1142
  }
1143
+ await this.reportForgeReadiness()
1132
1144
  const startedAt = await this.repoView.beginRepoTick(this.repoIdentity, this.runId)
1133
1145
  if (startedAt === null) {
1134
1146
  this.superseded = true
@@ -1161,7 +1173,7 @@ class DispatchLoop {
1161
1173
  const readyObservation =
1162
1174
  settings.intake || (!this.dashboard && this.opts.kernelRunId === undefined)
1163
1175
  ? undefined
1164
- : await this.dispatcher.observeReady()
1176
+ : await this.dispatcher.observeReady({ viewRefreshed: true })
1165
1177
  const report = await this.dispatcher.tick({
1166
1178
  resumeCurrent,
1167
1179
  viewRefreshed: true,
@@ -1213,6 +1225,7 @@ class DispatchLoop {
1213
1225
  // no dependence on emission order relative to `startRendering()`.
1214
1226
  const warningLines = [
1215
1227
  ...this.configWarnings,
1228
+ ...this.forgeWarnings,
1216
1229
  ...(this.warningLine !== undefined ? [this.warningLine] : []),
1217
1230
  ]
1218
1231
  let effective: DashboardModel = {
@@ -1321,6 +1334,7 @@ class DispatchLoop {
1321
1334
  * last read failed). The apply goes through the serialize queue under the
1322
1335
  * feed's identity+cursor fence, mirroring the transcript read's pattern. */
1323
1336
  private pollSessionFeed(): void {
1337
+ if (this.refresh !== undefined && !this.refresh.admitted) return
1324
1338
  const view = this.view
1325
1339
  if (view?.kind !== 'session') return
1326
1340
  if (view.status !== 'open' && view.error === undefined) {
@@ -1491,6 +1505,7 @@ class DispatchLoop {
1491
1505
  try {
1492
1506
  result = await controlBuild({
1493
1507
  store: this.wiring.store,
1508
+ ticketSource: async () => this.wiring.tickets,
1494
1509
  repo: this.repoIdentity,
1495
1510
  slug,
1496
1511
  env: this.opts.env,
@@ -1520,6 +1535,7 @@ class DispatchLoop {
1520
1535
  try {
1521
1536
  result = await controlBuild({
1522
1537
  store: this.wiring.store,
1538
+ ticketSource: async () => this.wiring.tickets,
1523
1539
  repo: this.repoIdentity,
1524
1540
  slug,
1525
1541
  env: this.opts.env,
@@ -1556,6 +1572,7 @@ class DispatchLoop {
1556
1572
  try {
1557
1573
  const result = await controlBuild({
1558
1574
  store: this.wiring.store,
1575
+ ticketSource: async () => this.wiring.tickets,
1559
1576
  repo: this.repoIdentity,
1560
1577
  slug: confirmation.slug,
1561
1578
  env: this.opts.env,
@@ -1578,6 +1595,7 @@ class DispatchLoop {
1578
1595
  try {
1579
1596
  const result = await controlBuild({
1580
1597
  store: this.wiring.store,
1598
+ ticketSource: async () => this.wiring.tickets,
1581
1599
  repo: this.repoIdentity,
1582
1600
  slug,
1583
1601
  env: this.opts.env,
@@ -1676,6 +1694,7 @@ class DispatchLoop {
1676
1694
  try {
1677
1695
  result = await controlBuild({
1678
1696
  store: this.wiring.store,
1697
+ ticketSource: async () => this.wiring.tickets,
1679
1698
  repo: this.repoIdentity,
1680
1699
  slug: prompt.slug,
1681
1700
  env: this.opts.env,
@@ -1705,19 +1724,7 @@ class DispatchLoop {
1705
1724
  await this.renderOnce()
1706
1725
  }
1707
1726
 
1708
- private async toggleAutoMerge(): Promise<void> {
1709
- if (this.view === undefined && this.selection?.kind === 'global') {
1710
- const event = await toggleRepositorySetting({
1711
- store: this.wiring.store,
1712
- repo: this.repoIdentity,
1713
- user: buildControlUser(this.opts.env),
1714
- setting: 'auto-merge-default',
1715
- run: this.runId,
1716
- })
1717
- this.say(`dispatcher auto-merge default ${event.enabled ? 'ON' : 'OFF'}`)
1718
- await this.renderOnce()
1719
- return
1720
- }
1727
+ private async toggleAutoMerge(kind: 'hold' | 'land' = 'land'): Promise<void> {
1721
1728
  const slug = this.selectedBuildSlug('auto-merge')
1722
1729
  if (slug === undefined) return
1723
1730
 
@@ -1725,24 +1732,22 @@ class DispatchLoop {
1725
1732
  try {
1726
1733
  result = await controlBuild({
1727
1734
  store: this.wiring.store,
1735
+ ticketSource: async () => this.wiring.tickets,
1728
1736
  repo: this.repoIdentity,
1729
1737
  slug,
1730
1738
  env: this.opts.env,
1731
- action: { kind: 'toggle-auto-merge' },
1739
+ action: { kind },
1732
1740
  })
1733
1741
  } catch (error) {
1734
1742
  if (await this.ignoreControlError('action', error)) return
1735
1743
  throw error
1736
1744
  }
1737
- if (
1738
- result.kind !== 'command' ||
1739
- (result.command !== 'auto-merge-on' && result.command !== 'auto-merge-off')
1740
- ) {
1745
+ if (result.kind !== 'command' || (result.command !== 'land' && result.command !== 'hold')) {
1741
1746
  throw new Error('build-control returned an invalid auto-merge toggle result')
1742
1747
  }
1743
1748
  this.say(
1744
- `build ${slug}: auto-merge ${
1745
- result.command === 'auto-merge-off' ? 'cancelled' : 'requested'
1749
+ `build ${slug}: landing ${
1750
+ result.command === 'hold' ? 'hold requested' : 'consent requested'
1746
1751
  }`,
1747
1752
  )
1748
1753
  await this.renderOnce()
@@ -1844,7 +1849,7 @@ class DispatchLoop {
1844
1849
  follow: true,
1845
1850
  scroll: 0,
1846
1851
  }
1847
- this.sessionFeed = new SessionStreamFeed(this.wiring.store, captured.slug)
1852
+ this.sessionFeed = new SessionStreamFeed(this.presentationStore, captured.slug)
1848
1853
  this.syncModelControls()
1849
1854
  this.paint()
1850
1855
  // Kick the first read immediately rather than waiting one interval.
@@ -1980,6 +1985,9 @@ class DispatchLoop {
1980
1985
  case 'bulk-resume':
1981
1986
  await this.bulkControl('resume')
1982
1987
  return
1988
+ case 'hold':
1989
+ await this.toggleAutoMerge('hold')
1990
+ return
1983
1991
  case 'auto-merge':
1984
1992
  await this.toggleAutoMerge()
1985
1993
  return
@@ -1996,12 +2004,14 @@ class DispatchLoop {
1996
2004
  }
1997
2005
 
1998
2006
  private queueAction(action: DashboardAction): void {
1999
- void this.serialize(() => this.handleAction(action)).catch((error: unknown) => {
2000
- const name = typeof action === 'string' ? action : action.kind
2001
- this.warn(
2002
- `dashboard ${name} action failed: ${error instanceof Error ? error.message : String(error)}`,
2003
- )
2004
- })
2007
+ void this.serialize(() => interactionRead(() => this.handleAction(action))).catch(
2008
+ (error: unknown) => {
2009
+ const name = typeof action === 'string' ? action : action.kind
2010
+ this.warn(
2011
+ `dashboard ${name} action failed: ${error instanceof Error ? error.message : String(error)}`,
2012
+ )
2013
+ },
2014
+ )
2005
2015
  }
2006
2016
 
2007
2017
  /** Modal edits are synchronous and never enter the dispatcher operation
@@ -2048,7 +2058,7 @@ class DispatchLoop {
2048
2058
  return
2049
2059
  case 'enter':
2050
2060
  this.resumeSubmitting = true
2051
- void this.serialize(() => this.submitResume(prompt))
2061
+ void this.serialize(() => interactionRead(() => this.submitResume(prompt)))
2052
2062
  .catch((error: unknown) => {
2053
2063
  this.warn(
2054
2064
  `dashboard resume action failed: ${
@@ -2068,6 +2078,7 @@ class DispatchLoop {
2068
2078
  }
2069
2079
 
2070
2080
  private onInput(input: TerminalInputEvent): void {
2081
+ this.refresh?.interaction()
2071
2082
  if (!this.acceptingKeys) return
2072
2083
  if (input.type === 'interrupt') {
2073
2084
  this.acceptingKeys = false
@@ -2126,7 +2137,10 @@ class DispatchLoop {
2126
2137
  // directional motions were routed above.
2127
2138
  if (input.type !== 'text') return
2128
2139
  switch (input.text.toLowerCase()) {
2129
- case 'm':
2140
+ case 'o':
2141
+ this.queueAction('hold')
2142
+ return
2143
+ case 'l':
2130
2144
  // Defense in depth: the session-view gate above already returns for a
2131
2145
  // session view, and the transcript guard below predates it.
2132
2146
  if (this.view?.kind !== 'transcript') {
@@ -2197,6 +2211,11 @@ class DispatchLoop {
2197
2211
  onListening: () => this.keyboard?.query(),
2198
2212
  onKeyboardFlags: (flags) => this.keyboard?.reported(flags),
2199
2213
  onDeviceAttributes: () => this.keyboard?.deviceAttributes(),
2214
+ onFocus: (focused) => {
2215
+ if (this.opts.once !== true) this.refresh?.focus(focused)
2216
+ },
2217
+ onInteraction: () => this.refresh?.interaction(),
2218
+ onSuspend: () => this.suspension?.suspend(),
2200
2219
  })
2201
2220
  }
2202
2221
 
@@ -2222,18 +2241,46 @@ class DispatchLoop {
2222
2241
  // dispatch process is independently excluded by the repository lease.
2223
2242
  if (this.harvestInFlight !== undefined) return
2224
2243
 
2244
+ let tracked: Promise<void>
2245
+ tracked = this.launchHarvestIfNeeded()
2246
+ .catch((error: unknown) => {
2247
+ // The gate may read the backing store after tick work dirties the view.
2248
+ // Contain that failure too, without relying on another store write.
2249
+ if (!this.stopped) {
2250
+ this.warn(
2251
+ `harvest launch failed: ${error instanceof Error ? error.message : String(error)}`,
2252
+ )
2253
+ }
2254
+ })
2255
+ .finally(() => {
2256
+ this.inFlight.delete(tracked)
2257
+ if (this.harvestInFlight === tracked) this.harvestInFlight = undefined
2258
+ })
2259
+ this.harvestInFlight = tracked
2260
+ this.inFlight.add(tracked)
2261
+ }
2262
+
2263
+ private async launchHarvestIfNeeded(): Promise<void> {
2264
+ const state = this.repoView.repositoryFacts().harvest
2265
+ const control = decideHarvestControl(state, this.maxHarvestRecoveryAttempts)
2266
+ if (control.kind === 'park') return
2267
+ if (control.kind === 'proceed' && actionableHarvestRun(state) === undefined) {
2268
+ const pressure = evaluateHarvestPressureFromDigests({
2269
+ digests: await this.repoView.getRepoBuildDigests(this.repoIdentity),
2270
+ harvestEvents: state,
2271
+ policy: this.currentConfig().config.policy,
2272
+ })
2273
+ if (pressure.trigger === undefined) return
2274
+ }
2225
2275
  const hosted = this.wiring.workspaces.harvestExecution
2226
2276
  if (hosted !== undefined) {
2227
2277
  const execution = `${this.host}-harvest-${this.wiring.ids('inst')}`
2228
2278
  this.hostedHarvestExecutions.add(execution)
2229
- let tracked: Promise<void>
2230
- tracked = this.launchHostedHarvest(hosted, execution).finally(() => {
2279
+ try {
2280
+ await this.launchHostedHarvest(hosted, execution)
2281
+ } finally {
2231
2282
  this.hostedHarvestExecutions.delete(execution)
2232
- this.inFlight.delete(tracked)
2233
- if (this.harvestInFlight === tracked) this.harvestInFlight = undefined
2234
- })
2235
- this.harvestInFlight = tracked
2236
- this.inFlight.add(tracked)
2283
+ }
2237
2284
  return
2238
2285
  }
2239
2286
 
@@ -2259,8 +2306,7 @@ class DispatchLoop {
2259
2306
  },
2260
2307
  }
2261
2308
 
2262
- let tracked: Promise<void>
2263
- tracked = (async () => {
2309
+ await (async () => {
2264
2310
  const ticketUrl =
2265
2311
  harvestDeps.config.tickets.source === 'hosted'
2266
2312
  ? (harvestDeps.config.tickets.url ?? (/^https?:/i.test(storeRef) ? storeRef : undefined))
@@ -2451,12 +2497,6 @@ class DispatchLoop {
2451
2497
  )
2452
2498
  }
2453
2499
  })
2454
- .finally(() => {
2455
- this.inFlight.delete(tracked)
2456
- if (this.harvestInFlight === tracked) this.harvestInFlight = undefined
2457
- })
2458
- this.harvestInFlight = tracked
2459
- this.inFlight.add(tracked)
2460
2500
  }
2461
2501
 
2462
2502
  /** Hosted harvest lifecycle: threshold gate → provision + launch in the
@@ -3408,6 +3448,49 @@ class DispatchLoop {
3408
3448
  * stderr writes each one, the dashboard wraps them into its warning region.
3409
3449
  * No surface gets a digest, a cap, or a truncated tail.
3410
3450
  */
3451
+ private async reportForgeReadiness(): Promise<void> {
3452
+ if (this.forgeInspected) return
3453
+ const checks = await inspectForgeReadiness(this.wiring.forge, {
3454
+ rootBranch: this.startupRootBranch,
3455
+ })
3456
+ const redact = createReadinessRedactor(this.opts.env)
3457
+ const status = this.repoView.repositoryFacts().status
3458
+ const recorded = new Set(
3459
+ status?.run === this.runId
3460
+ ? status.forgeReadinessFailures?.map((failure) => failure.check)
3461
+ : [],
3462
+ )
3463
+ for (const check of checks) {
3464
+ if (check.status === 'fail' && check.requirement === 'hard') {
3465
+ const key = hardReadinessKeys.find((key) => key === check.check)!
3466
+ if (!recorded.has(key)) {
3467
+ this.forgePublicationFailed = true
3468
+ await this.appendStatus({
3469
+ actor: DISPATCHER,
3470
+ type: 'dispatcher.forge-readiness-failed',
3471
+ payload: {
3472
+ run: this.runId,
3473
+ forge: redact(this.currentConfig().config.forge),
3474
+ rootBranch: redact(this.startupRootBranch),
3475
+ check: key,
3476
+ detail: redact(check.detail),
3477
+ remediation: redact(check.remediation),
3478
+ },
3479
+ })
3480
+ this.forgePublicationFailed = false
3481
+ recorded.add(key)
3482
+ }
3483
+ }
3484
+ if (check.status !== 'pass') {
3485
+ const line = redact(formatForgeReadiness(check))
3486
+ this.forgeWarnings.push(line)
3487
+ if (!this.dashboard) this.opts.stderr(line)
3488
+ }
3489
+ }
3490
+ this.forgeInspected = true
3491
+ this.syncModelControls()
3492
+ }
3493
+
3411
3494
  private reportRoleDiagnostics(): void {
3412
3495
  const lines = roleKeyWarnings(this.currentConfig().config)
3413
3496
  if (this.dashboard) {
@@ -3469,26 +3552,53 @@ class DispatchLoop {
3469
3552
  * repaint cached timing against a moving clock without re-reading.
3470
3553
  */
3471
3554
  private async renderOnce(): Promise<void> {
3555
+ if (this.opts.once !== true && this.refresh !== undefined) return this.refresh.request(true)
3556
+ return this.readFrame()
3557
+ }
3558
+
3559
+ private readonly repositoryPoll = new RepositoryPollCache<{
3560
+ buildSnapshot: Awaited<ReturnType<DashboardBuildPollCache['refresh']>>
3561
+ repositoryEvents: Awaited<ReturnType<typeof readRepositoryFacts>>['value']
3562
+ }>()
3563
+
3564
+ private async readFrame(): Promise<void> {
3565
+ if (this.opts.once !== true && this.refresh !== undefined && !this.refresh.admitted) return
3472
3566
  const { terminal } = this.opts
3473
3567
  if (this.region === undefined || terminal === undefined) return
3474
3568
  const configSnapshot = this.currentConfig()
3475
- const buildSnapshot = await this.dashboardBuilds.refresh(
3476
- configSnapshot.config,
3477
- configSnapshot.revision,
3478
- )
3479
- // Bounded read (AUT-489, AUT-545): every repository consumer of this frame —
3480
- // projectRepositoryHarvest (reduceHarvest plus the harvest-only raw scans in
3481
- // projectHarvestRun/escalationAttentionDismissed) and reduceDispatchSettings —
3482
- // reduces durable types only, so the AUT-489 subset is replay-equivalent with
3483
- // no anchor dependence (anchor analysis recorded; the frontend seed needed one
3484
- // only because reduceDispatchStatus folds here too — it does not here).
3485
- // Missing journal record stays a read-only empty journal (AUT-524).
3486
- const repositoryEvents = (await readRepositoryFacts(this.wiring.store, this.repoIdentity)).value
3569
+ const snapshot = await this.repositoryPoll.refresh({
3570
+ position: () => this.presentationStore.getRepoChangePosition(this.repoIdentity),
3571
+ now: () => this.wiring.clock().getTime(),
3572
+ revision: configSnapshot.revision,
3573
+ enabled: this.opts.once !== true,
3574
+ valid: (frame) => this.dashboardBuilds.isCurrent(frame.buildSnapshot),
3575
+ admitted: () =>
3576
+ this.opts.once === true || this.refresh === undefined || this.refresh.admitted,
3577
+ nextPollMs: this.refresh?.intervalMs ?? 0,
3578
+ read: async ({ fullEnrichment }) => {
3579
+ const buildSnapshot = await this.dashboardBuilds.refresh(
3580
+ configSnapshot.config,
3581
+ configSnapshot.revision,
3582
+ fullEnrichment,
3583
+ )
3584
+ const repositoryEvents = (
3585
+ await readRepositoryFacts(this.presentationStore, this.repoIdentity)
3586
+ ).value
3587
+ return { buildSnapshot, repositoryEvents }
3588
+ },
3589
+ })
3590
+ if (snapshot === undefined) return
3591
+ const { buildSnapshot, repositoryEvents } = snapshot
3487
3592
 
3488
3593
  // Action-triggered and timer refreshes share the cache but may finish their
3489
3594
  // repository reads out of order. Never let an older build snapshot replace
3490
3595
  // one that committed later.
3491
- if (!this.dashboardBuilds.isCurrent(buildSnapshot)) return
3596
+ if (
3597
+ !this.dashboardBuilds.isCurrent(buildSnapshot) ||
3598
+ (this.opts.once !== true && this.refresh !== undefined && !this.refresh.admitted)
3599
+ )
3600
+ return
3601
+ if (this.opts.once !== true) this.refresh?.activity(buildSnapshot.states.size > 0)
3492
3602
 
3493
3603
  // Polling continues while the operator types. Keep the prompt bound to the
3494
3604
  // captured build/escalations, shrink it around externally answered ids, and
@@ -3509,7 +3619,7 @@ class DispatchLoop {
3509
3619
  const state = buildSnapshot.states.get(this.abortConfirmation.slug)
3510
3620
  if (
3511
3621
  state === undefined ||
3512
- !['queued', 'running', 'paused', 'blocked'].includes(state.status) ||
3622
+ !['queued', 'running', 'collecting', 'paused', 'blocked'].includes(state.status) ||
3513
3623
  state.pendingCommands.some((command) => command.command === 'abort')
3514
3624
  ) {
3515
3625
  // Another process may have durably requested the abort while this
@@ -3525,7 +3635,7 @@ class DispatchLoop {
3525
3635
  repo: this.repoIdentity,
3526
3636
  queued: this.queuedCount,
3527
3637
  activeCount: [...buildSnapshot.states.values()].filter(
3528
- (state) => state.status !== 'done' && state.status !== 'aborted',
3638
+ (state) => state.kind !== 'node' && state.status !== 'done' && state.status !== 'aborted',
3529
3639
  ).length,
3530
3640
  capacity: configSnapshot.config.capacity,
3531
3641
  observationCount: this.observationCount,
@@ -3589,6 +3699,7 @@ class DispatchLoop {
3589
3699
  * displayed second is unchanged to zero writes. No store I/O.
3590
3700
  */
3591
3701
  private paint(): void {
3702
+ if (this.refresh !== undefined && !this.refresh.painting) return
3592
3703
  const { terminal } = this.opts
3593
3704
  if (this.region === undefined || terminal === undefined || this.model === undefined) return
3594
3705
  const renderer = this.opts.resolveDashboardRenderer?.() ?? renderDashboard
@@ -3643,63 +3754,47 @@ class DispatchLoop {
3643
3754
  }
3644
3755
 
3645
3756
  private startRendering(): void {
3646
- if (!this.dashboard || this.timer !== undefined) return
3647
- this.acceptingRenderPolls = true
3648
- const tick = (): void => {
3649
- if (!this.acceptingRenderPolls || this.rendering) return // fenced, no overlap
3650
- this.rendering = true
3651
- let handled!: Promise<void>
3652
- handled = this.renderOnce()
3653
- .catch((error: unknown) => {
3654
- // A transient store error must never kill dispatch — the dashboard
3655
- // is a view, and a view that throws is a bug in the view.
3757
+ if (!this.dashboard || this.refresh !== undefined) return
3758
+ this.refresh = new DashboardRefresh(async () => {
3759
+ try {
3760
+ await this.readFrame()
3761
+ } catch (error) {
3762
+ if (this.refresh?.isFocused)
3656
3763
  this.warn(
3657
3764
  `dashboard render failed: ${error instanceof Error ? error.message : String(error)}`,
3658
3765
  )
3659
- })
3660
- .finally(() => {
3661
- // Identity matters if lifecycle code ever stops and restarts polling:
3662
- // an older completion must not clear a replacement poll's guard.
3663
- if (this.renderInFlight !== handled) return
3664
- this.renderInFlight = undefined
3665
- this.rendering = false
3666
- })
3667
- this.renderInFlight = handled
3668
- }
3669
- this.timer = setInterval(tick, DASHBOARD_POLL_MS)
3670
- // Never hold the process open for a redraw.
3671
- this.timer.unref?.()
3672
- // Watch mode only: a second, cheap timer repaints the cached model so a
3673
- // running step's elapsed advances ~1×/s decoupled from the store poll
3674
- // (AC 8). `--once` renders a single snapshot per state, so it gets no ticker.
3766
+ throw error
3767
+ }
3768
+ })
3675
3769
  if (this.opts.once !== true) {
3770
+ if (this.opts.input !== undefined) this.opts.terminal?.modes.enter(FOCUS_REPORTING_MODE)
3771
+ if (this.opts.terminal !== undefined && this.opts.input !== undefined) {
3772
+ this.suspension = installPresentationSuspension(
3773
+ this.opts.terminal.modes,
3774
+ () => {
3775
+ this.refresh?.suspend()
3776
+ this.stopInput()
3777
+ },
3778
+ () => {
3779
+ this.startInput()
3780
+ this.region?.invalidate()
3781
+ this.refresh?.resume()
3782
+ },
3783
+ )
3784
+ }
3676
3785
  this.tickTimer = setInterval(() => this.paint(), DASHBOARD_TICK_MS)
3677
3786
  this.tickTimer.unref?.()
3678
3787
  }
3679
- tick()
3788
+ void this.refresh.request()
3680
3789
  }
3681
3790
 
3682
3791
  private async stopRendering(): Promise<void> {
3683
- // Clear both timer sources before yielding. The boolean also fences a timer
3684
- // callback that was already queued when clearInterval ran.
3685
- if (this.timer !== undefined) clearInterval(this.timer)
3686
- this.timer = undefined
3792
+ this.refresh?.stop()
3793
+ this.suspension?.close()
3794
+ this.opts.terminal?.modes.leave(FOCUS_REPORTING_MODE)
3687
3795
  if (this.tickTimer !== undefined) clearInterval(this.tickTimer)
3688
3796
  this.tickTimer = undefined
3689
- this.acceptingRenderPolls = false
3690
-
3691
- // The poll owns model/controller mutation as well as terminal painting, so
3692
- // join it rather than merely suppressing a late LiveRegion.update(). Its
3693
- // normal rejection is warning-handled above; the catch keeps teardown safe
3694
- // even if reporting that warning itself throws.
3695
- const inFlight = this.renderInFlight
3696
- if (inFlight !== undefined) {
3697
- try {
3698
- await inFlight
3699
- } catch {
3700
- // Dashboard rendering remains best-effort during teardown.
3701
- }
3702
- }
3797
+ await this.refresh?.join()
3703
3798
  }
3704
3799
 
3705
3800
  /** Stop polling, paint the truth one last time, release the region. Every
@@ -3717,6 +3812,7 @@ class DispatchLoop {
3717
3812
  // considered released.
3718
3813
  try {
3719
3814
  try {
3815
+ this.opts.terminal?.modes.leave(FOCUS_REPORTING_MODE)
3720
3816
  this.stopInput()
3721
3817
  } catch (error) {
3722
3818
  // Cursor restoration must not be skipped just because stdin restoration
@@ -3733,7 +3829,8 @@ class DispatchLoop {
3733
3829
  await this.stopRendering()
3734
3830
  await this.operationTail
3735
3831
  try {
3736
- await this.renderOnce()
3832
+ if (this.opts.once === true) await this.readFrame()
3833
+ else await this.refresh?.finalRefresh()
3737
3834
  } catch {
3738
3835
  // Best-effort: a failed final frame must not mask the run's outcome.
3739
3836
  }
@@ -3746,11 +3843,14 @@ class DispatchLoop {
3746
3843
 
3747
3844
  // ── Repository supervisor lease (§12 serialization) ────────────────────────
3748
3845
 
3749
- /** Claim (or renew) the repository lease for this invocation and start the
3846
+ /** Claim an unknown or expired repository lease and start the
3750
3847
  * heartbeat timer. False means another supervisor holds it: the caller
3751
3848
  * yields — no claims, launches, or publications. */
3752
3849
  private async ensureRepoLease(holder: string): Promise<boolean> {
3753
3850
  if (this.superseded) return false
3851
+ if (this.repoLeaseHolder === holder && this.wiring.clock().getTime() < this.repoLeaseValidUntil)
3852
+ return true
3853
+ const requestedAt = this.wiring.clock().getTime()
3754
3854
  const claimed = await this.wiring.store
3755
3855
  .claimRepoLease(this.repoIdentity, holder, REPO_LEASE_TTL_MS)
3756
3856
  .catch(() => false)
@@ -3773,6 +3873,7 @@ class DispatchLoop {
3773
3873
  }
3774
3874
  return false
3775
3875
  }
3876
+ this.repoLeaseValidUntil = requestedAt + REPO_LEASE_TTL_MS
3776
3877
  if (this.repoLeaseHolder === undefined) {
3777
3878
  this.repoLeaseHolder = holder
3778
3879
  this.startRepoLeaseHeartbeat(holder)
@@ -3783,9 +3884,13 @@ class DispatchLoop {
3783
3884
  private startRepoLeaseHeartbeat(holder: string): void {
3784
3885
  if (this.repoLeaseHeartbeat !== undefined) return
3785
3886
  this.repoLeaseHeartbeat = setInterval(() => {
3887
+ const requestedAt = this.wiring.clock().getTime()
3786
3888
  this.wiring.store.heartbeatRepo(this.repoIdentity, holder).then(
3787
3889
  (alive) => {
3788
- if (alive) return
3890
+ if (alive) {
3891
+ this.repoLeaseValidUntil = requestedAt + REPO_LEASE_TTL_MS
3892
+ return
3893
+ }
3789
3894
  // A peer holds the repository now. Exit watch mode cleanly after
3790
3895
  // the same teardown every stop takes (detach remote / reap local,
3791
3896
  // signal continuations, release the lease).
@@ -3833,6 +3938,7 @@ class DispatchLoop {
3833
3938
  this.stopRepoLeaseHeartbeat()
3834
3939
  const holder = this.repoLeaseHolder
3835
3940
  this.repoLeaseHolder = undefined
3941
+ this.repoLeaseValidUntil = 0
3836
3942
  if (holder === undefined) return
3837
3943
  try {
3838
3944
  await this.wiring.store.releaseRepoLease(this.repoIdentity, holder)
@@ -3929,6 +4035,7 @@ class DispatchLoop {
3929
4035
  this.printReport(report, this.harvestInFlight === undefined)
3930
4036
  startup = false
3931
4037
  } catch (error) {
4038
+ if (this.forgePublicationFailed) throw error
3932
4039
  const message = error instanceof Error ? error.message : String(error)
3933
4040
  await this.publishTickFailure(error)
3934
4041
  this.warn(`tick failed: ${message}`)
@@ -4130,7 +4237,8 @@ export async function abDispatch(opts: DispatchOpts): Promise<void> {
4130
4237
 
4131
4238
  // Interactive production dispatch is two programs. Resolve/open only the
4132
4239
  // Store in the terminal owner; config, plugins, adapters, runners, and ticket
4133
- // I/O are constructed exclusively by the supervised private child. Injected
4240
+ // I/O are constructed by the supervised private child. Explicit node-land
4241
+ // actions lazily open the ticket source to recheck completeness. Injected
4134
4242
  // wiring remains the direct test/embedding seam, and every plain/non-TTY
4135
4243
  // invocation stays on the byte-compatible in-process kernel path below.
4136
4244
  if (
@@ -4154,6 +4262,19 @@ export async function abDispatch(opts: DispatchOpts): Promise<void> {
4154
4262
  checkout: state.checkout,
4155
4263
  storeRef: opened.storeRef,
4156
4264
  store: opened.store,
4265
+ ticketSource: async () =>
4266
+ (
4267
+ await openTicketSource(
4268
+ {
4269
+ targetRepo: state.checkout,
4270
+ exec: resolvedOpts.exec,
4271
+ env: resolvedOpts.env,
4272
+ storeRef: opened.storeRef,
4273
+ stdout: resolvedOpts.stdout,
4274
+ },
4275
+ 'ab land',
4276
+ )
4277
+ ).source,
4157
4278
  env: resolvedOpts.env,
4158
4279
  terminal: resolvedOpts.terminal,
4159
4280
  input: resolvedOpts.input,
@@ -4347,13 +4468,6 @@ export async function abDispatch(opts: DispatchOpts): Promise<void> {
4347
4468
  payload: { enabled: resolvedOpts.intake, run: runId },
4348
4469
  })
4349
4470
  }
4350
- if (resolvedOpts.defaultAutoMerge !== undefined) {
4351
- await view.appendRepo(state.repo, {
4352
- actor,
4353
- type: 'dispatcher.auto-merge-default-set',
4354
- payload: { enabled: resolvedOpts.defaultAutoMerge, run: runId },
4355
- })
4356
- }
4357
4471
 
4358
4472
  await view.appendRepoWithArtifacts(
4359
4473
  state.repo,