@gradial/aci 0.1.51-ssr.2 → 0.1.51-ssr.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Agentic Content Infrastructure SDK
2
2
 
3
- `@gradial/aci` `0.1.51-ssr.2` is a pre-1.0 public-surface reset for the ACI
3
+ `@gradial/aci` `0.1.51-ssr.4` 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.51-ssr.2 zod@^4
11
+ npm install @gradial/aci@0.1.51-ssr.4 zod@^4
12
12
  ```
13
13
 
14
14
  ## Root Import
@@ -78,13 +78,13 @@ host bundles select and serve immutable release artifacts.
78
78
  The first RC scaffold path is Next:
79
79
 
80
80
  ```bash
81
- npx @gradial/aci@0.1.51-ssr.2 init my-site --template next-starter
81
+ npx @gradial/aci@0.1.51-ssr.4 init my-site --template next-starter
82
82
  ```
83
83
 
84
84
  List available templates:
85
85
 
86
86
  ```bash
87
- npx @gradial/aci@0.1.51-ssr.2 init --list
87
+ npx @gradial/aci@0.1.51-ssr.4 init --list
88
88
  ```
89
89
 
90
90
  ## Personalization: The One-Tag Install
@@ -15,11 +15,16 @@ import { ErrorPageMarker } from './error-page-marker.js';
15
15
  export async function resolveErrorPage(kind) {
16
16
  let siteConfig = null;
17
17
  const warnings = [];
18
- try {
19
- siteConfig = await getSiteConfig();
20
- }
21
- catch (error) {
22
- warnings.push(`site config unavailable at the error seat: ${String(error)}`);
18
+ // A deployed SSR release has no local `.aci/compiled` tree. The error
19
+ // seat must remain independent of the renderer that just failed, so serve
20
+ // the shipped default rather than opening FileContentProvider here.
21
+ if (process.env.HOSTING_DELIVERY_MODE !== 'ssr') {
22
+ try {
23
+ siteConfig = await getSiteConfig();
24
+ }
25
+ catch (error) {
26
+ warnings.push(`site config unavailable at the error seat: ${String(error)}`);
27
+ }
23
28
  }
24
29
  const resolved = await resolveErrorPageForSite(kind, siteConfig);
25
30
  return { ...resolved, warnings: [...warnings, ...resolved.warnings], siteConfig };
package/dist/next/page.js CHANGED
@@ -43,18 +43,24 @@ export function createPage(registry, options) {
43
43
  const dynamic = 'force-dynamic';
44
44
  async function generateMetadata({ params }) {
45
45
  const resolved = await resolveRoute(params);
46
- const input = await getRenderInput(resolved.route, resolved.context);
47
- const meta = routeMetadataForContent(input.siteConfig, input.page);
48
- return {
49
- title: meta.title,
50
- description: meta.description,
51
- alternates: meta.canonical ? { canonical: meta.canonical } : undefined,
52
- openGraph: {
46
+ try {
47
+ const input = await getRenderInput(resolved.route, resolved.context);
48
+ const meta = routeMetadataForContent(input.siteConfig, input.page);
49
+ return {
53
50
  title: meta.title,
54
51
  description: meta.description,
55
- siteName: meta.siteName,
56
- },
57
- };
52
+ alternates: meta.canonical ? { canonical: meta.canonical } : undefined,
53
+ openGraph: {
54
+ title: meta.title,
55
+ description: meta.description,
56
+ siteName: meta.siteName,
57
+ },
58
+ };
59
+ }
60
+ catch (error) {
61
+ logRenderFailure('metadata', resolved, error);
62
+ throw error;
63
+ }
58
64
  }
59
65
  async function CatchAllPage({ params }) {
60
66
  const resolved = await resolveRoute(params);
@@ -81,6 +87,7 @@ export function createPage(registry, options) {
81
87
  catch (error) {
82
88
  if (error instanceof PageNotFoundError)
83
89
  notFound();
90
+ logRenderFailure('page', resolved, error);
84
91
  throw error;
85
92
  }
86
93
  }
@@ -95,7 +102,9 @@ export function createPage(registry, options) {
95
102
  */
96
103
  async function resolveRoute(params) {
97
104
  const resolved = await params;
98
- const slug = resolved.slug ?? [];
105
+ const slug = decodePathSegments(resolved.slug ?? []);
106
+ if (!slug)
107
+ return { route: '/' };
99
108
  if (slug.length >= 2 && slug[0] === '__r') {
100
109
  const releaseId = slug[1];
101
110
  const selected = slug.slice(2);
@@ -129,3 +138,22 @@ function portableReleaseId(value) {
129
138
  function portablePathPart(value) {
130
139
  return value.length > 0 && value !== '.' && value !== '..' && !value.includes('/');
131
140
  }
141
+ function decodePathSegments(segments) {
142
+ try {
143
+ return segments.map((segment) => decodeURIComponent(segment));
144
+ }
145
+ catch {
146
+ return null;
147
+ }
148
+ }
149
+ function logRenderFailure(phase, resolved, error) {
150
+ const detail = error instanceof Error ? error.message : String(error);
151
+ console.error(JSON.stringify({
152
+ message: 'aci.ssr.render_failed',
153
+ phase,
154
+ releaseId: resolved.context?.releaseId,
155
+ pageRef: resolved.context?.pageRef,
156
+ route: resolved.route,
157
+ error: detail.slice(0, 512),
158
+ }));
159
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradial/aci",
3
- "version": "0.1.51-ssr.2",
3
+ "version": "0.1.51-ssr.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/gradial/bare-metal-go.git",
@@ -146,11 +146,11 @@
146
146
  "zod": "^4.0.0"
147
147
  },
148
148
  "optionalDependencies": {
149
- "@gradial/aci-cli-darwin-arm64": "0.1.51-ssr.2",
150
- "@gradial/aci-cli-darwin-x64": "0.1.51-ssr.2",
151
- "@gradial/aci-cli-linux-arm64": "0.1.51-ssr.2",
152
- "@gradial/aci-cli-linux-x64": "0.1.51-ssr.2",
153
- "@gradial/aci-cli-win32-arm64": "0.1.51-ssr.2",
154
- "@gradial/aci-cli-win32-x64": "0.1.51-ssr.2"
149
+ "@gradial/aci-cli-darwin-arm64": "0.1.51-ssr.4",
150
+ "@gradial/aci-cli-darwin-x64": "0.1.51-ssr.4",
151
+ "@gradial/aci-cli-linux-arm64": "0.1.51-ssr.4",
152
+ "@gradial/aci-cli-linux-x64": "0.1.51-ssr.4",
153
+ "@gradial/aci-cli-win32-arm64": "0.1.51-ssr.4",
154
+ "@gradial/aci-cli-win32-x64": "0.1.51-ssr.4"
155
155
  }
156
156
  }