@gitlab/duo-ui 8.14.2 → 8.16.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.
- package/CHANGELOG.md +14 -0
- package/dist/components/chat/components/duo_chat_context/constants.js +2 -1
- package/dist/components/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_category_items.js +5 -2
- package/dist/components/chat/components/duo_chat_context/mock_context_data.js +33 -4
- package/dist/components/chat/components/duo_chat_message/message_types/message_agent.js +1 -1
- package/dist/components/chat/components/duo_chat_message/message_types/message_base.js +5 -2
- package/dist/components/chat/components/duo_chat_message/message_types/message_input_requested.js +1 -1
- package/dist/components/chat/components/duo_chat_message/message_types/message_tool.js +27 -6
- package/dist/components/chat/components/duo_chat_message/message_types/message_workflow_end.js +1 -1
- package/dist/components/chat/mock_data.js +5 -1
- package/dist/index.js +4 -0
- package/package.json +3 -3
- package/src/components/chat/components/duo_chat_context/constants.js +1 -0
- package/src/components/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu.md +1 -1
- package/src/components/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_category_items.vue +10 -1
- package/src/components/chat/components/duo_chat_context/mock_context_data.js +36 -1
- package/src/components/chat/components/duo_chat_message/message_types/message_agent.vue +1 -1
- package/src/components/chat/components/duo_chat_message/message_types/message_base.vue +4 -1
- package/src/components/chat/components/duo_chat_message/message_types/message_input_requested.vue +1 -1
- package/src/components/chat/components/duo_chat_message/message_types/message_tool.vue +38 -11
- package/src/components/chat/components/duo_chat_message/message_types/message_workflow_end.vue +1 -1
- package/src/components/chat/mock_data.js +4 -0
- package/src/index.js +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [8.16.0](https://gitlab.com/gitlab-org/duo-ui/compare/v8.15.0...v8.16.0) (2025-05-14)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* Add repository context category ([793f77d](https://gitlab.com/gitlab-org/duo-ui/commit/793f77d76f3673a2cac5fc116b864b3c3779d0bf))
|
|
7
|
+
|
|
8
|
+
# [8.15.0](https://gitlab.com/gitlab-org/duo-ui/compare/v8.14.2...v8.15.0) (2025-05-12)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* Add new tool call styling ([8501c64](https://gitlab.com/gitlab-org/duo-ui/commit/8501c64e87d11aee0274043e1e6d32bfac05fbc0))
|
|
14
|
+
|
|
1
15
|
## [8.14.2](https://gitlab.com/gitlab-org/duo-ui/compare/v8.14.1...v8.14.2) (2025-05-05)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -4,8 +4,9 @@ const CONTEXT_ITEM_CATEGORY_FILE = 'file';
|
|
|
4
4
|
const CONTEXT_ITEM_CATEGORY_LOCAL_GIT = 'local_git';
|
|
5
5
|
const CONTEXT_ITEM_CATEGORY_DEPENDENCY = 'dependency';
|
|
6
6
|
const CONTEXT_ITEM_CATEGORY_TERMINAL_SELECTION = 'terminal';
|
|
7
|
+
const CONTEXT_ITEM_CATEGORY_REPOSITORY = 'repository';
|
|
7
8
|
const LANGUAGE_IDENTIFIER_PREFIX = 'language-';
|
|
8
9
|
const LANGUAGE_IDENTIFIER_DIFF = 'language-diff';
|
|
9
10
|
const LANGUAGE_IDENTIFIER_PLAINTEXT = 'language-plaintext';
|
|
10
11
|
|
|
11
|
-
export { CONTEXT_ITEM_CATEGORY_DEPENDENCY, CONTEXT_ITEM_CATEGORY_FILE, CONTEXT_ITEM_CATEGORY_ISSUE, CONTEXT_ITEM_CATEGORY_LOCAL_GIT, CONTEXT_ITEM_CATEGORY_MERGE_REQUEST, CONTEXT_ITEM_CATEGORY_TERMINAL_SELECTION, LANGUAGE_IDENTIFIER_DIFF, LANGUAGE_IDENTIFIER_PLAINTEXT, LANGUAGE_IDENTIFIER_PREFIX };
|
|
12
|
+
export { CONTEXT_ITEM_CATEGORY_DEPENDENCY, CONTEXT_ITEM_CATEGORY_FILE, CONTEXT_ITEM_CATEGORY_ISSUE, CONTEXT_ITEM_CATEGORY_LOCAL_GIT, CONTEXT_ITEM_CATEGORY_MERGE_REQUEST, CONTEXT_ITEM_CATEGORY_REPOSITORY, CONTEXT_ITEM_CATEGORY_TERMINAL_SELECTION, LANGUAGE_IDENTIFIER_DIFF, LANGUAGE_IDENTIFIER_PLAINTEXT, LANGUAGE_IDENTIFIER_PREFIX };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GlIcon, GlDropdownItem } from '@gitlab/ui';
|
|
1
|
+
import { GlIcon, GlDropdownItem, GlTooltipDirective } from '@gitlab/ui';
|
|
2
2
|
import { categoriesValidator } from '../utils';
|
|
3
3
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
4
4
|
|
|
@@ -8,6 +8,9 @@ var script = {
|
|
|
8
8
|
GlIcon,
|
|
9
9
|
GlDropdownItem
|
|
10
10
|
},
|
|
11
|
+
directives: {
|
|
12
|
+
GlTooltip: GlTooltipDirective
|
|
13
|
+
},
|
|
11
14
|
props: {
|
|
12
15
|
categories: {
|
|
13
16
|
type: Array,
|
|
@@ -33,7 +36,7 @@ var script = {
|
|
|
33
36
|
const __vue_script__ = script;
|
|
34
37
|
|
|
35
38
|
/* template */
|
|
36
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('ul',{staticClass:"gl-mb-0 gl-list-none gl-pl-0"},_vm._l((_vm.categories),function(category,index){return _c('gl-dropdown-item',{key:category.value,class:{ 'active-command': index === _vm.activeIndex },attrs:{"data-testid":"category-item"},on:{"click":function($event){return _vm.selectCategory(category)}}},[_c('div',{staticClass:"gl-flex gl-items-center",on:{"mouseenter":function($event){return _vm.setActiveIndex(index)}}},[_c('gl-icon',{staticClass:"gl-mr-2",attrs:{"name":category.icon}}),_vm._v("\n "+_vm._s(category.label)+"\n
|
|
39
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('ul',{staticClass:"gl-mb-0 gl-list-none gl-pl-0"},_vm._l((_vm.categories),function(category,index){return _c('gl-dropdown-item',{key:category.value,class:{ 'active-command': index === _vm.activeIndex },attrs:{"data-testid":"category-item"},on:{"click":function($event){return _vm.selectCategory(category)}}},[_c('div',{staticClass:"gl-flex gl-items-center",on:{"mouseenter":function($event){return _vm.setActiveIndex(index)}}},[_c('gl-icon',{staticClass:"gl-mr-2",attrs:{"name":category.icon}}),_vm._v("\n "+_vm._s(category.label)+"\n "),(category.tooltip)?_c('gl-icon',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip",value:(category.tooltip),expression:"category.tooltip"}],staticClass:"gl-ml-2",attrs:{"name":"information-o"}}):_vm._e()],1)])}),1)};
|
|
37
40
|
var __vue_staticRenderFns__ = [];
|
|
38
41
|
|
|
39
42
|
/* style */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CONTEXT_ITEM_CATEGORY_DEPENDENCY, CONTEXT_ITEM_CATEGORY_FILE, CONTEXT_ITEM_CATEGORY_LOCAL_GIT, CONTEXT_ITEM_CATEGORY_ISSUE, CONTEXT_ITEM_CATEGORY_MERGE_REQUEST } from './constants';
|
|
1
|
+
import { CONTEXT_ITEM_CATEGORY_DEPENDENCY, CONTEXT_ITEM_CATEGORY_FILE, CONTEXT_ITEM_CATEGORY_LOCAL_GIT, CONTEXT_ITEM_CATEGORY_ISSUE, CONTEXT_ITEM_CATEGORY_MERGE_REQUEST, CONTEXT_ITEM_CATEGORY_REPOSITORY } from './constants';
|
|
2
2
|
|
|
3
3
|
const MOCK_CATEGORIES = [{
|
|
4
4
|
label: 'Files',
|
|
@@ -20,6 +20,11 @@ const MOCK_CATEGORIES = [{
|
|
|
20
20
|
label: 'Dependencies',
|
|
21
21
|
value: CONTEXT_ITEM_CATEGORY_DEPENDENCY,
|
|
22
22
|
icon: 'package'
|
|
23
|
+
}, {
|
|
24
|
+
label: 'Repositories',
|
|
25
|
+
value: CONTEXT_ITEM_CATEGORY_REPOSITORY,
|
|
26
|
+
icon: 'project',
|
|
27
|
+
tooltip: 'Best for broad relational questions. Fills context quickly.'
|
|
23
28
|
}];
|
|
24
29
|
function getMockCategory(categoryValue) {
|
|
25
30
|
return MOCK_CATEGORIES.find(cat => cat.value === categoryValue);
|
|
@@ -250,7 +255,7 @@ const MOCK_CONTEXT_ITEM_DEPENDENCY = {
|
|
|
250
255
|
}
|
|
251
256
|
};
|
|
252
257
|
const MOCK_CONTEXT_ITEM_DEPENDENCY_DISABLED = {
|
|
253
|
-
id: '
|
|
258
|
+
id: '654e4567-e89b-12d3-a456-4266149801',
|
|
254
259
|
category: CONTEXT_ITEM_CATEGORY_DEPENDENCY,
|
|
255
260
|
content: JSON.stringify([{
|
|
256
261
|
javascript: ['@types/node@16.11.7', '@vue/compiler-sfc@3.2.37', 'typescript@4.5.5', 'vue@3.2.37'],
|
|
@@ -267,6 +272,30 @@ const MOCK_CONTEXT_ITEM_DEPENDENCY_DISABLED = {
|
|
|
267
272
|
project: 'example/vehicle'
|
|
268
273
|
}
|
|
269
274
|
};
|
|
275
|
+
const MOCK_CONTEXT_ITEM_REPOSITORY = {
|
|
276
|
+
id: '4354e4567-e89b-12d3-a456-4266146087',
|
|
277
|
+
category: CONTEXT_ITEM_CATEGORY_REPOSITORY,
|
|
278
|
+
content: '',
|
|
279
|
+
metadata: {
|
|
280
|
+
enabled: true,
|
|
281
|
+
title: 'example/garden',
|
|
282
|
+
icon: 'project',
|
|
283
|
+
subType: 'repository'
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
const MOCK_CONTEXT_ITEM_REPOSITORY_DISABLED = {
|
|
287
|
+
id: '923e4567-e89b-12d3-a456-426614174008',
|
|
288
|
+
category: CONTEXT_ITEM_CATEGORY_REPOSITORY,
|
|
289
|
+
content: '',
|
|
290
|
+
metadata: {
|
|
291
|
+
enabled: false,
|
|
292
|
+
disabledReasons: ['This repository is not available', 'Access restricted'],
|
|
293
|
+
title: 'example/vehicle',
|
|
294
|
+
icon: 'project',
|
|
295
|
+
subType: 'repository'
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
const mockRepositories = [MOCK_CONTEXT_ITEM_REPOSITORY, MOCK_CONTEXT_ITEM_REPOSITORY_DISABLED];
|
|
270
299
|
const mockDependencies = [MOCK_CONTEXT_ITEM_DEPENDENCY, MOCK_CONTEXT_ITEM_DEPENDENCY_DISABLED, {
|
|
271
300
|
id: 'b23e4567-e89b-12d3-a456-426614174010',
|
|
272
301
|
category: CONTEXT_ITEM_CATEGORY_DEPENDENCY,
|
|
@@ -317,7 +346,7 @@ const MOCK_CONTEXT_ITEM_TERMINAL = {
|
|
|
317
346
|
};
|
|
318
347
|
const mockTerminalSelections = [MOCK_CONTEXT_ITEM_TERMINAL];
|
|
319
348
|
const getMockContextItems = () => {
|
|
320
|
-
const allItems = [...mockFiles, ...mockGitItems, ...mockIssues, ...mockMergeRequests, ...mockDependencies, ...mockTerminalSelections];
|
|
349
|
+
const allItems = [...mockFiles, ...mockGitItems, ...mockIssues, ...mockMergeRequests, ...mockDependencies, ...mockTerminalSelections, ...mockRepositories];
|
|
321
350
|
|
|
322
351
|
// put disabled items in the back
|
|
323
352
|
const disabledItems = allItems.filter(item => !item.metadata.enabled);
|
|
@@ -325,4 +354,4 @@ const getMockContextItems = () => {
|
|
|
325
354
|
return [...enabledItems, ...disabledItems];
|
|
326
355
|
};
|
|
327
356
|
|
|
328
|
-
export { MOCK_CATEGORIES, MOCK_CONTEXT_FILE_CONTENT, MOCK_CONTEXT_FILE_DIFF_CONTENT, MOCK_CONTEXT_ITEM_DEPENDENCY, MOCK_CONTEXT_ITEM_DEPENDENCY_DISABLED, MOCK_CONTEXT_ITEM_FILE, MOCK_CONTEXT_ITEM_FILE_DISABLED, MOCK_CONTEXT_ITEM_GIT_COMMIT, MOCK_CONTEXT_ITEM_GIT_DIFF, MOCK_CONTEXT_ITEM_ISSUE, MOCK_CONTEXT_ITEM_ISSUE_DISABLED, MOCK_CONTEXT_ITEM_MERGE_REQUEST, MOCK_CONTEXT_ITEM_MERGE_REQUEST_DISABLED, MOCK_CONTEXT_ITEM_TERMINAL, getMockCategory, getMockContextItems };
|
|
357
|
+
export { MOCK_CATEGORIES, MOCK_CONTEXT_FILE_CONTENT, MOCK_CONTEXT_FILE_DIFF_CONTENT, MOCK_CONTEXT_ITEM_DEPENDENCY, MOCK_CONTEXT_ITEM_DEPENDENCY_DISABLED, MOCK_CONTEXT_ITEM_FILE, MOCK_CONTEXT_ITEM_FILE_DISABLED, MOCK_CONTEXT_ITEM_GIT_COMMIT, MOCK_CONTEXT_ITEM_GIT_DIFF, MOCK_CONTEXT_ITEM_ISSUE, MOCK_CONTEXT_ITEM_ISSUE_DISABLED, MOCK_CONTEXT_ITEM_MERGE_REQUEST, MOCK_CONTEXT_ITEM_MERGE_REQUEST_DISABLED, MOCK_CONTEXT_ITEM_REPOSITORY, MOCK_CONTEXT_ITEM_REPOSITORY_DISABLED, MOCK_CONTEXT_ITEM_TERMINAL, getMockCategory, getMockContextItems };
|
|
@@ -3,7 +3,7 @@ import { renderDuoChatMarkdownPreview } from '../../../markdown_renderer';
|
|
|
3
3
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
4
4
|
|
|
5
5
|
var script = {
|
|
6
|
-
name: '
|
|
6
|
+
name: 'DuoBaseMessage',
|
|
7
7
|
components: {
|
|
8
8
|
GlIcon
|
|
9
9
|
},
|
|
@@ -33,7 +33,10 @@ var script = {
|
|
|
33
33
|
*/
|
|
34
34
|
message: {
|
|
35
35
|
type: Object,
|
|
36
|
-
required: true
|
|
36
|
+
required: true,
|
|
37
|
+
validate: message => {
|
|
38
|
+
return message && message.content && message.role && message.errors;
|
|
39
|
+
}
|
|
37
40
|
}
|
|
38
41
|
},
|
|
39
42
|
computed: {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { GlLink } from '@gitlab/ui';
|
|
1
|
+
import { GlIcon, GlLink } from '@gitlab/ui';
|
|
2
2
|
import BaseMessage from './message_base';
|
|
3
3
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
4
4
|
|
|
5
5
|
var script = {
|
|
6
|
-
name: '
|
|
6
|
+
name: 'DuoToolMessage',
|
|
7
7
|
components: {
|
|
8
8
|
BaseMessage,
|
|
9
|
+
GlIcon,
|
|
9
10
|
GlLink
|
|
10
11
|
},
|
|
11
12
|
provide: {
|
|
@@ -20,13 +21,33 @@ var script = {
|
|
|
20
21
|
props: {
|
|
21
22
|
message: {
|
|
22
23
|
required: true,
|
|
23
|
-
type: Object
|
|
24
|
+
type: Object,
|
|
25
|
+
validate: value => {
|
|
26
|
+
return value && value.tool_info;
|
|
27
|
+
}
|
|
24
28
|
}
|
|
25
29
|
},
|
|
26
30
|
computed: {
|
|
31
|
+
iconName() {
|
|
32
|
+
var _this$message$tool_in;
|
|
33
|
+
switch ((_this$message$tool_in = this.message.tool_info) === null || _this$message$tool_in === void 0 ? void 0 : _this$message$tool_in.name) {
|
|
34
|
+
case 'read_file':
|
|
35
|
+
return 'eye';
|
|
36
|
+
case 'write_file':
|
|
37
|
+
return 'pencil';
|
|
38
|
+
case 'grep_files':
|
|
39
|
+
case 'list_files':
|
|
40
|
+
return 'search';
|
|
41
|
+
case 'get_issue':
|
|
42
|
+
case 'list_issue_notes':
|
|
43
|
+
return 'issues';
|
|
44
|
+
default:
|
|
45
|
+
return 'issue-type-maintenance';
|
|
46
|
+
}
|
|
47
|
+
},
|
|
27
48
|
messageFilePath() {
|
|
28
|
-
var _this$message$
|
|
29
|
-
return (_this$message$
|
|
49
|
+
var _this$message$tool_in2, _this$message$tool_in3;
|
|
50
|
+
return (_this$message$tool_in2 = this.message.tool_info) === null || _this$message$tool_in2 === void 0 ? void 0 : (_this$message$tool_in3 = _this$message$tool_in2.args) === null || _this$message$tool_in3 === void 0 ? void 0 : _this$message$tool_in3.file_path;
|
|
30
51
|
}
|
|
31
52
|
},
|
|
32
53
|
methods: {
|
|
@@ -42,7 +63,7 @@ const __vue_script__ = script;
|
|
|
42
63
|
/* template */
|
|
43
64
|
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('base-message',{attrs:{"message":_vm.message},scopedSlots:_vm._u([{key:"message",fn:function(ref){
|
|
44
65
|
var content = ref.content;
|
|
45
|
-
return [_c('
|
|
66
|
+
return [_c('div',{staticClass:"gl-flex gl-items-baseline !gl-text-subtle"},[_c('div',{staticClass:"gl-mr-3 gl-flex-shrink-0"},[_c('gl-icon',{attrs:{"name":_vm.iconName}})],1),_vm._v(" "),_c('div',[_c('span',[_vm._v(_vm._s(content))]),_vm._v(" "),(_vm.messageFilePath)?_c('gl-link',{staticClass:"gl-markdown file-path-link gl-break-all",attrs:{"data-testid":"file-path-link"},on:{"click":function($event){$event.preventDefault();return _vm.onOpenFilePath.apply(null, arguments)}}},[_c('code',[_vm._v(_vm._s(_vm.messageFilePath))])]):_vm._e()],1)])]}}])})};
|
|
46
67
|
var __vue_staticRenderFns__ = [];
|
|
47
68
|
|
|
48
69
|
/* style */
|
|
@@ -33,13 +33,17 @@ const MOCK_RESPONSE_MESSAGE = {
|
|
|
33
33
|
const MOCK_TOOL_MESSAGE = {
|
|
34
34
|
id: '123',
|
|
35
35
|
content: "Search for 'duo.*chat.*message' in directory",
|
|
36
|
-
message_type: MESSAGE_MODEL_ROLES.tool
|
|
36
|
+
message_type: MESSAGE_MODEL_ROLES.tool,
|
|
37
|
+
tool_info: {
|
|
38
|
+
name: 'list_files'
|
|
39
|
+
}
|
|
37
40
|
};
|
|
38
41
|
const MOCK_TOOL_MESSAGE_WITH_LINK = {
|
|
39
42
|
id: '123',
|
|
40
43
|
content: "Search for 'duo.*chat.*message' in directory",
|
|
41
44
|
message_type: MESSAGE_MODEL_ROLES.tool,
|
|
42
45
|
tool_info: {
|
|
46
|
+
name: 'list_files',
|
|
43
47
|
args: {
|
|
44
48
|
file_path: '/path/to/file.js'
|
|
45
49
|
}
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,10 @@ export { default as DuoChatLoader } from './components/chat/components/duo_chat_
|
|
|
7
7
|
export { default as DuoChatMessage } from './components/chat/components/duo_chat_message/duo_chat_message';
|
|
8
8
|
export { default as DuoChatMessageSources } from './components/chat/components/duo_chat_message_sources/duo_chat_message_sources';
|
|
9
9
|
export { default as DuoChatPredefinedPrompts } from './components/chat/components/duo_chat_predefined_prompts/duo_chat_predefined_prompts';
|
|
10
|
+
export { default as AgentMessage } from './components/chat/components/duo_chat_message/message_types/message_agent';
|
|
11
|
+
export { default as InputRequestedMessage } from './components/chat/components/duo_chat_message/message_types/message_input_requested';
|
|
12
|
+
export { default as SystemMessage } from './components/chat/components/duo_chat_message/message_types/message_tool';
|
|
13
|
+
export { default as WorkflowEndMessage } from './components/chat/components/duo_chat_message/message_types/message_workflow_end';
|
|
10
14
|
export { default as AgenticDuoChat } from './components/agentic_chat/agentic_duo_chat';
|
|
11
15
|
export { default as DuoChatContextItemDetailsModal } from './components/chat/components/duo_chat_context/duo_chat_context_item_details_modal/duo_chat_context_item_details_modal';
|
|
12
16
|
export { default as DuoChatContextItemMenu } from './components/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/duo-ui",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.16.0",
|
|
4
4
|
"description": "Duo UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -95,12 +95,12 @@
|
|
|
95
95
|
"@babel/core": "^7.27.1",
|
|
96
96
|
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
|
|
97
97
|
"@babel/plugin-proposal-optional-chaining": "^7.21.0",
|
|
98
|
-
"@babel/preset-env": "^7.27.
|
|
98
|
+
"@babel/preset-env": "^7.27.2",
|
|
99
99
|
"@babel/preset-react": "^7.27.1",
|
|
100
100
|
"@gitlab/eslint-plugin": "20.7.1",
|
|
101
101
|
"@gitlab/fonts": "^1.3.0",
|
|
102
102
|
"@gitlab/stylelint-config": "6.2.2",
|
|
103
|
-
"@gitlab/svgs": "^3.
|
|
103
|
+
"@gitlab/svgs": "^3.129.0",
|
|
104
104
|
"@gitlab/ui": "latest",
|
|
105
105
|
"@jest/test-sequencer": "^29.7.0",
|
|
106
106
|
"@rollup/plugin-commonjs": "^11.1.0",
|
|
@@ -4,6 +4,7 @@ export const CONTEXT_ITEM_CATEGORY_FILE = 'file';
|
|
|
4
4
|
export const CONTEXT_ITEM_CATEGORY_LOCAL_GIT = 'local_git';
|
|
5
5
|
export const CONTEXT_ITEM_CATEGORY_DEPENDENCY = 'dependency';
|
|
6
6
|
export const CONTEXT_ITEM_CATEGORY_TERMINAL_SELECTION = 'terminal';
|
|
7
|
+
export const CONTEXT_ITEM_CATEGORY_REPOSITORY = 'repository';
|
|
7
8
|
|
|
8
9
|
export const LANGUAGE_IDENTIFIER_PREFIX = 'language-';
|
|
9
10
|
export const LANGUAGE_IDENTIFIER_DIFF = 'language-diff';
|
|
@@ -11,7 +11,7 @@ The component expects items with specific display properties:
|
|
|
11
11
|
```typescript
|
|
12
12
|
export type AIContextItem = {
|
|
13
13
|
id: string;
|
|
14
|
-
category: 'file' | 'snippet' | 'issue' | 'merge_request' | 'dependency';
|
|
14
|
+
category: 'file' | 'snippet' | 'issue' | 'merge_request' | 'dependency' | 'repository';
|
|
15
15
|
|
|
16
16
|
content?: string; // some categories allow loading/displaying content in the details-modal
|
|
17
17
|
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { GlDropdownItem, GlIcon } from '@gitlab/ui';
|
|
2
|
+
import { GlDropdownItem, GlIcon, GlTooltipDirective } from '@gitlab/ui';
|
|
3
3
|
import { categoriesValidator } from '../utils';
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
name: 'DuoChatContextItemMenuCategoryItems',
|
|
7
7
|
components: { GlIcon, GlDropdownItem },
|
|
8
|
+
directives: {
|
|
9
|
+
GlTooltip: GlTooltipDirective,
|
|
10
|
+
},
|
|
8
11
|
props: {
|
|
9
12
|
categories: {
|
|
10
13
|
type: Array,
|
|
@@ -38,6 +41,12 @@ export default {
|
|
|
38
41
|
<div class="gl-flex gl-items-center" @mouseenter="setActiveIndex(index)">
|
|
39
42
|
<gl-icon :name="category.icon" class="gl-mr-2" />
|
|
40
43
|
{{ category.label }}
|
|
44
|
+
<gl-icon
|
|
45
|
+
v-if="category.tooltip"
|
|
46
|
+
v-gl-tooltip="category.tooltip"
|
|
47
|
+
name="information-o"
|
|
48
|
+
class="gl-ml-2"
|
|
49
|
+
/>
|
|
41
50
|
</div>
|
|
42
51
|
</gl-dropdown-item>
|
|
43
52
|
</ul>
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
CONTEXT_ITEM_CATEGORY_ISSUE,
|
|
5
5
|
CONTEXT_ITEM_CATEGORY_LOCAL_GIT,
|
|
6
6
|
CONTEXT_ITEM_CATEGORY_MERGE_REQUEST,
|
|
7
|
+
CONTEXT_ITEM_CATEGORY_REPOSITORY,
|
|
7
8
|
} from './constants';
|
|
8
9
|
|
|
9
10
|
export const MOCK_CATEGORIES = [
|
|
@@ -12,6 +13,12 @@ export const MOCK_CATEGORIES = [
|
|
|
12
13
|
{ label: 'Issues', value: CONTEXT_ITEM_CATEGORY_ISSUE, icon: 'issues' },
|
|
13
14
|
{ label: 'Merge Requests', value: CONTEXT_ITEM_CATEGORY_MERGE_REQUEST, icon: 'merge-request' },
|
|
14
15
|
{ label: 'Dependencies', value: CONTEXT_ITEM_CATEGORY_DEPENDENCY, icon: 'package' },
|
|
16
|
+
{
|
|
17
|
+
label: 'Repositories',
|
|
18
|
+
value: CONTEXT_ITEM_CATEGORY_REPOSITORY,
|
|
19
|
+
icon: 'project',
|
|
20
|
+
tooltip: 'Best for broad relational questions. Fills context quickly.',
|
|
21
|
+
},
|
|
15
22
|
];
|
|
16
23
|
|
|
17
24
|
export function getMockCategory(categoryValue) {
|
|
@@ -284,7 +291,7 @@ export const MOCK_CONTEXT_ITEM_DEPENDENCY = {
|
|
|
284
291
|
};
|
|
285
292
|
|
|
286
293
|
export const MOCK_CONTEXT_ITEM_DEPENDENCY_DISABLED = {
|
|
287
|
-
id: '
|
|
294
|
+
id: '654e4567-e89b-12d3-a456-4266149801',
|
|
288
295
|
category: CONTEXT_ITEM_CATEGORY_DEPENDENCY,
|
|
289
296
|
content: JSON.stringify([
|
|
290
297
|
{
|
|
@@ -309,6 +316,33 @@ export const MOCK_CONTEXT_ITEM_DEPENDENCY_DISABLED = {
|
|
|
309
316
|
},
|
|
310
317
|
};
|
|
311
318
|
|
|
319
|
+
export const MOCK_CONTEXT_ITEM_REPOSITORY = {
|
|
320
|
+
id: '4354e4567-e89b-12d3-a456-4266146087',
|
|
321
|
+
category: CONTEXT_ITEM_CATEGORY_REPOSITORY,
|
|
322
|
+
content: '',
|
|
323
|
+
metadata: {
|
|
324
|
+
enabled: true,
|
|
325
|
+
title: 'example/garden',
|
|
326
|
+
icon: 'project',
|
|
327
|
+
subType: 'repository',
|
|
328
|
+
},
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
export const MOCK_CONTEXT_ITEM_REPOSITORY_DISABLED = {
|
|
332
|
+
id: '923e4567-e89b-12d3-a456-426614174008',
|
|
333
|
+
category: CONTEXT_ITEM_CATEGORY_REPOSITORY,
|
|
334
|
+
content: '',
|
|
335
|
+
metadata: {
|
|
336
|
+
enabled: false,
|
|
337
|
+
disabledReasons: ['This repository is not available', 'Access restricted'],
|
|
338
|
+
title: 'example/vehicle',
|
|
339
|
+
icon: 'project',
|
|
340
|
+
subType: 'repository',
|
|
341
|
+
},
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
const mockRepositories = [MOCK_CONTEXT_ITEM_REPOSITORY, MOCK_CONTEXT_ITEM_REPOSITORY_DISABLED];
|
|
345
|
+
|
|
312
346
|
const mockDependencies = [
|
|
313
347
|
MOCK_CONTEXT_ITEM_DEPENDENCY,
|
|
314
348
|
MOCK_CONTEXT_ITEM_DEPENDENCY_DISABLED,
|
|
@@ -378,6 +412,7 @@ export const getMockContextItems = () => {
|
|
|
378
412
|
...mockMergeRequests,
|
|
379
413
|
...mockDependencies,
|
|
380
414
|
...mockTerminalSelections,
|
|
415
|
+
...mockRepositories,
|
|
381
416
|
];
|
|
382
417
|
|
|
383
418
|
// put disabled items in the back
|
|
@@ -4,7 +4,7 @@ import { GlIcon, GlTooltipDirective, GlSafeHtmlDirective as SafeHtml } from '@gi
|
|
|
4
4
|
import { renderDuoChatMarkdownPreview } from '../../../markdown_renderer';
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
|
-
name: '
|
|
7
|
+
name: 'DuoBaseMessage',
|
|
8
8
|
components: {
|
|
9
9
|
GlIcon,
|
|
10
10
|
},
|
|
@@ -35,6 +35,9 @@ export default {
|
|
|
35
35
|
message: {
|
|
36
36
|
type: Object,
|
|
37
37
|
required: true,
|
|
38
|
+
validate: (message) => {
|
|
39
|
+
return message && message.content && message.role && message.errors;
|
|
40
|
+
},
|
|
38
41
|
},
|
|
39
42
|
},
|
|
40
43
|
computed: {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { GlLink } from '@gitlab/ui';
|
|
2
|
+
import { GlIcon, GlLink } from '@gitlab/ui';
|
|
3
3
|
import BaseMessage from './message_base.vue';
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
|
-
name: '
|
|
6
|
+
name: 'DuoToolMessage',
|
|
7
7
|
components: {
|
|
8
8
|
BaseMessage,
|
|
9
|
+
GlIcon,
|
|
9
10
|
GlLink,
|
|
10
11
|
},
|
|
11
12
|
provide: {
|
|
@@ -21,9 +22,28 @@ export default {
|
|
|
21
22
|
message: {
|
|
22
23
|
required: true,
|
|
23
24
|
type: Object,
|
|
25
|
+
validate: (value) => {
|
|
26
|
+
return value && value.tool_info;
|
|
27
|
+
},
|
|
24
28
|
},
|
|
25
29
|
},
|
|
26
30
|
computed: {
|
|
31
|
+
iconName() {
|
|
32
|
+
switch (this.message.tool_info?.name) {
|
|
33
|
+
case 'read_file':
|
|
34
|
+
return 'eye';
|
|
35
|
+
case 'write_file':
|
|
36
|
+
return 'pencil';
|
|
37
|
+
case 'grep_files':
|
|
38
|
+
case 'list_files':
|
|
39
|
+
return 'search';
|
|
40
|
+
case 'get_issue':
|
|
41
|
+
case 'list_issue_notes':
|
|
42
|
+
return 'issues';
|
|
43
|
+
default:
|
|
44
|
+
return 'issue-type-maintenance';
|
|
45
|
+
}
|
|
46
|
+
},
|
|
27
47
|
messageFilePath() {
|
|
28
48
|
return this.message.tool_info?.args?.file_path;
|
|
29
49
|
},
|
|
@@ -38,15 +58,22 @@ export default {
|
|
|
38
58
|
<template>
|
|
39
59
|
<base-message :message="message">
|
|
40
60
|
<template #message="{ content }">
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
61
|
+
<div class="gl-flex gl-items-baseline !gl-text-subtle">
|
|
62
|
+
<div class="gl-mr-3 gl-flex-shrink-0">
|
|
63
|
+
<gl-icon :name="iconName" />
|
|
64
|
+
</div>
|
|
65
|
+
<div>
|
|
66
|
+
<span>{{ content }}</span>
|
|
67
|
+
<gl-link
|
|
68
|
+
v-if="messageFilePath"
|
|
69
|
+
class="gl-markdown file-path-link gl-break-all"
|
|
70
|
+
data-testid="file-path-link"
|
|
71
|
+
@click.prevent="onOpenFilePath"
|
|
72
|
+
>
|
|
73
|
+
<code>{{ messageFilePath }}</code>
|
|
74
|
+
</gl-link>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
50
77
|
</template>
|
|
51
78
|
</base-message>
|
|
52
79
|
</template>
|
|
@@ -48,6 +48,9 @@ export const MOCK_TOOL_MESSAGE = {
|
|
|
48
48
|
id: '123',
|
|
49
49
|
content: "Search for 'duo.*chat.*message' in directory",
|
|
50
50
|
message_type: MESSAGE_MODEL_ROLES.tool,
|
|
51
|
+
tool_info: {
|
|
52
|
+
name: 'list_files',
|
|
53
|
+
},
|
|
51
54
|
};
|
|
52
55
|
|
|
53
56
|
export const MOCK_TOOL_MESSAGE_WITH_LINK = {
|
|
@@ -55,6 +58,7 @@ export const MOCK_TOOL_MESSAGE_WITH_LINK = {
|
|
|
55
58
|
content: "Search for 'duo.*chat.*message' in directory",
|
|
56
59
|
message_type: MESSAGE_MODEL_ROLES.tool,
|
|
57
60
|
tool_info: {
|
|
61
|
+
name: 'list_files',
|
|
58
62
|
args: {
|
|
59
63
|
file_path: '/path/to/file.js',
|
|
60
64
|
},
|
package/src/index.js
CHANGED
|
@@ -12,6 +12,12 @@ export { default as DuoChatMessage } from './components/chat/components/duo_chat
|
|
|
12
12
|
export { default as DuoChatMessageSources } from './components/chat/components/duo_chat_message_sources/duo_chat_message_sources.vue';
|
|
13
13
|
export { default as DuoChatPredefinedPrompts } from './components/chat/components/duo_chat_predefined_prompts/duo_chat_predefined_prompts.vue';
|
|
14
14
|
|
|
15
|
+
// Duo message type components
|
|
16
|
+
export { default as AgentMessage } from './components/chat/components/duo_chat_message/message_types/message_agent.vue';
|
|
17
|
+
export { default as InputRequestedMessage } from './components/chat/components/duo_chat_message/message_types/message_input_requested.vue';
|
|
18
|
+
export { default as SystemMessage } from './components/chat/components/duo_chat_message/message_types/message_tool.vue';
|
|
19
|
+
export { default as WorkflowEndMessage } from './components/chat/components/duo_chat_message/message_types/message_workflow_end.vue';
|
|
20
|
+
|
|
15
21
|
// Agentic Duo Chat component
|
|
16
22
|
export { default as AgenticDuoChat } from './components/agentic_chat/agentic_duo_chat.vue';
|
|
17
23
|
|