@gitlab/duo-ui 11.1.2 → 11.2.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 +7 -0
- package/dist/components/chat/components/duo_chat_message/message_types/message_tool.js +8 -4
- package/dist/components/chat/components/duo_chat_message_tool_approval/components/base_tool_params.js +79 -0
- package/dist/components/chat/components/duo_chat_message_tool_approval/components/issuable_tool_params.js +116 -0
- package/dist/components/chat/components/duo_chat_message_tool_approval/components/run_command_tool_params.js +45 -5
- package/dist/components/chat/components/duo_chat_message_tool_approval/message_tool_approval.js +67 -20
- package/dist/components/chat/constants.js +12 -1
- package/dist/components/chat/mock_data.js +77 -1
- package/dist/components.css +1 -1
- package/dist/components.css.map +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/tailwind.css.map +1 -1
- package/package.json +2 -2
- package/src/components/chat/components/duo_chat_message/message_types/message_tool.vue +23 -11
- package/src/components/chat/components/duo_chat_message_tool_approval/components/base_tool_params.vue +55 -0
- package/src/components/chat/components/duo_chat_message_tool_approval/components/issuable_tool_params.vue +112 -0
- package/src/components/chat/components/duo_chat_message_tool_approval/components/run_command_tool_params.vue +51 -6
- package/src/components/chat/components/duo_chat_message_tool_approval/message_tool_approval.vue +97 -22
- package/src/components/chat/constants.js +12 -0
- package/src/components/chat/mock_data.js +80 -0
- package/translations.js +24 -7
- package/dist/components/chat/components/duo_chat_message_tool_approval/components/create_issue_tool_params.js +0 -88
- package/dist/components/chat/components/duo_chat_message_tool_approval/components/create_merge_request_tool_params.js +0 -83
- package/src/components/chat/components/duo_chat_message_tool_approval/components/create_issue_tool_params.vue +0 -80
- package/src/components/chat/components/duo_chat_message_tool_approval/components/create_merge_request_tool_params.vue +0 -74
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [11.2.0](https://gitlab.com/gitlab-org/duo-ui/compare/v11.1.2...v11.2.0) (2025-09-28)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* Further improvements to tool approval visualization in agentic chat ([e9b88ce](https://gitlab.com/gitlab-org/duo-ui/commit/e9b88ce8a7cf4396c907669eff5df90108996179))
|
|
7
|
+
|
|
1
8
|
## [11.1.2](https://gitlab.com/gitlab-org/duo-ui/compare/v11.1.1...v11.1.2) (2025-09-24)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { GlIcon, GlLink } from '@gitlab/ui';
|
|
2
2
|
import { translate } from '../../../../../utils/i18n';
|
|
3
|
-
import
|
|
3
|
+
import MessageToolApproval from '../../duo_chat_message_tool_approval/message_tool_approval';
|
|
4
|
+
import { APPROVAL_TOOL_NAMES } from '../../../constants';
|
|
4
5
|
import BaseMessage from './message_base';
|
|
5
6
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
6
7
|
|
|
@@ -18,7 +19,7 @@ var script = {
|
|
|
18
19
|
name: 'DuoToolMessage',
|
|
19
20
|
components: {
|
|
20
21
|
BaseMessage,
|
|
21
|
-
|
|
22
|
+
MessageToolApproval,
|
|
22
23
|
GlIcon,
|
|
23
24
|
GlLink
|
|
24
25
|
},
|
|
@@ -101,6 +102,9 @@ var script = {
|
|
|
101
102
|
},
|
|
102
103
|
toolWorkingDirectory() {
|
|
103
104
|
return this.workingDirectory;
|
|
105
|
+
},
|
|
106
|
+
requiresApproval() {
|
|
107
|
+
return [APPROVAL_TOOL_NAMES.runCommand, APPROVAL_TOOL_NAMES.runGitCommand, APPROVAL_TOOL_NAMES.createIssue, APPROVAL_TOOL_NAMES.updateIssue, APPROVAL_TOOL_NAMES.createMergeRequest, APPROVAL_TOOL_NAMES.updateMergeRequest, APPROVAL_TOOL_NAMES.createEpic, APPROVAL_TOOL_NAMES.updateEpic].includes(this.toolName);
|
|
104
108
|
}
|
|
105
109
|
},
|
|
106
110
|
methods: {
|
|
@@ -117,9 +121,9 @@ var script = {
|
|
|
117
121
|
const __vue_script__ = script;
|
|
118
122
|
|
|
119
123
|
/* template */
|
|
120
|
-
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){
|
|
124
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.requiresApproval)?_c('message-tool-approval',{attrs:{"message":_vm.message,"working-directory":_vm.workingDirectory,"approval-status":"approved"}}):_c('base-message',{attrs:{"message":_vm.message},scopedSlots:_vm._u([{key:"message",fn:function(ref){
|
|
121
125
|
var content = ref.content;
|
|
122
|
-
return [
|
|
126
|
+
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',{staticClass:"gl-flex-1"},[_c('div',{staticClass:"gl-mb-2"},[_c('span',{attrs:{"data-testid":"tool-message-content"}},[_vm._v(_vm._s(content))])]),_vm._v(" "),(_vm.projectId)?_c('div',{staticClass:"gl-mb-2",attrs:{"data-testid":"tool-message-project-info"}},[_c('span',{staticClass:"gl-font-weight-bold"},[_vm._v(_vm._s(_vm.$options.i18n.PROJECT_LABEL)+":")]),_vm._v(" "),_c('span',{staticClass:"gl-ml-2",attrs:{"data-testid":"tool-message-project-id"}},[_vm._v(_vm._s(_vm.projectId))])]):_vm._e(),_vm._v(" "),(_vm.branchName)?_c('div',{staticClass:"gl-mb-2",attrs:{"data-testid":"tool-message-branch-info"}},[_c('span',{staticClass:"gl-font-weight-bold"},[_vm._v(_vm._s(_vm.$options.i18n.BRANCH_LABEL)+":")]),_vm._v(" "),_c('span',{staticClass:"gl-ml-2",attrs:{"data-testid":"tool-message-branch-name"}},[_vm._v(_vm._s(_vm.branchName))])]):_vm._e(),_vm._v(" "),(_vm.startBranch)?_c('div',{staticClass:"gl-mb-2",attrs:{"data-testid":"tool-message-start-branch-info"}},[_c('span',{staticClass:"gl-font-weight-bold"},[_vm._v(_vm._s(_vm.$options.i18n.START_BRANCH_LABEL)+":")]),_vm._v(" "),_c('span',{staticClass:"gl-ml-2",attrs:{"data-testid":"tool-message-start-branch-name"}},[_vm._v(_vm._s(_vm.startBranch))])]):_vm._e(),_vm._v(" "),(_vm.commitMessage)?_c('div',{staticClass:"gl-mb-2",attrs:{"data-testid":"tool-message-commit-message-info"}},[_c('span',{staticClass:"gl-font-weight-bold"},[_vm._v(_vm._s(_vm.$options.i18n.COMMIT_MESSAGE_LABEL)+":")]),_vm._v(" "),_c('span',{staticClass:"gl-ml-2",attrs:{"data-testid":"tool-message-commit-message-text"}},[_vm._v(_vm._s(_vm.commitMessage))])]):_vm._e(),_vm._v(" "),(_vm.hasActions)?_c('div',{staticClass:"gl-mb-2",attrs:{"data-testid":"tool-message-actions-section"}},[_c('div',{staticClass:"gl-mb-2"},[_c('span',{staticClass:"gl-font-weight-bold",attrs:{"data-testid":"tool-message-actions-label"}},[_vm._v(_vm._s(_vm.$options.i18n.ACTION_LABEL)+"s:")])]),_vm._v(" "),_vm._l((_vm.toolArgs.actions),function(action,index){return _c('div',{key:index,staticClass:"gl-rounded gl-border gl-mb-3 gl-ml-4 gl-border-subtle gl-p-3",attrs:{"data-testid":"tool-message-action-item"}},[_c('div',{staticClass:"gl-mb-2"},[_c('span',{staticClass:"gl-font-weight-bold",attrs:{"data-testid":"tool-message-action-type"}},[_vm._v(_vm._s(action.action))])]),_vm._v(" "),(action.file_path)?_c('div',{staticClass:"gl-mb-2"},[_c('span',{staticClass:"gl-font-weight-bold"},[_vm._v(_vm._s(_vm.$options.i18n.FILE_PATH_LABEL)+":")]),_vm._v(" "),_c('gl-link',{staticClass:"gl-markdown file-path-link gl-ml-2 gl-break-all",attrs:{"data-testid":"tool-message-action-file-path-link"},on:{"click":function($event){$event.preventDefault();return _vm.onOpenFilePath(action.file_path)}}},[_c('code',[_vm._v(_vm._s(action.file_path))])])],1):_vm._e(),_vm._v(" "),(action.content)?_c('div',{staticClass:"gl-mb-2",attrs:{"data-testid":"tool-message-action-content"}},[_c('span',{staticClass:"gl-font-weight-bold"},[_vm._v(_vm._s(_vm.$options.i18n.CONTENT_LABEL)+":")]),_vm._v(" "),_c('pre',{staticClass:"gl-rounded gl-mt-2 gl-overflow-auto gl-bg-subtle gl-p-2 gl-text-sm",attrs:{"data-testid":"tool-message-action-content-text"}},[_vm._v(_vm._s(action.content))])]):_vm._e()])})],2):(_vm.messageFilePath)?_c('div',{staticClass:"gl-mb-2"},[_c('span',{staticClass:"gl-font-weight-bold"},[_vm._v(_vm._s(_vm.$options.i18n.FILE_PATH_LABEL)+":")]),_vm._v(" "),_c('gl-link',{staticClass:"gl-markdown file-path-link gl-ml-2 gl-break-all",attrs:{"data-testid":"tool-message-file-path-link"},on:{"click":function($event){$event.preventDefault();return _vm.onOpenFilePath(_vm.messageFilePath)}}},[_c('code',[_vm._v(_vm._s(_vm.messageFilePath))])])],1):_vm._e()])])]}}])})};
|
|
123
127
|
var __vue_staticRenderFns__ = [];
|
|
124
128
|
|
|
125
129
|
/* style */
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { GlAccordion, GlAccordionItem, GlSafeHtmlDirective } from '@gitlab/ui';
|
|
2
|
+
import { translate } from '../../../../../utils/i18n';
|
|
3
|
+
import PreBlock from './pre_block';
|
|
4
|
+
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
5
|
+
|
|
6
|
+
var script = {
|
|
7
|
+
name: 'BaseToolParams',
|
|
8
|
+
components: {
|
|
9
|
+
GlAccordion,
|
|
10
|
+
GlAccordionItem,
|
|
11
|
+
PreBlock
|
|
12
|
+
},
|
|
13
|
+
directives: {
|
|
14
|
+
SafeHtml: GlSafeHtmlDirective
|
|
15
|
+
},
|
|
16
|
+
props: {
|
|
17
|
+
message: {
|
|
18
|
+
type: String,
|
|
19
|
+
required: false,
|
|
20
|
+
default: ''
|
|
21
|
+
},
|
|
22
|
+
description: {
|
|
23
|
+
type: String,
|
|
24
|
+
required: false,
|
|
25
|
+
default: ''
|
|
26
|
+
},
|
|
27
|
+
customAccordionTitle: {
|
|
28
|
+
type: String,
|
|
29
|
+
required: false,
|
|
30
|
+
default: ''
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
computed: {
|
|
34
|
+
accordionTitle() {
|
|
35
|
+
return this.customAccordionTitle || this.$options.i18n.ACCORDION_TITLE;
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
i18n: {
|
|
39
|
+
ACCORDION_TITLE: translate('BaseToolParams.ACCORDION_TITLE', 'Read description')
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/* script */
|
|
44
|
+
const __vue_script__ = script;
|
|
45
|
+
|
|
46
|
+
/* template */
|
|
47
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-flex gl-flex-col"},[(_vm.message)?_c('div',{directives:[{name:"safe-html",rawName:"v-safe-html",value:(_vm.message),expression:"message"}]}):_vm._t("default"),_vm._v(" "),(_vm.description)?_c('gl-accordion',{staticClass:"-gl-ml-2 gl-mt-3",attrs:{"header-level":3}},[_vm._t("params-description",function(){return [_c('gl-accordion-item',{attrs:{"title":_vm.accordionTitle}},[_c('pre-block',[_vm._v(_vm._s(_vm.description))])],1)]})],2):_vm._e()],2)};
|
|
48
|
+
var __vue_staticRenderFns__ = [];
|
|
49
|
+
|
|
50
|
+
/* style */
|
|
51
|
+
const __vue_inject_styles__ = undefined;
|
|
52
|
+
/* scoped */
|
|
53
|
+
const __vue_scope_id__ = undefined;
|
|
54
|
+
/* module identifier */
|
|
55
|
+
const __vue_module_identifier__ = undefined;
|
|
56
|
+
/* functional template */
|
|
57
|
+
const __vue_is_functional_template__ = false;
|
|
58
|
+
/* style inject */
|
|
59
|
+
|
|
60
|
+
/* style inject SSR */
|
|
61
|
+
|
|
62
|
+
/* style inject shadow dom */
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
const __vue_component__ = __vue_normalize__(
|
|
67
|
+
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
68
|
+
__vue_inject_styles__,
|
|
69
|
+
__vue_script__,
|
|
70
|
+
__vue_scope_id__,
|
|
71
|
+
__vue_is_functional_template__,
|
|
72
|
+
__vue_module_identifier__,
|
|
73
|
+
false,
|
|
74
|
+
undefined,
|
|
75
|
+
undefined,
|
|
76
|
+
undefined
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
export default __vue_component__;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { sprintf, translate } from '../../../../../utils/i18n';
|
|
2
|
+
import { APPROVAL_TOOL_NAMES } from '../../../constants';
|
|
3
|
+
import BaseToolParams from './base_tool_params';
|
|
4
|
+
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
5
|
+
|
|
6
|
+
var script = {
|
|
7
|
+
name: 'IssuableToolParams',
|
|
8
|
+
components: {
|
|
9
|
+
BaseToolParams
|
|
10
|
+
},
|
|
11
|
+
props: {
|
|
12
|
+
toolName: {
|
|
13
|
+
type: String,
|
|
14
|
+
required: true,
|
|
15
|
+
validator: toolName => [APPROVAL_TOOL_NAMES.createIssue, APPROVAL_TOOL_NAMES.updateIssue, APPROVAL_TOOL_NAMES.createEpic, APPROVAL_TOOL_NAMES.updateEpic, APPROVAL_TOOL_NAMES.createMergeRequest, APPROVAL_TOOL_NAMES.updateMergeRequest].includes(toolName)
|
|
16
|
+
},
|
|
17
|
+
toolParams: {
|
|
18
|
+
type: Object,
|
|
19
|
+
required: true
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
computed: {
|
|
23
|
+
project() {
|
|
24
|
+
var _this$toolParams, _this$toolParams2;
|
|
25
|
+
return ((_this$toolParams = this.toolParams) === null || _this$toolParams === void 0 ? void 0 : _this$toolParams.projectPath) || ((_this$toolParams2 = this.toolParams) === null || _this$toolParams2 === void 0 ? void 0 : _this$toolParams2.projectId);
|
|
26
|
+
},
|
|
27
|
+
title() {
|
|
28
|
+
var _this$toolParams3;
|
|
29
|
+
return (_this$toolParams3 = this.toolParams) === null || _this$toolParams3 === void 0 ? void 0 : _this$toolParams3.title;
|
|
30
|
+
},
|
|
31
|
+
labels() {
|
|
32
|
+
var _this$toolParams4;
|
|
33
|
+
return (_this$toolParams4 = this.toolParams) === null || _this$toolParams4 === void 0 ? void 0 : _this$toolParams4.labels;
|
|
34
|
+
},
|
|
35
|
+
description() {
|
|
36
|
+
var _this$toolParams5;
|
|
37
|
+
return (_this$toolParams5 = this.toolParams) === null || _this$toolParams5 === void 0 ? void 0 : _this$toolParams5.description;
|
|
38
|
+
},
|
|
39
|
+
sourceBranch() {
|
|
40
|
+
var _this$toolParams6;
|
|
41
|
+
return (_this$toolParams6 = this.toolParams) === null || _this$toolParams6 === void 0 ? void 0 : _this$toolParams6.sourceBranch;
|
|
42
|
+
},
|
|
43
|
+
targetBranch() {
|
|
44
|
+
var _this$toolParams7;
|
|
45
|
+
return (_this$toolParams7 = this.toolParams) === null || _this$toolParams7 === void 0 ? void 0 : _this$toolParams7.targetBranch;
|
|
46
|
+
},
|
|
47
|
+
message() {
|
|
48
|
+
let message = this.$options.i18n[this.toolName] || '';
|
|
49
|
+
const labelsMessage = this.$options.i18n.ASSIGN_LABELS_MESSAGE;
|
|
50
|
+
const branchMessage = this.$options.i18n.BRANCH_MESSAGE;
|
|
51
|
+
if (this.title) {
|
|
52
|
+
message = `${message} ${this.$options.i18n.TITLE_MESSAGE}`;
|
|
53
|
+
}
|
|
54
|
+
if (this.sourceBranch && this.targetBranch) {
|
|
55
|
+
message = `${message} ${branchMessage}`;
|
|
56
|
+
}
|
|
57
|
+
if (this.labels) {
|
|
58
|
+
message = `${message} ${labelsMessage}`;
|
|
59
|
+
}
|
|
60
|
+
return sprintf(message, {
|
|
61
|
+
project: this.project,
|
|
62
|
+
...this.toolParams
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
i18n: {
|
|
67
|
+
[APPROVAL_TOOL_NAMES.createIssue]: translate('IssuableToolParams.CREATE_ISSUE', 'Open an issue in project <code>%{project}</code>.'),
|
|
68
|
+
[APPROVAL_TOOL_NAMES.updateIssue]: translate('IssuableToolParams.UPDATE_ISSUE', 'Update issue <code>%{issueIid}</code> in project <code>%{project}</code>.'),
|
|
69
|
+
[APPROVAL_TOOL_NAMES.createEpic]: translate('IssuableToolParams.CREATE_EPIC', 'Create an epic in group <code>%{groupId}</code>.'),
|
|
70
|
+
[APPROVAL_TOOL_NAMES.updateEpic]: translate('IssuableToolParams.UPDATE_EPIC', 'Update epic <code>%{epicId}</code> in group <code>%{groupId}</code>.'),
|
|
71
|
+
[APPROVAL_TOOL_NAMES.createMergeRequest]: translate('IssuableToolParams.CREATE_MERGE_REQUEST', 'Open a merge request in project <code>%{project}</code>.'),
|
|
72
|
+
[APPROVAL_TOOL_NAMES.updateMergeRequest]: translate('IssuableToolParams.UPDATE_MERGE_REQUEST', 'Update merge request <code>%{mergeRequestIid}</code> in project <code>%{project}</code>.'),
|
|
73
|
+
TITLE_MESSAGE: translate('IssuableToolParams.TITLE_MESSAGE', 'Set the title "<em>%{title}</em>".'),
|
|
74
|
+
BRANCH_MESSAGE: translate('IssuableToolParams.BRANCH_MESSAGE', 'From branch <code>%{sourceBranch}</code> to branch <code>%{targetBranch}</code>.'),
|
|
75
|
+
ASSIGN_LABELS_MESSAGE: translate('CreateIssueToolParams.ASSIGN_LABELS_MESSAGE', 'Assign the labels <code>%{labels}</code>.'),
|
|
76
|
+
ACCORDION_TITLE: translate('CreateIssueToolParams.ACCORDION_TITLE', 'Read description')
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/* script */
|
|
81
|
+
const __vue_script__ = script;
|
|
82
|
+
|
|
83
|
+
/* template */
|
|
84
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('base-tool-params',{attrs:{"message":_vm.message,"description":_vm.description}})};
|
|
85
|
+
var __vue_staticRenderFns__ = [];
|
|
86
|
+
|
|
87
|
+
/* style */
|
|
88
|
+
const __vue_inject_styles__ = undefined;
|
|
89
|
+
/* scoped */
|
|
90
|
+
const __vue_scope_id__ = undefined;
|
|
91
|
+
/* module identifier */
|
|
92
|
+
const __vue_module_identifier__ = undefined;
|
|
93
|
+
/* functional template */
|
|
94
|
+
const __vue_is_functional_template__ = false;
|
|
95
|
+
/* style inject */
|
|
96
|
+
|
|
97
|
+
/* style inject SSR */
|
|
98
|
+
|
|
99
|
+
/* style inject shadow dom */
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
const __vue_component__ = __vue_normalize__(
|
|
104
|
+
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
105
|
+
__vue_inject_styles__,
|
|
106
|
+
__vue_script__,
|
|
107
|
+
__vue_scope_id__,
|
|
108
|
+
__vue_is_functional_template__,
|
|
109
|
+
__vue_module_identifier__,
|
|
110
|
+
false,
|
|
111
|
+
undefined,
|
|
112
|
+
undefined,
|
|
113
|
+
undefined
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
export default __vue_component__;
|
|
@@ -1,25 +1,65 @@
|
|
|
1
1
|
import { GlIcon } from '@gitlab/ui';
|
|
2
|
+
import { translate } from '../../../../../utils/i18n';
|
|
3
|
+
import { APPROVAL_TOOL_NAMES } from '../../../constants';
|
|
4
|
+
import BaseToolParams from './base_tool_params';
|
|
2
5
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
3
6
|
|
|
4
7
|
var script = {
|
|
5
8
|
name: 'RunCommandToolParams',
|
|
6
9
|
components: {
|
|
7
|
-
GlIcon
|
|
10
|
+
GlIcon,
|
|
11
|
+
BaseToolParams
|
|
8
12
|
},
|
|
9
13
|
props: {
|
|
10
|
-
|
|
14
|
+
toolName: {
|
|
11
15
|
type: String,
|
|
12
16
|
required: true
|
|
13
17
|
},
|
|
18
|
+
program: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: false,
|
|
21
|
+
default: ''
|
|
22
|
+
},
|
|
14
23
|
args: {
|
|
15
24
|
type: String,
|
|
16
|
-
required:
|
|
25
|
+
required: false,
|
|
26
|
+
default: ''
|
|
27
|
+
},
|
|
28
|
+
command: {
|
|
29
|
+
type: String,
|
|
30
|
+
required: false,
|
|
31
|
+
default: ''
|
|
32
|
+
},
|
|
33
|
+
toolResponse: {
|
|
34
|
+
type: Object,
|
|
35
|
+
required: false,
|
|
36
|
+
default: null
|
|
37
|
+
},
|
|
38
|
+
workingDirectory: {
|
|
39
|
+
type: String,
|
|
40
|
+
required: false,
|
|
41
|
+
default: ''
|
|
17
42
|
}
|
|
18
43
|
},
|
|
19
44
|
computed: {
|
|
20
45
|
formattedCommand() {
|
|
21
|
-
|
|
46
|
+
if (this.toolName === APPROVAL_TOOL_NAMES.runCommand) {
|
|
47
|
+
var _this$command;
|
|
48
|
+
return (_this$command = this.command) !== null && _this$command !== void 0 && _this$command.length ? this.command : `${this.program} ${this.args}`;
|
|
49
|
+
}
|
|
50
|
+
return `git ${this.command} ${this.args}`;
|
|
51
|
+
},
|
|
52
|
+
withWorkingDirectory() {
|
|
53
|
+
var _this$workingDirector;
|
|
54
|
+
return (_this$workingDirector = this.workingDirectory) !== null && _this$workingDirector !== void 0 && _this$workingDirector.length ? `${this.workingDirectory}> ${this.formattedCommand}` : this.formattedCommand;
|
|
55
|
+
},
|
|
56
|
+
commandOutput() {
|
|
57
|
+
var _this$toolResponse;
|
|
58
|
+
return (_this$toolResponse = this.toolResponse) === null || _this$toolResponse === void 0 ? void 0 : _this$toolResponse.content;
|
|
22
59
|
}
|
|
60
|
+
},
|
|
61
|
+
i18n: {
|
|
62
|
+
SEE_COMMAND_OUTPUT: translate('RunCommandToolParams.ACCORDION_TITLE', 'Expand command output')
|
|
23
63
|
}
|
|
24
64
|
};
|
|
25
65
|
|
|
@@ -27,7 +67,7 @@ var script = {
|
|
|
27
67
|
const __vue_script__ = script;
|
|
28
68
|
|
|
29
69
|
/* template */
|
|
30
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-flex gl-items-center gl-gap-3"},[_c('gl-icon',{attrs:{"name":"terminal"}}),_vm._v(" "),_c('code',[_vm._v(_vm._s(_vm.
|
|
70
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('base-tool-params',{attrs:{"description":_vm.commandOutput,"custom-accordion-title":_vm.$options.i18n.SEE_COMMAND_OUTPUT}},[_c('div',{staticClass:"gl-flex gl-items-center gl-gap-3"},[_c('gl-icon',{attrs:{"name":"terminal"}}),_vm._v(" "),_c('code',[_vm._v(_vm._s(_vm.withWorkingDirectory))])],1)])};
|
|
31
71
|
var __vue_staticRenderFns__ = [];
|
|
32
72
|
|
|
33
73
|
/* style */
|
package/dist/components/chat/components/duo_chat_message_tool_approval/message_tool_approval.js
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
import { GlButton, GlCard, GlFormTextarea, GlFormGroup, GlBadge, GlDropdown, GlDropdownItem } from '@gitlab/ui';
|
|
2
2
|
import { translate } from '../../../../utils/i18n';
|
|
3
3
|
import { convertKeysToCamelCase } from '../../../../utils/object';
|
|
4
|
-
import { acceptedApproveToolPayloads } from '../../constants';
|
|
4
|
+
import { APPROVAL_TOOL_NAMES, acceptedApproveToolPayloads } from '../../constants';
|
|
5
5
|
import CreateCommitToolParams from './components/create_commit_tool_params';
|
|
6
|
-
import
|
|
7
|
-
import CreateMergeRequestToolParams from './components/create_merge_request_tool_params';
|
|
6
|
+
import IssuableToolParams from './components/issuable_tool_params';
|
|
8
7
|
import RunCommandToolParams from './components/run_command_tool_params';
|
|
9
8
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
10
9
|
|
|
11
|
-
const APPROVAL_TOOL_NAMES = {
|
|
12
|
-
createCommit: 'create_commit',
|
|
13
|
-
createIssue: 'create_issue',
|
|
14
|
-
createMergeRequest: 'create_merge_request',
|
|
15
|
-
runCommand: 'run_command'
|
|
16
|
-
};
|
|
17
10
|
const PROCESSING_STATE = {
|
|
18
11
|
APPROVING: 'approving',
|
|
19
12
|
DENYING: 'denying',
|
|
20
13
|
NONE: null
|
|
21
14
|
};
|
|
15
|
+
const TOOL_STATUS = {
|
|
16
|
+
Pending: 'pending',
|
|
17
|
+
Approved: 'approved'
|
|
18
|
+
};
|
|
22
19
|
const i18n = {
|
|
23
20
|
TOOL_APPROVAL_DESCRIPTION: translate('MessageToolApproval.toolApprovalDescription', 'GitLab Duo Agentic Chat wants to execute a tool. Do you want to proceed?'),
|
|
24
21
|
TOOL_LABEL: translate('MessageToolApproval.toolLabel', 'Tool:'),
|
|
@@ -37,16 +34,28 @@ const i18n = {
|
|
|
37
34
|
TOOL_APPROVAL_TITLES: {
|
|
38
35
|
[APPROVAL_TOOL_NAMES.createCommit]: translate('MessageToolApproval.createCommit', 'Duo wants to push a commit.'),
|
|
39
36
|
[APPROVAL_TOOL_NAMES.createIssue]: translate('MessageToolApproval.createIssue', 'Duo wants to open an issue.'),
|
|
37
|
+
[APPROVAL_TOOL_NAMES.updateIssue]: translate('MessageToolApproval.updateIssue', 'Duo wants to update an issue.'),
|
|
38
|
+
[APPROVAL_TOOL_NAMES.createEpic]: translate('MessageToolApproval.createEpic', 'Duo wants to create an epic.'),
|
|
39
|
+
[APPROVAL_TOOL_NAMES.updateEpic]: translate('MessageToolApproval.updateEpic', 'Duo wants to update an epic.'),
|
|
40
40
|
[APPROVAL_TOOL_NAMES.createMergeRequest]: translate('MessageToolApproval.createMergeRequest', 'Duo wants to create a merge request.'),
|
|
41
|
-
[APPROVAL_TOOL_NAMES.runCommand]: translate('MessageToolApproval.runCommand', 'Duo wants to run a command.')
|
|
41
|
+
[APPROVAL_TOOL_NAMES.runCommand]: translate('MessageToolApproval.runCommand', 'Duo wants to run a command.'),
|
|
42
|
+
[APPROVAL_TOOL_NAMES.runGitCommand]: translate('MessageToolApproval.runGitCommand', 'Duo wants to run a git command.')
|
|
42
43
|
},
|
|
43
|
-
TOOL_STATUS: translate('MessageToolApproval.
|
|
44
|
+
[TOOL_STATUS.Pending]: translate('MessageToolApproval.toolStatusPending', 'Pending'),
|
|
45
|
+
[TOOL_STATUS.Approved]: translate('MessageToolApproval.toolStatusApproved', 'Approved'),
|
|
46
|
+
TOGGLE_PARAMS_BUTTON_EXPAND: translate('MessageToolApproval.collapseButtonCollapsed', 'Display tool details'),
|
|
47
|
+
TOGGLE_PARAMS_BUTTON_COLLAPSE: translate('MessageToolApproval.collapseButtonExpanded', 'Hide tool details')
|
|
44
48
|
};
|
|
45
49
|
const TOOL_PARAMS_VIEW_COMPONENTS = {
|
|
46
50
|
[APPROVAL_TOOL_NAMES.createCommit]: 'CreateCommitToolParams',
|
|
47
|
-
[APPROVAL_TOOL_NAMES.createIssue]: '
|
|
48
|
-
[APPROVAL_TOOL_NAMES.
|
|
49
|
-
[APPROVAL_TOOL_NAMES.
|
|
51
|
+
[APPROVAL_TOOL_NAMES.createIssue]: 'IssuableToolParams',
|
|
52
|
+
[APPROVAL_TOOL_NAMES.updateIssue]: 'IssuableToolParams',
|
|
53
|
+
[APPROVAL_TOOL_NAMES.createEpic]: 'IssuableToolParams',
|
|
54
|
+
[APPROVAL_TOOL_NAMES.updateEpic]: 'IssuableToolParams',
|
|
55
|
+
[APPROVAL_TOOL_NAMES.createMergeRequest]: 'IssuableToolParams',
|
|
56
|
+
[APPROVAL_TOOL_NAMES.updateMergeRequest]: 'IssuableToolParams',
|
|
57
|
+
[APPROVAL_TOOL_NAMES.runCommand]: 'RunCommandToolParams',
|
|
58
|
+
[APPROVAL_TOOL_NAMES.runGitCommand]: 'RunCommandToolParams'
|
|
50
59
|
};
|
|
51
60
|
var script = {
|
|
52
61
|
name: 'MessageToolApproval',
|
|
@@ -59,8 +68,7 @@ var script = {
|
|
|
59
68
|
GlDropdown,
|
|
60
69
|
GlDropdownItem,
|
|
61
70
|
CreateCommitToolParams,
|
|
62
|
-
|
|
63
|
-
CreateMergeRequestToolParams,
|
|
71
|
+
IssuableToolParams,
|
|
64
72
|
RunCommandToolParams
|
|
65
73
|
},
|
|
66
74
|
props: {
|
|
@@ -68,11 +76,21 @@ var script = {
|
|
|
68
76
|
required: true,
|
|
69
77
|
type: Object
|
|
70
78
|
},
|
|
79
|
+
workingDirectory: {
|
|
80
|
+
type: String,
|
|
81
|
+
required: false,
|
|
82
|
+
default: ''
|
|
83
|
+
},
|
|
71
84
|
isProcessing: {
|
|
72
85
|
type: Boolean,
|
|
73
86
|
required: false,
|
|
74
87
|
default: false
|
|
75
88
|
},
|
|
89
|
+
approvalStatus: {
|
|
90
|
+
type: String,
|
|
91
|
+
required: false,
|
|
92
|
+
default: TOOL_STATUS.Pending
|
|
93
|
+
},
|
|
76
94
|
/**
|
|
77
95
|
* Array of approval options for multi-approval functionality
|
|
78
96
|
* @property {string} type - The approval type (approve-tool-once, approve-for-session, always-approve-tool)
|
|
@@ -99,7 +117,8 @@ var script = {
|
|
|
99
117
|
return {
|
|
100
118
|
showDenialReason: false,
|
|
101
119
|
denialReason: '',
|
|
102
|
-
localProcessingState: PROCESSING_STATE.NONE
|
|
120
|
+
localProcessingState: PROCESSING_STATE.NONE,
|
|
121
|
+
collapsed: this.approvalStatus === TOOL_STATUS.Approved
|
|
103
122
|
};
|
|
104
123
|
},
|
|
105
124
|
computed: {
|
|
@@ -111,6 +130,10 @@ var script = {
|
|
|
111
130
|
var _this$message2, _this$message2$tool_i;
|
|
112
131
|
return ((_this$message2 = this.message) === null || _this$message2 === void 0 ? void 0 : (_this$message2$tool_i = _this$message2.tool_info) === null || _this$message2$tool_i === void 0 ? void 0 : _this$message2$tool_i.args) || {};
|
|
113
132
|
},
|
|
133
|
+
toolResponse() {
|
|
134
|
+
var _this$message3, _this$message3$tool_i;
|
|
135
|
+
return (_this$message3 = this.message) === null || _this$message3 === void 0 ? void 0 : (_this$message3$tool_i = _this$message3.tool_info) === null || _this$message3$tool_i === void 0 ? void 0 : _this$message3$tool_i.tool_response;
|
|
136
|
+
},
|
|
114
137
|
camelCaseToolParameters() {
|
|
115
138
|
return convertKeysToCamelCase(this.toolParameters);
|
|
116
139
|
},
|
|
@@ -118,7 +141,31 @@ var script = {
|
|
|
118
141
|
return Object.keys(this.toolParameters).length > 0;
|
|
119
142
|
},
|
|
120
143
|
toolApprovalTitle() {
|
|
121
|
-
return i18n.TOOL_APPROVAL_TITLES[this.toolName];
|
|
144
|
+
return i18n.TOOL_APPROVAL_TITLES[this.toolName] || this.toolName;
|
|
145
|
+
},
|
|
146
|
+
toolStatusLabel() {
|
|
147
|
+
return i18n[this.approvalStatus];
|
|
148
|
+
},
|
|
149
|
+
toolStatusVariant() {
|
|
150
|
+
return {
|
|
151
|
+
[TOOL_STATUS.Pending]: 'neutral',
|
|
152
|
+
[TOOL_STATUS.Approved]: 'info'
|
|
153
|
+
}[this.approvalStatus];
|
|
154
|
+
},
|
|
155
|
+
collapsible() {
|
|
156
|
+
return this.approvalStatus === TOOL_STATUS.Approved;
|
|
157
|
+
},
|
|
158
|
+
collapseButtonProps() {
|
|
159
|
+
return this.collapsed ? {
|
|
160
|
+
icon: 'chevron-right',
|
|
161
|
+
title: i18n.TOGGLE_PARAMS_BUTTON_EXPAND
|
|
162
|
+
} : {
|
|
163
|
+
icon: 'chevron-down',
|
|
164
|
+
title: i18n.TOGGLE_PARAMS_BUTTON_COLLAPSE
|
|
165
|
+
};
|
|
166
|
+
},
|
|
167
|
+
isApproved() {
|
|
168
|
+
return this.approvalStatus === TOOL_STATUS.Approved;
|
|
122
169
|
},
|
|
123
170
|
isApproving() {
|
|
124
171
|
return this.isProcessing && this.localProcessingState === PROCESSING_STATE.APPROVING;
|
|
@@ -213,7 +260,7 @@ var script = {
|
|
|
213
260
|
const __vue_script__ = script;
|
|
214
261
|
|
|
215
262
|
/* template */
|
|
216
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-card',{scopedSlots:_vm._u([{key:"header",fn:function(){return [_c('div',{staticClass:"gl-flex gl-items-center gl-justify-between"},[_c('span',[_vm._v("\n
|
|
263
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-card',{staticClass:"gl-w-full",attrs:{"body-class":{ 'gl-hidden': _vm.collapsed }},scopedSlots:_vm._u([{key:"header",fn:function(){return [_c('div',{staticClass:"gl-flex gl-items-center gl-justify-between gl-gap-3"},[_c('span',[(_vm.collapsible)?_c('gl-button',_vm._b({attrs:{"variant":"default","category":"tertiary","size":"small","data-testid":"toggle-details-button"},on:{"click":function($event){_vm.collapsed = !_vm.collapsed;}}},'gl-button',_vm.collapseButtonProps,false)):_vm._e(),_vm._v(" "),_c('span',[_vm._v("\n "+_vm._s(_vm.toolApprovalTitle)+"\n ")])],1),_vm._v(" "),_c('gl-badge',{attrs:{"variant":_vm.toolStatusVariant}},[_vm._v("\n "+_vm._s(_vm.toolStatusLabel)+"\n ")])],1)]},proxy:true},(!_vm.isApproved)?{key:"footer",fn:function(){return [(!_vm.showDenialReason)?_c('div',{staticClass:"gl-flex gl-gap-2"},[(_vm.showSplitButton)?_c('gl-dropdown',{attrs:{"variant":"confirm","size":"small","split":"","text":_vm.primaryApprovalOption.text,"disabled":_vm.buttonsDisabled || _vm.primaryApprovalOption.disabled,"loading":_vm.isApproving,"data-testid":"approve-dropdown"},on:{"click":_vm.handlePrimaryApprove}},_vm._l((_vm.additionalApprovalOptions),function(option){return _c('gl-dropdown-item',{key:option.type,attrs:{"disabled":option.disabled,"data-testid":"approve-dropdown-item"},on:{"click":function($event){return _vm.handleDropdownSelection(option)}}},[_vm._v("\n "+_vm._s(option.text)+"\n ")])}),1):_c('gl-button',{attrs:{"variant":"confirm","size":"small","data-testid":"approve-tool-inline","disabled":_vm.buttonsDisabled || _vm.primaryApprovalOption.disabled,"loading":_vm.isApproving},on:{"click":_vm.handlePrimaryApprove}},[_vm._v("\n "+_vm._s(_vm.primaryApprovalOption.text)+"\n ")]),_vm._v(" "),_c('gl-button',{attrs:{"size":"small","data-testid":"deny-tool-inline","disabled":_vm.buttonsDisabled,"loading":_vm.isDenying},on:{"click":_vm.handleDeny}},[_vm._v("\n "+_vm._s(_vm.denyButtonText)+"\n ")])],1):_c('div',[_c('gl-form-group',{staticClass:"gl-mb-3",attrs:{"label":_vm.$options.i18n.DENIAL_REASON_LABEL,"label-for":"inline-rejection-reason","optional":true}},[_c('gl-form-textarea',{attrs:{"id":"inline-rejection-reason","placeholder":_vm.$options.i18n.DENIAL_REASON_PLACEHOLDER,"rows":2,"no-resize":true,"submit-on-enter":false,"disabled":_vm.buttonsDisabled,"data-testid":"denial-reason-textarea","autofocus":""},on:{"submit":_vm.submitDenial},model:{value:(_vm.denialReason),callback:function ($$v) {_vm.denialReason=$$v;},expression:"denialReason"}})],1),_vm._v(" "),_c('div',{staticClass:"gl-flex gl-gap-3"},[_c('gl-button',{attrs:{"size":"small","data-testid":"submit-denial","variant":"confirm","disabled":_vm.buttonsDisabled,"loading":_vm.isDenying},on:{"click":_vm.submitDenial}},[_vm._v("\n "+_vm._s(_vm.denyButtonText)+"\n ")]),_vm._v(" "),_c('gl-button',{attrs:{"size":"small","data-testid":"cancel-denial","disabled":_vm.buttonsDisabled},on:{"click":_vm.cancelDenial}},[_vm._v("\n "+_vm._s(_vm.$options.i18n.CANCEL_TEXT)+"\n ")])],1)],1)]},proxy:true}:null],null,true)},[_vm._v(" "),(_vm.toolParamsViewComponent)?_c(_vm.toolParamsViewComponent,_vm._b({tag:"component",staticClass:"gl-leading-20",attrs:{"tool-name":_vm.toolName,"tool-params":_vm.camelCaseToolParameters,"tool-response":_vm.toolResponse,"working-directory":_vm.workingDirectory}},'component',_vm.camelCaseToolParameters,false)):_c('div',{staticClass:"md gl-border gl-rounded-bl-none gl-border-1 gl-border-solid gl-border-transparent gl-bg-subtle gl-p-4 gl-leading-20 gl-text-default gl-break-anywhere"},[_c('div',{staticClass:"gl-border gl-mb-4 gl-rounded-base gl-border-gray-200 gl-bg-gray-50 gl-p-3"},[_c('p',{staticClass:"gl-mb-1 gl-text-sm gl-text-gray-500"},[_vm._v("\n "+_vm._s(_vm.$options.i18n.REQUEST_TEXT)+"\n ")]),_vm._v(" "),(_vm.hasToolParameters)?_c('code',{staticClass:"gl-whitespace-pre-wrap gl-text-sm gl-text-default gl-font-monospace",attrs:{"data-testid":"tool-parameters"}},[_vm._v(_vm._s(JSON.stringify(_vm.toolParameters, null, 2)))]):_c('span',{staticClass:"gl-text-sm gl-text-gray-500",attrs:{"data-testid":"no-parameters-message"}},[_vm._v("\n "+_vm._s(_vm.$options.i18n.NO_PARAMETERS_TEXT)+"\n ")])])])],1)};
|
|
217
264
|
var __vue_staticRenderFns__ = [];
|
|
218
265
|
|
|
219
266
|
/* style */
|
|
@@ -246,4 +293,4 @@ var __vue_staticRenderFns__ = [];
|
|
|
246
293
|
);
|
|
247
294
|
|
|
248
295
|
export default __vue_component__;
|
|
249
|
-
export {
|
|
296
|
+
export { PROCESSING_STATE, TOOL_STATUS, i18n };
|
|
@@ -42,5 +42,16 @@ const acceptedApproveToolPayloads = {
|
|
|
42
42
|
APPROVE_SESSION,
|
|
43
43
|
APPROVE_ALL_TOOLS
|
|
44
44
|
};
|
|
45
|
+
const APPROVAL_TOOL_NAMES = {
|
|
46
|
+
createCommit: 'create_commit',
|
|
47
|
+
createIssue: 'create_issue',
|
|
48
|
+
updateIssue: 'update_issue',
|
|
49
|
+
createEpic: 'create_epic',
|
|
50
|
+
updateEpic: 'update_epic',
|
|
51
|
+
createMergeRequest: 'create_merge_request',
|
|
52
|
+
updateMergeRequest: 'update_merge_request',
|
|
53
|
+
runCommand: 'run_command',
|
|
54
|
+
runGitCommand: 'run_git_command'
|
|
55
|
+
};
|
|
45
56
|
|
|
46
|
-
export { CHAT_BASE_COMMANDS, CHAT_CLEAR_MESSAGE, CHAT_INCLUDE_MESSAGE, CHAT_NEW_MESSAGE, CHAT_RESET_MESSAGE, DOCUMENTATION_SOURCE_TYPES, LOADING_TRANSITION_DURATION, MAX_PROMPT_LENGTH, MESSAGE_MODEL_ROLES, PROMPT_LENGTH_WARNING, SELECTED_CONTEXT_ITEMS_DEFAULT_COLLAPSED, acceptedApproveToolPayloads, badgeTypeValidator, badgeTypes };
|
|
57
|
+
export { APPROVAL_TOOL_NAMES, CHAT_BASE_COMMANDS, CHAT_CLEAR_MESSAGE, CHAT_INCLUDE_MESSAGE, CHAT_NEW_MESSAGE, CHAT_RESET_MESSAGE, DOCUMENTATION_SOURCE_TYPES, LOADING_TRANSITION_DURATION, MAX_PROMPT_LENGTH, MESSAGE_MODEL_ROLES, PROMPT_LENGTH_WARNING, SELECTED_CONTEXT_ITEMS_DEFAULT_COLLAPSED, acceptedApproveToolPayloads, badgeTypeValidator, badgeTypes };
|
|
@@ -179,6 +179,50 @@ const MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_RUN_COMMAND = {
|
|
|
179
179
|
status: 'success',
|
|
180
180
|
role: 'request'
|
|
181
181
|
};
|
|
182
|
+
const MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_RUN_COMMAND_WITH_RESPONSE = {
|
|
183
|
+
id: '125',
|
|
184
|
+
content: 'Tool run_command requires approval. Please confirm if you want to proceed.',
|
|
185
|
+
message_type: MESSAGE_MODEL_ROLES.request,
|
|
186
|
+
tool_info: {
|
|
187
|
+
args: {
|
|
188
|
+
command: 'cat Dockerfile | grep ENV'
|
|
189
|
+
},
|
|
190
|
+
name: 'run_command',
|
|
191
|
+
tool_response: {
|
|
192
|
+
id: null,
|
|
193
|
+
name: 'run_command',
|
|
194
|
+
type: 'ToolMessage',
|
|
195
|
+
status: 'success',
|
|
196
|
+
content: '\u001b]133;C;\u0007\u001b]633;E;cat Dockerfile | grep ENV;790e289b-7fc3-4fa8-accb-83538d075bfb\u0007\u001b]633;C\u0007ENV PYTHONDONTWRITEBYTECODE=1 \\\r\n',
|
|
197
|
+
artifact: null,
|
|
198
|
+
tool_call_id: 'toolu_01W1DWmLp26vLrohCV5ernd4',
|
|
199
|
+
additional_kwargs: {},
|
|
200
|
+
response_metadata: {}
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
timestamp: '2025-06-25T19:22:21.290791+00:00',
|
|
204
|
+
status: 'success',
|
|
205
|
+
role: 'request'
|
|
206
|
+
};
|
|
207
|
+
const MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_RUN_GIT_COMMAND = {
|
|
208
|
+
status: 'success',
|
|
209
|
+
content: 'Tool run_git_command requires approval. Please confirm if you want to proceed.',
|
|
210
|
+
timestamp: '2025-09-24T10:05:58.707330+00:00',
|
|
211
|
+
tool_info: {
|
|
212
|
+
args: {
|
|
213
|
+
args: '-r',
|
|
214
|
+
command: 'branch',
|
|
215
|
+
repository_url: 'https://gdk.test:3443/gitlab-duo/test'
|
|
216
|
+
},
|
|
217
|
+
name: 'run_git_command'
|
|
218
|
+
},
|
|
219
|
+
message_type: 'request',
|
|
220
|
+
correlation_id: null,
|
|
221
|
+
message_sub_type: null,
|
|
222
|
+
additional_context: null,
|
|
223
|
+
requestId: '41-1',
|
|
224
|
+
role: 'assistant'
|
|
225
|
+
};
|
|
182
226
|
const MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_ISSUE = {
|
|
183
227
|
id: '125',
|
|
184
228
|
content: 'Tool run_command requires approval. Please confirm if you want to proceed.',
|
|
@@ -196,6 +240,38 @@ const MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_ISSUE = {
|
|
|
196
240
|
status: 'success',
|
|
197
241
|
role: 'request'
|
|
198
242
|
};
|
|
243
|
+
const MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_UPDATE_ISSUE = {
|
|
244
|
+
id: '125',
|
|
245
|
+
content: 'Tool update_issue requires approval. Please confirm if you want to proceed.',
|
|
246
|
+
message_type: MESSAGE_MODEL_ROLES.request,
|
|
247
|
+
tool_info: {
|
|
248
|
+
name: 'update_issue',
|
|
249
|
+
args: {
|
|
250
|
+
project_id: 123,
|
|
251
|
+
issue_iid: 2,
|
|
252
|
+
title: 'CSP bug in VSCode Fork prevents loading external web views in Web IDE'
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
timestamp: '2025-06-25T19:22:21.290791+00:00',
|
|
256
|
+
status: 'success',
|
|
257
|
+
role: 'request'
|
|
258
|
+
};
|
|
259
|
+
const MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_EPIC = {
|
|
260
|
+
id: '125',
|
|
261
|
+
content: 'Tool create_epic requires approval. Please confirm if you want to proceed.',
|
|
262
|
+
message_type: MESSAGE_MODEL_ROLES.request,
|
|
263
|
+
tool_info: {
|
|
264
|
+
name: 'create_epic',
|
|
265
|
+
args: {
|
|
266
|
+
group_id: 'gitlab-duo',
|
|
267
|
+
title: 'CI Pipeline roadmap',
|
|
268
|
+
description: 'This epic contains issues related to making the CI pipeline of various projects more efficient'
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
timestamp: '2025-06-25T19:22:21.290791+00:00',
|
|
272
|
+
status: 'success',
|
|
273
|
+
role: 'request'
|
|
274
|
+
};
|
|
199
275
|
const MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_COMMIT = {
|
|
200
276
|
id: '125',
|
|
201
277
|
content: 'Tool create_commit requires approval. Please confirm if you want to proceed.',
|
|
@@ -542,4 +618,4 @@ const AGENTIC_THREADLIST = [{
|
|
|
542
618
|
}
|
|
543
619
|
}];
|
|
544
620
|
|
|
545
|
-
export { AGENTIC_THREADLIST, INCLUDE_SLASH_COMMAND, MOCK_AGENT_MESSAGE, MOCK_REQUEST_MESSAGE, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_COMMIT, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_ISSUE, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_MERGE_REQUEST, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_PARAMS, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_RUN_COMMAND, MOCK_RESPONSE_MESSAGE, MOCK_RESPONSE_MESSAGE_FOR_STREAMING, MOCK_TOOL_MESSAGE, MOCK_TOOL_MESSAGE_WITH_LINK, MOCK_USER_PROMPT_MESSAGE, MOCK_WORKFLOW_END_MESSAGE, SLASH_COMMANDS, THREADLIST, generateMockResponseChunks, generateSeparateChunks, renderGFM, renderMarkdown };
|
|
621
|
+
export { AGENTIC_THREADLIST, INCLUDE_SLASH_COMMAND, MOCK_AGENT_MESSAGE, MOCK_REQUEST_MESSAGE, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_COMMIT, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_EPIC, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_ISSUE, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_MERGE_REQUEST, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_PARAMS, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_RUN_COMMAND, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_RUN_COMMAND_WITH_RESPONSE, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_RUN_GIT_COMMAND, MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_UPDATE_ISSUE, MOCK_RESPONSE_MESSAGE, MOCK_RESPONSE_MESSAGE_FOR_STREAMING, MOCK_TOOL_MESSAGE, MOCK_TOOL_MESSAGE_WITH_LINK, MOCK_USER_PROMPT_MESSAGE, MOCK_WORKFLOW_END_MESSAGE, SLASH_COMMANDS, THREADLIST, generateMockResponseChunks, generateSeparateChunks, renderGFM, renderMarkdown };
|