@agent-native/core 0.48.3 → 0.48.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/dist/cli/skills.js +160 -17
- package/dist/cli/skills.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +10 -19
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/ErrorBoundary.d.ts.map +1 -1
- package/dist/client/ErrorBoundary.js +34 -1
- package/dist/client/ErrorBoundary.js.map +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/route-chunk-recovery.d.ts +17 -0
- package/dist/client/route-chunk-recovery.d.ts.map +1 -1
- package/dist/client/route-chunk-recovery.js +67 -0
- package/dist/client/route-chunk-recovery.js.map +1 -1
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +15 -71
- package/dist/deploy/build.js.map +1 -1
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +8 -5
- package/dist/server/auth.js.map +1 -1
- package/dist/server/onboarding-html.d.ts.map +1 -1
- package/dist/server/onboarding-html.js +12 -11
- package/dist/server/onboarding-html.js.map +1 -1
- package/dist/server/ssr-handler.d.ts.map +1 -1
- package/dist/server/ssr-handler.js +42 -130
- package/dist/server/ssr-handler.js.map +1 -1
- package/package.json +1 -1
package/dist/deploy/build.js
CHANGED
|
@@ -402,45 +402,6 @@ function injectDefaultSocialImageMeta(html, imageUrl) {
|
|
|
402
402
|
return html.slice(0, headCloseIdx) + tags.join("") + html.slice(headCloseIdx);
|
|
403
403
|
}
|
|
404
404
|
|
|
405
|
-
const PRIVATE_NO_STORE = "private, no-store";
|
|
406
|
-
const ANONYMOUS_SESSION_COOKIE_NAMES = new Set(["an_docs_session"]);
|
|
407
|
-
const BETTER_AUTH_SESSION_COOKIE_RE = /\\.session_(?:token|data)$/;
|
|
408
|
-
const EMBED_SESSION_COOKIE = "an_embed_session";
|
|
409
|
-
const AN_COOKIE_NAME = "an_session";
|
|
410
|
-
const BETTER_AUTH_COOKIE_PREFIX = "an";
|
|
411
|
-
|
|
412
|
-
function isAuthenticatedCookieName(name) {
|
|
413
|
-
if (ANONYMOUS_SESSION_COOKIE_NAMES.has(name)) return false;
|
|
414
|
-
const bareName = name.replace(/^__(?:Secure|Host)-/, "");
|
|
415
|
-
return (
|
|
416
|
-
bareName === AN_COOKIE_NAME ||
|
|
417
|
-
bareName === EMBED_SESSION_COOKIE ||
|
|
418
|
-
bareName === "an_session_workspace" ||
|
|
419
|
-
bareName.startsWith("an_session_") ||
|
|
420
|
-
bareName === BETTER_AUTH_COOKIE_PREFIX + ".session_token" ||
|
|
421
|
-
bareName === BETTER_AUTH_COOKIE_PREFIX + ".session_data" ||
|
|
422
|
-
BETTER_AUTH_SESSION_COOKIE_RE.test(bareName)
|
|
423
|
-
);
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
function requestHasAuthSignal(request) {
|
|
427
|
-
const headers = request.headers;
|
|
428
|
-
if (headers.get("authorization")) return true;
|
|
429
|
-
const cookieHeader = headers.get("cookie");
|
|
430
|
-
if (cookieHeader) {
|
|
431
|
-
const hasAuth = cookieHeader
|
|
432
|
-
.split(";")
|
|
433
|
-
.map((c) => c.trim().split("=", 1)[0]?.trim())
|
|
434
|
-
.filter(Boolean)
|
|
435
|
-
.some(isAuthenticatedCookieName);
|
|
436
|
-
if (hasAuth) return true;
|
|
437
|
-
}
|
|
438
|
-
const url = new URL(request.url);
|
|
439
|
-
if (url.searchParams.has("__an_embed_token")) return true;
|
|
440
|
-
if (url.searchParams.has("_session")) return true;
|
|
441
|
-
return false;
|
|
442
|
-
}
|
|
443
|
-
|
|
444
405
|
function isSsrHtmlOrDataResponse(headers, status, pathname) {
|
|
445
406
|
if (status < 200 || status >= 400) return false;
|
|
446
407
|
const contentType = (headers.get("content-type") || "").toLowerCase();
|
|
@@ -449,41 +410,26 @@ function isSsrHtmlOrDataResponse(headers, status, pathname) {
|
|
|
449
410
|
}
|
|
450
411
|
|
|
451
412
|
/**
|
|
452
|
-
* Apply the
|
|
453
|
-
*
|
|
454
|
-
* Anonymous requests get the public stale-while-revalidate default so the
|
|
455
|
-
* CDN can serve shared app-shell HTML and React Router loader data without
|
|
456
|
-
* hammering origin.
|
|
413
|
+
* Apply the SSR cache policy to the response headers.
|
|
457
414
|
*
|
|
458
|
-
*
|
|
459
|
-
*
|
|
460
|
-
*
|
|
415
|
+
* SSR IS A PUBLIC, HARD-CDN-CACHED SHELL — SERVED IDENTICALLY TO EVERYONE.
|
|
416
|
+
* Every SSR HTML / React Router .data response gets the same public
|
|
417
|
+
* stale-while-revalidate policy for ALL visitors, authenticated or not. The SSR
|
|
418
|
+
* output is impersonal (the handler never reads the request's session/cookies),
|
|
419
|
+
* so it is safe to hard-cache one shared copy at the edge. Do NOT reintroduce
|
|
420
|
+
* per-user / cookie-based cache variation here (no private, no no-store, no
|
|
421
|
+
* "authenticated then don't cache" branch) — that makes every logged-in
|
|
422
|
+
* visitor's pages uncacheable. Per-user state is resolved client-side instead.
|
|
461
423
|
*/
|
|
462
|
-
function applyDefaultSsrCacheHeader(headers, status, pathname
|
|
424
|
+
function applyDefaultSsrCacheHeader(headers, status, pathname) {
|
|
463
425
|
if (!isSsrHtmlOrDataResponse(headers, status, pathname)) return;
|
|
464
426
|
|
|
465
|
-
if (hasAuthSignal) {
|
|
466
|
-
// A route that explicitly opts into public caching (e.g. a share page that
|
|
467
|
-
// accepts an optional auth cookie) can signal intent via a "public" directive.
|
|
468
|
-
// Any other route-level or framework-default value (no-cache, private, unset)
|
|
469
|
-
// is overridden with private/no-store so no shared CDN cache stores a
|
|
470
|
-
// potentially personalized response.
|
|
471
|
-
const existingCc = headers.get("cache-control") || "";
|
|
472
|
-
if (!existingCc.includes("public")) {
|
|
473
|
-
headers.set("cache-control", PRIVATE_NO_STORE);
|
|
474
|
-
}
|
|
475
|
-
// Never propagate CDN-specific cache headers on authenticated responses.
|
|
476
|
-
headers.delete("cdn-cache-control");
|
|
477
|
-
headers.delete("netlify-cdn-cache-control");
|
|
478
|
-
return;
|
|
479
|
-
}
|
|
480
|
-
|
|
481
427
|
headers.set("cache-control", DEFAULT_SSR_CACHE_CONTROL);
|
|
482
428
|
headers.set("cdn-cache-control", DEFAULT_SSR_CDN_CACHE_CONTROL);
|
|
483
429
|
// Netlify function responses are dynamic by default and can otherwise show
|
|
484
430
|
// Cache-Status fwd=bypass even with Cache-Control: public. Keep this
|
|
485
431
|
// Netlify-specific header so SSR HTML/.data are served from the shared
|
|
486
|
-
// durable CDN cache instead of stampeding origin
|
|
432
|
+
// durable CDN cache instead of stampeding origin — for every visitor.
|
|
487
433
|
headers.set("netlify-cdn-cache-control", DEFAULT_SSR_NETLIFY_CDN_CACHE_CONTROL);
|
|
488
434
|
}
|
|
489
435
|
|
|
@@ -521,10 +467,10 @@ function applyImmutableAssetCacheHeaders(response, request) {
|
|
|
521
467
|
});
|
|
522
468
|
}
|
|
523
469
|
|
|
524
|
-
async function rewriteMountedResponse(response, basePath, pathname, request
|
|
470
|
+
async function rewriteMountedResponse(response, basePath, pathname, request) {
|
|
525
471
|
const sentryClientConfigScript = getSentryClientConfigScript();
|
|
526
472
|
const headers = new Headers(response.headers);
|
|
527
|
-
applyDefaultSsrCacheHeader(headers, response.status, pathname
|
|
473
|
+
applyDefaultSsrCacheHeader(headers, response.status, pathname);
|
|
528
474
|
applyDefaultSpeculationRulesHeader(headers, response.status, basePath);
|
|
529
475
|
|
|
530
476
|
const location = headers.get("location");
|
|
@@ -645,7 +591,6 @@ ${actionRegistrations.join("\n")}
|
|
|
645
591
|
return new Response(null, { status: 404 });
|
|
646
592
|
}
|
|
647
593
|
const request = requestWithPathname(event.req, p);
|
|
648
|
-
const hasAuthSignal = requestHasAuthSignal(event.req);
|
|
649
594
|
if (event.req.method === "HEAD") {
|
|
650
595
|
const getRequest = requestWithMethod(request, "GET");
|
|
651
596
|
const response = await rrHandler(getRequest);
|
|
@@ -657,11 +602,10 @@ ${actionRegistrations.join("\n")}
|
|
|
657
602
|
}),
|
|
658
603
|
basePath,
|
|
659
604
|
p,
|
|
660
|
-
getRequest
|
|
661
|
-
hasAuthSignal
|
|
605
|
+
getRequest
|
|
662
606
|
);
|
|
663
607
|
}
|
|
664
|
-
return rewriteMountedResponse(await rrHandler(request), basePath, p, request
|
|
608
|
+
return rewriteMountedResponse(await rrHandler(request), basePath, p, request);
|
|
665
609
|
}));
|
|
666
610
|
|
|
667
611
|
_handler = app.fetch.bind(app);
|