@defrex/autobuild 1.1.0 → 1.2.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.
- package/README.md +5 -13
- package/SPEC.md +140 -10
- package/bin/ab-dispatch-generation.ts +11 -2
- package/docs/accounts.md +119 -0
- package/docs/agent-runtimes.md +4 -4
- package/docs/architecture.md +107 -8
- package/docs/build-store.md +3 -41
- package/docs/cli.md +14 -0
- package/docs/configuration-overview.md +111 -0
- package/docs/configuration.md +260 -141
- package/docs/dispatcher-hosting.md +18 -33
- package/docs/intake.md +2 -0
- package/docs/merge-policy.md +1 -3
- package/docs/operating.md +1 -2
- package/docs/operator-api.md +100 -47
- package/docs/operator-surfaces.md +3 -20
- package/docs/overview.md +1 -1
- package/docs/plugin-authoring.md +21 -0
- package/docs/remote-store-protocol.md +198 -89
- package/docs/remote-ticket-protocol.md +29 -49
- package/docs/seams.md +8 -8
- package/docs/setup.md +34 -129
- package/docs/ticket-sources.md +18 -0
- package/docs/troubleshooting.md +7 -11
- package/docs/upgrading.md +1 -1
- package/docs/workspaces.md +4 -4
- package/package.json +14 -5
- package/packages/core/src/accounts/chatgpt-oauth.ts +216 -0
- package/packages/core/src/accounts/chatgpt-state.ts +41 -0
- package/packages/core/src/accounts/local-credentials.ts +194 -0
- package/packages/core/src/accounts/local-inference.ts +106 -0
- package/packages/core/src/accounts/local-owner.ts +123 -0
- package/packages/core/src/accounts/sensitive.ts +2 -0
- package/packages/core/src/cli/accounts.ts +147 -0
- package/packages/core/src/cli/binary.ts +3 -1
- package/packages/core/src/cli/connect.ts +3 -3
- package/packages/core/src/cli/dispatch-handoff.ts +125 -44
- package/packages/core/src/cli/dispatch-launch-contract.ts +187 -0
- package/packages/core/src/cli/dispatch-launcher.ts +54 -21
- package/packages/core/src/cli/dispatch-preflight.ts +6 -1
- package/packages/core/src/cli/dispatch.ts +71 -2
- package/packages/core/src/cli/help.ts +16 -0
- package/packages/core/src/cli/init-readiness-remote.ts +22 -1
- package/packages/core/src/cli/init-readiness-shared.ts +5 -1
- package/packages/core/src/cli/init-validation.ts +160 -18
- package/packages/core/src/cli/main.ts +44 -0
- package/packages/core/src/cli/publication-settlement.ts +4 -1
- package/packages/core/src/cli/secrets.ts +173 -0
- package/packages/core/src/cli/store-opening.ts +11 -1
- package/packages/core/src/cli/upgrade-agent.ts +9 -1
- package/packages/core/src/cli/watch.ts +3 -1
- package/packages/core/src/config/accounts.ts +101 -0
- package/packages/core/src/config/live.ts +14 -1
- package/packages/core/src/config/roles.ts +54 -3
- package/packages/core/src/config/schema.ts +60 -0
- package/packages/core/src/events/compatibility.ts +2 -1
- package/packages/core/src/events/payloads.ts +3 -0
- package/packages/core/src/events/repository.ts +2 -0
- package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +3 -0
- package/packages/core/src/kernel/reducer.ts +4 -1
- package/packages/core/src/operator/index.ts +2 -0
- package/packages/core/src/operator/protocol.ts +6 -0
- package/packages/core/src/operator/registry.ts +22 -1
- package/packages/core/src/operator/tickets.ts +25 -4
- package/packages/core/src/plugins/manifest.ts +2 -1
- package/packages/core/src/ports/runner/account-env.ts +88 -0
- package/packages/core/src/ports/runner/chatgpt-provider.ts +85 -0
- package/packages/core/src/ports/runner/claude.ts +26 -2
- package/packages/core/src/ports/runner/codex.ts +63 -31
- package/packages/core/src/ports/runner/one-shot.ts +2 -0
- package/packages/core/src/ports/runner/provider-error.ts +5 -0
- package/packages/core/src/ports/runner/routing.ts +35 -4
- package/packages/core/src/ports/tickets/contract.ts +58 -0
- package/packages/core/src/ports/tickets/tree.ts +1 -1
- package/packages/core/src/ports/types.ts +28 -7
- package/packages/core/src/ports/workspace/account-policy.ts +72 -0
- package/packages/core/src/ports/workspace/build-execution.ts +6 -1
- package/packages/core/src/ports/workspace/builtin-capabilities.ts +1 -0
- package/packages/core/src/ports/workspace/create.ts +2 -0
- package/packages/core/src/ports/workspace/git-worktree.ts +6 -1
- package/packages/core/src/ports/workspace/provider-capabilities.ts +1 -0
- package/packages/core/src/ports/workspace/vercel-sandbox.ts +125 -35
- package/packages/core/src/processes/build-runner.ts +32 -1
- package/packages/core/src/processes/dispatcher.ts +23 -0
- package/packages/core/src/processes/execution-settlement.ts +21 -3
- package/packages/core/src/processes/harvest-runner.ts +68 -8
- package/packages/core/src/project-secrets.ts +105 -0
- package/packages/core/src/secret-name.ts +41 -0
- package/packages/core/src/store/account-redaction.ts +156 -0
- package/packages/core/src/store/contract.ts +3 -1
- package/packages/core/src/store/reducer-value-shapes.json +2889 -2781
- package/packages/core/src/store/remote/client.ts +42 -47
- package/packages/core/src/store/remote/compatibility.ts +18 -0
- package/packages/core/src/testing/dispatch-read-budget.ts +122 -0
- package/packages/core/src/testing/index.ts +1 -0
- package/packages/core/src/testing/reduced-read-budget.ts +47 -0
- package/skills/guide/SKILL.md +120 -30
- package/skills/guide/references/accounts.md +119 -0
- package/skills/guide/references/merge-policy.md +1 -3
- package/skills/guide/references/operator-api.md +100 -47
- package/skills/guide/references/plugin-authoring.md +21 -0
- package/skills/guide/references/remote-store-protocol.md +198 -89
- package/skills/guide/references/remote-ticket-protocol.md +29 -49
- package/skills/guide/references/setup.md +34 -129
- package/skills/harvest/SKILL.md +3 -1
- package/skills/harvest-review/SKILL.md +3 -1
- package/skills/operate/SKILL.md +5 -6
- package/skills/spec/SKILL.md +1 -1
- package/skills/tickets/SKILL.md +3 -2
- package/templates/hosted-service/package.json +2 -2
- package/docs/hosted-dispatcher-cutover-validation.md +0 -178
- package/docs/hosted-dispatcher.md +0 -278
- package/docs/hosted-service.md +0 -304
- package/docs/mcp.md +0 -150
package/docs/mcp.md
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
# The hosted MCP server
|
|
2
|
-
|
|
3
|
-
The hosted service exposes the agent tool registry over [Streamable HTTP](https://modelcontextprotocol.io) at
|
|
4
|
-
`/mcp`, on the same origin as the operator dashboard. External agents — Claude
|
|
5
|
-
web, Claude Desktop, Claude Code, Codex, or any harness with an MCP client —
|
|
6
|
-
get the same operator surface across supported external bindings, at parity by
|
|
7
|
-
construction: tool names, descriptions, JSON schemas, and annotations are read
|
|
8
|
-
from the registry's closed table, and every execution goes through the
|
|
9
|
-
operator API's token-verified protocol.
|
|
10
|
-
|
|
11
|
-
## What the endpoint serves
|
|
12
|
-
|
|
13
|
-
- **Every registry tool**, with its schema and annotations, plus
|
|
14
|
-
**`repositories.list`** — a read-only tool returning the repository
|
|
15
|
-
identities this deployment serves (the values every tool's `repo` field
|
|
16
|
-
accepts). The binding is data-driven: when a future ticket adds registry
|
|
17
|
-
entries, they appear on the endpoint with no change to the deployment.
|
|
18
|
-
- **Server instructions** summarizing how Autobuild works (dispatcher, builds,
|
|
19
|
-
tickets, harvest, notes) and pointing clients at `repositories.list`.
|
|
20
|
-
- A **stateless transport**: fresh transport and server per request, JSON
|
|
21
|
-
responses, no session ids. Every request is authenticated independently, so
|
|
22
|
-
cold starts behave identically to warm instances.
|
|
23
|
-
|
|
24
|
-
## Authentication: OAuth 2.1 through Better Auth
|
|
25
|
-
|
|
26
|
-
The endpoint is an OAuth 2.1 **protected resource**; the deployment's Better
|
|
27
|
-
Auth instance is the **authorization server**. An unauthenticated request to
|
|
28
|
-
`/mcp` receives `401` with an RFC 9728 `WWW-Authenticate` challenge pointing at
|
|
29
|
-
`/.well-known/oauth-protected-resource`. From there a client:
|
|
30
|
-
|
|
31
|
-
1. Reads the protected-resource metadata (served at the origin root and under
|
|
32
|
-
`/api/auth`) to discover the authorization server.
|
|
33
|
-
2. Reads the authorization-server metadata
|
|
34
|
-
(`/.well-known/oauth-authorization-server`) — authorization, token, and
|
|
35
|
-
dynamic-registration endpoints, plus the `jwks_uri`.
|
|
36
|
-
3. Registers dynamically (`POST /api/auth/mcp/register`, RFC 7591); the
|
|
37
|
-
registered `client_name` becomes the `via` marker recorded on writes.
|
|
38
|
-
4. Runs the authorization-code flow with PKCE through `GET /api/auth/mcp/authorize`.
|
|
39
|
-
A signed-out person is redirected to the deployment's sign-in page (the
|
|
40
|
-
existing GitHub sign-in and organization membership policy); the flow resumes after
|
|
41
|
-
sign-in. Only super users and organization members are admitted. The resource
|
|
42
|
-
rechecks admission and project access on every tool callback, so removed
|
|
43
|
-
members lose authority with existing tokens (`403`).
|
|
44
|
-
5. Exchanges the code at `/api/auth/mcp/token`; access tokens are short-lived
|
|
45
|
-
and refresh tokens rotate. Consent renders only when the client sends
|
|
46
|
-
`prompt=consent` (the plugin's designed behavior); clients that omit it
|
|
47
|
-
receive a code directly.
|
|
48
|
-
|
|
49
|
-
Every tool call resolves the token's subject to the signed-in operator, mints
|
|
50
|
-
the same 30-second attributed operator token the web gateway mints — stamped
|
|
51
|
-
with `via: {kind: "mcp", client}` — and executes the named tool through the
|
|
52
|
-
operator server. A mutating tool's durable event therefore names the person
|
|
53
|
-
who authorized the client and which client executed it:
|
|
54
|
-
|
|
55
|
-
```json
|
|
56
|
-
{ "kind": "human", "user": "ada@example.com", "via": { "kind": "mcp", "client": "Claude web" } }
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Tool calls naming a repository outside the deployment's served set are refused
|
|
60
|
-
(`kind: "validation"`).
|
|
61
|
-
|
|
62
|
-
## Duration limits
|
|
63
|
-
|
|
64
|
-
The MCP route's `maxDuration` is 300 s (Vercel Pro default) — the same pairing
|
|
65
|
-
the [dispatcher route](hosted-dispatcher.md) documents. Tool-requested bounded
|
|
66
|
-
waits (`builds.events`' `waitSeconds`) are clamped to **`MCP_MAX_WAIT_SECONDS`
|
|
67
|
-
= 240 s** at the binding, so no single MCP request outlives the route's limit;
|
|
68
|
-
the registry's own schema currently caps that tool's waits lower, and the
|
|
69
|
-
clamp is the guard that holds if that cap rises.
|
|
70
|
-
|
|
71
|
-
## Connecting clients
|
|
72
|
-
|
|
73
|
-
### Claude web (custom connector)
|
|
74
|
-
|
|
75
|
-
Settings → Connectors → **Add custom connector**, enter the deployment URL
|
|
76
|
-
plus `/mcp` (e.g. `https://operator.example/mcp`). Claude discovers the
|
|
77
|
-
authorization server from the protected-resource metadata, registers
|
|
78
|
-
dynamically, and sends the person through GitHub sign-in and the consent page;
|
|
79
|
-
the OAuth callback is `https://claude.ai/api/mcp/auth_callback` (allowed by
|
|
80
|
-
dynamic registration — no configuration needed on the deployment).
|
|
81
|
-
|
|
82
|
-
### Claude Code
|
|
83
|
-
|
|
84
|
-
```sh
|
|
85
|
-
claude mcp add --transport http autobuild https://operator.example/mcp
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
Claude Code runs the same OAuth 2.1 flow in the terminal (it opens a browser
|
|
89
|
-
for sign-in and consent).
|
|
90
|
-
|
|
91
|
-
### Codex
|
|
92
|
-
|
|
93
|
-
```sh
|
|
94
|
-
codex mcp add autobuild --url https://operator.example/mcp
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
### Any MCP client
|
|
98
|
-
|
|
99
|
-
Point the client at `<deployment>/mcp` over Streamable HTTP. A client only
|
|
100
|
-
needs RFC 9728 discovery, dynamic client registration, PKCE, and refresh —
|
|
101
|
-
the standard surface the endpoint serves.
|
|
102
|
-
|
|
103
|
-
## Operational variables
|
|
104
|
-
|
|
105
|
-
- `AB_WEB_MCP_RESOURCE` (optional): the protected resource the plugin binds
|
|
106
|
-
tokens to. Defaults to `<BETTER_AUTH_URL>/mcp`, which is correct for the
|
|
107
|
-
standard deployment; override only when a proxy or custom domain fronts the
|
|
108
|
-
function. Must be an absolute http(s) URL (https in production).
|
|
109
|
-
- `BETTER_AUTH_URL`: the public origin — the authorization-server issuer and
|
|
110
|
-
the default MCP resource's base.
|
|
111
|
-
- `AB_WEB_SUPER_USER_EMAILS`: the super-user email list. Other operators need organization membership;
|
|
112
|
-
admission and repository access are rechecked on every tool callback.
|
|
113
|
-
- `AB_WEB_REPOSITORIES` (deprecated): optional once-per-database registry
|
|
114
|
-
bootstrap, never an ongoing allowlist. `repositories.list` queries current
|
|
115
|
-
active registrations on every call, and every tool checks current membership.
|
|
116
|
-
|
|
117
|
-
Super users see every registered project; other users see only active projects
|
|
118
|
-
assigned to their organizations. Database-authorized
|
|
119
|
-
owners use the [project commands](setup.md#connected-projects) to add or remove
|
|
120
|
-
projects without redeploying. Removal hides retained data until re-registration;
|
|
121
|
-
registry failures never authorize a call.
|
|
122
|
-
|
|
123
|
-
The endpoint requires no additional variables beyond the hosted service's
|
|
124
|
-
existing web/auth set. Note that consent renders when the client sends
|
|
125
|
-
`prompt=consent`; a client that omits it gets a code directly (the plugin's
|
|
126
|
-
designed behavior).
|
|
127
|
-
|
|
128
|
-
### Tree and consent reads
|
|
129
|
-
|
|
130
|
-
`merges.list` takes `{repo}` and returns slug-sorted ready consent or held
|
|
131
|
-
merges, with effective target, source branch, candidate, verification receipts
|
|
132
|
-
and node completeness/children. It reads reduced durable state; `builds.control`
|
|
133
|
-
with `merge` rechecks readiness and live completeness. `hold` remains available
|
|
134
|
-
before readiness. `tickets.tree` takes `{repo}` and returns `{root, children,
|
|
135
|
-
diagnostics}` from exhaustive configured-source enumeration. Source ancestry is
|
|
136
|
-
separate from frozen build ancestry. Both tools are read-only and repository scoped.
|
|
137
|
-
|
|
138
|
-
The CLI equivalents are `ab merges [--json] [--store <ref>]` and
|
|
139
|
-
`ab ticket tree [--json]`. Default `ab watch` attention includes node merges,
|
|
140
|
-
restack conflicts and derived `build.consent-ready` observations with durable
|
|
141
|
-
cursor positions. `ab wait` supports `consent`, `node-merged` and
|
|
142
|
-
`restack-conflicted`; current-state conditions return immediately. Explicit
|
|
143
|
-
watch event globs emit durable events only. A readiness episode changes on a
|
|
144
|
-
new candidate or exit/re-entry, and cursor resume suppresses its duplicate.
|
|
145
|
-
|
|
146
|
-
Consent and hold readiness produce only `build.consent-ready`; merge attention is
|
|
147
|
-
reserved for current gate deferrals and unsafe forge outcomes. Named and
|
|
148
|
-
repository-wide watches report an already-ready merge on first discovery.
|
|
149
|
-
Readiness observations use the same `{kind, branch, ticket?, build?}` effective
|
|
150
|
-
target shape as queue entries.
|