@defrex/autobuild 0.13.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.
- package/README.md +5 -3
- package/SPEC.md +673 -99
- package/bin/ab-dispatch-kernel.ts +4 -6
- package/docs/architecture.md +322 -75
- package/docs/assets/headline-wide.png +0 -0
- package/docs/configuration.md +112 -12
- package/docs/hosted-service.md +20 -2
- package/docs/integration-tree.md +117 -0
- package/docs/landing-policy.md +150 -0
- package/docs/mcp.md +24 -0
- package/docs/migration-1.0.md +68 -0
- package/docs/operator-api.md +20 -9
- package/docs/remote-store-protocol.md +114 -9
- package/docs/remote-ticket-protocol.md +26 -5
- package/docs/restacking.md +79 -0
- package/docs/setup.md +49 -6
- package/docs/ticket-dependencies.md +69 -0
- package/docs/ticket-migration.md +8 -0
- package/package.json +4 -3
- package/packages/core/src/cli/attention.ts +40 -163
- package/packages/core/src/cli/build-control.ts +75 -55
- package/packages/core/src/cli/bulk-control.ts +3 -2
- package/packages/core/src/cli/context.ts +68 -78
- package/packages/core/src/cli/dashboard/actions.ts +6 -3
- package/packages/core/src/cli/dashboard/landing-display.ts +6 -0
- package/packages/core/src/cli/dashboard/live.ts +5 -0
- package/packages/core/src/cli/dashboard/model.ts +178 -40
- package/packages/core/src/cli/dashboard/poll.ts +15 -9
- package/packages/core/src/cli/dashboard/refresh.ts +176 -0
- package/packages/core/src/cli/dashboard/render.ts +78 -28
- package/packages/core/src/cli/dashboard/repository-poll.ts +57 -0
- package/packages/core/src/cli/dashboard/selection.ts +7 -1
- package/packages/core/src/cli/dashboard/tree.ts +107 -0
- package/packages/core/src/cli/dispatch-frontend.ts +173 -169
- package/packages/core/src/cli/dispatch-process.ts +14 -7
- package/packages/core/src/cli/dispatch-repository-feed.ts +196 -0
- package/packages/core/src/cli/dispatch.ts +397 -214
- package/packages/core/src/cli/dispatcher-liveness.ts +41 -21
- package/packages/core/src/cli/harvest.ts +71 -39
- package/packages/core/src/cli/help.ts +49 -32
- package/packages/core/src/cli/historical-build-state.ts +27 -0
- package/packages/core/src/cli/init-validation.ts +43 -2
- package/packages/core/src/cli/keyboard.ts +6 -0
- package/packages/core/src/cli/landings.ts +18 -0
- package/packages/core/src/cli/main.ts +52 -18
- package/packages/core/src/cli/mcp.ts +9 -0
- package/packages/core/src/cli/pr-attachments.ts +10 -13
- package/packages/core/src/cli/pr-summary-publication.ts +27 -60
- package/packages/core/src/cli/pr-summary.ts +43 -13
- package/packages/core/src/cli/publication-settlement.ts +177 -21
- package/packages/core/src/cli/repository-status.ts +49 -2
- package/packages/core/src/cli/status.ts +133 -36
- package/packages/core/src/cli/terminal-restore.ts +54 -0
- package/packages/core/src/cli/terminal.ts +16 -2
- package/packages/core/src/cli/terminals.ts +121 -219
- package/packages/core/src/cli/ticket-editor.ts +10 -3
- package/packages/core/src/cli/ticket.ts +115 -20
- package/packages/core/src/cli/upgrade-commit.ts +4 -0
- package/packages/core/src/cli/upgrade-compatibility.ts +2 -2
- package/packages/core/src/cli/upgrade-landing.ts +69 -0
- package/packages/core/src/cli/upgrade.ts +16 -0
- package/packages/core/src/cli/wait.ts +194 -91
- package/packages/core/src/cli/watch.ts +111 -109
- package/packages/core/src/config/landing.ts +22 -0
- package/packages/core/src/config/live.ts +1 -0
- package/packages/core/src/config/pipeline-source.ts +4 -3
- package/packages/core/src/config/schema.ts +3 -0
- package/packages/core/src/events/catalog.ts +48 -3
- package/packages/core/src/events/payloads.ts +295 -6
- package/packages/core/src/events/repository.ts +38 -3
- package/packages/core/src/integration/harness.ts +11 -2
- package/packages/core/src/kernel/__snapshots__/reducer-registry.test.ts.snap +3330 -119
- package/packages/core/src/kernel/auto-merge-default.ts +1 -0
- package/packages/core/src/kernel/auto-merge.ts +29 -4
- package/packages/core/src/kernel/build-identity.ts +94 -0
- package/packages/core/src/kernel/change-presence.ts +179 -0
- package/packages/core/src/kernel/dispatch-status.ts +17 -1
- package/packages/core/src/kernel/dispatcher-liveness.ts +10 -4
- package/packages/core/src/kernel/engine.ts +89 -2
- package/packages/core/src/kernel/generators/build-log.ts +23 -0
- package/packages/core/src/kernel/generators/leaf-restack-log.ts +110 -0
- package/packages/core/src/kernel/generators/node-restack-log.ts +94 -0
- package/packages/core/src/kernel/generators/repository-journals.ts +25 -3
- package/packages/core/src/kernel/harvest.ts +25 -23
- package/packages/core/src/kernel/integration-completeness.ts +81 -0
- package/packages/core/src/kernel/integration-landing.ts +263 -0
- package/packages/core/src/kernel/integration-stack.ts +36 -0
- package/packages/core/src/kernel/integration-state.ts +135 -0
- package/packages/core/src/kernel/landing-policy.ts +47 -0
- package/packages/core/src/kernel/landing-publication.ts +41 -0
- package/packages/core/src/kernel/landing-readiness.ts +67 -0
- package/packages/core/src/kernel/landing-state.ts +96 -0
- package/packages/core/src/kernel/leaf-restack-completion.ts +24 -0
- package/packages/core/src/kernel/leaf-restack-state.ts +73 -0
- package/packages/core/src/kernel/log-index-value.ts +38 -0
- package/packages/core/src/kernel/log-index.ts +35 -5
- package/packages/core/src/kernel/node-landing.ts +439 -0
- package/packages/core/src/kernel/node-parent.ts +184 -0
- package/packages/core/src/kernel/node-restack-state.ts +191 -0
- package/packages/core/src/kernel/node-restack-transaction.ts +210 -0
- package/packages/core/src/kernel/node-restack.ts +274 -0
- package/packages/core/src/kernel/read-facts.ts +704 -0
- package/packages/core/src/kernel/reconcile-head.ts +51 -0
- package/packages/core/src/kernel/reconcile-restack.ts +560 -0
- package/packages/core/src/kernel/reducer-registry.ts +153 -3
- package/packages/core/src/kernel/reducer.ts +121 -6
- package/packages/core/src/kernel/repository-attention.ts +179 -0
- package/packages/core/src/kernel/service-facts.ts +135 -0
- package/packages/core/src/kernel/snapshot-parent.ts +33 -0
- package/packages/core/src/kernel/terminal-guard.ts +133 -0
- package/packages/core/src/ontology.ts +9 -1
- package/packages/core/src/operator/annotations.ts +12 -0
- package/packages/core/src/operator/control.ts +11 -6
- package/packages/core/src/operator/index.ts +6 -0
- package/packages/core/src/operator/landings.ts +35 -0
- package/packages/core/src/operator/presentation.ts +1 -0
- package/packages/core/src/operator/protocol.ts +12 -3
- package/packages/core/src/operator/query.ts +40 -21
- package/packages/core/src/operator/read-view.ts +4 -13
- package/packages/core/src/operator/registry.ts +48 -19
- package/packages/core/src/operator/requests.ts +3 -22
- package/packages/core/src/operator/sandbox.ts +10 -9
- package/packages/core/src/operator/tickets.ts +57 -11
- package/packages/core/src/plugin-sdk/index.ts +13 -0
- package/packages/core/src/ports/forge/contract.ts +91 -3
- package/packages/core/src/ports/forge/fake.ts +142 -4
- package/packages/core/src/ports/forge/git-rewrite.ts +232 -0
- package/packages/core/src/ports/forge/github-readiness.ts +421 -0
- package/packages/core/src/ports/forge/github.ts +631 -35
- package/packages/core/src/ports/forge/local-git.ts +119 -5
- package/packages/core/src/ports/forge/readiness.ts +99 -0
- package/packages/core/src/ports/tickets/contract.ts +41 -0
- package/packages/core/src/ports/tickets/create.ts +8 -1
- package/packages/core/src/ports/tickets/fake.ts +32 -1
- package/packages/core/src/ports/tickets/file-codec.ts +7 -0
- package/packages/core/src/ports/tickets/file.ts +18 -1
- package/packages/core/src/ports/tickets/hosted-index.ts +2 -0
- package/packages/core/src/ports/tickets/linear.ts +124 -4
- package/packages/core/src/ports/tickets/migration.ts +25 -1
- package/packages/core/src/ports/tickets/operations.ts +7 -2
- package/packages/core/src/ports/tickets/remote-protocol.ts +19 -0
- package/packages/core/src/ports/tickets/remote.ts +10 -1
- package/packages/core/src/ports/tickets/revision.ts +3 -1
- package/packages/core/src/ports/tickets/tree.ts +148 -0
- package/packages/core/src/ports/tickets/update.ts +15 -2
- package/packages/core/src/ports/types.ts +135 -5
- package/packages/core/src/ports/workspace/git-worktree.ts +2 -1
- package/packages/core/src/ports/workspace/provider-capabilities.ts +1 -1
- package/packages/core/src/ports/workspace/vercel-sandbox.ts +60 -3
- package/packages/core/src/processes/build-child.ts +6 -6
- package/packages/core/src/processes/build-runner.ts +586 -87
- package/packages/core/src/processes/dispatch-failure-budget.ts +5 -4
- package/packages/core/src/processes/dispatcher-selectors.ts +15 -9
- package/packages/core/src/processes/dispatcher.ts +2239 -357
- package/packages/core/src/processes/execution-no-progress.ts +46 -1
- package/packages/core/src/processes/harvest-execution-state.ts +15 -9
- package/packages/core/src/processes/harvest-runner.ts +34 -70
- package/packages/core/src/processes/harvest.ts +38 -15
- package/packages/core/src/processes/infrastructure-failure-budget.ts +13 -15
- package/packages/core/src/processes/orchestrator-tick.ts +2 -2
- package/packages/core/src/processes/publication-loss.ts +35 -21
- package/packages/core/src/processes/publication-state.ts +30 -5
- package/packages/core/src/processes/repo-view.ts +244 -1130
- package/packages/core/src/processes/tick-publication.ts +110 -0
- package/packages/core/src/store/adapter.ts +23 -0
- package/packages/core/src/store/build-scope.ts +35 -0
- package/packages/core/src/store/contract.ts +909 -0
- package/packages/core/src/store/digest.ts +52 -4
- package/packages/core/src/store/local/schema.ts +26 -13
- package/packages/core/src/store/local/store.ts +296 -55
- package/packages/core/src/store/memory.ts +181 -30
- package/packages/core/src/store/phase-session.ts +34 -0
- package/packages/core/src/store/reduced-reads.ts +240 -0
- package/packages/core/src/store/reducer-value-shapes.json +18323 -0
- package/packages/core/src/store/reducer-value-validation.ts +96 -0
- package/packages/core/src/store/reducer-values.ts +145 -0
- package/packages/core/src/store/remote/client.ts +85 -0
- package/packages/core/src/store/remote/compatibility.ts +21 -9
- package/packages/core/src/store/remote/index.ts +19 -0
- package/packages/core/src/store/remote/protocol.ts +27 -0
- package/packages/core/src/store/remote/version.ts +3 -1
- package/packages/core/src/store/repo-state-events.ts +3 -1
- package/packages/core/src/store/repo-tick.ts +72 -0
- package/packages/core/src/store/session-handle.ts +34 -0
- package/packages/core/src/store/snapshots.ts +10 -0
- package/packages/core/src/store/subscribe.ts +1 -1
- package/packages/core/src/store/ticket-assets.ts +4 -4
- package/packages/core/src/store/types.ts +71 -6
- package/packages/core/src/testing/dispatch-read-budget.ts +215 -0
- package/packages/core/src/testing/index.ts +10 -0
- package/packages/core/src/testing/reduced-read-budget.ts +502 -0
- package/packages/core/src/testing/refresh-scheduler.ts +32 -0
- package/skills/guide/SKILL.md +116 -62
- package/skills/guide/references/integration-tree.md +117 -0
- package/skills/guide/references/landing-policy.md +150 -0
- package/skills/guide/references/migration-1.0.md +68 -0
- package/skills/guide/references/operator-api.md +13 -6
- package/skills/guide/references/plugin-authoring.md +34 -0
- package/skills/guide/references/remote-store-protocol.md +114 -9
- package/skills/guide/references/remote-ticket-protocol.md +26 -5
- package/skills/guide/references/restacking.md +79 -0
- package/skills/guide/references/setup.md +49 -6
- package/skills/guide/references/ticket-dependencies.md +69 -0
- package/skills/guide/references/ticket-migration.md +8 -0
- package/skills/operate/SKILL.md +55 -5
- package/skills/reconcile/SKILL.md +55 -48
- package/skills/spec/SKILL.md +67 -1
- package/skills/tickets/SKILL.md +55 -2
- package/templates/autobuild.toml +3 -0
- package/templates/hosted-service/package.json +2 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
+
import { readDispatcherRunFacts } from '../packages/core/src/store/reduced-reads'
|
|
2
3
|
/** Private, shipped child for the interactive `ab dispatch` kernel. It owns no
|
|
3
4
|
* terminal handles; the public command launches it with immutable options. */
|
|
4
5
|
import { abDispatch } from '../packages/core/src/cli/dispatch'
|
|
@@ -61,12 +62,9 @@ try {
|
|
|
61
62
|
const opened = openStoreForRepoState(state, { env: process.env })
|
|
62
63
|
try {
|
|
63
64
|
await opened.store.ensureRepo(state.repo)
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
(event) => event.type === 'dispatcher.run-stopped' && event.payload.run === options.run,
|
|
68
|
-
)
|
|
69
|
-
) {
|
|
65
|
+
const facts = (await readDispatcherRunFacts(opened.store, state.repo, options.run, false))
|
|
66
|
+
.value
|
|
67
|
+
if (!facts.stop) {
|
|
70
68
|
await opened.store.appendRepo(state.repo, {
|
|
71
69
|
actor: DISPATCHER,
|
|
72
70
|
type: 'dispatcher.run-stopped',
|
package/docs/architecture.md
CHANGED
|
@@ -145,9 +145,9 @@ by a later advance. Each reducer publishes a `version`; bump it whenever the
|
|
|
145
145
|
accumulator shape or the fold semantics change, because a cached accumulator is
|
|
146
146
|
only valid for the version that wrote it. `kernel/reducer-registry.ts` lists
|
|
147
147
|
every reducer with its version, and its snapshot test fails when an accumulator
|
|
148
|
-
shape changes without a bump.
|
|
149
|
-
|
|
150
|
-
|
|
148
|
+
shape changes without a bump. Current-state consumers use the typed persisted
|
|
149
|
+
read helpers in `store/reduced-reads.ts`; whole-array reducers remain pure
|
|
150
|
+
reference projections for tests and explicit historical output.
|
|
151
151
|
|
|
152
152
|
**Reducer snapshots.** The `BuildStore` port can keep, per scope (one build log
|
|
153
153
|
or the repository journal) and registered reducer, that reducer's accumulator as
|
|
@@ -173,72 +173,91 @@ reads every snapshot as missing and replays (SQLSTATE `42P01` is never an
|
|
|
173
173
|
error), and an older client never asks. Run `bun run postgres:migrate` once to
|
|
174
174
|
gain the table; until then the dispatcher and every other reader replay in full.
|
|
175
175
|
|
|
176
|
-
**
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
the
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
dispatcher
|
|
240
|
-
|
|
241
|
-
|
|
176
|
+
**Named reducer values.** `BuildStore.getReducerValue(scope, {reducer, args?})`
|
|
177
|
+
returns `{version, cursor, value}` for each eligible entry in the executable
|
|
178
|
+
reducer registry. Eligible reducers consume build or repository events and finish
|
|
179
|
+
as plain JSON; raw journal-event lists, operator-session reducers, collections,
|
|
180
|
+
selector functions, and top-level optional results are explicitly excluded with
|
|
181
|
+
reasons. Factory arguments are validated and participate in a bounded digest
|
|
182
|
+
cache key. The persisted envelope also records the canonical scope, arguments,
|
|
183
|
+
name and version, and nested accumulator shapes are validated before restore.
|
|
184
|
+
The `value.*` namespace is reserved: public snapshot reads and writes reject it,
|
|
185
|
+
and the engine persists through private adapter hooks. Versioned cache keys
|
|
186
|
+
exclude checkpoints produced while the old namespace was publicly writable.
|
|
187
|
+
`tools/reducer-value-shapes.ts` regenerates those structural validators from the
|
|
188
|
+
declared accumulator types.
|
|
189
|
+
|
|
190
|
+
Memory, SQLite and Postgres use the same algorithm: capture the authoritative
|
|
191
|
+
high-water, load persisted state on every call, fold the indexed contiguous delta
|
|
192
|
+
through that boundary, persist, and return an independent JSON value. There is
|
|
193
|
+
no process-local accumulator cache. A foreign checkpoint newer than the initial
|
|
194
|
+
boundary causes a fresh high-water check. Normal writes are monotone; corrupt,
|
|
195
|
+
wrong-version or ahead-of-log rows are repaired only by comparing the exact row
|
|
196
|
+
observed, atomically with the log boundary. A losing writer still returns its
|
|
197
|
+
correct prefix. Missing or unreadable cache state replays; log failures propagate.
|
|
198
|
+
|
|
199
|
+
The remote adapter makes one value request; only the finished answer crosses the
|
|
200
|
+
wire. The service uses named effective-configuration references for hosted ticket
|
|
201
|
+
operations (including policy publication) and semantic build/harvest lifecycle
|
|
202
|
+
facts for delegated authentication and issuance. Lifecycle snapshots keep session,
|
|
203
|
+
execution and terminal evidence, including historical endings, without dispatcher
|
|
204
|
+
tick tails. Anchor membership follows the contiguous log prefix. The legacy
|
|
205
|
+
state-events route remains a deprecated compatibility endpoint. Public generic
|
|
206
|
+
snapshot routes remain compatible, but current consumer reads do not restore the
|
|
207
|
+
former dispatcher work bundles.
|
|
208
|
+
|
|
209
|
+
**Dispatcher repository view.** `RepoViewStore`
|
|
210
|
+
(`packages/core/src/processes/repo-view.ts`) coordinates repository metadata and
|
|
211
|
+
source promise chains. Its build and journal facts come from persisted reduced
|
|
212
|
+
values. Reads after an append or lost conditional append consult that boundary
|
|
213
|
+
again, so no process-local memo suppresses a required delta. The adapter owns
|
|
214
|
+
cache persistence and recovery; the view neither writes work bundles nor hydrates
|
|
215
|
+
whole logs for decisions. Discovery uses persisted build digests, including for
|
|
216
|
+
settled builds. Raw methods forward actual cursor event output.
|
|
217
|
+
|
|
218
|
+
JSON-safe companion projections preserve collection and optional-value contracts.
|
|
219
|
+
The build facts projection returns one prefix for engine routing; its log-index
|
|
220
|
+
rounds and finalize steps reconstruct Maps and Sets explicitly, while publication
|
|
221
|
+
selectors reconstruct from a JSON ledger. Repository facts retain configuration,
|
|
222
|
+
control, Harvest, and dispatcher run correlations. Lease metadata and clocks stay
|
|
223
|
+
outside event reducers: liveness combines durable run facts with the current
|
|
224
|
+
repository record and observation time, including an older lease holder hidden
|
|
225
|
+
by a newer run. The shared repository value keeps a bounded recent-run window, including the
|
|
226
|
+
latest started and stopped runs. Fresh invocations use those shared facts for
|
|
227
|
+
first-tick publication, liveness and supervision without creating a cold
|
|
228
|
+
parameterized cache. Older holder correlations can use `dispatcherRunFacts` for
|
|
229
|
+
the requested historical run. A never-started fresh invocation does not request
|
|
230
|
+
historical correlation. Stopped dispatcher history is not copied into every
|
|
231
|
+
current read.
|
|
232
|
+
|
|
233
|
+
Hosted project build listings use the optional backing-store
|
|
234
|
+
`listBuildsForRepo` capability with the authenticated repository. Postgres filters
|
|
235
|
+
build rows in SQL before hosted ticket readable-id projection. Admin listings
|
|
236
|
+
remain global; adapters without the capability retain application filtering.
|
|
237
|
+
|
|
238
|
+
**Operator and CLI reads.** Build listings and details, repository and Harvest
|
|
239
|
+
status, dispatcher decisions, operator API queries, MCP delegation and web
|
|
240
|
+
dashboard refreshes use the same typed persisted read helpers. Shared projection
|
|
241
|
+
functions render those facts; whole-array overloads remain reference oracles.
|
|
242
|
+
Operator passes are single-flight per repository, with requests arriving during a
|
|
243
|
+
pass queued for one trailing pass. Fresh readers use persisted cache rows too;
|
|
244
|
+
steady-state event-row cost depends on newly appended events at fixed build/run
|
|
245
|
+
cardinality, not on log length. Reduced collections may legitimately grow in JSON
|
|
246
|
+
size. Cache loss or corruption can replay history once to recover the same answer.
|
|
247
|
+
|
|
248
|
+
Watch and wait register from a compound persisted `buildStreamSeed` at cursor C.
|
|
249
|
+
Its build accumulator, deferral ledger and insertion-ordered historical PR
|
|
250
|
+
eligibility describe that same prefix. Ordinary polling, including the first
|
|
251
|
+
batch on an old build, reads only events after the cursor and advances that seed
|
|
252
|
+
event by event, preserving state at event N in each emitted record. Watch uses
|
|
253
|
+
historical eligibility for baseline suppression; wait retains its separate
|
|
254
|
+
current-attention registration policy. Only an explicit `--since` older than C
|
|
255
|
+
reconstructs a historical prefix once in `cli/historical-build-state.ts`.
|
|
256
|
+
Actual event listings, transcripts and cursor streams remain raw reads. The
|
|
257
|
+
interactive terminal frontend retains its independently established incremental
|
|
258
|
+
feed. `tools/persisted-reduced-reads.test.ts` scans production TypeScript calls
|
|
259
|
+
and maintains precise, reason-bearing exceptions for these boundaries and pure
|
|
260
|
+
reference projections; stale exceptions fail the check.
|
|
242
261
|
|
|
243
262
|
**Session Store authority.** `packages/core/src/cli/binary.ts` validates a complete build or
|
|
244
263
|
Harvest ambient tuple before opening its phase Store through
|
|
@@ -351,7 +370,7 @@ selection (applied at the planner's `ab done` in `packages/core/src/cli/terminal
|
|
|
351
370
|
snapshotted by the engine at approval), and
|
|
352
371
|
`packages/core/src/kernel/verify-applicability.ts` matches changed paths against a step's
|
|
353
372
|
selectors, resolved by the build runner via `git diff` against the initial
|
|
354
|
-
branch-cut base (or the
|
|
373
|
+
branch-cut base (or the effective base promoted by successful restack/reconcile publication).
|
|
355
374
|
This verify-only base is deliberately independent from implementation's
|
|
356
375
|
focused review range. All narrowing mechanisms produce the ordinary
|
|
357
376
|
queryable skipped outcome; Git failure is infrastructure and fails closed,
|
|
@@ -387,7 +406,19 @@ SIGTERM restore terminal modes immediately and begin one supervised drain;
|
|
|
387
406
|
persistent frontend and child handlers keep repeated signals graceful until the
|
|
388
407
|
kernel child is reaped, after which a non-SIGINT terminating signal is replayed
|
|
389
408
|
in the frontend. A parent-liveness watch remains the detached-kernel fallback.
|
|
390
|
-
|
|
409
|
+
The repository record carries constant-size, lease-holder-fenced tick telemetry:
|
|
410
|
+
`beginRepoTick` opens the unsafe boundary, and `finishRepoTick` atomically closes
|
|
411
|
+
it and appends selected tick facts. Successful unchanged ticks append nothing;
|
|
412
|
+
queue transitions, counters, diagnostics, attention resets/retries, and failures
|
|
413
|
+
retain their journal evidence. Buffered starts preserve actual `startedAt` for
|
|
414
|
+
attention cooldowns; old starts use their envelope time. Liveness reads refresh
|
|
415
|
+
the repository record even with an unchanged event cursor, merging matching-run
|
|
416
|
+
completion samples with journal ticks. Heartbeat renewal cannot invent progress.
|
|
417
|
+
The memory, SQLite, Postgres and remote adapters share this contract, including
|
|
418
|
+
no mutation after lease expiry and no partial publication on validation failure.
|
|
419
|
+
|
|
420
|
+
Timeout escalation is held while the matching repository tick observation is open
|
|
421
|
+
(with historical `tick-started` journal fallback when no observation exists),
|
|
391
422
|
because force-killing the ticket claim before build creation would not be
|
|
392
423
|
recoverable. After a build child claims a takeover lease, it reduces one
|
|
393
424
|
captured event prefix and appends transcriptless reclaimed `session.ended`
|
|
@@ -511,6 +542,17 @@ receive-pack-free network policy, so even a failed publication-policy restore
|
|
|
511
542
|
fails closed before setup or plugin code runs. Normal VM sessions never receive
|
|
512
543
|
Forge credentials.
|
|
513
544
|
|
|
545
|
+
**Forge readiness.** `ports/forge/readiness.ts` owns the portable check inventory,
|
|
546
|
+
classification, plugin fallback, and formatting; `github-readiness.ts` performs
|
|
547
|
+
read-only settings/policy inspection, keeping incomplete evidence unknown. Host
|
|
548
|
+
init validation invokes the configured registry forge outside guest probes.
|
|
549
|
+
Dispatch inspects after acquiring its repository lease and writes validated
|
|
550
|
+
`dispatcher.forge-readiness-failed` facts once per run/check for known hard
|
|
551
|
+
failures. `kernel/dispatch-status.ts` retains their typed collection across ticks
|
|
552
|
+
and reloads; the independent frontend and operator query project the same warnings.
|
|
553
|
+
`ab watch` follows these repository attention events for external orchestrators.
|
|
554
|
+
See [setup](setup.md#forge-readiness) for requirements and access guidance.
|
|
555
|
+
|
|
514
556
|
**Forge credentials.** `packages/core/src/ports/forge/github-transport.ts` owns the
|
|
515
557
|
REST transport seam and credential resolution for the builtin GitHub forge:
|
|
516
558
|
`GITHUB_TOKEN`, then `GH_TOKEN`, then the gh CLI's stored login read through
|
|
@@ -524,6 +566,35 @@ dispatcher — requires an exported token before any side effect and never consu
|
|
|
524
566
|
a checkout-less host has neither gh nor a keyring, and `vercel-sandbox` publication
|
|
525
567
|
injects that same token.
|
|
526
568
|
|
|
569
|
+
**Stable build identity.** The forge landing seam accepts optional build identity at operation time. Both
|
|
570
|
+
built-in adapters preserve their squash message and normalize a final
|
|
571
|
+
`Autobuild-Build: <slug>` trailer through `packages/core/src/kernel/build-identity.ts`. The GitHub
|
|
572
|
+
adapter reads the viewer's squash headline/body and head in one GraphQL query;
|
|
573
|
+
it never reconstructs server defaults from repository settings. The janitor
|
|
574
|
+
maintains native request message freshness after acknowledgement. A matching
|
|
575
|
+
request costs one GraphQL freshness query and no extra consent or pipeline read;
|
|
576
|
+
full gate inspection and refreshed durable consent/engine eligibility precede
|
|
577
|
+
any repair. Body comparison tolerates provider trimming of trailing whitespace
|
|
578
|
+
while preserving the complete headline, body content, and squash method.
|
|
579
|
+
|
|
580
|
+
Optional `Forge.readCommitMessage` and `Forge.containsBuild` capabilities expose
|
|
581
|
+
actual landed messages and exact trailer presence in reachable branch history.
|
|
582
|
+
The janitor records optional `pr.merged.buildTrailerPresent` for normal and abort
|
|
583
|
+
cleanup observations. Unsupported or failed inspection leaves evidence unknown;
|
|
584
|
+
a read failure also records an observation without preventing completion. Old
|
|
585
|
+
logs need no migration and keep the same status and presentation.
|
|
586
|
+
|
|
587
|
+
GitHub merge queues ignore squash-message overrides. The message query also
|
|
588
|
+
reads `repository.mergeQueue(branch:)`, covering classic protection and rulesets.
|
|
589
|
+
Its branch hint is checked against the PR's actual base, with a bounded re-query
|
|
590
|
+
after a retarget rather than assuming the repository default is the base.
|
|
591
|
+
Kernel auto-merge therefore
|
|
592
|
+
returns an actionable `unproven-gate-state` deferral for queue-protected bases;
|
|
593
|
+
it never bypasses the queue. Human queue landings still settle normally with
|
|
594
|
+
inspected trailer evidence when available. Expected-head guards and recurring
|
|
595
|
+
polls bound native message freshness, but cannot prevent a push and automatic
|
|
596
|
+
landing from both completing between polls.
|
|
597
|
+
|
|
527
598
|
**Agent runtimes.** `packages/core/src/ports/runner/`: `runtime.ts` (capability-carrying
|
|
528
599
|
registry plus boundary validation), `routing.ts` (eager role resolver),
|
|
529
600
|
`production.ts` (shipped Claude/Codex/Pi registrations), `codex.ts` (direct
|
|
@@ -671,13 +742,37 @@ queue. The supervised kernel child owns every slow
|
|
|
671
742
|
adapter operation, so slug naming, provisioning, runners, and Harvest cannot
|
|
672
743
|
block input.
|
|
673
744
|
|
|
745
|
+
`packages/core/src/cli/dashboard/refresh.ts` owns the shared presentation read
|
|
746
|
+
scheduler for both terminal paths: focused by default, paused on focus-out,
|
|
747
|
+
immediate on focus-in or keys, 500 ms with retained builds or during a 30-second
|
|
748
|
+
interaction hold, and 5 seconds when idle. Presentation store facades check
|
|
749
|
+
admission at every asynchronous read stage; the kernel uses its original store
|
|
750
|
+
and independent tick timers. Cached clock paints perform no reads. The mode
|
|
751
|
+
ledger owns focus reporting through teardown and catchable faults; job-control
|
|
752
|
+
suspension restores modes and input before stopping and reactivates with assumed
|
|
753
|
+
focus on resume. Plain, non-TTY, and once runs never enable focus reporting.
|
|
754
|
+
|
|
674
755
|
`packages/core/src/cli/build-progress.ts` projects the exact last-event, heartbeat, and lease
|
|
675
756
|
inputs shared by the diagnostic `ab builds` and `ab build status` surfaces. Its
|
|
676
757
|
one-hour `diverged` predicate is presentation-only: reducer status, engine
|
|
677
758
|
routing, and lease health remain independent. `packages/core/src/cli/dashboard/model.ts` is
|
|
678
759
|
the event-derived build-row projection; `poll.ts` reprojects rows for event or
|
|
679
|
-
effective-config changes and
|
|
680
|
-
|
|
760
|
+
effective-config changes and bounded enrichment refreshes while retaining the
|
|
761
|
+
cached log and reduction. `repository-poll.ts` serializes the complete presentation
|
|
762
|
+
snapshot in both terminal paths. It samples `getRepoChangePosition` before reads,
|
|
763
|
+
acknowledges it only after complete admitted reads, and reuses unchanged snapshots
|
|
764
|
+
for up to ten seconds. Scoped discovery uses `listBuildsForRepo`; unchanged focused
|
|
765
|
+
frames make one counter request. Session feeds remain independent.
|
|
766
|
+
|
|
767
|
+
The memory adapter maintains independent bigint counters; SQLite and PostgreSQL
|
|
768
|
+
increment `repo_change_positions` transactionally through triggers on build,
|
|
769
|
+
build-event, repository-event insertion and null-safe repository lease holder
|
|
770
|
+
changes. Reads return decimal text (unknown repos: `"0"`) without journal creation.
|
|
771
|
+
The hosted counter route returns only that position; scoped build discovery has
|
|
772
|
+
its own repository-authorized route before the journal-existence gate. PostgreSQL
|
|
773
|
+
counter DDL is additive, outside the guarded core schema/checksum, and must be
|
|
774
|
+
explicitly migrated before the service rollout. Existing writers use the same
|
|
775
|
+
triggers; rerunning migration preserves positions without replaying old events.
|
|
681
776
|
`detail.ts` projects chronological session history from the same retained log,
|
|
682
777
|
including a distinct transcriptless `reclaimed` ending, and `transcript.ts`
|
|
683
778
|
heuristically presents ordinary opaque transcript artifacts with a raw
|
|
@@ -962,13 +1057,13 @@ revisions rather than ignoring them.
|
|
|
962
1057
|
|
|
963
1058
|
`ab ticket edit <id>` opens `$VISUAL`, falling back to `$EDITOR`, using TOML
|
|
964
1059
|
frontmatter and a Markdown body. Only title, body and labels are editable;
|
|
965
|
-
id, blockers, creation key and reference comments are read-only. It saves only
|
|
1060
|
+
kind, target, id, blockers, creation key and reference comments are read-only. It saves only
|
|
966
1061
|
changed fields with the opening revision. Unchanged or formatting-only edits
|
|
967
1062
|
write nothing. On conflict, invalid input or editor failure, the error names an
|
|
968
1063
|
absolute file path containing the edited text. Read the current ticket and
|
|
969
1064
|
reapply the intended changes before retrying; conflicts are never merged.
|
|
970
1065
|
|
|
971
|
-
File and Linear revisions fingerprint title, body, canonical label/blocker sets
|
|
1066
|
+
File and Linear revisions fingerprint kind, target, title, body, canonical label/blocker sets
|
|
972
1067
|
and state; reverting identical content restores its fingerprint. File checks
|
|
973
1068
|
re-read immediately before writing, with the existing no-lock race window.
|
|
974
1069
|
Direct file edits and state-directory moves change revisions. File comments
|
|
@@ -994,3 +1089,155 @@ Hosted ticket detail reads expose complete, oldest-first structured comments in
|
|
|
994
1089
|
HTTP clients opt in with `x-autobuild-ticket-comments: 1` so historical strict
|
|
995
1090
|
decoders retain compatible responses. File comments remain embedded in the body;
|
|
996
1091
|
Linear comment reads are unchanged.
|
|
1092
|
+
|
|
1093
|
+
Ticket integration metadata lives in `ports/tickets/tree.ts`: source compatibility
|
|
1094
|
+
normalization, capability refusal, graph validation and the pure tree projection.
|
|
1095
|
+
File/fake/Linear adapters validate metadata at write boundaries; `operations.ts`
|
|
1096
|
+
and CLI/operator source opening wrap injected or plugin sources with the same
|
|
1097
|
+
compatibility facade. Metadata is excluded from hosted persistence/protocols.
|
|
1098
|
+
|
|
1099
|
+
|
|
1100
|
+
### Integration node dispatch
|
|
1101
|
+
|
|
1102
|
+
The product dispatcher owns the workspace-free node lifecycle:
|
|
1103
|
+
spec → node.opening → node.opened → collecting → complete → verify:* → consent → land.
|
|
1104
|
+
The ordinary work pipeline is unchanged. `build.created` freezes kind, target
|
|
1105
|
+
ticket/build identity and resolved parent in `baseBranch`. Integration facts
|
|
1106
|
+
are projected by the shared reducer and digests, including collecting/empty
|
|
1107
|
+
state. Admission resolves same-source targets through repository read facts;
|
|
1108
|
+
integration identities remain active for deduplication but consume no work slot.
|
|
1109
|
+
|
|
1110
|
+
Optional Forge node branch creation and comparison capabilities let GitHub
|
|
1111
|
+
operate without a checkout and local-git operate directly on its shared refs.
|
|
1112
|
+
Opening intent retains the sampled SHA across retries; adoption requires that
|
|
1113
|
+
commit in the existing branch's history. Comparison uses reachability, so an
|
|
1114
|
+
advanced parent never makes an empty node nonempty. The janitor opens PRs lazily
|
|
1115
|
+
and reuses terminal cleanup without leaf reconcile or auto-merge.
|
|
1116
|
+
|
|
1117
|
+
### Leaf and reconcile restacking
|
|
1118
|
+
|
|
1119
|
+
The kernel prepares a detached replay of one net build change on the base frozen
|
|
1120
|
+
by `reconcile.started`. The contribution baseline is the initial branch-cut base
|
|
1121
|
+
or latest successfully published restack/reconcile base. The resolver continues that one replay;
|
|
1122
|
+
completion requires one parent at the frozen base and the build identity trailer.
|
|
1123
|
+
Historical merge completions retain their original shape and semantics.
|
|
1124
|
+
|
|
1125
|
+
The optional grouped Forge rewrite capability owns authoritative head snapshots,
|
|
1126
|
+
immutable `refs/autobuild/archive/<slug>/<sha>` publication and expected-head CAS.
|
|
1127
|
+
GitHub uses explicit Git transport leases; local-git uses shared-database
|
|
1128
|
+
`update-ref` CAS without network calls. Trusted remote publication archives before
|
|
1129
|
+
replacement after guest teardown; it never uses ordinary append-only publication
|
|
1130
|
+
for restacks. Prepared, replayed, intended and rewritten facts support recovery.
|
|
1131
|
+
A contended rewrite preserves the observed work and retries on the same base.
|
|
1132
|
+
|
|
1133
|
+
`kernel/leaf-restack-state.ts` projects target observations, frozen transactions
|
|
1134
|
+
and cycle gates into the log index and persisted build facts. The engine selects
|
|
1135
|
+
automatic kernel work before any verify action and after finalize post-steps when
|
|
1136
|
+
the target moves. `reconcile-restack.ts` shares collapse, detached replay,
|
|
1137
|
+
archive-before-replacement and expected-head publication mechanics. Automatic
|
|
1138
|
+
transactions emit `restack.*`; clean completion never starts a reconcile cycle.
|
|
1139
|
+
Pre-PR conflicts adopt the prepared replay through ordinary reconcile. Initial
|
|
1140
|
+
verification remains mandatory; waiting conflicts use post-reconcile policy.
|
|
1141
|
+
|
|
1142
|
+
The dispatcher observes targets without changing workspaces; execution ownership
|
|
1143
|
+
and session settlement fence mutation. Transaction targets stay frozen while
|
|
1144
|
+
later moves coalesce. `publication.requested` carries automatic transaction
|
|
1145
|
+
identity through trusted remote teardown and publication. The runner settles
|
|
1146
|
+
local resolver intent only after its session ends. Verification facts
|
|
1147
|
+
cite the cycle's base/head, and clean waiting rewrites preserve those results.
|
|
1148
|
+
Object packs retain newly introduced replay trees/blobs as well as commit bytes.
|
|
1149
|
+
|
|
1150
|
+
GitHub archive push/fresh-fetch and rewrite contracts are manual opt-in cases in
|
|
1151
|
+
`ports/forge/github.live.test.ts`, using `AB_RUN_LIVE_PORT_CONTRACTS=1` and an
|
|
1152
|
+
explicit disposable `AB_GITHUB_CONTRACT_REPO`. Offline transport tests are not
|
|
1153
|
+
live provider evidence.
|
|
1154
|
+
|
|
1155
|
+
### Descendant node restacking
|
|
1156
|
+
|
|
1157
|
+
`kernel/node-restack.ts` inventories the contribution above the durable previous
|
|
1158
|
+
base, proves foreign merge safety against the sampled parent's full identity set,
|
|
1159
|
+
and replays individual changes. `kernel/node-restack-state.ts` reduces writer
|
|
1160
|
+
reservations, ordered receipts, conflicts, publication intent, confirmed effects,
|
|
1161
|
+
and inventory. `kernel/node-restack-transaction.ts` retains replay objects and
|
|
1162
|
+
archives before expected-head publication. The dispatcher polls all open nodes,
|
|
1163
|
+
including empty nodes, and advances clean cascades without agent calls. Only the
|
|
1164
|
+
active conflicted item attaches a reconcile runner, using source-build artifacts
|
|
1165
|
+
materialized by the dispatcher into the integration owner's store scope.
|
|
1166
|
+
|
|
1167
|
+
`kernel/node-parent.ts` coordinates lifecycle-aware target mutations for CLI
|
|
1168
|
+
and operator requests. It canonicalizes source aliases, checks the latest build
|
|
1169
|
+
generation and proposed/effective/pending ancestry, and reserves a durable
|
|
1170
|
+
`node.parent-requested` before provider mutation. Claimed work targets stay frozen;
|
|
1171
|
+
a changed target requires abort and re-dispatch before any mixed patch is written.
|
|
1172
|
+
The dispatcher reads node tickets independently of readiness and activates a
|
|
1173
|
+
confirmed, revalidated request with `node.parent-accepted`. Provider edits use
|
|
1174
|
+
the same validation; refusals are deduplicated by revision, target and reason.
|
|
1175
|
+
Uncertain writes recover by source readback rather than replaying a caller patch.
|
|
1176
|
+
Tracker observation errors are contained within that observation, preserving
|
|
1177
|
+
ordinary cascade and PR handling against durable ancestry. Already accepted moves
|
|
1178
|
+
complete their PR effects without another tracker read. Rejection comparisons use
|
|
1179
|
+
revision, target and reason fields so JSONB key ordering cannot defeat deduplication;
|
|
1180
|
+
`node.parent-rejection-cleared` removes a current refusal after correction while
|
|
1181
|
+
preserving its history.
|
|
1182
|
+
|
|
1183
|
+
Accepted parent facts update node target/base projections while creation facts
|
|
1184
|
+
remain provenance. Pending requests and moves fence verification, child landing
|
|
1185
|
+
and source landing, and count against both parents' completeness. Existing writer
|
|
1186
|
+
reservations settle before activation. The existing replay transaction freezes the
|
|
1187
|
+
new destination and retains the old contribution boundary until completion, even
|
|
1188
|
+
for distinct parents at the same SHA. Afterwards the dispatcher retargets the same
|
|
1189
|
+
PR through the optional `Forge.retargetPr` capability, inspects its acknowledged
|
|
1190
|
+
base/head, records a receipt and completes the parent operation. GitHub uses the
|
|
1191
|
+
[documented PR update endpoint](https://docs.github.com/en/rest/pulls/pulls#update-a-pull-request)
|
|
1192
|
+
with a branch-name `base`. Publication and PR acknowledgement retry separately;
|
|
1193
|
+
terminal human PR changes keep their ordinary handling. Children retain the moved
|
|
1194
|
+
node's identity and branch, so the usual target observations cascade the move.
|
|
1195
|
+
|
|
1196
|
+
In origin mode, node plumbing uses the forge's trusted `kernelExec` transport.
|
|
1197
|
+
The GitHub adapter supplies its token through subprocess-only Git configuration,
|
|
1198
|
+
scoped to the repository's HTTPS URL; credentials are absent from argv, saved
|
|
1199
|
+
remote URLs, repository configuration and agent environments. Parent snapshots,
|
|
1200
|
+
archives and expected-head writes use this same transport. The dispatcher checks
|
|
1201
|
+
parent and node heads through the forge API before acquiring a repository: an
|
|
1202
|
+
unchanged inventory needs no clone or Git commands. A required temporary clone
|
|
1203
|
+
completes before the node writer lease is acquired, so download time cannot
|
|
1204
|
+
expire writer authority. Build sandbox publication retains its separate trusted
|
|
1205
|
+
receive-pack path.
|
|
1206
|
+
|
|
1207
|
+
`kernel/node-landing.ts` shares the node writer lease and reservation with
|
|
1208
|
+
restacking. It cancels native auto-merge, refreshes actual PR refs, proves the
|
|
1209
|
+
exact destination ungated and fast-forwards the canonical child commit under
|
|
1210
|
+
CAS. The destination write proves landing; provider PR reconciliation is
|
|
1211
|
+
best-effort and never decides or retries that write. Root landing retains squash
|
|
1212
|
+
semantics. Store adapters expose node writer claim, renewal and holder-checked
|
|
1213
|
+
release separately from execution leases; Postgres schema version 15 adds their
|
|
1214
|
+
columns. Reservations live in the event stream and survive lease expiry.
|
|
1215
|
+
|
|
1216
|
+
The contribution boundary advances only on completed restacks. Reachable build
|
|
1217
|
+
identities include inherited parent changes; foreign counts include only the
|
|
1218
|
+
node's own contribution, preventing a parent rewrite from inflating descendants'
|
|
1219
|
+
foreign inventory. Status text and JSON expose both inventory and active items.
|
|
1220
|
+
|
|
1221
|
+
|
|
1222
|
+
Integration completion is sampled by `kernel/integration-completeness.ts` from
|
|
1223
|
+
exhaustive source listings, frozen claims and retained contribution identities.
|
|
1224
|
+
`integration.*` events retain observations, immutable cycle inputs, landing
|
|
1225
|
+
intents, provenance and tree audits. The build reducer projects these facts and
|
|
1226
|
+
`engine.ts` routes nodes directly through verification, without producer phases.
|
|
1227
|
+
Failed cycles park for repair children. The dispatcher temporarily provisions
|
|
1228
|
+
verification resources and rechecks head, parent, controls and completeness
|
|
1229
|
+
before publication. `integration-landing.ts` owns source-reserved root landing
|
|
1230
|
+
and immutable result audits; nested nodes use the destination writer transaction
|
|
1231
|
+
in `node-landing.ts`. GitHub uses guarded PR rebase; local-git uses an ancestry
|
|
1232
|
+
proof and exact-parent fast-forward. Shared status vocabulary exposes provenance
|
|
1233
|
+
and mismatch attention in both frontends. Human forge merges remain observable
|
|
1234
|
+
escape hatches independent of completeness and verification.
|
|
1235
|
+
|
|
1236
|
+
### Landing authorization
|
|
1237
|
+
|
|
1238
|
+
The pure evaluator in `kernel/landing-policy.ts` chooses the first matching
|
|
1239
|
+
`[[landing]]` rule. `kernel/landing-state.ts` reduces immutable candidate
|
|
1240
|
+
decisions and persistent hold/land commands. The dispatcher owns readiness,
|
|
1241
|
+
ticket label sampling and native-state convergence. `kernel/landing-publication.ts`
|
|
1242
|
+
confirms native cancellation at local and trusted remote head-publication seams.
|
|
1243
|
+
Node landings retain the existing writer serialization and gate proof.
|
|
Binary file
|