@copilotkit/vue 2.0.0-rc.19 → 2.0.0-rc.20

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 (73) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.mjs +2 -2
  3. package/dist/use-render-activity-message-CsWYyd6r.cjs +91 -0
  4. package/dist/use-render-activity-message-CsWYyd6r.cjs.map +1 -0
  5. package/dist/{use-render-activity-message-g7xEf4ep.js → use-render-activity-message-DntKKNdd.js} +6354 -6747
  6. package/dist/use-render-activity-message-DntKKNdd.js.map +1 -0
  7. package/dist/v2/components/InlineFeatureWarning.vue.d.ts.map +1 -1
  8. package/dist/v2/components/LicenseWarningBanner.vue.d.ts +2 -2
  9. package/dist/v2/components/LicenseWarningBanner.vue.d.ts.map +1 -1
  10. package/dist/v2/components/chat/CopilotChat.vue.d.ts +1 -1
  11. package/dist/v2/components/chat/CopilotChatAssistantMessage.vue.d.ts.map +1 -1
  12. package/dist/v2/components/chat/CopilotChatFeedbackCommentPopover.vue.d.ts +1 -1
  13. package/dist/v2/components/chat/CopilotChatFeedbackCommentPopover.vue.d.ts.map +1 -1
  14. package/dist/v2/components/chat/CopilotChatInspectorButton.vue.d.ts.map +1 -1
  15. package/dist/v2/components/chat/CopilotChatReasoningMessage.vue.d.ts.map +1 -1
  16. package/dist/v2/components/chat/CopilotChatUserMessage.vue.d.ts.map +1 -1
  17. package/dist/v2/components/chat/CopilotChatView.vue.d.ts +1 -1
  18. package/dist/v2/components/chat/CopilotChatWorkSummary.vue.d.ts.map +1 -1
  19. package/dist/v2/components/chat/CopilotModalHeader.vue.d.ts.map +1 -1
  20. package/dist/v2/components/chat/CopilotPopup.vue.d.ts +1 -1
  21. package/dist/v2/components/chat/CopilotPopupView.vue.d.ts +1 -1
  22. package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts +1 -1
  23. package/dist/v2/components/chat/CopilotSidebar.vue.d.ts +1 -1
  24. package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts +1 -1
  25. package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts +1 -1
  26. package/dist/v2/components/chat/index.d.ts +12 -12
  27. package/dist/v2/components/chat/inspector-shortcuts.d.ts +2 -1
  28. package/dist/v2/components/chat/inspector-shortcuts.d.ts.map +1 -1
  29. package/dist/v2/components/chat/message-feedback.d.ts +18 -49
  30. package/dist/v2/components/chat/message-feedback.d.ts.map +1 -1
  31. package/dist/v2/components/chat/normalize-auto-scroll.d.ts +2 -2
  32. package/dist/v2/components/chat/normalize-auto-scroll.d.ts.map +1 -1
  33. package/dist/v2/components/chat/use-copy-feedback.d.ts +11 -0
  34. package/dist/v2/components/chat/use-copy-feedback.d.ts.map +1 -0
  35. package/dist/v2/hooks/use-keyboard-height.d.ts +1 -1
  36. package/dist/v2/hooks/use-keyboard-height.d.ts.map +1 -1
  37. package/dist/v2/hooks/use-pin-to-send.d.ts +4 -12
  38. package/dist/v2/hooks/use-pin-to-send.d.ts.map +1 -1
  39. package/dist/v2/index.cjs +1 -1
  40. package/dist/v2/index.mjs +1 -1
  41. package/dist/v2/lib/is-mobile-viewport.d.ts +1 -14
  42. package/dist/v2/lib/is-mobile-viewport.d.ts.map +1 -1
  43. package/dist/v2/lib/shallow-stable.d.ts.map +1 -1
  44. package/package.json +8 -8
  45. package/src/v2/components/InlineFeatureWarning.vue +20 -21
  46. package/src/v2/components/LicenseWarningBanner.vue +25 -149
  47. package/src/v2/components/__tests__/LicenseWarningBanner.test.ts +48 -8
  48. package/src/v2/components/chat/CopilotChatAssistantMessage.vue +19 -43
  49. package/src/v2/components/chat/CopilotChatFeedbackCommentPopover.vue +2 -2
  50. package/src/v2/components/chat/CopilotChatInspectorButton.vue +45 -108
  51. package/src/v2/components/chat/CopilotChatReasoningMessage.vue +2 -28
  52. package/src/v2/components/chat/CopilotChatUserMessage.vue +24 -112
  53. package/src/v2/components/chat/CopilotChatWorkSummary.vue +23 -59
  54. package/src/v2/components/chat/CopilotModalHeader.vue +11 -23
  55. package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.learningFeedback.test.ts +5 -5
  56. package/src/v2/components/chat/inspector-shortcuts.ts +10 -16
  57. package/src/v2/components/chat/message-feedback.ts +62 -197
  58. package/src/v2/components/chat/normalize-auto-scroll.ts +3 -17
  59. package/src/v2/components/chat/use-copy-feedback.ts +21 -0
  60. package/src/v2/hooks/use-keyboard-height.ts +17 -40
  61. package/src/v2/hooks/use-pin-to-send.ts +15 -99
  62. package/src/v2/lib/__tests__/shallow-stable.test.ts +54 -0
  63. package/src/v2/lib/is-mobile-viewport.ts +5 -23
  64. package/src/v2/lib/shallow-stable.ts +2 -16
  65. package/dist/use-render-activity-message-IH90zF01.cjs +0 -92
  66. package/dist/use-render-activity-message-IH90zF01.cjs.map +0 -1
  67. package/dist/use-render-activity-message-g7xEf4ep.js.map +0 -1
  68. package/dist/v2/lib/message-feedback.d.ts +0 -33
  69. package/dist/v2/lib/message-feedback.d.ts.map +0 -1
  70. package/src/v2/components/chat/__tests__/normalize-auto-scroll.test.ts +0 -39
  71. package/src/v2/lib/__tests__/is-mobile-viewport.test.ts +0 -48
  72. package/src/v2/lib/__tests__/message-feedback.test.ts +0 -152
  73. package/src/v2/lib/message-feedback.ts +0 -120
@@ -0,0 +1,54 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { nextTick, shallowRef } from "vue";
3
+ import { useShallowStableRef } from "../shallow-stable";
4
+
5
+ /** A stable ref over a source the test replaces with `set(next)`. */
6
+ function stableOver<T>(initial: T) {
7
+ const source = shallowRef(initial);
8
+ const stable = useShallowStableRef(source);
9
+ const set = async (next: T) => {
10
+ source.value = next;
11
+ await nextTick();
12
+ };
13
+ return { stable, set };
14
+ }
15
+
16
+ describe("useShallowStableRef", () => {
17
+ it("keeps the reference for a shallowly equal plain object", async () => {
18
+ const { stable, set } = stableOver({ a: 1 });
19
+ const first = stable.value;
20
+
21
+ await set({ a: 1 });
22
+
23
+ expect(stable.value).toBe(first);
24
+ });
25
+
26
+ it("updates the reference when a value changes", async () => {
27
+ const { stable, set } = stableOver({ a: 1 });
28
+
29
+ await set({ a: 2 });
30
+
31
+ expect(stable.value).toEqual({ a: 2 });
32
+ });
33
+
34
+ it("updates the reference when a different key holds undefined", async () => {
35
+ const { stable, set } = stableOver<{ a?: number; b?: number }>({
36
+ a: undefined,
37
+ });
38
+ const first = stable.value;
39
+
40
+ await set({ b: undefined });
41
+
42
+ expect(stable.value).not.toBe(first);
43
+ expect(stable.value).toEqual({ b: undefined });
44
+ });
45
+
46
+ it("compares arrays by reference", async () => {
47
+ const { stable, set } = stableOver([1, 2]);
48
+ const first = stable.value;
49
+
50
+ await set([1, 2]);
51
+
52
+ expect(stable.value).not.toBe(first);
53
+ });
54
+ });
@@ -1,23 +1,5 @@
1
- /**
2
- * Media query for the mobile breakpoint, shared so the string literal isn't
3
- * duplicated across call sites within this package (e.g. `CopilotModalHeader`,
4
- * which needs a live `matchMedia` change-listener and so can't call
5
- * `isMobileViewport()` directly).
6
- */
7
- export const MOBILE_MAX_WIDTH_QUERY = "(max-width: 767px)";
8
-
9
- /**
10
- * Reports whether the viewport is in the mobile range (`<768px`), where the
11
- * drawer and chat modal are mutually exclusive. SSR-safe (returns `false`
12
- * when `window` is absent) and guards environments where `window` exists but
13
- * `window.matchMedia` does not (some test runners, embedded webviews).
14
- */
15
- export function isMobileViewport(): boolean {
16
- if (
17
- typeof window === "undefined" ||
18
- typeof window.matchMedia !== "function"
19
- ) {
20
- return false;
21
- }
22
- return window.matchMedia(MOBILE_MAX_WIDTH_QUERY).matches;
23
- }
1
+ // The mobile breakpoint lives in core. This module keeps the import path stable.
2
+ export {
3
+ ɵMOBILE_MAX_WIDTH_QUERY as MOBILE_MAX_WIDTH_QUERY,
4
+ ɵisMobileViewport as isMobileViewport,
5
+ } from "@copilotkit/core";
@@ -1,21 +1,7 @@
1
+ import { ɵshallowEqualRecord } from "@copilotkit/core";
1
2
  import { shallowRef, toValue, watch } from "vue";
2
3
  import type { MaybeRefOrGetter, ShallowRef } from "vue";
3
4
 
4
- function shallowEqualObjects(
5
- first: Record<string, unknown>,
6
- second: Record<string, unknown>,
7
- ): boolean {
8
- const firstKeys = Object.keys(first);
9
- const secondKeys = Object.keys(second);
10
- if (firstKeys.length !== secondKeys.length) return false;
11
-
12
- for (const key of firstKeys) {
13
- if (first[key] !== second[key]) return false;
14
- }
15
-
16
- return true;
17
- }
18
-
19
5
  function isPlainObject(value: unknown): value is Record<string, unknown> {
20
6
  return (
21
7
  value !== null &&
@@ -40,7 +26,7 @@ export function useShallowStableRef<T>(
40
26
  if (previous === next) return;
41
27
 
42
28
  if (isPlainObject(previous) && isPlainObject(next)) {
43
- if (shallowEqualObjects(previous, next)) {
29
+ if (ɵshallowEqualRecord(previous, next)) {
44
30
  return;
45
31
  }
46
32
  }