@standardagents/builder 0.20.0 → 0.20.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/dist/index.js +16 -1
- package/dist/index.js.map +1 -1
- package/dist/plugin.js +16 -1
- package/dist/plugin.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -20128,9 +20128,24 @@ function platformLoginUrl(request, env) {
|
|
|
20128
20128
|
return url.toString();
|
|
20129
20129
|
}
|
|
20130
20130
|
|
|
20131
|
+
function isUiNavigationPath(pathname) {
|
|
20132
|
+
if (!pathname || pathname === '/') return true;
|
|
20133
|
+
if (pathname.startsWith('/api/')) return false;
|
|
20134
|
+
const lastSegment = pathname.split('/').pop() || '';
|
|
20135
|
+
return !lastSegment.includes('.');
|
|
20136
|
+
}
|
|
20137
|
+
|
|
20131
20138
|
function isHtmlNavigationRequest(request) {
|
|
20132
20139
|
if (request.method !== 'GET' && request.method !== 'HEAD') return false;
|
|
20133
|
-
|
|
20140
|
+
const accept = (request.headers.get('Accept') || '').toLowerCase();
|
|
20141
|
+
if (accept.includes('text/html')) return true;
|
|
20142
|
+
|
|
20143
|
+
const fetchDest = (request.headers.get('Sec-Fetch-Dest') || '').toLowerCase();
|
|
20144
|
+
if (fetchDest === 'document') return true;
|
|
20145
|
+
if (fetchDest && fetchDest !== 'empty') return false;
|
|
20146
|
+
|
|
20147
|
+
const pathname = new URL(request.url).pathname || '/';
|
|
20148
|
+
return (accept === '' || accept === '*/*') && isUiNavigationPath(pathname);
|
|
20134
20149
|
}
|
|
20135
20150
|
|
|
20136
20151
|
// CORS headers for API responses
|