@arbidocs/react 0.5.164 → 0.5.166

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/dist/ai/MessageArtifactCard.js +16 -0
  2. package/dist/ai/MessageArtifactCard.js.map +2 -2
  3. package/dist/artifacts/artifact-kind.js +12 -1
  4. package/dist/artifacts/artifact-kind.js.map +2 -2
  5. package/dist/artifacts/index.cjs +26 -15
  6. package/dist/artifacts/index.cjs.map +1 -1
  7. package/dist/artifacts/index.d.ts +3 -20
  8. package/dist/artifacts/index.js +3 -1
  9. package/dist/artifacts/index.js.map +2 -2
  10. package/dist/calls/livekit/index.cjs +48 -48
  11. package/dist/chat/ChatBubble.js +56 -65
  12. package/dist/chat/ChatBubble.js.map +2 -2
  13. package/dist/chat/open-document.js +4 -1
  14. package/dist/chat/open-document.js.map +2 -2
  15. package/dist/{chunk-6HJZCIND.cjs → chunk-3DPOR5IR.cjs} +6 -3
  16. package/dist/chunk-3DPOR5IR.cjs.map +1 -0
  17. package/dist/{chunk-42X5ZO7Y.cjs → chunk-4TWXQFHU.cjs} +69 -69
  18. package/dist/{chunk-42X5ZO7Y.cjs.map → chunk-4TWXQFHU.cjs.map} +1 -1
  19. package/dist/{chunk-ZZBCZRA5.cjs → chunk-5QOZLKAY.cjs} +5 -2
  20. package/dist/chunk-5QOZLKAY.cjs.map +1 -0
  21. package/dist/{chunk-SUMXDNYG.cjs → chunk-BI4SYRLX.cjs} +70 -63
  22. package/dist/chunk-BI4SYRLX.cjs.map +1 -0
  23. package/dist/{chunk-ZBI5AMZC.cjs → chunk-HRQS27DO.cjs} +37 -37
  24. package/dist/{chunk-ZBI5AMZC.cjs.map → chunk-HRQS27DO.cjs.map} +1 -1
  25. package/dist/{chunk-V5WCKJEH.cjs → chunk-Q7BGWKHP.cjs} +44 -44
  26. package/dist/{chunk-V5WCKJEH.cjs.map → chunk-Q7BGWKHP.cjs.map} +1 -1
  27. package/dist/{chunk-6TJL4Z2F.cjs → chunk-TX7UCN73.cjs} +10 -10
  28. package/dist/{chunk-6TJL4Z2F.cjs.map → chunk-TX7UCN73.cjs.map} +1 -1
  29. package/dist/{chunk-WJIRX5MS.cjs → chunk-W4W75MSO.cjs} +134 -25
  30. package/dist/chunk-W4W75MSO.cjs.map +1 -0
  31. package/dist/chunk-WABJGKVA.cjs +246 -0
  32. package/dist/chunk-WABJGKVA.cjs.map +1 -0
  33. package/dist/databases.js.map +2 -2
  34. package/dist/directmessages/DmComposer.js +26 -10
  35. package/dist/directmessages/DmComposer.js.map +2 -2
  36. package/dist/directmessages/index.js +2 -0
  37. package/dist/directmessages/index.js.map +2 -2
  38. package/dist/directmessages/useChats.js +11 -0
  39. package/dist/directmessages/useChats.js.map +2 -2
  40. package/dist/document-tools/core.cjs +100 -100
  41. package/dist/document-tools/core.d.ts +2 -2
  42. package/dist/document-tools/index.cjs +102 -102
  43. package/dist/document-tools/index.d.ts +2 -2
  44. package/dist/entities/DocumentEntity.js +8 -3
  45. package/dist/entities/DocumentEntity.js.map +2 -2
  46. package/dist/entities/EntityActionsMenu.js +53 -0
  47. package/dist/entities/EntityActionsMenu.js.map +7 -0
  48. package/dist/entities/EntityPill.js +50 -16
  49. package/dist/entities/EntityPill.js.map +2 -2
  50. package/dist/entities/ProjectEntity.js +4 -0
  51. package/dist/entities/ProjectEntity.js.map +2 -2
  52. package/dist/entities/TagEntity.js +1 -0
  53. package/dist/entities/TagEntity.js.map +2 -2
  54. package/dist/entities/UserEntity.js +25 -3
  55. package/dist/entities/UserEntity.js.map +2 -2
  56. package/dist/entities/links.js +9 -0
  57. package/dist/entities/links.js.map +7 -0
  58. package/dist/entities/reference-data.js +56 -0
  59. package/dist/entities/reference-data.js.map +7 -0
  60. package/dist/{file-shares.d-Bwy9k3Db.d.ts → file-shares.d-Dlt7pKRi.d.ts} +3 -0
  61. package/dist/host/config.js.map +2 -2
  62. package/dist/index.cjs +1836 -1748
  63. package/dist/index.cjs.map +1 -1
  64. package/dist/{index.d-Dy_Pz6Vl.d.ts → index.d-BaZUctD1.d.ts} +34 -10
  65. package/dist/index.d.ts +164 -20
  66. package/dist/index.js +5 -0
  67. package/dist/index.js.map +2 -2
  68. package/dist/query-keys.js +3 -0
  69. package/dist/query-keys.js.map +2 -2
  70. package/dist/session/conversation-panels.js +5 -3
  71. package/dist/session/conversation-panels.js.map +2 -2
  72. package/dist/session/layout.js +5 -0
  73. package/dist/session/layout.js.map +2 -2
  74. package/dist/shell/index.cjs +37 -37
  75. package/dist/{stored-markdown.d-Bp18vrbr.d.ts → stored-markdown.d-BLQPny3e.d.ts} +21 -1
  76. package/dist/ui/index.cjs +155 -151
  77. package/dist/ui/index.d.ts +1 -1
  78. package/dist/ui/index.js +2 -0
  79. package/dist/ui/index.js.map +2 -2
  80. package/dist/viewers/AudioViewer.js +13 -3
  81. package/dist/viewers/AudioViewer.js.map +2 -2
  82. package/dist/viewers/MediaTranscriptPlayer.js +171 -0
  83. package/dist/viewers/MediaTranscriptPlayer.js.map +7 -0
  84. package/dist/viewers/VideoViewer.js +4 -11
  85. package/dist/viewers/VideoViewer.js.map +2 -2
  86. package/dist/viewers/index.cjs +8 -4
  87. package/dist/viewers/index.d.ts +17 -3
  88. package/dist/viewers/index.js +2 -0
  89. package/dist/viewers/index.js.map +2 -2
  90. package/package.json +3 -3
  91. package/dist/chunk-6HJZCIND.cjs.map +0 -1
  92. package/dist/chunk-SUMXDNYG.cjs.map +0 -1
  93. package/dist/chunk-TMPDW7J5.cjs +0 -79
  94. package/dist/chunk-TMPDW7J5.cjs.map +0 -1
  95. package/dist/chunk-WJIRX5MS.cjs.map +0 -1
  96. package/dist/chunk-ZZBCZRA5.cjs.map +0 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/entities/UserEntity.tsx"],
4
- "sourcesContent": ["/**\n * UserEntity Component\n *\n * Single source of truth for the user pill/avatar visual, promoted from the ARBI\n * app and DECOUPLED from the app store/API. It renders purely from injected,\n * already-resolved props \u2014 the app-coupled bits (current user, WebSocket presence\n * status, shared-workspace / agent-owner lookups) are resolved by the app adapter\n * and passed in as `isMe` / `displayStatus` / `tooltipContent` / `onClick`.\n *\n * Variants:\n * - pill: Avatar + name in a rounded container (default)\n * - icon: Avatar circle with hover tooltip\n *\n * Status-dot colours use the semantic `--color-status-*` token contract (see the\n * consuming app's @theme); they are seeded to the app's prior palette so the dots\n * stay pixel-identical.\n */\n\nimport React, { memo } from 'react'\nimport { MessageCircleMore } from 'lucide-react'\nimport { Avatar, AvatarFallback, AvatarImage } from '../ui/avatar'\nimport { ArbiBotHeadIcon } from '../icons/ArbiBotHeadIcon'\nimport { VerifiedBadge } from './VerifiedBadge'\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../ui/tooltip'\nimport { cn } from '../lib/utils'\nimport type { EntitySize } from './EntityPill'\n\n/** Presence display status - WebSocket states plus 'hidden' for when status is intentionally not shown */\nexport type PresenceDisplayStatus = 'connected' | 'connecting' | 'disconnected' | 'error' | 'hidden'\n\nexport interface UserEntityProps {\n size?: EntitySize\n variant?: 'icon' | 'pill'\n className?: string\n /** When true (default), shows tooltip on hover */\n showTooltip?: boolean\n /** When true (default), clicking triggers the injected action. Set false to disable interaction. */\n interactive?: boolean\n\n /** Two-letter initials shown in the avatar fallback (resolved by the app). */\n initials?: string\n /** Display label \u2014 \"You\" for the current user, else the real name. */\n displayName?: string\n /** Avatar image URL, if any. */\n picture?: string | null\n /** Optional image treatment for platform logos inside the normal avatar. */\n avatarImageClassName?: string\n /** Avatar background colour class for non-agents (e.g. 'bg-blue-500'). */\n colorClass?: string\n /** Whether this user is an agent \u2014 drives the dashed ring + bot badge. */\n isAgent?: boolean\n /** Verified tick (passed an ID check under this name): a badge after the name in the pill. */\n isVerified?: boolean\n /** Inline border/text colour for agent avatars (from the app's agentAvatarColors). */\n agentStyle?: React.CSSProperties\n /**\n * Inline avatar colours for ANY user, not only agents \u2014 e.g. the deterministic\n * tint the DM rows derive from the user id. Takes precedence over\n * `agentStyle`, which predates it and is the same mechanism under a narrower\n * name.\n */\n avatarStyle?: React.CSSProperties\n /** Whether this pill represents the current user \u2014 hides the chat icon and drives\n * which action `onClick` performs. */\n isMe?: boolean\n /** Resolved presence dot state; undefined hides the dot. */\n displayStatus?: PresenceDisplayStatus\n /** Resolved click handler (open settings for me, DM for others). */\n onClick?: (e: React.MouseEvent) => void\n /** Injected rich tooltip content (built by the app adapter). */\n tooltipContent?: React.ReactNode\n /** Render the empty \"no user\" avatar. */\n empty?: boolean\n}\n\nconst sizeClasses = {\n xs: 'h-5 w-5',\n sm: 'h-6 w-6',\n md: 'h-8 w-8',\n lg: 'h-10 w-10',\n}\n\nconst textSizeClasses = {\n xs: 'text-xs',\n sm: 'text-xs',\n md: 'text-xs',\n lg: 'text-sm',\n}\n\n// Presence dot sizes proportional to avatar size (larger for better visibility)\nconst presenceDotClasses = {\n xs: 'w-2 h-2 border',\n sm: 'w-2.5 h-2.5 border',\n md: 'w-3 h-3 border-2',\n lg: 'w-3.5 h-3.5 border-2',\n}\n\n// Position the presence dot at edge of avatar\nconst presencePositionClasses = {\n xs: '-right-1 bottom-0',\n sm: '-right-1 bottom-0',\n md: '-right-1.5 -bottom-0.5',\n lg: '-right-1.5 -bottom-0.5',\n}\n\n// Presence colours \u2014 semantic status tokens seeded to the app's prior palette\n// (matches the sidebar's connection-status colours).\n/** Accessible name for each dot state \u2014 the same wording PresenceLabel prints. */\nconst PRESENCE_LABELS: Record<PresenceDisplayStatus, string> = {\n connected: 'Online',\n connecting: 'Connecting',\n disconnected: 'Offline',\n error: 'Connection problem',\n hidden: 'Status hidden',\n}\n\nconst presenceColorClasses: Record<PresenceDisplayStatus, string> = {\n connected: 'bg-status-online',\n connecting: 'bg-status-connecting',\n disconnected: 'bg-status-away',\n error: 'bg-status-busy',\n hidden: 'bg-status-offline',\n}\n\nexport const UserEntity = memo(function UserEntity({\n size = 'md',\n variant = 'pill',\n className,\n showTooltip = true,\n interactive = true,\n initials = '',\n displayName = '',\n picture,\n avatarImageClassName,\n colorClass = '',\n isAgent = false,\n isVerified = false,\n agentStyle,\n avatarStyle,\n isMe = false,\n displayStatus,\n onClick,\n tooltipContent,\n empty = false,\n}: UserEntityProps) {\n // Empty state - no user\n if (empty) {\n return (\n <Avatar\n className={cn(sizeClasses[size], 'border border-border', className)}\n data-testid=\"user-entity\"\n >\n <AvatarFallback className=\"bg-status-empty text-muted-foreground text-xs font-semibold\">\n ?\n </AvatarFallback>\n </Avatar>\n )\n }\n\n const agentBadge = isAgent ? (\n <ArbiBotHeadIcon className=\"w-3.5 h-3.5 text-muted-foreground\" />\n ) : undefined\n\n // Messaging another user: the pill avatar doubles as the affordance \u2014 on hover it\n // swaps to a chat icon (see pillAvatar below).\n const canMessage = interactive && !isMe && !isAgent\n\n // One resolved inline style for the avatar surface. `agentStyle` was always\n // applied regardless of `isAgent`; `avatarStyle` is the same thing named for\n // what it does, so a non-agent tint no longer has to masquerade as one.\n const surfaceStyle = avatarStyle ?? agentStyle\n\n // Core avatar element - used in both icon and pill variants\n const avatarCore = (\n <Avatar\n className={cn(\n sizeClasses[size],\n isAgent ? 'rounded-full border-2 border-dashed' : 'border border-white'\n )}\n style={surfaceStyle}\n data-testid=\"user-entity\"\n >\n {picture && <AvatarImage src={picture} alt={initials} className={avatarImageClassName} />}\n <AvatarFallback\n className={cn(\n textSizeClasses[size],\n 'font-semibold leading-none',\n isAgent ? 'rounded-full bg-transparent' : `text-white ${colorClass}`\n )}\n style={surfaceStyle}\n >\n {initials}\n </AvatarFallback>\n </Avatar>\n )\n\n // Bottom-right avatar dot: the presence colour (green/grey/\u2026).\n const statusDot = displayStatus ? (\n <span\n className={cn(\n 'absolute rounded-full border-white',\n presenceDotClasses[size],\n presencePositionClasses[size],\n presenceColorClasses[displayStatus]\n )}\n data-testid=\"user-entity-presence\"\n // Named, not just coloured: a colour is legible only to someone who\n // already knows the convention, and to nobody using a screen reader.\n role=\"img\"\n aria-label={PRESENCE_LABELS[displayStatus]}\n title={PRESENCE_LABELS[displayStatus]}\n />\n ) : null\n\n // Icon variant avatar (used in stacks/columns) \u2014 avatar + optional status dot.\n // Inline-block at avatar size so a parent ring stays circular.\n const avatarElement = statusDot ? (\n <div\n className={cn(\n 'relative inline-block',\n sizeClasses[size],\n variant === 'pill' ? '' : className\n )}\n >\n {avatarCore}\n {statusDot}\n </div>\n ) : (\n <div className={cn('inline-block', variant === 'pill' ? '' : className)}>{avatarCore}</div>\n )\n\n // Pill variant avatar \u2014 the avatar itself IS the message affordance: on hover it\n // swaps to a chat icon (for other users), with the status dot pinned bottom-right.\n const pillAvatar = (\n // shrink-0: when the pill is squeezed the NAME truncates away \u2014 the avatar\n // must never collapse under it and overflow onto neighbouring text.\n <span className={cn('relative inline-block shrink-0', sizeClasses[size])}>\n <span className={cn('block transition-opacity', canMessage && 'group-hover/pill:opacity-0')}>\n {avatarCore}\n </span>\n {canMessage && (\n <span\n aria-hidden\n className=\"absolute inset-0 flex items-center justify-center rounded-full bg-muted text-foreground opacity-0 transition-opacity group-hover/pill:opacity-100\"\n >\n <MessageCircleMore className={size === 'xs' ? 'h-3 w-3' : 'h-4 w-4'} />\n </span>\n )}\n {statusDot}\n </span>\n )\n\n const resolvedTooltip = showTooltip ? tooltipContent : undefined\n\n // Pill variant \u2014 clean, borderless avatar + name (no container chrome). The avatar\n // itself is the message affordance (hover \u2192 chat icon); unread + presence share one\n // bottom-right dot. Only the agent badge trails the name. Interactivity + tooltip\n // are layered with no resting background \u2014 a subtle hover fill signals the target.\n if (variant === 'pill') {\n const row = (\n <>\n {pillAvatar}\n {displayName && (\n <span className=\"min-w-0 max-w-[320px] truncate text-sm leading-tight\">\n {displayName}\n </span>\n )}\n {isVerified && !isAgent && <VerifiedBadge />}\n {agentBadge}\n </>\n )\n const rowClass = 'group/pill inline-flex min-w-0 items-center gap-2'\n const clickable = interactive && !!onClick\n const clickableClass =\n \"relative cursor-pointer rounded-md px-1 py-0.5 -mx-1 transition-colors hover:bg-muted/60 pointer-coarse:after:absolute pointer-coarse:after:inset-x-0 pointer-coarse:after:-inset-y-3 pointer-coarse:after:content-['']\"\n\n if (resolvedTooltip) {\n return (\n <Tooltip>\n <TooltipTrigger\n type=\"button\"\n onClick={clickable ? onClick : undefined}\n onFocusCapture={(e) => e.stopPropagation()}\n className={cn(rowClass, clickable && clickableClass, className)}\n data-testid=\"user-entity-pill\"\n >\n {row}\n </TooltipTrigger>\n <TooltipContent className=\"p-2\">{resolvedTooltip}</TooltipContent>\n </Tooltip>\n )\n }\n\n if (clickable) {\n return (\n <button\n type=\"button\"\n onClick={onClick}\n className={cn(rowClass, clickableClass, className)}\n data-testid=\"user-entity-pill\"\n >\n {row}\n </button>\n )\n }\n\n return (\n <span className={cn(rowClass, className)} data-testid=\"user-entity-pill\">\n {row}\n </span>\n )\n }\n\n // Icon variant - always non-interactive, just show avatar with optional tooltip\n // Note: avoid asChild here \u2014 Radix ref merging with Avatar's internal refs causes infinite loops\n if (showTooltip) {\n return (\n <Tooltip>\n <TooltipTrigger\n onFocusCapture={(e) => e.stopPropagation()}\n className=\"touch-hit inline-flex\"\n >\n {avatarElement}\n </TooltipTrigger>\n <TooltipContent className=\"p-2\">{tooltipContent}</TooltipContent>\n </Tooltip>\n )\n }\n\n return avatarElement\n})\n"],
5
- "mappings": "AAwJQ,SA4GF,UA5GE,KAsBJ,YAtBI;AAtIR,SAAgB,YAAY;AAC5B,SAAS,yBAAyB;AAClC,SAAS,QAAQ,gBAAgB,mBAAmB;AACpD,SAAS,uBAAuB;AAChC,SAAS,qBAAqB;AAC9B,SAAS,SAAS,gBAAgB,sBAAsB;AACxD,SAAS,UAAU;AAmDnB,MAAM,cAAc;AAAA,EAClB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,MAAM,kBAAkB;AAAA,EACtB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;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ACJ,iCACG;AAAA;AAAA,MACA,eACC,oBAAC,UAAK,WAAU,wDACb,uBACH;AAAA,MAED,cAAc,CAAC,WAAW,oBAAC,iBAAc;AAAA,MACzC;AAAA,OACH;AAEF,UAAM,WAAW;AACjB,UAAM,YAAY,eAAe,CAAC,CAAC;AACnC,UAAM,iBACJ;AAEF,QAAI,iBAAiB;AACnB,aACE,qBAAC,WACC;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,SAAS,YAAY,UAAU;AAAA,YAC/B,gBAAgB,CAAC,MAAM,EAAE,gBAAgB;AAAA,YACzC,WAAW,GAAG,UAAU,aAAa,gBAAgB,SAAS;AAAA,YAC9D,eAAY;AAAA,YAEX;AAAA;AAAA,QACH;AAAA,QACA,oBAAC,kBAAe,WAAU,OAAO,2BAAgB;AAAA,SACnD;AAAA,IAEJ;AAEA,QAAI,WAAW;AACb,aACE;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL;AAAA,UACA,WAAW,GAAG,UAAU,gBAAgB,SAAS;AAAA,UACjD,eAAY;AAAA,UAEX;AAAA;AAAA,MACH;AAAA,IAEJ;AAEA,WACE,oBAAC,UAAK,WAAW,GAAG,UAAU,SAAS,GAAG,eAAY,oBACnD,eACH;AAAA,EAEJ;AAIA,MAAI,aAAa;AACf,WACE,qBAAC,WACC;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,gBAAgB,CAAC,MAAM,EAAE,gBAAgB;AAAA,UACzC,WAAU;AAAA,UAET;AAAA;AAAA,MACH;AAAA,MACA,oBAAC,kBAAe,WAAU,OAAO,0BAAe;AAAA,OAClD;AAAA,EAEJ;AAEA,SAAO;AACT,CAAC;",
4
+ "sourcesContent": ["/**\n * UserEntity Component\n *\n * Single source of truth for the user pill/avatar visual, promoted from the ARBI\n * app and DECOUPLED from the app store/API. It renders purely from injected,\n * already-resolved props \u2014 the app-coupled bits (current user, WebSocket presence\n * status, shared-workspace / agent-owner lookups) are resolved by the app adapter\n * and passed in as `isMe` / `displayStatus` / `tooltipContent` / `onClick`.\n *\n * Variants:\n * - pill: Avatar + name in a rounded container (default)\n * - icon: Avatar circle with hover tooltip\n *\n * Status-dot colours use the semantic `--color-status-*` token contract (see the\n * consuming app's @theme); they are seeded to the app's prior palette so the dots\n * stay pixel-identical.\n */\n\nimport React, { memo } from 'react'\nimport { MessageCircleMore } from 'lucide-react'\nimport { Avatar, AvatarFallback, AvatarImage } from '../ui/avatar'\nimport { ArbiBotHeadIcon } from '../icons/ArbiBotHeadIcon'\nimport { VerifiedBadge } from './VerifiedBadge'\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../ui/tooltip'\nimport { cn } from '../lib/utils'\nimport { useEntityHref } from './links'\nimport { EntityPill, type EntitySize } from './EntityPill'\n\n/** Presence display status - WebSocket states plus 'hidden' for when status is intentionally not shown */\nexport type PresenceDisplayStatus = 'connected' | 'connecting' | 'disconnected' | 'error' | 'hidden'\n\nexport interface UserEntityProps {\n size?: EntitySize\n variant?: 'icon' | 'pill'\n className?: string\n /** When true (default), shows tooltip on hover */\n showTooltip?: boolean\n /** When true (default), clicking triggers the injected action. Set false to disable interaction. */\n interactive?: boolean\n\n /** Two-letter initials shown in the avatar fallback (resolved by the app). */\n initials?: string\n /** Display label \u2014 \"You\" for the current user, else the real name. */\n displayName?: string\n /** Avatar image URL, if any. */\n picture?: string | null\n /** Optional image treatment for platform logos inside the normal avatar. */\n avatarImageClassName?: string\n /** Avatar background colour class for non-agents (e.g. 'bg-blue-500'). */\n colorClass?: string\n /** Whether this user is an agent \u2014 drives the dashed ring + bot badge. */\n isAgent?: boolean\n /** Verified tick (passed an ID check under this name): a badge after the name in the pill. */\n isVerified?: boolean\n /** Inline border/text colour for agent avatars (from the app's agentAvatarColors). */\n agentStyle?: React.CSSProperties\n /**\n * Inline avatar colours for ANY user, not only agents \u2014 e.g. the deterministic\n * tint the DM rows derive from the user id. Takes precedence over\n * `agentStyle`, which predates it and is the same mechanism under a narrower\n * name.\n */\n avatarStyle?: React.CSSProperties\n /** Whether this pill represents the current user \u2014 hides the chat icon and drives\n * which action `onClick` performs. */\n isMe?: boolean\n /** Resolved presence dot state; undefined hides the dot. */\n displayStatus?: PresenceDisplayStatus\n /** Resolved click handler (open settings for me, DM for others). */\n onClick?: (e: React.MouseEvent) => void\n /** Injected rich tooltip content (built by the app adapter). */\n tooltipContent?: React.ReactNode\n /** Render the empty \"no user\" avatar. */\n empty?: boolean\n copyHref?: string\n entityId?: string\n}\n\nconst sizeClasses = {\n xs: 'h-5 w-5',\n sm: 'h-6 w-6',\n md: 'h-8 w-8',\n lg: 'h-10 w-10',\n}\n\nconst textSizeClasses = {\n xs: 'text-xs',\n sm: 'text-xs',\n md: 'text-xs',\n lg: 'text-sm',\n}\n\n// Presence dot sizes proportional to avatar size (larger for better visibility)\nconst presenceDotClasses = {\n xs: 'w-2 h-2 border',\n sm: 'w-2.5 h-2.5 border',\n md: 'w-3 h-3 border-2',\n lg: 'w-3.5 h-3.5 border-2',\n}\n\n// Position the presence dot at edge of avatar\nconst presencePositionClasses = {\n xs: '-right-1 bottom-0',\n sm: '-right-1 bottom-0',\n md: '-right-1.5 -bottom-0.5',\n lg: '-right-1.5 -bottom-0.5',\n}\n\n// Presence colours \u2014 semantic status tokens seeded to the app's prior palette\n// (matches the sidebar's connection-status colours).\n/** Accessible name for each dot state \u2014 the same wording PresenceLabel prints. */\nconst PRESENCE_LABELS: Record<PresenceDisplayStatus, string> = {\n connected: 'Online',\n connecting: 'Connecting',\n disconnected: 'Offline',\n error: 'Connection problem',\n hidden: 'Status hidden',\n}\n\nconst presenceColorClasses: Record<PresenceDisplayStatus, string> = {\n connected: 'bg-status-online',\n connecting: 'bg-status-connecting',\n disconnected: 'bg-status-away',\n error: 'bg-status-busy',\n hidden: 'bg-status-offline',\n}\n\nexport const UserEntity = memo(function UserEntity({\n size = 'md',\n variant = 'pill',\n className,\n showTooltip = true,\n interactive = true,\n initials = '',\n displayName = '',\n picture,\n avatarImageClassName,\n colorClass = '',\n isAgent = false,\n isVerified = false,\n agentStyle,\n avatarStyle,\n isMe = false,\n displayStatus,\n onClick,\n tooltipContent,\n empty = false,\n copyHref,\n entityId,\n}: UserEntityProps) {\n const entityHref = useEntityHref(entityId)\n // Empty state - no user\n if (empty) {\n return (\n <Avatar\n className={cn(sizeClasses[size], 'border border-border', className)}\n data-testid=\"user-entity\"\n >\n <AvatarFallback className=\"bg-status-empty text-muted-foreground text-xs font-semibold\">\n ?\n </AvatarFallback>\n </Avatar>\n )\n }\n\n const agentBadge = isAgent ? (\n <ArbiBotHeadIcon className=\"w-3.5 h-3.5 text-muted-foreground\" />\n ) : undefined\n\n // Messaging another user: the pill avatar doubles as the affordance \u2014 on hover it\n // swaps to a chat icon (see pillAvatar below).\n const canMessage = interactive && !isMe && !isAgent\n\n // One resolved inline style for the avatar surface. `agentStyle` was always\n // applied regardless of `isAgent`; `avatarStyle` is the same thing named for\n // what it does, so a non-agent tint no longer has to masquerade as one.\n const surfaceStyle = avatarStyle ?? agentStyle\n\n // Core avatar element - used in both icon and pill variants\n const avatarCore = (\n <Avatar\n className={cn(\n sizeClasses[size],\n isAgent ? 'rounded-full border-2 border-dashed' : 'border border-white'\n )}\n style={surfaceStyle}\n data-testid=\"user-entity\"\n >\n {picture && <AvatarImage src={picture} alt={initials} className={avatarImageClassName} />}\n <AvatarFallback\n className={cn(\n textSizeClasses[size],\n 'font-semibold leading-none',\n isAgent ? 'rounded-full bg-transparent' : `text-white ${colorClass}`\n )}\n style={surfaceStyle}\n >\n {initials}\n </AvatarFallback>\n </Avatar>\n )\n\n // Bottom-right avatar dot: the presence colour (green/grey/\u2026).\n const statusDot = displayStatus ? (\n <span\n className={cn(\n 'absolute rounded-full border-white',\n presenceDotClasses[size],\n presencePositionClasses[size],\n presenceColorClasses[displayStatus]\n )}\n data-testid=\"user-entity-presence\"\n // Named, not just coloured: a colour is legible only to someone who\n // already knows the convention, and to nobody using a screen reader.\n role=\"img\"\n aria-label={PRESENCE_LABELS[displayStatus]}\n title={PRESENCE_LABELS[displayStatus]}\n />\n ) : null\n\n // Icon variant avatar (used in stacks/columns) \u2014 avatar + optional status dot.\n // Inline-block at avatar size so a parent ring stays circular.\n const avatarElement = statusDot ? (\n <div\n className={cn(\n 'relative inline-block',\n sizeClasses[size],\n variant === 'pill' ? '' : className\n )}\n >\n {avatarCore}\n {statusDot}\n </div>\n ) : (\n <div className={cn('inline-block', variant === 'pill' ? '' : className)}>{avatarCore}</div>\n )\n\n // Pill variant avatar \u2014 the avatar itself IS the message affordance: on hover it\n // swaps to a chat icon (for other users), with the status dot pinned bottom-right.\n const pillAvatar = (\n // shrink-0: when the pill is squeezed the NAME truncates away \u2014 the avatar\n // must never collapse under it and overflow onto neighbouring text.\n <span className={cn('relative inline-block shrink-0', sizeClasses[size])}>\n <span className={cn('block transition-opacity', canMessage && 'group-hover/pill:opacity-0')}>\n {avatarCore}\n </span>\n {canMessage && (\n <span\n aria-hidden\n className=\"absolute inset-0 flex items-center justify-center rounded-full bg-muted text-foreground opacity-0 transition-opacity group-hover/pill:opacity-100\"\n >\n <MessageCircleMore className={size === 'xs' ? 'h-3 w-3' : 'h-4 w-4'} />\n </span>\n )}\n {statusDot}\n </span>\n )\n\n const resolvedTooltip = showTooltip ? tooltipContent : undefined\n\n // Pill variant \u2014 clean, borderless avatar + name (no container chrome). The avatar\n // itself is the message affordance (hover \u2192 chat icon); unread + presence share one\n // bottom-right dot. Only the agent badge trails the name. Interactivity + tooltip\n // are layered with no resting background \u2014 a subtle hover fill signals the target.\n if (variant === 'pill' && (copyHref || entityHref))\n return (\n <span data-variant=\"pill\">\n <EntityPill\n icon={pillAvatar}\n label={displayName || 'Person'}\n secondaryText={\n <>\n {isVerified && !isAgent && <VerifiedBadge />}\n {agentBadge}\n </>\n }\n copyHref={copyHref || entityHref}\n onClick={interactive ? onClick : undefined}\n tooltipContent={resolvedTooltip}\n className={className}\n data-testid=\"user-entity-pill\"\n />\n </span>\n )\n if (variant === 'pill') {\n const row = (\n <>\n {pillAvatar}\n {displayName && (\n <span className=\"min-w-0 max-w-[320px] truncate text-sm font-medium tracking-[0.01em] underline decoration-dotted decoration-current/35 underline-offset-4 leading-tight\">\n {displayName}\n </span>\n )}\n {isVerified && !isAgent && <VerifiedBadge />}\n {agentBadge}\n </>\n )\n const rowClass = 'group/pill inline-flex min-w-0 items-center gap-2'\n const clickable = interactive && !!onClick\n const clickableClass =\n \"relative cursor-pointer rounded-md px-1 py-0.5 -mx-1 transition-colors pointer-coarse:after:absolute pointer-coarse:after:inset-x-0 pointer-coarse:after:-inset-y-3 pointer-coarse:after:content-['']\"\n\n if (resolvedTooltip) {\n return (\n <Tooltip>\n <TooltipTrigger\n type=\"button\"\n onClick={clickable ? onClick : undefined}\n onFocusCapture={(e) => e.stopPropagation()}\n className={cn(rowClass, clickable && clickableClass, className)}\n data-testid=\"user-entity-pill\"\n >\n {row}\n </TooltipTrigger>\n <TooltipContent className=\"p-2\">{resolvedTooltip}</TooltipContent>\n </Tooltip>\n )\n }\n\n if (clickable) {\n return (\n <button\n type=\"button\"\n onClick={onClick}\n className={cn(rowClass, clickableClass, className)}\n data-testid=\"user-entity-pill\"\n >\n {row}\n </button>\n )\n }\n\n return (\n <span className={cn(rowClass, className)} data-testid=\"user-entity-pill\">\n {row}\n </span>\n )\n }\n\n // Icon variant - always non-interactive, just show avatar with optional tooltip\n // Note: avoid asChild here \u2014 Radix ref merging with Avatar's internal refs causes infinite loops\n if (showTooltip) {\n return (\n <Tooltip>\n <TooltipTrigger\n onFocusCapture={(e) => e.stopPropagation()}\n className=\"touch-hit inline-flex\"\n >\n {avatarElement}\n </TooltipTrigger>\n <TooltipContent className=\"p-2\">{tooltipContent}</TooltipContent>\n </Tooltip>\n )\n }\n\n return avatarElement\n})\n"],
5
+ "mappings": "AA8JQ,SAiHI,UAjHJ,KAsBJ,YAtBI;AA5IR,SAAgB,YAAY;AAC5B,SAAS,yBAAyB;AAClC,SAAS,QAAQ,gBAAgB,mBAAmB;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AAAA,SACnD;AAAA,IAEJ;AAEA,QAAI,WAAW;AACb,aACE;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL;AAAA,UACA,WAAW,GAAG,UAAU,gBAAgB,SAAS;AAAA,UACjD,eAAY;AAAA,UAEX;AAAA;AAAA,MACH;AAAA,IAEJ;AAEA,WACE,oBAAC,UAAK,WAAW,GAAG,UAAU,SAAS,GAAG,eAAY,oBACnD,eACH;AAAA,EAEJ;AAIA,MAAI,aAAa;AACf,WACE,qBAAC,WACC;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,gBAAgB,CAAC,MAAM,EAAE,gBAAgB;AAAA,UACzC,WAAU;AAAA,UAET;AAAA;AAAA,MACH;AAAA,MACA,oBAAC,kBAAe,WAAU,OAAO,0BAAe;AAAA,OAClD;AAAA,EAEJ;AAEA,SAAO;AACT,CAAC;",
6
6
  "names": ["UserEntity"]
7
7
  }
@@ -0,0 +1,9 @@
1
+ import { useHostConfigRecord } from "../host/context.js";
2
+ function useEntityHref(id) {
3
+ const links = useHostConfigRecord().entities;
4
+ return id ? links?.hrefFor(id) : void 0;
5
+ }
6
+ export {
7
+ useEntityHref
8
+ };
9
+ //# sourceMappingURL=links.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/entities/links.ts"],
4
+ "sourcesContent": ["import { useHostConfigRecord } from '../host/context'\n\n/** A host supplies addresses once; presentation components never invent router paths. */\nexport interface EntityLinks {\n hrefFor: (id: string) => string | undefined\n}\nexport function useEntityHref(id?: string) {\n const links = useHostConfigRecord().entities as EntityLinks | undefined\n return id ? links?.hrefFor(id) : undefined\n}\n"],
5
+ "mappings": "AAAA,SAAS,2BAA2B;AAM7B,SAAS,cAAc,IAAa;AACzC,QAAM,QAAQ,oBAAoB,EAAE;AACpC,SAAO,KAAK,OAAO,QAAQ,EAAE,IAAI;AACnC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,56 @@
1
+ import { useQuery } from "@tanstack/react-query";
2
+ import { useArbiHost } from "../host/config.js";
3
+ import { arbiQueryKeys, calendarQueryKeys, callQueryKeys } from "../query-keys.js";
4
+ function useEntityReferenceTitle(id, workspaceId, enabled = true) {
5
+ const arbi = useArbiHost().arbi;
6
+ const prefix = id.split("-")[0];
7
+ const query = useQuery({
8
+ queryKey: prefix === "evt" ? [...calendarQueryKeys.event(id), "reference"] : prefix === "call" ? [...callQueryKeys.call(id), "reference"] : arbiQueryKeys.entityReference(workspaceId, id),
9
+ enabled: !!arbi?.isLoggedIn && enabled,
10
+ retry: false,
11
+ staleTime: 6e4,
12
+ queryFn: async () => {
13
+ if (!arbi) return null;
14
+ if (prefix === "evt") return (await arbi.calendar.getEvent(id)).title || null;
15
+ if (prefix === "call") {
16
+ const call = await arbi.calls.get(id);
17
+ return arbi.calls.title(call, await arbi.calls.key(call));
18
+ }
19
+ if (prefix === "con")
20
+ return (await arbi.conversations.list({ workspaceId: workspaceId ?? void 0 })).find(
21
+ (c) => c.external_id === id
22
+ )?.title || null;
23
+ if (!workspaceId) return null;
24
+ return arbi.readInWorkspace(workspaceId, async () => {
25
+ switch (prefix) {
26
+ case "pag":
27
+ return (await arbi.pages.get(id)).spec?.title || null;
28
+ case "dbs":
29
+ return (await arbi.databases.get(id)).name || null;
30
+ case "wfl":
31
+ return (await arbi.workflows.get(id)).name || null;
32
+ case "viw":
33
+ return (await arbi.views.get(id)).spec.name || null;
34
+ default:
35
+ return null;
36
+ }
37
+ });
38
+ }
39
+ });
40
+ return query.data;
41
+ }
42
+ function useReferencedDocuments(workspaceId) {
43
+ const arbi = useArbiHost().arbi;
44
+ return useQuery({
45
+ queryKey: arbiQueryKeys.referenceDocuments(workspaceId),
46
+ queryFn: () => arbi.documents.list({ workspaceId }),
47
+ enabled: !!arbi?.isLoggedIn,
48
+ retry: false,
49
+ staleTime: 6e4
50
+ });
51
+ }
52
+ export {
53
+ useEntityReferenceTitle,
54
+ useReferencedDocuments
55
+ };
56
+ //# sourceMappingURL=reference-data.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/entities/reference-data.ts"],
4
+ "sourcesContent": ["import { useQuery } from '@tanstack/react-query'\nimport { useArbiHost } from '../host/config'\nimport { arbiQueryKeys, calendarQueryKeys, callQueryKeys } from '../query-keys'\n\n/** Read labels without opening content, delegating keys or changing workspace. */\nexport function useEntityReferenceTitle(\n id: string,\n workspaceId: string | null | undefined,\n enabled = true\n): string | null | undefined {\n const arbi = useArbiHost().arbi\n const prefix = id.split('-')[0]\n const query = useQuery({\n queryKey:\n prefix === 'evt'\n ? [...calendarQueryKeys.event(id), 'reference']\n : prefix === 'call'\n ? [...callQueryKeys.call(id), 'reference']\n : arbiQueryKeys.entityReference(workspaceId, id),\n enabled: !!arbi?.isLoggedIn && enabled,\n retry: false,\n staleTime: 60_000,\n queryFn: async (): Promise<string | null> => {\n if (!arbi) return null\n if (prefix === 'evt') return (await arbi.calendar.getEvent(id)).title || null\n if (prefix === 'call') {\n const call = await arbi.calls.get(id)\n return arbi.calls.title(call, await arbi.calls.key(call))\n }\n if (prefix === 'con')\n return (\n (await arbi.conversations.list({ workspaceId: workspaceId ?? undefined })).find(\n (c) => c.external_id === id\n )?.title || null\n )\n if (!workspaceId) return null\n return arbi.readInWorkspace(workspaceId, async () => {\n switch (prefix) {\n case 'pag':\n return (await arbi.pages.get(id)).spec?.title || null\n case 'dbs':\n return (await arbi.databases.get(id)).name || null\n case 'wfl':\n return (await arbi.workflows.get(id)).name || null\n case 'viw':\n return (await arbi.views.get(id)).spec.name || null\n default:\n return null\n }\n })\n },\n })\n return query.data\n}\n\n/** A shared, explicitly scoped list resolves document references without changing the open workspace. */\nexport function useReferencedDocuments(workspaceId: string) {\n const arbi = useArbiHost().arbi\n return useQuery({\n queryKey: arbiQueryKeys.referenceDocuments(workspaceId),\n queryFn: () => arbi!.documents.list({ workspaceId }),\n enabled: !!arbi?.isLoggedIn,\n retry: false,\n staleTime: 60_000,\n })\n}\n"],
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AAQ;AAAA,UAChD,KAAK;AACH,oBAAQ,MAAM,KAAK,MAAM,IAAI,EAAE,GAAG,KAAK,QAAQ;AAAA,UACjD;AACE,mBAAO;AAAA,QACX;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AACD,SAAO,MAAM;AACf;AAGO,SAAS,uBAAuB,aAAqB;AAC1D,QAAM,OAAO,YAAY,EAAE;AAC3B,SAAO,SAAS;AAAA,IACd,UAAU,cAAc,mBAAmB,WAAW;AAAA,IACtD,SAAS,MAAM,KAAM,UAAU,KAAK,EAAE,YAAY,CAAC;AAAA,IACnD,SAAS,CAAC,CAAC,MAAM;AAAA,IACjB,OAAO;AAAA,IACP,WAAW;AAAA,EACb,CAAC;AACH;",
6
+ "names": []
7
+ }
@@ -14,6 +14,8 @@ import { ReactNode } from 'react';
14
14
  */
15
15
 
16
16
  declare const arbiQueryKeys: {
17
+ entityReference: (workspaceId: string | null | undefined, id: string) => readonly ["arbi", "entity-reference", string | null, string];
18
+ referenceDocuments: (workspaceId: string) => readonly ["arbi", "documents", string, "reference"];
17
19
  fileShares: () => readonly ["arbi", "fileShares"];
18
20
  fileShare: (id: string) => readonly ["arbi", "fileShare", string];
19
21
  fileSharePdf: (id: string, status?: string) => readonly ["arbi", "fileSharePdf", string, string | undefined];
@@ -108,6 +110,7 @@ declare const arbiQueryKeys: {
108
110
  /** One thread's loaded messages, decrypted, oldest first (`ChatThreadData`). */
109
111
  chatThread: (chatExtId: string) => readonly ["arbi", "chats", "thread", string];
110
112
  /** My own agent's progress on my last message to it (`agent_dm_status`), per agent. */
113
+ agentDmProgress: (ownerId: string, responseId: string) => readonly ["arbi", "chats", "agentProgress", string, string];
111
114
  agentDmStatus: (agentExtId: string) => readonly ["arbi", "chats", "agentStatus", string];
112
115
  /** The paid features this person may use (`/v1/user/entitlements`). */
113
116
  entitlements: () => readonly ["arbi", "entitlements"];
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/host/config.ts"],
4
- "sourcesContent": ["/**\n * What a host hands the `@arbidocs/react` hooks, as one configuration (`<ArbiHost config>`). Every\n * field is optional: without one the hooks use their own default. `@arbidocs/blocks` extends it\n * with the blocks domains (environment, billing, viewer, \u2026).\n *\n * A field whose value lives in the host's state is a hook (`use\u2026`), called by the hooks and kits\n * that need it, so the configuration itself stays one stable object for the host's life.\n */\n\nimport { useContext } from 'react'\nimport type { Arbi } from '@arbidocs/sdk/browser'\nimport type { AccountClient } from '../account/client'\nimport type { CalendarSupport } from '../calendar/support'\nimport type { MeetingChatRef } from '../calls/meeting-chat'\nimport type { ActiveCall } from '../calls/session'\nimport type { ArbiChatHost } from '../chat/host'\nimport type { DocumentsSupport } from '../documents/support'\nimport type { MailClient } from '../mail/client'\nimport type { ArbiSessionStore } from '../session/store'\nimport type { DictateContextValue } from '../ui/DictateContext'\nimport type { EntityVocabulary } from '../entities/vocabulary'\nimport type { ArbiHostConnection } from './ArbiHost'\nimport type { ArbiFeatures } from './features'\nimport { ArbiHostContext } from './context'\nimport type { DashboardsHost } from '../datasets/registry'\n\n/** The mail client, and whether mail is on for the signed-in user. */\nexport interface MailHost {\n client: MailClient\n /**\n * Whether mail reads run (signed in and entitled), and the server session the mailbox is\n * unlocked for: unlocking runs again when it changes (`null`: none yet, nothing is unlocked).\n * Absent: on, for one session.\n */\n useStatus?: () => { enabled: boolean; sessionKey: string | null }\n /**\n * The mail waiting in this device's Outbox (written offline), by status, while `enabled` (Mail\n * switched on); the offline status counts it as waiting work. Absent: no Outbox.\n */\n useOutbox?: (enabled: boolean) => ReadonlyArray<{ status: string }>\n /** The Outbox's folder, opened through `openMail({ folder })`. */\n outboxFolder?: string\n}\n\n/** The account client of the settings kits, and whether account reads run (signed in). */\nexport interface AccountHost {\n client: AccountClient\n /** Absent: always. */\n useEnabled?: () => boolean\n}\n\n/** Where the call panel goes in the host's layout. */\nexport type CallSlotMode = 'docked' | 'main'\n\n/** What the calls need from the host: navigation and layout are the host's. */\nexport interface CallsHost {\n /**\n * Show a call's meeting chat: an end-to-end chat, or a workspace meeting thread. Absent: the\n * in-call \"Open meeting chat\" does nothing.\n */\n openMeetingChat?: (ref: MeetingChatRef) => void\n /**\n * Once connected, show the call's conversation (its chat and live transcript) beside the call.\n * Absent: nothing is shown.\n */\n showConversation?: (call: ActiveCall) => void | Promise<void>\n /**\n * The element whose box the shown call fills: the right-hand dock, or (a webinar's audience) the\n * main area. The host claims its slot while `shown` and calls `onLost` when another panel takes\n * it (the call then minimises). Absent: the call floats at the right edge.\n */\n useSlot?: (mode: CallSlotMode, shown: boolean, onLost: () => void) => HTMLElement | null\n}\n\nexport interface ArbiHostConfig {\n /**\n * The SDK on the signed-in session. A host with its own login passes one on its session\n * (`new Arbi({ url, session })`); a blocks-only site gets one from `defaultHost`. A new instance (a\n * new session, a newly opened workspace) re-renders every hook.\n */\n arbi?: Arbi\n /** The session state the kits share. Absent: an in-memory one per top-level host. */\n session?: ArbiSessionStore\n /** Live processing, uploads and the host's document actions. Absent: the package's own. */\n documents?: DocumentsSupport\n /** The calendar kept on this device and account OAuth. Absent: online only, the user's connectors. */\n calendar?: CalendarSupport\n /** Absent: mail on the `arbi` session. */\n mail?: MailHost\n /** Absent: the account on the `arbi` session. */\n account?: AccountHost\n /** Absent: calls open no meeting chat from the room. */\n calls?: CallsHost\n /**\n * The parts of the product the user switches on or off, and where each switch is kept (the user's\n * settings, or this device), read with `useFeature(name)`. The call UI also follows the `calls`\n * feature, on top of the server's calls config. Absent, or a feature not listed: on.\n */\n features?: ArbiFeatures\n /** Dictation for every `dictate` field. Absent: no mic button. */\n dictate?: DictateContextValue\n /** The sign-in layer of a blocks-only site (`defaultHost` in `@arbidocs/blocks/connect`). */\n connection?: ArbiHostConnection\n /** Where the chat engine's side effects go (documents shown, mail drafts, used-up quota). */\n chat?: ArbiChatHost\n /**\n * The site's words for the entities (`{ PROJECT: 'Matter' }`), read by every kit through\n * `getEntityLabel`. Absent: the registry's (\"Project\", \"Workspace\", \"Thread\", \u2026).\n */\n vocabulary?: EntityVocabulary\n /**\n * What the site calls its assistant where people address it: the `@<name>` offered in a chat's\n * mention menu, the draft a shared thread starts with, and the name a message is routed to the\n * assistant on. Absent: \"ARBI\".\n */\n assistantName?: string\n /**\n * Charts and dashboards: more data sources (an external feed, a source relabelled in the site's\n * words). Pages themselves are the workspace's (`/v1/pages`). Absent: the built-in sources.\n */\n dashboards?: DashboardsHost\n}\n\n/** The host configuration in scope (`{}` outside an `<ArbiHost>`). */\nexport function useArbiHost(): ArbiHostConfig {\n return useContext(ArbiHostContext) as ArbiHostConfig\n}\n"],
5
- "mappings": "AASA,SAAS,kBAAkB;AAc3B,SAAS,uBAAuB;AAqGzB,SAAS,cAA8B;AAC5C,SAAO,WAAW,eAAe;AACnC;",
4
+ "sourcesContent": ["import type { EntityLinks } from '../entities/links'\n/**\n * What a host hands the `@arbidocs/react` hooks, as one configuration (`<ArbiHost config>`). Every\n * field is optional: without one the hooks use their own default. `@arbidocs/blocks` extends it\n * with the blocks domains (environment, billing, viewer, \u2026).\n *\n * A field whose value lives in the host's state is a hook (`use\u2026`), called by the hooks and kits\n * that need it, so the configuration itself stays one stable object for the host's life.\n */\n\nimport { useContext } from 'react'\nimport type { Arbi } from '@arbidocs/sdk/browser'\nimport type { AccountClient } from '../account/client'\nimport type { CalendarSupport } from '../calendar/support'\nimport type { MeetingChatRef } from '../calls/meeting-chat'\nimport type { ActiveCall } from '../calls/session'\nimport type { ArbiChatHost } from '../chat/host'\nimport type { DocumentsSupport } from '../documents/support'\nimport type { MailClient } from '../mail/client'\nimport type { ArbiSessionStore } from '../session/store'\nimport type { DictateContextValue } from '../ui/DictateContext'\nimport type { EntityVocabulary } from '../entities/vocabulary'\nimport type { ArbiHostConnection } from './ArbiHost'\nimport type { ArbiFeatures } from './features'\nimport { ArbiHostContext } from './context'\nimport type { DashboardsHost } from '../datasets/registry'\n\n/** The mail client, and whether mail is on for the signed-in user. */\nexport interface MailHost {\n client: MailClient\n /**\n * Whether mail reads run (signed in and entitled), and the server session the mailbox is\n * unlocked for: unlocking runs again when it changes (`null`: none yet, nothing is unlocked).\n * Absent: on, for one session.\n */\n useStatus?: () => { enabled: boolean; sessionKey: string | null }\n /**\n * The mail waiting in this device's Outbox (written offline), by status, while `enabled` (Mail\n * switched on); the offline status counts it as waiting work. Absent: no Outbox.\n */\n useOutbox?: (enabled: boolean) => ReadonlyArray<{ status: string }>\n /** The Outbox's folder, opened through `openMail({ folder })`. */\n outboxFolder?: string\n}\n\n/** The account client of the settings kits, and whether account reads run (signed in). */\nexport interface AccountHost {\n client: AccountClient\n /** Absent: always. */\n useEnabled?: () => boolean\n}\n\n/** Where the call panel goes in the host's layout. */\nexport type CallSlotMode = 'docked' | 'main'\n\n/** What the calls need from the host: navigation and layout are the host's. */\nexport interface CallsHost {\n /**\n * Show a call's meeting chat: an end-to-end chat, or a workspace meeting thread. Absent: the\n * in-call \"Open meeting chat\" does nothing.\n */\n openMeetingChat?: (ref: MeetingChatRef) => void\n /**\n * Once connected, show the call's conversation (its chat and live transcript) beside the call.\n * Absent: nothing is shown.\n */\n showConversation?: (call: ActiveCall) => void | Promise<void>\n /**\n * The element whose box the shown call fills: the right-hand dock, or (a webinar's audience) the\n * main area. The host claims its slot while `shown` and calls `onLost` when another panel takes\n * it (the call then minimises). Absent: the call floats at the right edge.\n */\n useSlot?: (mode: CallSlotMode, shown: boolean, onLost: () => void) => HTMLElement | null\n}\n\nexport interface ArbiHostConfig {\n /** Canonical links used by entity reference menus. */\n entities?: EntityLinks\n /**\n * The SDK on the signed-in session. A host with its own login passes one on its session\n * (`new Arbi({ url, session })`); a blocks-only site gets one from `defaultHost`. A new instance (a\n * new session, a newly opened workspace) re-renders every hook.\n */\n arbi?: Arbi\n /** The session state the kits share. Absent: an in-memory one per top-level host. */\n session?: ArbiSessionStore\n /** Live processing, uploads and the host's document actions. Absent: the package's own. */\n documents?: DocumentsSupport\n /** The calendar kept on this device and account OAuth. Absent: online only, the user's connectors. */\n calendar?: CalendarSupport\n /** Absent: mail on the `arbi` session. */\n mail?: MailHost\n /** Absent: the account on the `arbi` session. */\n account?: AccountHost\n /** Absent: calls open no meeting chat from the room. */\n calls?: CallsHost\n /**\n * The parts of the product the user switches on or off, and where each switch is kept (the user's\n * settings, or this device), read with `useFeature(name)`. The call UI also follows the `calls`\n * feature, on top of the server's calls config. Absent, or a feature not listed: on.\n */\n features?: ArbiFeatures\n /** Dictation for every `dictate` field. Absent: no mic button. */\n dictate?: DictateContextValue\n /** The sign-in layer of a blocks-only site (`defaultHost` in `@arbidocs/blocks/connect`). */\n connection?: ArbiHostConnection\n /** Where the chat engine's side effects go (documents shown, mail drafts, used-up quota). */\n chat?: ArbiChatHost\n /**\n * The site's words for the entities (`{ PROJECT: 'Matter' }`), read by every kit through\n * `getEntityLabel`. Absent: the registry's (\"Project\", \"Workspace\", \"Thread\", \u2026).\n */\n vocabulary?: EntityVocabulary\n /**\n * What the site calls its assistant where people address it: the `@<name>` offered in a chat's\n * mention menu, the draft a shared thread starts with, and the name a message is routed to the\n * assistant on. Absent: \"ARBI\".\n */\n assistantName?: string\n /**\n * Charts and dashboards: more data sources (an external feed, a source relabelled in the site's\n * words). Pages themselves are the workspace's (`/v1/pages`). Absent: the built-in sources.\n */\n dashboards?: DashboardsHost\n}\n\n/** The host configuration in scope (`{}` outside an `<ArbiHost>`). */\nexport function useArbiHost(): ArbiHostConfig {\n return useContext(ArbiHostContext) as ArbiHostConfig\n}\n"],
5
+ "mappings": "AAUA,SAAS,kBAAkB;AAc3B,SAAS,uBAAuB;AAuGzB,SAAS,cAA8B;AAC5C,SAAO,WAAW,eAAe;AACnC;",
6
6
  "names": []
7
7
  }