@arbidocs/blocks 0.4.71 → 0.4.73

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 (179) hide show
  1. package/dist/agents/index.cjs +404 -266
  2. package/dist/agents/index.js +10 -8
  3. package/dist/agents/tasks/TaskActivityTimeline.d.ts +1 -1
  4. package/dist/agents/tasks/WorkflowThreadStrip.d.ts +58 -0
  5. package/dist/agents/tasks/index.d.ts +1 -0
  6. package/dist/agents/workflows/WorkflowRunner.d.ts +70 -0
  7. package/dist/agents/workflows/index.d.ts +7 -1
  8. package/dist/agents/workflows/planSteps.d.ts +28 -0
  9. package/dist/agents/workflows/run.d.ts +97 -0
  10. package/dist/agents/workflows/skillMarkdown.d.ts +15 -0
  11. package/dist/agents/workflows/types.d.ts +109 -0
  12. package/dist/agents/workflows/useWorkflowPreview.d.ts +14 -0
  13. package/dist/agents/workflows/useWorkflowView.d.ts +54 -0
  14. package/dist/agents/workflows/workflow.d.ts +3 -1
  15. package/dist/calendar/CalendarGrid.d.ts +2 -0
  16. package/dist/calendar/CalendarList.d.ts +2 -0
  17. package/dist/calendar/CalendarSettingsForm.d.ts +2 -0
  18. package/dist/calendar/EventDetails.d.ts +2 -0
  19. package/dist/calendar/EventEditor.d.ts +2 -0
  20. package/dist/calendar/MiniMonth.d.ts +2 -0
  21. package/dist/calendar/RecurrenceEditor.d.ts +13 -0
  22. package/dist/calendar/RoomFinder.d.ts +2 -0
  23. package/dist/calendar/SchedulingAssistant.d.ts +2 -0
  24. package/dist/calendar/ScopeDialog.d.ts +2 -0
  25. package/dist/calendar/TimeZonePicker.d.ts +2 -0
  26. package/dist/calendar/colors.d.ts +4 -0
  27. package/dist/calendar/draft.d.ts +43 -0
  28. package/dist/calendar/format.d.ts +14 -0
  29. package/dist/calendar/grid-model.d.ts +24 -0
  30. package/dist/calendar/index.cjs +4122 -0
  31. package/dist/calendar/index.cjs.map +1 -0
  32. package/dist/calendar/index.d.ts +30 -0
  33. package/dist/calendar/index.js +4043 -0
  34. package/dist/calendar/index.js.map +1 -0
  35. package/dist/calendar/labels.d.ts +4 -0
  36. package/dist/calendar/recurrence-labels.d.ts +22 -0
  37. package/dist/calendar/recurrence.d.ts +66 -0
  38. package/dist/calendar/reminders.d.ts +26 -0
  39. package/dist/calendar/scheduling.d.ts +27 -0
  40. package/dist/calendar/types.d.ts +605 -0
  41. package/dist/calendar/ui.d.ts +16 -0
  42. package/dist/calendar/zone.d.ts +56 -0
  43. package/dist/chat/index.cjs +123 -123
  44. package/dist/chat/index.js +3 -3
  45. package/dist/chunk-2P3T23C7.js +1250 -0
  46. package/dist/chunk-2P3T23C7.js.map +1 -0
  47. package/dist/{chunk-XNRGCQPZ.cjs → chunk-3SFFTSOI.cjs} +5 -5
  48. package/dist/{chunk-XNRGCQPZ.cjs.map → chunk-3SFFTSOI.cjs.map} +1 -1
  49. package/dist/{chunk-7WM62NMM.cjs → chunk-6OL5S7MJ.cjs} +5 -2
  50. package/dist/chunk-6OL5S7MJ.cjs.map +1 -0
  51. package/dist/chunk-7D737FLE.cjs +43 -0
  52. package/dist/chunk-7D737FLE.cjs.map +1 -0
  53. package/dist/{chunk-VUEZARW5.cjs → chunk-B3WCKBJ7.cjs} +278 -5
  54. package/dist/chunk-B3WCKBJ7.cjs.map +1 -0
  55. package/dist/{chunk-L5UPP2HC.js → chunk-D46ZAPEE.js} +5 -2
  56. package/dist/chunk-D46ZAPEE.js.map +1 -0
  57. package/dist/{chunk-LFGJAZ5H.js → chunk-DDF5GPIJ.js} +6 -36
  58. package/dist/chunk-DDF5GPIJ.js.map +1 -0
  59. package/dist/chunk-DETZZBG2.cjs +91 -0
  60. package/dist/chunk-DETZZBG2.cjs.map +1 -0
  61. package/dist/chunk-EVUEIBNU.js +89 -0
  62. package/dist/chunk-EVUEIBNU.js.map +1 -0
  63. package/dist/{chunk-CXWESDIZ.cjs → chunk-F4RUCUXF.cjs} +6 -6
  64. package/dist/{chunk-CXWESDIZ.cjs.map → chunk-F4RUCUXF.cjs.map} +1 -1
  65. package/dist/{chunk-DABEWNL2.js → chunk-G5DP27DU.js} +3 -3
  66. package/dist/{chunk-DABEWNL2.js.map → chunk-G5DP27DU.js.map} +1 -1
  67. package/dist/{chunk-VZGBCBYB.js → chunk-GJV2G4FC.js} +276 -7
  68. package/dist/chunk-GJV2G4FC.js.map +1 -0
  69. package/dist/chunk-GTNUQBXI.cjs +1296 -0
  70. package/dist/chunk-GTNUQBXI.cjs.map +1 -0
  71. package/dist/{chunk-7M22KND4.cjs → chunk-IUR565UW.cjs} +303 -530
  72. package/dist/chunk-IUR565UW.cjs.map +1 -0
  73. package/dist/{chunk-5DM6VU4L.cjs → chunk-KJ3QEKOJ.cjs} +3 -3
  74. package/dist/{chunk-5DM6VU4L.cjs.map → chunk-KJ3QEKOJ.cjs.map} +1 -1
  75. package/dist/{chunk-THO7DZNN.cjs → chunk-MUMH3Z6K.cjs} +20 -15
  76. package/dist/chunk-MUMH3Z6K.cjs.map +1 -0
  77. package/dist/{chunk-3TVTG7FK.js → chunk-ORA2XE7U.js} +4 -4
  78. package/dist/{chunk-3TVTG7FK.js.map → chunk-ORA2XE7U.js.map} +1 -1
  79. package/dist/{chunk-5HOAOKZL.js → chunk-OYMWV45N.js} +21 -16
  80. package/dist/chunk-OYMWV45N.js.map +1 -0
  81. package/dist/{chunk-HLMFU7L2.js → chunk-QDNXEB3T.js} +272 -488
  82. package/dist/chunk-QDNXEB3T.js.map +1 -0
  83. package/dist/{chunk-ILGHS6ZV.js → chunk-SB5ZKOYN.js} +3 -3
  84. package/dist/{chunk-ILGHS6ZV.js.map → chunk-SB5ZKOYN.js.map} +1 -1
  85. package/dist/{chunk-CPMNAJLF.js → chunk-TX2ZICS7.js} +24 -4
  86. package/dist/chunk-TX2ZICS7.js.map +1 -0
  87. package/dist/{chunk-2ZTONLT5.cjs → chunk-ULWRNGGE.cjs} +25 -4
  88. package/dist/chunk-ULWRNGGE.cjs.map +1 -0
  89. package/dist/{chunk-BMWZTNZB.js → chunk-VRPRAU3J.js} +3 -3
  90. package/dist/{chunk-BMWZTNZB.js.map → chunk-VRPRAU3J.js.map} +1 -1
  91. package/dist/{chunk-LTA2IAQB.cjs → chunk-WOYUXVVQ.cjs} +8 -8
  92. package/dist/{chunk-LTA2IAQB.cjs.map → chunk-WOYUXVVQ.cjs.map} +1 -1
  93. package/dist/chunk-XD2M6LIG.js +41 -0
  94. package/dist/chunk-XD2M6LIG.js.map +1 -0
  95. package/dist/{chunk-WBDK4PIA.cjs → chunk-Z5VUZ6YD.cjs} +6 -37
  96. package/dist/chunk-Z5VUZ6YD.cjs.map +1 -0
  97. package/dist/collaboration/index.cjs +44 -45
  98. package/dist/collaboration/index.js +2 -3
  99. package/dist/connect/docx.cjs +2 -2
  100. package/dist/connect/docx.js +1 -1
  101. package/dist/connect/index.cjs +370 -48
  102. package/dist/connect/index.cjs.map +1 -1
  103. package/dist/connect/index.d.ts +2 -1
  104. package/dist/connect/index.js +331 -12
  105. package/dist/connect/index.js.map +1 -1
  106. package/dist/connection/ConnectedSettings.d.ts +13 -0
  107. package/dist/connection/ConnectedWorkflowBuilder.d.ts +44 -0
  108. package/dist/connection/ConnectedWorkflowRunner.d.ts +27 -0
  109. package/dist/connection/useWorkflowThread.d.ts +34 -0
  110. package/dist/document-tools/index.cjs +4 -5
  111. package/dist/document-tools/index.cjs.map +1 -1
  112. package/dist/document-tools/index.js +1 -2
  113. package/dist/document-tools/index.js.map +1 -1
  114. package/dist/facts/index.cjs +1 -1
  115. package/dist/facts/index.js +1 -1
  116. package/dist/files/import/index.d.ts +0 -1
  117. package/dist/files/index.cjs +31 -169
  118. package/dist/files/index.cjs.map +1 -1
  119. package/dist/files/index.js +8 -147
  120. package/dist/files/index.js.map +1 -1
  121. package/dist/home/index.cjs +21 -20
  122. package/dist/home/index.cjs.map +1 -1
  123. package/dist/home/index.js +3 -2
  124. package/dist/home/index.js.map +1 -1
  125. package/dist/index.cjs +680 -542
  126. package/dist/index.cjs.map +1 -1
  127. package/dist/index.js +15 -13
  128. package/dist/index.js.map +1 -1
  129. package/dist/settings/Billing.d.ts +4 -0
  130. package/dist/settings/IdentityVerification.d.ts +83 -0
  131. package/dist/settings/PlanBadge.d.ts +2 -2
  132. package/dist/settings/PlanCard.d.ts +6 -1
  133. package/dist/settings/ProfileCard.d.ts +5 -1
  134. package/dist/settings/SubscriptionParts.d.ts +6 -2
  135. package/dist/settings/index.cjs +128 -95
  136. package/dist/settings/index.cjs.map +1 -1
  137. package/dist/settings/index.d.ts +1 -0
  138. package/dist/settings/index.js +64 -47
  139. package/dist/settings/index.js.map +1 -1
  140. package/dist/shell/ActionCluster.d.ts +3 -1
  141. package/dist/shell/index.cjs +54 -54
  142. package/dist/shell/index.js +2 -2
  143. package/dist/studio/index.cjs +6 -6
  144. package/dist/studio/index.js +4 -4
  145. package/dist/workflow-canvas/StepInspector.d.ts +46 -0
  146. package/dist/workflow-canvas/TriggerInspector.d.ts +46 -0
  147. package/dist/workflow-canvas/WorkflowBuilder.d.ts +55 -0
  148. package/dist/workflow-canvas/WorkflowCanvas.d.ts +65 -0
  149. package/dist/workflow-canvas/edit.d.ts +54 -0
  150. package/dist/workflow-canvas/index.cjs +1609 -0
  151. package/dist/workflow-canvas/index.cjs.map +1 -0
  152. package/dist/workflow-canvas/index.d.ts +13 -0
  153. package/dist/workflow-canvas/index.js +1579 -0
  154. package/dist/workflow-canvas/index.js.map +1 -0
  155. package/dist/workflow-canvas/trigger.d.ts +51 -0
  156. package/dist/workspaces/index.cjs +2 -3
  157. package/dist/workspaces/index.cjs.map +1 -1
  158. package/dist/workspaces/index.js +1 -2
  159. package/dist/workspaces/index.js.map +1 -1
  160. package/package.json +41 -12
  161. package/src/calendar/calendar.css +316 -0
  162. package/src/workflow-canvas/canvas.css +113 -0
  163. package/dist/chunk-2ZTONLT5.cjs.map +0 -1
  164. package/dist/chunk-5HOAOKZL.js.map +0 -1
  165. package/dist/chunk-7M22KND4.cjs.map +0 -1
  166. package/dist/chunk-7WM62NMM.cjs.map +0 -1
  167. package/dist/chunk-CPMNAJLF.js.map +0 -1
  168. package/dist/chunk-DCDVWPMB.cjs +0 -29
  169. package/dist/chunk-DCDVWPMB.cjs.map +0 -1
  170. package/dist/chunk-HLMFU7L2.js.map +0 -1
  171. package/dist/chunk-L5UPP2HC.js.map +0 -1
  172. package/dist/chunk-LFGJAZ5H.js.map +0 -1
  173. package/dist/chunk-THO7DZNN.cjs.map +0 -1
  174. package/dist/chunk-TJMKFY5P.js +0 -27
  175. package/dist/chunk-TJMKFY5P.js.map +0 -1
  176. package/dist/chunk-VUEZARW5.cjs.map +0 -1
  177. package/dist/chunk-VZGBCBYB.js.map +0 -1
  178. package/dist/chunk-WBDK4PIA.cjs.map +0 -1
  179. package/dist/files/import/CalendarImportRow.d.ts +0 -26
@@ -1,26 +1,30 @@
1
1
  "use client";
2
- export { ConnectedAssistantDock, redlineStats, textToArtifact, toRedlineMarkdown, useConnectedAiTask, useConnectedChat, useSemanticSearch, useWorkspaceDocs } from '../chunk-3TVTG7FK.js';
3
- import { SettingsSection, ProfileCard, AvatarPicker, SettingsCard, SettingsActionRow, PasswordChangeDialog, EMAIL_NOTIFICATION_KEYS, EMAIL_NOTIFICATION_CATEGORIES, NotificationCategoryList, toNotificationCategories, toActiveSessionViews, SettingsRow, ActiveSessionsDialog, LogoutDialog, toLogoutSessionViews, SettingsDangerZone, DeleteAccountDialog, toDeleteBlockerViews } from '../chunk-VZGBCBYB.js';
2
+ import { SettingsSection, ProfileCard, AvatarPicker, IdentityVerificationCard, IdentityVerificationDialog, RequireVerified, SettingsCard, SettingsActionRow, PasswordChangeDialog, EMAIL_NOTIFICATION_KEYS, EMAIL_NOTIFICATION_CATEGORIES, NotificationCategoryList, toNotificationCategories, toActiveSessionViews, SettingsRow, ActiveSessionsDialog, LogoutDialog, toLogoutSessionViews, SettingsDangerZone, DeleteAccountDialog, toDeleteBlockerViews } from '../chunk-GJV2G4FC.js';
3
+ import { useWorkspaceDocs } from '../chunk-ORA2XE7U.js';
4
+ export { ConnectedAssistantDock, redlineStats, textToArtifact, toRedlineMarkdown, useConnectedAiTask, useConnectedChat, useSemanticSearch, useWorkspaceDocs } from '../chunk-ORA2XE7U.js';
5
+ import { ConnectionProvider, useConnection } from '../chunk-OYMWV45N.js';
6
+ export { ConnectionProvider, SESSION_EXPIRED_MESSAGE, isAuthenticated, useConnection } from '../chunk-OYMWV45N.js';
7
+ import { WorkflowRunner, initialRunInputs, workflowSteps, fromPlanSteps, stepStatesFromActivity, toPlanSteps, runThreadTitle, useWorkflowView } from '../chunk-2P3T23C7.js';
8
+ import '../chunk-EVUEIBNU.js';
9
+ import '../chunk-XD2M6LIG.js';
4
10
  import { StreamedArtifactFrame } from '../chunk-LOJVUGBJ.js';
5
11
  import '../chunk-VILAPTCB.js';
6
- import { ChatPage } from '../chunk-DABEWNL2.js';
12
+ import { ChatPage } from '../chunk-G5DP27DU.js';
7
13
  import '../chunk-KZJAG7T3.js';
8
14
  import '../chunk-3VQYJBOI.js';
15
+ import '../chunk-AA3PT6KR.js';
9
16
  import '../chunk-NPLYHR2E.js';
10
17
  import { initials } from '../chunk-OXF2IFXG.js';
11
- import '../chunk-TJMKFY5P.js';
12
- import { ConnectionProvider, useConnection } from '../chunk-5HOAOKZL.js';
13
- export { ConnectionProvider, SESSION_EXPIRED_MESSAGE, isAuthenticated, useConnection } from '../chunk-5HOAOKZL.js';
14
- import '../chunk-AA3PT6KR.js';
18
+ import '../chunk-TX2ZICS7.js';
15
19
  import '../chunk-7F6CBP3Z.js';
16
20
  import '../chunk-VUNV25KB.js';
17
- import { lazy, useState, Suspense, useMemo, useEffect } from 'react';
21
+ import { lazy, useState, Suspense, useCallback, useMemo, useEffect } from 'react';
18
22
  import { QueryClient, QueryClientProvider, useQueryClient, useQuery } from '@tanstack/react-query';
19
- import { ArbiProvider, useConversations, useRunConversation, useUploadSkillFiles, ArtifactCanvas, useWorkspaces, useShellWorkspaces, useProfile, useUpdateProfile, useRequestEmailChange, useConfirmEmailChange, useNameEditor, useAvatarCrop, useEmailChange, ImageCropModal, usePasswordChange, usePasswordChangeForm, useNotificationPreferences, useSessions, useCurrentSessionId, useTerminateSession, useLogoutAllSessions, useDeleteAccount, useDeleteAccountFlow, useArbi, useArbiWebSocket, notify, useWorkNotifications, useAgentSession, useStartAgentSession, useCloseAgentSession, ArbiWebSocketProvider, useArbiChat } from '@arbidocs/react';
23
+ import { ArbiProvider, useConversations, useRunConversation, useUploadSkillFiles, ArtifactCanvas, useArbi, useDocuments, useWorkspaceUsers, useWorkspaces, useShellWorkspaces, useProfile, useUpdateProfile, useRequestEmailChange, useConfirmEmailChange, useNameEditor, useAvatarCrop, useEmailChange, ImageCropModal, useIdentityVerification, usePasswordChange, usePasswordChangeForm, useNotificationPreferences, useSessions, useCurrentSessionId, useTerminateSession, useLogoutAllSessions, useDeleteAccount, useDeleteAccountFlow, useArbiWebSocket, notify, useWorkNotifications, useAgentSession, useStartAgentSession, useCloseAgentSession, AiAnswer, ArbiWebSocketProvider, useCreateWork, useActOnStep, useConversationActivity, useConversationThreads, useArbiChat } from '@arbidocs/react';
20
24
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
21
- import { Button, Label, Input } from '@arbidocs/react/ui';
25
+ import { Button, Label, Input, cn } from '@arbidocs/react/ui';
22
26
  import { useStreamedArtifact } from '@arbidocs/react/artifacts';
23
- import { UserCircle, KeyRound, Radio } from 'lucide-react';
27
+ import { ExternalLink, UserCircle, KeyRound, Radio } from 'lucide-react';
24
28
  import { useNotify } from '@arbidocs/react/shell';
25
29
 
26
30
  function ConnectionBoundWebSocket({ children }) {
@@ -179,6 +183,294 @@ function StreamedArtifact({
179
183
  }
180
184
  );
181
185
  }
186
+ var STARTING = /* @__PURE__ */ new Set(["pending", "running"]);
187
+ function formValues(step, inputs) {
188
+ if (step.kind !== "form") return void 0;
189
+ return Object.fromEntries(step.inputs.map((f) => [f.name, inputs[f.name] ?? ""]));
190
+ }
191
+ function useWorkflowThread(workflow, options = {}) {
192
+ const arbi = useArbi();
193
+ const { ensureWorkspaceOpen } = useConnection();
194
+ const { wsId } = useWorkspaceDocs();
195
+ const [threadId, setThreadId] = useState(options.conversationId);
196
+ const [localInputs, setLocalInputs] = useState(
197
+ () => initialRunInputs(workflow, options.initialInputs)
198
+ );
199
+ const [edits, setEdits] = useState({});
200
+ const [localStates, setLocalStates] = useState({});
201
+ const createWork = useCreateWork();
202
+ const actOnStep = useActOnStep();
203
+ const conversations = useConversations(wsId, { enabled: !!threadId, live: true });
204
+ const conversation = conversations.data?.find((c) => c.external_id === threadId);
205
+ const steps = useMemo(
206
+ () => workflowSteps(workflow).length > 0 ? workflowSteps(workflow) : fromPlanSteps(conversation?.plan?.steps ?? []),
207
+ [workflow, conversation?.plan?.steps]
208
+ );
209
+ const activity = useConversationActivity(threadId, { live: !!threadId });
210
+ const serverStates = useMemo(
211
+ () => stepStatesFromActivity(activity.data ?? []),
212
+ [activity.data]
213
+ );
214
+ const working = steps.some(
215
+ (s) => s.kind === "agent" && STARTING.has(serverStates[s.id]?.status ?? "pending")
216
+ );
217
+ const threads = useConversationThreads(wsId, threadId, { enabled: !!threadId, live: working });
218
+ const answers = useMemo(() => {
219
+ const byId = /* @__PURE__ */ new Map();
220
+ for (const t of threads.data?.threads ?? [])
221
+ for (const m of t.history) if (m.role === "assistant") byId.set(m.external_id, m.content);
222
+ return byId;
223
+ }, [threads.data]);
224
+ const answerMissing = Object.values(serverStates).some(
225
+ (st) => st.status === "done" && !!st.responseId && !answers.has(st.responseId)
226
+ );
227
+ const refetchThreads = threads.refetch;
228
+ useEffect(() => {
229
+ if (answerMissing) void refetchThreads();
230
+ }, [answerMissing, activity.data, refetchThreads]);
231
+ const states = useMemo(() => {
232
+ if (!threadId) return localStates;
233
+ const out = {};
234
+ for (const [id, s] of Object.entries(serverStates))
235
+ out[id] = { ...s, text: s.responseId ? answers.get(s.responseId) : void 0 };
236
+ return out;
237
+ }, [threadId, localStates, serverStates, answers]);
238
+ const inputs = useMemo(
239
+ () => threadId ? { ...localInputs, ...conversation?.skill_inputs ?? {}, ...edits } : { ...localInputs, ...edits },
240
+ [threadId, localInputs, conversation?.skill_inputs, edits]
241
+ );
242
+ const refresh = useCallback(async () => {
243
+ await Promise.all([activity.refetch(), conversations.refetch()]);
244
+ }, [activity, conversations]);
245
+ const act = useCallback(
246
+ async (id, body) => {
247
+ await actOnStep.mutateAsync({ conversationId: id, body });
248
+ await refresh();
249
+ },
250
+ [actOnStep, refresh]
251
+ );
252
+ const complete = useCallback(
253
+ async (step) => {
254
+ let values = inputs;
255
+ const commit = step.commit ? options.commit?.[step.id] : void 0;
256
+ if (commit && localStates[step.id]?.status !== "done") {
257
+ values = { ...values, ...await commit(values) ?? {} };
258
+ setLocalInputs(values);
259
+ setEdits({});
260
+ }
261
+ let id = threadId;
262
+ if (!id) {
263
+ await ensureWorkspaceOpen();
264
+ const created = await createWork.mutateAsync({
265
+ title: runThreadTitle(workflow, values).slice(0, 60),
266
+ description: workflow.description || null,
267
+ prompt: null,
268
+ skill_ref: null,
269
+ skill_inputs: values,
270
+ agent_ext_id: options.agentId ?? null,
271
+ auth_mode: "run_now_temp",
272
+ plan: {
273
+ goal: "",
274
+ criteria: [],
275
+ max_passes: 3,
276
+ documents: [],
277
+ steps: toPlanSteps(workflow, {
278
+ inputs: values,
279
+ resolveWorkflow: options.resolveWorkflow,
280
+ compose: options.compose
281
+ })
282
+ }
283
+ });
284
+ id = created.external_id;
285
+ setThreadId(id);
286
+ setLocalStates((s) => ({ ...s, [step.id]: { status: "done" } }));
287
+ options.onStarted?.(id);
288
+ }
289
+ await act(id, { step: step.id, action: "complete", inputs: formValues(step, values) });
290
+ },
291
+ [inputs, options, localStates, threadId, ensureWorkspaceOpen, createWork, workflow, act]
292
+ );
293
+ const skip = useCallback(
294
+ async (stepId) => {
295
+ if (!threadId) {
296
+ setLocalStates((s) => ({ ...s, [stepId]: { status: "skipped" } }));
297
+ return;
298
+ }
299
+ await act(threadId, { step: stepId, action: "skip" });
300
+ },
301
+ [threadId, act]
302
+ );
303
+ const retry = useCallback(
304
+ async (_stepId) => {
305
+ if (!threadId) return;
306
+ await arbi.conversations.runWithAuth(threadId);
307
+ await refresh();
308
+ },
309
+ [arbi, threadId, refresh]
310
+ );
311
+ const view = useWorkflowView({
312
+ steps,
313
+ states,
314
+ inputs,
315
+ setInput: (name, value) => setEdits((i) => ({ ...i, [name]: value })),
316
+ complete,
317
+ skip,
318
+ retry,
319
+ isLocked: (id) => states[id]?.status === "done"
320
+ });
321
+ return { view, conversationId: threadId, conversation };
322
+ }
323
+ var DEFAULT_CONNECTED_WORKFLOW_RUNNER_LABELS = {
324
+ notify: "Ask to approve",
325
+ notified: "Notified.",
326
+ openThread: "Open the thread"
327
+ };
328
+ function ConnectedWorkflowRunner({
329
+ workflow,
330
+ options,
331
+ onOpenConversation,
332
+ emptyHint,
333
+ connectedLabels,
334
+ testIdPrefix = "workflow-run",
335
+ ...runnerProps
336
+ }) {
337
+ const l = { ...DEFAULT_CONNECTED_WORKFLOW_RUNNER_LABELS, ...connectedLabels };
338
+ const arbi = useArbi();
339
+ const { ensureWorkspaceOpen } = useConnection();
340
+ const { wsId } = useWorkspaceDocs();
341
+ const { data: docs = [], refetch } = useDocuments(wsId);
342
+ const [uploading, setUploading] = useState(false);
343
+ const { view, conversationId } = useWorkflowThread(workflow, options);
344
+ const onUpload = useCallback(
345
+ async (files) => {
346
+ if (!files.length) return;
347
+ setUploading(true);
348
+ try {
349
+ await ensureWorkspaceOpen();
350
+ for (const f of files) await arbi.documents.uploadFile(f, f.name);
351
+ await refetch();
352
+ } finally {
353
+ setUploading(false);
354
+ }
355
+ },
356
+ [arbi, ensureWorkspaceOpen, refetch]
357
+ );
358
+ const renderAgentOutput = (step, state) => {
359
+ const status = state?.status;
360
+ if (!state?.text && status !== "done") return null;
361
+ return /* @__PURE__ */ jsx(
362
+ AiAnswer,
363
+ {
364
+ status: status === "running" ? "running" : "done",
365
+ text: state?.text ?? "",
366
+ emptyHint: emptyHint?.(step),
367
+ testId: `${testIdPrefix}-${step.id}-answer`
368
+ }
369
+ );
370
+ };
371
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
372
+ conversationId && onOpenConversation && /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxs(
373
+ Button,
374
+ {
375
+ variant: "ghost",
376
+ size: "sm",
377
+ onClick: () => onOpenConversation(conversationId),
378
+ "data-testid": `${testIdPrefix}-open-thread`,
379
+ children: [
380
+ /* @__PURE__ */ jsx(ExternalLink, { className: "size-4" }),
381
+ " ",
382
+ l.openThread
383
+ ]
384
+ }
385
+ ) }),
386
+ /* @__PURE__ */ jsx(
387
+ WorkflowRunner,
388
+ {
389
+ ...runnerProps,
390
+ workflow,
391
+ run: view,
392
+ renderAgentOutput,
393
+ renderReview: (step) => conversationId ? /* @__PURE__ */ jsx(
394
+ ReviewNotify,
395
+ {
396
+ conversationId,
397
+ workspaceId: wsId,
398
+ labels: l,
399
+ testId: `${testIdPrefix}-${step.id}`
400
+ }
401
+ ) : null,
402
+ onUpload,
403
+ uploading,
404
+ files: docs.map((d) => ({ id: d.external_id, name: d.file_name ?? d.external_id })),
405
+ testIdPrefix
406
+ }
407
+ )
408
+ ] });
409
+ }
410
+ function ReviewNotify({
411
+ conversationId,
412
+ workspaceId,
413
+ labels,
414
+ testId
415
+ }) {
416
+ const arbi = useArbi();
417
+ const { status, user, ensureWorkspaceOpen } = useConnection();
418
+ const { data: members = [] } = useWorkspaceUsers(workspaceId, {
419
+ enabled: status === "authenticated" && !!workspaceId,
420
+ beforeFetch: ensureWorkspaceOpen
421
+ });
422
+ const people = members.filter(
423
+ (m) => !m.agent_ext_id && !m.user.external_id.startsWith("agt-") && m.user.external_id !== user?.externalId
424
+ );
425
+ const [picked, setPicked] = useState([]);
426
+ const [sent, setSent] = useState(false);
427
+ const [busy, setBusy] = useState(false);
428
+ if (people.length === 0) return null;
429
+ const toggle = (id) => setPicked((p) => p.includes(id) ? p.filter((x) => x !== id) : [...p, id]);
430
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-3", "data-testid": `${testId}-notify`, children: [
431
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1.5", children: people.map((m) => {
432
+ const name = [m.user.given_name, m.user.family_name].filter(Boolean).join(" ") || m.user.email;
433
+ const on = picked.includes(m.user.external_id);
434
+ return /* @__PURE__ */ jsx(
435
+ "button",
436
+ {
437
+ type: "button",
438
+ onClick: () => toggle(m.user.external_id),
439
+ "aria-pressed": on,
440
+ className: cn(
441
+ "rounded-full border px-2.5 py-1 text-xs",
442
+ on ? "border-primary bg-primary/10 text-primary" : "border-border text-muted-foreground"
443
+ ),
444
+ "data-testid": `${testId}-person-${m.user.external_id}`,
445
+ children: name
446
+ },
447
+ m.user.external_id
448
+ );
449
+ }) }),
450
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
451
+ /* @__PURE__ */ jsx(
452
+ Button,
453
+ {
454
+ variant: "outline",
455
+ size: "sm",
456
+ disabled: !picked.length || busy,
457
+ onClick: async () => {
458
+ setBusy(true);
459
+ try {
460
+ await arbi.conversations.notify(conversationId, picked);
461
+ setSent(true);
462
+ } finally {
463
+ setBusy(false);
464
+ }
465
+ },
466
+ "data-testid": `${testId}-notify-send`,
467
+ children: labels.notify
468
+ }
469
+ ),
470
+ sent && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: labels.notified })
471
+ ] })
472
+ ] });
473
+ }
182
474
  function useConnectedShellWorkspaces(options = {}) {
183
475
  const { workspaceId, setWorkspace } = useConnection();
184
476
  const query = useWorkspaces();
@@ -283,11 +575,38 @@ function ConnectedProfileCard({ notify: notify3, title = "Profile" }) {
283
575
  name: { ...name, display, isSaving: name.isSaving },
284
576
  email: profile?.email ?? user?.email ?? "",
285
577
  isSso: profile?.isSso ?? false,
578
+ isVerified: profile?.isIdentityVerified ?? false,
286
579
  onStartEmailChange: email.onStart,
287
580
  emailChange: email.isOpen ? email : void 0
288
581
  }
289
582
  ) });
290
583
  }
584
+ function ConnectedIdentityVerification({
585
+ notify: notify3,
586
+ labels
587
+ }) {
588
+ const { data: profile } = useProfile();
589
+ const flow = useIdentityVerification({
590
+ onVerifiedChange: (verified) => notify3?.(verified ? "Identity verified" : "Verified tick removed", "success"),
591
+ onNameAccepted: () => notify3?.("Name updated to match your ID", "success")
592
+ });
593
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
594
+ /* @__PURE__ */ jsx(IdentityVerificationCard, { flow, labels }),
595
+ /* @__PURE__ */ jsx(
596
+ IdentityVerificationDialog,
597
+ {
598
+ flow,
599
+ accountName: profile?.fullName ?? "",
600
+ labels
601
+ }
602
+ )
603
+ ] });
604
+ }
605
+ function ConnectedRequireVerified({ children, labels }) {
606
+ const { data: profile } = useProfile();
607
+ const flow = useIdentityVerification();
608
+ return /* @__PURE__ */ jsx(RequireVerified, { flow, accountName: profile?.fullName ?? "", labels, children });
609
+ }
291
610
  function defaultUnmetPasswordRequirement(password) {
292
611
  if (password.length < 8) return "Minimum 8 characters";
293
612
  if (!/[A-Z!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(password)) {
@@ -750,6 +1069,6 @@ function ConnectedAgentChatPanel({
750
1069
  ] });
751
1070
  }
752
1071
 
753
- export { ArbiAppProvider, ConnectedAgentChatPanel, ConnectedDangerZone, ConnectedLogoutDialog, ConnectedNotificationPreferences, ConnectedProfileCard, ConnectedSecuritySection, ConnectedSessionsRow, ConnectedSkillUpload, ConnectedTaskAccessRequest, StreamedArtifact, defaultUnmetPasswordRequirement, useConnectedDocxNotifications, useConnectedShellWorkspaces, useConnectedWorkNotifications };
1072
+ export { ArbiAppProvider, ConnectedAgentChatPanel, ConnectedDangerZone, ConnectedIdentityVerification, ConnectedLogoutDialog, ConnectedNotificationPreferences, ConnectedProfileCard, ConnectedRequireVerified, ConnectedSecuritySection, ConnectedSessionsRow, ConnectedSkillUpload, ConnectedTaskAccessRequest, ConnectedWorkflowRunner, DEFAULT_CONNECTED_WORKFLOW_RUNNER_LABELS, StreamedArtifact, defaultUnmetPasswordRequirement, useConnectedDocxNotifications, useConnectedShellWorkspaces, useConnectedWorkNotifications };
754
1073
  //# sourceMappingURL=index.js.map
755
1074
  //# sourceMappingURL=index.js.map