@arbidocs/blocks 0.4.72 → 0.4.74
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 +401 -262
- package/dist/agents/index.js +7 -4
- package/dist/agents/tasks/TaskActivityTimeline.d.ts +1 -1
- package/dist/agents/tasks/WorkflowThreadStrip.d.ts +58 -0
- package/dist/agents/tasks/index.d.ts +1 -0
- package/dist/agents/workflows/WorkflowRunner.d.ts +86 -0
- package/dist/agents/workflows/WorkflowStepBar.d.ts +23 -0
- package/dist/agents/workflows/index.d.ts +7 -1
- package/dist/agents/workflows/planSteps.d.ts +28 -0
- package/dist/agents/workflows/run.d.ts +98 -0
- package/dist/agents/workflows/skillMarkdown.d.ts +15 -0
- package/dist/agents/workflows/types.d.ts +111 -0
- package/dist/agents/workflows/useWorkflowPreview.d.ts +14 -0
- package/dist/agents/workflows/useWorkflowView.d.ts +54 -0
- package/dist/agents/workflows/workflow.d.ts +3 -1
- package/dist/chat/index.cjs +124 -124
- package/dist/chat/index.js +3 -3
- package/dist/{chunk-DH7C2UJO.cjs → chunk-5LP54CWR.cjs} +299 -526
- package/dist/chunk-5LP54CWR.cjs.map +1 -0
- package/dist/{chunk-3SFFTSOI.cjs → chunk-7CVF3DK2.cjs} +5 -5
- package/dist/{chunk-3SFFTSOI.cjs.map → chunk-7CVF3DK2.cjs.map} +1 -1
- package/dist/chunk-7D737FLE.cjs +43 -0
- package/dist/chunk-7D737FLE.cjs.map +1 -0
- package/dist/{chunk-V3L5DONY.cjs → chunk-B4SRYJLM.cjs} +31 -2
- package/dist/chunk-B4SRYJLM.cjs.map +1 -0
- package/dist/{chunk-LFGJAZ5H.js → chunk-DDF5GPIJ.js} +6 -36
- package/dist/chunk-DDF5GPIJ.js.map +1 -0
- package/dist/chunk-DETZZBG2.cjs +91 -0
- package/dist/chunk-DETZZBG2.cjs.map +1 -0
- package/dist/chunk-EVUEIBNU.js +89 -0
- package/dist/chunk-EVUEIBNU.js.map +1 -0
- package/dist/{chunk-G5QTGKDJ.cjs → chunk-HITAN7JF.cjs} +8 -8
- package/dist/{chunk-G5QTGKDJ.cjs.map → chunk-HITAN7JF.cjs.map} +1 -1
- package/dist/{chunk-3VQYJBOI.js → chunk-HOXKR26S.js} +31 -4
- package/dist/chunk-HOXKR26S.js.map +1 -0
- package/dist/{chunk-KJ3QEKOJ.cjs → chunk-IPGKTUF7.cjs} +7 -33
- package/dist/chunk-IPGKTUF7.cjs.map +1 -0
- package/dist/{chunk-IMC2Z32C.js → chunk-KOSGX3UK.js} +269 -485
- package/dist/chunk-KOSGX3UK.js.map +1 -0
- package/dist/{chunk-KOXUBCLL.js → chunk-MK6NJQGF.js} +4 -4
- package/dist/{chunk-KOXUBCLL.js.map → chunk-MK6NJQGF.js.map} +1 -1
- package/dist/{chunk-THO7DZNN.cjs → chunk-MUMH3Z6K.cjs} +20 -15
- package/dist/chunk-MUMH3Z6K.cjs.map +1 -0
- package/dist/{chunk-5HOAOKZL.js → chunk-OYMWV45N.js} +21 -16
- package/dist/chunk-OYMWV45N.js.map +1 -0
- package/dist/chunk-P2RBE3FD.cjs +1448 -0
- package/dist/chunk-P2RBE3FD.cjs.map +1 -0
- package/dist/{chunk-G5DP27DU.js → chunk-UIWLDSTF.js} +3 -29
- package/dist/chunk-UIWLDSTF.js.map +1 -0
- package/dist/{chunk-VRPRAU3J.js → chunk-WJEKRSPH.js} +3 -3
- package/dist/{chunk-VRPRAU3J.js.map → chunk-WJEKRSPH.js.map} +1 -1
- package/dist/chunk-XD2M6LIG.js +41 -0
- package/dist/chunk-XD2M6LIG.js.map +1 -0
- package/dist/chunk-YWYVIQ7T.js +1402 -0
- package/dist/chunk-YWYVIQ7T.js.map +1 -0
- package/dist/{chunk-WBDK4PIA.cjs → chunk-Z5VUZ6YD.cjs} +6 -37
- package/dist/chunk-Z5VUZ6YD.cjs.map +1 -0
- package/dist/connect/docx.cjs +2 -2
- package/dist/connect/docx.js +1 -1
- package/dist/connect/index.cjs +379 -27
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.d.ts +1 -0
- package/dist/connect/index.js +362 -11
- package/dist/connect/index.js.map +1 -1
- package/dist/connection/ConnectedWorkflowBuilder.d.ts +44 -0
- package/dist/connection/ConnectedWorkflowRunner.d.ts +31 -0
- package/dist/connection/useWorkflowThread.d.ts +38 -0
- package/dist/facts/index.cjs +1 -1
- package/dist/facts/index.js +1 -1
- package/dist/files/index.cjs +9 -83
- package/dist/files/index.cjs.map +1 -1
- package/dist/files/index.js +6 -83
- package/dist/files/index.js.map +1 -1
- package/dist/home/index.cjs +22 -21
- package/dist/home/index.cjs.map +1 -1
- package/dist/home/index.js +4 -3
- package/dist/home/index.js.map +1 -1
- package/dist/index.cjs +579 -440
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -8
- package/dist/index.js.map +1 -1
- package/dist/shell/index.cjs +1 -1
- package/dist/shell/index.js +1 -1
- package/dist/studio/index.cjs +7 -7
- package/dist/studio/index.js +5 -5
- package/dist/workflow-canvas/StepInspector.d.ts +57 -0
- package/dist/workflow-canvas/TriggerInspector.d.ts +46 -0
- package/dist/workflow-canvas/WorkflowBuilder.d.ts +55 -0
- package/dist/workflow-canvas/WorkflowCanvas.d.ts +69 -0
- package/dist/workflow-canvas/edit.d.ts +54 -0
- package/dist/workflow-canvas/index.cjs +1719 -0
- package/dist/workflow-canvas/index.cjs.map +1 -0
- package/dist/workflow-canvas/index.d.ts +13 -0
- package/dist/workflow-canvas/index.js +1689 -0
- package/dist/workflow-canvas/index.js.map +1 -0
- package/dist/workflow-canvas/trigger.d.ts +51 -0
- package/dist/workflow-canvas/viewport.d.ts +47 -0
- package/package.json +25 -14
- package/src/workflow-canvas/canvas.css +113 -0
- package/dist/chunk-3VQYJBOI.js.map +0 -1
- package/dist/chunk-5HOAOKZL.js.map +0 -1
- package/dist/chunk-DH7C2UJO.cjs.map +0 -1
- package/dist/chunk-G5DP27DU.js.map +0 -1
- package/dist/chunk-IMC2Z32C.js.map +0 -1
- package/dist/chunk-KJ3QEKOJ.cjs.map +0 -1
- package/dist/chunk-LFGJAZ5H.js.map +0 -1
- package/dist/chunk-THO7DZNN.cjs.map +0 -1
- package/dist/chunk-V3L5DONY.cjs.map +0 -1
- package/dist/chunk-WBDK4PIA.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/connection/ArbiAppProvider.tsx","../../src/connection/ConnectedTaskAccessRequest.tsx","../../src/connection/ConnectedSkillUpload.tsx","../../src/connection/StreamedArtifact.tsx","../../src/connection/useConnectedShellWorkspaces.ts","../../src/connection/ConnectedSettings.tsx","../../src/connection/useConnectedDocxNotifications.ts","../../src/connection/useConnectedWorkNotifications.ts","../../src/connection/ConnectedAgentChatPanel.tsx"],"names":["jsx","useState","jsxs","Button","notify","useWorkspaces","useEffect","useNotify"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAqBA,SAAS,wBAAA,CAAyB,EAAE,QAAA,EAAS,EAA4B;AACvE,EAAA,MAAM,EAAE,MAAA,EAAO,GAAI,aAAA,EAAc;AACjC,EAAA,uBACE,GAAA,CAAC,qBAAA,EAAA,EAAsB,OAAA,EAAS,MAAA,KAAW,iBAAkB,QAAA,EAAS,CAAA;AAE1E;AAEO,SAAS,eAAA,CAAgB;AAAA,EAC9B,MAAA;AAAA,EACA;AACF,CAAA,EAGG;AACD,EAAA,MAAM,CAAC,WAAW,CAAA,GAAI,QAAA;AAAA,IACpB,MACE,IAAI,WAAA,CAAY;AAAA,MACd,cAAA,EAAgB,EAAE,OAAA,EAAS,EAAE,SAAA,EAAW,KAAQ,KAAA,EAAO,CAAA,EAAG,oBAAA,EAAsB,KAAA,EAAM;AAAE,KACzF;AAAA,GACL;AAEA,EAAA,MAAM,WAAA,GAAc,MAAA,CAAO,MAAA,IAAU,MAAA,CAAO,UAAA,IAAc,yBAAA;AAE1D,EAAA,2BACG,mBAAA,EAAA,EAAoB,MAAA,EAAQ,a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AA,KAAA,CAAM,YAAY,kBAAA,GAAgB;AAAA;AAAA,SACrC;AAAA,QAED,OAAA,CAAQ,IAAA,EAAM,MAAA,oBACbH,GAAAA;AAAA,UAACG,MAAAA;AAAA,UAAA;AAAA,YACC,IAAA,EAAK,QAAA;AAAA,YACL,OAAA,EAAQ,SAAA;AAAA,YACR,QAAA,EAAU,IAAA;AAAA,YACV,OAAA,EAAS,MAAM,KAAA,CAAM,MAAA,CAAO,OAAO,CAAA;AAAA,YACnC,aAAA,EAAY,mBAAA;AAAA,YAEX,QAAA,EAAA,KAAA,CAAM,YAAY,mBAAA,GAAiB;AAAA;AAAA;AACtC,OAAA,EAEJ;AAAA,KAAA,EACF,CAAA;AAAA,IACC,KAAA,oBACCH,GAAAA,CAAC,GAAA,EAAA,EAAE,MAAK,OAAA,EAAQ,SAAA,EAAU,0BAAA,EACvB,QAAA,EAAA,KAAA,CAAM,OAAA,EACT,CAAA;AAAA,IAED,KAAA,oBACCA,GAAAA,CAAC,UAAA,EAAA,EAA6C,OAAA,EAAkB,eAA/C,CAAA,EAAG,OAAO,CAAA,CAAA,EAAI,WAAW,CAAA,CAAgD;AAAA,GAAA,EAE9F,CAAA;AAEJ","file":"index.js","sourcesContent":["/**\n * Composition root for a host app on the ARBI React SDK.\n *\n * QueryClientProvider → react-query cache shared with the SDK\n * ArbiProvider → the SDK's Arbi instance (no network until login)\n * ConnectionProvider → demo/live auth + workspace layer\n *\n * With no live `apiUrl`, ArbiProvider is still mounted (cheap, inert) against\n * `demoApiUrl` and the app runs entirely in seeded demo mode.\n */\nimport { useState, type ReactNode } from 'react'\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query'\nimport { ArbiProvider, ArbiWebSocketProvider } from '@arbidocs/react'\nimport { ConnectionProvider, useConnection } from './ConnectionProvider'\nimport type { ArbiConnectionConfig } from './types'\n\n/**\n * Opens the shared SDK WebSocket once the app is live-authenticated (demo /\n * logged-out sessions have no backend, so they stay disconnected). Lives inside\n * ConnectionProvider so it can read the live status.\n */\nfunction ConnectionBoundWebSocket({ children }: { children: ReactNode }) {\n const { status } = useConnection()\n return (\n <ArbiWebSocketProvider enabled={status === 'authenticated'}>{children}</ArbiWebSocketProvider>\n )\n}\n\nexport function ArbiAppProvider({\n config,\n children,\n}: {\n config: ArbiConnectionConfig\n children: ReactNode\n}) {\n const [queryClient] = useState(\n () =>\n new QueryClient({\n defaultOptions: { queries: { staleTime: 30_000, retry: 1, refetchOnWindowFocus: false } },\n })\n )\n\n const providerUrl = config.apiUrl || config.demoApiUrl || 'https://demo.arbi.local'\n\n return (\n <QueryClientProvider client={queryClient}>\n <ArbiProvider url={providerUrl} deploymentDomain={config.deploymentDomain}>\n <ConnectionProvider config={config}>\n <ConnectionBoundWebSocket>{children}</ConnectionBoundWebSocket>\n </ConnectionProvider>\n </ArbiProvider>\n </QueryClientProvider>\n )\n}\n","import { useConversations, useRunConversation } from '@arbidocs/react'\nimport { Button } from '@arbidocs/react/ui'\nimport { useConnection } from './ConnectionProvider'\n\n/** Approval for a parked agent run, scoped to the currently selected task. */\nexport function ConnectedTaskAccessRequest({ conversationId }: { conversationId?: string }) {\n const { workspaceId } = useConnection()\n const tasks = useConversations(workspaceId ?? undefined, { live: true })\n const run = useRunConversation()\n const task = tasks.data?.find((item) => item.external_id === conversationId)\n if (!task?.pending_auth_request_id || !task.is_owner) return null\n return (\n <section\n className=\"flex flex-wrap items-center gap-3 rounded-lg border bg-card p-3\"\n data-testid=\"task-chat-access-request\"\n >\n <p className=\"flex-1 text-sm\">This task is waiting for temporary workspace access.</p>\n <Button\n disabled={run.isPending}\n onClick={() => run.mutate(task.external_id)}\n data-testid=\"task-chat-allow-access\"\n >\n {run.isPending ? 'Allowing access…' : 'Allow access and run'}\n </Button>\n {run.error && (\n <p role=\"alert\" className=\"w-full text-sm text-destructive\">\n {run.error.message}\n </p>\n )}\n </section>\n )\n}\n","import { useState } from 'react'\nimport { useUploadSkillFiles } from '@arbidocs/react'\nimport { Button, Input, Label } from '@arbidocs/react/ui'\n\n/** Import a main skill file; uploaded skills appear in the shared skill launcher. */\nexport function ConnectedSkillUpload() {\n const [name, setName] = useState('')\n const [file, setFile] = useState<File | null>(null)\n const upload = useUploadSkillFiles()\n const slug = name\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9_-]+/g, '-')\n .replace(/^-+|-+$/g, '')\n return (\n <section className=\"space-y-3 rounded-lg border p-4\" data-testid=\"skill-upload\">\n <h2 className=\"text-sm font-semibold\">Add a skill</h2>\n <p className=\"text-xs text-muted-foreground\">\n Upload a SKILL.md file containing the instructions your assistant should follow.\n </p>\n <Label htmlFor=\"skill-upload-name\">Skill name</Label>\n <Input\n id=\"skill-upload-name\"\n value={name}\n onChange={(event) => setName(event.target.value)}\n placeholder=\"disclosure-review\"\n data-testid=\"skill-upload-name\"\n />\n <Input\n type=\"file\"\n accept=\".md\"\n aria-label=\"Skill instructions file\"\n onChange={(event) => setFile(event.target.files?.[0] ?? null)}\n data-testid=\"skill-upload-file\"\n />\n <Button\n disabled={!slug || !file || upload.isPending}\n onClick={() =>\n file && upload.mutate([{ folder: `skills/${slug}`, fileName: 'SKILL.md', content: file }])\n }\n data-testid=\"skill-upload-submit\"\n >\n {upload.isPending ? 'Uploading…' : 'Upload skill'}\n </Button>\n {upload.isSuccess && (\n <p role=\"status\" className=\"text-sm\">\n Uploaded. The skill will appear once processing finishes.\n </p>\n )}\n {upload.error && (\n <p role=\"alert\" className=\"text-sm text-destructive\">\n {upload.error.message}\n </p>\n )}\n </section>\n )\n}\n","import { lazy, Suspense } from 'react'\nimport { ArtifactCanvas } from '@arbidocs/react'\nimport { useStreamedArtifact, type UseStreamedArtifactOptions } from '@arbidocs/react/artifacts'\nimport {\n StreamedArtifactFrame,\n type StreamedArtifactFrameLabels,\n type StreamedArtifactFrameTestIds,\n} from '../artifacts/StreamedArtifactFrame'\nimport type { ArtifactEvent } from './ai'\nimport type { StreamedArtifactEditorProps } from './StreamedArtifactEditor'\n\n// The editor (MDXEditor, Lexical) stays out of the bundle until a draft is ready to edit.\nconst StreamedArtifactEditor = lazy(() => import('./StreamedArtifactEditor'))\n\nexport interface StreamedArtifactProps\n extends\n Pick<UseStreamedArtifactOptions, 'configId' | 'parseRetry' | 'clean'>,\n Pick<\n StreamedArtifactEditorProps,\n 'editorProps' | 'onSaved' | 'onSaveError' | 'actions' | 'hideDefaultActions'\n > {\n /** The artifacts of the agent run (`useConnectedAiTask().artifacts`). */\n artifacts: ArtifactEvent[]\n workspaceId: string | undefined\n /** The agent is still working: show the live canvas. */\n busy: boolean\n /** The run failed; with no draft the canvas shows it. */\n error?: string | null\n stepCount?: number\n busyHint?: string\n emptyHint?: string\n className?: string\n /** Root test id of the editor; the preparing state is `${testId}-preparing`. */\n testId?: string\n labels?: Partial<StreamedArtifactFrameLabels>\n testIds?: Partial<StreamedArtifactFrameTestIds>\n}\n\n/**\n * An agent-drafted artifact from stream to editor, in one part. Pass the run's `artifacts` and\n * whether it is `busy`; it shows\n *\n * 1. the live `ArtifactCanvas` while the agent streams;\n * 2. \"Preparing editor...\" (the canvas stays readable underneath) while the finished draft is\n * cleaned (`cleanDraftMarkdown`), stored as version 1 of the artifact (`wpType: 'artifact'`)\n * and parsed by the backend, which can take up to about a minute;\n * 3. `ArtifactEditor` on the stored version (edit, save a new version, version list, compare\n * with track changes) when its text is ready;\n * 4. an error with Retry when storing or parsing fails.\n *\n * Needs `<ArbiProvider>` + React Query. The host imports the editor stylesheet\n * (`@mdxeditor/editor/style.css`) and defines the global `Prism` in a module it imports at app\n * start (see the Artifacts section of docs/design/blocks-package.md).\n *\n * ```tsx\n * const task = useConnectedAiTask()\n * <StreamedArtifact artifacts={task.artifacts} workspaceId={workspaceId} busy={task.status === 'running'} error={task.error} />\n * ```\n */\nexport function StreamedArtifact({\n artifacts,\n workspaceId,\n busy,\n error = null,\n stepCount,\n busyHint,\n emptyHint,\n className,\n testId = 'streamed-artifact',\n configId,\n parseRetry,\n clean,\n editorProps,\n onSaved,\n onSaveError,\n actions,\n hideDefaultActions,\n labels,\n testIds,\n}: StreamedArtifactProps) {\n const streamed = useStreamedArtifact({\n artifacts,\n workspaceId,\n settled: !busy && !error,\n configId,\n parseRetry,\n clean,\n })\n const canvas = (\n <ArtifactCanvas\n artifacts={artifacts}\n className={streamed.phase === 'streaming' ? className : undefined}\n busy={busy}\n busyHint={busyHint}\n stepCount={stepCount}\n error={error}\n emptyHint={emptyHint}\n />\n )\n return (\n <StreamedArtifactFrame\n phase={streamed.phase}\n canvas={canvas}\n className={className}\n error={streamed.error?.message}\n onRetry={streamed.retry}\n labels={labels}\n testIds={{ preparing: `${testId}-preparing`, error: `${testId}-error`, ...testIds }}\n >\n <Suspense fallback={canvas}>\n {streamed.docId && (\n <StreamedArtifactEditor\n key={streamed.docId}\n workspaceId={workspaceId}\n docId={streamed.docId}\n title={streamed.artifact?.title ?? 'Draft'}\n testId={testId}\n className={className}\n editorProps={editorProps}\n onSaved={onSaved}\n onSaveError={onSaveError}\n actions={actions}\n hideDefaultActions={hideDefaultActions}\n />\n )}\n </Suspense>\n </StreamedArtifactFrame>\n )\n}\n","import {\n useShellWorkspaces,\n useWorkspaces,\n type ShellWorkspaceSource,\n type UseShellWorkspacesOptions,\n type UseShellWorkspacesResult,\n} from '@arbidocs/react'\nimport { useConnection } from './ConnectionProvider'\n\nexport type UseConnectedShellWorkspacesOptions = Omit<\n UseShellWorkspacesOptions,\n 'workspaces' | 'isLoading' | 'loadError' | 'selectedId' | 'select'\n>\n\n/**\n * `useShellWorkspaces` wired to the connection layer: the account's live workspaces, the\n * connection's single selection as the active workspace, and `open` = `setWorkspace` (opens it on\n * the server, remembers it for the next login) then `onOpened`.\n *\n * ```tsx\n * const { active, recent, open } = useConnectedShellWorkspaces({\n * seed: { workspaces: demoWorkspaces, activeId: 'demo-1' },\n * onOpened: () => navigate('/app/documents'),\n * })\n * ```\n */\nexport function useConnectedShellWorkspaces(\n options: UseConnectedShellWorkspacesOptions = {}\n): UseShellWorkspacesResult {\n const { workspaceId, setWorkspace } = useConnection()\n const query = useWorkspaces()\n return useShellWorkspaces({\n ...options,\n workspaces: Array.isArray(query.data) ? (query.data as ShellWorkspaceSource[]) : undefined,\n isLoading: query.isLoading,\n loadError: query.error,\n selectedId: workspaceId,\n select: (workspace) => setWorkspace(workspace.id),\n })\n}\n","/**\n * The account area of a settings page, bound to the ARBI SDK: each section is a blocks part wired\n * to its `@arbidocs/react` hook, so a host drops them in a `SettingsPanel` and owns only the\n * layout (see the \"Settings page recipe\" in docs/design/blocks-package.md).\n *\n * Every section takes an optional `notify` for toasts and renders the default test ids of its\n * part. Anything the hooks cannot know (the recovery-key download, the billing link of a blocked\n * deletion, the password policy) is a prop.\n */\nimport { useMemo, useState, type ReactNode } from 'react'\nimport { KeyRound, Radio, UserCircle } from 'lucide-react'\nimport {\n ImageCropModal,\n useAvatarCrop,\n useConfirmEmailChange,\n useCurrentSessionId,\n useDeleteAccount,\n useDeleteAccountFlow,\n useEmailChange,\n useIdentityVerification,\n useLogoutAllSessions,\n useNameEditor,\n useNotificationPreferences,\n usePasswordChange,\n usePasswordChangeForm,\n useProfile,\n useRequestEmailChange,\n useSessions,\n useTerminateSession,\n useUpdateProfile,\n useWorkspaces,\n type AvatarFileProblem,\n type PasswordChangeResult,\n} from '@arbidocs/react'\nimport { Button } from '@arbidocs/react/ui'\nimport { initials } from '../lib/format'\nimport { AvatarPicker } from '../settings/AvatarPicker'\nimport { ProfileCard } from '../settings/ProfileCard'\nimport {\n IdentityVerificationCard,\n IdentityVerificationDialog,\n RequireVerified,\n type IdentityVerificationLabels,\n} from '../settings/IdentityVerification'\nimport {\n SettingsActionRow,\n SettingsCard,\n SettingsDangerZone,\n SettingsRow,\n SettingsSection,\n} from '../settings/SettingsPanel'\nimport { PasswordChangeDialog } from '../settings/PasswordChangeDialog'\nimport { ActiveSessionsDialog, DeleteAccountDialog } from '../settings/AccountDialogs'\nimport { LogoutDialog } from '../settings/LogoutDialog'\nimport { NotificationCategoryList } from '../settings/NotificationCategoryList'\nimport {\n EMAIL_NOTIFICATION_CATEGORIES,\n EMAIL_NOTIFICATION_KEYS,\n toActiveSessionViews,\n toDeleteBlockerViews,\n toLogoutSessionViews,\n toNotificationCategories,\n type EmailNotificationCategoryDef,\n} from '../settings/account-views'\nimport { useConnection } from './ConnectionProvider'\n\nexport type SettingsNotify = (message: string, kind: 'success' | 'error') => void\n\n/** The error text of a failed call: the backend `detail` when it sent one. */\nfunction errorText(error: unknown, fallback: string): string {\n const body = (error as { apiError?: { detail?: unknown } } | null)?.apiError\n return typeof body?.detail === 'string' ? body.detail : fallback\n}\n\nconst AVATAR_PROBLEMS: Record<AvatarFileProblem, string> = {\n 'not-image': 'Please choose an image file',\n 'too-large': 'Image must be 5 MB or smaller',\n unreadable: \"Couldn't read that image — try a different file\",\n}\n\n// ── Profile ─────────────────────────────────────────────────────────────────\n\nexport interface ConnectedProfileCardProps {\n notify?: SettingsNotify\n /** Section heading; default `Profile`. */\n title?: ReactNode\n}\n\n/** Avatar, editable name and email change of the signed-in user (`ProfileCard`). */\nexport function ConnectedProfileCard({ notify, title = 'Profile' }: ConnectedProfileCardProps) {\n const { data: profile } = useProfile()\n const updateProfile = useUpdateProfile()\n const requestEmailChange = useRequestEmailChange()\n const confirmEmailChange = useConfirmEmailChange()\n const { user } = useConnection()\n\n const name = useNameEditor({\n givenName: profile?.givenName,\n familyName: profile?.familyName,\n save: async (next) => {\n try {\n await updateProfile.mutateAsync(next)\n notify?.('Name updated', 'success')\n } catch (e) {\n notify?.('Failed to update name', 'error')\n throw e\n }\n },\n })\n const avatar = useAvatarCrop({\n upload: async (picture) => {\n try {\n await updateProfile.mutateAsync({ picture })\n notify?.('Profile picture updated', 'success')\n } catch (e) {\n notify?.('Failed to update picture', 'error')\n throw e\n }\n },\n onProblem: (problem) => notify?.(AVATAR_PROBLEMS[problem], 'error'),\n })\n const email = useEmailChange({\n requestCode: async (address) => {\n try {\n await requestEmailChange.mutateAsync(address)\n notify?.('Verification code sent to your new email', 'success')\n } catch (e) {\n notify?.(errorText(e, 'Failed to send verification code'), 'error')\n throw e\n }\n },\n confirm: async (args) => {\n try {\n await confirmEmailChange.mutateAsync(args)\n notify?.('Email address updated', 'success')\n } catch (e) {\n notify?.(errorText(e, 'Invalid or expired verification code'), 'error')\n throw e\n }\n },\n })\n\n const display = profile?.fullName || user?.name || 'Unnamed'\n return (\n <SettingsSection icon={<UserCircle />} title={title}>\n <ProfileCard\n avatar={\n <>\n <AvatarPicker\n pictureUrl={profile?.picture ?? user?.picture}\n initials={initials(display)}\n fallbackClassName=\"bg-primary text-primary-foreground\"\n isUploading={avatar.isUploading}\n onFileChosen={avatar.onFileChosen}\n />\n <ImageCropModal\n open={avatar.pendingImage !== null}\n image={avatar.pendingImage}\n title=\"Crop your photo\"\n aspect={1}\n cropShape=\"round\"\n output={{ maxSize: 128, mimeType: 'image/jpeg', quality: 0.85 }}\n onComplete={avatar.onCropComplete}\n onCancel={avatar.onCropCancel}\n />\n </>\n }\n name={{ ...name, display, isSaving: name.isSaving }}\n email={profile?.email ?? user?.email ?? ''}\n isSso={profile?.isSso ?? false}\n isVerified={profile?.isIdentityVerified ?? false}\n onStartEmailChange={email.onStart}\n emailChange={email.isOpen ? email : undefined}\n />\n </SettingsSection>\n )\n}\n\n// ── Identity verification ───────────────────────────────────────────────────\n\nexport interface ConnectedIdentityVerificationProps {\n notify?: SettingsNotify\n labels?: Partial<IdentityVerificationLabels>\n}\n\n/** The ID check card and its dialog, bound to the SDK. Renders nothing when not offered. */\nexport function ConnectedIdentityVerification({\n notify,\n labels,\n}: ConnectedIdentityVerificationProps) {\n const { data: profile } = useProfile()\n const flow = useIdentityVerification({\n onVerifiedChange: (verified) =>\n notify?.(verified ? 'Identity verified' : 'Verified tick removed', 'success'),\n onNameAccepted: () => notify?.('Name updated to match your ID', 'success'),\n })\n return (\n <>\n <IdentityVerificationCard flow={flow} labels={labels} />\n <IdentityVerificationDialog\n flow={flow}\n accountName={profile?.fullName ?? ''}\n labels={labels}\n />\n </>\n )\n}\n\nexport interface ConnectedRequireVerifiedProps {\n children?: ReactNode\n labels?: Partial<IdentityVerificationLabels>\n}\n\n/** `RequireVerified` bound to the SDK: gates `children` when the deployment requires an ID check. */\nexport function ConnectedRequireVerified({ children, labels }: ConnectedRequireVerifiedProps) {\n const { data: profile } = useProfile()\n const flow = useIdentityVerification()\n return (\n <RequireVerified flow={flow} accountName={profile?.fullName ?? ''} labels={labels}>\n {children}\n </RequireVerified>\n )\n}\n\n// ── Security: password ──────────────────────────────────────────────────────\n\n/** The default password policy: 8 characters, an uppercase letter or symbol, a digit. */\nexport function defaultUnmetPasswordRequirement(password: string): string | null {\n if (password.length < 8) return 'Minimum 8 characters'\n if (!/[A-Z!@#$%^&*()_+\\-=[\\]{};':\"\\\\|,.<>/?]/.test(password)) {\n return 'At least one uppercase letter or special character'\n }\n if (!/[0-9]/.test(password)) return 'At least one number'\n return null\n}\n\nexport interface ConnectedSecuritySectionProps {\n notify?: SettingsNotify\n /** The host's password policy; default is {@link defaultUnmetPasswordRequirement}. */\n getUnmetRequirement?: (password: string) => string | null\n /** The recovery-key download for the key the new password produced (shown on success). */\n renderRecoveryKey?: (result: PasswordChangeResult) => ReactNode\n /** Extra rows under \"Change password\" (e.g. \"Save recovery key\"). */\n children?: ReactNode\n}\n\n/** The Security card: \"Change password\" and the dialog behind it (`PasswordChangeDialog`). */\nexport function ConnectedSecuritySection({\n notify,\n getUnmetRequirement = defaultUnmetPasswordRequirement,\n renderRecoveryKey,\n children,\n}: ConnectedSecuritySectionProps) {\n const [open, setOpen] = useState(false)\n const change = usePasswordChange()\n // Only workspaces the user belongs to are re-keyed.\n const { data: workspaces } = useWorkspaces({ enabled: open })\n const workspaceCount = (workspaces ?? []).filter((w) => w.is_member).length\n const form = usePasswordChangeForm<PasswordChangeResult>({\n getUnmetRequirement,\n submit: async (vars) => {\n const result = await change.mutateAsync(vars)\n notify?.('Password changed successfully', 'success')\n return result\n },\n onClose: () => setOpen(false),\n })\n\n return (\n <SettingsSection icon={<KeyRound />} title=\"Security\">\n <SettingsCard padding=\"sm\">\n <SettingsActionRow\n title=\"Change password\"\n description=\"Used to sign in and to encrypt your data. Changing it re-encrypts everything in your account.\"\n onClick={() => setOpen(true)}\n testId=\"change-password-button\"\n />\n {children}\n </SettingsCard>\n <PasswordChangeDialog\n open={open}\n onClose={form.onCancel}\n recoveryMode={false}\n currentPassword={form.currentPassword}\n onCurrentPasswordChange={form.onCurrentPasswordChange}\n newPassword={form.newPassword}\n onNewPasswordChange={form.onNewPasswordChange}\n confirmPassword={form.confirmPassword}\n onConfirmPasswordChange={form.onConfirmPasswordChange}\n getUnmetRequirement={getUnmetRequirement}\n workspaceCount={workspaceCount}\n error={form.error}\n isProcessing={form.isProcessing}\n isSubmitDisabled={form.isSubmitDisabled}\n onSubmit={form.onSubmit}\n success={form.result ? (renderRecoveryKey?.(form.result) ?? <></>) : null}\n onDone={form.onDone}\n />\n </SettingsSection>\n )\n}\n\n// ── Notifications ───────────────────────────────────────────────────────────\n\nexport interface ConnectedNotificationPreferencesProps {\n /** Categories to offer; default {@link EMAIL_NOTIFICATION_CATEGORIES}. */\n categories?: readonly EmailNotificationCategoryDef[]\n title?: ReactNode\n}\n\n/** The email-notification switches (`NotificationCategoryList`) over the user settings. */\nexport function ConnectedNotificationPreferences({\n categories = EMAIL_NOTIFICATION_CATEGORIES,\n title = 'Notifications',\n}: ConnectedNotificationPreferencesProps) {\n const keys = useMemo(\n () =>\n categories === EMAIL_NOTIFICATION_CATEGORIES\n ? EMAIL_NOTIFICATION_KEYS\n : categories.map((c) => c.key),\n [categories]\n )\n const prefs = useNotificationPreferences(keys)\n return (\n <SettingsSection title={title}>\n <SettingsCard className=\"space-y-0\">\n <NotificationCategoryList\n masterId=\"emailNotifications\"\n masterTitle=\"Email Notifications\"\n masterDescription=\"Email me about activity when I’m away\"\n masterChecked={prefs.masterChecked}\n onMasterChange={prefs.setAll}\n categories={toNotificationCategories(prefs.checked, categories)}\n onCategoryChange={prefs.setCategory}\n />\n </SettingsCard>\n </SettingsSection>\n )\n}\n\n// ── Sessions ────────────────────────────────────────────────────────────────\n\nexport interface ConnectedSessionsRowProps {\n notify?: SettingsNotify\n /** Ask before ending a session; resolve `false` to cancel. Default: end at once. */\n confirm?: (message: string) => Promise<boolean> | boolean\n /** Glyph per session status. */\n renderSessionIcon?: (status: string) => ReactNode\n}\n\n/** \"Active sessions\" row with the manage dialog (`ActiveSessionsDialog`); end any but this device. */\nexport function ConnectedSessionsRow({\n notify,\n confirm,\n renderSessionIcon,\n}: ConnectedSessionsRowProps) {\n const [open, setOpen] = useState(false)\n const sessions = useSessions({ enabled: open })\n const currentSessionId = useCurrentSessionId()\n const terminate = useTerminateSession()\n const views = toActiveSessionViews(sessions.data ?? [], {\n currentSessionId,\n terminatingId: terminate.isPending ? terminate.variables : null,\n renderIcon: renderSessionIcon,\n })\n return (\n <>\n <SettingsRow\n label=\"Active sessions\"\n description=\"Devices and agents currently signed in to your account.\"\n >\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={() => setOpen(true)}\n className=\"flex items-center gap-2\"\n data-testid=\"active-sessions-button\"\n >\n <Radio className=\"h-4 w-4\" />\n Manage\n </Button>\n </SettingsRow>\n <ActiveSessionsDialog\n open={open}\n onOpenChange={setOpen}\n isLoading={sessions.isLoading}\n sessions={views}\n onTerminate={(id) => {\n void (async () => {\n const view = views.find((v) => v.id === id)\n const label = view?.detail.split(' · ')[0]\n const ok =\n (await confirm?.(\n `End the session on ${label}? It will be signed out immediately.`\n )) ?? true\n if (!ok) return\n try {\n await terminate.mutateAsync(id)\n } catch {\n notify?.('Failed to end session. Please try again.', 'error')\n }\n })()\n }}\n />\n </>\n )\n}\n\nexport interface ConnectedLogoutDialogProps {\n open: boolean\n onClose: () => void\n isOnline?: boolean\n renderSessionIcon?: (status: string) => ReactNode\n}\n\n/** Sign out of this device or all devices (`LogoutDialog`), listing the active sessions. */\nexport function ConnectedLogoutDialog({\n open,\n onClose,\n isOnline = true,\n renderSessionIcon,\n}: ConnectedLogoutDialogProps) {\n const { logout } = useConnection()\n const sessions = useSessions({ enabled: open })\n const logoutAll = useLogoutAllSessions()\n return (\n <LogoutDialog\n open={open}\n onClose={onClose}\n onLogoutThis={() => {\n onClose()\n logout()\n }}\n onLogoutAll={() => {\n onClose()\n // The server drops every session first; the connection then forgets this one.\n void logoutAll.mutateAsync().finally(logout)\n }}\n canLogoutAll\n isOnline={isOnline}\n sessions={toLogoutSessionViews(sessions.data ?? [])}\n renderSessionIcon={renderSessionIcon}\n />\n )\n}\n\n// ── Danger zone ─────────────────────────────────────────────────────────────\n\nexport interface ConnectedDangerZoneProps {\n notify?: SettingsNotify\n /** Link to the billing page for a deletion blocked by an active subscription. */\n renderSubscriptionLink?: () => ReactNode\n}\n\n/** \"Delete your account\": the collapsed danger zone and the two-step dialog (`DeleteAccountDialog`). */\nexport function ConnectedDangerZone({ notify, renderSubscriptionLink }: ConnectedDangerZoneProps) {\n const [zoneOpen, setZoneOpen] = useState(false)\n const [dialogOpen, setDialogOpen] = useState(false)\n const { user, logout } = useConnection()\n const remove = useDeleteAccount()\n const flow = useDeleteAccountFlow({\n userEmail: user?.email ?? '',\n remove: () => remove.mutateAsync(),\n onClose: () => setDialogOpen(false),\n onDeleted: logout,\n onError: () => notify?.('Failed to delete account. Please try again.', 'error'),\n })\n return (\n <>\n <SettingsDangerZone\n isOpen={zoneOpen}\n onToggle={() => setZoneOpen((o) => !o)}\n title=\"Delete your account\"\n description=\"Once deleted, your account will be immediately closed and you will be logged out. This action cannot be undone.\"\n action={\n <Button\n variant=\"destructive\"\n size=\"sm\"\n disabled={!user?.email}\n onClick={() => setDialogOpen(true)}\n data-testid=\"delete-account-button\"\n >\n Delete Account\n </Button>\n }\n />\n <DeleteAccountDialog\n open={dialogOpen}\n onClose={flow.onClose}\n step={flow.step}\n blockers={toDeleteBlockerViews(flow.blockers, renderSubscriptionLink)}\n onContinue={flow.onContinue}\n onBack={flow.onBack}\n userEmail={user?.email ?? ''}\n confirmEmail={flow.confirmEmail}\n onConfirmEmailChange={flow.onConfirmEmailChange}\n isDeleting={flow.isDeleting}\n onSubmit={flow.onSubmit}\n />\n </>\n )\n}\n","import { useEffect } from 'react'\nimport { useQuery, useQueryClient } from '@tanstack/react-query'\nimport { useArbi, useArbiWebSocket, notify, type AppNotification } from '@arbidocs/react'\nimport { useNotify } from '@arbidocs/react/shell'\nimport { useConnection } from './ConnectionProvider'\n\n/** Bridge persisted document mentions to the shared bell; hosts own routing. */\nexport function useConnectedDocxNotifications(\n onOpen: (target: {\n workspaceId: string\n documentId: string\n commentId: string\n }) => void | Promise<void>\n) {\n const arbi = useArbi()\n const { status, user, apiUrl } = useConnection()\n const queries = useQueryClient()\n const source = `docx-mentions:${apiUrl}:${user?.externalId || ''}`\n const queryKey = ['docx-mentions', apiUrl, user?.externalId]\n const { data = [] } = useQuery({\n queryKey,\n queryFn: () => arbi.notifications.list('docx_mention'),\n enabled: status === 'authenticated',\n refetchInterval: 30_000,\n })\n useArbiWebSocket((message) => {\n if (message.type === 'docx_mention') void queries.invalidateQueries({ queryKey })\n })\n useEffect(() => {\n const items: AppNotification[] = []\n if (status === 'authenticated')\n for (const note of data) {\n if (note.recipient.external_id !== user?.externalId || !note.workspace_ext_id) continue\n try {\n const target = JSON.parse(note.content || '{}') as {\n document_id?: string\n comment_id?: string\n }\n if (!target.document_id?.startsWith('doc-') || !target.comment_id) continue\n const documentId = target.document_id,\n commentId = target.comment_id,\n workspaceId = note.workspace_ext_id\n items.push({\n id: `docx:${note.external_id}`,\n title: 'Mentioned you in a document comment',\n description: [note.sender.given_name, note.sender.family_name]\n .filter(Boolean)\n .join(' '),\n variant: 'info',\n ts: Date.parse(note.created_at),\n read: note.read,\n source,\n onSelect: () => {\n void Promise.resolve(onOpen({ documentId, commentId, workspaceId })).catch((error) =>\n notify.error(\n error instanceof Error ? error.message : 'Could not open the document.'\n )\n )\n },\n })\n } catch {\n /* Ignore invalid legacy payloads. */\n }\n }\n useNotify.getState().syncSource(source, items)\n return () => useNotify.getState().syncSource(source, [])\n }, [data, status, user?.externalId, source, onOpen])\n const markRead = async (ids: string[]) => {\n try {\n await arbi.notifications.markRead(ids)\n await queries.invalidateQueries({ queryKey })\n } catch {\n notify.error('Could not mark document mentions read.')\n }\n }\n return {\n onMarkRead: (id: string) => {\n if (id.startsWith('docx:')) void markRead([id.slice(5)])\n },\n onMarkAllRead: () => {\n void markRead(\n data\n .filter((note) => !note.read && note.recipient.external_id === user?.externalId)\n .map((note) => note.external_id)\n )\n },\n }\n}\n","import { useEffect } from 'react'\nimport { useWorkNotifications, notify, type AppNotification } from '@arbidocs/react'\nimport { useNotify } from '@arbidocs/react/shell'\nimport type { components } from '@arbidocs/client'\nimport { useConnection } from './ConnectionProvider'\n\nexport type WorkNotificationTarget =\n | { kind: 'conversation'; workspaceId: string; conversationId: string; messageId?: string }\n | { kind: 'workflow'; workspaceId?: string; workflowId: string }\n\n/** Persisted work notifications in the shared bell; the consumer owns navigation. */\nexport function useConnectedWorkNotifications(\n onOpen: (target: WorkNotificationTarget) => void | Promise<void>\n) {\n const { status, user, apiUrl } = useConnection()\n const source = `work-notifications:${apiUrl}:${user?.externalId || ''}`\n const { data = [], markRead: persistRead } = useWorkNotifications({\n apiUrl,\n userId: user?.externalId,\n enabled: status === 'authenticated',\n })\n useEffect(() => {\n const items: AppNotification[] = []\n if (status === 'authenticated')\n for (const note of data) {\n if (note.recipient.external_id !== user?.externalId) continue\n const mapped = mapWorkNotification(note)\n if (!mapped) continue\n items.push({\n id: `work:${note.external_id}`,\n title: mapped.title,\n variant:\n note.type === 'workflow_failed'\n ? 'error'\n : note.type === 'conversation_done'\n ? 'success'\n : 'info',\n ts: Date.parse(note.created_at),\n read: note.read,\n source,\n onSelect: () => {\n void Promise.resolve()\n .then(() => onOpen(mapped.target))\n .catch((error) =>\n notify.error(\n error instanceof Error ? error.message : 'Could not open this notification.'\n )\n )\n },\n })\n }\n useNotify.getState().syncSource(source, items)\n return () => useNotify.getState().syncSource(source, [])\n }, [data, status, user?.externalId, source, onOpen])\n const markRead = async (ids: string[]) => {\n if (!ids.length) return\n try {\n await persistRead(ids)\n } catch {\n notify.error('Could not mark work notifications read.')\n }\n }\n return {\n onMarkRead: (id: string) => {\n // Only received, currently loaded work rows belong to this source.\n if (\n data.some(\n (note) =>\n `work:${note.external_id}` === id &&\n note.recipient.external_id === user?.externalId &&\n mapWorkNotification(note)\n )\n )\n void markRead([id.slice(5)])\n },\n onMarkAllRead: () => {\n void markRead(\n data\n .filter(\n (note) =>\n !note.read &&\n note.recipient.external_id === user?.externalId &&\n mapWorkNotification(note)\n )\n .map((note) => note.external_id)\n )\n },\n }\n}\n\n/** Route from explicit IDs; encrypted task text is never needed for a link. */\nexport function mapWorkNotification(note: components['schemas']['NotificationResponse']): {\n title: string\n target: WorkNotificationTarget\n} | null {\n const sender =\n [note.sender.given_name, note.sender.family_name].filter(Boolean).join(' ') || note.sender.email\n if (note.type === 'workflow_failed') {\n try {\n const payload = JSON.parse(note.content || '{}') as { workflow_ext_id?: string }\n if (!payload.workflow_ext_id?.match(/^wfl-[a-zA-Z0-9]+$/)) return null\n if (\n note.workspace_ext_id?.match(/^wrk-[a-zA-Z0-9]+$/) &&\n note.conversation_ext_id?.match(/^con-[a-zA-Z0-9]+$/)\n ) {\n return {\n title: 'A workflow failed to run',\n target: {\n kind: 'conversation',\n workspaceId: note.workspace_ext_id,\n conversationId: note.conversation_ext_id,\n },\n }\n }\n return {\n title: 'A workflow failed to run',\n target: {\n kind: 'workflow',\n workflowId: payload.workflow_ext_id,\n workspaceId: note.workspace_ext_id || undefined,\n },\n }\n } catch {\n return null\n }\n }\n const titles: Partial<Record<components['schemas']['NotificationType'], string>> = {\n mention: `${sender} mentioned you in a conversation`,\n workspace_access_request: `${sender} needs workspace access to run a task`,\n conversation_ready: `${sender} has a task ready`,\n conversation_done: `${sender} marked a task done`,\n }\n const title = titles[note.type]\n if (!title || !note.workspace_ext_id || !note.conversation_ext_id?.match(/^con-[a-zA-Z0-9]+$/))\n return null\n return {\n title,\n target: {\n kind: 'conversation',\n workspaceId: note.workspace_ext_id,\n conversationId: note.conversation_ext_id,\n ...(note.message_ext_id ? { messageId: note.message_ext_id } : {}),\n },\n }\n}\n","import {\n useAgentSession,\n useStartAgentSession,\n useCloseAgentSession,\n useArbiChat,\n} from '@arbidocs/react'\nimport { Button } from '@arbidocs/react/ui'\nimport { ChatPage } from '../chat/ChatPage'\n\nexport interface ConnectedAgentChatPanelProps {\n agentId: string\n workspaceId: string\n agentName?: string\n}\n\nfunction ActiveChat({ agentId, workspaceId }: ConnectedAgentChatPanelProps) {\n const chat = useArbiChat({ agentId, workspaceId })\n return (\n <ChatPage\n chat={{ ...chat, assistantMode: undefined, setAssistantMode: undefined }}\n documentsRequired={false}\n compactHeader\n surface=\"dock\"\n emptyTitle=\"What would you like me to do?\"\n emptyDescription=\"This agent works through its own login. Upload files here to stage them in its sandbox.\"\n className=\"h-[min(65vh,650px)] min-h-[380px]\"\n />\n )\n}\n\n/** An owned agent's independent login and chat, using the shared controller and chat surface. */\nexport function ConnectedAgentChatPanel({\n agentId,\n workspaceId,\n agentName = 'Agent',\n}: ConnectedAgentChatPanelProps) {\n const session = useAgentSession(agentId)\n const start = useStartAgentSession()\n const close = useCloseAgentSession()\n const ready = session.data?.active && session.data.workspace_ext_id === workspaceId\n const busy = start.isPending || close.isPending\n const error = start.error ?? close.error ?? session.error\n return (\n <section className=\"space-y-3\" data-testid=\"agent-chat-panel\">\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <p className=\"text-sm\" data-testid=\"agent-chat-session-status\">\n {agentName} ·{' '}\n {ready\n ? 'Signed in to this workspace'\n : session.data?.active\n ? `Signed in to ${session.data.workspace_name ?? 'another workspace'}`\n : 'Signed out'}\n </p>\n <div className=\"flex gap-2\">\n {!ready && (\n <Button\n type=\"button\"\n disabled={busy || session.isLoading}\n onClick={() => start.mutate({ agentId, workspaceId })}\n data-testid=\"agent-chat-login\"\n >\n {start.isPending ? 'Signing in…' : 'Sign in here'}\n </Button>\n )}\n {session.data?.active && (\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled={busy}\n onClick={() => close.mutate(agentId)}\n data-testid=\"agent-chat-logout\"\n >\n {close.isPending ? 'Signing out…' : 'Sign out agent'}\n </Button>\n )}\n </div>\n </div>\n {error && (\n <p role=\"alert\" className=\"text-sm text-destructive\">\n {error.message}\n </p>\n )}\n {ready && (\n <ActiveChat key={`${agentId}:${workspaceId}`} agentId={agentId} workspaceId={workspaceId} />\n )}\n </section>\n )\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/connection/ArbiAppProvider.tsx","../../src/connection/ConnectedTaskAccessRequest.tsx","../../src/connection/ConnectedSkillUpload.tsx","../../src/connection/StreamedArtifact.tsx","../../src/connection/useWorkflowThread.ts","../../src/connection/ConnectedWorkflowRunner.tsx","../../src/connection/useConnectedShellWorkspaces.ts","../../src/connection/ConnectedSettings.tsx","../../src/connection/useConnectedDocxNotifications.ts","../../src/connection/useConnectedWorkNotifications.ts","../../src/connection/ConnectedAgentChatPanel.tsx"],"names":["jsx","useState","jsxs","Button","useConversations","useArbi","useCallback","files","useEffect","notify","useWorkspaces","useMemo","useNotify"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,SAAS,wBAAA,CAAyB,EAAE,QAAA,EAAS,EAA4B;AACvE,EAAA,MAAM,EAAE,MAAA,EAAO,GAAI,aAAA,EAAc;AACjC,EAAA,uBACE,GAAA,CAAC,qBAAA,EAAA,EAAsB,OAAA,EAAS,MAAA,KAAW,iBAAkB,QAAA,EAAS,CAAA;AAE1E;AAEO,SAAS,eAAA,CAAgB;AAAA,EAC9B,MAAA;AAAA,EACA;AACF,CAAA,EAGG;AACD,EAAA,MAAM,CAAC,WAAW,CAAA,GAAI,QAAA;AAAA,IACpB,MACE,IAAI,WAAA,CAAY;AAAA,MACd,cAAA,EAAgB,EAAE,OAAA,EAAS,E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;AAAA;AAAA,SACrC;AAAA,QAED,OAAA,CAAQ,IAAA,EAAM,MAAA,oBACbH,GAAAA;AAAA,UAACG,MAAAA;AAAA,UAAA;AAAA,YACC,IAAA,EAAK,QAAA;AAAA,YACL,OAAA,EAAQ,SAAA;AAAA,YACR,QAAA,EAAU,IAAA;AAAA,YACV,OAAA,EAAS,MAAM,KAAA,CAAM,MAAA,CAAO,OAAO,CAAA;AAAA,YACnC,aAAA,EAAY,mBAAA;AAAA,YAEX,QAAA,EAAA,KAAA,CAAM,YAAY,mBAAA,GAAiB;AAAA;AAAA;AACtC,OAAA,EAEJ;AAAA,KAAA,EACF,CAAA;AAAA,IACC,KAAA,oBACCH,GAAAA,CAAC,GAAA,EAAA,EAAE,MAAK,OAAA,EAAQ,SAAA,EAAU,0BAAA,EACvB,QAAA,EAAA,KAAA,CAAM,OAAA,EACT,CAAA;AAAA,IAED,KAAA,oBACCA,GAAAA,CAAC,UAAA,EAAA,EAA6C,OAAA,EAAkB,eAA/C,CAAA,EAAG,OAAO,CAAA,CAAA,EAAI,WAAW,CAAA,CAAgD;AAAA,GAAA,EAE9F,CAAA;AAEJ","file":"index.js","sourcesContent":["/**\n * Composition root for a host app on the ARBI React SDK.\n *\n * QueryClientProvider → react-query cache shared with the SDK\n * ArbiProvider → the SDK's Arbi instance (no network until login)\n * ConnectionProvider → demo/live auth + workspace layer\n *\n * With no live `apiUrl`, ArbiProvider is still mounted (cheap, inert) against\n * `demoApiUrl` and the app runs entirely in seeded demo mode.\n */\nimport { useState, type ReactNode } from 'react'\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query'\nimport { ArbiProvider, ArbiWebSocketProvider } from '@arbidocs/react'\nimport { ConnectionProvider, useConnection } from './ConnectionProvider'\nimport type { ArbiConnectionConfig } from './types'\n\n/**\n * Opens the shared SDK WebSocket once the app is live-authenticated (demo /\n * logged-out sessions have no backend, so they stay disconnected). Lives inside\n * ConnectionProvider so it can read the live status.\n */\nfunction ConnectionBoundWebSocket({ children }: { children: ReactNode }) {\n const { status } = useConnection()\n return (\n <ArbiWebSocketProvider enabled={status === 'authenticated'}>{children}</ArbiWebSocketProvider>\n )\n}\n\nexport function ArbiAppProvider({\n config,\n children,\n}: {\n config: ArbiConnectionConfig\n children: ReactNode\n}) {\n const [queryClient] = useState(\n () =>\n new QueryClient({\n defaultOptions: { queries: { staleTime: 30_000, retry: 1, refetchOnWindowFocus: false } },\n })\n )\n\n const providerUrl = config.apiUrl || config.demoApiUrl || 'https://demo.arbi.local'\n\n return (\n <QueryClientProvider client={queryClient}>\n <ArbiProvider url={providerUrl} deploymentDomain={config.deploymentDomain}>\n <ConnectionProvider config={config}>\n <ConnectionBoundWebSocket>{children}</ConnectionBoundWebSocket>\n </ConnectionProvider>\n </ArbiProvider>\n </QueryClientProvider>\n )\n}\n","import { useConversations, useRunConversation } from '@arbidocs/react'\nimport { Button } from '@arbidocs/react/ui'\nimport { useConnection } from './ConnectionProvider'\n\n/** Approval for a parked agent run, scoped to the currently selected task. */\nexport function ConnectedTaskAccessRequest({ conversationId }: { conversationId?: string }) {\n const { workspaceId } = useConnection()\n const tasks = useConversations(workspaceId ?? undefined, { live: true })\n const run = useRunConversation()\n const task = tasks.data?.find((item) => item.external_id === conversationId)\n if (!task?.pending_auth_request_id || !task.is_owner) return null\n return (\n <section\n className=\"flex flex-wrap items-center gap-3 rounded-lg border bg-card p-3\"\n data-testid=\"task-chat-access-request\"\n >\n <p className=\"flex-1 text-sm\">This task is waiting for temporary workspace access.</p>\n <Button\n disabled={run.isPending}\n onClick={() => run.mutate(task.external_id)}\n data-testid=\"task-chat-allow-access\"\n >\n {run.isPending ? 'Allowing access…' : 'Allow access and run'}\n </Button>\n {run.error && (\n <p role=\"alert\" className=\"w-full text-sm text-destructive\">\n {run.error.message}\n </p>\n )}\n </section>\n )\n}\n","import { useState } from 'react'\nimport { useUploadSkillFiles } from '@arbidocs/react'\nimport { Button, Input, Label } from '@arbidocs/react/ui'\n\n/** Import a main skill file; uploaded skills appear in the shared skill launcher. */\nexport function ConnectedSkillUpload() {\n const [name, setName] = useState('')\n const [file, setFile] = useState<File | null>(null)\n const upload = useUploadSkillFiles()\n const slug = name\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9_-]+/g, '-')\n .replace(/^-+|-+$/g, '')\n return (\n <section className=\"space-y-3 rounded-lg border p-4\" data-testid=\"skill-upload\">\n <h2 className=\"text-sm font-semibold\">Add a skill</h2>\n <p className=\"text-xs text-muted-foreground\">\n Upload a SKILL.md file containing the instructions your assistant should follow.\n </p>\n <Label htmlFor=\"skill-upload-name\">Skill name</Label>\n <Input\n id=\"skill-upload-name\"\n value={name}\n onChange={(event) => setName(event.target.value)}\n placeholder=\"disclosure-review\"\n data-testid=\"skill-upload-name\"\n />\n <Input\n type=\"file\"\n accept=\".md\"\n aria-label=\"Skill instructions file\"\n onChange={(event) => setFile(event.target.files?.[0] ?? null)}\n data-testid=\"skill-upload-file\"\n />\n <Button\n disabled={!slug || !file || upload.isPending}\n onClick={() =>\n file && upload.mutate([{ folder: `skills/${slug}`, fileName: 'SKILL.md', content: file }])\n }\n data-testid=\"skill-upload-submit\"\n >\n {upload.isPending ? 'Uploading…' : 'Upload skill'}\n </Button>\n {upload.isSuccess && (\n <p role=\"status\" className=\"text-sm\">\n Uploaded. The skill will appear once processing finishes.\n </p>\n )}\n {upload.error && (\n <p role=\"alert\" className=\"text-sm text-destructive\">\n {upload.error.message}\n </p>\n )}\n </section>\n )\n}\n","import { lazy, Suspense } from 'react'\nimport { ArtifactCanvas } from '@arbidocs/react'\nimport { useStreamedArtifact, type UseStreamedArtifactOptions } from '@arbidocs/react/artifacts'\nimport {\n StreamedArtifactFrame,\n type StreamedArtifactFrameLabels,\n type StreamedArtifactFrameTestIds,\n} from '../artifacts/StreamedArtifactFrame'\nimport type { ArtifactEvent } from './ai'\nimport type { StreamedArtifactEditorProps } from './StreamedArtifactEditor'\n\n// The editor (MDXEditor, Lexical) stays out of the bundle until a draft is ready to edit.\nconst StreamedArtifactEditor = lazy(() => import('./StreamedArtifactEditor'))\n\nexport interface StreamedArtifactProps\n extends\n Pick<UseStreamedArtifactOptions, 'configId' | 'parseRetry' | 'clean'>,\n Pick<\n StreamedArtifactEditorProps,\n 'editorProps' | 'onSaved' | 'onSaveError' | 'actions' | 'hideDefaultActions'\n > {\n /** The artifacts of the agent run (`useConnectedAiTask().artifacts`). */\n artifacts: ArtifactEvent[]\n workspaceId: string | undefined\n /** The agent is still working: show the live canvas. */\n busy: boolean\n /** The run failed; with no draft the canvas shows it. */\n error?: string | null\n stepCount?: number\n busyHint?: string\n emptyHint?: string\n className?: string\n /** Root test id of the editor; the preparing state is `${testId}-preparing`. */\n testId?: string\n labels?: Partial<StreamedArtifactFrameLabels>\n testIds?: Partial<StreamedArtifactFrameTestIds>\n}\n\n/**\n * An agent-drafted artifact from stream to editor, in one part. Pass the run's `artifacts` and\n * whether it is `busy`; it shows\n *\n * 1. the live `ArtifactCanvas` while the agent streams;\n * 2. \"Preparing editor...\" (the canvas stays readable underneath) while the finished draft is\n * cleaned (`cleanDraftMarkdown`), stored as version 1 of the artifact (`wpType: 'artifact'`)\n * and parsed by the backend, which can take up to about a minute;\n * 3. `ArtifactEditor` on the stored version (edit, save a new version, version list, compare\n * with track changes) when its text is ready;\n * 4. an error with Retry when storing or parsing fails.\n *\n * Needs `<ArbiProvider>` + React Query. The host imports the editor stylesheet\n * (`@mdxeditor/editor/style.css`) and defines the global `Prism` in a module it imports at app\n * start (see the Artifacts section of docs/design/blocks-package.md).\n *\n * ```tsx\n * const task = useConnectedAiTask()\n * <StreamedArtifact artifacts={task.artifacts} workspaceId={workspaceId} busy={task.status === 'running'} error={task.error} />\n * ```\n */\nexport function StreamedArtifact({\n artifacts,\n workspaceId,\n busy,\n error = null,\n stepCount,\n busyHint,\n emptyHint,\n className,\n testId = 'streamed-artifact',\n configId,\n parseRetry,\n clean,\n editorProps,\n onSaved,\n onSaveError,\n actions,\n hideDefaultActions,\n labels,\n testIds,\n}: StreamedArtifactProps) {\n const streamed = useStreamedArtifact({\n artifacts,\n workspaceId,\n settled: !busy && !error,\n configId,\n parseRetry,\n clean,\n })\n const canvas = (\n <ArtifactCanvas\n artifacts={artifacts}\n className={streamed.phase === 'streaming' ? className : undefined}\n busy={busy}\n busyHint={busyHint}\n stepCount={stepCount}\n error={error}\n emptyHint={emptyHint}\n />\n )\n return (\n <StreamedArtifactFrame\n phase={streamed.phase}\n canvas={canvas}\n className={className}\n error={streamed.error?.message}\n onRetry={streamed.retry}\n labels={labels}\n testIds={{ preparing: `${testId}-preparing`, error: `${testId}-error`, ...testIds }}\n >\n <Suspense fallback={canvas}>\n {streamed.docId && (\n <StreamedArtifactEditor\n key={streamed.docId}\n workspaceId={workspaceId}\n docId={streamed.docId}\n title={streamed.artifact?.title ?? 'Draft'}\n testId={testId}\n className={className}\n editorProps={editorProps}\n onSaved={onSaved}\n onSaveError={onSaveError}\n actions={actions}\n hideDefaultActions={hideDefaultActions}\n />\n )}\n </Suspense>\n </StreamedArtifactFrame>\n )\n}\n","/**\n * A stepped workflow run that lives in a work thread on the server. The thread's plan carries the\n * steps; its activity log says where each step is; the work runner starts each agent step as a\n * turn in the thread. This hook reads all of that and does the person's part: it starts the thread\n * (with the run's inputs and the steps' prompts composed from them), completes forms, uploads and\n * reviews, skips, and retries a failed step. `WorkflowRunner` shows the result.\n */\n\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport {\n useActOnStep,\n useArbi,\n useConversationActivity,\n useConversationThreads,\n useConversations,\n useCreateWork,\n type ConversationResponse,\n} from '@arbidocs/react'\nimport { fromPlanSteps, toPlanSteps, type TaskPlanStep } from '../agents/workflows/planSteps'\nimport {\n initialRunInputs,\n runThreadTitle,\n stepStatesFromActivity,\n workflowSteps,\n type StepComposeOptions,\n type WorkflowActivityEvent,\n} from '../agents/workflows/run'\nimport { useWorkflowView, type WorkflowRunView } from '../agents/workflows/useWorkflowView'\nimport type {\n WorkflowDefinition,\n WorkflowInputs,\n WorkflowStep,\n WorkflowStepState,\n} from '../agents/workflows/types'\nimport { useConnection } from './ConnectionProvider'\nimport { useWorkspaceDocs } from './ai'\n\nexport interface UseWorkflowThreadOptions extends StepComposeOptions {\n /** An existing run to show (its thread). Absent: a new run starts when its first step is done. */\n conversationId?: string\n /** The thread was created (store its id to come back to the run). */\n onStarted?: (conversationId: string) => void\n /**\n * The host's commits, by step id (`commit: true` steps): done before the step is recorded, e.g.\n * create and open the matter the run belongs in (the thread is created in the open workspace).\n * May return inputs to merge into the run.\n */\n commit?: Record<string, (inputs: WorkflowInputs) => Promise<WorkflowInputs | void>>\n /** Prefills for a new run. */\n initialInputs?: WorkflowInputs\n /** The agent that runs the agent steps (`agt-…`); absent = the person's own assistant. */\n agentId?: string\n}\n\nexport interface WorkflowThread {\n view: WorkflowRunView\n /** The run's thread, once it exists. */\n conversationId: string | undefined\n conversation: ConversationResponse | undefined\n}\n\nconst STARTING = new Set(['pending', 'running'])\n\n/** The values a form step collected (what is recorded with it on the thread). */\nfunction formValues(step: WorkflowStep, inputs: WorkflowInputs): WorkflowInputs | undefined {\n if (step.kind !== 'form') return undefined\n return Object.fromEntries(step.inputs.map((f) => [f.name, inputs[f.name] ?? '']))\n}\n\n/** How many times missing answers are fetched again before giving up (about three minutes). */\nexport const ANSWER_RETRY_CAP = 16\n\n/** The wait before the `attempt`th fetch of missing answers: at once, then 1s doubling to 15s. */\nexport function answerRetryDelay(attempt: number): number {\n return attempt === 0 ? 0 : Math.min(1000 * 2 ** (attempt - 1), 15_000)\n}\n\n/**\n * Fetch again, with backoff and a cap, while `missing` (the ids of finished steps' answers not\n * read yet) is not empty. A change in what is missing starts the count again.\n */\nfunction useAnswerRetry(missing: string, refetch: () => Promise<unknown>) {\n const [attempt, setAttempt] = useState(0)\n const [prev, setPrev] = useState(missing)\n if (prev !== missing) {\n setPrev(missing)\n setAttempt(0)\n }\n const refetchRef = useRef(refetch)\n refetchRef.current = refetch\n useEffect(() => {\n if (!missing || attempt >= ANSWER_RETRY_CAP) return\n const t = setTimeout(() => {\n void refetchRef.current()\n setAttempt((a) => a + 1)\n }, answerRetryDelay(attempt))\n return () => clearTimeout(t)\n }, [missing, attempt])\n}\n\nexport function useWorkflowThread(\n workflow: WorkflowDefinition,\n options: UseWorkflowThreadOptions = {}\n): WorkflowThread {\n const arbi = useArbi()\n const { ensureWorkspaceOpen } = useConnection()\n const { wsId } = useWorkspaceDocs()\n const [threadId, setThreadId] = useState(options.conversationId)\n const [localInputs, setLocalInputs] = useState<WorkflowInputs>(() =>\n initialRunInputs(workflow, options.initialInputs)\n )\n // What the person typed: it wins over the thread's copy, which only learns a form's values when\n // that step is completed (until then it holds them blank).\n const [edits, setEdits] = useState<WorkflowInputs>({})\n const [localStates, setLocalStates] = useState<Record<string, WorkflowStepState>>({})\n const createWork = useCreateWork()\n const actOnStep = useActOnStep()\n\n const conversations = useConversations(wsId, { enabled: !!threadId, live: true })\n const conversation = conversations.data?.find((c) => c.external_id === threadId)\n const steps = useMemo(\n () =>\n workflowSteps(workflow).length > 0\n ? workflowSteps(workflow)\n : fromPlanSteps((conversation?.plan?.steps ?? []) as TaskPlanStep[]),\n [workflow, conversation?.plan?.steps]\n )\n\n // Poll while an agent step is on its way (the server starts it, then runs it).\n const activity = useConversationActivity(threadId, { live: !!threadId })\n const serverStates = useMemo(\n () => stepStatesFromActivity((activity.data ?? []) as WorkflowActivityEvent[]),\n [activity.data]\n )\n const working = steps.some(\n (s) => s.kind === 'agent' && STARTING.has(serverStates[s.id]?.status ?? 'pending')\n )\n const threads = useConversationThreads(wsId, threadId, { enabled: !!threadId, live: working })\n // Only answers with text: the assistant's message exists (empty) from the moment its turn\n // starts and is filled when the turn ends, which can be after the step is recorded done.\n const answers = useMemo(() => {\n const byId = new Map<string, string>()\n for (const t of threads.data?.threads ?? [])\n for (const m of t.history)\n if (m.role === 'assistant' && m.content?.trim()) byId.set(m.external_id, m.content)\n return byId\n }, [threads.data])\n\n // A step can finish as the run stops (the last one always does): nothing is polled then, and\n // the activity log no longer changes. Fetch the messages again, backing off, until every\n // finished step's answer is in (or the cap is reached; a new missing answer starts again).\n const missing = Object.values(serverStates)\n .flatMap((st) =>\n st.status === 'done' && st.responseId && !answers.has(st.responseId) ? [st.responseId] : []\n )\n .sort()\n .join(' ')\n useAnswerRetry(missing, threads.refetch)\n\n const states = useMemo(() => {\n if (!threadId) return localStates\n const out: Record<string, WorkflowStepState> = {}\n for (const [id, s] of Object.entries(serverStates))\n out[id] = { ...s, text: s.responseId ? answers.get(s.responseId) : undefined }\n return out\n }, [threadId, localStates, serverStates, answers])\n\n const inputs = useMemo(\n () =>\n threadId\n ? { ...localInputs, ...(conversation?.skill_inputs ?? {}), ...edits }\n : { ...localInputs, ...edits },\n [threadId, localInputs, conversation?.skill_inputs, edits]\n ) as WorkflowInputs\n\n const refresh = useCallback(async () => {\n await Promise.all([activity.refetch(), conversations.refetch()])\n }, [activity, conversations])\n\n const act = useCallback(\n async (\n id: string,\n body: { step: string; action: 'complete' | 'skip'; inputs?: WorkflowInputs }\n ) => {\n await actOnStep.mutateAsync({ conversationId: id, body })\n await refresh()\n },\n [actOnStep, refresh]\n )\n\n const complete = useCallback(\n async (step: WorkflowStep) => {\n let values = inputs\n const commit = step.commit ? options.commit?.[step.id] : undefined\n if (commit && localStates[step.id]?.status !== 'done') {\n values = { ...values, ...((await commit(values)) ?? {}) }\n setLocalInputs(values)\n setEdits({})\n }\n let id = threadId\n if (!id) {\n // The run starts: its thread, in the workspace now open, with the steps and the inputs so far.\n await ensureWorkspaceOpen()\n const created = await createWork.mutateAsync({\n title: runThreadTitle(workflow, values).slice(0, 60),\n description: workflow.description || null,\n prompt: null,\n skill_ref: null,\n skill_inputs: values as Record<string, unknown>,\n agent_ext_id: options.agentId ?? null,\n auth_mode: 'run_now_temp',\n plan: {\n goal: '',\n criteria: [],\n max_passes: 3,\n documents: [],\n steps: toPlanSteps(workflow, {\n inputs: values,\n resolveWorkflow: options.resolveWorkflow,\n compose: options.compose,\n }),\n },\n })\n id = created.external_id\n setThreadId(id)\n setLocalStates((s) => ({ ...s, [step.id]: { status: 'done' } }))\n options.onStarted?.(id)\n }\n await act(id, { step: step.id, action: 'complete', inputs: formValues(step, values) })\n },\n [inputs, options, localStates, threadId, ensureWorkspaceOpen, createWork, workflow, act]\n )\n\n const skip = useCallback(\n async (stepId: string) => {\n if (!threadId) {\n setLocalStates((s) => ({ ...s, [stepId]: { status: 'skipped' } }))\n return\n }\n await act(threadId, { step: stepId, action: 'skip' })\n },\n [threadId, act]\n )\n\n const retry = useCallback(\n async (_stepId: string) => {\n if (!threadId) return\n // Running the thread again retries its failed step.\n await arbi.conversations.runWithAuth(threadId)\n await refresh()\n },\n [arbi, threadId, refresh]\n )\n\n const view = useWorkflowView({\n steps,\n states,\n inputs,\n setInput: (name, value) => setEdits((i) => ({ ...i, [name]: value })),\n complete,\n skip,\n retry,\n isLocked: (id) => states[id]?.status === 'done',\n })\n\n return { view, conversationId: threadId, conversation }\n}\n","/**\n * A stepped workflow run in its work thread, end to end: `useWorkflowThread` keeps the run on the\n * server (the thread's plan, its activity, its turns) and `WorkflowRunner` shows it. Agent answers\n * are the thread's messages; uploads go into the open workspace; a review can notify the people\n * who should approve it, in the run's thread. The host keeps its wording, its commits\n * (`options.commit`) and its finish screen.\n */\n\nimport { useCallback, useEffect, useState } from 'react'\nimport { AiAnswer, useArbi, useDocuments, useWorkspaceUsers } from '@arbidocs/react'\nimport { Button, cn } from '@arbidocs/react/ui'\nimport { ExternalLink, Loader2 } from 'lucide-react'\nimport {\n WorkflowRunner,\n type WorkflowRunnerFile,\n type WorkflowRunnerProps,\n} from '../agents/workflows/WorkflowRunner'\nimport type {\n WorkflowAgentStep,\n WorkflowDefinition,\n WorkflowStepState,\n WorkflowUploadStep,\n} from '../agents/workflows/types'\nimport { useConnection } from './ConnectionProvider'\nimport { useWorkspaceDocs } from './ai'\nimport { useWorkflowThread, type UseWorkflowThreadOptions } from './useWorkflowThread'\n\nexport interface ConnectedWorkflowRunnerLabels {\n notify: string\n /** A finished step whose answer is still being fetched. */\n loadingAnswer: string\n notified: string\n openThread: string\n}\n\nexport const DEFAULT_CONNECTED_WORKFLOW_RUNNER_LABELS: ConnectedWorkflowRunnerLabels = {\n notify: 'Ask to approve',\n notified: 'Notified.',\n openThread: 'Open the thread',\n loadingAnswer: 'Fetching the answer…',\n}\n\nexport interface ConnectedWorkflowRunnerProps extends Omit<\n WorkflowRunnerProps,\n 'run' | 'renderAgentOutput' | 'onUpload' | 'uploading' | 'files' | 'renderReview'\n> {\n workflow: WorkflowDefinition\n /** The run's bindings: an existing thread, commits, prompt wording, workflow lookup. */\n options?: UseWorkflowThreadOptions\n /** Open a conversation (the run's thread): the host navigates. */\n onOpenConversation?: (conversationId: string) => void\n /** The muted line an agent step shows before its answer. */\n emptyHint?: (step: WorkflowAgentStep) => string | undefined\n connectedLabels?: Partial<ConnectedWorkflowRunnerLabels>\n}\n\nexport function ConnectedWorkflowRunner({\n workflow,\n options,\n onOpenConversation,\n emptyHint,\n connectedLabels,\n testIdPrefix = 'workflow-run',\n ...runnerProps\n}: ConnectedWorkflowRunnerProps) {\n const l = { ...DEFAULT_CONNECTED_WORKFLOW_RUNNER_LABELS, ...connectedLabels }\n const arbi = useArbi()\n const { ensureWorkspaceOpen } = useConnection()\n const { wsId } = useWorkspaceDocs()\n const { data: docs = [], refetch } = useDocuments(wsId)\n const [uploading, setUploading] = useState(false)\n const { view, conversationId } = useWorkflowThread(workflow, options)\n // The files added on each upload step in this run (doc id -> step id).\n const [added, setAdded] = useState<Record<string, string>>({})\n\n const onUpload = useCallback(\n async (files: File[], step: WorkflowUploadStep) => {\n if (!files.length) return\n setUploading(true)\n try {\n // The server resolves the target workspace from the session: make sure it is open.\n await ensureWorkspaceOpen()\n for (const f of files) {\n const { doc_ext_ids = [] } = (await arbi.documents.uploadFile(f, f.name)) ?? {}\n setAdded((a) => ({ ...a, ...Object.fromEntries(doc_ext_ids.map((id) => [id, step.id])) }))\n }\n await refetch()\n } finally {\n setUploading(false)\n }\n },\n [arbi, ensureWorkspaceOpen, refetch]\n )\n\n const files = docs.map((d): WorkflowRunnerFile => ({\n id: d.external_id,\n name: d.file_name ?? d.external_id,\n status: fileStatus(d.status),\n addedFor: added[d.external_id],\n }))\n // Watch the files just added until they are read (the step waits for them).\n const reading = files.some((f) => f.addedFor && f.status === 'processing')\n useEffect(() => {\n if (!reading) return\n const t = setInterval(() => void refetch(), READ_POLL_MS)\n return () => clearInterval(t)\n }, [reading, refetch])\n\n const renderAgentOutput = (step: WorkflowAgentStep, state: WorkflowStepState | undefined) => {\n const status = state?.status\n if (!state?.text && status !== 'done') return null\n // Finished, its answer not read yet (the thread is fetched again until it is).\n if (!state?.text && state?.responseId) {\n return (\n <p\n className=\"flex items-center gap-2 text-sm text-muted-foreground\"\n data-testid={`${testIdPrefix}-${step.id}-answer-loading`}\n >\n <Loader2 className=\"size-4 animate-spin\" /> {l.loadingAnswer}\n </p>\n )\n }\n return (\n <AiAnswer\n status={status === 'running' ? 'running' : 'done'}\n text={state?.text ?? ''}\n emptyHint={emptyHint?.(step)}\n testId={`${testIdPrefix}-${step.id}-answer`}\n />\n )\n }\n\n return (\n <div className=\"space-y-3\">\n {conversationId && onOpenConversation && (\n <div className=\"flex justify-end\">\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => onOpenConversation(conversationId)}\n data-testid={`${testIdPrefix}-open-thread`}\n >\n <ExternalLink className=\"size-4\" /> {l.openThread}\n </Button>\n </div>\n )}\n <WorkflowRunner\n {...runnerProps}\n workflow={workflow}\n run={view}\n renderAgentOutput={renderAgentOutput}\n renderReview={(step) =>\n conversationId ? (\n <ReviewNotify\n conversationId={conversationId}\n workspaceId={wsId}\n labels={l}\n testId={`${testIdPrefix}-${step.id}`}\n />\n ) : null\n }\n onUpload={onUpload}\n uploading={uploading}\n files={files}\n testIdPrefix={testIdPrefix}\n />\n </div>\n )\n}\n\nconst READ_POLL_MS = 3000\n\n/** A document's processing status as the upload step shows it; unknown stays unknown. */\nexport function fileStatus(status: string | null | undefined): WorkflowRunnerFile['status'] {\n const s = status?.toLowerCase()\n if (!s) return undefined\n if (s === 'failed') return 'failed'\n if (s === 'completed' || s === 'empty' || s === 'low-content') return 'ready'\n return 'processing'\n}\n\n/** Who should approve: the workspace's people (not agents), notified about the run's thread. */\nfunction ReviewNotify({\n conversationId,\n workspaceId,\n labels,\n testId,\n}: {\n conversationId: string\n workspaceId: string | undefined\n labels: ConnectedWorkflowRunnerLabels\n testId: string\n}) {\n const arbi = useArbi()\n const { status, user, ensureWorkspaceOpen } = useConnection()\n const { data: members = [] } = useWorkspaceUsers(workspaceId, {\n enabled: status === 'authenticated' && !!workspaceId,\n beforeFetch: ensureWorkspaceOpen,\n })\n const people = members.filter(\n (m) =>\n !m.agent_ext_id &&\n !m.user.external_id.startsWith('agt-') &&\n m.user.external_id !== user?.externalId\n )\n const [picked, setPicked] = useState<string[]>([])\n const [sent, setSent] = useState(false)\n const [busy, setBusy] = useState(false)\n if (people.length === 0) return null\n const toggle = (id: string) =>\n setPicked((p) => (p.includes(id) ? p.filter((x) => x !== id) : [...p, id]))\n\n return (\n <div className=\"space-y-3\" data-testid={`${testId}-notify`}>\n <div className=\"flex flex-wrap gap-1.5\">\n {people.map((m) => {\n const name =\n [m.user.given_name, m.user.family_name].filter(Boolean).join(' ') || m.user.email\n const on = picked.includes(m.user.external_id)\n return (\n <button\n key={m.user.external_id}\n type=\"button\"\n onClick={() => toggle(m.user.external_id)}\n aria-pressed={on}\n className={cn(\n 'rounded-full border px-2.5 py-1 text-xs',\n on\n ? 'border-primary bg-primary/10 text-primary'\n : 'border-border text-muted-foreground'\n )}\n data-testid={`${testId}-person-${m.user.external_id}`}\n >\n {name}\n </button>\n )\n })}\n </div>\n <div className=\"flex items-center gap-2\">\n <Button\n variant=\"outline\"\n size=\"sm\"\n disabled={!picked.length || busy}\n onClick={async () => {\n setBusy(true)\n try {\n await arbi.conversations.notify(conversationId, picked)\n setSent(true)\n } finally {\n setBusy(false)\n }\n }}\n data-testid={`${testId}-notify-send`}\n >\n {labels.notify}\n </Button>\n {sent && <span className=\"text-xs text-muted-foreground\">{labels.notified}</span>}\n </div>\n </div>\n )\n}\n","import {\n useShellWorkspaces,\n useWorkspaces,\n type ShellWorkspaceSource,\n type UseShellWorkspacesOptions,\n type UseShellWorkspacesResult,\n} from '@arbidocs/react'\nimport { useConnection } from './ConnectionProvider'\n\nexport type UseConnectedShellWorkspacesOptions = Omit<\n UseShellWorkspacesOptions,\n 'workspaces' | 'isLoading' | 'loadError' | 'selectedId' | 'select'\n>\n\n/**\n * `useShellWorkspaces` wired to the connection layer: the account's live workspaces, the\n * connection's single selection as the active workspace, and `open` = `setWorkspace` (opens it on\n * the server, remembers it for the next login) then `onOpened`.\n *\n * ```tsx\n * const { active, recent, open } = useConnectedShellWorkspaces({\n * seed: { workspaces: demoWorkspaces, activeId: 'demo-1' },\n * onOpened: () => navigate('/app/documents'),\n * })\n * ```\n */\nexport function useConnectedShellWorkspaces(\n options: UseConnectedShellWorkspacesOptions = {}\n): UseShellWorkspacesResult {\n const { workspaceId, setWorkspace } = useConnection()\n const query = useWorkspaces()\n return useShellWorkspaces({\n ...options,\n workspaces: Array.isArray(query.data) ? (query.data as ShellWorkspaceSource[]) : undefined,\n isLoading: query.isLoading,\n loadError: query.error,\n selectedId: workspaceId,\n select: (workspace) => setWorkspace(workspace.id),\n })\n}\n","/**\n * The account area of a settings page, bound to the ARBI SDK: each section is a blocks part wired\n * to its `@arbidocs/react` hook, so a host drops them in a `SettingsPanel` and owns only the\n * layout (see the \"Settings page recipe\" in docs/design/blocks-package.md).\n *\n * Every section takes an optional `notify` for toasts and renders the default test ids of its\n * part. Anything the hooks cannot know (the recovery-key download, the billing link of a blocked\n * deletion, the password policy) is a prop.\n */\nimport { useMemo, useState, type ReactNode } from 'react'\nimport { KeyRound, Radio, UserCircle } from 'lucide-react'\nimport {\n ImageCropModal,\n useAvatarCrop,\n useConfirmEmailChange,\n useCurrentSessionId,\n useDeleteAccount,\n useDeleteAccountFlow,\n useEmailChange,\n useIdentityVerification,\n useLogoutAllSessions,\n useNameEditor,\n useNotificationPreferences,\n usePasswordChange,\n usePasswordChangeForm,\n useProfile,\n useRequestEmailChange,\n useSessions,\n useTerminateSession,\n useUpdateProfile,\n useWorkspaces,\n type AvatarFileProblem,\n type PasswordChangeResult,\n} from '@arbidocs/react'\nimport { Button } from '@arbidocs/react/ui'\nimport { initials } from '../lib/format'\nimport { AvatarPicker } from '../settings/AvatarPicker'\nimport { ProfileCard } from '../settings/ProfileCard'\nimport {\n IdentityVerificationCard,\n IdentityVerificationDialog,\n RequireVerified,\n type IdentityVerificationLabels,\n} from '../settings/IdentityVerification'\nimport {\n SettingsActionRow,\n SettingsCard,\n SettingsDangerZone,\n SettingsRow,\n SettingsSection,\n} from '../settings/SettingsPanel'\nimport { PasswordChangeDialog } from '../settings/PasswordChangeDialog'\nimport { ActiveSessionsDialog, DeleteAccountDialog } from '../settings/AccountDialogs'\nimport { LogoutDialog } from '../settings/LogoutDialog'\nimport { NotificationCategoryList } from '../settings/NotificationCategoryList'\nimport {\n EMAIL_NOTIFICATION_CATEGORIES,\n EMAIL_NOTIFICATION_KEYS,\n toActiveSessionViews,\n toDeleteBlockerViews,\n toLogoutSessionViews,\n toNotificationCategories,\n type EmailNotificationCategoryDef,\n} from '../settings/account-views'\nimport { useConnection } from './ConnectionProvider'\n\nexport type SettingsNotify = (message: string, kind: 'success' | 'error') => void\n\n/** The error text of a failed call: the backend `detail` when it sent one. */\nfunction errorText(error: unknown, fallback: string): string {\n const body = (error as { apiError?: { detail?: unknown } } | null)?.apiError\n return typeof body?.detail === 'string' ? body.detail : fallback\n}\n\nconst AVATAR_PROBLEMS: Record<AvatarFileProblem, string> = {\n 'not-image': 'Please choose an image file',\n 'too-large': 'Image must be 5 MB or smaller',\n unreadable: \"Couldn't read that image — try a different file\",\n}\n\n// ── Profile ─────────────────────────────────────────────────────────────────\n\nexport interface ConnectedProfileCardProps {\n notify?: SettingsNotify\n /** Section heading; default `Profile`. */\n title?: ReactNode\n}\n\n/** Avatar, editable name and email change of the signed-in user (`ProfileCard`). */\nexport function ConnectedProfileCard({ notify, title = 'Profile' }: ConnectedProfileCardProps) {\n const { data: profile } = useProfile()\n const updateProfile = useUpdateProfile()\n const requestEmailChange = useRequestEmailChange()\n const confirmEmailChange = useConfirmEmailChange()\n const { user } = useConnection()\n\n const name = useNameEditor({\n givenName: profile?.givenName,\n familyName: profile?.familyName,\n save: async (next) => {\n try {\n await updateProfile.mutateAsync(next)\n notify?.('Name updated', 'success')\n } catch (e) {\n notify?.('Failed to update name', 'error')\n throw e\n }\n },\n })\n const avatar = useAvatarCrop({\n upload: async (picture) => {\n try {\n await updateProfile.mutateAsync({ picture })\n notify?.('Profile picture updated', 'success')\n } catch (e) {\n notify?.('Failed to update picture', 'error')\n throw e\n }\n },\n onProblem: (problem) => notify?.(AVATAR_PROBLEMS[problem], 'error'),\n })\n const email = useEmailChange({\n requestCode: async (address) => {\n try {\n await requestEmailChange.mutateAsync(address)\n notify?.('Verification code sent to your new email', 'success')\n } catch (e) {\n notify?.(errorText(e, 'Failed to send verification code'), 'error')\n throw e\n }\n },\n confirm: async (args) => {\n try {\n await confirmEmailChange.mutateAsync(args)\n notify?.('Email address updated', 'success')\n } catch (e) {\n notify?.(errorText(e, 'Invalid or expired verification code'), 'error')\n throw e\n }\n },\n })\n\n const display = profile?.fullName || user?.name || 'Unnamed'\n return (\n <SettingsSection icon={<UserCircle />} title={title}>\n <ProfileCard\n avatar={\n <>\n <AvatarPicker\n pictureUrl={profile?.picture ?? user?.picture}\n initials={initials(display)}\n fallbackClassName=\"bg-primary text-primary-foreground\"\n isUploading={avatar.isUploading}\n onFileChosen={avatar.onFileChosen}\n />\n <ImageCropModal\n open={avatar.pendingImage !== null}\n image={avatar.pendingImage}\n title=\"Crop your photo\"\n aspect={1}\n cropShape=\"round\"\n output={{ maxSize: 128, mimeType: 'image/jpeg', quality: 0.85 }}\n onComplete={avatar.onCropComplete}\n onCancel={avatar.onCropCancel}\n />\n </>\n }\n name={{ ...name, display, isSaving: name.isSaving }}\n email={profile?.email ?? user?.email ?? ''}\n isSso={profile?.isSso ?? false}\n isVerified={profile?.isIdentityVerified ?? false}\n onStartEmailChange={email.onStart}\n emailChange={email.isOpen ? email : undefined}\n />\n </SettingsSection>\n )\n}\n\n// ── Identity verification ───────────────────────────────────────────────────\n\nexport interface ConnectedIdentityVerificationProps {\n notify?: SettingsNotify\n labels?: Partial<IdentityVerificationLabels>\n}\n\n/** The ID check card and its dialog, bound to the SDK. Renders nothing when not offered. */\nexport function ConnectedIdentityVerification({\n notify,\n labels,\n}: ConnectedIdentityVerificationProps) {\n const { data: profile } = useProfile()\n const flow = useIdentityVerification({\n onVerifiedChange: (verified) =>\n notify?.(verified ? 'Identity verified' : 'Verified tick removed', 'success'),\n onNameAccepted: () => notify?.('Name updated to match your ID', 'success'),\n })\n return (\n <>\n <IdentityVerificationCard flow={flow} labels={labels} />\n <IdentityVerificationDialog\n flow={flow}\n accountName={profile?.fullName ?? ''}\n labels={labels}\n />\n </>\n )\n}\n\nexport interface ConnectedRequireVerifiedProps {\n children?: ReactNode\n labels?: Partial<IdentityVerificationLabels>\n}\n\n/** `RequireVerified` bound to the SDK: gates `children` when the deployment requires an ID check. */\nexport function ConnectedRequireVerified({ children, labels }: ConnectedRequireVerifiedProps) {\n const { data: profile } = useProfile()\n const flow = useIdentityVerification()\n return (\n <RequireVerified flow={flow} accountName={profile?.fullName ?? ''} labels={labels}>\n {children}\n </RequireVerified>\n )\n}\n\n// ── Security: password ──────────────────────────────────────────────────────\n\n/** The default password policy: 8 characters, an uppercase letter or symbol, a digit. */\nexport function defaultUnmetPasswordRequirement(password: string): string | null {\n if (password.length < 8) return 'Minimum 8 characters'\n if (!/[A-Z!@#$%^&*()_+\\-=[\\]{};':\"\\\\|,.<>/?]/.test(password)) {\n return 'At least one uppercase letter or special character'\n }\n if (!/[0-9]/.test(password)) return 'At least one number'\n return null\n}\n\nexport interface ConnectedSecuritySectionProps {\n notify?: SettingsNotify\n /** The host's password policy; default is {@link defaultUnmetPasswordRequirement}. */\n getUnmetRequirement?: (password: string) => string | null\n /** The recovery-key download for the key the new password produced (shown on success). */\n renderRecoveryKey?: (result: PasswordChangeResult) => ReactNode\n /** Extra rows under \"Change password\" (e.g. \"Save recovery key\"). */\n children?: ReactNode\n}\n\n/** The Security card: \"Change password\" and the dialog behind it (`PasswordChangeDialog`). */\nexport function ConnectedSecuritySection({\n notify,\n getUnmetRequirement = defaultUnmetPasswordRequirement,\n renderRecoveryKey,\n children,\n}: ConnectedSecuritySectionProps) {\n const [open, setOpen] = useState(false)\n const change = usePasswordChange()\n // Only workspaces the user belongs to are re-keyed.\n const { data: workspaces } = useWorkspaces({ enabled: open })\n const workspaceCount = (workspaces ?? []).filter((w) => w.is_member).length\n const form = usePasswordChangeForm<PasswordChangeResult>({\n getUnmetRequirement,\n submit: async (vars) => {\n const result = await change.mutateAsync(vars)\n notify?.('Password changed successfully', 'success')\n return result\n },\n onClose: () => setOpen(false),\n })\n\n return (\n <SettingsSection icon={<KeyRound />} title=\"Security\">\n <SettingsCard padding=\"sm\">\n <SettingsActionRow\n title=\"Change password\"\n description=\"Used to sign in and to encrypt your data. Changing it re-encrypts everything in your account.\"\n onClick={() => setOpen(true)}\n testId=\"change-password-button\"\n />\n {children}\n </SettingsCard>\n <PasswordChangeDialog\n open={open}\n onClose={form.onCancel}\n recoveryMode={false}\n currentPassword={form.currentPassword}\n onCurrentPasswordChange={form.onCurrentPasswordChange}\n newPassword={form.newPassword}\n onNewPasswordChange={form.onNewPasswordChange}\n confirmPassword={form.confirmPassword}\n onConfirmPasswordChange={form.onConfirmPasswordChange}\n getUnmetRequirement={getUnmetRequirement}\n workspaceCount={workspaceCount}\n error={form.error}\n isProcessing={form.isProcessing}\n isSubmitDisabled={form.isSubmitDisabled}\n onSubmit={form.onSubmit}\n success={form.result ? (renderRecoveryKey?.(form.result) ?? <></>) : null}\n onDone={form.onDone}\n />\n </SettingsSection>\n )\n}\n\n// ── Notifications ───────────────────────────────────────────────────────────\n\nexport interface ConnectedNotificationPreferencesProps {\n /** Categories to offer; default {@link EMAIL_NOTIFICATION_CATEGORIES}. */\n categories?: readonly EmailNotificationCategoryDef[]\n title?: ReactNode\n}\n\n/** The email-notification switches (`NotificationCategoryList`) over the user settings. */\nexport function ConnectedNotificationPreferences({\n categories = EMAIL_NOTIFICATION_CATEGORIES,\n title = 'Notifications',\n}: ConnectedNotificationPreferencesProps) {\n const keys = useMemo(\n () =>\n categories === EMAIL_NOTIFICATION_CATEGORIES\n ? EMAIL_NOTIFICATION_KEYS\n : categories.map((c) => c.key),\n [categories]\n )\n const prefs = useNotificationPreferences(keys)\n return (\n <SettingsSection title={title}>\n <SettingsCard className=\"space-y-0\">\n <NotificationCategoryList\n masterId=\"emailNotifications\"\n masterTitle=\"Email Notifications\"\n masterDescription=\"Email me about activity when I’m away\"\n masterChecked={prefs.masterChecked}\n onMasterChange={prefs.setAll}\n categories={toNotificationCategories(prefs.checked, categories)}\n onCategoryChange={prefs.setCategory}\n />\n </SettingsCard>\n </SettingsSection>\n )\n}\n\n// ── Sessions ────────────────────────────────────────────────────────────────\n\nexport interface ConnectedSessionsRowProps {\n notify?: SettingsNotify\n /** Ask before ending a session; resolve `false` to cancel. Default: end at once. */\n confirm?: (message: string) => Promise<boolean> | boolean\n /** Glyph per session status. */\n renderSessionIcon?: (status: string) => ReactNode\n}\n\n/** \"Active sessions\" row with the manage dialog (`ActiveSessionsDialog`); end any but this device. */\nexport function ConnectedSessionsRow({\n notify,\n confirm,\n renderSessionIcon,\n}: ConnectedSessionsRowProps) {\n const [open, setOpen] = useState(false)\n const sessions = useSessions({ enabled: open })\n const currentSessionId = useCurrentSessionId()\n const terminate = useTerminateSession()\n const views = toActiveSessionViews(sessions.data ?? [], {\n currentSessionId,\n terminatingId: terminate.isPending ? terminate.variables : null,\n renderIcon: renderSessionIcon,\n })\n return (\n <>\n <SettingsRow\n label=\"Active sessions\"\n description=\"Devices and agents currently signed in to your account.\"\n >\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={() => setOpen(true)}\n className=\"flex items-center gap-2\"\n data-testid=\"active-sessions-button\"\n >\n <Radio className=\"h-4 w-4\" />\n Manage\n </Button>\n </SettingsRow>\n <ActiveSessionsDialog\n open={open}\n onOpenChange={setOpen}\n isLoading={sessions.isLoading}\n sessions={views}\n onTerminate={(id) => {\n void (async () => {\n const view = views.find((v) => v.id === id)\n const label = view?.detail.split(' · ')[0]\n const ok =\n (await confirm?.(\n `End the session on ${label}? It will be signed out immediately.`\n )) ?? true\n if (!ok) return\n try {\n await terminate.mutateAsync(id)\n } catch {\n notify?.('Failed to end session. Please try again.', 'error')\n }\n })()\n }}\n />\n </>\n )\n}\n\nexport interface ConnectedLogoutDialogProps {\n open: boolean\n onClose: () => void\n isOnline?: boolean\n renderSessionIcon?: (status: string) => ReactNode\n}\n\n/** Sign out of this device or all devices (`LogoutDialog`), listing the active sessions. */\nexport function ConnectedLogoutDialog({\n open,\n onClose,\n isOnline = true,\n renderSessionIcon,\n}: ConnectedLogoutDialogProps) {\n const { logout } = useConnection()\n const sessions = useSessions({ enabled: open })\n const logoutAll = useLogoutAllSessions()\n return (\n <LogoutDialog\n open={open}\n onClose={onClose}\n onLogoutThis={() => {\n onClose()\n logout()\n }}\n onLogoutAll={() => {\n onClose()\n // The server drops every session first; the connection then forgets this one.\n void logoutAll.mutateAsync().finally(logout)\n }}\n canLogoutAll\n isOnline={isOnline}\n sessions={toLogoutSessionViews(sessions.data ?? [])}\n renderSessionIcon={renderSessionIcon}\n />\n )\n}\n\n// ── Danger zone ─────────────────────────────────────────────────────────────\n\nexport interface ConnectedDangerZoneProps {\n notify?: SettingsNotify\n /** Link to the billing page for a deletion blocked by an active subscription. */\n renderSubscriptionLink?: () => ReactNode\n}\n\n/** \"Delete your account\": the collapsed danger zone and the two-step dialog (`DeleteAccountDialog`). */\nexport function ConnectedDangerZone({ notify, renderSubscriptionLink }: ConnectedDangerZoneProps) {\n const [zoneOpen, setZoneOpen] = useState(false)\n const [dialogOpen, setDialogOpen] = useState(false)\n const { user, logout } = useConnection()\n const remove = useDeleteAccount()\n const flow = useDeleteAccountFlow({\n userEmail: user?.email ?? '',\n remove: () => remove.mutateAsync(),\n onClose: () => setDialogOpen(false),\n onDeleted: logout,\n onError: () => notify?.('Failed to delete account. Please try again.', 'error'),\n })\n return (\n <>\n <SettingsDangerZone\n isOpen={zoneOpen}\n onToggle={() => setZoneOpen((o) => !o)}\n title=\"Delete your account\"\n description=\"Once deleted, your account will be immediately closed and you will be logged out. This action cannot be undone.\"\n action={\n <Button\n variant=\"destructive\"\n size=\"sm\"\n disabled={!user?.email}\n onClick={() => setDialogOpen(true)}\n data-testid=\"delete-account-button\"\n >\n Delete Account\n </Button>\n }\n />\n <DeleteAccountDialog\n open={dialogOpen}\n onClose={flow.onClose}\n step={flow.step}\n blockers={toDeleteBlockerViews(flow.blockers, renderSubscriptionLink)}\n onContinue={flow.onContinue}\n onBack={flow.onBack}\n userEmail={user?.email ?? ''}\n confirmEmail={flow.confirmEmail}\n onConfirmEmailChange={flow.onConfirmEmailChange}\n isDeleting={flow.isDeleting}\n onSubmit={flow.onSubmit}\n />\n </>\n )\n}\n","import { useEffect } from 'react'\nimport { useQuery, useQueryClient } from '@tanstack/react-query'\nimport { useArbi, useArbiWebSocket, notify, type AppNotification } from '@arbidocs/react'\nimport { useNotify } from '@arbidocs/react/shell'\nimport { useConnection } from './ConnectionProvider'\n\n/** Bridge persisted document mentions to the shared bell; hosts own routing. */\nexport function useConnectedDocxNotifications(\n onOpen: (target: {\n workspaceId: string\n documentId: string\n commentId: string\n }) => void | Promise<void>\n) {\n const arbi = useArbi()\n const { status, user, apiUrl } = useConnection()\n const queries = useQueryClient()\n const source = `docx-mentions:${apiUrl}:${user?.externalId || ''}`\n const queryKey = ['docx-mentions', apiUrl, user?.externalId]\n const { data = [] } = useQuery({\n queryKey,\n queryFn: () => arbi.notifications.list('docx_mention'),\n enabled: status === 'authenticated',\n refetchInterval: 30_000,\n })\n useArbiWebSocket((message) => {\n if (message.type === 'docx_mention') void queries.invalidateQueries({ queryKey })\n })\n useEffect(() => {\n const items: AppNotification[] = []\n if (status === 'authenticated')\n for (const note of data) {\n if (note.recipient.external_id !== user?.externalId || !note.workspace_ext_id) continue\n try {\n const target = JSON.parse(note.content || '{}') as {\n document_id?: string\n comment_id?: string\n }\n if (!target.document_id?.startsWith('doc-') || !target.comment_id) continue\n const documentId = target.document_id,\n commentId = target.comment_id,\n workspaceId = note.workspace_ext_id\n items.push({\n id: `docx:${note.external_id}`,\n title: 'Mentioned you in a document comment',\n description: [note.sender.given_name, note.sender.family_name]\n .filter(Boolean)\n .join(' '),\n variant: 'info',\n ts: Date.parse(note.created_at),\n read: note.read,\n source,\n onSelect: () => {\n void Promise.resolve(onOpen({ documentId, commentId, workspaceId })).catch((error) =>\n notify.error(\n error instanceof Error ? error.message : 'Could not open the document.'\n )\n )\n },\n })\n } catch {\n /* Ignore invalid legacy payloads. */\n }\n }\n useNotify.getState().syncSource(source, items)\n return () => useNotify.getState().syncSource(source, [])\n }, [data, status, user?.externalId, source, onOpen])\n const markRead = async (ids: string[]) => {\n try {\n await arbi.notifications.markRead(ids)\n await queries.invalidateQueries({ queryKey })\n } catch {\n notify.error('Could not mark document mentions read.')\n }\n }\n return {\n onMarkRead: (id: string) => {\n if (id.startsWith('docx:')) void markRead([id.slice(5)])\n },\n onMarkAllRead: () => {\n void markRead(\n data\n .filter((note) => !note.read && note.recipient.external_id === user?.externalId)\n .map((note) => note.external_id)\n )\n },\n }\n}\n","import { useEffect } from 'react'\nimport { useWorkNotifications, notify, type AppNotification } from '@arbidocs/react'\nimport { useNotify } from '@arbidocs/react/shell'\nimport type { components } from '@arbidocs/client'\nimport { useConnection } from './ConnectionProvider'\n\nexport type WorkNotificationTarget =\n | { kind: 'conversation'; workspaceId: string; conversationId: string; messageId?: string }\n | { kind: 'workflow'; workspaceId?: string; workflowId: string }\n\n/** Persisted work notifications in the shared bell; the consumer owns navigation. */\nexport function useConnectedWorkNotifications(\n onOpen: (target: WorkNotificationTarget) => void | Promise<void>\n) {\n const { status, user, apiUrl } = useConnection()\n const source = `work-notifications:${apiUrl}:${user?.externalId || ''}`\n const { data = [], markRead: persistRead } = useWorkNotifications({\n apiUrl,\n userId: user?.externalId,\n enabled: status === 'authenticated',\n })\n useEffect(() => {\n const items: AppNotification[] = []\n if (status === 'authenticated')\n for (const note of data) {\n if (note.recipient.external_id !== user?.externalId) continue\n const mapped = mapWorkNotification(note)\n if (!mapped) continue\n items.push({\n id: `work:${note.external_id}`,\n title: mapped.title,\n variant:\n note.type === 'workflow_failed'\n ? 'error'\n : note.type === 'conversation_done'\n ? 'success'\n : 'info',\n ts: Date.parse(note.created_at),\n read: note.read,\n source,\n onSelect: () => {\n void Promise.resolve()\n .then(() => onOpen(mapped.target))\n .catch((error) =>\n notify.error(\n error instanceof Error ? error.message : 'Could not open this notification.'\n )\n )\n },\n })\n }\n useNotify.getState().syncSource(source, items)\n return () => useNotify.getState().syncSource(source, [])\n }, [data, status, user?.externalId, source, onOpen])\n const markRead = async (ids: string[]) => {\n if (!ids.length) return\n try {\n await persistRead(ids)\n } catch {\n notify.error('Could not mark work notifications read.')\n }\n }\n return {\n onMarkRead: (id: string) => {\n // Only received, currently loaded work rows belong to this source.\n if (\n data.some(\n (note) =>\n `work:${note.external_id}` === id &&\n note.recipient.external_id === user?.externalId &&\n mapWorkNotification(note)\n )\n )\n void markRead([id.slice(5)])\n },\n onMarkAllRead: () => {\n void markRead(\n data\n .filter(\n (note) =>\n !note.read &&\n note.recipient.external_id === user?.externalId &&\n mapWorkNotification(note)\n )\n .map((note) => note.external_id)\n )\n },\n }\n}\n\n/** Route from explicit IDs; encrypted task text is never needed for a link. */\nexport function mapWorkNotification(note: components['schemas']['NotificationResponse']): {\n title: string\n target: WorkNotificationTarget\n} | null {\n const sender =\n [note.sender.given_name, note.sender.family_name].filter(Boolean).join(' ') || note.sender.email\n if (note.type === 'workflow_failed') {\n try {\n const payload = JSON.parse(note.content || '{}') as { workflow_ext_id?: string }\n if (!payload.workflow_ext_id?.match(/^wfl-[a-zA-Z0-9]+$/)) return null\n if (\n note.workspace_ext_id?.match(/^wrk-[a-zA-Z0-9]+$/) &&\n note.conversation_ext_id?.match(/^con-[a-zA-Z0-9]+$/)\n ) {\n return {\n title: 'A workflow failed to run',\n target: {\n kind: 'conversation',\n workspaceId: note.workspace_ext_id,\n conversationId: note.conversation_ext_id,\n },\n }\n }\n return {\n title: 'A workflow failed to run',\n target: {\n kind: 'workflow',\n workflowId: payload.workflow_ext_id,\n workspaceId: note.workspace_ext_id || undefined,\n },\n }\n } catch {\n return null\n }\n }\n const titles: Partial<Record<components['schemas']['NotificationType'], string>> = {\n mention: `${sender} mentioned you in a conversation`,\n workspace_access_request: `${sender} needs workspace access to run a task`,\n conversation_ready: `${sender} has a task ready`,\n conversation_done: `${sender} marked a task done`,\n }\n const title = titles[note.type]\n if (!title || !note.workspace_ext_id || !note.conversation_ext_id?.match(/^con-[a-zA-Z0-9]+$/))\n return null\n return {\n title,\n target: {\n kind: 'conversation',\n workspaceId: note.workspace_ext_id,\n conversationId: note.conversation_ext_id,\n ...(note.message_ext_id ? { messageId: note.message_ext_id } : {}),\n },\n }\n}\n","import {\n useAgentSession,\n useStartAgentSession,\n useCloseAgentSession,\n useArbiChat,\n} from '@arbidocs/react'\nimport { Button } from '@arbidocs/react/ui'\nimport { ChatPage } from '../chat/ChatPage'\n\nexport interface ConnectedAgentChatPanelProps {\n agentId: string\n workspaceId: string\n agentName?: string\n}\n\nfunction ActiveChat({ agentId, workspaceId }: ConnectedAgentChatPanelProps) {\n const chat = useArbiChat({ agentId, workspaceId })\n return (\n <ChatPage\n chat={{ ...chat, assistantMode: undefined, setAssistantMode: undefined }}\n documentsRequired={false}\n compactHeader\n surface=\"dock\"\n emptyTitle=\"What would you like me to do?\"\n emptyDescription=\"This agent works through its own login. Upload files here to stage them in its sandbox.\"\n className=\"h-[min(65vh,650px)] min-h-[380px]\"\n />\n )\n}\n\n/** An owned agent's independent login and chat, using the shared controller and chat surface. */\nexport function ConnectedAgentChatPanel({\n agentId,\n workspaceId,\n agentName = 'Agent',\n}: ConnectedAgentChatPanelProps) {\n const session = useAgentSession(agentId)\n const start = useStartAgentSession()\n const close = useCloseAgentSession()\n const ready = session.data?.active && session.data.workspace_ext_id === workspaceId\n const busy = start.isPending || close.isPending\n const error = start.error ?? close.error ?? session.error\n return (\n <section className=\"space-y-3\" data-testid=\"agent-chat-panel\">\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <p className=\"text-sm\" data-testid=\"agent-chat-session-status\">\n {agentName} ·{' '}\n {ready\n ? 'Signed in to this workspace'\n : session.data?.active\n ? `Signed in to ${session.data.workspace_name ?? 'another workspace'}`\n : 'Signed out'}\n </p>\n <div className=\"flex gap-2\">\n {!ready && (\n <Button\n type=\"button\"\n disabled={busy || session.isLoading}\n onClick={() => start.mutate({ agentId, workspaceId })}\n data-testid=\"agent-chat-login\"\n >\n {start.isPending ? 'Signing in…' : 'Sign in here'}\n </Button>\n )}\n {session.data?.active && (\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled={busy}\n onClick={() => close.mutate(agentId)}\n data-testid=\"agent-chat-logout\"\n >\n {close.isPending ? 'Signing out…' : 'Sign out agent'}\n </Button>\n )}\n </div>\n </div>\n {error && (\n <p role=\"alert\" className=\"text-sm text-destructive\">\n {error.message}\n </p>\n )}\n {ready && (\n <ActiveChat key={`${agentId}:${workspaceId}`} agentId={agentId} workspaceId={workspaceId} />\n )}\n </section>\n )\n}\n"]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The workflow builder bound to the connection: it loads a saved workflow (or starts from the
|
|
3
|
+
* host's value), offers the workspace's skills as steps an agent can run, its agents, the events
|
|
4
|
+
* and tasks a workflow can start on, and saves the workflow (its trigger and its steps) or runs it
|
|
5
|
+
* now. Every run is a work thread that runs the steps. Exported from
|
|
6
|
+
* `@arbidocs/blocks/workflow-canvas` (it brings the graph library).
|
|
7
|
+
*/
|
|
8
|
+
import { type ReactNode } from 'react';
|
|
9
|
+
import { type StepComposeOptions, type WorkflowDefinition } from '../agents';
|
|
10
|
+
import { type WorkflowBuilderProps } from '../workflow-canvas/WorkflowBuilder';
|
|
11
|
+
import { type WorkflowBuilderValue } from '../workflow-canvas/trigger';
|
|
12
|
+
export interface ConnectedWorkflowBuilderLabels {
|
|
13
|
+
save: string;
|
|
14
|
+
saving: string;
|
|
15
|
+
runNow: string;
|
|
16
|
+
saved: string;
|
|
17
|
+
needTrigger: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const DEFAULT_CONNECTED_WORKFLOW_BUILDER_LABELS: ConnectedWorkflowBuilderLabels;
|
|
20
|
+
/** Workspace events a workflow can start on (notification types), in plain words. */
|
|
21
|
+
export declare const DEFAULT_WORKFLOW_EVENT_KINDS: {
|
|
22
|
+
value: string;
|
|
23
|
+
label: string;
|
|
24
|
+
}[];
|
|
25
|
+
export interface ConnectedWorkflowBuilderProps extends Pick<StepComposeOptions, 'compose'>, Pick<WorkflowBuilderProps, 'renderIcon' | 'labels' | 'canvasLabels' | 'inspectorLabels' | 'triggerLabels' | 'testId' | 'className'> {
|
|
26
|
+
/** A saved workflow to edit (`wfl-…`). */
|
|
27
|
+
workflowId?: string;
|
|
28
|
+
/** Where a new workflow starts (e.g. a built-in journey). */
|
|
29
|
+
initial: WorkflowBuilderValue;
|
|
30
|
+
/** Host workflows agent steps can run besides the workspace's skills (e.g. its own wording). */
|
|
31
|
+
workflows?: WorkflowDefinition[];
|
|
32
|
+
eventKinds?: Array<{
|
|
33
|
+
value: string;
|
|
34
|
+
label: string;
|
|
35
|
+
}>;
|
|
36
|
+
/** Saved (created or updated): its id. */
|
|
37
|
+
onSaved?: (workflowId: string) => void;
|
|
38
|
+
/** A run started: its thread. */
|
|
39
|
+
onRun?: (conversationId: string | undefined) => void;
|
|
40
|
+
/** Extra host buttons. */
|
|
41
|
+
actions?: ReactNode;
|
|
42
|
+
connectedLabels?: Partial<ConnectedWorkflowBuilderLabels>;
|
|
43
|
+
}
|
|
44
|
+
export declare function ConnectedWorkflowBuilder({ workflowId, initial, workflows: hostWorkflows, eventKinds, compose, onSaved, onRun, actions, connectedLabels, testId, ...builderProps }: ConnectedWorkflowBuilderProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A stepped workflow run in its work thread, end to end: `useWorkflowThread` keeps the run on the
|
|
3
|
+
* server (the thread's plan, its activity, its turns) and `WorkflowRunner` shows it. Agent answers
|
|
4
|
+
* are the thread's messages; uploads go into the open workspace; a review can notify the people
|
|
5
|
+
* who should approve it, in the run's thread. The host keeps its wording, its commits
|
|
6
|
+
* (`options.commit`) and its finish screen.
|
|
7
|
+
*/
|
|
8
|
+
import { type WorkflowRunnerFile, type WorkflowRunnerProps } from '../agents/workflows/WorkflowRunner';
|
|
9
|
+
import type { WorkflowAgentStep, WorkflowDefinition } from '../agents/workflows/types';
|
|
10
|
+
import { type UseWorkflowThreadOptions } from './useWorkflowThread';
|
|
11
|
+
export interface ConnectedWorkflowRunnerLabels {
|
|
12
|
+
notify: string;
|
|
13
|
+
/** A finished step whose answer is still being fetched. */
|
|
14
|
+
loadingAnswer: string;
|
|
15
|
+
notified: string;
|
|
16
|
+
openThread: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const DEFAULT_CONNECTED_WORKFLOW_RUNNER_LABELS: ConnectedWorkflowRunnerLabels;
|
|
19
|
+
export interface ConnectedWorkflowRunnerProps extends Omit<WorkflowRunnerProps, 'run' | 'renderAgentOutput' | 'onUpload' | 'uploading' | 'files' | 'renderReview'> {
|
|
20
|
+
workflow: WorkflowDefinition;
|
|
21
|
+
/** The run's bindings: an existing thread, commits, prompt wording, workflow lookup. */
|
|
22
|
+
options?: UseWorkflowThreadOptions;
|
|
23
|
+
/** Open a conversation (the run's thread): the host navigates. */
|
|
24
|
+
onOpenConversation?: (conversationId: string) => void;
|
|
25
|
+
/** The muted line an agent step shows before its answer. */
|
|
26
|
+
emptyHint?: (step: WorkflowAgentStep) => string | undefined;
|
|
27
|
+
connectedLabels?: Partial<ConnectedWorkflowRunnerLabels>;
|
|
28
|
+
}
|
|
29
|
+
export declare function ConnectedWorkflowRunner({ workflow, options, onOpenConversation, emptyHint, connectedLabels, testIdPrefix, ...runnerProps }: ConnectedWorkflowRunnerProps): import("react").JSX.Element;
|
|
30
|
+
/** A document's processing status as the upload step shows it; unknown stays unknown. */
|
|
31
|
+
export declare function fileStatus(status: string | null | undefined): WorkflowRunnerFile['status'];
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A stepped workflow run that lives in a work thread on the server. The thread's plan carries the
|
|
3
|
+
* steps; its activity log says where each step is; the work runner starts each agent step as a
|
|
4
|
+
* turn in the thread. This hook reads all of that and does the person's part: it starts the thread
|
|
5
|
+
* (with the run's inputs and the steps' prompts composed from them), completes forms, uploads and
|
|
6
|
+
* reviews, skips, and retries a failed step. `WorkflowRunner` shows the result.
|
|
7
|
+
*/
|
|
8
|
+
import { type ConversationResponse } from '@arbidocs/react';
|
|
9
|
+
import { type StepComposeOptions } from '../agents/workflows/run';
|
|
10
|
+
import { type WorkflowRunView } from '../agents/workflows/useWorkflowView';
|
|
11
|
+
import type { WorkflowDefinition, WorkflowInputs } from '../agents/workflows/types';
|
|
12
|
+
export interface UseWorkflowThreadOptions extends StepComposeOptions {
|
|
13
|
+
/** An existing run to show (its thread). Absent: a new run starts when its first step is done. */
|
|
14
|
+
conversationId?: string;
|
|
15
|
+
/** The thread was created (store its id to come back to the run). */
|
|
16
|
+
onStarted?: (conversationId: string) => void;
|
|
17
|
+
/**
|
|
18
|
+
* The host's commits, by step id (`commit: true` steps): done before the step is recorded, e.g.
|
|
19
|
+
* create and open the matter the run belongs in (the thread is created in the open workspace).
|
|
20
|
+
* May return inputs to merge into the run.
|
|
21
|
+
*/
|
|
22
|
+
commit?: Record<string, (inputs: WorkflowInputs) => Promise<WorkflowInputs | void>>;
|
|
23
|
+
/** Prefills for a new run. */
|
|
24
|
+
initialInputs?: WorkflowInputs;
|
|
25
|
+
/** The agent that runs the agent steps (`agt-…`); absent = the person's own assistant. */
|
|
26
|
+
agentId?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface WorkflowThread {
|
|
29
|
+
view: WorkflowRunView;
|
|
30
|
+
/** The run's thread, once it exists. */
|
|
31
|
+
conversationId: string | undefined;
|
|
32
|
+
conversation: ConversationResponse | undefined;
|
|
33
|
+
}
|
|
34
|
+
/** How many times missing answers are fetched again before giving up (about three minutes). */
|
|
35
|
+
export declare const ANSWER_RETRY_CAP = 16;
|
|
36
|
+
/** The wait before the `attempt`th fetch of missing answers: at once, then 1s doubling to 15s. */
|
|
37
|
+
export declare function answerRetryDelay(attempt: number): number;
|
|
38
|
+
export declare function useWorkflowThread(workflow: WorkflowDefinition, options?: UseWorkflowThreadOptions): WorkflowThread;
|
package/dist/facts/index.cjs
CHANGED
|
@@ -7,9 +7,9 @@ var chunkOUW6G4O2_cjs = require('../chunk-OUW6G4O2.cjs');
|
|
|
7
7
|
var chunk7RGLTF76_cjs = require('../chunk-7RGLTF76.cjs');
|
|
8
8
|
var chunkIA7RTPT3_cjs = require('../chunk-IA7RTPT3.cjs');
|
|
9
9
|
var chunk2EI7NCUA_cjs = require('../chunk-2EI7NCUA.cjs');
|
|
10
|
-
require('../chunk-C54XEN5T.cjs');
|
|
11
10
|
require('../chunk-FX3K6LNZ.cjs');
|
|
12
11
|
var chunkPPCATBOY_cjs = require('../chunk-PPCATBOY.cjs');
|
|
12
|
+
require('../chunk-C54XEN5T.cjs');
|
|
13
13
|
var chunkKDG6FER6_cjs = require('../chunk-KDG6FER6.cjs');
|
|
14
14
|
var chunkMHVNT4J3_cjs = require('../chunk-MHVNT4J3.cjs');
|
|
15
15
|
require('../chunk-DES3K4SD.cjs');
|
package/dist/facts/index.js
CHANGED
|
@@ -6,9 +6,9 @@ import { TabHeader } from '../chunk-4WWM3GQ5.js';
|
|
|
6
6
|
import { GridView, SelectionBar, SelectionBarAction } from '../chunk-BUHKUKKB.js';
|
|
7
7
|
import { FilterInput } from '../chunk-YU2KUMGE.js';
|
|
8
8
|
export { DEFAULT_FILTER_INPUT_LABELS as DEFAULT_FACTS_FILTER_INPUT_LABELS, DEFAULT_FILTER_FIELDS as FACTS_SEARCH_FIELD_OPTIONS, FilterInput as FactsFilterInput } from '../chunk-YU2KUMGE.js';
|
|
9
|
-
import '../chunk-76JDDMSP.js';
|
|
10
9
|
import '../chunk-SLSBJRWW.js';
|
|
11
10
|
import { observeResize } from '../chunk-NPLYHR2E.js';
|
|
11
|
+
import '../chunk-76JDDMSP.js';
|
|
12
12
|
import { initials } from '../chunk-OXF2IFXG.js';
|
|
13
13
|
import { testIdOr } from '../chunk-7F6CBP3Z.js';
|
|
14
14
|
import '../chunk-VUNV25KB.js';
|