@copilotkit/core 1.71.0 → 1.71.2

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.mjs CHANGED
@@ -1031,9 +1031,10 @@ async function readResourceBody(input, init, headers, method) {
1031
1031
  * through unchanged.
1032
1032
  */
1033
1033
  async function createSingleRouteResourceRequest(input, init, runtimeUrl) {
1034
- const runtime = new URL(runtimeUrl);
1034
+ const baseUrl = typeof window !== "undefined" && window.location?.href ? window.location.href : "http://localhost";
1035
+ const runtime = new URL(runtimeUrl, baseUrl);
1035
1036
  const inputUrl = input instanceof Request ? input.url : input instanceof URL ? input.href : input;
1036
- const target = new URL(inputUrl, runtime);
1037
+ const target = new URL(inputUrl, baseUrl);
1037
1038
  const runtimePath = runtime.pathname.replace(/\/$/, "");
1038
1039
  if (target.origin !== runtime.origin) return null;
1039
1040
  if (!target.pathname.startsWith(`${runtimePath}/`)) return null;