@copilotkit/vue 2.0.0-rc.7 → 2.0.0-rc.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.
Files changed (124) hide show
  1. package/dist/index.cjs +1 -73
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.mjs +292 -16947
  4. package/dist/index.mjs.map +1 -1
  5. package/dist/use-render-activity-message-C5LCG9a9.js +16451 -0
  6. package/dist/use-render-activity-message-C5LCG9a9.js.map +1 -0
  7. package/dist/use-render-activity-message-CPzguixR.cjs +74 -0
  8. package/dist/use-render-activity-message-CPzguixR.cjs.map +1 -0
  9. package/dist/v2/components/LicenseWarningBanner.vue.d.ts.map +1 -1
  10. package/dist/v2/components/chat/CopilotChat.vue.d.ts.map +1 -1
  11. package/dist/v2/components/chat/CopilotChatAttachmentQueue.vue.d.ts.map +1 -1
  12. package/dist/v2/components/chat/CopilotChatAttachmentRenderer.vue.d.ts.map +1 -1
  13. package/dist/v2/components/chat/CopilotChatInput.vue.d.ts +6 -270
  14. package/dist/v2/components/chat/CopilotChatInput.vue.d.ts.map +1 -1
  15. package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts +1 -1
  16. package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts.map +1 -1
  17. package/dist/v2/components/chat/CopilotChatReasoningMessage.vue.d.ts.map +1 -1
  18. package/dist/v2/components/chat/CopilotChatToolCallGroup.vue.d.ts +1 -1
  19. package/dist/v2/components/chat/CopilotChatToolCallGroup.vue.d.ts.map +1 -1
  20. package/dist/v2/components/chat/CopilotChatToolCallItem.vue.d.ts.map +1 -1
  21. package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts +1 -1
  22. package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts.map +1 -1
  23. package/dist/v2/components/chat/CopilotChatView.vue.d.ts.map +1 -1
  24. package/dist/v2/components/chat/CopilotChatWorkSummary.vue.d.ts.map +1 -1
  25. package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts +0 -1
  26. package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts.map +1 -1
  27. package/dist/v2/components/chat/index.d.ts +0 -1
  28. package/dist/v2/components/chat/index.d.ts.map +1 -1
  29. package/dist/v2/components/chat/tool-call-display-context.d.ts +2 -19
  30. package/dist/v2/components/chat/tool-call-display-context.d.ts.map +1 -1
  31. package/dist/v2/components/chat/tool-call-group-parts.d.ts +7 -20
  32. package/dist/v2/components/chat/tool-call-group-parts.d.ts.map +1 -1
  33. package/dist/v2/components/chat/turn-work.d.ts +0 -2
  34. package/dist/v2/components/chat/turn-work.d.ts.map +1 -1
  35. package/dist/v2/components/chat/types.d.ts +1 -2
  36. package/dist/v2/components/chat/types.d.ts.map +1 -1
  37. package/dist/v2/components/chat/use-chat-labels.d.ts +8 -0
  38. package/dist/v2/components/chat/use-chat-labels.d.ts.map +1 -0
  39. package/dist/v2/components/icons/index.d.ts +968 -1
  40. package/dist/v2/components/icons/index.d.ts.map +1 -1
  41. package/dist/v2/hooks/use-frontend-tool.d.ts +5 -0
  42. package/dist/v2/hooks/use-frontend-tool.d.ts.map +1 -1
  43. package/dist/v2/hooks/use-render-activity-message.d.ts +13 -9
  44. package/dist/v2/hooks/use-render-activity-message.d.ts.map +1 -1
  45. package/dist/v2/hooks/use-render-custom-messages.d.ts +5 -7
  46. package/dist/v2/hooks/use-render-custom-messages.d.ts.map +1 -1
  47. package/dist/v2/index.cjs +1 -1
  48. package/dist/v2/index.mjs +196 -199
  49. package/dist/v2/index.mjs.map +1 -1
  50. package/dist/v2/lib/vue-core.d.ts +0 -1
  51. package/dist/v2/lib/vue-core.d.ts.map +1 -1
  52. package/dist/v2/providers/CopilotKitProvider.vue.d.ts.map +1 -1
  53. package/dist/v2/providers/types.d.ts +3 -46
  54. package/dist/v2/providers/types.d.ts.map +1 -1
  55. package/dist/v2/types/human-in-the-loop.d.ts +8 -29
  56. package/dist/v2/types/human-in-the-loop.d.ts.map +1 -1
  57. package/dist/v2/types/interrupt.d.ts +1 -22
  58. package/dist/v2/types/interrupt.d.ts.map +1 -1
  59. package/dist/v2/types/vue-activity-message-renderer.d.ts +16 -15
  60. package/dist/v2/types/vue-activity-message-renderer.d.ts.map +1 -1
  61. package/dist/v2/types/vue-custom-message-renderer.d.ts +7 -16
  62. package/dist/v2/types/vue-custom-message-renderer.d.ts.map +1 -1
  63. package/dist/v2/types/vue-tool-call-renderer.d.ts +16 -35
  64. package/dist/v2/types/vue-tool-call-renderer.d.ts.map +1 -1
  65. package/package.json +7 -8
  66. package/src/__tests__/build-entries.test.ts +27 -0
  67. package/src/v2/components/LicenseWarningBanner.vue +31 -15
  68. package/src/v2/components/__tests__/LicenseWarningBanner.test.ts +20 -0
  69. package/src/v2/components/chat/CopilotChat.vue +19 -40
  70. package/src/v2/components/chat/CopilotChatAttachmentQueue.vue +14 -10
  71. package/src/v2/components/chat/CopilotChatAttachmentRenderer.vue +14 -6
  72. package/src/v2/components/chat/CopilotChatInput.vue +40 -30
  73. package/src/v2/components/chat/CopilotChatMessageView.vue +72 -140
  74. package/src/v2/components/chat/CopilotChatReasoningMessage.vue +31 -13
  75. package/src/v2/components/chat/CopilotChatToolCallGroup.vue +60 -37
  76. package/src/v2/components/chat/CopilotChatToolCallItem.vue +3 -3
  77. package/src/v2/components/chat/CopilotChatToolCallsView.vue +15 -13
  78. package/src/v2/components/chat/CopilotChatView.vue +5 -5
  79. package/src/v2/components/chat/CopilotChatWorkSummary.vue +44 -18
  80. package/src/v2/components/chat/__tests__/CopilotChat.labels.test.ts +19 -4
  81. package/src/v2/components/chat/__tests__/CopilotChatInput.test.ts +33 -1
  82. package/src/v2/components/chat/__tests__/CopilotChatMessageView.test.ts +247 -403
  83. package/src/v2/components/chat/__tests__/CopilotChatMessageView.toolCallDisplay.test.ts +1 -99
  84. package/src/v2/components/chat/copilotChatToolCallItemRender.ts +3 -19
  85. package/src/v2/components/chat/index.ts +0 -1
  86. package/src/v2/components/chat/tool-call-display-context.ts +2 -23
  87. package/src/v2/components/chat/tool-call-group-parts.ts +44 -85
  88. package/src/v2/components/chat/turn-work.ts +0 -9
  89. package/src/v2/components/chat/types.ts +4 -4
  90. package/src/v2/components/chat/use-chat-labels.ts +16 -0
  91. package/src/v2/components/icons/__tests__/icons.test.ts +72 -68
  92. package/src/v2/components/icons/index.ts +109 -27
  93. package/src/v2/hooks/__tests__/use-frontend-tool.e2e.test.ts +62 -1
  94. package/src/v2/hooks/__tests__/use-render-activity-message.test.ts +105 -0
  95. package/src/v2/hooks/__tests__/use-render-tool.test.ts +3 -6
  96. package/src/v2/hooks/__tests__/zod-regression.test.ts +4 -3
  97. package/src/v2/hooks/use-frontend-tool.ts +10 -10
  98. package/src/v2/hooks/use-render-activity-message.ts +27 -48
  99. package/src/v2/hooks/use-render-custom-messages.ts +14 -35
  100. package/src/v2/lib/vue-core.ts +3 -5
  101. package/src/v2/providers/CopilotKitProvider.vue +29 -80
  102. package/src/v2/providers/__tests__/CopilotKitProvider.headersAtSendTime.test.ts +3 -3
  103. package/src/v2/providers/__tests__/CopilotKitProvider.learning.test.ts +3 -1
  104. package/src/v2/providers/__tests__/CopilotKitProvider.test.ts +17 -0
  105. package/src/v2/providers/types.ts +3 -49
  106. package/src/v2/types/__tests__/defineToolCallRenderer.test.ts +28 -33
  107. package/src/v2/types/defineToolCallRenderer.ts +5 -4
  108. package/src/v2/types/human-in-the-loop.ts +8 -32
  109. package/src/v2/types/interrupt.ts +7 -31
  110. package/src/v2/types/vue-activity-message-renderer.ts +24 -15
  111. package/src/v2/types/vue-custom-message-renderer.ts +12 -16
  112. package/src/v2/types/vue-tool-call-renderer.ts +23 -38
  113. package/vite.config.ts +1 -2
  114. package/dist/v2/components/chat/BasicMarkdown.vue.d.ts +0 -9
  115. package/dist/v2/components/chat/BasicMarkdown.vue.d.ts.map +0 -1
  116. package/dist/v2/components/chat/tool-call-layout.d.ts +0 -115
  117. package/dist/v2/components/chat/tool-call-layout.d.ts.map +0 -1
  118. package/dist/v2/lib/transcription-client.d.ts +0 -19
  119. package/dist/v2/lib/transcription-client.d.ts.map +0 -1
  120. package/src/v2/components/chat/BasicMarkdown.vue +0 -160
  121. package/src/v2/components/chat/__tests__/BasicMarkdown.test.ts +0 -69
  122. package/src/v2/components/chat/tool-call-layout.ts +0 -304
  123. package/src/v2/lib/__tests__/transcription-client.test.ts +0 -67
  124. package/src/v2/lib/transcription-client.ts +0 -151
@@ -1,49 +1,6 @@
1
- export declare const CopilotChatDefaultLabels: {
2
- readonly chatInputPlaceholder: "Type a message...";
3
- readonly chatInputToolbarStartTranscribeButtonLabel: "Transcribe";
4
- readonly chatInputToolbarCancelTranscribeButtonLabel: "Cancel";
5
- readonly chatInputToolbarFinishTranscribeButtonLabel: "Finish";
6
- readonly chatInputToolbarAddButtonLabel: "Add photos or files";
7
- readonly chatInputToolbarToolsButtonLabel: "Tools";
8
- readonly chatInputToolbarSendButtonLabel: "Send message";
9
- readonly chatInputToolbarStopButtonLabel: "Stop";
10
- readonly assistantMessageToolbarCopyCodeLabel: "Copy";
11
- readonly assistantMessageToolbarCopyCodeCopiedLabel: "Copied";
12
- readonly assistantMessageToolbarCopyMessageLabel: "Copy";
13
- readonly assistantMessageToolbarInspectorLabel: "View in Inspector";
14
- readonly assistantMessageToolbarInspectorDescription: "Open this message in the Inspector";
15
- readonly assistantMessageToolbarInspectorLocalOnlyLabel: "Local only";
16
- readonly assistantMessageToolbarInspectorLocalOnlyDescription: "Only visible on localhost or loopback hosts in development. Never shown in production.";
17
- readonly assistantMessageToolbarInspectorTitle: "CopilotKit Inspector";
18
- readonly assistantMessageToolbarInspectorHideLabel: "Hide this icon";
19
- readonly assistantMessageToolbarInspectorHideDescription: "Until you reload this page";
20
- readonly assistantMessageToolbarThumbsUpLabel: "Good response";
21
- readonly assistantMessageToolbarThumbsDownLabel: "Bad response";
22
- readonly assistantMessageFeedbackCommentPlaceholder: "Add a comment (optional)";
23
- readonly assistantMessageFeedbackCommentSubmitLabel: "Send comment";
24
- readonly assistantMessageToolbarReadAloudLabel: "Read aloud";
25
- readonly assistantMessageToolbarRegenerateLabel: "Regenerate";
26
- readonly userMessageToolbarCopyMessageLabel: "Copy";
27
- readonly userMessageToolbarEditMessageLabel: "Edit";
28
- readonly userMessageToolbarPreviousBranchLabel: "Previous branch";
29
- readonly userMessageToolbarNextBranchLabel: "Next branch";
30
- readonly chatDisclaimerText: "AI can make mistakes. Please verify important information.";
31
- readonly chatToggleOpenLabel: "Open chat";
32
- readonly chatToggleCloseLabel: "Close chat";
33
- readonly chatScrollToBottomLabel: "Scroll to bottom";
34
- readonly modalHeaderTitle: "CopilotKit Chat";
35
- readonly welcomeMessageText: "How can I help you today?";
36
- readonly reasoningMessageThinkingLabel: "Thinking…";
37
- readonly chatInputSlashMenuLabel: "Slash commands";
38
- readonly chatInputSlashMenuEmptyText: "No commands found";
39
- readonly attachmentRemoveButtonLabel: "Remove attachment";
40
- readonly attachmentPlayVideoButtonLabel: "Play video";
41
- readonly attachmentPreviewCloseButtonLabel: "Close preview";
42
- readonly modalHeaderCloseButtonLabel: "Close";
43
- readonly modalHeaderThreadsButtonLabel: "Open threads";
44
- readonly sidebarLabel: "Copilot chat sidebar";
45
- };
46
- export type CopilotChatLabels = typeof CopilotChatDefaultLabels;
1
+ import type { CopilotChatLabels } from "@copilotkit/core";
2
+ export { CopilotChatDefaultLabels } from "@copilotkit/core";
3
+ export type { CopilotChatLabels } from "@copilotkit/core";
47
4
  export interface CopilotChatConfigurationValue {
48
5
  labels: CopilotChatLabels;
49
6
  agentId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/v2/providers/types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+C3B,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,OAAO,wBAAwB,CAAC;AAEhE,MAAM,WAAW,6BAA6B;IAC5C,MAAM,EAAE,iBAAiB,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,mBAAmB,EAAE,OAAO,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC;;;;OAIG;IACH,iBAAiB,EAAE,CACjB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,KAC7B,IAAI,CAAC;IACV;;;OAGG;IACH,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,4DAA4D;IAC5D,UAAU,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,aAAa,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,gFAAgF;IAChF,gBAAgB,EAAE,OAAO,CAAC;IAC1B,yEAAyE;IACzE,cAAc,EAAE,MAAM,MAAM,IAAI,CAAC;CAClC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/v2/providers/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,MAAM,WAAW,6BAA6B;IAC5C,MAAM,EAAE,iBAAiB,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,mBAAmB,EAAE,OAAO,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC;;;;OAIG;IACH,iBAAiB,EAAE,CACjB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,KAC7B,IAAI,CAAC;IACV;;;OAGG;IACH,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,4DAA4D;IAC5D,UAAU,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,aAAa,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,gFAAgF;IAChF,gBAAgB,EAAE,OAAO,CAAC;IAC1B,yEAAyE;IACzE,cAAc,EAAE,MAAM,MAAM,IAAI,CAAC;CAClC"}
@@ -1,33 +1,12 @@
1
- import type { FrontendTool, ToolCallStatus } from "@copilotkit/core";
1
+ import type { FrontendTool, HumanInTheLoopRenderProps } from "@copilotkit/core";
2
2
  import type { Component, VNodeChild } from "vue";
3
- export type VueHumanInTheLoopRenderProps<T> = {
4
- name: string;
5
- description: string;
6
- toolCallId: string;
7
- agentId?: string;
8
- args: Partial<T>;
9
- status: ToolCallStatus.InProgress;
10
- result: undefined;
11
- respond: undefined;
12
- } | {
13
- name: string;
14
- description: string;
15
- toolCallId: string;
16
- agentId?: string;
17
- args: T;
18
- status: ToolCallStatus.Executing;
19
- result: undefined;
20
- respond: (result: unknown) => Promise<void>;
21
- } | {
22
- name: string;
23
- description: string;
24
- toolCallId: string;
25
- agentId?: string;
26
- args: T;
27
- status: ToolCallStatus.Complete;
28
- result: string;
29
- respond: undefined;
30
- };
3
+ /**
4
+ * Props a Vue human-in-the-loop renderer receives. Same as core's
5
+ * `HumanInTheLoopRenderProps`.
6
+ *
7
+ * @typeParam T - The shape of the tool arguments.
8
+ */
9
+ export type VueHumanInTheLoopRenderProps<T> = HumanInTheLoopRenderProps<T>;
31
10
  export type VueHumanInTheLoopRenderFn<T> = ((props: VueHumanInTheLoopRenderProps<T>) => VNodeChild) | Component<VueHumanInTheLoopRenderProps<T>>;
32
11
  export type VueHumanInTheLoop<T extends Record<string, unknown> = Record<string, unknown>> = Omit<FrontendTool<T>, "handler"> & {
33
12
  render: VueHumanInTheLoopRenderFn<T>;
@@ -1 +1 @@
1
- {"version":3,"file":"human-in-the-loop.d.ts","sourceRoot":"","sources":["../../../src/v2/types/human-in-the-loop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEjD,MAAM,MAAM,4BAA4B,CAAC,CAAC,IACtC;IACE,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACjB,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC;IAClC,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,SAAS,CAAC;CACpB,GACD;IACE,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,CAAC,CAAC;IACR,MAAM,EAAE,cAAc,CAAC,SAAS,CAAC;IACjC,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C,GACD;IACE,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,CAAC,CAAC;IACR,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,SAAS,CAAC;CACpB,CAAC;AAEN,MAAM,MAAM,yBAAyB,CAAC,CAAC,IACnC,CAAC,CAAC,KAAK,EAAE,4BAA4B,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,GACxD,SAAS,CAAC,4BAA4B,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/C,MAAM,MAAM,iBAAiB,CAC3B,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IACzD,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG;IACrC,MAAM,EAAE,yBAAyB,CAAC,CAAC,CAAC,CAAC;CACtC,CAAC"}
1
+ {"version":3,"file":"human-in-the-loop.d.ts","sourceRoot":"","sources":["../../../src/v2/types/human-in-the-loop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,MAAM,4BAA4B,CAAC,CAAC,IAAI,yBAAyB,CAAC,CAAC,CAAC,CAAC;AAE3E,MAAM,MAAM,yBAAyB,CAAC,CAAC,IACnC,CAAC,CAAC,KAAK,EAAE,4BAA4B,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,GACxD,SAAS,CAAC,4BAA4B,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/C,MAAM,MAAM,iBAAiB,CAC3B,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IACzD,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG;IACrC,MAAM,EAAE,yBAAyB,CAAC,CAAC,CAAC,CAAC;CACtC,CAAC"}
@@ -1,23 +1,2 @@
1
- import type { Interrupt, RunAgentResult } from "@ag-ui/client";
2
- export interface InterruptEvent<TValue = unknown> {
3
- name: string;
4
- value: TValue;
5
- }
6
- export type InterruptResolveFn = (payload?: unknown, interruptId?: string) => Promise<RunAgentResult | void>;
7
- export type InterruptCancelFn = (interruptId?: string) => Promise<RunAgentResult | void>;
8
- export interface InterruptHandlerProps<TValue = unknown> {
9
- event: InterruptEvent<TValue>;
10
- interrupt: Interrupt | null;
11
- interrupts: Interrupt[];
12
- resolve: InterruptResolveFn;
13
- cancel: InterruptCancelFn;
14
- }
15
- export interface InterruptRenderProps<TValue = unknown, TResult = unknown> {
16
- event: InterruptEvent<TValue>;
17
- interrupt: Interrupt | null;
18
- interrupts: Interrupt[];
19
- result: TResult;
20
- resolve: InterruptResolveFn;
21
- cancel: InterruptCancelFn;
22
- }
1
+ export type { InterruptEvent, InterruptResolveFn, InterruptCancelFn, InterruptHandlerProps, InterruptRenderProps, } from "@copilotkit/core";
23
2
  //# sourceMappingURL=interrupt.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"interrupt.d.ts","sourceRoot":"","sources":["../../../src/v2/types/interrupt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/D,MAAM,WAAW,cAAc,CAAC,MAAM,GAAG,OAAO;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,kBAAkB,GAAG,CAC/B,OAAO,CAAC,EAAE,OAAO,EACjB,WAAW,CAAC,EAAE,MAAM,KACjB,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;AACpC,MAAM,MAAM,iBAAiB,GAAG,CAC9B,WAAW,CAAC,EAAE,MAAM,KACjB,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;AAEpC,MAAM,WAAW,qBAAqB,CAAC,MAAM,GAAG,OAAO;IACrD,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IAC9B,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IAC5B,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,MAAM,EAAE,iBAAiB,CAAC;CAC3B;AAED,MAAM,WAAW,oBAAoB,CAAC,MAAM,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO;IACvE,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IAC9B,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IAC5B,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,MAAM,EAAE,iBAAiB,CAAC;CAC3B"}
1
+ {"version":3,"file":"interrupt.d.ts","sourceRoot":"","sources":["../../../src/v2/types/interrupt.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC"}
@@ -1,18 +1,19 @@
1
- import type { ActivityMessage } from "@ag-ui/core";
2
- import type { AbstractAgent } from "@ag-ui/client";
3
- import type { z } from "zod";
1
+ import type { ActivityMessageRenderProps, ActivityMessageRendererDef } from "@copilotkit/core";
4
2
  import type { Component, VNodeChild } from "vue";
5
- export interface VueActivityMessageRendererProps<TActivityContent> {
6
- activityType: string;
7
- content: TActivityContent;
8
- message: ActivityMessage;
9
- agent: AbstractAgent | undefined;
10
- }
3
+ /**
4
+ * Props a Vue activity message renderer receives. Same as core's
5
+ * `ActivityMessageRenderProps`.
6
+ *
7
+ * @typeParam TActivityContent - The shape of the activity content.
8
+ */
9
+ export type VueActivityMessageRendererProps<TActivityContent> = ActivityMessageRenderProps<TActivityContent>;
11
10
  export type VueActivityMessageRendererRenderFn<TActivityContent> = ((props: VueActivityMessageRendererProps<TActivityContent>) => VNodeChild) | Component<VueActivityMessageRendererProps<TActivityContent>>;
12
- export interface VueActivityMessageRenderer<TActivityContent> {
13
- activityType: string;
14
- agentId?: string;
15
- content: z.ZodSchema<TActivityContent>;
16
- render: VueActivityMessageRendererRenderFn<TActivityContent>;
17
- }
11
+ /**
12
+ * A Vue activity message renderer registration. `content` takes any
13
+ * Standard Schema (zod, valibot, arktype, and so on). The chat validates the
14
+ * activity content with it and passes the result to `render`.
15
+ *
16
+ * @typeParam TActivityContent - The shape of the activity content.
17
+ */
18
+ export type VueActivityMessageRenderer<TActivityContent> = ActivityMessageRendererDef<TActivityContent, VueActivityMessageRendererRenderFn<TActivityContent>>;
18
19
  //# sourceMappingURL=vue-activity-message-renderer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vue-activity-message-renderer.d.ts","sourceRoot":"","sources":["../../../src/v2/types/vue-activity-message-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEjD,MAAM,WAAW,+BAA+B,CAAC,gBAAgB;IAC/D,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,OAAO,EAAE,eAAe,CAAC;IACzB,KAAK,EAAE,aAAa,GAAG,SAAS,CAAC;CAClC;AAED,MAAM,MAAM,kCAAkC,CAAC,gBAAgB,IAC3D,CAAC,CAAC,KAAK,EAAE,+BAA+B,CAAC,gBAAgB,CAAC,KAAK,UAAU,CAAC,GAC1E,SAAS,CAAC,+BAA+B,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAEjE,MAAM,WAAW,0BAA0B,CAAC,gBAAgB;IAC1D,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,CAAC,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;IACvC,MAAM,EAAE,kCAAkC,CAAC,gBAAgB,CAAC,CAAC;CAC9D"}
1
+ {"version":3,"file":"vue-activity-message-renderer.d.ts","sourceRoot":"","sources":["../../../src/v2/types/vue-activity-message-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,0BAA0B,EAC3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,MAAM,+BAA+B,CAAC,gBAAgB,IAC1D,0BAA0B,CAAC,gBAAgB,CAAC,CAAC;AAE/C,MAAM,MAAM,kCAAkC,CAAC,gBAAgB,IAC3D,CAAC,CAAC,KAAK,EAAE,+BAA+B,CAAC,gBAAgB,CAAC,KAAK,UAAU,CAAC,GAC1E,SAAS,CAAC,+BAA+B,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAEjE;;;;;;GAMG;AACH,MAAM,MAAM,0BAA0B,CAAC,gBAAgB,IACrD,0BAA0B,CACxB,gBAAgB,EAChB,kCAAkC,CAAC,gBAAgB,CAAC,CACrD,CAAC"}
@@ -1,19 +1,10 @@
1
- import type { Message } from "@ag-ui/core";
1
+ import type { CustomMessageRendererDef, CustomMessageRendererPosition, CustomMessageRenderProps } from "@copilotkit/core";
2
2
  import type { Component, VNodeChild } from "vue";
3
- export type VueCustomMessageRendererPosition = "before" | "after";
4
- export interface VueCustomMessageRendererProps {
5
- message: Message;
6
- position: VueCustomMessageRendererPosition;
7
- runId: string;
8
- messageIndex: number;
9
- messageIndexInRun: number;
10
- numberOfMessagesInRun: number;
11
- agentId: string;
12
- stateSnapshot: unknown;
13
- }
3
+ /** Where a custom message renderer draws. Same as core's type. */
4
+ export type VueCustomMessageRendererPosition = CustomMessageRendererPosition;
5
+ /** Props a Vue custom message renderer receives. Same as core's type. */
6
+ export type VueCustomMessageRendererProps = CustomMessageRenderProps;
14
7
  export type VueCustomMessageRendererRenderFn = ((props: VueCustomMessageRendererProps) => VNodeChild) | Component<VueCustomMessageRendererProps>;
15
- export interface VueCustomMessageRenderer {
16
- agentId?: string;
17
- render: VueCustomMessageRendererRenderFn;
18
- }
8
+ /** A Vue custom message renderer registration. */
9
+ export type VueCustomMessageRenderer = CustomMessageRendererDef<VueCustomMessageRendererRenderFn>;
19
10
  //# sourceMappingURL=vue-custom-message-renderer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vue-custom-message-renderer.d.ts","sourceRoot":"","sources":["../../../src/v2/types/vue-custom-message-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEjD,MAAM,MAAM,gCAAgC,GAAG,QAAQ,GAAG,OAAO,CAAC;AAElE,MAAM,WAAW,6BAA6B;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,gCAAgC,CAAC;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,MAAM,gCAAgC,GACxC,CAAC,CAAC,KAAK,EAAE,6BAA6B,KAAK,UAAU,CAAC,GACtD,SAAS,CAAC,6BAA6B,CAAC,CAAC;AAE7C,MAAM,WAAW,wBAAwB;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,gCAAgC,CAAC;CAC1C"}
1
+ {"version":3,"file":"vue-custom-message-renderer.d.ts","sourceRoot":"","sources":["../../../src/v2/types/vue-custom-message-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,6BAA6B,EAC7B,wBAAwB,EACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEjD,kEAAkE;AAClE,MAAM,MAAM,gCAAgC,GAAG,6BAA6B,CAAC;AAE7E,yEAAyE;AACzE,MAAM,MAAM,6BAA6B,GAAG,wBAAwB,CAAC;AAErE,MAAM,MAAM,gCAAgC,GACxC,CAAC,CAAC,KAAK,EAAE,6BAA6B,KAAK,UAAU,CAAC,GACtD,SAAS,CAAC,6BAA6B,CAAC,CAAC;AAE7C,kDAAkD;AAClD,MAAM,MAAM,wBAAwB,GAClC,wBAAwB,CAAC,gCAAgC,CAAC,CAAC"}
@@ -1,44 +1,25 @@
1
- import type { ToolCallStatus } from "@copilotkit/core";
2
- import type { StandardSchemaV1 } from "@copilotkit/shared";
1
+ import type { ToolCallRenderProps, ToolCallRendererDef } from "@copilotkit/core";
3
2
  import type { Component, VNodeChild } from "vue";
4
3
  /**
5
- * Props passed to a Vue tool call render function.
4
+ * Props passed to a Vue tool call render function. Same as core's
5
+ * `ToolCallRenderProps`.
6
+ *
7
+ * @typeParam T - The shape of the tool arguments.
6
8
  */
7
- export type VueToolCallRendererRenderProps<T> = {
8
- name: string;
9
- toolCallId: string;
10
- args: Partial<T>;
11
- status: ToolCallStatus.InProgress;
12
- result: undefined;
13
- } | {
14
- name: string;
15
- toolCallId: string;
16
- args: T;
17
- status: ToolCallStatus.Executing;
18
- result: undefined;
19
- } | {
20
- name: string;
21
- toolCallId: string;
22
- args: T;
23
- status: ToolCallStatus.Complete;
24
- result: string;
25
- };
9
+ export type VueToolCallRendererRenderProps<T> = ToolCallRenderProps<T>;
26
10
  /**
27
11
  * Vue component or render function for tool call rendering.
28
12
  * Component is normalized to (props) => VNodeChild internally.
29
13
  */
30
14
  export type VueToolCallRendererRenderFn<T> = ((props: VueToolCallRendererRenderProps<T>) => VNodeChild) | Component<VueToolCallRendererRenderProps<T>>;
31
- export interface VueToolCallRenderer<T = unknown> {
32
- name: string;
33
- args: StandardSchemaV1<any, T>;
34
- agentId?: string;
35
- /**
36
- * Whether calls this renderer draws join the chat's tool-call groups (see
37
- * `toolCallDisplay` on `CopilotChatMessageView`). CopilotKit's built-in card
38
- * sets it; a renderer that leaves it unset always shows its calls on their
39
- * own, since the chat can't tell what it draws (it may even draw nothing).
40
- */
41
- group?: boolean;
42
- render: VueToolCallRendererRenderFn<T>;
43
- }
15
+ type VueToolCallRendererDef<T> = ToolCallRendererDef<T, VueToolCallRendererRenderFn<T>>;
16
+ /**
17
+ * A Vue tool call renderer registration: core's `ToolCallRendererDef` with a
18
+ * Vue render function. `args` is required here. Use `defineToolCallRenderer`
19
+ * to build one; it fills in `args` for a `"*"` renderer that has no schema.
20
+ *
21
+ * @typeParam T - The shape of the tool arguments.
22
+ */
23
+ export type VueToolCallRenderer<T = unknown> = VueToolCallRendererDef<T> & Required<Pick<VueToolCallRendererDef<T>, "args">>;
24
+ export {};
44
25
  //# sourceMappingURL=vue-tool-call-renderer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vue-tool-call-renderer.d.ts","sourceRoot":"","sources":["../../../src/v2/types/vue-tool-call-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEjD;;GAEG;AACH,MAAM,MAAM,8BAA8B,CAAC,CAAC,IACxC;IACE,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACjB,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC;IAClC,MAAM,EAAE,SAAS,CAAC;CACnB,GACD;IACE,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,CAAC,CAAC;IACR,MAAM,EAAE,cAAc,CAAC,SAAS,CAAC;IACjC,MAAM,EAAE,SAAS,CAAC;CACnB,GACD;IACE,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,CAAC,CAAC;IACR,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEN;;;GAGG;AACH,MAAM,MAAM,2BAA2B,CAAC,CAAC,IACrC,CAAC,CAAC,KAAK,EAAE,8BAA8B,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,GAC1D,SAAS,CAAC,8BAA8B,CAAC,CAAC,CAAC,CAAC,CAAC;AAEjD,MAAM,WAAW,mBAAmB,CAAC,CAAC,GAAG,OAAO;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,gBAAgB,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,2BAA2B,CAAC,CAAC,CAAC,CAAC;CACxC"}
1
+ {"version":3,"file":"vue-tool-call-renderer.d.ts","sourceRoot":"","sources":["../../../src/v2/types/vue-tool-call-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,MAAM,8BAA8B,CAAC,CAAC,IAAI,mBAAmB,CAAC,CAAC,CAAC,CAAC;AAEvE;;;GAGG;AACH,MAAM,MAAM,2BAA2B,CAAC,CAAC,IACrC,CAAC,CAAC,KAAK,EAAE,8BAA8B,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,GAC1D,SAAS,CAAC,8BAA8B,CAAC,CAAC,CAAC,CAAC,CAAC;AAEjD,KAAK,sBAAsB,CAAC,CAAC,IAAI,mBAAmB,CAClD,CAAC,EACD,2BAA2B,CAAC,CAAC,CAAC,CAC/B,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,OAAO,IAAI,sBAAsB,CAAC,CAAC,CAAC,GACtE,QAAQ,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@copilotkit/vue",
3
- "version": "2.0.0-rc.7",
3
+ "version": "2.0.0-rc.8",
4
4
  "private": false,
5
5
  "description": "Vue 3 components and composables for CopilotKit",
6
6
  "keywords": [
@@ -61,14 +61,13 @@
61
61
  "@a2ui/web_core": "0.10.4",
62
62
  "@ag-ui/client": "1.0.2",
63
63
  "@ag-ui/core": "1.0.2",
64
- "@copilotkit/core": "2.0.0-rc.7",
65
- "@copilotkit/markdown-renderer": "2.0.0-rc.7",
66
- "@copilotkit/mcp-apps-renderer": "2.0.0-rc.7",
67
- "@copilotkit/shared": "2.0.0-rc.7",
68
- "@copilotkit/web-components": "2.0.0-rc.7",
69
- "@copilotkit/web-inspector": "2.0.0-rc.7",
64
+ "@copilotkit/core": "2.0.0-rc.8",
65
+ "@copilotkit/markdown-renderer": "2.0.0-rc.8",
66
+ "@copilotkit/mcp-apps-renderer": "2.0.0-rc.8",
67
+ "@copilotkit/shared": "2.0.0-rc.8",
68
+ "@copilotkit/web-components": "2.0.0-rc.8",
69
+ "@copilotkit/web-inspector": "2.0.0-rc.8",
70
70
  "@jetbrains/websandbox": "^1.1.3",
71
- "lucide-vue-next": "^0.525.0",
72
71
  "zod": "^3.25.75",
73
72
  "zod-to-json-schema": "^3.24.5"
74
73
  },
@@ -0,0 +1,27 @@
1
+ // @vitest-environment node
2
+ import { describe, expect, it } from "vitest";
3
+ import type { LibraryOptions } from "vite";
4
+ import config from "../../vite.config";
5
+ import { useFrontendTool as v1UseFrontendTool } from "../hooks/use-frontend-tool";
6
+ import { useFrontendTool as v2UseFrontendTool } from "../v2/hooks/use-frontend-tool";
7
+
8
+ // The package's "./v2" export points at the build's "v2/index" entry, and "."
9
+ // at "index". Each entry must build from the module that matches its export.
10
+ const entries = (config.build?.lib as LibraryOptions).entry as Record<
11
+ string,
12
+ string
13
+ >;
14
+
15
+ describe("library build entries", () => {
16
+ it("builds @copilotkit/vue/v2 from the v2 module, with the v2 hooks", async () => {
17
+ const v2 = await import(/* @vite-ignore */ entries["v2/index"]!);
18
+
19
+ expect(v2.useFrontendTool).toBe(v2UseFrontendTool);
20
+ });
21
+
22
+ it("builds @copilotkit/vue from the root module, with the v1-compatible hooks", async () => {
23
+ const root = await import(/* @vite-ignore */ entries.index!);
24
+
25
+ expect(root.useFrontendTool).toBe(v1UseFrontendTool);
26
+ });
27
+ });
@@ -1,5 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, onBeforeUnmount, onMounted } from "vue";
3
+ import { ɵformatLabel } from "@copilotkit/core";
4
+ import { useChatLabels } from "./chat/use-chat-labels";
3
5
 
4
6
  // Total reserved vertical space for the fixed license banner: banner height
5
7
  // (~36px) + bottom offset (8px) + visual gap above the chat input (~8px).
@@ -36,45 +38,59 @@ interface BannerSpec {
36
38
  actionUrl: string;
37
39
  }
38
40
 
41
+ const labels = useChatLabels();
42
+
43
+ function expiringMessage(days: number | undefined) {
44
+ if (days === undefined) return labels.value.licenseExpiringText;
45
+ const template =
46
+ days === 1
47
+ ? labels.value.licenseExpiringInDaysOne
48
+ : labels.value.licenseExpiringInDaysOther;
49
+ return ɵformatLabel(template, { days });
50
+ }
51
+
39
52
  const spec = computed<BannerSpec | null>(() => {
53
+ const text = labels.value;
40
54
  switch (props.type) {
41
55
  case "no_license":
42
56
  return {
43
57
  severity: "info",
44
- message: "Powered by CopilotKit",
45
- actionLabel: "Get a license",
58
+ message: text.licensePoweredByText,
59
+ actionLabel: text.licenseGetLicenseLabel,
46
60
  actionUrl: "https://copilotkit.ai/pricing",
47
61
  };
48
62
  case "feature_unlicensed":
49
63
  return {
50
64
  severity: "warning",
51
- message: `⚠ The "${props.featureName ?? ""}" feature requires a CopilotKit license.`,
52
- actionLabel: "Get a license",
65
+ message: ɵformatLabel(text.licenseFeatureUnlicensedText, {
66
+ feature: props.featureName ?? "",
67
+ }),
68
+ actionLabel: text.licenseGetLicenseLabel,
53
69
  actionUrl: "https://copilotkit.ai/pricing",
54
70
  };
55
- case "expiring": {
56
- const days = props.graceRemaining;
57
- const dayLabel = days === 1 ? "day" : "days";
71
+ case "expiring":
58
72
  return {
59
73
  severity: "warning",
60
- message: `Your CopilotKit license expires in ${days} ${dayLabel}. Please renew.`,
61
- actionLabel: "Renew",
74
+ message: expiringMessage(props.graceRemaining),
75
+ actionLabel: text.licenseRenewLabel,
62
76
  actionUrl: "https://dashboard.operations.copilotkit.ai",
63
77
  };
64
- }
65
78
  case "expired":
66
79
  return {
67
80
  severity: "critical",
68
- message: `Your CopilotKit license expired${props.expiryDate ? ` on ${props.expiryDate}` : ""}. Please renew at copilotkit.ai/pricing`,
69
- actionLabel: "Renew now",
81
+ message: props.expiryDate
82
+ ? ɵformatLabel(text.licenseExpiredOnDateText, {
83
+ date: props.expiryDate,
84
+ })
85
+ : text.licenseExpiredText,
86
+ actionLabel: text.licenseRenewNowLabel,
70
87
  actionUrl: "https://copilotkit.ai/pricing",
71
88
  };
72
89
  case "invalid":
73
90
  return {
74
91
  severity: "critical",
75
- message:
76
- "Invalid CopilotKit license token. Please check your configuration.",
77
- actionLabel: "Get a license",
92
+ message: text.licenseInvalidText,
93
+ actionLabel: text.licenseGetLicenseLabel,
78
94
  actionUrl: "https://copilotkit.ai/pricing",
79
95
  };
80
96
  default:
@@ -20,4 +20,24 @@ describe("LicenseWarningBanner", () => {
20
20
 
21
21
  expect(wrapper.find("button").exists()).toBe(false);
22
22
  });
23
+
24
+ it("says the license expires soon when the day count is unknown", () => {
25
+ const wrapper = mount(LicenseWarningBanner, {
26
+ props: { type: "expiring" },
27
+ });
28
+
29
+ expect(wrapper.get("span").text()).toBe(
30
+ "Your CopilotKit license expires soon. Please renew.",
31
+ );
32
+ });
33
+
34
+ it("counts the days left before the license expires", () => {
35
+ const wrapper = mount(LicenseWarningBanner, {
36
+ props: { type: "expiring", graceRemaining: 1 },
37
+ });
38
+
39
+ expect(wrapper.get("span").text()).toBe(
40
+ "Your CopilotKit license expires in 1 day. Please renew.",
41
+ );
42
+ });
23
43
  });
@@ -4,7 +4,6 @@ import {
4
4
  createAttachmentContent,
5
5
  DEFAULT_AGENT_ID,
6
6
  randomUUID,
7
- TranscriptionErrorCode,
8
7
  } from "@copilotkit/shared";
9
8
  import {
10
9
  computed,
@@ -17,7 +16,14 @@ import {
17
16
  useSlots,
18
17
  watch,
19
18
  } from "vue";
20
- import { CopilotKitCoreErrorCode, ɵisHttpAgent } from "@copilotkit/core";
19
+ import {
20
+ CopilotChatDefaultLabels,
21
+ CopilotKitCoreErrorCode,
22
+ TranscriptionError,
23
+ ɵisHttpAgent,
24
+ ɵtranscribeAudio,
25
+ ɵtranscriptionErrorMessageKey,
26
+ } from "@copilotkit/core";
21
27
  import type { Suggestion } from "@copilotkit/core";
22
28
  import CopilotChatConfigurationProvider from "../../providers/CopilotChatConfigurationProvider.vue";
23
29
  import { useCopilotChatConfiguration } from "../../providers/useCopilotChatConfiguration";
@@ -28,10 +34,6 @@ import { useAgent } from "../../hooks/use-agent";
28
34
  import { useSuggestions } from "../../hooks/use-suggestions";
29
35
  import { useAttachments } from "../../hooks/use-attachments";
30
36
  import { useShallowStableRef } from "../../lib/shallow-stable";
31
- import {
32
- transcribeAudio,
33
- TranscriptionError,
34
- } from "../../lib/transcription-client";
35
37
  import CopilotChatView from "./CopilotChatView.vue";
36
38
  import { LastUserMessageKey } from "./last-user-message-context";
37
39
  import type { LastUserMessageState } from "./last-user-message-context";
@@ -159,6 +161,12 @@ const isConnecting = computed(
159
161
  );
160
162
  const stableLabels = useShallowStableRef(computed(() => props.labels));
161
163
  const resolvedLabels = computed(() => stableLabels.value);
164
+ // The labels this chat shows, the same merge its configuration provider makes.
165
+ const chatLabels = computed(() => ({
166
+ ...CopilotChatDefaultLabels,
167
+ ...existingConfig.value?.labels,
168
+ ...resolvedLabels.value,
169
+ }));
162
170
 
163
171
  // `useAgent` takes no threadId: it pins one only from a surrounding chat
164
172
  // configuration, and this call sits outside the provider rendered in this
@@ -771,48 +779,19 @@ async function handleFinishTranscribeWithAudio(audioBlob: Blob) {
771
779
  isTranscribing.value = true;
772
780
  try {
773
781
  transcriptionError.value = null;
774
- const result = await transcribeAudio(copilotkit.value, audioBlob);
782
+ const result = await ɵtranscribeAudio(copilotkit.value, audioBlob);
775
783
  const trimmedPrevious = inputValue.value.trim();
776
784
  inputValue.value = trimmedPrevious
777
785
  ? `${trimmedPrevious} ${result.text}`
778
786
  : result.text;
779
787
  } catch (error) {
780
788
  console.error("CopilotChat: Transcription failed", error);
789
+ const labels = chatLabels.value;
781
790
  if (error instanceof TranscriptionError) {
782
- const { code, retryable, message } = error.info;
783
- switch (code) {
784
- case TranscriptionErrorCode.RATE_LIMITED:
785
- transcriptionError.value = "Too many requests. Please wait a moment.";
786
- break;
787
- case TranscriptionErrorCode.AUTH_FAILED:
788
- transcriptionError.value =
789
- "Authentication error. Please check your configuration.";
790
- break;
791
- case TranscriptionErrorCode.AUDIO_TOO_LONG:
792
- transcriptionError.value =
793
- "Recording is too long. Please try a shorter recording.";
794
- break;
795
- case TranscriptionErrorCode.AUDIO_TOO_SHORT:
796
- transcriptionError.value =
797
- "Recording is too short. Please try again.";
798
- break;
799
- case TranscriptionErrorCode.INVALID_AUDIO_FORMAT:
800
- transcriptionError.value = "Audio format not supported.";
801
- break;
802
- case TranscriptionErrorCode.SERVICE_NOT_CONFIGURED:
803
- transcriptionError.value = "Transcription service is not available.";
804
- break;
805
- case TranscriptionErrorCode.NETWORK_ERROR:
806
- transcriptionError.value =
807
- "Network error. Please check your connection.";
808
- break;
809
- default:
810
- transcriptionError.value = retryable
811
- ? "Transcription failed. Please try again."
812
- : message;
813
- }
791
+ const key = ɵtranscriptionErrorMessageKey(error.info);
792
+ transcriptionError.value = key ? labels[key] : error.info.message;
814
793
  } else {
815
- transcriptionError.value = "Transcription failed. Please try again.";
794
+ transcriptionError.value = labels.transcriptionErrorGenericText;
816
795
  }
817
796
  } finally {
818
797
  isTranscribing.value = false;
@@ -9,8 +9,7 @@ import type { Attachment } from "@copilotkit/shared";
9
9
  import type { CopilotChatAttachmentQueueProps } from "./types";
10
10
  import { IconPlay } from "../icons";
11
11
  import CopilotChatLightbox from "./CopilotChatLightbox.vue";
12
- import { useCopilotChatConfiguration } from "../../providers/useCopilotChatConfiguration";
13
- import { CopilotChatDefaultLabels } from "../../providers/types";
12
+ import { useChatLabels } from "./use-chat-labels";
14
13
 
15
14
  const props = withDefaults(defineProps<CopilotChatAttachmentQueueProps>(), {
16
15
  attachments: () => [],
@@ -21,8 +20,7 @@ const emit = defineEmits<{
21
20
  "remove-attachment": [id: string];
22
21
  }>();
23
22
 
24
- const config = useCopilotChatConfiguration();
25
- const labels = computed(() => config.value?.labels ?? CopilotChatDefaultLabels);
23
+ const labels = useChatLabels();
26
24
 
27
25
  const activeLightboxAttachment = ref<Attachment | null>(null);
28
26
  const documentBlobUrl = ref<string | null>(null);
@@ -32,10 +30,10 @@ const lightboxLabel = computed(() => {
32
30
  if (!attachment) return undefined;
33
31
  if (attachment.filename) return attachment.filename;
34
32
  return attachment.type === "image"
35
- ? "Image attachment"
33
+ ? labels.value.attachmentImageAltText
36
34
  : attachment.type === "video"
37
35
  ? "Video attachment"
38
- : "Document";
36
+ : labels.value.attachmentDocumentLabel;
39
37
  });
40
38
  const isPreviewableDocument = computed(() => {
41
39
  const attachment = activeLightboxAttachment.value;
@@ -267,7 +265,7 @@ function createBlobUrl(
267
265
  class="cpk-attachment-queue-document-name"
268
266
  data-testid="copilot-chat-attachment-document-filename"
269
267
  >
270
- {{ attachment.filename || "Document" }}
268
+ {{ attachment.filename || labels.attachmentDocumentLabel }}
271
269
  </span>
272
270
  <span
273
271
  v-if="attachment.size != null"
@@ -369,10 +367,16 @@ function createBlobUrl(
369
367
  </div>
370
368
  <div class="cpk-attachment-queue-document-card-details">
371
369
  <div class="cpk-attachment-queue-document-card-name">
372
- {{ activeLightboxAttachment.filename || "Document" }}
370
+ {{
371
+ activeLightboxAttachment.filename ||
372
+ labels.attachmentDocumentLabel
373
+ }}
373
374
  </div>
374
375
  <div class="cpk-attachment-queue-document-card-meta">
375
- {{ activeLightboxAttachment.source.mimeType || "Unknown type" }}
376
+ {{
377
+ activeLightboxAttachment.source.mimeType ||
378
+ labels.attachmentUnknownTypeText
379
+ }}
376
380
  {{
377
381
  activeLightboxAttachment.size != null
378
382
  ? ` · ${formatFileSize(activeLightboxAttachment.size)}`
@@ -381,7 +385,7 @@ function createBlobUrl(
381
385
  </div>
382
386
  </div>
383
387
  <div class="cpk-attachment-queue-document-card-note">
384
- No preview available for this file type
388
+ {{ labels.attachmentNoPreviewText }}
385
389
  </div>
386
390
  </div>
387
391
  </template>