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