@arbidocs/react 0.4.9 → 0.4.10
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/README.md +9 -0
- package/dist/artifacts/index.cjs +153 -19
- package/dist/artifacts/index.cjs.map +1 -1
- package/dist/artifacts/index.d.cts +120 -8
- package/dist/artifacts/index.d.ts +120 -8
- package/dist/artifacts/index.js +128 -19
- package/dist/artifacts/index.js.map +1 -1
- package/dist/{chunk-TA3IZP7I.cjs → chunk-K5TOB34Q.cjs} +3 -3
- package/dist/{chunk-TA3IZP7I.cjs.map → chunk-K5TOB34Q.cjs.map} +1 -1
- package/dist/{chunk-E7UO2JSR.cjs → chunk-KKSSTNJK.cjs} +110 -2
- package/dist/chunk-KKSSTNJK.cjs.map +1 -0
- package/dist/{chunk-RTULVZOS.js → chunk-NVMQLJI4.js} +3 -3
- package/dist/{chunk-RTULVZOS.js.map → chunk-NVMQLJI4.js.map} +1 -1
- package/dist/{chunk-R5SR7R6W.js → chunk-UV5ZEUNV.js} +105 -3
- package/dist/chunk-UV5ZEUNV.js.map +1 -0
- package/dist/index.cjs +394 -370
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +9 -9
- package/dist/stored-markdown-DMwFzWhc.d.cts +75 -0
- package/dist/stored-markdown-DMwFzWhc.d.ts +75 -0
- package/dist/ui/index.cjs +147 -147
- package/dist/ui/index.js +2 -2
- package/package.json +3 -3
- package/dist/chunk-E7UO2JSR.cjs.map +0 -1
- package/dist/chunk-R5SR7R6W.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -12,6 +12,7 @@ import { ab as EntityIconComponent } from './index-4WLy-KDK.cjs';
|
|
|
12
12
|
export { A as AgentBadge, a as AiMarkdown, b as Avatar, c as AvatarFallback, d as AvatarImage, B as BASE_COLORS, e as Badge, f as BadgeProps, g as Button, h as ButtonProps, C as Card, i as CardContent, j as CardDescription, k as CardFooter, l as CardHeader, m as CardProps, n as CardTitle, o as Checkbox, p as Collapsible, q as CollapsibleContent, r as CollapsibleTrigger, s as Command, t as CommandDialog, u as CommandEmpty, v as CommandGroup, w as CommandInput, x as CommandItem, y as CommandList, z as CommandSeparator, D as CommandShortcut, E as Dialog, F as DialogClose, G as DialogContent, H as DialogDescription, I as DialogFooter, J as DialogHeader, K as DialogOverlay, L as DialogPortal, M as DialogPresentation, N as DialogTitle, O as DialogTrigger, P as DictateContextValue, Q as DictateProvider, R as DocumentCard, S as DocumentCardProps, T as DocumentEntity, U as DocumentEntityProps, V as DocumentLike, W as DropdownMenu, X as DropdownMenuCheckboxItem, Y as DropdownMenuContent, Z as DropdownMenuGroup, _ as DropdownMenuItem, $ as DropdownMenuLabel, a0 as DropdownMenuPortal, a1 as DropdownMenuRadioGroup, a2 as DropdownMenuRadioItem, a3 as DropdownMenuSeparator, a4 as DropdownMenuShortcut, a5 as DropdownMenuSub, a6 as DropdownMenuSubContent, a7 as DropdownMenuSubTrigger, a8 as DropdownMenuTrigger, a9 as ENTITY_MAPPINGS, aa as EntityIcon, ac as EntityPill, ad as EntityRegistryOverride, ae as EntityType, af as HoverCard, ag as HoverCardContent, ah as HoverCardTrigger, ai as IconToggle, aj as IconToggleProps, ak as Input, al as InputProps, am as Label, an as MarkMenu, ao as MarkMenuItem, ap as MarkMenuProps, aq as MarkdownRenderer, ar as MarkdownRendererProps, as as MarkdownStreamingContext, at as NEUTRAL_GRAY, au as PLACEHOLDER_COLOR, av as PassageCard, aw as PassageCardProps, ax as Popover, ay as PopoverAnchor, az as PopoverContent, aA as PopoverTrigger, aB as PresenceDisplayStatus, aC as PresenceLabel, aD as Progress, aE as ProjectEntity, aF as ProjectEntityProps, aG as ProjectRelation, aH as RadioGroup, aI as RadioGroupItem, aJ as Rag, aK as RagDot, aL as RelevanceDot, aM as ScrollArea, aN as ScrollBar, aO as Select, aP as SelectContent, aQ as SelectGroup, aR as SelectItem, aS as SelectLabel, aT as SelectScrollDownButton, aU as SelectScrollUpButton, aV as SelectSeparator, aW as SelectTrigger, aX as SelectValue, aY as Separator, aZ as Slider, a_ as StatusBadgeComponent, a$ as StatusBadgeProps, b0 as StatusPill, b1 as StatusPillProps, b2 as StatusVariant, b3 as Switch, b4 as TAG_TYPE_ICONS, b5 as TAG_TYPE_LABELS, b6 as Table, b7 as TableBody, b8 as TableCaption, b9 as TableCell, ba as TableFooter, bb as TableHead, bc as TableHeader, bd as TableRow, be as Tabs, bf as TabsContent, bg as TabsList, bh as TabsTrigger, bi as TagEntity, bj as TagEntityProps, bk as TagLike, bl as Textarea, bm as TextareaProps, bn as Toggle, bo as ToggleGroup, bp as ToggleGroupItem, bq as Tooltip, br as TooltipContent, bs as TooltipProvider, bt as TooltipTrigger, bu as UserEntity, bv as UserEntityProps, bw as UserMenu, bx as UserMenuItem, by as UserMenuProps, bz as UserMenuStatus, bA as VISIBILITY_ICONS, bB as VisibilityIcon, bC as badgeVariants, bD as buttonVariants, bE as cardVariants, bF as closeOpenEmphasis, bG as cn, bH as configureEntityRegistry, bI as configureRagLabels, bJ as configureStatusRegistry, bK as getDocIcon, bL as getEntityColor, bM as getEntityColorStyles, bN as getEntityIcon, bO as getEntityLabel, bP as getStatusVariant, bQ as getTagTypeIcon, bR as getTagTypeLabel, bS as getWorkspaceColor, bT as markdownBaseComponents, bU as normalizeCitationMarkup, bV as splitMarkdownBlocks, bW as toggleVariants, bX as trimOpenCitation } from './index-4WLy-KDK.cjs';
|
|
13
13
|
import { LucideIcon } from 'lucide-react';
|
|
14
14
|
import { Components } from 'react-markdown';
|
|
15
|
+
export { c as cleanDraftMarkdown, p as promoteBoldTitle, r as repairParsedTitle, s as stripAgentPreamble, u as unescapeMarkdown, a as unwrapCitationLinks } from './stored-markdown-DMwFzWhc.cjs';
|
|
15
16
|
export { A as AppNotification, D as DEFAULT_NOTIFY_TONE, N as NotificationBell, a as NotificationBellProps, b as NotificationBellTriggerState, c as NotifyOptions, d as NotifyVariant, T as Toaster, n as notify, s as seedNotifications, e as selectUnread, u as useNotify } from './index-CcbVSNSP.cjs';
|
|
16
17
|
import { ColDef } from 'ag-grid-community';
|
|
17
18
|
export { ToasterProps, toast } from 'sonner';
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { ab as EntityIconComponent } from './index-4WLy-KDK.js';
|
|
|
12
12
|
export { A as AgentBadge, a as AiMarkdown, b as Avatar, c as AvatarFallback, d as AvatarImage, B as BASE_COLORS, e as Badge, f as BadgeProps, g as Button, h as ButtonProps, C as Card, i as CardContent, j as CardDescription, k as CardFooter, l as CardHeader, m as CardProps, n as CardTitle, o as Checkbox, p as Collapsible, q as CollapsibleContent, r as CollapsibleTrigger, s as Command, t as CommandDialog, u as CommandEmpty, v as CommandGroup, w as CommandInput, x as CommandItem, y as CommandList, z as CommandSeparator, D as CommandShortcut, E as Dialog, F as DialogClose, G as DialogContent, H as DialogDescription, I as DialogFooter, J as DialogHeader, K as DialogOverlay, L as DialogPortal, M as DialogPresentation, N as DialogTitle, O as DialogTrigger, P as DictateContextValue, Q as DictateProvider, R as DocumentCard, S as DocumentCardProps, T as DocumentEntity, U as DocumentEntityProps, V as DocumentLike, W as DropdownMenu, X as DropdownMenuCheckboxItem, Y as DropdownMenuContent, Z as DropdownMenuGroup, _ as DropdownMenuItem, $ as DropdownMenuLabel, a0 as DropdownMenuPortal, a1 as DropdownMenuRadioGroup, a2 as DropdownMenuRadioItem, a3 as DropdownMenuSeparator, a4 as DropdownMenuShortcut, a5 as DropdownMenuSub, a6 as DropdownMenuSubContent, a7 as DropdownMenuSubTrigger, a8 as DropdownMenuTrigger, a9 as ENTITY_MAPPINGS, aa as EntityIcon, ac as EntityPill, ad as EntityRegistryOverride, ae as EntityType, af as HoverCard, ag as HoverCardContent, ah as HoverCardTrigger, ai as IconToggle, aj as IconToggleProps, ak as Input, al as InputProps, am as Label, an as MarkMenu, ao as MarkMenuItem, ap as MarkMenuProps, aq as MarkdownRenderer, ar as MarkdownRendererProps, as as MarkdownStreamingContext, at as NEUTRAL_GRAY, au as PLACEHOLDER_COLOR, av as PassageCard, aw as PassageCardProps, ax as Popover, ay as PopoverAnchor, az as PopoverContent, aA as PopoverTrigger, aB as PresenceDisplayStatus, aC as PresenceLabel, aD as Progress, aE as ProjectEntity, aF as ProjectEntityProps, aG as ProjectRelation, aH as RadioGroup, aI as RadioGroupItem, aJ as Rag, aK as RagDot, aL as RelevanceDot, aM as ScrollArea, aN as ScrollBar, aO as Select, aP as SelectContent, aQ as SelectGroup, aR as SelectItem, aS as SelectLabel, aT as SelectScrollDownButton, aU as SelectScrollUpButton, aV as SelectSeparator, aW as SelectTrigger, aX as SelectValue, aY as Separator, aZ as Slider, a_ as StatusBadgeComponent, a$ as StatusBadgeProps, b0 as StatusPill, b1 as StatusPillProps, b2 as StatusVariant, b3 as Switch, b4 as TAG_TYPE_ICONS, b5 as TAG_TYPE_LABELS, b6 as Table, b7 as TableBody, b8 as TableCaption, b9 as TableCell, ba as TableFooter, bb as TableHead, bc as TableHeader, bd as TableRow, be as Tabs, bf as TabsContent, bg as TabsList, bh as TabsTrigger, bi as TagEntity, bj as TagEntityProps, bk as TagLike, bl as Textarea, bm as TextareaProps, bn as Toggle, bo as ToggleGroup, bp as ToggleGroupItem, bq as Tooltip, br as TooltipContent, bs as TooltipProvider, bt as TooltipTrigger, bu as UserEntity, bv as UserEntityProps, bw as UserMenu, bx as UserMenuItem, by as UserMenuProps, bz as UserMenuStatus, bA as VISIBILITY_ICONS, bB as VisibilityIcon, bC as badgeVariants, bD as buttonVariants, bE as cardVariants, bF as closeOpenEmphasis, bG as cn, bH as configureEntityRegistry, bI as configureRagLabels, bJ as configureStatusRegistry, bK as getDocIcon, bL as getEntityColor, bM as getEntityColorStyles, bN as getEntityIcon, bO as getEntityLabel, bP as getStatusVariant, bQ as getTagTypeIcon, bR as getTagTypeLabel, bS as getWorkspaceColor, bT as markdownBaseComponents, bU as normalizeCitationMarkup, bV as splitMarkdownBlocks, bW as toggleVariants, bX as trimOpenCitation } from './index-4WLy-KDK.js';
|
|
13
13
|
import { LucideIcon } from 'lucide-react';
|
|
14
14
|
import { Components } from 'react-markdown';
|
|
15
|
+
export { c as cleanDraftMarkdown, p as promoteBoldTitle, r as repairParsedTitle, s as stripAgentPreamble, u as unescapeMarkdown, a as unwrapCitationLinks } from './stored-markdown-DMwFzWhc.js';
|
|
15
16
|
export { A as AppNotification, D as DEFAULT_NOTIFY_TONE, N as NotificationBell, a as NotificationBellProps, b as NotificationBellTriggerState, c as NotifyOptions, d as NotifyVariant, T as Toaster, n as notify, s as seedNotifications, e as selectUnread, u as useNotify } from './index-CcbVSNSP.js';
|
|
16
17
|
import { ColDef } from 'ag-grid-community';
|
|
17
18
|
export { ToasterProps, toast } from 'sonner';
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { useDocuments, useConversations, useAssistantQuery, useConversationThreads, arbiQueryKeys, useWorkspaces, useParsedDocument, useTags, useActivity, useThumbnails } from './chunk-R5SR7R6W.js';
|
|
2
|
-
export { DEFAULT_USD_PER_CREDIT, arbiQueryKeys, creditsToUsd, formatCredits, isUsageMetered, useActivity, useAgents, useAssistantQuery, useConfigs, useConversationThreads, useConversations, useDeleteAgents, useDocuments, useFacts, useHealth, useParsedDocument, useProjectInvoices, useProjectUsage, useProjects, useProjectsUsage, useSessions, useTags, useTasks, useThumbnails, useUserUsageToday, useWorkspaces } from './chunk-R5SR7R6W.js';
|
|
3
|
-
import { MarkMenu, AiMarkdown, Card, Button, Badge, TagEntity, Input, FILE_TYPE_COLORS, getEntityIcon, UserEntity, getEntityColorStyles, AgentBadge, Textarea, Label, Slider, Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter, DocumentEntity, DocumentCard, useAudioRecorder, MicWaveformIndicator, IconToggle, classifyMediaError, formatElapsed, PassageCard } from './chunk-RTULVZOS.js';
|
|
4
|
-
export { AgentBadge, AiMarkdown, ArbiBotHeadIcon, AudIcon, Avatar, AvatarFallback, AvatarImage, BASE_COLORS, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DictateProvider, DocumentCard, DocumentEntity, ENTITY_MAPPINGS, EmlIcon, EntityIcon, EntityPill, FILE_TYPE_COLORS, HoverCard, HoverCardContent, HoverCardTrigger, IconToggle, ImgIcon, InlineMicButton, Input, Label, MarkMenu, MicRecordingOverlay, MicWaveformIndicator, NEUTRAL_GRAY, PLACEHOLDER_COLOR, PassageCard, PdfIcon, Popover, PopoverAnchor, 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, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UserEntity, UserMenu, VISIBILITY_ICONS, VidIcon, VisibilityIcon, badgeVariants, buttonVariants, cardVariants, configureEntityRegistry, configureRagLabels, configureStatusRegistry, formatElapsed, getDocIcon, getEntityColor, getEntityColorStyles, getEntityIcon, getEntityLabel, getStatusVariant, getTagTypeIcon, getTagTypeLabel, getWorkspaceColor, toggleVariants, useAudioRecorder } from './chunk-RTULVZOS.js';
|
|
5
|
-
import { normalizeCitationMarkup, MarkdownRenderer } from './chunk-TGGQGFS3.js';
|
|
6
|
-
export { MarkdownRenderer, MarkdownStreamingContext, closeOpenEmphasis, markdownBaseComponents, normalizeCitationMarkup, splitMarkdownBlocks, trimOpenCitation } from './chunk-TGGQGFS3.js';
|
|
7
1
|
import { formatRelativeTime } from './chunk-FSMIN5VX.js';
|
|
8
2
|
export { DEFAULT_NOTIFY_TONE, NotificationBell, Toaster, formatRelativeTime, notify, seedNotifications, selectUnread, toast, useNotify } from './chunk-FSMIN5VX.js';
|
|
3
|
+
import { useDocuments, useConversations, useAssistantQuery, useConversationThreads, arbiQueryKeys, useWorkspaces, useParsedDocument, useTags, useActivity, useThumbnails } from './chunk-UV5ZEUNV.js';
|
|
4
|
+
export { DEFAULT_USD_PER_CREDIT, arbiQueryKeys, cleanDraftMarkdown, creditsToUsd, formatCredits, isUsageMetered, promoteBoldTitle, repairParsedTitle, stripAgentPreamble, unescapeMarkdown, unwrapCitationLinks, useActivity, useAgents, useAssistantQuery, useConfigs, useConversationThreads, useConversations, useDeleteAgents, useDocuments, useFacts, useHealth, useParsedDocument, useProjectInvoices, useProjectUsage, useProjects, useProjectsUsage, useSessions, useTags, useTasks, useThumbnails, useUserUsageToday, useWorkspaces } from './chunk-UV5ZEUNV.js';
|
|
5
|
+
import { AudioViewer, ImageViewer, VideoViewer } from './chunk-HDCRPPBW.js';
|
|
6
|
+
import { useArbi } from './chunk-J4MX2W4H.js';
|
|
7
|
+
export { ArbiProvider, useArbi } from './chunk-J4MX2W4H.js';
|
|
8
|
+
import { MarkMenu, AiMarkdown, Card, Button, Badge, TagEntity, Input, FILE_TYPE_COLORS, getEntityIcon, UserEntity, getEntityColorStyles, AgentBadge, Textarea, Label, Slider, Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter, DocumentEntity, DocumentCard, useAudioRecorder, MicWaveformIndicator, IconToggle, classifyMediaError, formatElapsed, PassageCard } from './chunk-NVMQLJI4.js';
|
|
9
|
+
export { AgentBadge, AiMarkdown, ArbiBotHeadIcon, AudIcon, Avatar, AvatarFallback, AvatarImage, BASE_COLORS, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DictateProvider, DocumentCard, DocumentEntity, ENTITY_MAPPINGS, EmlIcon, EntityIcon, EntityPill, FILE_TYPE_COLORS, HoverCard, HoverCardContent, HoverCardTrigger, IconToggle, ImgIcon, InlineMicButton, Input, Label, MarkMenu, MicRecordingOverlay, MicWaveformIndicator, NEUTRAL_GRAY, PLACEHOLDER_COLOR, PassageCard, PdfIcon, Popover, PopoverAnchor, 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, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UserEntity, UserMenu, VISIBILITY_ICONS, VidIcon, VisibilityIcon, badgeVariants, buttonVariants, cardVariants, configureEntityRegistry, configureRagLabels, configureStatusRegistry, formatElapsed, getDocIcon, getEntityColor, getEntityColorStyles, getEntityIcon, getEntityLabel, getStatusVariant, getTagTypeIcon, getTagTypeLabel, getWorkspaceColor, toggleVariants, useAudioRecorder } from './chunk-NVMQLJI4.js';
|
|
9
10
|
import { ScrollArea, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator } from './chunk-N5SVBDLC.js';
|
|
10
11
|
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ScrollArea, ScrollBar } from './chunk-N5SVBDLC.js';
|
|
12
|
+
import { normalizeCitationMarkup, MarkdownRenderer } from './chunk-TGGQGFS3.js';
|
|
13
|
+
export { MarkdownRenderer, MarkdownStreamingContext, closeOpenEmphasis, markdownBaseComponents, normalizeCitationMarkup, splitMarkdownBlocks, trimOpenCitation } from './chunk-TGGQGFS3.js';
|
|
11
14
|
import { cn } from './chunk-SN5YV6FF.js';
|
|
12
15
|
export { cn } from './chunk-SN5YV6FF.js';
|
|
13
|
-
import { AudioViewer, ImageViewer, VideoViewer } from './chunk-HDCRPPBW.js';
|
|
14
|
-
import { useArbi } from './chunk-J4MX2W4H.js';
|
|
15
|
-
export { ArbiProvider, useArbi } from './chunk-J4MX2W4H.js';
|
|
16
16
|
import React, { memo, useState, createContext, useMemo, useCallback, useEffect, useRef, useLayoutEffect, useContext, useId, Fragment as Fragment$1 } from 'react';
|
|
17
17
|
import { resolveCitations, summarizeCitations, connectWithReconnect } from '@arbidocs/sdk/browser';
|
|
18
18
|
export { Arbi, ArbiError } from '@arbidocs/sdk/browser';
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers for markdown that is STORED (an agent's draft saved as an artifact, then read back from
|
|
3
|
+
* the backend's parse). Pure and SDK-free; they sit next to `normalizeCitationMarkup`, which they
|
|
4
|
+
* build on.
|
|
5
|
+
*
|
|
6
|
+
* Two directions:
|
|
7
|
+
*
|
|
8
|
+
* - Going in (`cleanDraftMarkdown` = `unwrapCitationLinks` + `stripAgentPreamble` +
|
|
9
|
+
* `promoteBoldTitle`): a streamed draft carries citation links, `(*Source: ...*)` notes and
|
|
10
|
+
* sometimes narration before the document. A stored letter should hold only the letter.
|
|
11
|
+
* - Coming out (`unescapeMarkdown`): the backend's parse of a stored `.md` returns the text with
|
|
12
|
+
* markdown punctuation backslash-escaped (`**Fees.**` comes back as `\*\*Fees\.\*\*`).
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Undo the backend's escaping of a markdown artifact: `\*\*Scope\.\*\*` becomes `**Scope.**`.
|
|
16
|
+
*
|
|
17
|
+
* THE RULE. Apply this ONLY to text of an artifact that was stored from markdown (an agent draft
|
|
18
|
+
* or an edited version, always uploaded as `.md`): for those the parser escapes every markdown
|
|
19
|
+
* punctuation character, including the backslash itself, so removing one level of escaping is the
|
|
20
|
+
* exact inverse (an author's literal `\*` is stored as `\\\*` and comes back as `\*`). Do not
|
|
21
|
+
* apply it to a PDF or Word parse, where a backslash is just a character.
|
|
22
|
+
*
|
|
23
|
+
* Details:
|
|
24
|
+
* - Only a backslash followed by markdown punctuation (``\ ` * _ { } [ ] ( ) # + - . ! | > ~ <``)
|
|
25
|
+
* is removed; `\n`, `C:\temp` and a trailing backslash are left alone.
|
|
26
|
+
* - Pairs are read left to right, so `\\*` is an escaped backslash followed by a bare `*`.
|
|
27
|
+
* - Fenced code blocks are never touched (the parser does not escape inside them).
|
|
28
|
+
* - Inline code spans: the parser DOES escape `*` and `_` there (`` `a*b` `` comes back as
|
|
29
|
+
* `` `a\*b` ``), so only `\*` and `\_` are undone inside a span; any other backslash in code
|
|
30
|
+
* (`` `re\.x` ``) is a literal and stays.
|
|
31
|
+
*/
|
|
32
|
+
declare function unescapeMarkdown(text: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* The parser also mangles the TITLE of a stored markdown document (seen on a real backend): the
|
|
35
|
+
* first heading comes back doubled (`## # Title`) or alone inside a code fence
|
|
36
|
+
* (a fence, `# Title`, a fence). Both are repaired, on the first non-blank line only, so a code
|
|
37
|
+
* block or heading later in the text is never touched. Like `unescapeMarkdown`, apply it only to
|
|
38
|
+
* artifacts stored from markdown.
|
|
39
|
+
*/
|
|
40
|
+
declare function repairParsedTitle(text: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* Text for storage from text that carries citations: `normalizeCitationMarkup` first (it hoists
|
|
43
|
+
* list, heading and bold tokens out of the link so unwrapping cannot orphan half of a `**` pair),
|
|
44
|
+
* then `[text](#cite-N)` becomes `text`, `(*Source: ...*)` notes are dropped, and a bold or
|
|
45
|
+
* heading marker that lost its partner is repaired. Fenced code is left alone.
|
|
46
|
+
*/
|
|
47
|
+
declare function unwrapCitationLinks(text: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* Cut what an agent wrote BEFORE the document, when it is narration.
|
|
50
|
+
*
|
|
51
|
+
* HEURISTIC (conservative, so a document is never trimmed by mistake). The document is taken to
|
|
52
|
+
* start at the first `#` heading, or, when there is none, at the first whole-line bold title within
|
|
53
|
+
* the first 15 lines. The text before it is removed only when ALL of these hold:
|
|
54
|
+
* 1. it is short (at most 1200 characters);
|
|
55
|
+
* 2. it is plain prose: no list, table, quote, code or heading;
|
|
56
|
+
* 3. it reads like the agent talking: first person ("I'll draft ..."), "Here is ...", "Per the
|
|
57
|
+
* instructions", "Based on the ..." and the like.
|
|
58
|
+
* A document that opens with a dateline, an address or any text that does not trip rule 3 is kept
|
|
59
|
+
* whole. A horizontal rule left at the end of the cut text is dropped with it.
|
|
60
|
+
*/
|
|
61
|
+
declare function stripAgentPreamble(text: string): string;
|
|
62
|
+
/**
|
|
63
|
+
* Make the document's title a real heading: a first line that is a bold title (`**Letter**`, even
|
|
64
|
+
* with stray inner `**`) becomes `# Letter`. A document that already opens with a heading is left
|
|
65
|
+
* alone.
|
|
66
|
+
*/
|
|
67
|
+
declare function promoteBoldTitle(text: string): string;
|
|
68
|
+
/**
|
|
69
|
+
* Everything a streamed draft needs before it is stored as the artifact's first version:
|
|
70
|
+
* `unwrapCitationLinks`, `stripAgentPreamble`, `promoteBoldTitle`, clean headings, collapsed blank
|
|
71
|
+
* runs, trimmed.
|
|
72
|
+
*/
|
|
73
|
+
declare function cleanDraftMarkdown(raw: string): string;
|
|
74
|
+
|
|
75
|
+
export { unwrapCitationLinks as a, cleanDraftMarkdown as c, promoteBoldTitle as p, repairParsedTitle as r, stripAgentPreamble as s, unescapeMarkdown as u };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers for markdown that is STORED (an agent's draft saved as an artifact, then read back from
|
|
3
|
+
* the backend's parse). Pure and SDK-free; they sit next to `normalizeCitationMarkup`, which they
|
|
4
|
+
* build on.
|
|
5
|
+
*
|
|
6
|
+
* Two directions:
|
|
7
|
+
*
|
|
8
|
+
* - Going in (`cleanDraftMarkdown` = `unwrapCitationLinks` + `stripAgentPreamble` +
|
|
9
|
+
* `promoteBoldTitle`): a streamed draft carries citation links, `(*Source: ...*)` notes and
|
|
10
|
+
* sometimes narration before the document. A stored letter should hold only the letter.
|
|
11
|
+
* - Coming out (`unescapeMarkdown`): the backend's parse of a stored `.md` returns the text with
|
|
12
|
+
* markdown punctuation backslash-escaped (`**Fees.**` comes back as `\*\*Fees\.\*\*`).
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Undo the backend's escaping of a markdown artifact: `\*\*Scope\.\*\*` becomes `**Scope.**`.
|
|
16
|
+
*
|
|
17
|
+
* THE RULE. Apply this ONLY to text of an artifact that was stored from markdown (an agent draft
|
|
18
|
+
* or an edited version, always uploaded as `.md`): for those the parser escapes every markdown
|
|
19
|
+
* punctuation character, including the backslash itself, so removing one level of escaping is the
|
|
20
|
+
* exact inverse (an author's literal `\*` is stored as `\\\*` and comes back as `\*`). Do not
|
|
21
|
+
* apply it to a PDF or Word parse, where a backslash is just a character.
|
|
22
|
+
*
|
|
23
|
+
* Details:
|
|
24
|
+
* - Only a backslash followed by markdown punctuation (``\ ` * _ { } [ ] ( ) # + - . ! | > ~ <``)
|
|
25
|
+
* is removed; `\n`, `C:\temp` and a trailing backslash are left alone.
|
|
26
|
+
* - Pairs are read left to right, so `\\*` is an escaped backslash followed by a bare `*`.
|
|
27
|
+
* - Fenced code blocks are never touched (the parser does not escape inside them).
|
|
28
|
+
* - Inline code spans: the parser DOES escape `*` and `_` there (`` `a*b` `` comes back as
|
|
29
|
+
* `` `a\*b` ``), so only `\*` and `\_` are undone inside a span; any other backslash in code
|
|
30
|
+
* (`` `re\.x` ``) is a literal and stays.
|
|
31
|
+
*/
|
|
32
|
+
declare function unescapeMarkdown(text: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* The parser also mangles the TITLE of a stored markdown document (seen on a real backend): the
|
|
35
|
+
* first heading comes back doubled (`## # Title`) or alone inside a code fence
|
|
36
|
+
* (a fence, `# Title`, a fence). Both are repaired, on the first non-blank line only, so a code
|
|
37
|
+
* block or heading later in the text is never touched. Like `unescapeMarkdown`, apply it only to
|
|
38
|
+
* artifacts stored from markdown.
|
|
39
|
+
*/
|
|
40
|
+
declare function repairParsedTitle(text: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* Text for storage from text that carries citations: `normalizeCitationMarkup` first (it hoists
|
|
43
|
+
* list, heading and bold tokens out of the link so unwrapping cannot orphan half of a `**` pair),
|
|
44
|
+
* then `[text](#cite-N)` becomes `text`, `(*Source: ...*)` notes are dropped, and a bold or
|
|
45
|
+
* heading marker that lost its partner is repaired. Fenced code is left alone.
|
|
46
|
+
*/
|
|
47
|
+
declare function unwrapCitationLinks(text: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* Cut what an agent wrote BEFORE the document, when it is narration.
|
|
50
|
+
*
|
|
51
|
+
* HEURISTIC (conservative, so a document is never trimmed by mistake). The document is taken to
|
|
52
|
+
* start at the first `#` heading, or, when there is none, at the first whole-line bold title within
|
|
53
|
+
* the first 15 lines. The text before it is removed only when ALL of these hold:
|
|
54
|
+
* 1. it is short (at most 1200 characters);
|
|
55
|
+
* 2. it is plain prose: no list, table, quote, code or heading;
|
|
56
|
+
* 3. it reads like the agent talking: first person ("I'll draft ..."), "Here is ...", "Per the
|
|
57
|
+
* instructions", "Based on the ..." and the like.
|
|
58
|
+
* A document that opens with a dateline, an address or any text that does not trip rule 3 is kept
|
|
59
|
+
* whole. A horizontal rule left at the end of the cut text is dropped with it.
|
|
60
|
+
*/
|
|
61
|
+
declare function stripAgentPreamble(text: string): string;
|
|
62
|
+
/**
|
|
63
|
+
* Make the document's title a real heading: a first line that is a bold title (`**Letter**`, even
|
|
64
|
+
* with stray inner `**`) becomes `# Letter`. A document that already opens with a heading is left
|
|
65
|
+
* alone.
|
|
66
|
+
*/
|
|
67
|
+
declare function promoteBoldTitle(text: string): string;
|
|
68
|
+
/**
|
|
69
|
+
* Everything a streamed draft needs before it is stored as the artifact's first version:
|
|
70
|
+
* `unwrapCitationLinks`, `stripAgentPreamble`, `promoteBoldTitle`, clean headings, collapsed blank
|
|
71
|
+
* runs, trimmed.
|
|
72
|
+
*/
|
|
73
|
+
declare function cleanDraftMarkdown(raw: string): string;
|
|
74
|
+
|
|
75
|
+
export { unwrapCitationLinks as a, cleanDraftMarkdown as c, promoteBoldTitle as p, repairParsedTitle as r, stripAgentPreamble as s, unescapeMarkdown as u };
|