@arbidocs/blocks 0.5.113 → 0.5.115
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/dist/{ConnectedCallDock-VCJ6Q7WE.cjs → ConnectedCallDock-WER7R222.cjs} +27 -27
- package/dist/{ConnectedCallDock-VCJ6Q7WE.cjs.map → ConnectedCallDock-WER7R222.cjs.map} +1 -1
- package/dist/{ConnectedCallRoom-BUI3ILJD.cjs → ConnectedCallRoom-T7OBQTYP.cjs} +19 -19
- package/dist/{ConnectedCallRoom-BUI3ILJD.cjs.map → ConnectedCallRoom-T7OBQTYP.cjs.map} +1 -1
- package/dist/{ConnectedMailInviteCard-P65MQM6J.cjs → ConnectedMailInviteCard-EINB3THA.cjs} +5 -5
- package/dist/{ConnectedMailInviteCard-P65MQM6J.cjs.map → ConnectedMailInviteCard-EINB3THA.cjs.map} +1 -1
- package/dist/{ConnectedNativeDocxComparison-JO2H4QIP.cjs → ConnectedNativeDocxComparison-YXMYJWXY.cjs} +24 -24
- package/dist/{ConnectedNativeDocxComparison-JO2H4QIP.cjs.map → ConnectedNativeDocxComparison-YXMYJWXY.cjs.map} +1 -1
- package/dist/{ConnectedProductionSetDialog-BSPM4NQC.cjs → ConnectedProductionSetDialog-LHB4VQWC.cjs} +9 -9
- package/dist/{ConnectedProductionSetDialog-BSPM4NQC.cjs.map → ConnectedProductionSetDialog-LHB4VQWC.cjs.map} +1 -1
- package/dist/{ConnectedStreamedWordArtifact-DMQEJFCA.cjs → ConnectedStreamedWordArtifact-2RTCHVPI.cjs} +24 -24
- package/dist/{ConnectedStreamedWordArtifact-DMQEJFCA.cjs.map → ConnectedStreamedWordArtifact-2RTCHVPI.cjs.map} +1 -1
- package/dist/{DocumentReviewCard-UBE2DVAC.cjs → DocumentReviewCard-ZSBZBGFK.cjs} +23 -23
- package/dist/{DocumentReviewCard-UBE2DVAC.cjs.map → DocumentReviewCard-ZSBZBGFK.cjs.map} +1 -1
- package/dist/{FilesViewerDialog-EBYRA3ZZ.cjs → FilesViewerDialog-I5QIHQZT.cjs} +55 -55
- package/dist/{FilesViewerDialog-EBYRA3ZZ.cjs.map → FilesViewerDialog-I5QIHQZT.cjs.map} +1 -1
- package/dist/{NativeDocxEditor-EJEIJDOC.cjs → NativeDocxEditor-H6TAEVGY.cjs} +6 -6
- package/dist/{NativeDocxEditor-EJEIJDOC.cjs.map → NativeDocxEditor-H6TAEVGY.cjs.map} +1 -1
- package/dist/{WorkspaceTableView-BO2OJO7A.cjs → WorkspaceTableView-J3C6VH4T.cjs} +9 -9
- package/dist/{WorkspaceTableView-BO2OJO7A.cjs.map → WorkspaceTableView-J3C6VH4T.cjs.map} +1 -1
- package/dist/agents/index.cjs +298 -298
- package/dist/{ai-EMNMGDAN.cjs → ai-IM4A23YT.cjs} +27 -27
- package/dist/ai-IM4A23YT.cjs.map +1 -0
- package/dist/calls/index.cjs +149 -149
- package/dist/chat/DraftingDocChip.d.ts +3 -1
- package/dist/chat/DraftingDocChip.js +7 -4
- package/dist/chat/DraftingDocChip.js.map +2 -2
- package/dist/chat/index.cjs +65 -65
- package/dist/{chunk-AJVZYRAJ.cjs → chunk-24EDG4PC.cjs} +68 -68
- package/dist/{chunk-AJVZYRAJ.cjs.map → chunk-24EDG4PC.cjs.map} +1 -1
- package/dist/{chunk-GTTDJMWX.cjs → chunk-325GVZE6.cjs} +6 -6
- package/dist/{chunk-GTTDJMWX.cjs.map → chunk-325GVZE6.cjs.map} +1 -1
- package/dist/{chunk-HM5L4SBC.cjs → chunk-3A7QWUAW.cjs} +3 -3
- package/dist/{chunk-HM5L4SBC.cjs.map → chunk-3A7QWUAW.cjs.map} +1 -1
- package/dist/{chunk-ET3NVY27.cjs → chunk-42TURFHF.cjs} +5 -5
- package/dist/{chunk-ET3NVY27.cjs.map → chunk-42TURFHF.cjs.map} +1 -1
- package/dist/{chunk-J2RXQVVF.cjs → chunk-4EK7TAP7.cjs} +5 -5
- package/dist/{chunk-J2RXQVVF.cjs.map → chunk-4EK7TAP7.cjs.map} +1 -1
- package/dist/{chunk-BHTEKYWJ.cjs → chunk-557MJ4IH.cjs} +23 -23
- package/dist/{chunk-BHTEKYWJ.cjs.map → chunk-557MJ4IH.cjs.map} +1 -1
- package/dist/{chunk-Y45VRNSZ.cjs → chunk-57NHXEU2.cjs} +4 -4
- package/dist/{chunk-Y45VRNSZ.cjs.map → chunk-57NHXEU2.cjs.map} +1 -1
- package/dist/{chunk-MUA5PJGX.cjs → chunk-5SKHK3BG.cjs} +4 -4
- package/dist/{chunk-MUA5PJGX.cjs.map → chunk-5SKHK3BG.cjs.map} +1 -1
- package/dist/{chunk-AFXDLDPU.cjs → chunk-5UYFLFNR.cjs} +4 -4
- package/dist/{chunk-AFXDLDPU.cjs.map → chunk-5UYFLFNR.cjs.map} +1 -1
- package/dist/{chunk-OTG5T5Z5.cjs → chunk-6UTKM5AB.cjs} +5 -5
- package/dist/{chunk-OTG5T5Z5.cjs.map → chunk-6UTKM5AB.cjs.map} +1 -1
- package/dist/{chunk-H5OLHP2U.cjs → chunk-7OPOPYV6.cjs} +3 -3
- package/dist/{chunk-H5OLHP2U.cjs.map → chunk-7OPOPYV6.cjs.map} +1 -1
- package/dist/{chunk-MQANCZOD.cjs → chunk-A3T3IC3K.cjs} +78 -78
- package/dist/{chunk-MQANCZOD.cjs.map → chunk-A3T3IC3K.cjs.map} +1 -1
- package/dist/{chunk-5VCID67B.cjs → chunk-B3LZITVF.cjs} +12 -12
- package/dist/{chunk-5VCID67B.cjs.map → chunk-B3LZITVF.cjs.map} +1 -1
- package/dist/{chunk-OZWYCRRK.cjs → chunk-BQ5RIWWT.cjs} +30 -30
- package/dist/{chunk-OZWYCRRK.cjs.map → chunk-BQ5RIWWT.cjs.map} +1 -1
- package/dist/chunk-CIHERNDO.cjs +18 -0
- package/dist/{chunk-L52N2LVE.cjs.map → chunk-CIHERNDO.cjs.map} +1 -1
- package/dist/{chunk-NP4EWPIP.cjs → chunk-CJYWHUZR.cjs} +6 -6
- package/dist/{chunk-NP4EWPIP.cjs.map → chunk-CJYWHUZR.cjs.map} +1 -1
- package/dist/{chunk-6W4X4EFI.cjs → chunk-CMGNRMPA.cjs} +5 -5
- package/dist/{chunk-6W4X4EFI.cjs.map → chunk-CMGNRMPA.cjs.map} +1 -1
- package/dist/{chunk-YONJRX6N.cjs → chunk-CPG7II4E.cjs} +28 -28
- package/dist/{chunk-YONJRX6N.cjs.map → chunk-CPG7II4E.cjs.map} +1 -1
- package/dist/{chunk-GGBNUDLK.cjs → chunk-CPR6EHG7.cjs} +70 -70
- package/dist/{chunk-GGBNUDLK.cjs.map → chunk-CPR6EHG7.cjs.map} +1 -1
- package/dist/{chunk-DZWIVRYP.cjs → chunk-DDIW4HLU.cjs} +36 -36
- package/dist/{chunk-DZWIVRYP.cjs.map → chunk-DDIW4HLU.cjs.map} +1 -1
- package/dist/{chunk-Z3VNKPPH.cjs → chunk-E3Y7RI3J.cjs} +4 -4
- package/dist/{chunk-Z3VNKPPH.cjs.map → chunk-E3Y7RI3J.cjs.map} +1 -1
- package/dist/{chunk-WT7CCCIN.cjs → chunk-GNX3FBBX.cjs} +4 -4
- package/dist/{chunk-WT7CCCIN.cjs.map → chunk-GNX3FBBX.cjs.map} +1 -1
- package/dist/{chunk-IIWJQEBC.cjs → chunk-H7PHOTX2.cjs} +10 -10
- package/dist/{chunk-IIWJQEBC.cjs.map → chunk-H7PHOTX2.cjs.map} +1 -1
- package/dist/{chunk-LQHXUSWZ.cjs → chunk-HQDR43JC.cjs} +6 -6
- package/dist/{chunk-LQHXUSWZ.cjs.map → chunk-HQDR43JC.cjs.map} +1 -1
- package/dist/{chunk-6LQN4BMX.cjs → chunk-IDCD5TEZ.cjs} +5 -5
- package/dist/{chunk-6LQN4BMX.cjs.map → chunk-IDCD5TEZ.cjs.map} +1 -1
- package/dist/{chunk-INEPPS4H.cjs → chunk-IW7CDJTA.cjs} +4 -4
- package/dist/{chunk-INEPPS4H.cjs.map → chunk-IW7CDJTA.cjs.map} +1 -1
- package/dist/{chunk-6YOZKXV6.cjs → chunk-JR2YSBD5.cjs} +4 -4
- package/dist/{chunk-6YOZKXV6.cjs.map → chunk-JR2YSBD5.cjs.map} +1 -1
- package/dist/{chunk-ZFKWCGA5.cjs → chunk-JV5TVUOU.cjs} +4 -4
- package/dist/{chunk-ZFKWCGA5.cjs.map → chunk-JV5TVUOU.cjs.map} +1 -1
- package/dist/{chunk-IFOGBMAE.cjs → chunk-KLMNCBLY.cjs} +9 -6
- package/dist/chunk-KLMNCBLY.cjs.map +1 -0
- package/dist/{chunk-JDI7E4RI.cjs → chunk-KTQOGT2L.cjs} +14 -14
- package/dist/{chunk-JDI7E4RI.cjs.map → chunk-KTQOGT2L.cjs.map} +1 -1
- package/dist/{chunk-OKHKJ5ML.cjs → chunk-KXIRVKCJ.cjs} +11 -11
- package/dist/{chunk-OKHKJ5ML.cjs.map → chunk-KXIRVKCJ.cjs.map} +1 -1
- package/dist/{chunk-4ED7CNOX.cjs → chunk-M6IKVKU5.cjs} +40 -3
- package/dist/chunk-M6IKVKU5.cjs.map +1 -0
- package/dist/{chunk-XKDUPU7B.cjs → chunk-NJCK6V6U.cjs} +4 -4
- package/dist/{chunk-XKDUPU7B.cjs.map → chunk-NJCK6V6U.cjs.map} +1 -1
- package/dist/{chunk-OVKJ7OVZ.cjs → chunk-NNUK5ZM7.cjs} +6 -6
- package/dist/{chunk-OVKJ7OVZ.cjs.map → chunk-NNUK5ZM7.cjs.map} +1 -1
- package/dist/{chunk-MJHIBCF7.cjs → chunk-NY3YUCOW.cjs} +4 -4
- package/dist/{chunk-MJHIBCF7.cjs.map → chunk-NY3YUCOW.cjs.map} +1 -1
- package/dist/{chunk-R4TP3VS3.cjs → chunk-OEREKAAP.cjs} +101 -101
- package/dist/{chunk-R4TP3VS3.cjs.map → chunk-OEREKAAP.cjs.map} +1 -1
- package/dist/{chunk-ENUZ35NR.cjs → chunk-P5AQYC4D.cjs} +4 -4
- package/dist/{chunk-ENUZ35NR.cjs.map → chunk-P5AQYC4D.cjs.map} +1 -1
- package/dist/{chunk-ZZZ6AZDR.cjs → chunk-P77YTTJ3.cjs} +4 -4
- package/dist/{chunk-ZZZ6AZDR.cjs.map → chunk-P77YTTJ3.cjs.map} +1 -1
- package/dist/{chunk-5I2VUNZR.cjs → chunk-PGJYD67F.cjs} +6 -6
- package/dist/{chunk-5I2VUNZR.cjs.map → chunk-PGJYD67F.cjs.map} +1 -1
- package/dist/{chunk-BYN7UMC5.cjs → chunk-PL7HUTM3.cjs} +8 -8
- package/dist/{chunk-BYN7UMC5.cjs.map → chunk-PL7HUTM3.cjs.map} +1 -1
- package/dist/{chunk-T7J352JD.cjs → chunk-QMIHLJMH.cjs} +6 -6
- package/dist/{chunk-T7J352JD.cjs.map → chunk-QMIHLJMH.cjs.map} +1 -1
- package/dist/{chunk-WJP6ICDM.cjs → chunk-R7CJEIA5.cjs} +4 -4
- package/dist/{chunk-WJP6ICDM.cjs.map → chunk-R7CJEIA5.cjs.map} +1 -1
- package/dist/{chunk-IE677C4I.cjs → chunk-SBWIA4PL.cjs} +21 -21
- package/dist/{chunk-IE677C4I.cjs.map → chunk-SBWIA4PL.cjs.map} +1 -1
- package/dist/{chunk-GVTKFVXH.cjs → chunk-SGYSDABK.cjs} +6 -6
- package/dist/{chunk-GVTKFVXH.cjs.map → chunk-SGYSDABK.cjs.map} +1 -1
- package/dist/{chunk-PIB7K7HI.cjs → chunk-T23UTIRI.cjs} +8 -8
- package/dist/{chunk-PIB7K7HI.cjs.map → chunk-T23UTIRI.cjs.map} +1 -1
- package/dist/{chunk-E4BLRF2L.cjs → chunk-TDO5UWXF.cjs} +5 -5
- package/dist/{chunk-E4BLRF2L.cjs.map → chunk-TDO5UWXF.cjs.map} +1 -1
- package/dist/{chunk-U5T46QCS.cjs → chunk-TKHCIHE2.cjs} +3 -3
- package/dist/chunk-TKHCIHE2.cjs.map +1 -0
- package/dist/{chunk-4IOYQLKG.cjs → chunk-TP5PGWIO.cjs} +3 -3
- package/dist/{chunk-4IOYQLKG.cjs.map → chunk-TP5PGWIO.cjs.map} +1 -1
- package/dist/{chunk-A4Z5CTLF.cjs → chunk-TT4IF52H.cjs} +39 -39
- package/dist/{chunk-A4Z5CTLF.cjs.map → chunk-TT4IF52H.cjs.map} +1 -1
- package/dist/{chunk-WIAWHETB.cjs → chunk-ULPTSXXO.cjs} +4 -4
- package/dist/{chunk-WIAWHETB.cjs.map → chunk-ULPTSXXO.cjs.map} +1 -1
- package/dist/{chunk-K5MYEWD5.cjs → chunk-UZHWXKS6.cjs} +7 -7
- package/dist/{chunk-K5MYEWD5.cjs.map → chunk-UZHWXKS6.cjs.map} +1 -1
- package/dist/{chunk-XW524KUX.cjs → chunk-VJCSEMXT.cjs} +4 -4
- package/dist/{chunk-XW524KUX.cjs.map → chunk-VJCSEMXT.cjs.map} +1 -1
- package/dist/{chunk-B5442TKX.cjs → chunk-VRK3IQAP.cjs} +4 -4
- package/dist/{chunk-B5442TKX.cjs.map → chunk-VRK3IQAP.cjs.map} +1 -1
- package/dist/{chunk-MYRKL3JO.cjs → chunk-VWTOIGX4.cjs} +4 -4
- package/dist/{chunk-MYRKL3JO.cjs.map → chunk-VWTOIGX4.cjs.map} +1 -1
- package/dist/{chunk-KZKGZ7IG.cjs → chunk-WAV762GP.cjs} +14 -14
- package/dist/{chunk-KZKGZ7IG.cjs.map → chunk-WAV762GP.cjs.map} +1 -1
- package/dist/{chunk-DMNX556N.cjs → chunk-WR2SF44W.cjs} +10 -10
- package/dist/{chunk-DMNX556N.cjs.map → chunk-WR2SF44W.cjs.map} +1 -1
- package/dist/{chunk-M2D4POJV.cjs → chunk-WXUU3COI.cjs} +9 -9
- package/dist/{chunk-M2D4POJV.cjs.map → chunk-WXUU3COI.cjs.map} +1 -1
- package/dist/{chunk-FGEBA3TL.cjs → chunk-X5LANJDZ.cjs} +26 -26
- package/dist/{chunk-FGEBA3TL.cjs.map → chunk-X5LANJDZ.cjs.map} +1 -1
- package/dist/{chunk-MY7Q3QE2.cjs → chunk-XKVPSOKP.cjs} +4 -4
- package/dist/{chunk-MY7Q3QE2.cjs.map → chunk-XKVPSOKP.cjs.map} +1 -1
- package/dist/{chunk-ONZOVO2B.cjs → chunk-Y24V6HPR.cjs} +24 -24
- package/dist/{chunk-ONZOVO2B.cjs.map → chunk-Y24V6HPR.cjs.map} +1 -1
- package/dist/{chunk-KGGSBJMU.cjs → chunk-YGXOKB5Z.cjs} +4 -4
- package/dist/{chunk-KGGSBJMU.cjs.map → chunk-YGXOKB5Z.cjs.map} +1 -1
- package/dist/{chunk-YAPXIANR.cjs → chunk-YVCOQHCE.cjs} +5 -5
- package/dist/{chunk-YAPXIANR.cjs.map → chunk-YVCOQHCE.cjs.map} +1 -1
- package/dist/{chunk-LCNKKSN3.cjs → chunk-ZTXQIIFV.cjs} +6 -6
- package/dist/{chunk-LCNKKSN3.cjs.map → chunk-ZTXQIIFV.cjs.map} +1 -1
- package/dist/citations/index.cjs +8 -8
- package/dist/connect/docx.cjs +28 -28
- package/dist/connect/index.cjs +1683 -1497
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/viewer.cjs +41 -41
- package/dist/connection/ConnectedWorkflowBuilder.d.ts +11 -0
- package/dist/connection/ConnectedWorkflowBuilder.js +42 -3
- package/dist/connection/ConnectedWorkflowBuilder.js.map +2 -2
- package/dist/connection/conversation/ConnectedConversation.js +143 -55
- package/dist/connection/conversation/ConnectedConversation.js.map +2 -2
- package/dist/connection/conversation/ConnectedConversationPage.js +36 -2
- package/dist/connection/conversation/ConnectedConversationPage.js.map +2 -2
- package/dist/connection/conversation/ConversationSendButton.d.ts +1 -0
- package/dist/connection/conversation/ConversationSendButton.js +3 -2
- package/dist/connection/conversation/ConversationSendButton.js.map +2 -2
- package/dist/connection/conversation/DocumentTargetNotice.d.ts +7 -0
- package/dist/connection/conversation/DocumentTargetNotice.js +45 -0
- package/dist/connection/conversation/DocumentTargetNotice.js.map +7 -0
- package/dist/connection/conversation/documentSwitch.d.ts +9 -0
- package/dist/connection/conversation/documentSwitch.js +40 -0
- package/dist/connection/conversation/documentSwitch.js.map +7 -0
- package/dist/connection/workflows/ConnectedWorkflowsPage.js +10 -3
- package/dist/connection/workflows/ConnectedWorkflowsPage.js.map +2 -2
- package/dist/connection/workflows/useWorkflowsPageState.d.ts +1 -0
- package/dist/connection/workflows/useWorkflowsPageState.js.map +2 -2
- package/dist/dashboards/index.cjs +23 -23
- package/dist/docx/NativeDocxEditor.js +3 -1
- package/dist/docx/NativeDocxEditor.js.map +2 -2
- package/dist/docx/index.cjs +38 -38
- package/dist/docx/signatures/SignatureFields.d.ts +2 -0
- package/dist/docx/signatures/SignatureFields.js +40 -2
- package/dist/docx/signatures/SignatureFields.js.map +2 -2
- package/dist/embed/index.cjs +50 -50
- package/dist/facts/index.cjs +44 -44
- package/dist/files/index.cjs +226 -226
- package/dist/home/index.cjs +32 -32
- package/dist/index.cjs +1694 -1694
- package/dist/provider/environment.d.ts +5 -0
- package/dist/provider/environment.js +1 -1
- package/dist/provider/environment.js.map +2 -2
- package/dist/provider/requests.d.ts +2 -0
- package/dist/provider/requests.js.map +2 -2
- package/dist/retrieval/index.cjs +4 -4
- package/dist/settings/index.cjs +147 -147
- package/dist/shell/index.cjs +91 -91
- package/dist/studio/index.cjs +42 -42
- package/dist/styles.css +1 -1
- package/dist/workflow-canvas/index.cjs +116 -74
- package/dist/workflow-canvas/index.cjs.map +1 -1
- package/dist/workspaces/index.cjs +27 -27
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +5 -5
- package/dist/ai-EMNMGDAN.cjs.map +0 -1
- package/dist/chunk-4ED7CNOX.cjs.map +0 -1
- package/dist/chunk-IFOGBMAE.cjs.map +0 -1
- package/dist/chunk-L52N2LVE.cjs +0 -18
- package/dist/chunk-U5T46QCS.cjs.map +0 -1
package/dist/connect/viewer.cjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkA3T3IC3K_cjs = require('../chunk-A3T3IC3K.cjs');
|
|
5
5
|
require('../chunk-4CIVQWAX.cjs');
|
|
6
|
-
var
|
|
7
|
-
require('../chunk-
|
|
8
|
-
require('../chunk-
|
|
9
|
-
require('../chunk-
|
|
10
|
-
require('../chunk-
|
|
11
|
-
require('../chunk-
|
|
6
|
+
var chunkPL7HUTM3_cjs = require('../chunk-PL7HUTM3.cjs');
|
|
7
|
+
require('../chunk-YGXOKB5Z.cjs');
|
|
8
|
+
require('../chunk-KXIRVKCJ.cjs');
|
|
9
|
+
require('../chunk-TT4IF52H.cjs');
|
|
10
|
+
require('../chunk-NJCK6V6U.cjs');
|
|
11
|
+
require('../chunk-NNUK5ZM7.cjs');
|
|
12
12
|
require('../chunk-223D4727.cjs');
|
|
13
13
|
require('../chunk-SNUBQMIS.cjs');
|
|
14
|
-
require('../chunk-
|
|
14
|
+
require('../chunk-X5LANJDZ.cjs');
|
|
15
15
|
require('../chunk-4ONPEVTP.cjs');
|
|
16
16
|
require('../chunk-V3KLUWQQ.cjs');
|
|
17
|
-
require('../chunk-
|
|
18
|
-
require('../chunk-
|
|
17
|
+
require('../chunk-P5AQYC4D.cjs');
|
|
18
|
+
require('../chunk-WAV762GP.cjs');
|
|
19
19
|
require('../chunk-YYPZOEED.cjs');
|
|
20
20
|
require('../chunk-GNZAH6UI.cjs');
|
|
21
21
|
require('../chunk-JH6JTI76.cjs');
|
|
@@ -24,72 +24,72 @@ require('../chunk-DTMBAFIL.cjs');
|
|
|
24
24
|
require('../chunk-ZESMRGDV.cjs');
|
|
25
25
|
require('../chunk-VCEX7COE.cjs');
|
|
26
26
|
require('../chunk-34HQO4ZQ.cjs');
|
|
27
|
-
require('../chunk-
|
|
28
|
-
require('../chunk-5VCID67B.cjs');
|
|
27
|
+
require('../chunk-B3LZITVF.cjs');
|
|
29
28
|
require('../chunk-MZZ3SBQL.cjs');
|
|
30
|
-
require('../chunk-
|
|
31
|
-
require('../chunk-
|
|
29
|
+
require('../chunk-NY3YUCOW.cjs');
|
|
30
|
+
require('../chunk-325GVZE6.cjs');
|
|
32
31
|
require('../chunk-ZPPMAL5P.cjs');
|
|
33
32
|
require('../chunk-ORELHENJ.cjs');
|
|
34
33
|
require('../chunk-NWNVWO6L.cjs');
|
|
35
34
|
require('../chunk-SK6HQ46Q.cjs');
|
|
36
35
|
require('../chunk-MNIQDXM6.cjs');
|
|
37
|
-
require('../chunk-
|
|
38
|
-
require('../chunk-
|
|
39
|
-
require('../chunk-
|
|
40
|
-
require('../chunk-Z2XZ2D4N.cjs');
|
|
41
|
-
require('../chunk-YZSQ7F5K.cjs');
|
|
42
|
-
require('../chunk-MCXS6X37.cjs');
|
|
43
|
-
require('../chunk-KQF7POTG.cjs');
|
|
44
|
-
require('../chunk-HM5L4SBC.cjs');
|
|
45
|
-
require('../chunk-75BNMCUX.cjs');
|
|
36
|
+
require('../chunk-E3Y7RI3J.cjs');
|
|
37
|
+
require('../chunk-VLCY46K6.cjs');
|
|
38
|
+
require('../chunk-3A7QWUAW.cjs');
|
|
46
39
|
require('../chunk-OEJQFPWO.cjs');
|
|
47
40
|
require('../chunk-OYXWQTHF.cjs');
|
|
48
41
|
require('../chunk-S237ORM3.cjs');
|
|
49
42
|
require('../chunk-II2OEXHW.cjs');
|
|
50
|
-
require('../chunk-
|
|
51
|
-
require('../chunk-WJP6ICDM.cjs');
|
|
43
|
+
require('../chunk-R7CJEIA5.cjs');
|
|
52
44
|
require('../chunk-3YEXZX4H.cjs');
|
|
53
45
|
require('../chunk-4PA6VCCR.cjs');
|
|
54
|
-
require('../chunk-
|
|
46
|
+
require('../chunk-WXUU3COI.cjs');
|
|
55
47
|
require('../chunk-AHDJXIUB.cjs');
|
|
56
48
|
require('../chunk-RL2HI6NP.cjs');
|
|
57
49
|
require('../chunk-6UZC4XVV.cjs');
|
|
58
|
-
require('../chunk-
|
|
59
|
-
require('../chunk-
|
|
60
|
-
require('../chunk-
|
|
61
|
-
require('../chunk-UDSHVNU3.cjs');
|
|
62
|
-
require('../chunk-ZFKWCGA5.cjs');
|
|
63
|
-
require('../chunk-IPSHAMO2.cjs');
|
|
50
|
+
require('../chunk-YVCOQHCE.cjs');
|
|
51
|
+
require('../chunk-JV5TVUOU.cjs');
|
|
52
|
+
require('../chunk-E7TE2WVT.cjs');
|
|
64
53
|
require('../chunk-EG7EJFUE.cjs');
|
|
65
54
|
require('../chunk-VG24E4JJ.cjs');
|
|
66
55
|
require('../chunk-U2FFG2B3.cjs');
|
|
67
56
|
require('../chunk-KKYNTWDU.cjs');
|
|
68
57
|
require('../chunk-M74FWYNL.cjs');
|
|
69
58
|
require('../chunk-VZOOGA47.cjs');
|
|
70
|
-
require('../chunk-
|
|
71
|
-
require('../chunk-
|
|
59
|
+
require('../chunk-HQDR43JC.cjs');
|
|
60
|
+
require('../chunk-JR2YSBD5.cjs');
|
|
72
61
|
require('../chunk-3YZKDCWY.cjs');
|
|
73
62
|
require('../chunk-SJSGSHIT.cjs');
|
|
74
|
-
require('../chunk-PPCATBOY.cjs');
|
|
75
63
|
require('../chunk-ZW6FPIFC.cjs');
|
|
76
|
-
require('../chunk-
|
|
64
|
+
require('../chunk-CT3SLXB7.cjs');
|
|
65
|
+
require('../chunk-DEXUL3T6.cjs');
|
|
66
|
+
require('../chunk-6WMMZLEV.cjs');
|
|
67
|
+
require('../chunk-Z2XZ2D4N.cjs');
|
|
68
|
+
require('../chunk-YZSQ7F5K.cjs');
|
|
69
|
+
require('../chunk-MCXS6X37.cjs');
|
|
70
|
+
require('../chunk-KQF7POTG.cjs');
|
|
71
|
+
require('../chunk-75BNMCUX.cjs');
|
|
72
|
+
require('../chunk-FX3K6LNZ.cjs');
|
|
73
|
+
require('../chunk-QGVOT7E4.cjs');
|
|
74
|
+
require('../chunk-QRAQZTJE.cjs');
|
|
75
|
+
require('../chunk-UDSHVNU3.cjs');
|
|
76
|
+
require('../chunk-IPSHAMO2.cjs');
|
|
77
|
+
require('../chunk-PPCATBOY.cjs');
|
|
78
|
+
require('../chunk-TKHCIHE2.cjs');
|
|
77
79
|
require('../chunk-JDFBEGQO.cjs');
|
|
78
|
-
require('../chunk-LJJJ6CYH.cjs');
|
|
79
|
-
require('../chunk-VLCY46K6.cjs');
|
|
80
|
-
require('../chunk-E7TE2WVT.cjs');
|
|
81
80
|
require('../chunk-ULWRNGGE.cjs');
|
|
81
|
+
require('../chunk-LJJJ6CYH.cjs');
|
|
82
82
|
require('../chunk-PLIF5CUV.cjs');
|
|
83
83
|
|
|
84
84
|
|
|
85
85
|
|
|
86
86
|
Object.defineProperty(exports, "ConnectedDocumentViewer", {
|
|
87
87
|
enumerable: true,
|
|
88
|
-
get: function () { return
|
|
88
|
+
get: function () { return chunkA3T3IC3K_cjs.ConnectedDocumentViewer; }
|
|
89
89
|
});
|
|
90
90
|
Object.defineProperty(exports, "ConnectedDocumentToolsProvider", {
|
|
91
91
|
enumerable: true,
|
|
92
|
-
get: function () { return
|
|
92
|
+
get: function () { return chunkPL7HUTM3_cjs.ConnectedDocumentToolsProvider; }
|
|
93
93
|
});
|
|
94
94
|
//# sourceMappingURL=viewer.cjs.map
|
|
95
95
|
//# sourceMappingURL=viewer.cjs.map
|
|
@@ -28,6 +28,17 @@ export interface ConnectedWorkflowBuilderLabels {
|
|
|
28
28
|
export declare const DEFAULT_CONNECTED_WORKFLOW_BUILDER_LABELS: ConnectedWorkflowBuilderLabels;
|
|
29
29
|
/** Where a new workflow starts: started by hand, one agent step to fill in. */
|
|
30
30
|
export declare function newWorkflowBuilderValue(): WorkflowBuilderValue;
|
|
31
|
+
/**
|
|
32
|
+
* Where "Schedule a task" starts: a workflow that repeats on a schedule, with one agent step whose
|
|
33
|
+
* prompt is the task, on the default recurrence (changed in the builder). It has no title: saved,
|
|
34
|
+
* it is named from the task's first words (`withTitleFromPrompt`). Every run is a thread.
|
|
35
|
+
*/
|
|
36
|
+
export declare function scheduledTaskBuilderValue(): WorkflowBuilderValue;
|
|
37
|
+
/**
|
|
38
|
+
* A workflow left without a title is named from its first agent step's prompt (its first words),
|
|
39
|
+
* so scheduled tasks don't all share one name. Others are returned as they are.
|
|
40
|
+
*/
|
|
41
|
+
export declare function withTitleFromPrompt(value: WorkflowBuilderValue): WorkflowBuilderValue;
|
|
31
42
|
/** Workspace events a workflow can start on (notification types), in plain words. */
|
|
32
43
|
export declare const DEFAULT_WORKFLOW_EVENT_KINDS: ({
|
|
33
44
|
value: "conversation_done";
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
import { Button } from "@arbidocs/react/ui";
|
|
15
15
|
import { Loader2, Play, Save } from "lucide-react";
|
|
16
16
|
import { mergeSkillWorkflows } from "../agents/index.js";
|
|
17
|
+
import { DEFAULT_RECURRENCE, buildRRule } from "../agents/tasks/rrule.js";
|
|
17
18
|
import { stepConfigProblems, validateWorkflowGraph, workflowSteps } from "../agents/workflows/run.js";
|
|
18
19
|
import { WorkflowBuilder } from "../workflow-canvas/WorkflowBuilder.js";
|
|
19
20
|
import {
|
|
@@ -63,6 +64,40 @@ function newWorkflowBuilderValue() {
|
|
|
63
64
|
trigger: DEFAULT_WORKFLOW_TRIGGER
|
|
64
65
|
};
|
|
65
66
|
}
|
|
67
|
+
function scheduledTaskBuilderValue() {
|
|
68
|
+
const value = newWorkflowBuilderValue();
|
|
69
|
+
return {
|
|
70
|
+
workflow: {
|
|
71
|
+
...value.workflow,
|
|
72
|
+
title: "",
|
|
73
|
+
run: {
|
|
74
|
+
kind: "steps",
|
|
75
|
+
steps: [
|
|
76
|
+
{
|
|
77
|
+
id: "work",
|
|
78
|
+
kind: "agent",
|
|
79
|
+
title: "The task",
|
|
80
|
+
run: { kind: "prompt", promptTemplate: "" }
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
trigger: { ...value.trigger, start: "repeat", rrule: buildRRule(DEFAULT_RECURRENCE) }
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
const TITLE_WORDS = 6;
|
|
89
|
+
function withTitleFromPrompt(value) {
|
|
90
|
+
if (value.workflow.title.trim()) return value;
|
|
91
|
+
const steps = value.workflow.run.kind === "steps" ? value.workflow.run.steps : [];
|
|
92
|
+
const prompt = steps.flatMap((s) => {
|
|
93
|
+
if (s.kind !== "agent") return [];
|
|
94
|
+
const { run } = s;
|
|
95
|
+
return run && "promptTemplate" in run ? [run.promptTemplate] : [];
|
|
96
|
+
})[0];
|
|
97
|
+
const words = (prompt ?? "").trim().split(/\s+/).filter(Boolean);
|
|
98
|
+
const title = words.slice(0, TITLE_WORDS).join(" ") + (words.length > TITLE_WORDS ? "\u2026" : "");
|
|
99
|
+
return { ...value, workflow: { ...value.workflow, title: title || "Scheduled task" } };
|
|
100
|
+
}
|
|
66
101
|
const DEFAULT_WORKFLOW_EVENT_KINDS = [
|
|
67
102
|
{ value: "conversation_done", label: "A task is marked done" },
|
|
68
103
|
{ value: "conversation_ready", label: "Work is ready for me" },
|
|
@@ -135,7 +170,9 @@ function ConnectedWorkflowBuilder({
|
|
|
135
170
|
const busy = !!pending || create.isPending || update.isPending || run.isPending;
|
|
136
171
|
const save = async () => {
|
|
137
172
|
if (!workspaceId) return void 0;
|
|
138
|
-
const
|
|
173
|
+
const named = withTitleFromPrompt(value);
|
|
174
|
+
const result = id ? await update.mutateAsync({ workflowId: id, patch: builderToWorkflowUpdate(named, options) }) : await create.mutateAsync(builderToWorkflowRequest(named, workspaceId, options));
|
|
175
|
+
if (named !== value) setValue(named);
|
|
139
176
|
setId(result.external_id);
|
|
140
177
|
setLoaded(result.external_id);
|
|
141
178
|
const { trigger } = value;
|
|
@@ -147,7 +184,7 @@ function ConnectedWorkflowBuilder({
|
|
|
147
184
|
await ensureWorkspaceOpen();
|
|
148
185
|
await grantAccess.mutateAsync({ agentExtId: agentId, workspaceId });
|
|
149
186
|
}
|
|
150
|
-
await onSaved?.(result.external_id,
|
|
187
|
+
await onSaved?.(result.external_id, named);
|
|
151
188
|
return result.external_id;
|
|
152
189
|
};
|
|
153
190
|
const attempt = async (andRun) => {
|
|
@@ -227,6 +264,8 @@ export {
|
|
|
227
264
|
ConnectedWorkflowBuilder,
|
|
228
265
|
DEFAULT_CONNECTED_WORKFLOW_BUILDER_LABELS,
|
|
229
266
|
DEFAULT_WORKFLOW_EVENT_KINDS,
|
|
230
|
-
newWorkflowBuilderValue
|
|
267
|
+
newWorkflowBuilderValue,
|
|
268
|
+
scheduledTaskBuilderValue,
|
|
269
|
+
withTitleFromPrompt
|
|
231
270
|
};
|
|
232
271
|
//# sourceMappingURL=ConnectedWorkflowBuilder.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/connection/ConnectedWorkflowBuilder.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * The workflow builder bound to the connection: it loads a saved workflow (or starts from the\n * host's value), offers the host's workflows and the user's skills as steps an agent can run, its\n * agents, the people, labels, documents, events and tasks a workflow can use, and saves the\n * workflow (its trigger and its steps) or runs it now. An unattended workflow that keeps standing\n * access gives its agent the workspace once saved. Every run is a work thread that runs the steps.\n * Saved and failed are told through the environment's `notify`. Exported from\n * `@arbidocs/blocks/workflow-canvas` (it brings the graph library).\n */\n\nimport { useEffect, useMemo, useState } from 'react'\nimport {\n useAgents,\n useCreateWorkflow,\n useGrantAgentAccess,\n useRunWorkflow,\n useWorkspaceUsers,\n useSkills,\n useUpdateWorkflow,\n useWorkflows,\n} from '@arbidocs/react'\nimport type { components } from '@arbidocs/client'\nimport { Button } from '@arbidocs/react/ui'\nimport { Loader2, Play, Save } from 'lucide-react'\nimport { mergeSkillWorkflows, type StepComposeOptions, type WorkflowDefinition } from '../agents'\nimport { stepConfigProblems, validateWorkflowGraph, workflowSteps } from '../agents/workflows/run'\nimport { WorkflowBuilder, type WorkflowBuilderProps } from '../workflow-canvas/WorkflowBuilder'\nimport {\n DEFAULT_WORKFLOW_TRIGGER,\n builderToWorkflowRequest,\n builderToWorkflowUpdate,\n declaredSignals,\n triggerProblem,\n workflowRecordToBuilder,\n type WorkflowBuilderValue,\n} from '../workflow-canvas/trigger'\nimport { useBlocksEnvironment } from '../provider/environment'\nimport { useConnectedWorkspace } from './ConnectionProvider'\nimport { useConnectedConversations, useConnectedTags, useListedDocuments } from './workspaceData'\n\nconst NO_WORKFLOWS: WorkflowDefinition[] = []\n\nexport interface ConnectedWorkflowBuilderLabels {\n save: string\n saving: string\n runNow: string\n /** The notification once saved. */\n saved: string\n needTrigger: string\n running: string\n /** Notified when saving (or the after-save step) fails without a message. */\n saveFailed: string\n /** Notified when \"Run now\" fails without a message. */\n runFailed: string\n /** A task (to start after) without a title. */\n untitledTask: string\n}\n\nexport const DEFAULT_CONNECTED_WORKFLOW_BUILDER_LABELS: ConnectedWorkflowBuilderLabels = {\n save: 'Save',\n saving: 'Saving\u2026',\n runNow: 'Run now',\n saved: 'Workflow saved',\n needTrigger: 'Finish setting when it starts.',\n running: 'Starting\u2026',\n saveFailed: 'Could not save the workflow',\n runFailed: 'Could not run the workflow',\n untitledTask: 'Untitled thread',\n}\n\n/** Where a new workflow starts: started by hand, one agent step to fill in. */\nexport function newWorkflowBuilderValue(): WorkflowBuilderValue {\n return {\n workflow: {\n id: 'new',\n title: 'New workflow',\n description: '',\n inputs: [],\n landing: 'chat',\n schedulable: false,\n run: {\n kind: 'steps',\n steps: [\n {\n id: 'work',\n kind: 'agent',\n title: 'Do the work',\n run: { kind: 'prompt', promptTemplate: '' },\n },\n ],\n },\n },\n trigger: DEFAULT_WORKFLOW_TRIGGER,\n }\n}\n\n/**\n * A workspace event a workflow can start on: a notification type (what the API's `event_kind` check\n * accepts), except those the workflow engine emits itself, which the API refuses as a trigger (422).\n */\ntype WorkflowEventKind = Exclude<components['schemas']['NotificationType'], 'workflow_failed'>\n\n/** Workspace events a workflow can start on (notification types), in plain words. */\nexport const DEFAULT_WORKFLOW_EVENT_KINDS = [\n { value: 'conversation_done', label: 'A task is marked done' },\n { value: 'conversation_ready', label: 'Work is ready for me' },\n { value: 'mention', label: 'Someone mentions me' },\n { value: 'workflow_completed', label: 'Another workflow finishes' },\n { value: 'workflow_signal', label: 'When a step signals' },\n // Filter on {\"language\": \"other\", \"wp_type\": \"source\"} to act on every non-English upload (e.g. Translate).\n { value: 'document_processed', label: 'A document finishes processing' },\n] satisfies Array<{ value: WorkflowEventKind; label: string }>\n\nexport interface ConnectedWorkflowBuilderProps\n extends\n Pick<StepComposeOptions, 'compose'>,\n Pick<\n WorkflowBuilderProps,\n | 'renderIcon'\n | 'labels'\n | 'canvasLabels'\n | 'inspectorLabels'\n | 'triggerLabels'\n | 'testId'\n | 'className'\n > {\n /** A saved workflow to edit (`wfl-\u2026`). */\n workflowId?: string\n /** Where a new workflow starts (e.g. a built-in journey). Default: one agent step. */\n initial?: WorkflowBuilderValue\n /**\n * Host workflows agent steps can run besides the user's skills (e.g. its built-ins with their own\n * forms); an uploaded skill of the same id is used instead (`mergeSkillWorkflows`).\n */\n workflows?: WorkflowDefinition[]\n eventKinds?: Array<{ value: string; label: string }>\n /**\n * Saved (created or updated, the agent's standing access granted): its id and the value saved.\n * It may return a promise for host setup that must finish first: \"Save\" waits for it before\n * telling saved, and \"Run now\" waits for it before running, and does not run if it rejects.\n */\n onSaved?: (workflowId: string, value: WorkflowBuilderValue) => void | Promise<void>\n /** A run started: its thread. Default: open it (the environment's `openConversation`). */\n onRun?: (conversationId: string | undefined) => void\n connectedLabels?: Partial<ConnectedWorkflowBuilderLabels>\n}\n\nexport function ConnectedWorkflowBuilder({\n workflowId,\n initial = newWorkflowBuilderValue(),\n workflows: hostWorkflows = NO_WORKFLOWS,\n eventKinds = DEFAULT_WORKFLOW_EVENT_KINDS,\n compose,\n onSaved,\n onRun,\n connectedLabels,\n testId = 'workflow-builder',\n ...builderProps\n}: ConnectedWorkflowBuilderProps) {\n const l = { ...DEFAULT_CONNECTED_WORKFLOW_BUILDER_LABELS, ...connectedLabels }\n const { notify, openConversation } = useBlocksEnvironment()\n const { workspaceId, live, ensureWorkspaceOpen } = useConnectedWorkspace()\n const members = useWorkspaceUsers(workspaceId ?? undefined, {\n enabled: live && !!workspaceId,\n beforeFetch: ensureWorkspaceOpen,\n })\n const { data: tagList } = useConnectedTags()\n const { data: docList } = useListedDocuments()\n const people = (members.data ?? []).map((m) => ({\n value: m.user.external_id,\n label: [m.user.given_name, m.user.family_name].filter(Boolean).join(' ') || m.user.email,\n }))\n const tagOptions = tagList.map((t) => ({ value: t.external_id, label: t.name }))\n const documentOptions = docList.map((d) => ({\n value: d.external_id,\n label: d.file_name ?? d.external_id,\n }))\n const saved = useWorkflows()\n const skills = useSkills()\n const agentsQuery = useAgents()\n const { data: conversations } = useConnectedConversations()\n const create = useCreateWorkflow()\n const update = useUpdateWorkflow()\n const run = useRunWorkflow()\n const grantAccess = useGrantAgentAccess()\n const [id, setId] = useState(workflowId)\n const [value, setValue] = useState<WorkflowBuilderValue>(initial)\n // Which button is working, and where it is: saving covers the host's after-save step too.\n const [pending, setPending] = useState<{ action: 'save' | 'run'; phase: 'saving' | 'running' }>()\n\n // A saved workflow opens as it was saved.\n const record = saved.data?.find((w) => w.external_id === id)\n const [loaded, setLoaded] = useState<string | undefined>(undefined)\n useEffect(() => {\n if (record && loaded !== record.external_id) {\n setValue(workflowRecordToBuilder(record))\n setLoaded(record.external_id)\n }\n }, [record, loaded])\n\n const workflows = useMemo(() => {\n const merged = mergeSkillWorkflows(hostWorkflows, skills.data ?? [])\n return [...merged.host, ...merged.skills]\n }, [hostWorkflows, skills.data])\n const agents = (agentsQuery.data ?? []).map((a) => ({\n id: a.external_id,\n label: a.given_name || a.email,\n }))\n const tasks = conversations\n .filter((c) => c.status && c.status !== 'done')\n .map((c) => ({ value: c.external_id, label: c.title || l.untitledTask }))\n const options = { resolveWorkflow: (wid: string) => workflows.find((w) => w.id === wid), compose }\n\n const problem =\n triggerProblem(value.trigger) ??\n (validateWorkflowGraph(workflowSteps(value.workflow)).length ||\n stepConfigProblems(workflowSteps(value.workflow)).length\n ? 'graph'\n : null)\n const busy = !!pending || create.isPending || update.isPending || run.isPending\n\n /**\n * Save; then, when unattended starts keep standing access, give the agent (the one picked, else\n * the one the server assigned) the workspace, so a run started next already has it; then the\n * host's after-save step. Throws if any of them fails.\n */\n const save = async (): Promise<string | undefined> => {\n if (!workspaceId) return undefined\n const result = id\n ? await update.mutateAsync({ workflowId: id, patch: builderToWorkflowUpdate(value, options) })\n : await create.mutateAsync(builderToWorkflowRequest(value, workspaceId, options))\n setId(result.external_id)\n setLoaded(result.external_id)\n const { trigger } = value\n const agentId = trigger.agentId || result.agent_ext_id\n // Standing access only: an expiring membership (an earlier \"Allow access\") is not, and a run\n // relying on it would park asking for access again. Granting upgrades it to standing.\n const hasStanding = (members.data ?? []).some(\n (m) => m.user.external_id === agentId && !m.is_temporary\n )\n if (trigger.start !== 'manual' && trigger.access === 'standing' && agentId && !hasStanding) {\n await ensureWorkspaceOpen()\n await grantAccess.mutateAsync({ agentExtId: agentId, workspaceId })\n }\n await onSaved?.(result.external_id, value)\n return result.external_id\n }\n\n const attempt = async (andRun: boolean) => {\n setPending({ action: andRun ? 'run' : 'save', phase: 'saving' })\n try {\n const savedId = await save()\n if (!savedId) return\n if (!andRun) {\n notify(l.saved, 'success')\n return\n }\n setPending({ action: 'run', phase: 'running' })\n const started = await run.mutateAsync(savedId)\n if (started.error) throw new Error(started.error)\n const conversationId = started.conversation_ext_id ?? undefined\n if (onRun) onRun(conversationId)\n else if (conversationId) openConversation(conversationId)\n } catch (e) {\n notify(\n e instanceof Error && e.message ? e.message : andRun ? l.runFailed : l.saveFailed,\n 'error'\n )\n } finally {\n setPending(undefined)\n }\n }\n\n return (\n <WorkflowBuilder\n {...builderProps}\n value={value}\n onChange={setValue}\n workflows={workflows}\n agents={agents}\n eventKinds={eventKinds}\n tasks={tasks}\n people={people}\n tags={tagOptions}\n documents={documentOptions}\n signals={declaredSignals(saved.data ?? [])}\n compose={compose}\n testId={testId}\n actions={\n <>\n {problem && problem !== 'graph' && (\n <span className=\"text-xs text-destructive\">{l.needTrigger}</span>\n )}\n <Button\n variant=\"outline\"\n size=\"sm\"\n disabled={!!problem || busy || !workspaceId}\n onClick={() => void attempt(true)}\n data-testid={`${testId}-run`}\n >\n {pending?.action === 'run' ? (\n <Loader2 className=\"size-4 animate-spin\" />\n ) : (\n <Play className=\"size-4\" />\n )}\n {pending?.action === 'run'\n ? pending.phase === 'saving'\n ? l.saving\n : l.running\n : l.runNow}\n </Button>\n <Button\n size=\"sm\"\n disabled={!!problem || busy || !workspaceId}\n onClick={() => void attempt(false)}\n data-testid={`${testId}-save`}\n >\n {pending?.action === 'save' ? (\n <Loader2 className=\"size-4 animate-spin\" />\n ) : (\n <Save className=\"size-4\" />\n )}\n {pending?.action === 'save' ? l.saving : l.save}\n </Button>\n </>\n }\n />\n )\n}\n"],
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["/**\n * The workflow builder bound to the connection: it loads a saved workflow (or starts from the\n * host's value), offers the host's workflows and the user's skills as steps an agent can run, its\n * agents, the people, labels, documents, events and tasks a workflow can use, and saves the\n * workflow (its trigger and its steps) or runs it now. An unattended workflow that keeps standing\n * access gives its agent the workspace once saved. Every run is a work thread that runs the steps.\n * Saved and failed are told through the environment's `notify`. Exported from\n * `@arbidocs/blocks/workflow-canvas` (it brings the graph library).\n */\n\nimport { useEffect, useMemo, useState } from 'react'\nimport {\n useAgents,\n useCreateWorkflow,\n useGrantAgentAccess,\n useRunWorkflow,\n useWorkspaceUsers,\n useSkills,\n useUpdateWorkflow,\n useWorkflows,\n} from '@arbidocs/react'\nimport type { components } from '@arbidocs/client'\nimport { Button } from '@arbidocs/react/ui'\nimport { Loader2, Play, Save } from 'lucide-react'\nimport { mergeSkillWorkflows, type StepComposeOptions, type WorkflowDefinition } from '../agents'\nimport { DEFAULT_RECURRENCE, buildRRule } from '../agents/tasks/rrule'\nimport { stepConfigProblems, validateWorkflowGraph, workflowSteps } from '../agents/workflows/run'\nimport { WorkflowBuilder, type WorkflowBuilderProps } from '../workflow-canvas/WorkflowBuilder'\nimport {\n DEFAULT_WORKFLOW_TRIGGER,\n builderToWorkflowRequest,\n builderToWorkflowUpdate,\n declaredSignals,\n triggerProblem,\n workflowRecordToBuilder,\n type WorkflowBuilderValue,\n} from '../workflow-canvas/trigger'\nimport { useBlocksEnvironment } from '../provider/environment'\nimport { useConnectedWorkspace } from './ConnectionProvider'\nimport { useConnectedConversations, useConnectedTags, useListedDocuments } from './workspaceData'\n\nconst NO_WORKFLOWS: WorkflowDefinition[] = []\n\nexport interface ConnectedWorkflowBuilderLabels {\n save: string\n saving: string\n runNow: string\n /** The notification once saved. */\n saved: string\n needTrigger: string\n running: string\n /** Notified when saving (or the after-save step) fails without a message. */\n saveFailed: string\n /** Notified when \"Run now\" fails without a message. */\n runFailed: string\n /** A task (to start after) without a title. */\n untitledTask: string\n}\n\nexport const DEFAULT_CONNECTED_WORKFLOW_BUILDER_LABELS: ConnectedWorkflowBuilderLabels = {\n save: 'Save',\n saving: 'Saving\u2026',\n runNow: 'Run now',\n saved: 'Workflow saved',\n needTrigger: 'Finish setting when it starts.',\n running: 'Starting\u2026',\n saveFailed: 'Could not save the workflow',\n runFailed: 'Could not run the workflow',\n untitledTask: 'Untitled thread',\n}\n\n/** Where a new workflow starts: started by hand, one agent step to fill in. */\nexport function newWorkflowBuilderValue(): WorkflowBuilderValue {\n return {\n workflow: {\n id: 'new',\n title: 'New workflow',\n description: '',\n inputs: [],\n landing: 'chat',\n schedulable: false,\n run: {\n kind: 'steps',\n steps: [\n {\n id: 'work',\n kind: 'agent',\n title: 'Do the work',\n run: { kind: 'prompt', promptTemplate: '' },\n },\n ],\n },\n },\n trigger: DEFAULT_WORKFLOW_TRIGGER,\n }\n}\n\n/**\n * Where \"Schedule a task\" starts: a workflow that repeats on a schedule, with one agent step whose\n * prompt is the task, on the default recurrence (changed in the builder). It has no title: saved,\n * it is named from the task's first words (`withTitleFromPrompt`). Every run is a thread.\n */\nexport function scheduledTaskBuilderValue(): WorkflowBuilderValue {\n const value = newWorkflowBuilderValue()\n return {\n workflow: {\n ...value.workflow,\n title: '',\n run: {\n kind: 'steps',\n steps: [\n {\n id: 'work',\n kind: 'agent',\n title: 'The task',\n run: { kind: 'prompt', promptTemplate: '' },\n },\n ],\n },\n },\n trigger: { ...value.trigger, start: 'repeat', rrule: buildRRule(DEFAULT_RECURRENCE) },\n }\n}\n\n/** Words of the task a workflow without a title is named after. */\nconst TITLE_WORDS = 6\n\n/**\n * A workflow left without a title is named from its first agent step's prompt (its first words),\n * so scheduled tasks don't all share one name. Others are returned as they are.\n */\nexport function withTitleFromPrompt(value: WorkflowBuilderValue): WorkflowBuilderValue {\n if (value.workflow.title.trim()) return value\n const steps = value.workflow.run.kind === 'steps' ? value.workflow.run.steps : []\n const prompt = steps.flatMap((s) => {\n if (s.kind !== 'agent') return []\n const { run } = s\n return run && 'promptTemplate' in run ? [run.promptTemplate] : []\n })[0]\n const words = (prompt ?? '').trim().split(/\\s+/).filter(Boolean)\n const title = words.slice(0, TITLE_WORDS).join(' ') + (words.length > TITLE_WORDS ? '\u2026' : '')\n return { ...value, workflow: { ...value.workflow, title: title || 'Scheduled task' } }\n}\n\n/**\n * A workspace event a workflow can start on: a notification type (what the API's `event_kind` check\n * accepts), except those the workflow engine emits itself, which the API refuses as a trigger (422).\n */\ntype WorkflowEventKind = Exclude<components['schemas']['NotificationType'], 'workflow_failed'>\n\n/** Workspace events a workflow can start on (notification types), in plain words. */\nexport const DEFAULT_WORKFLOW_EVENT_KINDS = [\n { value: 'conversation_done', label: 'A task is marked done' },\n { value: 'conversation_ready', label: 'Work is ready for me' },\n { value: 'mention', label: 'Someone mentions me' },\n { value: 'workflow_completed', label: 'Another workflow finishes' },\n { value: 'workflow_signal', label: 'When a step signals' },\n // Filter on {\"language\": \"other\", \"wp_type\": \"source\"} to act on every non-English upload (e.g. Translate).\n { value: 'document_processed', label: 'A document finishes processing' },\n] satisfies Array<{ value: WorkflowEventKind; label: string }>\n\nexport interface ConnectedWorkflowBuilderProps\n extends\n Pick<StepComposeOptions, 'compose'>,\n Pick<\n WorkflowBuilderProps,\n | 'renderIcon'\n | 'labels'\n | 'canvasLabels'\n | 'inspectorLabels'\n | 'triggerLabels'\n | 'testId'\n | 'className'\n > {\n /** A saved workflow to edit (`wfl-\u2026`). */\n workflowId?: string\n /** Where a new workflow starts (e.g. a built-in journey). Default: one agent step. */\n initial?: WorkflowBuilderValue\n /**\n * Host workflows agent steps can run besides the user's skills (e.g. its built-ins with their own\n * forms); an uploaded skill of the same id is used instead (`mergeSkillWorkflows`).\n */\n workflows?: WorkflowDefinition[]\n eventKinds?: Array<{ value: string; label: string }>\n /**\n * Saved (created or updated, the agent's standing access granted): its id and the value saved.\n * It may return a promise for host setup that must finish first: \"Save\" waits for it before\n * telling saved, and \"Run now\" waits for it before running, and does not run if it rejects.\n */\n onSaved?: (workflowId: string, value: WorkflowBuilderValue) => void | Promise<void>\n /** A run started: its thread. Default: open it (the environment's `openConversation`). */\n onRun?: (conversationId: string | undefined) => void\n connectedLabels?: Partial<ConnectedWorkflowBuilderLabels>\n}\n\nexport function ConnectedWorkflowBuilder({\n workflowId,\n initial = newWorkflowBuilderValue(),\n workflows: hostWorkflows = NO_WORKFLOWS,\n eventKinds = DEFAULT_WORKFLOW_EVENT_KINDS,\n compose,\n onSaved,\n onRun,\n connectedLabels,\n testId = 'workflow-builder',\n ...builderProps\n}: ConnectedWorkflowBuilderProps) {\n const l = { ...DEFAULT_CONNECTED_WORKFLOW_BUILDER_LABELS, ...connectedLabels }\n const { notify, openConversation } = useBlocksEnvironment()\n const { workspaceId, live, ensureWorkspaceOpen } = useConnectedWorkspace()\n const members = useWorkspaceUsers(workspaceId ?? undefined, {\n enabled: live && !!workspaceId,\n beforeFetch: ensureWorkspaceOpen,\n })\n const { data: tagList } = useConnectedTags()\n const { data: docList } = useListedDocuments()\n const people = (members.data ?? []).map((m) => ({\n value: m.user.external_id,\n label: [m.user.given_name, m.user.family_name].filter(Boolean).join(' ') || m.user.email,\n }))\n const tagOptions = tagList.map((t) => ({ value: t.external_id, label: t.name }))\n const documentOptions = docList.map((d) => ({\n value: d.external_id,\n label: d.file_name ?? d.external_id,\n }))\n const saved = useWorkflows()\n const skills = useSkills()\n const agentsQuery = useAgents()\n const { data: conversations } = useConnectedConversations()\n const create = useCreateWorkflow()\n const update = useUpdateWorkflow()\n const run = useRunWorkflow()\n const grantAccess = useGrantAgentAccess()\n const [id, setId] = useState(workflowId)\n const [value, setValue] = useState<WorkflowBuilderValue>(initial)\n // Which button is working, and where it is: saving covers the host's after-save step too.\n const [pending, setPending] = useState<{ action: 'save' | 'run'; phase: 'saving' | 'running' }>()\n\n // A saved workflow opens as it was saved.\n const record = saved.data?.find((w) => w.external_id === id)\n const [loaded, setLoaded] = useState<string | undefined>(undefined)\n useEffect(() => {\n if (record && loaded !== record.external_id) {\n setValue(workflowRecordToBuilder(record))\n setLoaded(record.external_id)\n }\n }, [record, loaded])\n\n const workflows = useMemo(() => {\n const merged = mergeSkillWorkflows(hostWorkflows, skills.data ?? [])\n return [...merged.host, ...merged.skills]\n }, [hostWorkflows, skills.data])\n const agents = (agentsQuery.data ?? []).map((a) => ({\n id: a.external_id,\n label: a.given_name || a.email,\n }))\n const tasks = conversations\n .filter((c) => c.status && c.status !== 'done')\n .map((c) => ({ value: c.external_id, label: c.title || l.untitledTask }))\n const options = { resolveWorkflow: (wid: string) => workflows.find((w) => w.id === wid), compose }\n\n const problem =\n triggerProblem(value.trigger) ??\n (validateWorkflowGraph(workflowSteps(value.workflow)).length ||\n stepConfigProblems(workflowSteps(value.workflow)).length\n ? 'graph'\n : null)\n const busy = !!pending || create.isPending || update.isPending || run.isPending\n\n /**\n * Save; then, when unattended starts keep standing access, give the agent (the one picked, else\n * the one the server assigned) the workspace, so a run started next already has it; then the\n * host's after-save step. Throws if any of them fails.\n */\n const save = async (): Promise<string | undefined> => {\n if (!workspaceId) return undefined\n const named = withTitleFromPrompt(value)\n const result = id\n ? await update.mutateAsync({ workflowId: id, patch: builderToWorkflowUpdate(named, options) })\n : await create.mutateAsync(builderToWorkflowRequest(named, workspaceId, options))\n if (named !== value) setValue(named)\n setId(result.external_id)\n setLoaded(result.external_id)\n const { trigger } = value\n const agentId = trigger.agentId || result.agent_ext_id\n // Standing access only: an expiring membership (an earlier \"Allow access\") is not, and a run\n // relying on it would park asking for access again. Granting upgrades it to standing.\n const hasStanding = (members.data ?? []).some(\n (m) => m.user.external_id === agentId && !m.is_temporary\n )\n if (trigger.start !== 'manual' && trigger.access === 'standing' && agentId && !hasStanding) {\n await ensureWorkspaceOpen()\n await grantAccess.mutateAsync({ agentExtId: agentId, workspaceId })\n }\n await onSaved?.(result.external_id, named)\n return result.external_id\n }\n\n const attempt = async (andRun: boolean) => {\n setPending({ action: andRun ? 'run' : 'save', phase: 'saving' })\n try {\n const savedId = await save()\n if (!savedId) return\n if (!andRun) {\n notify(l.saved, 'success')\n return\n }\n setPending({ action: 'run', phase: 'running' })\n const started = await run.mutateAsync(savedId)\n if (started.error) throw new Error(started.error)\n const conversationId = started.conversation_ext_id ?? undefined\n if (onRun) onRun(conversationId)\n else if (conversationId) openConversation(conversationId)\n } catch (e) {\n notify(\n e instanceof Error && e.message ? e.message : andRun ? l.runFailed : l.saveFailed,\n 'error'\n )\n } finally {\n setPending(undefined)\n }\n }\n\n return (\n <WorkflowBuilder\n {...builderProps}\n value={value}\n onChange={setValue}\n workflows={workflows}\n agents={agents}\n eventKinds={eventKinds}\n tasks={tasks}\n people={people}\n tags={tagOptions}\n documents={documentOptions}\n signals={declaredSignals(saved.data ?? [])}\n compose={compose}\n testId={testId}\n actions={\n <>\n {problem && problem !== 'graph' && (\n <span className=\"text-xs text-destructive\">{l.needTrigger}</span>\n )}\n <Button\n variant=\"outline\"\n size=\"sm\"\n disabled={!!problem || busy || !workspaceId}\n onClick={() => void attempt(true)}\n data-testid={`${testId}-run`}\n >\n {pending?.action === 'run' ? (\n <Loader2 className=\"size-4 animate-spin\" />\n ) : (\n <Play className=\"size-4\" />\n )}\n {pending?.action === 'run'\n ? pending.phase === 'saving'\n ? l.saving\n : l.running\n : l.runNow}\n </Button>\n <Button\n size=\"sm\"\n disabled={!!problem || busy || !workspaceId}\n onClick={() => void attempt(false)}\n data-testid={`${testId}-save`}\n >\n {pending?.action === 'save' ? (\n <Loader2 className=\"size-4 animate-spin\" />\n ) : (\n <Save className=\"size-4\" />\n )}\n {pending?.action === 'save' ? l.saving : l.save}\n </Button>\n </>\n }\n />\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAmVQ,mBAEI,KAEF,YAJF;AAzUR,SAAS,WAAW,SAAS,gBAAgB;AAC7C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,cAAc;AACvB,SAAS,SAAS,MAAM,YAAY;AACpC,SAAS,2BAA6E;AACtF,SAAS,oBAAoB,kBAAkB;AAC/C,SAAS,oBAAoB,uBAAuB,qBAAqB;AACzE,SAAS,uBAAkD;AAC3D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,4BAA4B;AACrC,SAAS,6BAA6B;AACtC,SAAS,2BAA2B,kBAAkB,0BAA0B;AAEhF,MAAM,eAAqC,CAAC;AAkBrC,MAAM,4CAA4E;AAAA,EACvF,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,aAAa;AAAA,EACb,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,cAAc;AAChB;AAGO,SAAS,0BAAgD;AAC9D,SAAO;AAAA,IACL,UAAU;AAAA,MACR,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,aAAa;AAAA,MACb,QAAQ,CAAC;AAAA,MACT,SAAS;AAAA,MACT,aAAa;A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EAAE;AAAA;AAAA;AAAA,QACR;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,UAAU,CAAC,CAAC,WAAW,QAAQ,CAAC;AAAA,YAChC,SAAS,MAAM,KAAK,QAAQ,KAAK;AAAA,YACjC,eAAa,GAAG,MAAM;AAAA,YAErB;AAAA,uBAAS,WAAW,SACnB,oBAAC,WAAQ,WAAU,uBAAsB,IAEzC,oBAAC,QAAK,WAAU,UAAS;AAAA,cAE1B,SAAS,WAAW,SAAS,EAAE,SAAS,EAAE;AAAA;AAAA;AAAA,QAC7C;AAAA,SACF;AAAA;AAAA,EAEJ;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import {
|
|
4
4
|
ArbiBotHeadIcon as ArbiBotIcon,
|
|
5
5
|
READ_ONLY_MEETING_TEXT,
|
|
@@ -61,6 +61,8 @@ import { ConnectedConversationEmpty } from "./ConnectedConversationEmpty.js";
|
|
|
61
61
|
import { ConnectedMessageArea as MessageArea } from "./ConnectedMessageArea.js";
|
|
62
62
|
import { ConversationAlert } from "./ConversationAlert.js";
|
|
63
63
|
import { ConversationComposer } from "./ConversationComposer.js";
|
|
64
|
+
import { DocumentTargetNotice } from "./DocumentTargetNotice.js";
|
|
65
|
+
import { createDocumentSwitchGuard, switchInScope } from "./documentSwitch.js";
|
|
64
66
|
import { ConversationSendButton } from "./ConversationSendButton.js";
|
|
65
67
|
import { MicButton } from "./MicButton.js";
|
|
66
68
|
import { useMeetingThreadMessages } from "./useMeetingThreadMessages.js";
|
|
@@ -330,7 +332,24 @@ function ConversationThread({
|
|
|
330
332
|
parentMessageId,
|
|
331
333
|
messageHistory
|
|
332
334
|
});
|
|
335
|
+
const scopeKey = JSON.stringify([selectedWorkspaceId, currentConversationId]);
|
|
336
|
+
const documentSwitchGuards = useRef(
|
|
337
|
+
/* @__PURE__ */ new Map()
|
|
338
|
+
);
|
|
339
|
+
if (!documentSwitchGuards.current.has(scopeKey)) {
|
|
340
|
+
documentSwitchGuards.current.set(scopeKey, createDocumentSwitchGuard());
|
|
341
|
+
}
|
|
342
|
+
const switchingDocument = documentSwitchGuards.current.get(scopeKey);
|
|
343
|
+
const [, setSwitchState] = useState({ scope: scopeKey, pending: false, failed: false });
|
|
344
|
+
const documentSwitchPending = switchingDocument.isPending();
|
|
345
|
+
const documentSwitchFailed = switchingDocument.hasFailed();
|
|
333
346
|
const handleUserSend = useCallback(() => {
|
|
347
|
+
if (switchingDocument.isPending()) return;
|
|
348
|
+
if (switchingDocument.hasFailed()) {
|
|
349
|
+
session.setAutoSendDraft(false);
|
|
350
|
+
switchingDocument.acknowledgeFailure();
|
|
351
|
+
setSwitchState({ scope: scopeKey, pending: false, failed: false });
|
|
352
|
+
}
|
|
334
353
|
const draft = selectDraft(session.getState());
|
|
335
354
|
if (!pendingAnswer && slashWorkflows.openForDraft(draft)) {
|
|
336
355
|
session.setDraft("");
|
|
@@ -339,7 +358,15 @@ function ConversationThread({
|
|
|
339
358
|
if (refuseChatWhenOffline()) return;
|
|
340
359
|
scrollToBottom();
|
|
341
360
|
handleComposerSend();
|
|
342
|
-
}, [
|
|
361
|
+
}, [
|
|
362
|
+
pendingAnswer,
|
|
363
|
+
slashWorkflows,
|
|
364
|
+
handleComposerSend,
|
|
365
|
+
scrollToBottom,
|
|
366
|
+
session,
|
|
367
|
+
switchingDocument,
|
|
368
|
+
scopeKey
|
|
369
|
+
]);
|
|
343
370
|
useEffect(() => {
|
|
344
371
|
if (editingMessageId && inputRef.current) {
|
|
345
372
|
const textarea = inputRef.current;
|
|
@@ -359,12 +386,41 @@ function ConversationThread({
|
|
|
359
386
|
const findDocument = (id) => id ? allWorkspaceDocuments?.find((d) => d.external_id === id) : void 0;
|
|
360
387
|
const draftingDocument = findDocument(turnDocumentId);
|
|
361
388
|
const attachableDocument = turnDocumentId ? void 0 : findDocument(openDocumentId);
|
|
389
|
+
const differentVisibleDocument = Boolean(
|
|
390
|
+
turnDocumentId && openDocumentId && turnDocumentId !== openDocumentId
|
|
391
|
+
);
|
|
392
|
+
const targetTitle = draftingDocument ? getDocumentTitle(draftingDocument) : turnDocumentId;
|
|
393
|
+
const visibleDocument = findDocument(openDocumentId);
|
|
394
|
+
const visibleTitle = visibleDocument ? getDocumentTitle(visibleDocument) : openDocumentId;
|
|
395
|
+
const sameTitle = targetTitle && visibleTitle && targetTitle === visibleTitle;
|
|
396
|
+
const switchThreadDocument = (documentId) => {
|
|
397
|
+
if (isGenerating || switchingDocument.isPending()) return;
|
|
398
|
+
const isCurrent = () => {
|
|
399
|
+
const state = session.getState();
|
|
400
|
+
return state.workspaceId === selectedWorkspaceId && state.conversationId === currentConversationId;
|
|
401
|
+
};
|
|
402
|
+
setSwitchState({ scope: scopeKey, pending: true, failed: false });
|
|
403
|
+
void switchInScope(
|
|
404
|
+
switchingDocument,
|
|
405
|
+
() => threadDocument.bind(documentId),
|
|
406
|
+
isCurrent,
|
|
407
|
+
(pending) => setSwitchState({ scope: scopeKey, pending, failed: false }),
|
|
408
|
+
() => {
|
|
409
|
+
setSwitchState({ scope: scopeKey, pending: false, failed: true });
|
|
410
|
+
session.setAutoSendDraft(false);
|
|
411
|
+
}
|
|
412
|
+
);
|
|
413
|
+
};
|
|
362
414
|
useDocumentAutoAdd({
|
|
363
415
|
selectedWorkspaceId,
|
|
364
416
|
allWorkspaceDocuments,
|
|
365
417
|
hasContent: !isEmptyConversation || Boolean(parentMessageId || messageHistory?.length || isGenerating)
|
|
366
418
|
});
|
|
367
|
-
useAutoSendDraft(
|
|
419
|
+
useAutoSendDraft(
|
|
420
|
+
handleComposerSend,
|
|
421
|
+
!isLoadingWorkspaceDocuments && !documentSwitchPending && !documentSwitchFailed,
|
|
422
|
+
() => !switchingDocument.isPending()
|
|
423
|
+
);
|
|
368
424
|
useStartRequestedDraft();
|
|
369
425
|
const orphanedMessage = getOrphanedLastMessage(messageHistory, isGenerating, assistantMode);
|
|
370
426
|
return /* @__PURE__ */ jsxs(ConversationBody, { children: [
|
|
@@ -464,58 +520,90 @@ function ConversationThread({
|
|
|
464
520
|
"data-testid": "meeting-thread-read-only",
|
|
465
521
|
children: READ_ONLY_MEETING_TEXT
|
|
466
522
|
}
|
|
467
|
-
) : /* @__PURE__ */
|
|
468
|
-
|
|
469
|
-
{
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
/* @__PURE__ */ jsx(
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
523
|
+
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
524
|
+
documentSwitchPending && /* @__PURE__ */ jsx("p", { className: "mx-3 mb-2 text-sm text-muted-foreground", role: "status", children: "Switching this thread\u2019s document\u2026" }),
|
|
525
|
+
documentSwitchFailed && /* @__PURE__ */ jsxs("div", { className: "mx-3 mb-2 text-sm text-destructive", role: "status", children: [
|
|
526
|
+
/* @__PURE__ */ jsx("p", { children: "The document switch failed. Check which document this thread will use before sending." }),
|
|
527
|
+
/* @__PURE__ */ jsx(
|
|
528
|
+
"button",
|
|
529
|
+
{
|
|
530
|
+
type: "button",
|
|
531
|
+
className: "underline",
|
|
532
|
+
onClick: () => {
|
|
533
|
+
session.setAutoSendDraft(false);
|
|
534
|
+
switchingDocument.acknowledgeFailure();
|
|
535
|
+
setSwitchState({ scope: scopeKey, pending: false, failed: false });
|
|
536
|
+
},
|
|
537
|
+
children: "Use the current thread document"
|
|
538
|
+
}
|
|
539
|
+
)
|
|
540
|
+
] }),
|
|
541
|
+
!paMode && differentVisibleDocument && /* @__PURE__ */ jsx(
|
|
542
|
+
DocumentTargetNotice,
|
|
543
|
+
{
|
|
544
|
+
target: sameTitle ? `${targetTitle} (${turnDocumentId})` : targetTitle,
|
|
545
|
+
visible: sameTitle ? `${visibleTitle} (${openDocumentId})` : visibleTitle,
|
|
546
|
+
onSwitch: visibleDocument ? () => switchThreadDocument(openDocumentId) : void 0,
|
|
547
|
+
disabled: isGenerating || documentSwitchPending
|
|
548
|
+
}
|
|
549
|
+
),
|
|
550
|
+
/* @__PURE__ */ jsx(
|
|
551
|
+
ConversationComposer,
|
|
552
|
+
{
|
|
553
|
+
handleSendMessage: handleUserSend,
|
|
554
|
+
placeholder: pendingAnswer ? assistant.answerPlaceholder : void 0,
|
|
555
|
+
isGenerating,
|
|
556
|
+
shouldOfferFollowUp: !showScrollToBottom,
|
|
557
|
+
inputRef,
|
|
558
|
+
isBranching,
|
|
559
|
+
onCancelBranching: session.cancelEditing,
|
|
560
|
+
modelSelector: paMode ? void 0 : modelSelector,
|
|
561
|
+
skills: composerSkills,
|
|
562
|
+
onBrowseSkills: browseSkills,
|
|
563
|
+
contextUsage: latestContextUsage,
|
|
564
|
+
isConversationEmpty: messageHistory.length === 0 && !isBranching,
|
|
565
|
+
leftButton: paMode ? /* @__PURE__ */ jsx(PaModeBadge, { icon: /* @__PURE__ */ jsx(ArbiBotIcon, { size: 16, className: "shrink-0" }) }) : /* @__PURE__ */ jsxs(ComposerAccessories, { children: [
|
|
566
|
+
composerAccessory,
|
|
567
|
+
threadDocument.unavailable ? /* @__PURE__ */ jsx(
|
|
568
|
+
DraftingDocChip,
|
|
569
|
+
{
|
|
570
|
+
state: "unavailable",
|
|
571
|
+
title: "",
|
|
572
|
+
disabled: isGenerating || documentSwitchPending,
|
|
573
|
+
onDetach: () => switchThreadDocument(null)
|
|
574
|
+
}
|
|
575
|
+
) : draftingDocument ? /* @__PURE__ */ jsx(
|
|
576
|
+
DraftingDocChip,
|
|
577
|
+
{
|
|
578
|
+
title: getDocumentTitle(draftingDocument),
|
|
579
|
+
disabled: isGenerating || documentSwitchPending,
|
|
580
|
+
onDetach: threadDocument.documentId ? () => switchThreadDocument(null) : void 0
|
|
581
|
+
}
|
|
582
|
+
) : attachableDocument && /* @__PURE__ */ jsx(
|
|
583
|
+
DraftingDocChip,
|
|
584
|
+
{
|
|
585
|
+
state: "attach",
|
|
586
|
+
title: getDocumentTitle(attachableDocument),
|
|
587
|
+
disabled: isGenerating || documentSwitchPending,
|
|
588
|
+
onAttach: () => switchThreadDocument(attachableDocument.external_id)
|
|
589
|
+
}
|
|
590
|
+
)
|
|
591
|
+
] }),
|
|
592
|
+
rightButton: /* @__PURE__ */ jsxs(ComposerTools, { children: [
|
|
593
|
+
composerTools,
|
|
594
|
+
/* @__PURE__ */ jsx(MicButton, { inputRef }),
|
|
595
|
+
/* @__PURE__ */ jsx(
|
|
596
|
+
ConversationSendButton,
|
|
597
|
+
{
|
|
598
|
+
onClick: handleUserSend,
|
|
599
|
+
disabled: documentSwitchPending,
|
|
600
|
+
hasOrphanedMessage: !isGenerating && orphanedMessage !== null
|
|
601
|
+
}
|
|
602
|
+
)
|
|
603
|
+
] })
|
|
604
|
+
}
|
|
605
|
+
)
|
|
606
|
+
] })
|
|
519
607
|
] })
|
|
520
608
|
}
|
|
521
609
|
),
|