@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.
Files changed (44) hide show
  1. package/dist/{MarkdownSurfaces-L67964_B.mjs → MarkdownSurfaces-DGpjmPaB.mjs} +11 -2
  2. package/dist/MarkdownSurfaces-DGpjmPaB.mjs.map +1 -0
  3. package/dist/{MarkdownSurfaces-D-OkjUpU.cjs → MarkdownSurfaces-FF5za2kU.cjs} +11 -2
  4. package/dist/MarkdownSurfaces-FF5za2kU.cjs.map +1 -0
  5. package/dist/{copilotkit-BjllYYjw.cjs → copilotkit-BuIuo-Z1.cjs} +165 -100
  6. package/dist/copilotkit-BuIuo-Z1.cjs.map +1 -0
  7. package/dist/{copilotkit-BEcaM4L4.d.mts → copilotkit-C765tOUi.d.mts} +46 -3
  8. package/dist/copilotkit-C765tOUi.d.mts.map +1 -0
  9. package/dist/{copilotkit-fKrKqoiP.mjs → copilotkit-DyxwF9wL.mjs} +165 -100
  10. package/dist/copilotkit-DyxwF9wL.mjs.map +1 -0
  11. package/dist/{copilotkit-D9jIImy9.d.cts → copilotkit-wqaNanhw.d.cts} +46 -3
  12. package/dist/copilotkit-wqaNanhw.d.cts.map +1 -0
  13. package/dist/index.cjs +2 -2
  14. package/dist/index.d.cts +1 -1
  15. package/dist/index.d.mts +1 -1
  16. package/dist/index.mjs +2 -2
  17. package/dist/index.umd.js +12 -3
  18. package/dist/index.umd.js.map +1 -1
  19. package/dist/v2/generative-ui.cjs +1 -1
  20. package/dist/v2/generative-ui.d.cts +54 -54
  21. package/dist/v2/generative-ui.d.mts +54 -54
  22. package/dist/v2/generative-ui.mjs +1 -1
  23. package/dist/v2/headless.cjs +10 -1
  24. package/dist/v2/headless.cjs.map +1 -1
  25. package/dist/v2/headless.d.cts +9 -0
  26. package/dist/v2/headless.d.cts.map +1 -1
  27. package/dist/v2/headless.d.mts +9 -0
  28. package/dist/v2/headless.d.mts.map +1 -1
  29. package/dist/v2/headless.mjs +10 -1
  30. package/dist/v2/headless.mjs.map +1 -1
  31. package/dist/v2/index.cjs +2 -2
  32. package/dist/v2/index.css +1 -1
  33. package/dist/v2/index.d.cts +1 -1
  34. package/dist/v2/index.d.mts +1 -1
  35. package/dist/v2/index.mjs +2 -2
  36. package/dist/v2/index.umd.js +173 -99
  37. package/dist/v2/index.umd.js.map +1 -1
  38. package/package.json +8 -8
  39. package/dist/MarkdownSurfaces-D-OkjUpU.cjs.map +0 -1
  40. package/dist/MarkdownSurfaces-L67964_B.mjs.map +0 -1
  41. package/dist/copilotkit-BEcaM4L4.d.mts.map +0 -1
  42. package/dist/copilotkit-BjllYYjw.cjs.map +0 -1
  43. package/dist/copilotkit-D9jIImy9.d.cts.map +0 -1
  44. package/dist/copilotkit-fKrKqoiP.mjs.map +0 -1
@@ -1,4 +1,4 @@
1
- const require_MarkdownSurfaces = require('./MarkdownSurfaces-D-OkjUpU.cjs');
1
+ const require_MarkdownSurfaces = require('./MarkdownSurfaces-FF5za2kU.cjs');
2
2
  let react = require("react");
3
3
  react = require_MarkdownSurfaces.__toESM(react);
4
4
  let _copilotkit_core = require("@copilotkit/core");
@@ -924,13 +924,13 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
924
924
  const slashMenu = slashMenuVisible ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
925
925
  "data-testid": "copilot-slash-menu",
926
926
  role: "listbox",
927
- "aria-label": "Slash commands",
927
+ "aria-label": labels.chatInputSlashMenuLabel,
928
928
  ref: slashMenuRef,
929
929
  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]",
930
930
  style: { maxHeight: `${SLASH_MENU_MAX_VISIBLE_ITEMS * SLASH_MENU_ITEM_HEIGHT_PX}px` },
931
931
  children: filteredCommands.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
932
932
  className: "cpk:px-3 cpk:py-2 cpk:text-sm cpk:text-muted-foreground",
933
- children: "No commands found"
933
+ children: labels.chatInputSlashMenuEmptyText
934
934
  }) : filteredCommands.map((item, index) => {
935
935
  const isActive = index === slashHighlightIndex;
936
936
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
@@ -1325,7 +1325,7 @@ function useRenderToolCall() {
1325
1325
 
1326
1326
  //#endregion
1327
1327
  //#region package.json
1328
- var version = "1.81.0";
1328
+ var version = "1.83.0";
1329
1329
 
1330
1330
  //#endregion
1331
1331
  //#region src/v2/components/CopilotKitInspector.tsx
@@ -2910,7 +2910,7 @@ function A2UIBuiltInToolCallRenderer() {
2910
2910
  */
2911
2911
  function A2UICatalogContext({ catalog, includeSchema }) {
2912
2912
  const { copilotkit } = (0, _copilotkit_react_core_v2_context.useCopilotKit)();
2913
- const capabilitiesValue = (0, react.useMemo)(() => (0, _copilotkit_a2ui_renderer.buildCatalogContextValue)(catalog), [catalog]);
2913
+ const capabilitiesValue = (0, react.useMemo)(() => (0, _copilotkit_a2ui_renderer.buildCatalogContextValue)(catalog, { includeSchema: includeSchema !== false }), [catalog, includeSchema]);
2914
2914
  const schemaValue = (0, react.useMemo)(() => includeSchema !== false ? JSON.stringify((0, _copilotkit_a2ui_renderer.extractCatalogComponentSchemas)(catalog)) : null, [catalog, includeSchema]);
2915
2915
  const a2uiAgentsKey = copilotkit?.a2uiAgents?.join(",");
2916
2916
  (0, react.useLayoutEffect)(() => {
@@ -6004,14 +6004,14 @@ function ToolCallRow({ name, parameters, result, status, appearance, className,
6004
6004
  const line = appearance === "line";
6005
6005
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6006
6006
  "data-copilotkit": true,
6007
- className: (0, tailwind_merge.twMerge)(!line && "cpk:border-t cpk:border-border", className),
6007
+ className: (0, tailwind_merge.twMerge)(appearance === "card" && "cpk:border-t cpk:border-border", className),
6008
6008
  ...props,
6009
6009
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
6010
6010
  type: "button",
6011
6011
  "aria-expanded": open,
6012
6012
  "aria-controls": detailsId,
6013
6013
  onClick: () => setOpen((value) => !value),
6014
- 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"),
6014
+ 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"),
6015
6015
  children: [
6016
6016
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StatusIcon, { status }),
6017
6017
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -6051,7 +6051,8 @@ function ToolCallRow({ name, parameters, result, status, appearance, className,
6051
6051
  *
6052
6052
  * Each call is drawn by its registered renderer. CopilotKit's built-in card
6053
6053
  * (`useDefaultRenderTool`) draws a compact row inside the card and line
6054
- * appearances; a custom wildcard renderer draws whatever it draws.
6054
+ * appearances and an open stack; a custom wildcard renderer draws whatever it
6055
+ * draws.
6055
6056
  */
6056
6057
  function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isActive = false, className, ...props }) {
6057
6058
  const [open, setOpen] = (0, react.useState)(false);
@@ -6130,11 +6131,6 @@ function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isAc
6130
6131
  });
6131
6132
  }
6132
6133
  if (appearance === "stack") {
6133
- if (calls.length === 1) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
6134
- ...groupProps,
6135
- className: (0, tailwind_merge.twMerge)("cpk:py-1", className),
6136
- children: renderCall(latest)
6137
- });
6138
6134
  const behind = open ? 0 : Math.min(calls.length - 1, 2);
6139
6135
  const layer = "cpk:rounded-xl cpk:border cpk:border-border cpk:bg-card cpk:text-card-foreground";
6140
6136
  const latestStatus = entryStatus(latest, isActive);
@@ -6148,68 +6144,88 @@ function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isAc
6148
6144
  },
6149
6145
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6150
6146
  className: "cpk:relative cpk:isolate",
6151
- children: [Array.from({ length: behind }, (_, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
6152
- "aria-hidden": "true",
6153
- className: (0, tailwind_merge.twMerge)(layer, "cpk:absolute cpk:inset-0"),
6154
- style: {
6155
- transform: `translateY(${(index + 1) * 6}px) scaleX(${1 - (index + 1) * .045})`,
6156
- zIndex: -1 - index,
6157
- opacity: 1 - (index + 1) * .28
6158
- }
6159
- }, index)), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
6160
- type: "button",
6161
- "aria-expanded": open,
6162
- "aria-controls": open ? bodyId : void 0,
6163
- onClick: () => setOpen((value) => !value),
6164
- 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 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")),
6165
- children: open ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
6166
- pluralize(calls.length, "tool call"),
6167
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FailedCount, { calls }),
6168
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chevron, {
6169
- open: true,
6170
- className: "cpk:-rotate-90"
6171
- }),
6172
- "Collapse"
6173
- ] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
6174
- 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",
6175
- children: [
6176
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StatusIcon, { status: latestStatus }),
6177
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6178
- className: (0, tailwind_merge.twMerge)("cpk:shrink-0 cpk:font-mono cpk:font-medium cpk:text-foreground", latestStatus === "running" && "cpk-shimmer"),
6179
- children: latest.toolCall.function.name
6180
- }),
6181
- latestPreview && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6182
- className: "cpk:min-w-0 cpk:truncate cpk:font-mono cpk:text-muted-foreground",
6183
- children: latestPreview
6184
- })
6185
- ]
6186
- }, latest.toolCall.id), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
6187
- className: "cpk:ml-2 cpk:inline-flex cpk:shrink-0 cpk:items-center cpk:gap-2 cpk:text-xs cpk:text-muted-foreground",
6188
- children: [
6147
+ children: [
6148
+ Array.from({ length: behind }, (_, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
6149
+ "aria-hidden": "true",
6150
+ className: (0, tailwind_merge.twMerge)(layer, "cpk:absolute cpk:inset-0"),
6151
+ style: {
6152
+ transform: `translateY(${(index + 1) * 6}px) scaleX(${1 - (index + 1) * .045})`,
6153
+ zIndex: -1 - index,
6154
+ opacity: 1 - (index + 1) * .28
6155
+ }
6156
+ }, index)),
6157
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
6158
+ type: "button",
6159
+ "aria-expanded": open,
6160
+ "aria-controls": open ? bodyId : void 0,
6161
+ onClick: () => setOpen((value) => !value),
6162
+ 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")),
6163
+ children: open ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
6164
+ pluralize(calls.length, "tool call"),
6189
6165
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FailedCount, { calls }),
6190
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6191
- className: "cpk:tabular-nums",
6192
- children: pluralize(calls.length, "call")
6193
- }),
6194
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chevron, {
6195
- open: false,
6196
- className: "cpk:rotate-90"
6166
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
6167
+ className: "cpk:ml-auto cpk:inline-flex cpk:items-center cpk:gap-1",
6168
+ children: ["Collapse", /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chevron, {
6169
+ open: true,
6170
+ className: "cpk:-rotate-90"
6171
+ })]
6197
6172
  })
6198
- ]
6199
- })] })
6200
- })]
6173
+ ] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
6174
+ 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",
6175
+ children: [
6176
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StatusIcon, { status: latestStatus }),
6177
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6178
+ className: (0, tailwind_merge.twMerge)("cpk:shrink-0 cpk:font-mono cpk:font-medium cpk:text-foreground", latestStatus === "running" && "cpk-shimmer"),
6179
+ children: latest.toolCall.function.name
6180
+ }),
6181
+ latestPreview && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6182
+ className: "cpk:min-w-0 cpk:truncate cpk:font-mono cpk:text-muted-foreground",
6183
+ children: latestPreview
6184
+ }),
6185
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6186
+ className: "cpk:sr-only",
6187
+ children: statusLabels[latestStatus]
6188
+ })
6189
+ ]
6190
+ }, latest.toolCall.id), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
6191
+ className: "cpk:ml-2 cpk:inline-flex cpk:shrink-0 cpk:items-center cpk:gap-2 cpk:text-xs cpk:text-muted-foreground",
6192
+ children: [
6193
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FailedCount, { calls }),
6194
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6195
+ className: "cpk:tabular-nums",
6196
+ children: pluralize(calls.length, "call")
6197
+ }),
6198
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chevron, {
6199
+ open: false,
6200
+ className: "cpk:rotate-90"
6201
+ })
6202
+ ]
6203
+ })] })
6204
+ }),
6205
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6206
+ "aria-live": "polite",
6207
+ className: "cpk:sr-only",
6208
+ children: open ? "" : `${latest.toolCall.function.name}: ${statusLabels[latestStatus]}`
6209
+ })
6210
+ ]
6201
6211
  }), open && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
6202
6212
  id: bodyId,
6203
- className: "cpk:[&>*]:animate-[cpk-stack-fan_300ms_cubic-bezier(0.16,1,0.3,1)_both] cpk:motion-reduce:[&>*]:animate-none",
6204
- children: calls.map((call) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.default.Fragment, { children: renderCall(call) }, call.toolCall.id))
6213
+ className: "cpk:grid cpk:gap-1.5",
6214
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolCallGroupContext.Provider, {
6215
+ value: {
6216
+ appearance: "stack",
6217
+ failedIds,
6218
+ active: isActive
6219
+ },
6220
+ children: calls.map((call, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
6221
+ 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"),
6222
+ style: { animationDelay: `${index * 30}ms` },
6223
+ children: renderCall(call)
6224
+ }, call.toolCall.id))
6225
+ })
6205
6226
  })]
6206
6227
  });
6207
6228
  }
6208
- if (calls.length === 1) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
6209
- ...groupProps,
6210
- className: (0, tailwind_merge.twMerge)("cpk:py-1", className),
6211
- children: renderCall(latest)
6212
- });
6213
6229
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6214
6230
  ...groupProps,
6215
6231
  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),
@@ -6232,7 +6248,7 @@ function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isAc
6232
6248
  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",
6233
6249
  children: [status === "failed" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FailedCount, { calls }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6234
6250
  className: "cpk:tabular-nums",
6235
- children: status === "running" ? `${done} done` : statusLabels[status]
6251
+ children: status !== "running" ? statusLabels[status] : done > 0 && `${done} done`
6236
6252
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chevron, { open })]
6237
6253
  })
6238
6254
  ]
@@ -9343,7 +9359,13 @@ var CopilotChatAssistantMessage_default = CopilotChatAssistantMessage;
9343
9359
 
9344
9360
  //#endregion
9345
9361
  //#region src/v2/components/chat/Lightbox.tsx
9362
+ /**
9363
+ * A full-screen preview portalled to `document.body`. It closes on Escape, a
9364
+ * click on the backdrop, or its close button, which is named by
9365
+ * `labels.attachmentPreviewCloseButtonLabel`.
9366
+ */
9346
9367
  function Lightbox({ onClose, children }) {
9368
+ const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? require_MarkdownSurfaces.CopilotChatDefaultLabels;
9347
9369
  (0, react.useEffect)(() => {
9348
9370
  const handleKey = (e) => {
9349
9371
  if (e.key === "Escape") onClose();
@@ -9358,7 +9380,7 @@ function Lightbox({ onClose, children }) {
9358
9380
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
9359
9381
  onClick: onClose,
9360
9382
  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",
9361
- "aria-label": "Close preview",
9383
+ "aria-label": labels.attachmentPreviewCloseButtonLabel,
9362
9384
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.X, { className: "cpk:w-5 cpk:h-5" })
9363
9385
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
9364
9386
  onClick: (e) => e.stopPropagation(),
@@ -9711,7 +9733,14 @@ function formatDuration$1(seconds) {
9711
9733
  if (secs === 0) return `${mins} minute${mins > 1 ? "s" : ""}`;
9712
9734
  return `${mins}m ${secs}s`;
9713
9735
  }
9736
+ /**
9737
+ * A reasoning message as a collapsible block. While the model reasons it is
9738
+ * open and the header shows `labels.reasoningMessageThinkingLabel`; when
9739
+ * streaming ends it collapses and the header reads "Thought for …". The
9740
+ * `header` slot also receives `elapsedSeconds`.
9741
+ */
9714
9742
  function CopilotChatReasoningMessage({ message, messages, isRunning, isLatest: isLatestProp, header, contentView, toggle, children, className, ...props }) {
9743
+ const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? require_MarkdownSurfaces.CopilotChatDefaultLabels;
9715
9744
  const isLatest = isLatestProp ?? messages?.[messages.length - 1]?.id === message.id;
9716
9745
  const isStreaming = !!(isRunning && isLatest);
9717
9746
  const hasContent = !!(message.content && message.content.length > 0);
@@ -9741,12 +9770,13 @@ function CopilotChatReasoningMessage({ message, messages, isRunning, isLatest: i
9741
9770
  userToggledRef.current = true;
9742
9771
  setIsOpen((prev) => !prev);
9743
9772
  } : void 0;
9744
- const label = isStreaming ? "Thinking…" : `Thought for ${formatDuration$1(elapsed)}`;
9773
+ const label = isStreaming ? labels.reasoningMessageThinkingLabel : `Thought for ${formatDuration$1(elapsed)}`;
9745
9774
  const boundHeader = renderSlot(header, CopilotChatReasoningMessage.Header, {
9746
9775
  isOpen,
9747
9776
  label,
9748
9777
  hasContent,
9749
9778
  isStreaming,
9779
+ elapsedSeconds: elapsed,
9750
9780
  onClick: handleToggle
9751
9781
  });
9752
9782
  const boundContent = renderSlot(contentView, CopilotChatReasoningMessage.Content, {
@@ -9778,7 +9808,7 @@ function CopilotChatReasoningMessage({ message, messages, isRunning, isLatest: i
9778
9808
  });
9779
9809
  }
9780
9810
  (function(_CopilotChatReasoningMessage) {
9781
- _CopilotChatReasoningMessage.Header = ({ isOpen, label = "Thoughts", hasContent, isStreaming, className, children: headerChildren, ...headerProps }) => {
9811
+ _CopilotChatReasoningMessage.Header = ({ isOpen, label = "Thoughts", hasContent, isStreaming, elapsedSeconds: _elapsedSeconds, className, children: headerChildren, ...headerProps }) => {
9782
9812
  const isExpandable = !!hasContent;
9783
9813
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
9784
9814
  type: "button",
@@ -11054,7 +11084,12 @@ CopilotChatMessageView.Cursor = function Cursor({ className, ...props }) {
11054
11084
 
11055
11085
  //#endregion
11056
11086
  //#region src/v2/components/chat/CopilotChatAttachmentQueue.tsx
11087
+ /**
11088
+ * The attachments queued in the composer, each with a preview and a remove
11089
+ * button named by `labels.attachmentRemoveButtonLabel`.
11090
+ */
11057
11091
  const CopilotChatAttachmentQueue = ({ attachments, onRemoveAttachment, className }) => {
11092
+ const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? require_MarkdownSurfaces.CopilotChatDefaultLabels;
11058
11093
  if (attachments.length === 0) return null;
11059
11094
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
11060
11095
  "data-testid": "copilot-attachment-queue",
@@ -11069,7 +11104,7 @@ const CopilotChatAttachmentQueue = ({ attachments, onRemoveAttachment, className
11069
11104
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
11070
11105
  onClick: () => onRemoveAttachment(attachment.id),
11071
11106
  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"),
11072
- "aria-label": "Remove attachment",
11107
+ "aria-label": labels.attachmentRemoveButtonLabel,
11073
11108
  children: "✕"
11074
11109
  })
11075
11110
  ]
@@ -11125,7 +11160,13 @@ function AudioPreview({ attachment }) {
11125
11160
  })]
11126
11161
  });
11127
11162
  }
11163
+ /**
11164
+ * A video thumbnail with a play button, named by
11165
+ * `labels.attachmentPlayVideoButtonLabel`, that opens the full player in a
11166
+ * lightbox.
11167
+ */
11128
11168
  function VideoPreview({ attachment }) {
11169
+ const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? require_MarkdownSurfaces.CopilotChatDefaultLabels;
11129
11170
  const src = (0, _copilotkit_shared.getSourceUrl)(attachment.source);
11130
11171
  const { thumbnailRef, vtName, open, openLightbox, closeLightbox } = useLightbox();
11131
11172
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
@@ -11146,7 +11187,7 @@ function VideoPreview({ attachment }) {
11146
11187
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
11147
11188
  onClick: openLightbox,
11148
11189
  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",
11149
- "aria-label": "Play video",
11190
+ "aria-label": labels.attachmentPlayVideoButtonLabel,
11150
11191
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
11151
11192
  className: "cpk:w-8 cpk:h-8 cpk:rounded-full cpk:bg-black/60 cpk:flex cpk:items-center cpk:justify-center",
11152
11193
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Play, { className: "cpk:w-4 cpk:h-4 cpk:text-white cpk:ml-0.5" })
@@ -12233,6 +12274,7 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
12233
12274
  const pendingRunActivityReconnectRef = (0, react.useRef)(false);
12234
12275
  const runActivityReconnectGenerationRef = (0, react.useRef)(0);
12235
12276
  const activeLocalRunIdsRef = (0, react.useRef)(/* @__PURE__ */ new Set());
12277
+ const observedLocalRunIdsRef = (0, react.useRef)(/* @__PURE__ */ new Set());
12236
12278
  const recentlyLocalRunIdsRef = (0, react.useRef)(/* @__PURE__ */ new Map());
12237
12279
  const activeWakeRunIdsRef = (0, react.useRef)(/* @__PURE__ */ new Set());
12238
12280
  const recentlyWakeRunIdsRef = (0, react.useRef)(/* @__PURE__ */ new Map());
@@ -12264,7 +12306,7 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
12264
12306
  }, []);
12265
12307
  const isLocalActiveRunActivity = (0, react.useCallback)((notification) => {
12266
12308
  if (notification.agentId && notification.agentId !== resolvedAgentId) return false;
12267
- if (!notification.runId || !activeLocalRunIdsRef.current.has(notification.runId) && !recentlyLocalRunIdsRef.current.has(notification.runId)) return false;
12309
+ if (!notification.runId || !activeLocalRunIdsRef.current.has(notification.runId) && !observedLocalRunIdsRef.current.has(notification.runId) && !recentlyLocalRunIdsRef.current.has(notification.runId)) return false;
12268
12310
  const eventType = notification.eventType.toUpperCase();
12269
12311
  return eventType === "RUN_STARTED" || eventType === "RUN_FINISHED" || eventType === "RUN_ERROR";
12270
12312
  }, [resolvedAgentId]);
@@ -12463,6 +12505,16 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
12463
12505
  pendingWakeRunIdRef.current = notification.runId;
12464
12506
  startRunActivityReconnectRef.current?.(generation);
12465
12507
  });
12508
+ const observedLocalRunIds = observedLocalRunIdsRef.current;
12509
+ const localRunSubscription = agent.subscribe({
12510
+ onRunInitialized: ({ input }) => {
12511
+ observedLocalRunIds.add(input.runId);
12512
+ },
12513
+ onRunFinalized: ({ input }) => {
12514
+ observedLocalRunIds.delete(input.runId);
12515
+ rememberRecentlyLocalRunId(input.runId);
12516
+ }
12517
+ });
12466
12518
  return () => {
12467
12519
  detached = true;
12468
12520
  pendingRunActivityReconnectRef.current = false;
@@ -12475,6 +12527,7 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
12475
12527
  if (wakeReconnectActive) agent.detachActiveRun().catch(() => {});
12476
12528
  activeWakeRunIdsRef.current.clear();
12477
12529
  subscription.unsubscribe();
12530
+ localRunSubscription.unsubscribe();
12478
12531
  if (ownsStandaloneStore) {
12479
12532
  threadStore.setContext(null);
12480
12533
  threadStore.stop();
@@ -12493,6 +12546,7 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
12493
12546
  copilotkit.threadEndpoints?.realtimeMetadata,
12494
12547
  standaloneRunActivityStore,
12495
12548
  isLocalActiveRunActivity,
12549
+ rememberRecentlyLocalRunId,
12496
12550
  rememberRecentlyWakeRunId
12497
12551
  ]);
12498
12552
  const waitForActiveRunToSettle = (0, react.useCallback)(async () => {
@@ -13014,28 +13068,34 @@ CopilotModalHeader.displayName = "CopilotModalHeader";
13014
13068
  ...props,
13015
13069
  children
13016
13070
  });
13017
- _CopilotModalHeader.CloseButton = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
13018
- type: "button",
13019
- "data-testid": "copilot-close-button",
13020
- 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),
13021
- "aria-label": "Close",
13022
- ...props,
13023
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.X, {
13024
- className: "cpk:h-4 cpk:w-4",
13025
- "aria-hidden": "true"
13026
- })
13027
- });
13028
- _CopilotModalHeader.DrawerLauncher = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
13029
- type: "button",
13030
- "data-testid": "copilot-threads-drawer-launcher",
13031
- 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),
13032
- "aria-label": "Open threads",
13033
- ...props,
13034
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.PanelLeftOpen, {
13035
- className: "cpk:h-4 cpk:w-4",
13036
- "aria-hidden": "true"
13037
- })
13038
- });
13071
+ _CopilotModalHeader.CloseButton = ({ className, ...props }) => {
13072
+ const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? require_MarkdownSurfaces.CopilotChatDefaultLabels;
13073
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
13074
+ type: "button",
13075
+ "data-testid": "copilot-close-button",
13076
+ 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),
13077
+ "aria-label": labels.modalHeaderCloseButtonLabel,
13078
+ ...props,
13079
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.X, {
13080
+ className: "cpk:h-4 cpk:w-4",
13081
+ "aria-hidden": "true"
13082
+ })
13083
+ });
13084
+ };
13085
+ _CopilotModalHeader.DrawerLauncher = ({ className, ...props }) => {
13086
+ const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? require_MarkdownSurfaces.CopilotChatDefaultLabels;
13087
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
13088
+ type: "button",
13089
+ "data-testid": "copilot-threads-drawer-launcher",
13090
+ 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),
13091
+ "aria-label": labels.modalHeaderThreadsButtonLabel,
13092
+ ...props,
13093
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.PanelLeftOpen, {
13094
+ className: "cpk:h-4 cpk:w-4",
13095
+ "aria-hidden": "true"
13096
+ })
13097
+ });
13098
+ };
13039
13099
  })(CopilotModalHeader || (CopilotModalHeader = {}));
13040
13100
  CopilotModalHeader.Title.displayName = "CopilotModalHeader.Title";
13041
13101
  CopilotModalHeader.CloseButton.displayName = "CopilotModalHeader.CloseButton";
@@ -13045,6 +13105,10 @@ CopilotModalHeader.DrawerLauncher.displayName = "CopilotModalHeader.DrawerLaunch
13045
13105
  //#region src/v2/components/chat/CopilotSidebarView.tsx
13046
13106
  const DEFAULT_SIDEBAR_WIDTH = 480;
13047
13107
  const SIDEBAR_TRANSITION_MS = 260;
13108
+ /**
13109
+ * The chat in a side panel: a `complementary` region named by
13110
+ * `labels.sidebarLabel`, with a header, the chat view and a toggle button.
13111
+ */
13048
13112
  function CopilotSidebarView({ header, toggleButton, width, defaultOpen = true, position = "right", ...props }) {
13049
13113
  const { open, onOpenChange } = useModalOpenControl();
13050
13114
  const hasOpenControl = open !== void 0 || onOpenChange !== void 0;
@@ -13065,7 +13129,8 @@ function CopilotSidebarView({ header, toggleButton, width, defaultOpen = true, p
13065
13129
  });
13066
13130
  }
13067
13131
  function CopilotSidebarViewInternal({ header, toggleButton, width, position = "right", ...props }) {
13068
- const isSidebarOpen = require_MarkdownSurfaces.useCopilotChatConfiguration()?.isModalOpen ?? false;
13132
+ const configuration = require_MarkdownSurfaces.useCopilotChatConfiguration();
13133
+ const isSidebarOpen = configuration?.isModalOpen ?? false;
13069
13134
  const sidebarRef = (0, react.useRef)(null);
13070
13135
  const [sidebarWidth, setSidebarWidth] = (0, react.useState)(width ?? DEFAULT_SIDEBAR_WIDTH);
13071
13136
  const widthToCss = (w) => {
@@ -13130,7 +13195,7 @@ function CopilotSidebarViewInternal({ header, toggleButton, width, position = "r
13130
13195
  paddingBottom: "env(safe-area-inset-bottom)"
13131
13196
  },
13132
13197
  "aria-hidden": !isSidebarOpen,
13133
- "aria-label": "Copilot chat sidebar",
13198
+ "aria-label": configuration?.labels.sidebarLabel ?? require_MarkdownSurfaces.CopilotChatDefaultLabels.sidebarLabel,
13134
13199
  role: "complementary",
13135
13200
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
13136
13201
  className: "cpk:flex cpk:h-full cpk:w-full cpk:flex-col cpk:overflow-hidden",
@@ -16463,4 +16528,4 @@ Object.defineProperty(exports, 'useToast', {
16463
16528
  return useToast;
16464
16529
  }
16465
16530
  });
16466
- //# sourceMappingURL=copilotkit-BjllYYjw.cjs.map
16531
+ //# sourceMappingURL=copilotkit-BuIuo-Z1.cjs.map