@copilotkit/core 1.71.1 → 1.72.0

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.umd.js CHANGED
@@ -1150,10 +1150,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1150
1150
  * through unchanged.
1151
1151
  */
1152
1152
  async function createSingleRouteResourceRequest(input, init, runtimeUrl) {
1153
- var _init$method, _init$headers;
1154
- const runtime = new URL(runtimeUrl);
1153
+ var _window$location, _init$method, _init$headers;
1154
+ const baseUrl = typeof window !== "undefined" && ((_window$location = window.location) === null || _window$location === void 0 ? void 0 : _window$location.href) ? window.location.href : "http://localhost";
1155
+ const runtime = new URL(runtimeUrl, baseUrl);
1155
1156
  const inputUrl = input instanceof Request ? input.url : input instanceof URL ? input.href : input;
1156
- const target = new URL(inputUrl, runtime);
1157
+ const target = new URL(inputUrl, baseUrl);
1157
1158
  const runtimePath = runtime.pathname.replace(/\/$/, "");
1158
1159
  if (target.origin !== runtime.origin) return null;
1159
1160
  if (!target.pathname.startsWith(`${runtimePath}/`)) return null;