@aui.io/apollo 0.1.69 → 0.1.71

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 (23) hide show
  1. package/node_modules/@aui.io/apollo-cli/dist/src/commands/bundles.d.ts +12 -0
  2. package/node_modules/@aui.io/apollo-cli/dist/src/commands/bundles.js +75 -8
  3. package/node_modules/@aui.io/apollo-cli/dist/src/commands/bundles.js.map +1 -1
  4. package/node_modules/@aui.io/apollo-cli/dist/src/commands/hierarchy.js +7 -1
  5. package/node_modules/@aui.io/apollo-cli/dist/src/commands/hierarchy.js.map +1 -1
  6. package/node_modules/@aui.io/apollo-cli/package.json +3 -3
  7. package/node_modules/@aui.io/apollo-core/dist/src/api/builder-api.d.ts +105 -2
  8. package/node_modules/@aui.io/apollo-core/dist/src/api/builder-api.js +13 -2
  9. package/node_modules/@aui.io/apollo-core/dist/src/api/builder-api.js.map +1 -1
  10. package/node_modules/@aui.io/apollo-core/dist/src/bundle/build-area.d.ts +14 -2
  11. package/node_modules/@aui.io/apollo-core/dist/src/bundle/build-area.js +19 -2
  12. package/node_modules/@aui.io/apollo-core/dist/src/bundle/build-area.js.map +1 -1
  13. package/node_modules/@aui.io/apollo-core/dist/src/bundle/validate.d.ts +10 -0
  14. package/node_modules/@aui.io/apollo-core/dist/src/bundle/validate.js +26 -0
  15. package/node_modules/@aui.io/apollo-core/dist/src/bundle/validate.js.map +1 -1
  16. package/node_modules/@aui.io/apollo-core/dist/src/services/bundles.d.ts +60 -15
  17. package/node_modules/@aui.io/apollo-core/dist/src/services/bundles.js +141 -18
  18. package/node_modules/@aui.io/apollo-core/dist/src/services/bundles.js.map +1 -1
  19. package/node_modules/@aui.io/apollo-core/dist/src/services/clients.js +11 -3
  20. package/node_modules/@aui.io/apollo-core/dist/src/services/clients.js.map +1 -1
  21. package/node_modules/@aui.io/apollo-core/package.json +1 -1
  22. package/node_modules/@aui.io/apollo-tui/package.json +2 -2
  23. package/package.json +4 -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;kFAC8E;IACvE,UAAU,CAAC,KAAmB,EAAE,cAAsB;QAC3D,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE;YAC5C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,KAAK;YACX,OAAO,EAAE,EAAE,iBAAiB,EAAE,cAAc,EAAE;SAC/C,CAAC,CAAC;IACL,CAAC;IAEM,SAAS,CAAC,OAAe;QAC9B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,qBAAqB,OAAO,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED;;;6DAGyD;IAClD,WAAW,CAAC,OAAe,EAAE,OAAe;QACjD,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CACtB,sBAAsB,kBAAkB,CAAC,OAAO,CAAC,wBAAwB,kBAAkB,CAAC,OAAO,CAAC,EAAE,CACvG,CAAC;IACJ,CAAC;CACF"}
@@ -3,9 +3,21 @@ export interface BuildFiles {
3
3
  /** POSIX path relative to `bundle/build/` → raw bytes. */
4
4
  files: Record<string, Buffer>;
5
5
  }
6
- /** Every file under the area, dotfiles skipped. A missing directory reads
7
- * as an empty area — "no proof material yet" is a normal state. */
6
+ /** `bundle/build/certification.yaml` — WRITTEN by `apollo pull` from the
7
+ * certificate query, never authored, never pushed (build-bundle-schema-design.md
8
+ * §10). The area's read and hash both skip it, so it never reaches the
9
+ * baseline, the dirty check, the diff or a push. */
10
+ export declare const CERTIFICATION_FILE = "certification.yaml";
11
+ /** True for the files the platform writes into the area for the reader's
12
+ * benefit — not proof material, not the author's work. */
13
+ export declare function isWrittenBuildFile(relativePath: string): boolean;
14
+ /** Every file under the area, dotfiles and the platform-written files
15
+ * skipped. A missing directory reads as an empty area — "no proof material
16
+ * yet" is a normal state. */
8
17
  export declare function readBuildFiles(root: string): Promise<BuildFiles>;
18
+ /** Sorted sha256 per file — the baseline's record of the area. A written
19
+ * file is dropped here too, so a snapshot that carries one (a remote
20
+ * bundle from before the rule) never records it either. */
9
21
  export declare function hashBuildFiles(files: Record<string, Buffer>): Record<string, string>;
10
22
  /** Exact sync to the given snapshot: write everything, delete what the
11
23
  * snapshot no longer holds, prune emptied directories. */
@@ -16,6 +16,16 @@
16
16
  import { createHash } from "node:crypto";
17
17
  import { mkdir, readdir, readFile, rmdir, unlink, writeFile } from "node:fs/promises";
18
18
  import path from "node:path";
19
+ /** `bundle/build/certification.yaml` — WRITTEN by `apollo pull` from the
20
+ * certificate query, never authored, never pushed (build-bundle-schema-design.md
21
+ * §10). The area's read and hash both skip it, so it never reaches the
22
+ * baseline, the dirty check, the diff or a push. */
23
+ export const CERTIFICATION_FILE = "certification.yaml";
24
+ /** True for the files the platform writes into the area for the reader's
25
+ * benefit — not proof material, not the author's work. */
26
+ export function isWrittenBuildFile(relativePath) {
27
+ return relativePath === CERTIFICATION_FILE;
28
+ }
19
29
  function safeBuildRel(relativePath) {
20
30
  const normalised = path.posix.normalize(relativePath.replaceAll("\\", "/"));
21
31
  if (path.posix.isAbsolute(normalised) ||
@@ -32,8 +42,9 @@ function resolveInside(root, relativePath) {
32
42
  }
33
43
  return target;
34
44
  }
35
- /** Every file under the area, dotfiles skipped. A missing directory reads
36
- * as an empty area — "no proof material yet" is a normal state. */
45
+ /** Every file under the area, dotfiles and the platform-written files
46
+ * skipped. A missing directory reads as an empty area — "no proof material
47
+ * yet" is a normal state. */
37
48
  export async function readBuildFiles(root) {
38
49
  const absoluteRoot = path.resolve(root);
39
50
  const files = {};
@@ -54,6 +65,8 @@ export async function readBuildFiles(root) {
54
65
  const relativePath = relativeDirectory
55
66
  ? `${relativeDirectory}/${entry.name}`
56
67
  : entry.name;
68
+ if (isWrittenBuildFile(relativePath))
69
+ continue;
57
70
  const absolutePath = path.join(directory, entry.name);
58
71
  if (entry.isDirectory()) {
59
72
  await walk(absolutePath, relativePath);
@@ -66,8 +79,12 @@ export async function readBuildFiles(root) {
66
79
  await walk(absoluteRoot);
67
80
  return { root: absoluteRoot, files };
68
81
  }
82
+ /** Sorted sha256 per file — the baseline's record of the area. A written
83
+ * file is dropped here too, so a snapshot that carries one (a remote
84
+ * bundle from before the rule) never records it either. */
69
85
  export function hashBuildFiles(files) {
70
86
  return Object.fromEntries(Object.entries(files)
87
+ .filter(([relativePath]) => !isWrittenBuildFile(relativePath))
71
88
  .sort(([left], [right]) => left.localeCompare(right))
72
89
  .map(([relativePath, content]) => [
73
90
  relativePath,
@@ -1 +1 @@
1
- {"version":3,"file":"build-area.js","sourceRoot":"","sources":["../../../src/bundle/build-area.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACtF,OAAO,IAAI,MAAM,WAAW,CAAC;AAQ7B,SAAS,YAAY,CAAC,YAAoB;IACxC,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;IAC5E,IACE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC;QACjC,UAAU,KAAK,IAAI;QACnB,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,EAC5B,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,sCAAsC,YAAY,EAAE,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,aAAa,CAAC,IAAY,EAAE,YAAoB;IACvD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC;IAC9D,IAAI,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC;QACh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AAO,GAAG,MAAM,OAAO,CAAC,SAAS,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;QAClE,IAAI,KAAK,GAAG,IAAI,CAAC;QACjB,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;YAC/C,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;gBACxB,IAAI,MAAM,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;oBACtB,MAAM,KAAK,CAAC,KAAK,CAAC,CAAC;oBACnB,SAAS;gBACX,CAAC;gBACD,KAAK,GAAG,KAAK,CAAC;gBACd,SAAS;YACX,CAAC;YACD,KAAK,GAAG,KAAK,CAAC;QAChB,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;AACnB,CAAC"}
@@ -1,3 +1,4 @@
1
+ import type { BundleAudit } from "../api/builder-api.js";
1
2
  export interface ValidationFinding {
2
3
  file: string;
3
4
  path: string;
@@ -38,3 +39,12 @@ export declare function mapRuntimeValidation(response: RuntimeValidateResponse):
38
39
  */
39
40
  export declare function renderValidation(result: ValidationResult): string;
40
41
  export declare function assertValidProgram(result: ValidationResult): ValidationResult;
42
+ /**
43
+ * The build-bundle audit as text — errors, warnings, then advisories, one
44
+ * `✗ [code] file: message` line each, under its own heading, so a reader
45
+ * tells the builder's opinion of the proof material from the engine's
46
+ * opinion of the program. Empty when the audit has nothing to say.
47
+ */
48
+ export declare function renderBundleAudit(audit: BundleAudit | undefined): string[];
49
+ /** Refuse when the audit carries an error: every one refuses a push. */
50
+ export declare function assertPushableBundle(audit: BundleAudit | undefined): void;
@@ -102,4 +102,30 @@ function summarizeReport(name, body) {
102
102
  const compact = JSON.stringify(body);
103
103
  return compact.length > 120 ? `${compact.slice(0, 117)}...` : compact;
104
104
  }
105
+ const EMPTY_AUDIT = { errors: [], warnings: [], advisories: [] };
106
+ /**
107
+ * The build-bundle audit as text — errors, warnings, then advisories, one
108
+ * `✗ [code] file: message` line each, under its own heading, so a reader
109
+ * tells the builder's opinion of the proof material from the engine's
110
+ * opinion of the program. Empty when the audit has nothing to say.
111
+ */
112
+ export function renderBundleAudit(audit) {
113
+ const block = audit ?? EMPTY_AUDIT;
114
+ const line = (f, tag) => `${tag} [${f.code}] ${f.file}: ${f.message}`;
115
+ const lines = [
116
+ ...block.errors.map((f) => line(f, "✗")),
117
+ ...block.warnings.map((f) => line(f, "⚠")),
118
+ ...block.advisories.map((f) => line(f, "·")),
119
+ ];
120
+ return lines.length > 0 ? ["build bundle:", ...lines] : [];
121
+ }
122
+ /** Refuse when the audit carries an error: every one refuses a push. */
123
+ export function assertPushableBundle(audit) {
124
+ if (audit && audit.errors.length > 0) {
125
+ throw new ValidationError([
126
+ "The build bundle cannot ship — fix these before pushing:",
127
+ ...renderBundleAudit({ ...audit, warnings: [], advisories: [] }).slice(1),
128
+ ].join("\n"));
129
+ }
130
+ }
105
131
  //# sourceMappingURL=validate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/bundle/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AA+BrD,MAAM,UAAU,oBAAoB,CAClC,QAAiC;IAEjC,MAAM,QAAQ,GAAwB;QACpC,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YACnC,IAAI,EAAE,EAAE;YACR,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,KAAK,EAAE,OAAgB;SACxB,CAAC,CAAC;QACH,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,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@@ -1,6 +1,6 @@
1
1
  import type { AgentSettingsClient, BuildBundlePushResponse } from "../api/agent-settings.js";
2
2
  import { type AgentVersion, type ManagementClient, type VersionPull, type VersionPush } from "../api/management.js";
3
- import type { BuilderApiClient, EraCensus, OrphanCensus } from "../api/builder-api.js";
3
+ import type { BuilderApiClient, BundleAudit, BundleFix, Certificate, EraCensus, OrphanCensus } from "../api/builder-api.js";
4
4
  import type { RuntimeApiClient } from "../api/runtime-api.js";
5
5
  import { type FileDiff } from "../bundle/baseline.js";
6
6
  import { type ValidationResult } from "../bundle/validate.js";
@@ -12,6 +12,7 @@ export declare function requireAgent(context: Context): string;
12
12
  /** The checkout root the context is bound to (exported for the sibling
13
13
  * services that anchor per-checkout state there, e.g. the advisor thread). */
14
14
  export declare function agentRoot(context: Context): string;
15
+ export declare function bundleSourceRoot(context: Context, root?: string): string;
15
16
  /** What one pull moved in the build area, when the agent has a build bundle. */
16
17
  export interface BuildAreaSync {
17
18
  version: number;
@@ -111,6 +112,12 @@ export interface PullCheckoutResult {
111
112
  removed: string[];
112
113
  /** The build area sync, when the agent has a build bundle. */
113
114
  build?: BuildAreaSync;
115
+ /**
116
+ * The certificate written as `bundle/build/certification.yaml` — the
117
+ * pulled version's family has a completed full regression. Absent when it
118
+ * has none (any stale file was removed) or the query failed (see `note`).
119
+ */
120
+ certificate?: Certificate;
114
121
  /** The engine build every fetch above was routed to, when pinned. */
115
122
  runtimeVersion?: string;
116
123
  skills?: string[];
@@ -139,7 +146,12 @@ export declare function pullCheckout(context: Context, clients: {
139
146
  management: ManagementClient;
140
147
  runtime: RuntimeApiClient;
141
148
  agentSettings: AgentSettingsClient;
149
+ builder: BuilderApiClient;
142
150
  }, options?: PullCheckoutOptions): Promise<PullCheckoutResult>;
151
+ /** `bundle/build/certification.yaml` as text — build-bundle-schema-design.md
152
+ * §10, the wire answer laid out in the schema's order. Epoch `taken_at`
153
+ * becomes the ISO stamp the schema shows. */
154
+ export declare function renderCertification(certificate: Certificate): string;
143
155
  /** Both lanes against the baseline in one report: program paths bare (as
144
156
  * ever), build paths under a `build/` prefix — same dialect as the push
145
157
  * and pull dirty-guard messages. */
@@ -176,6 +188,13 @@ export interface PushCheckoutResult {
176
188
  * (tau-airlines desk, ENGINE-REQUESTS-3, platform item 1).
177
189
  */
178
190
  validationLane?: "runtime" | "builder";
191
+ /**
192
+ * The builder's audit of the proof material (`bundle/build/**`), the push's
193
+ * SECOND check: the engine says whether the program runs, the builder says
194
+ * whether the brief, needs, cases, scenarios and world are present, well
195
+ * formed and consistent. Every error here refused the push; warnings ride.
196
+ */
197
+ bundle?: BundleAudit;
179
198
  }
180
199
  /**
181
200
  * Publish the checkout, both lanes: a changed program becomes a new agent
@@ -189,7 +208,12 @@ export declare function pushBundle(context: Context, clients: {
189
208
  management: ManagementClient;
190
209
  runtime: RuntimeApiClient;
191
210
  agentSettings: AgentSettingsClient;
192
- /** Optional: the fallback gate when the runtime validate lane is dead. */
211
+ /**
212
+ * The builder's audit of the proof material — a push's second check
213
+ * (build-bundle-validation-design.md §3), and the fallback gate when the
214
+ * runtime validate lane is dead. Optional in the type for the callers
215
+ * that never push; a push without it refuses.
216
+ */
193
217
  builder?: BuilderApiClient;
194
218
  }, options?: {
195
219
  root?: string;
@@ -202,29 +226,50 @@ export declare function validateProgramBundle(runtime: RuntimeApiClient, files:
202
226
  agentId?: string): Promise<ValidationResult>;
203
227
  /**
204
228
  * The checkout as builder-api's stateless gates see it: the program under
205
- * `src/**`, and the authored YAML the build tree holds — the scripted suite
206
- * (`scenarios.yaml`), the case bank (`cases.yaml`), the needs and the world
207
- * (`needs.yaml`, `world.yaml`) — under `build/**`. The records ride for the
208
- * reader, not the gates: the advisor ships this identical tree, and advice
209
- * on "why does this regression go red" needs the suite the question is
210
- * about (authoring-modes-design.md F4). Named files, not the whole area — the
211
- * build tree also holds transcripts and binaries that a JSON advice payload
212
- * has no business carrying. A legacy `bundle/src/scenarios.yaml` is NOT
213
- * lifted here — it rides as `src/scenarios.yaml` and the service refuses it
214
- * with the finding that teaches the move (headless-authoring-design.md).
229
+ * `src/**`, and the build records under `build/**` — the brief, the needs,
230
+ * the cases, the scripted suite, the world and the decision log. They ride
231
+ * for the AUDIT (the builder's check of the proof material: presence, shape,
232
+ * every relation) and for the advisor, whose advice on "why does this
233
+ * regression go red" needs the suite the question is about
234
+ * (authoring-modes-design.md F4). Named files, not the whole area — the
235
+ * build tree also holds transcripts and binaries that a JSON payload has no
236
+ * business carrying. A legacy `bundle/src/scenarios.yaml` is NOT lifted
237
+ * here — it rides as `src/scenarios.yaml` and the audit refuses it with the
238
+ * finding that teaches the move (headless-authoring-design.md).
215
239
  */
216
240
  export declare function readCheckoutTree(root: string): Promise<Record<string, string>>;
217
- /** `ValidationResult` plus the two mandatory advisory censuses the builder
218
- * gate returns alongside its verdict — neither moves `valid`. */
241
+ /** `ValidationResult` plus what only the builder's gate returns: the
242
+ * build-bundle audit, the push verdict it decides, and the two mandatory
243
+ * advisory censuses — the censuses never move `valid`. */
219
244
  export interface BundleValidation extends ValidationResult {
245
+ /** No program error and no audit error of any layer — what a push says. */
246
+ pushable: boolean;
247
+ bundle: BundleAudit;
220
248
  orphans: OrphanCensus;
221
249
  eraCensus: EraCensus;
250
+ /** Only when asked with `fix`: the mechanical repairs builder-api planned
251
+ * over a copy of the tree (this checkout writes them), and the verdict
252
+ * after them. */
253
+ fixes?: BundleFix[];
254
+ fixed?: {
255
+ valid: boolean;
256
+ pushable: boolean;
257
+ bundle: BundleAudit;
258
+ };
222
259
  }
223
260
  /** Validation via builder-api's stateless gate. Unlike the push lane
224
261
  * (`validateProgramBundle`, runtime-api, pinned engine), this is the
225
262
  * builder's own opinion of the tree — structure, load, semantics, wiring,
226
263
  * plus the orphan and era censuses. */
227
- export declare function validateLocalBundle(context: Context, builder: BuilderApiClient, root?: string): Promise<BundleValidation>;
264
+ export declare function validateLocalBundle(context: Context, builder: BuilderApiClient, root?: string, options?: {
265
+ fix?: boolean;
266
+ }): Promise<BundleValidation>;
267
+ /**
268
+ * Write builder-api's mechanical repairs onto the checkout: `src/**` paths
269
+ * land under the program root, `build/**` beside it, a null content removes
270
+ * the file. Returns the paths touched, in the plan's order.
271
+ */
272
+ export declare function applyBundleFixes(fixes: BundleFix[], root: string): Promise<string[]>;
228
273
  export declare function listVersions(context: Context, management: ManagementClient): Promise<{
229
274
  results: AgentVersion[];
230
275
  }>;
@@ -1,11 +1,13 @@
1
+ import { mkdir, unlink, writeFile } from "node:fs/promises";
1
2
  import { homedir } from "node:os";
2
3
  import path from "node:path";
4
+ import YAML from "yaml";
3
5
  import { findLiveVersion, } from "../api/management.js";
4
6
  import { diffHashes, diffHashMaps, isClean, readBaseline, writeBaseline, } from "../bundle/baseline.js";
5
- import { hashBuildFiles, readBuildFiles, writeBuildFiles, } from "../bundle/build-area.js";
7
+ import { CERTIFICATION_FILE, hashBuildFiles, readBuildFiles, writeBuildFiles, } from "../bundle/build-area.js";
6
8
  import { hashFiles, readProgramFiles } from "../bundle/files.js";
7
9
  import { assembleBundle, bundleFileLayout, bundleFiles, writeBundleFiles, } from "../bundle/materialize.js";
8
- import { assertValidProgram, mapRuntimeValidation, } from "../bundle/validate.js";
10
+ import { assertPushableBundle, assertValidProgram, mapRuntimeValidation, } from "../bundle/validate.js";
9
11
  import { patchBinding, writeBinding, } from "../config/index.js";
10
12
  import { ApiError, CliError, ConfigError, ValidationError } from "../errors/index.js";
11
13
  import { checkoutSchemasDir, installSchemas } from "../schemas/install.js";
@@ -30,7 +32,7 @@ export function agentRoot(context) {
30
32
  return context.agentRoot ??
31
33
  (context.bindingPath ? path.dirname(context.bindingPath) : process.cwd());
32
34
  }
33
- function bundleSourceRoot(context, root = agentRoot(context)) {
35
+ export function bundleSourceRoot(context, root = agentRoot(context)) {
34
36
  return path.join(root, "bundle", "src");
35
37
  }
36
38
  /** The build area beside a src root — `<checkout>/bundle/build`. Derived
@@ -317,16 +319,84 @@ export async function pullCheckout(context, clients, options = {}) {
317
319
  ...(options.fetch ? { fetch: options.fetch } : {}),
318
320
  force: options.force === true,
319
321
  });
322
+ // The certificate is the platform's reading of the pulled family, written
323
+ // for the reader next to the proof material — never authored, never
324
+ // pushed (the area's read skips it). A failed query is a note, not a
325
+ // failed pull: the bundle is already on disk.
326
+ const certified = await writeCertification(clients.builder, requireAgent(context), bundle.pull.version_tag, buildAreaRoot(bundleSourceRoot(context, root)));
320
327
  const assets = await refreshRuntimeAssets(context, clients.runtime, root, {
321
328
  ...(options.skills !== undefined ? { skills: options.skills } : {}),
322
329
  ...(options.schemas !== undefined ? { schemas: options.schemas } : {}),
323
330
  });
331
+ const notes = [certified.note, assets.note].filter((note) => Boolean(note));
324
332
  return {
325
333
  ...bundle,
334
+ ...(certified.certificate ? { certificate: certified.certificate } : {}),
326
335
  ...(context.runtimeVersion ? { runtimeVersion: context.runtimeVersion } : {}),
327
336
  ...assets,
337
+ ...(notes.length ? { note: notes.join("\n") } : {}),
328
338
  };
329
339
  }
340
+ /** `bundle/build/certification.yaml` as text — build-bundle-schema-design.md
341
+ * §10, the wire answer laid out in the schema's order. Epoch `taken_at`
342
+ * becomes the ISO stamp the schema shows. */
343
+ export function renderCertification(certificate) {
344
+ const takenAt = typeof certificate.taken_at === "number"
345
+ ? new Date(certificate.taken_at * 1000).toISOString().replace(/\.\d{3}Z$/, "Z")
346
+ : certificate.taken_at;
347
+ const body = YAML.stringify({
348
+ certificate: {
349
+ version: certificate.version,
350
+ revision: certificate.revision,
351
+ run: certificate.run,
352
+ src_hash: certificate.src_hash,
353
+ taken_at: takenAt,
354
+ cases: certificate.cases.map((row) => ({
355
+ id: row.id,
356
+ ...(row.need ? { need: row.need } : {}),
357
+ symbolic: row.symbolic,
358
+ neural: row.neural,
359
+ final: row.final,
360
+ last_green: row.last_green,
361
+ })),
362
+ },
363
+ });
364
+ return ("# Written by `apollo pull` from the platform's certificate query — the\n" +
365
+ "# latest completed full regression on this family, per case. Never\n" +
366
+ "# authored, never pushed; the next pull replaces it.\n" +
367
+ body);
368
+ }
369
+ /** Ask for the family's certificate and mirror it into the area: 200
370
+ * writes the file, 404 (`no_certificate`) removes a stale one, anything
371
+ * else leaves the area as it was and reports. */
372
+ async function writeCertification(builder, agentId, version, buildDir) {
373
+ const target = path.join(buildDir, CERTIFICATION_FILE);
374
+ let certificate;
375
+ try {
376
+ certificate = (await builder.certificate(agentId, version)).certificate;
377
+ }
378
+ catch (error) {
379
+ if (error instanceof ApiError && error.status === 404) {
380
+ await removeIfPresent(target);
381
+ return {};
382
+ }
383
+ return {
384
+ note: `Certificate not refreshed (${error instanceof Error ? error.message : String(error)}) — bundle/build/${CERTIFICATION_FILE} is as it was.`,
385
+ };
386
+ }
387
+ await mkdir(buildDir, { recursive: true });
388
+ await writeFile(target, renderCertification(certificate), "utf8");
389
+ return { certificate };
390
+ }
391
+ async function removeIfPresent(target) {
392
+ try {
393
+ await unlink(target);
394
+ }
395
+ catch (error) {
396
+ if (error.code !== "ENOENT")
397
+ throw error;
398
+ }
399
+ }
330
400
  /** Both lanes against the baseline in one report: program paths bare (as
331
401
  * ever), build paths under a `build/` prefix — same dialect as the push
332
402
  * and pull dirty-guard messages. */
@@ -384,6 +454,7 @@ export async function pushBundle(context, clients, options = {}) {
384
454
  // the transport wraps a timeout as CliError code REQUEST_TIMEOUT.
385
455
  let validation;
386
456
  let validationLane = "runtime";
457
+ let audited;
387
458
  try {
388
459
  validation = await validateProgramBundle(clients.runtime, program.files, agentId);
389
460
  }
@@ -395,10 +466,22 @@ export async function pushBundle(context, clients, options = {}) {
395
466
  : error instanceof TypeError;
396
467
  if (!unreachable || !clients.builder)
397
468
  throw error;
398
- validation = await validateLocalBundle(context, clients.builder, root);
469
+ audited = await validateLocalBundle(context, clients.builder, root);
470
+ validation = audited;
399
471
  validationLane = "builder";
400
472
  }
401
473
  assertValidProgram(validation);
474
+ // The push's second check: the builder's audit of the proof material.
475
+ // Two validators, two inputs — the engine never sees `build/**`, and the
476
+ // builder's verdict on the program is not consulted here (the engine's
477
+ // was, above). A push cannot proceed without it: a bundle with no brief,
478
+ // needs or cases does not ship (existence refuses at push).
479
+ if (!clients.builder) {
480
+ throw new ConfigError("push needs builder-api to audit the build bundle — set the builder base URL for this profile.");
481
+ }
482
+ audited ??= await validateLocalBundle(context, clients.builder, root);
483
+ assertPushableBundle(audited.bundle);
484
+ const bundleAudit = audited.bundle;
402
485
  const build = await readBuildFiles(buildAreaRoot(root));
403
486
  const buildHashes = hashBuildFiles(build.files);
404
487
  const baseline = await readBaseline(homeDir, agentId);
@@ -412,6 +495,7 @@ export async function pushBundle(context, clients, options = {}) {
412
495
  diff,
413
496
  buildDiff,
414
497
  validation,
498
+ bundle: bundleAudit,
415
499
  ...pinned,
416
500
  ...(validationLane === "builder" ? { validationLane } : {}),
417
501
  };
@@ -464,6 +548,7 @@ export async function pushBundle(context, clients, options = {}) {
464
548
  ...(push ? { push } : {}),
465
549
  ...(buildPush ? { buildPush } : {}),
466
550
  validation,
551
+ bundle: bundleAudit,
467
552
  ...pinned,
468
553
  ...(validationLane === "builder" ? { validationLane } : {}),
469
554
  };
@@ -476,16 +561,16 @@ agentId) {
476
561
  }
477
562
  /**
478
563
  * The checkout as builder-api's stateless gates see it: the program under
479
- * `src/**`, and the authored YAML the build tree holds — the scripted suite
480
- * (`scenarios.yaml`), the case bank (`cases.yaml`), the needs and the world
481
- * (`needs.yaml`, `world.yaml`) — under `build/**`. The records ride for the
482
- * reader, not the gates: the advisor ships this identical tree, and advice
483
- * on "why does this regression go red" needs the suite the question is
484
- * about (authoring-modes-design.md F4). Named files, not the whole area — the
485
- * build tree also holds transcripts and binaries that a JSON advice payload
486
- * has no business carrying. A legacy `bundle/src/scenarios.yaml` is NOT
487
- * lifted here — it rides as `src/scenarios.yaml` and the service refuses it
488
- * with the finding that teaches the move (headless-authoring-design.md).
564
+ * `src/**`, and the build records under `build/**` — the brief, the needs,
565
+ * the cases, the scripted suite, the world and the decision log. They ride
566
+ * for the AUDIT (the builder's check of the proof material: presence, shape,
567
+ * every relation) and for the advisor, whose advice on "why does this
568
+ * regression go red" needs the suite the question is about
569
+ * (authoring-modes-design.md F4). Named files, not the whole area — the
570
+ * build tree also holds transcripts and binaries that a JSON payload has no
571
+ * business carrying. A legacy `bundle/src/scenarios.yaml` is NOT lifted
572
+ * here — it rides as `src/scenarios.yaml` and the audit refuses it with the
573
+ * finding that teaches the move (headless-authoring-design.md).
489
574
  */
490
575
  export async function readCheckoutTree(root) {
491
576
  const program = await readProgramFiles(root);
@@ -496,7 +581,14 @@ export async function readCheckoutTree(root) {
496
581
  const { readFile } = await import("node:fs/promises");
497
582
  // Wire names are canonical `.yaml`; a `.yml` spelling on disk still ships
498
583
  // (first spelling wins, same file either way).
499
- for (const canonical of ["scenarios.yaml", "cases.yaml", "needs.yaml", "world.yaml"]) {
584
+ for (const canonical of [
585
+ "brief.md",
586
+ "needs.yaml",
587
+ "cases.yaml",
588
+ "scenarios.yaml",
589
+ "world.yaml",
590
+ "decisions.yaml",
591
+ ]) {
500
592
  for (const name of [canonical, canonical.replace(/\.yaml$/, ".yml")]) {
501
593
  try {
502
594
  tree[`build/${canonical}`] = await readFile(path.join(root, "..", "build", name), "utf8");
@@ -514,18 +606,49 @@ export async function readCheckoutTree(root) {
514
606
  * (`validateProgramBundle`, runtime-api, pinned engine), this is the
515
607
  * builder's own opinion of the tree — structure, load, semantics, wiring,
516
608
  * plus the orphan and era censuses. */
517
- export async function validateLocalBundle(context, builder, root = bundleSourceRoot(context)) {
609
+ export async function validateLocalBundle(context, builder, root = bundleSourceRoot(context), options = {}) {
518
610
  // The bound agent's id rides along so the gate counts the agent's VAULT
519
611
  // secret names as resolved — the checkout rightly carries no secrets.yaml,
520
612
  // and without the names every vault-held credential reads unresolved.
521
- const response = await builder.validateTree(await readCheckoutTree(root), context.agentId);
613
+ const response = await builder.validateTree(await readCheckoutTree(root), context.agentId, options);
522
614
  const mapped = mapRuntimeValidation({
523
615
  valid: response.valid,
524
616
  errors: response.errors,
525
617
  warnings: response.warnings,
526
618
  ...(response.program.id ? { program: response.program } : {}),
527
619
  });
528
- return { ...mapped, orphans: response.orphans, eraCensus: response.era_census };
620
+ return {
621
+ ...mapped,
622
+ pushable: response.pushable,
623
+ bundle: response.bundle,
624
+ orphans: response.orphans,
625
+ eraCensus: response.era_census,
626
+ ...(response.fixes ? { fixes: response.fixes } : {}),
627
+ ...(response.fixed ? { fixed: response.fixed } : {}),
628
+ };
629
+ }
630
+ /**
631
+ * Write builder-api's mechanical repairs onto the checkout: `src/**` paths
632
+ * land under the program root, `build/**` beside it, a null content removes
633
+ * the file. Returns the paths touched, in the plan's order.
634
+ */
635
+ export async function applyBundleFixes(fixes, root) {
636
+ const { mkdir, rm, writeFile } = await import("node:fs/promises");
637
+ const touched = [];
638
+ for (const fix of fixes) {
639
+ const target = fix.path.startsWith("build/")
640
+ ? path.join(root, "..", "build", fix.path.slice("build/".length))
641
+ : path.join(root, fix.path.replace(/^src\//, ""));
642
+ if (fix.content === null) {
643
+ await rm(target, { force: true });
644
+ }
645
+ else {
646
+ await mkdir(path.dirname(target), { recursive: true });
647
+ await writeFile(target, fix.content, "utf8");
648
+ }
649
+ touched.push(fix.path);
650
+ }
651
+ return touched;
529
652
  }
530
653
  export async function listVersions(context, management) {
531
654
  return management.listVersions(requireAgent(context));