@arbidocs/react 0.4.127 → 0.4.128

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/index.d.cts CHANGED
@@ -114,6 +114,13 @@ interface UseArbiChatOptions {
114
114
  workspaceId?: string;
115
115
  /** Assistant configuration or model id passed to every query. */
116
116
  model?: string;
117
+ /**
118
+ * Drafting mode: the saved document the turn is about, read once as each question is sent (not
119
+ * for a comment that does not call the assistant). The request names it
120
+ * (`active_artifact_ext_id`), so the assistant works in that document. Return nothing when no
121
+ * document is open. `@arbidocs/blocks` binds it to the open document.
122
+ */
123
+ activeArtifact?: () => string | null | undefined;
117
124
  /** Longest auto-title in characters (used until the backend has titled the conversation). Default 48. */
118
125
  titleLength?: number;
119
126
  /**
package/dist/index.d.ts CHANGED
@@ -114,6 +114,13 @@ interface UseArbiChatOptions {
114
114
  workspaceId?: string;
115
115
  /** Assistant configuration or model id passed to every query. */
116
116
  model?: string;
117
+ /**
118
+ * Drafting mode: the saved document the turn is about, read once as each question is sent (not
119
+ * for a comment that does not call the assistant). The request names it
120
+ * (`active_artifact_ext_id`), so the assistant works in that document. Return nothing when no
121
+ * document is open. `@arbidocs/blocks` binds it to the open document.
122
+ */
123
+ activeArtifact?: () => string | null | undefined;
117
124
  /** Longest auto-title in characters (used until the backend has titled the conversation). Default 48. */
118
125
  titleLength?: number;
119
126
  /**
package/dist/index.js CHANGED
@@ -7,10 +7,10 @@ import { returnFocusToMark, MarkMenu, AiMarkdown, Card, Badge, TagEntity, Input,
7
7
  export { AUDIO_MIME_PREFERENCE, AgentBadge, AiMarkdown, ArbiBotHeadIcon, ArbiIcon, AudIcon, Avatar, AvatarFallback, AvatarImage, BASE_COLORS, Badge, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, DEFAULT_SEGMENTER_CONFIG, DictateProvider, DocIcon, DocumentCard, DocumentEntity, ENTITY_MAPPINGS, EmlIcon, EntityIcon, EntityPill, FILE_TYPE_COLORS, HoverCard, HoverCardContent, HoverCardTrigger, HtmlIcon, INITIAL_SEGMENTER_STATE, IconToggle, ImgIcon, InlineMicButton, Input, Label, MarkMenu, MicRecordingOverlay, MicWaveformIndicator, NEUTRAL_GRAY, PLACEHOLDER_COLOR, PassageCard, PdfIcon, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, PresenceLabel, Progress, ProjectEntity, RadioGroup, RadioGroupItem, RagDot, RelevanceDot, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Slider, StatusPill, Switch, TAG_TYPE_ICONS, TAG_TYPE_LABELS, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TagEntity, Textarea, ThreadVisibilityIcon, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TxtIcon, UserEntity, UserMenu, VIDEO_MIME_PREFERENCE, VISIBILITY_ICONS, VerifiedBadge, VidIcon, VisibilityIcon, VisibilityToggle, XlsIcon, badgeVariants, cardVariants, classifyMediaError, configureEntityRegistry, configureRagLabels, configureStatusRegistry, createChunkedRecorder, flushSegmenter, formatElapsed, getDocIcon, getEntityColor, getEntityColorStyles, getEntityIcon, getEntityLabel, getStatusVariant, getTagTypeIcon, getTagTypeLabel, getWorkspaceColor, levelFromRms, pickRecorderMimeType, stepSegmenter, toggleVariants, useAudioRecorder } from './chunk-5PQO46PE.js';
8
8
  import { MarkdownRenderer } from './chunk-EKRRORFO.js';
9
9
  export { MarkdownRenderer, MarkdownStreamingContext, markdownBaseComponents, splitMarkdownBlocks } from './chunk-EKRRORFO.js';
10
- import { normalizeCitationMarkup } from './chunk-QRCMKEE6.js';
11
- export { closeOpenEmphasis, normalizeCitationMarkup, trimOpenCitation } from './chunk-QRCMKEE6.js';
12
10
  import { Button, Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from './chunk-YNNAJJ5Z.js';
13
11
  export { Button, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, buttonVariants } from './chunk-YNNAJJ5Z.js';
12
+ import { normalizeCitationMarkup } from './chunk-QRCMKEE6.js';
13
+ export { closeOpenEmphasis, normalizeCitationMarkup, trimOpenCitation } from './chunk-QRCMKEE6.js';
14
14
  import { ScrollArea } from './chunk-W4H6XAIU.js';
15
15
  export { ScrollArea, ScrollBar } from './chunk-W4H6XAIU.js';
16
16
  import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator } from './chunk-47CCGUWR.js';
@@ -472,6 +472,10 @@ var isAbort = (e) => e instanceof DOMException && e.name === "AbortError";
472
472
  var TITLE_REFRESH_DELAYS_MS = [2500, 6e3, 12e3];
473
473
  function useArbiChat(options = {}) {
474
474
  const { workspaceId, agentId, model, titleLength = 48, streamRecovery } = options;
475
+ const activeArtifactRef = useRef(options.activeArtifact);
476
+ useEffect(() => {
477
+ activeArtifactRef.current = options.activeArtifact;
478
+ });
475
479
  const recoveryIntervalMs = streamRecovery?.intervalMs ?? 3e3;
476
480
  const recoveryTimeoutMs = streamRecovery?.timeoutMs ?? 12e4;
477
481
  const arbi = useArbi();
@@ -689,6 +693,7 @@ function useArbiChat(options = {}) {
689
693
  title: t.title || titleFromQuestion(text, titleLength),
690
694
  messages: [...t.messages, userMessage, answer]
691
695
  }));
696
+ const activeArtifactExtId = activeArtifactRef.current?.() || void 0;
692
697
  const controller = new AbortController();
693
698
  abortRef.current = controller;
694
699
  runIdRef.current = null;
@@ -719,6 +724,7 @@ function useArbiChat(options = {}) {
719
724
  ...thread.conversationId ? { conversationId: thread.conversationId } : {},
720
725
  ...!thread.conversationId && thread.assistantMode === "mentioned" ? { assistantMode: "mentioned" } : {},
721
726
  ...mentions?.length ? { mentions } : {},
727
+ ...activeArtifactExtId ? { activeArtifactExtId } : {},
722
728
  model,
723
729
  signal: controller.signal,
724
730
  onStreamStart: (data) => {