@copilotkit/react-core 2.0.0-rc.43 → 2.0.0-rc.44
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/{MarkdownRendererContext-C2J_lgqF.d.cts → MarkdownRendererContext-QFCldfW_.d.cts} +1 -1
- package/dist/{MarkdownRendererContext-C2J_lgqF.d.cts.map → MarkdownRendererContext-QFCldfW_.d.cts.map} +1 -1
- package/dist/{MarkdownRendererContext-CytkPOAJ.d.mts → MarkdownRendererContext-aK63ZFd-.d.mts} +1 -1
- package/dist/{MarkdownRendererContext-CytkPOAJ.d.mts.map → MarkdownRendererContext-aK63ZFd-.d.mts.map} +1 -1
- package/dist/{MarkdownSurfaces-DytbRzj2.cjs → MarkdownSurfaces-Do948N1P.cjs} +2 -2
- package/dist/{MarkdownSurfaces-DytbRzj2.cjs.map → MarkdownSurfaces-Do948N1P.cjs.map} +1 -1
- package/dist/{MarkdownSurfaces-DlYqJkAE.mjs → MarkdownSurfaces-rtE9wRUP.mjs} +2 -2
- package/dist/{MarkdownSurfaces-DlYqJkAE.mjs.map → MarkdownSurfaces-rtE9wRUP.mjs.map} +1 -1
- package/dist/{ProviderMarkdown-i_i2osOH.cjs → ProviderMarkdown-D0eI0aPo.cjs} +23 -1
- package/dist/ProviderMarkdown-D0eI0aPo.cjs.map +1 -0
- package/dist/{ProviderMarkdown-BZaPDROY.mjs → ProviderMarkdown-epL7F3Vt.mjs} +19 -3
- package/dist/ProviderMarkdown-epL7F3Vt.mjs.map +1 -0
- package/dist/accessibility-BLK-gE0R.mjs.map +1 -1
- package/dist/accessibility-GnodqxkH.cjs.map +1 -1
- package/dist/chat-BZ_bvAkg.d.mts +38 -0
- package/dist/chat-BZ_bvAkg.d.mts.map +1 -0
- package/dist/chat-CpZVyF_t.d.cts +38 -0
- package/dist/chat-CpZVyF_t.d.cts.map +1 -0
- package/dist/generative-ui/map.cjs +26 -0
- package/dist/generative-ui/map.cjs.map +1 -0
- package/dist/generative-ui/map.d.cts +23 -0
- package/dist/generative-ui/map.d.cts.map +1 -0
- package/dist/generative-ui/map.d.mts +23 -0
- package/dist/generative-ui/map.d.mts.map +1 -0
- package/dist/generative-ui/map.mjs +24 -0
- package/dist/generative-ui/map.mjs.map +1 -0
- package/dist/generative-ui/native.d.cts +3 -2
- package/dist/generative-ui/native.d.cts.map +1 -1
- package/dist/generative-ui/native.d.mts +3 -2
- package/dist/generative-ui/native.d.mts.map +1 -1
- package/dist/generative-ui.cjs +2 -2
- package/dist/generative-ui.d.cts +5 -4
- package/dist/generative-ui.d.cts.map +1 -1
- package/dist/generative-ui.d.mts +5 -4
- package/dist/generative-ui.d.mts.map +1 -1
- package/dist/generative-ui.mjs +2 -2
- package/dist/{hooks-DqsOIh8A.d.mts → hooks-D2H3iL0N.d.mts} +2 -2
- package/dist/{hooks-DqsOIh8A.d.mts.map → hooks-D2H3iL0N.d.mts.map} +1 -1
- package/dist/{hooks-2Ur8NQhj.d.cts → hooks-Dy8HeEdr.d.cts} +2 -2
- package/dist/{hooks-2Ur8NQhj.d.cts.map → hooks-Dy8HeEdr.d.cts.map} +1 -1
- package/dist/index.cjs +12 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +4 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +11 -25
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +44 -21
- package/dist/index.umd.js.map +1 -1
- package/dist/{chat-C5XWeO1M.d.mts → runtime-context-B7f4M85q.d.mts} +21 -39
- package/dist/runtime-context-B7f4M85q.d.mts.map +1 -0
- package/dist/{chat-DtHs4alO.d.cts → runtime-context-CIkZS0ap.d.cts} +21 -39
- package/dist/runtime-context-CIkZS0ap.d.cts.map +1 -0
- package/dist/{standard-s8jByRiE.mjs → standard-CSBR4FhM.mjs} +31 -15
- package/dist/standard-CSBR4FhM.mjs.map +1 -0
- package/dist/{standard-CqGTZUZy.cjs → standard-DBjcBGyd.cjs} +31 -15
- package/dist/standard-DBjcBGyd.cjs.map +1 -0
- package/package.json +14 -7
- package/dist/ProviderMarkdown-BZaPDROY.mjs.map +0 -1
- package/dist/ProviderMarkdown-i_i2osOH.cjs.map +0 -1
- package/dist/chat-C5XWeO1M.d.mts.map +0 -1
- package/dist/chat-DtHs4alO.d.cts.map +0 -1
- package/dist/standard-CqGTZUZy.cjs.map +0 -1
- package/dist/standard-s8jByRiE.mjs.map +0 -1
package/dist/index.umd.js
CHANGED
|
@@ -82,8 +82,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
82
82
|
|
|
83
83
|
//#endregion
|
|
84
84
|
//#region src/lib/use-latest-ref.ts
|
|
85
|
-
|
|
86
|
-
/**
|
|
85
|
+
/**
|
|
87
86
|
* A ref that holds the latest `value`, for callbacks that run after render
|
|
88
87
|
* (event handlers, controller callbacks). The ref changes in a layout effect,
|
|
89
88
|
* not during render, so a render that React throws away leaves it alone.
|
|
@@ -95,6 +94,10 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
95
94
|
});
|
|
96
95
|
return ref;
|
|
97
96
|
}
|
|
97
|
+
var useIsomorphicLayoutEffect;
|
|
98
|
+
var init_use_latest_ref = __esmMin((() => {
|
|
99
|
+
useIsomorphicLayoutEffect = typeof window === "undefined" ? react.useEffect : react.useLayoutEffect;
|
|
100
|
+
}));
|
|
98
101
|
|
|
99
102
|
//#endregion
|
|
100
103
|
//#region src/lib/utils.ts
|
|
@@ -759,6 +762,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
759
762
|
|
|
760
763
|
//#endregion
|
|
761
764
|
//#region src/components/chat/CopilotChatInput.tsx
|
|
765
|
+
init_use_latest_ref();
|
|
762
766
|
init_CopilotIcon();
|
|
763
767
|
init_slots();
|
|
764
768
|
init_utils();
|
|
@@ -1373,7 +1377,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
1373
1377
|
|
|
1374
1378
|
//#endregion
|
|
1375
1379
|
//#region package.json
|
|
1376
|
-
var version$1 = "2.0.0-rc.
|
|
1380
|
+
var version$1 = "2.0.0-rc.44";
|
|
1377
1381
|
|
|
1378
1382
|
//#endregion
|
|
1379
1383
|
//#region src/components/CopilotKitInspector.tsx
|
|
@@ -5054,13 +5058,18 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
5054
5058
|
return typeof value === "object" && value !== null && "Map" in value && typeof value.Map === "function";
|
|
5055
5059
|
}
|
|
5056
5060
|
/**
|
|
5057
|
-
*
|
|
5058
|
-
*
|
|
5061
|
+
* Loads maplibre-gl on the client with the `map` loader of the
|
|
5062
|
+
* `generativeUI` config. This module never imports the package itself: a
|
|
5063
|
+
* bundler resolves each dynamic import at build time, so an app without the
|
|
5064
|
+
* optional peer would fail to build. Rejects when the module is not
|
|
5065
|
+
* maplibre-gl.
|
|
5059
5066
|
*/
|
|
5060
|
-
async function loadMapLibre() {
|
|
5061
|
-
const
|
|
5062
|
-
const fromDefault = "default" in
|
|
5063
|
-
|
|
5067
|
+
async function loadMapLibre(loader) {
|
|
5068
|
+
const loaded = await loader();
|
|
5069
|
+
const fromDefault = typeof loaded === "object" && loaded !== null && "default" in loaded ? loaded.default : void 0;
|
|
5070
|
+
if (isMapLibre(fromDefault)) return fromDefault;
|
|
5071
|
+
if (isMapLibre(loaded)) return loaded;
|
|
5072
|
+
throw new Error("The map loader did not give maplibre-gl.");
|
|
5064
5073
|
}
|
|
5065
5074
|
/**
|
|
5066
5075
|
* True when the element is in dark mode: it, or an ancestor, has the `dark`
|
|
@@ -5082,8 +5091,9 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
5082
5091
|
return isDark;
|
|
5083
5092
|
}
|
|
5084
5093
|
/**
|
|
5085
|
-
* A MapLibre map with markers. maplibre-gl loads only in the browser
|
|
5086
|
-
*
|
|
5094
|
+
* A MapLibre map with markers. maplibre-gl loads only in the browser, with
|
|
5095
|
+
* the `map` loader of the `generativeUI` config. Without the loader, when
|
|
5096
|
+
* the load fails, or when WebGL is not there, the component shows a list of
|
|
5087
5097
|
* the places. A click on a place or a marker sets `selected`.
|
|
5088
5098
|
*/
|
|
5089
5099
|
function MapView(props) {
|
|
@@ -5094,16 +5104,24 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
5094
5104
|
const { zoom, route } = props;
|
|
5095
5105
|
const height = props.height ?? 240;
|
|
5096
5106
|
const containerRef = (0, react.useRef)(null);
|
|
5097
|
-
const
|
|
5107
|
+
const runtime = useRequiredGenerativeUIRuntime();
|
|
5108
|
+
const { theme } = runtime;
|
|
5109
|
+
const loaderRef = useLatestRef(runtime.config.map);
|
|
5110
|
+
const hasLoader = runtime.config.map !== void 0;
|
|
5111
|
+
const [status, setStatus] = (0, react.useState)(hasLoader ? "loading" : "fallback");
|
|
5098
5112
|
const setSelectedRef = (0, react.useRef)(props.setSelected);
|
|
5099
5113
|
setSelectedRef.current = props.setSelected;
|
|
5100
|
-
const { theme } = useRequiredGenerativeUIRuntime();
|
|
5101
5114
|
const styleUrl = useIsDark(containerRef) ? theme?.dark?.mapStyle || theme?.mapStyle || DEFAULT_DARK_MAP_STYLE : theme?.mapStyle || DEFAULT_MAP_STYLE;
|
|
5102
5115
|
(0, react.useEffect)(() => {
|
|
5103
5116
|
let isCancelled = false;
|
|
5104
5117
|
let map;
|
|
5105
|
-
|
|
5106
|
-
|
|
5118
|
+
const loader = loaderRef.current;
|
|
5119
|
+
if (!loader) {
|
|
5120
|
+
setStatus("fallback");
|
|
5121
|
+
return;
|
|
5122
|
+
}
|
|
5123
|
+
async function mount(load) {
|
|
5124
|
+
const maplibregl = await loadMapLibre(load);
|
|
5107
5125
|
const container = containerRef.current;
|
|
5108
5126
|
if (isCancelled || !container) return;
|
|
5109
5127
|
const first = markers[0];
|
|
@@ -5164,7 +5182,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
5164
5182
|
});
|
|
5165
5183
|
setStatus("ready");
|
|
5166
5184
|
}
|
|
5167
|
-
mount().catch(() => {
|
|
5185
|
+
mount(loader).catch(() => {
|
|
5168
5186
|
map?.remove();
|
|
5169
5187
|
map = void 0;
|
|
5170
5188
|
if (!isCancelled) setStatus("fallback");
|
|
@@ -5176,6 +5194,8 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
5176
5194
|
} catch {}
|
|
5177
5195
|
};
|
|
5178
5196
|
}, [
|
|
5197
|
+
hasLoader,
|
|
5198
|
+
loaderRef,
|
|
5179
5199
|
markers,
|
|
5180
5200
|
center,
|
|
5181
5201
|
zoom,
|
|
@@ -5263,6 +5283,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
5263
5283
|
var init_Map = __esmMin((() => {
|
|
5264
5284
|
init_runtime_context();
|
|
5265
5285
|
init_Chart();
|
|
5286
|
+
init_use_latest_ref();
|
|
5266
5287
|
init_styles();
|
|
5267
5288
|
DEFAULT_MAP_STYLE = "https://tiles.openfreemap.org/styles/positron";
|
|
5268
5289
|
DEFAULT_DARK_MAP_STYLE = "https://tiles.openfreemap.org/styles/dark";
|
|
@@ -7921,9 +7942,10 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
7921
7942
|
}
|
|
7922
7943
|
/**
|
|
7923
7944
|
* The generative UI config of the provider. That is the `generativeUI` prop
|
|
7924
|
-
* when
|
|
7925
|
-
*
|
|
7926
|
-
*
|
|
7945
|
+
* when it has a `ui`. Otherwise, when the runtime turns generative UI on, it
|
|
7946
|
+
* is the standard UI for the agents of the runtime, once the standard UI has
|
|
7947
|
+
* loaded, with the other options of the prop (such as `map` or `theme`).
|
|
7948
|
+
* `undefined` while generative UI is off, or still loading.
|
|
7927
7949
|
*/
|
|
7928
7950
|
function useStandardUIFallback(generativeUI, runtimeInfo) {
|
|
7929
7951
|
const fallback = (0, _copilotkit_core.ɵresolveGenerativeUIDefault)({
|
|
@@ -7947,11 +7969,12 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
7947
7969
|
};
|
|
7948
7970
|
}, [active, standardUI]);
|
|
7949
7971
|
return (0, react.useMemo)(() => {
|
|
7950
|
-
if (generativeUI) return generativeUI;
|
|
7972
|
+
if (generativeUI?.ui) return generativeUI;
|
|
7951
7973
|
if (!active || !standardUI) return void 0;
|
|
7952
7974
|
return {
|
|
7975
|
+
...generativeUI,
|
|
7953
7976
|
ui: standardUI,
|
|
7954
|
-
agentIds
|
|
7977
|
+
agentIds: generativeUI?.agentIds ?? agentIds
|
|
7955
7978
|
};
|
|
7956
7979
|
}, [
|
|
7957
7980
|
generativeUI,
|