@defrex/autobuild 1.0.0-beta.3 → 1.0.0-beta.4
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/SPEC.md +317 -20
- package/bin/ab-dispatch-generation.ts +93 -0
- package/docs/answering-blocked-builds.md +21 -3
- package/docs/architecture.md +166 -7
- package/docs/configuration.md +173 -5
- package/docs/integration-tree.md +87 -2
- package/docs/integration.md +54 -0
- package/docs/operator-api.md +58 -5
- package/docs/remote-store-protocol.md +4 -1
- package/docs/restacking.md +4 -1
- package/docs/setup.md +20 -0
- package/docs/spec-standard.md +23 -5
- package/package.json +3 -3
- package/packages/core/src/cli/artifact.ts +5 -4
- package/packages/core/src/cli/attention.ts +2 -0
- package/packages/core/src/cli/binary-direct.ts +190 -0
- package/packages/core/src/cli/binary-lifecycle.ts +46 -0
- package/packages/core/src/cli/binary.ts +24 -210
- package/packages/core/src/cli/build-control.ts +105 -2
- package/packages/core/src/cli/context.ts +41 -1
- package/packages/core/src/cli/dashboard/hand-pushed.ts +24 -0
- package/packages/core/src/cli/dashboard/handoff.ts +64 -0
- package/packages/core/src/cli/dashboard/integration-detail.ts +3 -0
- package/packages/core/src/cli/dashboard/model.ts +34 -10
- package/packages/core/src/cli/dashboard/render.ts +24 -2
- package/packages/core/src/cli/dashboard/rollback.ts +30 -0
- package/packages/core/src/cli/dispatch-args.ts +53 -0
- package/packages/core/src/cli/dispatch-crash-budget.ts +15 -0
- package/packages/core/src/cli/dispatch-frontend.ts +52 -5
- package/packages/core/src/cli/dispatch-handoff.ts +276 -0
- package/packages/core/src/cli/dispatch-launch-contract.ts +170 -0
- package/packages/core/src/cli/dispatch-launcher.ts +580 -0
- package/packages/core/src/cli/dispatch-parent-watch.ts +44 -0
- package/packages/core/src/cli/dispatch-preflight.ts +272 -0
- package/packages/core/src/cli/dispatch-presentation-job.ts +46 -0
- package/packages/core/src/cli/dispatch-presentation-ownership.ts +9 -0
- package/packages/core/src/cli/dispatch-process.ts +22 -90
- package/packages/core/src/cli/dispatch-readiness.ts +47 -0
- package/packages/core/src/cli/dispatch-repository-feed.ts +5 -1
- package/packages/core/src/cli/dispatch-runtime-cache.ts +522 -0
- package/packages/core/src/cli/dispatch-runtime-dependencies.ts +291 -0
- package/packages/core/src/cli/dispatch-runtime-use.ts +336 -0
- package/packages/core/src/cli/dispatch-upgrade-controller.ts +221 -0
- package/packages/core/src/cli/dispatch-upgrade-install.ts +258 -0
- package/packages/core/src/cli/dispatch-upgrade-source.ts +309 -0
- package/packages/core/src/cli/dispatch-upgrade-target.ts +190 -0
- package/packages/core/src/cli/dispatch.ts +604 -60
- package/packages/core/src/cli/dispatcher-liveness.ts +1 -1
- package/packages/core/src/cli/harvest.ts +28 -11
- package/packages/core/src/cli/help.ts +6 -3
- package/packages/core/src/cli/installation.ts +5 -3
- package/packages/core/src/cli/main-checkout.ts +59 -0
- package/packages/core/src/cli/main.ts +15 -45
- package/packages/core/src/cli/node-verification-provenance.ts +97 -0
- package/packages/core/src/cli/repo-state.ts +3 -58
- package/packages/core/src/cli/repository-status.ts +67 -3
- package/packages/core/src/cli/runtime-spawn.ts +16 -0
- package/packages/core/src/cli/status.ts +57 -3
- package/packages/core/src/cli/upgrade-followup.ts +25 -0
- package/packages/core/src/cli/wait.ts +3 -0
- package/packages/core/src/cli/watch.ts +7 -0
- package/packages/core/src/config/live.ts +1 -0
- package/packages/core/src/config/schema.ts +8 -4
- package/packages/core/src/distribution-packaging.ts +116 -0
- package/packages/core/src/events/catalog.ts +6 -0
- package/packages/core/src/events/payloads.ts +53 -9
- package/packages/core/src/events/policy.ts +25 -0
- package/packages/core/src/events/repository.ts +184 -4
- package/packages/core/src/events/runtime.ts +16 -0
- package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +2515 -78
- package/packages/core/src/kernel/dispatch-drain-recovery.ts +121 -0
- package/packages/core/src/kernel/dispatch-status.ts +4 -2
- package/packages/core/src/kernel/dispatch-upgrade.ts +171 -0
- package/packages/core/src/kernel/dispatcher-liveness.ts +7 -0
- package/packages/core/src/kernel/generators/repository-journals.ts +82 -0
- package/packages/core/src/kernel/guarded-forge.ts +1 -1
- package/packages/core/src/kernel/harvest.ts +98 -4
- package/packages/core/src/kernel/integration-attention.ts +20 -0
- package/packages/core/src/kernel/integration-state.ts +80 -11
- package/packages/core/src/kernel/landing-readiness.ts +6 -1
- package/packages/core/src/kernel/mixed-version.ts +34 -0
- package/packages/core/src/kernel/node-polling.ts +160 -0
- package/packages/core/src/kernel/read-facts.ts +40 -5
- package/packages/core/src/kernel/reducer-registry.ts +3 -0
- package/packages/core/src/kernel/reducer.ts +75 -14
- package/packages/core/src/kernel/service-facts.ts +11 -4
- package/packages/core/src/operator/presentation.ts +7 -0
- package/packages/core/src/operator/query.ts +6 -2
- package/packages/core/src/operator/registry.ts +1 -1
- package/packages/core/src/plugins/load.ts +4 -1
- package/packages/core/src/plugins/runtime-snapshot.ts +128 -0
- package/packages/core/src/ports/forge/contract.ts +29 -0
- package/packages/core/src/ports/forge/github.ts +189 -61
- package/packages/core/src/ports/forge-failure.ts +1 -0
- package/packages/core/src/ports/forge-telemetry.ts +3 -0
- package/packages/core/src/ports/runner/session-env.ts +1 -0
- package/packages/core/src/ports/types.ts +10 -0
- package/packages/core/src/ports/workspace/distribution-archive.ts +22 -149
- package/packages/core/src/ports/workspace/distribution-release.ts +56 -0
- package/packages/core/src/ports/workspace/git-worktree.ts +2 -1
- package/packages/core/src/ports/workspace/local-build-execution.ts +37 -17
- package/packages/core/src/processes/build-child-exit.ts +5 -26
- package/packages/core/src/processes/build-runner.ts +81 -11
- package/packages/core/src/processes/dispatcher.ts +254 -23
- package/packages/core/src/processes/execution-no-progress.ts +6 -0
- package/packages/core/src/processes/execution-relaunch.ts +30 -0
- package/packages/core/src/processes/execution-settlement.ts +16 -7
- package/packages/core/src/processes/harvest-runner.ts +328 -292
- package/packages/core/src/processes/process-group-reaper.ts +17 -10
- package/packages/core/src/runtime-identity.ts +22 -3
- package/packages/core/src/store/contract.ts +153 -0
- package/packages/core/src/store/local/store.ts +197 -72
- package/packages/core/src/store/reduced-reads.ts +8 -0
- package/packages/core/src/store/reducer-value-shapes.json +5783 -3305
- package/packages/core/src/store/remote/client.ts +43 -0
- package/packages/core/src/store/repo-state-events.ts +20 -3
- package/packages/core/src/store/types.ts +7 -0
- package/skills/guide/SKILL.md +231 -23
- package/skills/guide/references/integration-tree.md +87 -2
- package/skills/guide/references/operator-api.md +53 -4
- package/skills/guide/references/plugin-authoring.md +45 -4
- package/skills/guide/references/remote-store-protocol.md +4 -1
- package/skills/guide/references/restacking.md +4 -1
- package/skills/guide/references/setup.md +20 -0
- package/skills/guide/references/spec-standard.md +23 -5
- package/skills/harvest/SKILL.md +4 -0
- package/skills/harvest-review/SKILL.md +4 -0
- package/skills/operate/SKILL.md +78 -8
- package/skills/spec/SKILL.md +19 -1
- package/skills/tickets/SKILL.md +19 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Iterating inside an integration node
|
|
2
|
+
|
|
3
|
+
A node collects related work into one finite delivery to its parent. Write its
|
|
4
|
+
ticket as a charter: why the integration matters, what observable conditions
|
|
5
|
+
make the whole done, and where and how it lands under the repository's effective
|
|
6
|
+
landing policy. Keep the usual spec sections: what and why, checkable acceptance
|
|
7
|
+
criteria, out of scope, and evidence. Put evolving feature specifics in children.
|
|
8
|
+
|
|
9
|
+
For example, a charter can aim for a coherent account-management flow, complete
|
|
10
|
+
when account settings and closure work together and pass integration verification.
|
|
11
|
+
Child tickets define the detailed behavior of those flows.
|
|
12
|
+
|
|
13
|
+
Create the node and children with ids returned by your ticket source:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
ab ticket create "Account management" --body charter.md --kind node
|
|
17
|
+
ab ticket create "Account settings" --body settings.md --target <node-id>
|
|
18
|
+
ab ticket tree
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
While the node is open, add more spec-standard children as needed. Each ordinary
|
|
22
|
+
child runs its normal pipeline. Node verification uses contribution provenance
|
|
23
|
+
to judge ordinary changes against either the current event-authorized node
|
|
24
|
+
charter or the introducing child's spec. Each child need not be independently
|
|
25
|
+
promised by the charter.
|
|
26
|
+
|
|
27
|
+
For small maintainer-authorized tweaks, push to the node's recorded branch with
|
|
28
|
+
meaningful commit messages explaining intent. Verification reads the owned
|
|
29
|
+
hand-pushed commit messages in the frozen range and judges quality and
|
|
30
|
+
consistency; it cannot fail a tweak solely for lacking a covering spec.
|
|
31
|
+
Phase agents still follow their own publication boundaries.
|
|
32
|
+
|
|
33
|
+
When the charter itself changes, explicitly revise the active build:
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
ab answer <node> --revise-spec replacement.md
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Alternatively, amend the ticket, then run
|
|
40
|
+
`ab answer <node> --revise-spec-from-ticket`. Editing the ticket alone does not
|
|
41
|
+
revise the build. Eligible idle collecting or verification-failed nodes recollect
|
|
42
|
+
and verify the replacement revision, even on the same head and parent after a
|
|
43
|
+
failed cycle. Children retain their specs, claims and targets.
|
|
44
|
+
|
|
45
|
+
Open children, including triage, backlog and ready tickets, keep the node
|
|
46
|
+
incomplete. Once complete, the node must pass verification on its exact head and
|
|
47
|
+
parent and satisfy its configured landing gates. Landing completes the node and
|
|
48
|
+
closes admission; use a new node for a later delivery. Consent requirements depend
|
|
49
|
+
on the effective policy.
|
|
50
|
+
|
|
51
|
+
See [integration trees](integration-tree.md#collect-verify-and-land) for provenance
|
|
52
|
+
and completion details, [revision restrictions](integration-tree.md#operator-node-spec-revisions)
|
|
53
|
+
for when a replacement is accepted, and [landing policy](landing-policy.md) for
|
|
54
|
+
landing and consent rules.
|
package/docs/operator-api.md
CHANGED
|
@@ -81,8 +81,8 @@ turn runner (a later ticket) is the only producer of turn facts.
|
|
|
81
81
|
| Method and path | Result |
|
|
82
82
|
|---|---|
|
|
83
83
|
| `GET …/builds?scope=active\|queued\|all` | Build summaries, newest update first. `queued` means active plus queued, matching `ab builds --queued`. |
|
|
84
|
-
| `GET …/builds/{slug}` | `{detail, dashboardRow}`; `dashboardRow` remains a `CLEANING` row after `build.aborted` and becomes `null` only when the dashboard stops listing it (after cleanup's `build.completed`). |
|
|
85
|
-
| `GET …/dashboard` | `{generatedAt, model, settingsHeader}`. `model` is the dashboard's rows, steps, elapsed timing inputs, harvest row, queue/capacity and settings projection. |
|
|
84
|
+
| `GET …/builds/{slug}` | `{detail, dashboardRow}`; `detail.runnerAttaches` records chronological attach boundaries and their runtime identity (version, commit, source kind/location), with null runtime for unrecorded historical attaches; `dashboardRow` remains a `CLEANING` row after `build.aborted` and becomes `null` only when the dashboard stops listing it (after cleanup's `build.completed`). |
|
|
85
|
+
| `GET …/dashboard` | `{generatedAt, model, settingsHeader}`. `model` is the dashboard's rows, steps, elapsed timing inputs, harvest row, queue/capacity and settings projection. Optional `rollback` contains `correlation`, `lineage`, full `failed` and `restored` runtime identities and rollback event `ts` for the authoritative dispatcher lineage’s unresolved hold. Both dashboards name failed, restored and held runtime plus timestamp. Matching durable different-target hold clearance removes it; a fresh operator lineage hides it only after a committed operational tick or accepted takeover. Run-started and yielded ticks alone cannot replace authority; same-lineage generations retain the notice. Historical rollback records are not fallback notices. Optional `handoffs` lists all accepted unfinished handoffs with predecessor `run`, optional `successor`, `correlation`, full `from`/`to` runtimes, `mode` and optional `deadline`. Outstanding drain-mode builds carry `draining: true`, also on build-detail `dashboardRow`; matching settlement removes it. Accepted completion removes the handoff; neither takeover nor the clock does. Missing historical mode means cutover and missing deadline displays unknown. |
|
|
86
86
|
| `GET …/status` | Repository intake, pause, and default-auto-merge projection. |
|
|
87
87
|
| `GET …/harvest/status` | Harvest gate, runs, steps, recovery, and attention projection. |
|
|
88
88
|
| `GET …/builds/{slug}/artifacts/{kind}?rev=N` | Raw bytes (`application/octet-stream`) plus content-disposition and `X-Autobuild-Artifact-*` metadata headers. Omit `rev` for latest. |
|
|
@@ -146,6 +146,24 @@ revision, a trusted caller fetches the current ticket body and supplies it; the
|
|
|
146
146
|
build must still have a recorded ticket. Revision conformance, lazy retry,
|
|
147
147
|
artifact metadata, event ordering, and refusal rules are the same as the CLI.
|
|
148
148
|
|
|
149
|
+
Operators may explicitly revise an opened idle collecting node or a node blocked on failed
|
|
150
|
+
integration verification without an escalation. Use
|
|
151
|
+
`ab answer <node> --revise-spec replacement.md` or, after amending its ticket,
|
|
152
|
+
`ab answer <node> --revise-spec-from-ticket`. Ticket edits alone do not revise
|
|
153
|
+
the build. Both forms enforce the same spec standard as leaf revisions.
|
|
154
|
+
Each kernel `spec.revised` records the exact artifact and operator identity
|
|
155
|
+
(with optional transport provenance); earlier revisions remain readable.
|
|
156
|
+
Ticket-origin revisions re-pin assets; supplied bodies preserve asset pins.
|
|
157
|
+
The node recollects and verifies the new revision, including on the same head
|
|
158
|
+
and parent after a failed cycle. Earlier cycles remain historical evidence
|
|
159
|
+
and cannot block or authorize landing under the replacement. Children keep
|
|
160
|
+
their specs, claims and targets; contributions are not restarted.
|
|
161
|
+
Active verification/reconcile or writer work, restack/reparent work, pause,
|
|
162
|
+
pending controls, landing intent and ended PRs refuse the no-escalation path.
|
|
163
|
+
A concurrent state change refuses publication with a retry explanation;
|
|
164
|
+
uncited artifacts are inert. Leaves still require an open escalation and
|
|
165
|
+
restart from `plan`.
|
|
166
|
+
|
|
149
167
|
## The registry's protocol face: `POST …/tools/{tool}`
|
|
150
168
|
|
|
151
169
|
One generic route executes any entry of the agent tool registry (the same
|
|
@@ -220,7 +238,8 @@ event reads.
|
|
|
220
238
|
|
|
221
239
|
Dispatcher liveness is also visible through `ab repository status --json`:
|
|
222
240
|
`dispatcher.holder` identifies the unexpired repository lease owner, independently
|
|
223
|
-
of `latestRun`.
|
|
241
|
+
of `latestRun`. Each run includes its recorded `runtime` (version, commit, and
|
|
242
|
+
source kind/location), or null for unrecorded historical starts. Heartbeat age measures attributable renewals; tick age measures
|
|
224
243
|
durable progress. Missing historical evidence is null. The liveness query uses
|
|
225
244
|
bounded repository facts first, with a full-history fallback when a later
|
|
226
245
|
invocation hides the holder start or the latest stop. Other state reads retain
|
|
@@ -238,6 +257,8 @@ record the first signal in the stop fact, and release its lease before exit.
|
|
|
238
257
|
|
|
239
258
|
The default watch reports actionable conditions only:
|
|
240
259
|
|
|
260
|
+
- `integration.verification-failed`: failed node verification, once per prepared cycle, with failed steps, verified head and parent, and guidance to file a repair child targeting the node. Recovery reports only the latest prepared cycle while its head and parent remain current; superseded failures are not backfilled.
|
|
261
|
+
|
|
241
262
|
- `build.janitor-failing`: a build has reached the configured consecutive-failure threshold; a successful janitor attempt clears it.
|
|
242
263
|
- `dispatcher.forge-persistent`: forge degradation remains after a completed post-reset retry opportunity; successful recovery clears it.
|
|
243
264
|
|
|
@@ -250,7 +271,7 @@ The default watch reports actionable conditions only:
|
|
|
250
271
|
build/PR; it does not duplicate consent or hold attention.
|
|
251
272
|
- Repository `harvest.escalated`, `harvest.recovery-exhausted`,
|
|
252
273
|
`dispatcher.config-rejected`, `dispatcher.config-reloaded` with nonempty
|
|
253
|
-
`restartRequired`, abnormal `dispatcher.run-stopped`, and `dispatcher.lost`.
|
|
274
|
+
`restartRequired`, `dispatcher.upgrade-failed`, `dispatcher.runtime-rolled-back`, abnormal `dispatcher.run-stopped`, and `dispatcher.lost`.
|
|
254
275
|
- `dispatcher.ticket-source-persistent`: degradation past its advertised
|
|
255
276
|
reset time, once a tick started at or after reset has completed or failed
|
|
256
277
|
with the episode still open; crossing reset alone is silent. Without a reset,
|
|
@@ -287,7 +308,9 @@ arming the watch. Named watches still end when every named build is terminal;
|
|
|
287
308
|
learn their outcomes from status reconciliation at exit.
|
|
288
309
|
|
|
289
310
|
`ab wait --for attention` is build-only and uses the same build conditions:
|
|
290
|
-
|
|
311
|
+
current failed node verification, an open escalation, janitor failure attention,
|
|
312
|
+
consent readiness, landing/conflict attention or a merge decision. Current failed
|
|
313
|
+
verification satisfies attention even before its notification is written. Existing conditions return immediately,
|
|
291
314
|
even with `--since`; live and backlog matches ignore routine outcomes and
|
|
292
315
|
self-healing failures. A merge match uses the watch observation with
|
|
293
316
|
`condition: "attention"`. Explicit `--event` globs remain event-only.
|
|
@@ -320,3 +343,33 @@ the original reset, which later rate limits cannot postpone indefinitely.
|
|
|
320
343
|
uses the same service as `ab restack <node>`. The receipt contains `slug`,
|
|
321
344
|
`request`, `coalesced` and `waiting`; execution is asynchronous. It refuses
|
|
322
345
|
non-node, unopened and terminal builds and enforces repository ownership.
|
|
346
|
+
|
|
347
|
+
Repository status includes `upgrades.runs`, keyed by originating dispatcher run,
|
|
348
|
+
with latest successful `resolved` target, detected target, failure, handoff and
|
|
349
|
+
completion evidence. `dispatcher.upgrade-target-resolved` carries strict
|
|
350
|
+
`{run, lineage, target}` data; the target has mode (`pinned`, `installed`, or
|
|
351
|
+
`source`), content key, source provenance and optional version/base/SHA. Source
|
|
352
|
+
mode names the authoritative base commit, which can advance without changing
|
|
353
|
+
packaged inputs or the running runtime. Status text renders the resolved mode,
|
|
354
|
+
base and SHA separately, so an older handoff cannot hide a newer target. Identical
|
|
355
|
+
observations append nothing; a successful resolution does not clear failures. Facts carry launcher
|
|
356
|
+
lineage, from/to runtimes, resolution mode and authoritative base SHA/ref or original
|
|
357
|
+
installation provenance, plus prepared cache identity. Completion names the successor
|
|
358
|
+
and records completed retirement separately from takeover. During a handoff the
|
|
359
|
+
projection includes both generations, chosen mode, outstanding draining builds
|
|
360
|
+
and deadline. The successor owns repository work after terminal release and lease
|
|
361
|
+
claim, while old local runners retain execution leases until settlement or deadline.
|
|
362
|
+
Remote guests retain independent leases, finish their phase and request neutral
|
|
363
|
+
relaunch; their separate handoff capture never holds retirement open. `dispatcher.upgrade-failed` is immediate repository
|
|
364
|
+
attention; the current generation remains active and identical failed inputs are
|
|
365
|
+
suppressed across native handoff until target or selected-store compatibility evidence changes or a fresh operator launch.
|
|
366
|
+
|
|
367
|
+
Repository status additionally exposes `upgrades.lastRollback` (historical, retained
|
|
368
|
+
when cleared), `upgrades.holds` keyed by launcher lineage, `upgrades.lineages` keyed
|
|
369
|
+
by generation run, optional `upgrades.authoritativeRun` from rollback, accepted takeover or committed operational tick (never startup/yield alone), `upgrades.rollbackIds` for idempotent rollback correlations, and `rollbackHold` for the effective dispatcher lineage.
|
|
370
|
+
`dispatcher.runtime-rolled-back` names failed/restored runtime identities and cache
|
|
371
|
+
roots, target, original handoff/takeover, three failed exits and reason. It is default
|
|
372
|
+
repository attention. `dispatcher.rollback-hold-cleared` records a different
|
|
373
|
+
successfully resolved target. The rollback hold survives store compatibility
|
|
374
|
+
changes, resolution errors and upgrade opt-out; a new operator-launch lineage
|
|
375
|
+
ignores old holds. Preflight failure suppression above remains separate.
|
|
@@ -497,7 +497,7 @@ without a journal record, or a repository without builds.
|
|
|
497
497
|
| `getRepo` | `GET /repos/{repo}` | none | `200` + `RepositoryRecord`; absent is `404` (the shipped client maps this to `null`) |
|
|
498
498
|
| `appendRepo` | `POST /repos/{repo}/events` | event write | `201` + repository event envelope |
|
|
499
499
|
| `getRepoEvents` | `GET /repos/{repo}/events?since={n}&wait={s}` | optional `since` query value, parsed as in section 3; absence defaults to `0`. Optional `wait` in whole seconds, per the event-wait rules of section 3 | `200` + envelopes with `seq >` parsed `since`, in increasing sequence order |
|
|
500
|
-
| `getRepoStateEvents` | `GET /repos/{repo}/state-events` | none | `200` + the bounded repository-journal subset (AUT-489): every durable event type (`harvest.*`, `orchestrator.sandbox.*`, the three dispatcher setting types) plus, when the journal has one, the tail from the latest `dispatcher.run-started`, in increasing sequence order; served inside the repository-existence gate like `GET events`, so an unknown repository is `404` |
|
|
500
|
+
| `getRepoStateEvents` | `GET /repos/{repo}/state-events` | none | `200` + the bounded repository-journal subset (AUT-489): every durable event type (`harvest.*`, `orchestrator.sandbox.*`, the three dispatcher setting types, and cross-generation handoff correlation facts: target-prepared, yield-requested, upgrade-failed, handoff-started, terminal-released, takeover, drain-deadline, drain-settled and handoff-completed) plus, when the journal has one, the tail from the latest `dispatcher.run-started`, in increasing sequence order; served inside the repository-existence gate like `GET events`, so an unknown repository is `404` |
|
|
501
501
|
| `getReducerSnapshot` (repo scope) | `GET /repos/{repo}/snapshots/{reducer}?version={n}` | required `version` query value, a positive integer; `reducer` is a registry name (`^[A-Za-z][A-Za-z0-9._-]{0,63}$`) | `200` + `{"version", "cursor", "state"}` or `200 null` when absent, written by another reducer version, ahead of the journal's tail, or the repository has no journal record; an unknown repository is `404`, which the shipped client also maps to `null` |
|
|
502
502
|
| `putReducerSnapshot` (repo scope) | `PUT /repos/{repo}/snapshots/{reducer}` | `{"version": int >= 1, "cursor": int >= 0, "state": JSON}`, at most 16 MiB (`413` above) | `200 {"written": boolean}`; the stored cursor never decreases, so a write at an equal or lower cursor (or an equal cursor at an equal or lower version) and one past the journal's tail answer `written: false` |
|
|
503
503
|
| `appendRepoWithArtifacts` | `POST /repos/{repo}/deposits` | atomic deposit request | `201` + `{event, artifacts}` using repository shapes |
|
|
@@ -1006,6 +1006,9 @@ Build grants live until 60 seconds after durable build termination. Phase grants
|
|
|
1006
1006
|
also retire 60 seconds after their own session ends, whichever comes first.
|
|
1007
1007
|
Harvest grants retire 60 seconds after their run stops or their authorized
|
|
1008
1008
|
execution ends/releases; harvest phases additionally retire on session end.
|
|
1009
|
+
Durable harvest suspension immediately closes the phase grant, without a grace interval.
|
|
1010
|
+
A resumed local harvest turn opens a new bracket and receives fresh credentials;
|
|
1011
|
+
the predecessor grant stays closed.
|
|
1009
1012
|
The boundary is exclusive: at `end + 60_000ms` the credential is refused. This
|
|
1010
1013
|
window permits final transcripts, diagnostics, deposits and stream closure.
|
|
1011
1014
|
Pause/escalation of a build and lease expiry do not end authority. Active grants
|
package/docs/restacking.md
CHANGED
|
@@ -33,6 +33,9 @@ need their own demand. Existing frozen transactions, including ones reserved
|
|
|
33
33
|
before upgrade, finish first; later demand coalesces onto the latest parent.
|
|
34
34
|
Leaves keep verify-entry and awaiting-landing restacks for every target.
|
|
35
35
|
|
|
36
|
+
For observation cadence, durable wakes and last-check evidence, see
|
|
37
|
+
[node polling and status](integration-tree.md#polling-and-status).
|
|
38
|
+
|
|
36
39
|
Presence demand uses change identities, never ticket resolution alone. It follows
|
|
37
40
|
only the path from the nearest proven ancestor source down to the dependent's
|
|
38
41
|
actual destination, processing ancestors first. Unrelated siblings stay idle;
|
|
@@ -82,7 +85,7 @@ archives, changes and merge proofs. Lease expiry recovers the same operation,
|
|
|
82
85
|
not a competing one. Prepared/conflicted/replayed item receipts, publication
|
|
83
86
|
intent, proven replacement and settlement distinguish each recovery boundary.
|
|
84
87
|
Inventory retains its sampled source boundary even while the confirmed parent
|
|
85
|
-
boundary stays unchanged. It exposes source identities, node-owned foreign commits, active operation,
|
|
88
|
+
boundary stays unchanged. It exposes source identities, hand-pushed changes (node-owned foreign commits), active operation,
|
|
86
89
|
conflict item and unsafe merge evidence.
|
|
87
90
|
|
|
88
91
|
Only a conflicted item attaches a reconcile runner. It receives the original
|
package/docs/setup.md
CHANGED
|
@@ -222,6 +222,18 @@ requires a published release.
|
|
|
222
222
|
|
|
223
223
|
### Guest distribution version selection and delivery
|
|
224
224
|
|
|
225
|
+
Cached generations retain explicit archive provenance. A registry generation
|
|
226
|
+
resolves its manifest version’s GitHub release asset on first guest use, validates
|
|
227
|
+
version and digest, and atomically caches it separately from the host archive.
|
|
228
|
+
Local launch requires no GitHub fetch. Isolated and hoisted Bun installations
|
|
229
|
+
retain registry provenance through store-path or lock evidence. Source, Git and local package
|
|
230
|
+
generations deliver their exact packed code. Missing or invalid release assets
|
|
231
|
+
fail guest delivery and remain retryable, without falling back to packing the
|
|
232
|
+
registry installation.
|
|
233
|
+
Remote guests finish their phase before requesting relaunch; re-attachment
|
|
234
|
+
refreshes the archive and marker before the next runner starts. They retain
|
|
235
|
+
independent leases and never hold local retirement open.
|
|
236
|
+
|
|
225
237
|
The guest's distribution version is selected by the archive source, and both
|
|
226
238
|
sources agree with the running system by construction:
|
|
227
239
|
|
|
@@ -400,6 +412,14 @@ Its session instructions must preserve this contract:
|
|
|
400
412
|
|
|
401
413
|
1. Run `ab context`. The verifier receives `.ab/spec.md`, the configured step,
|
|
402
414
|
the commit range, and, after escalation is answered, `.ab/guidance.json`.
|
|
415
|
+
Node verify sessions also receive `nodeVerification` in the context manifest:
|
|
416
|
+
contribution specs and a provenance index mapping commits to the builds that
|
|
417
|
+
introduced them. Read those specs through the manifest's allocated paths.
|
|
418
|
+
Also read `handPushedCommits: [{sha, originalSha, message}]` from the manifest
|
|
419
|
+
and index. These hand-pushed node commit messages express maintainer-authorized
|
|
420
|
+
intent; judge quality and consistency, and never fail them solely for lacking
|
|
421
|
+
a covering spec. Other node changes are authorized when the node spec or the introducing
|
|
422
|
+
contribution's spec covers it; use the commit index to find that spec.
|
|
403
423
|
2. Exercise each applicable acceptance criterion through the repository's real
|
|
404
424
|
application lifecycle. Prefer the narrowest honest flow that catches a
|
|
405
425
|
regression.
|
package/docs/spec-standard.md
CHANGED
|
@@ -127,8 +127,26 @@ order.
|
|
|
127
127
|
|
|
128
128
|
## Immutability during a build
|
|
129
129
|
|
|
130
|
-
The spec is the build's contract artifact (kind `spec`, revision 0).
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
and the
|
|
130
|
+
The spec is the build's contract artifact (kind `spec`, revision 0).
|
|
131
|
+
Every downstream reviewer approves conformance to its pinned revision.
|
|
132
|
+
For leaves, a phase that discovers the spec itself is wrong raises an
|
|
133
|
+
escalation (`ab escalate`); a human answers, the spec gets revision N+1,
|
|
134
|
+
and the leaf restarts from `plan`.
|
|
135
|
+
|
|
136
|
+
Operators may explicitly revise an opened idle collecting node or a node blocked on failed
|
|
137
|
+
integration verification without an escalation. Use
|
|
138
|
+
`ab answer <node> --revise-spec replacement.md` or, after amending its ticket,
|
|
139
|
+
`ab answer <node> --revise-spec-from-ticket`. Ticket edits alone do not revise
|
|
140
|
+
the build. Both forms enforce the same spec standard as leaf revisions.
|
|
141
|
+
Each kernel `spec.revised` records the exact artifact and operator identity
|
|
142
|
+
(with optional transport provenance); earlier revisions remain readable.
|
|
143
|
+
Ticket-origin revisions re-pin assets; supplied bodies preserve asset pins.
|
|
144
|
+
The node recollects and verifies the new revision, including on the same head
|
|
145
|
+
and parent after a failed cycle. Earlier cycles remain historical evidence
|
|
146
|
+
and cannot block or authorize landing under the replacement. Children keep
|
|
147
|
+
their specs, claims and targets; contributions are not restarted.
|
|
148
|
+
Active verification/reconcile or writer work, restack/reparent work, pause,
|
|
149
|
+
pending controls, landing intent and ended PRs refuse the no-escalation path.
|
|
150
|
+
A concurrent state change refuses publication with a retry explanation;
|
|
151
|
+
uncited artifacts are inert. Leaves still require an open escalation and
|
|
152
|
+
restart from `plan`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defrex/autobuild",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.4",
|
|
4
4
|
"description": "Agent-driven software delivery from groomed ticket to merged PR",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -144,8 +144,8 @@
|
|
|
144
144
|
},
|
|
145
145
|
"devDependencies": {
|
|
146
146
|
"@biomejs/biome": "2.5.5",
|
|
147
|
-
"@defrex/autobuild-postgres-store": "1.0.0-beta.
|
|
148
|
-
"@defrex/autobuild-vercel-sandbox": "1.0.0-beta.
|
|
147
|
+
"@defrex/autobuild-postgres-store": "1.0.0-beta.4",
|
|
148
|
+
"@defrex/autobuild-vercel-sandbox": "1.0.0-beta.4",
|
|
149
149
|
"@resvg/resvg-js": "2.6.2",
|
|
150
150
|
"@types/bun": "^1.3.14",
|
|
151
151
|
"@types/node": "^24.0.0",
|
|
@@ -55,16 +55,17 @@ export async function artifactPut(
|
|
|
55
55
|
if (kind.trim() === '') {
|
|
56
56
|
throw new Error("'ab artifact put' requires a non-empty <kind> (§8.2)")
|
|
57
57
|
}
|
|
58
|
-
// §6.3
|
|
58
|
+
// §6.3: phase agents cannot change the spec during a build. It enters via
|
|
59
59
|
// dispatch (spec.imported / spec.authored — dispatcher plumbing, never this
|
|
60
|
-
// CLI) and changes only through
|
|
60
|
+
// CLI) and changes only through operator ab answer (spec.revised).
|
|
61
61
|
// Without this gate, any phase's agent could silently swap the contract
|
|
62
62
|
// every later reviewer approves conformance to.
|
|
63
63
|
if (kind === 'spec') {
|
|
64
64
|
throw new Error(
|
|
65
|
-
"'ab artifact put spec' is rejected: the spec is immutable during a build " +
|
|
65
|
+
"'ab artifact put spec' is rejected: the spec is immutable to phase agents during a build " +
|
|
66
66
|
'(§6.3) — a phase that finds the spec itself wrong should raise ' +
|
|
67
|
-
"'ab escalate' so a human can revise it
|
|
67
|
+
"'ab escalate' so a human can revise it. Leaf revisions require an escalation and restart from plan; " +
|
|
68
|
+
'operators may revise idle collecting or verification-failed nodes through ab answer without an escalation.',
|
|
68
69
|
)
|
|
69
70
|
}
|
|
70
71
|
const file = Bun.file(filePath)
|
|
@@ -57,6 +57,8 @@ export function repositoryNeedsAttention(event: RepositoryEvent): boolean {
|
|
|
57
57
|
case 'harvest.recovery-exhausted':
|
|
58
58
|
case 'dispatcher.forge-readiness-failed':
|
|
59
59
|
case 'dispatcher.config-rejected':
|
|
60
|
+
case 'dispatcher.runtime-rolled-back':
|
|
61
|
+
case 'dispatcher.upgrade-failed':
|
|
60
62
|
return true
|
|
61
63
|
case 'dispatcher.config-reloaded':
|
|
62
64
|
return event.payload.restartRequired.length > 0
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { ownsDispatchPresentation } from './dispatch-presentation-ownership'
|
|
2
|
+
import { guardForge } from '../kernel/guarded-forge'
|
|
3
|
+
import { scopeLocalStoreToPhaseSession } from '../store/phase-session'
|
|
4
|
+
import { openProductionStore } from './store-opening'
|
|
5
|
+
/**
|
|
6
|
+
* Shared wiring for the `ab` process entry points. Production calls this with
|
|
7
|
+
* argv only; the repo-local hot entry may additionally supply a per-paint
|
|
8
|
+
* dashboard renderer resolver. All command routing and resource cleanup stay
|
|
9
|
+
* identical between the two entries.
|
|
10
|
+
*/
|
|
11
|
+
import { join } from 'node:path'
|
|
12
|
+
import { isSessionlessInvocation, runCli } from './main'
|
|
13
|
+
import { createUpgradeAgentResolver } from './upgrade-agent'
|
|
14
|
+
import { loadDotEnv } from './dotenv'
|
|
15
|
+
import { MissingAmbientContextError, resolveCliEnv, resolveHarvestCliEnv } from './env'
|
|
16
|
+
import { openProductionSessionStore } from './store-opening'
|
|
17
|
+
import { processTerminal, processTerminalInput } from './terminal'
|
|
18
|
+
import type { TerminalRestoreProcess } from './terminal-restore'
|
|
19
|
+
import type { DashboardRendererResolver } from './dashboard/render'
|
|
20
|
+
import { loadConfig } from '../config/load'
|
|
21
|
+
import { loadPlugins } from '../plugins/load'
|
|
22
|
+
import { createForge } from '../ports/forge/create'
|
|
23
|
+
import { spawnExec } from '../ports/workspace/git-worktree'
|
|
24
|
+
import { randomIds } from '../ids'
|
|
25
|
+
import { systemClock } from '../store/types'
|
|
26
|
+
import { resolveMainRepo } from './repo-state'
|
|
27
|
+
|
|
28
|
+
import {
|
|
29
|
+
usesGenericSessionlessSigintHandler,
|
|
30
|
+
installSessionlessSigintHandler,
|
|
31
|
+
withDispatchTerminalRestore,
|
|
32
|
+
} from './binary-lifecycle'
|
|
33
|
+
|
|
34
|
+
export async function runDirectBinary(
|
|
35
|
+
argv: string[],
|
|
36
|
+
resolveDashboardRenderer?: DashboardRendererResolver,
|
|
37
|
+
): Promise<number> {
|
|
38
|
+
const command = argv[0]
|
|
39
|
+
// Version identity is installation-local and offline; do not inspect even a
|
|
40
|
+
// repository-local .env before routing it.
|
|
41
|
+
if (command !== '--version') {
|
|
42
|
+
// Local .env supplies developer-set secrets (e.g. LINEAR_API_KEY); real
|
|
43
|
+
// environment variables always win over .env values.
|
|
44
|
+
loadDotEnv(join(process.cwd(), '.env'), process.env)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
delete process.env.AB_DISPATCH_GENERATION
|
|
48
|
+
|
|
49
|
+
const unscopedDeps = {
|
|
50
|
+
workspacePath: process.cwd(),
|
|
51
|
+
processEnv: process.env,
|
|
52
|
+
exec: spawnExec,
|
|
53
|
+
stdout: (line: string) => {
|
|
54
|
+
if (command !== 'dispatch' || ownsDispatchPresentation()) console.log(line)
|
|
55
|
+
},
|
|
56
|
+
stderr: (line: string) => {
|
|
57
|
+
if (command !== 'dispatch' || ownsDispatchPresentation()) console.error(line)
|
|
58
|
+
},
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Sessionless commands resolve their own repository/store and do not require
|
|
62
|
+
// a phase tuple; durable controls also take a target slug and inspect raw
|
|
63
|
+
// AB_SESSION/AB_BUILD only to reject self-control. The flat-name set and
|
|
64
|
+
// mixed nested-command classifier live beside the switch in main.ts.
|
|
65
|
+
if (isSessionlessInvocation(argv)) {
|
|
66
|
+
// The dispatch watch loop runs until SIGINT; abort the signal so it exits
|
|
67
|
+
// cleanly at the next tick boundary (§15.6-C: in-flight leases expire and
|
|
68
|
+
// a future dispatch re-attaches).
|
|
69
|
+
const controller = new AbortController()
|
|
70
|
+
const onSigint = (): void => controller.abort('SIGINT')
|
|
71
|
+
const ownsSigint = usesGenericSessionlessSigintHandler(command)
|
|
72
|
+
const terminal = processTerminal(process.stdout)
|
|
73
|
+
const removeSigint = installSessionlessSigintHandler(command, onSigint)
|
|
74
|
+
try {
|
|
75
|
+
return await withDispatchTerminalRestore(
|
|
76
|
+
command,
|
|
77
|
+
terminal,
|
|
78
|
+
() =>
|
|
79
|
+
runCli(argv, {
|
|
80
|
+
...unscopedDeps,
|
|
81
|
+
...(ownsSigint ? { signal: controller.signal } : {}),
|
|
82
|
+
// `ab dispatch`'s dashboard seam: interactive iff stdout is a real
|
|
83
|
+
// TTY, so a pipe or redirect silently gets plain output.
|
|
84
|
+
terminal,
|
|
85
|
+
input: processTerminalInput(process.stdin),
|
|
86
|
+
...(command === 'init'
|
|
87
|
+
? { initInteractive: process.stdin.isTTY === true && process.stdout.isTTY === true }
|
|
88
|
+
: {}),
|
|
89
|
+
upgradeResolverFactory: createUpgradeAgentResolver,
|
|
90
|
+
...(resolveDashboardRenderer !== undefined ? { resolveDashboardRenderer } : {}),
|
|
91
|
+
}),
|
|
92
|
+
process as unknown as TerminalRestoreProcess,
|
|
93
|
+
(signal) => controller.abort(signal),
|
|
94
|
+
)
|
|
95
|
+
} finally {
|
|
96
|
+
removeSigint()
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (command === 'harvest') {
|
|
101
|
+
let harvestEnv: ReturnType<typeof resolveHarvestCliEnv>
|
|
102
|
+
try {
|
|
103
|
+
harvestEnv = resolveHarvestCliEnv(process.env)
|
|
104
|
+
} catch (error) {
|
|
105
|
+
if (error instanceof MissingAmbientContextError) {
|
|
106
|
+
return runCli(argv, unscopedDeps)
|
|
107
|
+
}
|
|
108
|
+
console.error(error instanceof Error ? error.message : String(error))
|
|
109
|
+
return 1
|
|
110
|
+
}
|
|
111
|
+
const store = openProductionSessionStore(harvestEnv)
|
|
112
|
+
try {
|
|
113
|
+
return await runCli(argv, {
|
|
114
|
+
...unscopedDeps,
|
|
115
|
+
store,
|
|
116
|
+
harvestEnv,
|
|
117
|
+
ids: randomIds(),
|
|
118
|
+
clock: systemClock,
|
|
119
|
+
})
|
|
120
|
+
} finally {
|
|
121
|
+
await store.close()
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
let cliEnv: ReturnType<typeof resolveCliEnv>
|
|
126
|
+
try {
|
|
127
|
+
cliEnv = resolveCliEnv(process.env)
|
|
128
|
+
} catch (error) {
|
|
129
|
+
if (error instanceof MissingAmbientContextError) {
|
|
130
|
+
return runCli(argv, unscopedDeps)
|
|
131
|
+
}
|
|
132
|
+
console.error(error instanceof Error ? error.message : String(error))
|
|
133
|
+
return 1
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// A scoped phase process is composed from the build worktree's immutable
|
|
137
|
+
// configuration just like dispatch. Load and select the forge before opening
|
|
138
|
+
// the store so plugin failures cannot partially execute terminal plumbing.
|
|
139
|
+
// Guest tolerance (AUT-517), always on here: in checkout mode `ab dispatch`
|
|
140
|
+
// already failed startup if a configured plugin did not resolve, and
|
|
141
|
+
// origin-mode phase processes only run inside guests — so an unresolvable
|
|
142
|
+
// bare specifier here can only be the provider-plugin case, which a phase
|
|
143
|
+
// process (never constructing workspace providers) may skip.
|
|
144
|
+
let forge: Awaited<ReturnType<typeof createForge>>
|
|
145
|
+
try {
|
|
146
|
+
const repoRoot = process.cwd()
|
|
147
|
+
const packageRoot = await resolveMainRepo(repoRoot, spawnExec)
|
|
148
|
+
const config = await loadConfig(join(repoRoot, 'autobuild.toml'))
|
|
149
|
+
const plugins = await loadPlugins(config.plugins, repoRoot, {
|
|
150
|
+
packageRoot,
|
|
151
|
+
guest: true,
|
|
152
|
+
})
|
|
153
|
+
forge = await createForge({
|
|
154
|
+
name: config.forge,
|
|
155
|
+
registry: plugins,
|
|
156
|
+
env: process.env,
|
|
157
|
+
repoRoot,
|
|
158
|
+
})
|
|
159
|
+
} catch (error) {
|
|
160
|
+
console.error(error instanceof Error ? error.message : String(error))
|
|
161
|
+
return 1
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const kernelStore = openProductionStore(cliEnv.store, cliEnv.token)
|
|
165
|
+
const store = scopeLocalStoreToPhaseSession(kernelStore, {
|
|
166
|
+
kind: 'build',
|
|
167
|
+
id: cliEnv.build,
|
|
168
|
+
session: cliEnv.session,
|
|
169
|
+
})
|
|
170
|
+
try {
|
|
171
|
+
const record = await store.getBuild(cliEnv.build)
|
|
172
|
+
if (record)
|
|
173
|
+
forge = guardForge(forge, {
|
|
174
|
+
store: kernelStore,
|
|
175
|
+
repo: record.repo,
|
|
176
|
+
name: forge.name,
|
|
177
|
+
wait: true,
|
|
178
|
+
})
|
|
179
|
+
return await runCli(argv, {
|
|
180
|
+
...unscopedDeps,
|
|
181
|
+
store,
|
|
182
|
+
env: cliEnv,
|
|
183
|
+
forge,
|
|
184
|
+
ids: randomIds(),
|
|
185
|
+
clock: systemClock,
|
|
186
|
+
})
|
|
187
|
+
} finally {
|
|
188
|
+
await store.close()
|
|
189
|
+
}
|
|
190
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { TerminalOut } from './terminal'
|
|
2
|
+
import { installTerminalRestoreHook, type TerminalRestoreProcess } from './terminal-restore'
|
|
3
|
+
/** Upgrade (including its `update` alias) owns Ctrl-C only while raw per-file
|
|
4
|
+
* progress is active. Everywhere else its process must retain Node's ordinary
|
|
5
|
+
* immediate SIGINT termination. */
|
|
6
|
+
export function usesGenericSessionlessSigintHandler(command: string | undefined): boolean {
|
|
7
|
+
return command !== 'upgrade' && command !== 'update'
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface SessionlessSigintBoundary {
|
|
11
|
+
on(event: 'SIGINT', listener: () => void): unknown
|
|
12
|
+
once(event: 'SIGINT', listener: () => void): unknown
|
|
13
|
+
removeListener(event: 'SIGINT', listener: () => void): unknown
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Dispatch keeps its listener through the complete child drain; ordinary
|
|
17
|
+
* sessionless commands preserve the historical one-shot cancellation. */
|
|
18
|
+
export function installSessionlessSigintHandler(
|
|
19
|
+
command: string | undefined,
|
|
20
|
+
onSigint: () => void,
|
|
21
|
+
boundary: SessionlessSigintBoundary = process,
|
|
22
|
+
): () => void {
|
|
23
|
+
if (!usesGenericSessionlessSigintHandler(command)) return () => {}
|
|
24
|
+
if (command === 'dispatch') boundary.on('SIGINT', onSigint)
|
|
25
|
+
else boundary.once('SIGINT', onSigint)
|
|
26
|
+
return () => boundary.removeListener('SIGINT', onSigint)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Install the dispatch-only process fallback around the exact CLI lifetime. */
|
|
30
|
+
export async function withDispatchTerminalRestore<T>(
|
|
31
|
+
command: string | undefined,
|
|
32
|
+
terminal: TerminalOut,
|
|
33
|
+
run: () => Promise<T>,
|
|
34
|
+
boundary: TerminalRestoreProcess = process as unknown as TerminalRestoreProcess,
|
|
35
|
+
requestStop: (signal: NodeJS.Signals) => void = () => {},
|
|
36
|
+
): Promise<T> {
|
|
37
|
+
const hook =
|
|
38
|
+
command === 'dispatch'
|
|
39
|
+
? installTerminalRestoreHook(terminal.modes, boundary, requestStop)
|
|
40
|
+
: undefined
|
|
41
|
+
try {
|
|
42
|
+
return await run()
|
|
43
|
+
} finally {
|
|
44
|
+
hook?.close()
|
|
45
|
+
}
|
|
46
|
+
}
|