@arbidocs/blocks 0.5.166 → 0.5.167
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/{CalendarGridImpl-ZUHFUWWA.cjs → CalendarGridImpl-2M6IPL4U.cjs} +19 -19
- package/dist/{CalendarGridImpl-ZUHFUWWA.cjs.map → CalendarGridImpl-2M6IPL4U.cjs.map} +1 -1
- package/dist/{ConnectedCallDock-RUBZWNBS.cjs → ConnectedCallDock-PFMK5OGR.cjs} +25 -25
- package/dist/{ConnectedCallDock-RUBZWNBS.cjs.map → ConnectedCallDock-PFMK5OGR.cjs.map} +1 -1
- package/dist/{ConnectedCallRoom-UE73GPNR.cjs → ConnectedCallRoom-VHU2XWLY.cjs} +18 -18
- package/dist/{ConnectedCallRoom-UE73GPNR.cjs.map → ConnectedCallRoom-VHU2XWLY.cjs.map} +1 -1
- package/dist/ConnectedMailInviteCard-S2X4XN3X.cjs +22 -0
- package/dist/{ConnectedMailInviteCard-HPOHLB72.cjs.map → ConnectedMailInviteCard-S2X4XN3X.cjs.map} +1 -1
- package/dist/{ConnectedNativeDocxComparison-P5TX46HD.cjs → ConnectedNativeDocxComparison-AOVH47RY.cjs} +17 -17
- package/dist/{ConnectedNativeDocxComparison-P5TX46HD.cjs.map → ConnectedNativeDocxComparison-AOVH47RY.cjs.map} +1 -1
- package/dist/{ConnectedPresentation-CQJB3BOB.cjs → ConnectedPresentation-PYTZBAOR.cjs} +20 -20
- package/dist/{ConnectedPresentation-CQJB3BOB.cjs.map → ConnectedPresentation-PYTZBAOR.cjs.map} +1 -1
- package/dist/{ConnectedProductionSetDialog-O5RX57PS.cjs → ConnectedProductionSetDialog-6ZGBUMOT.cjs} +5 -5
- package/dist/{ConnectedProductionSetDialog-O5RX57PS.cjs.map → ConnectedProductionSetDialog-6ZGBUMOT.cjs.map} +1 -1
- package/dist/{ConnectedSlidesTab-LEA5OW75.cjs → ConnectedSlidesTab-GT5TQPWW.cjs} +15 -15
- package/dist/{ConnectedSlidesTab-LEA5OW75.cjs.map → ConnectedSlidesTab-GT5TQPWW.cjs.map} +1 -1
- package/dist/{ConnectedStreamedWordArtifact-XO4ULCQO.cjs → ConnectedStreamedWordArtifact-2WBJZI2K.cjs} +17 -17
- package/dist/{ConnectedStreamedWordArtifact-XO4ULCQO.cjs.map → ConnectedStreamedWordArtifact-2WBJZI2K.cjs.map} +1 -1
- package/dist/{DocumentReviewCard-OHWZ6YI3.cjs → DocumentReviewCard-3E44O3F6.cjs} +16 -16
- package/dist/{DocumentReviewCard-OHWZ6YI3.cjs.map → DocumentReviewCard-3E44O3F6.cjs.map} +1 -1
- package/dist/{FilesViewerDialog-M6MRG2X7.cjs → FilesViewerDialog-JCW2SMBU.cjs} +46 -46
- package/dist/{FilesViewerDialog-M6MRG2X7.cjs.map → FilesViewerDialog-JCW2SMBU.cjs.map} +1 -1
- package/dist/{WorkspaceTableView-ZAN4C4IZ.cjs → WorkspaceTableView-ZKLEEPCF.cjs} +9 -9
- package/dist/{WorkspaceTableView-ZAN4C4IZ.cjs.map → WorkspaceTableView-ZKLEEPCF.cjs.map} +1 -1
- package/dist/agents/index.cjs +284 -284
- package/dist/agents/workflows/StepDocuments.d.ts +14 -1
- package/dist/agents/workflows/StepDocuments.js +23 -1
- package/dist/agents/workflows/StepDocuments.js.map +2 -2
- package/dist/{ai-AV4LQ5AW.cjs → ai-VXPILCGE.cjs} +29 -29
- package/dist/ai-VXPILCGE.cjs.map +1 -0
- package/dist/auth/index.cjs +12 -12
- package/dist/calendar/SchedulingAssistant.js +6 -1
- package/dist/calendar/SchedulingAssistant.js.map +2 -2
- package/dist/calendar/index.cjs +117 -117
- package/dist/calendar/labels.js +1 -0
- package/dist/calendar/labels.js.map +2 -2
- package/dist/calendar/types.d.ts +1 -0
- package/dist/calls/connected/CallPeoplePicker.d.ts +1 -1
- package/dist/calls/connected/CallPeoplePicker.js +4 -2
- package/dist/calls/connected/CallPeoplePicker.js.map +2 -2
- package/dist/calls/connected/ConnectedCallRoom.js +33 -2
- package/dist/calls/connected/ConnectedCallRoom.js.map +2 -2
- package/dist/calls/connected/DmCallButton.js +14 -6
- package/dist/calls/connected/DmCallButton.js.map +2 -2
- package/dist/calls/connected/call-people.d.ts +4 -2
- package/dist/calls/connected/call-people.js +4 -0
- package/dist/calls/connected/call-people.js.map +2 -2
- package/dist/calls/index.cjs +119 -119
- package/dist/chat/index.cjs +56 -56
- package/dist/{chunk-SXBQAMHV.cjs → chunk-2KGU5G6Z.cjs} +6 -6
- package/dist/chunk-2KGU5G6Z.cjs.map +1 -0
- package/dist/{chunk-W7XZKTDG.cjs → chunk-3K7V4LOF.cjs} +19 -10
- package/dist/chunk-3K7V4LOF.cjs.map +1 -0
- package/dist/{chunk-QD2XCNJH.cjs → chunk-4TJCJ74G.cjs} +54 -54
- package/dist/{chunk-QD2XCNJH.cjs.map → chunk-4TJCJ74G.cjs.map} +1 -1
- package/dist/{chunk-TKO24ZZ6.cjs → chunk-5PXK77RO.cjs} +4 -4
- package/dist/{chunk-TKO24ZZ6.cjs.map → chunk-5PXK77RO.cjs.map} +1 -1
- package/dist/{chunk-7QSZSGUQ.cjs → chunk-6CNK2C34.cjs} +6 -6
- package/dist/{chunk-7QSZSGUQ.cjs.map → chunk-6CNK2C34.cjs.map} +1 -1
- package/dist/{chunk-3QHVDOQT.cjs → chunk-6INJQAGS.cjs} +22 -22
- package/dist/{chunk-3QHVDOQT.cjs.map → chunk-6INJQAGS.cjs.map} +1 -1
- package/dist/{chunk-VDHBLDQC.cjs → chunk-6N7QT2DH.cjs} +3 -3
- package/dist/{chunk-VDHBLDQC.cjs.map → chunk-6N7QT2DH.cjs.map} +1 -1
- package/dist/{chunk-VNYMWFIT.cjs → chunk-6PKP7UT7.cjs} +8 -7
- package/dist/chunk-6PKP7UT7.cjs.map +1 -0
- package/dist/{chunk-VDT7TEAH.cjs → chunk-6ZJBUMNK.cjs} +3 -3
- package/dist/{chunk-VDT7TEAH.cjs.map → chunk-6ZJBUMNK.cjs.map} +1 -1
- package/dist/{chunk-3UCRJRNI.cjs → chunk-7NVDGD63.cjs} +3 -3
- package/dist/{chunk-3UCRJRNI.cjs.map → chunk-7NVDGD63.cjs.map} +1 -1
- package/dist/{chunk-JEHGTPS2.cjs → chunk-AHUEBRLX.cjs} +4 -4
- package/dist/{chunk-JEHGTPS2.cjs.map → chunk-AHUEBRLX.cjs.map} +1 -1
- package/dist/{chunk-5G33DATM.cjs → chunk-AKNZZGJ3.cjs} +36 -36
- package/dist/{chunk-5G33DATM.cjs.map → chunk-AKNZZGJ3.cjs.map} +1 -1
- package/dist/{chunk-5FSULBPE.cjs → chunk-B5AOYT4U.cjs} +3 -3
- package/dist/{chunk-5FSULBPE.cjs.map → chunk-B5AOYT4U.cjs.map} +1 -1
- package/dist/{chunk-3EIO4ZH5.cjs → chunk-BJRQHR7R.cjs} +6 -6
- package/dist/{chunk-3EIO4ZH5.cjs.map → chunk-BJRQHR7R.cjs.map} +1 -1
- package/dist/{chunk-ZKKSTMMI.cjs → chunk-DNHZYLPK.cjs} +3 -3
- package/dist/{chunk-ZKKSTMMI.cjs.map → chunk-DNHZYLPK.cjs.map} +1 -1
- package/dist/{chunk-LZGGR63X.cjs → chunk-DOBSQC2P.cjs} +4 -4
- package/dist/{chunk-LZGGR63X.cjs.map → chunk-DOBSQC2P.cjs.map} +1 -1
- package/dist/{chunk-N2SJR2Y7.cjs → chunk-E43TT6FH.cjs} +52 -52
- package/dist/{chunk-N2SJR2Y7.cjs.map → chunk-E43TT6FH.cjs.map} +1 -1
- package/dist/{chunk-LE4Z2UIG.cjs → chunk-EADZEEKI.cjs} +61 -61
- package/dist/{chunk-LE4Z2UIG.cjs.map → chunk-EADZEEKI.cjs.map} +1 -1
- package/dist/{chunk-6AFAYGJW.cjs → chunk-EG3DPKXM.cjs} +5 -5
- package/dist/{chunk-6AFAYGJW.cjs.map → chunk-EG3DPKXM.cjs.map} +1 -1
- package/dist/{chunk-7OMRSZOJ.cjs → chunk-EXUCQ6KA.cjs} +28 -28
- package/dist/{chunk-7OMRSZOJ.cjs.map → chunk-EXUCQ6KA.cjs.map} +1 -1
- package/dist/{chunk-4M3OIBIS.cjs → chunk-FC6VMY2L.cjs} +49 -44
- package/dist/chunk-FC6VMY2L.cjs.map +1 -0
- package/dist/{chunk-6U3CYVZC.cjs → chunk-FUGQ7YQW.cjs} +3 -2
- package/dist/chunk-FUGQ7YQW.cjs.map +1 -0
- package/dist/{chunk-YTDVWIHU.cjs → chunk-GXIXNSBV.cjs} +146 -107
- package/dist/chunk-GXIXNSBV.cjs.map +1 -0
- package/dist/{chunk-SJPKXXB5.cjs → chunk-H2BUDSKT.cjs} +6 -6
- package/dist/{chunk-SJPKXXB5.cjs.map → chunk-H2BUDSKT.cjs.map} +1 -1
- package/dist/{chunk-CI777IPA.cjs → chunk-IJ4JKHEC.cjs} +18 -18
- package/dist/{chunk-CI777IPA.cjs.map → chunk-IJ4JKHEC.cjs.map} +1 -1
- package/dist/{chunk-OHWYQI3B.cjs → chunk-IPSR2PUU.cjs} +12 -12
- package/dist/{chunk-OHWYQI3B.cjs.map → chunk-IPSR2PUU.cjs.map} +1 -1
- package/dist/{chunk-PK5H5SVS.cjs → chunk-KBRDUFXG.cjs} +7 -7
- package/dist/{chunk-PK5H5SVS.cjs.map → chunk-KBRDUFXG.cjs.map} +1 -1
- package/dist/{chunk-SX6KL6UN.cjs → chunk-KTYJNF7R.cjs} +4 -4
- package/dist/{chunk-SX6KL6UN.cjs.map → chunk-KTYJNF7R.cjs.map} +1 -1
- package/dist/{chunk-WV3RNWAG.cjs → chunk-LG2IKM2G.cjs} +11 -11
- package/dist/{chunk-WV3RNWAG.cjs.map → chunk-LG2IKM2G.cjs.map} +1 -1
- package/dist/{chunk-ER2MRSLT.cjs → chunk-LJTHFTQQ.cjs} +3 -3
- package/dist/{chunk-ER2MRSLT.cjs.map → chunk-LJTHFTQQ.cjs.map} +1 -1
- package/dist/{chunk-7GVKG3G4.cjs → chunk-M3HYFFCK.cjs} +13 -13
- package/dist/{chunk-7GVKG3G4.cjs.map → chunk-M3HYFFCK.cjs.map} +1 -1
- package/dist/{chunk-ZLXTGHK3.cjs → chunk-NFVYHS3X.cjs} +85 -56
- package/dist/chunk-NFVYHS3X.cjs.map +1 -0
- package/dist/{chunk-7XR6CPCU.cjs → chunk-PIJPM5RA.cjs} +25 -3
- package/dist/chunk-PIJPM5RA.cjs.map +1 -0
- package/dist/{chunk-BNXWT3DX.cjs → chunk-PNZVCHFS.cjs} +8 -8
- package/dist/{chunk-BNXWT3DX.cjs.map → chunk-PNZVCHFS.cjs.map} +1 -1
- package/dist/{chunk-6DHDITKK.cjs → chunk-PP3KYFSS.cjs} +4 -4
- package/dist/{chunk-6DHDITKK.cjs.map → chunk-PP3KYFSS.cjs.map} +1 -1
- package/dist/{chunk-4RDXW7KP.cjs → chunk-QGCNYDHZ.cjs} +11 -11
- package/dist/{chunk-4RDXW7KP.cjs.map → chunk-QGCNYDHZ.cjs.map} +1 -1
- package/dist/{chunk-3DRBJGRR.cjs → chunk-SKQ5OMMF.cjs} +7 -7
- package/dist/{chunk-3DRBJGRR.cjs.map → chunk-SKQ5OMMF.cjs.map} +1 -1
- package/dist/{chunk-XKXKEVHH.cjs → chunk-TPYOXG5S.cjs} +6 -6
- package/dist/{chunk-XKXKEVHH.cjs.map → chunk-TPYOXG5S.cjs.map} +1 -1
- package/dist/{chunk-OIYKKUAN.cjs → chunk-TU46WKTN.cjs} +3 -3
- package/dist/{chunk-OIYKKUAN.cjs.map → chunk-TU46WKTN.cjs.map} +1 -1
- package/dist/{chunk-PYKTUGPE.cjs → chunk-U33XOC7T.cjs} +6 -6
- package/dist/{chunk-PYKTUGPE.cjs.map → chunk-U33XOC7T.cjs.map} +1 -1
- package/dist/{chunk-DI6UEQCZ.cjs → chunk-VHXGBVT6.cjs} +4 -4
- package/dist/{chunk-DI6UEQCZ.cjs.map → chunk-VHXGBVT6.cjs.map} +1 -1
- package/dist/{chunk-NAXF2KHT.cjs → chunk-VNUBBRJM.cjs} +6 -6
- package/dist/{chunk-NAXF2KHT.cjs.map → chunk-VNUBBRJM.cjs.map} +1 -1
- package/dist/{chunk-WGRXQ7PI.cjs → chunk-W6PTT27N.cjs} +17 -17
- package/dist/{chunk-WGRXQ7PI.cjs.map → chunk-W6PTT27N.cjs.map} +1 -1
- package/dist/{chunk-TLIZD6DV.cjs → chunk-W7TSEN3J.cjs} +6 -6
- package/dist/{chunk-TLIZD6DV.cjs.map → chunk-W7TSEN3J.cjs.map} +1 -1
- package/dist/{chunk-BCU65RJM.cjs → chunk-WQ2KG4LS.cjs} +3 -3
- package/dist/{chunk-BCU65RJM.cjs.map → chunk-WQ2KG4LS.cjs.map} +1 -1
- package/dist/{chunk-FUKN3PI5.cjs → chunk-WQQ6C2ML.cjs} +3 -3
- package/dist/{chunk-FUKN3PI5.cjs.map → chunk-WQQ6C2ML.cjs.map} +1 -1
- package/dist/{chunk-JFCTB5YI.cjs → chunk-XGMA7ITI.cjs} +6 -6
- package/dist/{chunk-JFCTB5YI.cjs.map → chunk-XGMA7ITI.cjs.map} +1 -1
- package/dist/{chunk-NFXHBTAO.cjs → chunk-XKOIHIVQ.cjs} +4 -4
- package/dist/{chunk-NFXHBTAO.cjs.map → chunk-XKOIHIVQ.cjs.map} +1 -1
- package/dist/{chunk-AG5XZ3AM.cjs → chunk-Y4OTUJGD.cjs} +11 -11
- package/dist/{chunk-AG5XZ3AM.cjs.map → chunk-Y4OTUJGD.cjs.map} +1 -1
- package/dist/{chunk-HH5MKRBL.cjs → chunk-ZSZI576U.cjs} +7 -7
- package/dist/{chunk-HH5MKRBL.cjs.map → chunk-ZSZI576U.cjs.map} +1 -1
- package/dist/connect/docx.cjs +20 -20
- package/dist/connect/index.cjs +1355 -1322
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/viewer.cjs +34 -34
- package/dist/connection/ConnectedAgentChatPanel.js +5 -5
- package/dist/connection/ConnectedAgentChatPanel.js.map +2 -2
- package/dist/connection/calendar/ConnectedCalendar.js +4 -2
- package/dist/connection/calendar/ConnectedCalendar.js.map +2 -2
- package/dist/connection/calendar/EventScheduling.js +29 -4
- package/dist/connection/calendar/EventScheduling.js.map +2 -2
- package/dist/connection/conversation/AgentControlBar.js +2 -2
- package/dist/connection/conversation/AgentControlBar.js.map +2 -2
- package/dist/connection/conversation/AnswerTable.js +19 -2
- package/dist/connection/conversation/AnswerTable.js.map +2 -2
- package/dist/connection/conversation/ConversationComposer.js +29 -7
- package/dist/connection/conversation/ConversationComposer.js.map +2 -2
- package/dist/connection/files/fields/fields-manager-panel.d.ts +1 -1
- package/dist/connection/files/fields/fields-manager-panel.js +1 -1
- package/dist/connection/files/fields/fields-manager-panel.js.map +2 -2
- package/dist/connection/files/upload/useAddFromUrls.d.ts +1 -1
- package/dist/connection/files/upload/useAddFromUrls.js +1 -1
- package/dist/connection/files/upload/useAddFromUrls.js.map +1 -1
- package/dist/connection/messenger/full-variant.js +1 -1
- package/dist/connection/messenger/full-variant.js.map +2 -2
- package/dist/connection/panels/ConnectedPanelHost.js +3 -2
- package/dist/connection/panels/ConnectedPanelHost.js.map +2 -2
- package/dist/connection/report-problem/CaptureBar.d.ts +4 -5
- package/dist/connection/report-problem/CaptureBar.js +56 -13
- package/dist/connection/report-problem/CaptureBar.js.map +2 -2
- package/dist/connection/report-problem/ReportProblemDialog.js +3 -2
- package/dist/connection/report-problem/ReportProblemDialog.js.map +2 -2
- package/dist/connection/report-problem/SupportVideoEvidence.js +22 -49
- package/dist/connection/report-problem/SupportVideoEvidence.js.map +2 -2
- package/dist/connection/report-problem/useReportProblem.js +11 -23
- package/dist/connection/report-problem/useReportProblem.js.map +2 -2
- package/dist/connection/report-problem/useSupportVideo.d.ts +2 -0
- package/dist/connection/report-problem/useSupportVideo.js +1 -0
- package/dist/connection/report-problem/useSupportVideo.js.map +2 -2
- package/dist/dashboards/index.cjs +1 -1
- package/dist/embed/index.cjs +39 -39
- package/dist/facts/index.cjs +44 -44
- package/dist/files/index.cjs +228 -228
- package/dist/index.cjs +1588 -1588
- package/dist/pages/index.cjs +30 -30
- package/dist/settings/index.cjs +138 -138
- package/dist/shell/PanelPortal.js +4 -4
- package/dist/shell/PanelPortal.js.map +2 -2
- package/dist/shell/index.cjs +84 -84
- package/dist/studio/index.cjs +28 -28
- package/dist/styles.css +1 -1
- package/dist/workflow-canvas/index.cjs +65 -65
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +5 -5
- package/dist/ConnectedMailInviteCard-HPOHLB72.cjs +0 -22
- package/dist/ai-AV4LQ5AW.cjs.map +0 -1
- package/dist/chunk-4M3OIBIS.cjs.map +0 -1
- package/dist/chunk-6U3CYVZC.cjs.map +0 -1
- package/dist/chunk-7XR6CPCU.cjs.map +0 -1
- package/dist/chunk-SXBQAMHV.cjs.map +0 -1
- package/dist/chunk-VNYMWFIT.cjs.map +0 -1
- package/dist/chunk-W7XZKTDG.cjs.map +0 -1
- package/dist/chunk-YTDVWIHU.cjs.map +0 -1
- package/dist/chunk-ZLXTGHK3.cjs.map +0 -1
|
@@ -48,6 +48,7 @@ function EventScheduling({
|
|
|
48
48
|
if (me && !list.includes(me.toLowerCase())) list.unshift(me.toLowerCase());
|
|
49
49
|
return list;
|
|
50
50
|
}, [attendees, me]);
|
|
51
|
+
const attendeeSetKey = JSON.stringify([...ids].sort());
|
|
51
52
|
const labelOf = (id) => {
|
|
52
53
|
if (me && id === me.toLowerCase()) return "You";
|
|
53
54
|
const a = attendees.find((x) => attendeeKey(x) === id);
|
|
@@ -60,9 +61,33 @@ function EventScheduling({
|
|
|
60
61
|
} : null;
|
|
61
62
|
const freeBusy = useFreeBusy(open ? ids : [], fbWindow?.start ?? null, fbWindow?.end ?? null);
|
|
62
63
|
const rows = useMemo(
|
|
63
|
-
() =>
|
|
64
|
+
() => {
|
|
65
|
+
if (!date) return [];
|
|
66
|
+
const entries = freeBusy.isPlaceholderData || freeBusy.isError ? [] : freeBusy.data ?? [];
|
|
67
|
+
return freeBusyToRows(
|
|
68
|
+
ids.map(
|
|
69
|
+
(id) => entries.find((entry) => entry.attendee.toLowerCase() === id) ?? {
|
|
70
|
+
attendee: id,
|
|
71
|
+
known: false,
|
|
72
|
+
busy: []
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
date,
|
|
76
|
+
labelOf,
|
|
77
|
+
roomEmails
|
|
78
|
+
);
|
|
79
|
+
},
|
|
64
80
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
65
|
-
[
|
|
81
|
+
[
|
|
82
|
+
freeBusy.data,
|
|
83
|
+
freeBusy.isPlaceholderData,
|
|
84
|
+
freeBusy.isError,
|
|
85
|
+
date,
|
|
86
|
+
ids,
|
|
87
|
+
roomEmails,
|
|
88
|
+
attendees,
|
|
89
|
+
me
|
|
90
|
+
]
|
|
66
91
|
);
|
|
67
92
|
const findTime = useFindTime();
|
|
68
93
|
const [suggestions, setSuggestions] = useState(null);
|
|
@@ -98,7 +123,7 @@ function EventScheduling({
|
|
|
98
123
|
dayStartHour: Math.max(0, Math.min(workingStartHour, 8) - 1),
|
|
99
124
|
dayEndHour: 21,
|
|
100
125
|
loading: freeBusy.isFetching,
|
|
101
|
-
suggestions,
|
|
126
|
+
suggestions: suggestions?.attendeeSetKey === attendeeSetKey ? suggestions.values : null,
|
|
102
127
|
finding: findTime.isPending,
|
|
103
128
|
onDateChange: setDayOverride,
|
|
104
129
|
onFindTime: () => dayStart && findTime.mutate(
|
|
@@ -114,7 +139,7 @@ function EventScheduling({
|
|
|
114
139
|
limit: 8
|
|
115
140
|
},
|
|
116
141
|
{
|
|
117
|
-
onSuccess: (s) => setSuggestions(toSuggestionViews(s)),
|
|
142
|
+
onSuccess: (s) => setSuggestions({ attendeeSetKey, values: toSuggestionViews(s) }),
|
|
118
143
|
onError: (err) => notify(`Could not find times: ${err.message}`, "error")
|
|
119
144
|
}
|
|
120
145
|
),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/connection/calendar/EventScheduling.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * The editor's scheduling section: attendees' free/busy over the event's day (POST /freebusy), \"Find a\n * time\" (POST /find-time) that moves the draft. Collapsed until opened, so the editor does not fetch on every open.\n */\nimport { useMemo, useState } from 'react'\nimport { CalendarSearch } from 'lucide-react'\nimport { Button } from '@arbidocs/react/ui'\nimport { useArbi, useFindTime, useFreeBusy } from '@arbidocs/react'\nimport {\n SchedulingAssistant,\n applySuggestion,\n draftRangeUtc,\n freeBusyToRows,\n isAllDayDraft,\n toSuggestionViews,\n utcToDate,\n type EventDraft,\n type TimeSuggestionView,\n} from '../../calendar'\nimport { useBlocksEnvironment } from '../../provider/environment'\n\nexport interface EventSchedulingProps {\n draft: EventDraft\n onChange: (draft: EventDraft) => void\n timeZone: string\n workingStartHour?: number\n}\n\nconst attendeeKey = (a: NonNullable<EventDraft['attendees']>[number]) =>\n (a.email ?? a.user_id ?? '').toLowerCase()\n\nexport function EventScheduling({\n draft,\n onChange,\n timeZone,\n workingStartHour = 7,\n}: EventSchedulingProps) {\n const [open, setOpen] = useState(false)\n const { notify } = useBlocksEnvironment()\n const arbi = useArbi()\n const me = arbi.isLoggedIn ? (arbi.user.identity()?.email ?? null) : null\n const allDay = isAllDayDraft(draft)\n const range = useMemo(() => {\n try {\n const { startMs, endMs } = draftRangeUtc(draft, timeZone)\n if (!Number.isFinite(startMs) || !Number.isFinite(endMs) || endMs <= startMs) return null\n return { start: new Date(startMs).toISOString(), end: new Date(endMs).toISOString() }\n } catch {\n return null\n }\n }, [draft, timeZone])\n const eventDate = range ? utcToDate(range.start, timeZone) : null\n const [dayOverride, setDayOverride] = useState<string | null>(null)\n const date = dayOverride ?? eventDate\n\n const attendees = useMemo(() => draft.attendees ?? [], [draft.attendees])\n const roomEmails = useMemo(\n () => new Set(attendees.filter((a) => a.kind === 'room').map(attendeeKey)),\n [attendees]\n )\n const ids = useMemo(() => {\n const list = attendees.map(attendeeKey).filter(Boolean)\n if (me && !list.includes(me.toLowerCase())) list.unshift(me.toLowerCase())\n return list\n }, [attendees, me])\n const labelOf = (id: string) => {\n if (me && id === me.toLowerCase()) return 'You'\n const a = attendees.find((x) => attendeeKey(x) === id)\n return a?.name || a?.email || id\n }\n\n const dayStart = date ? `${date}T00:00:00Z` : null\n const fbWindow = date\n ? {\n start: new Date(Date.parse(`${date}T00:00:00Z`) - 86400_000).toISOString(),\n end: new Date(Date.parse(`${date}T00:00:00Z`) + 2 * 86400_000).toISOString(),\n }\n : null\n const freeBusy = useFreeBusy(open ? ids : [], fbWindow?.start ?? null, fbWindow?.end ?? null)\n const rows = useMemo(\n () => (date
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["/**\n * The editor's scheduling section: attendees' free/busy over the event's day (POST /freebusy), \"Find a\n * time\" (POST /find-time) that moves the draft. Collapsed until opened, so the editor does not fetch on every open.\n */\nimport { useMemo, useState } from 'react'\nimport { CalendarSearch } from 'lucide-react'\nimport { Button } from '@arbidocs/react/ui'\nimport { useArbi, useFindTime, useFreeBusy } from '@arbidocs/react'\nimport {\n SchedulingAssistant,\n applySuggestion,\n draftRangeUtc,\n freeBusyToRows,\n isAllDayDraft,\n toSuggestionViews,\n utcToDate,\n type EventDraft,\n type TimeSuggestionView,\n} from '../../calendar'\nimport { useBlocksEnvironment } from '../../provider/environment'\n\nexport interface EventSchedulingProps {\n draft: EventDraft\n onChange: (draft: EventDraft) => void\n timeZone: string\n workingStartHour?: number\n}\n\nconst attendeeKey = (a: NonNullable<EventDraft['attendees']>[number]) =>\n (a.email ?? a.user_id ?? '').toLowerCase()\n\nexport function EventScheduling({\n draft,\n onChange,\n timeZone,\n workingStartHour = 7,\n}: EventSchedulingProps) {\n const [open, setOpen] = useState(false)\n const { notify } = useBlocksEnvironment()\n const arbi = useArbi()\n const me = arbi.isLoggedIn ? (arbi.user.identity()?.email ?? null) : null\n const allDay = isAllDayDraft(draft)\n const range = useMemo(() => {\n try {\n const { startMs, endMs } = draftRangeUtc(draft, timeZone)\n if (!Number.isFinite(startMs) || !Number.isFinite(endMs) || endMs <= startMs) return null\n return { start: new Date(startMs).toISOString(), end: new Date(endMs).toISOString() }\n } catch {\n return null\n }\n }, [draft, timeZone])\n const eventDate = range ? utcToDate(range.start, timeZone) : null\n const [dayOverride, setDayOverride] = useState<string | null>(null)\n const date = dayOverride ?? eventDate\n\n const attendees = useMemo(() => draft.attendees ?? [], [draft.attendees])\n const roomEmails = useMemo(\n () => new Set(attendees.filter((a) => a.kind === 'room').map(attendeeKey)),\n [attendees]\n )\n const ids = useMemo(() => {\n const list = attendees.map(attendeeKey).filter(Boolean)\n if (me && !list.includes(me.toLowerCase())) list.unshift(me.toLowerCase())\n return list\n }, [attendees, me])\n const attendeeSetKey = JSON.stringify([...ids].sort())\n const labelOf = (id: string) => {\n if (me && id === me.toLowerCase()) return 'You'\n const a = attendees.find((x) => attendeeKey(x) === id)\n return a?.name || a?.email || id\n }\n\n const dayStart = date ? `${date}T00:00:00Z` : null\n const fbWindow = date\n ? {\n start: new Date(Date.parse(`${date}T00:00:00Z`) - 86400_000).toISOString(),\n end: new Date(Date.parse(`${date}T00:00:00Z`) + 2 * 86400_000).toISOString(),\n }\n : null\n const freeBusy = useFreeBusy(open ? ids : [], fbWindow?.start ?? null, fbWindow?.end ?? null)\n const rows = useMemo(\n () => {\n if (!date) return []\n // Previous query data can omit newly added attendees. Missing or stale availability is unknown.\n const entries = freeBusy.isPlaceholderData || freeBusy.isError ? [] : (freeBusy.data ?? [])\n return freeBusyToRows(\n ids.map(\n (id) =>\n entries.find((entry) => entry.attendee.toLowerCase() === id) ?? {\n attendee: id,\n known: false,\n busy: [],\n }\n ),\n date,\n labelOf,\n roomEmails\n )\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n freeBusy.data,\n freeBusy.isPlaceholderData,\n freeBusy.isError,\n date,\n ids,\n roomEmails,\n attendees,\n me,\n ]\n )\n\n const findTime = useFindTime()\n const [suggestions, setSuggestions] = useState<{\n attendeeSetKey: string\n values: TimeSuggestionView[]\n } | null>(null)\n const duration = range\n ? Math.round((Date.parse(range.end) - Date.parse(range.start)) / 60_000)\n : 30\n\n if (allDay) return null\n if (!open)\n return (\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={() => setOpen(true)}\n data-testid=\"calendar-open-scheduling\"\n >\n <CalendarSearch className=\"mr-1 size-4\" /> Scheduling assistant\n </Button>\n )\n\n return (\n <div\n className=\"space-y-4 rounded-md border border-border p-3\"\n data-testid=\"calendar-scheduling-section\"\n >\n {date && (\n <SchedulingAssistant\n date={date}\n timeZone={timeZone}\n rows={rows}\n selection={range ? { startUtc: range.start, endUtc: range.end } : null}\n dayStartHour={Math.max(0, Math.min(workingStartHour, 8) - 1)}\n dayEndHour={21}\n loading={freeBusy.isFetching}\n suggestions={suggestions?.attendeeSetKey === attendeeSetKey ? suggestions.values : null}\n finding={findTime.isPending}\n onDateChange={setDayOverride}\n onFindTime={() =>\n dayStart &&\n findTime.mutate(\n {\n attendees: ids,\n duration_minutes: Math.max(5, Math.min(duration, 24 * 60)),\n start: new Date(\n Math.max(Date.now(), Date.parse(dayStart) - 86400_000)\n ).toISOString(),\n end: new Date(Date.parse(dayStart) + 7 * 86400_000).toISOString(),\n working_hours_only: true,\n time_zone: timeZone,\n limit: 8,\n },\n {\n onSuccess: (s) => setSuggestions({ attendeeSetKey, values: toSuggestionViews(s) }),\n onError: (err) => notify(`Could not find times: ${err.message}`, 'error'),\n }\n )\n }\n onPickSuggestion={(s) => {\n onChange(applySuggestion(draft, s, timeZone))\n setDayOverride(null)\n }}\n />\n )}\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AA4HM,SAOE,KAPF;AAxHN,SAAS,SAAS,gBAAgB;AAClC,SAAS,sBAAsB;AAC/B,SAAS,cAAc;AACvB,SAAS,SAAS,aAAa,mBAAmB;AAClD;AAAA,EACE;AAAA,EACA;AAAA,EAC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AAK,KAAK,MAAM,QAAQ,IAAI,IAAI,KAAS,EAAE,YAAY;AAAA,cAChE,oBAAoB;AAAA,cACpB,WAAW;AAAA,cACX,OAAO;AAAA,YACT;AAAA,YACA;AAAA,cACE,WAAW,CAAC,MAAM,eAAe,EAAE,gBAAgB,QAAQ,kBAAkB,CAAC,EAAE,CAAC;AAAA,cACjF,SAAS,CAAC,QAAQ,OAAO,yBAAyB,IAAI,OAAO,IAAI,OAAO;AAAA,YAC1E;AAAA,UACF;AAAA,UAEF,kBAAkB,CAAC,MAAM;AACvB,qBAAS,gBAAgB,OAAO,GAAG,QAAQ,CAAC;AAC5C,2BAAe,IAAI;AAAA,UACrB;AAAA;AAAA,MACF;AAAA;AAAA,EAEJ;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -62,7 +62,6 @@ function AgentControlBar({
|
|
|
62
62
|
{
|
|
63
63
|
state: showState ? controlState : void 0,
|
|
64
64
|
stateLabel: STATE_LABEL[controlState],
|
|
65
|
-
isProbing: probePending,
|
|
66
65
|
waitingLabel: waitingOnChildren ? waitingLabel : void 0,
|
|
67
66
|
stepLabel,
|
|
68
67
|
stepIcon: CurrentStepIcon && /* @__PURE__ */ jsx(
|
|
@@ -115,7 +114,8 @@ function AgentControlBar({
|
|
|
115
114
|
(message) => !message.serverId || !queuedMessages.some((queued) => queued.external_id === message.serverId)
|
|
116
115
|
);
|
|
117
116
|
const queuedNotes = displayedQueuedMessages.filter((message) => message.content);
|
|
118
|
-
const below = probeAnswer || queuedNotes.length > 0 ? /* @__PURE__ */ jsxs(AgentBarNotes, { children: [
|
|
117
|
+
const below = probePending || probeAnswer || queuedNotes.length > 0 ? /* @__PURE__ */ jsxs(AgentBarNotes, { children: [
|
|
118
|
+
probePending && /* @__PURE__ */ jsx(AgentBarStatus, { isProbing: true }),
|
|
119
119
|
queuedNotes.map((message, index) => /* @__PURE__ */ jsx(
|
|
120
120
|
AgentBarQueuedNote,
|
|
121
121
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/connection/conversation/AgentControlBar.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * AgentControlBar \u2014 the live turn bar.\n *\n * While the agent is working, this renders in the pinned footer slot above the\n * composer (so it stays in view as the user scrolls) and owns the running turn:\n * current step + elapsed time, the steps drawer (collapsed, opens upward), Stop,\n * and a \u22EE menu to act on the agent out of band (Pause / Resume / Ask for status).\n *\n * It shares its chrome and steps drawer with the settled in-card bar via\n * {@link AgentBarShell}, so the two are a single visual modality \u2014 the bar simply\n * settles into the message bubble when the turn completes.\n *\n * The kebab menu is pure UX sugar over slash commands: each action emits the same\n * text (`/pause`, `/resume`, `/report`) the user could type in the composer, sent\n * through the normal interjection path and dispatched by the backend\n * (`human_input.send_message`). There is no dedicated control endpoint. See\n * `useAgentRunControl`.\n *\n * Reflected state:\n * - **Pausing\u2026 / Paused / Resuming\u2026** \u2014 from `arbi.agent_control_state`, plus an\n * optimistic hint set the instant an action is taken (the loop only confirms at\n * its next boundary).\n * - **Status update** \u2014 the answer to a `/report` probe, arriving out of band as\n * an `arbi.probe_answer` event. It never steers the agent or joins the\n * conversation; it's a transient note.\n *\n * All control state is transient (the session's `agentControl` maps), keyed by the\n * streaming assistant message id, and cleared when the turn completes.\n */\n\nimport { Pause, Play, Activity, Square } from 'lucide-react'\nimport {\n AgentBarIconButton,\n AgentBarMenu,\n AgentBarNotes,\n AgentBarProbeAnswer,\n AgentBarQueuedNote,\n AgentBarStatus,\n type AgentBarMenuItem,\n type AgentBarState,\n} from '../../agents/runs/AgentBar'\nimport { useAgentRunControl, useArbiSessionState } from '@arbidocs/react'\nimport { AgentBarShell } from './AgentBarShell'\nimport { MessageLiveSeconds, type MessageTimerSubscription } from './MessageLiveSeconds'\nimport { getCurrentStep, extractSubagentLanes, type AgentStepEvent } from '@arbidocs/sdk/browser'\nimport { getCurrentAgentStepPresentation } from '../../agents/runs/step-presentation'\n\nexport interface AgentControlBarProps {\n assistantMessageExtId: string\n /** Live step trace for the running turn \u2014 drives the status line + steps drawer. */\n agentSteps?: AgentStepEvent[]\n /** Message timer subscription for the running turn (drives the elapsed ticker). */\n liveTimer?: MessageTimerSubscription\n /** Abort the running turn. */\n onStop?: () => void\n /** User prompts accepted by the backend and waiting on this turn. */\n queuedMessages?: Array<{ external_id: string; content: string | null }>\n}\n\nconst STATE_LABEL: Record<string, string> = {\n pausing: 'Pausing\u2026',\n paused: 'Paused',\n resuming: 'Resuming\u2026',\n}\n\nexport function AgentControlBar({\n assistantMessageExtId,\n agentSteps,\n liveTimer,\n onStop,\n queuedMessages = [],\n}: AgentControlBarProps) {\n const controlState = useArbiSessionState(\n (s) => s.agentControlStates[assistantMessageExtId] ?? 'running'\n )\n const probeAnswer = useArbiSessionState((s) => s.agentProbeAnswers[assistantMessageExtId])\n const probePending = useArbiSessionState(\n (s) => s.agentProbePending[assistantMessageExtId] ?? false\n )\n const transientQueuedMessages = useArbiSessionState(\n (s) => s.queuedMessages[assistantMessageExtId]\n )\n const { pause, resume, report } = useAgentRunControl(assistantMessageExtId)\n\n const showState = controlState !== 'running'\n // Show Resume once the loop is (or is about to be) paused; Pause otherwise.\n const isPaused = controlState === 'paused' || controlState === 'resuming'\n\n const steps = agentSteps ?? []\n const currentStep = getCurrentStep(steps)\n const currentPresentation = getCurrentAgentStepPresentation(steps)\n const CurrentStepIcon = currentPresentation?.Icon\n const stepLabel = currentPresentation?.description ?? 'Agent working\u2026'\n\n // When the agent has dispatched sub-agents and its own latest move was to\n // manage/await them (a deep_research / sub_agent / skill call that blocks on a\n // child), the main line should say it's WAITING \u2014 otherwise it sits frozen on\n // \"Sub-agent \u2014 working\" for the child's whole duration, which reads as stuck and\n // duplicates the roster below. The children report their own progress on their\n // own lines; this line just names who it's waiting on.\n const runningLanes = extractSubagentLanes(steps).filter((l) => l.status === 'running')\n const currentTool = currentPresentation?.tool\n const waitingOnChildren =\n runningLanes.length > 0 &&\n ['sub_agent', 'spawn_subagent', 'deep_research', 'run_skill'].includes(currentTool ?? '')\n const waitingLabel =\n runningLanes.length === 1\n ? `Waiting on ${runningLanes[0].job}`\n : `Waiting on ${runningLanes.length} sub-agents`\n\n // The timer sits next to the current step's name, so it measures that step \u2014 the\n // same figure the steps drawer shows on the live row (elapsed minus the step's\n // start). Showing the whole turn's elapsed here put two different numbers on one step.\n const liveTimerNode = liveTimer && (\n <MessageLiveSeconds\n {...liveTimer}\n offsetSeconds={currentStep?.t ?? 0}\n fallbackSeconds={0}\n minDisplaySeconds={0.05}\n />\n )\n const status = (\n <AgentBarStatus\n state={showState ? (controlState as AgentBarState) : undefined}\n stateLabel={STATE_LABEL[controlState]}\n
|
|
5
|
-
"mappings": ";AAkHI,
|
|
4
|
+
"sourcesContent": ["/**\n * AgentControlBar \u2014 the live turn bar.\n *\n * While the agent is working, this renders in the pinned footer slot above the\n * composer (so it stays in view as the user scrolls) and owns the running turn:\n * current step + elapsed time, the steps drawer (collapsed, opens upward), Stop,\n * and a \u22EE menu to act on the agent out of band (Pause / Resume / Ask for status).\n *\n * It shares its chrome and steps drawer with the settled in-card bar via\n * {@link AgentBarShell}, so the two are a single visual modality \u2014 the bar simply\n * settles into the message bubble when the turn completes.\n *\n * The kebab menu is pure UX sugar over slash commands: each action emits the same\n * text (`/pause`, `/resume`, `/report`) the user could type in the composer, sent\n * through the normal interjection path and dispatched by the backend\n * (`human_input.send_message`). There is no dedicated control endpoint. See\n * `useAgentRunControl`.\n *\n * Reflected state:\n * - **Pausing\u2026 / Paused / Resuming\u2026** \u2014 from `arbi.agent_control_state`, plus an\n * optimistic hint set the instant an action is taken (the loop only confirms at\n * its next boundary).\n * - **Status update** \u2014 the answer to a `/report` probe, arriving out of band as\n * an `arbi.probe_answer` event. It never steers the agent or joins the\n * conversation; it's a transient note.\n *\n * All control state is transient (the session's `agentControl` maps), keyed by the\n * streaming assistant message id, and cleared when the turn completes.\n */\n\nimport { Pause, Play, Activity, Square } from 'lucide-react'\nimport {\n AgentBarIconButton,\n AgentBarMenu,\n AgentBarNotes,\n AgentBarProbeAnswer,\n AgentBarQueuedNote,\n AgentBarStatus,\n type AgentBarMenuItem,\n type AgentBarState,\n} from '../../agents/runs/AgentBar'\nimport { useAgentRunControl, useArbiSessionState } from '@arbidocs/react'\nimport { AgentBarShell } from './AgentBarShell'\nimport { MessageLiveSeconds, type MessageTimerSubscription } from './MessageLiveSeconds'\nimport { getCurrentStep, extractSubagentLanes, type AgentStepEvent } from '@arbidocs/sdk/browser'\nimport { getCurrentAgentStepPresentation } from '../../agents/runs/step-presentation'\n\nexport interface AgentControlBarProps {\n assistantMessageExtId: string\n /** Live step trace for the running turn \u2014 drives the status line + steps drawer. */\n agentSteps?: AgentStepEvent[]\n /** Message timer subscription for the running turn (drives the elapsed ticker). */\n liveTimer?: MessageTimerSubscription\n /** Abort the running turn. */\n onStop?: () => void\n /** User prompts accepted by the backend and waiting on this turn. */\n queuedMessages?: Array<{ external_id: string; content: string | null }>\n}\n\nconst STATE_LABEL: Record<string, string> = {\n pausing: 'Pausing\u2026',\n paused: 'Paused',\n resuming: 'Resuming\u2026',\n}\n\nexport function AgentControlBar({\n assistantMessageExtId,\n agentSteps,\n liveTimer,\n onStop,\n queuedMessages = [],\n}: AgentControlBarProps) {\n const controlState = useArbiSessionState(\n (s) => s.agentControlStates[assistantMessageExtId] ?? 'running'\n )\n const probeAnswer = useArbiSessionState((s) => s.agentProbeAnswers[assistantMessageExtId])\n const probePending = useArbiSessionState(\n (s) => s.agentProbePending[assistantMessageExtId] ?? false\n )\n const transientQueuedMessages = useArbiSessionState(\n (s) => s.queuedMessages[assistantMessageExtId]\n )\n const { pause, resume, report } = useAgentRunControl(assistantMessageExtId)\n\n const showState = controlState !== 'running'\n // Show Resume once the loop is (or is about to be) paused; Pause otherwise.\n const isPaused = controlState === 'paused' || controlState === 'resuming'\n\n const steps = agentSteps ?? []\n const currentStep = getCurrentStep(steps)\n const currentPresentation = getCurrentAgentStepPresentation(steps)\n const CurrentStepIcon = currentPresentation?.Icon\n const stepLabel = currentPresentation?.description ?? 'Agent working\u2026'\n\n // When the agent has dispatched sub-agents and its own latest move was to\n // manage/await them (a deep_research / sub_agent / skill call that blocks on a\n // child), the main line should say it's WAITING \u2014 otherwise it sits frozen on\n // \"Sub-agent \u2014 working\" for the child's whole duration, which reads as stuck and\n // duplicates the roster below. The children report their own progress on their\n // own lines; this line just names who it's waiting on.\n const runningLanes = extractSubagentLanes(steps).filter((l) => l.status === 'running')\n const currentTool = currentPresentation?.tool\n const waitingOnChildren =\n runningLanes.length > 0 &&\n ['sub_agent', 'spawn_subagent', 'deep_research', 'run_skill'].includes(currentTool ?? '')\n const waitingLabel =\n runningLanes.length === 1\n ? `Waiting on ${runningLanes[0].job}`\n : `Waiting on ${runningLanes.length} sub-agents`\n\n // The timer sits next to the current step's name, so it measures that step \u2014 the\n // same figure the steps drawer shows on the live row (elapsed minus the step's\n // start). Showing the whole turn's elapsed here put two different numbers on one step.\n const liveTimerNode = liveTimer && (\n <MessageLiveSeconds\n {...liveTimer}\n offsetSeconds={currentStep?.t ?? 0}\n fallbackSeconds={0}\n minDisplaySeconds={0.05}\n />\n )\n const status = (\n <AgentBarStatus\n state={showState ? (controlState as AgentBarState) : undefined}\n stateLabel={STATE_LABEL[controlState]}\n waitingLabel={waitingOnChildren ? waitingLabel : undefined}\n stepLabel={stepLabel}\n stepIcon={\n CurrentStepIcon && (\n <CurrentStepIcon\n className=\"h-4 w-4 shrink-0 animate-pulse text-yellow-text\"\n aria-hidden=\"true\"\n />\n )\n }\n timer={liveTimerNode}\n />\n )\n\n const menuItems: AgentBarMenuItem[] = [\n isPaused\n ? {\n id: 'resume',\n label: 'Resume',\n icon: <Play className=\"mr-2 h-4 w-4\" />,\n onSelect: resume,\n testId: 'agent-resume-action',\n }\n : {\n id: 'pause',\n label: 'Pause',\n icon: <Pause className=\"mr-2 h-4 w-4\" />,\n onSelect: pause,\n testId: 'agent-pause-action',\n },\n {\n id: 'report',\n label: 'Ask for status',\n icon: <Activity className=\"mr-2 h-4 w-4\" />,\n onSelect: report,\n disabled: probePending,\n testId: 'agent-report-action',\n },\n ]\n\n const controls = (\n <>\n {onStop && (\n <AgentBarIconButton\n onClick={onStop}\n title=\"Stop\"\n aria-label=\"Stop generating\"\n data-testid=\"stop-generating-button\"\n >\n <Square className=\"h-3 w-3\" fill=\"currentColor\" />\n </AgentBarIconButton>\n )}\n <AgentBarMenu items={menuItems} />\n </>\n )\n\n // The thread already shows each follow-up the server has placed (`queuedMessages`), so the bar\n // only adds the ones it does not show yet. Repeating a placed one here showed it twice.\n const displayedQueuedMessages = (transientQueuedMessages ?? []).filter(\n (message) =>\n !message.serverId || !queuedMessages.some((queued) => queued.external_id === message.serverId)\n )\n // One row per queued message: the note clamps to two lines, so a combined note\n // would hide every follow-up after the first.\n const queuedNotes = displayedQueuedMessages.filter((message) => message.content)\n const below =\n probePending || probeAnswer || queuedNotes.length > 0 ? (\n <AgentBarNotes>\n {probePending && <AgentBarStatus isProbing />}\n {queuedNotes.map((message, index) => (\n <AgentBarQueuedNote\n key={index}\n text={message.content ?? ''}\n isAcknowledged={message.acknowledged}\n />\n ))}\n {probeAnswer && <AgentBarProbeAnswer answer={probeAnswer.answer} />}\n </AgentBarNotes>\n ) : null\n\n return (\n <AgentBarShell\n className=\"mb-2\"\n testId=\"agent-control-bar\"\n controlStateAttr={controlState}\n steps={steps}\n isStreaming\n liveTimer={liveTimer}\n status={status}\n controls={controls}\n below={below}\n />\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAkHI,SAoDA,UApDA,KAoDA,YApDA;AApFJ,SAAS,OAAO,MAAM,UAAU,cAAc;AAC9C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP,SAAS,oBAAoB,2BAA2B;AACxD,SAAS,qBAAqB;AAC9B,SAAS,0BAAyD;AAClE,SAAS,gBAAgB,4BAAiD;AAC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S,IAClD,qBAAC,iBACE;AAAA,oBAAgB,oBAAC,kBAAe,WAAS,MAAC;AAAA,IAC1C,YAAY,IAAI,CAAC,SAAS,UACzB;AAAA,MAAC;AAAA;AAAA,QAEC,MAAM,QAAQ,WAAW;AAAA,QACzB,gBAAgB,QAAQ;AAAA;AAAA,MAFnB;AAAA,IAGP,CACD;AAAA,IACA,eAAe,oBAAC,uBAAoB,QAAQ,YAAY,QAAQ;AAAA,KACnE,IACE;AAEN,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV,QAAO;AAAA,MACP,kBAAkB;AAAA,MAClB;AAAA,MACA,aAAW;AAAA,MACX;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -5,6 +5,15 @@ import { ChevronRight, Download } from "lucide-react";
|
|
|
5
5
|
import { cn } from "@arbidocs/react/ui";
|
|
6
6
|
import { downloadTableAsCsv } from "../../chat/table-csv.js";
|
|
7
7
|
import { notify } from "@arbidocs/react/shell";
|
|
8
|
+
function hasSimpleColumnGrid(table) {
|
|
9
|
+
const headerRows = table.tHead?.rows;
|
|
10
|
+
if (!headerRows || headerRows.length !== 1) return false;
|
|
11
|
+
const columns = headerRows[0].cells.length;
|
|
12
|
+
if (columns === 0 || columns > 5) return false;
|
|
13
|
+
return Array.from(table.rows).every(
|
|
14
|
+
(row) => row.cells.length === columns && Array.from(row.cells).every((cell) => cell.colSpan === 1 && cell.rowSpan === 1)
|
|
15
|
+
);
|
|
16
|
+
}
|
|
8
17
|
function AnswerTable({
|
|
9
18
|
children,
|
|
10
19
|
className,
|
|
@@ -13,9 +22,13 @@ function AnswerTable({
|
|
|
13
22
|
const wrapperRef = useRef(null);
|
|
14
23
|
const scrollRef = useRef(null);
|
|
15
24
|
const [hasMoreRight, setHasMoreRight] = useState(false);
|
|
25
|
+
const [fitsColumns, setFitsColumns] = useState(false);
|
|
16
26
|
const checkOverflow = useCallback(() => {
|
|
17
27
|
const el = scrollRef.current;
|
|
18
28
|
if (!el) return;
|
|
29
|
+
const table = el.querySelector("table");
|
|
30
|
+
const canFit = !!table && hasSimpleColumnGrid(table) && el.clientWidth >= 560;
|
|
31
|
+
setFitsColumns((prev) => prev === canFit ? prev : canFit);
|
|
19
32
|
const more = el.scrollLeft + el.clientWidth < el.scrollWidth - 1;
|
|
20
33
|
setHasMoreRight((prev) => prev === more ? prev : more);
|
|
21
34
|
}, []);
|
|
@@ -27,7 +40,7 @@ function AnswerTable({
|
|
|
27
40
|
observer.observe(el);
|
|
28
41
|
if (el.firstElementChild) observer.observe(el.firstElementChild);
|
|
29
42
|
return () => observer.disconnect();
|
|
30
|
-
}, [checkOverflow]);
|
|
43
|
+
}, [checkOverflow, fitsColumns]);
|
|
31
44
|
const scrollRight = useCallback(() => {
|
|
32
45
|
const el = scrollRef.current;
|
|
33
46
|
if (!el) return;
|
|
@@ -87,8 +100,12 @@ function AnswerTable({
|
|
|
87
100
|
"table",
|
|
88
101
|
{
|
|
89
102
|
"data-testid": "markdown-table",
|
|
103
|
+
"data-fit-columns": fitsColumns ? "" : void 0,
|
|
90
104
|
...props,
|
|
91
|
-
className: cn(
|
|
105
|
+
className: cn(
|
|
106
|
+
fitsColumns ? "w-full table-fixed [&_td]:min-w-0 [&_th]:min-w-0 [&_td]:[overflow-wrap:anywhere] [&_th]:[overflow-wrap:anywhere] [&_td_*]:[overflow-wrap:anywhere] [&_th_*]:[overflow-wrap:anywhere]" : "[&_td]:min-w-36 [&_th]:min-w-36",
|
|
107
|
+
className
|
|
108
|
+
),
|
|
92
109
|
children
|
|
93
110
|
}
|
|
94
111
|
)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/connection/conversation/AnswerTable.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { useCallback, useEffect, useRef, useState } from 'react'\nimport { ChevronRight, Download } from 'lucide-react'\nimport { cn } from '@arbidocs/react/ui'\nimport { downloadTableAsCsv } from '../../chat/table-csv'\nimport { notify } from '@arbidocs/react/shell'\n\n/**\n * A markdown table inside an assistant answer, with a \"Download CSV\" button.\n *\n * The table scrolls sideways inside its own box when it is wider than the answer, so\n * no column is clipped. The button sits in a row above the table, so it never covers a\n * header, and only shows on hover or keyboard focus (always on touch screens), so it\n * doesn't clutter the answer; it stays in the tab order so keyboard users can always reach it.\n *\n * A table's sideways scrollbar sits at its bottom edge, often far below the screen, and phones\n * hide scrollbars until you scroll. So while columns are still off to the right, a fade on the\n * right edge and a labelled \"Scroll right\" button in the row above the table say there is more.\n * The button scrolls the table on tap and sits outside the table, so it never covers a header.\n * Both go away once you reach the end.\n */\nexport function AnswerTable({\n children,\n className,\n ...props\n}: React.ComponentPropsWithoutRef<'table'>): React.JSX.Element {\n const wrapperRef = useRef<HTMLDivElement>(null)\n const scrollRef = useRef<HTMLDivElement>(null)\n const [hasMoreRight, setHasMoreRight] = useState(false)\n\n const checkOverflow = useCallback(() => {\n const el = scrollRef.current\n if (!el) return\n const more = el.scrollLeft + el.clientWidth < el.scrollWidth - 1\n // Equality-guarded so scrolling or resizing doesn't re-render when nothing changed.\n setHasMoreRight((prev) => (prev === more ? prev : more))\n }, [])\n\n useEffect(() => {\n const el = scrollRef.current\n if (!el) return\n checkOverflow()\n const observer = new ResizeObserver(checkOverflow)\n observer.observe(el)\n if (el.firstElementChild) observer.observe(el.firstElementChild)\n return () => observer.disconnect()\n }, [checkOverflow])\n\n const scrollRight = useCallback(() => {\n const el = scrollRef.current\n if (!el) return\n el.scrollBy({ left: 240, behavior: 'smooth' })\n }, [])\n\n const handleDownload = useCallback(async () => {\n const table = wrapperRef.current?.querySelector('table')\n if (!table || !wrapperRef.current) return\n try {\n const filename = await downloadTableAsCsv(table, wrapperRef.current)\n notify.success(`Saved ${filename}`)\n } catch (error) {\n console.error('Failed to download table as CSV', error)\n notify.error('Could not download the table as CSV')\n }\n }, [])\n\n return (\n <div ref={wrapperRef} className=\"group/answer-table w-fit min-w-0 max-w-full\">\n <div className=\"flex items-center justify-end gap-2 pb-1\">\n {hasMoreRight && (\n <button\n type=\"button\"\n onClick={scrollRight}\n data-testid=\"answer-table-scroll-right\"\n className=\"flex items-center gap-1 rounded border border-border bg-background/90 px-1.5 py-0.5 text-xs text-foreground shadow-sm transition-colors hover:bg-muted\"\n >\n <span>Scroll right</span>\n <ChevronRight size={12} aria-hidden=\"true\" />\n </button>\n )}\n <button\n type=\"button\"\n onClick={handleDownload}\n data-testid=\"answer-table-download-csv\"\n aria-label=\"Download table as CSV\"\n title=\"Download as CSV\"\n className=\"flex items-center gap-1 rounded border border-border bg-background/90 px-1.5 py-0.5 text-xs text-muted-foreground opacity-0 shadow-sm transition-opacity hover:text-foreground focus-visible:opacity-100 group-hover/answer-table:opacity-100 group-focus-within/answer-table:opacity-100 pointer-coarse:opacity-100\"\n >\n <Download size={12} aria-hidden=\"true\" />\n <span>CSV</span>\n </button>\n </div>\n {/* Wide tables scroll sideways inside the bubble instead of running past its edge. */}\n <div className=\"relative min-w-0 max-w-full\">\n <div\n ref={scrollRef}\n onScroll={checkOverflow}\n className=\"scrollbar-subtle max-w-full overflow-x-auto pb-1\"\n data-testid=\"answer-table-scroll\"\n >\n {/* Each column keeps a readable width, so on a phone the table scrolls sideways\n instead of squeezing every column to a word or two per line. */}\n <table\n data-testid=\"markdown-table\"\n {...props}\n className={cn('[&_td]:min-w-36 [&_th]:min-w-36'
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["import React, { useCallback, useEffect, useRef, useState } from 'react'\nimport { ChevronRight, Download } from 'lucide-react'\nimport { cn } from '@arbidocs/react/ui'\nimport { downloadTableAsCsv } from '../../chat/table-csv'\nimport { notify } from '@arbidocs/react/shell'\n\nfunction hasSimpleColumnGrid(table: HTMLTableElement): boolean {\n const headerRows = table.tHead?.rows\n if (!headerRows || headerRows.length !== 1) return false\n const columns = headerRows[0].cells.length\n if (columns === 0 || columns > 5) return false\n\n return Array.from(table.rows).every(\n (row) =>\n row.cells.length === columns &&\n Array.from(row.cells).every((cell) => cell.colSpan === 1 && cell.rowSpan === 1)\n )\n}\n\n/**\n * A markdown table inside an assistant answer, with a \"Download CSV\" button.\n *\n * The table scrolls sideways inside its own box when it is wider than the answer, so\n * no column is clipped. The button sits in a row above the table, so it never covers a\n * header, and only shows on hover or keyboard focus (always on touch screens), so it\n * doesn't clutter the answer; it stays in the tab order so keyboard users can always reach it.\n *\n * A table's sideways scrollbar sits at its bottom edge, often far below the screen, and phones\n * hide scrollbars until you scroll. So while columns are still off to the right, a fade on the\n * right edge and a labelled \"Scroll right\" button in the row above the table say there is more.\n * The button scrolls the table on tap and sits outside the table, so it never covers a header.\n * Both go away once you reach the end.\n */\nexport function AnswerTable({\n children,\n className,\n ...props\n}: React.ComponentPropsWithoutRef<'table'>): React.JSX.Element {\n const wrapperRef = useRef<HTMLDivElement>(null)\n const scrollRef = useRef<HTMLDivElement>(null)\n const [hasMoreRight, setHasMoreRight] = useState(false)\n const [fitsColumns, setFitsColumns] = useState(false)\n\n const checkOverflow = useCallback(() => {\n const el = scrollRef.current\n if (!el) return\n const table = el.querySelector('table')\n const canFit = !!table && hasSimpleColumnGrid(table) && el.clientWidth >= 560\n setFitsColumns((prev) => (prev === canFit ? prev : canFit))\n const more = el.scrollLeft + el.clientWidth < el.scrollWidth - 1\n // Equality-guarded so scrolling or resizing doesn't re-render when nothing changed.\n setHasMoreRight((prev) => (prev === more ? prev : more))\n }, [])\n\n useEffect(() => {\n const el = scrollRef.current\n if (!el) return\n checkOverflow()\n const observer = new ResizeObserver(checkOverflow)\n observer.observe(el)\n if (el.firstElementChild) observer.observe(el.firstElementChild)\n return () => observer.disconnect()\n }, [checkOverflow, fitsColumns])\n\n const scrollRight = useCallback(() => {\n const el = scrollRef.current\n if (!el) return\n el.scrollBy({ left: 240, behavior: 'smooth' })\n }, [])\n\n const handleDownload = useCallback(async () => {\n const table = wrapperRef.current?.querySelector('table')\n if (!table || !wrapperRef.current) return\n try {\n const filename = await downloadTableAsCsv(table, wrapperRef.current)\n notify.success(`Saved ${filename}`)\n } catch (error) {\n console.error('Failed to download table as CSV', error)\n notify.error('Could not download the table as CSV')\n }\n }, [])\n\n return (\n <div ref={wrapperRef} className=\"group/answer-table w-fit min-w-0 max-w-full\">\n <div className=\"flex items-center justify-end gap-2 pb-1\">\n {hasMoreRight && (\n <button\n type=\"button\"\n onClick={scrollRight}\n data-testid=\"answer-table-scroll-right\"\n className=\"flex items-center gap-1 rounded border border-border bg-background/90 px-1.5 py-0.5 text-xs text-foreground shadow-sm transition-colors hover:bg-muted\"\n >\n <span>Scroll right</span>\n <ChevronRight size={12} aria-hidden=\"true\" />\n </button>\n )}\n <button\n type=\"button\"\n onClick={handleDownload}\n data-testid=\"answer-table-download-csv\"\n aria-label=\"Download table as CSV\"\n title=\"Download as CSV\"\n className=\"flex items-center gap-1 rounded border border-border bg-background/90 px-1.5 py-0.5 text-xs text-muted-foreground opacity-0 shadow-sm transition-opacity hover:text-foreground focus-visible:opacity-100 group-hover/answer-table:opacity-100 group-focus-within/answer-table:opacity-100 pointer-coarse:opacity-100\"\n >\n <Download size={12} aria-hidden=\"true\" />\n <span>CSV</span>\n </button>\n </div>\n {/* Wide tables scroll sideways inside the bubble instead of running past its edge. */}\n <div className=\"relative min-w-0 max-w-full\">\n <div\n ref={scrollRef}\n onScroll={checkOverflow}\n className=\"scrollbar-subtle max-w-full overflow-x-auto pb-1\"\n data-testid=\"answer-table-scroll\"\n >\n {/* Each column keeps a readable width, so on a phone the table scrolls sideways\n instead of squeezing every column to a word or two per line. */}\n <table\n data-testid=\"markdown-table\"\n data-fit-columns={fitsColumns ? '' : undefined}\n {...props}\n className={cn(\n fitsColumns\n ? 'w-full table-fixed [&_td]:min-w-0 [&_th]:min-w-0 [&_td]:[overflow-wrap:anywhere] [&_th]:[overflow-wrap:anywhere] [&_td_*]:[overflow-wrap:anywhere] [&_th_*]:[overflow-wrap:anywhere]'\n : '[&_td]:min-w-36 [&_th]:min-w-36',\n className\n )}\n >\n {children}\n </table>\n </div>\n {hasMoreRight && (\n <div\n aria-hidden=\"true\"\n data-testid=\"answer-table-fade\"\n className=\"pointer-events-none absolute inset-y-0 right-0 w-10 bg-linear-to-l from-background to-transparent\"\n />\n )}\n </div>\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAsFU,SAME,KANF;AAtFV,SAAgB,aAAa,WAAW,QAAQ,gBAAgB;AAChE,SAAS,cAAc,gBAAgB;AACvC,SAAS,UAAU;AACnB,SAAS,0BAA0B;AACnC,SAAS,cAAc;AAEvB,SAAS,oBAAoB,OAAkC;AAC7D,QAAM,aAAa,MAAM,OAAO;AAChC,MAAI,CAAC,cAAc,WAAW,WAAW,EAAG,QAAO;AACnD,QAAM,UAAU,WAAW,CAAC,EAAE,MAAM;AACpC,MAAI,YAAY,KAAK,UAAU,EAAG,QAAO;AAEzC,SAAO,MAAM,KAAK,MAAM,IAAI,EAAE;AAAA,IAC5B,CAAC,QACC,IAAI,MAAM,WAAW,WACrB,MAAM,KAAK,IAAI,KAAK,EAAE,MAAM,CAAC,SAAS,KAAK,YAAY,KAAK,KAAK,YAAY,CAAC;AAAA,EAClF;AACF;AAgBO,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAA+D;AAC7D,QAAM,aAAa,OAAuB,IAAI;AAC9C,QAAM,YAAY,OAAuB,IAAI;AAC7C,QAAM,CAAC,cAAc,eAAe,IAAI,SAAS,KAAK;AACtD,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,KAAK;AAEpD,QAAM,gBAAgB,YAAY,MAAM;AACtC,UAAM,KAAK,UAAU;AACrB,QAAI,CAAC,GAAI;AACT,UAAM,QAAQ,GAAG,cAAc,OAAO;AACtC,UAAM,SAAS,CAAC,CAAC,SAAS,oBAAoB,KAAK,KAAK,GAAG,eAAe;AAC1E,mBAAe,CAAC,SAAU,SAAS,SA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AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,SAAS;AAAA,UACT,eAAY;AAAA,UACZ,cAAW;AAAA,UACX,OAAM;AAAA,UACN,WAAU;AAAA,UAEV;AAAA,gCAAC,YAAS,MAAM,IAAI,eAAY,QAAO;AAAA,YACvC,oBAAC,UAAK,iBAAG;AAAA;AAAA;AAAA,MACX;AAAA,OACF;AAAA,IAEA,qBAAC,SAAI,WAAU,+BACb;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,KAAK;AAAA,UACL,UAAU;AAAA,UACV,WAAU;AAAA,UACV,eAAY;AAAA,UAIZ;AAAA,YAAC;AAAA;AAAA,cACC,eAAY;AAAA,cACZ,oBAAkB,cAAc,KAAK;AAAA,cACpC,GAAG;AAAA,cACJ,WAAW;AAAA,gBACT,cACI,yLACA;AAAA,gBACJ;AAAA,cACF;AAAA,cAEC;AAAA;AAAA,UACH;AAAA;AAAA,MACF;AAAA,MACC,gBACC;AAAA,QAAC;AAAA;AAAA,UACC,eAAY;AAAA,UACZ,eAAY;AAAA,UACZ,WAAU;AAAA;AAAA,MACZ;AAAA,OAEJ;AAAA,KACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -140,11 +140,6 @@ const ConversationComposerComponent = function ConversationComposer({
|
|
|
140
140
|
if (recipient.handleKeyDown(event)) return;
|
|
141
141
|
if (slashNav.handleKeyDown(event)) return;
|
|
142
142
|
if (mention.nav.handleKeyDown(event)) return;
|
|
143
|
-
if (followUp && event.key === "Tab" && !event.shiftKey) {
|
|
144
|
-
event.preventDefault();
|
|
145
|
-
setNewMessage(followUp);
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
143
|
if (event.key === "Escape" && isBranching && onCancelBranching) {
|
|
149
144
|
event.preventDefault();
|
|
150
145
|
onCancelBranching();
|
|
@@ -189,6 +184,34 @@ const ConversationComposerComponent = function ConversationComposer({
|
|
|
189
184
|
onSelect: mention.pick
|
|
190
185
|
}
|
|
191
186
|
),
|
|
187
|
+
followUp && /* @__PURE__ */ jsxs(
|
|
188
|
+
"div",
|
|
189
|
+
{
|
|
190
|
+
className: "mb-2 flex items-start gap-3 rounded-md border border-border bg-background p-3",
|
|
191
|
+
"data-testid": "follow-up-suggestion",
|
|
192
|
+
children: [
|
|
193
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
194
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs font-medium text-muted-foreground", children: "Suggested follow-up" }),
|
|
195
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-foreground", children: followUp })
|
|
196
|
+
] }),
|
|
197
|
+
/* @__PURE__ */ jsx(
|
|
198
|
+
Button,
|
|
199
|
+
{
|
|
200
|
+
type: "button",
|
|
201
|
+
variant: "outline",
|
|
202
|
+
size: "sm",
|
|
203
|
+
className: "shrink-0",
|
|
204
|
+
onClick: () => {
|
|
205
|
+
setNewMessage(followUp);
|
|
206
|
+
requestAnimationFrame(() => textareaRef.current?.focus());
|
|
207
|
+
},
|
|
208
|
+
"data-testid": "follow-up-suggestion-button",
|
|
209
|
+
children: "Use suggestion"
|
|
210
|
+
}
|
|
211
|
+
)
|
|
212
|
+
]
|
|
213
|
+
}
|
|
214
|
+
),
|
|
192
215
|
/* @__PURE__ */ jsx(
|
|
193
216
|
Composer.Input,
|
|
194
217
|
{
|
|
@@ -210,9 +233,8 @@ const ConversationComposerComponent = function ConversationComposer({
|
|
|
210
233
|
requestAnimationFrame(() => textareaRef.current?.focus());
|
|
211
234
|
},
|
|
212
235
|
isRoomy: isConversationEmpty,
|
|
213
|
-
isSuggestion: !!followUp,
|
|
214
236
|
compact,
|
|
215
|
-
placeholder:
|
|
237
|
+
placeholder: placeholder || (isBranching ? "Edit message to create a branch..." : isThread ? "Message the thread\u2026 @mention someone to notify them" : isGenerating ? "Type your next prompt..." : assistant.askAnythingPlaceholder)
|
|
216
238
|
}
|
|
217
239
|
),
|
|
218
240
|
/* @__PURE__ */ jsx(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/connection/conversation/ConversationComposer.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * The conversation's composer: the `Composer` block bound to the session's draft, the slash menu\n * (the backend's built-in commands and the user's skills), @mentions of the workspace's people,\n * and the backend-suggested follow-up. Layout, long-paste folding, menu rendering and keyboard\n * navigation are the `Composer` parts'; what a send does is the caller's (`handleSendMessage`).\n */\n\nimport { Button } from '@arbidocs/react/ui'\nimport React, { useEffect, useLayoutEffect, useMemo, useRef, memo, type ReactNode } from 'react'\nimport { Settings } from 'lucide-react'\nimport {\n buildMentionCandidates,\n selectDraft,\n useArbiSession,\n useArbiSessionState,\n useArbiSessionStore,\n useConversations,\n useWorkspaceUsers,\n} from '@arbidocs/react'\nimport { useAssistantName, useAssistantCopy } from '@arbidocs/react/shell'\nimport type { ContextUsage } from '@arbidocs/sdk/browser'\nimport { Composer } from '../../chat/Composer'\nimport { useHintsVisibility } from '../tips/useContextualHints'\nimport { MentionMenu } from '../../chat/MentionMenu'\nimport { SlashMenu, type SlashMenuItem } from '../../chat/SlashMenu'\nimport { useListKeyNav } from '../../lib/useListKeyNav'\nimport { useLongPaste } from '../../lib/useLongPaste'\nimport { useMentionAutocomplete } from '../../chat/useMentionAutocomplete'\nimport { useRecipientDraft } from '../../chat/useRecipientDraft'\nimport { ContextUsageBar } from '../../chat/ContextUsageBar'\nimport type { WorkflowDefinition } from '../../agents/workflows/types'\nimport { useSlashItems } from './useSlashItems'\nimport { BUILTIN_SKILLS } from '../../agents/workflows/catalogue/seed'\n\nconst NO_SKILLS: ReadonlyArray<WorkflowDefinition> = []\n\n/** What picking a skill in the slash menu does (the host's workflow launcher). */\nexport interface ComposerSkills {\n /** A picked skill: open its launcher. True when it did (the composer then clears the draft). */\n openFor: (item: SlashMenuItem) => boolean\n}\n\nexport interface ConversationComposerProps {\n /** The draft, controlled (default: the session's draft for the open conversation). */\n value?: string\n /** Set the controlled draft. */\n onValueChange?: (value: string) => void\n /** Function to handle sending the message */\n handleSendMessage: () => void\n /** Whether an AI response is currently being generated */\n isGenerating?: boolean\n /** Compact presentation is opt-in; the full app retains its existing layout. */\n compact?: boolean\n /** Reference to the input element for focus management */\n inputRef?: React.RefObject<HTMLTextAreaElement | null>\n /** Flag indicating if we're currently creating a branch */\n isBranching?: boolean\n /** Function to cancel branch creation */\n onCancelBranching?: () => void\n /** Custom placeholder text */\n placeholder?: string\n /** Function to open settings popup */\n onOpenSettings?: () => void\n /** Optional left button element (e.g., paperclip button) */\n leftButton?: React.ReactNode\n /** Optional right button element (e.g., send/stop button) */\n rightButton?: React.ReactNode\n /** The model selector, before `rightButton` (the host's). */\n modelSelector?: ReactNode\n /**\n * What picking a skill does (its form). With it the menu offers the built-in skills too; without\n * it, only what is typed as `/slug` (commands, the host's packs, the user's skills).\n */\n skills?: ComposerSkills\n /** The slash menu's \"Browse all\" opens the host's skills browser. */\n onBrowseSkills?: () => void\n /** Context usage data from the latest assistant message */\n contextUsage?: ContextUsage | null\n /** Whether this is an empty conversation (taller, more inviting input + warmer placeholder) */\n isConversationEmpty?: boolean\n /**\n * Offer the backend's follow-up chip. The host turns this off while the reader is scrolled up\n * the thread: the chip grows the sticky dock upward, so it would cover the answer being read.\n */\n shouldOfferFollowUp?: boolean\n}\n\nconst ConversationComposerComponent = function ConversationComposer({\n value,\n onValueChange,\n handleSendMessage,\n isGenerating = false,\n compact = false,\n inputRef,\n isBranching = false,\n onCancelBranching,\n placeholder,\n onOpenSettings,\n leftButton,\n rightButton,\n modelSelector,\n skills,\n onBrowseSkills,\n contextUsage,\n isConversationEmpty = false,\n shouldOfferFollowUp = true,\n}: ConversationComposerProps) {\n // The draft is read here, so the conversation does not re-render on every keystroke.\n const session = useArbiSessionStore()\n const sessionDraft = useArbiSessionState(selectDraft)\n const newMessage = value ?? sessionDraft\n const setNewMessage = onValueChange ?? session.setDraft\n\n // Backend-suggested follow-up for THIS conversation, offered as faded inline text in the composer. The\n // input is never pre-filled: the chip drops the text in only when clicked.\n const { showHints } = useHintsVisibility()\n const suggestedQuery = useArbiSessionState((s) => s.suggestedQuery)\n const currentConversationId = useArbiSessionState((s) => s.conversationId)\n const workspaceId = useArbiSessionState((s) => s.workspaceId)\n const longPaste = useLongPaste(newMessage)\n\n const textareaRef = useRef<HTMLTextAreaElement>(null)\n\n // Expose the input form's live width and position as CSS vars so the (portaled)\n // documents/facts hover popups can size themselves to the chat bar, line up with it, and open\n // clear of the field itself (see useChatBarAnchor).\n const formRef = useRef<HTMLFormElement>(null)\n useLayoutEffect(() => {\n const el = formRef.current\n if (!el) return\n const apply = () => {\n document.documentElement.style.setProperty('--chat-input-width', `${el.offsetWidth}px`)\n const rect = el.getBoundingClientRect()\n document.documentElement.style.setProperty('--chat-input-left', `${rect.left}px`)\n document.documentElement.style.setProperty('--chat-input-top', `${rect.top}px`)\n }\n apply()\n const ro = new ResizeObserver(apply)\n ro.observe(el)\n return () => ro.disconnect()\n }, [])\n\n // Synchronize the internal and forwarded refs\n useLayoutEffect(() => {\n if (textareaRef.current && inputRef && 'current' in inputRef) {\n inputRef.current = textareaRef.current\n }\n }, [inputRef])\n\n // \u2500\u2500 Slash-command menu \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n //\n // Two sources, one menu (see useSlashItems): the backend's built-in commands and the user's\n // skills. The menu only opens when the draft is a bare slash command in progress; once the user\n // types a space (committing the slug -> arguments), the menu hides and Enter/arrows fall through.\n const {\n slashToken,\n filteredItems,\n isOpen: isSlashMenuOpen,\n canBrowseSkills,\n } = useSlashItems(newMessage, skills ? BUILTIN_SKILLS : NO_SKILLS)\n\n /**\n * Replace the leading slash token with the chosen slug and a trailing space, so the user can\n * type arguments immediately. The trailing space also commits the slug, which closes the menu.\n */\n const insertSlashItem = (item: SlashMenuItem) => {\n // A picked skill that takes arguments opens the host's workflow launcher.\n if (skills?.openFor(item)) {\n setNewMessage('')\n return\n }\n setNewMessage(`/${item.name} `)\n requestAnimationFrame(() => {\n const ta = textareaRef.current\n if (!ta) return\n ta.focus()\n const end = `/${item.name} `.length\n ta.setSelectionRange(end, end)\n })\n }\n\n // \u2500\u2500 @mentions + assistant mode \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n //\n // `@` opens the member + assistant autocomplete. In a thread (`mentioned` mode) a message only\n // reaches the assistant when it @mentions it; the send path reads the mentions from the text.\n const { data: users } = useWorkspaceUsers()\n const currentUserId = useArbiSession().user?.external_id\n const assistantName = useAssistantName()\n const mentionCandidates = useMemo(\n () => buildMentionCandidates(users ?? [], currentUserId, assistantName),\n [users, currentUserId, assistantName]\n )\n const mention = useMentionAutocomplete({\n value: newMessage,\n onValueChange: setNewMessage,\n candidates: mentionCandidates,\n textareaRef,\n })\n // Shared chats use explicit recipients; solo chats address the assistant implicitly.\n const { data: conversations } = useConversations(workspaceId ?? undefined)\n const isThread =\n conversations?.find((conversation) => conversation.external_id === currentConversationId)\n ?.is_shared ?? false\n // A thread's draft starts addressed to the assistant.\n const prefillsAssistant = isThread && !isBranching\n const recipient = useRecipientDraft({\n value: newMessage,\n onValueChange: setNewMessage,\n contextKey: currentConversationId,\n defaultLabel: prefillsAssistant ? assistantName : null,\n })\n\n const assistant = useAssistantCopy()\n const slashNav = useListKeyNav({\n open: isSlashMenuOpen,\n items: filteredItems,\n onPick: insertSlashItem,\n // Clear the leading slash to fully dismiss; otherwise the menu reopens on the next letter.\n onDismiss: () => setNewMessage(''),\n resetKey: slashToken,\n })\n\n // The citation popover docks right above the composer and would paint over the menus that open\n // from it, so opening one dismisses the popover. The document viewer keeps the passage, as\n // Escape does.\n const isComposerMenuOpen = isSlashMenuOpen || mention.isOpen\n useEffect(() => {\n if (isComposerMenuOpen) session.setActiveCitationKey(null)\n }, [isComposerMenuOpen, session])\n\n // Shown only while the input is empty and the suggestion belongs to the conversation on\n // screen: a suggestion from another tab must never appear here. It also stays out of the\n // way while a reply streams or the reader is scrolled up: the chip sits inside the sticky dock\n // and would cover the text being read.\n const followUp =\n !newMessage &&\n !isBranching &&\n !isGenerating &&\n shouldOfferFollowUp &&\n showHints &&\n suggestedQuery &&\n suggestedQuery.conversationExtId === currentConversationId\n ? suggestedQuery.text\n : null\n\n const sendDraft = () => {\n handleSendMessage()\n // Keep input focused to allow typing the next prompt during generation\n textareaRef.current?.focus()\n // Reset branching state after sending the message\n if (isBranching && onCancelBranching) onCancelBranching()\n }\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (recipient.handleKeyDown(event)) return\n // Slash- and mention-menu keys take priority, but only while a menu is actually open.\n if (slashNav.handleKeyDown(event)) return\n if (mention.nav.handleKeyDown(event)) return\n\n if (followUp && event.key === 'Tab' && !event.shiftKey) {\n event.preventDefault()\n setNewMessage(followUp)\n return\n }\n\n // Plain Enter submits through <Composer.Input> (handleSubmit below).\n if (event.key === 'Escape' && isBranching && onCancelBranching) {\n event.preventDefault()\n onCancelBranching()\n }\n }\n\n const handleSubmit = (e: React.FormEvent) => {\n e.preventDefault()\n if (recipient.hasBody) sendDraft()\n }\n\n return (\n <>\n <Composer.Root\n onSubmit={handleSubmit}\n formRef={formRef}\n isBranching={isBranching}\n notice={isBranching ? <Composer.Notice onCancel={onCancelBranching} /> : undefined}\n >\n <Composer.Frame\n className={\n compact\n ? 'rounded-none border-0 px-0 py-0 shadow-none focus-within:shadow-none'\n : undefined\n }\n >\n {/* Anchors above the textarea inside the frame so it floats over content. */}\n <SlashMenu\n open={isSlashMenuOpen}\n items={filteredItems}\n selectedIndex={slashNav.selectedIndex}\n setSelectedIndex={slashNav.setSelectedIndex}\n listboxId={slashNav.listboxId}\n onSelect={insertSlashItem}\n onBrowse={canBrowseSkills ? onBrowseSkills : undefined}\n />\n <MentionMenu\n open={mention.isOpen}\n items={mention.items}\n selectedIndex={mention.nav.selectedIndex}\n setSelectedIndex={mention.nav.setSelectedIndex}\n listboxId={mention.nav.listboxId}\n onSelect={mention.pick}\n />\n <Composer.Input\n value={newMessage}\n onValueChange={(next) => {\n mention.onValueChange(next)\n longPaste.onValueChange(next)\n }}\n onPaste={(event) => longPaste.onPaste(event, newMessage)}\n onKeyDown={onKeyDown}\n textareaProps={{\n ...(mention.isOpen ? mention.nav.comboboxProps : slashNav.comboboxProps),\n ...mention.textareaProps,\n }}\n textareaRef={textareaRef}\n isPasteCollapsed={longPaste.isCollapsed}\n onExpandPaste={() => {\n longPaste.expand()\n requestAnimationFrame(() => textareaRef.current?.focus())\n }}\n isRoomy={isConversationEmpty}\n isSuggestion={!!followUp}\n compact={compact}\n placeholder={\n followUp ||\n placeholder ||\n (isBranching\n ? 'Edit message to create a branch...'\n : isThread\n ? 'Message the thread\u2026 @mention someone to notify them'\n : isGenerating\n ? 'Type your next prompt...'\n : assistant.askAnythingPlaceholder)\n }\n />\n <Composer.Toolbar\n className={compact ? 'flex-nowrap' : undefined}\n leading={\n <>\n {leftButton}\n {compact && modelSelector}\n {onOpenSettings && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={onOpenSettings}\n className=\"h-8 w-8 p-0 pointer-coarse:h-11 pointer-coarse:w-11\"\n aria-label=\"Chat settings\"\n title=\"Chat settings\"\n data-testid=\"message-input-settings-button\"\n >\n <Settings className=\"h-4 w-4 text-muted-foreground\" />\n </Button>\n )}\n </>\n }\n trailing={\n <>\n {!compact && modelSelector}\n {rightButton}\n </>\n }\n />\n <ContextUsageBar contextUsage={contextUsage} draftLength={newMessage.length} />\n </Composer.Frame>\n </Composer.Root>\n </>\n )\n}\n\nexport const ConversationComposer = memo(ConversationComposerComponent)\n"],
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["/**\n * The conversation's composer: the `Composer` block bound to the session's draft, the slash menu\n * (the backend's built-in commands and the user's skills), @mentions of the workspace's people,\n * and the backend-suggested follow-up. Layout, long-paste folding, menu rendering and keyboard\n * navigation are the `Composer` parts'; what a send does is the caller's (`handleSendMessage`).\n */\n\nimport { Button } from '@arbidocs/react/ui'\nimport React, { useEffect, useLayoutEffect, useMemo, useRef, memo, type ReactNode } from 'react'\nimport { Settings } from 'lucide-react'\nimport {\n buildMentionCandidates,\n selectDraft,\n useArbiSession,\n useArbiSessionState,\n useArbiSessionStore,\n useConversations,\n useWorkspaceUsers,\n} from '@arbidocs/react'\nimport { useAssistantName, useAssistantCopy } from '@arbidocs/react/shell'\nimport type { ContextUsage } from '@arbidocs/sdk/browser'\nimport { Composer } from '../../chat/Composer'\nimport { useHintsVisibility } from '../tips/useContextualHints'\nimport { MentionMenu } from '../../chat/MentionMenu'\nimport { SlashMenu, type SlashMenuItem } from '../../chat/SlashMenu'\nimport { useListKeyNav } from '../../lib/useListKeyNav'\nimport { useLongPaste } from '../../lib/useLongPaste'\nimport { useMentionAutocomplete } from '../../chat/useMentionAutocomplete'\nimport { useRecipientDraft } from '../../chat/useRecipientDraft'\nimport { ContextUsageBar } from '../../chat/ContextUsageBar'\nimport type { WorkflowDefinition } from '../../agents/workflows/types'\nimport { useSlashItems } from './useSlashItems'\nimport { BUILTIN_SKILLS } from '../../agents/workflows/catalogue/seed'\n\nconst NO_SKILLS: ReadonlyArray<WorkflowDefinition> = []\n\n/** What picking a skill in the slash menu does (the host's workflow launcher). */\nexport interface ComposerSkills {\n /** A picked skill: open its launcher. True when it did (the composer then clears the draft). */\n openFor: (item: SlashMenuItem) => boolean\n}\n\nexport interface ConversationComposerProps {\n /** The draft, controlled (default: the session's draft for the open conversation). */\n value?: string\n /** Set the controlled draft. */\n onValueChange?: (value: string) => void\n /** Function to handle sending the message */\n handleSendMessage: () => void\n /** Whether an AI response is currently being generated */\n isGenerating?: boolean\n /** Compact presentation is opt-in; the full app retains its existing layout. */\n compact?: boolean\n /** Reference to the input element for focus management */\n inputRef?: React.RefObject<HTMLTextAreaElement | null>\n /** Flag indicating if we're currently creating a branch */\n isBranching?: boolean\n /** Function to cancel branch creation */\n onCancelBranching?: () => void\n /** Custom placeholder text */\n placeholder?: string\n /** Function to open settings popup */\n onOpenSettings?: () => void\n /** Optional left button element (e.g., paperclip button) */\n leftButton?: React.ReactNode\n /** Optional right button element (e.g., send/stop button) */\n rightButton?: React.ReactNode\n /** The model selector, before `rightButton` (the host's). */\n modelSelector?: ReactNode\n /**\n * What picking a skill does (its form). With it the menu offers the built-in skills too; without\n * it, only what is typed as `/slug` (commands, the host's packs, the user's skills).\n */\n skills?: ComposerSkills\n /** The slash menu's \"Browse all\" opens the host's skills browser. */\n onBrowseSkills?: () => void\n /** Context usage data from the latest assistant message */\n contextUsage?: ContextUsage | null\n /** Whether this is an empty conversation (taller, more inviting input + warmer placeholder) */\n isConversationEmpty?: boolean\n /**\n * Offer the backend's follow-up chip. The host turns this off while the reader is scrolled up\n * the thread: the chip grows the sticky dock upward, so it would cover the answer being read.\n */\n shouldOfferFollowUp?: boolean\n}\n\nconst ConversationComposerComponent = function ConversationComposer({\n value,\n onValueChange,\n handleSendMessage,\n isGenerating = false,\n compact = false,\n inputRef,\n isBranching = false,\n onCancelBranching,\n placeholder,\n onOpenSettings,\n leftButton,\n rightButton,\n modelSelector,\n skills,\n onBrowseSkills,\n contextUsage,\n isConversationEmpty = false,\n shouldOfferFollowUp = true,\n}: ConversationComposerProps) {\n // The draft is read here, so the conversation does not re-render on every keystroke.\n const session = useArbiSessionStore()\n const sessionDraft = useArbiSessionState(selectDraft)\n const newMessage = value ?? sessionDraft\n const setNewMessage = onValueChange ?? session.setDraft\n\n // Backend-suggested follow-up for THIS conversation, kept separate from the editable draft until accepted.\n const { showHints } = useHintsVisibility()\n const suggestedQuery = useArbiSessionState((s) => s.suggestedQuery)\n const currentConversationId = useArbiSessionState((s) => s.conversationId)\n const workspaceId = useArbiSessionState((s) => s.workspaceId)\n const longPaste = useLongPaste(newMessage)\n\n const textareaRef = useRef<HTMLTextAreaElement>(null)\n\n // Expose the input form's live width and position as CSS vars so the (portaled)\n // documents/facts hover popups can size themselves to the chat bar, line up with it, and open\n // clear of the field itself (see useChatBarAnchor).\n const formRef = useRef<HTMLFormElement>(null)\n useLayoutEffect(() => {\n const el = formRef.current\n if (!el) return\n const apply = () => {\n document.documentElement.style.setProperty('--chat-input-width', `${el.offsetWidth}px`)\n const rect = el.getBoundingClientRect()\n document.documentElement.style.setProperty('--chat-input-left', `${rect.left}px`)\n document.documentElement.style.setProperty('--chat-input-top', `${rect.top}px`)\n }\n apply()\n const ro = new ResizeObserver(apply)\n ro.observe(el)\n return () => ro.disconnect()\n }, [])\n\n // Synchronize the internal and forwarded refs\n useLayoutEffect(() => {\n if (textareaRef.current && inputRef && 'current' in inputRef) {\n inputRef.current = textareaRef.current\n }\n }, [inputRef])\n\n // \u2500\u2500 Slash-command menu \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n //\n // Two sources, one menu (see useSlashItems): the backend's built-in commands and the user's\n // skills. The menu only opens when the draft is a bare slash command in progress; once the user\n // types a space (committing the slug -> arguments), the menu hides and Enter/arrows fall through.\n const {\n slashToken,\n filteredItems,\n isOpen: isSlashMenuOpen,\n canBrowseSkills,\n } = useSlashItems(newMessage, skills ? BUILTIN_SKILLS : NO_SKILLS)\n\n /**\n * Replace the leading slash token with the chosen slug and a trailing space, so the user can\n * type arguments immediately. The trailing space also commits the slug, which closes the menu.\n */\n const insertSlashItem = (item: SlashMenuItem) => {\n // A picked skill that takes arguments opens the host's workflow launcher.\n if (skills?.openFor(item)) {\n setNewMessage('')\n return\n }\n setNewMessage(`/${item.name} `)\n requestAnimationFrame(() => {\n const ta = textareaRef.current\n if (!ta) return\n ta.focus()\n const end = `/${item.name} `.length\n ta.setSelectionRange(end, end)\n })\n }\n\n // \u2500\u2500 @mentions + assistant mode \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n //\n // `@` opens the member + assistant autocomplete. In a thread (`mentioned` mode) a message only\n // reaches the assistant when it @mentions it; the send path reads the mentions from the text.\n const { data: users } = useWorkspaceUsers()\n const currentUserId = useArbiSession().user?.external_id\n const assistantName = useAssistantName()\n const mentionCandidates = useMemo(\n () => buildMentionCandidates(users ?? [], currentUserId, assistantName),\n [users, currentUserId, assistantName]\n )\n const mention = useMentionAutocomplete({\n value: newMessage,\n onValueChange: setNewMessage,\n candidates: mentionCandidates,\n textareaRef,\n })\n // Shared chats use explicit recipients; solo chats address the assistant implicitly.\n const { data: conversations } = useConversations(workspaceId ?? undefined)\n const isThread =\n conversations?.find((conversation) => conversation.external_id === currentConversationId)\n ?.is_shared ?? false\n // A thread's draft starts addressed to the assistant.\n const prefillsAssistant = isThread && !isBranching\n const recipient = useRecipientDraft({\n value: newMessage,\n onValueChange: setNewMessage,\n contextKey: currentConversationId,\n defaultLabel: prefillsAssistant ? assistantName : null,\n })\n\n const assistant = useAssistantCopy()\n const slashNav = useListKeyNav({\n open: isSlashMenuOpen,\n items: filteredItems,\n onPick: insertSlashItem,\n // Clear the leading slash to fully dismiss; otherwise the menu reopens on the next letter.\n onDismiss: () => setNewMessage(''),\n resetKey: slashToken,\n })\n\n // The citation popover docks right above the composer and would paint over the menus that open\n // from it, so opening one dismisses the popover. The document viewer keeps the passage, as\n // Escape does.\n const isComposerMenuOpen = isSlashMenuOpen || mention.isOpen\n useEffect(() => {\n if (isComposerMenuOpen) session.setActiveCitationKey(null)\n }, [isComposerMenuOpen, session])\n\n // Shown only while the input is empty and the suggestion belongs to the conversation on\n // screen: a suggestion from another tab must never appear here. It also stays out of the\n // way while a reply streams or the reader is scrolled up: the offer sits inside the sticky dock\n // and would cover the text being read.\n const followUp =\n !newMessage &&\n !isBranching &&\n !isGenerating &&\n shouldOfferFollowUp &&\n showHints &&\n suggestedQuery &&\n suggestedQuery.conversationExtId === currentConversationId\n ? suggestedQuery.text\n : null\n\n const sendDraft = () => {\n handleSendMessage()\n // Keep input focused to allow typing the next prompt during generation\n textareaRef.current?.focus()\n // Reset branching state after sending the message\n if (isBranching && onCancelBranching) onCancelBranching()\n }\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (recipient.handleKeyDown(event)) return\n // Slash- and mention-menu keys take priority, but only while a menu is actually open.\n if (slashNav.handleKeyDown(event)) return\n if (mention.nav.handleKeyDown(event)) return\n\n // Plain Enter submits through <Composer.Input> (handleSubmit below).\n if (event.key === 'Escape' && isBranching && onCancelBranching) {\n event.preventDefault()\n onCancelBranching()\n }\n }\n\n const handleSubmit = (e: React.FormEvent) => {\n e.preventDefault()\n if (recipient.hasBody) sendDraft()\n }\n\n return (\n <>\n <Composer.Root\n onSubmit={handleSubmit}\n formRef={formRef}\n isBranching={isBranching}\n notice={isBranching ? <Composer.Notice onCancel={onCancelBranching} /> : undefined}\n >\n <Composer.Frame\n className={\n compact\n ? 'rounded-none border-0 px-0 py-0 shadow-none focus-within:shadow-none'\n : undefined\n }\n >\n {/* Anchors above the textarea inside the frame so it floats over content. */}\n <SlashMenu\n open={isSlashMenuOpen}\n items={filteredItems}\n selectedIndex={slashNav.selectedIndex}\n setSelectedIndex={slashNav.setSelectedIndex}\n listboxId={slashNav.listboxId}\n onSelect={insertSlashItem}\n onBrowse={canBrowseSkills ? onBrowseSkills : undefined}\n />\n <MentionMenu\n open={mention.isOpen}\n items={mention.items}\n selectedIndex={mention.nav.selectedIndex}\n setSelectedIndex={mention.nav.setSelectedIndex}\n listboxId={mention.nav.listboxId}\n onSelect={mention.pick}\n />\n {followUp && (\n <div\n className=\"mb-2 flex items-start gap-3 rounded-md border border-border bg-background p-3\"\n data-testid=\"follow-up-suggestion\"\n >\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-xs font-medium text-muted-foreground\">Suggested follow-up</p>\n <p className=\"mt-1 text-sm text-foreground\">{followUp}</p>\n </div>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n className=\"shrink-0\"\n onClick={() => {\n setNewMessage(followUp)\n requestAnimationFrame(() => textareaRef.current?.focus())\n }}\n data-testid=\"follow-up-suggestion-button\"\n >\n Use suggestion\n </Button>\n </div>\n )}\n <Composer.Input\n value={newMessage}\n onValueChange={(next) => {\n mention.onValueChange(next)\n longPaste.onValueChange(next)\n }}\n onPaste={(event) => longPaste.onPaste(event, newMessage)}\n onKeyDown={onKeyDown}\n textareaProps={{\n ...(mention.isOpen ? mention.nav.comboboxProps : slashNav.comboboxProps),\n ...mention.textareaProps,\n }}\n textareaRef={textareaRef}\n isPasteCollapsed={longPaste.isCollapsed}\n onExpandPaste={() => {\n longPaste.expand()\n requestAnimationFrame(() => textareaRef.current?.focus())\n }}\n isRoomy={isConversationEmpty}\n compact={compact}\n placeholder={\n placeholder ||\n (isBranching\n ? 'Edit message to create a branch...'\n : isThread\n ? 'Message the thread\u2026 @mention someone to notify them'\n : isGenerating\n ? 'Type your next prompt...'\n : assistant.askAnythingPlaceholder)\n }\n />\n <Composer.Toolbar\n className={compact ? 'flex-nowrap' : undefined}\n leading={\n <>\n {leftButton}\n {compact && modelSelector}\n {onOpenSettings && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={onOpenSettings}\n className=\"h-8 w-8 p-0 pointer-coarse:h-11 pointer-coarse:w-11\"\n aria-label=\"Chat settings\"\n title=\"Chat settings\"\n data-testid=\"message-input-settings-button\"\n >\n <Settings className=\"h-4 w-4 text-muted-foreground\" />\n </Button>\n )}\n </>\n }\n trailing={\n <>\n {!compact && modelSelector}\n {rightButton}\n </>\n }\n />\n <ContextUsageBar contextUsage={contextUsage} draftLength={newMessage.length} />\n </Composer.Frame>\n </Composer.Root>\n </>\n )\n}\n\nexport const ConversationComposer = memo(ConversationComposerComponent)\n"],
|
|
5
|
+
"mappings": ";AAoR8B,SAqFhB,UArFgB,KAgChB,YAhCgB;AA7Q9B,SAAS,cAAc;AACvB,SAAgB,WAAW,iBAAiB,SAAS,QAAQ,YAA4B;AACzF,SAAS,gBAAgB;AACzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,kBAAkB,wBAAwB;AAEnD,SAAS,gBAAgB;AACzB,SAAS,0BAA0B;AACnC,SAAS,mBAAmB;AAC5B,SAAS,iBAAqC;AAC9C,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAC7B,SAAS,8BAA8B;AACvC,SAAS,yBAAyB;AAClC,SAAS,uBAAuB;AAEhC,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAE/B,MAAM,YAA+C,CAAC;AAqDtD,MAAM,gCAAgC,SAAS,qBAAqB;AAAA,EAClE;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,UAAU;AAAA,EACV;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,sBAAsB;AAAA,EACtB,sBAAsB;AACxB,GAA8B;AAE5B,QAAM,UAAU,oBAAoB;AACpC,QAAM,eA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,MAAK;AAAA,sBACL,SAAS;AAAA,sBACT,WAAU;AAAA,sBACV,cAAW;AAAA,sBACX,OAAM;AAAA,sBACN,eAAY;AAAA,sBAEZ,8BAAC,YAAS,WAAU,iCAAgC;AAAA;AAAA,kBACtD;AAAA,mBAEJ;AAAA,gBAEF,UACE,iCACG;AAAA,mBAAC,WAAW;AAAA,kBACZ;AAAA,mBACH;AAAA;AAAA,YAEJ;AAAA,YACA,oBAAC,mBAAgB,cAA4B,aAAa,WAAW,QAAQ;AAAA;AAAA;AAAA,MAC/E;AAAA;AAAA,EACF,GACF;AAEJ;AAEO,MAAMA,wBAAuB,KAAK,6BAA6B;",
|
|
6
6
|
"names": ["ConversationComposer"]
|
|
7
7
|
}
|
|
@@ -10,7 +10,7 @@ export declare const FIELDS_MANAGER_PANEL = "fields-manager-panel";
|
|
|
10
10
|
export declare const FIELDS_MANAGER_KIND_VIEW = "fieldsManager.kind";
|
|
11
11
|
/** A request for the create form (a new number each time: each request is seen once). */
|
|
12
12
|
export declare const FIELDS_MANAGER_CREATE_VIEW = "fieldsManager.create";
|
|
13
|
-
/** Open the panel
|
|
13
|
+
/** Open the panel over the page, on a tab and with its create form when asked. */
|
|
14
14
|
export declare function openFieldsManagerIn(layout: Pick<ArbiLayoutActions, 'setTransientView' | 'openPanel'>, kind?: TagGroup, options?: {
|
|
15
15
|
create?: boolean;
|
|
16
16
|
}): void;
|
|
@@ -5,7 +5,7 @@ const FIELDS_MANAGER_CREATE_VIEW = "fieldsManager.create";
|
|
|
5
5
|
let createRequests = 0;
|
|
6
6
|
function openFieldsManagerIn(layout, kind, options = {}) {
|
|
7
7
|
if (kind) layout.setTransientView(FIELDS_MANAGER_KIND_VIEW, kind);
|
|
8
|
-
layout.openPanel(FIELDS_MANAGER_PANEL, "
|
|
8
|
+
layout.openPanel(FIELDS_MANAGER_PANEL, "overlay");
|
|
9
9
|
if (options.create) layout.setTransientView(FIELDS_MANAGER_CREATE_VIEW, ++createRequests);
|
|
10
10
|
}
|
|
11
11
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/connection/files/fields/fields-manager-panel.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Where the labels and annotations panel (`ConnectedFieldsManagerPanel`) keeps its state in the\n * session, and opening it.\n */\nimport type { TagGroup } from '@arbidocs/sdk/browser'\nimport type { ArbiLayoutActions } from '@arbidocs/react'\n\n/** The panel's id in the session's `shell.panels`. */\nexport const FIELDS_MANAGER_PANEL = 'fields-manager-panel'\n/** The panel's tab (labels or annotations), in the session's transient views. */\nexport const FIELDS_MANAGER_KIND_VIEW = 'fieldsManager.kind'\n/** A request for the create form (a new number each time: each request is seen once). */\nexport const FIELDS_MANAGER_CREATE_VIEW = 'fieldsManager.create'\n\nlet createRequests = 0\n\n/** Open the panel
|
|
5
|
-
"mappings": ";AAQO,MAAM,uBAAuB;AAE7B,MAAM,2BAA2B;AAEjC,MAAM,6BAA6B;AAE1C,IAAI,iBAAiB;AAGd,SAAS,oBACd,QACA,MACA,UAAgC,CAAC,GAC3B;AACN,MAAI,KAAM,QAAO,iBAAiB,0BAA0B,IAAI;AAChE,SAAO,UAAU,sBAAsB,
|
|
4
|
+
"sourcesContent": ["/**\n * Where the labels and annotations panel (`ConnectedFieldsManagerPanel`) keeps its state in the\n * session, and opening it.\n */\nimport type { TagGroup } from '@arbidocs/sdk/browser'\nimport type { ArbiLayoutActions } from '@arbidocs/react'\n\n/** The panel's id in the session's `shell.panels`. */\nexport const FIELDS_MANAGER_PANEL = 'fields-manager-panel'\n/** The panel's tab (labels or annotations), in the session's transient views. */\nexport const FIELDS_MANAGER_KIND_VIEW = 'fieldsManager.kind'\n/** A request for the create form (a new number each time: each request is seen once). */\nexport const FIELDS_MANAGER_CREATE_VIEW = 'fieldsManager.create'\n\nlet createRequests = 0\n\n/** Open the panel over the page, on a tab and with its create form when asked. */\nexport function openFieldsManagerIn(\n layout: Pick<ArbiLayoutActions, 'setTransientView' | 'openPanel'>,\n kind?: TagGroup,\n options: { create?: boolean } = {}\n): void {\n if (kind) layout.setTransientView(FIELDS_MANAGER_KIND_VIEW, kind)\n layout.openPanel(FIELDS_MANAGER_PANEL, 'overlay')\n if (options.create) layout.setTransientView(FIELDS_MANAGER_CREATE_VIEW, ++createRequests)\n}\n"],
|
|
5
|
+
"mappings": ";AAQO,MAAM,uBAAuB;AAE7B,MAAM,2BAA2B;AAEjC,MAAM,6BAA6B;AAE1C,IAAI,iBAAiB;AAGd,SAAS,oBACd,QACA,MACA,UAAgC,CAAC,GAC3B;AACN,MAAI,KAAM,QAAO,iBAAiB,0BAA0B,IAAI;AAChE,SAAO,UAAU,sBAAsB,SAAS;AAChD,MAAI,QAAQ,OAAQ,QAAO,iBAAiB,4BAA4B,EAAE,cAAc;AAC1F;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* chosen files). Resolves false when the addresses could not be sent (the dialog stays open).
|
|
5
5
|
*/
|
|
6
6
|
export interface AddFromUrlsOptions {
|
|
7
|
-
/**
|
|
7
|
+
/** Share with workspace members. Omitted visibility is private. */
|
|
8
8
|
shared?: boolean;
|
|
9
9
|
configExtId?: string | null;
|
|
10
10
|
/** A zip archive's files, to upload like chosen files. */
|
|
@@ -5,7 +5,7 @@ import { useBlocksEnvironment } from "../../../provider/environment.js";
|
|
|
5
5
|
import { useConnectedWorkspace } from "../../ConnectionProvider.js";
|
|
6
6
|
const plural = (count, one, many = `${one}s`) => count === 1 ? one : many;
|
|
7
7
|
function useAddFromUrls({
|
|
8
|
-
shared =
|
|
8
|
+
shared = false,
|
|
9
9
|
configExtId,
|
|
10
10
|
onZipFiles
|
|
11
11
|
} = {}) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/connection/files/upload/useAddFromUrls.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Add documents from web addresses, telling the user how it went: the documents the server made,\n * the addresses it skipped, and a zip archive's files (handed to `onZipFiles`, to upload like\n * chosen files). Resolves false when the addresses could not be sent (the dialog stays open).\n */\n\nimport { useCallback } from 'react'\nimport { useUploadFromUrls } from '@arbidocs/react'\nimport { useBlocksEnvironment } from '../../../provider/environment'\nimport { useConnectedWorkspace } from '../../ConnectionProvider'\n\nconst plural = (count: number, one: string, many = `${one}s`) => (count === 1 ? one : many)\n\nexport interface AddFromUrlsOptions {\n /**
|
|
4
|
+
"sourcesContent": ["/**\n * Add documents from web addresses, telling the user how it went: the documents the server made,\n * the addresses it skipped, and a zip archive's files (handed to `onZipFiles`, to upload like\n * chosen files). Resolves false when the addresses could not be sent (the dialog stays open).\n */\n\nimport { useCallback } from 'react'\nimport { useUploadFromUrls } from '@arbidocs/react'\nimport { useBlocksEnvironment } from '../../../provider/environment'\nimport { useConnectedWorkspace } from '../../ConnectionProvider'\n\nconst plural = (count: number, one: string, many = `${one}s`) => (count === 1 ? one : many)\n\nexport interface AddFromUrlsOptions {\n /** Share with workspace members. Omitted visibility is private. */\n shared?: boolean\n configExtId?: string | null\n /** A zip archive's files, to upload like chosen files. */\n onZipFiles?: (files: File[]) => void\n}\n\nexport function useAddFromUrls({\n shared = false,\n configExtId,\n onZipFiles,\n}: AddFromUrlsOptions = {}) {\n const { notify } = useBlocksEnvironment()\n const { workspaceId } = useConnectedWorkspace()\n const uploadFromUrls = useUploadFromUrls()\n return useCallback(\n async (urls: string[]): Promise<boolean> => {\n if (urls.length === 0 || !workspaceId) return false\n let result\n try {\n result = await uploadFromUrls({ urls, shared, configExtId, workspaceId })\n } catch {\n return false\n }\n const { docIds, skipped, zipFiles, oversizedInZips, failedZipUrls } = result\n if (zipFiles.length > 0) {\n onZipFiles?.(zipFiles)\n notify(\n `Extracted ${zipFiles.length} ${plural(zipFiles.length, 'file')} from ZIP. Click Add files to send.`,\n 'success'\n )\n }\n if (oversizedInZips.length > 0)\n notify(\n `Skipped ${oversizedInZips.length} oversized ${plural(oversizedInZips.length, 'file')} inside ZIP archives.`,\n 'warning'\n )\n if (failedZipUrls.length > 0)\n notify(\n `Failed to fetch ${failedZipUrls.length} ZIP ${plural(failedZipUrls.length, 'URL')}. Browser CORS may block third-party hosts \u2014 try a CORS-enabled URL.`,\n 'error'\n )\n if (skipped.length > 0)\n notify(\n `${skipped.length} ${plural(skipped.length, 'URL was', 'URLs were')} skipped:\\n${skipped.map((s) => `${s.file_name}: ${s.reason}`).join('\\n')}`,\n 'warning'\n )\n if (docIds.length > 0)\n notify(\n `Upload complete (${docIds.length} ${plural(docIds.length, 'document')}). Indexing in the background...`,\n 'success',\n { workspaceId }\n )\n return true\n },\n [workspaceId, uploadFromUrls, shared, configExtId, onZipFiles, notify]\n )\n}\n"],
|
|
5
5
|
"mappings": ";AAMA,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AAClC,SAAS,4BAA4B;AACrC,SAAS,6BAA6B;AAEtC,MAAM,SAAS,CAAC,OAAe,KAAa,OAAO,GAAG,GAAG,QAAS,UAAU,IAAI,MAAM;AAU/E,SAAS,eAAe;AAAA,EAC7B,SAAS;AAAA,EACT;AAAA,EACA;AACF,IAAwB,CAAC,GAAG;AAC1B,QAAM,EAAE,OAAO,IAAI,qBAAqB;AACxC,QAAM,EAAE,YAAY,IAAI,sBAAsB;AAC9C,QAAM,iBAAiB,kBAAkB;AACzC,SAAO;AAAA,IACL,OAAO,SAAqC;AAC1C,UAAI,KAAK,WAAW,KAAK,CAAC,YAAa,QAAO;AAC9C,UAAI;AACJ,UAAI;AACF,iBAAS,MAAM,eAAe,EAAE,MAAM,QAAQ,aAAa,YAAY,CAAC;AAAA,MAC1E,QAAQ;AACN,eAAO;AAAA,MACT;AACA,YAAM,EAAE,QAAQ,SAAS,UAAU,iBAAiB,cAAc,IAAI;AACtE,UAAI,SAAS,SAAS,GAAG;AACvB,qBAAa,QAAQ;AACrB;AAAA,UACE,aAAa,SAAS,MAAM,IAAI,OAAO,SAAS,QAAQ,MAAM,CAAC;AAAA,UAC/D;AAAA,QACF;AAAA,MACF;AACA,UAAI,gBAAgB,SAAS;AAC3B;AAAA,UACE,WAAW,gBAAgB,MAAM,cAAc,OAAO,gBAAgB,QAAQ,MAAM,CAAC;AAAA,UACrF;AAAA,QACF;AACF,UAAI,cAAc,SAAS;AACzB;AAAA,UACE,mBAAmB,cAAc,MAAM,QAAQ,OAAO,cAAc,QAAQ,KAAK,CAAC;AAAA,UAClF;AAAA,QACF;AACF,UAAI,QAAQ,SAAS;AACnB;AAAA,UACE,GAAG,QAAQ,MAAM,IAAI,OAAO,QAAQ,QAAQ,WAAW,WAAW,CAAC;AAAA,EAAc,QAAQ,IAAI,CAAC,MAAM,GAAG,EAAE,SAAS,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,IAAI,CAAC;AAAA,UAC7I;AAAA,QACF;AACF,UAAI,OAAO,SAAS;AAClB;AAAA,UACE,oBAAoB,OAAO,MAAM,IAAI,OAAO,OAAO,QAAQ,UAAU,CAAC;AAAA,UACtE;AAAA,UACA,EAAE,YAAY;AAAA,QAChB;AACF,aAAO;AAAA,IACT;AAAA,IACA,CAAC,aAAa,gBAAgB,QAAQ,aAAa,YAAY,MAAM;AAAA,EACvE;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -33,7 +33,7 @@ function ConnectedPeerActions({ peer, addPeople }) {
|
|
|
33
33
|
)
|
|
34
34
|
];
|
|
35
35
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
36
|
-
|
|
36
|
+
/* @__PURE__ */ jsx(DmCallButton, { peer }),
|
|
37
37
|
!isAgent(peer) && /* @__PURE__ */ jsx(ScheduleCallButton, { peer }),
|
|
38
38
|
/* @__PURE__ */ jsx(
|
|
39
39
|
ConnectedContactMenu,
|