@gitlab/duo-ui 11.2.2 → 11.3.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 CHANGED
@@ -1,3 +1,15 @@
1
+ # [11.3.0](https://gitlab.com/gitlab-org/duo-ui/compare/v11.2.2...v11.3.0) (2025-10-03)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **MCP:** Display correct cancelPrompt state after approvals ([d82ae48](https://gitlab.com/gitlab-org/duo-ui/commit/d82ae48267f1689f16680670d18faf5d97dab6f7))
7
+
8
+
9
+ ### Features
10
+
11
+ * **header:** Adden new boolean to hide only part of header ([ec361ad](https://gitlab.com/gitlab-org/duo-ui/commit/ec361adccc4886c292c6a8061718d5bf1ebdbe50))
12
+
1
13
  ## [11.2.2](https://gitlab.com/gitlab-org/duo-ui/compare/v11.2.1...v11.2.2) (2025-10-03)
2
14
 
3
15
 
@@ -377,6 +377,13 @@ var script = {
377
377
  },
378
378
  activeThreadTitleForView() {
379
379
  return this.currentView === VIEW_TYPES.CHAT && this.activeThreadTitle || '';
380
+ },
381
+ isAwaitingToolApproval() {
382
+ if (!this.messages || this.messages.length === 0) {
383
+ return false;
384
+ }
385
+ const lastMessage = this.messages[this.messages.length - 1];
386
+ return Boolean(lastMessage && lastMessage.message_type === 'request' && lastMessage.tool_info !== undefined);
380
387
  }
381
388
  },
382
389
  watch: {
@@ -384,16 +391,28 @@ var script = {
384
391
  this.currentView = newView;
385
392
  },
386
393
  isLoading(loading) {
387
- if (!loading && !this.isStreaming) {
394
+ if (!loading && !this.isStreaming && !this.isToolApprovalProcessing && !this.isAwaitingToolApproval) {
388
395
  this.canSubmit = true; // Re-enable submit button when loading stops
389
396
  }
390
397
  this.isHidden = false;
391
398
  },
392
399
  isStreaming(streaming) {
393
- if (!streaming && !this.isLoading) {
400
+ if (!streaming && !this.isLoading && !this.isToolApprovalProcessing && !this.isAwaitingToolApproval) {
394
401
  this.canSubmit = true; // Re-enable submit button when streaming stops
395
402
  }
396
403
  },
404
+ isToolApprovalProcessing(processing) {
405
+ if (!processing && !this.isLoading && !this.isStreaming && !this.isAwaitingToolApproval) {
406
+ this.canSubmit = true; // Re-enable submit button when tool approval processing stops
407
+ }
408
+ },
409
+ isAwaitingToolApproval(awaiting) {
410
+ if (awaiting) {
411
+ this.canSubmit = false; // Show cancel button when tool approval is needed
412
+ } else if (!this.isLoading && !this.isStreaming && !this.isToolApprovalProcessing) {
413
+ this.canSubmit = true; // Re-enable submit button when tool approval is no longer needed
414
+ }
415
+ },
397
416
  lastMessage(newMessage) {
398
417
  if (this.scrolledToBottom || (newMessage === null || newMessage === void 0 ? void 0 : newMessage.role.toLowerCase()) === MESSAGE_MODEL_ROLES.user) {
399
418
  // only scroll to bottom on new message if the user hasn't explicitly scrolled up to view an earlier message
@@ -412,6 +431,13 @@ var script = {
412
431
  },
413
432
  created() {
414
433
  this.handleScrollingThrottled = throttle(this.handleScrolling, 200); // Assume a 200ms throttle for example
434
+
435
+ // Set initial canSubmit state based on current conditions
436
+ // Note: We don't check isStreaming here because the component should allow
437
+ // the first submission even if it starts with streaming messages
438
+ if (this.isAwaitingToolApproval || this.isLoading || this.isToolApprovalProcessing) {
439
+ this.canSubmit = false;
440
+ }
415
441
  },
416
442
  mounted() {
417
443
  this.scrollToBottom();
@@ -210,6 +210,14 @@ var script = {
210
210
  required: false,
211
211
  default: true
212
212
  },
213
+ /**
214
+ * Whether the studio style header should be displayed.
215
+ */
216
+ showStudioHeader: {
217
+ type: Boolean,
218
+ required: false,
219
+ default: true
220
+ },
213
221
  /**
214
222
  * Override the default empty state title text.
215
223
  */
@@ -681,7 +689,7 @@ var script = {
681
689
  const __vue_script__ = script;
682
690
 
683
691
  /* template */
684
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"markdown-code-block duo-chat gl-bottom-0 gl-flex gl-max-h-full gl-flex-grow gl-flex-col",attrs:{"id":"chat-component","role":"complementary","data-testid":"chat-component"}},[(_vm.showHeader)?_c('web-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,"session-id":_vm.sessionId,"agents":_vm.agents},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('div',{staticClass:"duo-chat-input web-only gl-relative gl-min-h-8 gl-max-w-full gl-grow gl-flex-col gl-rounded-bl-[12px] gl-rounded-br-[18px] gl-rounded-tl-[12px] gl-rounded-tr-[12px] gl-align-top"},[_c('div',{staticClass:"gl-flex gl-justify-between gl-border-0 gl-border-b-1 gl-border-solid gl-border-strong gl-px-4 gl-py-4"},[_c('div',[_vm._v(_vm._s(_vm.$options.i18n.CHAT_MODEL_PLACEHOLDER))]),_vm._v(" "),_c('div',[_vm._t("agentic-switch")],2)]),_vm._v(" "),_c('div',{staticClass:"gl-h-[80px] gl-grow",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",attrs:{"disabled":!_vm.canSubmit,"data-testid":"chat-prompt-input","placeholder":_vm.inputPlaceholder,"character-count-limit":_vm.maxPromptLength,"textarea-classes":[
692
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"markdown-code-block duo-chat gl-bottom-0 gl-flex gl-max-h-full gl-flex-grow gl-flex-col",attrs:{"id":"chat-component","role":"complementary","data-testid":"chat-component"}},[(_vm.showHeader)?_c('web-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,"session-id":_vm.sessionId,"agents":_vm.agents,"show-studio-header":_vm.showStudioHeader},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('div',{staticClass:"duo-chat-input web-only gl-relative gl-min-h-8 gl-max-w-full gl-grow gl-flex-col gl-rounded-bl-[12px] gl-rounded-br-[18px] gl-rounded-tl-[12px] gl-rounded-tr-[12px] gl-align-top"},[_c('div',{staticClass:"gl-flex gl-justify-between gl-border-0 gl-border-b-1 gl-border-solid gl-border-strong gl-px-4 gl-py-4"},[_c('div',[_vm._v(_vm._s(_vm.$options.i18n.CHAT_MODEL_PLACEHOLDER))]),_vm._v(" "),_c('div',[_vm._t("agentic-switch")],2)]),_vm._v(" "),_c('div',{staticClass:"gl-h-[80px] gl-grow",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",attrs:{"disabled":!_vm.canSubmit,"data-testid":"chat-prompt-input","placeholder":_vm.inputPlaceholder,"character-count-limit":_vm.maxPromptLength,"textarea-classes":[
685
693
  '!gl-h-full',
686
694
  '!gl-bg-transparent',
687
695
  '!gl-py-4',
@@ -82,6 +82,11 @@ var script = {
82
82
  type: Array,
83
83
  required: false,
84
84
  default: () => []
85
+ },
86
+ showStudioHeader: {
87
+ type: Boolean,
88
+ required: false,
89
+ default: false
85
90
  }
86
91
  },
87
92
  computed: {
@@ -121,7 +126,7 @@ var script = {
121
126
  const __vue_script__ = script;
122
127
 
123
128
  /* template */
124
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('header',{staticClass:"gl-border-b gl-shrink-0 gl-bg-default gl-p-0",attrs:{"data-testid":"chat-header"}},[_c('div',{staticClass:"gl-border-b gl-flex gl-w-full gl-items-center gl-px-5 gl-py-3"},[(_vm.subtitle)?_c('h4',{staticClass:"gl-mb-0 gl-max-w-17/20 gl-flex-1 gl-shrink-0 gl-overflow-hidden gl-truncate gl-text-ellipsis gl-whitespace-nowrap gl-pr-3 gl-text-sm gl-font-normal gl-text-subtle",attrs:{"data-testid":"chat-subtitle"}},[_vm._v("\n "+_vm._s(_vm.subtitle)+"\n ")]):_vm._e(),_vm._v(" "),_c('gl-button',{staticClass:"gl-ml-auto",attrs:{"category":"tertiary","variant":"default","icon":"close","size":"small","data-testid":"chat-close-button","aria-label":_vm.$options.i18n.CHAT_CLOSE_LABEL},on:{"click":function($event){return _vm.$emit('close')}}})],1),_vm._v(" "),_c('div',{staticClass:"drawer-title gl-flex gl-items-center gl-justify-start gl-p-5"},[_c('div',{staticClass:"gl-flex gl-flex-1 gl-overflow-hidden"},[_c('gl-avatar',{staticClass:"gl-mr-3",attrs:{"size":32,"entity-name":_vm.title,"shape":"circle"}}),_vm._v(" "),_c('div',{staticClass:"gl-flex gl-items-center"},[_c('h3',{staticClass:"gl-my-0 gl-text-[0.875rem]"},[_vm._v(_vm._s(_vm.title))])])],1),_vm._v(" "),_c('div',{staticClass:"gl-flex gl-gap-3"},[(
129
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('header',{staticClass:"gl-border-b gl-shrink-0 gl-bg-default gl-p-0",attrs:{"data-testid":"chat-header"}},[(!_vm.showStudioHeader)?_c('div',{staticClass:"gl-border-b gl-flex gl-w-full gl-items-center gl-px-5 gl-py-3",attrs:{"data-testid":"chat-top-header"}},[(_vm.subtitle)?_c('h4',{staticClass:"gl-mb-0 gl-max-w-17/20 gl-flex-1 gl-shrink-0 gl-overflow-hidden gl-truncate gl-text-ellipsis gl-whitespace-nowrap gl-pr-3 gl-text-sm gl-font-normal gl-text-subtle",attrs:{"data-testid":"chat-subtitle"}},[_vm._v("\n "+_vm._s(_vm.subtitle)+"\n ")]):_vm._e(),_vm._v(" "),_c('gl-button',{staticClass:"gl-ml-auto",attrs:{"category":"tertiary","variant":"default","icon":"close","size":"small","data-testid":"chat-close-button","aria-label":_vm.$options.i18n.CHAT_CLOSE_LABEL},on:{"click":function($event){return _vm.$emit('close')}}})],1):_vm._e(),_vm._v(" "),_c('div',{staticClass:"drawer-title gl-flex gl-items-center gl-justify-start gl-p-5"},[_c('div',{staticClass:"gl-flex gl-flex-1 gl-overflow-hidden"},[_c('gl-avatar',{staticClass:"gl-mr-3",attrs:{"size":32,"entity-name":_vm.title,"shape":"circle"}}),_vm._v(" "),_c('div',{staticClass:"gl-flex gl-items-center"},[_c('h3',{staticClass:"gl-my-0 gl-text-[0.875rem]"},[_vm._v(_vm._s(_vm.title))])])],1),_vm._v(" "),_c('div',{staticClass:"gl-flex gl-gap-3"},[(
125
130
  _vm.isMultithreaded && (_vm.activeThreadId || _vm.currentView === _vm.VIEW_TYPES.LIST || _vm.hasManyAgents)
126
131
  )?[(_vm.hasManyAgents)?_c('gl-disclosure-dropdown',{attrs:{"title":_vm.$options.i18n.CHAT_NEW_TOOLTIP,"toggle-text":_vm.$options.i18n.CHAT_NEW_TOOLTIP,"items":_vm.agents,"data-testid":"chat-new-button","variant":"confirm","category":"tertiary","size":"small","icon":"duo-chat-new","text-sr-only":"","aria-label":_vm.$options.i18n.CHAT_NEW_LABEL,"no-caret":""},on:{"action":_vm.startNewChat},scopedSlots:_vm._u([{key:"list-item",fn:function(ref){
127
132
  var item = ref.item;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/duo-ui",
3
- "version": "11.2.2",
3
+ "version": "11.3.0",
4
4
  "description": "Duo UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -453,22 +453,53 @@ export default {
453
453
  activeThreadTitleForView() {
454
454
  return (this.currentView === VIEW_TYPES.CHAT && this.activeThreadTitle) || '';
455
455
  },
456
+ isAwaitingToolApproval() {
457
+ if (!this.messages || this.messages.length === 0) {
458
+ return false;
459
+ }
460
+ const lastMessage = this.messages[this.messages.length - 1];
461
+ return Boolean(
462
+ lastMessage && lastMessage.message_type === 'request' && lastMessage.tool_info !== undefined
463
+ );
464
+ },
456
465
  },
457
466
  watch: {
458
467
  multiThreadedView(newView) {
459
468
  this.currentView = newView;
460
469
  },
461
470
  isLoading(loading) {
462
- if (!loading && !this.isStreaming) {
471
+ if (
472
+ !loading &&
473
+ !this.isStreaming &&
474
+ !this.isToolApprovalProcessing &&
475
+ !this.isAwaitingToolApproval
476
+ ) {
463
477
  this.canSubmit = true; // Re-enable submit button when loading stops
464
478
  }
465
479
  this.isHidden = false;
466
480
  },
467
481
  isStreaming(streaming) {
468
- if (!streaming && !this.isLoading) {
482
+ if (
483
+ !streaming &&
484
+ !this.isLoading &&
485
+ !this.isToolApprovalProcessing &&
486
+ !this.isAwaitingToolApproval
487
+ ) {
469
488
  this.canSubmit = true; // Re-enable submit button when streaming stops
470
489
  }
471
490
  },
491
+ isToolApprovalProcessing(processing) {
492
+ if (!processing && !this.isLoading && !this.isStreaming && !this.isAwaitingToolApproval) {
493
+ this.canSubmit = true; // Re-enable submit button when tool approval processing stops
494
+ }
495
+ },
496
+ isAwaitingToolApproval(awaiting) {
497
+ if (awaiting) {
498
+ this.canSubmit = false; // Show cancel button when tool approval is needed
499
+ } else if (!this.isLoading && !this.isStreaming && !this.isToolApprovalProcessing) {
500
+ this.canSubmit = true; // Re-enable submit button when tool approval is no longer needed
501
+ }
502
+ },
472
503
  lastMessage(newMessage) {
473
504
  if (this.scrolledToBottom || newMessage?.role.toLowerCase() === MESSAGE_MODEL_ROLES.user) {
474
505
  // only scroll to bottom on new message if the user hasn't explicitly scrolled up to view an earlier message
@@ -487,6 +518,13 @@ export default {
487
518
  },
488
519
  created() {
489
520
  this.handleScrollingThrottled = throttle(this.handleScrolling, 200); // Assume a 200ms throttle for example
521
+
522
+ // Set initial canSubmit state based on current conditions
523
+ // Note: We don't check isStreaming here because the component should allow
524
+ // the first submission even if it starts with streaming messages
525
+ if (this.isAwaitingToolApproval || this.isLoading || this.isToolApprovalProcessing) {
526
+ this.canSubmit = false;
527
+ }
490
528
  },
491
529
  mounted() {
492
530
  this.scrollToBottom();
@@ -273,6 +273,14 @@ export default {
273
273
  required: false,
274
274
  default: true,
275
275
  },
276
+ /**
277
+ * Whether the studio style header should be displayed.
278
+ */
279
+ showStudioHeader: {
280
+ type: Boolean,
281
+ required: false,
282
+ default: true,
283
+ },
276
284
  /**
277
285
  * Override the default empty state title text.
278
286
  */
@@ -784,6 +792,7 @@ export default {
784
792
  :badge-type="isMultithreaded ? null : badgeType"
785
793
  :session-id="sessionId"
786
794
  :agents="agents"
795
+ :show-studio-header="showStudioHeader"
787
796
  @go-back="onGoBack"
788
797
  @new-chat="onNewChat"
789
798
  @close="hideChat"
@@ -103,6 +103,11 @@ export default {
103
103
  required: false,
104
104
  default: () => [],
105
105
  },
106
+ showStudioHeader: {
107
+ type: Boolean,
108
+ required: false,
109
+ default: false,
110
+ },
106
111
  },
107
112
  computed: {
108
113
  VIEW_TYPES() {
@@ -140,7 +145,11 @@ export default {
140
145
 
141
146
  <template>
142
147
  <header data-testid="chat-header" class="gl-border-b gl-shrink-0 gl-bg-default gl-p-0">
143
- <div class="gl-border-b gl-flex gl-w-full gl-items-center gl-px-5 gl-py-3">
148
+ <div
149
+ v-if="!showStudioHeader"
150
+ class="gl-border-b gl-flex gl-w-full gl-items-center gl-px-5 gl-py-3"
151
+ data-testid="chat-top-header"
152
+ >
144
153
  <h4
145
154
  v-if="subtitle"
146
155
  class="gl-mb-0 gl-max-w-17/20 gl-flex-1 gl-shrink-0 gl-overflow-hidden gl-truncate gl-text-ellipsis gl-whitespace-nowrap gl-pr-3 gl-text-sm gl-font-normal gl-text-subtle"