@defrex/autobuild 1.4.2 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/SPEC.md +432 -92
- package/bin/ab-dispatch-kernel.ts +1 -0
- package/docs/accounts.md +9 -0
- package/docs/agent-runtimes.md +1 -0
- package/docs/answering-blocked-builds.md +2 -1
- package/docs/architecture.md +282 -127
- package/docs/assets/headline-wide.png +0 -0
- package/docs/build-store.md +33 -3
- package/docs/cli.md +2 -1
- package/docs/configuration-overview.md +9 -0
- package/docs/configuration.md +163 -102
- package/docs/dispatcher-hosting.md +19 -3
- package/docs/dispatcher.md +9 -4
- package/docs/integration-overview.md +2 -2
- package/docs/integration-tree.md +91 -28
- package/docs/merge-policy.md +28 -9
- package/docs/operator-api.md +43 -18
- package/docs/operator-surfaces.md +1 -1
- package/docs/plugin-authoring.md +85 -8
- package/docs/remote-store-protocol.md +25 -7
- package/docs/remote-ticket-protocol.md +126 -12
- package/docs/restacking.md +20 -6
- package/docs/seams.md +2 -2
- package/docs/setup.md +19 -13
- package/docs/spec-standard.md +2 -1
- package/docs/ticket-dependencies.md +26 -8
- package/docs/ticket-migration.md +70 -7
- package/docs/ticket-sources.md +82 -5
- package/docs/tickets.md +34 -2
- package/docs/troubleshooting.md +2 -2
- package/docs/verification.md +5 -5
- package/docs/website.md +8 -0
- package/docs/workspaces.md +1 -1
- package/package.json +4 -3
- package/packages/core/src/accounts/hosted-readiness.ts +21 -0
- package/packages/core/src/cli/attention.ts +1 -0
- package/packages/core/src/cli/build-control.ts +36 -12
- package/packages/core/src/cli/connect.ts +9 -18
- package/packages/core/src/cli/context.ts +44 -0
- package/packages/core/src/cli/dashboard/configuration.ts +11 -0
- package/packages/core/src/cli/dashboard/model.ts +40 -10
- package/packages/core/src/cli/dashboard/queue.ts +21 -0
- package/packages/core/src/cli/dashboard/render.ts +40 -22
- package/packages/core/src/cli/dispatch-frontend.ts +63 -30
- package/packages/core/src/cli/dispatch-mode.ts +35 -16
- package/packages/core/src/cli/dispatch-repository-feed.ts +40 -11
- package/packages/core/src/cli/dispatch.ts +154 -47
- package/packages/core/src/cli/help.ts +59 -22
- package/packages/core/src/cli/init-hosted-accounts.ts +54 -0
- package/packages/core/src/cli/init-readiness-remote.ts +16 -3
- package/packages/core/src/cli/init-validation.ts +144 -42
- package/packages/core/src/cli/issue-links.ts +67 -0
- package/packages/core/src/cli/main.ts +32 -15
- package/packages/core/src/cli/pr-summary-publication.ts +38 -7
- package/packages/core/src/cli/publication-settlement.ts +36 -24
- package/packages/core/src/cli/repository-status.ts +201 -49
- package/packages/core/src/cli/status.ts +41 -3
- package/packages/core/src/cli/terminals.ts +37 -2
- package/packages/core/src/cli/ticket-editor.ts +20 -6
- package/packages/core/src/cli/ticket.ts +264 -46
- package/packages/core/src/cli/triage-count-sampler.ts +59 -0
- package/packages/core/src/cli/watch.ts +4 -0
- package/packages/core/src/config/live.ts +45 -4
- package/packages/core/src/config/load.ts +9 -0
- package/packages/core/src/config/pipeline-source.ts +6 -2
- package/packages/core/src/config/ready-assignee.ts +86 -0
- package/packages/core/src/config/schema.ts +164 -36
- package/packages/core/src/distribution-packaging.ts +1 -1
- package/packages/core/src/events/catalog.ts +5 -0
- package/packages/core/src/events/compatibility.ts +2 -1
- package/packages/core/src/events/payloads.ts +70 -0
- package/packages/core/src/events/policy.ts +8 -0
- package/packages/core/src/events/repository.ts +91 -28
- package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +41 -0
- package/packages/core/src/kernel/build-identity.ts +12 -0
- package/packages/core/src/kernel/change-presence.ts +139 -6
- package/packages/core/src/kernel/dispatch-capacity.ts +80 -14
- package/packages/core/src/kernel/dispatch-status.ts +10 -1
- package/packages/core/src/kernel/dispatch-upgrade.ts +104 -5
- package/packages/core/src/kernel/engine.ts +4 -2
- package/packages/core/src/kernel/finalize-pr-rejection.ts +95 -0
- package/packages/core/src/kernel/generators/repository-journals.ts +15 -1
- package/packages/core/src/kernel/harvest.ts +4 -1
- package/packages/core/src/kernel/integration-completeness.ts +104 -17
- package/packages/core/src/kernel/integration-landing.ts +17 -0
- package/packages/core/src/kernel/integration-state.ts +17 -0
- package/packages/core/src/kernel/issue-keywords.ts +202 -0
- package/packages/core/src/kernel/janitor-failure.ts +11 -0
- package/packages/core/src/kernel/kernel-git.ts +87 -0
- package/packages/core/src/kernel/landing-readiness.ts +25 -17
- package/packages/core/src/kernel/log-index.ts +1 -1
- package/packages/core/src/kernel/node-issue-links.ts +142 -0
- package/packages/core/src/kernel/node-parent.ts +6 -0
- package/packages/core/src/kernel/node-restack-transaction.ts +2 -0
- package/packages/core/src/kernel/pr-summary.ts +24 -0
- package/packages/core/src/kernel/read-deferrals.ts +75 -12
- package/packages/core/src/kernel/read-facts.ts +32 -1
- package/packages/core/src/kernel/reconcile-restack.ts +1 -1
- package/packages/core/src/kernel/reducer-registry.ts +31 -1
- package/packages/core/src/kernel/reducer.ts +90 -2
- package/packages/core/src/kernel/ticket-preparation.ts +12 -0
- package/packages/core/src/kernel/verify-budget.ts +43 -0
- package/packages/core/src/operator/index.ts +3 -1
- package/packages/core/src/operator/presentation.ts +3 -0
- package/packages/core/src/operator/protocol.ts +38 -2
- package/packages/core/src/operator/query.ts +66 -29
- package/packages/core/src/operator/registry.ts +47 -26
- package/packages/core/src/operator/tickets.ts +77 -10
- package/packages/core/src/plugin-sdk/index.ts +13 -0
- package/packages/core/src/plugins/manifest.ts +1 -1
- package/packages/core/src/plugins/registry.ts +1 -0
- package/packages/core/src/ports/forge/contract.ts +69 -0
- package/packages/core/src/ports/forge/create.ts +5 -0
- package/packages/core/src/ports/forge/fake.ts +184 -3
- package/packages/core/src/ports/forge/git-rewrite.ts +4 -2
- package/packages/core/src/ports/forge/github.ts +175 -38
- package/packages/core/src/ports/forge/local-git.ts +14 -0
- package/packages/core/src/ports/forge/readiness.ts +10 -0
- package/packages/core/src/ports/forge-failure.ts +43 -0
- package/packages/core/src/ports/runner/claude.ts +7 -1
- package/packages/core/src/ports/runner/codex.ts +7 -2
- package/packages/core/src/ports/runner/native-cli-fixture.ts +2 -1
- package/packages/core/src/ports/runner/pi.ts +7 -1
- package/packages/core/src/ports/runner/runtime.ts +3 -0
- package/packages/core/src/ports/runner/start-prompt.ts +37 -0
- package/packages/core/src/ports/tickets/contract.ts +320 -7
- package/packages/core/src/ports/tickets/create.ts +72 -17
- package/packages/core/src/ports/tickets/fake.ts +18 -0
- package/packages/core/src/ports/tickets/file-codec.ts +20 -0
- package/packages/core/src/ports/tickets/file.ts +43 -1
- package/packages/core/src/ports/tickets/github-fake.ts +1123 -0
- package/packages/core/src/ports/tickets/github-issues.ts +431 -0
- package/packages/core/src/ports/tickets/github-validators.ts +194 -0
- package/packages/core/src/ports/tickets/github.ts +2029 -0
- package/packages/core/src/ports/tickets/hosted-index.ts +34 -3
- package/packages/core/src/ports/tickets/issue-links.ts +86 -0
- package/packages/core/src/ports/tickets/lifecycle.ts +60 -4
- package/packages/core/src/ports/tickets/linear.ts +66 -6
- package/packages/core/src/ports/tickets/migration.ts +290 -68
- package/packages/core/src/ports/tickets/operations.ts +98 -12
- package/packages/core/src/ports/tickets/priority.ts +55 -0
- package/packages/core/src/ports/tickets/remote-protocol.ts +195 -29
- package/packages/core/src/ports/tickets/remote.ts +188 -13
- package/packages/core/src/ports/tickets/revision.ts +22 -1
- package/packages/core/src/ports/tickets/states.ts +43 -0
- package/packages/core/src/ports/tickets/tree.ts +58 -12
- package/packages/core/src/ports/tickets/update.ts +12 -2
- package/packages/core/src/ports/types.ts +190 -9
- package/packages/core/src/ports/workspace/commit-preservation.ts +135 -13
- package/packages/core/src/ports/workspace/git-worktree.ts +3 -1
- package/packages/core/src/ports/workspace/vercel-sandbox.ts +118 -27
- package/packages/core/src/processes/build-runner.ts +99 -21
- package/packages/core/src/processes/dispatcher.ts +822 -338
- package/packages/core/src/processes/execution-no-progress.ts +5 -0
- package/packages/core/src/processes/harvest-runner.ts +17 -8
- package/packages/core/src/processes/harvest.ts +5 -8
- package/packages/core/src/processes/tick-publication.ts +12 -2
- package/packages/core/src/processes/ticket-scan-schedule.ts +78 -0
- package/packages/core/src/processes/workspace-preservation.ts +36 -1
- package/packages/core/src/runtime-identity.ts +10 -2
- package/packages/core/src/scenarios/harness.ts +4 -0
- package/packages/core/src/store/adapter.ts +7 -1
- package/packages/core/src/store/contract.ts +83 -2
- package/packages/core/src/store/digest.ts +32 -1
- package/packages/core/src/store/reducer-value-shapes.json +4187 -3391
- package/packages/core/src/store/remote/protocol.ts +2 -0
- package/packages/core/src/store/remote/released-clients.json +11 -0
- package/packages/core/src/store/remote/released-reducer-values/1.5.0.json +26924 -0
- package/packages/core/src/store/remote/released-reducer-values/index.ts +2 -0
- package/packages/core/src/store/repo-state-events.ts +2 -0
- package/packages/core/src/store/types.ts +5 -0
- package/packages/core/src/testing/dispatch-read-budget.ts +729 -123
- package/packages/core/src/testing/index.ts +18 -1
- package/packages/core/src/testing/presence-history.ts +79 -0
- package/packages/core/src/testing/reduced-read-budget.ts +1085 -31
- package/packages/core/src/testing/upgrade-generations.ts +77 -0
- package/skills/code-review/SKILL.md +4 -3
- package/skills/finalize/SKILL.md +18 -2
- package/skills/guide/SKILL.md +374 -136
- package/skills/guide/references/accounts.md +9 -0
- package/skills/guide/references/integration-tree.md +91 -28
- package/skills/guide/references/merge-policy.md +28 -9
- package/skills/guide/references/operator-api.md +43 -18
- package/skills/guide/references/plugin-authoring.md +85 -8
- package/skills/guide/references/remote-store-protocol.md +25 -7
- package/skills/guide/references/remote-ticket-protocol.md +126 -12
- package/skills/guide/references/restacking.md +20 -6
- package/skills/guide/references/setup.md +19 -13
- package/skills/guide/references/spec-standard.md +2 -1
- package/skills/guide/references/ticket-dependencies.md +26 -8
- package/skills/guide/references/ticket-migration.md +70 -7
- package/skills/harvest-review/SKILL.md +4 -3
- package/skills/implement/SKILL.md +20 -1
- package/skills/operate/SKILL.md +103 -28
- package/skills/plan/SKILL.md +1 -1
- package/skills/reconcile/SKILL.md +5 -4
- package/skills/spec/SKILL.md +15 -2
- package/skills/tickets/SKILL.md +114 -37
- package/templates/autobuild.toml +5 -0
- package/templates/hosted-service/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { integrationFailed } from '../kernel/integration-state'
|
|
2
|
-
import {
|
|
2
|
+
import { landRefusalReason } from '../kernel/landing-readiness'
|
|
3
3
|
import { observeIntegration } from '../kernel/integration-completeness'
|
|
4
4
|
import type { TicketSource } from '../ports/types'
|
|
5
5
|
import { readBuildFacts } from '../store/reduced-reads'
|
|
@@ -122,6 +122,8 @@ export type BuildControlErrorCode =
|
|
|
122
122
|
| 'discard-pending'
|
|
123
123
|
| 'review-round-ceiling-unavailable'
|
|
124
124
|
| 'incompatible-answer-options'
|
|
125
|
+
| 'merge-not-ready'
|
|
126
|
+
| 'node-incomplete'
|
|
125
127
|
|
|
126
128
|
/** Typed codes let the dashboard turn stale selections/prompts into warnings
|
|
127
129
|
* while the CLI can surface the same underlying conflict as a command error. */
|
|
@@ -366,7 +368,7 @@ export function decideRevise(
|
|
|
366
368
|
if (open.length === 0) {
|
|
367
369
|
const paused =
|
|
368
370
|
state.status === 'paused'
|
|
369
|
-
? ` If a revision already
|
|
371
|
+
? ` If a spec revision was already recorded, the build remains paused; run ab resume ${slug}.`
|
|
370
372
|
: ''
|
|
371
373
|
return {
|
|
372
374
|
kind: 'refuse',
|
|
@@ -476,6 +478,9 @@ export interface ControlBuildOpts {
|
|
|
476
478
|
via?: Via
|
|
477
479
|
action: BuildControlAction
|
|
478
480
|
ticketSource?: () => Promise<TicketSource>
|
|
481
|
+
/** The configured rejected role's state, read when a node's completeness is
|
|
482
|
+
* established; a rejected child does not hold the node open. */
|
|
483
|
+
rejectedState?: () => Promise<string | undefined>
|
|
479
484
|
/** Injected only for --revise-spec-from-ticket. */
|
|
480
485
|
prepareTicketAssets?: (ref: TicketRef, store: BuildStore, repo: string) => Promise<PinnedAsset[]>
|
|
481
486
|
readTicketBody?: (ref: TicketRef, store: BuildStore, repo: string) => Promise<string>
|
|
@@ -539,25 +544,42 @@ export async function controlBuild(opts: ControlBuildOpts): Promise<BuildControl
|
|
|
539
544
|
if (opts.action.kind === 'land' && discardInFlight(current)) throw discardPending(opts.slug)
|
|
540
545
|
const decision = current.landing?.decision
|
|
541
546
|
if (opts.action.kind === 'land') {
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
547
|
+
const reason = landRefusalReason(current, facts.log.restack)
|
|
548
|
+
if (reason !== undefined)
|
|
549
|
+
throw new BuildControlError(
|
|
550
|
+
'merge-not-ready',
|
|
551
|
+
`Merge is not ready: ${reason}; refresh the build's status and run ab merge once it is ready`,
|
|
545
552
|
)
|
|
546
553
|
if (current.kind === 'node') {
|
|
547
554
|
if (!opts.ticketSource)
|
|
548
555
|
throw new Error('Cannot establish node completeness: ticket source unavailable')
|
|
549
|
-
const
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
556
|
+
const source = await opts.ticketSource()
|
|
557
|
+
const rejectedState = await opts.rejectedState?.()
|
|
558
|
+
let failure: { error: unknown } | undefined
|
|
559
|
+
const observed = await observeIntegration(opts.store, source, opts.slug, undefined, {
|
|
560
|
+
...(rejectedState === undefined ? {} : { rejectedState }),
|
|
561
|
+
onFailure: (error) => {
|
|
562
|
+
failure ??= { error }
|
|
563
|
+
},
|
|
564
|
+
})
|
|
565
|
+
// An observation that could not run is a server fault, not a
|
|
566
|
+
// build-state refusal, so it never becomes node-incomplete.
|
|
567
|
+
if (failure !== undefined)
|
|
568
|
+
throw failure.error instanceof Error
|
|
569
|
+
? failure.error
|
|
570
|
+
: new Error(String(failure.error))
|
|
554
571
|
if (
|
|
555
572
|
observed.openChildren.length ||
|
|
556
573
|
observed.diagnostics.length ||
|
|
557
574
|
!observed.contributions.length
|
|
558
575
|
)
|
|
559
|
-
throw new
|
|
560
|
-
'
|
|
576
|
+
throw new BuildControlError(
|
|
577
|
+
'node-incomplete',
|
|
578
|
+
`Node is incomplete${
|
|
579
|
+
observed.openChildren.length
|
|
580
|
+
? ` (open children: ${observed.openChildren.join(', ')})`
|
|
581
|
+
: ''
|
|
582
|
+
}; wait for its children and verification before running ab merge`,
|
|
561
583
|
)
|
|
562
584
|
}
|
|
563
585
|
}
|
|
@@ -1045,6 +1067,7 @@ export interface AbBuildControlOpts {
|
|
|
1045
1067
|
slug: string
|
|
1046
1068
|
action: BuildControlAction
|
|
1047
1069
|
ticketSource?: () => Promise<TicketSource>
|
|
1070
|
+
rejectedState?: () => Promise<string | undefined>
|
|
1048
1071
|
/** Explicit `--store`; selection remains --store > AB_STORE > repo-local. */
|
|
1049
1072
|
storeRef?: string
|
|
1050
1073
|
/** Injected only for --revise-spec-from-ticket. */
|
|
@@ -1068,6 +1091,7 @@ export async function abBuildControl(opts: AbBuildControlOpts): Promise<BuildCon
|
|
|
1068
1091
|
env: opts.env,
|
|
1069
1092
|
action: opts.action,
|
|
1070
1093
|
ticketSource: opts.ticketSource,
|
|
1094
|
+
...(opts.rejectedState !== undefined ? { rejectedState: opts.rejectedState } : {}),
|
|
1071
1095
|
...(opts.readTicketBody !== undefined ? { readTicketBody: opts.readTicketBody } : {}),
|
|
1072
1096
|
...(opts.prepareTicketAssets ? { prepareTicketAssets: opts.prepareTicketAssets } : {}),
|
|
1073
1097
|
}),
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { parseConfig } from '../config/load'
|
|
2
|
-
import { HostedTicketSource } from '../ports/tickets/remote'
|
|
3
|
-
import { ticketLifecycle } from '../ports/tickets/lifecycle'
|
|
2
|
+
import { HostedTicketSource, hostedTicketPolicy } from '../ports/tickets/remote'
|
|
4
3
|
import { createHash, randomBytes, randomUUID } from 'node:crypto'
|
|
5
4
|
import { access, readFile, rename, unlink, writeFile } from 'node:fs/promises'
|
|
6
5
|
import { constants } from 'node:fs'
|
|
@@ -245,27 +244,13 @@ export async function abConnect(raw: string | undefined, opts: ConnectOptions):
|
|
|
245
244
|
(!configuredTickets.url || normalizeServiceURL(configuredTickets.url) === service))
|
|
246
245
|
) {
|
|
247
246
|
const tickets = parseConfig(updatedText).tickets
|
|
248
|
-
const lifecycle = ticketLifecycle(tickets)
|
|
249
247
|
await new HostedTicketSource({
|
|
250
248
|
url: service,
|
|
251
249
|
token,
|
|
252
250
|
repo: p.repo,
|
|
253
251
|
teamKey: tickets.teamKey!,
|
|
254
252
|
...(opts.fetch ? { fetchFn: (input, init) => opts.fetch!(String(input), init) } : {}),
|
|
255
|
-
}).synchronizePolicy(
|
|
256
|
-
version: 1,
|
|
257
|
-
tickets: {
|
|
258
|
-
source: 'hosted',
|
|
259
|
-
teamKey: tickets.teamKey!,
|
|
260
|
-
readyState: lifecycle.ready,
|
|
261
|
-
triageState: lifecycle.triage,
|
|
262
|
-
claimedState: lifecycle.doing,
|
|
263
|
-
doneState: lifecycle.done,
|
|
264
|
-
createState: lifecycle.create,
|
|
265
|
-
proposalState: lifecycle.proposal,
|
|
266
|
-
...(tickets.readyLabels !== undefined ? { readyLabels: tickets.readyLabels } : {}),
|
|
267
|
-
},
|
|
268
|
-
})
|
|
253
|
+
}).synchronizePolicy(hostedTicketPolicy(tickets))
|
|
269
254
|
}
|
|
270
255
|
credentials.save({ service, repo: p.repo, id, token })
|
|
271
256
|
saved = true
|
|
@@ -320,7 +305,13 @@ export async function abDisconnect(opts: ConnectOptions): Promise<void> {
|
|
|
320
305
|
throw new Error(
|
|
321
306
|
'Multiple services: use ab disconnect --tickets for tickets; set AB_STORE to the build service and select --builds for builds',
|
|
322
307
|
)
|
|
323
|
-
if (!p.service && !opts.builds && p.ticketService)
|
|
308
|
+
if (!p.service && !opts.builds && p.ticketService) {
|
|
309
|
+
if (typeof p.ticketService !== 'string' || !/^https?:/.test(p.ticketService))
|
|
310
|
+
throw new Error(
|
|
311
|
+
'Hosted tickets have no service URL: [tickets] url is missing and the build store is not an HTTP service. Set [tickets] url (or run ab connect --tickets <url>), then retry ab disconnect --tickets',
|
|
312
|
+
)
|
|
313
|
+
if (!opts.tickets) return abDisconnect({ ...opts, tickets: true })
|
|
314
|
+
}
|
|
324
315
|
if (!p.service) throw new Error('No configured service')
|
|
325
316
|
const credentials = new ProjectCredentials(opts.env)
|
|
326
317
|
const entry = credentials.load(p.service, p.repo)
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
type NodeVerificationIndex,
|
|
5
5
|
} from '../kernel/node-verification-context'
|
|
6
6
|
import { compatibilityDiagnostic } from '../kernel/mixed-version'
|
|
7
|
+
import { describeIssueLinks } from '../kernel/issue-keywords'
|
|
7
8
|
import { readBuildFacts, type CurrentBuildFacts } from '../store/reduced-reads'
|
|
8
9
|
/**
|
|
9
10
|
* The `ab context` materializer (SPEC §8.3): a phase-scoped hydration of the
|
|
@@ -102,6 +103,9 @@ export interface ContextManifest {
|
|
|
102
103
|
size: number
|
|
103
104
|
path: string
|
|
104
105
|
}[]
|
|
106
|
+
/** The forge issue links this build froze at claim, with effective intent
|
|
107
|
+
* (SPEC "Forge issue links"). Omitted when the build has none. */
|
|
108
|
+
issueLinks?: { issue: number; intent: 'closes' | 'refs'; downgradeReason?: string }[]
|
|
105
109
|
/** From the latest `implement.completed` (§8.3 code-review/verify inputs). */
|
|
106
110
|
commitRange?: CommitRange
|
|
107
111
|
/** Reconcile: `{baseSha}` freshly recorded by this attempt's phase start (§15.7). */
|
|
@@ -197,6 +201,36 @@ export async function buildContext(deps: ContextDeps): Promise<ContextManifest>
|
|
|
197
201
|
}
|
|
198
202
|
throw error
|
|
199
203
|
}
|
|
204
|
+
// Durable, session-scoped proof that this session read its own build after
|
|
205
|
+
// the chain's latest classified failure. Written before any filesystem work.
|
|
206
|
+
const pending = events.log.readDeferrals.find(
|
|
207
|
+
(item) =>
|
|
208
|
+
item.session === env.session &&
|
|
209
|
+
item.phase === phase &&
|
|
210
|
+
item.round === round &&
|
|
211
|
+
!item.ended &&
|
|
212
|
+
!item.settled &&
|
|
213
|
+
!item.recovered,
|
|
214
|
+
)
|
|
215
|
+
if (pending) {
|
|
216
|
+
try {
|
|
217
|
+
await store.append(build, {
|
|
218
|
+
actor: KERNEL,
|
|
219
|
+
type: 'session.build-read-recovered',
|
|
220
|
+
payload: {
|
|
221
|
+
session: env.session,
|
|
222
|
+
phase,
|
|
223
|
+
round,
|
|
224
|
+
operation: 'context',
|
|
225
|
+
reason: 'own-build-read',
|
|
226
|
+
evidenceSeq: pending.evidenceSeq,
|
|
227
|
+
failureSeq: pending.lastFailureSeq,
|
|
228
|
+
},
|
|
229
|
+
})
|
|
230
|
+
} catch {
|
|
231
|
+
/* Lost evidence leaves the deferral unrecovered, which parks safely. */
|
|
232
|
+
}
|
|
233
|
+
}
|
|
200
234
|
const state = events.state
|
|
201
235
|
|
|
202
236
|
// Preserve legacy tracked scratch exactly while replacing disposable files.
|
|
@@ -374,12 +408,22 @@ export async function buildContext(deps: ContextDeps): Promise<ContextManifest>
|
|
|
374
408
|
`- id: ${ticket.id}`,
|
|
375
409
|
...(ticket.url !== undefined ? [`- url: ${ticket.url}`] : []),
|
|
376
410
|
...(ticket.title !== undefined ? [`- title: ${ticket.title}`] : []),
|
|
411
|
+
...(state.issueLinks.length > 0
|
|
412
|
+
? [`- issues: ${describeIssueLinks(state.issueLinks)}`]
|
|
413
|
+
: []),
|
|
377
414
|
'',
|
|
378
415
|
]
|
|
379
416
|
await writeDerived('ticket.md', lines.join('\n'))
|
|
380
417
|
}
|
|
381
418
|
}
|
|
382
419
|
|
|
420
|
+
if (state.issueLinks.length > 0)
|
|
421
|
+
manifest.issueLinks = state.issueLinks.map((link) => ({
|
|
422
|
+
issue: link.issue,
|
|
423
|
+
intent: link.intent,
|
|
424
|
+
...(link.downgrade !== undefined ? { downgradeReason: link.downgrade.reason } : {}),
|
|
425
|
+
}))
|
|
426
|
+
|
|
383
427
|
if (inputs.assets === true && state.pinnedAssets.length > 0) {
|
|
384
428
|
// The pin, not the ticket's current state: the revisions `build.created`
|
|
385
429
|
// (or the latest re-pinning `spec.revised`) recorded, fetched by explicit
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DashboardModel } from './model'
|
|
2
|
+
|
|
3
|
+
/** The one factual line every frontend shows where pipeline configuration
|
|
4
|
+
* would appear while no dispatcher has run for the repository. */
|
|
5
|
+
export const NO_DISPATCHER_RUN_LINE = 'No dispatcher has run for this project yet.'
|
|
6
|
+
|
|
7
|
+
/** The Active counter: `–` while no dispatcher run supplies a capacity. */
|
|
8
|
+
export function activeCounterText(model: Pick<DashboardModel, 'active' | 'configuration'>): string {
|
|
9
|
+
if (model.configuration === 'no-dispatcher-run') return '–'
|
|
10
|
+
return `${model.active.current}/${model.active.limit}`
|
|
11
|
+
}
|
|
@@ -10,7 +10,11 @@ import {
|
|
|
10
10
|
enrichIntegrationRows,
|
|
11
11
|
type IntegrationRow,
|
|
12
12
|
} from './integration-row'
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
dispatchCapacity,
|
|
15
|
+
slotWaitText,
|
|
16
|
+
type DispatchCapacity,
|
|
17
|
+
} from '../../kernel/dispatch-capacity'
|
|
14
18
|
import { openBuildWorkspace, provisionMarkerReducer } from '../../processes/dispatcher-selectors'
|
|
15
19
|
import { projectTree, treeVocabulary, type TreeProjection } from './tree'
|
|
16
20
|
export { treeVocabulary, consentQueue } from './tree'
|
|
@@ -86,6 +90,7 @@ import type { UIMessage } from 'ai'
|
|
|
86
90
|
import type { StreamOutcome, StreamPart } from '../../store/streams/types'
|
|
87
91
|
export { dashboardBuildControl } from './actions'
|
|
88
92
|
export type { DashboardBuildControl } from './actions'
|
|
93
|
+
export { NO_DISPATCHER_RUN_LINE, activeCounterText } from './configuration'
|
|
89
94
|
import {
|
|
90
95
|
DEFAULT_MAX_HARVEST_RECOVERY_ATTEMPTS,
|
|
91
96
|
openHarvestRun,
|
|
@@ -323,9 +328,14 @@ export interface DashboardModel {
|
|
|
323
328
|
/** Shared occupied/effective slot counter; idle integration nodes are free. */
|
|
324
329
|
active: DashboardCounter
|
|
325
330
|
capacity?: DispatchCapacity
|
|
326
|
-
/**
|
|
327
|
-
*
|
|
328
|
-
|
|
331
|
+
/** Absent: the recorded run's effective configuration projected this model.
|
|
332
|
+
* `no-dispatcher-run`: the repository journal records no dispatcher run, so
|
|
333
|
+
* pipeline configuration (steps, verify universe, capacity) is unknown and
|
|
334
|
+
* `active.limit` is not meaningful. */
|
|
335
|
+
configuration?: 'no-dispatcher-run'
|
|
336
|
+
/** Tickets in the configured triage state from the dispatcher's last
|
|
337
|
+
* successful sample; absent is unknown (`–`). */
|
|
338
|
+
triage?: number
|
|
329
339
|
/** Durable repository intake state (`true` means claims are disabled). */
|
|
330
340
|
drained: boolean
|
|
331
341
|
/** Durable repository-wide hold (`true` means queued builds cannot launch). */
|
|
@@ -1315,7 +1325,7 @@ interface DashboardFrameHeader {
|
|
|
1315
1325
|
capacityProjection?: DispatchCapacity
|
|
1316
1326
|
repo: string
|
|
1317
1327
|
queued: number
|
|
1318
|
-
|
|
1328
|
+
triage?: number
|
|
1319
1329
|
selection?: DashboardSelection
|
|
1320
1330
|
standby?: string
|
|
1321
1331
|
availableUpgrade?: string
|
|
@@ -1327,7 +1337,6 @@ interface DashboardFrameHeader {
|
|
|
1327
1337
|
export interface DashboardHeader extends DashboardFrameHeader {
|
|
1328
1338
|
activeCount: number
|
|
1329
1339
|
capacity: number
|
|
1330
|
-
observationLimit: number
|
|
1331
1340
|
}
|
|
1332
1341
|
|
|
1333
1342
|
/**
|
|
@@ -1335,6 +1344,27 @@ export interface DashboardHeader extends DashboardFrameHeader {
|
|
|
1335
1344
|
* projection here means build rows (including their phase intervals) may be
|
|
1336
1345
|
* cached without caching dispatcher settings or Harvest state.
|
|
1337
1346
|
*/
|
|
1347
|
+
/** A node waiting for a runner slot says so on its row unless a more urgent
|
|
1348
|
+
* alert already stands. Returns copies; cached projected rows stay intact. */
|
|
1349
|
+
export function decorateSlotWaits(
|
|
1350
|
+
rows: readonly DashboardBuild[],
|
|
1351
|
+
capacity: DispatchCapacity | undefined,
|
|
1352
|
+
): DashboardBuild[] {
|
|
1353
|
+
const waiting = new Map((capacity?.waitingNodes ?? []).map((node) => [node.slug, node.request]))
|
|
1354
|
+
if (!waiting.size) return [...rows]
|
|
1355
|
+
return rows.map((row) => {
|
|
1356
|
+
const request = waiting.get(row.slug)
|
|
1357
|
+
if (!request || !row.integrationRow || row.integrationRow.alert) return row
|
|
1358
|
+
return {
|
|
1359
|
+
...row,
|
|
1360
|
+
integrationRow: {
|
|
1361
|
+
...row.integrationRow,
|
|
1362
|
+
alert: { tone: 'yellow', text: slotWaitText(request) },
|
|
1363
|
+
},
|
|
1364
|
+
}
|
|
1365
|
+
})
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1338
1368
|
export function buildDashboardFromProjected(
|
|
1339
1369
|
projectedBuilds: readonly DashboardBuild[],
|
|
1340
1370
|
header: DashboardHeader,
|
|
@@ -1349,8 +1379,9 @@ export function buildDashboardFromProjected(
|
|
|
1349
1379
|
: repositoryEvents.upgrades)
|
|
1350
1380
|
const upgrade = projectHandoffs(upgradeState)
|
|
1351
1381
|
const rollback = projectRollback(upgradeState)
|
|
1352
|
-
const builds =
|
|
1353
|
-
projectedBuilds.map((row) => enrichDrainingRow(row, upgrade.draining)),
|
|
1382
|
+
const builds = decorateSlotWaits(
|
|
1383
|
+
enrichIntegrationRows(projectedBuilds.map((row) => enrichDrainingRow(row, upgrade.draining))),
|
|
1384
|
+
header.capacityProjection,
|
|
1354
1385
|
).sort((a, b) => a.slug.localeCompare(b.slug))
|
|
1355
1386
|
const missingAccounts = Array.isArray(repositoryEvents)
|
|
1356
1387
|
? repositoryReadFactsReducer.reduce(repositoryEvents).missingAccounts
|
|
@@ -1369,13 +1400,13 @@ export function buildDashboardFromProjected(
|
|
|
1369
1400
|
repo: header.repo,
|
|
1370
1401
|
...(rollback ? { rollback } : {}),
|
|
1371
1402
|
...(upgrade.handoffs.length ? { handoffs: upgrade.handoffs } : {}),
|
|
1403
|
+
...(header.triage !== undefined ? { triage: header.triage } : {}),
|
|
1372
1404
|
queued: header.queued,
|
|
1373
1405
|
active: {
|
|
1374
1406
|
current: header.capacityProjection?.occupied ?? header.activeCount,
|
|
1375
1407
|
limit: header.capacityProjection?.effective ?? header.capacity,
|
|
1376
1408
|
},
|
|
1377
1409
|
...(header.capacityProjection ? { capacity: header.capacityProjection } : {}),
|
|
1378
|
-
observations: { current: header.observationCount, limit: header.observationLimit },
|
|
1379
1410
|
drained: !settings.intake,
|
|
1380
1411
|
repositoryPaused: settings.paused,
|
|
1381
1412
|
defaultAutoMerge: settings.defaultAutoMerge,
|
|
@@ -1427,7 +1458,6 @@ export function buildDashboard(
|
|
|
1427
1458
|
capacityProjection,
|
|
1428
1459
|
activeCount,
|
|
1429
1460
|
capacity: config.capacity,
|
|
1430
|
-
observationLimit: config.policy.harvestThreshold,
|
|
1431
1461
|
},
|
|
1432
1462
|
repositoryEvents,
|
|
1433
1463
|
)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ticketPriority, urgentFirst } from '../../ports/tickets/priority'
|
|
2
|
+
import type { Ticket } from '../../ports/types'
|
|
3
|
+
|
|
4
|
+
/** The word every frontend shows on an urgent queued ticket. */
|
|
5
|
+
export const URGENT_MARK = 'URGENT'
|
|
6
|
+
|
|
7
|
+
export interface QueuedTicket<T> {
|
|
8
|
+
ticket: T
|
|
9
|
+
urgent: boolean
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Queued tickets in dispatch order — urgent first, then normal, each in the
|
|
13
|
+
* source's order — each saying whether it is urgent. */
|
|
14
|
+
export function queuedTickets<T extends Pick<Ticket, 'priority'>>(
|
|
15
|
+
tickets: readonly T[],
|
|
16
|
+
): QueuedTicket<T>[] {
|
|
17
|
+
return urgentFirst(tickets).map((ticket) => ({
|
|
18
|
+
ticket,
|
|
19
|
+
urgent: ticketPriority(ticket) === 'urgent',
|
|
20
|
+
}))
|
|
21
|
+
}
|
|
@@ -3,6 +3,7 @@ import { formatHandoff } from './handoff'
|
|
|
3
3
|
import { handPushedLabel, handPushedText } from './hand-pushed'
|
|
4
4
|
import { integrationBarCells } from './integration-row'
|
|
5
5
|
import { capacityExplanation } from '../../kernel/dispatch-capacity'
|
|
6
|
+
import { NO_DISPATCHER_RUN_LINE, activeCounterText } from './configuration'
|
|
6
7
|
import { treeVocabulary, consentQueue } from './tree'
|
|
7
8
|
/**
|
|
8
9
|
* The dashboard's other pure half: model → `string[]`. No terminal, no state,
|
|
@@ -73,7 +74,11 @@ export interface RenderOpts {
|
|
|
73
74
|
* must pass `paintableRows(rows)`, not `rows`. This module cannot enforce
|
|
74
75
|
* that — it counts lines and knows nothing of the region's trailing newline.
|
|
75
76
|
*
|
|
76
|
-
*
|
|
77
|
+
* A list-view frame given a height fills it exactly: the body region is
|
|
78
|
+
* padded so the legend (or prompt panel) occupies the last lines.
|
|
79
|
+
*
|
|
80
|
+
* Absent ⇒ unbounded and unpadded, for callers that are not painting a
|
|
81
|
+
* screen.
|
|
77
82
|
*/
|
|
78
83
|
height?: number
|
|
79
84
|
}
|
|
@@ -1620,8 +1625,8 @@ function renderDashboardContent(model: DashboardModel, opts: RenderOpts): string
|
|
|
1620
1625
|
paint('Autobuild', 'bold', color),
|
|
1621
1626
|
displayText(basename(model.repo)),
|
|
1622
1627
|
paint(
|
|
1623
|
-
`
|
|
1624
|
-
`
|
|
1628
|
+
`triage ${model.triage ?? '–'} | queue ${model.queued} | ` +
|
|
1629
|
+
`active ${activeCounterText(model)}${model.configuration === 'no-dispatcher-run' ? '' : capacityExplanation(model.capacity)}`,
|
|
1625
1630
|
'dim',
|
|
1626
1631
|
color,
|
|
1627
1632
|
),
|
|
@@ -1649,6 +1654,9 @@ function renderDashboardContent(model: DashboardModel, opts: RenderOpts): string
|
|
|
1649
1654
|
summary,
|
|
1650
1655
|
toggles,
|
|
1651
1656
|
...standbyLine(model, color, width),
|
|
1657
|
+
...(model.configuration === 'no-dispatcher-run'
|
|
1658
|
+
? [truncate(paint(` ${NO_DISPATCHER_RUN_LINE}`, 'dim', color), width)]
|
|
1659
|
+
: []),
|
|
1652
1660
|
...(upgradeNotice === undefined ? [] : [upgradeNotice]),
|
|
1653
1661
|
...runtimeNoticeLines(model, color, width),
|
|
1654
1662
|
...warnings,
|
|
@@ -1747,13 +1755,14 @@ function renderDashboardContent(model: DashboardModel, opts: RenderOpts): string
|
|
|
1747
1755
|
|
|
1748
1756
|
// Brute force is intentional and tiny (dashboard row counts are bounded
|
|
1749
1757
|
// by operator workload): choose the largest contiguous whole-row window
|
|
1750
|
-
// containing selection, with explicit omission notices.
|
|
1751
|
-
//
|
|
1758
|
+
// containing selection, with explicit omission notices. Each notice
|
|
1759
|
+
// costs two rows: the notice and the blank line separating it from the
|
|
1760
|
+
// builds. Harvest and builds participate identically.
|
|
1752
1761
|
let best: { start: number; end: number; count: number; used: number } | undefined
|
|
1753
1762
|
for (let start = 0; start <= selectedIndex; start += 1) {
|
|
1754
1763
|
for (let end = selectedIndex; end < rows.length; end += 1) {
|
|
1755
1764
|
const rowLines = prefix[end + 1]! - prefix[start]! + (end - start)
|
|
1756
|
-
const notices = (start > 0 ?
|
|
1765
|
+
const notices = (start > 0 ? 2 : 0) + (end < rows.length - 1 ? 2 : 0)
|
|
1757
1766
|
const used = rowLines + notices
|
|
1758
1767
|
if (used > bodyBudget) continue
|
|
1759
1768
|
const count = end - start + 1
|
|
@@ -1770,33 +1779,36 @@ function renderDashboardContent(model: DashboardModel, opts: RenderOpts): string
|
|
|
1770
1779
|
if (best !== undefined) {
|
|
1771
1780
|
body = []
|
|
1772
1781
|
if (best.start > 0) {
|
|
1773
|
-
body.push(overflowNotice(`${best.start} more above`, color, width))
|
|
1782
|
+
body.push(overflowNotice(`${best.start} more above`, color, width), '')
|
|
1774
1783
|
}
|
|
1775
1784
|
body.push(...flattenRows(rows.slice(best.start, best.end + 1)))
|
|
1776
1785
|
const below = rows.length - best.end - 1
|
|
1777
1786
|
if (below > 0) {
|
|
1778
|
-
body.push(overflowNotice(`and ${below} more below`, color, width))
|
|
1787
|
+
body.push('', overflowNotice(`and ${below} more below`, color, width))
|
|
1779
1788
|
}
|
|
1780
1789
|
} else {
|
|
1781
|
-
//
|
|
1782
|
-
// identity visible, then spend remaining
|
|
1790
|
+
// No whole-row window fits once notice gaps are counted. Keep the
|
|
1791
|
+
// selected row's selectable identity visible, then spend remaining
|
|
1792
|
+
// rows on detail and omission. Every notice keeps its one-line gap
|
|
1793
|
+
// from the detail; with no room for a notice and its gap, the
|
|
1794
|
+
// selection wins.
|
|
1783
1795
|
const selectedLines = rows[selectedIndex]!.lines
|
|
1784
1796
|
const above = selectedIndex
|
|
1785
1797
|
const below = rows.length - selectedIndex - 1
|
|
1786
|
-
let
|
|
1787
|
-
if (bodyBudget
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
const detailCapacity = Math.max(1, bodyBudget - noticeLines)
|
|
1798
|
+
let notices = 0
|
|
1799
|
+
if (bodyBudget >= 5 && above > 0 && below > 0) notices = 2
|
|
1800
|
+
else if (bodyBudget >= 3 && (above > 0 || below > 0)) notices = 1
|
|
1801
|
+
const detailCapacity = Math.max(1, bodyBudget - notices * 2)
|
|
1791
1802
|
body = []
|
|
1792
|
-
if (
|
|
1793
|
-
body.push(overflowNotice(`${above} more above`, color, width))
|
|
1803
|
+
if (notices === 2) {
|
|
1804
|
+
body.push(overflowNotice(`${above} more above`, color, width), '')
|
|
1794
1805
|
}
|
|
1795
1806
|
body.push(...selectedLines.slice(0, detailCapacity))
|
|
1796
|
-
if (
|
|
1797
|
-
body.push(overflowNotice(`and ${below} more below`, color, width))
|
|
1798
|
-
} else if (
|
|
1807
|
+
if (notices === 2) {
|
|
1808
|
+
body.push('', overflowNotice(`and ${below} more below`, color, width))
|
|
1809
|
+
} else if (notices === 1) {
|
|
1799
1810
|
body.push(
|
|
1811
|
+
'',
|
|
1800
1812
|
overflowNotice(
|
|
1801
1813
|
above > 0 && below > 0
|
|
1802
1814
|
? `${above} above, ${below} below`
|
|
@@ -1814,8 +1826,14 @@ function renderDashboardContent(model: DashboardModel, opts: RenderOpts): string
|
|
|
1814
1826
|
}
|
|
1815
1827
|
|
|
1816
1828
|
// Both blanks are structural frame chrome, independent of warning/upgrade
|
|
1817
|
-
// content, and are charged exactly once in the body budget above.
|
|
1818
|
-
|
|
1829
|
+
// content, and are charged exactly once in the body budget above. A bounded
|
|
1830
|
+
// frame pads its body region to the budget so the controls are pinned to
|
|
1831
|
+
// the bottom rows; an unbounded frame is not padded.
|
|
1832
|
+
const fill =
|
|
1833
|
+
height === undefined
|
|
1834
|
+
? 0
|
|
1835
|
+
: Math.max(0, height - top.length - separatorCount - body.length - controls.length)
|
|
1836
|
+
return [...top, '', ...body, ...Array.from({ length: fill }, () => ''), '', ...controls]
|
|
1819
1837
|
}
|
|
1820
1838
|
|
|
1821
1839
|
/** Render the dashboard inside a fixed one-column horizontal gutter.
|