@defrex/autobuild 1.0.0-beta.3 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +362 -56
  3. package/bin/ab-dispatch-generation.ts +93 -0
  4. package/docs/agent-runtimes.md +157 -0
  5. package/docs/answering-blocked-builds.md +21 -3
  6. package/docs/architecture.md +166 -7
  7. package/docs/build-store.md +123 -0
  8. package/docs/builds.md +82 -0
  9. package/docs/cli.md +48 -0
  10. package/docs/configuration-overview.md +93 -0
  11. package/docs/configuration.md +1778 -188
  12. package/docs/dispatcher-hosting.md +115 -0
  13. package/docs/dispatcher.md +59 -0
  14. package/docs/forges.md +121 -0
  15. package/docs/getting-started.md +60 -0
  16. package/docs/glossary.md +60 -0
  17. package/docs/hosted-service.md +2 -2
  18. package/docs/intake.md +48 -0
  19. package/docs/integration-overview.md +81 -0
  20. package/docs/integration-tree.md +87 -2
  21. package/docs/integration.md +54 -0
  22. package/docs/operating.md +114 -0
  23. package/docs/operator-api.md +64 -11
  24. package/docs/operator-surfaces.md +90 -0
  25. package/docs/overview.md +49 -0
  26. package/docs/plugin-authoring.md +426 -0
  27. package/docs/remote-store-protocol.md +12 -9
  28. package/docs/restacking.md +4 -1
  29. package/docs/seams.md +66 -0
  30. package/docs/setup.md +28 -6
  31. package/docs/skills.md +119 -0
  32. package/docs/spec-standard.md +23 -5
  33. package/docs/ticket-sources.md +132 -0
  34. package/docs/tickets.md +69 -0
  35. package/docs/troubleshooting.md +111 -0
  36. package/docs/upgrading.md +50 -0
  37. package/docs/verification.md +146 -0
  38. package/docs/website.md +47 -5
  39. package/docs/workspaces.md +152 -0
  40. package/package.json +5 -4
  41. package/packages/core/src/cli/artifact.ts +5 -4
  42. package/packages/core/src/cli/attention.ts +2 -0
  43. package/packages/core/src/cli/binary-direct.ts +190 -0
  44. package/packages/core/src/cli/binary-lifecycle.ts +46 -0
  45. package/packages/core/src/cli/binary.ts +24 -210
  46. package/packages/core/src/cli/build-control.ts +105 -2
  47. package/packages/core/src/cli/context.ts +41 -1
  48. package/packages/core/src/cli/dashboard/hand-pushed.ts +24 -0
  49. package/packages/core/src/cli/dashboard/handoff.ts +64 -0
  50. package/packages/core/src/cli/dashboard/integration-detail.ts +3 -0
  51. package/packages/core/src/cli/dashboard/model.ts +34 -10
  52. package/packages/core/src/cli/dashboard/render.ts +24 -2
  53. package/packages/core/src/cli/dashboard/rollback.ts +30 -0
  54. package/packages/core/src/cli/dispatch-args.ts +53 -0
  55. package/packages/core/src/cli/dispatch-crash-budget.ts +15 -0
  56. package/packages/core/src/cli/dispatch-frontend.ts +52 -5
  57. package/packages/core/src/cli/dispatch-handoff.ts +276 -0
  58. package/packages/core/src/cli/dispatch-launch-contract.ts +170 -0
  59. package/packages/core/src/cli/dispatch-launcher.ts +580 -0
  60. package/packages/core/src/cli/dispatch-parent-watch.ts +44 -0
  61. package/packages/core/src/cli/dispatch-preflight.ts +272 -0
  62. package/packages/core/src/cli/dispatch-presentation-job.ts +46 -0
  63. package/packages/core/src/cli/dispatch-presentation-ownership.ts +9 -0
  64. package/packages/core/src/cli/dispatch-process.ts +22 -90
  65. package/packages/core/src/cli/dispatch-readiness.ts +47 -0
  66. package/packages/core/src/cli/dispatch-repository-feed.ts +5 -1
  67. package/packages/core/src/cli/dispatch-runtime-cache.ts +522 -0
  68. package/packages/core/src/cli/dispatch-runtime-dependencies.ts +291 -0
  69. package/packages/core/src/cli/dispatch-runtime-use.ts +336 -0
  70. package/packages/core/src/cli/dispatch-upgrade-controller.ts +221 -0
  71. package/packages/core/src/cli/dispatch-upgrade-install.ts +258 -0
  72. package/packages/core/src/cli/dispatch-upgrade-source.ts +309 -0
  73. package/packages/core/src/cli/dispatch-upgrade-target.ts +190 -0
  74. package/packages/core/src/cli/dispatch.ts +604 -60
  75. package/packages/core/src/cli/dispatcher-liveness.ts +1 -1
  76. package/packages/core/src/cli/env.ts +1 -1
  77. package/packages/core/src/cli/harvest.ts +28 -11
  78. package/packages/core/src/cli/help.ts +10 -5
  79. package/packages/core/src/cli/installation.ts +5 -3
  80. package/packages/core/src/cli/main-checkout.ts +59 -0
  81. package/packages/core/src/cli/main.ts +15 -45
  82. package/packages/core/src/cli/node-verification-provenance.ts +97 -0
  83. package/packages/core/src/cli/repo-state.ts +3 -58
  84. package/packages/core/src/cli/repository-status.ts +67 -3
  85. package/packages/core/src/cli/runtime-spawn.ts +16 -0
  86. package/packages/core/src/cli/status.ts +57 -3
  87. package/packages/core/src/cli/upgrade-followup.ts +25 -0
  88. package/packages/core/src/cli/wait.ts +3 -0
  89. package/packages/core/src/cli/watch.ts +7 -0
  90. package/packages/core/src/config/landing.ts +8 -0
  91. package/packages/core/src/config/live.ts +1 -0
  92. package/packages/core/src/config/reference-metadata.ts +31 -0
  93. package/packages/core/src/config/reference.ts +342 -0
  94. package/packages/core/src/config/roles.ts +1 -1
  95. package/packages/core/src/config/schema.ts +352 -10
  96. package/packages/core/src/distribution-packaging.ts +116 -0
  97. package/packages/core/src/events/catalog.ts +6 -0
  98. package/packages/core/src/events/payloads.ts +53 -9
  99. package/packages/core/src/events/policy.ts +25 -0
  100. package/packages/core/src/events/repository.ts +184 -4
  101. package/packages/core/src/events/runtime.ts +16 -0
  102. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +2515 -78
  103. package/packages/core/src/kernel/dispatch-drain-recovery.ts +121 -0
  104. package/packages/core/src/kernel/dispatch-status.ts +4 -2
  105. package/packages/core/src/kernel/dispatch-upgrade.ts +171 -0
  106. package/packages/core/src/kernel/dispatcher-liveness.ts +7 -0
  107. package/packages/core/src/kernel/generators/repository-journals.ts +82 -0
  108. package/packages/core/src/kernel/guarded-forge.ts +1 -1
  109. package/packages/core/src/kernel/harvest.ts +98 -4
  110. package/packages/core/src/kernel/integration-attention.ts +20 -0
  111. package/packages/core/src/kernel/integration-state.ts +80 -11
  112. package/packages/core/src/kernel/landing-readiness.ts +6 -1
  113. package/packages/core/src/kernel/mixed-version.ts +34 -0
  114. package/packages/core/src/kernel/node-polling.ts +160 -0
  115. package/packages/core/src/kernel/read-facts.ts +40 -5
  116. package/packages/core/src/kernel/reducer-registry.ts +3 -0
  117. package/packages/core/src/kernel/reducer.ts +75 -14
  118. package/packages/core/src/kernel/service-facts.ts +11 -4
  119. package/packages/core/src/ontology.ts +2 -2
  120. package/packages/core/src/open-map.ts +3 -1
  121. package/packages/core/src/operator/presentation.ts +7 -0
  122. package/packages/core/src/operator/query.ts +6 -2
  123. package/packages/core/src/operator/registry.ts +1 -1
  124. package/packages/core/src/plugins/load.ts +4 -1
  125. package/packages/core/src/plugins/runtime-snapshot.ts +128 -0
  126. package/packages/core/src/ports/forge/contract.ts +29 -0
  127. package/packages/core/src/ports/forge/github.ts +189 -61
  128. package/packages/core/src/ports/forge-failure.ts +1 -0
  129. package/packages/core/src/ports/forge-telemetry.ts +3 -0
  130. package/packages/core/src/ports/runner/session-env.ts +1 -0
  131. package/packages/core/src/ports/types.ts +10 -0
  132. package/packages/core/src/ports/workspace/distribution-archive.ts +22 -149
  133. package/packages/core/src/ports/workspace/distribution-release.ts +56 -0
  134. package/packages/core/src/ports/workspace/git-worktree.ts +2 -1
  135. package/packages/core/src/ports/workspace/local-build-execution.ts +37 -17
  136. package/packages/core/src/processes/build-child-exit.ts +5 -26
  137. package/packages/core/src/processes/build-runner.ts +81 -11
  138. package/packages/core/src/processes/dispatcher.ts +254 -23
  139. package/packages/core/src/processes/execution-no-progress.ts +6 -0
  140. package/packages/core/src/processes/execution-relaunch.ts +30 -0
  141. package/packages/core/src/processes/execution-settlement.ts +16 -7
  142. package/packages/core/src/processes/harvest-runner.ts +328 -292
  143. package/packages/core/src/processes/process-group-reaper.ts +17 -10
  144. package/packages/core/src/runtime-identity.ts +22 -3
  145. package/packages/core/src/store/contract.ts +153 -0
  146. package/packages/core/src/store/local/store.ts +197 -72
  147. package/packages/core/src/store/reduced-reads.ts +8 -0
  148. package/packages/core/src/store/reducer-value-shapes.json +5783 -3305
  149. package/packages/core/src/store/remote/client.ts +43 -0
  150. package/packages/core/src/store/repo-state-events.ts +20 -3
  151. package/packages/core/src/store/types.ts +7 -0
  152. package/skills/finalize/SKILL.md +3 -1
  153. package/skills/guide/SKILL.md +273 -48
  154. package/skills/guide/references/integration-tree.md +87 -2
  155. package/skills/guide/references/operator-api.md +71 -14
  156. package/skills/guide/references/plugin-authoring.md +231 -266
  157. package/skills/guide/references/remote-store-protocol.md +12 -9
  158. package/skills/guide/references/restacking.md +4 -1
  159. package/skills/guide/references/setup.md +28 -6
  160. package/skills/guide/references/spec-standard.md +23 -5
  161. package/skills/harvest/SKILL.md +4 -0
  162. package/skills/harvest-review/SKILL.md +4 -0
  163. package/skills/implement/SKILL.md +4 -2
  164. package/skills/operate/SKILL.md +104 -35
  165. package/skills/plan/SKILL.md +12 -4
  166. package/skills/spec/SKILL.md +20 -2
  167. package/skills/tickets/SKILL.md +20 -1
  168. package/templates/hosted-service/package.json +2 -2
package/docs/builds.md ADDED
@@ -0,0 +1,82 @@
1
+ ---
2
+ title: "One build, end to end"
3
+ group: "concepts"
4
+ description: "Follow a work ticket through planning, review, verification, pull request creation, and landing."
5
+ label: "Builds"
6
+ order: 2
7
+ ---
8
+
9
+ # One build, end to end
10
+
11
+ A build is one execution of one work ticket, identified by a slug, through a fixed pipeline:
12
+
13
+ ```text
14
+ spec → plan ⇄ plan-review → implement ⇄ code-review → verify:* → finalize
15
+ ```
16
+
17
+ Integration nodes have a [different lifecycle](integration-overview.md).
18
+
19
+
20
+ ## The spec is the contract
21
+
22
+ At dispatch, Autobuild pins the groomed, conforming spec as a stored artifact; `spec` names that contract, not an agent phase. Planning, review, and verification judge against the pinned spec, not mutable tracker text.
23
+
24
+ To change the contract, your operator agent answers an escalation with a revised spec, and the build restarts from planning:
25
+
26
+ ```sh
27
+ bun ab answer <slug> --revise-spec revised-spec.md
28
+ ```
29
+
30
+
31
+ ## Produce, then review
32
+
33
+ | Loop | Producer | Reviewer checks against |
34
+ |---|---|---|
35
+ | `plan ⇄ plan-review` | planner proposes a plan | the spec |
36
+ | `implement ⇄ code-review` | implementer makes local commits | the spec and plan |
37
+
38
+ Either reviewer approves, requests revisions with structured findings, or escalates a question.
39
+
40
+ - **Sessions.** Each phase gets its own session; the producer keeps it across a loop's rounds, and each reviewer round starts fresh.
41
+ - **Context** passes between phases as durable artifacts: spec, approved plan, implementation notes, findings, and verification reports.
42
+
43
+ Two limits park the build for an answer:
44
+
45
+ - **Round ceiling.** `[policy].maxReviewRounds` (default 6) per loop. Your operator agent can override it for the parked loop and current spec revision with `ab answer <slug> --review-round-ceiling <n>`.
46
+ - **Stall limit.** A finding the reviewer marks as persisting for `[policy].stallRounds` rounds (default 3) escalates.
47
+
48
+
49
+ ## Verify, then publish
50
+
51
+ After code review approves, Autobuild prepares the build's single net change on the sampled destination and runs the `verify:*` steps in order:
52
+
53
+ - **Check verifiers** run a command; the exit code decides.
54
+ - **Agent verifiers** record a pass, a failure report, or a skip reason.
55
+ - **Applicability rules** can skip a step with a recorded reason.
56
+
57
+ A failure sends the build, with its report, back through implementation, code review, and verification. See [Verification](verification.md).
58
+
59
+ Once verification passes, the finalize agent writes the PR description; Autobuild publishes the branch and opens the PR. Optional `finalize:*` post-steps, such as a changelog or ticket link, run after PR creation; a failed post-step records an observation instead of failing the build. `verify:*` and `finalize:*` are the only configurable extension points.
60
+
61
+
62
+ ## When a human is needed
63
+
64
+ After grooming, escalations are the judgment gates. A build parks with a recorded question on an unclear requirement, a persistent review disagreement, or an exhausted policy bound.
65
+
66
+ Your operator agent answers bounded questions from your instructions and brings unresolved product decisions to you. Restarting dispatch doesn't answer a question, and an answer doesn't force success.
67
+
68
+ Landing consent is a separate policy decision your operator agent manages. Repositories can require it even for a green build; verification, forge checks, and merge gates still apply. See [integration and landing policy](integration-overview.md).
69
+
70
+
71
+ ## The reconcile epilogue
72
+
73
+ After finalize, Autobuild watches the destination until the PR merges or closes:
74
+
75
+ ```text
76
+ (pr.conflicted → reconcile → verify:*)* → merged or closed
77
+ ```
78
+
79
+ - **Clean restack** onto a newer base is automatic; no agent runs.
80
+ - **Conflicted replay** enters `reconcile`: an agent resolves the kernel-prepared change on a frozen refreshed base, then post-reconcile verification runs.
81
+
82
+ See [integrating related work](integration-overview.md#one-identity-per-leaf-change) for replay details and the [dispatcher guide](dispatcher.md) for how builds run and resume.
package/docs/cli.md ADDED
@@ -0,0 +1,48 @@
1
+ ---
2
+ title: CLI
3
+ group: reference
4
+ order: 16
5
+ description: "Every command, grouped by your responsibilities and your operator agent’s."
6
+ ---
7
+
8
+ # CLI
9
+
10
+ Run `bun ab <command>`; `bun ab help <command>` lists flags and subcommands. See [Operating](operating.md) for workflows.
11
+
12
+ ## For you
13
+
14
+ - `dispatch` — Run the dispatcher and dashboard.
15
+ - `init` — Install skills and hand setup to a coding agent.
16
+ - `upgrade` — Update Autobuild and merge default skills.
17
+ - `connect` — Connect to a hosted service with browser approval.
18
+ - `disconnect` — Revoke and remove the saved credential.
19
+
20
+ ## For your operator agent
21
+
22
+ - `help` — Show the overview or one command's help.
23
+ - `ticket` — Create, groom, inspect, and move tickets.
24
+ - `repository` — Inspect durable dispatcher settings.
25
+ - `landings` — List landings awaiting consent.
26
+ - `builds` — List builds and status.
27
+ - `build` — Inspect one build's state and events.
28
+ - `watch` — Follow events with a resumable cursor.
29
+ - `wait` — Block until a build condition holds; print one record.
30
+ - `mcp` — Serve the operator tools over stdio.
31
+ - `pause` — Request a build or repository pause.
32
+ - `resume` — Resume a paused build or repository.
33
+ - `answer` — Answer escalations or request a retry.
34
+ - `abort` — Request irreversible build termination and cleanup.
35
+ - `restack` — Request a node restack onto its current parent.
36
+ - `hold` — Hold a landing, withdrawing consent.
37
+ - `land` — Consent to a ready landing.
38
+ - `models` — Search Pi's model catalog.
39
+ - `plugin` — Inspect, diagnose, and contract-test adapters.
40
+ - `context` — Materialize the current phase's inputs.
41
+ - `artifact` — Deposit, fetch, or download versioned artifacts.
42
+ - `observe` — Record an observation outside the build's scope.
43
+ - `done` — Complete a producer phase.
44
+ - `verdict` — Complete a review or verification phase.
45
+ - `escalate` — Park the build with a question for you.
46
+ - `harvest` — Inspect or drive observation harvesting.
47
+
48
+ Phase commands (`context`, `done`, `verdict`) use runner-scoped session authority: the runner starts phase agents, never your operator agent. See [Skills](skills.md).
@@ -0,0 +1,93 @@
1
+ ---
2
+ title: "Repository configuration"
3
+ group: "reference"
4
+ description: "Map autobuild.toml settings to verification, agent roles, capacity, ticket readiness, landing policy, and editable skills."
5
+ label: "Configuration"
6
+ order: 8
7
+ slug: "configuration"
8
+ ---
9
+
10
+ # Repository configuration
11
+
12
+ `autobuild.toml` declares your repository's infrastructure, commands, agent roles, checks and operating limits.
13
+
14
+
15
+ ## Commands and extension steps
16
+
17
+ Verify and finalize steps run named commands or agent skills, in order:
18
+
19
+ ```toml
20
+ [commands]
21
+ typecheck = "bun tsc --noEmit"
22
+
23
+ [verify]
24
+ steps = ["types", "acceptance"]
25
+
26
+ [verify.types]
27
+ kind = "check"
28
+ command = "typecheck"
29
+ always = true
30
+
31
+ [verify.acceptance]
32
+ kind = "agent"
33
+ skill = "verify-acceptance" # repository-authored skill
34
+ ```
35
+
36
+ - **Verify**: command checks and agent verifiers. A build's plan selects optional steps.
37
+ - **Finalize** post-steps run after PR creation, e.g. a changelog update. A failed post-step is recorded without failing a green build.
38
+ - These are the only extension points; configuration can't add or reorder phases.
39
+
40
+ See the [verification guide](verification.md).
41
+
42
+
43
+ ## Roles, models, and limits
44
+
45
+ Roles inherit runtime and model from `roles.default` and override them per job. Ordered `alternates` are fallbacks when a provider is unavailable.
46
+
47
+ ```toml
48
+ capacity = 2
49
+
50
+ [roles.default]
51
+ runtime = "claude"
52
+
53
+ [roles.code-review]
54
+ runtime = "pi"
55
+ model = "kimi-coding/k3"
56
+
57
+ [policy]
58
+ maxReviewRounds = 6
59
+ maxVerifyAttempts = 3
60
+ sessionBudgetSeconds = 3600
61
+ ```
62
+
63
+ - **Capacity** bounds concurrent work.
64
+ - **Policy limits** bound review rounds, retries and session budgets, and decide when automation stops for attention.
65
+
66
+
67
+ ## Admission and landing
68
+
69
+ - **Tickets.** `[tickets]` sets the source and readiness criteria for admitting work.
70
+ - **Landing.** Ordered, first-match `[[landing]]` rules on source and destination select automatic landing or explicit consent. See [Integrating related work](integration-overview.md#policy-authorizes-landing) for matching and defaults, [Working with your operator agent](operating.md) for consent and hold commands.
71
+ - **Reloads.** Build execution configuration is pinned; dispatcher policy and role settings reload live.
72
+ - **Secrets** stay out of committed TOML.
73
+
74
+
75
+ ## Editable skills and installation
76
+
77
+ The vendored `ab-*` skills are editable repository files supplying agent judgment: how to plan, implement, review and operate. Code owns transitions, state and gates.
78
+
79
+ ```
80
+ bun ab init
81
+ bun ab init --validate
82
+ ```
83
+
84
+ - **`init`** writes a stack-neutral configuration if none exists, vendors skills, and hands repository-aware setup (commands, adapter prerequisites) to a coding agent. Existing configuration is preserved.
85
+ - **`init --validate`** checks readiness for the configured arrangement.
86
+
87
+ Every repository must configure an **acceptance check**: an agent verify step that runs the built software, exercises each acceptance criterion, attaches evidence and returns a typed verdict. It leaves no test files behind. An existing end-to-end or browser suite goes in an ordinary `check` step; setup doesn't create one.
88
+
89
+ ```
90
+ bun ab upgrade
91
+ ```
92
+
93
+ `upgrade` updates the installation on its distribution channel and merges upstream skill changes into your edits, surfacing conflicts instead of overwriting. See [Upgrading](upgrading.md) and [Skills](skills.md#how-upgrades-preserve-customization).