@gradial/aci 0.1.52 → 0.1.53-canary.693

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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ ### Changed
6
+
7
+ - Immutable code builds (`ACI_CODE_ARTIFACT_BUILD=1`) no longer read or compile
8
+ authored error-page content. Native client error seats use the shipped
9
+ default; publish resolves authored CDN error pages independently. Error
10
+ analytics policy is emitted as a separate code-owned instrumentation artifact
11
+ at the existing `.aci/compiled/error-pages/instrumentation.json` path so
12
+ SDK-first upgrades preserve custom analytics on deployed builders.
13
+
3
14
  ## 0.1.52
4
15
 
5
16
  ### Changed
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Agentic Content Infrastructure SDK
2
2
 
3
- `@gradial/aci` `0.1.52` is a pre-1.0 public-surface reset for the ACI
3
+ `@gradial/aci` `0.1.53-canary.693` is a pre-1.0 public-surface reset for the ACI
4
4
  client SDK. Breaking changes from the old `0.1.x` accidental surface are
5
5
  intentional: the root import is framework-neutral, framework runtime behavior is
6
6
  behind explicit subpaths, and the first required customer path is React/Next.
@@ -8,7 +8,7 @@ behind explicit subpaths, and the first required customer path is React/Next.
8
8
  ## Install
9
9
 
10
10
  ```bash
11
- npm install @gradial/aci@0.1.52 zod@^4
11
+ npm install @gradial/aci@0.1.53-canary.693 zod@^4
12
12
  ```
13
13
 
14
14
  ## Root Import
@@ -137,13 +137,13 @@ host bundles select and serve immutable release artifacts.
137
137
  The first RC scaffold path is Next:
138
138
 
139
139
  ```bash
140
- npx @gradial/aci@0.1.52 init my-site --template next-starter
140
+ npx @gradial/aci@0.1.53-canary.693 init my-site --template next-starter
141
141
  ```
142
142
 
143
143
  List available templates:
144
144
 
145
145
  ```bash
146
- npx @gradial/aci@0.1.52 init --list
146
+ npx @gradial/aci@0.1.53-canary.693 init --list
147
147
  ```
148
148
 
149
149
  ## Personalization: The One-Tag Install
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ export function prepareCodeArtifact(root: string | undefined, content: any): Promise<string>;
2
3
  /**
3
4
  * D-15 policy resolution for the 500.html instrumentation tag (page_type
4
5
  * "error"; self-contained inline delivery — this copy is a real static
@@ -17,9 +18,9 @@ export function resolveInstrumentationTag(root: string | undefined, content: any
17
18
  /**
18
19
  * D-16 prepare-phase artifact: serializes BOTH kinds' instrumentation tags
19
20
  * (tenant module when present, SDK default otherwise) into
20
- * error-pages/instrumentation.json under the compiled content root. The
21
- * AWS-lane code capsule packs source/.aci/compiled/**, so the Go publish
22
- * materializer reads this file from the capsule and stamps the kind-matching
21
+ * error-pages/instrumentation.json under the selected transport root. Code
22
+ * builds retain .aci/compiled/error-pages/instrumentation.json so deployed
23
+ * builders retain it and the Go publish materializer stamps the kind-matching
23
24
  * tag into the CDN error artifacts — the tag crosses the JS→Go boundary as
24
25
  * data. Serialization failures (bind/method-shorthand exports, FIND-006)
25
26
  * throw before anything is written.
@@ -3,6 +3,10 @@
3
3
  // specs/features/authorable-error-pages, T3/T11; REQ-10/REQ-11/REQ-14, D-9,
4
4
  // D-16).
5
5
  //
6
+ // ACI_CODE_ARTIFACT_BUILD=1 makes both phases content-independent: prepare
7
+ // serializes only the code-owned policy at its existing .aci/compiled path.
8
+ // Emit uses the shipped default without resolving authored error-page bindings.
9
+ //
6
10
  // Two phases. The Next template wires both around `next build`; the Astro
7
11
  // template runs only `prepare` before `astro build` (its 404/500 seats
8
12
  // render through the framework, but the D-16 instrumentation artifact must
@@ -16,8 +20,8 @@
16
20
  // leaves the shipped default in play (REQ-4, warn posture). Then writes
17
21
  // error-pages/instrumentation.json (both kinds' serialized tags) into
18
22
  // the compiled content root so the tag crosses the JS→Go boundary as
19
- // data: the AWS-lane code capsule packs source/.aci/compiled/** and the
20
- // Go publish materializer stamps the kind-matching tag into the CDN
23
+ // data: builders retain the instrumentation file at its existing capsule
24
+ // path, and the Go publish materializer stamps the kind-matching tag into the CDN
21
25
  // error artifacts (D-16). An unserializable tenant push fails the build
22
26
  // loudly here (delta FIND-006).
23
27
  //
@@ -84,7 +88,18 @@ function hasCompiledContent() {
84
88
  // ---------------------------------------------------------------------------
85
89
  // prepare
86
90
  // ---------------------------------------------------------------------------
91
+ // Retain the deployed transport path for SDK-first upgrades. This file is
92
+ // executable policy, not a compiled page snapshot; do not compile content here.
93
+ export async function prepareCodeArtifact(root = siteRoot, content) {
94
+ return writeInstrumentationArtifact(root, content, path.join(root, '.aci', 'compiled'));
95
+ }
87
96
  async function prepare() {
97
+ if (process.env.ACI_CODE_ARTIFACT_BUILD === '1') {
98
+ // Code artifacts carry executable policy only. The selected content and
99
+ // its error-page bindings belong to preview/publish, never this build.
100
+ await prepareCodeArtifact();
101
+ return;
102
+ }
88
103
  if (hasCompiledContent()) {
89
104
  log(`compiled content present at ${contentRoot}`);
90
105
  }
@@ -292,9 +307,9 @@ async function resolveInstrumentationPush(root = siteRoot) {
292
307
  /**
293
308
  * D-16 prepare-phase artifact: serializes BOTH kinds' instrumentation tags
294
309
  * (tenant module when present, SDK default otherwise) into
295
- * error-pages/instrumentation.json under the compiled content root. The
296
- * AWS-lane code capsule packs source/.aci/compiled/**, so the Go publish
297
- * materializer reads this file from the capsule and stamps the kind-matching
310
+ * error-pages/instrumentation.json under the selected transport root. Code
311
+ * builds retain .aci/compiled/error-pages/instrumentation.json so deployed
312
+ * builders retain it and the Go publish materializer stamps the kind-matching
298
313
  * tag into the CDN error artifacts — the tag crosses the JS→Go boundary as
299
314
  * data. Serialization failures (bind/method-shorthand exports, FIND-006)
300
315
  * throw before anything is written.
@@ -353,7 +368,9 @@ async function emit() {
353
368
  log('public/500.html already provided by the site; leaving it untouched (skip-if-present)');
354
369
  return;
355
370
  }
356
- const { route, defaultHtml } = await resolveCatchAllRoute();
371
+ const { route, defaultHtml } = process.env.ACI_CODE_ARTIFACT_BUILD === '1'
372
+ ? { route: null, defaultHtml: (await sdkContent()).defaultErrorPageHtml() }
373
+ : await resolveCatchAllRoute();
357
374
  let instrumentationTag;
358
375
  try {
359
376
  instrumentationTag = await resolveInstrumentationTag();
@@ -3,6 +3,7 @@ import { join, relative } from 'path';
3
3
  import { createRequire } from 'module';
4
4
  import { createContentWatchWebpackPlugin } from './content-watch.js';
5
5
  import { buildErrorSeatPayload } from './error-seat-payload.js';
6
+ import { defaultErrorPageFragmentHtml } from '../content/default-error-page.js';
6
7
  const require = createRequire(import.meta.url);
7
8
  export function withAci(nextConfig = {}, options = {}) {
8
9
  if (process.env.TURBOPACK) {
@@ -20,7 +21,11 @@ export function withAci(nextConfig = {}, options = {}) {
20
21
  // serialization failures warn and serialize the shipped default (REQ-4);
21
22
  // under enforce they fail the build closed, and unknown posture values
22
23
  // fail closed too. Present-but-broken bindings fail closed always (REQ-5).
23
- const errorSeat = buildErrorSeatPayload(undefined, process.env.ACI_ERROR_PAGES_POSTURE);
24
+ // A code artifact is independent of every content snapshot. Authored error
25
+ // bindings are validated when previewing/publishing the selected content.
26
+ const errorSeat = process.env.ACI_CODE_ARTIFACT_BUILD === '1'
27
+ ? { payload: { defaulted: true, defaultHtml: defaultErrorPageFragmentHtml() }, warnings: [], errors: [] }
28
+ : buildErrorSeatPayload(undefined, process.env.ACI_ERROR_PAGES_POSTURE);
24
29
  if (errorSeat.errors.length > 0) {
25
30
  throw new Error(`ACI errorPages bindings are invalid (site.json#errorPages):\n- ${errorSeat.errors.join('\n- ')}`);
26
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradial/aci",
3
- "version": "0.1.52",
3
+ "version": "0.1.53-canary.693",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/gradial/bare-metal-go.git",
@@ -160,11 +160,11 @@
160
160
  "zod": "^4.0.0"
161
161
  },
162
162
  "optionalDependencies": {
163
- "@gradial/aci-cli-darwin-arm64": "0.1.52",
164
- "@gradial/aci-cli-darwin-x64": "0.1.52",
165
- "@gradial/aci-cli-linux-arm64": "0.1.52",
166
- "@gradial/aci-cli-linux-x64": "0.1.52",
167
- "@gradial/aci-cli-win32-arm64": "0.1.52",
168
- "@gradial/aci-cli-win32-x64": "0.1.52"
163
+ "@gradial/aci-cli-darwin-arm64": "0.1.53-canary.693",
164
+ "@gradial/aci-cli-darwin-x64": "0.1.53-canary.693",
165
+ "@gradial/aci-cli-linux-arm64": "0.1.53-canary.693",
166
+ "@gradial/aci-cli-linux-x64": "0.1.53-canary.693",
167
+ "@gradial/aci-cli-win32-arm64": "0.1.53-canary.693",
168
+ "@gradial/aci-cli-win32-x64": "0.1.53-canary.693"
169
169
  }
170
170
  }
@@ -3,6 +3,10 @@
3
3
  // specs/features/authorable-error-pages, T3/T11; REQ-10/REQ-11/REQ-14, D-9,
4
4
  // D-16).
5
5
  //
6
+ // ACI_CODE_ARTIFACT_BUILD=1 makes both phases content-independent: prepare
7
+ // serializes only the code-owned policy at its existing .aci/compiled path.
8
+ // Emit uses the shipped default without resolving authored error-page bindings.
9
+ //
6
10
  // Two phases. The Next template wires both around `next build`; the Astro
7
11
  // template runs only `prepare` before `astro build` (its 404/500 seats
8
12
  // render through the framework, but the D-16 instrumentation artifact must
@@ -16,8 +20,8 @@
16
20
  // leaves the shipped default in play (REQ-4, warn posture). Then writes
17
21
  // error-pages/instrumentation.json (both kinds' serialized tags) into
18
22
  // the compiled content root so the tag crosses the JS→Go boundary as
19
- // data: the AWS-lane code capsule packs source/.aci/compiled/** and the
20
- // Go publish materializer stamps the kind-matching tag into the CDN
23
+ // data: builders retain the instrumentation file at its existing capsule
24
+ // path, and the Go publish materializer stamps the kind-matching tag into the CDN
21
25
  // error artifacts (D-16). An unserializable tenant push fails the build
22
26
  // loudly here (delta FIND-006).
23
27
  //
@@ -92,7 +96,19 @@ function hasCompiledContent() {
92
96
  // prepare
93
97
  // ---------------------------------------------------------------------------
94
98
 
99
+ // Retain the deployed transport path for SDK-first upgrades. This file is
100
+ // executable policy, not a compiled page snapshot; do not compile content here.
101
+ export async function prepareCodeArtifact(root = siteRoot, content) {
102
+ return writeInstrumentationArtifact(root, content, path.join(root, '.aci', 'compiled'));
103
+ }
104
+
95
105
  async function prepare() {
106
+ if (process.env.ACI_CODE_ARTIFACT_BUILD === '1') {
107
+ // Code artifacts carry executable policy only. The selected content and
108
+ // its error-page bindings belong to preview/publish, never this build.
109
+ await prepareCodeArtifact();
110
+ return;
111
+ }
96
112
  if (hasCompiledContent()) {
97
113
  log(`compiled content present at ${contentRoot}`);
98
114
  } else {
@@ -308,9 +324,9 @@ async function resolveInstrumentationPush(root = siteRoot) {
308
324
  /**
309
325
  * D-16 prepare-phase artifact: serializes BOTH kinds' instrumentation tags
310
326
  * (tenant module when present, SDK default otherwise) into
311
- * error-pages/instrumentation.json under the compiled content root. The
312
- * AWS-lane code capsule packs source/.aci/compiled/**, so the Go publish
313
- * materializer reads this file from the capsule and stamps the kind-matching
327
+ * error-pages/instrumentation.json under the selected transport root. Code
328
+ * builds retain .aci/compiled/error-pages/instrumentation.json so deployed
329
+ * builders retain it and the Go publish materializer stamps the kind-matching
314
330
  * tag into the CDN error artifacts — the tag crosses the JS→Go boundary as
315
331
  * data. Serialization failures (bind/method-shorthand exports, FIND-006)
316
332
  * throw before anything is written.
@@ -375,7 +391,9 @@ async function emit() {
375
391
  return;
376
392
  }
377
393
 
378
- const { route, defaultHtml } = await resolveCatchAllRoute();
394
+ const { route, defaultHtml } = process.env.ACI_CODE_ARTIFACT_BUILD === '1'
395
+ ? { route: null, defaultHtml: (await sdkContent()).defaultErrorPageHtml() }
396
+ : await resolveCatchAllRoute();
379
397
  let instrumentationTag;
380
398
  try {
381
399
  instrumentationTag = await resolveInstrumentationTag();