@defrex/autobuild 1.5.0 → 1.7.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 (126) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +192 -24
  3. package/docs/agent-runtimes.md +1 -1
  4. package/docs/answering-blocked-builds.md +7 -4
  5. package/docs/architecture.md +100 -32
  6. package/docs/configuration-overview.md +10 -0
  7. package/docs/configuration.md +340 -10
  8. package/docs/dispatcher.md +2 -2
  9. package/docs/forges.md +1 -0
  10. package/docs/glossary.md +1 -1
  11. package/docs/operating.md +1 -1
  12. package/docs/operator-api.md +33 -10
  13. package/docs/operator-surfaces.md +6 -3
  14. package/docs/plugin-authoring.md +48 -6
  15. package/docs/remote-store-protocol.md +33 -10
  16. package/docs/restacking.md +16 -7
  17. package/docs/ticket-sources.md +34 -6
  18. package/docs/tickets.md +7 -1
  19. package/docs/troubleshooting.md +1 -1
  20. package/docs/workspaces.md +1 -1
  21. package/package.json +3 -3
  22. package/packages/core/src/cli/attention.ts +3 -0
  23. package/packages/core/src/cli/binary-direct.ts +1 -0
  24. package/packages/core/src/cli/dashboard/model.ts +14 -4
  25. package/packages/core/src/cli/dashboard/poll.ts +14 -0
  26. package/packages/core/src/cli/dashboard/render.ts +3 -0
  27. package/packages/core/src/cli/dispatch-frontend.ts +10 -14
  28. package/packages/core/src/cli/dispatch-preflight.ts +5 -1
  29. package/packages/core/src/cli/dispatch-repository-feed.ts +145 -109
  30. package/packages/core/src/cli/dispatch-tickets.ts +47 -0
  31. package/packages/core/src/cli/dispatch-upgrade-controller.ts +3 -0
  32. package/packages/core/src/cli/dispatch.ts +377 -101
  33. package/packages/core/src/cli/help.ts +15 -6
  34. package/packages/core/src/cli/init-validation.ts +14 -1
  35. package/packages/core/src/cli/repo-lease.ts +225 -0
  36. package/packages/core/src/cli/repository-status.ts +40 -3
  37. package/packages/core/src/cli/status.ts +21 -13
  38. package/packages/core/src/cli/ticket.ts +22 -4
  39. package/packages/core/src/cli/wait.ts +4 -1
  40. package/packages/core/src/cli/watch.ts +17 -4
  41. package/packages/core/src/config/live.ts +4 -0
  42. package/packages/core/src/config/profiles.ts +96 -0
  43. package/packages/core/src/config/ready-assignee.ts +43 -11
  44. package/packages/core/src/config/roles.ts +33 -10
  45. package/packages/core/src/config/schema.ts +204 -26
  46. package/packages/core/src/events/catalog.ts +2 -0
  47. package/packages/core/src/events/compatibility.ts +3 -1
  48. package/packages/core/src/events/forge-degradation-policy.ts +16 -2
  49. package/packages/core/src/events/payloads.ts +23 -0
  50. package/packages/core/src/events/policy.ts +3 -0
  51. package/packages/core/src/events/repository.ts +19 -0
  52. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +267 -352
  53. package/packages/core/src/kernel/build-creation.ts +29 -0
  54. package/packages/core/src/kernel/dispatch-capacity.ts +134 -30
  55. package/packages/core/src/kernel/engine.ts +13 -6
  56. package/packages/core/src/kernel/forge-health.ts +47 -0
  57. package/packages/core/src/kernel/generators/build-log.ts +9 -0
  58. package/packages/core/src/kernel/guarded-forge.ts +76 -18
  59. package/packages/core/src/kernel/incremental-fixtures.ts +1 -0
  60. package/packages/core/src/kernel/janitor-failure.ts +85 -5
  61. package/packages/core/src/kernel/leaf-restack-state.ts +4 -2
  62. package/packages/core/src/kernel/log-index.ts +1 -1
  63. package/packages/core/src/kernel/node-landing.ts +2 -1
  64. package/packages/core/src/kernel/node-parent.ts +2 -0
  65. package/packages/core/src/kernel/read-facts.ts +9 -1
  66. package/packages/core/src/kernel/reducer-registry.ts +6 -1
  67. package/packages/core/src/kernel/reducer.ts +75 -4
  68. package/packages/core/src/kernel/ticket-preparation.ts +15 -8
  69. package/packages/core/src/operator/protocol.ts +10 -0
  70. package/packages/core/src/operator/query.ts +16 -13
  71. package/packages/core/src/operator/registry.ts +25 -5
  72. package/packages/core/src/operator/sandbox-host.ts +3 -0
  73. package/packages/core/src/operator/tickets.ts +15 -3
  74. package/packages/core/src/plugin-sdk/index.ts +4 -0
  75. package/packages/core/src/ports/forge/create.ts +6 -0
  76. package/packages/core/src/ports/forge/github-transport.ts +40 -3
  77. package/packages/core/src/ports/forge/github.ts +12 -1
  78. package/packages/core/src/ports/forge/workspace-ancestry.ts +60 -0
  79. package/packages/core/src/ports/forge-failure.ts +31 -2
  80. package/packages/core/src/ports/runner/routing.ts +66 -5
  81. package/packages/core/src/ports/tickets/assignees.ts +54 -0
  82. package/packages/core/src/ports/tickets/contract.ts +164 -4
  83. package/packages/core/src/ports/tickets/create.ts +35 -7
  84. package/packages/core/src/ports/tickets/github-fake.ts +18 -2
  85. package/packages/core/src/ports/tickets/github.ts +247 -29
  86. package/packages/core/src/ports/tickets/hosted-index.ts +1 -0
  87. package/packages/core/src/ports/tickets/operations.ts +6 -1
  88. package/packages/core/src/ports/tickets/tree.ts +12 -2
  89. package/packages/core/src/ports/tickets/update.ts +6 -2
  90. package/packages/core/src/ports/types.ts +37 -3
  91. package/packages/core/src/ports/workspace/commit-preservation.ts +28 -12
  92. package/packages/core/src/ports/workspace/git-worktree.ts +3 -1
  93. package/packages/core/src/ports/workspace/harvest-execution.ts +4 -2
  94. package/packages/core/src/ports/workspace/vercel-sandbox.ts +12 -0
  95. package/packages/core/src/processes/build-child.ts +28 -7
  96. package/packages/core/src/processes/build-execution-state.ts +4 -1
  97. package/packages/core/src/processes/build-runner.ts +17 -2
  98. package/packages/core/src/processes/dispatcher.ts +329 -59
  99. package/packages/core/src/processes/execution-no-progress.ts +2 -0
  100. package/packages/core/src/processes/harvest-child.ts +8 -2
  101. package/packages/core/src/processes/harvest-execution-state.ts +104 -0
  102. package/packages/core/src/processes/harvest-runner.ts +251 -17
  103. package/packages/core/src/processes/repo-view.ts +2 -0
  104. package/packages/core/src/scenarios/harness.ts +160 -36
  105. package/packages/core/src/store/reduced-reads.ts +10 -0
  106. package/packages/core/src/store/reducer-value-shapes.json +3339 -2898
  107. package/packages/core/src/store/remote/client.ts +21 -8
  108. package/packages/core/src/store/remote/index.ts +4 -0
  109. package/packages/core/src/store/remote/protocol.ts +7 -0
  110. package/packages/core/src/store/remote/released-clients.json +22 -0
  111. package/packages/core/src/store/remote/released-reducer-values/1.6.0.json +27173 -0
  112. package/packages/core/src/store/remote/released-reducer-values/1.7.0.json +27366 -0
  113. package/packages/core/src/store/remote/released-reducer-values/index.ts +4 -0
  114. package/packages/core/src/store/repo-state-events.ts +1 -0
  115. package/packages/core/src/store/types.ts +11 -0
  116. package/packages/core/src/testing/dispatch-read-budget.ts +84 -58
  117. package/packages/core/src/testing/index.ts +2 -0
  118. package/packages/core/src/testing/reduced-read-budget.ts +411 -11
  119. package/skills/guide/SKILL.md +166 -35
  120. package/skills/guide/references/operator-api.md +33 -10
  121. package/skills/guide/references/plugin-authoring.md +48 -6
  122. package/skills/guide/references/remote-store-protocol.md +33 -10
  123. package/skills/guide/references/restacking.md +16 -7
  124. package/skills/operate/SKILL.md +79 -14
  125. package/skills/tickets/SKILL.md +22 -4
  126. package/templates/hosted-service/package.json +2 -2
@@ -1,5 +1,6 @@
1
1
  import { StoreWriteTooLargeError } from './errors'
2
2
  import {
3
+ BUILD_CREATION_KEY_CAPABILITY,
3
4
  DISPATCH_PLACEMENT_CAPABILITY,
4
5
  placementCapabilitiesSchema,
5
6
  dispatchPlacementSchema,
@@ -232,20 +233,32 @@ export class RemoteBuildStore implements BuildStore {
232
233
  }
233
234
  }
234
235
 
235
- private placementCapability: Promise<boolean> | undefined
236
+ /** One `/health` probe per instance; `null` when the service predates it. */
237
+ private healthCapabilities: Promise<string[] | null> | undefined
236
238
 
237
- async getDispatchPlacement(repo: string): Promise<DispatchPlacement> {
238
- this.placementCapability ??= (async () => {
239
+ private capabilities(): Promise<string[] | null> {
240
+ this.healthCapabilities ??= (async () => {
239
241
  const response = await this.raw('GET', '/health')
240
- if (response.status === 404 || response.status === 405) return false
242
+ if (response.status === 404 || response.status === 405) return null
241
243
  if (!response.ok) throw await this.toError(response)
242
- const health = placementCapabilitiesSchema.parse(await response.json())
243
- return health.capabilities?.includes(DISPATCH_PLACEMENT_CAPABILITY) ?? false
244
+ return placementCapabilitiesSchema.parse(await response.json()).capabilities ?? []
244
245
  })().catch((error) => {
245
- this.placementCapability = undefined
246
+ this.healthCapabilities = undefined
246
247
  throw error
247
248
  })
248
- if (!(await this.placementCapability))
249
+ return this.healthCapabilities
250
+ }
251
+
252
+ /** A project credential's server allocates slugs; one without the creation
253
+ * key capability may allocate one the client never learns. */
254
+ async buildCreationIdentity(): Promise<'keyed' | 'allocated'> {
255
+ return (await this.capabilities())?.includes(BUILD_CREATION_KEY_CAPABILITY)
256
+ ? 'keyed'
257
+ : 'allocated'
258
+ }
259
+
260
+ async getDispatchPlacement(repo: string): Promise<DispatchPlacement> {
261
+ if (!(await this.capabilities())?.includes(DISPATCH_PLACEMENT_CAPABILITY))
249
262
  return { status: 'unknown', reason: 'unsupported-capability' }
250
263
  return this.requestJson('GET', `${this.repoPath(repo)}/placement`, dispatchPlacementSchema)
251
264
  }
@@ -34,6 +34,8 @@ export type { ReducerSnapshot, SnapshotScope } from '../snapshots'
34
34
 
35
35
  export * from './compatibility'
36
36
 
37
+ export { creationBuildSlug, projectBuildSlugBase } from '../../kernel/build-creation'
38
+
37
39
  export { delegateCredential } from './credentials'
38
40
 
39
41
  export { reduceBuild } from '../../kernel/reducer'
@@ -60,6 +62,8 @@ export { assertPublicSnapshotReducer } from '../snapshots'
60
62
 
61
63
  export {
62
64
  validateForgeDegradation,
65
+ validateForgeResetHorizon,
66
+ FORGE_RESET_EVENT_TYPES,
63
67
  MAX_FORGE_DEGRADATION_MS,
64
68
  } from '../../events/forge-degradation-policy'
65
69
 
@@ -33,6 +33,7 @@ import { compatibilityMetadataSchema } from '../../events/policy'
33
33
  import { repoTickCompletionSchema, repoTickObservationSchema } from '../repo-tick'
34
34
  import { reducerSnapshotWireSchema } from '../snapshots'
35
35
  import { z } from 'zod'
36
+ import { CREATION_KEY } from '../../kernel/build-creation'
36
37
  import { actorSchema } from '../../events/envelope'
37
38
  import { eventPayloadSchemas } from '../../events/payloads'
38
39
  import { ticketRefSchema } from '../../ontology'
@@ -95,6 +96,10 @@ export const newBuildBodySchema = z.object({
95
96
  // Additive optional initial `build.created` event, appended atomically with
96
97
  // the record. Loose like every event wire schema: the backing store validates.
97
98
  created: eventWriteWireSchema.optional(),
99
+ // Additive optional creation key (`build-creation-key-v1`): a project
100
+ // credential's create lands at the slug this key derives, at most once.
101
+ // Old servers strip it; old clients never send it. No protocol-version bump.
102
+ creationKey: z.string().regex(CREATION_KEY).optional(),
98
103
  })
99
104
 
100
105
  export const buildRecordWireSchema = z.object({
@@ -552,6 +557,8 @@ export const nodeRewriteWireSchema = eventPayloadSchemas['node.rewritten'].nulla
552
557
 
553
558
  /** Optional and independently negotiated; no change to released value contracts. */
554
559
  export const DISPATCH_PLACEMENT_CAPABILITY = 'dispatch-placement-v1'
560
+ /** `/health` capability: keyed project creation lands at `creationBuildSlug`. */
561
+ export const BUILD_CREATION_KEY_CAPABILITY = 'build-creation-key-v1'
555
562
  export const placementCapabilitiesSchema = z.object({
556
563
  capabilities: z.array(z.string()).optional(),
557
564
  })
@@ -66,5 +66,27 @@
66
66
  "provenance": {
67
67
  "tag": "v1.5.0"
68
68
  }
69
+ },
70
+ {
71
+ "version": "1.6.0",
72
+ "publishedAt": "2026-11-11T20:56:49.407Z",
73
+ "protocol": "7",
74
+ "contract": "1.6.0.json",
75
+ "projects": true,
76
+ "catalogIdentity": "ae037cc96a338978d3635547f527fbc76ae434751c0b3faedc5edca409c7bf96",
77
+ "provenance": {
78
+ "tag": "v1.6.0"
79
+ }
80
+ },
81
+ {
82
+ "version": "1.7.0",
83
+ "publishedAt": "2026-11-13T01:06:47.187Z",
84
+ "protocol": "7",
85
+ "contract": "1.7.0.json",
86
+ "projects": true,
87
+ "catalogIdentity": "de08611c12803625ec427cb3b6cfda0c3c888ecf3aeea11774e98447d670a6c1",
88
+ "provenance": {
89
+ "tag": "v1.7.0"
90
+ }
69
91
  }
70
92
  ]