@arbidocs/blocks 0.4.135 → 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.
Files changed (123) hide show
  1. package/dist/agents/index.cjs +422 -367
  2. package/dist/agents/index.js +8 -9
  3. package/dist/agents/skills/index.d.ts +2 -0
  4. package/dist/agents/skills/skillFiles.d.ts +65 -0
  5. package/dist/agents/skills/skillImport.d.ts +36 -0
  6. package/dist/agents/workflows/WorkflowDocumentsField.d.ts +42 -5
  7. package/dist/agents/workflows/index.d.ts +3 -3
  8. package/dist/agents/workflows/workflow.d.ts +19 -0
  9. package/dist/agents/workflows/workspaceScope.d.ts +12 -0
  10. package/dist/chat/index.cjs +138 -138
  11. package/dist/chat/index.js +3 -3
  12. package/dist/chunk-2KUCVSFF.js +51 -0
  13. package/dist/chunk-2KUCVSFF.js.map +1 -0
  14. package/dist/{chunk-GDBDHOI4.js → chunk-3RJN2VTL.js} +36 -6
  15. package/dist/chunk-3RJN2VTL.js.map +1 -0
  16. package/dist/{chunk-6AALMYPS.cjs → chunk-6F7SZCVL.cjs} +23 -2
  17. package/dist/chunk-6F7SZCVL.cjs.map +1 -0
  18. package/dist/{chunk-PUCY3UXN.js → chunk-7M4C6CK7.js} +3 -3
  19. package/dist/{chunk-PUCY3UXN.js.map → chunk-7M4C6CK7.js.map} +1 -1
  20. package/dist/{chunk-2PNNCEPH.js → chunk-ATJUVHVB.js} +1545 -8
  21. package/dist/chunk-ATJUVHVB.js.map +1 -0
  22. package/dist/{chunk-4S5IDT5F.cjs → chunk-BUNZWOPX.cjs} +5 -5
  23. package/dist/{chunk-4S5IDT5F.cjs.map → chunk-BUNZWOPX.cjs.map} +1 -1
  24. package/dist/{chunk-KYDRUFWT.cjs → chunk-C3ZRLULA.cjs} +5 -5
  25. package/dist/{chunk-KYDRUFWT.cjs.map → chunk-C3ZRLULA.cjs.map} +1 -1
  26. package/dist/{chunk-SARREDFP.cjs → chunk-CHVCTKF4.cjs} +1620 -47
  27. package/dist/chunk-CHVCTKF4.cjs.map +1 -0
  28. package/dist/chunk-CQCC7LE7.js +210 -0
  29. package/dist/chunk-CQCC7LE7.js.map +1 -0
  30. package/dist/{chunk-4UMXQPNA.js → chunk-E5OYHJMU.js} +3 -3
  31. package/dist/{chunk-4UMXQPNA.js.map → chunk-E5OYHJMU.js.map} +1 -1
  32. package/dist/{chunk-PJJY6CYL.cjs → chunk-EHOPZBAX.cjs} +11 -11
  33. package/dist/{chunk-PJJY6CYL.cjs.map → chunk-EHOPZBAX.cjs.map} +1 -1
  34. package/dist/{chunk-4QIIDXLF.cjs → chunk-HDYWXEQU.cjs} +8 -8
  35. package/dist/{chunk-4QIIDXLF.cjs.map → chunk-HDYWXEQU.cjs.map} +1 -1
  36. package/dist/{chunk-GZPTWHP5.cjs → chunk-HLB4DIYV.cjs} +5 -5
  37. package/dist/{chunk-GZPTWHP5.cjs.map → chunk-HLB4DIYV.cjs.map} +1 -1
  38. package/dist/{chunk-TT6XV6WM.cjs → chunk-JY73DJOS.cjs} +78 -1274
  39. package/dist/chunk-JY73DJOS.cjs.map +1 -0
  40. package/dist/{chunk-ARDHLU73.cjs → chunk-KDUGTKVI.cjs} +21 -2
  41. package/dist/chunk-KDUGTKVI.cjs.map +1 -0
  42. package/dist/{chunk-UMIY4SQS.js → chunk-KMNZ2RVO.js} +17 -1191
  43. package/dist/chunk-KMNZ2RVO.js.map +1 -0
  44. package/dist/{chunk-6S5FLMWG.js → chunk-KSHKTOY2.js} +203 -7
  45. package/dist/chunk-KSHKTOY2.js.map +1 -0
  46. package/dist/{chunk-4RLCRFZS.js → chunk-L2PAPOZ5.js} +21 -3
  47. package/dist/chunk-L2PAPOZ5.js.map +1 -0
  48. package/dist/{chunk-QYTYW74G.js → chunk-L3T7OJRX.js} +4 -4
  49. package/dist/{chunk-QYTYW74G.js.map → chunk-L3T7OJRX.js.map} +1 -1
  50. package/dist/{chunk-ENDP7JER.js → chunk-M33QUNFH.js} +3 -3
  51. package/dist/{chunk-ENDP7JER.js.map → chunk-M33QUNFH.js.map} +1 -1
  52. package/dist/chunk-RFIBUWLF.cjs +232 -0
  53. package/dist/chunk-RFIBUWLF.cjs.map +1 -0
  54. package/dist/{chunk-N26CXGXC.cjs → chunk-RQ2Y7USX.cjs} +201 -3
  55. package/dist/chunk-RQ2Y7USX.cjs.map +1 -0
  56. package/dist/chunk-UUHUQHXR.cjs +56 -0
  57. package/dist/chunk-UUHUQHXR.cjs.map +1 -0
  58. package/dist/{chunk-SZX44LCT.js → chunk-VMESMX7N.js} +3 -3
  59. package/dist/{chunk-SZX44LCT.js.map → chunk-VMESMX7N.js.map} +1 -1
  60. package/dist/{chunk-QDEODGXE.cjs → chunk-WS5EX7DN.cjs} +37 -6
  61. package/dist/chunk-WS5EX7DN.cjs.map +1 -0
  62. package/dist/{chunk-2DFDFOM7.js → chunk-YOMPLCP6.js} +22 -3
  63. package/dist/chunk-YOMPLCP6.js.map +1 -0
  64. package/dist/connect/docx.cjs +4 -4
  65. package/dist/connect/docx.js +3 -3
  66. package/dist/connect/index.cjs +463 -97
  67. package/dist/connect/index.cjs.map +1 -1
  68. package/dist/connect/index.d.ts +5 -2
  69. package/dist/connect/index.js +387 -49
  70. package/dist/connect/index.js.map +1 -1
  71. package/dist/connection/ConnectedSkillUpload.d.ts +26 -2
  72. package/dist/connection/ConnectedWorkflowBuilder.d.ts +24 -12
  73. package/dist/connection/ConnectedWorkflowLauncher.d.ts +35 -0
  74. package/dist/connection/ConnectedWorkflowsTable.d.ts +62 -0
  75. package/dist/connection/ConnectionProvider.d.ts +17 -0
  76. package/dist/connection/workspaceData.d.ts +45 -0
  77. package/dist/facts/index.cjs +1 -1
  78. package/dist/facts/index.js +1 -1
  79. package/dist/files/index.cjs +1 -1
  80. package/dist/files/index.js +1 -1
  81. package/dist/home/index.cjs +20 -21
  82. package/dist/home/index.cjs.map +1 -1
  83. package/dist/home/index.js +2 -3
  84. package/dist/home/index.js.map +1 -1
  85. package/dist/index.cjs +610 -555
  86. package/dist/index.cjs.map +1 -1
  87. package/dist/index.js +14 -15
  88. package/dist/index.js.map +1 -1
  89. package/dist/settings/index.cjs +11 -11
  90. package/dist/settings/index.js +2 -2
  91. package/dist/shell/index.cjs +1 -1
  92. package/dist/shell/index.js +1 -1
  93. package/dist/site/index.cjs +5 -5
  94. package/dist/site/index.js +1 -1
  95. package/dist/studio/index.cjs +7 -7
  96. package/dist/studio/index.js +5 -5
  97. package/dist/workflow-canvas/index.cjs +122 -96
  98. package/dist/workflow-canvas/index.cjs.map +1 -1
  99. package/dist/workflow-canvas/index.d.ts +1 -1
  100. package/dist/workflow-canvas/index.js +73 -48
  101. package/dist/workflow-canvas/index.js.map +1 -1
  102. package/node_modules/@arbidocs/coedit/package.json +1 -1
  103. package/package.json +4 -4
  104. package/dist/chunk-2DFDFOM7.js.map +0 -1
  105. package/dist/chunk-2PNNCEPH.js.map +0 -1
  106. package/dist/chunk-4RLCRFZS.js.map +0 -1
  107. package/dist/chunk-4XJZ6AAY.js +0 -407
  108. package/dist/chunk-4XJZ6AAY.js.map +0 -1
  109. package/dist/chunk-6AALMYPS.cjs.map +0 -1
  110. package/dist/chunk-6S5FLMWG.js.map +0 -1
  111. package/dist/chunk-7D737FLE.cjs +0 -43
  112. package/dist/chunk-7D737FLE.cjs.map +0 -1
  113. package/dist/chunk-ARDHLU73.cjs.map +0 -1
  114. package/dist/chunk-GDBDHOI4.js.map +0 -1
  115. package/dist/chunk-N26CXGXC.cjs.map +0 -1
  116. package/dist/chunk-QDEODGXE.cjs.map +0 -1
  117. package/dist/chunk-S5HZBXZA.cjs +0 -430
  118. package/dist/chunk-S5HZBXZA.cjs.map +0 -1
  119. package/dist/chunk-SARREDFP.cjs.map +0 -1
  120. package/dist/chunk-TT6XV6WM.cjs.map +0 -1
  121. package/dist/chunk-UMIY4SQS.js.map +0 -1
  122. package/dist/chunk-XD2M6LIG.js +0 -41
  123. package/dist/chunk-XD2M6LIG.js.map +0 -1
@@ -3,12 +3,15 @@
3
3
  * hooks, React Query + ARBI provider). Kept off the root barrel because it needs React Query.
4
4
  */
5
5
  export { type ArbiMode, type ConnectionStatus, type ArbiUser, type AssistantStep, type AssistantCitation, type AssistantMessage, type ArbiConnectionConfig, } from '../connection/types';
6
- export { ConnectionProvider, SESSION_EXPIRED_MESSAGE, useConnection, isAuthenticated, } from '../connection/ConnectionProvider';
6
+ export { ConnectionProvider, SESSION_EXPIRED_MESSAGE, useConnection, useConnectedWorkspace, type ConnectedWorkspace, isAuthenticated, } from '../connection/ConnectionProvider';
7
7
  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 { ConnectedSkillUpload } from '../connection/ConnectedSkillUpload';
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';
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';
14
17
  export { ConnectedWorkflowRunner, DEFAULT_CONNECTED_WORKFLOW_RUNNER_LABELS, type ConnectedWorkflowRunnerProps, type ConnectedWorkflowRunnerLabels, type WorkflowRunnerDocument, } from '../connection/ConnectedWorkflowRunner';
@@ -1,33 +1,38 @@
1
1
  "use client";
2
2
  import { FilesFilterBar, FolderFilterButton, FolderPickerRow } from '../chunk-7RJTEWYM.js';
3
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-QYTYW74G.js';
5
- export { ConnectedAssistantDock, redlineStats, textToArtifact, toRedlineMarkdown, useConnectedAiTask, useConnectedChat, useSemanticSearch, useWorkspaceDocs } from '../chunk-QYTYW74G.js';
6
- import { ConnectedNativeDocxEditor } from '../chunk-4UMXQPNA.js';
7
- import { ConnectionProvider, useConnection } from '../chunk-4RLCRFZS.js';
8
- export { ConnectionProvider, SESSION_EXPIRED_MESSAGE, isAuthenticated, useConnection } from '../chunk-4RLCRFZS.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';
10
+ export { ConnectionProvider, SESSION_EXPIRED_MESSAGE, isAuthenticated, useConnectedWorkspace, useConnection } from '../chunk-L2PAPOZ5.js';
9
11
  import { SignDocumentDialog } from '../chunk-2YOVK524.js';
10
12
  import '../chunk-GYAUJ4KT.js';
11
13
  import '../chunk-2FL7QJKJ.js';
12
14
  import '../chunk-HFZ45FD3.js';
13
- import { WorkspaceActivityList, WorkspaceNotificationMenu, ThreadFollowMenuItem, ThreadFollowButton, TagTable, tagTableDocx } from '../chunk-ENDP7JER.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, WorkflowRunner, fromPlanSteps, toPlanSteps, useWorkflowView } from '../chunk-2PNNCEPH.js';
19
+ import { WorkflowsTable, workflowTriggerType, buildWorkflowScopeSource, documentScopeLabels, WorkflowDocumentsField, WorkflowLauncher, WorkflowStepBar, importSkillFile, importSkillFromUrl, WorkflowRunner, fromPlanSteps, toPlanSteps, useWorkflowView } from '../chunk-ATJUVHVB.js';
18
20
  import '../chunk-EVUEIBNU.js';
19
- import { TriStateFilterMenu } from '../chunk-6S5FLMWG.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';
20
26
  import { FilterInput } from '../chunk-YU2KUMGE.js';
21
27
  import '../chunk-N5YEF3LC.js';
22
- import '../chunk-XD2M6LIG.js';
23
28
  import { StreamedArtifactFrame } from '../chunk-LOJVUGBJ.js';
24
29
  import '../chunk-VILAPTCB.js';
25
30
  import { ConfirmDialog } from '../chunk-VHJHY7TT.js';
26
31
  import { TabHeader } from '../chunk-4WWM3GQ5.js';
27
- import { ChatPage } from '../chunk-PUCY3UXN.js';
32
+ import { ChatPage } from '../chunk-7M4C6CK7.js';
28
33
  import '../chunk-7XF5SFJ2.js';
29
34
  import { takeOpenDocumentForTurn, useRegisterOpenDocument } from '../chunk-YBLIKTJK.js';
30
- import { splitDocRef, stepLevels, stepDocuments, stepKindOf, initialRunInputs, workflowSteps, stepStatesFromActivity, runThreadTitle, stepFields } from '../chunk-2DFDFOM7.js';
35
+ import { splitDocRef, stepLevels, stepDocuments, stepKindOf, initialRunInputs, workflowSteps, stepStatesFromActivity, runThreadTitle, stepFields } from '../chunk-YOMPLCP6.js';
31
36
  import '../chunk-AUS3KBHJ.js';
32
37
  import '../chunk-AA3PT6KR.js';
33
38
  import '../chunk-SLSBJRWW.js';
@@ -35,15 +40,15 @@ import '../chunk-NPLYHR2E.js';
35
40
  import '../chunk-7F6CBP3Z.js';
36
41
  import { useBlocksEnvironment } from '../chunk-YNIBUKV5.js';
37
42
  import { ModalScaffold } from '../chunk-TX2ZICS7.js';
38
- import { initials } from '../chunk-OXF2IFXG.js';
43
+ import { fmtDate, initials } from '../chunk-OXF2IFXG.js';
39
44
  import '../chunk-VUNV25KB.js';
40
- import { lazy, useState, useMemo, Suspense, useEffect, useRef, useCallback, useLayoutEffect } from 'react';
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, useArbi, 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';
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
- import { Button, Label, Input, Dialog, DialogContent, DialogTitle, DialogDescription, Tooltip, TooltipTrigger, TooltipContent, cn } from '@arbidocs/react/ui';
49
+ import { Button, Label, Input, cn, Dialog, DialogContent, DialogTitle, DialogDescription, Tooltip, TooltipTrigger, TooltipContent } from '@arbidocs/react/ui';
50
+ import { Upload, Link2, ExternalLink, UserCircle, KeyRound, Radio, Mail, Settings, Plus, ArrowLeft, Loader2, X, Paperclip, Send, MessageSquare } from 'lucide-react';
45
51
  import { useStreamedArtifact } from '@arbidocs/react/artifacts';
46
- import { ExternalLink, UserCircle, KeyRound, Radio, Mail, Settings, Plus, ArrowLeft, Loader2, X, Paperclip, Send, MessageSquare } from 'lucide-react';
47
52
  import { useIsOnline, useOptionalDocumentTools, fetchDocumentPdf, DocumentToolsProvider } from '@arbidocs/react/document-tools';
48
53
  import { useNotify } from '@arbidocs/react/shell';
49
54
  import { bytesToBase64 } from '@arbidocs/client';
@@ -181,48 +186,381 @@ function ConnectedThreadFollow({
181
186
  }
182
187
  );
183
188
  }
184
- function ConnectedSkillUpload() {
185
- const [name, setName] = useState("");
186
- const [file, setFile] = useState(null);
187
- const upload = useUploadSkillFiles();
188
- const slug = name.trim().toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "");
189
- return /* @__PURE__ */ jsxs("section", { className: "space-y-3 rounded-lg border p-4", "data-testid": "skill-upload", children: [
190
- /* @__PURE__ */ jsx("h2", { className: "text-sm font-semibold", children: "Add a skill" }),
191
- /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Upload a SKILL.md file containing the instructions your assistant should follow." }),
192
- /* @__PURE__ */ jsx(Label, { htmlFor: "skill-upload-name", children: "Skill name" }),
193
- /* @__PURE__ */ jsx(
194
- Input,
195
- {
196
- id: "skill-upload-name",
197
- value: name,
198
- onChange: (event) => setName(event.target.value),
199
- placeholder: "disclosure-review",
200
- "data-testid": "skill-upload-name"
201
- }
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])
202
255
  ),
203
- /* @__PURE__ */ jsx(
204
- Input,
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",
205
384
  {
385
+ ref: input,
206
386
  type: "file",
207
- accept: ".md",
208
- "aria-label": "Skill instructions file",
209
- onChange: (event) => setFile(event.target.files?.[0] ?? null),
210
- "data-testid": "skill-upload-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
+ }
211
396
  }
212
397
  ),
213
398
  /* @__PURE__ */ jsx(
214
- Button,
399
+ WorkflowDocumentsField,
215
400
  {
216
- disabled: !slug || !file || upload.isPending,
217
- onClick: () => file && upload.mutate([{ folder: `skills/${slug}`, fileName: "SKILL.md", content: file }]),
218
- "data-testid": "skill-upload-submit",
219
- children: upload.isPending ? "Uploading\u2026" : "Upload skill"
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
220
410
  }
221
- ),
222
- upload.isSuccess && /* @__PURE__ */ jsx("p", { role: "status", className: "text-sm", children: "Uploaded. The skill will appear once processing finishes." }),
223
- upload.error && /* @__PURE__ */ jsx("p", { role: "alert", className: "text-sm text-destructive", children: upload.error.message })
411
+ )
224
412
  ] });
225
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
+ }
438
+ var DEFAULT_CONNECTED_SKILL_UPLOAD_LABELS = {
439
+ title: "Add a skill",
440
+ description: "Bring in a skill someone sent you, from a file or a link.",
441
+ fromFile: "From a file",
442
+ chooseFile: "Choose a file",
443
+ fromLink: "From a link",
444
+ linkPlaceholder: "https://\u2026/SKILL.md",
445
+ add: "Add",
446
+ cancel: "Cancel",
447
+ added: (slug) => `${slug} added`,
448
+ failed: "Could not add the skill"
449
+ };
450
+ function ConnectedSkillUpload({ onDone, labels, className }) {
451
+ const l = { ...DEFAULT_CONNECTED_SKILL_UPLOAD_LABELS, ...labels };
452
+ const { notify } = useBlocksEnvironment();
453
+ const upload = useUploadSkillFiles();
454
+ const fileRef = useRef(null);
455
+ const [url, setUrl] = useState("");
456
+ const [busy, setBusy] = useState(false);
457
+ const add = async (read) => {
458
+ setBusy(true);
459
+ try {
460
+ const { slug, entries } = await read();
461
+ await upload.mutateAsync(
462
+ entries.map((e) => ({
463
+ folder: e.folder,
464
+ fileName: e.fileName,
465
+ content: new Blob([e.content], { type: "text/markdown" })
466
+ }))
467
+ );
468
+ notify(l.added(slug), "success");
469
+ setUrl("");
470
+ onDone?.(slug);
471
+ } catch (error) {
472
+ notify(error instanceof Error && error.message ? error.message : l.failed, "error");
473
+ } finally {
474
+ setBusy(false);
475
+ }
476
+ };
477
+ return /* @__PURE__ */ jsxs(
478
+ "div",
479
+ {
480
+ className: cn("flex flex-col gap-6 overflow-y-auto p-4", className),
481
+ "data-testid": "skills-add-view",
482
+ children: [
483
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
484
+ /* @__PURE__ */ jsx("h3", { className: "text-base font-semibold", children: l.title }),
485
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: l.description })
486
+ ] }),
487
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
488
+ /* @__PURE__ */ jsx(Label, { children: l.fromFile }),
489
+ /* @__PURE__ */ jsx(
490
+ "input",
491
+ {
492
+ ref: fileRef,
493
+ type: "file",
494
+ accept: ".md,.markdown,.zip",
495
+ className: "hidden",
496
+ "data-testid": "skills-add-file-input",
497
+ onChange: (e) => {
498
+ const file = e.target.files?.[0];
499
+ e.target.value = "";
500
+ if (file) void add(() => importSkillFile(file));
501
+ }
502
+ }
503
+ ),
504
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
505
+ Button,
506
+ {
507
+ variant: "outline",
508
+ disabled: busy,
509
+ onClick: () => fileRef.current?.click(),
510
+ className: "pointer-coarse:min-h-11",
511
+ "data-testid": "skills-add-file",
512
+ children: [
513
+ /* @__PURE__ */ jsx(Upload, { className: "mr-1.5 size-4" }),
514
+ l.chooseFile
515
+ ]
516
+ }
517
+ ) })
518
+ ] }),
519
+ /* @__PURE__ */ jsxs(
520
+ "form",
521
+ {
522
+ className: "space-y-2",
523
+ onSubmit: (e) => {
524
+ e.preventDefault();
525
+ if (url.trim()) void add(() => importSkillFromUrl(url));
526
+ },
527
+ children: [
528
+ /* @__PURE__ */ jsx(Label, { htmlFor: "skills-add-url", children: l.fromLink }),
529
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 sm:flex-row", children: [
530
+ /* @__PURE__ */ jsx(
531
+ Input,
532
+ {
533
+ id: "skills-add-url",
534
+ value: url,
535
+ onChange: (e) => setUrl(e.target.value),
536
+ placeholder: l.linkPlaceholder,
537
+ inputMode: "url",
538
+ className: "pointer-coarse:min-h-11",
539
+ "data-testid": "skills-add-url-input"
540
+ }
541
+ ),
542
+ /* @__PURE__ */ jsxs(
543
+ Button,
544
+ {
545
+ type: "submit",
546
+ disabled: busy || !url.trim(),
547
+ className: "pointer-coarse:min-h-11",
548
+ "data-testid": "skills-add-url-submit",
549
+ children: [
550
+ /* @__PURE__ */ jsx(Link2, { className: "mr-1.5 size-4" }),
551
+ l.add
552
+ ]
553
+ }
554
+ )
555
+ ] })
556
+ ]
557
+ }
558
+ ),
559
+ onDone && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: () => onDone(), className: "pointer-coarse:min-h-11", children: l.cancel }) })
560
+ ]
561
+ }
562
+ );
563
+ }
226
564
  var StreamedArtifactEditor = lazy(() => import('../StreamedArtifactEditor-XQNANTWM.js'));
227
565
  function StreamedArtifact({
228
566
  artifacts,
@@ -3825,6 +4163,6 @@ function ConnectedAgentChatPanel({
3825
4163
  ] });
3826
4164
  }
3827
4165
 
3828
- 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_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 };
3829
4167
  //# sourceMappingURL=index.js.map
3830
4168
  //# sourceMappingURL=index.js.map