@gitlab/duo-ui 15.12.1 → 15.14.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 (29) hide show
  1. package/dist/components/agentic_chat/agentic_duo_chat.js +9 -2
  2. package/dist/components/agentic_chat/web_agentic_duo_chat.js +14 -1
  3. package/dist/components/chat/components/duo_chat_conversation/duo_chat_conversation.js +14 -1
  4. package/dist/components/chat/components/duo_chat_header/duo_chat_header.js +18 -8
  5. package/dist/components/chat/components/duo_chat_message/duo_chat_message.js +14 -2
  6. package/dist/components/chat/components/duo_chat_message/message_types/index.js +6 -7
  7. package/dist/components/chat/components/duo_chat_message/message_types/message_map.js +48 -28
  8. package/dist/components/chat/components/duo_chat_message/message_types/message_tool.js +1 -7
  9. package/dist/components/chat/components/duo_chat_message/message_types/message_tool_approved.js +63 -0
  10. package/dist/components/chat/components/utils.js +3 -1
  11. package/dist/components/chat/constants.js +2 -1
  12. package/dist/index.js +11 -1
  13. package/dist/tailwind.css +1 -1
  14. package/dist/tailwind.css.map +1 -1
  15. package/package.json +7 -6
  16. package/src/components/agentic_chat/agentic_duo_chat.vue +11 -3
  17. package/src/components/agentic_chat/web_agentic_duo_chat.vue +14 -0
  18. package/src/components/chat/components/duo_chat_conversation/duo_chat_conversation.vue +14 -0
  19. package/src/components/chat/components/duo_chat_header/duo_chat_header.vue +26 -14
  20. package/src/components/chat/components/duo_chat_message/duo_chat_message.vue +14 -1
  21. package/src/components/chat/components/duo_chat_message/message_types/index.js +2 -13
  22. package/src/components/chat/components/duo_chat_message/message_types/message_map.vue +51 -30
  23. package/src/components/chat/components/duo_chat_message/message_types/message_tool.vue +1 -13
  24. package/src/components/chat/components/duo_chat_message/message_types/message_tool_approved.vue +32 -0
  25. package/src/components/chat/components/utils.js +9 -0
  26. package/src/components/chat/constants.js +10 -0
  27. package/src/index.js +10 -8
  28. package/dist/components/chat/components/duo_chat_message/message_types/constants.js +0 -11
  29. package/src/components/chat/components/duo_chat_message/message_types/constants.js +0 -15
@@ -0,0 +1,32 @@
1
+ <script>
2
+ import MessageToolApproval from '../../duo_chat_message_tool_approval/message_tool_approval.vue';
3
+
4
+ export default {
5
+ name: 'MessageToolApproved',
6
+ components: { MessageToolApproval },
7
+ props: {
8
+ message: {
9
+ required: true,
10
+ type: Object,
11
+ },
12
+ workingDirectory: {
13
+ required: false,
14
+ type: String,
15
+ default: '',
16
+ },
17
+ },
18
+ computed: {
19
+ messages() {
20
+ return [this.message];
21
+ },
22
+ },
23
+ };
24
+ </script>
25
+ <template>
26
+ <message-tool-approval
27
+ :messages="messages"
28
+ :working-directory="workingDirectory"
29
+ approval-status="approved"
30
+ v-on="$listeners"
31
+ />
32
+ </template>
@@ -1,3 +1,12 @@
1
+ export const isValidMessageRenderer = (renderer) =>
2
+ renderer !== null &&
3
+ typeof renderer === 'object' &&
4
+ typeof renderer.component === 'object' &&
5
+ typeof renderer.matchMessage === 'function';
6
+
7
+ export const messageRenderersValidator = (renderers) =>
8
+ Array.isArray(renderers) && renderers.every((renderer) => isValidMessageRenderer(renderer));
9
+
1
10
  export const concatUntilEmpty = (arr) => {
2
11
  if (!arr) return '';
3
12
 
@@ -31,6 +31,16 @@ export const MESSAGE_MODEL_ROLES = {
31
31
  workflow_end: 'workflow_end',
32
32
  };
33
33
 
34
+ export const VALID_MESSAGE_TYPES = [
35
+ MESSAGE_MODEL_ROLES.agent,
36
+ MESSAGE_MODEL_ROLES.workflow_end,
37
+ MESSAGE_MODEL_ROLES.request,
38
+ MESSAGE_MODEL_ROLES.tool,
39
+ MESSAGE_MODEL_ROLES.user,
40
+ MESSAGE_MODEL_ROLES.system,
41
+ MESSAGE_MODEL_ROLES.assistant,
42
+ ];
43
+
34
44
  export const SELECTED_CONTEXT_ITEMS_DEFAULT_COLLAPSED = true;
35
45
 
36
46
  // TODO this should be a shared util in GitLab UI
package/src/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ import { MESSAGE_MODEL_ROLES } from './components/chat/constants';
2
+
1
3
  export { default as DuoUserFeedback } from './components/user_feedback/user_feedback.vue';
2
4
 
3
5
  // Duo Chat component
@@ -9,14 +11,14 @@ export { default as DuoChatMessageSources } from './components/chat/components/d
9
11
  export { default as DuoChatPredefinedPrompts } from './components/chat/components/duo_chat_predefined_prompts/duo_chat_predefined_prompts.vue';
10
12
 
11
13
  // Duo message types
12
- export {
13
- VALID_MESSAGE_TYPES,
14
- AGENT_MESSAGE_TYPE,
15
- USER_MESSAGE_TYPE,
16
- FLOW_END_TYPE,
17
- INPUT_REQUEST_TYPE,
18
- TOOL_MESSAGE_TYPE,
19
- } from './components/chat/components/duo_chat_message/message_types/constants';
14
+ export { MESSAGE_MODEL_ROLES, VALID_MESSAGE_TYPES } from './components/chat/constants';
15
+
16
+ // Legacy message type exports for backward compatibility
17
+ export const AGENT_MESSAGE_TYPE = MESSAGE_MODEL_ROLES.agent;
18
+ export const USER_MESSAGE_TYPE = MESSAGE_MODEL_ROLES.user;
19
+ export const FLOW_END_TYPE = MESSAGE_MODEL_ROLES.workflow_end;
20
+ export const INPUT_REQUEST_TYPE = MESSAGE_MODEL_ROLES.request;
21
+ export const TOOL_MESSAGE_TYPE = MESSAGE_MODEL_ROLES.tool;
20
22
 
21
23
  // Duo message type components
22
24
  export { default as MessageMap } from './components/chat/components/duo_chat_message/message_types/message_map.vue';
@@ -1,11 +0,0 @@
1
- // Message type constants
2
- const AGENT_MESSAGE_TYPE = 'agent';
3
- const FLOW_END_TYPE = 'workflow_end';
4
- const INPUT_REQUEST_TYPE = 'request';
5
- const TOOL_MESSAGE_TYPE = 'tool';
6
- const USER_MESSAGE_TYPE = 'user';
7
-
8
- // Array of all valid message types for validation
9
- const VALID_MESSAGE_TYPES = [AGENT_MESSAGE_TYPE, FLOW_END_TYPE, INPUT_REQUEST_TYPE, TOOL_MESSAGE_TYPE, USER_MESSAGE_TYPE];
10
-
11
- export { AGENT_MESSAGE_TYPE, FLOW_END_TYPE, INPUT_REQUEST_TYPE, TOOL_MESSAGE_TYPE, USER_MESSAGE_TYPE, VALID_MESSAGE_TYPES };
@@ -1,15 +0,0 @@
1
- // Message type constants
2
- export const AGENT_MESSAGE_TYPE = 'agent';
3
- export const FLOW_END_TYPE = 'workflow_end';
4
- export const INPUT_REQUEST_TYPE = 'request';
5
- export const TOOL_MESSAGE_TYPE = 'tool';
6
- export const USER_MESSAGE_TYPE = 'user';
7
-
8
- // Array of all valid message types for validation
9
- export const VALID_MESSAGE_TYPES = [
10
- AGENT_MESSAGE_TYPE,
11
- FLOW_END_TYPE,
12
- INPUT_REQUEST_TYPE,
13
- TOOL_MESSAGE_TYPE,
14
- USER_MESSAGE_TYPE,
15
- ];