@defrex/autobuild 1.10.0 → 1.11.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 (250) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +738 -68
  3. package/bin/ab-dispatch-generation.ts +3 -1
  4. package/docs/accounts.md +2 -1
  5. package/docs/answering-blocked-builds.md +20 -0
  6. package/docs/architecture.md +155 -25
  7. package/docs/build-store.md +10 -7
  8. package/docs/cli.md +33 -1
  9. package/docs/configuration-overview.md +4 -1
  10. package/docs/configuration.md +381 -29
  11. package/docs/dispatcher.md +63 -4
  12. package/docs/forges.md +7 -0
  13. package/docs/integration-tree.md +2 -2
  14. package/docs/operating.md +4 -2
  15. package/docs/operator-api.md +134 -6
  16. package/docs/operator-surfaces.md +85 -0
  17. package/docs/optimization-nodes.md +69 -11
  18. package/docs/plugin-authoring.md +37 -1
  19. package/docs/remote-store-protocol.md +94 -13
  20. package/docs/remote-ticket-protocol.md +40 -0
  21. package/docs/restacking.md +20 -4
  22. package/docs/setup.md +14 -2
  23. package/docs/ticket-dependencies.md +10 -3
  24. package/docs/ticket-sources.md +24 -2
  25. package/docs/tickets.md +7 -1
  26. package/docs/troubleshooting.md +8 -0
  27. package/docs/verification.md +4 -3
  28. package/docs/workspaces.md +3 -0
  29. package/package.json +9 -5
  30. package/packages/core/src/cli/accounts.ts +7 -2
  31. package/packages/core/src/cli/attention.ts +3 -1
  32. package/packages/core/src/cli/binary-direct.ts +2 -0
  33. package/packages/core/src/cli/binary-lifecycle.ts +2 -1
  34. package/packages/core/src/cli/build-control.ts +79 -1
  35. package/packages/core/src/cli/context.ts +4 -0
  36. package/packages/core/src/cli/dashboard/facts.ts +49 -53
  37. package/packages/core/src/cli/dashboard/header.ts +101 -0
  38. package/packages/core/src/cli/dashboard/model.ts +31 -39
  39. package/packages/core/src/cli/dashboard/objective-row.ts +46 -14
  40. package/packages/core/src/cli/dashboard/poll.ts +178 -76
  41. package/packages/core/src/cli/dashboard/render.ts +129 -230
  42. package/packages/core/src/cli/dashboard/row-text.ts +538 -0
  43. package/packages/core/src/cli/dashboard/timeline.ts +288 -0
  44. package/packages/core/src/cli/dashboard/vocabulary.ts +188 -0
  45. package/packages/core/src/cli/dispatch-args.ts +44 -1
  46. package/packages/core/src/cli/dispatch-frontend.ts +29 -38
  47. package/packages/core/src/cli/dispatch-launch-stop.ts +18 -0
  48. package/packages/core/src/cli/dispatch-launcher.ts +20 -7
  49. package/packages/core/src/cli/dispatch-web.ts +155 -0
  50. package/packages/core/src/cli/dispatch.ts +200 -34
  51. package/packages/core/src/cli/help.ts +87 -3
  52. package/packages/core/src/cli/init-validation.ts +3 -3
  53. package/packages/core/src/cli/main.ts +70 -6
  54. package/packages/core/src/cli/mcp.ts +35 -3
  55. package/packages/core/src/cli/objective.ts +1 -1
  56. package/packages/core/src/cli/operator-preference.ts +57 -0
  57. package/packages/core/src/cli/repo-lease.ts +2 -0
  58. package/packages/core/src/cli/repo-state.ts +56 -6
  59. package/packages/core/src/cli/repository-status.ts +97 -43
  60. package/packages/core/src/cli/status.ts +82 -1
  61. package/packages/core/src/cli/terminal-restore.ts +32 -7
  62. package/packages/core/src/cli/ticket.ts +98 -36
  63. package/packages/core/src/cli/wait.ts +14 -6
  64. package/packages/core/src/cli/watch.ts +20 -4
  65. package/packages/core/src/cli/web.ts +139 -0
  66. package/packages/core/src/config/live.ts +99 -14
  67. package/packages/core/src/config/load.ts +61 -20
  68. package/packages/core/src/config/local.ts +212 -0
  69. package/packages/core/src/config/pipeline-source.ts +2 -0
  70. package/packages/core/src/config/reference.ts +18 -0
  71. package/packages/core/src/config/schema.ts +45 -10
  72. package/packages/core/src/events/catalog.ts +4 -0
  73. package/packages/core/src/events/payloads.ts +97 -0
  74. package/packages/core/src/events/policy.ts +10 -0
  75. package/packages/core/src/events/repository.ts +46 -3
  76. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +316 -0
  77. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/017d8dd5bb6dd80b.json.gz +0 -0
  78. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/178e12f1759b7552.json.gz +0 -0
  79. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/4932c70a2af97faf.json.gz +0 -0
  80. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/536085773daf6b58.json.gz +0 -0
  81. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/6bd6275061aaffa5.json.gz +0 -0
  82. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/89625654b02e9ac1.json.gz +0 -0
  83. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/a98af134be2da8a9.json.gz +0 -0
  84. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/d5d5ccca80a893d8.json.gz +0 -0
  85. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/f8155387eb5f375c.json.gz +0 -0
  86. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/3c27f918b194e3b3.json +465 -0
  87. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/79f0e0f4ccd43ba2.json +455 -0
  88. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/859c09edac738823.json +1086 -0
  89. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a283c1f3462b1cc1.json +81 -0
  90. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a6e570fb126991ff.json +36 -0
  91. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a8acf22c968b6e3d.json +81 -0
  92. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/ba7b85895bf6698e.json +1153 -0
  93. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/fc66408cde0b6b04.json +637 -0
  94. package/packages/core/src/kernel/build-roster.ts +230 -0
  95. package/packages/core/src/kernel/dispatch-capacity.ts +4 -2
  96. package/packages/core/src/kernel/engine.ts +43 -5
  97. package/packages/core/src/kernel/execution-intervals.ts +61 -0
  98. package/packages/core/src/kernel/generators/optimization-log.ts +101 -0
  99. package/packages/core/src/kernel/generators/repository-journals.ts +13 -0
  100. package/packages/core/src/kernel/leaf-restack-base.ts +33 -7
  101. package/packages/core/src/kernel/leaf-restack-state.ts +82 -3
  102. package/packages/core/src/kernel/log-index.ts +19 -0
  103. package/packages/core/src/kernel/optimization-admission.ts +244 -3
  104. package/packages/core/src/kernel/optimization.ts +183 -4
  105. package/packages/core/src/kernel/phase-failures.ts +121 -0
  106. package/packages/core/src/kernel/published-branch-head.ts +60 -0
  107. package/packages/core/src/kernel/reducer-registry.ts +27 -8
  108. package/packages/core/src/kernel/reducer-revisions.ts +25 -0
  109. package/packages/core/src/kernel/reducer.ts +63 -4
  110. package/packages/core/src/kernel/rollup.ts +61 -0
  111. package/packages/core/src/kernel/setup-streak.ts +38 -0
  112. package/packages/core/src/kernel/step-durations.ts +257 -0
  113. package/packages/core/src/kernel/target-observation.ts +6 -1
  114. package/packages/core/src/kernel/target-rewrite-recovery.ts +116 -0
  115. package/packages/core/src/kernel/verify-diff-base.ts +5 -0
  116. package/packages/core/src/kernel/verify-stages.ts +13 -3
  117. package/packages/core/src/ontology.ts +5 -0
  118. package/packages/core/src/operator/agent-context-serve.ts +631 -0
  119. package/packages/core/src/operator/annotations.ts +75 -5
  120. package/packages/core/src/operator/attention.ts +470 -0
  121. package/packages/core/src/operator/canonical-skills.ts +35 -0
  122. package/packages/core/src/operator/cli-equivalents.ts +270 -0
  123. package/packages/core/src/operator/context-prompts.ts +61 -0
  124. package/packages/core/src/operator/index.ts +49 -1
  125. package/packages/core/src/operator/landings.ts +28 -19
  126. package/packages/core/src/operator/optimization.ts +7 -0
  127. package/packages/core/src/operator/protocol.ts +3 -0
  128. package/packages/core/src/operator/query.ts +122 -72
  129. package/packages/core/src/operator/read-view.ts +5 -2
  130. package/packages/core/src/operator/registry.ts +406 -46
  131. package/packages/core/src/operator/requests.ts +20 -18
  132. package/packages/core/src/operator/sandbox-host.ts +107 -11
  133. package/packages/core/src/operator/sandbox-resolver.ts +253 -0
  134. package/packages/core/src/operator/sandbox.ts +778 -82
  135. package/packages/core/src/operator/ticket-asset-list.ts +77 -0
  136. package/packages/core/src/operator/ticket-assets.ts +167 -0
  137. package/packages/core/src/operator/tickets.ts +33 -2
  138. package/packages/core/src/plugin-sdk/index.ts +22 -0
  139. package/packages/core/src/plugins/manifest.ts +1 -1
  140. package/packages/core/src/ports/forge/fake.ts +92 -1
  141. package/packages/core/src/ports/forge/git-blob.ts +15 -0
  142. package/packages/core/src/ports/forge/github.ts +82 -0
  143. package/packages/core/src/ports/forge/local-git.ts +61 -1
  144. package/packages/core/src/ports/forge-failure.ts +24 -0
  145. package/packages/core/src/ports/runner/antigravity-test.fixture.ts +149 -0
  146. package/packages/core/src/ports/runner/claude-test.fixture.ts +71 -0
  147. package/packages/core/src/ports/runner/codex-test.fixture.ts +63 -0
  148. package/packages/core/src/ports/tickets/contract.ts +71 -0
  149. package/packages/core/src/ports/tickets/fake.ts +11 -0
  150. package/packages/core/src/ports/tickets/file.ts +18 -0
  151. package/packages/core/src/ports/tickets/github-fake.ts +136 -4
  152. package/packages/core/src/ports/tickets/github.ts +387 -30
  153. package/packages/core/src/ports/tickets/hosted-index.ts +10 -0
  154. package/packages/core/src/ports/tickets/linear.ts +130 -0
  155. package/packages/core/src/ports/tickets/priority.ts +9 -0
  156. package/packages/core/src/ports/tickets/remote-protocol.ts +34 -0
  157. package/packages/core/src/ports/tickets/remote.ts +70 -6
  158. package/packages/core/src/ports/tickets/search.ts +139 -0
  159. package/packages/core/src/ports/types.ts +104 -2
  160. package/packages/core/src/ports/workspace/builtin-capabilities.ts +9 -0
  161. package/packages/core/src/ports/workspace/create.ts +15 -1
  162. package/packages/core/src/ports/workspace/fake.ts +340 -12
  163. package/packages/core/src/ports/workspace/git-worktree.ts +833 -42
  164. package/packages/core/src/ports/workspace/operator-sandbox.ts +129 -12
  165. package/packages/core/src/ports/workspace/process-group.ts +48 -0
  166. package/packages/core/src/ports/workspace/vercel-sandbox.ts +1260 -123
  167. package/packages/core/src/processes/agent-context-assemble.ts +576 -0
  168. package/packages/core/src/processes/agent-context.ts +469 -0
  169. package/packages/core/src/processes/build-runner.ts +387 -236
  170. package/packages/core/src/processes/dispatcher.ts +211 -55
  171. package/packages/core/src/processes/execution-no-progress.ts +4 -0
  172. package/packages/core/src/processes/optimization-activity.ts +120 -0
  173. package/packages/core/src/processes/phase-failure-budget.ts +1 -0
  174. package/packages/core/src/processes/repo-view.ts +78 -2
  175. package/packages/core/src/processes/sandbox-state.ts +53 -6
  176. package/packages/core/src/processes/tick-publication.ts +2 -0
  177. package/packages/core/src/processes/workspace-preparation.ts +76 -0
  178. package/packages/core/src/scenarios/harness.ts +0 -5
  179. package/packages/core/src/store/account-redaction.ts +1 -0
  180. package/packages/core/src/store/adapter.ts +52 -1
  181. package/packages/core/src/store/agent-context.ts +432 -0
  182. package/packages/core/src/store/build-feed.ts +291 -0
  183. package/packages/core/src/store/build-scope.ts +19 -1
  184. package/packages/core/src/store/contract.ts +911 -14
  185. package/packages/core/src/store/digest.ts +19 -6
  186. package/packages/core/src/store/histogram.ts +113 -0
  187. package/packages/core/src/store/local/schema.ts +62 -0
  188. package/packages/core/src/store/local/store.ts +628 -22
  189. package/packages/core/src/store/local/ticket-asset-heads.ts +23 -0
  190. package/packages/core/src/store/memory.ts +461 -69
  191. package/packages/core/src/store/open-builds.ts +19 -0
  192. package/packages/core/src/store/phase-session.ts +32 -4
  193. package/packages/core/src/store/reduced-reads.ts +14 -4
  194. package/packages/core/src/store/reducer-value-shapes.json +6987 -5749
  195. package/packages/core/src/store/reducer-values.ts +6 -1
  196. package/packages/core/src/store/remote/client.ts +208 -2
  197. package/packages/core/src/store/remote/compatibility.ts +1 -1
  198. package/packages/core/src/store/remote/index.ts +33 -0
  199. package/packages/core/src/store/remote/protocol.ts +69 -0
  200. package/packages/core/src/store/remote/released-clients.json +11 -0
  201. package/packages/core/src/store/remote/released-reducer-values/1.11.0.json +35680 -0
  202. package/packages/core/src/store/remote/released-reducer-values/index.ts +18 -16
  203. package/packages/core/src/store/retention.ts +23 -1
  204. package/packages/core/src/store/rollups.ts +337 -0
  205. package/packages/core/src/store/session-handle.ts +20 -2
  206. package/packages/core/src/store/snapshots.ts +10 -0
  207. package/packages/core/src/store/types.ts +108 -9
  208. package/packages/core/src/testing/dispatch-read-budget.ts +1092 -2
  209. package/packages/core/src/testing/git-config-isolation.ts +7 -5
  210. package/packages/core/src/testing/index.ts +27 -0
  211. package/packages/core/src/testing/memory-operator-sandbox.ts +346 -0
  212. package/packages/core/src/testing/reduced-read-budget.ts +1873 -98
  213. package/packages/core/src/web/analytics-source.ts +303 -0
  214. package/packages/core/src/web/assets/Atkinson-OFL.txt +93 -0
  215. package/packages/core/src/web/assets/AtkinsonHyperlegibleNext.latin.woff2 +0 -0
  216. package/packages/core/src/web/assets/JetBrains-OFL.txt +93 -0
  217. package/packages/core/src/web/assets/JetBrainsMono.latin.woff2 +0 -0
  218. package/packages/core/src/web/assets/app.css +1 -0
  219. package/packages/core/src/web/assets/app.js +9 -0
  220. package/packages/core/src/web/assets/manifest.json +31 -0
  221. package/packages/core/src/web/assets/theme.js +1 -0
  222. package/packages/core/src/web/bounded.ts +31 -0
  223. package/packages/core/src/web/http.ts +315 -0
  224. package/packages/core/src/web/hub.ts +160 -0
  225. package/packages/core/src/web/options.ts +38 -0
  226. package/packages/core/src/web/overview-source.ts +322 -0
  227. package/packages/core/src/web/page.ts +56 -0
  228. package/packages/core/src/web/protocol.ts +151 -0
  229. package/packages/core/src/web/read-only.ts +23 -0
  230. package/packages/core/src/web/repository-source.ts +35 -0
  231. package/packages/core/src/web/server.ts +97 -0
  232. package/skills/code-review/SKILL.md +10 -2
  233. package/skills/guide/SKILL.md +366 -52
  234. package/skills/guide/references/accounts.md +2 -1
  235. package/skills/guide/references/integration-tree.md +2 -2
  236. package/skills/guide/references/operator-api.md +134 -6
  237. package/skills/guide/references/optimization-nodes.md +69 -11
  238. package/skills/guide/references/plugin-authoring.md +37 -1
  239. package/skills/guide/references/remote-store-protocol.md +94 -13
  240. package/skills/guide/references/remote-ticket-protocol.md +40 -0
  241. package/skills/guide/references/restacking.md +20 -4
  242. package/skills/guide/references/setup.md +14 -2
  243. package/skills/guide/references/ticket-dependencies.md +10 -3
  244. package/skills/implement/SKILL.md +23 -4
  245. package/skills/operate/SKILL.md +134 -32
  246. package/skills/plan/SKILL.md +10 -4
  247. package/skills/plan-review/SKILL.md +9 -2
  248. package/skills/spec/SKILL.md +34 -8
  249. package/skills/tickets/SKILL.md +51 -5
  250. package/templates/hosted-service/package.json +2 -2
@@ -130,7 +130,8 @@ others choose local storage. The destination is shown before the browser opens.
130
130
  OpenAI handles consent and authorization. No token is printed.
131
131
 
132
132
  Local credentials live in protected, ignored main-checkout
133
- `.autobuild/accounts/` state shared by worktrees. Project sign-in transfers
133
+ `.autobuild/accounts/` state. Worktrees reach it through the main checkout,
134
+ wherever they live. Project sign-in transfers
134
135
  credentials directly to the encrypted refreshing project secret named by
135
136
  `credentialEnv`; it retains no renewable credential locally. This name
136
137
  identifies a host access-token slot, not a refresh token supplied in TOML.
@@ -202,7 +202,7 @@ A node becomes an optimization node when its spec carries exactly one fenced
202
202
  block whose info string is exactly `autobuild-objective`, holding a TOML
203
203
  objective: a purpose, a command metric with a direction or a judge panel, a
204
204
  harness of path selectors, an epsilon, and a budget of `maxAttempts`,
205
- `maxHours` or both. A threshold and a plateau are optional; the stop mode
205
+ `maxHours` (active hours, not wall-clock time) or both. A threshold and a plateau are optional; the stop mode
206
206
  defaults to `abort` and proposer concurrency to 1. The ticket's kind stays
207
207
  `node`; no label or state marks it. A heading named "Objective", a `toml` block,
208
208
  prose, inline code, a fence nested inside another fence (a Markdown example of
@@ -232,7 +232,7 @@ effective objective and marks each field that differs from the ticket's block
232
232
 
233
233
  Progress is derived from the node's log: starting value and noise spread,
234
234
  current and best values, attempts filed, accepted, rejected and running, the
235
- plateau counter, elapsed hours and attempts against the budget, and stop
235
+ plateau counter, active hours and attempts against the budget, and stop
236
236
  eligibility by threshold, plateau and budget. A child is an attempt only when
237
237
  its ticket was created from a recorded proposal of the node; a repair child
238
238
  filed by hand counts toward neither budget nor plateau. Rejected attempts are
@@ -90,7 +90,7 @@ raw session-event append. External operator harnesses own agent execution.
90
90
  | `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. |
91
91
  | `GET …/tickets?state=S&label=L&limit=N&offset=K&order=O` | `{states,tickets,diagnostics,criteria,triageState,readyState,doneState,total}`. The three lifecycle names come from effective repository configuration (including provider fallback). With no `state`, `criteria.state` is `triageState`; repeated `label` parameters narrow that state with AND filters. An explicit `state` selects that exact backend workflow state. `limit` (0–200) returns one page, after skipping `offset`, in `order` `oldest` (the default: dispatch order, urgent tickets first, then the source order) or `newest` (newest filed first, regardless of urgency; see paging below); `total` counts every match before paging. |
92
92
  | `GET …/tickets/states` | Full state metadata `{name,tickets,about?}[]`, including empty states (`tickets.states` in MCP). |
93
- | `GET …/tickets/{id}` | `{ticket,blockers,build}`. Blockers include native `exists`/`resolved` status; `build` prefers an active matching repository build, otherwise the most recently updated one. |
93
+ | `GET …/tickets/{id}` | `{ticket,blockers,build,assets}`. Blockers include native `exists`/`resolved` status; `build` prefers an active matching repository build, otherwise the most recently updated one. `assets` lists the current ticket assets as `{kind,name,revision,size,layout,fileCount}`, as `ab ticket show --json` does. |
94
94
 
95
95
  For artifact reads, an absent `rev` selects the latest revision. A supplied value
96
96
  must match `[0-9]+` (one or more ASCII base-10 digits) and represent an integer
@@ -146,6 +146,7 @@ Answer variants:
146
146
  {"resolution":"guidance","text":"…"}
147
147
  {"resolution":"retry"}
148
148
  {"resolution":"dismiss","text":"optional audit text"}
149
+ {"resolution":"accept-target","text":"optional audit text"}
149
150
  {"resolution":"review-round-ceiling","ceiling":4,"text":"optional guidance"}
150
151
  {"resolution":"revise-spec","origin":"body","body":"replacement spec","text":"optional guidance"}
151
152
  {"resolution":"revise-spec","origin":"ticket","body":"current amended ticket body","text":"optional guidance"}
@@ -190,11 +191,78 @@ closed table `ab mcp` serves over stdio): the body is the tool's validated input
190
191
  included and required to equal the URL's repository — and the response is the
191
192
  registry result verbatim. The verified operator token supplies the acting
192
193
  identity and, when minted with one, the `via` attribution marker; the body
193
- never does. Failures keep the shared `{kind,error,code?,progress?}` shape:
194
+ never does. Failures keep the shared `{kind,error,code?,progress?,state?}` shape
195
+ (`state` names the sandbox lifecycle state on a `sandbox-not-ready` refusal):
194
196
  validation is `400`, auth `403`, not-found `404`, conflict and refusal `409`,
195
197
  internal `500`. The route adds no authority of its own — it is the registry
196
- behind the token check — so a tool available here is exactly the tool table,
197
- and the table's contract suite is the single gate.
198
+ behind the token check — so a tool available here is exactly the deployment's
199
+ served table, and the table's contract suite is the single gate. The hosted
200
+ `/mcp` binding advertises that same table. Sandbox tools are in it when the
201
+ deployment can host operator sandboxes, and each call is gated per repository
202
+ on the latest deposited effective config. A closed gate is a `409 refusal`
203
+ with code `sandbox-orchestrator-disabled`, `sandbox-no-effective-config`,
204
+ `sandbox-effective-config-invalid`, `sandbox-credentials-missing` or
205
+ `sandbox-backend-unavailable`.
206
+
207
+ ### Per-repository MCP URLs
208
+
209
+ Beside the deployment-wide `/mcp`, each registered project has its own MCP
210
+ URL. Adding it to an agent harness connects that harness to one repository.
211
+
212
+ | | `/mcp` | `/mcp/<host><path>` |
213
+ |---|---|---|
214
+ | URL | `<resource>` | `<resource>/<host><path>`, e.g. `https://ops.example/mcp/github.com/acme/widgets` for `https://github.com/acme/widgets` |
215
+ | Tool schemas | every tool requires `repo` | no `repo` field; the URL's repository is supplied |
216
+ | `repositories.list` | offered | not offered |
217
+ | A `repo` argument | names the repository | equal to the URL's repository is ignored; any other is a `validation` result |
218
+ | `sandbox.*` listed | when the deployment can host sandboxes | also needs the repository's latest deposited effective config to enable `[orchestrator]` (one latest-artifact read per listing) |
219
+ | Instructions | describe the deployment, with each accessible repository's agent context | name only that repository, with its agent context |
220
+ | Prompts | one per skill per accessible repository, `<label>.<skill>` | one per skill, named for the skill |
221
+
222
+ `<resource>` is `AB_WEB_MCP_RESOURCE`, by default `<origin>/mcp`. The URL is
223
+ derived from the repository identity, so it is stable across deploys and
224
+ sign-ins, and only its canonical spelling is served: a trailing slash, `.git`
225
+ or an encoded character is `404`. An unregistered project, or one the signed-in
226
+ operator cannot reach, is also `404`, checked after authentication. Admission
227
+ and repository access are rechecked on every tool call, and writes carry the
228
+ same operator and `via` attribution as `/mcp`.
229
+
230
+ OAuth is discovered from the URL alone. Its protected-resource metadata lives at
231
+ the RFC 9728 path-inserted location,
232
+ `<origin>/.well-known/oauth-protected-resource/mcp/<host><path>`, and names the
233
+ per-repository URL as its `resource`. The token endpoint honors RFC 8707
234
+ `resource`:
235
+
236
+ - A token issued for a per-repository URL is accepted only there. At another
237
+ project's URL or at `/mcp` it gets `401` with `error="invalid_token"`, so
238
+ the client signs in again for that URL.
239
+ - A token issued for `/mcp`, or without a `resource`, is accepted at every URL.
240
+ - Refreshing a per-repository token keeps its resource, whether the refresh
241
+ omits `resource` or names `/mcp`. Naming another per-repository URL on that
242
+ refresh is refused with `invalid_target`.
243
+ - Refreshing a `/mcp` or resource-less token may name one per-repository URL.
244
+ The new token is then bound to that URL only.
245
+ - Any request naming a resource this deployment does not serve is refused
246
+ with `invalid_target`.
247
+
248
+ ### Agent context
249
+
250
+ `context.list` and `context.read` are registry tools, so they appear on both
251
+ endpoints and on this route. They serve the repository's captured skills and
252
+ agent instructions, or the canonical skills bundled with the serving Autobuild
253
+ when none are captured. Each read prepends a generated preamble mapping the `ab`
254
+ commands the file mentions to tools; agent instructions are framed as the
255
+ repository's own rules.
256
+
257
+ - Both endpoints expose one MCP prompt per skill whose message is the
258
+ `context.read` text of its `SKILL.md`. On `/mcp` the name is
259
+ `<label>.<skill>`, where `<label>` is the identity without its scheme and
260
+ with every character outside `[A-Za-z0-9_-]` as `_`; colliding names gain a
261
+ `~<hash>` suffix. An unknown name is `InvalidParams`.
262
+ - The agent-context section of the server instructions is built only for an
263
+ `initialize` request: one latest-revision record read per repository in
264
+ scope. `tools/list`, `tools/call` and other requests read nothing for it, and
265
+ prompt indexes load only for `prompts/list` and `prompts/get`.
198
266
 
199
267
  ### Success results
200
268
 
@@ -207,7 +275,8 @@ Build control returns one of:
207
275
  a blocked build. This is a successful prompt transition but **does not append
208
276
  an event**; submit one of the answer requests next.
209
277
  - `{kind:"answered",slug,count,resolution,resumed,...}` from the answer route.
210
- `resolution` is `guidance`, `retry`, `dismiss-finding`, or `revise-spec`.
278
+ `resolution` is `guidance`, `retry`, `dismiss-finding`, `revise-spec`, or
279
+ `accept-target` (answers only a leaf's target-rewritten escalation).
211
280
  Depending on the operation, the result also includes `remainingOpen`,
212
281
  `reviewRoundCeiling:{loop,value}`, `specRev`, `authorizedEarlier`, or a
213
282
  `terminalSignal` describing a terminal status, pending abort, or ended PR.
@@ -299,7 +368,8 @@ The default watch reports actionable conditions only:
299
368
  - `dispatcher.forge-degraded`: the dispatcher's own rate-limit cooldown opened, with its reset; once per episode. Extensions marked `continued` are silent.
300
369
  - `dispatcher.forge-persistent`: forge degradation remains after a completed post-reset retry opportunity; successful recovery clears it.
301
370
 
302
- - Build `escalation.raised`, `integration.landed`, `node.item-conflicted`, `target.rewritten`,
371
+ - Build `escalation.raised`, `integration.landed`, `node.item-conflicted`,
372
+ `target.rewritten` (a node's, once per rejected base; a leaf recovers or escalates),
303
373
  `landing.consent-revoked` (protected merge consent revoked by a reconcile's
304
374
  edits, naming the matched files and both heads),
305
375
  `pr.checks-failed` (failing forge CI at a finished leaf's live PR head, once
@@ -428,6 +498,27 @@ repository records the CLI default watch reports, or every event with
428
498
  advances past filtered events. Omitting `cursor` returns no events and a
429
499
  baseline cursor; an expired cursor fails with `code: "cursor-too-old"`.
430
500
 
501
+ The MCP `repository.attention` tool is a connected agent's first call of each
502
+ operator round. It takes `{repo, cursor?}` and returns everything currently
503
+ waiting on the operator:
504
+
505
+ | Section | Contents |
506
+ |---|---|
507
+ | `escalations` | Open builds with open escalations, as `builds.get` reports them; wait-only builds are excluded |
508
+ | `merges` | The `merges.list` entries, each with its build's PR |
509
+ | `events` | The `repository.events` attention page after `cursor`: `{items, cursor, hasMore}` |
510
+ | `waiting` | Builds `paused`, `stalled`, failing node verification (`verification-failed`) or failing forge CI (`ci-failing`), each with a `detail` |
511
+ | `dispatcher` | No holder, a current upgrade failure, a rollback hold or a forge cooldown, from `repository.status` |
512
+
513
+ Every item carries `resolve: [{tool, input, by, note?}]`, primary first: a real
514
+ registry tool and a partial input. `by: "human"` marks a condition no agent call
515
+ fixes; the named tool reads the evidence to report. Cursor rules match
516
+ `repository.events`: an omitted cursor returns no events and a baseline cursor
517
+ beside every current-state section, and an expired cursor fails with
518
+ `code: "cursor-too-old"`. The call never waits. Its cost is bounded: one open-build
519
+ listing pass, the `repository.status` reads and at most 256 journal positions,
520
+ with zero event rows when nothing changed.
521
+
431
522
 
432
523
  Hosted ticket tools resolve independent project ticket policy, including its
433
524
  backlog and rejected roles for role moves, before legacy uploaded configuration. Queue, detail, state discovery and mutations work before any build
@@ -537,6 +628,33 @@ blocked (use `builds.answer`) are refused with `not-reopenable`; a pending abort
537
628
  or discard is refused with `abort-pending` or `discard-pending`. Ownership is
538
629
  enforced. The tool has no HTTP route.
539
630
 
631
+ ### Ticket assets
632
+
633
+ Three tools carry the `ab ticket attach`, `ab ticket asset get` and
634
+ `ab ticket asset rm` surface; `tickets.get` lists the current assets. Bytes
635
+ cross the wire as strict, padded standard base64 (`""` is an empty file).
636
+
637
+ | Tool | Input | Receipt |
638
+ |---|---|---|
639
+ | `tickets.asset.attach` | `{repo, id, kind, name, layout, entries}`; `layout` is `file` (exactly one file entry) or `tree` (a folder, possibly empty); each entry is `{type:"file", path, contentBase64}` or `{type:"dir", path}` | `{asset, replaced, activeBuilds, noteError?}`: `asset` is the stored revision's metadata as `ab ticket attach --json` prints it |
640
+ | `tickets.asset.get` | `{repo, id, kind, name, rev?}`; without `rev`, the latest revision | `{asset, entries}`: entries in manifest order, each `{type:"file", path, size, contentBase64}` or `{type:"dir", path}` |
641
+ | `tickets.asset.remove` | `{repo, id, kind, name}` | `{removed, activeBuilds, noteError?}`: the metadata of the revision that was current |
642
+
643
+ - **Same rules as the CLI.** Each attach stores a new revision; earlier
644
+ revisions, including those of a removed asset, stay readable by `rev`. The
645
+ store's limits apply (25 MiB of file bytes by default).
646
+ - **Failures.** A naming, path, layout or size violation is `validation` with
647
+ code `ticket-asset-invalid`, and stores nothing. An unknown ticket, a missing
648
+ asset or revision, or removing an asset with no current revision is
649
+ `not-found`.
650
+ - **Notes.** Attach and remove leave a note on the ticket after the store
651
+ write. A failed note does not fail the call: the receipt carries `noteError`,
652
+ and retrying an attach would store another revision.
653
+ - **Active builds.** `activeBuilds` names the ticket's running builds; each
654
+ keeps the assets it froze at the claim.
655
+ - Attach and remove require an attributed identity; `tickets.asset.remove` is
656
+ annotated destructive. The tools have no HTTP route.
657
+
540
658
  ### Node restack request
541
659
 
542
660
  `builds.restack` accepts `{repo, slug}`. `POST /operator/v1/repos/:repo/builds/:slug/restack`
@@ -754,3 +872,13 @@ proof of provider success. A clear appends once without reading history, even
754
872
  when already healthy; later degradation wins by ordinary journal order.
755
873
  Existing dispatcher/kernel automatic recovery and old payloads remain valid;
756
874
  the recovered payload additionally accepts an optional nonblank `reason`.
875
+
876
+ ### Dispatcher running evidence
877
+
878
+ `repository.status` returns required `dispatcherRunning`: true for a lease holder,
879
+ an expired holder, or an unfinished handoff naming a draining predecessor (even
880
+ with an empty drain map). This uses already loaded projections without extra reads.
881
+ Missing or unreadable status is not permission to start. Ownership is local-only:
882
+ `ab operator dispatcher [human|agent] [--json]` reads/saves the optional preference
883
+ in `.autobuild/local.toml`; there is no remote preference endpoint. Repository
884
+ instructions take precedence. See `ab-operate` for ownership and clean-stop limits.
@@ -218,10 +218,23 @@ not the code under improvement, so leave that code out. Keep selectors narrow:
218
218
  a harness that covers the code being optimized pins the very code attempts are
219
219
  meant to change.
220
220
 
221
+ ### Measuring where builds run
222
+
223
+ Measure the evidence, the threshold and ε in the environment builds run in.
224
+
225
+ - With a remote workspace such as a sandbox, get the benchmark run there.
226
+ - If you can't, say so in the evidence. Leave the threshold out, and set it
227
+ with `ab objective <node> --threshold n` once the node reports its starting
228
+ value.
229
+ - Why: absolute timings from a workstation don't transfer to a sandbox. The
230
+ node's opening measurement and noise check run in the build environment, so
231
+ a threshold or ε from elsewhere may be unreachable or below the noise.
232
+
221
233
  ### Choosing ε and the noise check
222
234
 
223
235
  Choose ε above the noise. ε is the smallest gain worth landing. Run the
224
- command several times on the same tree first. If the median moves by more than
236
+ command several times on the same tree first, in the environment builds run
237
+ in. If the median moves by more than
225
238
  your ε between identical runs, raise ε or `samples`. The node checks this when
226
239
  it opens: its starting measurement raises `optimization.noise-exceeded` when ε
227
240
  is below the measured spread. A panel node judges its opening head against
@@ -254,8 +267,10 @@ should not decide an ε of 0.1. See [judge panels](#judge-panels).
254
267
  ### Choosing a budget
255
268
 
256
269
  Choose a budget you would sign off on unattended. It is the limit a human
257
- approves once for the whole run. `maxAttempts` bounds cost; `maxHours` bounds wall-clock
258
- time. Set a plateau when a run of failed strategies should end the search
270
+ approves once for the whole run. `maxAttempts` bounds cost; `maxHours` bounds
271
+ [active hours](#active-hours): time the node's attempts, proposer or
272
+ measurements actually run, not wall-clock time since opening. Time an attempt
273
+ spends queued for a slot, parked on an escalation or paused is not charged. Set a plateau when a run of failed strategies should end the search
259
274
  early. Set a threshold only when there is a value at which you would stop
260
275
  looking. Use `concurrency` above 1 only when attempts are independent enough to
261
276
  run side by side.
@@ -590,7 +605,7 @@ blinded order.
590
605
  | `optimization.objective-revised` | node | changes, revision (human) |
591
606
  | `optimization.baseline-measured` | node | revision, head, harnessPin, samples, median, spread, report |
592
607
  | `optimization.noise-exceeded` | node | revision, head, harnessPin, median, spread, epsilon, effective ε (advisory) |
593
- | `optimization.proposal-requested` | node | id, node head, room, budget used (attempts, hours) (dispatcher) |
608
+ | `optimization.proposal-requested` | node | id, node head, room, budget used (attempts, active hours) (dispatcher) |
594
609
  | `optimization.attempts-proposed` | node | request, proposals (id, ticket, title, strategy), reason when empty; recorded after every ticket exists (dispatcher) |
595
610
  | `attempt.measurement-requested` | attempt | id, node, candidate, baseline, harnessPin, revision, metric, purpose (panel) |
596
611
  | `attempt.sampled` | attempt | request, candidate, baseline, harnessPin, revision, samples (judges for a panel), medians or win rate, report |
@@ -604,6 +619,8 @@ blinded order.
604
619
  | `attempt.settled` | node | attempt (proposal, ticket, build, branch?), outcome, measurement (revision, baseline, candidate, delta), policy?, mergedSha?, note, head (accepted only) |
605
620
  | `attempt.merged-unmeasured` | node | proposal, ticket, build, merged head (sha?), reason, measuredCandidate? |
606
621
  | `optimization.stopped` | node | cause, mode |
622
+ | `optimization.activity-recorded` | node | attempt execution facts (build, n, instance, started or ended, at), accounted counts, released builds?, watermark, starts?, settles? (dispatcher) |
623
+ | `execution.accounted` | attempt | count: execution facts the node has accounted (dispatcher, advisory) |
607
624
  | `attempt.ticket-rejected` | node | proposal, ticket, rejected state the ticket moved to |
608
625
  | `attempt.branch-deleted` | node | proposal, build, branch |
609
626
  | `attempt.branch-cleanup-failed` | node | proposal, build?, branch, error |
@@ -661,7 +678,7 @@ Progress is derived from the node's log, never recorded:
661
678
  unmeasured (slot held)` while any remain.
662
679
  - **Plateau counter**: consecutive `no-improvement` or `declined` settlements
663
680
  since the last `accepted`; `stopped` and `aborted` leave it unchanged.
664
- - **Elapsed budget**: hours since the first acceptance, against `maxHours`, and
681
+ - **Budget used**: [active hours](#active-hours), against `maxHours`, and
665
682
  attempts filed, against `maxAttempts`.
666
683
  - **Stop eligibility** by threshold, plateau and budget, and whether the node
667
684
  has stopped. Once stopped, `ab objective` also shows what still blocks
@@ -689,14 +706,16 @@ Every surface shows the same objective row, read from the node's digest alone:
689
706
  ```text
690
707
  objective 50 → 44 (minimize) · threshold 35 · noise ±1.5
691
708
  attempts 1 accepted · 3 rejected · 0 running
692
- budget 4/60 attempts · 3.1/24 hours
709
+ budget 4/60 attempts · 3.1/24 active hours
693
710
  stopped plateau (drain)
694
711
  ```
695
712
 
696
713
  A panel shows `win rate 50% → 70%` instead. Only configured budgets appear,
697
714
  `no threshold` and `objective not measured` stand in for absent values, and
698
- the `stopped` segment appears once the node stops. Budget hours stop at the
699
- stop time; a watch record evaluates them at its own timestamp. `ab objective`
715
+ the `stopped` segment appears once the node stops. Budget hours are active
716
+ hours and stop growing at the stop; `(settling)` follows them until the
717
+ dispatcher has accounted attempt runs from before the stop. A watch record
718
+ evaluates them at its own timestamp. `ab objective`
700
719
  remains the full view, with the best value, plateau and stop eligibility.
701
720
 
702
721
  ## Proposer phase
@@ -724,7 +743,7 @@ deferred for runtime compatibility gets `optimization.proposal-deferred` with
724
743
  that reason instead, and is reconsidered once a fact that can clear it lands.
725
744
  The request takes a slot ahead of normal ticket claims, like node reconcile and
726
745
  verification. Before the session starts, the dispatcher re-checks the request:
727
- when the node stopped, the hours budget expired, or room fell below the
746
+ when the node stopped, the active-hours budget is spent, or room fell below the
728
747
  recorded room, it records `optimization.proposal-withdrawn`, which clears the
729
748
  request and never counts as an empty proposal. A session that already started
730
749
  keeps the room it was granted.
@@ -736,7 +755,10 @@ out detached. `ab context` writes:
736
755
  quick-revised since its latest acceptance;
737
756
  - `progress.json`: starting, current, best and threshold values, attempt
738
757
  counts, attempts in flight, the plateau counter, consecutive empty proposals,
739
- the opening time and the request (`id`, `head`, `room`);
758
+ the opening time (`openedAt`), `activeHours` and the request (`id`, `head`,
759
+ `room`). `activeHours` is the active-hours budget used so far, evaluated when
760
+ the context is materialized; `openedAt` is opening metadata, not the budget
761
+ clock;
740
762
  - `ledger.json`: `settled`, one entry per settled attempt with `nearMiss: true`
741
763
  on a near miss, and `inFlight`, the running attempts with their titles and
742
764
  strategies;
@@ -809,6 +831,12 @@ build as an ordinary child.
809
831
  An attempt keeps the ordinary work grammar: plan, plan review, implement, code
810
832
  review, verify and finalize.
811
833
 
834
+ An attempt claims at its node's priority. `ab priority <node> urgent` puts
835
+ the node's attempts claimed afterwards in the urgent tier; an attempt already
836
+ claimed keeps its build's priority. Nothing is reserved: an attempt waits for
837
+ a free slot like any ready ticket, preempts nothing, and follows the source's
838
+ order within its tier.
839
+
812
840
  ### Attempt context
813
841
 
814
842
  In every phase of an attempt, `ab context` writes a derived `objective.md` and
@@ -969,6 +997,36 @@ slot, and retries on later polls without changing the settlement. An attempt
969
997
  that never published needs no deletion. Aborted and stopped attempts keep abort
970
998
  cleanup's own branch deletion.
971
999
 
1000
+ ## Active hours
1001
+
1002
+ `maxHours` counts the time the node's optimization work actually runs:
1003
+
1004
+ - **What counts.** An attempt from its `execution.started` to its
1005
+ `execution.ended`, and the node's own runs that started while its proposer
1006
+ or a measurement was due. Overlapping runs count once.
1007
+ - **What doesn't.** An attempt queued for a slot has no execution. A runner
1008
+ ends its execution whenever the build waits: paused, blocked on an
1009
+ escalation, on a ticket wait or awaiting merge. Other node runs, such as a
1010
+ branch reconcile, don't count.
1011
+ - **How it is kept.** The node's digest holds an exact union of execution
1012
+ intervals. Its own runs fold from its log. Attempt runs arrive in
1013
+ `optimization.activity-recorded` batches: on each tick the dispatcher reads
1014
+ an attempt build's `executionIntervals` value only when the build's digest
1015
+ shows new execution facts, records them on the node, then acknowledges them
1016
+ on the build with `execution.accounted`. An idle tick reads nothing. The
1017
+ first pass over a node starts its clock with a `starts` batch, so an
1018
+ attempt that settles before the dispatcher saw it run is still charged.
1019
+ - **At a stop.** `optimization.stopped` closes every interval at the stop
1020
+ time, so the value never grows afterwards. The next tick records one
1021
+ settling batch with every attempt run from before the stop the node had not
1022
+ yet accounted; a large one is chunked, and only its last chunk settles. Until then surfaces show `settling`, because that batch may
1023
+ change the value once.
1024
+ - **Nodes opened before active hours.** Their own past proposer and
1025
+ measurement runs count. Attempts still in flight are charged their whole
1026
+ run history once the dispatcher first sees them; attempts that settled
1027
+ before the clock's starting batch are not charged. A completed node reports its own runs,
1028
+ clipped at its stop.
1029
+
972
1030
  ## Stopping and completion
973
1031
 
974
1032
  An optimization node is done when the number is good enough, when it stops
@@ -982,7 +1040,7 @@ any point lands real, verified progress.
982
1040
  |---|---|
983
1041
  | `threshold` | The node head's current value has reached `target.threshold` in the objective's direction; for a panel, the head's recorded win rate against the starting head. |
984
1042
  | `plateau` | `stop.plateau.attempts` consecutive `no-improvement` or `declined` settlements. |
985
- | `budget` | Attempts filed reached `maxAttempts`, or hours since the first acceptance reached `maxHours`. |
1043
+ | `budget` | Attempts filed reached `maxAttempts`, or [active hours](#active-hours) reached `maxHours`. |
986
1044
  | `exhausted` | The proposer has nothing left to try. |
987
1045
  | `operator` | A human stopped it with `ab objective <node> --stop` or `optimization.stop`. |
988
1046
 
@@ -49,6 +49,8 @@ Declare served model prefixes and a default. Optional tool-free `oneShot` sits b
49
49
  - Provision an absolute, writable working copy for the requested branch; return durable base evidence.
50
50
  - Resume an intact branch non-destructively, never silently re-cut from a newer base. Rematerialize a lost copy. Make release idempotent.
51
51
  - Optional `provision.publication` supplies a durable confirmed SHA and known cache tips for authoritative readback and cache repair. Preserve unknown unpublished work.
52
+ - Optional `provision.fresh: { owner }` marks a build's first provision. A pre-existing branch of that name is not the build's work: never return it as the base unless you hold your own creation receipt for `owner` (stable across that build's retries). Cut from `baseBranch` and keep the old tip recoverable. Providers that ignore it rely on claim-time deduplication.
53
+ - Optional `localBranchExists(repo, branch)` reports a local `refs/heads/<branch>` in the checkout you create branches in, and throws when the probe fails. Dispatch calls it only at claim time and skips such a slug. Omit it when your branches aren't local; `remoteBranchExists` covers those.
52
54
 
53
55
  ### `forge`
54
56
 
@@ -108,7 +110,8 @@ another store opened. A throw during slug selection fails that claim: no build
108
110
  is created and the ticket is handed back to retry on a later tick, never named
109
111
  without the check. A throw while diagnosing a target node leaves the plain
110
112
  pending diagnostic. Without the capability, slugs are deduplicated against the
111
- local store only and the dispatcher records a startup warning.
113
+ local store, plus local branches when the workspace provider implements
114
+ `localBranchExists`, and the dispatcher records a startup warning.
112
115
 
113
116
  Stores may expose `getNodeRewrite(node, previousHead, beforePrevious)` as a bounded point
114
117
  lookup of a durable `node.rewritten` receipt. Built-in adapters index these
@@ -244,6 +247,7 @@ A plugin relying on a capability declares an `apiVersion` range containing its v
244
247
  - **1.8** Forge failure classification and request observers.
245
248
  - **1.9** Optional native ticket-source paging (`listPage`); older sources retain operator slicing.
246
249
  - **1.10** Optional ticket-source ready-assignee capability (`readyAssignee`, with `prepareReadyAssignee`, `readyAssigneeRefusal` and `describeReadyAssignee`); sources without it refuse `[tickets].readyAssignee`. Also optional targeted ticket listing (`listTargeting`); older tree sources are observed through `listAll`.
250
+ - **1.11** Optional ticket-source search (`search`); callers refuse sources without it and never fall back to a listing.
247
251
 
248
252
  ## 2. Create a repository-local module
249
253
 
@@ -644,6 +648,38 @@ File, Linear and GitHub retain fallback; the remote `HostedTicketSource`
644
648
  forwards pages to the service's native paging (`list-page`), falling back only
645
649
  against a service predating it. The POST list-ready protocol stays exhaustive.
646
650
 
651
+ ## Optional ticket search capability
652
+
653
+ Text search is an optional API 1.11 ticket-source capability:
654
+ `search?(query: TicketSearchQuery): Promise<TicketSearchPage>`. The SDK exports
655
+ the types and the `TicketSearchCursorInvalid` and `TicketSearchUnsupported`
656
+ errors.
657
+
658
+ | Type | Fields |
659
+ | --- | --- |
660
+ | `TicketSearchQuery` | `text`, optional `state`, optional `labels`, `limit`, optional `cursor` |
661
+ | `TicketSearchHit` | `id`, `title`, optional `state`, `labels`, `kind`, optional `target` |
662
+ | `TicketSearchPage` | `tickets: TicketSearchHit[]`, optional `cursor`, `diagnostics` |
663
+
664
+ - **Matching.** A ticket matches when every whitespace-separated term of
665
+ `text` occurs, case-insensitively, in its title or body; each term may hit
666
+ either field. A provider-backed source may apply its provider's word matching
667
+ instead.
668
+ - **Filters.** `state` resolves as `listReady` resolves it; absent means every
669
+ state, including completed and rejected tickets. `labels` are ANDed.
670
+ - **Paging.** `limit` is positive and already bounded by the caller. `cursor`
671
+ is opaque and source-defined; return one only when more matches remain. Order
672
+ is source-defined and stable across pages. Reject a malformed or foreign
673
+ cursor with the SDK's `TicketSearchCursorInvalid(sourceName, cursor)`;
674
+ callers map it to the `search-cursor-invalid` refusal.
675
+ - **Cost.** Build each hit from the search read itself, never from a follow-up
676
+ read per result. A failure rejects; it never falls back to `listAll`.
677
+
678
+ Sources that cannot search omit the method. Callers (`tickets.search`,
679
+ `ab ticket search`) then refuse with `TicketSearchUnsupported`, naming the
680
+ source, before reading any ticket. The shared `describeTicketSourceContract`
681
+ suite checks declared search automatically and skips it otherwise.
682
+
647
683
  Hosted cooldown recording rejects observed reset deadlines beyond the 24-hour
648
684
  admission horizon explicitly; adapters must not shorten or invent a provider
649
685
  reset to evade this validation. Operator forge-clear is an audited override,