@copilotkit/react-core 2.0.0-rc.38 → 2.0.0-rc.39
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-BL8ct_3U.d.mts +34 -0
- package/dist/MarkdownRendererContext-BL8ct_3U.d.mts.map +1 -0
- package/dist/MarkdownRendererContext-C2J_lgqF.d.cts +34 -0
- package/dist/MarkdownRendererContext-C2J_lgqF.d.cts.map +1 -0
- package/dist/MarkdownSurfaces-Byz821bg.mjs +324 -0
- package/dist/MarkdownSurfaces-Byz821bg.mjs.map +1 -0
- package/dist/MarkdownSurfaces-D2Ck-cbb.cjs +378 -0
- package/dist/MarkdownSurfaces-D2Ck-cbb.cjs.map +1 -0
- package/dist/{MarkdownSurfaces-BQ1HGCzB.mjs → chat-Bf0vVdo7.mjs} +642 -484
- package/dist/chat-Bf0vVdo7.mjs.map +1 -0
- package/dist/{MarkdownSurfaces-BFoO6wSB.cjs → chat-D3fxo6Ah.cjs} +663 -529
- package/dist/chat-D3fxo6Ah.cjs.map +1 -0
- package/dist/{MarkdownRendererContext-CPfNVyde.d.mts → chat-DgP2N7bD.d.mts} +31 -39
- package/dist/chat-DgP2N7bD.d.mts.map +1 -0
- package/dist/{MarkdownRendererContext-iOl2pj9l.d.cts → chat-DtHs4alO.d.cts} +31 -39
- package/dist/chat-DtHs4alO.d.cts.map +1 -0
- package/dist/generative-ui/native.cjs +66 -0
- package/dist/generative-ui/native.cjs.map +1 -0
- package/dist/generative-ui/native.d.cts +155 -0
- package/dist/generative-ui/native.d.cts.map +1 -0
- package/dist/generative-ui/native.d.mts +155 -0
- package/dist/generative-ui/native.d.mts.map +1 -0
- package/dist/generative-ui/native.mjs +24 -0
- package/dist/generative-ui/native.mjs.map +1 -0
- package/dist/generative-ui.cjs +45 -70
- package/dist/generative-ui.cjs.map +1 -1
- package/dist/generative-ui.d.cts +72 -144
- package/dist/generative-ui.d.cts.map +1 -1
- package/dist/generative-ui.d.mts +72 -144
- package/dist/generative-ui.d.mts.map +1 -1
- package/dist/generative-ui.mjs +4 -29
- package/dist/generative-ui.mjs.map +1 -1
- package/dist/headless.d.cts +58 -153
- package/dist/headless.d.cts.map +1 -1
- package/dist/hooks-2Ur8NQhj.d.cts +84 -0
- package/dist/hooks-2Ur8NQhj.d.cts.map +1 -0
- package/dist/hooks-BRYonCVu.d.mts +84 -0
- package/dist/hooks-BRYonCVu.d.mts.map +1 -0
- package/dist/index.cjs +82 -430
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- 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 +5 -353
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +645 -140
- package/dist/index.umd.js.map +1 -1
- package/dist/refs-BIUfn1wb.cjs +43 -0
- package/dist/refs-BIUfn1wb.cjs.map +1 -0
- package/dist/refs-CMrRm3ta.mjs +31 -0
- package/dist/refs-CMrRm3ta.mjs.map +1 -0
- package/dist/use-generative-ui-root-C12htqbK.cjs +390 -0
- package/dist/use-generative-ui-root-C12htqbK.cjs.map +1 -0
- package/dist/use-generative-ui-root-CVgsDy1f.mjs +385 -0
- package/dist/use-generative-ui-root-CVgsDy1f.mjs.map +1 -0
- package/package.json +14 -10
- package/dist/MarkdownRendererContext-CPfNVyde.d.mts.map +0 -1
- package/dist/MarkdownRendererContext-iOl2pj9l.d.cts.map +0 -1
- package/dist/MarkdownSurfaces-BFoO6wSB.cjs.map +0 -1
- package/dist/MarkdownSurfaces-BQ1HGCzB.mjs.map +0 -1
package/dist/index.umd.js
CHANGED
|
@@ -1358,7 +1358,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
1358
1358
|
|
|
1359
1359
|
//#endregion
|
|
1360
1360
|
//#region package.json
|
|
1361
|
-
var version$1 = "2.0.0-rc.
|
|
1361
|
+
var version$1 = "2.0.0-rc.39";
|
|
1362
1362
|
|
|
1363
1363
|
//#endregion
|
|
1364
1364
|
//#region src/components/CopilotKitInspector.tsx
|
|
@@ -2018,6 +2018,81 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
2018
2018
|
return null;
|
|
2019
2019
|
}
|
|
2020
2020
|
|
|
2021
|
+
//#endregion
|
|
2022
|
+
//#region src/generative-ui/runtime-context.ts
|
|
2023
|
+
const GenerativeUIRuntimeContext = (0, react.createContext)(null);
|
|
2024
|
+
function useGenerativeUIRuntime() {
|
|
2025
|
+
return (0, react.useContext)(GenerativeUIRuntimeContext);
|
|
2026
|
+
}
|
|
2027
|
+
function useRequiredGenerativeUIRuntime() {
|
|
2028
|
+
const runtime = (0, react.useContext)(GenerativeUIRuntimeContext);
|
|
2029
|
+
if (!runtime) throw new Error("Generative UI components must be rendered inside a generative UI provider: <CopilotKitProvider generativeUI={{ ui }}> on the web, or <GenerativeUIProvider> from @copilotkit/react-native/generative-ui on React Native.");
|
|
2030
|
+
return runtime;
|
|
2031
|
+
}
|
|
2032
|
+
const GenerativeUINodeContext = (0, react.createContext)(null);
|
|
2033
|
+
|
|
2034
|
+
//#endregion
|
|
2035
|
+
//#region src/generative-ui/hooks.ts
|
|
2036
|
+
const noopSubscribe$1 = () => () => {};
|
|
2037
|
+
const zero = () => 0;
|
|
2038
|
+
/** Re-renders on any surface-manager change. */
|
|
2039
|
+
function useManagerVersion(runtime) {
|
|
2040
|
+
return (0, react.useSyncExternalStore)(runtime?.manager.subscribe ?? noopSubscribe$1, runtime?.manager.getVersion ?? zero, zero);
|
|
2041
|
+
}
|
|
2042
|
+
|
|
2043
|
+
//#endregion
|
|
2044
|
+
//#region src/generative-ui/activity.ts
|
|
2045
|
+
/**
|
|
2046
|
+
* The rejected operations of a surface (the runtime's first, then the
|
|
2047
|
+
* client's) and the error that goes with them, for a wrapper: a generic
|
|
2048
|
+
* message, with the same list as its `cause`. The `cause` is not enumerable,
|
|
2049
|
+
* so `JSON.stringify`, a spread and error reporters leave the list out.
|
|
2050
|
+
* `clientRejected` is appended to in place by the manager, so its length is
|
|
2051
|
+
* part of the key.
|
|
2052
|
+
*/
|
|
2053
|
+
function useGenerativeUIRejected(serverRejected, clientRejected) {
|
|
2054
|
+
const rejected = (0, react.useMemo)(() => [...serverRejected ?? [], ...clientRejected ?? []], [
|
|
2055
|
+
serverRejected,
|
|
2056
|
+
clientRejected,
|
|
2057
|
+
clientRejected?.length ?? 0
|
|
2058
|
+
]);
|
|
2059
|
+
return {
|
|
2060
|
+
rejected,
|
|
2061
|
+
error: (0, react.useMemo)(() => rejected.length ? (0, _copilotkit_shared_generative_ui.withCause)(/* @__PURE__ */ new Error(`${rejected.length} UI update(s) could not be shown`), rejected) : void 0, [rejected])
|
|
2062
|
+
};
|
|
2063
|
+
}
|
|
2064
|
+
/**
|
|
2065
|
+
* What a renderer of one surface activity message shows: the surface (or the
|
|
2066
|
+
* failed surface whose `createSurface` was rejected), and its rejected
|
|
2067
|
+
* operations with their error (see {@link useGenerativeUIRejected}). It
|
|
2068
|
+
* ingests `content` into the manager (idempotent: the root ingests the
|
|
2069
|
+
* agent's messages too, and this covers an agent the root has not seen yet),
|
|
2070
|
+
* and renders again on every change of the manager.
|
|
2071
|
+
*
|
|
2072
|
+
* `surface` is undefined when there is no runtime, thread or content, when
|
|
2073
|
+
* the surface's target is not `target`, or when the surface does not exist
|
|
2074
|
+
* (the agent deleted it). Both rejected lists cover only the latest
|
|
2075
|
+
* `render_ui` call (see the manager's ingest).
|
|
2076
|
+
*/
|
|
2077
|
+
function useGenerativeUIActivitySurface({ runtime, threadId, agentId, content, target }) {
|
|
2078
|
+
useManagerVersion(runtime);
|
|
2079
|
+
(0, react.useLayoutEffect)(() => {
|
|
2080
|
+
if (runtime && threadId && content) runtime.manager.ingest(threadId, agentId, content);
|
|
2081
|
+
}, [
|
|
2082
|
+
runtime,
|
|
2083
|
+
threadId,
|
|
2084
|
+
agentId,
|
|
2085
|
+
content
|
|
2086
|
+
]);
|
|
2087
|
+
const surface = runtime && threadId && content && content.target === target ? runtime.manager.getSurface(threadId, content.surfaceId) ?? runtime.manager.getFailedSurface(threadId, content.surfaceId) : void 0;
|
|
2088
|
+
const { rejected, error } = useGenerativeUIRejected(content?.rejected, surface?.clientRejected);
|
|
2089
|
+
return {
|
|
2090
|
+
surface,
|
|
2091
|
+
rejected,
|
|
2092
|
+
error
|
|
2093
|
+
};
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2021
2096
|
//#endregion
|
|
2022
2097
|
//#region src/generative-ui/markdown/context.ts
|
|
2023
2098
|
/**
|
|
@@ -2099,9 +2174,38 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
2099
2174
|
//#endregion
|
|
2100
2175
|
//#region src/generative-ui/use-generative-ui-root.ts
|
|
2101
2176
|
const isDevelopment = () => process.env.NODE_ENV !== "production";
|
|
2177
|
+
/**
|
|
2178
|
+
* The malformed-content warnings already printed, by manager, so each
|
|
2179
|
+
* distinct issue warns once while the manager lives.
|
|
2180
|
+
*/
|
|
2181
|
+
const warnedMalformed = /* @__PURE__ */ new WeakMap();
|
|
2182
|
+
/**
|
|
2183
|
+
* Ingests the surface activity messages of `messages`. A message whose
|
|
2184
|
+
* content is malformed (for example `null`) is skipped, in development with a
|
|
2185
|
+
* warning once for each distinct issue, so it cannot throw inside the
|
|
2186
|
+
* agent's run; the messages after it are still ingested.
|
|
2187
|
+
*/
|
|
2102
2188
|
function ingestMessages(manager, agent, messages) {
|
|
2103
|
-
|
|
2104
|
-
|
|
2189
|
+
const { threadId } = agent;
|
|
2190
|
+
if (!threadId) return;
|
|
2191
|
+
for (const message of messages) {
|
|
2192
|
+
if (message.role !== "activity" || message.activityType !== _copilotkit_shared.GENERATIVE_UI_ACTIVITY_TYPE) continue;
|
|
2193
|
+
const parsed = (0, _copilotkit_core_generative_ui.parseGenerativeUISurfaceContent)(message.content);
|
|
2194
|
+
if (parsed.content) {
|
|
2195
|
+
manager.ingest(threadId, agent.agentId, parsed.content);
|
|
2196
|
+
continue;
|
|
2197
|
+
}
|
|
2198
|
+
if (!isDevelopment()) continue;
|
|
2199
|
+
const warning = `[generativeUI] skipped an activity message of thread ${JSON.stringify(threadId)}: its content is malformed: ${parsed.issues.join("; ")}.`;
|
|
2200
|
+
let warned = warnedMalformed.get(manager);
|
|
2201
|
+
if (!warned) {
|
|
2202
|
+
warned = /* @__PURE__ */ new Set();
|
|
2203
|
+
warnedMalformed.set(manager, warned);
|
|
2204
|
+
}
|
|
2205
|
+
if (warned.has(warning)) continue;
|
|
2206
|
+
warned.add(warning);
|
|
2207
|
+
console.warn(warning);
|
|
2208
|
+
}
|
|
2105
2209
|
}
|
|
2106
2210
|
/** Provider-side wiring: manager, dispatcher, agent subscriptions, envelope. */
|
|
2107
2211
|
function useGenerativeUIRoot(copilotkit, config) {
|
|
@@ -2367,29 +2471,35 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
2367
2471
|
}
|
|
2368
2472
|
|
|
2369
2473
|
//#endregion
|
|
2370
|
-
//#region src/generative-ui/
|
|
2371
|
-
const
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2474
|
+
//#region src/generative-ui/host.tsx
|
|
2475
|
+
const DISPLAY_CONTENTS = { display: "contents" };
|
|
2476
|
+
/**
|
|
2477
|
+
* The root element is always there, so a theme change does not remount the
|
|
2478
|
+
* surface. `display: contents` keeps it out of the layout, and the CSS
|
|
2479
|
+
* variables still reach every component of the surface. The `a2ui-surface`
|
|
2480
|
+
* class scopes the standard catalog's surface CSS rules. The theme is a
|
|
2481
|
+
* stylesheet, not an inline style, so that its `dark` values can apply in
|
|
2482
|
+
* dark mode only. The values are checked in `themeStyleSheet`, and the HTML
|
|
2483
|
+
* is set as is, so the server render keeps the quotes of the rule.
|
|
2484
|
+
*/
|
|
2485
|
+
function DomSurfaceRoot({ surfaceId, theme, children }) {
|
|
2486
|
+
const sheet = react.default.useMemo(() => (0, _copilotkit_shared_generative_ui.themeStyleSheet)(theme), [theme]);
|
|
2487
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2488
|
+
className: "a2ui-surface",
|
|
2489
|
+
"data-generative-ui-root": surfaceId,
|
|
2490
|
+
"data-a2ui-theme": sheet?.id,
|
|
2491
|
+
style: DISPLAY_CONTENTS,
|
|
2492
|
+
children: [sheet ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { dangerouslySetInnerHTML: { __html: sheet.css } }) : null, children]
|
|
2493
|
+
});
|
|
2379
2494
|
}
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
function useManagerVersion(runtime) {
|
|
2388
|
-
return (0, react.useSyncExternalStore)(runtime?.manager.subscribe ?? noopSubscribe$1, runtime?.manager.getVersion ?? zero, zero);
|
|
2495
|
+
function DomAccessibilityWrapper({ attributes, children }) {
|
|
2496
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2497
|
+
"data-a2ui-accessibility": "",
|
|
2498
|
+
style: DISPLAY_CONTENTS,
|
|
2499
|
+
...attributes,
|
|
2500
|
+
children
|
|
2501
|
+
});
|
|
2389
2502
|
}
|
|
2390
|
-
|
|
2391
|
-
//#endregion
|
|
2392
|
-
//#region src/generative-ui/boundaries.tsx
|
|
2393
2503
|
function DefaultNodeFallback({ message, componentId, retry }) {
|
|
2394
2504
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2395
2505
|
role: "alert",
|
|
@@ -2417,7 +2527,24 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
2417
2527
|
]
|
|
2418
2528
|
});
|
|
2419
2529
|
}
|
|
2530
|
+
/** The DOM host: what a surface draws on the web. */
|
|
2531
|
+
const domGenerativeUIHost = {
|
|
2532
|
+
SurfaceRoot: DomSurfaceRoot,
|
|
2533
|
+
AccessibilityWrapper: DomAccessibilityWrapper,
|
|
2534
|
+
NodeFallback: DefaultNodeFallback
|
|
2535
|
+
};
|
|
2420
2536
|
/**
|
|
2537
|
+
* The host elements of the surfaces below. Defaults to the DOM host, so a
|
|
2538
|
+
* web app never sets it.
|
|
2539
|
+
*/
|
|
2540
|
+
const GenerativeUIHostContext = (0, react.createContext)(domGenerativeUIHost);
|
|
2541
|
+
function useGenerativeUIHost() {
|
|
2542
|
+
return (0, react.useContext)(GenerativeUIHostContext);
|
|
2543
|
+
}
|
|
2544
|
+
|
|
2545
|
+
//#endregion
|
|
2546
|
+
//#region src/generative-ui/boundaries.tsx
|
|
2547
|
+
/**
|
|
2421
2548
|
* A child that has not streamed yet renders nothing. The prose keeps
|
|
2422
2549
|
* streaming above the surface, and each component appears as soon as it is
|
|
2423
2550
|
* complete. A grey block in its place would read as a broken layout.
|
|
@@ -2425,18 +2552,188 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
2425
2552
|
function NodePlaceholder(_props) {
|
|
2426
2553
|
return null;
|
|
2427
2554
|
}
|
|
2428
|
-
/**
|
|
2429
|
-
|
|
2555
|
+
/**
|
|
2556
|
+
* The error that a fallback threw, told apart from the error of the
|
|
2557
|
+
* component it stood in for. The fallback's own error is the `cause`.
|
|
2558
|
+
*/
|
|
2559
|
+
function fallbackError(error, componentId) {
|
|
2560
|
+
const subject = componentId === void 0 ? "the surface" : componentId;
|
|
2561
|
+
return (0, _copilotkit_shared_generative_ui.withCause)(/* @__PURE__ */ new Error(`The error fallback of ${subject} threw: ${error.message}`), error);
|
|
2562
|
+
}
|
|
2563
|
+
function createFailureLog() {
|
|
2564
|
+
const last = /* @__PURE__ */ new Map();
|
|
2565
|
+
const released = /* @__PURE__ */ new Set();
|
|
2566
|
+
const releasedSinceSettle = /* @__PURE__ */ new Set();
|
|
2567
|
+
const heldBack = /* @__PURE__ */ new Map();
|
|
2568
|
+
return {
|
|
2569
|
+
report(runtime, slot, info, context = "") {
|
|
2570
|
+
released.delete(slot);
|
|
2571
|
+
const signature = [
|
|
2572
|
+
info.kind,
|
|
2573
|
+
info.error.name,
|
|
2574
|
+
info.error.message,
|
|
2575
|
+
context
|
|
2576
|
+
].join("\n");
|
|
2577
|
+
if (last.get(slot) === signature) {
|
|
2578
|
+
if (releasedSinceSettle.has(slot)) heldBack.set(slot, {
|
|
2579
|
+
runtime,
|
|
2580
|
+
info,
|
|
2581
|
+
signature
|
|
2582
|
+
});
|
|
2583
|
+
return;
|
|
2584
|
+
}
|
|
2585
|
+
heldBack.delete(slot);
|
|
2586
|
+
last.set(slot, signature);
|
|
2587
|
+
(0, _copilotkit_core_generative_ui.reportErrorSafely)(runtime, info);
|
|
2588
|
+
},
|
|
2589
|
+
clear(slot) {
|
|
2590
|
+
released.delete(slot);
|
|
2591
|
+
last.delete(slot);
|
|
2592
|
+
heldBack.delete(slot);
|
|
2593
|
+
},
|
|
2594
|
+
retain(slot) {
|
|
2595
|
+
released.delete(slot);
|
|
2596
|
+
},
|
|
2597
|
+
release(slot) {
|
|
2598
|
+
heldBack.delete(slot);
|
|
2599
|
+
if (!last.has(slot)) return;
|
|
2600
|
+
released.add(slot);
|
|
2601
|
+
releasedSinceSettle.add(slot);
|
|
2602
|
+
},
|
|
2603
|
+
settle(missed = false) {
|
|
2604
|
+
for (const slot of missed ? releasedSinceSettle : released) last.delete(slot);
|
|
2605
|
+
if (missed) for (const [slot, { runtime, info, signature }] of heldBack) {
|
|
2606
|
+
if (!releasedSinceSettle.has(slot) || last.has(slot)) continue;
|
|
2607
|
+
last.set(slot, signature);
|
|
2608
|
+
(0, _copilotkit_core_generative_ui.reportErrorSafely)(runtime, info);
|
|
2609
|
+
}
|
|
2610
|
+
heldBack.clear();
|
|
2611
|
+
released.clear();
|
|
2612
|
+
releasedSinceSettle.clear();
|
|
2613
|
+
}
|
|
2614
|
+
};
|
|
2615
|
+
}
|
|
2616
|
+
/** Outside a surface, every failure is reported. */
|
|
2617
|
+
const UNLOGGED = {
|
|
2618
|
+
report: (runtime, _slot, info) => (0, _copilotkit_core_generative_ui.reportErrorSafely)(runtime, info),
|
|
2619
|
+
clear: () => {},
|
|
2620
|
+
retain: () => {},
|
|
2621
|
+
release: () => {},
|
|
2622
|
+
settle: () => {}
|
|
2623
|
+
};
|
|
2624
|
+
/** The failure log of the surface being rendered; set by `SurfaceView`. */
|
|
2625
|
+
const GenerativeUIFailureLogContext = (0, react.createContext)(UNLOGGED);
|
|
2626
|
+
function useFailureLog() {
|
|
2627
|
+
return (0, react.useContext)(GenerativeUIFailureLogContext);
|
|
2628
|
+
}
|
|
2629
|
+
/**
|
|
2630
|
+
* The slots of a failure log, per node place (one rendered copy of a node,
|
|
2631
|
+
* see `placeOf` in SurfaceView) and surface boundary.
|
|
2632
|
+
*/
|
|
2633
|
+
const failureSlots = {
|
|
2634
|
+
node: (place) => `node ${place}`,
|
|
2635
|
+
appFallback: (place) => `app-fallback ${place}`,
|
|
2636
|
+
renderFallback: (place) => `render-fallback ${place}`,
|
|
2637
|
+
fallback: (place) => `fallback ${place}`,
|
|
2638
|
+
cycle: (place) => `cycle ${place}`,
|
|
2639
|
+
props: (place) => `props ${place}`,
|
|
2640
|
+
surface: (level) => `surface ${level}`,
|
|
2641
|
+
surfaceFallback: (level) => `surface-fallback ${level}`
|
|
2642
|
+
};
|
|
2643
|
+
function sameKeys(a, b) {
|
|
2644
|
+
return a.length === b.length && a.every((value, i) => Object.is(value, b[i]));
|
|
2645
|
+
}
|
|
2646
|
+
var FallbackGuard = class extends react.Component {
|
|
2430
2647
|
constructor(..._args) {
|
|
2431
2648
|
super(..._args);
|
|
2649
|
+
_defineProperty(this, "state", {
|
|
2650
|
+
failed: false,
|
|
2651
|
+
resetKeys: this.props.resetKeys
|
|
2652
|
+
});
|
|
2653
|
+
}
|
|
2654
|
+
static getDerivedStateFromError(thrown) {
|
|
2655
|
+
return {
|
|
2656
|
+
failed: true,
|
|
2657
|
+
error: (0, _copilotkit_shared_generative_ui.toError)(thrown)
|
|
2658
|
+
};
|
|
2659
|
+
}
|
|
2660
|
+
static getDerivedStateFromProps(props, state) {
|
|
2661
|
+
return sameKeys(props.resetKeys, state.resetKeys) ? null : {
|
|
2662
|
+
failed: false,
|
|
2663
|
+
error: void 0,
|
|
2664
|
+
resetKeys: props.resetKeys
|
|
2665
|
+
};
|
|
2666
|
+
}
|
|
2667
|
+
report(error) {
|
|
2668
|
+
const { runtime, surfaceId, componentId, log, slot, context } = this.props;
|
|
2669
|
+
log.report(runtime, slot, {
|
|
2670
|
+
kind: "render",
|
|
2671
|
+
surfaceId,
|
|
2672
|
+
...componentId === void 0 ? {} : { componentId },
|
|
2673
|
+
error: fallbackError(error, componentId)
|
|
2674
|
+
}, context);
|
|
2675
|
+
}
|
|
2676
|
+
componentDidCatch(thrown) {
|
|
2677
|
+
this.report(this.state.error ?? (0, _copilotkit_shared_generative_ui.toError)(thrown));
|
|
2678
|
+
}
|
|
2679
|
+
componentDidMount() {
|
|
2680
|
+
if (!this.state.failed) {
|
|
2681
|
+
this.props.log.clear(this.props.slot);
|
|
2682
|
+
return;
|
|
2683
|
+
}
|
|
2684
|
+
if (this.state.error) this.report(this.state.error);
|
|
2685
|
+
}
|
|
2686
|
+
componentDidUpdate() {
|
|
2687
|
+
if (!this.state.failed) this.props.log.clear(this.props.slot);
|
|
2688
|
+
}
|
|
2689
|
+
render() {
|
|
2690
|
+
return this.state.failed ? this.props.replacement ?? null : this.props.children;
|
|
2691
|
+
}
|
|
2692
|
+
};
|
|
2693
|
+
/**
|
|
2694
|
+
* The host's `NodeFallback`, guarded: when it throws, the node renders
|
|
2695
|
+
* nothing and the error is reported, and the parent node keeps rendering.
|
|
2696
|
+
* Every place that shows the host fallback goes through this.
|
|
2697
|
+
*/
|
|
2698
|
+
function GuardedNodeFallback({ surfaceId, componentId, runtime, message, retry, slot, revision }) {
|
|
2699
|
+
const { NodeFallback } = useGenerativeUIHost();
|
|
2700
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FallbackGuard, {
|
|
2701
|
+
surfaceId,
|
|
2702
|
+
componentId,
|
|
2703
|
+
runtime,
|
|
2704
|
+
log: useFailureLog(),
|
|
2705
|
+
slot,
|
|
2706
|
+
context: message,
|
|
2707
|
+
resetKeys: [message, revision],
|
|
2708
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NodeFallback, {
|
|
2709
|
+
message,
|
|
2710
|
+
componentId: componentId ?? "surface",
|
|
2711
|
+
retry
|
|
2712
|
+
})
|
|
2713
|
+
});
|
|
2714
|
+
}
|
|
2715
|
+
/**
|
|
2716
|
+
* Calls the app's `errorBoundary.fallback` in a render of its own, so that
|
|
2717
|
+
* the guard above it catches what it throws.
|
|
2718
|
+
*/
|
|
2719
|
+
function AppErrorFallback({ render, ...props }) {
|
|
2720
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: render(props) });
|
|
2721
|
+
}
|
|
2722
|
+
/**
|
|
2723
|
+
* Per-node boundary. Resets on retry or a new agent revision, not on data
|
|
2724
|
+
* ticks. A failure that stays the same across revisions is reported once.
|
|
2725
|
+
*/
|
|
2726
|
+
var NodeBoundary = class extends react.Component {
|
|
2727
|
+
constructor(..._args2) {
|
|
2728
|
+
super(..._args2);
|
|
2432
2729
|
_defineProperty(this, "state", {
|
|
2433
2730
|
error: null,
|
|
2434
2731
|
revision: this.props.revision
|
|
2435
2732
|
});
|
|
2436
2733
|
_defineProperty(this, "retry", () => this.setState({ error: null }));
|
|
2437
2734
|
}
|
|
2438
|
-
static getDerivedStateFromError(
|
|
2439
|
-
return { error };
|
|
2735
|
+
static getDerivedStateFromError(thrown) {
|
|
2736
|
+
return { error: (0, _copilotkit_shared_generative_ui.toError)(thrown) };
|
|
2440
2737
|
}
|
|
2441
2738
|
static getDerivedStateFromProps(props, state) {
|
|
2442
2739
|
return props.revision !== state.revision ? {
|
|
@@ -2444,53 +2741,138 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
2444
2741
|
revision: props.revision
|
|
2445
2742
|
} : null;
|
|
2446
2743
|
}
|
|
2447
|
-
componentDidCatch(
|
|
2448
|
-
const { runtime, surfaceId, componentId } = this.props;
|
|
2449
|
-
(
|
|
2744
|
+
componentDidCatch(thrown) {
|
|
2745
|
+
const { runtime, surfaceId, componentId, log, place } = this.props;
|
|
2746
|
+
log.clear(failureSlots.fallback(place));
|
|
2747
|
+
log.report(runtime, failureSlots.node(place), {
|
|
2450
2748
|
kind: "render",
|
|
2451
2749
|
surfaceId,
|
|
2452
2750
|
componentId,
|
|
2453
|
-
error
|
|
2751
|
+
error: this.state.error ?? (0, _copilotkit_shared_generative_ui.toError)(thrown)
|
|
2454
2752
|
});
|
|
2455
2753
|
}
|
|
2754
|
+
slots() {
|
|
2755
|
+
const { place } = this.props;
|
|
2756
|
+
return [
|
|
2757
|
+
failureSlots.node(place),
|
|
2758
|
+
failureSlots.appFallback(place),
|
|
2759
|
+
failureSlots.renderFallback(place)
|
|
2760
|
+
];
|
|
2761
|
+
}
|
|
2762
|
+
clearSlots() {
|
|
2763
|
+
for (const slot of this.slots()) this.props.log.clear(slot);
|
|
2764
|
+
}
|
|
2765
|
+
componentDidMount() {
|
|
2766
|
+
for (const slot of this.slots()) this.props.log.retain(slot);
|
|
2767
|
+
if (!this.state.error) {
|
|
2768
|
+
this.clearSlots();
|
|
2769
|
+
return;
|
|
2770
|
+
}
|
|
2771
|
+
const { runtime, surfaceId, componentId, log, place } = this.props;
|
|
2772
|
+
log.report(runtime, failureSlots.node(place), {
|
|
2773
|
+
kind: "render",
|
|
2774
|
+
surfaceId,
|
|
2775
|
+
componentId,
|
|
2776
|
+
error: this.state.error
|
|
2777
|
+
});
|
|
2778
|
+
}
|
|
2779
|
+
componentDidUpdate(prevProps) {
|
|
2780
|
+
if (prevProps.place !== this.props.place) {
|
|
2781
|
+
const { log } = this.props;
|
|
2782
|
+
log.release(failureSlots.node(prevProps.place));
|
|
2783
|
+
log.release(failureSlots.appFallback(prevProps.place));
|
|
2784
|
+
log.release(failureSlots.renderFallback(prevProps.place));
|
|
2785
|
+
for (const slot of this.slots()) log.retain(slot);
|
|
2786
|
+
}
|
|
2787
|
+
if (!this.state.error) this.clearSlots();
|
|
2788
|
+
}
|
|
2789
|
+
componentWillUnmount() {
|
|
2790
|
+
for (const slot of this.slots()) this.props.log.release(slot);
|
|
2791
|
+
}
|
|
2456
2792
|
render() {
|
|
2457
2793
|
const { error } = this.state;
|
|
2458
2794
|
if (!error) return this.props.children;
|
|
2459
|
-
const { runtime, surfaceId, componentId } = this.props;
|
|
2460
|
-
const
|
|
2461
|
-
return fallback ? fallback({
|
|
2462
|
-
error,
|
|
2463
|
-
retry: this.retry,
|
|
2795
|
+
const { runtime, surfaceId, componentId, place, log } = this.props;
|
|
2796
|
+
const hostFallback = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GuardedNodeFallback, {
|
|
2464
2797
|
surfaceId,
|
|
2465
|
-
componentId
|
|
2466
|
-
|
|
2798
|
+
componentId,
|
|
2799
|
+
runtime,
|
|
2467
2800
|
message: error.message,
|
|
2801
|
+
retry: this.retry,
|
|
2802
|
+
slot: failureSlots.renderFallback(place)
|
|
2803
|
+
});
|
|
2804
|
+
const fallback = runtime.errorFallback;
|
|
2805
|
+
if (!fallback) return hostFallback;
|
|
2806
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FallbackGuard, {
|
|
2807
|
+
surfaceId,
|
|
2468
2808
|
componentId,
|
|
2469
|
-
|
|
2809
|
+
runtime,
|
|
2810
|
+
log,
|
|
2811
|
+
slot: failureSlots.appFallback(place),
|
|
2812
|
+
context: error.message,
|
|
2813
|
+
resetKeys: [error],
|
|
2814
|
+
replacement: hostFallback,
|
|
2815
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AppErrorFallback, {
|
|
2816
|
+
render: fallback,
|
|
2817
|
+
error,
|
|
2818
|
+
retry: this.retry,
|
|
2819
|
+
surfaceId,
|
|
2820
|
+
componentId
|
|
2821
|
+
})
|
|
2470
2822
|
});
|
|
2471
2823
|
}
|
|
2472
2824
|
};
|
|
2473
|
-
/**
|
|
2825
|
+
/**
|
|
2826
|
+
* Surface boundary: a failure here must not reach the chat or the host page.
|
|
2827
|
+
* It resets on a new revision, and on Retry when `retryable`. A failure that
|
|
2828
|
+
* stays the same across revisions is reported once.
|
|
2829
|
+
*/
|
|
2474
2830
|
var SurfaceBoundary = class extends react.Component {
|
|
2475
|
-
constructor(...
|
|
2476
|
-
super(...
|
|
2477
|
-
_defineProperty(this, "state", {
|
|
2831
|
+
constructor(..._args3) {
|
|
2832
|
+
super(..._args3);
|
|
2833
|
+
_defineProperty(this, "state", {
|
|
2834
|
+
error: null,
|
|
2835
|
+
revision: this.props.revision
|
|
2836
|
+
});
|
|
2837
|
+
_defineProperty(this, "retry", () => this.setState({ error: null }));
|
|
2478
2838
|
}
|
|
2479
|
-
static getDerivedStateFromError(
|
|
2480
|
-
return { error };
|
|
2839
|
+
static getDerivedStateFromError(thrown) {
|
|
2840
|
+
return { error: (0, _copilotkit_shared_generative_ui.toError)(thrown) };
|
|
2841
|
+
}
|
|
2842
|
+
static getDerivedStateFromProps(props, state) {
|
|
2843
|
+
return props.revision !== state.revision ? {
|
|
2844
|
+
error: null,
|
|
2845
|
+
revision: props.revision
|
|
2846
|
+
} : null;
|
|
2481
2847
|
}
|
|
2482
|
-
componentDidCatch(
|
|
2483
|
-
|
|
2848
|
+
componentDidCatch(thrown) {
|
|
2849
|
+
const { runtime, surfaceId, log, level } = this.props;
|
|
2850
|
+
log.report(runtime, failureSlots.surface(level), {
|
|
2484
2851
|
kind: "render",
|
|
2485
|
-
surfaceId
|
|
2486
|
-
error
|
|
2852
|
+
surfaceId,
|
|
2853
|
+
error: this.state.error ?? (0, _copilotkit_shared_generative_ui.toError)(thrown)
|
|
2487
2854
|
});
|
|
2488
2855
|
}
|
|
2856
|
+
clearSlots() {
|
|
2857
|
+
const { log, level } = this.props;
|
|
2858
|
+
log.clear(failureSlots.surface(level));
|
|
2859
|
+
log.clear(failureSlots.surfaceFallback(level));
|
|
2860
|
+
}
|
|
2861
|
+
componentDidMount() {
|
|
2862
|
+
if (!this.state.error) this.clearSlots();
|
|
2863
|
+
}
|
|
2864
|
+
componentDidUpdate() {
|
|
2865
|
+
if (!this.state.error) this.clearSlots();
|
|
2866
|
+
}
|
|
2489
2867
|
render() {
|
|
2490
2868
|
if (!this.state.error) return this.props.children;
|
|
2491
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
2869
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GuardedNodeFallback, {
|
|
2870
|
+
surfaceId: this.props.surfaceId,
|
|
2871
|
+
componentId: void 0,
|
|
2872
|
+
runtime: this.props.runtime,
|
|
2492
2873
|
message: "this generated UI failed to render",
|
|
2493
|
-
|
|
2874
|
+
retry: this.props.retryable ? this.retry : void 0,
|
|
2875
|
+
slot: failureSlots.surfaceFallback(this.props.level)
|
|
2494
2876
|
});
|
|
2495
2877
|
}
|
|
2496
2878
|
};
|
|
@@ -2498,7 +2880,6 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
2498
2880
|
//#endregion
|
|
2499
2881
|
//#region src/generative-ui/SurfaceView.tsx
|
|
2500
2882
|
const NO_ANCESTORS = [];
|
|
2501
|
-
const ROOT_STYLE = { display: "contents" };
|
|
2502
2883
|
const undefinedSnapshot = () => void 0;
|
|
2503
2884
|
const noopSubscribe = () => () => {};
|
|
2504
2885
|
const zeroSnapshot = () => 0;
|
|
@@ -2508,23 +2889,80 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
2508
2889
|
}
|
|
2509
2890
|
function SurfaceView({ surface }) {
|
|
2510
2891
|
const runtime = useRequiredGenerativeUIRuntime();
|
|
2511
|
-
const {
|
|
2512
|
-
const
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2892
|
+
const { SurfaceRoot } = useGenerativeUIHost();
|
|
2893
|
+
const appliedCount = (0, react.useSyncExternalStore)(runtime.manager.subscribe, () => surface.operations.length, undefinedSnapshot);
|
|
2894
|
+
const revision = (0, react.useMemo)(() => ({
|
|
2895
|
+
surface,
|
|
2896
|
+
appliedCount
|
|
2897
|
+
}), [surface, appliedCount]);
|
|
2898
|
+
const [scopedLog, setScopedLog] = (0, react.useState)(() => ({
|
|
2899
|
+
key: surface.key,
|
|
2900
|
+
log: createFailureLog()
|
|
2901
|
+
}));
|
|
2902
|
+
let failureLog = scopedLog.log;
|
|
2903
|
+
if (scopedLog.key !== surface.key) {
|
|
2904
|
+
const next = {
|
|
2905
|
+
key: surface.key,
|
|
2906
|
+
log: createFailureLog()
|
|
2907
|
+
};
|
|
2908
|
+
setScopedLog(next);
|
|
2909
|
+
failureLog = next.log;
|
|
2910
|
+
}
|
|
2911
|
+
const { threadId, surfaceId } = surface;
|
|
2912
|
+
const { manager } = runtime;
|
|
2913
|
+
const seen = (0, react.useRef)(void 0);
|
|
2914
|
+
(0, react.useLayoutEffect)(() => {
|
|
2915
|
+
const contentOf = () => {
|
|
2916
|
+
const current = manager.getSurface(threadId, surfaceId);
|
|
2917
|
+
return {
|
|
2918
|
+
log: failureLog,
|
|
2919
|
+
current,
|
|
2920
|
+
applied: current?.operations.length
|
|
2921
|
+
};
|
|
2922
|
+
};
|
|
2923
|
+
const observe = (missed) => {
|
|
2924
|
+
const last = seen.current;
|
|
2925
|
+
const next = contentOf();
|
|
2926
|
+
seen.current = next;
|
|
2927
|
+
if (last?.log === failureLog && (next.current !== last.current || next.applied !== last.applied)) failureLog.settle(missed);
|
|
2928
|
+
};
|
|
2929
|
+
observe(true);
|
|
2930
|
+
return manager.subscribe(() => observe(false));
|
|
2931
|
+
}, [
|
|
2932
|
+
manager,
|
|
2933
|
+
threadId,
|
|
2934
|
+
surfaceId,
|
|
2935
|
+
failureLog
|
|
2936
|
+
]);
|
|
2937
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GenerativeUIFailureLogContext.Provider, {
|
|
2938
|
+
value: failureLog,
|
|
2939
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SurfaceBoundary, {
|
|
2519
2940
|
surfaceId: surface.surfaceId,
|
|
2520
2941
|
runtime,
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2942
|
+
log: failureLog,
|
|
2943
|
+
level: "outer",
|
|
2944
|
+
revision,
|
|
2945
|
+
retryable: true,
|
|
2946
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SurfaceRoot, {
|
|
2947
|
+
surfaceId: surface.surfaceId,
|
|
2948
|
+
theme: runtime.theme,
|
|
2949
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SurfaceBoundary, {
|
|
2950
|
+
surfaceId: surface.surfaceId,
|
|
2951
|
+
runtime,
|
|
2952
|
+
log: failureLog,
|
|
2953
|
+
level: "inner",
|
|
2954
|
+
revision,
|
|
2955
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NodeView, {
|
|
2956
|
+
surface,
|
|
2957
|
+
componentId: _copilotkit_shared.GENERATIVE_UI_ROOT_ID,
|
|
2958
|
+
basePath: void 0,
|
|
2959
|
+
ancestors: NO_ANCESTORS,
|
|
2960
|
+
parentPlace: "",
|
|
2961
|
+
via: ""
|
|
2962
|
+
})
|
|
2963
|
+
})
|
|
2526
2964
|
})
|
|
2527
|
-
})
|
|
2965
|
+
})
|
|
2528
2966
|
});
|
|
2529
2967
|
}
|
|
2530
2968
|
/**
|
|
@@ -2549,27 +2987,63 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
2549
2987
|
* repeats both.
|
|
2550
2988
|
*/
|
|
2551
2989
|
function scopedId(componentId, basePath) {
|
|
2552
|
-
return `${basePath
|
|
2990
|
+
return `${basePath === void 0 ? "" : JSON.stringify(basePath)}#${JSON.stringify(componentId)}`;
|
|
2991
|
+
}
|
|
2992
|
+
/**
|
|
2993
|
+
* Where one rendered copy of a node is: the place of its parent, the slot
|
|
2994
|
+
* or child reference of the parent it renders in, and its scoped id. Names
|
|
2995
|
+
* the node's failure-log slots. A scoped id alone is not enough: the same
|
|
2996
|
+
* id can render under two parents, and a cyclic reference repeats the
|
|
2997
|
+
* scoped id of an ancestor. Each copy keeps its own memory of what it
|
|
2998
|
+
* reported, so one copy that renders, goes away or remounts does not clear
|
|
2999
|
+
* the memory of another that still fails.
|
|
3000
|
+
*/
|
|
3001
|
+
function placeOf(parentPlace, via, position) {
|
|
3002
|
+
return `${parentPlace}/${via === "" ? "" : JSON.stringify(via)}${position}`;
|
|
2553
3003
|
}
|
|
2554
|
-
const NodeView = (0, react.memo)(function NodeView({ surface, componentId, basePath, ancestors }) {
|
|
3004
|
+
const NodeView = (0, react.memo)(function NodeView({ surface, componentId, basePath, ancestors, parentPlace, via }) {
|
|
2555
3005
|
const runtime = useRequiredGenerativeUIRuntime();
|
|
3006
|
+
const log = useFailureLog();
|
|
2556
3007
|
const component = useComponentModel(runtime.manager, surface.model, componentId);
|
|
2557
3008
|
const properties = useComponentProperties(runtime.manager, component);
|
|
2558
|
-
|
|
3009
|
+
const position = scopedId(componentId, basePath);
|
|
3010
|
+
const place = placeOf(parentPlace, via, position);
|
|
3011
|
+
(0, react.useEffect)(() => {
|
|
3012
|
+
const slots = [
|
|
3013
|
+
failureSlots.fallback(place),
|
|
3014
|
+
failureSlots.cycle(place),
|
|
3015
|
+
failureSlots.props(place)
|
|
3016
|
+
];
|
|
3017
|
+
for (const slot of slots) log.retain(slot);
|
|
3018
|
+
return () => {
|
|
3019
|
+
for (const slot of slots) log.release(slot);
|
|
3020
|
+
};
|
|
3021
|
+
}, [log, place]);
|
|
3022
|
+
if (ancestors.includes(position)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GuardedNodeFallback, {
|
|
3023
|
+
surfaceId: surface.surfaceId,
|
|
3024
|
+
componentId,
|
|
3025
|
+
runtime,
|
|
2559
3026
|
message: `cyclic reference to ${componentId}`,
|
|
2560
|
-
|
|
3027
|
+
slot: failureSlots.cycle(place),
|
|
3028
|
+
revision: properties
|
|
2561
3029
|
});
|
|
2562
3030
|
if (!component || !properties) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NodePlaceholder, { componentId });
|
|
2563
3031
|
const definition = runtime.ui.components.get(component.type);
|
|
2564
|
-
if (!definition) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
3032
|
+
if (!definition) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GuardedNodeFallback, {
|
|
3033
|
+
surfaceId: surface.surfaceId,
|
|
3034
|
+
componentId,
|
|
3035
|
+
runtime,
|
|
2565
3036
|
message: `unknown component "${component.type}"`,
|
|
2566
|
-
|
|
3037
|
+
slot: failureSlots.fallback(place),
|
|
3038
|
+
revision: properties
|
|
2567
3039
|
});
|
|
2568
3040
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NodeBoundary, {
|
|
2569
3041
|
surfaceId: surface.surfaceId,
|
|
2570
3042
|
componentId,
|
|
3043
|
+
place,
|
|
2571
3044
|
revision: properties,
|
|
2572
3045
|
runtime,
|
|
3046
|
+
log,
|
|
2573
3047
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResolvedNode, {
|
|
2574
3048
|
surface,
|
|
2575
3049
|
componentId,
|
|
@@ -2577,7 +3051,8 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
2577
3051
|
properties,
|
|
2578
3052
|
runtime,
|
|
2579
3053
|
basePath,
|
|
2580
|
-
ancestors
|
|
3054
|
+
ancestors,
|
|
3055
|
+
place
|
|
2581
3056
|
})
|
|
2582
3057
|
}, component.type);
|
|
2583
3058
|
});
|
|
@@ -2585,7 +3060,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
2585
3060
|
* Renders the component of a template once for each item of the list at the
|
|
2586
3061
|
* template path, keyed by index. Renders nothing when there is no list.
|
|
2587
3062
|
*/
|
|
2588
|
-
function TemplateChildren({ surface, template, basePath, ancestors }) {
|
|
3063
|
+
function TemplateChildren({ surface, template, basePath, ancestors, parentPlace, via }) {
|
|
2589
3064
|
const dataModel = surface.model.dataModel;
|
|
2590
3065
|
const listPath = (0, _copilotkit_core_generative_ui.resolvePath)(template.path, basePath);
|
|
2591
3066
|
const subscribe = (0, react.useCallback)((onChange) => {
|
|
@@ -2601,17 +3076,25 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
2601
3076
|
surface,
|
|
2602
3077
|
componentId: template.componentId,
|
|
2603
3078
|
basePath: (0, _copilotkit_core_generative_ui.joinPath)(listPath, String(index)),
|
|
2604
|
-
ancestors
|
|
3079
|
+
ancestors,
|
|
3080
|
+
parentPlace,
|
|
3081
|
+
via
|
|
2605
3082
|
}, index)) });
|
|
2606
3083
|
}
|
|
2607
3084
|
/**
|
|
2608
3085
|
* The props the model sets, with their dynamic values resolved from the
|
|
2609
3086
|
* surface data model: `{"@path"}` bindings, `{"@call"}` function values and
|
|
2610
|
-
* `{"@call":"@index"}` in a template, at any depth.
|
|
2611
|
-
*
|
|
2612
|
-
*
|
|
2613
|
-
*
|
|
2614
|
-
*
|
|
3087
|
+
* `{"@call":"@index"}` in a template, at any depth. Bound props, events and
|
|
3088
|
+
* slots are left out, and so are the keys of the A2UI component envelope;
|
|
3089
|
+
* `accessibility` is resolved the same way and given on its own.
|
|
3090
|
+
*
|
|
3091
|
+
* A writable prop that is not bound to a path and that the component set
|
|
3092
|
+
* shows the local value from `overrides`, also when the model never set the
|
|
3093
|
+
* prop. That is intended: the user's edit wins over the model's literal
|
|
3094
|
+
* value, also over a newer literal the agent sends later, until the node
|
|
3095
|
+
* remounts. A literal is not data the agent and the user share; a prop
|
|
3096
|
+
* that both must write is bound to a path, and the setter writes the data
|
|
3097
|
+
* model.
|
|
2615
3098
|
*
|
|
2616
3099
|
* A prop is resolved again only when its raw value or a data model value it
|
|
2617
3100
|
* read has changed, so the result keeps its identity otherwise. A function
|
|
@@ -2622,7 +3105,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
2622
3105
|
const units = (0, react.useMemo)(() => {
|
|
2623
3106
|
const list = [];
|
|
2624
3107
|
for (const key of Object.keys(properties)) {
|
|
2625
|
-
if (definition.events?.[key] || definition.slots?.[key] ||
|
|
3108
|
+
if (definition.events?.[key] || definition.slots?.[key] || (0, _copilotkit_shared_generative_ui.hasOwnKey)(definition.selectors, key) || _copilotkit_shared.A2UI_COMPONENT_ENVELOPE_KEYS.has(key)) continue;
|
|
2626
3109
|
list.push({
|
|
2627
3110
|
key,
|
|
2628
3111
|
raw: properties[key]
|
|
@@ -2723,9 +3206,10 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
2723
3206
|
for (const [key, selector] of selectors) try {
|
|
2724
3207
|
values[key] = selector(state, modelProps);
|
|
2725
3208
|
} catch (error) {
|
|
3209
|
+
const { message } = (0, _copilotkit_shared_generative_ui.toError)(error);
|
|
2726
3210
|
return {
|
|
2727
3211
|
ok: false,
|
|
2728
|
-
problem: `${key}: selector threw: ${
|
|
3212
|
+
problem: `${key}: selector threw: ${message}`
|
|
2729
3213
|
};
|
|
2730
3214
|
}
|
|
2731
3215
|
return {
|
|
@@ -2736,8 +3220,10 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
2736
3220
|
/**
|
|
2737
3221
|
* The values of the bound props of a node, read from the app state.
|
|
2738
3222
|
*
|
|
2739
|
-
* The selectors
|
|
2740
|
-
*
|
|
3223
|
+
* The selectors get the checked model props: the resolved values that
|
|
3224
|
+
* passed the props schema (without the nulls it rejected), not the
|
|
3225
|
+
* schema's parsed output, so its defaults and transforms are not applied
|
|
3226
|
+
* yet. They run again only when the state object or those props change. When the new values are shallow-equal to the last ones, the
|
|
2741
3227
|
* last snapshot is kept. So the node re-renders only when a selected value
|
|
2742
3228
|
* changes. A selector that returns a new array on each call cannot cause a
|
|
2743
3229
|
* render loop: with the same inputs, the cached snapshot comes back.
|
|
@@ -2767,7 +3253,10 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
2767
3253
|
* Checks the model-set props with the props schema before the selectors run.
|
|
2768
3254
|
* The bound props are not set yet, so their issues do not count. Neither do
|
|
2769
3255
|
* issues with no path (a check over several props), which the full check
|
|
2770
|
-
* after the selectors reports.
|
|
3256
|
+
* after the selectors reports. The exception is the issue that an async
|
|
3257
|
+
* props schema gives (`isAsyncIssue`): the render checks props
|
|
3258
|
+
* synchronously only, so the full check would fail the same way, and it is
|
|
3259
|
+
* reported here.
|
|
2771
3260
|
*/
|
|
2772
3261
|
function checkModelProps(definition, modelData) {
|
|
2773
3262
|
if (!definition.props) return {
|
|
@@ -2786,7 +3275,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
2786
3275
|
if (!result.success) {
|
|
2787
3276
|
const issues = result.issues.filter((issue) => {
|
|
2788
3277
|
const key = (0, _copilotkit_shared_generative_ui.issueKey)(issue);
|
|
2789
|
-
return key === void 0 ? (0, _copilotkit_shared_generative_ui.isAsyncIssue)(issue) : !
|
|
3278
|
+
return key === void 0 ? (0, _copilotkit_shared_generative_ui.isAsyncIssue)(issue) : !(0, _copilotkit_shared_generative_ui.hasOwnKey)(definition.selectors, key);
|
|
2790
3279
|
});
|
|
2791
3280
|
if (issues.length > 0) return {
|
|
2792
3281
|
ok: false,
|
|
@@ -2849,7 +3338,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
2849
3338
|
function useEventProps(runtime, surface, componentId, definition, properties, basePath) {
|
|
2850
3339
|
const latest = (0, react.useRef)(properties);
|
|
2851
3340
|
latest.current = properties;
|
|
2852
|
-
const boundNames = Object.keys(definition.events ?? {}).filter((name) =>
|
|
3341
|
+
const boundNames = Object.keys(definition.events ?? {}).filter((name) => (0, _copilotkit_shared_generative_ui.hasOwnKey)(definition.eventFunctions, name) || (0, _copilotkit_shared.isActionBinding)(properties[name])).join("|");
|
|
2853
3342
|
return (0, react.useMemo)(() => {
|
|
2854
3343
|
const handlers = {};
|
|
2855
3344
|
const names = boundNames ? boundNames.split("|") : [];
|
|
@@ -2861,7 +3350,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
2861
3350
|
name,
|
|
2862
3351
|
parameters: definition.events?.[name]?.parameters
|
|
2863
3352
|
};
|
|
2864
|
-
const functionName =
|
|
3353
|
+
const functionName = (0, _copilotkit_shared_generative_ui.hasOwnKey)(definition.eventFunctions, name) ? definition.eventFunctions[name] : void 0;
|
|
2865
3354
|
handlers[name] = functionName === void 0 ? (args) => (0, _copilotkit_core_generative_ui.invokeBoundEvent)({
|
|
2866
3355
|
...call,
|
|
2867
3356
|
binding: latest.current[name],
|
|
@@ -2887,7 +3376,9 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
2887
3376
|
* The setter props of a node: `setValue` for the writable prop `value`. For
|
|
2888
3377
|
* a prop the model bound to `{"@path"}`, the setter writes the data model
|
|
2889
3378
|
* and makes the path user-owned. For a literal prop, it sets `overrides`, a
|
|
2890
|
-
* local value of this mounted node
|
|
3379
|
+
* local value of this mounted node that wins over the model's value until
|
|
3380
|
+
* the node remounts (see `useModelDataProps`). The setters keep their
|
|
3381
|
+
* identity.
|
|
2891
3382
|
*/
|
|
2892
3383
|
function useSetterProps(runtime, surface, componentId, definition, properties, basePath) {
|
|
2893
3384
|
const [overrides, setOverrides] = (0, react.useState)({});
|
|
@@ -2910,7 +3401,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
2910
3401
|
try {
|
|
2911
3402
|
runtime.manager.setOwnedValue(surface.key, (0, _copilotkit_core_generative_ui.resolvePath)(binding["@path"], basePath), value);
|
|
2912
3403
|
} catch (cause) {
|
|
2913
|
-
const message =
|
|
3404
|
+
const { message } = (0, _copilotkit_shared_generative_ui.toError)(cause);
|
|
2914
3405
|
(0, _copilotkit_core_generative_ui.reportErrorSafely)(runtime, {
|
|
2915
3406
|
kind: "props",
|
|
2916
3407
|
surfaceId: surface.surfaceId,
|
|
@@ -2929,29 +3420,36 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
2929
3420
|
])
|
|
2930
3421
|
};
|
|
2931
3422
|
}
|
|
2932
|
-
function useSlotProps(surface, definition, properties, componentId, basePath, ancestors) {
|
|
3423
|
+
function useSlotProps(surface, definition, properties, componentId, basePath, ancestors, place) {
|
|
2933
3424
|
return (0, react.useMemo)(() => {
|
|
2934
3425
|
const childAncestors = [...ancestors, scopedId(componentId, basePath)];
|
|
2935
3426
|
const slots = {};
|
|
2936
3427
|
for (const [name, kind] of Object.entries(definition.slots ?? {})) {
|
|
2937
3428
|
const value = properties[name];
|
|
3429
|
+
const via = `${name}:`;
|
|
2938
3430
|
if (kind === "single" && typeof value === "string") slots[name] = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NodeView, {
|
|
2939
3431
|
surface,
|
|
2940
3432
|
componentId: value,
|
|
2941
3433
|
basePath,
|
|
2942
|
-
ancestors: childAncestors
|
|
3434
|
+
ancestors: childAncestors,
|
|
3435
|
+
parentPlace: place,
|
|
3436
|
+
via
|
|
2943
3437
|
});
|
|
2944
3438
|
else if (kind === "multiple" && isTemplateChildren(value)) slots[name] = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TemplateChildren, {
|
|
2945
3439
|
surface,
|
|
2946
3440
|
template: value,
|
|
2947
3441
|
basePath,
|
|
2948
|
-
ancestors: childAncestors
|
|
3442
|
+
ancestors: childAncestors,
|
|
3443
|
+
parentPlace: place,
|
|
3444
|
+
via
|
|
2949
3445
|
});
|
|
2950
3446
|
else if (kind === "multiple" && Array.isArray(value)) slots[name] = [...new Set(value.filter((id) => typeof id === "string"))].map((id) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NodeView, {
|
|
2951
3447
|
surface,
|
|
2952
3448
|
componentId: id,
|
|
2953
3449
|
basePath,
|
|
2954
|
-
ancestors: childAncestors
|
|
3450
|
+
ancestors: childAncestors,
|
|
3451
|
+
parentPlace: place,
|
|
3452
|
+
via
|
|
2955
3453
|
}, id));
|
|
2956
3454
|
}
|
|
2957
3455
|
return slots;
|
|
@@ -2961,7 +3459,8 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
2961
3459
|
properties,
|
|
2962
3460
|
componentId,
|
|
2963
3461
|
basePath,
|
|
2964
|
-
ancestors
|
|
3462
|
+
ancestors,
|
|
3463
|
+
place
|
|
2965
3464
|
]);
|
|
2966
3465
|
}
|
|
2967
3466
|
/**
|
|
@@ -2969,33 +3468,43 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
2969
3468
|
* `childList()`, at any depth) replaced by the rendered component. Without
|
|
2970
3469
|
* references, the parsed props come back as they are.
|
|
2971
3470
|
*/
|
|
2972
|
-
function useChildRefProps(surface, refs, props, componentId, basePath, ancestors) {
|
|
3471
|
+
function useChildRefProps(surface, refs, props, componentId, basePath, ancestors, place) {
|
|
2973
3472
|
return (0, react.useMemo)(() => {
|
|
2974
3473
|
if (props === void 0 || refs.length === 0) return props;
|
|
2975
3474
|
const childAncestors = [...ancestors, scopedId(componentId, basePath)];
|
|
2976
|
-
const render = (kind, value) => {
|
|
3475
|
+
const render = (kind, value, via) => {
|
|
2977
3476
|
if (kind === "single") return typeof value === "string" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NodeView, {
|
|
2978
3477
|
surface,
|
|
2979
3478
|
componentId: value,
|
|
2980
3479
|
basePath,
|
|
2981
|
-
ancestors: childAncestors
|
|
3480
|
+
ancestors: childAncestors,
|
|
3481
|
+
parentPlace: place,
|
|
3482
|
+
via
|
|
2982
3483
|
}) : void 0;
|
|
2983
3484
|
if (isTemplateChildren(value)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TemplateChildren, {
|
|
2984
3485
|
surface,
|
|
2985
3486
|
template: value,
|
|
2986
3487
|
basePath,
|
|
2987
|
-
ancestors: childAncestors
|
|
3488
|
+
ancestors: childAncestors,
|
|
3489
|
+
parentPlace: place,
|
|
3490
|
+
via
|
|
2988
3491
|
});
|
|
2989
3492
|
if (!Array.isArray(value)) return void 0;
|
|
2990
3493
|
return [...new Set(value.filter((id) => typeof id === "string"))].map((id) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NodeView, {
|
|
2991
3494
|
surface,
|
|
2992
3495
|
componentId: id,
|
|
2993
3496
|
basePath,
|
|
2994
|
-
ancestors: childAncestors
|
|
3497
|
+
ancestors: childAncestors,
|
|
3498
|
+
parentPlace: place,
|
|
3499
|
+
via
|
|
2995
3500
|
}, id));
|
|
2996
3501
|
};
|
|
2997
3502
|
let result = props;
|
|
2998
|
-
for (const ref of refs)
|
|
3503
|
+
for (const ref of refs) {
|
|
3504
|
+
let found = 0;
|
|
3505
|
+
const path = ref.path.join(".");
|
|
3506
|
+
result = (0, _copilotkit_shared.mapAtChildRef)(result, ref.path, (value) => render(ref.kind, value, `${path}[${found++}]:`));
|
|
3507
|
+
}
|
|
2999
3508
|
return result;
|
|
3000
3509
|
}, [
|
|
3001
3510
|
surface,
|
|
@@ -3003,15 +3512,17 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
3003
3512
|
props,
|
|
3004
3513
|
componentId,
|
|
3005
3514
|
basePath,
|
|
3006
|
-
ancestors
|
|
3515
|
+
ancestors,
|
|
3516
|
+
place
|
|
3007
3517
|
]);
|
|
3008
3518
|
}
|
|
3009
|
-
function ResolvedNode({ surface, componentId, definition, properties, runtime, basePath, ancestors }) {
|
|
3519
|
+
function ResolvedNode({ surface, componentId, definition, properties, runtime, basePath, ancestors, place }) {
|
|
3520
|
+
const { AccessibilityWrapper } = useGenerativeUIHost();
|
|
3010
3521
|
const { overrides, setters } = useSetterProps(runtime, surface, componentId, definition, properties, basePath);
|
|
3011
3522
|
const dataProps = useDataProps(runtime, surface, definition, properties, basePath, overrides);
|
|
3012
3523
|
const eventProps = useEventProps(runtime, surface, componentId, definition, properties, basePath);
|
|
3013
|
-
const slotProps = useSlotProps(surface, definition, properties, componentId, basePath, ancestors);
|
|
3014
|
-
const childRefProps = useChildRefProps(surface, definition.childRefs, dataProps.ok ? dataProps.props : void 0, componentId, basePath, ancestors);
|
|
3524
|
+
const slotProps = useSlotProps(surface, definition, properties, componentId, basePath, ancestors, place);
|
|
3525
|
+
const childRefProps = useChildRefProps(surface, definition.childRefs, dataProps.ok ? dataProps.props : void 0, componentId, basePath, ancestors, place);
|
|
3015
3526
|
const accessibility = dataProps.ok ? dataProps.accessibility : void 0;
|
|
3016
3527
|
const nodeContext = (0, react.useMemo)(() => ({
|
|
3017
3528
|
surfaceKey: surface.key,
|
|
@@ -3025,8 +3536,19 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
3025
3536
|
accessibility
|
|
3026
3537
|
]);
|
|
3027
3538
|
const problem = dataProps.ok ? void 0 : dataProps.problem;
|
|
3539
|
+
const log = useFailureLog();
|
|
3540
|
+
(0, react.useEffect)(() => {
|
|
3541
|
+
if (!problem) {
|
|
3542
|
+
log.clear(failureSlots.fallback(place));
|
|
3543
|
+
log.clear(failureSlots.props(place));
|
|
3544
|
+
}
|
|
3545
|
+
}, [
|
|
3546
|
+
problem,
|
|
3547
|
+
log,
|
|
3548
|
+
place
|
|
3549
|
+
]);
|
|
3028
3550
|
(0, react.useEffect)(() => {
|
|
3029
|
-
if (problem) (
|
|
3551
|
+
if (problem) log.report(runtime, failureSlots.props(place), {
|
|
3030
3552
|
kind: "props",
|
|
3031
3553
|
surfaceId: surface.surfaceId,
|
|
3032
3554
|
componentId,
|
|
@@ -3034,13 +3556,19 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
3034
3556
|
});
|
|
3035
3557
|
}, [
|
|
3036
3558
|
problem,
|
|
3559
|
+
log,
|
|
3560
|
+
place,
|
|
3037
3561
|
runtime,
|
|
3038
3562
|
surface.surfaceId,
|
|
3039
3563
|
componentId
|
|
3040
3564
|
]);
|
|
3041
|
-
if (!dataProps.ok) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
3565
|
+
if (!dataProps.ok) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GuardedNodeFallback, {
|
|
3566
|
+
surfaceId: surface.surfaceId,
|
|
3567
|
+
componentId,
|
|
3568
|
+
runtime,
|
|
3042
3569
|
message: `invalid props (${problem})`,
|
|
3043
|
-
|
|
3570
|
+
slot: failureSlots.fallback(place),
|
|
3571
|
+
revision: properties
|
|
3044
3572
|
});
|
|
3045
3573
|
const Component = definition.component;
|
|
3046
3574
|
const rendered = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, {
|
|
@@ -3052,10 +3580,8 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
3052
3580
|
const hasEnvelope = properties.accessibility !== void 0 && definition.accessibility !== "self";
|
|
3053
3581
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GenerativeUINodeContext.Provider, {
|
|
3054
3582
|
value: nodeContext,
|
|
3055
|
-
children: hasEnvelope ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
3056
|
-
|
|
3057
|
-
style: ROOT_STYLE,
|
|
3058
|
-
...(0, _copilotkit_core_generative_ui.wrapperAria)((0, _copilotkit_core_generative_ui.accessibilityAttributes)(accessibility)),
|
|
3583
|
+
children: hasEnvelope ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AccessibilityWrapper, {
|
|
3584
|
+
attributes: (0, _copilotkit_core_generative_ui.wrapperAria)((0, _copilotkit_core_generative_ui.accessibilityAttributes)(accessibility)),
|
|
3059
3585
|
children: rendered
|
|
3060
3586
|
}) : rendered
|
|
3061
3587
|
});
|
|
@@ -3075,39 +3601,18 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
3075
3601
|
})]
|
|
3076
3602
|
});
|
|
3077
3603
|
}
|
|
3078
|
-
const ContentSchema = zod.object({
|
|
3079
|
-
surfaceId: zod.string(),
|
|
3080
|
-
target: zod.string(),
|
|
3081
|
-
catalogId: zod.string(),
|
|
3082
|
-
operations: zod.array(zod.any()),
|
|
3083
|
-
status: zod.enum([
|
|
3084
|
-
"streaming",
|
|
3085
|
-
"ready",
|
|
3086
|
-
"error"
|
|
3087
|
-
]),
|
|
3088
|
-
rejected: zod.array(zod.object({
|
|
3089
|
-
index: zod.number(),
|
|
3090
|
-
reason: zod.string()
|
|
3091
|
-
})).default([])
|
|
3092
|
-
}).loose();
|
|
3093
3604
|
function GenerativeUIChatActivity({ content, agent }) {
|
|
3094
3605
|
const runtime = useGenerativeUIRuntime();
|
|
3095
3606
|
const threadId = useCopilotChatConfiguration()?.threadId ?? agent?.threadId;
|
|
3096
3607
|
const Wrapper = (0, react.useContext)(GenerativeUIChatSlotContext) ?? DefaultGenerativeUIChatCard;
|
|
3097
|
-
|
|
3098
|
-
(0, react.useLayoutEffect)(() => {
|
|
3099
|
-
if (runtime && threadId) runtime.manager.ingest(threadId, agent?.agentId, content);
|
|
3100
|
-
}, [
|
|
3608
|
+
const { surface, rejected, error } = useGenerativeUIActivitySurface({
|
|
3101
3609
|
runtime,
|
|
3102
3610
|
threadId,
|
|
3103
|
-
agent?.agentId,
|
|
3104
|
-
content
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
const surface = runtime.manager.getSurface(threadId, content.surfaceId) ?? runtime.manager.getFailedSurface(threadId, content.surfaceId);
|
|
3611
|
+
agentId: agent?.agentId,
|
|
3612
|
+
content,
|
|
3613
|
+
target: _copilotkit_shared.GENERATIVE_UI_CHAT_TARGET
|
|
3614
|
+
});
|
|
3108
3615
|
if (!surface) return null;
|
|
3109
|
-
const rejected = [...content.rejected ?? [], ...surface.clientRejected];
|
|
3110
|
-
const error = rejected.length ? new Error(`${rejected.length} UI update(s) could not be shown`, { cause: rejected }) : void 0;
|
|
3111
3616
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Wrapper, {
|
|
3112
3617
|
surfaceId: content.surfaceId,
|
|
3113
3618
|
isStreaming: content.status === "streaming",
|
|
@@ -3119,7 +3624,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
3119
3624
|
function createGenerativeUIActivityRenderer() {
|
|
3120
3625
|
return {
|
|
3121
3626
|
activityType: _copilotkit_shared.GENERATIVE_UI_ACTIVITY_TYPE,
|
|
3122
|
-
content:
|
|
3627
|
+
content: _copilotkit_core_generative_ui.GenerativeUISurfaceContentSchema,
|
|
3123
3628
|
render: GenerativeUIChatActivity
|
|
3124
3629
|
};
|
|
3125
3630
|
}
|