@arbidocs/react 0.5.173 → 0.5.174
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/chat/ChatBubble.js +1 -6
- package/dist/chat/ChatBubble.js.map +2 -2
- package/dist/chat/useMessageTimer.js +4 -2
- package/dist/chat/useMessageTimer.js.map +2 -2
- package/dist/{chunk-W4W75MSO.cjs → chunk-UR5F4DNJ.cjs} +43 -45
- package/dist/chunk-UR5F4DNJ.cjs.map +1 -0
- package/dist/directmessages/DmComposer.js +5 -2
- package/dist/directmessages/DmComposer.js.map +2 -2
- package/dist/entities/EntityPill.js +2 -1
- package/dist/entities/EntityPill.js.map +2 -2
- package/dist/entities/UserEntity.js +11 -2
- package/dist/entities/UserEntity.js.map +2 -2
- package/dist/icons/ArbiBotHeadIcon.js +28 -41
- package/dist/icons/ArbiBotHeadIcon.js.map +2 -2
- package/dist/index.cjs +228 -228
- package/dist/index.cjs.map +1 -1
- package/dist/{index.d-BaZUctD1.d.ts → index.d-DIQCjS20.d.ts} +9 -2
- package/dist/index.d.ts +7 -11
- package/dist/ui/index.cjs +156 -152
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +2 -0
- package/dist/ui/index.js.map +2 -2
- package/package.json +3 -3
- package/dist/chunk-W4W75MSO.cjs.map +0 -1
package/dist/chat/ChatBubble.js
CHANGED
|
@@ -22,7 +22,6 @@ const ChatBubble = memo(function ChatBubble2({
|
|
|
22
22
|
id,
|
|
23
23
|
isLastOfRun = true,
|
|
24
24
|
senderName,
|
|
25
|
-
senderBadge,
|
|
26
25
|
avatar,
|
|
27
26
|
classNames,
|
|
28
27
|
renderMessage = (m) => m,
|
|
@@ -60,7 +59,7 @@ const ChatBubble = memo(function ChatBubble2({
|
|
|
60
59
|
"data-testid": testId,
|
|
61
60
|
className: cn(
|
|
62
61
|
"relative flex w-full min-w-0 items-start gap-2",
|
|
63
|
-
floating && "
|
|
62
|
+
floating && "bg-transparent",
|
|
64
63
|
floating && (compact ? "items-center px-3.5 py-2" : "px-4 py-3.5"),
|
|
65
64
|
!floating && (isLastOfRun ? "mb-2" : "mb-0.5")
|
|
66
65
|
),
|
|
@@ -76,10 +75,6 @@ const ChatBubble = memo(function ChatBubble2({
|
|
|
76
75
|
floating ? "min-w-0 flex-1" : cn("px-3.5 py-2 shadow-sm transition-shadow", bubbleRadius, bubbleSurface)
|
|
77
76
|
),
|
|
78
77
|
children: [
|
|
79
|
-
floating && !compact && senderName && /* @__PURE__ */ jsxs("div", { className: "mb-1 flex items-center gap-2 text-[11px] font-medium tracking-[0.01em] text-muted-foreground", children: [
|
|
80
|
-
senderName,
|
|
81
|
-
senderBadge
|
|
82
|
-
] }),
|
|
83
78
|
compact ? /* @__PURE__ */ jsx("div", { className: "truncate text-[13px] leading-5 text-muted-foreground", title: message, children: message }) : (message || !attachments) && /* @__PURE__ */ jsx(
|
|
84
79
|
"div",
|
|
85
80
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/chat/ChatBubble.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * Chat Bubble Component\n * iMessage / WhatsApp-style message bubble with read receipts and\n * consecutive-message grouping.\n *\n * Promoted from the ARBI app. To keep `@arbidocs/react` light (peers react /\n * react-dom only), the two host-owned concerns \u2014 rendering the message body\n * (the app's heavy markdown renderer) and formatting the timestamp \u2014 are\n * injected via the optional `renderMessage` / `formatTimestamp` props. Both\n * default to plain text so the component works standalone; the ARBI app shim\n * wires in `<MarkdownRenderer>` and `formatFriendlyDate` for identical output.\n */\n\nimport { memo, useState, type ReactNode } from 'react'\nimport { Trash2, Check, CheckCheck, Link } from 'lucide-react'\nimport { cn } from '../lib/utils'\n\n/** Animated typing indicator (three bouncing dots) */\nexport const TypingIndicator = memo(function TypingIndicator() {\n return (\n <div className=\"flex w-full justify-start mb-2\" data-testid=\"dm-typing-indicator\">\n <div className=\"bg-card border border-primary rounded-2xl rounded-bl-md px-4 py-2.5\">\n <div className=\"flex gap-1 items-center\">\n <span className=\"w-1.5 h-1.5 rounded-full bg-muted-foreground animate-bounce [animation-delay:0ms]\" />\n <span className=\"w-1.5 h-1.5 rounded-full bg-muted-foreground animate-bounce [animation-delay:150ms]\" />\n <span className=\"w-1.5 h-1.5 rounded-full bg-muted-foreground animate-bounce [animation-delay:300ms]\" />\n </div>\n </div>\n </div>\n )\n})\n\nexport interface ChatBubbleProps {\n appearance?: 'standard' | 'floating'\n /** Single-line query preview once its answer has arrived. */\n compact?: boolean\n message: string\n timestamp: string\n isSent: boolean\n deleted?: boolean\n read?: boolean\n onDelete?: () => void\n /**\n * Copy a shareable deep link to this exact message. Optional \u2014 the host\n * builds the URL (it knows the workspace/deployment domain, the light\n * package doesn't), this just renders the affordance and calls back.\n */\n onCopyLink?: () => void\n /** Stable DOM anchor for scroll-to-message (a notification deep link, a\n * \"jump to this message\" action). Typically the message's external id. */\n id?: string\n /** Last bubble in a same-sender run; shows the timestamp and read receipt. */\n isLastOfRun?: boolean\n /**\n * Who sent it. Rendered in the meta row on the last bubble of a run, so a\n * thread that needs attribution (a group, or a rail-less list where the peer\n * isn't in a header) gets it without a row per message.\n */\n senderName?: string\n senderBadge?: ReactNode\n /** Sender identity, shown on the same side for both participants. */\n avatar?: ReactNode\n /** Per-slot brand overrides, so a consumer pins its accent in one place. */\n classNames?: {\n /** The current user's own bubble. */\n ownBubble?: string\n /** The peer's bubble. */\n peerBubble?: string\n }\n /**\n * Render the message body. Injected by the host so the light package doesn't\n * depend on the app's markdown renderer. Defaults to plain text.\n */\n renderMessage?: (message: string) => ReactNode\n /**\n * Format the timestamp shown on the last bubble of a run. Defaults to the\n * raw string.\n */\n formatTimestamp?: (timestamp: string) => string\n /**\n * Rendered inside the bubble under the text \u2014 e.g. a message's attached\n * files. The host owns fetching and decrypting them. A message with\n * attachments and no text shows only these.\n */\n attachments?: ReactNode\n /** Marks the message row, including the deleted tombstone. */\n 'data-testid'?: string\n}\n\nexport const ChatBubble = memo(function ChatBubble({\n appearance = 'standard',\n compact = false,\n message,\n timestamp,\n isSent,\n deleted,\n read,\n onDelete,\n onCopyLink,\n id,\n isLastOfRun = true,\n senderName,\n
|
|
5
|
-
"mappings": "AAsBQ,SACE,KADF;AATR,SAAS,MAAM,gBAAgC;AAC/C,SAAS,QAAQ,OAAO,YAAY,YAAY;AAChD,SAAS,UAAU;AAGZ,MAAM,kBAAkB,KAAK,SAASA,mBAAkB;AAC7D,SACE,oBAAC,SAAI,WAAU,kCAAiC,eAAY,uBAC1D,8BAAC,SAAI,WAAU,uEACb,+BAAC,SAAI,WAAU,2BACb;AAAA,wBAAC,UAAK,WAAU,qFAAoF;AAAA,IACpG,oBAAC,UAAK,WAAU,uFAAsF;AAAA,IACtG,oBAAC,UAAK,WAAU,uFAAsF;AAAA,KACxG,GACF,GACF;AAEJ,CAAC;AA2DM,MAAM,aAAa,KAAK,SAASC,YAAW;AAAA,EACjD,aAAa;AAAA,EACb,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA
|
|
4
|
+
"sourcesContent": ["/**\n * Chat Bubble Component\n * iMessage / WhatsApp-style message bubble with read receipts and\n * consecutive-message grouping.\n *\n * Promoted from the ARBI app. To keep `@arbidocs/react` light (peers react /\n * react-dom only), the two host-owned concerns \u2014 rendering the message body\n * (the app's heavy markdown renderer) and formatting the timestamp \u2014 are\n * injected via the optional `renderMessage` / `formatTimestamp` props. Both\n * default to plain text so the component works standalone; the ARBI app shim\n * wires in `<MarkdownRenderer>` and `formatFriendlyDate` for identical output.\n */\n\nimport { memo, useState, type ReactNode } from 'react'\nimport { Trash2, Check, CheckCheck, Link } from 'lucide-react'\nimport { cn } from '../lib/utils'\n\n/** Animated typing indicator (three bouncing dots) */\nexport const TypingIndicator = memo(function TypingIndicator() {\n return (\n <div className=\"flex w-full justify-start mb-2\" data-testid=\"dm-typing-indicator\">\n <div className=\"bg-card border border-primary rounded-2xl rounded-bl-md px-4 py-2.5\">\n <div className=\"flex gap-1 items-center\">\n <span className=\"w-1.5 h-1.5 rounded-full bg-muted-foreground animate-bounce [animation-delay:0ms]\" />\n <span className=\"w-1.5 h-1.5 rounded-full bg-muted-foreground animate-bounce [animation-delay:150ms]\" />\n <span className=\"w-1.5 h-1.5 rounded-full bg-muted-foreground animate-bounce [animation-delay:300ms]\" />\n </div>\n </div>\n </div>\n )\n})\n\nexport interface ChatBubbleProps {\n appearance?: 'standard' | 'floating'\n /** Single-line query preview once its answer has arrived. */\n compact?: boolean\n message: string\n timestamp: string\n isSent: boolean\n deleted?: boolean\n read?: boolean\n onDelete?: () => void\n /**\n * Copy a shareable deep link to this exact message. Optional \u2014 the host\n * builds the URL (it knows the workspace/deployment domain, the light\n * package doesn't), this just renders the affordance and calls back.\n */\n onCopyLink?: () => void\n /** Stable DOM anchor for scroll-to-message (a notification deep link, a\n * \"jump to this message\" action). Typically the message's external id. */\n id?: string\n /** Last bubble in a same-sender run; shows the timestamp and read receipt. */\n isLastOfRun?: boolean\n /**\n * Who sent it. Rendered in the meta row on the last bubble of a run, so a\n * thread that needs attribution (a group, or a rail-less list where the peer\n * isn't in a header) gets it without a row per message.\n */\n senderName?: string\n senderBadge?: ReactNode\n /** Sender identity, shown on the same side for both participants. */\n avatar?: ReactNode\n /** Per-slot brand overrides, so a consumer pins its accent in one place. */\n classNames?: {\n /** The current user's own bubble. */\n ownBubble?: string\n /** The peer's bubble. */\n peerBubble?: string\n }\n /**\n * Render the message body. Injected by the host so the light package doesn't\n * depend on the app's markdown renderer. Defaults to plain text.\n */\n renderMessage?: (message: string) => ReactNode\n /**\n * Format the timestamp shown on the last bubble of a run. Defaults to the\n * raw string.\n */\n formatTimestamp?: (timestamp: string) => string\n /**\n * Rendered inside the bubble under the text \u2014 e.g. a message's attached\n * files. The host owns fetching and decrypting them. A message with\n * attachments and no text shows only these.\n */\n attachments?: ReactNode\n /** Marks the message row, including the deleted tombstone. */\n 'data-testid'?: string\n}\n\nexport const ChatBubble = memo(function ChatBubble({\n appearance = 'standard',\n compact = false,\n message,\n timestamp,\n isSent,\n deleted,\n read,\n onDelete,\n onCopyLink,\n id,\n isLastOfRun = true,\n senderName,\n avatar,\n classNames,\n renderMessage = (m) => m,\n formatTimestamp = (t) => t,\n attachments,\n 'data-testid': testId,\n}: ChatBubbleProps) {\n const [isHovered, setIsHovered] = useState(false)\n const [isFocused, setIsFocused] = useState(false)\n const showActions = isHovered || isFocused\n\n // No \"edited\" indicator: `updated_at` is also bumped by read-state\n // patches, so we can't tell a real content edit from a recipient\n // marking the message as read. The created_at timestamp is the only\n // honest signal we can show here.\n\n if (deleted) {\n return (\n <div id={id} data-testid={testId} className=\"flex w-full justify-start mb-2\">\n <div className=\"text-sm text-muted-foreground italic px-3 py-1\">Message deleted</div>\n </div>\n )\n }\n\n const floating = appearance === 'floating'\n const bubbleRadius = 'rounded-lg'\n\n // Own messages sit on a soft brand tint rather than full `primary`: a\n // saturated block per message shouts on a long thread, and a light surface\n // means markdown needs no colour inversion.\n //\n // The tint is `ai-accent-soft`, NOT `accent`. Plenty of themes set `accent`\n // equal to `muted` and a hair off `background` \u2014 ARBI's differ by 3% \u2014 so an\n // accent bubble there is invisible against the thread. `ai-accent-soft` is\n // part of the AI-accent contract every consuming app defines explicitly, so\n // it is a tint by construction.\n const bubbleSurface = isSent\n ? cn('bg-ai-accent-soft text-foreground chat-bubble-sent', classNames?.ownBubble)\n : cn('border border-border bg-card text-card-foreground', classNames?.peerBubble)\n\n const copyLinkButton = onCopyLink && (\n <button\n onClick={onCopyLink}\n onFocus={() => setIsFocused(true)}\n onBlur={() => setIsFocused(false)}\n className={cn(\n 'self-end p-1 transition-opacity focus:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded',\n showActions ? 'opacity-100 text-foreground' : 'opacity-0 text-muted-foreground'\n )}\n aria-label=\"Copy link to this message\"\n >\n <Link className=\"w-3.5 h-3.5\" />\n </button>\n )\n\n return (\n <div\n id={id}\n data-testid={testId}\n className={cn(\n 'relative flex w-full min-w-0 items-start gap-2',\n floating && 'bg-transparent',\n floating && (compact ? 'items-center px-3.5 py-2' : 'px-4 py-3.5'),\n !floating && (isLastOfRun ? 'mb-2' : 'mb-0.5')\n )}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n >\n {avatar && <div className={cn('shrink-0', !compact && 'pt-1')}>{avatar}</div>}\n\n <div className=\"flex min-w-0 flex-1 flex-col\">\n <div\n className={cn(\n 'break-words',\n floating\n ? 'min-w-0 flex-1'\n : cn('px-3.5 py-2 shadow-sm transition-shadow', bubbleRadius, bubbleSurface)\n )}\n >\n {compact ? (\n <div className=\"truncate text-[13px] leading-5 text-muted-foreground\" title={message}>\n {message}\n </div>\n ) : (\n (message || !attachments) && (\n <div\n className={cn(\n 'text-sm [&_.markdown-content]:space-y-1.5 [&_pre]:max-w-full [&_pre]:overflow-x-auto',\n floating && 'leading-[1.65] [&_.markdown-content]:leading-[1.65]',\n floating && isSent && 'text-[13px] text-muted-foreground'\n )}\n >\n {renderMessage(message)}\n </div>\n )\n )}\n {attachments && <div className={cn(message && 'mt-1.5')}>{attachments}</div>}\n\n {/* Sender + timestamp + read receipt, only on the last bubble of the\n run \u2014 a meta row per message is noise in a 1:1 thread. */}\n {!floating && isLastOfRun && (\n <div className={cn('flex items-center gap-1.5 mt-0.5', 'justify-start')}>\n {senderName && (\n <span className=\"text-xs font-medium leading-none opacity-90\">{senderName}</span>\n )}\n <span className=\"text-xs leading-none opacity-70\">{formatTimestamp(timestamp)}</span>\n {isSent &&\n (read ? (\n <CheckCheck className=\"w-3.5 h-3.5 flex-shrink-0 opacity-80\" />\n ) : (\n <Check className=\"w-3.5 h-3.5 flex-shrink-0 opacity-60\" />\n ))}\n </div>\n )}\n </div>\n </div>\n\n {/* Message actions share the same position in either direction. */}\n {(onDelete || copyLinkButton) && (\n <div\n className={cn(\n 'absolute right-1 top-1 flex items-center gap-0.5 rounded',\n showActions && 'bg-background/90'\n )}\n >\n {onDelete && (\n <button\n onClick={onDelete}\n onFocus={() => setIsFocused(true)}\n onBlur={() => setIsFocused(false)}\n className={cn(\n 'self-end p-1 transition-opacity focus:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded',\n showActions ? 'opacity-100 text-destructive' : 'opacity-0 text-muted-foreground'\n )}\n aria-label=\"Delete message\"\n >\n <Trash2 className=\"w-3.5 h-3.5\" />\n </button>\n )}\n {copyLinkButton}\n </div>\n )}\n </div>\n )\n})\n"],
|
|
5
|
+
"mappings": "AAsBQ,SACE,KADF;AATR,SAAS,MAAM,gBAAgC;AAC/C,SAAS,QAAQ,OAAO,YAAY,YAAY;AAChD,SAAS,UAAU;AAGZ,MAAM,kBAAkB,KAAK,SAASA,mBAAkB;AAC7D,SACE,oBAAC,SAAI,WAAU,kCAAiC,eAAY,uBAC1D,8BAAC,SAAI,WAAU,uEACb,+BAAC,SAAI,WAAU,2BACb;AAAA,wBAAC,UAAK,WAAU,qFAAoF;AAAA,IACpG,oBAAC,UAAK,WAAU,uFAAsF;AAAA,IACtG,oBAAC,UAAK,WAAU,uFAAsF;AAAA,KACxG,GACF,GACF;AAEJ,CAAC;AA2DM,MAAM,aAAa,KAAK,SAASC,YAAW;AAAA,EACjD,aAAa;AAAA,EACb,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgB,CAAC,MAAM;AAAA,EACvB,kBAAkB,CAAC,MAAM;AAAA,EACzB;AAAA,EACA,eAAe;AACjB,GAAoB;AAClB,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAChD,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAChD,QAAM,cAAc,aAAa;AAOjC,MAAI,SAAS;AACX,WACE,oBAAC,SAAI,IAAQ,eAAa,QAAQ,WAAU,kCAC1C,8BAAC,SAAI,WAAU,kDAAiD,6BAAe,GACjF;AAAA,EAEJ;AAEA,QAAM,WAAW,eAAe;AAChC,QAAM,eAAe;AAWrB,QAAM,gBAAgB,SAClB,GAAG,sDAAsD,YAAY,SAAS,IAC9E,GAAG,qDAAqD,YAAY,UAAU;AAElF,QAAM,iBAAiB,cACrB;AAAA,IAAC;AAAA;AAAA,MACC,SAAS;AAAA,MACT,SAAS,MAAM,aAAa,IAAI;AAAA,MAChC,QAAQ,MAAM,aAAa,KAAK;AAAA,MAChC,WAAW;AAAA,QACT;AAAA,QACA,cAAc,gCAAgC;AAAA,MAChD;AAAA,MACA,cAAW;AAAA,MAEX,8BAAC,QAAK,WAAU,eAAc;AAAA;AAAA,EAChC;AAGF,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,eAAa;AAAA,MACb,WAAW;AAAA,QACT;AAAA,QACA,YAAY;AAAA,QACZ,aAAa,UAAU,6BAA6B;AAAA,QACpD,CAAC,aAAa,cAAc,SAAS;AAAA,MACvC;AAAA,MACA,cAAc,MAAM,aAAa,IAAI;AAAA,MACrC,cAAc,MAAM,aAAa,KAAK;AAAA,MAErC;AAAA,kBAAU,oBAAC,SAAI,WAAW,GAAG,YAAY,CAAC,WAAW,MAAM,GAAI,kBAAO;AAAA,QAEvE,oBAAC,SAAI,WAAU,gCACb;AAAA,UAAC;AAAA;AAAA,YACC,WAAW;AAAA,cACT;AAAA,cACA,WACI,mBACA,GAAG,2CAA2C,cAAc,aAAa;AAAA,YAC/E;AAAA,YAEC;AAAA,wBACC,oBAAC,SAAI,WAAU,wDAAuD,OAAO,SAC1E,mBACH,KAEC,WAAW,CAAC,gBACX;AAAA,gBAAC;AAAA;AAAA,kBACC,WAAW;AAAA,oBACT;AAAA,oBACA,YAAY;AAAA,oBACZ,YAAY,UAAU;AAAA,kBACxB;AAAA,kBAEC,wBAAc,OAAO;AAAA;AAAA,cACxB;AAAA,cAGH,eAAe,oBAAC,SAAI,WAAW,GAAG,WAAW,QAAQ,GAAI,uBAAY;AAAA,cAIrE,CAAC,YAAY,eACZ,qBAAC,SAAI,WAAW,GAAG,oCAAoC,eAAe,GACnE;AAAA,8BACC,oBAAC,UAAK,WAAU,+CAA+C,sBAAW;AAAA,gBAE5E,oBAAC,UAAK,WAAU,mCAAmC,0BAAgB,SAAS,GAAE;AAAA,gBAC7E,WACE,OACC,oBAAC,cAAW,WAAU,wCAAuC,IAE7D,oBAAC,SAAM,WAAU,wCAAuC;AAAA,iBAE9D;AAAA;AAAA;AAAA,QAEJ,GACF;AAAA,SAGE,YAAY,mBACZ;AAAA,UAAC;AAAA;AAAA,YACC,WAAW;AAAA,cACT;AAAA,cACA,eAAe;AAAA,YACjB;AAAA,YAEC;AAAA,0BACC;AAAA,gBAAC;AAAA;AAAA,kBACC,SAAS;AAAA,kBACT,SAAS,MAAM,aAAa,IAAI;AAAA,kBAChC,QAAQ,MAAM,aAAa,KAAK;AAAA,kBAChC,WAAW;AAAA,oBACT;AAAA,oBACA,cAAc,iCAAiC;AAAA,kBACjD;AAAA,kBACA,cAAW;AAAA,kBAEX,8BAAC,UAAO,WAAU,eAAc;AAAA;AAAA,cAClC;AAAA,cAED;AAAA;AAAA;AAAA,QACH;AAAA;AAAA;AAAA,EAEJ;AAEJ,CAAC;",
|
|
6
6
|
"names": ["TypingIndicator", "ChatBubble"]
|
|
7
7
|
}
|
|
@@ -4,12 +4,14 @@ function useMessageTimer({
|
|
|
4
4
|
conversationId,
|
|
5
5
|
messageId,
|
|
6
6
|
isUser,
|
|
7
|
-
isGenerating
|
|
7
|
+
isGenerating,
|
|
8
|
+
startTime: observedStartTime
|
|
8
9
|
}) {
|
|
9
10
|
const session = useArbiSessionStore();
|
|
10
11
|
const convId = conversationId || "new";
|
|
11
12
|
const timerKey = `${convId}:${messageId}`;
|
|
12
|
-
const
|
|
13
|
+
const streamStartTime = useArbiSessionState((s) => s.generating[convId]?.startTime ?? null);
|
|
14
|
+
const generationStartTime = observedStartTime ?? streamStartTime;
|
|
13
15
|
const storedElapsed = useArbiSessionState((s) => s.messageTimers[timerKey]?.elapsedTime);
|
|
14
16
|
const [elapsedTime, setElapsedTime] = useState(0);
|
|
15
17
|
const lastElapsedRef = useRef(0);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/chat/useMessageTimer.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * The time an answer has taken: counted on the client while its turn runs (separately from the\n * server's step times), and saved when it stops showing, so a finished answer keeps its time and a\n * re-attached run keeps counting from its real start.\n */\n\nimport { useEffect, useRef, useState } from 'react'\nimport { useArbiSessionState, useArbiSessionStore } from '../session'\n\nexport interface UseMessageTimerOptions {\n conversationId: string | undefined\n messageId: string | undefined\n isUser: boolean\n isGenerating: boolean\n}\n\nexport interface MessageTimerResult {\n /** Seconds. */\n elapsedTime: number\n}\n\nexport function useMessageTimer({\n conversationId,\n messageId,\n isUser,\n isGenerating,\n}: UseMessageTimerOptions): MessageTimerResult {\n const session = useArbiSessionStore()\n const convId = conversationId || 'new'\n const timerKey = `${convId}:${messageId}`\n\n const
|
|
5
|
-
"mappings": "AAMA,SAAS,WAAW,QAAQ,gBAAgB;AAC5C,SAAS,qBAAqB,2BAA2B;
|
|
4
|
+
"sourcesContent": ["/**\n * The time an answer has taken: counted on the client while its turn runs (separately from the\n * server's step times), and saved when it stops showing, so a finished answer keeps its time and a\n * re-attached run keeps counting from its real start.\n */\n\nimport { useEffect, useRef, useState } from 'react'\nimport { useArbiSessionState, useArbiSessionStore } from '../session'\n\nexport interface UseMessageTimerOptions {\n conversationId: string | undefined\n messageId: string | undefined\n isUser: boolean\n isGenerating: boolean\n /** Authoritative start for runs observed outside the workspace stream (e.g. personal chat). */\n startTime?: number\n}\n\nexport interface MessageTimerResult {\n /** Seconds. */\n elapsedTime: number\n}\n\nexport function useMessageTimer({\n conversationId,\n messageId,\n isUser,\n isGenerating,\n startTime: observedStartTime,\n}: UseMessageTimerOptions): MessageTimerResult {\n const session = useArbiSessionStore()\n const convId = conversationId || 'new'\n const timerKey = `${convId}:${messageId}`\n\n const streamStartTime = useArbiSessionState((s) => s.generating[convId]?.startTime ?? null)\n const generationStartTime = observedStartTime ?? streamStartTime\n const storedElapsed = useArbiSessionState((s) => s.messageTimers[timerKey]?.elapsedTime)\n\n const [elapsedTime, setElapsedTime] = useState(0)\n // The latest elapsed time, for the cleanup to save without depending on it.\n const lastElapsedRef = useRef(0)\n\n // A finished answer shows its saved time.\n useEffect(() => {\n if (!isUser && !isGenerating && storedElapsed) setElapsedTime(storedElapsed)\n }, [isUser, isGenerating, storedElapsed])\n\n // Count while the turn runs. The cleanup saves the final time through the store's current state,\n // so the saved timer is not a dependency (saving would re-run the effect, which saves again...).\n useEffect(() => {\n if (isUser || !isGenerating || !generationStartTime) return\n const startTime = generationStartTime\n const key = timerKey\n const interval = setInterval(() => {\n const elapsed = (Date.now() - startTime) / 1000\n lastElapsedRef.current = elapsed\n setElapsedTime(elapsed)\n }, 100)\n return () => {\n clearInterval(interval)\n const finalElapsed = lastElapsedRef.current || (Date.now() - startTime) / 1000\n session.setMessageTimer(key, { startTime, elapsedTime: finalElapsed })\n }\n }, [isUser, isGenerating, generationStartTime, timerKey, session])\n\n return { elapsedTime }\n}\n"],
|
|
5
|
+
"mappings": "AAMA,SAAS,WAAW,QAAQ,gBAAgB;AAC5C,SAAS,qBAAqB,2BAA2B;AAgBlD,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AACb,GAA+C;AAC7C,QAAM,UAAU,oBAAoB;AACpC,QAAM,SAAS,kBAAkB;AACjC,QAAM,WAAW,GAAG,MAAM,IAAI,SAAS;AAEvC,QAAM,kBAAkB,oBAAoB,CAAC,MAAM,EAAE,WAAW,MAAM,GAAG,aAAa,IAAI;AAC1F,QAAM,sBAAsB,qBAAqB;AACjD,QAAM,gBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,QAAQ,GAAG,WAAW;AAEvF,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,CAAC;AAEhD,QAAM,iBAAiB,OAAO,CAAC;AAG/B,YAAU,MAAM;AACd,QAAI,CAAC,UAAU,CAAC,gBAAgB,cAAe,gBAAe,aAAa;AAAA,EAC7E,GAAG,CAAC,QAAQ,cAAc,aAAa,CAAC;AAIxC,YAAU,MAAM;AACd,QAAI,UAAU,CAAC,gBAAgB,CAAC,oBAAqB;AACrD,UAAM,YAAY;AAClB,UAAM,MAAM;AACZ,UAAM,WAAW,YAAY,MAAM;AACjC,YAAM,WAAW,KAAK,IAAI,IAAI,aAAa;AAC3C,qBAAe,UAAU;AACzB,qBAAe,OAAO;AAAA,IACxB,GAAG,GAAG;AACN,WAAO,MAAM;AACX,oBAAc,QAAQ;AACtB,YAAM,eAAe,eAAe,YAAY,KAAK,IAAI,IAAI,aAAa;AAC1E,cAAQ,gBAAgB,KAAK,EAAE,WAAW,aAAa,aAAa,CAAC;AAAA,IACvE;AAAA,EACF,GAAG,CAAC,QAAQ,cAAc,qBAAqB,UAAU,OAAO,CAAC;AAEjE,SAAO,EAAE,YAAY;AACvB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -464,7 +464,8 @@ var EntityPill = React.forwardRef(function EntityPill2({
|
|
|
464
464
|
{
|
|
465
465
|
className: chunkS6A6FSG7_cjs.cn(
|
|
466
466
|
textSizeClass,
|
|
467
|
-
"font-medium tracking-[0.01em] truncate leading-tight min-w-0
|
|
467
|
+
"font-medium tracking-[0.01em] truncate leading-tight min-w-0 decoration-dotted decoration-current/35 underline-offset-4",
|
|
468
|
+
!disabled && (onClick || href) && "group-hover/pill:underline group-focus-visible/pill:underline",
|
|
468
469
|
labelMaxWidth,
|
|
469
470
|
labelClassName
|
|
470
471
|
),
|
|
@@ -2914,46 +2915,34 @@ function ProjectEntity({
|
|
|
2914
2915
|
}
|
|
2915
2916
|
);
|
|
2916
2917
|
}
|
|
2917
|
-
var ArbiBotHeadIcon = ({ size = 24, className = "" }) =>
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
"svg",
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
}
|
|
2946
|
-
),
|
|
2947
|
-
/* @__PURE__ */ jsxRuntime.jsxs("g", { transform: "translate(0,250) scale(0.1,-0.1)", fill: "currentColor", stroke: "none", children: [
|
|
2948
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M785 1777 c-60 -60 -59 -134 1 -186 92 -82 236 9 204 128 -25 93 -138 125 -205 58z m161 -29 c7 -22 -19 -52 -40 -45 -21 7 -30 35 -17 51 19 23 48 20 57 -6z" }),
|
|
2949
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M1591 1803 c-128 -67 -85 -243 60 -243 83 0 141 99 105 178 -32 69 -103 97 -165 65z m127 -59 c4 -25 -19 -47 -41 -38 -22 8 -30 34 -16 51 17 20 53 12 57 -13z" }),
|
|
2950
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M843 1347 c-9 -15 9 -63 41 -108 148 -202 565 -209 730 -12 37 44 60 103 47 116 -13 13 -810 17 -818 4z" })
|
|
2951
|
-
] })
|
|
2952
|
-
] })
|
|
2953
|
-
]
|
|
2954
|
-
}
|
|
2955
|
-
);
|
|
2956
|
-
};
|
|
2918
|
+
var ArbiBotHeadIcon = ({ size = 24, className = "" }) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2919
|
+
"svg",
|
|
2920
|
+
{
|
|
2921
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2922
|
+
width: size,
|
|
2923
|
+
height: size,
|
|
2924
|
+
viewBox: "0 0 32 32",
|
|
2925
|
+
fill: "none",
|
|
2926
|
+
stroke: "currentColor",
|
|
2927
|
+
strokeWidth: "2.5",
|
|
2928
|
+
strokeLinecap: "round",
|
|
2929
|
+
strokeLinejoin: "round",
|
|
2930
|
+
"aria-hidden": "true",
|
|
2931
|
+
focusable: "false",
|
|
2932
|
+
className,
|
|
2933
|
+
children: [
|
|
2934
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4.5 14C4.5 7.65 9.65 4 16 4s11.5 3.65 11.5 10v4c0 6-5.15 10-11.5 10S4.5 24 4.5 18Z" }),
|
|
2935
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4.5 13h2m19 0h2m-13 1h3" }),
|
|
2936
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "6.5", y: "10.5", width: "8", height: "7", rx: "3.5" }),
|
|
2937
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "17.5", y: "10.5", width: "8", height: "7", rx: "3.5" }),
|
|
2938
|
+
/* @__PURE__ */ jsxRuntime.jsxs("g", { fill: "currentColor", stroke: "none", children: [
|
|
2939
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "10.5", cy: "14", r: "1.25" }),
|
|
2940
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "21.5", cy: "14", r: "1.25" })
|
|
2941
|
+
] }),
|
|
2942
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M11.5 21.5c2.5 2 6.5 2 9 0" })
|
|
2943
|
+
]
|
|
2944
|
+
}
|
|
2945
|
+
);
|
|
2957
2946
|
function VerifiedBadge({ className, label = "Identity verified" }) {
|
|
2958
2947
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2959
2948
|
lucideReact.BadgeCheck,
|
|
@@ -3131,14 +3120,23 @@ var UserEntity = React.memo(function UserEntity2({
|
|
|
3131
3120
|
}
|
|
3132
3121
|
) });
|
|
3133
3122
|
if (variant === "pill") {
|
|
3123
|
+
const clickable = interactive && !!onClick;
|
|
3134
3124
|
const row = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3135
3125
|
pillAvatar,
|
|
3136
|
-
displayName && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3126
|
+
displayName && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3127
|
+
"span",
|
|
3128
|
+
{
|
|
3129
|
+
className: chunkS6A6FSG7_cjs.cn(
|
|
3130
|
+
"min-w-0 max-w-[320px] truncate text-sm font-medium tracking-[0.01em] decoration-dotted decoration-current/35 underline-offset-4 leading-tight",
|
|
3131
|
+
clickable && "group-hover/pill:underline group-focus-visible/pill:underline"
|
|
3132
|
+
),
|
|
3133
|
+
children: displayName
|
|
3134
|
+
}
|
|
3135
|
+
),
|
|
3137
3136
|
isVerified && !isAgent2 && /* @__PURE__ */ jsxRuntime.jsx(VerifiedBadge, {}),
|
|
3138
3137
|
agentBadge
|
|
3139
3138
|
] });
|
|
3140
3139
|
const rowClass = "group/pill inline-flex min-w-0 items-center gap-2";
|
|
3141
|
-
const clickable = interactive && !!onClick;
|
|
3142
3140
|
const clickableClass = "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-['']";
|
|
3143
3141
|
if (resolvedTooltip) {
|
|
3144
3142
|
return /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
|
|
@@ -5443,5 +5441,5 @@ exports.toggleVariants = toggleVariants;
|
|
|
5443
5441
|
exports.useAudioRecorder = useAudioRecorder;
|
|
5444
5442
|
exports.useDictateContext = useDictateContext;
|
|
5445
5443
|
exports.usesOriginalBytesForViewer = usesOriginalBytesForViewer;
|
|
5446
|
-
//# sourceMappingURL=chunk-
|
|
5447
|
-
//# sourceMappingURL=chunk-
|
|
5444
|
+
//# sourceMappingURL=chunk-UR5F4DNJ.cjs.map
|
|
5445
|
+
//# sourceMappingURL=chunk-UR5F4DNJ.cjs.map
|