@zero-library/chat-copilot 3.1.7 → 3.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -854,8 +854,8 @@ var ChatSender_default = React10.forwardRef(
854
854
  const isFocusedRef = React10.useRef(false);
855
855
  const commandConfigRef = React10.useRef(commandConfig);
856
856
  commandConfigRef.current = commandConfig;
857
- const inputComponent = React10.useCallback(
858
- (inputProps) => /* @__PURE__ */ jsxRuntime.jsx(ChatInput_default, { ...inputProps, commandConfig: commandConfigRef.current }),
857
+ const inputComponent = React10.useMemo(
858
+ () => React10.forwardRef((inputProps, ref2) => /* @__PURE__ */ jsxRuntime.jsx(ChatInput_default, { ...inputProps, ref: ref2, commandConfig: commandConfigRef.current })),
859
859
  []
860
860
  );
861
861
  React10.useEffect(() => {
@@ -3909,6 +3909,15 @@ function extractSurfaceId2(command) {
3909
3909
  function getA2uiRuntimeCommands(state) {
3910
3910
  return [...state.serverCommands, ...state.localCommands];
3911
3911
  }
3912
+ function sanitizeA2uiCommands(commands) {
3913
+ return commands.map((cmd) => {
3914
+ if (!cmd || typeof cmd !== "object" || !cmd.updateDataModel) return cmd;
3915
+ const { path } = cmd.updateDataModel;
3916
+ if (typeof path === "string" && path.trim()) return cmd;
3917
+ const { updateDataModel: _, ...rest } = cmd;
3918
+ return rest;
3919
+ });
3920
+ }
3912
3921
  function diffConversationMessages(messages, prevCursors) {
3913
3922
  if (messages.length < prevCursors.length) {
3914
3923
  return { shouldReplayAll: true, nextCursors: [], pendingItems: [] };
@@ -4106,7 +4115,7 @@ function selectA2uiRuntimeView(state, dismissedSurfaceIds) {
4106
4115
  const mergedDismissedSurfaceIds = Array.from(
4107
4116
  new Set([...dismissedSurfaceIds || [], ...state.optimisticallyDismissedSurfaceIds].filter((surfaceId) => surfaceId?.trim?.()))
4108
4117
  );
4109
- const commands = getA2uiRuntimeCommands(state);
4118
+ const commands = sanitizeA2uiCommands(getA2uiRuntimeCommands(state));
4110
4119
  const visibleSurfaceIds = resolveVisibleSurfaceIds(commands, mergedDismissedSurfaceIds);
4111
4120
  const anchoredSurfaceIdsByMessageIndex = {};
4112
4121
  visibleSurfaceIds.forEach((surfaceId) => {