@gitlab/duo-ui 10.15.4 → 10.16.1

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 (22) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/components/agentic_chat/agentic_duo_chat.js +19 -1
  3. package/dist/components/chat/components/duo_chat_conversation/duo_chat_conversation.js +9 -1
  4. package/dist/components/chat/components/duo_chat_message/duo_chat_message.js +9 -1
  5. package/dist/components/chat/components/duo_chat_message/message_types/message_map.js +9 -1
  6. package/dist/components/chat/components/duo_chat_message/message_types/message_tool.js +29 -8
  7. package/dist/components/chat/components/duo_chat_message/message_types/message_workflow_end.js +2 -2
  8. package/dist/components/{ui/duo_terminal_command/duo_terminal_command.js → chat/components/duo_chat_message_tool_command_output/message_tool_command_output.js} +2 -2
  9. package/dist/components/chat/duo_chat.js +9 -1
  10. package/dist/index.js +0 -1
  11. package/package.json +1 -1
  12. package/src/components/agentic_chat/agentic_duo_chat.vue +23 -1
  13. package/src/components/chat/components/duo_chat_conversation/duo_chat_conversation.vue +9 -0
  14. package/src/components/chat/components/duo_chat_message/duo_chat_message.vue +9 -0
  15. package/src/components/chat/components/duo_chat_message/message_types/message_map.vue +9 -0
  16. package/src/components/chat/components/duo_chat_message/message_types/message_tool.vue +29 -2
  17. package/src/components/chat/components/duo_chat_message/message_types/message_workflow_end.vue +2 -2
  18. package/src/components/{ui/duo_terminal_command/duo_terminal_command.md → chat/components/duo_chat_message_tool_command_output/message_tool_command_output.md} +3 -3
  19. package/src/components/{ui/duo_terminal_command/duo_terminal_command.vue → chat/components/duo_chat_message_tool_command_output/message_tool_command_output.vue} +10 -5
  20. package/src/components/chat/duo_chat.vue +16 -2
  21. package/src/index.js +0 -1
  22. package/translations.js +1 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ ## [10.16.1](https://gitlab.com/gitlab-org/duo-ui/compare/v10.16.0...v10.16.1) (2025-08-14)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **DuoChat:** Added test for some common keyboard shortcuts ([af93b26](https://gitlab.com/gitlab-org/duo-ui/commit/af93b263ddf55fc66f805743c4dbdbe11b0cd56e))
7
+ * **DuoChat:** Fix VScode undo/redo ([4b4c7bc](https://gitlab.com/gitlab-org/duo-ui/commit/4b4c7bc3cd154cfdc57bcce5646face488672084))
8
+
9
+ # [10.16.0](https://gitlab.com/gitlab-org/duo-ui/compare/v10.15.4...v10.16.0) (2025-08-13)
10
+
11
+
12
+ ### Features
13
+
14
+ * drill down project path ([de6ac72](https://gitlab.com/gitlab-org/duo-ui/commit/de6ac72edb3b27def03a5202a1a4cdbda7c405e9))
15
+ * remove code bg transparency from scss ([7fa417a](https://gitlab.com/gitlab-org/duo-ui/commit/7fa417a82dd3dfa7adae320d147e90c943dd3bf0))
16
+ * update terminal command component into chat ([1dde731](https://gitlab.com/gitlab-org/duo-ui/commit/1dde731cc5fa80cddfff38b0fb001e84885cde5e))
17
+
1
18
  ## [10.15.4](https://gitlab.com/gitlab-org/duo-ui/compare/v10.15.3...v10.15.4) (2025-08-13)
2
19
 
3
20
 
@@ -258,6 +258,14 @@ var script = {
258
258
  type: Boolean,
259
259
  required: false,
260
260
  default: false
261
+ },
262
+ /**
263
+ * Optional parameter to pass in the working directory - needed for MessageMap Tool type
264
+ */
265
+ workingDirectory: {
266
+ type: String,
267
+ required: false,
268
+ default: ''
261
269
  }
262
270
  },
263
271
  data() {
@@ -630,6 +638,16 @@ var script = {
630
638
  * @param {String} filePath The file path to open
631
639
  */
632
640
  this.$emit('open-file-path', filePath);
641
+ },
642
+ handleUndo(event) {
643
+ var _document$execCommand, _document;
644
+ event.preventDefault();
645
+ (_document$execCommand = (_document = document).execCommand) === null || _document$execCommand === void 0 ? void 0 : _document$execCommand.call(_document, 'undo');
646
+ },
647
+ handleRedo(event) {
648
+ var _document$execCommand2, _document2;
649
+ event.preventDefault();
650
+ (_document$execCommand2 = (_document2 = document).execCommand) === null || _document$execCommand2 === void 0 ? void 0 : _document$execCommand2.call(_document2, 'redo');
633
651
  }
634
652
  },
635
653
  i18n
@@ -645,7 +663,7 @@ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=
645
663
  },attrs:{"width":_vm.shouldRenderResizable ? _vm.dimensions.width : null,"height":_vm.shouldRenderResizable ? _vm.dimensions.height : null,"max-width":_vm.shouldRenderResizable ? _vm.dimensions.maxWidth : null,"max-height":_vm.shouldRenderResizable ? _vm.dimensions.maxHeight : null,"min-width":_vm.shouldRenderResizable ? _vm.dimensions.minWidth : null,"left":_vm.shouldRenderResizable ? _vm.dimensions.left : null,"top":_vm.shouldRenderResizable ? _vm.dimensions.top : null,"fit-parent":true,"min-height":_vm.shouldRenderResizable ? _vm.dimensions.minHeight : null,"active":_vm.shouldRenderResizable ? ['l', 't', 'lt'] : null},on:{"resize:end":_vm.updateSize}},[(!_vm.isHidden)?_c('aside',{staticClass:"markdown-code-block duo-chat gl-bottom-0 gl-flex gl-max-h-full gl-flex-col",class:{
646
664
  'resizable-content': _vm.shouldRenderResizable,
647
665
  'duo-chat-drawer': !_vm.shouldRenderResizable,
648
- },attrs:{"id":"chat-component","role":"complementary","data-testid":"chat-component"}},[(_vm.showHeader)?_c('duo-chat-header',{ref:"header",attrs:{"active-thread-id":_vm.activeThreadId,"title":_vm.isMultithreaded && _vm.currentView === 'list' ? _vm.$options.i18n.CHAT_HISTORY_TITLE : _vm.title,"subtitle":_vm.activeThreadTitleForView,"error":_vm.error,"is-multithreaded":_vm.isMultithreaded,"current-view":_vm.currentView,"should-render-resizable":_vm.shouldRenderResizable,"badge-type":_vm.isMultithreaded ? null : _vm.badgeType},on:{"go-back":_vm.onGoBack,"new-chat":_vm.onNewChat,"close":_vm.hideChat},scopedSlots:_vm._u([{key:"subheader",fn:function(){return [_vm._t("subheader")]},proxy:true}],null,true)}):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-flex gl-flex-1 gl-flex-grow gl-flex-col gl-overflow-y-auto gl-overscroll-contain gl-bg-inherit",attrs:{"data-testid":"chat-history"},on:{"scroll":_vm.handleScrollingThrottled}},[(_vm.shouldShowThreadList)?_c('duo-chat-threads',{attrs:{"threads":_vm.threadList,"preferred-locale":_vm.preferredLocale},on:{"new-chat":_vm.onNewChat,"select-thread":_vm.onSelectThread,"delete-thread":_vm.onDeleteThread,"close":_vm.hideChat}}):_c('transition-group',{staticClass:"duo-chat-history gl-mt-auto gl-p-5",attrs:{"mode":"out-in","tag":"section","name":"message"}},[_vm._l((_vm.conversations),function(conversation,index){return _c('duo-chat-conversation',{key:("conversation-" + index),attrs:{"enable-code-insertion":_vm.enableCodeInsertion,"messages":conversation,"show-delimiter":index > 0,"with-feedback":_vm.withFeedback,"is-tool-approval-processing":_vm.isToolApprovalProcessing},on:{"track-feedback":_vm.onTrackFeedback,"insert-code-snippet":_vm.onInsertCodeSnippet,"copy-code-snippet":_vm.onCopyCodeSnippet,"copy-message":_vm.onCopyMessage,"get-context-item-content":_vm.onGetContextItemContent,"approve-tool":_vm.onApproveToolCall,"deny-tool":_vm.onDenyToolCall,"open-file-path":_vm.onOpenFilePath}})}),_vm._v(" "),(!_vm.hasMessages && !_vm.isLoading)?[_c('div',{key:"empty-state-message",staticClass:"duo-chat-message gl-rounded-bl-none gl-leading-20 gl-text-gray-900 gl-break-anywhere",attrs:{"data-testid":"gl-duo-chat-empty-state"}},[(_vm.emptyStateTitle)?_c('p',{staticClass:"gl-m-0",attrs:{"data-testid":"gl-duo-chat-empty-state-title"}},[_vm._v("\n "+_vm._s(_vm.emptyStateTitle)+"\n ")]):_vm._e(),_vm._v(" "),_c('duo-chat-predefined-prompts',{key:"predefined-prompts",attrs:{"prompts":_vm.predefinedPrompts},on:{"click":_vm.sendPredefinedPrompt}})],1)]:_vm._e(),_vm._v(" "),(_vm.isLoading)?_c('duo-chat-loader',{key:"loader",attrs:{"tool-name":_vm.toolName}}):_vm._e(),_vm._v(" "),_c('div',{key:"anchor",ref:"anchor",staticClass:"scroll-anchor"})],2)],1),_vm._v(" "),(_vm.isChatAvailable && !_vm.shouldShowThreadList)?_c('footer',{staticClass:"duo-chat-drawer-footer gl-relative gl-z-2 gl-shrink-0 gl-border-0 gl-bg-default gl-pb-3",class:{ 'duo-chat-drawer-body-scrim-on-footer': !_vm.scrolledToBottom },attrs:{"data-testid":"chat-footer"}},[_c('gl-form',{attrs:{"data-testid":"chat-prompt-form"},on:{"submit":function($event){$event.stopPropagation();$event.preventDefault();return _vm.sendChatPrompt.apply(null, arguments)}}},[_c('div',{staticClass:"gl-relative gl-max-w-full"},[_vm._t("context-items-menu",null,{"isOpen":_vm.contextItemsMenuIsOpen,"onClose":_vm.closeContextItemsMenuOpen,"setRef":_vm.setContextItemsMenuRef,"focusPrompt":_vm.focusChatInput})],2),_vm._v(" "),_c('gl-form-input-group',{scopedSlots:_vm._u([{key:"append",fn:function(){return [(_vm.canSubmit)?_c('gl-button',{staticClass:"!gl-absolute gl-bottom-2 gl-right-2 !gl-rounded-full",attrs:{"icon":"paper-airplane","category":"primary","variant":"confirm","type":"submit","data-testid":"chat-prompt-submit-button","aria-label":_vm.$options.i18n.CHAT_SUBMIT_LABEL}}):_c('gl-button',{staticClass:"!gl-absolute gl-bottom-2 gl-right-2 !gl-rounded-full",attrs:{"icon":"stop","category":"primary","variant":"default","data-testid":"chat-prompt-cancel-button","aria-label":_vm.$options.i18n.CHAT_CANCEL_LABEL},on:{"click":_vm.cancelPrompt}})]},proxy:true}],null,false,3738248012)},[_c('div',{staticClass:"duo-chat-input gl-min-h-8 gl-max-w-full gl-grow gl-align-top",attrs:{"data-value":_vm.prompt}},[(_vm.shouldShowSlashCommands)?_c('gl-card',{ref:"commands",staticClass:"slash-commands !gl-absolute gl-w-full -gl-translate-y-full gl-list-none gl-pl-0 gl-shadow-md",attrs:{"body-class":"!gl-p-2"}},_vm._l((_vm.filteredSlashCommands),function(command,index){return _c('gl-dropdown-item',{key:command.name,class:{ 'active-command': index === _vm.activeCommandIndex },on:{"click":function($event){return _vm.selectSlashCommand(index)}},nativeOn:{"mouseenter":function($event){_vm.activeCommandIndex = index;}}},[_c('span',{staticClass:"gl-flex gl-justify-between"},[_c('span',{staticClass:"gl-block"},[_vm._v(_vm._s(command.name))]),_vm._v(" "),_c('small',{staticClass:"gl-pl-3 gl-text-right gl-italic gl-text-subtle"},[_vm._v(_vm._s(command.description))])])])}),1):_vm._e(),_vm._v(" "),_c('gl-form-textarea',{ref:"prompt",staticClass:"gl-absolute !gl-h-full gl-rounded-br-none gl-rounded-tr-none !gl-bg-transparent !gl-py-4 !gl-shadow-none",class:{ 'gl-truncate': !_vm.prompt },attrs:{"disabled":!_vm.canSubmit,"data-testid":"chat-prompt-input","placeholder":_vm.inputPlaceholder,"autofocus":""},on:{"compositionend":_vm.compositionEnd},nativeOn:{"keydown":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }if($event.ctrlKey||$event.shiftKey||$event.altKey||$event.metaKey){ return null; }$event.preventDefault();},"keyup":function($event){return _vm.onInputKeyup.apply(null, arguments)}},model:{value:(_vm.prompt),callback:function ($$v) {_vm.prompt=$$v;},expression:"prompt"}})],1)])],1),_vm._v(" "),_vm._t("footer-controls"),_vm._v(" "),_c('p',{staticClass:"gl-mb-0 gl-mt-3 gl-px-4 gl-text-sm gl-text-secondary"},[_vm._v("\n "+_vm._s(_vm.$options.i18n.CHAT_DISCLAMER)+"\n ")])],2):_vm._e()],1):_vm._e()])};
666
+ },attrs:{"id":"chat-component","role":"complementary","data-testid":"chat-component"}},[(_vm.showHeader)?_c('duo-chat-header',{ref:"header",attrs:{"active-thread-id":_vm.activeThreadId,"title":_vm.isMultithreaded && _vm.currentView === 'list' ? _vm.$options.i18n.CHAT_HISTORY_TITLE : _vm.title,"subtitle":_vm.activeThreadTitleForView,"error":_vm.error,"is-multithreaded":_vm.isMultithreaded,"current-view":_vm.currentView,"should-render-resizable":_vm.shouldRenderResizable,"badge-type":_vm.isMultithreaded ? null : _vm.badgeType},on:{"go-back":_vm.onGoBack,"new-chat":_vm.onNewChat,"close":_vm.hideChat},scopedSlots:_vm._u([{key:"subheader",fn:function(){return [_vm._t("subheader")]},proxy:true}],null,true)}):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-flex gl-flex-1 gl-flex-grow gl-flex-col gl-overflow-y-auto gl-overscroll-contain gl-bg-inherit",attrs:{"data-testid":"chat-history"},on:{"scroll":_vm.handleScrollingThrottled}},[(_vm.shouldShowThreadList)?_c('duo-chat-threads',{attrs:{"threads":_vm.threadList,"preferred-locale":_vm.preferredLocale},on:{"new-chat":_vm.onNewChat,"select-thread":_vm.onSelectThread,"delete-thread":_vm.onDeleteThread,"close":_vm.hideChat}}):_c('transition-group',{staticClass:"duo-chat-history gl-mt-auto gl-p-5",attrs:{"mode":"out-in","tag":"section","name":"message"}},[_vm._l((_vm.conversations),function(conversation,index){return _c('duo-chat-conversation',{key:("conversation-" + index),attrs:{"enable-code-insertion":_vm.enableCodeInsertion,"messages":conversation,"show-delimiter":index > 0,"with-feedback":_vm.withFeedback,"is-tool-approval-processing":_vm.isToolApprovalProcessing,"working-directory":_vm.workingDirectory},on:{"track-feedback":_vm.onTrackFeedback,"insert-code-snippet":_vm.onInsertCodeSnippet,"copy-code-snippet":_vm.onCopyCodeSnippet,"copy-message":_vm.onCopyMessage,"get-context-item-content":_vm.onGetContextItemContent,"approve-tool":_vm.onApproveToolCall,"deny-tool":_vm.onDenyToolCall,"open-file-path":_vm.onOpenFilePath}})}),_vm._v(" "),(!_vm.hasMessages && !_vm.isLoading)?[_c('div',{key:"empty-state-message",staticClass:"duo-chat-message gl-rounded-bl-none gl-leading-20 gl-text-gray-900 gl-break-anywhere",attrs:{"data-testid":"gl-duo-chat-empty-state"}},[(_vm.emptyStateTitle)?_c('p',{staticClass:"gl-m-0",attrs:{"data-testid":"gl-duo-chat-empty-state-title"}},[_vm._v("\n "+_vm._s(_vm.emptyStateTitle)+"\n ")]):_vm._e(),_vm._v(" "),_c('duo-chat-predefined-prompts',{key:"predefined-prompts",attrs:{"prompts":_vm.predefinedPrompts},on:{"click":_vm.sendPredefinedPrompt}})],1)]:_vm._e(),_vm._v(" "),(_vm.isLoading)?_c('duo-chat-loader',{key:"loader",attrs:{"tool-name":_vm.toolName}}):_vm._e(),_vm._v(" "),_c('div',{key:"anchor",ref:"anchor",staticClass:"scroll-anchor"})],2)],1),_vm._v(" "),(_vm.isChatAvailable && !_vm.shouldShowThreadList)?_c('footer',{staticClass:"duo-chat-drawer-footer gl-relative gl-z-2 gl-shrink-0 gl-border-0 gl-bg-default gl-pb-3",class:{ 'duo-chat-drawer-body-scrim-on-footer': !_vm.scrolledToBottom },attrs:{"data-testid":"chat-footer"}},[_c('gl-form',{attrs:{"data-testid":"chat-prompt-form"},on:{"submit":function($event){$event.stopPropagation();$event.preventDefault();return _vm.sendChatPrompt.apply(null, arguments)}}},[_c('div',{staticClass:"gl-relative gl-max-w-full"},[_vm._t("context-items-menu",null,{"isOpen":_vm.contextItemsMenuIsOpen,"onClose":_vm.closeContextItemsMenuOpen,"setRef":_vm.setContextItemsMenuRef,"focusPrompt":_vm.focusChatInput})],2),_vm._v(" "),_c('gl-form-input-group',{scopedSlots:_vm._u([{key:"append",fn:function(){return [(_vm.canSubmit)?_c('gl-button',{staticClass:"!gl-absolute gl-bottom-2 gl-right-2 !gl-rounded-full",attrs:{"icon":"paper-airplane","category":"primary","variant":"confirm","type":"submit","data-testid":"chat-prompt-submit-button","aria-label":_vm.$options.i18n.CHAT_SUBMIT_LABEL}}):_c('gl-button',{staticClass:"!gl-absolute gl-bottom-2 gl-right-2 !gl-rounded-full",attrs:{"icon":"stop","category":"primary","variant":"default","data-testid":"chat-prompt-cancel-button","aria-label":_vm.$options.i18n.CHAT_CANCEL_LABEL},on:{"click":_vm.cancelPrompt}})]},proxy:true}],null,false,3738248012)},[_c('div',{staticClass:"duo-chat-input gl-min-h-8 gl-max-w-full gl-grow gl-align-top",attrs:{"data-value":_vm.prompt}},[(_vm.shouldShowSlashCommands)?_c('gl-card',{ref:"commands",staticClass:"slash-commands !gl-absolute gl-w-full -gl-translate-y-full gl-list-none gl-pl-0 gl-shadow-md",attrs:{"body-class":"!gl-p-2"}},_vm._l((_vm.filteredSlashCommands),function(command,index){return _c('gl-dropdown-item',{key:command.name,class:{ 'active-command': index === _vm.activeCommandIndex },on:{"click":function($event){return _vm.selectSlashCommand(index)}},nativeOn:{"mouseenter":function($event){_vm.activeCommandIndex = index;}}},[_c('span',{staticClass:"gl-flex gl-justify-between"},[_c('span',{staticClass:"gl-block"},[_vm._v(_vm._s(command.name))]),_vm._v(" "),_c('small',{staticClass:"gl-pl-3 gl-text-right gl-italic gl-text-subtle"},[_vm._v(_vm._s(command.description))])])])}),1):_vm._e(),_vm._v(" "),_c('gl-form-textarea',{ref:"prompt",staticClass:"gl-absolute !gl-h-full gl-rounded-br-none gl-rounded-tr-none !gl-bg-transparent !gl-py-4 !gl-shadow-none",class:{ 'gl-truncate': !_vm.prompt },attrs:{"disabled":!_vm.canSubmit,"data-testid":"chat-prompt-input","placeholder":_vm.inputPlaceholder,"autofocus":""},on:{"keydown":[function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"z",undefined,$event.key,undefined)){ return null; }if(!$event.ctrlKey){ return null; }if($event.shiftKey||$event.altKey||$event.metaKey){ return null; }return _vm.handleUndo.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"z",undefined,$event.key,undefined)){ return null; }if(!$event.metaKey){ return null; }if($event.ctrlKey||$event.shiftKey||$event.altKey){ return null; }return _vm.handleUndo.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"z",undefined,$event.key,undefined)){ return null; }if(!$event.ctrlKey){ return null; }if(!$event.shiftKey){ return null; }if($event.altKey||$event.metaKey){ return null; }return _vm.handleRedo.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"z",undefined,$event.key,undefined)){ return null; }if(!$event.metaKey){ return null; }if(!$event.shiftKey){ return null; }if($event.ctrlKey||$event.altKey){ return null; }return _vm.handleRedo.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"y",undefined,$event.key,undefined)){ return null; }if(!$event.ctrlKey){ return null; }if($event.shiftKey||$event.altKey||$event.metaKey){ return null; }return _vm.handleRedo.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"y",undefined,$event.key,undefined)){ return null; }if(!$event.metaKey){ return null; }if($event.ctrlKey||$event.shiftKey||$event.altKey){ return null; }return _vm.handleRedo.apply(null, arguments)}],"compositionend":_vm.compositionEnd},nativeOn:{"keydown":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }if($event.ctrlKey||$event.shiftKey||$event.altKey||$event.metaKey){ return null; }$event.preventDefault();},"keyup":function($event){return _vm.onInputKeyup.apply(null, arguments)}},model:{value:(_vm.prompt),callback:function ($$v) {_vm.prompt=$$v;},expression:"prompt"}})],1)])],1),_vm._v(" "),_vm._t("footer-controls"),_vm._v(" "),_c('p',{staticClass:"gl-mb-0 gl-mt-3 gl-px-4 gl-text-sm gl-text-secondary"},[_vm._v("\n "+_vm._s(_vm.$options.i18n.CHAT_DISCLAMER)+"\n ")])],2):_vm._e()],1):_vm._e()])};
649
667
  var __vue_staticRenderFns__ = [];
650
668
 
651
669
  /* style */
@@ -69,6 +69,14 @@ var script = {
69
69
  type: Boolean,
70
70
  required: false,
71
71
  default: false
72
+ },
73
+ /**
74
+ * Optional parameter to pass in the working directory - needed for MessageMap Tool type
75
+ */
76
+ workingDirectory: {
77
+ type: String,
78
+ required: false,
79
+ default: ''
72
80
  }
73
81
  },
74
82
  computed: {
@@ -114,7 +122,7 @@ var script = {
114
122
  const __vue_script__ = script;
115
123
 
116
124
  /* template */
117
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{class:['gl-flex gl-flex-col gl-justify-end', { 'insert-code-hidden': !_vm.enableCodeInsertion }]},[(_vm.showDelimiter)?_c('div',{staticClass:"gl-my-5 gl-flex gl-items-center gl-gap-4 gl-text-gray-500",attrs:{"data-testid":"conversation-delimiter"}},[_c('hr',{staticClass:"gl-grow"}),_vm._v(" "),_c('span',[_vm._v(_vm._s(_vm.$options.i18n.CONVERSATION_NEW_CHAT))]),_vm._v(" "),_c('hr',{staticClass:"gl-grow"})]):_vm._e(),_vm._v(" "),_vm._l((_vm.messages),function(msg,index){return _c('duo-chat-message',{key:((msg.role) + "-" + index),attrs:{"message":msg,"trusted-urls":_vm.trustedUrls,"is-cancelled":_vm.canceledRequestIds.includes(msg.requestId),"with-feedback":_vm.withFeedback},on:{"track-feedback":_vm.onTrackFeedback,"insert-code-snippet":_vm.onInsertCodeSnippet,"copy-code-snippet":_vm.onCopyCodeSnippet,"copy-message":_vm.onCopyMessage,"get-context-item-content":_vm.onGetContextItemContent,"open-file-path":_vm.onOpenFilePath}})}),_vm._v(" "),(_vm.isAwaitingToolApproval)?_c('duo-chat-message-tool-approval',{attrs:{"message":_vm.messages[_vm.messages.length - 1],"is-processing":_vm.isToolApprovalProcessing},on:{"approve-tool":_vm.onApproveToolCall,"deny-tool":_vm.onDenyToolCall}}):_vm._e()],2)};
125
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{class:['gl-flex gl-flex-col gl-justify-end', { 'insert-code-hidden': !_vm.enableCodeInsertion }]},[(_vm.showDelimiter)?_c('div',{staticClass:"gl-my-5 gl-flex gl-items-center gl-gap-4 gl-text-gray-500",attrs:{"data-testid":"conversation-delimiter"}},[_c('hr',{staticClass:"gl-grow"}),_vm._v(" "),_c('span',[_vm._v(_vm._s(_vm.$options.i18n.CONVERSATION_NEW_CHAT))]),_vm._v(" "),_c('hr',{staticClass:"gl-grow"})]):_vm._e(),_vm._v(" "),_vm._l((_vm.messages),function(msg,index){return _c('duo-chat-message',{key:((msg.role) + "-" + index),attrs:{"message":msg,"trusted-urls":_vm.trustedUrls,"is-cancelled":_vm.canceledRequestIds.includes(msg.requestId),"with-feedback":_vm.withFeedback,"working-directory":_vm.workingDirectory},on:{"track-feedback":_vm.onTrackFeedback,"insert-code-snippet":_vm.onInsertCodeSnippet,"copy-code-snippet":_vm.onCopyCodeSnippet,"copy-message":_vm.onCopyMessage,"get-context-item-content":_vm.onGetContextItemContent,"open-file-path":_vm.onOpenFilePath}})}),_vm._v(" "),(_vm.isAwaitingToolApproval)?_c('duo-chat-message-tool-approval',{attrs:{"message":_vm.messages[_vm.messages.length - 1],"is-processing":_vm.isToolApprovalProcessing},on:{"approve-tool":_vm.onApproveToolCall,"deny-tool":_vm.onDenyToolCall}}):_vm._e()],2)};
118
126
  var __vue_staticRenderFns__ = [];
119
127
 
120
128
  /* style */
@@ -86,6 +86,14 @@ var script = {
86
86
  type: Boolean,
87
87
  required: false,
88
88
  default: true
89
+ },
90
+ /**
91
+ * Optional parameter to pass in the working directory
92
+ */
93
+ workingDirectory: {
94
+ type: String,
95
+ required: false,
96
+ default: ''
89
97
  }
90
98
  },
91
99
  data() {
@@ -293,7 +301,7 @@ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=
293
301
  'gl-ml-auto gl-bg-feedback-info gl-p-3 gl-text-feedback-info': _vm.isUserMessage,
294
302
  'gl-text-default': _vm.isAssistantMessage && !_vm.error,
295
303
  'duo-chat-message-with-error gl-bg-feedback-danger gl-p-3': _vm.error,
296
- },on:{"insert-code-snippet":_vm.onInsertCodeSnippet,"copy-code-snippet":_vm.onCopyCodeSnippet}},[(_vm.showA11yFromText)?_c('div',{staticClass:"gl-sr-only"},[_vm._v("\n "+_vm._s(_vm.isUserMessage ? _vm.$options.i18n.FROM_ME : _vm.$options.i18n.FROM_DUO)+"\n ")]):_vm._e(),_vm._v(" "),_c('div',{ref:"content-wrapper",class:{ 'has-error': _vm.error }},[(_vm.displaySelectedContextItems && _vm.isAssistantMessage)?_c('duo-chat-context-item-selections',{attrs:{"selections":_vm.selectedContextItems,"title":_vm.selectedContextItemsTitle,"default-collapsed":_vm.selectedContextItemsDefaultCollapsed,"variant":"assistant"},on:{"get-content":_vm.onGetContextItemContent}}):_vm._e(),_vm._v(" "),(_vm.error)?_c('div',{staticClass:"gl-flex"},[(_vm.error)?_c('gl-icon',{staticClass:"error-icon gl-mr-3 gl-mt-1 gl-shrink-0 gl-text-danger",attrs:{"aria-label":_vm.$options.i18n.MESSAGE_ERROR,"name":"error","size":16,"data-testid":"error"}}):_vm._e(),_vm._v(" "),_c('div',{directives:[{name:"safe-html",rawName:"v-safe-html:[$options.safeHtmlConfigExtension]",value:(_vm.renderedError),expression:"renderedError",arg:_vm.$options.safeHtmlConfigExtension}],ref:"error-message"})],1):_c('div',[_c('div',{staticClass:"gl-flex"},[(_vm.isUserMessage)?_c('gl-avatar',{staticClass:"gl-mr-3 gl-mt-1",attrs:{"size":16,"entity-name":"User","src":_vm.avatarUrl}}):_vm._e(),_vm._v(" "),_c('div',{directives:[{name:"safe-html",rawName:"v-safe-html:[$options.safeHtmlConfigExtension]",value:(_vm.messageContent),expression:"messageContent",arg:_vm.$options.safeHtmlConfigExtension}],ref:"content"})],1),_vm._v(" "),(_vm.isAssistantMessage)?[(_vm.sources)?_c('documentation-sources',{attrs:{"sources":_vm.sources}}):_vm._e(),_vm._v(" "),_c('div',{staticClass:"duo-chat-message-feedback gl-mt-4 gl-flex gl-items-end"},[(_vm.isChunkAndNotCancelled)?_c('gl-animated-loader-icon',{attrs:{"is-on":true}}):_vm._e(),_vm._v(" "),(_vm.shouldShowFeedbackLink)?_c('message-feedback',{attrs:{"has-feedback":_vm.hasFeedback},on:{"feedback":_vm.logEvent}}):_vm._e()],1)]:_vm._e()],2),_vm._v(" "),(_vm.displaySelectedContextItems && _vm.isUserMessage)?_c('duo-chat-context-item-selections',{attrs:{"selections":_vm.selectedContextItems,"title":_vm.selectedContextItemsTitle,"default-collapsed":_vm.selectedContextItemsDefaultCollapsed,"variant":"user"},on:{"get-content":_vm.onGetContextItemContent}}):_vm._e()],1)]),_vm._v(" "),_c('transition',{attrs:{"name":"duo-chat-message-actions"}},[(_vm.shouldShowCopyAction)?_c('div',{staticClass:"duo-chat-message-actions gl-z-1099 gl-absolute gl-bottom-0 gl-right-0 gl-rounded-br-lg gl-rounded-tr-lg gl-bg-subtle"},[_c('gl-button',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip.hover",modifiers:{"hover":true}}],class:{ '!gl-text-success': _vm.copied },attrs:{"title":_vm.copied ? _vm.$options.i18n.CHAT_MESSAGE_COPIED : _vm.$options.i18n.CHAT_MESSAGE_COPY,"icon":_vm.copied ? 'check-circle-filled' : 'copy-to-clipboard',"category":"tertiary"},on:{"click":_vm.copyMessage}})],1):_vm._e()])]:_c('message-map',{attrs:{"message":_vm.message,"with-feedback":_vm.withFeedback,"data-testid":"workflow-message"},on:{"open-file-path":_vm.onOpenFilePath,"feedback":_vm.logEvent,"insert-code-snippet":_vm.onInsertCodeSnippet,"copy-code-snippet":_vm.onCopyCodeSnippet}})],2)};
304
+ },on:{"insert-code-snippet":_vm.onInsertCodeSnippet,"copy-code-snippet":_vm.onCopyCodeSnippet}},[(_vm.showA11yFromText)?_c('div',{staticClass:"gl-sr-only"},[_vm._v("\n "+_vm._s(_vm.isUserMessage ? _vm.$options.i18n.FROM_ME : _vm.$options.i18n.FROM_DUO)+"\n ")]):_vm._e(),_vm._v(" "),_c('div',{ref:"content-wrapper",class:{ 'has-error': _vm.error }},[(_vm.displaySelectedContextItems && _vm.isAssistantMessage)?_c('duo-chat-context-item-selections',{attrs:{"selections":_vm.selectedContextItems,"title":_vm.selectedContextItemsTitle,"default-collapsed":_vm.selectedContextItemsDefaultCollapsed,"variant":"assistant"},on:{"get-content":_vm.onGetContextItemContent}}):_vm._e(),_vm._v(" "),(_vm.error)?_c('div',{staticClass:"gl-flex"},[(_vm.error)?_c('gl-icon',{staticClass:"error-icon gl-mr-3 gl-mt-1 gl-shrink-0 gl-text-danger",attrs:{"aria-label":_vm.$options.i18n.MESSAGE_ERROR,"name":"error","size":16,"data-testid":"error"}}):_vm._e(),_vm._v(" "),_c('div',{directives:[{name:"safe-html",rawName:"v-safe-html:[$options.safeHtmlConfigExtension]",value:(_vm.renderedError),expression:"renderedError",arg:_vm.$options.safeHtmlConfigExtension}],ref:"error-message"})],1):_c('div',[_c('div',{staticClass:"gl-flex"},[(_vm.isUserMessage)?_c('gl-avatar',{staticClass:"gl-mr-3 gl-mt-1",attrs:{"size":16,"entity-name":"User","src":_vm.avatarUrl}}):_vm._e(),_vm._v(" "),_c('div',{directives:[{name:"safe-html",rawName:"v-safe-html:[$options.safeHtmlConfigExtension]",value:(_vm.messageContent),expression:"messageContent",arg:_vm.$options.safeHtmlConfigExtension}],ref:"content"})],1),_vm._v(" "),(_vm.isAssistantMessage)?[(_vm.sources)?_c('documentation-sources',{attrs:{"sources":_vm.sources}}):_vm._e(),_vm._v(" "),_c('div',{staticClass:"duo-chat-message-feedback gl-mt-4 gl-flex gl-items-end"},[(_vm.isChunkAndNotCancelled)?_c('gl-animated-loader-icon',{attrs:{"is-on":true}}):_vm._e(),_vm._v(" "),(_vm.shouldShowFeedbackLink)?_c('message-feedback',{attrs:{"has-feedback":_vm.hasFeedback},on:{"feedback":_vm.logEvent}}):_vm._e()],1)]:_vm._e()],2),_vm._v(" "),(_vm.displaySelectedContextItems && _vm.isUserMessage)?_c('duo-chat-context-item-selections',{attrs:{"selections":_vm.selectedContextItems,"title":_vm.selectedContextItemsTitle,"default-collapsed":_vm.selectedContextItemsDefaultCollapsed,"variant":"user"},on:{"get-content":_vm.onGetContextItemContent}}):_vm._e()],1)]),_vm._v(" "),_c('transition',{attrs:{"name":"duo-chat-message-actions"}},[(_vm.shouldShowCopyAction)?_c('div',{staticClass:"duo-chat-message-actions gl-z-1099 gl-absolute gl-bottom-0 gl-right-0 gl-rounded-br-lg gl-rounded-tr-lg gl-bg-subtle"},[_c('gl-button',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip.hover",modifiers:{"hover":true}}],class:{ '!gl-text-success': _vm.copied },attrs:{"title":_vm.copied ? _vm.$options.i18n.CHAT_MESSAGE_COPIED : _vm.$options.i18n.CHAT_MESSAGE_COPY,"icon":_vm.copied ? 'check-circle-filled' : 'copy-to-clipboard',"category":"tertiary"},on:{"click":_vm.copyMessage}})],1):_vm._e()])]:_c('message-map',{attrs:{"message":_vm.message,"with-feedback":_vm.withFeedback,"working-directory":_vm.workingDirectory,"data-testid":"workflow-message"},on:{"open-file-path":_vm.onOpenFilePath,"feedback":_vm.logEvent,"insert-code-snippet":_vm.onInsertCodeSnippet,"copy-code-snippet":_vm.onCopyCodeSnippet}})],2)};
297
305
  var __vue_staticRenderFns__ = [];
298
306
 
299
307
  /* style */
@@ -43,6 +43,14 @@ var script = {
43
43
  type: Object,
44
44
  required: false,
45
45
  default: () => ({})
46
+ },
47
+ /**
48
+ * Optional parameter to pass in the working directory
49
+ */
50
+ workingDirectory: {
51
+ type: String,
52
+ required: false,
53
+ default: ''
46
54
  }
47
55
  },
48
56
  computed: {
@@ -70,7 +78,7 @@ var script = {
70
78
  const __vue_script__ = script;
71
79
 
72
80
  /* template */
73
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c(_vm.messageComponent,_vm._g(_vm._b({tag:"component",style:(_vm.customStyles),attrs:{"message":_vm.message}},'component',_vm.$attrs,false),_vm.$listeners))};
81
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c(_vm.messageComponent,_vm._g(_vm._b({tag:"component",style:(_vm.customStyles),attrs:{"message":_vm.message,"working-directory":_vm.workingDirectory}},'component',_vm.$attrs,false),_vm.$listeners))};
74
82
  var __vue_staticRenderFns__ = [];
75
83
 
76
84
  /* style */
@@ -1,5 +1,6 @@
1
1
  import { GlIcon, GlLink } from '@gitlab/ui';
2
2
  import { translate } from '../../../../../utils/i18n';
3
+ import MessageToolCommandOutput from '../../duo_chat_message_tool_command_output/message_tool_command_output';
3
4
  import BaseMessage from './message_base';
4
5
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
5
6
 
@@ -10,12 +11,14 @@ const i18n = {
10
11
  COMMIT_MESSAGE_LABEL: translate('DuoChatMessage.commitMessageLabel', 'Commit message'),
11
12
  ACTION_LABEL: translate('DuoChatMessage.actionLabel', 'Action'),
12
13
  CONTENT_LABEL: translate('DuoChatMessage.contentLabel', 'Content'),
13
- FILE_PATH_LABEL: translate('DuoChatMessage.filePathLabel', 'File path')
14
+ FILE_PATH_LABEL: translate('DuoChatMessage.filePathLabel', 'File path'),
15
+ RAN_TERMINAL_COMMAND: translate('DuoChatMessage.ranTerminalCommand', 'Ran terminal command')
14
16
  };
15
17
  var script = {
16
18
  name: 'DuoToolMessage',
17
19
  components: {
18
20
  BaseMessage,
21
+ MessageToolCommandOutput,
19
22
  GlIcon,
20
23
  GlLink
21
24
  },
@@ -36,12 +39,16 @@ var script = {
36
39
  validate: value => {
37
40
  return value && value.tool_info;
38
41
  }
42
+ },
43
+ workingDirectory: {
44
+ required: false,
45
+ type: String,
46
+ default: ''
39
47
  }
40
48
  },
41
49
  computed: {
42
50
  iconName() {
43
- var _this$message$tool_in;
44
- switch ((_this$message$tool_in = this.message.tool_info) === null || _this$message$tool_in === void 0 ? void 0 : _this$message$tool_in.name) {
51
+ switch (this.toolName) {
45
52
  case 'read_file':
46
53
  return 'eye';
47
54
  case 'write_file':
@@ -59,12 +66,12 @@ var script = {
59
66
  }
60
67
  },
61
68
  messageFilePath() {
62
- var _this$message$tool_in2, _this$message$tool_in3;
63
- 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;
69
+ var _this$message$tool_in, _this$message$tool_in2;
70
+ return (_this$message$tool_in = this.message.tool_info) === null || _this$message$tool_in === void 0 ? void 0 : (_this$message$tool_in2 = _this$message$tool_in.args) === null || _this$message$tool_in2 === void 0 ? void 0 : _this$message$tool_in2.file_path;
64
71
  },
65
72
  toolArgs() {
66
- var _this$message$tool_in4;
67
- return ((_this$message$tool_in4 = this.message.tool_info) === null || _this$message$tool_in4 === void 0 ? void 0 : _this$message$tool_in4.args) || {};
73
+ var _this$message$tool_in3;
74
+ return ((_this$message$tool_in3 = this.message.tool_info) === null || _this$message$tool_in3 === void 0 ? void 0 : _this$message$tool_in3.args) || {};
68
75
  },
69
76
  hasActions() {
70
77
  return this.toolArgs.actions && Array.isArray(this.toolArgs.actions);
@@ -80,6 +87,20 @@ var script = {
80
87
  },
81
88
  commitMessage() {
82
89
  return this.toolArgs.commit_message;
90
+ },
91
+ hasCommandOutput() {
92
+ return this.message.message_sub_type === 'command_output';
93
+ },
94
+ toolName() {
95
+ var _this$message$tool_in4;
96
+ return (_this$message$tool_in4 = this.message.tool_info) === null || _this$message$tool_in4 === void 0 ? void 0 : _this$message$tool_in4.name;
97
+ },
98
+ toolResponse() {
99
+ var _this$message$tool_in5;
100
+ return (_this$message$tool_in5 = this.message.tool_info) === null || _this$message$tool_in5 === void 0 ? void 0 : _this$message$tool_in5.toolResponse;
101
+ },
102
+ toolWorkingDirectory() {
103
+ return this.workingDirectory;
83
104
  }
84
105
  },
85
106
  methods: {
@@ -98,7 +119,7 @@ const __vue_script__ = script;
98
119
  /* template */
99
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){
100
121
  var content = ref.content;
101
- 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()])])]}}])})};
122
+ return [(_vm.hasCommandOutput)?_c('message-tool-command-output',{attrs:{"command-header":_vm.$options.i18n.RAN_TERMINAL_COMMAND,"command-action":_vm.toolName,"command-output":_vm.toolResponse,"working-directory":_vm.toolWorkingDirectory}}):_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()])])]}}])})};
102
123
  var __vue_staticRenderFns__ = [];
103
124
 
104
125
  /* style */
@@ -13,7 +13,7 @@ var script = {
13
13
  endMessage: {
14
14
  required: false,
15
15
  type: String,
16
- default: "Review the changes. To improve the implementation, create another workflow and describe the specific changes you'd like to see."
16
+ default: "Review the changes. To improve the implementation, create another session and describe the specific changes you'd like to see."
17
17
  },
18
18
  action: {
19
19
  required: false,
@@ -27,7 +27,7 @@ var script = {
27
27
  },
28
28
  buttonText() {
29
29
  var _this$action;
30
- return ((_this$action = this.action) === null || _this$action === void 0 ? void 0 : _this$action.text) || 'New workflow';
30
+ return ((_this$action = this.action) === null || _this$action === void 0 ? void 0 : _this$action.text) || 'New session';
31
31
  }
32
32
  },
33
33
  newRoute: {
@@ -2,7 +2,7 @@ import { GlCollapse, GlButton, GlIcon } from '@gitlab/ui';
2
2
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
3
3
 
4
4
  var script = {
5
- name: 'GlDuoTerminalCommand',
5
+ name: 'MessageToolCommandOutput',
6
6
  components: {
7
7
  GlCollapse,
8
8
  GlButton,
@@ -63,7 +63,7 @@ var script = {
63
63
  const __vue_script__ = script;
64
64
 
65
65
  /* template */
66
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-border-solid gl-border-neutral-600"},[_c('div',{staticClass:"gl-flex gl-w-full gl-items-center gl-justify-between gl-px-3 gl-py-2"},[_c('span',{staticClass:"gl-flex gl-items-center",attrs:{"data-testid":"terminal-command-header"}},[_c('gl-icon',{staticClass:"gl-mr-3",attrs:{"name":"terminal"}}),_vm._v("\n "+_vm._s(_vm.commandHeader)+"\n ")],1),_vm._v(" "),(_vm.isCommandOutputAvailable)?_c('gl-button',{attrs:{"text":"Toggle visibility","icon":_vm.toggleIcon,"data-testid":"toggle-visibility-button","category":"tertiary"},on:{"click":_vm.toggleVisibility}}):_vm._e()],1),_vm._v(" "),_c('div',{staticClass:"gl-leading-22 gl-border-t gl-flex gl-flex-col gl-p-3"},[_c('code',{staticClass:"gl-text-subtle",attrs:{"data-testid":"terminal-working-directory"}},[_vm._v(_vm._s(_vm.workingDirectory)+" >")]),_vm._v(" "),_c('code',{staticClass:"gl-text-default",attrs:{"data-testid":"terminal-command-action"}},[_vm._v(_vm._s(_vm.commandAction))])]),_vm._v(" "),(_vm.isCommandOutputAvailable)?_c('gl-collapse',{attrs:{"visible":_vm.isVisible}},[_c('div',{staticClass:"gl-bg-black gl-p-3"},[_c('code',[_vm._v(_vm._s(_vm.commandOutput))])])]):_vm._e(),_vm._v(" "),(_vm.$scopedSlots.actions)?_c('div',{staticClass:"gl-border-t gl-p-3"},[_vm._t("actions")],2):_vm._e()],1)};
66
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"terminal-command-output gl-border-solid gl-border-neutral-600"},[_c('div',{staticClass:"gl-flex gl-w-full gl-items-center gl-justify-between gl-px-3 gl-py-2"},[_c('span',{staticClass:"gl-flex gl-items-center",attrs:{"data-testid":"terminal-command-header"}},[_c('gl-icon',{staticClass:"gl-mr-3",attrs:{"name":"terminal"}}),_vm._v("\n "+_vm._s(_vm.commandHeader)+"\n ")],1),_vm._v(" "),(_vm.isCommandOutputAvailable)?_c('gl-button',{attrs:{"text":"Toggle visibility","icon":_vm.toggleIcon,"data-testid":"toggle-visibility-button","category":"tertiary"},on:{"click":_vm.toggleVisibility}}):_vm._e()],1),_vm._v(" "),_c('div',{staticClass:"gl-leading-22 gl-border-t gl-flex gl-flex-col gl-p-3"},[(_vm.workingDirectory)?_c('code',{staticClass:"!gl-bg-transparent gl-text-subtle",attrs:{"data-testid":"terminal-working-directory"}},[_vm._v(_vm._s(_vm.workingDirectory)+" >")]):_vm._e(),_vm._v(" "),_c('code',{staticClass:"!gl-bg-transparent gl-text-default",attrs:{"data-testid":"terminal-command-action"}},[_vm._v(_vm._s(_vm.commandAction))])]),_vm._v(" "),(_vm.isCommandOutputAvailable)?_c('gl-collapse',{attrs:{"visible":_vm.isVisible}},[_c('div',{staticClass:"gl-bg-black gl-p-3"},[_c('code',{staticClass:"!gl-bg-transparent"},[_vm._v(_vm._s(_vm.commandOutput))])])]):_vm._e(),_vm._v(" "),(_vm.$scopedSlots.actions)?_c('div',{staticClass:"gl-border-t gl-p-3"},[_vm._t("actions")],2):_vm._e()],1)};
67
67
  var __vue_staticRenderFns__ = [];
68
68
 
69
69
  /* style */
@@ -615,6 +615,14 @@ var script = {
615
615
  * @param {String} filePath The file path to open
616
616
  */
617
617
  this.$emit('open-file-path', filePath);
618
+ },
619
+ handleUndo(event) {
620
+ event.preventDefault();
621
+ document.execCommand('undo');
622
+ },
623
+ handleRedo(event) {
624
+ event.preventDefault();
625
+ document.execCommand('redo');
618
626
  }
619
627
  },
620
628
  i18n
@@ -630,7 +638,7 @@ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=
630
638
  },attrs:{"width":_vm.shouldRenderResizable ? _vm.dimensions.width : null,"height":_vm.shouldRenderResizable ? _vm.dimensions.height : null,"max-width":_vm.shouldRenderResizable ? _vm.dimensions.maxWidth : null,"max-height":_vm.shouldRenderResizable ? _vm.dimensions.maxHeight : null,"min-width":_vm.shouldRenderResizable ? _vm.dimensions.minWidth : null,"left":_vm.shouldRenderResizable ? _vm.dimensions.left : null,"top":_vm.shouldRenderResizable ? _vm.dimensions.top : null,"fit-parent":true,"min-height":_vm.shouldRenderResizable ? _vm.dimensions.minHeight : null,"active":_vm.shouldRenderResizable ? ['l', 't', 'lt'] : null},on:{"resize:end":_vm.updateSize}},[(!_vm.isHidden)?_c('aside',{staticClass:"markdown-code-block duo-chat gl-bottom-0 gl-flex gl-max-h-full gl-flex-col",class:{
631
639
  'resizable-content': _vm.shouldRenderResizable,
632
640
  'duo-chat-drawer': !_vm.shouldRenderResizable,
633
- },attrs:{"id":"chat-component","role":"complementary","data-testid":"chat-component"}},[(_vm.showHeader)?_c('duo-chat-header',{ref:"header",attrs:{"active-thread-id":_vm.activeThreadId,"title":_vm.isMultithreaded && _vm.currentView === 'list' ? _vm.$options.i18n.CHAT_HISTORY_TITLE : _vm.title,"subtitle":_vm.activeThreadTitleForView,"is-multithreaded":_vm.isMultithreaded,"current-view":_vm.currentView,"should-render-resizable":_vm.shouldRenderResizable,"badge-type":_vm.isMultithreaded ? null : _vm.badgeType},on:{"go-back":_vm.onGoBack,"go-back-to-chat":_vm.onGoBackToChat,"new-chat":_vm.onNewChat,"close":_vm.hideChat},scopedSlots:_vm._u([{key:"subheader",fn:function(){return [_vm._t("subheader")]},proxy:true}],null,true)}):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-flex gl-flex-1 gl-flex-grow gl-flex-col gl-overflow-y-auto gl-overscroll-contain gl-bg-inherit",attrs:{"data-testid":"chat-history"},on:{"scroll":_vm.handleScrollingThrottled}},[(_vm.shouldShowThreadList)?_c('duo-chat-threads',{attrs:{"threads":_vm.threadList,"preferred-locale":_vm.preferredLocale},on:{"new-chat":_vm.onNewChat,"select-thread":_vm.onSelectThread,"delete-thread":_vm.onDeleteThread,"close":_vm.hideChat}}):_c('transition-group',{staticClass:"duo-chat-history gl-mt-auto gl-p-5",attrs:{"mode":"out-in","tag":"section","name":"message"}},[_vm._l((_vm.conversations),function(conversation,index){return _c('duo-chat-conversation',{key:("conversation-" + index),attrs:{"enable-code-insertion":_vm.enableCodeInsertion,"messages":conversation,"canceled-request-ids":_vm.canceledRequestIds,"show-delimiter":index > 0,"trusted-urls":_vm.trustedUrls},on:{"track-feedback":_vm.onTrackFeedback,"insert-code-snippet":_vm.onInsertCodeSnippet,"copy-code-snippet":_vm.onCopyCodeSnippet,"copy-message":_vm.onCopyMessage,"get-context-item-content":_vm.onGetContextItemContent,"open-file-path":_vm.onOpenFilePath}})}),_vm._v(" "),(!_vm.hasMessages && !_vm.isLoading)?[_c('div',{key:"empty-state-message",staticClass:"duo-chat-message gl-rounded-bl-none gl-p-4 gl-leading-20 gl-text-gray-900 gl-break-anywhere",attrs:{"data-testid":"gl-duo-chat-empty-state"}},[(_vm.emptyStateTitle)?_c('p',{staticClass:"gl-m-0",attrs:{"data-testid":"gl-duo-chat-empty-state-title"}},[_vm._v("\n "+_vm._s(_vm.emptyStateTitle)+"\n ")]):_vm._e(),_vm._v(" "),_c('duo-chat-predefined-prompts',{key:"predefined-prompts",attrs:{"prompts":_vm.predefinedPrompts},on:{"click":_vm.sendPredefinedPrompt}})],1)]:_vm._e(),_vm._v(" "),(_vm.isLoading)?_c('duo-chat-loader',{key:"loader",attrs:{"tool-name":_vm.toolName}}):_vm._e(),_vm._v(" "),_c('div',{key:"anchor",ref:"anchor",staticClass:"scroll-anchor"})],2)],1),_vm._v(" "),(_vm.isChatAvailable && !_vm.shouldShowThreadList)?_c('footer',{staticClass:"duo-chat-drawer-footer gl-relative gl-z-2 gl-shrink-0 gl-border-0 gl-bg-default gl-pb-3",class:{ 'duo-chat-drawer-body-scrim-on-footer': !_vm.scrolledToBottom },attrs:{"data-testid":"chat-footer"}},[_c('gl-form',{attrs:{"data-testid":"chat-prompt-form"},on:{"submit":function($event){$event.stopPropagation();$event.preventDefault();return _vm.sendChatPrompt.apply(null, arguments)}}},[_c('div',{staticClass:"gl-relative gl-max-w-full"},[_vm._t("context-items-menu",null,{"isOpen":_vm.contextItemsMenuIsOpen,"onClose":_vm.closeContextItemsMenuOpen,"setRef":_vm.setContextItemsMenuRef,"focusPrompt":_vm.focusChatInput})],2),_vm._v(" "),_c('gl-form-input-group',{scopedSlots:_vm._u([{key:"append",fn:function(){return [(_vm.displaySubmitButton)?_c('gl-button',{staticClass:"!gl-absolute gl-bottom-2 gl-right-2 !gl-rounded-full",attrs:{"icon":"paper-airplane","category":"primary","variant":"confirm","type":"submit","data-testid":"chat-prompt-submit-button","aria-label":_vm.$options.i18n.CHAT_SUBMIT_LABEL}}):_c('gl-button',{staticClass:"!gl-absolute gl-bottom-2 gl-right-2 !gl-rounded-full",attrs:{"icon":"stop","category":"primary","variant":"default","data-testid":"chat-prompt-cancel-button","aria-label":_vm.$options.i18n.CHAT_CANCEL_LABEL},on:{"click":_vm.cancelPrompt}})]},proxy:true}],null,false,608602988)},[_c('div',{staticClass:"duo-chat-input gl-min-h-8 gl-max-w-full gl-grow gl-align-top",attrs:{"data-value":_vm.prompt}},[(_vm.shouldShowSlashCommands)?_c('gl-card',{ref:"commands",staticClass:"slash-commands !gl-absolute gl-w-full -gl-translate-y-full gl-list-none gl-pl-0 gl-shadow-md",attrs:{"body-class":"!gl-p-2"}},_vm._l((_vm.filteredSlashCommands),function(command,index){return _c('gl-dropdown-item',{key:command.name,class:{ 'active-command': index === _vm.activeCommandIndex },on:{"click":function($event){return _vm.selectSlashCommand(index)}},nativeOn:{"mouseenter":function($event){_vm.activeCommandIndex = index;}}},[_c('span',{staticClass:"gl-flex gl-justify-between"},[_c('span',{staticClass:"gl-block"},[_vm._v(_vm._s(command.name))]),_vm._v(" "),_c('small',{staticClass:"gl-pl-3 gl-text-right gl-italic gl-text-subtle"},[_vm._v(_vm._s(command.description))])])])}),1):_vm._e(),_vm._v(" "),_c('gl-form-textarea',{ref:"prompt",staticClass:"gl-absolute !gl-h-full gl-rounded-br-none gl-rounded-tr-none !gl-bg-transparent !gl-py-4 !gl-shadow-none",class:{ 'gl-truncate': !_vm.prompt },attrs:{"data-testid":"chat-prompt-input","placeholder":_vm.inputPlaceholder,"autofocus":""},on:{"compositionend":_vm.compositionEnd},nativeOn:{"keydown":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }if($event.ctrlKey||$event.shiftKey||$event.altKey||$event.metaKey){ return null; }$event.preventDefault();},"keyup":function($event){return _vm.onInputKeyup.apply(null, arguments)}},model:{value:(_vm.prompt),callback:function ($$v) {_vm.prompt=$$v;},expression:"prompt"}})],1)])],1),_vm._v(" "),_vm._t("footer-controls"),_vm._v(" "),_c('p',{staticClass:"gl-mb-0 gl-mt-3 gl-px-4 gl-text-sm gl-text-secondary"},[_vm._v("\n "+_vm._s(_vm.$options.i18n.CHAT_DISCLAMER)+"\n ")])],2):_vm._e()],1):_vm._e()])};
641
+ },attrs:{"id":"chat-component","role":"complementary","data-testid":"chat-component"}},[(_vm.showHeader)?_c('duo-chat-header',{ref:"header",attrs:{"active-thread-id":_vm.activeThreadId,"title":_vm.isMultithreaded && _vm.currentView === 'list' ? _vm.$options.i18n.CHAT_HISTORY_TITLE : _vm.title,"subtitle":_vm.activeThreadTitleForView,"is-multithreaded":_vm.isMultithreaded,"current-view":_vm.currentView,"should-render-resizable":_vm.shouldRenderResizable,"badge-type":_vm.isMultithreaded ? null : _vm.badgeType},on:{"go-back":_vm.onGoBack,"go-back-to-chat":_vm.onGoBackToChat,"new-chat":_vm.onNewChat,"close":_vm.hideChat},scopedSlots:_vm._u([{key:"subheader",fn:function(){return [_vm._t("subheader")]},proxy:true}],null,true)}):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-flex gl-flex-1 gl-flex-grow gl-flex-col gl-overflow-y-auto gl-overscroll-contain gl-bg-inherit",attrs:{"data-testid":"chat-history"},on:{"scroll":_vm.handleScrollingThrottled}},[(_vm.shouldShowThreadList)?_c('duo-chat-threads',{attrs:{"threads":_vm.threadList,"preferred-locale":_vm.preferredLocale},on:{"new-chat":_vm.onNewChat,"select-thread":_vm.onSelectThread,"delete-thread":_vm.onDeleteThread,"close":_vm.hideChat}}):_c('transition-group',{staticClass:"duo-chat-history gl-mt-auto gl-p-5",attrs:{"mode":"out-in","tag":"section","name":"message"}},[_vm._l((_vm.conversations),function(conversation,index){return _c('duo-chat-conversation',{key:("conversation-" + index),attrs:{"enable-code-insertion":_vm.enableCodeInsertion,"messages":conversation,"canceled-request-ids":_vm.canceledRequestIds,"show-delimiter":index > 0,"trusted-urls":_vm.trustedUrls},on:{"track-feedback":_vm.onTrackFeedback,"insert-code-snippet":_vm.onInsertCodeSnippet,"copy-code-snippet":_vm.onCopyCodeSnippet,"copy-message":_vm.onCopyMessage,"get-context-item-content":_vm.onGetContextItemContent,"open-file-path":_vm.onOpenFilePath}})}),_vm._v(" "),(!_vm.hasMessages && !_vm.isLoading)?[_c('div',{key:"empty-state-message",staticClass:"duo-chat-message gl-rounded-bl-none gl-p-4 gl-leading-20 gl-text-gray-900 gl-break-anywhere",attrs:{"data-testid":"gl-duo-chat-empty-state"}},[(_vm.emptyStateTitle)?_c('p',{staticClass:"gl-m-0",attrs:{"data-testid":"gl-duo-chat-empty-state-title"}},[_vm._v("\n "+_vm._s(_vm.emptyStateTitle)+"\n ")]):_vm._e(),_vm._v(" "),_c('duo-chat-predefined-prompts',{key:"predefined-prompts",attrs:{"prompts":_vm.predefinedPrompts},on:{"click":_vm.sendPredefinedPrompt}})],1)]:_vm._e(),_vm._v(" "),(_vm.isLoading)?_c('duo-chat-loader',{key:"loader",attrs:{"tool-name":_vm.toolName}}):_vm._e(),_vm._v(" "),_c('div',{key:"anchor",ref:"anchor",staticClass:"scroll-anchor"})],2)],1),_vm._v(" "),(_vm.isChatAvailable && !_vm.shouldShowThreadList)?_c('footer',{staticClass:"duo-chat-drawer-footer gl-relative gl-z-2 gl-shrink-0 gl-border-0 gl-bg-default gl-pb-3",class:{ 'duo-chat-drawer-body-scrim-on-footer': !_vm.scrolledToBottom },attrs:{"data-testid":"chat-footer"}},[_c('gl-form',{attrs:{"data-testid":"chat-prompt-form"},on:{"submit":function($event){$event.stopPropagation();$event.preventDefault();return _vm.sendChatPrompt.apply(null, arguments)}}},[_c('div',{staticClass:"gl-relative gl-max-w-full"},[_vm._t("context-items-menu",null,{"isOpen":_vm.contextItemsMenuIsOpen,"onClose":_vm.closeContextItemsMenuOpen,"setRef":_vm.setContextItemsMenuRef,"focusPrompt":_vm.focusChatInput})],2),_vm._v(" "),_c('gl-form-input-group',{scopedSlots:_vm._u([{key:"append",fn:function(){return [(_vm.displaySubmitButton)?_c('gl-button',{staticClass:"!gl-absolute gl-bottom-2 gl-right-2 !gl-rounded-full",attrs:{"icon":"paper-airplane","category":"primary","variant":"confirm","type":"submit","data-testid":"chat-prompt-submit-button","aria-label":_vm.$options.i18n.CHAT_SUBMIT_LABEL}}):_c('gl-button',{staticClass:"!gl-absolute gl-bottom-2 gl-right-2 !gl-rounded-full",attrs:{"icon":"stop","category":"primary","variant":"default","data-testid":"chat-prompt-cancel-button","aria-label":_vm.$options.i18n.CHAT_CANCEL_LABEL},on:{"click":_vm.cancelPrompt}})]},proxy:true}],null,false,608602988)},[_c('div',{staticClass:"duo-chat-input gl-min-h-8 gl-max-w-full gl-grow gl-align-top",attrs:{"data-value":_vm.prompt}},[(_vm.shouldShowSlashCommands)?_c('gl-card',{ref:"commands",staticClass:"slash-commands !gl-absolute gl-w-full -gl-translate-y-full gl-list-none gl-pl-0 gl-shadow-md",attrs:{"body-class":"!gl-p-2"}},_vm._l((_vm.filteredSlashCommands),function(command,index){return _c('gl-dropdown-item',{key:command.name,class:{ 'active-command': index === _vm.activeCommandIndex },on:{"click":function($event){return _vm.selectSlashCommand(index)}},nativeOn:{"mouseenter":function($event){_vm.activeCommandIndex = index;}}},[_c('span',{staticClass:"gl-flex gl-justify-between"},[_c('span',{staticClass:"gl-block"},[_vm._v(_vm._s(command.name))]),_vm._v(" "),_c('small',{staticClass:"gl-pl-3 gl-text-right gl-italic gl-text-subtle"},[_vm._v(_vm._s(command.description))])])])}),1):_vm._e(),_vm._v(" "),_c('gl-form-textarea',{ref:"prompt",staticClass:"gl-absolute !gl-h-full gl-rounded-br-none gl-rounded-tr-none !gl-bg-transparent !gl-py-4 !gl-shadow-none",class:{ 'gl-truncate': !_vm.prompt },attrs:{"data-testid":"chat-prompt-input","placeholder":_vm.inputPlaceholder,"autofocus":""},on:{"keydown":[function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"z",undefined,$event.key,undefined)){ return null; }if(!$event.ctrlKey){ return null; }if($event.shiftKey||$event.altKey||$event.metaKey){ return null; }return _vm.handleUndo.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"z",undefined,$event.key,undefined)){ return null; }if(!$event.metaKey){ return null; }if($event.ctrlKey||$event.shiftKey||$event.altKey){ return null; }return _vm.handleUndo.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"z",undefined,$event.key,undefined)){ return null; }if(!$event.ctrlKey){ return null; }if(!$event.shiftKey){ return null; }return _vm.handleRedo.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"z",undefined,$event.key,undefined)){ return null; }if(!$event.metaKey){ return null; }if(!$event.shiftKey){ return null; }return _vm.handleRedo.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"y",undefined,$event.key,undefined)){ return null; }if(!$event.ctrlKey){ return null; }return _vm.handleRedo.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"y",undefined,$event.key,undefined)){ return null; }if(!$event.metaKey){ return null; }return _vm.handleRedo.apply(null, arguments)}],"compositionend":_vm.compositionEnd},nativeOn:{"keydown":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }if($event.ctrlKey||$event.shiftKey||$event.altKey||$event.metaKey){ return null; }$event.preventDefault();},"keyup":function($event){return _vm.onInputKeyup.apply(null, arguments)}},model:{value:(_vm.prompt),callback:function ($$v) {_vm.prompt=$$v;},expression:"prompt"}})],1)])],1),_vm._v(" "),_vm._t("footer-controls"),_vm._v(" "),_c('p',{staticClass:"gl-mb-0 gl-mt-3 gl-px-4 gl-text-sm gl-text-secondary"},[_vm._v("\n "+_vm._s(_vm.$options.i18n.CHAT_DISCLAMER)+"\n ")])],2):_vm._e()],1):_vm._e()])};
634
642
  var __vue_staticRenderFns__ = [];
635
643
 
636
644
  /* style */
package/dist/index.js CHANGED
@@ -18,7 +18,6 @@ export { default as DuoChatContextItemMenu } from './components/chat/components/
18
18
  export { default as DuoChatContextItemPopover } from './components/chat/components/duo_chat_context/duo_chat_context_item_popover/duo_chat_context_item_popover';
19
19
  export { default as DuoChatContextItemSelections } from './components/chat/components/duo_chat_context/duo_chat_context_item_selections/duo_chat_context_item_selections';
20
20
  export { InsertCodeSnippetElement as DuoChatInsertCodeSnippetElement } from './components/chat/components/duo_chat_message/insert_code_snippet_element';
21
- export { default as DuoTerminalCommand } from './components/ui/duo_terminal_command/duo_terminal_command';
22
21
  export { default as DuoNavigationBar } from './components/ui/duo_navigation_bar/duo_navigation_bar';
23
22
  export { default as DuoRecentCollapsible } from './components/ui/duo_recent_collapsible/duo_recent_collapsible';
24
23
  export { default as DuoRecentContent } from './components/ui/duo_recent_content/duo_recent_content';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/duo-ui",
3
- "version": "10.15.4",
3
+ "version": "10.16.1",
4
4
  "description": "Duo UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -316,6 +316,14 @@ export default {
316
316
  required: false,
317
317
  default: false,
318
318
  },
319
+ /**
320
+ * Optional parameter to pass in the working directory - needed for MessageMap Tool type
321
+ */
322
+ workingDirectory: {
323
+ type: String,
324
+ required: false,
325
+ default: '',
326
+ },
319
327
  },
320
328
  data() {
321
329
  return {
@@ -561,7 +569,6 @@ export default {
561
569
  },
562
570
  onInputKeyup(e) {
563
571
  const { key } = e;
564
-
565
572
  if (this.contextItemsMenuIsOpen) {
566
573
  if (!this.shouldShowContextItemSelectionMenu) {
567
574
  this.contextItemsMenuIsOpen = false;
@@ -697,6 +704,14 @@ export default {
697
704
  */
698
705
  this.$emit('open-file-path', filePath);
699
706
  },
707
+ handleUndo(event) {
708
+ event.preventDefault();
709
+ document.execCommand?.('undo');
710
+ },
711
+ handleRedo(event) {
712
+ event.preventDefault();
713
+ document.execCommand?.('redo');
714
+ },
700
715
  },
701
716
  i18n,
702
717
  };
@@ -782,6 +797,7 @@ export default {
782
797
  :show-delimiter="index > 0"
783
798
  :with-feedback="withFeedback"
784
799
  :is-tool-approval-processing="isToolApprovalProcessing"
800
+ :working-directory="workingDirectory"
785
801
  @track-feedback="onTrackFeedback"
786
802
  @insert-code-snippet="onInsertCodeSnippet"
787
803
  @copy-code-snippet="onCopyCodeSnippet"
@@ -868,6 +884,12 @@ export default {
868
884
  :placeholder="inputPlaceholder"
869
885
  autofocus
870
886
  @keydown.enter.exact.native.prevent
887
+ @keydown.ctrl.z.exact="handleUndo"
888
+ @keydown.meta.z.exact="handleUndo"
889
+ @keydown.ctrl.shift.z.exact="handleRedo"
890
+ @keydown.meta.shift.z.exact="handleRedo"
891
+ @keydown.ctrl.y.exact="handleRedo"
892
+ @keydown.meta.y.exact="handleRedo"
871
893
  @keyup.native="onInputKeyup"
872
894
  @compositionend="compositionEnd"
873
895
  />
@@ -72,6 +72,14 @@ export default {
72
72
  required: false,
73
73
  default: false,
74
74
  },
75
+ /**
76
+ * Optional parameter to pass in the working directory - needed for MessageMap Tool type
77
+ */
78
+ workingDirectory: {
79
+ type: String,
80
+ required: false,
81
+ default: '',
82
+ },
75
83
  },
76
84
  computed: {
77
85
  isAwaitingToolApproval() {
@@ -134,6 +142,7 @@ export default {
134
142
  :trusted-urls="trustedUrls"
135
143
  :is-cancelled="canceledRequestIds.includes(msg.requestId)"
136
144
  :with-feedback="withFeedback"
145
+ :working-directory="workingDirectory"
137
146
  @track-feedback="onTrackFeedback"
138
147
  @insert-code-snippet="onInsertCodeSnippet"
139
148
  @copy-code-snippet="onCopyCodeSnippet"
@@ -102,6 +102,14 @@ export default {
102
102
  required: false,
103
103
  default: true,
104
104
  },
105
+ /**
106
+ * Optional parameter to pass in the working directory
107
+ */
108
+ workingDirectory: {
109
+ type: String,
110
+ required: false,
111
+ default: '',
112
+ },
105
113
  },
106
114
  data() {
107
115
  return {
@@ -421,6 +429,7 @@ export default {
421
429
  v-else
422
430
  :message="message"
423
431
  :with-feedback="withFeedback"
432
+ :working-directory="workingDirectory"
424
433
  data-testid="workflow-message"
425
434
  @open-file-path="onOpenFilePath"
426
435
  @feedback="logEvent"
@@ -52,6 +52,14 @@ export default {
52
52
  required: false,
53
53
  default: () => ({}),
54
54
  },
55
+ /**
56
+ * Optional parameter to pass in the working directory
57
+ */
58
+ workingDirectory: {
59
+ type: String,
60
+ required: false,
61
+ default: '',
62
+ },
55
63
  },
56
64
  computed: {
57
65
  messageMap() {
@@ -74,6 +82,7 @@ export default {
74
82
  <component
75
83
  :is="messageComponent"
76
84
  :message="message"
85
+ :working-directory="workingDirectory"
77
86
  v-bind="$attrs"
78
87
  :style="customStyles"
79
88
  v-on="$listeners"
@@ -1,6 +1,7 @@
1
1
  <script>
2
2
  import { GlIcon, GlLink } from '@gitlab/ui';
3
3
  import { translate } from '../../../../../utils/i18n';
4
+ import MessageToolCommandOutput from '../../duo_chat_message_tool_command_output/message_tool_command_output.vue';
4
5
  import BaseMessage from './message_base.vue';
5
6
 
6
7
  export const i18n = {
@@ -11,12 +12,14 @@ export const i18n = {
11
12
  ACTION_LABEL: translate('DuoChatMessage.actionLabel', 'Action'),
12
13
  CONTENT_LABEL: translate('DuoChatMessage.contentLabel', 'Content'),
13
14
  FILE_PATH_LABEL: translate('DuoChatMessage.filePathLabel', 'File path'),
15
+ RAN_TERMINAL_COMMAND: translate('DuoChatMessage.ranTerminalCommand', 'Ran terminal command'),
14
16
  };
15
17
 
16
18
  export default {
17
19
  name: 'DuoToolMessage',
18
20
  components: {
19
21
  BaseMessage,
22
+ MessageToolCommandOutput,
20
23
  GlIcon,
21
24
  GlLink,
22
25
  },
@@ -38,10 +41,15 @@ export default {
38
41
  return value && value.tool_info;
39
42
  },
40
43
  },
44
+ workingDirectory: {
45
+ required: false,
46
+ type: String,
47
+ default: '',
48
+ },
41
49
  },
42
50
  computed: {
43
51
  iconName() {
44
- switch (this.message.tool_info?.name) {
52
+ switch (this.toolName) {
45
53
  case 'read_file':
46
54
  return 'eye';
47
55
  case 'write_file':
@@ -79,6 +87,18 @@ export default {
79
87
  commitMessage() {
80
88
  return this.toolArgs.commit_message;
81
89
  },
90
+ hasCommandOutput() {
91
+ return this.message.message_sub_type === 'command_output';
92
+ },
93
+ toolName() {
94
+ return this.message.tool_info?.name;
95
+ },
96
+ toolResponse() {
97
+ return this.message.tool_info?.toolResponse;
98
+ },
99
+ toolWorkingDirectory() {
100
+ return this.workingDirectory;
101
+ },
82
102
  },
83
103
  methods: {
84
104
  onOpenFilePath(filePath) {
@@ -93,7 +113,14 @@ export default {
93
113
  <template>
94
114
  <base-message :message="message">
95
115
  <template #message="{ content }">
96
- <div class="gl-flex gl-items-baseline !gl-text-subtle">
116
+ <message-tool-command-output
117
+ v-if="hasCommandOutput"
118
+ :command-header="$options.i18n.RAN_TERMINAL_COMMAND"
119
+ :command-action="toolName"
120
+ :command-output="toolResponse"
121
+ :working-directory="toolWorkingDirectory"
122
+ />
123
+ <div v-else class="gl-flex gl-items-baseline !gl-text-subtle">
97
124
  <div class="gl-mr-3 gl-flex-shrink-0">
98
125
  <gl-icon :name="iconName" />
99
126
  </div>
@@ -15,7 +15,7 @@ export default {
15
15
  required: false,
16
16
  type: String,
17
17
  default:
18
- "Review the changes. To improve the implementation, create another workflow and describe the specific changes you'd like to see.",
18
+ "Review the changes. To improve the implementation, create another session and describe the specific changes you'd like to see.",
19
19
  },
20
20
  action: {
21
21
  required: false,
@@ -30,7 +30,7 @@ export default {
30
30
  : this.$options.newRoute;
31
31
  },
32
32
  buttonText() {
33
- return this.action?.text || 'New workflow';
33
+ return this.action?.text || 'New session';
34
34
  },
35
35
  },
36
36
  newRoute: {
@@ -19,7 +19,7 @@ And you can also pass in the following slot:
19
19
  ### Basic Usage
20
20
 
21
21
  ```vue
22
- <gl-duo-terminal-command
22
+ <message-tool-command-output
23
23
  command-header="Ran terminal command"
24
24
  command-action="npm install"
25
25
  command-output="added 1256 packages, and audited 1257 packages in 30s"
@@ -30,7 +30,7 @@ And you can also pass in the following slot:
30
30
  ### With Custom Actions
31
31
 
32
32
  ```vue
33
- <gl-duo-terminal-command
33
+ <message-tool-command-output
34
34
  command-header="Ran terminal command"
35
35
  command-action="npm install"
36
36
  command-output="added 1256 packages, and audited 1257 packages in 30s"
@@ -39,5 +39,5 @@ And you can also pass in the following slot:
39
39
  <template #actions>
40
40
  <gl-button category="tertiary" @click="runCommand">Open terminal</gl-button>
41
41
  </template>
42
- </gl-duo-terminal-command>
42
+ </message-tool-command-output>
43
43
  ```
@@ -2,7 +2,7 @@
2
2
  import { GlCollapse, GlButton, GlIcon } from '@gitlab/ui';
3
3
 
4
4
  export default {
5
- name: 'GlDuoTerminalCommand',
5
+ name: 'MessageToolCommandOutput',
6
6
  components: {
7
7
  GlCollapse,
8
8
  GlButton,
@@ -61,7 +61,7 @@ export default {
61
61
  </script>
62
62
 
63
63
  <template>
64
- <div class="gl-border-solid gl-border-neutral-600">
64
+ <div class="terminal-command-output gl-border-solid gl-border-neutral-600">
65
65
  <div class="gl-flex gl-w-full gl-items-center gl-justify-between gl-px-3 gl-py-2">
66
66
  <span class="gl-flex gl-items-center" data-testid="terminal-command-header">
67
67
  <gl-icon name="terminal" class="gl-mr-3" />
@@ -77,14 +77,19 @@ export default {
77
77
  />
78
78
  </div>
79
79
  <div class="gl-leading-22 gl-border-t gl-flex gl-flex-col gl-p-3">
80
- <code class="gl-text-subtle" data-testid="terminal-working-directory"
80
+ <code
81
+ v-if="workingDirectory"
82
+ class="!gl-bg-transparent gl-text-subtle"
83
+ data-testid="terminal-working-directory"
81
84
  >{{ workingDirectory }} ></code
82
85
  >
83
- <code class="gl-text-default" data-testid="terminal-command-action">{{ commandAction }}</code>
86
+ <code class="!gl-bg-transparent gl-text-default" data-testid="terminal-command-action">{{
87
+ commandAction
88
+ }}</code>
84
89
  </div>
85
90
  <gl-collapse v-if="isCommandOutputAvailable" :visible="isVisible">
86
91
  <div class="gl-bg-black gl-p-3">
87
- <code>{{ commandOutput }}</code>
92
+ <code class="!gl-bg-transparent">{{ commandOutput }}</code>
88
93
  </div>
89
94
  </gl-collapse>
90
95
  <div v-if="$scopedSlots.actions" class="gl-border-t gl-p-3">
@@ -688,6 +688,14 @@ export default {
688
688
  */
689
689
  this.$emit('open-file-path', filePath);
690
690
  },
691
+ handleUndo(event) {
692
+ event.preventDefault();
693
+ document.execCommand('undo');
694
+ },
695
+ handleRedo(event) {
696
+ event.preventDefault();
697
+ document.execCommand('redo');
698
+ },
691
699
  },
692
700
  i18n,
693
701
  };
@@ -809,8 +817,8 @@ export default {
809
817
  <gl-form data-testid="chat-prompt-form" @submit.stop.prevent="sendChatPrompt">
810
818
  <div class="gl-relative gl-max-w-full">
811
819
  <!--
812
- @slot For integrating `<gl-context-items-menu>` component if pinned-context should be available. The following scopedSlot properties are provided: `isOpen`, `onClose`, `setRef`, `focusPrompt`, which should be passed to the `<gl-context-items-menu>` component when rendering, e.g. `<template #context-items-menu="{ isOpen, onClose, setRef, focusPrompt }">` `<duo-chat-context-item-menu :ref="setRef" :open="isOpen" @close="onClose" @focus-prompt="focusPrompt" ...`
813
- -->
820
+ @slot For integrating `<gl-context-items-menu>` component if pinned-context should be available. The following scopedSlot properties are provided: `isOpen`, `onClose`, `setRef`, `focusPrompt`, which should be passed to the `<gl-context-items-menu>` component when rendering, e.g. `<template #context-items-menu="{ isOpen, onClose, setRef, focusPrompt }">` `<duo-chat-context-item-menu :ref="setRef" :open="isOpen" @close="onClose" @focus-prompt="focusPrompt" ...`
821
+ -->
814
822
  <slot
815
823
  name="context-items-menu"
816
824
  :is-open="contextItemsMenuIsOpen"
@@ -856,6 +864,12 @@ export default {
856
864
  :placeholder="inputPlaceholder"
857
865
  autofocus
858
866
  @keydown.enter.exact.native.prevent
867
+ @keydown.ctrl.z.exact="handleUndo"
868
+ @keydown.meta.z.exact="handleUndo"
869
+ @keydown.ctrl.shift.z="handleRedo"
870
+ @keydown.meta.shift.z="handleRedo"
871
+ @keydown.ctrl.y="handleRedo"
872
+ @keydown.meta.y="handleRedo"
859
873
  @keyup.native="onInputKeyup"
860
874
  @compositionend="compositionEnd"
861
875
  />
package/src/index.js CHANGED
@@ -39,7 +39,6 @@ export { default as DuoChatContextItemSelections } from './components/chat/compo
39
39
  export { InsertCodeSnippetElement as DuoChatInsertCodeSnippetElement } from './components/chat/components/duo_chat_message/insert_code_snippet_element';
40
40
 
41
41
  // Duo UI components
42
- export { default as DuoTerminalCommand } from './components/ui/duo_terminal_command/duo_terminal_command.vue';
43
42
  export { default as DuoNavigationBar } from './components/ui/duo_navigation_bar/duo_navigation_bar.vue';
44
43
  export { default as DuoRecentCollapsible } from './components/ui/duo_recent_collapsible/duo_recent_collapsible.vue';
45
44
  export { default as DuoRecentContent } from './components/ui/duo_recent_content/duo_recent_content.vue';
package/translations.js CHANGED
@@ -90,6 +90,7 @@ export default {
90
90
  'DuoChatMessage.modalMessageError': 'Error sending the message',
91
91
  'DuoChatMessage.modalTitle': 'Give feedback on GitLab Duo Chat',
92
92
  'DuoChatMessage.projectLabel': 'Project',
93
+ 'DuoChatMessage.ranTerminalCommand': 'Ran terminal command',
93
94
  'DuoChatMessage.startBranchLabel': 'Start branch',
94
95
  'DuoChatMessageSources.messageSources': null,
95
96
  'DuoRecentCollapsable.viewAllText': 'View All',