mito-ai 0.1.27__py3-none-any.whl → 0.1.29__py3-none-any.whl

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.

Potentially problematic release.


This version of mito-ai might be problematic. Click here for more details.

Files changed (29) hide show
  1. mito_ai/_version.py +1 -1
  2. mito_ai/openai_client.py +22 -6
  3. mito_ai/tests/providers/test_azure.py +635 -0
  4. mito_ai/utils/anthropic_utils.py +3 -0
  5. mito_ai/utils/open_ai_utils.py +0 -4
  6. {mito_ai-0.1.27.data → mito_ai-0.1.29.data}/data/share/jupyter/labextensions/mito_ai/build_log.json +1 -1
  7. {mito_ai-0.1.27.data → mito_ai-0.1.29.data}/data/share/jupyter/labextensions/mito_ai/package.json +2 -2
  8. {mito_ai-0.1.27.data → mito_ai-0.1.29.data}/data/share/jupyter/labextensions/mito_ai/schemas/mito_ai/package.json.orig +1 -1
  9. mito_ai-0.1.27.data/data/share/jupyter/labextensions/mito_ai/static/lib_index_js.43d516a828f1937a42bb.js → mito_ai-0.1.29.data/data/share/jupyter/labextensions/mito_ai/static/lib_index_js.8fc39671fbc9ba62e74b.js +337 -144
  10. mito_ai-0.1.29.data/data/share/jupyter/labextensions/mito_ai/static/lib_index_js.8fc39671fbc9ba62e74b.js.map +1 -0
  11. mito_ai-0.1.27.data/data/share/jupyter/labextensions/mito_ai/static/remoteEntry.806d64f6e8a03c8a76c7.js → mito_ai-0.1.29.data/data/share/jupyter/labextensions/mito_ai/static/remoteEntry.6bf957d24d60237bb287.js +3 -3
  12. mito_ai-0.1.27.data/data/share/jupyter/labextensions/mito_ai/static/remoteEntry.806d64f6e8a03c8a76c7.js.map → mito_ai-0.1.29.data/data/share/jupyter/labextensions/mito_ai/static/remoteEntry.6bf957d24d60237bb287.js.map +1 -1
  13. {mito_ai-0.1.27.dist-info → mito_ai-0.1.29.dist-info}/METADATA +1 -1
  14. {mito_ai-0.1.27.dist-info → mito_ai-0.1.29.dist-info}/RECORD +28 -27
  15. mito_ai-0.1.27.data/data/share/jupyter/labextensions/mito_ai/static/lib_index_js.43d516a828f1937a42bb.js.map +0 -1
  16. {mito_ai-0.1.27.data → mito_ai-0.1.29.data}/data/etc/jupyter/jupyter_server_config.d/mito_ai.json +0 -0
  17. {mito_ai-0.1.27.data → mito_ai-0.1.29.data}/data/share/jupyter/labextensions/mito_ai/schemas/mito_ai/toolbar-buttons.json +0 -0
  18. {mito_ai-0.1.27.data → mito_ai-0.1.29.data}/data/share/jupyter/labextensions/mito_ai/static/style.js +0 -0
  19. {mito_ai-0.1.27.data → mito_ai-0.1.29.data}/data/share/jupyter/labextensions/mito_ai/static/style_index_js.06083e515de4862df010.js +0 -0
  20. {mito_ai-0.1.27.data → mito_ai-0.1.29.data}/data/share/jupyter/labextensions/mito_ai/static/style_index_js.06083e515de4862df010.js.map +0 -0
  21. {mito_ai-0.1.27.data → mito_ai-0.1.29.data}/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_html2canvas_dist_html2canvas_js.ea47e8c8c906197f8d19.js +0 -0
  22. {mito_ai-0.1.27.data → mito_ai-0.1.29.data}/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_html2canvas_dist_html2canvas_js.ea47e8c8c906197f8d19.js.map +0 -0
  23. {mito_ai-0.1.27.data → mito_ai-0.1.29.data}/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_semver_index_js.9795f79265ddb416864b.js +0 -0
  24. {mito_ai-0.1.27.data → mito_ai-0.1.29.data}/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_semver_index_js.9795f79265ddb416864b.js.map +0 -0
  25. {mito_ai-0.1.27.data → mito_ai-0.1.29.data}/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_vscode-diff_dist_index_js.ea55f1f9346638aafbcf.js +0 -0
  26. {mito_ai-0.1.27.data → mito_ai-0.1.29.data}/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_vscode-diff_dist_index_js.ea55f1f9346638aafbcf.js.map +0 -0
  27. {mito_ai-0.1.27.dist-info → mito_ai-0.1.29.dist-info}/WHEEL +0 -0
  28. {mito_ai-0.1.27.dist-info → mito_ai-0.1.29.dist-info}/entry_points.txt +0 -0
  29. {mito_ai-0.1.27.dist-info → mito_ai-0.1.29.dist-info}/licenses/LICENSE +0 -0
@@ -510,6 +510,67 @@ const AlertBlock = ({ content, mitoAIConnectionErrorType }) => {
510
510
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (AlertBlock);
511
511
 
512
512
 
513
+ /***/ }),
514
+
515
+ /***/ "./lib/Extensions/AiChat/ChatMessage/AssistantCodeBlock.js":
516
+ /*!*****************************************************************!*\
517
+ !*** ./lib/Extensions/AiChat/ChatMessage/AssistantCodeBlock.js ***!
518
+ \*****************************************************************/
519
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
520
+
521
+ __webpack_require__.r(__webpack_exports__);
522
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
523
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
524
+ /* harmony export */ });
525
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "webpack/sharing/consume/default/react");
526
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
527
+ /* harmony import */ var _PythonCode__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./PythonCode */ "./lib/Extensions/AiChat/ChatMessage/PythonCode.js");
528
+ /* harmony import */ var _utils_classNames__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../utils/classNames */ "./lib/utils/classNames.js");
529
+ /* harmony import */ var _style_CodeBlock_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../style/CodeBlock.css */ "./style/CodeBlock.css");
530
+ /* harmony import */ var _icons_ExpandIcon__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../icons/ExpandIcon */ "./lib/icons/ExpandIcon.js");
531
+ /* harmony import */ var _icons_CodeIcon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../icons/CodeIcon */ "./lib/icons/CodeIcon.js");
532
+ /* harmony import */ var _CodeBlockToolbar__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./CodeBlockToolbar */ "./lib/Extensions/AiChat/ChatMessage/CodeBlockToolbar.js");
533
+ /*
534
+ * Copyright (c) Saga Inc.
535
+ * Distributed under the terms of the GNU Affero General Public License v3.0 License.
536
+ */
537
+
538
+
539
+
540
+
541
+
542
+
543
+
544
+ const AssistantCodeBlock = ({ code, isCodeComplete, renderMimeRegistry, previewAICode, acceptAICode, rejectAICode, isLastAiMessage, codeReviewStatus, agentModeEnabled }) => {
545
+ const [isCodeExpanded, setIsCodeExpanded] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
546
+ // Memoize calculations
547
+ const lineCount = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => code.split('\n').length - 2, [code]);
548
+ const shouldShowToolbar = isLastAiMessage || isCodeComplete;
549
+ if (agentModeEnabled) {
550
+ return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: (0,_utils_classNames__WEBPACK_IMPORTED_MODULE_2__.classNames)('code-block-container', {
551
+ 'agent-mode': true,
552
+ 'agent-mode-collapsed': !isCodeExpanded
553
+ }) },
554
+ react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { onClick: () => setIsCodeExpanded(!isCodeExpanded), className: (0,_utils_classNames__WEBPACK_IMPORTED_MODULE_2__.classNames)('agent-mode-toggle', {
555
+ expanded: isCodeExpanded
556
+ }) },
557
+ react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", { className: "agent-mode-toggle-content" },
558
+ react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_icons_CodeIcon__WEBPACK_IMPORTED_MODULE_3__["default"], null),
559
+ "Generated ",
560
+ lineCount,
561
+ " lines of code"),
562
+ react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_icons_ExpandIcon__WEBPACK_IMPORTED_MODULE_4__["default"], { isExpanded: isCodeExpanded })),
563
+ isCodeExpanded && (react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_PythonCode__WEBPACK_IMPORTED_MODULE_5__["default"], { code: code, renderMimeRegistry: renderMimeRegistry }))));
564
+ }
565
+ else {
566
+ return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: "code-block-container" },
567
+ shouldShowToolbar && (react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_CodeBlockToolbar__WEBPACK_IMPORTED_MODULE_6__["default"], { code: code, isLastAiMessage: isLastAiMessage, codeReviewStatus: codeReviewStatus, onPreview: previewAICode, onAccept: acceptAICode, onReject: rejectAICode })),
568
+ react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_PythonCode__WEBPACK_IMPORTED_MODULE_5__["default"], { code: code, renderMimeRegistry: renderMimeRegistry })));
569
+ }
570
+ };
571
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (AssistantCodeBlock);
572
+
573
+
513
574
  /***/ }),
514
575
 
515
576
  /***/ "./lib/Extensions/AiChat/ChatMessage/ChatDropdown.js":
@@ -874,20 +935,21 @@ __webpack_require__.r(__webpack_exports__);
874
935
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "webpack/sharing/consume/default/react");
875
936
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
876
937
  /* harmony import */ var _utils_classNames__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../utils/classNames */ "./lib/utils/classNames.js");
877
- /* harmony import */ var _CodeBlock__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./CodeBlock */ "./lib/Extensions/AiChat/ChatMessage/CodeBlock.js");
938
+ /* harmony import */ var _UserCodeBlock__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./UserCodeBlock */ "./lib/Extensions/AiChat/ChatMessage/UserCodeBlock.js");
939
+ /* harmony import */ var _AssistantCodeBlock__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./AssistantCodeBlock */ "./lib/Extensions/AiChat/ChatMessage/AssistantCodeBlock.js");
878
940
  /* harmony import */ var _AlertBlock__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./AlertBlock */ "./lib/Extensions/AiChat/ChatMessage/AlertBlock.js");
879
- /* harmony import */ var _MarkdownBlock__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./MarkdownBlock */ "./lib/Extensions/AiChat/ChatMessage/MarkdownBlock.js");
941
+ /* harmony import */ var _MarkdownBlock__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./MarkdownBlock */ "./lib/Extensions/AiChat/ChatMessage/MarkdownBlock.js");
880
942
  /* harmony import */ var _utils_strings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../utils/strings */ "./lib/utils/strings.js");
881
- /* harmony import */ var _icons_Pencil__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../../icons/Pencil */ "./lib/icons/Pencil.js");
943
+ /* harmony import */ var _icons_Pencil__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../../../icons/Pencil */ "./lib/icons/Pencil.js");
882
944
  /* harmony import */ var _ChatInput__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ChatInput */ "./lib/Extensions/AiChat/ChatMessage/ChatInput.js");
883
- /* harmony import */ var _components_TextAndIconButton__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../components/TextAndIconButton */ "./lib/components/TextAndIconButton.js");
884
- /* harmony import */ var _icons_PlayButtonIcon__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../icons/PlayButtonIcon */ "./lib/icons/PlayButtonIcon.js");
885
- /* harmony import */ var _icons_CopyIcon__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../../icons/CopyIcon */ "./lib/icons/CopyIcon.js");
886
- /* harmony import */ var _utils_copyToClipboard__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../../utils/copyToClipboard */ "./lib/utils/copyToClipboard.js");
887
- /* harmony import */ var _components_TextButton__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../../components/TextButton */ "./lib/components/TextButton.js");
945
+ /* harmony import */ var _components_TextAndIconButton__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../components/TextAndIconButton */ "./lib/components/TextAndIconButton.js");
946
+ /* harmony import */ var _icons_PlayButtonIcon__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../../icons/PlayButtonIcon */ "./lib/icons/PlayButtonIcon.js");
947
+ /* harmony import */ var _icons_CopyIcon__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../../icons/CopyIcon */ "./lib/icons/CopyIcon.js");
948
+ /* harmony import */ var _utils_copyToClipboard__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../../utils/copyToClipboard */ "./lib/utils/copyToClipboard.js");
949
+ /* harmony import */ var _components_TextButton__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../../components/TextButton */ "./lib/components/TextButton.js");
888
950
  /* harmony import */ var _style_ChatMessage_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../style/ChatMessage.css */ "./style/ChatMessage.css");
889
951
  /* harmony import */ var _style_MarkdownMessage_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../style/MarkdownMessage.css */ "./style/MarkdownMessage.css");
890
- /* harmony import */ var _components_AgentToolComponents_GetCellOutputToolUI__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../../../components/AgentToolComponents/GetCellOutputToolUI */ "./lib/components/AgentToolComponents/GetCellOutputToolUI.js");
952
+ /* harmony import */ var _components_AgentToolComponents_GetCellOutputToolUI__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../../../components/AgentToolComponents/GetCellOutputToolUI */ "./lib/components/AgentToolComponents/GetCellOutputToolUI.js");
891
953
  /*
892
954
  * Copyright (c) Saga Inc.
893
955
  * Distributed under the terms of the GNU Affero General Public License v3.0 License.
@@ -908,7 +970,8 @@ __webpack_require__.r(__webpack_exports__);
908
970
 
909
971
 
910
972
 
911
- const ChatMessage = ({ message, messageType, promptType, agentResponse, messageIndex, mitoAIConnectionError, mitoAIConnectionErrorType, notebookTracker, renderMimeRegistry, isLastAiMessage, isLastMessage, operatingSystem, previewAICode, acceptAICode, rejectAICode, onUpdateMessage, contextManager, codeReviewStatus, setNextSteps, }) => {
973
+
974
+ const ChatMessage = ({ message, messageType, promptType, agentResponse, messageIndex, mitoAIConnectionError, mitoAIConnectionErrorType, notebookTracker, renderMimeRegistry, isLastAiMessage, isLastMessage, operatingSystem, previewAICode, acceptAICode, rejectAICode, onUpdateMessage, contextManager, codeReviewStatus, setNextSteps, agentModeEnabled, }) => {
912
975
  const [isEditing, setIsEditing] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
913
976
  if (message.role !== 'user' && message.role !== 'assistant') {
914
977
  return null;
@@ -958,15 +1021,15 @@ const ChatMessage = ({ message, messageType, promptType, agentResponse, messageI
958
1021
  // An empty code will look like this '```python ```'
959
1022
  if (messagePart.length > 14) {
960
1023
  return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null,
961
- react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_CodeBlock__WEBPACK_IMPORTED_MODULE_7__["default"], { key: index + messagePart, code: messagePart, isCodeComplete: isCodeComplete, role: message.role, renderMimeRegistry: renderMimeRegistry, previewAICode: previewAICode, acceptAICode: acceptAICode, rejectAICode: rejectAICode, isLastAiMessage: isLastAiMessage, codeReviewStatus: codeReviewStatus }),
1024
+ message.role === 'user' ? (react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_UserCodeBlock__WEBPACK_IMPORTED_MODULE_7__["default"], { code: messagePart, renderMimeRegistry: renderMimeRegistry, agentModeEnabled: agentModeEnabled })) : (react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_AssistantCodeBlock__WEBPACK_IMPORTED_MODULE_8__["default"], { code: messagePart, isCodeComplete: isCodeComplete, renderMimeRegistry: renderMimeRegistry, previewAICode: previewAICode, acceptAICode: acceptAICode, rejectAICode: rejectAICode, isLastAiMessage: isLastAiMessage, codeReviewStatus: codeReviewStatus, agentModeEnabled: agentModeEnabled })),
962
1025
  isLastAiMessage && isCodeComplete && codeReviewStatus === 'chatPreview' &&
963
1026
  react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: 'chat-message-buttons' },
964
- react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_TextAndIconButton__WEBPACK_IMPORTED_MODULE_8__["default"], { onClick: () => { previewAICode(); }, text: 'Overwrite Active Cell', icon: _icons_PlayButtonIcon__WEBPACK_IMPORTED_MODULE_9__["default"], title: 'Write the Ai generated code to the active cell in the jupyter notebook, replacing the current code.', variant: 'gray', width: 'fit-contents' }),
965
- react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_TextAndIconButton__WEBPACK_IMPORTED_MODULE_8__["default"], { onClick: () => { void (0,_utils_copyToClipboard__WEBPACK_IMPORTED_MODULE_10__["default"])(messagePart); }, text: 'Copy', icon: _icons_CopyIcon__WEBPACK_IMPORTED_MODULE_11__["default"], title: 'Copy the Ai generated code to your clipboard', variant: 'gray', width: 'fit-contents' })),
1027
+ react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_TextAndIconButton__WEBPACK_IMPORTED_MODULE_9__["default"], { onClick: () => { previewAICode(); }, text: 'Overwrite Active Cell', icon: _icons_PlayButtonIcon__WEBPACK_IMPORTED_MODULE_10__["default"], title: 'Write the Ai generated code to the active cell in the jupyter notebook, replacing the current code.', variant: 'gray', width: 'fit-contents' }),
1028
+ react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_TextAndIconButton__WEBPACK_IMPORTED_MODULE_9__["default"], { onClick: () => { void (0,_utils_copyToClipboard__WEBPACK_IMPORTED_MODULE_11__["default"])(messagePart); }, text: 'Copy', icon: _icons_CopyIcon__WEBPACK_IMPORTED_MODULE_12__["default"], title: 'Copy the Ai generated code to your clipboard', variant: 'gray', width: 'fit-contents' })),
966
1029
  isLastAiMessage && isCodeComplete && codeReviewStatus === 'codeCellPreview' &&
967
1030
  react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: 'chat-message-buttons' },
968
- react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_TextButton__WEBPACK_IMPORTED_MODULE_12__["default"], { onClick: () => { acceptAICode(); }, text: `Accept code ${operatingSystem === 'mac' ? '⌘Y' : 'Ctrl+Y'}`, title: 'Accept the Ai generated code', variant: 'green', width: 'fit-contents' }),
969
- react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_TextButton__WEBPACK_IMPORTED_MODULE_12__["default"], { onClick: () => { rejectAICode(); }, text: `Reject code ${operatingSystem === 'mac' ? '⌘U' : 'Ctrl+U'}`, title: 'Reject the Ai generated code and revert to the previous version of the code cell', variant: 'red', width: 'fit-contents' }))));
1031
+ react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_TextButton__WEBPACK_IMPORTED_MODULE_13__["default"], { onClick: () => { acceptAICode(); }, text: `Accept code ${operatingSystem === 'mac' ? '⌘Y' : 'Ctrl+Y'}`, title: 'Accept the Ai generated code', variant: 'green', width: 'fit-contents' }),
1032
+ react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_TextButton__WEBPACK_IMPORTED_MODULE_13__["default"], { onClick: () => { rejectAICode(); }, text: `Reject code ${operatingSystem === 'mac' ? '⌘U' : 'Ctrl+U'}`, title: 'Reject the Ai generated code and revert to the previous version of the code cell', variant: 'red', width: 'fit-contents' }))));
970
1033
  }
971
1034
  else {
972
1035
  // Return null for empty code blocks
@@ -982,15 +1045,15 @@ const ChatMessage = ({ message, messageType, promptType, agentResponse, messageI
982
1045
  }
983
1046
  } }, message.role === 'user' && promptType === 'smartDebug' ? (
984
1047
  /* Use a pre tag to preserve the newline and indentation of the error message */
985
- react__WEBPACK_IMPORTED_MODULE_0___default().createElement("pre", { className: "chat-taskpane-smart-debug-error-message" }, messagePart)) : (react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_MarkdownBlock__WEBPACK_IMPORTED_MODULE_13__["default"], { markdown: messagePart, renderMimeRegistry: renderMimeRegistry, notebookTracker: notebookTracker })))));
1048
+ react__WEBPACK_IMPORTED_MODULE_0___default().createElement("pre", { className: "chat-taskpane-smart-debug-error-message" }, messagePart)) : (react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_MarkdownBlock__WEBPACK_IMPORTED_MODULE_14__["default"], { markdown: messagePart, renderMimeRegistry: renderMimeRegistry, notebookTracker: notebookTracker })))));
986
1049
  }
987
1050
  }),
988
1051
  editable &&
989
1052
  react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: "message-action-buttons" },
990
1053
  react__WEBPACK_IMPORTED_MODULE_0___default().createElement("button", { className: "message-start-editing-button", onClick: handleEditClick, title: "Edit message" },
991
- react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_icons_Pencil__WEBPACK_IMPORTED_MODULE_14__["default"], null))),
1054
+ react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_icons_Pencil__WEBPACK_IMPORTED_MODULE_15__["default"], null))),
992
1055
  (agentResponse === null || agentResponse === void 0 ? void 0 : agentResponse.type) === 'get_cell_output' &&
993
- react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_AgentToolComponents_GetCellOutputToolUI__WEBPACK_IMPORTED_MODULE_15__["default"], null)));
1056
+ react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_AgentToolComponents_GetCellOutputToolUI__WEBPACK_IMPORTED_MODULE_16__["default"], null)));
994
1057
  };
995
1058
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ChatMessage);
996
1059
 
@@ -1045,10 +1108,10 @@ const Citation = ({ citationIndex, cellId, line, notebookTracker }) => {
1045
1108
 
1046
1109
  /***/ }),
1047
1110
 
1048
- /***/ "./lib/Extensions/AiChat/ChatMessage/CodeBlock.js":
1049
- /*!********************************************************!*\
1050
- !*** ./lib/Extensions/AiChat/ChatMessage/CodeBlock.js ***!
1051
- \********************************************************/
1111
+ /***/ "./lib/Extensions/AiChat/ChatMessage/CodeBlockToolbar.js":
1112
+ /*!***************************************************************!*\
1113
+ !*** ./lib/Extensions/AiChat/ChatMessage/CodeBlockToolbar.js ***!
1114
+ \***************************************************************/
1052
1115
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1053
1116
 
1054
1117
  __webpack_require__.r(__webpack_exports__);
@@ -1057,15 +1120,12 @@ __webpack_require__.r(__webpack_exports__);
1057
1120
  /* harmony export */ });
1058
1121
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "webpack/sharing/consume/default/react");
1059
1122
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
1060
- /* harmony import */ var _PythonCode__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./PythonCode */ "./lib/Extensions/AiChat/ChatMessage/PythonCode.js");
1061
- /* harmony import */ var _style_CodeBlock_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../style/CodeBlock.css */ "./style/CodeBlock.css");
1062
- /* harmony import */ var _utils_copyToClipboard__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../utils/copyToClipboard */ "./lib/utils/copyToClipboard.js");
1063
- /* harmony import */ var _components_IconButton__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../components/IconButton */ "./lib/components/IconButton.js");
1064
- /* harmony import */ var _icons_CopyIcon__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../icons/CopyIcon */ "./lib/icons/CopyIcon.js");
1065
- /* harmony import */ var _icons_PlayButtonIcon__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../icons/PlayButtonIcon */ "./lib/icons/PlayButtonIcon.js");
1066
- /* harmony import */ var _icons_AcceptIcon__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../icons/AcceptIcon */ "./lib/icons/AcceptIcon.js");
1067
- /* harmony import */ var _icons_RejectIcon__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../icons/RejectIcon */ "./lib/icons/RejectIcon.js");
1068
- /* harmony import */ var _icons_ExpandIcon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../icons/ExpandIcon */ "./lib/icons/ExpandIcon.js");
1123
+ /* harmony import */ var _utils_copyToClipboard__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../utils/copyToClipboard */ "./lib/utils/copyToClipboard.js");
1124
+ /* harmony import */ var _components_IconButton__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../components/IconButton */ "./lib/components/IconButton.js");
1125
+ /* harmony import */ var _icons_CopyIcon__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../icons/CopyIcon */ "./lib/icons/CopyIcon.js");
1126
+ /* harmony import */ var _icons_PlayButtonIcon__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../icons/PlayButtonIcon */ "./lib/icons/PlayButtonIcon.js");
1127
+ /* harmony import */ var _icons_AcceptIcon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../icons/AcceptIcon */ "./lib/icons/AcceptIcon.js");
1128
+ /* harmony import */ var _icons_RejectIcon__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../icons/RejectIcon */ "./lib/icons/RejectIcon.js");
1069
1129
  /*
1070
1130
  * Copyright (c) Saga Inc.
1071
1131
  * Distributed under the terms of the GNU Affero General Public License v3.0 License.
@@ -1077,44 +1137,15 @@ __webpack_require__.r(__webpack_exports__);
1077
1137
 
1078
1138
 
1079
1139
 
1080
-
1081
-
1082
-
1083
- const CodeBlock = ({ code, isCodeComplete, role, renderMimeRegistry, previewAICode, acceptAICode, rejectAICode, isLastAiMessage, codeReviewStatus, }) => {
1084
- const [isExpanded, setIsExpanded] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
1085
- if (role === 'user') {
1086
- const numCodePreviewLines = 5;
1087
- const isCodeExpandable = code.split('\n').length > numCodePreviewLines;
1088
- const previewCode = code.split('\n').slice(0, numCodePreviewLines).join('\n');
1089
- return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: 'code-block-container active-cell-code-block', onClick: () => setIsExpanded(!isExpanded), style: { cursor: 'pointer' } },
1090
- react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_PythonCode__WEBPACK_IMPORTED_MODULE_2__["default"], { code: isExpanded ? code : previewCode, renderMimeRegistry: renderMimeRegistry }),
1091
- isCodeExpandable && (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: 'code-block-expand-button', title: isExpanded ? "Collapse" : "Expand", onClick: (e) => {
1092
- e.stopPropagation();
1093
- setIsExpanded(!isExpanded);
1094
- } },
1095
- react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_icons_ExpandIcon__WEBPACK_IMPORTED_MODULE_3__["default"], { isExpanded: isExpanded })))));
1096
- }
1097
- if (role === 'assistant') {
1098
- return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: 'code-block-container' },
1099
- react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null,
1100
- isLastAiMessage && isCodeComplete &&
1101
- react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: 'code-block-toolbar' },
1102
- codeReviewStatus === 'chatPreview' &&
1103
- react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_IconButton__WEBPACK_IMPORTED_MODULE_4__["default"], { icon: react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_icons_PlayButtonIcon__WEBPACK_IMPORTED_MODULE_5__["default"], null), title: "Overwrite Active Cell", onClick: () => { previewAICode(); } }),
1104
- codeReviewStatus === 'codeCellPreview' &&
1105
- react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_IconButton__WEBPACK_IMPORTED_MODULE_4__["default"], { icon: react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_icons_AcceptIcon__WEBPACK_IMPORTED_MODULE_6__["default"], null), title: "Accept AI Generated Code", onClick: () => { acceptAICode(); }, style: { color: 'var(--green-700)' } }),
1106
- codeReviewStatus === 'codeCellPreview' &&
1107
- react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_IconButton__WEBPACK_IMPORTED_MODULE_4__["default"], { icon: react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_icons_RejectIcon__WEBPACK_IMPORTED_MODULE_7__["default"], null), title: "Reject AI Generated Code", onClick: () => { rejectAICode(); }, style: { color: 'var(--red-700)' } }),
1108
- codeReviewStatus !== 'codeCellPreview' &&
1109
- react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_IconButton__WEBPACK_IMPORTED_MODULE_4__["default"], { icon: react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_icons_CopyIcon__WEBPACK_IMPORTED_MODULE_8__["default"], null), title: "Copy", onClick: () => { void (0,_utils_copyToClipboard__WEBPACK_IMPORTED_MODULE_9__["default"])(code); } })),
1110
- !isLastAiMessage &&
1111
- react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: 'code-block-toolbar' },
1112
- react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_IconButton__WEBPACK_IMPORTED_MODULE_4__["default"], { icon: react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_icons_CopyIcon__WEBPACK_IMPORTED_MODULE_8__["default"], null), title: "Copy", onClick: () => { void (0,_utils_copyToClipboard__WEBPACK_IMPORTED_MODULE_9__["default"])(code); } }))),
1113
- react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_PythonCode__WEBPACK_IMPORTED_MODULE_2__["default"], { code: code, renderMimeRegistry: renderMimeRegistry })));
1114
- }
1115
- return react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null);
1140
+ const CodeBlockToolbar = ({ code, isLastAiMessage = false, codeReviewStatus, onPreview, onAccept, onReject }) => {
1141
+ return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: 'code-block-toolbar' },
1142
+ isLastAiMessage && codeReviewStatus === 'chatPreview' && onPreview && (react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_IconButton__WEBPACK_IMPORTED_MODULE_1__["default"], { icon: react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_icons_PlayButtonIcon__WEBPACK_IMPORTED_MODULE_2__["default"], null), title: "Overwrite Active Cell", onClick: onPreview })),
1143
+ isLastAiMessage && codeReviewStatus === 'codeCellPreview' && onAccept && onReject && (react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null,
1144
+ react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_IconButton__WEBPACK_IMPORTED_MODULE_1__["default"], { icon: react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_icons_AcceptIcon__WEBPACK_IMPORTED_MODULE_3__["default"], null), title: "Accept AI Generated Code", onClick: onAccept, style: { color: 'var(--green-700)' } }),
1145
+ react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_IconButton__WEBPACK_IMPORTED_MODULE_1__["default"], { icon: react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_icons_RejectIcon__WEBPACK_IMPORTED_MODULE_4__["default"], null), title: "Reject AI Generated Code", onClick: onReject, style: { color: 'var(--red-700)' } }))),
1146
+ (!isLastAiMessage || codeReviewStatus !== 'codeCellPreview') && (react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_IconButton__WEBPACK_IMPORTED_MODULE_1__["default"], { icon: react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_icons_CopyIcon__WEBPACK_IMPORTED_MODULE_5__["default"], null), title: "Copy", onClick: () => { void (0,_utils_copyToClipboard__WEBPACK_IMPORTED_MODULE_6__["default"])(code); } }))));
1116
1147
  };
1117
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CodeBlock);
1148
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CodeBlockToolbar);
1118
1149
 
1119
1150
 
1120
1151
  /***/ }),
@@ -1447,6 +1478,47 @@ const ScrollableSuggestions = ({ onSelectSuggestion }) => {
1447
1478
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ScrollableSuggestions);
1448
1479
 
1449
1480
 
1481
+ /***/ }),
1482
+
1483
+ /***/ "./lib/Extensions/AiChat/ChatMessage/UserCodeBlock.js":
1484
+ /*!************************************************************!*\
1485
+ !*** ./lib/Extensions/AiChat/ChatMessage/UserCodeBlock.js ***!
1486
+ \************************************************************/
1487
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1488
+
1489
+ __webpack_require__.r(__webpack_exports__);
1490
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1491
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1492
+ /* harmony export */ });
1493
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "webpack/sharing/consume/default/react");
1494
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
1495
+ /* harmony import */ var _PythonCode__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./PythonCode */ "./lib/Extensions/AiChat/ChatMessage/PythonCode.js");
1496
+ /* harmony import */ var _style_CodeBlock_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../style/CodeBlock.css */ "./style/CodeBlock.css");
1497
+ /* harmony import */ var _icons_ExpandIcon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../icons/ExpandIcon */ "./lib/icons/ExpandIcon.js");
1498
+ /*
1499
+ * Copyright (c) Saga Inc.
1500
+ * Distributed under the terms of the GNU Affero General Public License v3.0 License.
1501
+ */
1502
+
1503
+
1504
+
1505
+
1506
+ const UserCodeBlock = ({ code, renderMimeRegistry, agentModeEnabled }) => {
1507
+ const [isExpanded, setIsExpanded] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
1508
+ const numCodePreviewLines = 5;
1509
+ const isCodeExpandable = code.split('\n').length > numCodePreviewLines;
1510
+ const previewCode = code.split('\n').slice(0, numCodePreviewLines).join('\n');
1511
+ return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: `code-block-container active-cell-code-block ${agentModeEnabled ? 'agent-mode' : ''}`, onClick: () => setIsExpanded(!isExpanded), style: { cursor: 'pointer' } },
1512
+ react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_PythonCode__WEBPACK_IMPORTED_MODULE_2__["default"], { code: isExpanded ? code : previewCode, renderMimeRegistry: renderMimeRegistry }),
1513
+ isCodeExpandable && (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: 'code-block-expand-button', title: isExpanded ? "Collapse" : "Expand", onClick: (e) => {
1514
+ e.stopPropagation();
1515
+ setIsExpanded(!isExpanded);
1516
+ } },
1517
+ react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_icons_ExpandIcon__WEBPACK_IMPORTED_MODULE_3__["default"], { isExpanded: isExpanded })))));
1518
+ };
1519
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (UserCodeBlock);
1520
+
1521
+
1450
1522
  /***/ }),
1451
1523
 
1452
1524
  /***/ "./lib/Extensions/AiChat/ChatTaskpane.js":
@@ -1470,33 +1542,34 @@ __webpack_require__.r(__webpack_exports__);
1470
1542
  /* harmony import */ var _style_TextButton_css__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../style/TextButton.css */ "./style/TextButton.css");
1471
1543
  /* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @jupyterlab/ui-components */ "webpack/sharing/consume/default/@jupyterlab/ui-components");
1472
1544
  /* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_6__);
1473
- /* harmony import */ var _icons__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../../icons */ "./lib/icons/index.js");
1474
- /* harmony import */ var _icons_MitoLogo__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../../icons/MitoLogo */ "./lib/icons/MitoLogo.js");
1475
- /* harmony import */ var _ChatMessage_ChatInput__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./ChatMessage/ChatInput */ "./lib/Extensions/AiChat/ChatMessage/ChatInput.js");
1476
- /* harmony import */ var _ChatMessage_ChatMessage__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./ChatMessage/ChatMessage */ "./lib/Extensions/AiChat/ChatMessage/ChatMessage.js");
1477
- /* harmony import */ var _ChatMessage_ScrollableSuggestions__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./ChatMessage/ScrollableSuggestions */ "./lib/Extensions/AiChat/ChatMessage/ScrollableSuggestions.js");
1545
+ /* harmony import */ var _icons__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../../icons */ "./lib/icons/index.js");
1546
+ /* harmony import */ var _icons_MitoLogo__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ../../icons/MitoLogo */ "./lib/icons/MitoLogo.js");
1547
+ /* harmony import */ var _ChatMessage_ChatInput__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./ChatMessage/ChatInput */ "./lib/Extensions/AiChat/ChatMessage/ChatInput.js");
1548
+ /* harmony import */ var _ChatMessage_ChatMessage__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./ChatMessage/ChatMessage */ "./lib/Extensions/AiChat/ChatMessage/ChatMessage.js");
1549
+ /* harmony import */ var _ChatMessage_ScrollableSuggestions__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./ChatMessage/ScrollableSuggestions */ "./lib/Extensions/AiChat/ChatMessage/ScrollableSuggestions.js");
1478
1550
  /* harmony import */ var _ChatHistoryManager__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ChatHistoryManager */ "./lib/Extensions/AiChat/ChatHistoryManager.js");
1479
- /* harmony import */ var _CodeDiffDisplay__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./CodeDiffDisplay */ "./lib/Extensions/AiChat/CodeDiffDisplay.js");
1480
- /* harmony import */ var _components_ToggleButton__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ../../components/ToggleButton */ "./lib/components/ToggleButton.js");
1481
- /* harmony import */ var _components_IconButton__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../../components/IconButton */ "./lib/components/IconButton.js");
1482
- /* harmony import */ var _components_LoadingDots__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ../../components/LoadingDots */ "./lib/components/LoadingDots.js");
1483
- /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../../commands */ "./lib/commands.js");
1484
- /* harmony import */ var _utils_codeDiff__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../../utils/codeDiff */ "./lib/utils/codeDiff.js");
1485
- /* harmony import */ var _utils_notebook__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../utils/notebook */ "./lib/utils/notebook.js");
1486
- /* harmony import */ var _utils_strings__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../utils/strings */ "./lib/utils/strings.js");
1487
- /* harmony import */ var _utils_agentActions__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../../utils/agentActions */ "./lib/utils/agentActions.js");
1488
- /* harmony import */ var _utils_scroll__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../utils/scroll */ "./lib/utils/scroll.js");
1489
- /* harmony import */ var _components_LoadingCircle__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ../../components/LoadingCircle */ "./lib/components/LoadingCircle.js");
1551
+ /* harmony import */ var _CodeDiffDisplay__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./CodeDiffDisplay */ "./lib/Extensions/AiChat/CodeDiffDisplay.js");
1552
+ /* harmony import */ var _components_ToggleButton__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ../../components/ToggleButton */ "./lib/components/ToggleButton.js");
1553
+ /* harmony import */ var _components_IconButton__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../../components/IconButton */ "./lib/components/IconButton.js");
1554
+ /* harmony import */ var _components_LoadingDots__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ../../components/LoadingDots */ "./lib/components/LoadingDots.js");
1555
+ /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../../commands */ "./lib/commands.js");
1556
+ /* harmony import */ var _utils_codeDiff__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../../utils/codeDiff */ "./lib/utils/codeDiff.js");
1557
+ /* harmony import */ var _utils_notebook__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../utils/notebook */ "./lib/utils/notebook.js");
1558
+ /* harmony import */ var _utils_strings__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../utils/strings */ "./lib/utils/strings.js");
1559
+ /* harmony import */ var _utils_agentActions__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../../utils/agentActions */ "./lib/utils/agentActions.js");
1560
+ /* harmony import */ var _utils_scroll__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../utils/scroll */ "./lib/utils/scroll.js");
1561
+ /* harmony import */ var _components_LoadingCircle__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ../../components/LoadingCircle */ "./lib/components/LoadingCircle.js");
1490
1562
  /* harmony import */ var _components_ModelSelector__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../components/ModelSelector */ "./lib/components/ModelSelector.js");
1491
- /* harmony import */ var _utils_blacklistedWords__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../utils/blacklistedWords */ "./lib/utils/blacklistedWords.js");
1492
- /* harmony import */ var _components_DropdownMenu__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../../components/DropdownMenu */ "./lib/components/DropdownMenu.js");
1493
- /* harmony import */ var _SettingsManager_SettingsManagerPlugin__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../SettingsManager/SettingsManagerPlugin */ "./lib/Extensions/SettingsManager/SettingsManagerPlugin.js");
1563
+ /* harmony import */ var _utils_blacklistedWords__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../../utils/blacklistedWords */ "./lib/utils/blacklistedWords.js");
1564
+ /* harmony import */ var _components_DropdownMenu__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../../components/DropdownMenu */ "./lib/components/DropdownMenu.js");
1565
+ /* harmony import */ var _SettingsManager_SettingsManagerPlugin__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../SettingsManager/SettingsManagerPlugin */ "./lib/Extensions/SettingsManager/SettingsManagerPlugin.js");
1494
1566
  /* harmony import */ var _FirstMessage__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./FirstMessage */ "./lib/Extensions/AiChat/FirstMessage.js");
1495
- /* harmony import */ var _CTACarousel__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./CTACarousel */ "./lib/Extensions/AiChat/CTACarousel.js");
1496
- /* harmony import */ var _components_NextStepsPills__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ../../components/NextStepsPills */ "./lib/components/NextStepsPills.js");
1497
- /* harmony import */ var _icons_UndoIcon__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ../../icons/UndoIcon */ "./lib/icons/UndoIcon.js");
1498
- /* harmony import */ var _components_TextAndIconButton__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ../../components/TextAndIconButton */ "./lib/components/TextAndIconButton.js");
1499
- /* harmony import */ var _utils_checkpoint__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../utils/checkpoint */ "./lib/utils/checkpoint.js");
1567
+ /* harmony import */ var _CTACarousel__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./CTACarousel */ "./lib/Extensions/AiChat/CTACarousel.js");
1568
+ /* harmony import */ var _components_NextStepsPills__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ../../components/NextStepsPills */ "./lib/components/NextStepsPills.js");
1569
+ /* harmony import */ var _icons_UndoIcon__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ../../icons/UndoIcon */ "./lib/icons/UndoIcon.js");
1570
+ /* harmony import */ var _components_TextAndIconButton__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ../../components/TextAndIconButton */ "./lib/components/TextAndIconButton.js");
1571
+ /* harmony import */ var _utils_checkpoint__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../utils/checkpoint */ "./lib/utils/checkpoint.js");
1572
+ /* harmony import */ var _utils_waitForNotebookReady__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../utils/waitForNotebookReady */ "./lib/utils/waitForNotebookReady.js");
1500
1573
  /*
1501
1574
  * Copyright (c) Saga Inc.
1502
1575
  * Distributed under the terms of the GNU Affero General Public License v3.0 License.
@@ -1534,6 +1607,7 @@ __webpack_require__.r(__webpack_exports__);
1534
1607
 
1535
1608
 
1536
1609
 
1610
+
1537
1611
 
1538
1612
 
1539
1613
  const AGENT_EXECUTION_DEPTH_LIMIT = 20;
@@ -1765,6 +1839,7 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
1765
1839
  }
1766
1840
  const firstMessage = (0,_FirstMessage__WEBPACK_IMPORTED_MODULE_9__.getFirstMessageFromCookie)();
1767
1841
  if (firstMessage) {
1842
+ await (0,_utils_waitForNotebookReady__WEBPACK_IMPORTED_MODULE_10__.waitForNotebookReady)(notebookTracker);
1768
1843
  await startAgentExecution(firstMessage);
1769
1844
  }
1770
1845
  }
@@ -1802,7 +1877,7 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
1802
1877
  // Scroll to bottom whenever chat history updates, but only if in follow mode
1803
1878
  (0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(() => {
1804
1879
  if (autoScrollFollowMode) {
1805
- (0,_utils_scroll__WEBPACK_IMPORTED_MODULE_10__.scrollToDiv)(chatMessagesRef);
1880
+ (0,_utils_scroll__WEBPACK_IMPORTED_MODULE_11__.scrollToDiv)(chatMessagesRef);
1806
1881
  }
1807
1882
  }, [chatHistoryManager.getDisplayOptimizedHistory().length, chatHistoryManager, autoScrollFollowMode]);
1808
1883
  // Add scroll event handler to detect manual scrolling
@@ -1911,7 +1986,7 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
1911
1986
  agentExecutionMetadata.index = messageIndex;
1912
1987
  }
1913
1988
  if (sendActiveCellOutput) {
1914
- const activeCellOutput = await (0,_utils_notebook__WEBPACK_IMPORTED_MODULE_11__.getActiveCellOutput)(notebookTracker);
1989
+ const activeCellOutput = await (0,_utils_notebook__WEBPACK_IMPORTED_MODULE_12__.getActiveCellOutput)(notebookTracker);
1915
1990
  if (activeCellOutput !== undefined) {
1916
1991
  agentExecutionMetadata.base64EncodedActiveCellOutput = activeCellOutput;
1917
1992
  }
@@ -1951,7 +2026,7 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
1951
2026
  // Add the active cell output to the metadata afterwards setting the chatHistoryManager so that
1952
2027
  // we don't have to wait on turning the output into a base64 image before we can add the user's message
1953
2028
  // to the chat.
1954
- const activeCellOutput = await (0,_utils_notebook__WEBPACK_IMPORTED_MODULE_11__.getActiveCellOutput)(notebookTracker);
2029
+ const activeCellOutput = await (0,_utils_notebook__WEBPACK_IMPORTED_MODULE_12__.getActiveCellOutput)(notebookTracker);
1955
2030
  if (activeCellOutput !== undefined) {
1956
2031
  chatMessageMetadata.base64EncodedActiveCellOutput = activeCellOutput;
1957
2032
  }
@@ -2110,7 +2185,7 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
2110
2185
  setAgentExecutionStatus('idle');
2111
2186
  };
2112
2187
  const startAgentExecution = async (input, messageIndex, selectedRules) => {
2113
- await (0,_utils_checkpoint__WEBPACK_IMPORTED_MODULE_12__.createCheckpoint)(app, setHasCheckpoint);
2188
+ await (0,_utils_checkpoint__WEBPACK_IMPORTED_MODULE_13__.createCheckpoint)(app, setHasCheckpoint);
2114
2189
  setAgentExecutionStatus('working');
2115
2190
  // Enable follow mode when user starts agent execution
2116
2191
  setAutoScrollFollowMode(true);
@@ -2142,9 +2217,9 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
2142
2217
  const aiDisplayOptimizedChatItem = chatHistoryManagerRef.current.getLastAIDisplayOptimizedChatItem();
2143
2218
  // # TODO: Make this is a helper function so we can also use it in the auto error fixup!
2144
2219
  if (aiDisplayOptimizedChatItem) {
2145
- const aiGeneratedCode = (0,_utils_strings__WEBPACK_IMPORTED_MODULE_13__.getCodeBlockFromMessage)(aiDisplayOptimizedChatItem.message);
2220
+ const aiGeneratedCode = (0,_utils_strings__WEBPACK_IMPORTED_MODULE_14__.getCodeBlockFromMessage)(aiDisplayOptimizedChatItem.message);
2146
2221
  if (aiGeneratedCode) {
2147
- const securityCheck = (0,_utils_blacklistedWords__WEBPACK_IMPORTED_MODULE_14__.checkForBlacklistedWords)(aiGeneratedCode);
2222
+ const securityCheck = (0,_utils_blacklistedWords__WEBPACK_IMPORTED_MODULE_15__.checkForBlacklistedWords)(aiGeneratedCode);
2148
2223
  if (!securityCheck.safe) {
2149
2224
  console.error('Security Warning:', securityCheck.reason);
2150
2225
  addAIMessageFromResponseAndUpdateState(`I cannot execute this code without your approval because this code did not pass my security checks. ${securityCheck.reason}. For your safety, I am stopping execution of this plan.`, 'agent:execution', chatHistoryManager);
@@ -2171,8 +2246,8 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
2171
2246
  }
2172
2247
  if (agentResponse.type === 'cell_update' && agentResponse.cell_update) {
2173
2248
  // Run the code and handle any errors
2174
- await (0,_utils_agentActions__WEBPACK_IMPORTED_MODULE_15__.acceptAndRunCellUpdate)(agentResponse.cell_update, notebookTracker, app, previewAICodeToActiveCell, acceptAICode);
2175
- const status = await (0,_utils_agentActions__WEBPACK_IMPORTED_MODULE_15__.retryIfExecutionError)(notebookTracker, app, getDuplicateChatHistoryManager, addAIMessageFromResponseAndUpdateState, sendAgentSmartDebugMessage, previewAICodeToActiveCell, acceptAICode, shouldContinueAgentExecution, finalizeAgentStop, chatHistoryManagerRef);
2249
+ await (0,_utils_agentActions__WEBPACK_IMPORTED_MODULE_16__.acceptAndRunCellUpdate)(agentResponse.cell_update, notebookTracker, app, previewAICodeToActiveCell, acceptAICode);
2250
+ const status = await (0,_utils_agentActions__WEBPACK_IMPORTED_MODULE_16__.retryIfExecutionError)(notebookTracker, app, getDuplicateChatHistoryManager, addAIMessageFromResponseAndUpdateState, sendAgentSmartDebugMessage, previewAICodeToActiveCell, acceptAICode, shouldContinueAgentExecution, finalizeAgentStop, chatHistoryManagerRef);
2176
2251
  if (status === 'interupted') {
2177
2252
  break;
2178
2253
  }
@@ -2201,33 +2276,33 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
2201
2276
  if (!aiMessage) {
2202
2277
  return;
2203
2278
  }
2204
- const updateCellCode = (0,_utils_notebook__WEBPACK_IMPORTED_MODULE_11__.getCellCodeByID)(notebookTracker, updateCellID);
2279
+ const updateCellCode = (0,_utils_notebook__WEBPACK_IMPORTED_MODULE_12__.getCellCodeByID)(notebookTracker, updateCellID);
2205
2280
  if (updateCellID === undefined || updateCellCode === undefined) {
2206
2281
  return;
2207
2282
  }
2208
2283
  // Extract the code from the AI's message and then calculate the code diffs
2209
- const aiGeneratedCode = (0,_utils_strings__WEBPACK_IMPORTED_MODULE_13__.getCodeBlockFromMessage)(aiMessage);
2210
- const aiGeneratedCodeCleaned = (0,_utils_strings__WEBPACK_IMPORTED_MODULE_13__.removeMarkdownCodeFormatting)(aiGeneratedCode || '');
2211
- const { unifiedCodeString, unifiedDiffs } = (0,_utils_codeDiff__WEBPACK_IMPORTED_MODULE_16__.getCodeDiffsAndUnifiedCodeString)(updateCellCode, aiGeneratedCodeCleaned);
2284
+ const aiGeneratedCode = (0,_utils_strings__WEBPACK_IMPORTED_MODULE_14__.getCodeBlockFromMessage)(aiMessage);
2285
+ const aiGeneratedCodeCleaned = (0,_utils_strings__WEBPACK_IMPORTED_MODULE_14__.removeMarkdownCodeFormatting)(aiGeneratedCode || '');
2286
+ const { unifiedCodeString, unifiedDiffs } = (0,_utils_codeDiff__WEBPACK_IMPORTED_MODULE_17__.getCodeDiffsAndUnifiedCodeString)(updateCellCode, aiGeneratedCodeCleaned);
2212
2287
  // Store the code cell ID where we write the code diffs so that we can
2213
2288
  // accept or reject the code diffs to the correct cell
2214
2289
  cellStateBeforeDiff.current = { codeCellID: updateCellID, code: updateCellCode };
2215
2290
  // Temporarily write the unified code string to the active cell so we can display
2216
2291
  // the code diffs to the user
2217
- (0,_utils_notebook__WEBPACK_IMPORTED_MODULE_11__.writeCodeToCellByID)(notebookTracker, unifiedCodeString, updateCellID);
2292
+ (0,_utils_notebook__WEBPACK_IMPORTED_MODULE_12__.writeCodeToCellByID)(notebookTracker, unifiedCodeString, updateCellID);
2218
2293
  updateCodeCellsExtensions(unifiedDiffs);
2219
2294
  // Briefly highlight the code cell to draw the user's attention to it
2220
- (0,_utils_notebook__WEBPACK_IMPORTED_MODULE_11__.highlightCodeCell)(notebookTracker, updateCellID);
2295
+ (0,_utils_notebook__WEBPACK_IMPORTED_MODULE_12__.highlightCodeCell)(notebookTracker, updateCellID);
2221
2296
  };
2222
2297
  const displayOptimizedChatHistory = chatHistoryManager.getDisplayOptimizedHistory();
2223
2298
  const previewAICodeToActiveCell = () => {
2224
2299
  setCodeReviewStatus('codeCellPreview');
2225
- const activeCellID = (0,_utils_notebook__WEBPACK_IMPORTED_MODULE_11__.getActiveCellID)(notebookTracker);
2300
+ const activeCellID = (0,_utils_notebook__WEBPACK_IMPORTED_MODULE_12__.getActiveCellID)(notebookTracker);
2226
2301
  const lastAIDisplayMessage = chatHistoryManagerRef.current.getLastAIDisplayOptimizedChatItem();
2227
2302
  if (activeCellID === undefined || lastAIDisplayMessage === undefined) {
2228
2303
  return;
2229
2304
  }
2230
- (0,_utils_notebook__WEBPACK_IMPORTED_MODULE_11__.scrollToCell)(notebookTracker, activeCellID, undefined, 'end');
2305
+ (0,_utils_notebook__WEBPACK_IMPORTED_MODULE_12__.scrollToCell)(notebookTracker, activeCellID, undefined, 'end');
2231
2306
  updateCodeDiffStripes(lastAIDisplayMessage.message, activeCellID);
2232
2307
  updateCellToolbarButtons();
2233
2308
  };
@@ -2237,7 +2312,7 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
2237
2312
  if (!lastAIMessage || !cellStateBeforeDiff.current) {
2238
2313
  return;
2239
2314
  }
2240
- const aiGeneratedCode = (0,_utils_strings__WEBPACK_IMPORTED_MODULE_13__.getCodeBlockFromMessage)(lastAIMessage.message);
2315
+ const aiGeneratedCode = (0,_utils_strings__WEBPACK_IMPORTED_MODULE_14__.getCodeBlockFromMessage)(lastAIMessage.message);
2241
2316
  if (!aiGeneratedCode) {
2242
2317
  return;
2243
2318
  }
@@ -2246,10 +2321,10 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
2246
2321
  // Write to the cell that has the code diffs
2247
2322
  writeCodeToCellAndTurnOffDiffs(aiGeneratedCode, targetCellID);
2248
2323
  // Focus on the active cell after the code is written
2249
- const targetCell = (0,_utils_notebook__WEBPACK_IMPORTED_MODULE_11__.getCellByID)(notebookTracker, targetCellID);
2324
+ const targetCell = (0,_utils_notebook__WEBPACK_IMPORTED_MODULE_12__.getCellByID)(notebookTracker, targetCellID);
2250
2325
  if (targetCell) {
2251
2326
  // Make the target cell the active cell
2252
- (0,_utils_notebook__WEBPACK_IMPORTED_MODULE_11__.setActiveCellByID)(notebookTracker, targetCellID);
2327
+ (0,_utils_notebook__WEBPACK_IMPORTED_MODULE_12__.setActiveCellByID)(notebookTracker, targetCellID);
2253
2328
  // Focus on the active cell
2254
2329
  targetCell.activate();
2255
2330
  }
@@ -2274,7 +2349,7 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
2274
2349
  updateCodeCellsExtensions(undefined);
2275
2350
  cellStateBeforeDiff.current = undefined;
2276
2351
  if (codeCellID !== undefined) {
2277
- (0,_utils_notebook__WEBPACK_IMPORTED_MODULE_11__.writeCodeToCellByID)(notebookTracker, code, codeCellID);
2352
+ (0,_utils_notebook__WEBPACK_IMPORTED_MODULE_12__.writeCodeToCellByID)(notebookTracker, code, codeCellID);
2278
2353
  updateCellToolbarButtons();
2279
2354
  }
2280
2355
  };
@@ -2285,17 +2360,17 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
2285
2360
  the first time we create the chat. Registering the command when it is already created causes
2286
2361
  errors.
2287
2362
  */
2288
- app.commands.addCommand(_commands__WEBPACK_IMPORTED_MODULE_17__.COMMAND_MITO_AI_PREVIEW_LATEST_CODE, {
2363
+ app.commands.addCommand(_commands__WEBPACK_IMPORTED_MODULE_18__.COMMAND_MITO_AI_PREVIEW_LATEST_CODE, {
2289
2364
  execute: () => {
2290
2365
  previewAICodeToActiveCell();
2291
2366
  }
2292
2367
  });
2293
- app.commands.addCommand(_commands__WEBPACK_IMPORTED_MODULE_17__.COMMAND_MITO_AI_APPLY_LATEST_CODE, {
2368
+ app.commands.addCommand(_commands__WEBPACK_IMPORTED_MODULE_18__.COMMAND_MITO_AI_APPLY_LATEST_CODE, {
2294
2369
  execute: () => {
2295
2370
  acceptAICode();
2296
2371
  }
2297
2372
  });
2298
- app.commands.addCommand(_commands__WEBPACK_IMPORTED_MODULE_17__.COMMAND_MITO_AI_REJECT_LATEST_CODE, {
2373
+ app.commands.addCommand(_commands__WEBPACK_IMPORTED_MODULE_18__.COMMAND_MITO_AI_REJECT_LATEST_CODE, {
2299
2374
  execute: () => {
2300
2375
  rejectAICode();
2301
2376
  }
@@ -2304,19 +2379,19 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
2304
2379
  Add a new command to the JupyterLab command registry that sends the current chat message.
2305
2380
  We use this to automatically send the message when the user adds an error to the chat.
2306
2381
  */
2307
- app.commands.addCommand(_commands__WEBPACK_IMPORTED_MODULE_17__.COMMAND_MITO_AI_SEND_DEBUG_ERROR_MESSAGE, {
2382
+ app.commands.addCommand(_commands__WEBPACK_IMPORTED_MODULE_18__.COMMAND_MITO_AI_SEND_DEBUG_ERROR_MESSAGE, {
2308
2383
  execute: async (args) => {
2309
2384
  if (args === null || args === void 0 ? void 0 : args.input) {
2310
2385
  await sendSmartDebugMessage(args.input.toString());
2311
2386
  }
2312
2387
  }
2313
2388
  });
2314
- app.commands.addCommand(_commands__WEBPACK_IMPORTED_MODULE_17__.COMMAND_MITO_AI_SEND_EXPLAIN_CODE_MESSAGE, {
2389
+ app.commands.addCommand(_commands__WEBPACK_IMPORTED_MODULE_18__.COMMAND_MITO_AI_SEND_EXPLAIN_CODE_MESSAGE, {
2315
2390
  execute: async () => {
2316
2391
  await sendExplainCodeMessage();
2317
2392
  }
2318
2393
  });
2319
- app.commands.addCommand(_commands__WEBPACK_IMPORTED_MODULE_17__.COMMAND_MITO_AI_SEND_AGENT_MESSAGE, {
2394
+ app.commands.addCommand(_commands__WEBPACK_IMPORTED_MODULE_18__.COMMAND_MITO_AI_SEND_AGENT_MESSAGE, {
2320
2395
  execute: async (args) => {
2321
2396
  if (args === null || args === void 0 ? void 0 : args.input) {
2322
2397
  // Make sure we're in agent mode
@@ -2335,7 +2410,7 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
2335
2410
  /*
2336
2411
  Register the code cell toolbar buttons for accepting and rejecting code.
2337
2412
  */
2338
- app.commands.addCommand(_commands__WEBPACK_IMPORTED_MODULE_17__.COMMAND_MITO_AI_CELL_TOOLBAR_ACCEPT_CODE, {
2413
+ app.commands.addCommand(_commands__WEBPACK_IMPORTED_MODULE_18__.COMMAND_MITO_AI_CELL_TOOLBAR_ACCEPT_CODE, {
2339
2414
  label: `Accept ${operatingSystem === 'mac' ? '⌘Y' : 'Ctrl+Y'}`,
2340
2415
  className: 'text-button-mito-ai button-base button-green',
2341
2416
  caption: 'Accept Code',
@@ -2353,7 +2428,7 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
2353
2428
  }
2354
2429
  }
2355
2430
  });
2356
- app.commands.addCommand(_commands__WEBPACK_IMPORTED_MODULE_17__.COMMAND_MITO_AI_CELL_TOOLBAR_REJECT_CODE, {
2431
+ app.commands.addCommand(_commands__WEBPACK_IMPORTED_MODULE_18__.COMMAND_MITO_AI_CELL_TOOLBAR_REJECT_CODE, {
2357
2432
  label: `Reject ${operatingSystem === 'mac' ? '⌘U' : 'Ctrl+U'}`,
2358
2433
  className: 'text-button-mito-ai button-base button-red',
2359
2434
  caption: 'Reject Code',
@@ -2374,13 +2449,13 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
2374
2449
  // Register keyboard shortcuts
2375
2450
  const accelYDisposable = app.commands.addKeyBinding({
2376
2451
  command: codeReviewStatus === 'chatPreview' ?
2377
- _commands__WEBPACK_IMPORTED_MODULE_17__.COMMAND_MITO_AI_PREVIEW_LATEST_CODE :
2378
- _commands__WEBPACK_IMPORTED_MODULE_17__.COMMAND_MITO_AI_APPLY_LATEST_CODE,
2452
+ _commands__WEBPACK_IMPORTED_MODULE_18__.COMMAND_MITO_AI_PREVIEW_LATEST_CODE :
2453
+ _commands__WEBPACK_IMPORTED_MODULE_18__.COMMAND_MITO_AI_APPLY_LATEST_CODE,
2379
2454
  keys: ['Accel Y'],
2380
2455
  selector: 'body',
2381
2456
  });
2382
2457
  const accelDDisposable = app.commands.addKeyBinding({
2383
- command: _commands__WEBPACK_IMPORTED_MODULE_17__.COMMAND_MITO_AI_REJECT_LATEST_CODE,
2458
+ command: _commands__WEBPACK_IMPORTED_MODULE_18__.COMMAND_MITO_AI_REJECT_LATEST_CODE,
2384
2459
  keys: ['Accel U'],
2385
2460
  selector: 'body',
2386
2461
  preventDefault: true,
@@ -2397,8 +2472,8 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
2397
2472
  // Without this, the user needs to take some action, like switching to a different cell
2398
2473
  // and then switching back in order for the Jupyter to re-evaluate if it should
2399
2474
  // show the toolbar buttons.
2400
- app.commands.notifyCommandChanged(_commands__WEBPACK_IMPORTED_MODULE_17__.COMMAND_MITO_AI_CELL_TOOLBAR_ACCEPT_CODE);
2401
- app.commands.notifyCommandChanged(_commands__WEBPACK_IMPORTED_MODULE_17__.COMMAND_MITO_AI_CELL_TOOLBAR_REJECT_CODE);
2475
+ app.commands.notifyCommandChanged(_commands__WEBPACK_IMPORTED_MODULE_18__.COMMAND_MITO_AI_CELL_TOOLBAR_ACCEPT_CODE);
2476
+ app.commands.notifyCommandChanged(_commands__WEBPACK_IMPORTED_MODULE_18__.COMMAND_MITO_AI_CELL_TOOLBAR_REJECT_CODE);
2402
2477
  };
2403
2478
  // Create a WeakMap to store compartments per code cell
2404
2479
  const codeDiffStripesCompartments = react__WEBPACK_IMPORTED_MODULE_2___default().useRef(new WeakMap());
@@ -2413,6 +2488,8 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
2413
2488
  notebook.widgets.forEach((cell, index) => {
2414
2489
  if (cell.model.type === 'code') {
2415
2490
  const isActiveCodeCell = activeCellIndex === index;
2491
+ // TODO: Instead of casting, we should rely on the type system to make
2492
+ // sure we're using the correct types!
2416
2493
  const codeCell = cell;
2417
2494
  const cmEditor = codeCell.editor;
2418
2495
  const editorView = cmEditor === null || cmEditor === void 0 ? void 0 : cmEditor.editor;
@@ -2424,13 +2501,13 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
2424
2501
  codeDiffStripesCompartments.current.set(codeCell, compartment);
2425
2502
  // Apply the initial configuration
2426
2503
  editorView.dispatch({
2427
- effects: _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.StateEffect.appendConfig.of(compartment.of(unifiedDiffLines !== undefined && isActiveCodeCell ? (0,_CodeDiffDisplay__WEBPACK_IMPORTED_MODULE_18__.codeDiffStripesExtension)({ unifiedDiffLines: unifiedDiffLines }) : [])),
2504
+ effects: _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.StateEffect.appendConfig.of(compartment.of(unifiedDiffLines !== undefined && isActiveCodeCell ? (0,_CodeDiffDisplay__WEBPACK_IMPORTED_MODULE_19__.codeDiffStripesExtension)({ unifiedDiffLines: unifiedDiffLines }) : [])),
2428
2505
  });
2429
2506
  }
2430
2507
  else {
2431
2508
  // Reconfigure the compartment
2432
2509
  editorView.dispatch({
2433
- effects: compartment.reconfigure(unifiedDiffLines !== undefined && isActiveCodeCell ? (0,_CodeDiffDisplay__WEBPACK_IMPORTED_MODULE_18__.codeDiffStripesExtension)({ unifiedDiffLines: unifiedDiffLines }) : []),
2510
+ effects: compartment.reconfigure(unifiedDiffLines !== undefined && isActiveCodeCell ? (0,_CodeDiffDisplay__WEBPACK_IMPORTED_MODULE_19__.codeDiffStripesExtension)({ unifiedDiffLines: unifiedDiffLines }) : []),
2434
2511
  });
2435
2512
  }
2436
2513
  }
@@ -2444,16 +2521,16 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
2444
2521
  return (react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "chat-taskpane" },
2445
2522
  react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "chat-taskpane-header" },
2446
2523
  react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "chat-taskpane-header-left" },
2447
- react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_components_IconButton__WEBPACK_IMPORTED_MODULE_19__["default"], { icon: react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_6__.settingsIcon.react, null), title: "Mito AI Settings", onClick: () => {
2448
- void app.commands.execute(_SettingsManager_SettingsManagerPlugin__WEBPACK_IMPORTED_MODULE_20__.COMMAND_MITO_AI_SETTINGS);
2524
+ react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_components_IconButton__WEBPACK_IMPORTED_MODULE_20__["default"], { icon: react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_6__.settingsIcon.react, null), title: "Mito AI Settings", onClick: () => {
2525
+ void app.commands.execute(_SettingsManager_SettingsManagerPlugin__WEBPACK_IMPORTED_MODULE_21__.COMMAND_MITO_AI_SETTINGS);
2449
2526
  } })),
2450
2527
  react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "chat-taskpane-header-right" },
2451
- react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_components_IconButton__WEBPACK_IMPORTED_MODULE_19__["default"], { icon: react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_6__.addIcon.react, null), title: "Start New Chat", onClick: async () => { await startNewChat(); } }),
2452
- react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_components_DropdownMenu__WEBPACK_IMPORTED_MODULE_21__["default"], { trigger: react__WEBPACK_IMPORTED_MODULE_2___default().createElement("button", { className: "icon-button", title: "Chat Threads", onClick: fetchChatThreads },
2528
+ react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_components_IconButton__WEBPACK_IMPORTED_MODULE_20__["default"], { icon: react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_6__.addIcon.react, null), title: "Start New Chat", onClick: async () => { await startNewChat(); } }),
2529
+ react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_components_DropdownMenu__WEBPACK_IMPORTED_MODULE_22__["default"], { trigger: react__WEBPACK_IMPORTED_MODULE_2___default().createElement("button", { className: "icon-button", title: "Chat Threads", onClick: fetchChatThreads },
2453
2530
  react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_6__.historyIcon.react, null)), items: chatThreads.length > 0
2454
2531
  ? chatThreads.map(thread => ({
2455
2532
  label: thread.name,
2456
- primaryIcon: activeThreadIdRef.current === thread.thread_id ? _icons__WEBPACK_IMPORTED_MODULE_22__.OpenIndicatorLabIcon.react : undefined,
2533
+ primaryIcon: activeThreadIdRef.current === thread.thread_id ? _icons__WEBPACK_IMPORTED_MODULE_23__.OpenIndicatorLabIcon.react : undefined,
2457
2534
  onClick: () => fetchChatHistoryAndSetActiveThread(thread.thread_id),
2458
2535
  secondaryActions: [
2459
2536
  {
@@ -2472,24 +2549,24 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
2472
2549
  displayOptimizedChatHistory.length === 0 &&
2473
2550
  react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "chat-empty-message" },
2474
2551
  react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { style: { margin: '0 auto 8px', display: 'block', textAlign: 'center' } },
2475
- react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_icons_MitoLogo__WEBPACK_IMPORTED_MODULE_23__["default"], { width: "60", height: "30" })),
2552
+ react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_icons_MitoLogo__WEBPACK_IMPORTED_MODULE_24__["default"], { width: "60", height: "30" })),
2476
2553
  react__WEBPACK_IMPORTED_MODULE_2___default().createElement("span", { style: { display: 'block', textAlign: 'center', fontWeight: 'bold', fontSize: '20px', marginBottom: '15px' } }, "Data Copilot"),
2477
- react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_CTACarousel__WEBPACK_IMPORTED_MODULE_24__["default"], { app: app })),
2554
+ react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_CTACarousel__WEBPACK_IMPORTED_MODULE_25__["default"], { app: app })),
2478
2555
  displayOptimizedChatHistory.map((displayOptimizedChat, index) => {
2479
- return (react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_ChatMessage_ChatMessage__WEBPACK_IMPORTED_MODULE_25__["default"], { key: index, message: displayOptimizedChat.message, promptType: displayOptimizedChat.promptType, messageType: displayOptimizedChat.type, agentResponse: displayOptimizedChat.agentResponse, codeCellID: displayOptimizedChat.codeCellID, mitoAIConnectionError: displayOptimizedChat.type === 'connection error', mitoAIConnectionErrorType: displayOptimizedChat.mitoAIConnectionErrorType || null, messageIndex: index, notebookTracker: notebookTracker, renderMimeRegistry: renderMimeRegistry, app: app, isLastAiMessage: index === lastAIMessagesIndex, isLastMessage: index === displayOptimizedChatHistory.length - 1, operatingSystem: operatingSystem, previewAICode: previewAICodeToActiveCell, acceptAICode: acceptAICode, rejectAICode: rejectAICode, onUpdateMessage: handleUpdateMessage, contextManager: contextManager, codeReviewStatus: codeReviewStatus, setNextSteps: setNextSteps }));
2556
+ return (react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_ChatMessage_ChatMessage__WEBPACK_IMPORTED_MODULE_26__["default"], { key: index, message: displayOptimizedChat.message, promptType: displayOptimizedChat.promptType, messageType: displayOptimizedChat.type, agentResponse: displayOptimizedChat.agentResponse, codeCellID: displayOptimizedChat.codeCellID, mitoAIConnectionError: displayOptimizedChat.type === 'connection error', mitoAIConnectionErrorType: displayOptimizedChat.mitoAIConnectionErrorType || null, messageIndex: index, notebookTracker: notebookTracker, renderMimeRegistry: renderMimeRegistry, app: app, isLastAiMessage: index === lastAIMessagesIndex, isLastMessage: index === displayOptimizedChatHistory.length - 1, operatingSystem: operatingSystem, previewAICode: previewAICodeToActiveCell, acceptAICode: acceptAICode, rejectAICode: rejectAICode, onUpdateMessage: handleUpdateMessage, contextManager: contextManager, codeReviewStatus: codeReviewStatus, setNextSteps: setNextSteps, agentModeEnabled: agentModeEnabled }));
2480
2557
  }).filter(message => message !== null),
2481
2558
  loadingAIResponse &&
2482
2559
  react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "chat-loading-message" },
2483
2560
  "Thinking ",
2484
- react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_components_LoadingDots__WEBPACK_IMPORTED_MODULE_26__["default"], null)),
2561
+ react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_components_LoadingDots__WEBPACK_IMPORTED_MODULE_27__["default"], null)),
2485
2562
  hasCheckpoint &&
2486
2563
  agentModeEnabled &&
2487
2564
  agentExecutionStatus === 'idle' &&
2488
2565
  displayOptimizedChatHistory.length > 0 && (react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: 'message message-assistant-chat' },
2489
- react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_components_TextAndIconButton__WEBPACK_IMPORTED_MODULE_27__["default"], { text: "Revert changes", icon: _icons_UndoIcon__WEBPACK_IMPORTED_MODULE_28__["default"], title: "Revert changes", onClick: () => (0,_utils_checkpoint__WEBPACK_IMPORTED_MODULE_12__.restoreCheckpoint)(app, notebookTracker, setHasCheckpoint, getDuplicateChatHistoryManager, setChatHistoryManager), variant: "gray", width: "fit-contents", iconPosition: "left" }),
2566
+ react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_components_TextAndIconButton__WEBPACK_IMPORTED_MODULE_28__["default"], { text: "Revert changes", icon: _icons_UndoIcon__WEBPACK_IMPORTED_MODULE_29__["default"], title: "Revert changes", onClick: () => (0,_utils_checkpoint__WEBPACK_IMPORTED_MODULE_13__.restoreCheckpoint)(app, notebookTracker, setHasCheckpoint, getDuplicateChatHistoryManager, setChatHistoryManager), variant: "gray", width: "fit-contents", iconPosition: "left" }),
2490
2567
  react__WEBPACK_IMPORTED_MODULE_2___default().createElement("p", { className: "text-muted text-sm" }, "Undo the most recent changes made by the agent")))),
2491
2568
  displayOptimizedChatHistory.length === 0 && (react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "suggestions-container" },
2492
- react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_ChatMessage_ScrollableSuggestions__WEBPACK_IMPORTED_MODULE_29__["default"], { onSelectSuggestion: (prompt) => {
2569
+ react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_ChatMessage_ScrollableSuggestions__WEBPACK_IMPORTED_MODULE_30__["default"], { onSelectSuggestion: (prompt) => {
2493
2570
  if (agentModeEnabled) {
2494
2571
  void startAgentExecution(prompt);
2495
2572
  }
@@ -2498,15 +2575,15 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
2498
2575
  }
2499
2576
  } }))),
2500
2577
  react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: `connected-input-container ${nextSteps.length > 0 ? 'has-next-steps' : ''}` },
2501
- nextSteps.length > 0 && (react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_components_NextStepsPills__WEBPACK_IMPORTED_MODULE_30__["default"], { nextSteps: nextSteps, onSelectNextStep: agentModeEnabled ? startAgentExecution : sendChatInputMessage, displayedNextStepsIfAvailable: displayedNextStepsIfAvailable, setDisplayedNextStepsIfAvailable: setDisplayedNextStepsIfAvailable })),
2502
- react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_ChatMessage_ChatInput__WEBPACK_IMPORTED_MODULE_31__["default"], { initialContent: '', placeholder: agentExecutionStatus === 'working' ? 'Agent is working...' :
2578
+ nextSteps.length > 0 && (react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_components_NextStepsPills__WEBPACK_IMPORTED_MODULE_31__["default"], { nextSteps: nextSteps, onSelectNextStep: agentModeEnabled ? startAgentExecution : sendChatInputMessage, displayedNextStepsIfAvailable: displayedNextStepsIfAvailable, setDisplayedNextStepsIfAvailable: setDisplayedNextStepsIfAvailable })),
2579
+ react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_ChatMessage_ChatInput__WEBPACK_IMPORTED_MODULE_32__["default"], { initialContent: '', placeholder: agentExecutionStatus === 'working' ? 'Agent is working...' :
2503
2580
  agentExecutionStatus === 'stopping' ? 'Agent is stopping...' :
2504
2581
  agentModeEnabled ? 'Ask agent to do anything' :
2505
2582
  displayOptimizedChatHistory.length < 2 ? `Ask question (${operatingSystem === 'mac' ? '⌘' : 'Ctrl'}E), @ to mention`
2506
2583
  : `Ask followup (${operatingSystem === 'mac' ? '⌘' : 'Ctrl'}E), @ to mention`, onSave: agentModeEnabled ? startAgentExecution : sendChatInputMessage, onCancel: undefined, isEditing: false, contextManager: contextManager, notebookTracker: notebookTracker, renderMimeRegistry: renderMimeRegistry, agentModeEnabled: agentModeEnabled })),
2507
2584
  agentExecutionStatus !== 'working' && agentExecutionStatus !== 'stopping' && (react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "chat-controls" },
2508
2585
  react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "chat-controls-left" },
2509
- react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_components_ToggleButton__WEBPACK_IMPORTED_MODULE_32__["default"], { leftText: "Chat", leftTooltip: "Chat mode suggests an edit to the active cell and let's you decide to accept or reject it.", rightText: "Agent", rightTooltip: "Agent mode writes and executes code until it's finished your request.", isLeftSelected: !agentModeEnabled, onChange: async (isLeftSelected) => {
2586
+ react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_components_ToggleButton__WEBPACK_IMPORTED_MODULE_33__["default"], { leftText: "Chat", leftTooltip: "Chat mode suggests an edit to the active cell and let's you decide to accept or reject it.", rightText: "Agent", rightTooltip: "Agent mode writes and executes code until it's finished your request.", isLeftSelected: !agentModeEnabled, onChange: async (isLeftSelected) => {
2510
2587
  await startNewChat(); // TODO: delete thread instead of starting new chat
2511
2588
  setAgentModeEnabled(!isLeftSelected);
2512
2589
  // Clear agent checkpoint when switching modes
@@ -2541,7 +2618,7 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
2541
2618
  " \u23CE"))),
2542
2619
  (agentExecutionStatus === 'working' || agentExecutionStatus === 'stopping') && (react__WEBPACK_IMPORTED_MODULE_2___default().createElement("button", { className: "button-base button-red stop-agent-button", onClick: markAgentForStopping, disabled: agentExecutionStatus === 'stopping', "data-testid": "stop-agent-button" }, agentExecutionStatus === 'stopping' ? (react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "stop-agent-button-content" },
2543
2620
  "Stopping",
2544
- react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_components_LoadingCircle__WEBPACK_IMPORTED_MODULE_33__["default"], null),
2621
+ react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_components_LoadingCircle__WEBPACK_IMPORTED_MODULE_34__["default"], null),
2545
2622
  " ")) : ('Stop Agent')))));
2546
2623
  };
2547
2624
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ChatTaskpane);
@@ -6434,6 +6511,31 @@ const AcceptIcon = () => (react__WEBPACK_IMPORTED_MODULE_0___default().createEle
6434
6511
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (AcceptIcon);
6435
6512
 
6436
6513
 
6514
+ /***/ }),
6515
+
6516
+ /***/ "./lib/icons/CodeIcon.js":
6517
+ /*!*******************************!*\
6518
+ !*** ./lib/icons/CodeIcon.js ***!
6519
+ \*******************************/
6520
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
6521
+
6522
+ __webpack_require__.r(__webpack_exports__);
6523
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6524
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
6525
+ /* harmony export */ });
6526
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "webpack/sharing/consume/default/react");
6527
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
6528
+ /*
6529
+ * Copyright (c) Saga Inc.
6530
+ * Distributed under the terms of the GNU Affero General Public License v3.0 License.
6531
+ */
6532
+
6533
+ const CodeIcon = () => (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", { width: "14", height: "14", viewBox: "0 0 20 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
6534
+ react__WEBPACK_IMPORTED_MODULE_0___default().createElement("g", { fill: "currentColor" },
6535
+ react__WEBPACK_IMPORTED_MODULE_0___default().createElement("path", { d: "M12.3162 0.0513449C12.8027 0.213518 13.0817 0.713391 12.9792 1.20347L12.9487 1.31624L8.94868 13.3162C8.77403 13.8402 8.20773 14.1233 7.68378 13.9487C7.19726 13.7865 6.91835 13.2866 7.02082 12.7966L7.05134 12.6838L11.0513 0.683791C11.226 0.159848 11.7923 -0.123303 12.3162 0.0513449ZM5.79999 3.40001C6.10587 3.80785 6.05312 4.37331 5.69568 4.71852L5.59998 4.8L2.667 7.00001L5.59998 9.20003C6.00782 9.50591 6.1155 10.0635 5.86902 10.495L5.79999 10.6C5.49411 11.0079 4.9365 11.1155 4.50501 10.869L4.40003 10.8L0.40003 7.8C-0.0977483 7.42667 -0.130987 6.7049 0.30042 6.28511L0.40003 6.20003L4.40003 3.20003C4.84186 2.86866 5.46862 2.95818 5.79999 3.40001ZM15.495 3.131L15.6 3.20003L19.6 6.20003C20.0978 6.57336 20.131 7.29513 19.6996 7.71492L19.6 7.8L15.6 10.8C15.1582 11.1314 14.5314 11.0418 14.2 10.6C13.8941 10.1922 13.9469 9.62672 14.3043 9.28151L14.4 9.20003L17.333 7.00001L14.4 4.8C13.9922 4.49412 13.8845 3.93654 14.131 3.50505L14.2 3.40001C14.5059 2.99217 15.0635 2.88452 15.495 3.131Z" }))));
6536
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CodeIcon);
6537
+
6538
+
6437
6539
  /***/ }),
6438
6540
 
6439
6541
  /***/ "./lib/icons/CopyIcon.js":
@@ -8615,6 +8717,70 @@ async function checkForUpdates(serverSettings) {
8615
8717
  }
8616
8718
 
8617
8719
 
8720
+ /***/ }),
8721
+
8722
+ /***/ "./lib/utils/waitForNotebookReady.js":
8723
+ /*!*******************************************!*\
8724
+ !*** ./lib/utils/waitForNotebookReady.js ***!
8725
+ \*******************************************/
8726
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8727
+
8728
+ __webpack_require__.r(__webpack_exports__);
8729
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8730
+ /* harmony export */ waitForNotebookReady: () => (/* binding */ waitForNotebookReady)
8731
+ /* harmony export */ });
8732
+ /*
8733
+ * Copyright (c) Saga Inc.
8734
+ * Distributed under the terms of the GNU Affero General Public License v3.0 License.
8735
+ */
8736
+ /*
8737
+ Wait for the notebook to be ready and attached.
8738
+ This is used to wait for the notebook to be ready before sending the first message.
8739
+ */
8740
+ const waitForNotebookReady = async (notebookTracker) => {
8741
+ const notebook = notebookTracker.currentWidget;
8742
+ if (!notebook) {
8743
+ console.warn('No active notebook found');
8744
+ return;
8745
+ }
8746
+ // Wait for notebook to be ready and attached
8747
+ await notebook.context.ready;
8748
+ // Wait for attachment
8749
+ if (!notebook.content.isAttached) {
8750
+ await new Promise(resolve => {
8751
+ const checkAttached = () => {
8752
+ if (notebook.content.isAttached) {
8753
+ resolve();
8754
+ }
8755
+ else {
8756
+ setTimeout(checkAttached, 100);
8757
+ }
8758
+ };
8759
+ checkAttached();
8760
+ });
8761
+ }
8762
+ // Wait for all cells to be created and ready
8763
+ await new Promise(resolve => {
8764
+ const checkCellsReady = () => {
8765
+ const cells = notebook.content.widgets;
8766
+ // In large notebooks, not all of the cells are attatched I think.
8767
+ // So instead we just wait for any cell to be ready and then give it
8768
+ // another 500ms to be ready.
8769
+ const anyCellReady = cells.some(cell => cell.isAttached && cell.model);
8770
+ if (anyCellReady && cells.length > 0) {
8771
+ resolve();
8772
+ }
8773
+ else {
8774
+ setTimeout(checkCellsReady, 100);
8775
+ }
8776
+ };
8777
+ checkCellsReady();
8778
+ });
8779
+ // Small buffer for final initialization
8780
+ await new Promise(resolve => setTimeout(resolve, 500));
8781
+ };
8782
+
8783
+
8618
8784
  /***/ }),
8619
8785
 
8620
8786
  /***/ "./lib/websockets/BaseWebsocketClient.js":
@@ -10066,9 +10232,36 @@ ___CSS_LOADER_EXPORT___.push([module.id, `/*
10066
10232
  background-color: transparent;
10067
10233
  }
10068
10234
 
10235
+ .agent-mode-toggle {
10236
+ cursor: pointer;
10237
+ padding: 10px;
10238
+ color: var(--jp-ui-font-color2);
10239
+ display: flex;
10240
+ justify-content: space-between;
10241
+ align-items: center;
10242
+ border: 1px solid var(--jp-ui-font-color2);
10243
+ border-radius: 5px;
10244
+ }
10245
+
10246
+ .agent-mode-toggle-content {
10247
+ display: flex;
10248
+ align-items: center;
10249
+ gap: 10px;
10250
+ }
10251
+
10252
+ .agent-mode-toggle.expanded {
10253
+ border: none;
10254
+ border-bottom: 1px solid var(--grey-300);
10255
+ border-radius: 5px 5px 0 0;
10256
+ }
10257
+
10258
+ .agent-mode-collapsed {
10259
+ border: none;
10260
+ }
10261
+
10069
10262
 
10070
10263
 
10071
- `, "",{"version":3,"sources":["webpack://./style/CodeBlock.css"],"names":[],"mappings":"AAAA;;;EAGE;;AAEF;EACE,aAAa;EACb,sBAAsB;EACtB,kBAAkB;EAClB,cAAc;;EAEd,8CAA8C;EAC9C,kBAAkB;EAClB,iCAAiC;EACjC,gBAAgB;AAClB;;AAEA;EACE,WAAW;EACX,gBAAgB;AAClB;;AAEA;EACE,aAAa;EACb,mBAAmB;EACnB,mBAAmB;EACnB,oBAAoB;;EAEpB,WAAW;EACX,2DAA2D;EAC3D,wCAAwC;EACxC,gBAAgB;AAClB;;AAEA;EACE,YAAY;EACZ,gBAAgB;EAChB,0CAA0C;AAC5C;;AAEA;EACE,2DAA2D;EAC3D,YAAY;EACZ,sCAAsC;EACtC,kBAAkB;;EAElB,gBAAgB;EAChB,0CAA0C;AAC5C;;AAEA;EACE,8CAA8C;EAC9C,+CAA+C;AACjD;;AAEA;EACE,YAAY;AACd;;AAEA;EACE,UAAU;EACV,gBAAgB;AAClB;;AAEA;EACE,aAAa;EACb,uBAAuB;EACvB,mBAAmB;EACnB,cAAc;EACd,WAAW;EACX,8CAA8C;EAC9C,iCAAiC;EACjC,eAAe;AACjB;;AAEA;EACE,qCAAqC;AACvC;;AAEA;EACE,cAAc;EACd,SAAS;AACX;;AAEA;EACE,6BAA6B;AAC/B","sourcesContent":["/*\n * Copyright (c) Saga Inc.\n * Distributed under the terms of the GNU Affero General Public License v3.0 License.\n */\n\n.code-block-container {\n display: flex;\n flex-direction: column;\n position: relative;\n margin: 10px 0;\n\n background-color: var(--chat-background-color);\n border-radius: 4px;\n border: 1px solid var(--grey-300);\n overflow: hidden;\n}\n\n.code-content {\n width: 100%;\n overflow-x: auto;\n}\n\n.code-block-toolbar {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: end;\n\n width: 100%;\n background-color: var(--chat-user-message-background-color);\n border-bottom: 1px solid var(--grey-300);\n font-size: 0.8em;\n}\n\n.code-location {\n flex-grow: 1;\n margin-left: 5px;\n color: var(--chat-user-message-font-color);\n}\n\n.code-block-toolbar button {\n background-color: var(--chat-user-message-background-color);\n border: none;\n border-left: 1px solid var(--grey-300);\n border-radius: 0px;\n\n font-size: 0.8em;\n color: var(--chat-user-message-font-color);\n}\n\n.code-block-toolbar button:hover {\n background-color: var(--chat-background-color);\n color: var(--chat-assistant-message-font-color);\n}\n\n.active-cell-code-block {\n opacity: 0.7;\n}\n\n.active-cell-code-block:hover {\n opacity: 1;\n transition: 0.3s;\n}\n\n.code-block-expand-button {\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 4px 0;\n width: 100%;\n background-color: var(--chat-background-color);\n transition: background-color 0.2s;\n cursor: pointer;\n}\n\n.code-block-expand-button:hover {\n background-color: rgba(0, 0, 0, 0.05);\n}\n\n.code-block-expand-button svg {\n display: block;\n margin: 0;\n}\n\n.code-block-expand-button .icon-button {\n background-color: transparent;\n}\n\n\n\n"],"sourceRoot":""}]);
10264
+ `, "",{"version":3,"sources":["webpack://./style/CodeBlock.css"],"names":[],"mappings":"AAAA;;;EAGE;;AAEF;EACE,aAAa;EACb,sBAAsB;EACtB,kBAAkB;EAClB,cAAc;;EAEd,8CAA8C;EAC9C,kBAAkB;EAClB,iCAAiC;EACjC,gBAAgB;AAClB;;AAEA;EACE,WAAW;EACX,gBAAgB;AAClB;;AAEA;EACE,aAAa;EACb,mBAAmB;EACnB,mBAAmB;EACnB,oBAAoB;;EAEpB,WAAW;EACX,2DAA2D;EAC3D,wCAAwC;EACxC,gBAAgB;AAClB;;AAEA;EACE,YAAY;EACZ,gBAAgB;EAChB,0CAA0C;AAC5C;;AAEA;EACE,2DAA2D;EAC3D,YAAY;EACZ,sCAAsC;EACtC,kBAAkB;;EAElB,gBAAgB;EAChB,0CAA0C;AAC5C;;AAEA;EACE,8CAA8C;EAC9C,+CAA+C;AACjD;;AAEA;EACE,YAAY;AACd;;AAEA;EACE,UAAU;EACV,gBAAgB;AAClB;;AAEA;EACE,aAAa;EACb,uBAAuB;EACvB,mBAAmB;EACnB,cAAc;EACd,WAAW;EACX,8CAA8C;EAC9C,iCAAiC;EACjC,eAAe;AACjB;;AAEA;EACE,qCAAqC;AACvC;;AAEA;EACE,cAAc;EACd,SAAS;AACX;;AAEA;EACE,6BAA6B;AAC/B;;AAEA;EACE,eAAe;EACf,aAAa;EACb,+BAA+B;EAC/B,aAAa;EACb,8BAA8B;EAC9B,mBAAmB;EACnB,0CAA0C;EAC1C,kBAAkB;AACpB;;AAEA;EACE,aAAa;EACb,mBAAmB;EACnB,SAAS;AACX;;AAEA;EACE,YAAY;EACZ,wCAAwC;EACxC,0BAA0B;AAC5B;;AAEA;EACE,YAAY;AACd","sourcesContent":["/*\n * Copyright (c) Saga Inc.\n * Distributed under the terms of the GNU Affero General Public License v3.0 License.\n */\n\n.code-block-container {\n display: flex;\n flex-direction: column;\n position: relative;\n margin: 10px 0;\n\n background-color: var(--chat-background-color);\n border-radius: 4px;\n border: 1px solid var(--grey-300);\n overflow: hidden;\n}\n\n.code-content {\n width: 100%;\n overflow-x: auto;\n}\n\n.code-block-toolbar {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: end;\n\n width: 100%;\n background-color: var(--chat-user-message-background-color);\n border-bottom: 1px solid var(--grey-300);\n font-size: 0.8em;\n}\n\n.code-location {\n flex-grow: 1;\n margin-left: 5px;\n color: var(--chat-user-message-font-color);\n}\n\n.code-block-toolbar button {\n background-color: var(--chat-user-message-background-color);\n border: none;\n border-left: 1px solid var(--grey-300);\n border-radius: 0px;\n\n font-size: 0.8em;\n color: var(--chat-user-message-font-color);\n}\n\n.code-block-toolbar button:hover {\n background-color: var(--chat-background-color);\n color: var(--chat-assistant-message-font-color);\n}\n\n.active-cell-code-block {\n opacity: 0.7;\n}\n\n.active-cell-code-block:hover {\n opacity: 1;\n transition: 0.3s;\n}\n\n.code-block-expand-button {\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 4px 0;\n width: 100%;\n background-color: var(--chat-background-color);\n transition: background-color 0.2s;\n cursor: pointer;\n}\n\n.code-block-expand-button:hover {\n background-color: rgba(0, 0, 0, 0.05);\n}\n\n.code-block-expand-button svg {\n display: block;\n margin: 0;\n}\n\n.code-block-expand-button .icon-button {\n background-color: transparent;\n}\n\n.agent-mode-toggle {\n cursor: pointer;\n padding: 10px;\n color: var(--jp-ui-font-color2);\n display: flex;\n justify-content: space-between;\n align-items: center;\n border: 1px solid var(--jp-ui-font-color2);\n border-radius: 5px;\n}\n\n.agent-mode-toggle-content {\n display: flex;\n align-items: center;\n gap: 10px;\n}\n\n.agent-mode-toggle.expanded {\n border: none;\n border-bottom: 1px solid var(--grey-300);\n border-radius: 5px 5px 0 0;\n}\n\n.agent-mode-collapsed {\n border: none;\n}\n\n\n\n"],"sourceRoot":""}]);
10072
10265
  // Exports
10073
10266
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
10074
10267
 
@@ -13845,4 +14038,4 @@ var update = _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js
13845
14038
  /***/ })
13846
14039
 
13847
14040
  }]);
13848
- //# sourceMappingURL=lib_index_js.43d516a828f1937a42bb.js.map
14041
+ //# sourceMappingURL=lib_index_js.8fc39671fbc9ba62e74b.js.map