@arbidocs/blocks 0.4.136 → 0.4.137
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/agents/index.cjs +380 -373
- package/dist/agents/index.js +11 -12
- package/dist/agents/workflows/WorkflowDocumentsField.d.ts +42 -5
- package/dist/agents/workflows/index.d.ts +2 -2
- package/dist/agents/workflows/workspaceScope.d.ts +12 -0
- package/dist/calls/index.cjs +3 -3
- package/dist/calls/index.js +2 -2
- package/dist/chat/index.cjs +139 -139
- package/dist/chat/index.js +4 -4
- package/dist/chunk-2KUCVSFF.js +51 -0
- package/dist/chunk-2KUCVSFF.js.map +1 -0
- package/dist/{chunk-3FFRYZKV.js → chunk-3RJN2VTL.js} +36 -6
- package/dist/chunk-3RJN2VTL.js.map +1 -0
- package/dist/{chunk-OWCEQKAR.cjs → chunk-6F7SZCVL.cjs} +3 -3
- package/dist/{chunk-OWCEQKAR.cjs.map → chunk-6F7SZCVL.cjs.map} +1 -1
- package/dist/{chunk-JO3EMZ4X.js → chunk-7M4C6CK7.js} +3 -3
- package/dist/{chunk-JO3EMZ4X.js.map → chunk-7M4C6CK7.js.map} +1 -1
- package/dist/{chunk-OR4CO743.cjs → chunk-AAFX64WD.cjs} +3 -3
- package/dist/{chunk-OR4CO743.cjs.map → chunk-AAFX64WD.cjs.map} +1 -1
- package/dist/{chunk-IQU2GI6V.js → chunk-ATJUVHVB.js} +1301 -8
- package/dist/chunk-ATJUVHVB.js.map +1 -0
- package/dist/{chunk-OAL3B2ZU.cjs → chunk-BUNZWOPX.cjs} +5 -5
- package/dist/{chunk-OAL3B2ZU.cjs.map → chunk-BUNZWOPX.cjs.map} +1 -1
- package/dist/{chunk-N55UIXVT.cjs → chunk-C3ZRLULA.cjs} +5 -5
- package/dist/{chunk-N55UIXVT.cjs.map → chunk-C3ZRLULA.cjs.map} +1 -1
- package/dist/{chunk-LIHRGG4M.cjs → chunk-CHVCTKF4.cjs} +1365 -49
- package/dist/chunk-CHVCTKF4.cjs.map +1 -0
- package/dist/chunk-CQCC7LE7.js +210 -0
- package/dist/chunk-CQCC7LE7.js.map +1 -0
- package/dist/{chunk-ZAVEMQ37.cjs → chunk-DWZXSPMB.cjs} +3 -3
- package/dist/{chunk-ZAVEMQ37.cjs.map → chunk-DWZXSPMB.cjs.map} +1 -1
- package/dist/{chunk-VIU7AMHF.js → chunk-E5OYHJMU.js} +3 -3
- package/dist/{chunk-VIU7AMHF.js.map → chunk-E5OYHJMU.js.map} +1 -1
- package/dist/{chunk-7YLJHTDC.cjs → chunk-EHOPZBAX.cjs} +11 -11
- package/dist/{chunk-7YLJHTDC.cjs.map → chunk-EHOPZBAX.cjs.map} +1 -1
- package/dist/{chunk-5HFPRI3W.js → chunk-FUTMU4FR.js} +3 -3
- package/dist/{chunk-5HFPRI3W.js.map → chunk-FUTMU4FR.js.map} +1 -1
- package/dist/{chunk-IE5CUCZK.cjs → chunk-HDYWXEQU.cjs} +4 -4
- package/dist/{chunk-IE5CUCZK.cjs.map → chunk-HDYWXEQU.cjs.map} +1 -1
- package/dist/{chunk-C44D4WFG.cjs → chunk-HLB4DIYV.cjs} +3 -3
- package/dist/{chunk-C44D4WFG.cjs.map → chunk-HLB4DIYV.cjs.map} +1 -1
- package/dist/{chunk-OZLWSNUC.cjs → chunk-JY73DJOS.cjs} +80 -1232
- package/dist/chunk-JY73DJOS.cjs.map +1 -0
- package/dist/{chunk-LT2X5N37.js → chunk-KMNZ2RVO.js} +19 -1152
- package/dist/chunk-KMNZ2RVO.js.map +1 -0
- package/dist/{chunk-6S5FLMWG.js → chunk-KSHKTOY2.js} +203 -7
- package/dist/chunk-KSHKTOY2.js.map +1 -0
- package/dist/{chunk-ZNI4SW2G.js → chunk-L3T7OJRX.js} +3 -3
- package/dist/{chunk-ZNI4SW2G.js.map → chunk-L3T7OJRX.js.map} +1 -1
- package/dist/{chunk-RUB62J2X.js → chunk-M33QUNFH.js} +3 -3
- package/dist/{chunk-RUB62J2X.js.map → chunk-M33QUNFH.js.map} +1 -1
- package/dist/{chunk-DJM7DLCT.cjs → chunk-OPTBQSCV.cjs} +3 -3
- package/dist/{chunk-DJM7DLCT.cjs.map → chunk-OPTBQSCV.cjs.map} +1 -1
- package/dist/{chunk-GFYGYME3.js → chunk-OQ7RUNOC.js} +3 -3
- package/dist/{chunk-GFYGYME3.js.map → chunk-OQ7RUNOC.js.map} +1 -1
- package/dist/chunk-RFIBUWLF.cjs +232 -0
- package/dist/chunk-RFIBUWLF.cjs.map +1 -0
- package/dist/{chunk-N26CXGXC.cjs → chunk-RQ2Y7USX.cjs} +201 -3
- package/dist/chunk-RQ2Y7USX.cjs.map +1 -0
- package/dist/chunk-UUHUQHXR.cjs +56 -0
- package/dist/chunk-UUHUQHXR.cjs.map +1 -0
- package/dist/{chunk-ECERC6TI.js → chunk-VHJHY7TT.js} +3 -3
- package/dist/{chunk-ECERC6TI.js.map → chunk-VHJHY7TT.js.map} +1 -1
- package/dist/{chunk-5BXEYYH6.js → chunk-VMESMX7N.js} +3 -3
- package/dist/{chunk-5BXEYYH6.js.map → chunk-VMESMX7N.js.map} +1 -1
- package/dist/{chunk-44R3CCZT.cjs → chunk-WS5EX7DN.cjs} +37 -6
- package/dist/chunk-WS5EX7DN.cjs.map +1 -0
- package/dist/{chunk-Y5KTM3V5.js → chunk-YOMPLCP6.js} +3 -3
- package/dist/{chunk-Y5KTM3V5.js.map → chunk-YOMPLCP6.js.map} +1 -1
- package/dist/collaboration/index.cjs +51 -51
- package/dist/collaboration/index.js +3 -3
- package/dist/connect/docx.cjs +5 -5
- package/dist/connect/docx.js +4 -4
- package/dist/connect/index.cjs +353 -76
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.d.ts +3 -0
- package/dist/connect/index.js +274 -20
- package/dist/connect/index.js.map +1 -1
- package/dist/connection/ConnectedWorkflowBuilder.d.ts +1 -1
- package/dist/connection/ConnectedWorkflowLauncher.d.ts +35 -0
- package/dist/connection/ConnectedWorkflowsTable.d.ts +62 -0
- package/dist/connection/workspaceData.d.ts +45 -0
- package/dist/document-tools/index.cjs +1 -1
- package/dist/document-tools/index.js +1 -1
- package/dist/facts/index.cjs +4 -4
- package/dist/facts/index.js +4 -4
- package/dist/files/index.cjs +3 -3
- package/dist/files/index.js +3 -3
- package/dist/home/index.cjs +22 -23
- package/dist/home/index.cjs.map +1 -1
- package/dist/home/index.js +4 -5
- package/dist/home/index.js.map +1 -1
- package/dist/index.cjs +733 -726
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +20 -21
- package/dist/index.js.map +1 -1
- package/dist/retrieval/index.cjs +1 -1
- package/dist/retrieval/index.js +1 -1
- package/dist/settings/index.cjs +56 -56
- package/dist/settings/index.js +6 -6
- package/dist/shell/index.cjs +2 -2
- package/dist/shell/index.js +2 -2
- package/dist/site/index.cjs +5 -5
- package/dist/site/index.js +1 -1
- package/dist/studio/index.cjs +8 -8
- package/dist/studio/index.js +7 -7
- package/dist/workflow-canvas/index.cjs +73 -71
- package/dist/workflow-canvas/index.cjs.map +1 -1
- package/dist/workflow-canvas/index.js +23 -21
- package/dist/workflow-canvas/index.js.map +1 -1
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +4 -4
- package/dist/chunk-3FFRYZKV.js.map +0 -1
- package/dist/chunk-44R3CCZT.cjs.map +0 -1
- package/dist/chunk-4XJZ6AAY.js +0 -407
- package/dist/chunk-4XJZ6AAY.js.map +0 -1
- package/dist/chunk-6S5FLMWG.js.map +0 -1
- package/dist/chunk-7D737FLE.cjs +0 -43
- package/dist/chunk-7D737FLE.cjs.map +0 -1
- package/dist/chunk-IQU2GI6V.js.map +0 -1
- package/dist/chunk-LIHRGG4M.cjs.map +0 -1
- package/dist/chunk-LT2X5N37.js.map +0 -1
- package/dist/chunk-N26CXGXC.cjs.map +0 -1
- package/dist/chunk-OZLWSNUC.cjs.map +0 -1
- package/dist/chunk-S5HZBXZA.cjs +0 -430
- package/dist/chunk-S5HZBXZA.cjs.map +0 -1
- package/dist/chunk-XD2M6LIG.js +0 -41
- package/dist/chunk-XD2M6LIG.js.map +0 -1
package/dist/connect/index.d.ts
CHANGED
|
@@ -8,6 +8,9 @@ export { ArbiAppProvider } from '../connection/ArbiAppProvider';
|
|
|
8
8
|
export { ConnectedTaskAccessRequest } from '../connection/ConnectedTaskAccessRequest';
|
|
9
9
|
export { ConnectedWorkspaceActivity, type ConnectedWorkspaceActivityProps, } from '../connection/ConnectedWorkspaceActivity';
|
|
10
10
|
export { ConnectedWorkspaceNotificationMenu, ConnectedThreadFollow, type ConnectedWorkspaceNotificationMenuProps, type ConnectedThreadFollowProps, } from '../connection/ConnectedNotificationRelevance';
|
|
11
|
+
export { ConnectedWorkspaceDataProvider, useConnectedDocuments, useConnectedTags, useConnectedConversations, type ConnectedConversation, type ConnectedWorkspaceData, type ConnectedList, type ConnectedListResult, type ConnectedDocument, type ConnectedTag, } from '../connection/workspaceData';
|
|
12
|
+
export { ConnectedWorkflowsTable, DEFAULT_CONNECTED_WORKFLOWS_TABLE_LABELS, useConnectedWorkspaceRole, type ConnectedWorkflowsTableProps, type ConnectedWorkflowsTableLabels, } from '../connection/ConnectedWorkflowsTable';
|
|
13
|
+
export { ConnectedWorkflowLauncher, ConnectedWorkflowDocumentsField, useConnectedWorkflowScopeSource, useConnectedAgentOptions, toWorkflowFieldDocument, type ConnectedWorkflowLauncherProps, type ConnectedWorkflowDocumentsFieldProps, } from '../connection/ConnectedWorkflowLauncher';
|
|
11
14
|
export { ConnectedSkillUpload, DEFAULT_CONNECTED_SKILL_UPLOAD_LABELS, type ConnectedSkillUploadProps, type ConnectedSkillUploadLabels, } from '../connection/ConnectedSkillUpload';
|
|
12
15
|
export { useConnectedAiTask, useConnectedChat, ConnectedAssistantDock, useWorkspaceDocs, useSemanticSearch, toRedlineMarkdown, redlineStats, textToArtifact, type AiTaskStatus, type AiRunOptions, type SearchChunk, type ArtifactEvent, } from '../connection/ai';
|
|
13
16
|
export { StreamedArtifact, type StreamedArtifactProps } from '../connection/StreamedArtifact';
|
package/dist/connect/index.js
CHANGED
|
@@ -1,45 +1,50 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
2
|
+
import { FilesFilterBar, FolderFilterButton, FolderPickerRow } from '../chunk-7RJTEWYM.js';
|
|
3
|
+
import { SettingsSection, ProfileCard, AvatarPicker, IdentityVerificationCard, IdentityVerificationDialog, RequireVerified, PasswordChangeDialog, SettingsCard, SettingsActionRow, EMAIL_NOTIFICATION_KEYS, EMAIL_NOTIFICATION_CATEGORIES, NotificationCategoryList, toNotificationCategories, toActiveSessionViews, SettingsRow, ActiveSessionsDialog, LogoutDialog, toLogoutSessionViews, SettingsDangerZone, DeleteAccountDialog, toDeleteBlockerViews } from '../chunk-OQ7RUNOC.js';
|
|
4
|
+
import { useWorkspaceDocs } from '../chunk-L3T7OJRX.js';
|
|
5
|
+
export { ConnectedAssistantDock, redlineStats, textToArtifact, toRedlineMarkdown, useConnectedAiTask, useConnectedChat, useSemanticSearch, useWorkspaceDocs } from '../chunk-L3T7OJRX.js';
|
|
6
|
+
import { useConnectedConversations, useConnectedDocuments, useConnectedTags } from '../chunk-2KUCVSFF.js';
|
|
7
|
+
export { ConnectedWorkspaceDataProvider, useConnectedConversations, useConnectedDocuments, useConnectedTags } from '../chunk-2KUCVSFF.js';
|
|
8
|
+
import { ConnectedNativeDocxEditor } from '../chunk-E5OYHJMU.js';
|
|
9
|
+
import { ConnectionProvider, useConnection, useConnectedWorkspace } from '../chunk-L2PAPOZ5.js';
|
|
7
10
|
export { ConnectionProvider, SESSION_EXPIRED_MESSAGE, isAuthenticated, useConnectedWorkspace, useConnection } from '../chunk-L2PAPOZ5.js';
|
|
8
11
|
import { SignDocumentDialog } from '../chunk-2YOVK524.js';
|
|
9
12
|
import '../chunk-GYAUJ4KT.js';
|
|
10
13
|
import '../chunk-2FL7QJKJ.js';
|
|
11
14
|
import '../chunk-HFZ45FD3.js';
|
|
12
|
-
import {
|
|
13
|
-
import { WorkspaceActivityList, WorkspaceNotificationMenu, ThreadFollowMenuItem, ThreadFollowButton, TagTable, tagTableDocx } from '../chunk-RUB62J2X.js';
|
|
15
|
+
import { WorkspaceActivityList, WorkspaceNotificationMenu, ThreadFollowMenuItem, ThreadFollowButton, TagTable, tagTableDocx } from '../chunk-M33QUNFH.js';
|
|
14
16
|
import { PlainMailBodyEditor, draftMailCompose, replyMailCompose, emptyMailCompose, MailGrid, MailMessageView, MailDocumentPicker, parseMailRecipients } from '../chunk-6HCJ3ZEU.js';
|
|
15
17
|
import { DOCX_MIME_TYPE } from '../chunk-QXMR5YHC.js';
|
|
16
18
|
import '../chunk-AF6RDAJF.js';
|
|
17
|
-
import { WorkflowStepBar, importSkillFile, importSkillFromUrl, WorkflowRunner, fromPlanSteps, toPlanSteps, useWorkflowView } from '../chunk-
|
|
18
|
-
import '../chunk-XD2M6LIG.js';
|
|
19
|
-
import { TriStateFilterMenu } from '../chunk-6S5FLMWG.js';
|
|
19
|
+
import { WorkflowsTable, workflowTriggerType, buildWorkflowScopeSource, documentScopeLabels, WorkflowDocumentsField, WorkflowLauncher, WorkflowStepBar, importSkillFile, importSkillFromUrl, WorkflowRunner, fromPlanSteps, toPlanSteps, useWorkflowView } from '../chunk-ATJUVHVB.js';
|
|
20
20
|
import '../chunk-EVUEIBNU.js';
|
|
21
|
+
import { TriStateFilterMenu } from '../chunk-KSHKTOY2.js';
|
|
22
|
+
import '../chunk-P6GHJSLR.js';
|
|
23
|
+
import '../chunk-3RJN2VTL.js';
|
|
24
|
+
import '../chunk-444XKG46.js';
|
|
25
|
+
import '../chunk-NUNKSZKU.js';
|
|
21
26
|
import { FilterInput } from '../chunk-YU2KUMGE.js';
|
|
22
27
|
import '../chunk-N5YEF3LC.js';
|
|
23
28
|
import { StreamedArtifactFrame } from '../chunk-LOJVUGBJ.js';
|
|
24
29
|
import '../chunk-VILAPTCB.js';
|
|
25
|
-
import { ConfirmDialog } from '../chunk-
|
|
30
|
+
import { ConfirmDialog } from '../chunk-VHJHY7TT.js';
|
|
26
31
|
import { TabHeader } from '../chunk-4WWM3GQ5.js';
|
|
27
|
-
import {
|
|
28
|
-
import { ModalScaffold } from '../chunk-TX2ZICS7.js';
|
|
29
|
-
import { ChatPage } from '../chunk-JO3EMZ4X.js';
|
|
32
|
+
import { ChatPage } from '../chunk-7M4C6CK7.js';
|
|
30
33
|
import '../chunk-7XF5SFJ2.js';
|
|
31
34
|
import { takeOpenDocumentForTurn, useRegisterOpenDocument } from '../chunk-YBLIKTJK.js';
|
|
32
|
-
import { splitDocRef, stepLevels, stepDocuments, stepKindOf, initialRunInputs, workflowSteps, stepStatesFromActivity, runThreadTitle, stepFields } from '../chunk-
|
|
33
|
-
import '../chunk-AA3PT6KR.js';
|
|
35
|
+
import { splitDocRef, stepLevels, stepDocuments, stepKindOf, initialRunInputs, workflowSteps, stepStatesFromActivity, runThreadTitle, stepFields } from '../chunk-YOMPLCP6.js';
|
|
34
36
|
import '../chunk-AUS3KBHJ.js';
|
|
37
|
+
import '../chunk-AA3PT6KR.js';
|
|
35
38
|
import '../chunk-SLSBJRWW.js';
|
|
36
39
|
import '../chunk-NPLYHR2E.js';
|
|
37
40
|
import '../chunk-7F6CBP3Z.js';
|
|
38
|
-
import {
|
|
41
|
+
import { useBlocksEnvironment } from '../chunk-YNIBUKV5.js';
|
|
42
|
+
import { ModalScaffold } from '../chunk-TX2ZICS7.js';
|
|
43
|
+
import { fmtDate, initials } from '../chunk-OXF2IFXG.js';
|
|
39
44
|
import '../chunk-VUNV25KB.js';
|
|
40
|
-
import { lazy, useState, useMemo,
|
|
45
|
+
import { lazy, useState, useMemo, useEffect, useRef, useCallback, Suspense, useLayoutEffect } from 'react';
|
|
41
46
|
import { QueryClient, QueryClientProvider, useQueryClient, useQuery } from '@tanstack/react-query';
|
|
42
|
-
import { ArbiProvider, useConversations, useRunConversation, useWorkspaceActivity, useWorkspaceUsers, useWorkspaceNotificationLevel, useFollowThread, useUploadSkillFiles, ArtifactCanvas, useArbiChat,
|
|
47
|
+
import { ArbiProvider, useConversations, useRunConversation, useWorkspaceActivity, useWorkspaceUsers, useWorkspaceNotificationLevel, useFollowThread, useWorkflows, useAgents, useUpdateWorkflow, useDeleteWorkflow, useRunWorkflow, useArbi, useThumbnails, useUploadSkillFiles, ArtifactCanvas, useArbiChat, useDocuments, useTagKindSchema, useTags, useSetTagValues, useUpdateTagKindSchema, useInvalidateTagData, useWorkspaces, useShellWorkspaces, useProfile, useUpdateProfile, useRequestEmailChange, useConfirmEmailChange, useNameEditor, useAvatarCrop, useEmailChange, ImageCropModal, useIdentityVerification, usePasswordChange, usePasswordChangeForm, useNotificationPreferences, useSessions, useCurrentSessionId, useTerminateSession, useSignOut, useDeleteAccount, useDeleteAccountFlow, useArbiWebSocket, useWorkNotifications, mailDraftIdFromContent, useMailClient, defaultMailAlias, useClaimNativeAlias, useMailOnline, useConnectMailAccount, useDisconnectMailAccount, useMailPolicy, useMailAccounts, useMailUnlock, useMailFolders, useMailMessages, useMailDraftCompose, useMailMessage, useMailCache, MailOfflineUnavailableError, accountPath, useAgentSession, useStartAgentSession, useCloseAgentSession, isAliasTakenError, nextAliasSuggestion, aliasTakenMessage, mailJson, ArbiWebSocketProvider, useCreateWork, useActOnStep, useConversationActivity, useConversationThreads, fileAttachment, useMailProjects, useSaveMailDraft, useSendMail, useMailDraftReplaced, AiAnswer, useMailDraftEditor } from '@arbidocs/react';
|
|
43
48
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
44
49
|
import { Button, Label, Input, cn, Dialog, DialogContent, DialogTitle, DialogDescription, Tooltip, TooltipTrigger, TooltipContent } from '@arbidocs/react/ui';
|
|
45
50
|
import { Upload, Link2, ExternalLink, UserCircle, KeyRound, Radio, Mail, Settings, Plus, ArrowLeft, Loader2, X, Paperclip, Send, MessageSquare } from 'lucide-react';
|
|
@@ -181,6 +186,255 @@ function ConnectedThreadFollow({
|
|
|
181
186
|
}
|
|
182
187
|
);
|
|
183
188
|
}
|
|
189
|
+
function useConnectedWorkspaceRole() {
|
|
190
|
+
const { workspaceId, live, userId, ensureWorkspaceOpen } = useConnectedWorkspace();
|
|
191
|
+
const { data: members = [] } = useWorkspaceUsers(workspaceId ?? void 0, {
|
|
192
|
+
enabled: live && !!workspaceId,
|
|
193
|
+
beforeFetch: ensureWorkspaceOpen
|
|
194
|
+
});
|
|
195
|
+
const role = members.find((m) => m.user.external_id === userId)?.role;
|
|
196
|
+
return {
|
|
197
|
+
members,
|
|
198
|
+
role,
|
|
199
|
+
/** An owner or a collaborator edits, pauses, resumes and runs what is shared with the workspace. */
|
|
200
|
+
canEditShared: role === "owner" || role === "collaborator",
|
|
201
|
+
/** With an item's creator, the only one who deletes it. */
|
|
202
|
+
isWorkspaceOwner: role === "owner"
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
var DEFAULT_CONNECTED_WORKFLOWS_TABLE_LABELS = {
|
|
206
|
+
updateFailed: "Could not update the workflow",
|
|
207
|
+
deleteTitle: "Delete workflow",
|
|
208
|
+
deleteOne: (name) => `Delete \u201C${name}\u201D? Threads it already created stay.`,
|
|
209
|
+
deleteMany: (count) => `Delete ${count} workflows? Threads they already created stay.`,
|
|
210
|
+
runFailed: "The workflow failed. You can send an error report from its history.",
|
|
211
|
+
noThread: "The workflow did not create a thread.",
|
|
212
|
+
documentAction: (workflow) => workflow.action?.type === "email_documents" ? "Preparing your document email" : "Reviewing documents",
|
|
213
|
+
untitledTask: "Untitled thread"
|
|
214
|
+
};
|
|
215
|
+
var messageOf = (error) => error instanceof Error ? error.message : "";
|
|
216
|
+
function ConnectedWorkflowsTable({
|
|
217
|
+
filter,
|
|
218
|
+
describeTrigger = (w) => workflowTriggerType(w).replaceAll("_", " "),
|
|
219
|
+
formatDate = fmtDate,
|
|
220
|
+
onViewRuns,
|
|
221
|
+
connectedLabels,
|
|
222
|
+
...tableProps
|
|
223
|
+
}) {
|
|
224
|
+
const l = { ...DEFAULT_CONNECTED_WORKFLOWS_TABLE_LABELS, ...connectedLabels };
|
|
225
|
+
const { notify, confirm, openConversation } = useBlocksEnvironment();
|
|
226
|
+
const { canEditShared, isWorkspaceOwner } = useConnectedWorkspaceRole();
|
|
227
|
+
const { data: saved = [], isLoading } = useWorkflows({ live: true });
|
|
228
|
+
const { data: conversations, refetch } = useConnectedConversations({ live: true });
|
|
229
|
+
const { data: agents = [] } = useAgents();
|
|
230
|
+
const update = useUpdateWorkflow();
|
|
231
|
+
const remove = useDeleteWorkflow();
|
|
232
|
+
const run = useRunWorkflow();
|
|
233
|
+
const [busyId, setBusyId] = useState(null);
|
|
234
|
+
const workflows = useMemo(() => filter ? saved.filter(filter) : saved, [saved, filter]);
|
|
235
|
+
const firingStamp = saved.map((w) => `${w.external_id}:${w.last_fired_at ?? ""}`).join("|");
|
|
236
|
+
useEffect(() => {
|
|
237
|
+
void refetch?.();
|
|
238
|
+
}, [firingStamp, refetch]);
|
|
239
|
+
const lastRuns = useMemo(() => {
|
|
240
|
+
const out = {};
|
|
241
|
+
for (const c of conversations) {
|
|
242
|
+
const id = c.workflow_ext_id;
|
|
243
|
+
if (id && (!out[id] || Date.parse(c.created_at) > Date.parse(out[id].at)))
|
|
244
|
+
out[id] = { conversationId: c.external_id, at: c.created_at, threadStatus: c.status };
|
|
245
|
+
}
|
|
246
|
+
return out;
|
|
247
|
+
}, [conversations]);
|
|
248
|
+
const agentNames = useMemo(
|
|
249
|
+
() => Object.fromEntries(agents.map((a) => [a.external_id, a.given_name || a.email])),
|
|
250
|
+
[agents]
|
|
251
|
+
);
|
|
252
|
+
const taskNames = useMemo(
|
|
253
|
+
() => Object.fromEntries(
|
|
254
|
+
conversations.filter((c) => c.status != null).map((c) => [c.external_id, c.title || l.untitledTask])
|
|
255
|
+
),
|
|
256
|
+
[conversations, l.untitledTask]
|
|
257
|
+
);
|
|
258
|
+
const act = async (workflow, action) => {
|
|
259
|
+
setBusyId(workflow.external_id);
|
|
260
|
+
try {
|
|
261
|
+
await action();
|
|
262
|
+
} catch (error) {
|
|
263
|
+
notify(messageOf(error) || l.updateFailed, "error");
|
|
264
|
+
} finally {
|
|
265
|
+
setBusyId(null);
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
const setActive = (workflow, active) => act(workflow, () => update.mutateAsync({ workflowId: workflow.external_id, patch: { active } }));
|
|
269
|
+
const deleteAll = async (items) => {
|
|
270
|
+
if (!items.length) return;
|
|
271
|
+
const ok = await confirm({
|
|
272
|
+
title: l.deleteTitle,
|
|
273
|
+
message: items.length === 1 ? l.deleteOne(items[0].name) : l.deleteMany(items.length)
|
|
274
|
+
});
|
|
275
|
+
if (!ok) return;
|
|
276
|
+
for (const workflow of items)
|
|
277
|
+
await act(workflow, () => remove.mutateAsync(workflow.external_id));
|
|
278
|
+
};
|
|
279
|
+
return /* @__PURE__ */ jsx(
|
|
280
|
+
WorkflowsTable,
|
|
281
|
+
{
|
|
282
|
+
...tableProps,
|
|
283
|
+
workflows,
|
|
284
|
+
isLoading,
|
|
285
|
+
busyId,
|
|
286
|
+
describeTrigger,
|
|
287
|
+
formatDate,
|
|
288
|
+
agentNames,
|
|
289
|
+
taskNames,
|
|
290
|
+
lastRuns,
|
|
291
|
+
canEditShared,
|
|
292
|
+
isWorkspaceOwner,
|
|
293
|
+
onOpenThread: (conversationId) => openConversation(conversationId),
|
|
294
|
+
onViewRuns,
|
|
295
|
+
onToggleActive: (workflow, active) => void setActive(workflow, active),
|
|
296
|
+
onToggleActiveMany: (items, active) => {
|
|
297
|
+
void (async () => {
|
|
298
|
+
for (const workflow of items) await setActive(workflow, active);
|
|
299
|
+
})();
|
|
300
|
+
},
|
|
301
|
+
onToggleShared: (workflow, shared) => void act(
|
|
302
|
+
workflow,
|
|
303
|
+
() => update.mutateAsync({ workflowId: workflow.external_id, patch: { shared } })
|
|
304
|
+
),
|
|
305
|
+
onDelete: (workflow) => void deleteAll([workflow]),
|
|
306
|
+
onDeleteMany: (items) => void deleteAll(items),
|
|
307
|
+
onRun: (workflow) => void act(workflow, async () => {
|
|
308
|
+
const result = await run.mutateAsync(workflow.external_id);
|
|
309
|
+
if (result.conversation_ext_id) openConversation(result.conversation_ext_id);
|
|
310
|
+
if (result.error) {
|
|
311
|
+
onViewRuns?.(workflow);
|
|
312
|
+
notify(l.runFailed, "error");
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
if (result.execution_id && !result.conversation_ext_id) {
|
|
316
|
+
onViewRuns?.(workflow);
|
|
317
|
+
notify(l.documentAction(workflow), "success");
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
if (!result.conversation_ext_id) throw new Error(l.noThread);
|
|
321
|
+
})
|
|
322
|
+
}
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
var IMAGE_FILE_TYPES = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "gif", "bmp", "tiff", "webp"]);
|
|
326
|
+
function toWorkflowFieldDocument(doc) {
|
|
327
|
+
const isImage = IMAGE_FILE_TYPES.has((doc.file_type ?? "").toLowerCase());
|
|
328
|
+
return {
|
|
329
|
+
id: doc.external_id,
|
|
330
|
+
title: doc.doc_metadata?.title || doc.file_name || doc.external_id,
|
|
331
|
+
fileName: doc.file_name,
|
|
332
|
+
pages: isImage ? null : doc.n_pages ?? null,
|
|
333
|
+
tokens: isImage ? null : doc.tokens ?? null,
|
|
334
|
+
status: doc.status,
|
|
335
|
+
isImage
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
function useConnectedWorkflowScopeSource() {
|
|
339
|
+
const { data: docs } = useConnectedDocuments();
|
|
340
|
+
const { data: tags } = useConnectedTags();
|
|
341
|
+
return useMemo(() => buildWorkflowScopeSource(docs, documentScopeLabels(tags)), [docs, tags]);
|
|
342
|
+
}
|
|
343
|
+
function useConnectedAgentOptions() {
|
|
344
|
+
const { data: agents } = useAgents();
|
|
345
|
+
return useMemo(
|
|
346
|
+
() => (agents ?? []).map((a) => ({ id: a.external_id, label: a.given_name || a.email })),
|
|
347
|
+
[agents]
|
|
348
|
+
);
|
|
349
|
+
}
|
|
350
|
+
function ConnectedWorkflowDocumentsField({
|
|
351
|
+
field,
|
|
352
|
+
value,
|
|
353
|
+
onChange,
|
|
354
|
+
onAddFiles,
|
|
355
|
+
labels
|
|
356
|
+
}) {
|
|
357
|
+
const arbi = useArbi();
|
|
358
|
+
const { notify } = useBlocksEnvironment();
|
|
359
|
+
const { ensureWorkspaceOpen } = useConnectedWorkspace();
|
|
360
|
+
const { data: docs, loaded, refetch } = useConnectedDocuments();
|
|
361
|
+
const documents = useMemo(() => docs.map(toWorkflowFieldDocument), [docs]);
|
|
362
|
+
const chosen = value.documents ?? [];
|
|
363
|
+
const { data: thumbnails } = useThumbnails(chosen, { enabled: (field.max ?? 1) > 1 });
|
|
364
|
+
const input = useRef(null);
|
|
365
|
+
const [adding, setAdding] = useState(false);
|
|
366
|
+
const upload = useCallback(
|
|
367
|
+
async (files) => {
|
|
368
|
+
setAdding(true);
|
|
369
|
+
try {
|
|
370
|
+
await ensureWorkspaceOpen();
|
|
371
|
+
for (const file of files) await arbi.documents.uploadFile(file, file.name);
|
|
372
|
+
} catch (error) {
|
|
373
|
+
notify(error instanceof Error && error.message ? error.message : String(error), "error");
|
|
374
|
+
} finally {
|
|
375
|
+
setAdding(false);
|
|
376
|
+
await refetch?.();
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
[arbi, ensureWorkspaceOpen, notify, refetch]
|
|
380
|
+
);
|
|
381
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
382
|
+
!onAddFiles && /* @__PURE__ */ jsx(
|
|
383
|
+
"input",
|
|
384
|
+
{
|
|
385
|
+
ref: input,
|
|
386
|
+
type: "file",
|
|
387
|
+
multiple: true,
|
|
388
|
+
className: "hidden",
|
|
389
|
+
"aria-label": "Add files",
|
|
390
|
+
"data-testid": "workflow-add-files-input",
|
|
391
|
+
onChange: (e) => {
|
|
392
|
+
const files = Array.from(e.target.files ?? []);
|
|
393
|
+
e.target.value = "";
|
|
394
|
+
if (files.length) void upload(files);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
),
|
|
398
|
+
/* @__PURE__ */ jsx(
|
|
399
|
+
WorkflowDocumentsField,
|
|
400
|
+
{
|
|
401
|
+
field,
|
|
402
|
+
value,
|
|
403
|
+
onChange,
|
|
404
|
+
documents,
|
|
405
|
+
loaded,
|
|
406
|
+
thumbnailOf: (id) => thumbnails?.[id],
|
|
407
|
+
onAddFiles: onAddFiles ?? ((files) => files?.length ? void upload(files) : input.current?.click()),
|
|
408
|
+
adding,
|
|
409
|
+
labels
|
|
410
|
+
}
|
|
411
|
+
)
|
|
412
|
+
] });
|
|
413
|
+
}
|
|
414
|
+
function ConnectedWorkflowLauncher({
|
|
415
|
+
onAddFiles,
|
|
416
|
+
...props
|
|
417
|
+
}) {
|
|
418
|
+
const scopeSource = useConnectedWorkflowScopeSource();
|
|
419
|
+
const agents = useConnectedAgentOptions();
|
|
420
|
+
return /* @__PURE__ */ jsx(
|
|
421
|
+
WorkflowLauncher,
|
|
422
|
+
{
|
|
423
|
+
...props,
|
|
424
|
+
scopeSource,
|
|
425
|
+
agents,
|
|
426
|
+
renderDocuments: (field, value, onChange) => /* @__PURE__ */ jsx(
|
|
427
|
+
ConnectedWorkflowDocumentsField,
|
|
428
|
+
{
|
|
429
|
+
field,
|
|
430
|
+
value,
|
|
431
|
+
onChange,
|
|
432
|
+
onAddFiles
|
|
433
|
+
}
|
|
434
|
+
)
|
|
435
|
+
}
|
|
436
|
+
);
|
|
437
|
+
}
|
|
184
438
|
var DEFAULT_CONNECTED_SKILL_UPLOAD_LABELS = {
|
|
185
439
|
title: "Add a skill",
|
|
186
440
|
description: "Bring in a skill someone sent you, from a file or a link.",
|
|
@@ -3909,6 +4163,6 @@ function ConnectedAgentChatPanel({
|
|
|
3909
4163
|
] });
|
|
3910
4164
|
}
|
|
3911
4165
|
|
|
3912
|
-
export { ArbiAppProvider, ConnectedAgentChatPanel, ConnectedDangerZone, ConnectedIdentityVerification, ConnectedLogoutDialog, ConnectedMailAccounts, ConnectedMailComposer, ConnectedMailMessage, ConnectedMailSetup, ConnectedMailbox, ConnectedNotificationPreferences, ConnectedPasswordChangeDialog, ConnectedProfileCard, ConnectedRequireVerified, ConnectedSecuritySection, ConnectedSessionsRow, ConnectedSkillUpload, ConnectedTagTable, ConnectedTaskAccessRequest, ConnectedThreadFollow, ConnectedWorkflowRunner, ConnectedWorkspaceActivity, ConnectedWorkspaceNotificationMenu, DEFAULT_CONNECTED_SKILL_UPLOAD_LABELS, DEFAULT_CONNECTED_WORKFLOW_RUNNER_LABELS, StreamedArtifact, WorkflowRunThread, defaultUnmetPasswordRequirement, resolveMailbox, useConnectedDocxNotifications, useConnectedShellWorkspaces, useConnectedWorkNotifications };
|
|
4166
|
+
export { ArbiAppProvider, ConnectedAgentChatPanel, ConnectedDangerZone, ConnectedIdentityVerification, ConnectedLogoutDialog, ConnectedMailAccounts, ConnectedMailComposer, ConnectedMailMessage, ConnectedMailSetup, ConnectedMailbox, ConnectedNotificationPreferences, ConnectedPasswordChangeDialog, ConnectedProfileCard, ConnectedRequireVerified, ConnectedSecuritySection, ConnectedSessionsRow, ConnectedSkillUpload, ConnectedTagTable, ConnectedTaskAccessRequest, ConnectedThreadFollow, ConnectedWorkflowDocumentsField, ConnectedWorkflowLauncher, ConnectedWorkflowRunner, ConnectedWorkflowsTable, ConnectedWorkspaceActivity, ConnectedWorkspaceNotificationMenu, DEFAULT_CONNECTED_SKILL_UPLOAD_LABELS, DEFAULT_CONNECTED_WORKFLOWS_TABLE_LABELS, DEFAULT_CONNECTED_WORKFLOW_RUNNER_LABELS, StreamedArtifact, WorkflowRunThread, defaultUnmetPasswordRequirement, resolveMailbox, toWorkflowFieldDocument, useConnectedAgentOptions, useConnectedDocxNotifications, useConnectedShellWorkspaces, useConnectedWorkNotifications, useConnectedWorkflowScopeSource, useConnectedWorkspaceRole };
|
|
3913
4167
|
//# sourceMappingURL=index.js.map
|
|
3914
4168
|
//# sourceMappingURL=index.js.map
|