@defrex/autobuild 1.0.0-beta.0 → 1.0.0-beta.1

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 CHANGED
@@ -21,18 +21,23 @@ agent runtime you select: Claude Code, Codex CLI, or Pi. The GitHub forge also
21
21
  needs an authenticated [`gh` CLI](https://cli.github.com) or an exported
22
22
  `GITHUB_TOKEN`/`GH_TOKEN`; the local-git forge needs no account or remote.
23
23
 
24
+ From the repository you want built, install Autobuild as a development dependency:
25
+
24
26
  <!-- release-install:start -->
25
27
 
26
28
  ```sh
27
- bun add -g @defrex/autobuild@0.14.0
29
+ bun add -d --exact @defrex/autobuild@0.14.0
28
30
  ```
29
31
 
30
32
  <!-- release-install:end -->
31
33
 
32
- Then, from the repository you want built:
34
+ Without a `package.json`, installation creates `package.json` and `bun.lock`,
35
+ which should be committed, with `node_modules/` ignored.
36
+
37
+ Run the repository-installed CLI:
33
38
 
34
39
  ```sh
35
- ab init
40
+ bun ab init
36
41
  ```
37
42
 
38
43
  This vendors the editable `ab-*` skills, writes a stack-neutral config, and
@@ -41,7 +46,7 @@ hands repository-aware setup to a coding agent. The
41
46
  start the dispatcher and its live dashboard:
42
47
 
43
48
  ```sh
44
- ab dispatch
49
+ bun ab dispatch
45
50
  ```
46
51
 
47
52
  Then groom your first ticket in your coding agent:
package/SPEC.md CHANGED
@@ -126,8 +126,8 @@ resolve first from the consuming repository's main checkout, so they use that
126
126
  repository's installed dependencies and remain available when a local store
127
127
  places linked worktrees outside the checkout's package ancestry; a package the
128
128
  repository lacks then resolves from the Autobuild installation the CLI runs
129
- from, so an extension installed next to the CLI (`bun add -g
130
- @defrex/autobuild-<extension>`) loads without being added to the repository. A
129
+ from as a fallback. Install extensions as repository development dependencies
130
+ with `bun add -d --exact @defrex/autobuild-<extension>`. A
131
131
  repository copy always wins over an installed one. Dispatch and sessionless
132
132
  commands naturally use the main checkout for both repository roots. Autobuild
133
133
  does not install a missing package.
@@ -2177,12 +2177,13 @@ and `--once` kernel semantics remain the line-oriented/direct compatibility
2177
2177
  path; `--once` still performs one tick and drains its in-flight work.
2178
2178
 
2179
2179
  Interactive watch presentation enables xterm focus reporting (mode 1004) only
2180
- while it owns terminal input. A focus-out report pauses all automatic dashboard
2181
- reads, including session feeds; focus-in refreshes immediately. Terminals that
2182
- send no reports remain focused. Every operator key requests an immediate refresh
2180
+ while it owns terminal input. Local-store reads keep the same cadence regardless
2181
+ of focus. Network stores (remote HTTP and Postgres) use 5-second polling while
2182
+ unfocused, including session feeds and automatic session recovery. Focus-in
2183
+ refreshes immediately. Terminals that send no reports remain focused. Every operator key requests an immediate refresh
2183
2184
  unless one is already running and holds the 500 ms cadence for at least 30
2184
- seconds. Otherwise retained nonterminal builds (including abort cleanup) use
2185
- 500 ms polling and an empty dashboard uses 5 seconds. Cached elapsed counters
2185
+ seconds while focused (or on a local store). Otherwise retained nonterminal
2186
+ builds (including abort cleanup) use 500 ms polling and an empty dashboard uses 5 seconds. Cached elapsed counters
2186
2187
  may repaint without reads. Focus never pauses the dispatcher kernel. Job-control
2187
2188
  suspension restores owned terminal modes and raw input before stopping; resume
2188
2189
  reenables them, assumes focus, and refreshes immediately. Teardown disables focus
@@ -2196,8 +2197,8 @@ same transaction as build creation, build/repository event insertion (including
2196
2197
  artifact-backed and tick writes), or a stored dispatcher lease holder transition.
2197
2198
  Other repositories, failed writes, denied claims, same-holder renewals, heartbeats,
2198
2199
  and passive expiry do not advance it. It is separate from journal sequence cursors.
2199
- Unchanged positions reuse the complete presentation snapshot; a focused ordinary
2200
- refresh then makes exactly one store request. Discovery uses required exact-repo
2200
+ Unchanged positions reuse the complete presentation snapshot; an ordinary refresh, focused or unfocused,
2201
+ then makes exactly one store request. Discovery uses required exact-repo
2201
2202
  `listBuildsForRepo(repo)`, never a global listing. Initial hydration, position or
2202
2203
  configuration changes, and at most ten seconds between full reads refresh the
2203
2204
  snapshot, including mutable lease/stream/artifact/ticket enrichment. Failed or
@@ -743,9 +743,13 @@ adapter operation, so slug naming, provisioning, runners, and Harvest cannot
743
743
  block input.
744
744
 
745
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,
746
+ scheduler for both terminal paths: focused by default, independent of focus for
747
+ local stores, and 5-second polling when unfocused for network stores,
747
748
  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
+ interaction hold, and 5 seconds when idle. The optional BuildStore.networkReads
750
+ capability identifies remote HTTP and Postgres adapters, including wrapped stores.
751
+ Session feeds and automatic recovery follow the same cadence; unchanged network
752
+ polls retain the change-position savings and bounded enrichment exception. Presentation store facades check
749
753
  admission at every asynchronous read stage; the kernel uses its original store
750
754
  and independent tick timers. Cached clock paints perform no reads. The mode
751
755
  ledger owns focus reporting through teardown and catchable faults; job-control
@@ -1,5 +1,9 @@
1
1
  # Configuration reference
2
2
 
3
+ Install Autobuild in the target repository with `bun add -d --exact @defrex/autobuild`.
4
+ Here, `ab <command>` means the repository-installed CLI; run it as
5
+ `bun ab <command>`, for example `bun ab init`.
6
+
3
7
  Autobuild reads one declarative `autobuild.toml` from the repository root.
4
8
  Commands in the file are shell strings; the file itself is never evaluated as
5
9
  code. A running dispatcher owns an accepted snapshot from the main checkout,
@@ -278,8 +282,8 @@ root whose config is being read. In a scoped phase process that root is the
278
282
  immutable build worktree. Bare npm package specifiers resolve first from the
279
283
  consuming repository's main checkout and therefore use its installed
280
284
  dependencies; a package the repository lacks then resolves from Autobuild's own
281
- installation, so an extension installed next to the CLI (`bun add -g
282
- @defrex/autobuild-<extension>`) loads without being added to the repository. A
285
+ installation as a fallback. Install extensions in the consuming repository with
286
+ `bun add -d --exact @defrex/autobuild-<extension>`. A
283
287
  repository copy always wins over an installed one. This package lookup remains
284
288
  stable when a relocated local store places a linked worktree outside the
285
289
  checkout. Dispatch and sessionless commands use the main checkout for both
package/docs/setup.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Repository setup
2
2
 
3
+ Install Autobuild in the target repository with `bun add -d --exact @defrex/autobuild`.
4
+ Here, `ab <command>` means the repository-installed CLI; run it as
5
+ `bun ab <command>`, for example `bun ab init`.
6
+
3
7
  Configure Autobuild outside the build pipeline. This conversation is not a
4
8
  build or phase. Work directly in the repository and involve the maintainer in
5
9
  choices that cannot be derived from source. Secrets belong in the environment
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defrex/autobuild",
3
- "version": "1.0.0-beta.0",
3
+ "version": "1.0.0-beta.1",
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.0",
148
- "@defrex/autobuild-vercel-sandbox": "1.0.0-beta.0",
147
+ "@defrex/autobuild-postgres-store": "1.0.0-beta.1",
148
+ "@defrex/autobuild-vercel-sandbox": "1.0.0-beta.1",
149
149
  "@resvg/resvg-js": "2.6.2",
150
150
  "@types/bun": "^1.3.14",
151
151
  "@types/node": "^24.0.0",
@@ -39,6 +39,7 @@ export class DashboardRefresh {
39
39
  constructor(
40
40
  private readonly refresh: () => Promise<void>,
41
41
  private readonly time: RefreshScheduler = scheduler,
42
+ private readonly networkReads = false,
42
43
  ) {}
43
44
 
44
45
  get painting(): boolean {
@@ -50,7 +51,7 @@ export class DashboardRefresh {
50
51
  }
51
52
 
52
53
  get admitted(): boolean {
53
- return this.active && !this.suspended && (this.focused || this.permit === this.generation)
54
+ return this.active && !this.suspended
54
55
  }
55
56
 
56
57
  activity(live: boolean): void {
@@ -58,10 +59,13 @@ export class DashboardRefresh {
58
59
  }
59
60
 
60
61
  focus(focused: boolean): void {
62
+ if (this.focused === focused) return
61
63
  this.focused = focused
62
- this.generation += 1
63
- this.cancel()
64
64
  if (focused) void this.request()
65
+ else if (this.networkReads) {
66
+ this.cancel()
67
+ if (this.flight === undefined) this.schedule()
68
+ }
65
69
  }
66
70
 
67
71
  interaction(): void {
@@ -77,7 +81,8 @@ export class DashboardRefresh {
77
81
 
78
82
  resume(): void {
79
83
  this.suspended = false
80
- this.focus(true)
84
+ this.focused = true
85
+ void this.request()
81
86
  }
82
87
 
83
88
  stop(): void {
@@ -103,11 +108,10 @@ export class DashboardRefresh {
103
108
  }
104
109
 
105
110
  request(interaction = false): Promise<void> {
106
- if (!this.active || this.suspended || (!this.focused && !interaction)) return Promise.resolve()
111
+ if (!this.active || this.suspended) return Promise.resolve()
107
112
  if (this.flight !== undefined) {
108
- // A focus round trip invalidates an outstanding read. Refresh again after
109
- // it settles, rather than losing the focus-in wakeup.
110
- if (this.permit !== this.generation) this.wake = true
113
+ // Retain an explicit wakeup that arrives during outstanding I/O.
114
+ if (interaction || this.permit !== this.generation) this.wake = true
111
115
  return this.flight
112
116
  }
113
117
  this.cancel()
@@ -121,7 +125,7 @@ export class DashboardRefresh {
121
125
  if (this.flight !== current) return
122
126
  this.flight = undefined
123
127
  this.permit = undefined
124
- if (this.wake && this.active && !this.suspended && this.focused) {
128
+ if (this.wake && this.active && !this.suspended) {
125
129
  this.wake = false
126
130
  void this.request()
127
131
  } else this.schedule()
@@ -137,15 +141,18 @@ export class DashboardRefresh {
137
141
 
138
142
  /** Current admission cadence, also used to bound presentation staleness. */
139
143
  get intervalMs(): number {
144
+ if (this.networkReads && !this.focused) return 5000
140
145
  return this.live || this.time.now() < this.deadline ? 500 : 5000
141
146
  }
142
147
 
143
148
  private schedule(): void {
144
- if (!this.active || this.suspended || !this.focused) return
149
+ if (!this.active || this.suspended) return
145
150
  const interval = this.intervalMs
146
151
  // Slow/failing requests do not spin when their start deadline is overdue.
147
- const remaining = this.started + interval - this.time.now()
148
- const delay = remaining > 0 ? remaining : 50
152
+ const remaining = Number.isFinite(this.started)
153
+ ? this.started + interval - this.time.now()
154
+ : interval
155
+ const delay = remaining > 0 ? remaining : this.networkReads && !this.focused ? interval : 50
149
156
  this.timer = this.time.set(() => {
150
157
  this.timer = undefined
151
158
  void this.request()
@@ -155,7 +162,7 @@ export class DashboardRefresh {
155
162
 
156
163
  /** Guard each asynchronous read stage, including reads inside shared caches.
157
164
  * Operator mutations keep their original store; only presentation readers use
158
- * this facade. A focus loss cannot recall I/O already dispatched. */
165
+ * this facade. Suspension and stop fence subsequent read stages. */
159
166
  export function presentationReader<T extends object>(store: T, admitted: () => boolean): T {
160
167
  return new Proxy(store, {
161
168
  get(target, key, receiver) {
@@ -962,18 +962,22 @@ export class DispatchFrontend {
962
962
 
963
963
  private startPresentation(): void {
964
964
  this.accepting = true
965
- this.refresh = new DashboardRefresh(async () => {
966
- try {
967
- await this.readFrame()
968
- } catch (error) {
969
- if (this.refresh?.admitted)
970
- await this.report(
971
- `dashboard render failed: ${error instanceof Error ? error.message : String(error)}`,
972
- 'warning',
973
- )
974
- throw error
975
- }
976
- }, this.opts.refreshScheduler)
965
+ this.refresh = new DashboardRefresh(
966
+ async () => {
967
+ try {
968
+ await this.readFrame()
969
+ } catch (error) {
970
+ if (this.refresh?.admitted)
971
+ await this.report(
972
+ `dashboard render failed: ${error instanceof Error ? error.message : String(error)}`,
973
+ 'warning',
974
+ )
975
+ throw error
976
+ }
977
+ },
978
+ this.opts.refreshScheduler,
979
+ this.opts.store.networkReads,
980
+ )
977
981
  this.listen()
978
982
  this.opts.terminal.modes.enter(FOCUS_REPORTING_MODE)
979
983
  this.suspension = installPresentationSuspension(
@@ -3755,17 +3755,21 @@ class DispatchLoop {
3755
3755
 
3756
3756
  private startRendering(): void {
3757
3757
  if (!this.dashboard || this.refresh !== undefined) return
3758
- this.refresh = new DashboardRefresh(async () => {
3759
- try {
3760
- await this.readFrame()
3761
- } catch (error) {
3762
- if (this.refresh?.isFocused)
3763
- this.warn(
3764
- `dashboard render failed: ${error instanceof Error ? error.message : String(error)}`,
3765
- )
3766
- throw error
3767
- }
3768
- })
3758
+ this.refresh = new DashboardRefresh(
3759
+ async () => {
3760
+ try {
3761
+ await this.readFrame()
3762
+ } catch (error) {
3763
+ if (this.refresh?.painting)
3764
+ this.warn(
3765
+ `dashboard render failed: ${error instanceof Error ? error.message : String(error)}`,
3766
+ )
3767
+ throw error
3768
+ }
3769
+ },
3770
+ undefined,
3771
+ this.presentationStore.networkReads,
3772
+ )
3769
3773
  if (this.opts.once !== true) {
3770
3774
  if (this.opts.input !== undefined) this.opts.terminal?.modes.enter(FOCUS_REPORTING_MODE)
3771
3775
  if (this.opts.terminal !== undefined && this.opts.input !== undefined) {
@@ -792,7 +792,9 @@ export function renderTopLevelHelp(): string {
792
792
  '`ab` is Autobuild’s human/operator CLI and the agent↔store channel (SPEC §8.2).',
793
793
  '',
794
794
  'Primary human workflow:',
795
- ' Run `ab init` once, groom tickets to Ready, then run `ab dispatch`.',
795
+ ' Install in your repository: bun add -d --exact @defrex/autobuild',
796
+ ' Run `bun ab init` once, groom tickets to Ready, then run `bun ab dispatch`.',
797
+ ' Command notation `ab <command>` denotes the repository-installed CLI.',
796
798
  ' Dispatch drives planning, implementation, review, verification, and merge.',
797
799
  '',
798
800
  'For details, run `ab help <command>` or `ab <command> --help`.',
@@ -95,10 +95,9 @@ export interface PluginDiagnosis {
95
95
  export interface PluginLoadOptions {
96
96
  /** Root whose installed dependencies satisfy bare package specifiers first. */
97
97
  packageRoot?: string
98
- /** Autobuild installation root tried after `packageRoot`, so an extension
99
- * installed next to the CLI (`bun add -g @defrex/autobuild-<extension>`)
100
- * loads without being added to the repository. Defaults to the running
101
- * distribution's root. */
98
+ /** Autobuild installation root tried as a fallback after `packageRoot`.
99
+ * Extensions normally live in the repository's development dependencies.
100
+ * Defaults to the running distribution's root. */
102
101
  installationRoot?: string
103
102
  /** Guest context (AUT-517): a package-kind specifier that cannot be
104
103
  * resolved from either candidate is skipped with a notice instead of
@@ -170,6 +170,7 @@ export interface RemoteBuildStoreOptions {
170
170
  }
171
171
 
172
172
  export class RemoteBuildStore implements BuildStore {
173
+ readonly networkReads = true
173
174
  private readonly base: string
174
175
  private readonly token: string | undefined
175
176
  private readonly fetchFn: typeof fetch
@@ -17,6 +17,12 @@ export function releaseVersion(value: unknown): semver.SemVer | undefined {
17
17
  return parsed && parsed.version === value ? parsed : undefined
18
18
  }
19
19
 
20
+ /** Capability history, independent of admission: the audit signal arrived in 0.14. */
21
+ export function clientSupportsIntegrationAuditPending(version: unknown): boolean {
22
+ const parsed = releaseVersion(version)
23
+ return parsed !== undefined && (parsed.major > 0 || parsed.minor >= 14)
24
+ }
25
+
20
26
  const stableVersionSchema = z.string().refine((value) => stableVersion(value) !== undefined)
21
27
  export const supportedClientRangeSchema = z
22
28
  .strictObject({
@@ -267,6 +267,8 @@ export interface SubscribeOptions {
267
267
  }
268
268
 
269
269
  export interface BuildStore {
270
+ /** Reads cross a network boundary; presentation polling may use a relaxed cadence. */
271
+ readonly networkReads?: boolean
270
272
  /** Return an interface-enforced handle with authority over exactly `slug`.
271
273
  * The handle retains this shape so foreign/admin calls fail loudly. */
272
274
  scopeBuild(slug: string): BuildScopedStore
@@ -5,6 +5,10 @@ description: Authoritative reference for the autobuild system as installed in th
5
5
 
6
6
  # Autobuild system guide
7
7
 
8
+ Install Autobuild in the target repository with `bun add -d --exact @defrex/autobuild`.
9
+ Here, `ab <command>` means the repository-installed CLI; run it as
10
+ `bun ab <command>`, for example `bun ab init`.
11
+
8
12
  Reference material for an agent working on a repository that uses autobuild.
9
13
  This skill describes the *system*. It drives no phase and changes no files.
10
14
 
@@ -298,9 +302,9 @@ under the preceding table.
298
302
  Repository-path specifiers resolve from the config-bearing root, which is the
299
303
  immutable build worktree in scoped phases. npm package specifiers resolve from
300
304
  the consuming main checkout's installed dependencies first, then from the
301
- Autobuild installation the CLI runs from, so an extension installed next to
302
- the CLI (`bun add -g @defrex/autobuild-<extension>`) loads without being added
303
- to the repository; a repository copy wins over an installed one, and missing
305
+ Autobuild installation the CLI runs from as a fallback. Install extensions in
306
+ the consuming repository with `bun add -d --exact @defrex/autobuild-<extension>`;
307
+ a repository copy wins over an installed one, and missing
304
308
  packages fail and are never installed automatically. Specifier strings must be
305
309
  unique: an exact repeat fails config
306
310
  validation before resolution or evaluation, identifies the repeated value and
@@ -1,5 +1,9 @@
1
1
  # Authoring Autobuild plugins
2
2
 
3
+ Install Autobuild in the target repository with `bun add -d --exact @defrex/autobuild`.
4
+ Here, `ab <command>` means the repository-installed CLI; run it as
5
+ `bun ab <command>`, for example `bun ab init`.
6
+
3
7
  Use this reference when asked to connect Autobuild to another ticket tracker,
4
8
  agent runtime, workspace system, or forge. A plugin is a trusted Bun module
5
9
  loaded in-process from the consuming repository. **Definition of done for an
@@ -152,9 +156,10 @@ Add the module specifier at the TOML root, before any table. Repository-path
152
156
  specifiers resolve from the config-bearing root, which is the immutable build
153
157
  worktree in scoped phases. npm package specifiers resolve from the consuming
154
158
  main checkout's installed dependencies first, then from the Autobuild
155
- installation the CLI runs from (so `bun add -g @defrex/autobuild-<extension>`
156
- next to the CLI is enough); a repository copy wins over an installed one, and
157
- missing packages fail and are never installed automatically:
159
+ installation the CLI runs from as a fallback. Install extensions in the
160
+ consuming repository with `bun add -d --exact @defrex/autobuild-<extension>`;
161
+ a repository copy wins over an installed one, and missing packages fail and
162
+ are never installed automatically:
158
163
 
159
164
  ```toml
160
165
  plugins = ["./autobuild-plugin.ts"]
@@ -1,5 +1,9 @@
1
1
  # Repository setup
2
2
 
3
+ Install Autobuild in the target repository with `bun add -d --exact @defrex/autobuild`.
4
+ Here, `ab <command>` means the repository-installed CLI; run it as
5
+ `bun ab <command>`, for example `bun ab init`.
6
+
3
7
  Configure Autobuild outside the build pipeline. This conversation is not a
4
8
  build or phase. Work directly in the repository and involve the maintainer in
5
9
  choices that cannot be derived from source. Secrets belong in the environment