@copilotkit/react-core 1.81.0 → 1.83.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/{MarkdownSurfaces-L67964_B.mjs → MarkdownSurfaces-DGpjmPaB.mjs} +11 -2
- package/dist/MarkdownSurfaces-DGpjmPaB.mjs.map +1 -0
- package/dist/{MarkdownSurfaces-D-OkjUpU.cjs → MarkdownSurfaces-FF5za2kU.cjs} +11 -2
- package/dist/MarkdownSurfaces-FF5za2kU.cjs.map +1 -0
- package/dist/{copilotkit-BjllYYjw.cjs → copilotkit-BuIuo-Z1.cjs} +165 -100
- package/dist/copilotkit-BuIuo-Z1.cjs.map +1 -0
- package/dist/{copilotkit-BEcaM4L4.d.mts → copilotkit-C765tOUi.d.mts} +46 -3
- package/dist/copilotkit-C765tOUi.d.mts.map +1 -0
- package/dist/{copilotkit-fKrKqoiP.mjs → copilotkit-DyxwF9wL.mjs} +165 -100
- package/dist/copilotkit-DyxwF9wL.mjs.map +1 -0
- package/dist/{copilotkit-D9jIImy9.d.cts → copilotkit-wqaNanhw.d.cts} +46 -3
- package/dist/copilotkit-wqaNanhw.d.cts.map +1 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.umd.js +12 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/v2/generative-ui.cjs +1 -1
- package/dist/v2/generative-ui.d.cts +54 -54
- package/dist/v2/generative-ui.d.mts +54 -54
- package/dist/v2/generative-ui.mjs +1 -1
- package/dist/v2/headless.cjs +10 -1
- package/dist/v2/headless.cjs.map +1 -1
- package/dist/v2/headless.d.cts +9 -0
- package/dist/v2/headless.d.cts.map +1 -1
- package/dist/v2/headless.d.mts +9 -0
- package/dist/v2/headless.d.mts.map +1 -1
- package/dist/v2/headless.mjs +10 -1
- package/dist/v2/headless.mjs.map +1 -1
- package/dist/v2/index.cjs +2 -2
- package/dist/v2/index.css +1 -1
- package/dist/v2/index.d.cts +1 -1
- package/dist/v2/index.d.mts +1 -1
- package/dist/v2/index.mjs +2 -2
- package/dist/v2/index.umd.js +173 -99
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +8 -8
- package/dist/MarkdownSurfaces-D-OkjUpU.cjs.map +0 -1
- package/dist/MarkdownSurfaces-L67964_B.mjs.map +0 -1
- package/dist/copilotkit-BEcaM4L4.d.mts.map +0 -1
- package/dist/copilotkit-BjllYYjw.cjs.map +0 -1
- package/dist/copilotkit-D9jIImy9.d.cts.map +0 -1
- package/dist/copilotkit-fKrKqoiP.mjs.map +0 -1
package/dist/v2/index.umd.js
CHANGED
|
@@ -243,7 +243,16 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
243
243
|
chatToggleCloseLabel: "Close chat",
|
|
244
244
|
chatScrollToBottomLabel: "Scroll to bottom",
|
|
245
245
|
modalHeaderTitle: "CopilotKit Chat",
|
|
246
|
-
welcomeMessageText: "How can I help you today?"
|
|
246
|
+
welcomeMessageText: "How can I help you today?",
|
|
247
|
+
reasoningMessageThinkingLabel: "Thinking…",
|
|
248
|
+
chatInputSlashMenuLabel: "Slash commands",
|
|
249
|
+
chatInputSlashMenuEmptyText: "No commands found",
|
|
250
|
+
attachmentRemoveButtonLabel: "Remove attachment",
|
|
251
|
+
attachmentPlayVideoButtonLabel: "Play video",
|
|
252
|
+
attachmentPreviewCloseButtonLabel: "Close preview",
|
|
253
|
+
modalHeaderCloseButtonLabel: "Close",
|
|
254
|
+
modalHeaderThreadsButtonLabel: "Open threads",
|
|
255
|
+
sidebarLabel: "Copilot chat sidebar"
|
|
247
256
|
};
|
|
248
257
|
/**
|
|
249
258
|
* Mobile breakpoint below which the chat modal and the thread-list drawer are
|
|
@@ -1395,13 +1404,13 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
1395
1404
|
const slashMenu = slashMenuVisible ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1396
1405
|
"data-testid": "copilot-slash-menu",
|
|
1397
1406
|
role: "listbox",
|
|
1398
|
-
"aria-label":
|
|
1407
|
+
"aria-label": labels.chatInputSlashMenuLabel,
|
|
1399
1408
|
ref: slashMenuRef,
|
|
1400
1409
|
className: "cpk:absolute cpk:bottom-full cpk:left-0 cpk:right-0 cpk:z-30 cpk:mb-2 cpk:max-h-64 cpk:overflow-y-auto cpk:rounded-lg cpk:border cpk:border-border cpk:bg-white cpk:shadow-lg cpk:dark:border-[#3a3a3a] cpk:dark:bg-[#1f1f1f]",
|
|
1401
1410
|
style: { maxHeight: `${SLASH_MENU_MAX_VISIBLE_ITEMS * SLASH_MENU_ITEM_HEIGHT_PX}px` },
|
|
1402
1411
|
children: filteredCommands.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1403
1412
|
className: "cpk:px-3 cpk:py-2 cpk:text-sm cpk:text-muted-foreground",
|
|
1404
|
-
children:
|
|
1413
|
+
children: labels.chatInputSlashMenuEmptyText
|
|
1405
1414
|
}) : filteredCommands.map((item, index) => {
|
|
1406
1415
|
const isActive = index === slashHighlightIndex;
|
|
1407
1416
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
@@ -1815,7 +1824,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
1815
1824
|
|
|
1816
1825
|
//#endregion
|
|
1817
1826
|
//#region package.json
|
|
1818
|
-
var version = "1.
|
|
1827
|
+
var version = "1.83.0";
|
|
1819
1828
|
|
|
1820
1829
|
//#endregion
|
|
1821
1830
|
//#region src/v2/components/CopilotKitInspector.tsx
|
|
@@ -3413,7 +3422,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
3413
3422
|
*/
|
|
3414
3423
|
function A2UICatalogContext({ catalog, includeSchema }) {
|
|
3415
3424
|
const { copilotkit } = useCopilotKit();
|
|
3416
|
-
const capabilitiesValue = (0, react.useMemo)(() => (0, _copilotkit_a2ui_renderer.buildCatalogContextValue)(catalog), [catalog]);
|
|
3425
|
+
const capabilitiesValue = (0, react.useMemo)(() => (0, _copilotkit_a2ui_renderer.buildCatalogContextValue)(catalog, { includeSchema: includeSchema !== false }), [catalog, includeSchema]);
|
|
3417
3426
|
const schemaValue = (0, react.useMemo)(() => includeSchema !== false ? JSON.stringify((0, _copilotkit_a2ui_renderer.extractCatalogComponentSchemas)(catalog)) : null, [catalog, includeSchema]);
|
|
3418
3427
|
const a2uiAgentsKey = copilotkit?.a2uiAgents?.join(",");
|
|
3419
3428
|
(0, react.useLayoutEffect)(() => {
|
|
@@ -9044,14 +9053,14 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
9044
9053
|
const line = appearance === "line";
|
|
9045
9054
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
9046
9055
|
"data-copilotkit": true,
|
|
9047
|
-
className: (0, tailwind_merge.twMerge)(
|
|
9056
|
+
className: (0, tailwind_merge.twMerge)(appearance === "card" && "cpk:border-t cpk:border-border", className),
|
|
9048
9057
|
...props,
|
|
9049
9058
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
9050
9059
|
type: "button",
|
|
9051
9060
|
"aria-expanded": open,
|
|
9052
9061
|
"aria-controls": detailsId,
|
|
9053
9062
|
onClick: () => setOpen((value) => !value),
|
|
9054
|
-
className: (0, tailwind_merge.twMerge)("cpk:group/row cpk:m-0 cpk:flex cpk:min-w-0 cpk:cursor-pointer cpk:items-center cpk:gap-2 cpk:border-none cpk:bg-transparent cpk:text-left cpk:text-[13px] cpk:text-inherit cpk:transition-colors cpk:hover:bg-accent/60 cpk:focus-visible:outline-2 cpk:focus-visible:-outline-offset-2 cpk:focus-visible:outline-ring", line ? "cpk:-mx-1.5 cpk:w-[calc(100%+0.75rem)] cpk:rounded-md cpk:px-1.5 cpk:py-1" : "cpk:w-full cpk:px-3.5 cpk:py-2"),
|
|
9063
|
+
className: (0, tailwind_merge.twMerge)("cpk:group/row cpk:m-0 cpk:flex cpk:min-w-0 cpk:cursor-pointer cpk:items-center cpk:gap-2 cpk:border-none cpk:bg-transparent cpk:text-left cpk:text-[13px] cpk:text-inherit cpk:transition-colors cpk:hover:bg-accent/60 cpk:focus-visible:outline-2 cpk:focus-visible:-outline-offset-2 cpk:focus-visible:outline-ring", line ? "cpk:-mx-1.5 cpk:w-[calc(100%+0.75rem)] cpk:rounded-md cpk:px-1.5 cpk:py-1" : appearance === "stack" ? "cpk:w-full cpk:px-3.5 cpk:py-2.5" : "cpk:w-full cpk:px-3.5 cpk:py-2"),
|
|
9055
9064
|
children: [
|
|
9056
9065
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StatusIcon, { status }),
|
|
9057
9066
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
@@ -9091,7 +9100,8 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
9091
9100
|
*
|
|
9092
9101
|
* Each call is drawn by its registered renderer. CopilotKit's built-in card
|
|
9093
9102
|
* (`useDefaultRenderTool`) draws a compact row inside the card and line
|
|
9094
|
-
* appearances; a custom wildcard renderer draws whatever it
|
|
9103
|
+
* appearances and an open stack; a custom wildcard renderer draws whatever it
|
|
9104
|
+
* draws.
|
|
9095
9105
|
*/
|
|
9096
9106
|
function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isActive = false, className, ...props }) {
|
|
9097
9107
|
const [open, setOpen] = (0, react.useState)(false);
|
|
@@ -9170,11 +9180,6 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
9170
9180
|
});
|
|
9171
9181
|
}
|
|
9172
9182
|
if (appearance === "stack") {
|
|
9173
|
-
if (calls.length === 1) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
9174
|
-
...groupProps,
|
|
9175
|
-
className: (0, tailwind_merge.twMerge)("cpk:py-1", className),
|
|
9176
|
-
children: renderCall(latest)
|
|
9177
|
-
});
|
|
9178
9183
|
const behind = open ? 0 : Math.min(calls.length - 1, 2);
|
|
9179
9184
|
const layer = "cpk:rounded-xl cpk:border cpk:border-border cpk:bg-card cpk:text-card-foreground";
|
|
9180
9185
|
const latestStatus = entryStatus(latest, isActive);
|
|
@@ -9188,68 +9193,88 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
9188
9193
|
},
|
|
9189
9194
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
9190
9195
|
className: "cpk:relative cpk:isolate",
|
|
9191
|
-
children: [
|
|
9192
|
-
|
|
9193
|
-
|
|
9194
|
-
|
|
9195
|
-
|
|
9196
|
-
|
|
9197
|
-
|
|
9198
|
-
|
|
9199
|
-
|
|
9200
|
-
|
|
9201
|
-
"
|
|
9202
|
-
|
|
9203
|
-
|
|
9204
|
-
|
|
9205
|
-
|
|
9206
|
-
|
|
9207
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
9208
|
-
|
|
9209
|
-
open: true,
|
|
9210
|
-
className: "cpk:-rotate-90"
|
|
9211
|
-
}),
|
|
9212
|
-
"Collapse"
|
|
9213
|
-
] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
9214
|
-
className: "cpk:flex cpk:min-w-0 cpk:flex-1 cpk:items-center cpk:gap-2 cpk:animate-[cpk-stack-drop_260ms_cubic-bezier(0.16,1,0.3,1)] cpk:motion-reduce:animate-none",
|
|
9215
|
-
children: [
|
|
9216
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StatusIcon, { status: latestStatus }),
|
|
9217
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
9218
|
-
className: (0, tailwind_merge.twMerge)("cpk:shrink-0 cpk:font-mono cpk:font-medium cpk:text-foreground", latestStatus === "running" && "cpk-shimmer"),
|
|
9219
|
-
children: latest.toolCall.function.name
|
|
9220
|
-
}),
|
|
9221
|
-
latestPreview && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
9222
|
-
className: "cpk:min-w-0 cpk:truncate cpk:font-mono cpk:text-muted-foreground",
|
|
9223
|
-
children: latestPreview
|
|
9224
|
-
})
|
|
9225
|
-
]
|
|
9226
|
-
}, latest.toolCall.id), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
9227
|
-
className: "cpk:ml-2 cpk:inline-flex cpk:shrink-0 cpk:items-center cpk:gap-2 cpk:text-xs cpk:text-muted-foreground",
|
|
9228
|
-
children: [
|
|
9196
|
+
children: [
|
|
9197
|
+
Array.from({ length: behind }, (_, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
9198
|
+
"aria-hidden": "true",
|
|
9199
|
+
className: (0, tailwind_merge.twMerge)(layer, "cpk:absolute cpk:inset-0"),
|
|
9200
|
+
style: {
|
|
9201
|
+
transform: `translateY(${(index + 1) * 6}px) scaleX(${1 - (index + 1) * .045})`,
|
|
9202
|
+
zIndex: -1 - index,
|
|
9203
|
+
opacity: 1 - (index + 1) * .28
|
|
9204
|
+
}
|
|
9205
|
+
}, index)),
|
|
9206
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
9207
|
+
type: "button",
|
|
9208
|
+
"aria-expanded": open,
|
|
9209
|
+
"aria-controls": open ? bodyId : void 0,
|
|
9210
|
+
onClick: () => setOpen((value) => !value),
|
|
9211
|
+
className: (0, tailwind_merge.twMerge)("cpk:relative cpk:m-0 cpk:flex cpk:min-w-0 cpk:cursor-pointer cpk:items-center cpk:text-left cpk:transition-colors cpk:focus-visible:outline-2 cpk:focus-visible:outline-ring", open ? "cpk:mb-1.5 cpk:w-full cpk:gap-1.5 cpk:rounded-md cpk:border-none cpk:bg-transparent cpk:p-0 cpk:py-0.5 cpk:text-xs cpk:text-muted-foreground cpk:hover:text-foreground" : (0, tailwind_merge.twMerge)(layer, "cpk:w-full cpk:gap-2 cpk:px-3.5 cpk:py-2.5 cpk:text-[13px] cpk:shadow-[0_1px_2px_rgb(0_0_0/0.04)] cpk:hover:bg-accent")),
|
|
9212
|
+
children: open ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
9213
|
+
pluralize(calls.length, "tool call"),
|
|
9229
9214
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FailedCount, { calls }),
|
|
9230
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
9231
|
-
className: "cpk:
|
|
9232
|
-
children:
|
|
9233
|
-
|
|
9234
|
-
|
|
9235
|
-
|
|
9236
|
-
className: "cpk:rotate-90"
|
|
9215
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
9216
|
+
className: "cpk:ml-auto cpk:inline-flex cpk:items-center cpk:gap-1",
|
|
9217
|
+
children: ["Collapse", /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chevron, {
|
|
9218
|
+
open: true,
|
|
9219
|
+
className: "cpk:-rotate-90"
|
|
9220
|
+
})]
|
|
9237
9221
|
})
|
|
9238
|
-
]
|
|
9239
|
-
|
|
9240
|
-
|
|
9222
|
+
] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
9223
|
+
className: "cpk:flex cpk:min-w-0 cpk:flex-1 cpk:items-center cpk:gap-2 cpk:animate-[cpk-stack-drop_260ms_cubic-bezier(0.16,1,0.3,1)] cpk:motion-reduce:animate-none",
|
|
9224
|
+
children: [
|
|
9225
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StatusIcon, { status: latestStatus }),
|
|
9226
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
9227
|
+
className: (0, tailwind_merge.twMerge)("cpk:shrink-0 cpk:font-mono cpk:font-medium cpk:text-foreground", latestStatus === "running" && "cpk-shimmer"),
|
|
9228
|
+
children: latest.toolCall.function.name
|
|
9229
|
+
}),
|
|
9230
|
+
latestPreview && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
9231
|
+
className: "cpk:min-w-0 cpk:truncate cpk:font-mono cpk:text-muted-foreground",
|
|
9232
|
+
children: latestPreview
|
|
9233
|
+
}),
|
|
9234
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
9235
|
+
className: "cpk:sr-only",
|
|
9236
|
+
children: statusLabels[latestStatus]
|
|
9237
|
+
})
|
|
9238
|
+
]
|
|
9239
|
+
}, latest.toolCall.id), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
9240
|
+
className: "cpk:ml-2 cpk:inline-flex cpk:shrink-0 cpk:items-center cpk:gap-2 cpk:text-xs cpk:text-muted-foreground",
|
|
9241
|
+
children: [
|
|
9242
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FailedCount, { calls }),
|
|
9243
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
9244
|
+
className: "cpk:tabular-nums",
|
|
9245
|
+
children: pluralize(calls.length, "call")
|
|
9246
|
+
}),
|
|
9247
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chevron, {
|
|
9248
|
+
open: false,
|
|
9249
|
+
className: "cpk:rotate-90"
|
|
9250
|
+
})
|
|
9251
|
+
]
|
|
9252
|
+
})] })
|
|
9253
|
+
}),
|
|
9254
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
9255
|
+
"aria-live": "polite",
|
|
9256
|
+
className: "cpk:sr-only",
|
|
9257
|
+
children: open ? "" : `${latest.toolCall.function.name}: ${statusLabels[latestStatus]}`
|
|
9258
|
+
})
|
|
9259
|
+
]
|
|
9241
9260
|
}), open && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
9242
9261
|
id: bodyId,
|
|
9243
|
-
className: "cpk:
|
|
9244
|
-
children:
|
|
9262
|
+
className: "cpk:grid cpk:gap-1.5",
|
|
9263
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolCallGroupContext.Provider, {
|
|
9264
|
+
value: {
|
|
9265
|
+
appearance: "stack",
|
|
9266
|
+
failedIds,
|
|
9267
|
+
active: isActive
|
|
9268
|
+
},
|
|
9269
|
+
children: calls.map((call, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
9270
|
+
className: (0, tailwind_merge.twMerge)(layer, "cpk:overflow-hidden cpk:shadow-[0_1px_2px_rgb(0_0_0/0.04)] cpk:animate-[cpk-stack-fan_240ms_cubic-bezier(0.16,1,0.3,1)_both] cpk:motion-reduce:animate-none"),
|
|
9271
|
+
style: { animationDelay: `${index * 30}ms` },
|
|
9272
|
+
children: renderCall(call)
|
|
9273
|
+
}, call.toolCall.id))
|
|
9274
|
+
})
|
|
9245
9275
|
})]
|
|
9246
9276
|
});
|
|
9247
9277
|
}
|
|
9248
|
-
if (calls.length === 1) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
9249
|
-
...groupProps,
|
|
9250
|
-
className: (0, tailwind_merge.twMerge)("cpk:py-1", className),
|
|
9251
|
-
children: renderCall(latest)
|
|
9252
|
-
});
|
|
9253
9278
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
9254
9279
|
...groupProps,
|
|
9255
9280
|
className: (0, tailwind_merge.twMerge)("cpk:my-3 cpk:overflow-hidden cpk:rounded-xl cpk:border cpk:border-border cpk:bg-card cpk:text-card-foreground", className),
|
|
@@ -9272,7 +9297,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
9272
9297
|
className: "cpk:ml-auto cpk:flex cpk:shrink-0 cpk:items-center cpk:gap-2 cpk:pl-2 cpk:text-xs cpk:text-muted-foreground",
|
|
9273
9298
|
children: [status === "failed" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FailedCount, { calls }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
9274
9299
|
className: "cpk:tabular-nums",
|
|
9275
|
-
children: status
|
|
9300
|
+
children: status !== "running" ? statusLabels[status] : done > 0 && `${done} done`
|
|
9276
9301
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chevron, { open })]
|
|
9277
9302
|
})
|
|
9278
9303
|
]
|
|
@@ -12503,7 +12528,13 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
12503
12528
|
|
|
12504
12529
|
//#endregion
|
|
12505
12530
|
//#region src/v2/components/chat/Lightbox.tsx
|
|
12531
|
+
/**
|
|
12532
|
+
* A full-screen preview portalled to `document.body`. It closes on Escape, a
|
|
12533
|
+
* click on the backdrop, or its close button, which is named by
|
|
12534
|
+
* `labels.attachmentPreviewCloseButtonLabel`.
|
|
12535
|
+
*/
|
|
12506
12536
|
function Lightbox({ onClose, children }) {
|
|
12537
|
+
const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
|
|
12507
12538
|
(0, react.useEffect)(() => {
|
|
12508
12539
|
const handleKey = (e) => {
|
|
12509
12540
|
if (e.key === "Escape") onClose();
|
|
@@ -12518,7 +12549,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
12518
12549
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
12519
12550
|
onClick: onClose,
|
|
12520
12551
|
className: "cpk:absolute cpk:top-4 cpk:right-4 cpk:text-white cpk:bg-white/10 cpk:hover:bg-white/20 cpk:rounded-full cpk:w-10 cpk:h-10 cpk:flex cpk:items-center cpk:justify-center cpk:cursor-pointer cpk:border-none cpk:z-10",
|
|
12521
|
-
"aria-label":
|
|
12552
|
+
"aria-label": labels.attachmentPreviewCloseButtonLabel,
|
|
12522
12553
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.X, { className: "cpk:w-5 cpk:h-5" })
|
|
12523
12554
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
12524
12555
|
onClick: (e) => e.stopPropagation(),
|
|
@@ -12871,7 +12902,14 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
12871
12902
|
if (secs === 0) return `${mins} minute${mins > 1 ? "s" : ""}`;
|
|
12872
12903
|
return `${mins}m ${secs}s`;
|
|
12873
12904
|
}
|
|
12905
|
+
/**
|
|
12906
|
+
* A reasoning message as a collapsible block. While the model reasons it is
|
|
12907
|
+
* open and the header shows `labels.reasoningMessageThinkingLabel`; when
|
|
12908
|
+
* streaming ends it collapses and the header reads "Thought for …". The
|
|
12909
|
+
* `header` slot also receives `elapsedSeconds`.
|
|
12910
|
+
*/
|
|
12874
12911
|
function CopilotChatReasoningMessage({ message, messages, isRunning, isLatest: isLatestProp, header, contentView, toggle, children, className, ...props }) {
|
|
12912
|
+
const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
|
|
12875
12913
|
const isLatest = isLatestProp ?? messages?.[messages.length - 1]?.id === message.id;
|
|
12876
12914
|
const isStreaming = !!(isRunning && isLatest);
|
|
12877
12915
|
const hasContent = !!(message.content && message.content.length > 0);
|
|
@@ -12901,12 +12939,13 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
12901
12939
|
userToggledRef.current = true;
|
|
12902
12940
|
setIsOpen((prev) => !prev);
|
|
12903
12941
|
} : void 0;
|
|
12904
|
-
const label = isStreaming ?
|
|
12942
|
+
const label = isStreaming ? labels.reasoningMessageThinkingLabel : `Thought for ${formatDuration$1(elapsed)}`;
|
|
12905
12943
|
const boundHeader = renderSlot(header, CopilotChatReasoningMessage.Header, {
|
|
12906
12944
|
isOpen,
|
|
12907
12945
|
label,
|
|
12908
12946
|
hasContent,
|
|
12909
12947
|
isStreaming,
|
|
12948
|
+
elapsedSeconds: elapsed,
|
|
12910
12949
|
onClick: handleToggle
|
|
12911
12950
|
});
|
|
12912
12951
|
const boundContent = renderSlot(contentView, CopilotChatReasoningMessage.Content, {
|
|
@@ -12938,7 +12977,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
12938
12977
|
});
|
|
12939
12978
|
}
|
|
12940
12979
|
(function(_CopilotChatReasoningMessage) {
|
|
12941
|
-
_CopilotChatReasoningMessage.Header = ({ isOpen, label = "Thoughts", hasContent, isStreaming, className, children: headerChildren, ...headerProps }) => {
|
|
12980
|
+
_CopilotChatReasoningMessage.Header = ({ isOpen, label = "Thoughts", hasContent, isStreaming, elapsedSeconds: _elapsedSeconds, className, children: headerChildren, ...headerProps }) => {
|
|
12942
12981
|
const isExpandable = !!hasContent;
|
|
12943
12982
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
12944
12983
|
type: "button",
|
|
@@ -14214,7 +14253,12 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
14214
14253
|
|
|
14215
14254
|
//#endregion
|
|
14216
14255
|
//#region src/v2/components/chat/CopilotChatAttachmentQueue.tsx
|
|
14256
|
+
/**
|
|
14257
|
+
* The attachments queued in the composer, each with a preview and a remove
|
|
14258
|
+
* button named by `labels.attachmentRemoveButtonLabel`.
|
|
14259
|
+
*/
|
|
14217
14260
|
const CopilotChatAttachmentQueue = ({ attachments, onRemoveAttachment, className }) => {
|
|
14261
|
+
const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
|
|
14218
14262
|
if (attachments.length === 0) return null;
|
|
14219
14263
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
14220
14264
|
"data-testid": "copilot-attachment-queue",
|
|
@@ -14229,7 +14273,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
14229
14273
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
14230
14274
|
onClick: () => onRemoveAttachment(attachment.id),
|
|
14231
14275
|
className: cn("cpk:absolute cpk:bg-black/60 cpk:text-white cpk:border-none cpk:rounded-full cpk:w-5 cpk:h-5 cpk:flex cpk:items-center cpk:justify-center cpk:cursor-pointer cpk:text-[10px] cpk:z-20", isMedia ? "cpk:top-1 cpk:right-1" : "cpk:top-1.5 cpk:right-1.5"),
|
|
14232
|
-
"aria-label":
|
|
14276
|
+
"aria-label": labels.attachmentRemoveButtonLabel,
|
|
14233
14277
|
children: "✕"
|
|
14234
14278
|
})
|
|
14235
14279
|
]
|
|
@@ -14285,7 +14329,13 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
14285
14329
|
})]
|
|
14286
14330
|
});
|
|
14287
14331
|
}
|
|
14332
|
+
/**
|
|
14333
|
+
* A video thumbnail with a play button, named by
|
|
14334
|
+
* `labels.attachmentPlayVideoButtonLabel`, that opens the full player in a
|
|
14335
|
+
* lightbox.
|
|
14336
|
+
*/
|
|
14288
14337
|
function VideoPreview({ attachment }) {
|
|
14338
|
+
const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
|
|
14289
14339
|
const src = (0, _copilotkit_shared.getSourceUrl)(attachment.source);
|
|
14290
14340
|
const { thumbnailRef, vtName, open, openLightbox, closeLightbox } = useLightbox();
|
|
14291
14341
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
@@ -14306,7 +14356,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
14306
14356
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
14307
14357
|
onClick: openLightbox,
|
|
14308
14358
|
className: "cpk:absolute cpk:inset-0 cpk:flex cpk:items-center cpk:justify-center cpk:z-10 cpk:cursor-pointer cpk:bg-black/20 cpk:border-none cpk:p-0",
|
|
14309
|
-
"aria-label":
|
|
14359
|
+
"aria-label": labels.attachmentPlayVideoButtonLabel,
|
|
14310
14360
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
14311
14361
|
className: "cpk:w-8 cpk:h-8 cpk:rounded-full cpk:bg-black/60 cpk:flex cpk:items-center cpk:justify-center",
|
|
14312
14362
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Play, { className: "cpk:w-4 cpk:h-4 cpk:text-white cpk:ml-0.5" })
|
|
@@ -15393,6 +15443,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
15393
15443
|
const pendingRunActivityReconnectRef = (0, react.useRef)(false);
|
|
15394
15444
|
const runActivityReconnectGenerationRef = (0, react.useRef)(0);
|
|
15395
15445
|
const activeLocalRunIdsRef = (0, react.useRef)(/* @__PURE__ */ new Set());
|
|
15446
|
+
const observedLocalRunIdsRef = (0, react.useRef)(/* @__PURE__ */ new Set());
|
|
15396
15447
|
const recentlyLocalRunIdsRef = (0, react.useRef)(/* @__PURE__ */ new Map());
|
|
15397
15448
|
const activeWakeRunIdsRef = (0, react.useRef)(/* @__PURE__ */ new Set());
|
|
15398
15449
|
const recentlyWakeRunIdsRef = (0, react.useRef)(/* @__PURE__ */ new Map());
|
|
@@ -15424,7 +15475,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
15424
15475
|
}, []);
|
|
15425
15476
|
const isLocalActiveRunActivity = (0, react.useCallback)((notification) => {
|
|
15426
15477
|
if (notification.agentId && notification.agentId !== resolvedAgentId) return false;
|
|
15427
|
-
if (!notification.runId || !activeLocalRunIdsRef.current.has(notification.runId) && !recentlyLocalRunIdsRef.current.has(notification.runId)) return false;
|
|
15478
|
+
if (!notification.runId || !activeLocalRunIdsRef.current.has(notification.runId) && !observedLocalRunIdsRef.current.has(notification.runId) && !recentlyLocalRunIdsRef.current.has(notification.runId)) return false;
|
|
15428
15479
|
const eventType = notification.eventType.toUpperCase();
|
|
15429
15480
|
return eventType === "RUN_STARTED" || eventType === "RUN_FINISHED" || eventType === "RUN_ERROR";
|
|
15430
15481
|
}, [resolvedAgentId]);
|
|
@@ -15623,6 +15674,16 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
15623
15674
|
pendingWakeRunIdRef.current = notification.runId;
|
|
15624
15675
|
startRunActivityReconnectRef.current?.(generation);
|
|
15625
15676
|
});
|
|
15677
|
+
const observedLocalRunIds = observedLocalRunIdsRef.current;
|
|
15678
|
+
const localRunSubscription = agent.subscribe({
|
|
15679
|
+
onRunInitialized: ({ input }) => {
|
|
15680
|
+
observedLocalRunIds.add(input.runId);
|
|
15681
|
+
},
|
|
15682
|
+
onRunFinalized: ({ input }) => {
|
|
15683
|
+
observedLocalRunIds.delete(input.runId);
|
|
15684
|
+
rememberRecentlyLocalRunId(input.runId);
|
|
15685
|
+
}
|
|
15686
|
+
});
|
|
15626
15687
|
return () => {
|
|
15627
15688
|
detached = true;
|
|
15628
15689
|
pendingRunActivityReconnectRef.current = false;
|
|
@@ -15635,6 +15696,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
15635
15696
|
if (wakeReconnectActive) agent.detachActiveRun().catch(() => {});
|
|
15636
15697
|
activeWakeRunIdsRef.current.clear();
|
|
15637
15698
|
subscription.unsubscribe();
|
|
15699
|
+
localRunSubscription.unsubscribe();
|
|
15638
15700
|
if (ownsStandaloneStore) {
|
|
15639
15701
|
threadStore.setContext(null);
|
|
15640
15702
|
threadStore.stop();
|
|
@@ -15653,6 +15715,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
15653
15715
|
copilotkit.threadEndpoints?.realtimeMetadata,
|
|
15654
15716
|
standaloneRunActivityStore,
|
|
15655
15717
|
isLocalActiveRunActivity,
|
|
15718
|
+
rememberRecentlyLocalRunId,
|
|
15656
15719
|
rememberRecentlyWakeRunId
|
|
15657
15720
|
]);
|
|
15658
15721
|
const waitForActiveRunToSettle = (0, react.useCallback)(async () => {
|
|
@@ -16174,28 +16237,34 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
16174
16237
|
...props,
|
|
16175
16238
|
children
|
|
16176
16239
|
});
|
|
16177
|
-
_CopilotModalHeader.CloseButton = ({ className, ...props }) =>
|
|
16178
|
-
|
|
16179
|
-
|
|
16180
|
-
|
|
16181
|
-
|
|
16182
|
-
|
|
16183
|
-
|
|
16184
|
-
|
|
16185
|
-
|
|
16186
|
-
|
|
16187
|
-
|
|
16188
|
-
|
|
16189
|
-
|
|
16190
|
-
|
|
16191
|
-
|
|
16192
|
-
|
|
16193
|
-
|
|
16194
|
-
|
|
16195
|
-
|
|
16196
|
-
"
|
|
16197
|
-
|
|
16198
|
-
|
|
16240
|
+
_CopilotModalHeader.CloseButton = ({ className, ...props }) => {
|
|
16241
|
+
const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
|
|
16242
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
16243
|
+
type: "button",
|
|
16244
|
+
"data-testid": "copilot-close-button",
|
|
16245
|
+
className: cn("cpk:inline-flex cpk:size-8 cpk:items-center cpk:justify-center cpk:rounded-full cpk:text-muted-foreground cpk:transition cpk:cursor-pointer", "cpk:hover:bg-muted cpk:hover:text-foreground cpk:focus-visible:outline-none cpk:focus-visible:ring-2 cpk:focus-visible:ring-ring", className),
|
|
16246
|
+
"aria-label": labels.modalHeaderCloseButtonLabel,
|
|
16247
|
+
...props,
|
|
16248
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.X, {
|
|
16249
|
+
className: "cpk:h-4 cpk:w-4",
|
|
16250
|
+
"aria-hidden": "true"
|
|
16251
|
+
})
|
|
16252
|
+
});
|
|
16253
|
+
};
|
|
16254
|
+
_CopilotModalHeader.DrawerLauncher = ({ className, ...props }) => {
|
|
16255
|
+
const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
|
|
16256
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
16257
|
+
type: "button",
|
|
16258
|
+
"data-testid": "copilot-threads-drawer-launcher",
|
|
16259
|
+
className: cn("cpk:inline-flex cpk:size-8 cpk:items-center cpk:justify-center cpk:rounded-full cpk:text-muted-foreground cpk:transition cpk:cursor-pointer", "cpk:hover:bg-muted cpk:hover:text-foreground cpk:focus-visible:outline-none cpk:focus-visible:ring-2 cpk:focus-visible:ring-ring", className),
|
|
16260
|
+
"aria-label": labels.modalHeaderThreadsButtonLabel,
|
|
16261
|
+
...props,
|
|
16262
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.PanelLeftOpen, {
|
|
16263
|
+
className: "cpk:h-4 cpk:w-4",
|
|
16264
|
+
"aria-hidden": "true"
|
|
16265
|
+
})
|
|
16266
|
+
});
|
|
16267
|
+
};
|
|
16199
16268
|
})(CopilotModalHeader || (CopilotModalHeader = {}));
|
|
16200
16269
|
CopilotModalHeader.Title.displayName = "CopilotModalHeader.Title";
|
|
16201
16270
|
CopilotModalHeader.CloseButton.displayName = "CopilotModalHeader.CloseButton";
|
|
@@ -16205,6 +16274,10 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
16205
16274
|
//#region src/v2/components/chat/CopilotSidebarView.tsx
|
|
16206
16275
|
const DEFAULT_SIDEBAR_WIDTH = 480;
|
|
16207
16276
|
const SIDEBAR_TRANSITION_MS = 260;
|
|
16277
|
+
/**
|
|
16278
|
+
* The chat in a side panel: a `complementary` region named by
|
|
16279
|
+
* `labels.sidebarLabel`, with a header, the chat view and a toggle button.
|
|
16280
|
+
*/
|
|
16208
16281
|
function CopilotSidebarView({ header, toggleButton, width, defaultOpen = true, position = "right", ...props }) {
|
|
16209
16282
|
const { open, onOpenChange } = useModalOpenControl();
|
|
16210
16283
|
const hasOpenControl = open !== void 0 || onOpenChange !== void 0;
|
|
@@ -16225,7 +16298,8 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
16225
16298
|
});
|
|
16226
16299
|
}
|
|
16227
16300
|
function CopilotSidebarViewInternal({ header, toggleButton, width, position = "right", ...props }) {
|
|
16228
|
-
const
|
|
16301
|
+
const configuration = useCopilotChatConfiguration();
|
|
16302
|
+
const isSidebarOpen = configuration?.isModalOpen ?? false;
|
|
16229
16303
|
const sidebarRef = (0, react.useRef)(null);
|
|
16230
16304
|
const [sidebarWidth, setSidebarWidth] = (0, react.useState)(width ?? DEFAULT_SIDEBAR_WIDTH);
|
|
16231
16305
|
const widthToCss = (w) => {
|
|
@@ -16290,7 +16364,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
16290
16364
|
paddingBottom: "env(safe-area-inset-bottom)"
|
|
16291
16365
|
},
|
|
16292
16366
|
"aria-hidden": !isSidebarOpen,
|
|
16293
|
-
"aria-label":
|
|
16367
|
+
"aria-label": configuration?.labels.sidebarLabel ?? CopilotChatDefaultLabels.sidebarLabel,
|
|
16294
16368
|
role: "complementary",
|
|
16295
16369
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
16296
16370
|
className: "cpk:flex cpk:h-full cpk:w-full cpk:flex-col cpk:overflow-hidden",
|