@defrex/autobuild 1.0.0-beta.4 → 1.0.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.
Files changed (54) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +45 -36
  3. package/docs/agent-runtimes.md +157 -0
  4. package/docs/build-store.md +123 -0
  5. package/docs/builds.md +82 -0
  6. package/docs/cli.md +48 -0
  7. package/docs/configuration-overview.md +93 -0
  8. package/docs/configuration.md +1626 -204
  9. package/docs/dispatcher-hosting.md +115 -0
  10. package/docs/dispatcher.md +59 -0
  11. package/docs/forges.md +121 -0
  12. package/docs/getting-started.md +60 -0
  13. package/docs/glossary.md +60 -0
  14. package/docs/hosted-service.md +2 -2
  15. package/docs/intake.md +48 -0
  16. package/docs/integration-overview.md +81 -0
  17. package/docs/operating.md +114 -0
  18. package/docs/operator-api.md +6 -6
  19. package/docs/operator-surfaces.md +90 -0
  20. package/docs/overview.md +49 -0
  21. package/docs/plugin-authoring.md +426 -0
  22. package/docs/remote-store-protocol.md +8 -8
  23. package/docs/seams.md +66 -0
  24. package/docs/setup.md +8 -6
  25. package/docs/skills.md +119 -0
  26. package/docs/ticket-sources.md +132 -0
  27. package/docs/tickets.md +69 -0
  28. package/docs/troubleshooting.md +111 -0
  29. package/docs/upgrading.md +50 -0
  30. package/docs/verification.md +146 -0
  31. package/docs/website.md +47 -5
  32. package/docs/workspaces.md +152 -0
  33. package/package.json +5 -4
  34. package/packages/core/src/cli/env.ts +1 -1
  35. package/packages/core/src/cli/help.ts +4 -2
  36. package/packages/core/src/config/landing.ts +8 -0
  37. package/packages/core/src/config/reference-metadata.ts +31 -0
  38. package/packages/core/src/config/reference.ts +342 -0
  39. package/packages/core/src/config/roles.ts +1 -1
  40. package/packages/core/src/config/schema.ts +344 -6
  41. package/packages/core/src/ontology.ts +2 -2
  42. package/packages/core/src/open-map.ts +3 -1
  43. package/skills/finalize/SKILL.md +3 -1
  44. package/skills/guide/SKILL.md +42 -25
  45. package/skills/guide/references/operator-api.md +18 -10
  46. package/skills/guide/references/plugin-authoring.md +227 -303
  47. package/skills/guide/references/remote-store-protocol.md +8 -8
  48. package/skills/guide/references/setup.md +8 -6
  49. package/skills/implement/SKILL.md +4 -2
  50. package/skills/operate/SKILL.md +26 -27
  51. package/skills/plan/SKILL.md +12 -4
  52. package/skills/spec/SKILL.md +1 -1
  53. package/skills/tickets/SKILL.md +1 -1
  54. package/templates/hosted-service/package.json +2 -2
@@ -12,6 +12,7 @@
12
12
  * validated.
13
13
  */
14
14
  import { z } from 'zod'
15
+ import { documentSchema, documentFields } from './reference-metadata'
15
16
  import { landingRuleSchema } from './landing'
16
17
  export { landingRuleSchema, type LandingRule } from './landing'
17
18
  import { normalizeServiceURL } from '../connection'
@@ -66,15 +67,16 @@ function stepSection<T, C>(
66
67
  compose: (steps: string[], stepConfigs: Record<string, T>, afterReconcile: boolean) => C,
67
68
  allowAfterReconcile = false,
68
69
  ) {
69
- return z
70
+ const afterReconcileSchema = z.boolean().default(true)
71
+ const schema = z
70
72
  .unknown()
71
73
  .transform((input, ctx): C => {
72
74
  const stepConfigs: Record<string, T> = Object.create(null)
73
75
  let steps: string[] = []
74
- let afterReconcile = true
76
+ let afterReconcile = afterReconcileSchema.parse(undefined)
75
77
  for (const [key, raw] of ownEntries(input, label, ctx)) {
76
78
  if (key === 'afterReconcile' && allowAfterReconcile) {
77
- const parsed = z.boolean().safeParse(raw)
79
+ const parsed = afterReconcileSchema.safeParse(raw)
78
80
  if (parsed.success) afterReconcile = parsed.data
79
81
  else forwardIssues(parsed.error.issues, ctx, [key])
80
82
  continue
@@ -91,6 +93,26 @@ function stepSection<T, C>(
91
93
  return compose(steps, stepConfigs, afterReconcile)
92
94
  })
93
95
  .prefault({})
96
+ documentSchema(stepsSchema, {
97
+ description:
98
+ 'Ordered names of the configured step tables. Every listed step must have a table and every table must be listed.',
99
+ })
100
+ documentSchema(tableSchema, {
101
+ description:
102
+ 'Named step. Select exactly one strict variant using kind; command belongs only to check, skill only to agent.',
103
+ })
104
+ documentSchema(afterReconcileSchema, {
105
+ description:
106
+ 'Whether verification runs after reconciliation. A step override takes precedence.',
107
+ })
108
+ return documentSchema(schema, {
109
+ structure: {
110
+ kind: 'steps',
111
+ steps: stepsSchema,
112
+ table: tableSchema,
113
+ ...(allowAfterReconcile ? { afterReconcile: afterReconcileSchema } : {}),
114
+ },
115
+ })
94
116
  }
95
117
 
96
118
  // ── [pr] / [pr.imageHost] ────────────────────────────────────────────────────
@@ -98,11 +120,22 @@ function stepSection<T, C>(
98
120
  /** Optional public GitHub release used for review-window image copies.
99
121
  * Omission is intentionally `undefined`: hosting is off by default. */
100
122
  export const imageHostSchema = prImageHostSchema
123
+
124
+ documentFields(imageHostSchema, {
125
+ provider: 'Select the GitHub release adapter.',
126
+ repository: 'Public repository containing the existing review release.',
127
+ releaseId: 'Numeric id of an existing published, mutable release.',
128
+ })
101
129
  export type ImageHostConfig = z.infer<typeof imageHostSchema>
102
130
 
103
131
  export const prSchema = z.strictObject({
104
132
  imageHost: imageHostSchema.optional(),
105
133
  })
134
+
135
+ documentFields(prSchema, {
136
+ imageHost:
137
+ 'Copy attached images to a temporary public review location so they can render inline.',
138
+ })
106
139
  export type PrConfig = z.infer<typeof prSchema>
107
140
 
108
141
  // ── [workspace] ─────────────────────────────────────────────────────────────
@@ -120,6 +153,12 @@ export const vercelProvisioningStepSchema = z.strictObject({
120
153
  name: nonblankProvisioningString('provisioning step name'),
121
154
  command: nonblankProvisioningString('provisioning step command'),
122
155
  })
156
+
157
+ documentFields(vercelProvisioningStepSchema, {
158
+ name: 'Unique provisioning step name. Must contain a non-whitespace character.',
159
+ command:
160
+ 'Shell command executed in declaration order during provisioning. Must contain a non-whitespace character.',
161
+ })
123
162
  export type VercelProvisioningStep = z.infer<typeof vercelProvisioningStepSchema>
124
163
 
125
164
  const vercelUniversalImageSchema = z
@@ -136,6 +175,15 @@ export const runtimeProvisioningEntrySchema = z.strictObject({
136
175
  install: z.string().refine((value) => value.trim().length > 0, 'install must be nonblank'),
137
176
  preflight: z.string().refine((value) => value.trim().length > 0, 'preflight must be nonblank'),
138
177
  })
178
+
179
+ documentFields(runtimeProvisioningEntrySchema, {
180
+ install: 'required nonblank shell command; use an immutable package version, digest, or commit',
181
+ preflight: 'required nonblank shell command; verify the expected executable and exact version',
182
+ })
183
+ documentSchema(runtimeProvisioningEntrySchema, {
184
+ description:
185
+ 'Installation and preflight commands for an effective runtime. Every effective role or alternate runtime must have an entry.',
186
+ })
139
187
  export type RuntimeProvisioningEntry = z.infer<typeof runtimeProvisioningEntrySchema>
140
188
 
141
189
  export const runtimeProvisioningSchema = openMap(
@@ -230,6 +278,36 @@ export const vercelSandboxConfigSchema = z
230
278
  }
231
279
  }
232
280
  })
281
+
282
+ documentFields(vercelSandboxConfigSchema, {
283
+ image: 'Managed image used to provision the workspace.',
284
+ vcpus:
285
+ 'Virtual CPUs allocated to each workspace; provider account limits may further restrict allocation.',
286
+ timeoutSeconds:
287
+ 'VM/session lifetime in seconds and abrupt-orphan bound. Provider plan limits also apply.',
288
+ operationTimeoutMs:
289
+ 'Deadline in milliseconds for each provider acknowledgement, independent of session lifetime.',
290
+ snapshotExpirationSeconds:
291
+ 'Snapshot expiration in seconds. Omission uses the provider expiration policy.',
292
+ region: 'Primary region; omission uses the provider region selection.',
293
+ failoverRegions:
294
+ 'Ordered alternative regions used if the primary region cannot provision a workspace.',
295
+ environmentVariables:
296
+ 'unique API-credential variable names copied into runtime and agent/check commands',
297
+ provisioning:
298
+ 'ordered strict inline tables `{ name, command }`; names and commands are nonblank and names are unique',
299
+ runtimeProvisioning:
300
+ 'open map keyed by every effective role/alternate runtime; each entry requires `install` and `preflight`',
301
+ gitUsernameEnv:
302
+ 'optional variable name for the dedicated read-only clone username; requires `gitPasswordEnv`',
303
+ gitPasswordEnv:
304
+ 'optional variable name for the dedicated read-only clone password; requires `gitUsernameEnv`',
305
+ })
306
+ documentSchema(vercelSandboxConfigSchema, {
307
+ description: 'Strict Vercel workspace provisioning configuration.',
308
+ constraints:
309
+ 'Environment variable and failover region lists must be unique. Failovers exclude the primary region. Provisioning names must be unique. Clone credential names must be configured together, excluded from runtime environmentVariables, and separate from Forge and Vercel credentials.',
310
+ })
233
311
  type NormalizedVercelSandboxConfig = z.infer<typeof vercelSandboxConfigSchema>
234
312
  /** Direct provider construction remains source-compatible; schema-parsed
235
313
  * production config always materializes operationTimeoutMs. */
@@ -256,7 +334,21 @@ export const workspaceSchema = z.strictObject({
256
334
  '[workspace].provider must be a nonblank provider name',
257
335
  )
258
336
  .default('git-worktree'),
259
- config: openMap('[workspace.config]', z.unknown(), { keys: 'any' }),
337
+ config: openMap(
338
+ '[workspace.config]',
339
+ documentSchema(z.unknown(), {
340
+ description:
341
+ 'Plugin-owned value passed through unchanged. Builtin providers validate their own declared schema.',
342
+ }),
343
+ { keys: 'any' },
344
+ ),
345
+ })
346
+
347
+ documentFields(workspaceSchema, {
348
+ provider:
349
+ 'Select the provider used for provisioning, recovery, PR epilogue working-directory calls, and release.',
350
+ config:
351
+ 'Adapter-specific declarative configuration passed unchanged to the selected plugin factory.',
260
352
  })
261
353
  export type WorkspaceConfig = z.infer<typeof workspaceSchema>
262
354
 
@@ -329,7 +421,10 @@ export const BUILTIN_WORKSPACE_PROVIDER_CONFIG: ReadonlyMap<
329
421
  // Open map of deterministic verbs the kernel may run. `setup`, `lint`,
330
422
  // `typecheck`, `test` are conventions, not required keys (§16.1).
331
423
 
332
- export const commandsSchema = openMap('[commands]', z.string().min(1))
424
+ export const commandsSchema = openMap(
425
+ '[commands]',
426
+ documentSchema(z.string().min(1), { description: 'Named deterministic shell command.' }),
427
+ )
333
428
  export type Commands = z.infer<typeof commandsSchema>
334
429
 
335
430
  // ── [verify.<step>] ──────────────────────────────────────────────────────────
@@ -377,6 +472,11 @@ export const verifyPathGlobSchema = z.string().superRefine((pattern, ctx) => {
377
472
  if (message !== undefined) ctx.addIssue({ code: 'custom', message })
378
473
  })
379
474
 
475
+ documentSchema(verifyPathGlobSchema, {
476
+ constraints:
477
+ 'Positive repository-relative globs with literal characters, *, ?, and whole-segment ** only. No NUL, absolute paths, backslashes, negation, empty or traversal segments, character classes, brace expansion or extglobs.',
478
+ })
479
+
380
480
  const verifyApplicabilityShape = {
381
481
  afterReconcile: z.boolean().optional(),
382
482
  /** Any-match positive path selectors; absent means unconditional. */
@@ -397,6 +497,17 @@ export const verifyCheckStepSchema = z.strictObject({
397
497
  ...verifyApplicabilityShape,
398
498
  })
399
499
 
500
+ documentFields(verifyCheckStepSchema, {
501
+ kind: 'Select the strict step variant. Fields from another variant are rejected.',
502
+ command:
503
+ 'Name of an existing command in [commands]; required for check steps and forbidden for agent steps.',
504
+ afterReconcile:
505
+ 'Step override wins over `[verify].afterReconcile`; false skips this step after reconciliation only.',
506
+ paths: 'Apply only when at least one changed path matches. Available to both variants.',
507
+ always:
508
+ '`true` makes the step mandatory in plan selection and bypasses path gating. Available to both variants.',
509
+ })
510
+
400
511
  export const verifyAgentStepSchema = z.strictObject({
401
512
  /** Agent-verify: skill + verdict schema (§16.1). */
402
513
  kind: z.literal('agent'),
@@ -404,6 +515,16 @@ export const verifyAgentStepSchema = z.strictObject({
404
515
  ...verifyApplicabilityShape,
405
516
  })
406
517
 
518
+ documentFields(verifyAgentStepSchema, {
519
+ kind: 'Select the strict step variant. Fields from another variant are rejected.',
520
+ skill: 'Exact installed skill name; required for agent steps and forbidden for check steps.',
521
+ afterReconcile:
522
+ 'Step override wins over `[verify].afterReconcile`; false skips this step after reconciliation only.',
523
+ paths: 'Apply only when at least one changed path matches. Available to both variants.',
524
+ always:
525
+ '`true` makes the step mandatory in plan selection and bypasses path gating. Available to both variants.',
526
+ })
527
+
407
528
  export const verifyStepConfigSchema = z.discriminatedUnion('kind', [
408
529
  verifyCheckStepSchema,
409
530
  verifyAgentStepSchema,
@@ -441,12 +562,23 @@ export const finalizeCheckStepSchema = z.strictObject({
441
562
  command: z.string().min(1),
442
563
  })
443
564
 
565
+ documentFields(finalizeCheckStepSchema, {
566
+ kind: 'Select the strict step variant. Fields from another variant are rejected.',
567
+ command:
568
+ 'Name of an existing command in [commands]; required for check steps and forbidden for agent steps.',
569
+ })
570
+
444
571
  export const finalizeAgentStepSchema = z.strictObject({
445
572
  kind: z.literal('agent'),
446
573
  /** Exact installed skill name passed to the configured runtime. */
447
574
  skill: z.string().min(1),
448
575
  })
449
576
 
577
+ documentFields(finalizeAgentStepSchema, {
578
+ kind: 'Select the strict step variant. Fields from another variant are rejected.',
579
+ skill: 'Exact installed skill name; required for agent steps and forbidden for check steps.',
580
+ })
581
+
450
582
  export const finalizeStepConfigSchema = z.discriminatedUnion('kind', [
451
583
  finalizeCheckStepSchema,
452
584
  finalizeAgentStepSchema,
@@ -487,6 +619,14 @@ const runtimeAxesSchema = z.strictObject({
487
619
  extensions: z.array(z.string().min(1)).optional(),
488
620
  })
489
621
 
622
+ documentFields(runtimeAxesSchema, {
623
+ runtime: 'Select an agent adapter.',
624
+ model: 'Select the exact model. Codex uses unqualified `gpt-*`; Pi ids are provider-qualified.',
625
+ args: 'Ordered extra CLI argv tokens applied to every phase and tool-free one-shot invocation. A supplied list replaces, rather than unions with, the inherited list.',
626
+ extensions:
627
+ 'Compatibility-only field. Dispatch warns for each declaring role; migrate explicit runtime options to `args`.',
628
+ })
629
+
490
630
  export const roleSchema = runtimeAxesSchema.extend({
491
631
  // Wall-clock budget for each session dispatched through this logical role.
492
632
  // Absent ⇒ inherit [roles.default], then [policy].sessionBudgetSeconds.
@@ -504,6 +644,42 @@ export const roleSchema = runtimeAxesSchema.extend({
504
644
  // entry overlays the concrete role's resolved primary axes.
505
645
  alternates: z.array(runtimeAxesSchema).optional(),
506
646
  })
647
+
648
+ documentFields(roleSchema, {
649
+ runtime: 'Select an agent adapter.',
650
+ model: 'Select the exact model. Codex uses unqualified `gpt-*`; Pi ids are provider-qualified.',
651
+ args: 'Ordered extra CLI argv tokens applied to every phase and tool-free one-shot invocation. A supplied list replaces, rather than unions with, the inherited list.',
652
+ extensions:
653
+ 'Compatibility-only field. Dispatch warns for each declaring role; migrate explicit runtime options to `args`.',
654
+ sessionBudgetSeconds:
655
+ 'Active-time budget for each build phase session routed through this logical role. Suspended intervals are excluded; native continuation retains the original ceiling and accumulated active time. One budget covers the primary and every alternate target.',
656
+ alternates:
657
+ "Failure-triggered execution targets (provider failures and a runtime whose CLI is not installed). A role's list replaces the inherited list wholesale; each entry overlays that role's effective primary axes. `extensions` is accepted there only as the same deprecated no-op.",
658
+ })
659
+ documentSchema(roleSchema, {
660
+ description:
661
+ 'Named role inheriting each omitted axis from roles.default. The default role must name a registered runtime.',
662
+ })
663
+ documentSchema(roleSchema.shape.runtime, {
664
+ constraints:
665
+ 'Required on roles.default by runtime resolution; other roles inherit it. Must name a registered runtime.',
666
+ })
667
+ documentSchema(roleSchema.shape.model, {
668
+ constraints:
669
+ 'Omission inherits the base model, otherwise uses the selected runtime default. Must be compatible with that runtime.',
670
+ })
671
+ documentSchema(roleSchema.shape.args, {
672
+ constraints:
673
+ 'Omission inherits the base list, otherwise resolves to an empty list; an explicit list replaces it.',
674
+ })
675
+ documentSchema(roleSchema.shape.sessionBudgetSeconds, {
676
+ constraints:
677
+ 'Omission inherits roles.default.sessionBudgetSeconds, otherwise policy.sessionBudgetSeconds.',
678
+ })
679
+ documentSchema(roleSchema.shape.alternates, {
680
+ constraints:
681
+ 'Omission inherits the base alternate list, otherwise resolves to an empty list; each alternate overlays the resolved primary axes.',
682
+ })
507
683
  export type RoleConfig = z.infer<typeof roleSchema>
508
684
 
509
685
  // ── [policy] ─────────────────────────────────────────────────────────────────
@@ -533,6 +709,30 @@ export const policySchema = z.strictObject({
533
709
  janitorBackoffMaxSeconds: z.number().int().positive().default(300),
534
710
  harvestMaxDrift: z.number().int().nonnegative().default(3),
535
711
  })
712
+
713
+ documentFields(policySchema, {
714
+ upgradeDrainSeconds:
715
+ 'Deadline for a retiring generation, relative to handoff start; hot-reloaded during drain.',
716
+ sessionBudgetSeconds:
717
+ 'Active-time bound for each build agent session unless its logical role overrides it. Native continuation retains the original ceiling; suspension does not consume it.',
718
+ stallRounds: 'Escalate when the same review finding survives this many rounds.',
719
+ maxVerifyAttempts: 'Bound failure-driven verify \u2192 implement retry cycles.',
720
+ maxDispatchAttempts: 'Bound consecutive dispatch failures before human escalation.',
721
+ maxSetupAttempts: 'Bound consecutive workspace setup failures before human escalation.',
722
+ maxInfrastructureAttempts:
723
+ 'Bound consecutive provision/start/wait/cleanup failures before a setup-targeted policy escalation; a human `retry` answer re-arms this budget.',
724
+ maxReconcileAttempts:
725
+ 'Bound completed reconciles that leave the PR conflicted against an unchanged authoritative base. Moving-base races do not consume the bound.',
726
+ maxReviewRounds:
727
+ 'Default bound for each plan/review and implement/review convergence loop. Your agent may replace it for one parked build loop and current spec revision with `ab answer --review-round-ceiling`; other builds are unaffected.',
728
+ harvestThreshold: 'New unclaimed observation occurrences needed to start one harvest run.',
729
+ janitorFailureAttentionSeconds: 'Consecutive janitor failure duration before build attention.',
730
+ nodeIdleAfterSeconds: 'Quiet period before opened integration nodes enter idle polling.',
731
+ nodeIdlePollSeconds: 'Interval between idle node checks; durable activity wakes the next tick.',
732
+ janitorBackoffMaxSeconds: 'Cap on exponential janitor retry delay, starting at 30 seconds.',
733
+ harvestMaxDrift:
734
+ 'Other builds merged after the oldest unclaimed observation needed to start a run; `0` disables drift.',
735
+ })
536
736
  export type PolicyConfig = z.infer<typeof policySchema>
537
737
 
538
738
  // ── [tickets] ────────────────────────────────────────────────────────────────
@@ -643,6 +843,65 @@ export const ticketsInputSchema = z.strictObject({
643
843
  * still tell a defaulted dir from an explicit one. */
644
844
  dir: z.string().min(1).optional(),
645
845
  })
846
+
847
+ documentFields(ticketsInputSchema, {
848
+ url: 'Ticket service independent of [store] url and AB_STORE. Required with local builds.',
849
+ source: 'Select the ticket adapter after configured plugins load.',
850
+ readyLabels: 'Require every listed label in addition to the state gate.',
851
+ readyState: 'The one workflow state eligible for dispatch.',
852
+ readyAssignee:
853
+ 'Require the ticket to be assigned to one Linear user, in addition to the state and label gates.',
854
+ teamKey: 'Backend team key such as `"ENG"`, or an existing plugin config field.',
855
+ claimedState: 'Workflow state entered when a ticket is claimed.',
856
+ doneState: 'Project completion state and merged-ticket transition.',
857
+ createState: 'Default state for newly created tickets when `ab ticket create` omits `--state`.',
858
+ triageState: 'State used for spec-gate bounces, aborts, and closed-unmerged PRs.',
859
+ proposalState:
860
+ 'State harvest files its synthesized proposals into. Setting it to `readyState` waives the human grooming gate, not dependency eligibility.',
861
+ dir: 'Root containing file-source state directories, or an existing plugin config field. Relative file paths resolve from the repository.',
862
+ })
863
+ documentSchema(ticketsInputSchema, {
864
+ constraints:
865
+ 'readyState is required except for hosted, which resolves omission to ready. url is forbidden for file and linear; hosted URLs are normalized service URLs.',
866
+ })
867
+ documentSchema(ticketsInputSchema.shape.readyState, {
868
+ required: 'Required unless source = "hosted"; hosted omission resolves to "ready".',
869
+ })
870
+ documentSchema(ticketsInputSchema.shape.teamKey, {
871
+ required: 'Required for linear and hosted; forbidden for file; optional for plugins.',
872
+ })
873
+ documentSchema(ticketsInputSchema.shape.claimedState, { constraints: 'Forbidden for file.' })
874
+ documentSchema(ticketsInputSchema.shape.dir, { constraints: 'Forbidden for linear and hosted.' })
875
+ documentSchema(ticketsInputSchema.shape.readyAssignee, { constraints: 'Allowed only for linear.' })
876
+ documentSchema(ticketsInputSchema.shape.readyLabels, {
877
+ constraints:
878
+ 'Omission uses source readiness defaults (Linear: autobuild label; file: none). Explicit [] disables label gating.',
879
+ })
880
+ documentSchema(ticketsInputSchema.shape.url, {
881
+ constraints:
882
+ 'Forbidden for file and linear. Hosted omission uses the selected remote BuildStore URL; with a local BuildStore an explicit hosted URL is required.',
883
+ })
884
+ documentSchema(ticketsInputSchema.shape.doneState, {
885
+ constraints: 'Hosted resolution uses done when omitted.',
886
+ })
887
+ documentSchema(ticketsInputSchema.shape.claimedState, {
888
+ constraints:
889
+ 'Forbidden for file. Resolution uses In Progress for direct Linear, doing for hosted.',
890
+ })
891
+ documentSchema(ticketsInputSchema.shape.createState, {
892
+ constraints: 'Omission uses the source creation state (Linear team default; file Triage).',
893
+ })
894
+ documentSchema(ticketsInputSchema.shape.triageState, {
895
+ constraints:
896
+ 'Omission resolves to Backlog for Linear, triage for hosted, Triage for file/plugin sources.',
897
+ })
898
+ documentSchema(ticketsInputSchema.shape.proposalState, {
899
+ constraints: 'Omission uses the resolved triageState.',
900
+ })
901
+ documentSchema(ticketsInputSchema.shape.dir, {
902
+ constraints:
903
+ 'Forbidden for linear and hosted. File omission resolves to the selected local state root tickets directory; plugin omission remains omitted.',
904
+ })
646
905
  export const ticketsSchema = ticketsInputSchema
647
906
  .superRefine((tickets, ctx) => {
648
907
  if (tickets.source === 'hosted' && tickets.url !== undefined) {
@@ -673,6 +932,11 @@ export const ticketsSchema = ticketsInputSchema
673
932
  ? { url: normalizeServiceURL(tickets.url, 'tickets.url') }
674
933
  : {}),
675
934
  }))
935
+
936
+ documentSchema(ticketsSchema, {
937
+ constraints:
938
+ 'readyState is required except for hosted, whose omitted value resolves to ready. url is forbidden for file and linear; hosted URLs must be absolute HTTPS (loopback HTTP allowed), without credentials, query or fragment, and are normalized.',
939
+ })
676
940
  export type TicketsConfig = z.infer<typeof ticketsSchema>
677
941
 
678
942
  // ── [orchestrator] ──────────────────────────────────────────────────────────
@@ -692,6 +956,17 @@ export const orchestratorSandboxSchema = z.strictObject({
692
956
  * config error. Unset means none. */
693
957
  environmentVariables: z.array(z.string().min(1)).default([]),
694
958
  })
959
+
960
+ documentFields(orchestratorSandboxSchema, {
961
+ idleMinutes:
962
+ "Minutes without a sandbox tool call after which the dispatcher tick's janitor stops the environment, keeping its snapshot; the next tool call resumes it.",
963
+ environmentVariables:
964
+ 'Names of non-secret host variables forwarded into the sandbox \u2014 the only non-toolchain environment it ever sees, during provisioning/setup and tool exec/start alike. Unset means none.',
965
+ })
966
+ documentSchema(orchestratorSandboxSchema.shape.environmentVariables, {
967
+ constraints:
968
+ 'When enabled, forwarding store, forge, ticket-provider, model or Vercel credentials, or builtin-provider forbidden names, is rejected.',
969
+ })
695
970
  export type OrchestratorSandboxConfig = z.infer<typeof orchestratorSandboxSchema>
696
971
 
697
972
  /** The turn runner lives inside the hosted operator route and the dispatcher
@@ -797,6 +1072,29 @@ export const orchestratorSchema = z.strictObject({
797
1072
  * `ab watch` compiler. */
798
1073
  wake: z.array(z.string().min(1)).optional(),
799
1074
  })
1075
+
1076
+ documentFields(orchestratorSchema, {
1077
+ enabled:
1078
+ 'Master gate. With the table absent or `enabled = false`, the sandbox tools are absent from every binding, no environment is ever provisioned, and no dispatcher tick or message post ever runs orchestrator code \u2014 a local dispatcher is inert even when enabled, because the turn runner exists only in the hosted deployment.',
1079
+ sandbox: 'Sandbox behavior knobs.',
1080
+ model:
1081
+ "Provider-qualified model string for the turn runner, in the same vocabulary as `[roles]` model strings (a leading `vercel-ai-gateway/` prefix is accepted and stripped). Resolved through the deployment's gateway credential.",
1082
+ invocationBudgetSeconds:
1083
+ 'Wall-clock budget in seconds for one turn invocation. Values above the route limit are clamped after parsing.',
1084
+ approvals:
1085
+ "Registry tool names whose calls suspend a turn until you answer. Empty (`[]`) means none \u2014 autonomous operation. An entry naming an absent or unknown tool is **inert by design**, never a config error: the list stays stable while the registry grows, and a tool's removal cannot break parsing. A `tool:qualifier` entry applies to the named discriminator value only (for example `tickets.move:ready` approves moving a ticket to `ready`); for a tool without a discriminator, only the bare form matches.",
1086
+ wake: 'The attention events a **new** session wakes for. Kept schema-optional so absent (inherit the legacy hosted wake set including `integration.verification-failed`, independently of CLI watch defaults) and `[]` (never wake; message-only) stay distinct. Each glob must match at least one build or repository-journal event type, validated with the same compiler `ab watch` uses. Existing sessions never retroactively inherit; an explicit `PUT .../wake` always wins.',
1087
+ })
1088
+ documentSchema(orchestratorSchema.shape.model, {
1089
+ required: 'Required when orchestrator.enabled = true.',
1090
+ })
1091
+ documentSchema(orchestratorSchema.shape.invocationBudgetSeconds, {
1092
+ constraints: `Values above ${ORCHESTRATOR_ROUTE_LIMIT_SECONDS} are clamped to that limit after parsing.`,
1093
+ })
1094
+ documentSchema(orchestratorSchema.shape.wake, {
1095
+ constraints:
1096
+ 'Every glob must match a known build or repository-journal event. Omission inherits the legacy hosted wake set independently of CLI watch defaults; [] disables waking.',
1097
+ })
800
1098
  export type OrchestratorConfig = z.infer<typeof orchestratorSchema>
801
1099
 
802
1100
  // ── Whole file ───────────────────────────────────────────────────────────────
@@ -811,7 +1109,15 @@ export const storeSchema = z.strictObject({
811
1109
  }
812
1110
  }),
813
1111
  })
814
- const configRootSchema = z.strictObject({
1112
+
1113
+ documentFields(storeSchema, {
1114
+ url: 'Absolute HTTPS service base URL; loopback HTTP is allowed for development. No credentials, query or fragment. Trailing slashes are normalized.',
1115
+ })
1116
+ documentSchema(storeSchema.shape.url, {
1117
+ constraints:
1118
+ 'Absolute HTTPS service URL; loopback HTTP allowed. No credentials, query or fragment. Trailing slashes normalized.',
1119
+ })
1120
+ export const configRootSchema = z.strictObject({
815
1121
  store: storeSchema.optional(),
816
1122
  upgrade: z.strictObject({ automatic: z.boolean().default(true) }).prefault({}),
817
1123
  /** Base branch builds cut from and target (§16.1). */
@@ -858,6 +1164,38 @@ const configRootSchema = z.strictObject({
858
1164
  } as z.input<typeof ticketsSchema>),
859
1165
  })
860
1166
 
1167
+ documentFields(configRootSchema, {
1168
+ store: 'Optional remote BuildStore connection. Credentials live outside TOML.',
1169
+ upgrade: 'Automatic dispatcher runtime target checks and adoption.',
1170
+ baseBranch: 'Branch used to cut builds, target PRs, and merge during reconciliation.',
1171
+ capacity:
1172
+ 'Concurrent occupied slots for this repository. Paused and blocked work retains slots. Node reconcile and verification exclude their own blocked/paused descendants at admission; new claims use total occupancy. See [integration capacity](integration-tree.md).',
1173
+ ticketScanIntervalSeconds:
1174
+ 'Ticket-source ready scan cadence; tick spacing is the effective minimum.',
1175
+ forge:
1176
+ 'Forge adapter name. Shipped values are `github` and `local-git`; configured plugins may register other names.',
1177
+ plugins:
1178
+ 'Trusted Bun plugin modules loaded by dispatch, `ab ticket`, and scoped phase CLI processes.',
1179
+ landing: 'Ordered landing rules; the first matching rule controls consent.',
1180
+ pr: 'Pull request review image hosting configuration.',
1181
+ workspace: 'Workspace provider selector and provider-specific configuration.',
1182
+ commands: 'Named shell commands used by setup and deterministic checks.',
1183
+ verify: 'Ordered verification steps and applicability rules.',
1184
+ finalize: 'Ordered post-PR steps. Failures are recorded without blocking the PR.',
1185
+ roles: 'Named agent roles. The reserved default role provides inherited runtime axes.',
1186
+ policy: 'Lifecycle budgets, retries, convergence and harvest limits.',
1187
+ orchestrator:
1188
+ 'Operator-agent sandbox settings. This table does not start or host an operator agent.',
1189
+ tickets:
1190
+ 'Ticket source and lifecycle vocabulary. Omitting the table supplies source=file but still requires readyState.',
1191
+ })
1192
+ documentSchema(configRootSchema.shape.upgrade.unwrap().shape.automatic, {
1193
+ description: 'Check and adopt changed runtime targets automatically.',
1194
+ })
1195
+ documentSchema(configRootSchema.shape.plugins, {
1196
+ constraints: 'Exact module specifiers must be unique.',
1197
+ })
1198
+
861
1199
  /** Root metadata keeps strict error prose and documentation coverage honest. */
862
1200
  export const TOP_LEVEL_SCALARS = [
863
1201
  'baseBranch',
@@ -37,7 +37,7 @@ export function isPhase(value: string): value is Phase {
37
37
  return isCorePhase(value) || isVerifyPhase(value)
38
38
  }
39
39
 
40
- /** `verify:e2e` → `e2e` */
40
+ /** `verify:acceptance` → `acceptance` */
41
41
  export function verifyStep(phase: VerifyPhase): string {
42
42
  return phase.slice('verify:'.length)
43
43
  }
@@ -172,7 +172,7 @@ export const CORE_ARTIFACT_KINDS = [
172
172
  ] as const
173
173
  export type CoreArtifactKind = (typeof CORE_ARTIFACT_KINDS)[number]
174
174
 
175
- /** `e2e` → `verify-report:e2e` */
175
+ /** `acceptance` → `verify-report:acceptance` */
176
176
  export function verifyReportKind(step: string): string {
177
177
  return `verify-report:${step}`
178
178
  }
@@ -30,6 +30,7 @@
30
30
  * likewise author-chosen — there, by the plugin author rather than the operator.
31
31
  */
32
32
  import { z } from 'zod'
33
+ import { documentSchema } from './config/reference-metadata'
33
34
  import { forwardIssues, type IssueSink } from './zod-issues'
34
35
 
35
36
  /** How an entry name is validated. Autobuild-owned maps must be able to address
@@ -185,7 +186,7 @@ export function parseEntry<T>(
185
186
  */
186
187
  export function openMap<T>(label: string, valueSchema: z.ZodType<T>, opts: OpenMapOptions = {}) {
187
188
  const keys = opts.keys ?? 'nonempty'
188
- return z
189
+ const schema = z
189
190
  .unknown()
190
191
  .transform((input, ctx): Record<string, T> => {
191
192
  const entries: Record<string, T> = Object.create(null)
@@ -200,4 +201,5 @@ export function openMap<T>(label: string, valueSchema: z.ZodType<T>, opts: OpenM
200
201
  return entries
201
202
  })
202
203
  .prefault({})
204
+ return documentSchema(schema, { structure: { kind: 'map', value: valueSchema, keys } })
203
205
  }
@@ -9,6 +9,8 @@ The build is green: plan approved, code approved, every verify step passed.
9
9
  You write the PR description; the kernel opens the PR when you finish (you
10
10
  never touch the forge).
11
11
 
12
+ Guidance is an external operator answer, from the operator agent or a human.
13
+
12
14
  ## Session shape
13
15
 
14
16
  1. Run `ab context`. You get `.ab/spec.md`, `.ab/plan.md`, every verify report,
@@ -36,7 +38,7 @@ never touch the forge).
36
38
  `ab done` validates the deposit; the kernel opens the PR from it. One
37
39
  terminal command; if validation fails, fix what it names and rerun.
38
40
 
39
- `.ab/guidance.json`, when present, is a human operator's answer to the
41
+ `.ab/guidance.json`, when present, is an operator's answer to the
40
42
  escalation that blocked this build: the escalation id and the answer text. It
41
43
  is authoritative feedback for this attempt and the PR description must act on
42
44
  it, while the spec remains the contract this phase is measured against — if the