@defrex/autobuild 1.10.0 → 1.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/SPEC.md +745 -69
- package/bin/ab-dispatch-generation.ts +3 -1
- package/docs/accounts.md +2 -1
- package/docs/answering-blocked-builds.md +20 -0
- package/docs/architecture.md +165 -29
- package/docs/build-store.md +10 -7
- package/docs/cli.md +33 -1
- package/docs/configuration-overview.md +4 -1
- package/docs/configuration.md +381 -29
- package/docs/dispatcher.md +64 -4
- package/docs/forges.md +7 -0
- package/docs/integration-tree.md +2 -2
- package/docs/operating.md +4 -2
- package/docs/operator-api.md +134 -6
- package/docs/operator-surfaces.md +85 -0
- package/docs/optimization-nodes.md +69 -11
- package/docs/plugin-authoring.md +37 -1
- package/docs/remote-store-protocol.md +94 -13
- package/docs/remote-ticket-protocol.md +40 -0
- package/docs/restacking.md +20 -4
- package/docs/setup.md +14 -2
- package/docs/ticket-dependencies.md +10 -3
- package/docs/ticket-sources.md +24 -2
- package/docs/tickets.md +7 -1
- package/docs/troubleshooting.md +8 -0
- package/docs/verification.md +4 -3
- package/docs/workspaces.md +3 -0
- package/package.json +9 -5
- package/packages/core/src/cli/accounts.ts +7 -2
- package/packages/core/src/cli/attention.ts +3 -1
- package/packages/core/src/cli/binary-direct.ts +2 -0
- package/packages/core/src/cli/binary-lifecycle.ts +2 -1
- package/packages/core/src/cli/build-control.ts +79 -1
- package/packages/core/src/cli/context.ts +4 -0
- package/packages/core/src/cli/dashboard/facts.ts +49 -53
- package/packages/core/src/cli/dashboard/header.ts +111 -0
- package/packages/core/src/cli/dashboard/model.ts +31 -39
- package/packages/core/src/cli/dashboard/objective-row.ts +46 -14
- package/packages/core/src/cli/dashboard/poll.ts +179 -76
- package/packages/core/src/cli/dashboard/render.ts +159 -230
- package/packages/core/src/cli/dashboard/row-text.ts +538 -0
- package/packages/core/src/cli/dashboard/timeline.ts +288 -0
- package/packages/core/src/cli/dashboard/vocabulary.ts +188 -0
- package/packages/core/src/cli/dispatch-args.ts +44 -1
- package/packages/core/src/cli/dispatch-frontend.ts +40 -40
- package/packages/core/src/cli/dispatch-launch-stop.ts +18 -0
- package/packages/core/src/cli/dispatch-launcher.ts +20 -7
- package/packages/core/src/cli/dispatch-web.ts +155 -0
- package/packages/core/src/cli/dispatch.ts +202 -38
- package/packages/core/src/cli/help.ts +87 -3
- package/packages/core/src/cli/init-validation.ts +3 -3
- package/packages/core/src/cli/main.ts +70 -6
- package/packages/core/src/cli/mcp.ts +35 -3
- package/packages/core/src/cli/objective.ts +1 -1
- package/packages/core/src/cli/operator-preference.ts +57 -0
- package/packages/core/src/cli/repo-lease.ts +2 -0
- package/packages/core/src/cli/repo-state.ts +56 -6
- package/packages/core/src/cli/repository-status.ts +105 -49
- package/packages/core/src/cli/status.ts +82 -1
- package/packages/core/src/cli/terminal-restore.ts +32 -7
- package/packages/core/src/cli/ticket.ts +98 -36
- package/packages/core/src/cli/wait.ts +14 -6
- package/packages/core/src/cli/watch.ts +20 -4
- package/packages/core/src/cli/web.ts +139 -0
- package/packages/core/src/config/live.ts +99 -14
- package/packages/core/src/config/load.ts +61 -20
- package/packages/core/src/config/local.ts +212 -0
- package/packages/core/src/config/pipeline-source.ts +2 -0
- package/packages/core/src/config/reference.ts +18 -0
- package/packages/core/src/config/schema.ts +45 -10
- package/packages/core/src/events/catalog.ts +4 -0
- package/packages/core/src/events/payloads.ts +97 -0
- package/packages/core/src/events/policy.ts +10 -0
- package/packages/core/src/events/repository.ts +46 -3
- package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +381 -30
- package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/017d8dd5bb6dd80b.json.gz +0 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/178e12f1759b7552.json.gz +0 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/4932c70a2af97faf.json.gz +0 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/536085773daf6b58.json.gz +0 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/6bd6275061aaffa5.json.gz +0 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/89625654b02e9ac1.json.gz +0 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/a98af134be2da8a9.json.gz +0 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/d5d5ccca80a893d8.json.gz +0 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/f8155387eb5f375c.json.gz +0 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/3c27f918b194e3b3.json +465 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/46196d8f0076496a.json +97 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/79f0e0f4ccd43ba2.json +455 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/859c09edac738823.json +1086 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a283c1f3462b1cc1.json +81 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a6e570fb126991ff.json +36 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a8acf22c968b6e3d.json +81 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/ba7b85895bf6698e.json +1153 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/fc66408cde0b6b04.json +637 -0
- package/packages/core/src/kernel/build-roster.ts +230 -0
- package/packages/core/src/kernel/dispatch-capacity.ts +4 -2
- package/packages/core/src/kernel/dispatch-status.ts +139 -0
- package/packages/core/src/kernel/engine.ts +43 -5
- package/packages/core/src/kernel/execution-intervals.ts +61 -0
- package/packages/core/src/kernel/generators/optimization-log.ts +101 -0
- package/packages/core/src/kernel/generators/repository-journals.ts +13 -0
- package/packages/core/src/kernel/leaf-restack-base.ts +33 -7
- package/packages/core/src/kernel/leaf-restack-state.ts +82 -3
- package/packages/core/src/kernel/log-index.ts +19 -0
- package/packages/core/src/kernel/optimization-admission.ts +244 -3
- package/packages/core/src/kernel/optimization.ts +183 -4
- package/packages/core/src/kernel/phase-failures.ts +121 -0
- package/packages/core/src/kernel/published-branch-head.ts +60 -0
- package/packages/core/src/kernel/read-facts.ts +15 -13
- package/packages/core/src/kernel/reducer-registry.ts +27 -8
- package/packages/core/src/kernel/reducer-revisions.ts +27 -0
- package/packages/core/src/kernel/reducer.ts +63 -4
- package/packages/core/src/kernel/rollup.ts +61 -0
- package/packages/core/src/kernel/setup-streak.ts +38 -0
- package/packages/core/src/kernel/step-durations.ts +257 -0
- package/packages/core/src/kernel/target-observation.ts +6 -1
- package/packages/core/src/kernel/target-rewrite-recovery.ts +116 -0
- package/packages/core/src/kernel/verify-diff-base.ts +5 -0
- package/packages/core/src/kernel/verify-stages.ts +13 -3
- package/packages/core/src/ontology.ts +5 -0
- package/packages/core/src/operator/agent-context-serve.ts +631 -0
- package/packages/core/src/operator/annotations.ts +75 -5
- package/packages/core/src/operator/attention.ts +470 -0
- package/packages/core/src/operator/canonical-skills.ts +35 -0
- package/packages/core/src/operator/cli-equivalents.ts +270 -0
- package/packages/core/src/operator/context-prompts.ts +61 -0
- package/packages/core/src/operator/index.ts +49 -1
- package/packages/core/src/operator/landings.ts +28 -19
- package/packages/core/src/operator/optimization.ts +7 -0
- package/packages/core/src/operator/protocol.ts +3 -0
- package/packages/core/src/operator/query.ts +129 -74
- package/packages/core/src/operator/read-view.ts +5 -2
- package/packages/core/src/operator/registry.ts +406 -46
- package/packages/core/src/operator/requests.ts +20 -18
- package/packages/core/src/operator/sandbox-host.ts +107 -11
- package/packages/core/src/operator/sandbox-resolver.ts +253 -0
- package/packages/core/src/operator/sandbox.ts +778 -82
- package/packages/core/src/operator/ticket-asset-list.ts +77 -0
- package/packages/core/src/operator/ticket-assets.ts +167 -0
- package/packages/core/src/operator/tickets.ts +33 -2
- package/packages/core/src/plugin-sdk/index.ts +22 -0
- package/packages/core/src/plugins/manifest.ts +1 -1
- package/packages/core/src/ports/forge/fake.ts +92 -1
- package/packages/core/src/ports/forge/git-blob.ts +15 -0
- package/packages/core/src/ports/forge/github.ts +82 -0
- package/packages/core/src/ports/forge/local-git.ts +61 -1
- package/packages/core/src/ports/forge-failure.ts +24 -0
- package/packages/core/src/ports/runner/antigravity-test.fixture.ts +149 -0
- package/packages/core/src/ports/runner/claude-test.fixture.ts +71 -0
- package/packages/core/src/ports/runner/codex-test.fixture.ts +63 -0
- package/packages/core/src/ports/tickets/contract.ts +71 -0
- package/packages/core/src/ports/tickets/fake.ts +11 -0
- package/packages/core/src/ports/tickets/file.ts +18 -0
- package/packages/core/src/ports/tickets/github-fake.ts +136 -4
- package/packages/core/src/ports/tickets/github.ts +387 -30
- package/packages/core/src/ports/tickets/hosted-index.ts +10 -0
- package/packages/core/src/ports/tickets/linear.ts +130 -0
- package/packages/core/src/ports/tickets/priority.ts +9 -0
- package/packages/core/src/ports/tickets/remote-protocol.ts +34 -0
- package/packages/core/src/ports/tickets/remote.ts +70 -6
- package/packages/core/src/ports/tickets/search.ts +139 -0
- package/packages/core/src/ports/types.ts +104 -2
- package/packages/core/src/ports/workspace/builtin-capabilities.ts +9 -0
- package/packages/core/src/ports/workspace/create.ts +15 -1
- package/packages/core/src/ports/workspace/fake.ts +340 -12
- package/packages/core/src/ports/workspace/git-worktree.ts +833 -42
- package/packages/core/src/ports/workspace/operator-sandbox.ts +129 -12
- package/packages/core/src/ports/workspace/process-group.ts +48 -0
- package/packages/core/src/ports/workspace/vercel-sandbox.ts +1260 -123
- package/packages/core/src/processes/agent-context-assemble.ts +576 -0
- package/packages/core/src/processes/agent-context.ts +469 -0
- package/packages/core/src/processes/build-runner.ts +387 -236
- package/packages/core/src/processes/dispatcher.ts +211 -55
- package/packages/core/src/processes/execution-no-progress.ts +4 -0
- package/packages/core/src/processes/optimization-activity.ts +120 -0
- package/packages/core/src/processes/phase-failure-budget.ts +1 -0
- package/packages/core/src/processes/repo-view.ts +78 -2
- package/packages/core/src/processes/sandbox-state.ts +53 -6
- package/packages/core/src/processes/tick-publication.ts +2 -0
- package/packages/core/src/processes/workspace-preparation.ts +76 -0
- package/packages/core/src/scenarios/harness.ts +0 -5
- package/packages/core/src/store/account-redaction.ts +1 -0
- package/packages/core/src/store/adapter.ts +52 -1
- package/packages/core/src/store/agent-context.ts +432 -0
- package/packages/core/src/store/build-feed.ts +291 -0
- package/packages/core/src/store/build-scope.ts +19 -1
- package/packages/core/src/store/contract.ts +911 -14
- package/packages/core/src/store/digest.ts +19 -6
- package/packages/core/src/store/histogram.ts +113 -0
- package/packages/core/src/store/local/schema.ts +62 -0
- package/packages/core/src/store/local/store.ts +628 -22
- package/packages/core/src/store/local/ticket-asset-heads.ts +23 -0
- package/packages/core/src/store/memory.ts +461 -69
- package/packages/core/src/store/open-builds.ts +19 -0
- package/packages/core/src/store/phase-session.ts +32 -4
- package/packages/core/src/store/reduced-reads.ts +14 -4
- package/packages/core/src/store/reducer-value-shapes.json +7027 -5751
- package/packages/core/src/store/reducer-values.ts +6 -1
- package/packages/core/src/store/remote/client.ts +208 -2
- package/packages/core/src/store/remote/compatibility.ts +1 -1
- package/packages/core/src/store/remote/index.ts +33 -0
- package/packages/core/src/store/remote/protocol.ts +69 -0
- package/packages/core/src/store/remote/released-clients.json +22 -0
- package/packages/core/src/store/remote/released-reducer-values/1.11.0.json +35680 -0
- package/packages/core/src/store/remote/released-reducer-values/1.11.1.json +35718 -0
- package/packages/core/src/store/remote/released-reducer-values/index.ts +20 -16
- package/packages/core/src/store/retention.ts +23 -1
- package/packages/core/src/store/rollups.ts +337 -0
- package/packages/core/src/store/session-handle.ts +20 -2
- package/packages/core/src/store/snapshots.ts +10 -0
- package/packages/core/src/store/types.ts +108 -9
- package/packages/core/src/testing/dispatch-journals.ts +117 -0
- package/packages/core/src/testing/dispatch-read-budget.ts +1092 -2
- package/packages/core/src/testing/git-config-isolation.ts +7 -5
- package/packages/core/src/testing/index.ts +27 -0
- package/packages/core/src/testing/memory-operator-sandbox.ts +346 -0
- package/packages/core/src/testing/reduced-read-budget.ts +1873 -98
- package/packages/core/src/web/analytics-source.ts +303 -0
- package/packages/core/src/web/assets/Atkinson-OFL.txt +93 -0
- package/packages/core/src/web/assets/AtkinsonHyperlegibleNext.latin.woff2 +0 -0
- package/packages/core/src/web/assets/JetBrains-OFL.txt +93 -0
- package/packages/core/src/web/assets/JetBrainsMono.latin.woff2 +0 -0
- package/packages/core/src/web/assets/app.css +1 -0
- package/packages/core/src/web/assets/app.js +9 -0
- package/packages/core/src/web/assets/manifest.json +31 -0
- package/packages/core/src/web/assets/theme.js +1 -0
- package/packages/core/src/web/bounded.ts +31 -0
- package/packages/core/src/web/http.ts +315 -0
- package/packages/core/src/web/hub.ts +160 -0
- package/packages/core/src/web/options.ts +38 -0
- package/packages/core/src/web/overview-source.ts +322 -0
- package/packages/core/src/web/page.ts +56 -0
- package/packages/core/src/web/protocol.ts +151 -0
- package/packages/core/src/web/read-only.ts +23 -0
- package/packages/core/src/web/repository-source.ts +39 -0
- package/packages/core/src/web/server.ts +97 -0
- package/skills/code-review/SKILL.md +10 -2
- package/skills/guide/SKILL.md +376 -54
- package/skills/guide/references/accounts.md +2 -1
- package/skills/guide/references/integration-tree.md +2 -2
- package/skills/guide/references/operator-api.md +134 -6
- package/skills/guide/references/optimization-nodes.md +69 -11
- package/skills/guide/references/plugin-authoring.md +37 -1
- package/skills/guide/references/remote-store-protocol.md +94 -13
- package/skills/guide/references/remote-ticket-protocol.md +40 -0
- package/skills/guide/references/restacking.md +20 -4
- package/skills/guide/references/setup.md +14 -2
- package/skills/guide/references/ticket-dependencies.md +10 -3
- package/skills/implement/SKILL.md +23 -4
- package/skills/operate/SKILL.md +134 -32
- package/skills/plan/SKILL.md +10 -4
- package/skills/plan-review/SKILL.md +9 -2
- package/skills/spec/SKILL.md +34 -8
- package/skills/tickets/SKILL.md +51 -5
- package/templates/hosted-service/package.json +2 -2
|
@@ -16,6 +16,9 @@ export const reducerValueRequestSchema = z
|
|
|
16
16
|
.object({
|
|
17
17
|
reducer: z.string().min(1).max(64),
|
|
18
18
|
args: z.record(z.string(), z.json()).optional(),
|
|
19
|
+
/** Read-time arguments: they shape a rollup's finished value without
|
|
20
|
+
* creating a key (SPEC §7.7). Named reducers reject them. */
|
|
21
|
+
read: z.record(z.string(), z.json()).optional(),
|
|
19
22
|
})
|
|
20
23
|
.strict()
|
|
21
24
|
export type ReducerValueRequest = z.infer<typeof reducerValueRequestSchema>
|
|
@@ -44,7 +47,7 @@ export interface ValueCatalogEntry {
|
|
|
44
47
|
create(args: any): IncrementalReducer<any, any, any>
|
|
45
48
|
}
|
|
46
49
|
|
|
47
|
-
function canonical(value: unknown): string {
|
|
50
|
+
export function canonical(value: unknown): string {
|
|
48
51
|
if (Array.isArray(value)) return `[${value.map(canonical).join(',')}]`
|
|
49
52
|
if (value !== null && typeof value === 'object')
|
|
50
53
|
return `{${Object.entries(value)
|
|
@@ -60,6 +63,8 @@ export function resolveReducerValue(
|
|
|
60
63
|
catalogIdentity = READ_CATALOG_IDENTITY,
|
|
61
64
|
) {
|
|
62
65
|
const request = reducerValueRequestSchema.parse(input)
|
|
66
|
+
if (request.read !== undefined)
|
|
67
|
+
throw new Error(`reducer "${request.reducer}" takes no read-time arguments`)
|
|
63
68
|
const registration = Object.hasOwn(REDUCERS, request.reducer)
|
|
64
69
|
? REDUCERS[request.reducer]
|
|
65
70
|
: undefined
|
|
@@ -19,6 +19,19 @@ import {
|
|
|
19
19
|
type EventPage,
|
|
20
20
|
} from '../event-reads'
|
|
21
21
|
import { ArtifactMetaUnsupportedError } from '../artifact-meta'
|
|
22
|
+
import {
|
|
23
|
+
BuildFeedUnsupportedError,
|
|
24
|
+
decodeBuildPageCursor,
|
|
25
|
+
hasBuildPageFilters,
|
|
26
|
+
requireBuildPageCursorOrder,
|
|
27
|
+
resolveBuildPageFilters,
|
|
28
|
+
sameBuildPageFilters,
|
|
29
|
+
parseChangePosition,
|
|
30
|
+
resolveBuildPageLimit,
|
|
31
|
+
type BuildPage,
|
|
32
|
+
type BuildPageOptions,
|
|
33
|
+
type ChangedBuilds,
|
|
34
|
+
} from '../build-feed'
|
|
22
35
|
import {
|
|
23
36
|
operatorPresenceBodySchema,
|
|
24
37
|
operatorPresenceWireSchema,
|
|
@@ -45,10 +58,13 @@ import { prepareEventWrite as validateEventWrite } from '../../events/catalog'
|
|
|
45
58
|
import { prepareRepositoryEventWrite as validateRepositoryEventWrite } from '../../events/repository'
|
|
46
59
|
import {
|
|
47
60
|
resolveReducerValue,
|
|
61
|
+
reducerValueRequestSchema,
|
|
48
62
|
reducerValueSchema,
|
|
49
63
|
type ReducerValueRequest,
|
|
50
64
|
type ReducerValue,
|
|
51
65
|
} from '../reducer-values'
|
|
66
|
+
import { rollupEntry } from '../rollups'
|
|
67
|
+
import type { ReducerValueScope, RollupScope } from '../snapshots'
|
|
52
68
|
/**
|
|
53
69
|
* RemoteBuildStore (SPEC §7.2 adapter 2): the client half of the remote
|
|
54
70
|
* store — a full BuildStore over the wire protocol in protocol.ts. The
|
|
@@ -100,7 +116,8 @@ import { createBuildScopedStore } from '../build-scope'
|
|
|
100
116
|
import { createSessionScopedStore } from '../session-handle'
|
|
101
117
|
import { pollingSubscribe } from '../subscribe'
|
|
102
118
|
import type { ReducerSnapshot, SnapshotScope } from '../snapshots'
|
|
103
|
-
import type { BuildDigest } from '../types'
|
|
119
|
+
import type { BuildDigest, OpenBuild } from '../types'
|
|
120
|
+
import { OpenBuildsCapabilityError } from '../open-builds'
|
|
104
121
|
import type {
|
|
105
122
|
StreamChunk,
|
|
106
123
|
StreamOutcome,
|
|
@@ -135,9 +152,13 @@ import {
|
|
|
135
152
|
artifactMetaListSchema,
|
|
136
153
|
artifactMetaWireSchema,
|
|
137
154
|
buildDigestListSchema,
|
|
155
|
+
buildPageSchema,
|
|
138
156
|
buildRecordListSchema,
|
|
139
157
|
buildRecordWireSchema,
|
|
158
|
+
openBuildListSchema,
|
|
159
|
+
changedBuildsSchema,
|
|
140
160
|
conditionalEventResponseSchema,
|
|
161
|
+
conditionalRepoEventResponseSchema,
|
|
141
162
|
conditionalSessionEventResponseSchema,
|
|
142
163
|
decodeBase64,
|
|
143
164
|
depositsResponseSchema,
|
|
@@ -436,6 +457,38 @@ export class RemoteBuildStore implements BuildStore {
|
|
|
436
457
|
return this.requestJson('GET', '/builds', buildRecordListSchema)
|
|
437
458
|
}
|
|
438
459
|
|
|
460
|
+
async listOpenBuilds(repo: string): Promise<OpenBuild[]> {
|
|
461
|
+
// Handled before the repository-existence gate like `build-digests`: an
|
|
462
|
+
// unknown repo answers 200 []. A server without the route answers a
|
|
463
|
+
// capability failure; listing every build instead is never allowed. An
|
|
464
|
+
// older server routes the unrecognized operation through that gate, so
|
|
465
|
+
// its `unknown repo` 404 for an empty or journal-less repository is the
|
|
466
|
+
// same missing capability: this server never answers it for this route.
|
|
467
|
+
const path = `${this.repoPath(repo)}/open-builds`
|
|
468
|
+
const response = await this.raw('GET', path)
|
|
469
|
+
if (!response.ok) {
|
|
470
|
+
const body = errorBodySchema.safeParse(
|
|
471
|
+
await response
|
|
472
|
+
.clone()
|
|
473
|
+
.json()
|
|
474
|
+
.catch(() => null),
|
|
475
|
+
)
|
|
476
|
+
if (
|
|
477
|
+
response.status === 405 ||
|
|
478
|
+
(body.success &&
|
|
479
|
+
((response.status === 501 && body.data.kind === 'unsupported-operation') ||
|
|
480
|
+
(response.status === 404 &&
|
|
481
|
+
body.data.kind === 'not-found' &&
|
|
482
|
+
(body.data.error === 'no route: GET /repos/:repo/open-builds' ||
|
|
483
|
+
body.data.error === `no route: GET ${new URL(`${this.base}${path}`).pathname}` ||
|
|
484
|
+
body.data.error === `unknown repo "${repo}"`))))
|
|
485
|
+
)
|
|
486
|
+
throw new OpenBuildsCapabilityError(repo)
|
|
487
|
+
throw await this.toError(response)
|
|
488
|
+
}
|
|
489
|
+
return openBuildListSchema.parse(await response.json()) as OpenBuild[]
|
|
490
|
+
}
|
|
491
|
+
|
|
439
492
|
async getRepoBuildDigests(repo: string): Promise<Map<string, BuildDigest>> {
|
|
440
493
|
// A repo-scoped batch read (AUT-487): one request regardless of build
|
|
441
494
|
// count. The route answers from build records, so an unknown repo or a
|
|
@@ -838,6 +891,20 @@ export class RemoteBuildStore implements BuildStore {
|
|
|
838
891
|
return envelope as unknown as RepositoryEventEnvelope<T>
|
|
839
892
|
}
|
|
840
893
|
|
|
894
|
+
async appendRepoIfCurrent<T extends RepositoryEventType>(
|
|
895
|
+
repo: string,
|
|
896
|
+
expectedSeq: number,
|
|
897
|
+
event: RepositoryEventWrite<T>,
|
|
898
|
+
): Promise<RepositoryEventEnvelope<T> | null> {
|
|
899
|
+
const envelope = await this.requestJson(
|
|
900
|
+
'POST',
|
|
901
|
+
`${this.repoPath(repo)}/events/conditional`,
|
|
902
|
+
conditionalRepoEventResponseSchema,
|
|
903
|
+
{ expectedSeq, event: validateRepositoryEventWrite(event) },
|
|
904
|
+
)
|
|
905
|
+
return envelope as unknown as RepositoryEventEnvelope<T> | null
|
|
906
|
+
}
|
|
907
|
+
|
|
841
908
|
async appendRepoWithArtifacts<T extends RepositoryEventType>(
|
|
842
909
|
repo: string,
|
|
843
910
|
artifacts: ArtifactInput[],
|
|
@@ -983,7 +1050,11 @@ export class RemoteBuildStore implements BuildStore {
|
|
|
983
1050
|
) as Promise<EventPage<RepositoryEvent>>
|
|
984
1051
|
}
|
|
985
1052
|
|
|
986
|
-
async getReducerValue(
|
|
1053
|
+
async getReducerValue(
|
|
1054
|
+
scope: ReducerValueScope,
|
|
1055
|
+
request: ReducerValueRequest,
|
|
1056
|
+
): Promise<ReducerValue> {
|
|
1057
|
+
if (scope.kind === 'rollup') return this.getRollupValue(scope, request)
|
|
987
1058
|
const { reducer } = resolveReducerValue(scope, request)
|
|
988
1059
|
const root = scope.kind === 'build' ? this.buildPath(scope.slug) : this.repoPath(scope.repo)
|
|
989
1060
|
const response = await this.raw('POST', `${root}/reducer-values`, request, undefined, {
|
|
@@ -1034,6 +1105,68 @@ export class RemoteBuildStore implements BuildStore {
|
|
|
1034
1105
|
}
|
|
1035
1106
|
}
|
|
1036
1107
|
|
|
1108
|
+
/** `POST …/rollup-values` (SPEC §7.7): one request, answered by the
|
|
1109
|
+
* server's canonical rollup. The client never runs the engine and never
|
|
1110
|
+
* falls back to the feed, build values or events. Rollups have no released
|
|
1111
|
+
* projection catalog, so a version other than this client's, an absent
|
|
1112
|
+
* route (an older server) or a value outside the rollup's schema is a typed
|
|
1113
|
+
* `ReducerValueIncompatibilityError`. */
|
|
1114
|
+
private async getRollupValue(
|
|
1115
|
+
scope: RollupScope,
|
|
1116
|
+
request: ReducerValueRequest,
|
|
1117
|
+
): Promise<ReducerValue> {
|
|
1118
|
+
const parsed = reducerValueRequestSchema.parse(request)
|
|
1119
|
+
const def = rollupEntry(parsed.reducer)
|
|
1120
|
+
// Reject invalid arguments before the network.
|
|
1121
|
+
def.args.parse(parsed.args ?? {})
|
|
1122
|
+
def.read.parse(parsed.read ?? {})
|
|
1123
|
+
const response = await this.raw('POST', `${this.repoPath(scope.repo)}/rollup-values`, parsed)
|
|
1124
|
+
const fail = (serverVersion: number | undefined, reason: string): never => {
|
|
1125
|
+
throw new ReducerValueIncompatibilityError(
|
|
1126
|
+
parsed.reducer,
|
|
1127
|
+
scope,
|
|
1128
|
+
def.version,
|
|
1129
|
+
serverVersion,
|
|
1130
|
+
reason,
|
|
1131
|
+
)
|
|
1132
|
+
}
|
|
1133
|
+
if (response.status === 404 || response.status === 405)
|
|
1134
|
+
fail(undefined, 'server does not serve rollups')
|
|
1135
|
+
if (response.status === 400) {
|
|
1136
|
+
// The request passed local validation, so a server-side validation
|
|
1137
|
+
// refusal is a capability gap: an older server without this rollup.
|
|
1138
|
+
const refusal = errorBodySchema.safeParse(
|
|
1139
|
+
await response
|
|
1140
|
+
.clone()
|
|
1141
|
+
.json()
|
|
1142
|
+
.catch(() => null),
|
|
1143
|
+
)
|
|
1144
|
+
if (refusal.success && refusal.data.kind === 'validation')
|
|
1145
|
+
fail(undefined, `server does not serve rollup "${parsed.reducer}": ${refusal.data.error}`)
|
|
1146
|
+
}
|
|
1147
|
+
if (!response.ok) throw await this.toError(response)
|
|
1148
|
+
let body: unknown
|
|
1149
|
+
try {
|
|
1150
|
+
body = await response.json()
|
|
1151
|
+
} catch (error) {
|
|
1152
|
+
if (!(error instanceof SyntaxError)) throw error
|
|
1153
|
+
fail(undefined, 'invalid rollup envelope: expected JSON')
|
|
1154
|
+
}
|
|
1155
|
+
const envelope = reducerValueSchema.safeParse(body)
|
|
1156
|
+
if (!envelope.success) fail(undefined, `invalid rollup envelope: ${envelope.error.message}`)
|
|
1157
|
+
const result = envelope.data!
|
|
1158
|
+
if (result.version !== def.version) fail(result.version, 'rollup version differs')
|
|
1159
|
+
const value = def.valueSchema.safeParse(result.value)
|
|
1160
|
+
if (!value.success) fail(result.version, `invalid rollup value: ${value.error.message}`)
|
|
1161
|
+
const identity = response.headers.get(CATALOG_IDENTITY_HEADER)
|
|
1162
|
+
return {
|
|
1163
|
+
version: result.version,
|
|
1164
|
+
cursor: result.cursor,
|
|
1165
|
+
value: result.value,
|
|
1166
|
+
...(identity === null ? {} : { catalogIdentity: identity }),
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1037
1170
|
private snapshotPath(scope: SnapshotScope, reducer: string): string {
|
|
1038
1171
|
const root = scope.kind === 'build' ? this.buildPath(scope.slug) : this.repoPath(scope.repo)
|
|
1039
1172
|
return `${root}/snapshots/${encodeURIComponent(reducer)}`
|
|
@@ -1083,6 +1216,79 @@ export class RemoteBuildStore implements BuildStore {
|
|
|
1083
1216
|
return this.requestJson('GET', `${this.repoPath(repo)}/builds`, buildRecordListSchema)
|
|
1084
1217
|
}
|
|
1085
1218
|
|
|
1219
|
+
async listBuildsChangedSince(repo: string, position: string): Promise<ChangedBuilds> {
|
|
1220
|
+
parseChangePosition(position)
|
|
1221
|
+
return this.buildFeedRequest(
|
|
1222
|
+
'changedBuilds',
|
|
1223
|
+
repo,
|
|
1224
|
+
'changed-builds',
|
|
1225
|
+
new URLSearchParams({ since: position }),
|
|
1226
|
+
changedBuildsSchema,
|
|
1227
|
+
)
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
async listBuildsPage(repo: string, opts: BuildPageOptions = {}): Promise<BuildPage> {
|
|
1231
|
+
const query = new URLSearchParams({ limit: String(resolveBuildPageLimit(opts.limit)) })
|
|
1232
|
+
const filters = resolveBuildPageFilters(opts)
|
|
1233
|
+
if (opts.cursor !== undefined) {
|
|
1234
|
+
requireBuildPageCursorOrder(decodeBuildPageCursor(opts.cursor), filters)
|
|
1235
|
+
query.set('cursor', opts.cursor)
|
|
1236
|
+
}
|
|
1237
|
+
if (filters.kind !== undefined) query.set('kind', filters.kind)
|
|
1238
|
+
if (filters.outcome !== undefined) query.set('outcome', filters.outcome)
|
|
1239
|
+
if (filters.activeSince !== undefined) query.set('activeSince', filters.activeSince)
|
|
1240
|
+
const filtered = hasBuildPageFilters(filters)
|
|
1241
|
+
const page = await this.buildFeedRequest(
|
|
1242
|
+
filtered ? 'buildPageFilters' : 'buildPage',
|
|
1243
|
+
repo,
|
|
1244
|
+
'build-page',
|
|
1245
|
+
query,
|
|
1246
|
+
buildPageSchema,
|
|
1247
|
+
)
|
|
1248
|
+
// An older server ignores the filter parameters and answers an
|
|
1249
|
+
// unfiltered page without the echo. The client never filters that page
|
|
1250
|
+
// itself and never retries without filters.
|
|
1251
|
+
if (filtered && !sameBuildPageFilters(page.filters, filters))
|
|
1252
|
+
throw new BuildFeedUnsupportedError('buildPageFilters')
|
|
1253
|
+
// Rebuilt field by field: a consumer compiling without strictNullChecks
|
|
1254
|
+
// infers zod's `.nullable()` as optional, which `BuildPage` rejects.
|
|
1255
|
+
return { builds: page.builds, next: page.next ?? null }
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
/** One request to an additive feed route. A server on this release line
|
|
1259
|
+
* that lacks the route answers 501, or 404 from its route table (or, for a
|
|
1260
|
+
* journal-less repository, from its existence gate, which the feed routes
|
|
1261
|
+
* sit before): that is `BuildFeedUnsupportedError`, never a fallback to
|
|
1262
|
+
* listing builds or reading events. */
|
|
1263
|
+
private async buildFeedRequest<T>(
|
|
1264
|
+
capability: 'changedBuilds' | 'buildPage' | 'buildPageFilters',
|
|
1265
|
+
repo: string,
|
|
1266
|
+
route: 'changed-builds' | 'build-page',
|
|
1267
|
+
query: URLSearchParams,
|
|
1268
|
+
schema: { parse: (data: unknown) => T },
|
|
1269
|
+
): Promise<T> {
|
|
1270
|
+
const response = await this.raw('GET', `${this.repoPath(repo)}/${route}?${query}`)
|
|
1271
|
+
if (response.ok) return schema.parse(await response.json())
|
|
1272
|
+
const body = errorBodySchema.safeParse(
|
|
1273
|
+
await response
|
|
1274
|
+
.clone()
|
|
1275
|
+
.json()
|
|
1276
|
+
.catch(() => null),
|
|
1277
|
+
)
|
|
1278
|
+
if (
|
|
1279
|
+
body.success &&
|
|
1280
|
+
((response.status === 501 && body.data.kind === 'unsupported-operation') ||
|
|
1281
|
+
(response.status === 404 &&
|
|
1282
|
+
body.data.kind === 'not-found' &&
|
|
1283
|
+
(body.data.error === `no route: GET /repos/:repo/${route}` ||
|
|
1284
|
+
body.data.error ===
|
|
1285
|
+
`no route: GET ${new URL(`${this.base}${this.repoPath(repo)}/${route}`).pathname}` ||
|
|
1286
|
+
body.data.error === `unknown repo "${repo}"`)))
|
|
1287
|
+
)
|
|
1288
|
+
throw new BuildFeedUnsupportedError(capability)
|
|
1289
|
+
throw await this.toError(response)
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1086
1292
|
async getRepoHighWater(repo: string): Promise<number> {
|
|
1087
1293
|
// Additive route beside `state-events`; the store service and client
|
|
1088
1294
|
// retain this additive route throughout the supported client window.
|
|
@@ -157,7 +157,7 @@ export class ReducerValueIncompatibilityError extends Error {
|
|
|
157
157
|
override readonly name = 'ReducerValueIncompatibilityError'
|
|
158
158
|
constructor(
|
|
159
159
|
readonly reducer: string,
|
|
160
|
-
readonly scope: import('../snapshots').
|
|
160
|
+
readonly scope: import('../snapshots').ReducerValueScope,
|
|
161
161
|
readonly clientVersion: number,
|
|
162
162
|
readonly serverVersion: number | undefined,
|
|
163
163
|
readonly reason: string,
|
|
@@ -34,6 +34,16 @@ export type { ReducerSnapshot, SnapshotScope } from '../snapshots'
|
|
|
34
34
|
|
|
35
35
|
export * from './compatibility'
|
|
36
36
|
|
|
37
|
+
// The changed-builds feed and paged build listing: argument parsing the
|
|
38
|
+
// server shares with every adapter, and the client's typed capability error.
|
|
39
|
+
export {
|
|
40
|
+
BuildFeedUnsupportedError,
|
|
41
|
+
BuildFeedValidationError,
|
|
42
|
+
parseBuildPageFilterParams,
|
|
43
|
+
parseBuildPageLimitParam,
|
|
44
|
+
parseChangePosition,
|
|
45
|
+
} from '../build-feed'
|
|
46
|
+
|
|
37
47
|
export { creationBuildSlug, projectBuildSlugBase } from '../../kernel/build-creation'
|
|
38
48
|
|
|
39
49
|
export { delegateCredential } from './credentials'
|
|
@@ -53,6 +63,25 @@ export type {
|
|
|
53
63
|
ReducerValueStorage,
|
|
54
64
|
ValueCacheRow,
|
|
55
65
|
} from '../reducer-values'
|
|
66
|
+
export {
|
|
67
|
+
KeyedMutex,
|
|
68
|
+
ROLLUP_LEASE_MS,
|
|
69
|
+
ROLLUP_LEASE_WAIT_MS,
|
|
70
|
+
ROLLUP_RENEW_BATCH,
|
|
71
|
+
RollupLeaseLostError,
|
|
72
|
+
RollupLeaseTimeoutError,
|
|
73
|
+
readRollupValue,
|
|
74
|
+
resolveRollupValue,
|
|
75
|
+
rollupEntry,
|
|
76
|
+
} from '../rollups'
|
|
77
|
+
export type {
|
|
78
|
+
ResolvedRollup,
|
|
79
|
+
RollupAdvance,
|
|
80
|
+
RollupReads,
|
|
81
|
+
RollupRow,
|
|
82
|
+
RollupStorage,
|
|
83
|
+
} from '../rollups'
|
|
84
|
+
export type { ReducerValueScope, RollupScope } from '../snapshots'
|
|
56
85
|
|
|
57
86
|
export type { BuildDelegationFacts, HarvestDelegationFacts } from '../../kernel/service-facts'
|
|
58
87
|
|
|
@@ -85,3 +114,7 @@ export type { DispatchPlacementFact } from '../../events/repository'
|
|
|
85
114
|
|
|
86
115
|
export { readDispatchPlacement } from '../reduced-reads'
|
|
87
116
|
export * from '../event-reads'
|
|
117
|
+
|
|
118
|
+
// Sizes the dispatcher's agent-context deposits are held to; the hosted
|
|
119
|
+
// service's artifact ceiling must admit both.
|
|
120
|
+
export { AGENT_CONTEXT_CACHE_SLOT_PAYLOAD, AGENT_CONTEXT_MAX_BYTES } from '../agent-context'
|
|
@@ -38,6 +38,7 @@ import { actorSchema } from '../../events/envelope'
|
|
|
38
38
|
import { eventPayloadSchemas, WAIT_TICKET_LIMIT } from '../../events/payloads'
|
|
39
39
|
import { ticketRefSchema } from '../../ontology'
|
|
40
40
|
import type { ArtifactMeta, RepositoryArtifactMeta, SessionArtifactMeta } from '../types'
|
|
41
|
+
import type { ClockSpan } from '../../kernel/optimization-admission'
|
|
41
42
|
|
|
42
43
|
// ── Errors (D6: errors as feedback over the wire) ────────────────────────────
|
|
43
44
|
|
|
@@ -157,11 +158,48 @@ export const repositoryEventEnvelopeWireSchema = z.object({
|
|
|
157
158
|
})
|
|
158
159
|
export const repositoryEventListSchema = z.array(repositoryEventEnvelopeWireSchema)
|
|
159
160
|
|
|
161
|
+
/** `POST repos/:repo/events/conditional`: the repository journal's
|
|
162
|
+
* compare-and-append. `201` carries the envelope, `200 null` a miss. */
|
|
163
|
+
export const conditionalRepoEventBodySchema = z.object({
|
|
164
|
+
expectedSeq: z.number().int().nonnegative(),
|
|
165
|
+
event: eventWriteWireSchema,
|
|
166
|
+
})
|
|
167
|
+
export const conditionalRepoEventResponseSchema = repositoryEventEnvelopeWireSchema.nullable()
|
|
168
|
+
|
|
160
169
|
/** `GET repos/:repo/high-water`: the journal's greatest assigned seq. */
|
|
161
170
|
export const repoChangePositionSchema = z.object({
|
|
162
171
|
position: z.string().regex(/^(0|[1-9][0-9]*)$/),
|
|
163
172
|
})
|
|
164
173
|
|
|
174
|
+
/** `GET repos/:repo/changed-builds?since=P`: builds whose latest change
|
|
175
|
+
* position is after `P`, ascending, with the head read in the same snapshot. */
|
|
176
|
+
export const changedBuildsSchema = z.object({
|
|
177
|
+
position: z.string().regex(/^(0|[1-9][0-9]*)$/),
|
|
178
|
+
builds: z.array(
|
|
179
|
+
z.object({
|
|
180
|
+
slug: z.string(),
|
|
181
|
+
position: z.string().regex(/^(0|[1-9][0-9]*)$/),
|
|
182
|
+
}),
|
|
183
|
+
),
|
|
184
|
+
})
|
|
185
|
+
|
|
186
|
+
/** The normalized filters a server applied to a build page. */
|
|
187
|
+
export const buildPageFiltersSchema = z.object({
|
|
188
|
+
kind: z.enum(['leaf', 'node']).optional(),
|
|
189
|
+
outcome: z.literal('merged').optional(),
|
|
190
|
+
activeSince: z.string().optional(),
|
|
191
|
+
})
|
|
192
|
+
|
|
193
|
+
/** `GET repos/:repo/build-page?limit=N[&cursor=C][&kind=K][&outcome=merged]
|
|
194
|
+
* [&activeSince=T]`: one page, newest first by creation, or by update under
|
|
195
|
+
* `activeSince`. A filtered answer echoes the filters it applied, so a client
|
|
196
|
+
* can tell it from an older server that ignored them. */
|
|
197
|
+
export const buildPageSchema = z.object({
|
|
198
|
+
builds: buildRecordListSchema,
|
|
199
|
+
next: z.string().nullable(),
|
|
200
|
+
filters: buildPageFiltersSchema.optional(),
|
|
201
|
+
})
|
|
202
|
+
|
|
165
203
|
export const repoHighWaterSchema = z.object({ seq: z.number().int().nonnegative() })
|
|
166
204
|
|
|
167
205
|
/** `GET builds|repos/:id/snapshots/:reducer?version=N`: the snapshot or `null`. */
|
|
@@ -315,6 +353,17 @@ export const sessionDepositsResponseSchema = z.object({
|
|
|
315
353
|
// The wire form of `BuildDigest` (store/types.ts). `terminal` is omitted when
|
|
316
354
|
// the build's log carries no terminal fact, per the protocol's omission
|
|
317
355
|
// convention for optional members.
|
|
356
|
+
// A `[start, end]` active-hours span. Not `z.tuple`: a consumer compiling
|
|
357
|
+
// without `strictNullChecks` (a plugin's default tsc) infers its members as
|
|
358
|
+
// optional, which no longer assigns to `ClockSpan`.
|
|
359
|
+
const clockSpanSchema = z.custom<ClockSpan>(
|
|
360
|
+
(value) =>
|
|
361
|
+
Array.isArray(value) &&
|
|
362
|
+
value.length === 2 &&
|
|
363
|
+
value.every((part) => typeof part === 'string' && part.length > 0),
|
|
364
|
+
{ message: 'expected a [start, end] span of two non-empty strings' },
|
|
365
|
+
)
|
|
366
|
+
|
|
318
367
|
export const buildDigestWireSchema = z.object({
|
|
319
368
|
compatibility: z
|
|
320
369
|
.object({
|
|
@@ -350,6 +399,9 @@ export const buildDigestWireSchema = z.object({
|
|
|
350
399
|
readinessChangeSeq: z.number().int().positive().optional(),
|
|
351
400
|
reclaimPending: z.literal(true).optional(),
|
|
352
401
|
executionOpen: z.literal(true).optional(),
|
|
402
|
+
// Additive; an older service omits it, and its clients' optimization
|
|
403
|
+
// activity pass then fails closed with a typed capability error.
|
|
404
|
+
executionFacts: z.number().int().nonnegative().optional(),
|
|
353
405
|
// Additive; an older service omits it, and its clients see no pending
|
|
354
406
|
// rejection until the service deploys. Clients never read node logs instead.
|
|
355
407
|
rejectionsPending: z.literal(true).optional(),
|
|
@@ -378,6 +430,18 @@ export const buildDigestWireSchema = z.object({
|
|
|
378
430
|
emptyProposals: z.number().int().nonnegative(),
|
|
379
431
|
openedAt: z.string().min(1),
|
|
380
432
|
maxHours: z.number().positive().optional(),
|
|
433
|
+
// Additive active-hours clock; an older service omits it, and its
|
|
434
|
+
// clients skip the hours condition of a proposal request, which the
|
|
435
|
+
// build read then confirms.
|
|
436
|
+
clock: z
|
|
437
|
+
.object({
|
|
438
|
+
activeMs: z.number().nonnegative(),
|
|
439
|
+
spans: z.array(clockSpanSchema),
|
|
440
|
+
open: z.array(z.string().min(1)),
|
|
441
|
+
stoppedAt: z.string().min(1).optional(),
|
|
442
|
+
settled: z.literal(true).optional(),
|
|
443
|
+
})
|
|
444
|
+
.optional(),
|
|
381
445
|
proposal: z
|
|
382
446
|
.object({
|
|
383
447
|
request: z.string().min(1),
|
|
@@ -393,6 +457,11 @@ export const buildDigestWireSchema = z.object({
|
|
|
393
457
|
.optional(),
|
|
394
458
|
})
|
|
395
459
|
export const buildDigestListSchema = z.array(buildDigestWireSchema)
|
|
460
|
+
/** `GET /repos/{repo}/open-builds`: the records and digests of the repo's
|
|
461
|
+
* open builds (latest terminal fact is not `build.completed`). */
|
|
462
|
+
export const openBuildListSchema = z.array(
|
|
463
|
+
z.object({ record: buildRecordWireSchema, digest: buildDigestWireSchema }),
|
|
464
|
+
)
|
|
396
465
|
|
|
397
466
|
// ── Artifacts ────────────────────────────────────────────────────────────────
|
|
398
467
|
|
|
@@ -132,5 +132,27 @@
|
|
|
132
132
|
"provenance": {
|
|
133
133
|
"tag": "v1.10.0"
|
|
134
134
|
}
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"version": "1.11.0",
|
|
138
|
+
"publishedAt": "2026-11-25T19:48:15.267Z",
|
|
139
|
+
"protocol": "7",
|
|
140
|
+
"contract": "1.11.0.json",
|
|
141
|
+
"projects": true,
|
|
142
|
+
"catalogIdentity": "8248c708658af58dd6a413223f0afd3ce1d65e1c120c5f35e814c68348208b7f",
|
|
143
|
+
"provenance": {
|
|
144
|
+
"tag": "v1.11.0"
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"version": "1.11.1",
|
|
149
|
+
"publishedAt": "2026-11-25T22:03:27.248Z",
|
|
150
|
+
"protocol": "7",
|
|
151
|
+
"contract": "1.11.1.json",
|
|
152
|
+
"projects": true,
|
|
153
|
+
"catalogIdentity": "6c30d0893e9b12b2f8105fc1918e08ebfe0b67755ee7593b6afc7cb5070b379a",
|
|
154
|
+
"provenance": {
|
|
155
|
+
"tag": "v1.11.1"
|
|
156
|
+
}
|
|
135
157
|
}
|
|
136
158
|
]
|