@arbidocs/blocks 0.4.15 → 0.4.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/index.cjs +369 -171
- package/dist/agents/index.js +4 -2
- package/dist/agents/tasks/DueDateMenu.d.ts +32 -0
- package/dist/agents/tasks/NewThreadDialog.d.ts +53 -0
- package/dist/agents/tasks/PersonPill.d.ts +22 -0
- package/dist/agents/tasks/PillSelect.d.ts +39 -0
- package/dist/agents/tasks/TaskActivityDialog.d.ts +14 -0
- package/dist/agents/tasks/TaskActivityTimeline.d.ts +54 -0
- package/dist/agents/tasks/TaskComposer.d.ts +6 -106
- package/dist/agents/tasks/TaskMoveDialog.d.ts +25 -0
- package/dist/agents/tasks/TaskOutputsCell.d.ts +23 -0
- package/dist/agents/tasks/TaskPlan.d.ts +4 -2
- package/dist/agents/tasks/TaskReviewActions.d.ts +44 -0
- package/dist/agents/tasks/TaskRowMenu.d.ts +28 -0
- package/dist/agents/tasks/TaskStatusPill.d.ts +24 -0
- package/dist/agents/tasks/TaskTable.d.ts +99 -0
- package/dist/agents/tasks/TaskThreadChip.d.ts +19 -0
- package/dist/agents/tasks/TaskTriggerChip.d.ts +24 -0
- package/dist/agents/tasks/TasksChrome.d.ts +17 -17
- package/dist/agents/tasks/WorkflowComposer.d.ts +10 -0
- package/dist/agents/tasks/WorkflowsTable.d.ts +72 -0
- package/dist/agents/tasks/gridWidth.d.ts +11 -0
- package/dist/agents/tasks/index.d.ts +23 -7
- package/dist/agents/tasks/taskColumns.d.ts +39 -63
- package/dist/agents/tasks/taskComposerTypes.d.ts +217 -0
- package/dist/agents/tasks/taskLabels.d.ts +27 -10
- package/dist/agents/tasks/taskRequest.d.ts +151 -25
- package/dist/agents/tasks/taskRows.d.ts +111 -0
- package/dist/agents/tasks/taskTableLabels.d.ts +64 -0
- package/dist/agents/tasks/workflowColumns.d.ts +23 -0
- package/dist/agents/tasks/workflowRows.d.ts +44 -0
- package/dist/agents/tasks/workflowTableLabels.d.ts +53 -0
- package/dist/agents/workflows/WorkflowConfigDialog.d.ts +5 -0
- package/dist/agents/workflows/index.d.ts +1 -0
- package/dist/agents/workflows/scopeRender.d.ts +10 -0
- package/dist/agents/workflows/types.d.ts +2 -0
- package/dist/chat/AssistantModeToggle.d.ts +25 -0
- package/dist/chat/MentionMenu.d.ts +52 -0
- package/dist/chat/index.cjs +119 -63
- package/dist/chat/index.d.ts +4 -0
- package/dist/chat/index.js +1 -1
- package/dist/chat/mentions.d.ts +64 -0
- package/dist/chat/useMentionAutocomplete.d.ts +33 -0
- package/dist/{chunk-IMA6I73C.js → chunk-ABSII3ND.js} +336 -4
- package/dist/chunk-ABSII3ND.js.map +1 -0
- package/dist/{chunk-22T6KHGB.cjs → chunk-C2V6HQKG.cjs} +348 -2
- package/dist/chunk-C2V6HQKG.cjs.map +1 -0
- package/dist/chunk-IC2VHFWR.js +158 -0
- package/dist/chunk-IC2VHFWR.js.map +1 -0
- package/dist/{chunk-67HGXV4I.cjs → chunk-IWOOGRNG.cjs} +4276 -855
- package/dist/chunk-IWOOGRNG.cjs.map +1 -0
- package/dist/{chunk-D6XY3C4O.cjs → chunk-JGZTRLKL.cjs} +207 -139
- package/dist/chunk-JGZTRLKL.cjs.map +1 -0
- package/dist/{chunk-H7OD4CHN.js → chunk-NUPVHEJW.js} +208 -140
- package/dist/chunk-NUPVHEJW.js.map +1 -0
- package/dist/{chunk-CVFBSUXL.js → chunk-OMF7444S.js} +4223 -851
- package/dist/chunk-OMF7444S.js.map +1 -0
- package/dist/chunk-ZPERNIMP.cjs +162 -0
- package/dist/chunk-ZPERNIMP.cjs.map +1 -0
- package/dist/connection/ai.d.ts +4 -1
- package/dist/facts/FactRowActions.d.ts +5 -1
- package/dist/facts/factColumns.d.ts +1 -1
- package/dist/facts/index.cjs +18 -9
- package/dist/facts/index.cjs.map +1 -1
- package/dist/facts/index.js +13 -4
- package/dist/facts/index.js.map +1 -1
- package/dist/files/GridView.d.ts +5 -0
- package/dist/files/index.cjs +17 -17
- package/dist/files/index.js +3 -4
- package/dist/files/index.js.map +1 -1
- package/dist/index.cjs +495 -243
- package/dist/index.js +4 -4
- package/dist/settings/ConversationSettingsParts.d.ts +5 -1
- package/dist/settings/index.cjs +8 -3
- package/dist/settings/index.cjs.map +1 -1
- package/dist/settings/index.js +8 -3
- package/dist/settings/index.js.map +1 -1
- package/dist/site/index.cjs +9 -9
- package/dist/site/index.js +1 -1
- package/dist/workspaces/index.cjs +1 -1
- package/dist/workspaces/index.cjs.map +1 -1
- package/dist/workspaces/index.js +1 -1
- package/dist/workspaces/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/agents/tasks/LiveRunsBanner.d.ts +0 -26
- package/dist/agents/tasks/TaskRowActions.d.ts +0 -43
- package/dist/chunk-22T6KHGB.cjs.map +0 -1
- package/dist/chunk-67HGXV4I.cjs.map +0 -1
- package/dist/chunk-CVFBSUXL.js.map +0 -1
- package/dist/chunk-D6XY3C4O.cjs.map +0 -1
- package/dist/chunk-H7OD4CHN.js.map +0 -1
- package/dist/chunk-IMA6I73C.js.map +0 -1
- package/dist/chunk-NUNKSZKU.js +0 -203
- package/dist/chunk-NUNKSZKU.js.map +0 -1
- package/dist/chunk-V4ISCZJ7.cjs +0 -207
- package/dist/chunk-V4ISCZJ7.cjs.map +0 -1
|
@@ -4,7 +4,7 @@ import { useAssistantDock, useChatSurface } from './chunk-UVIOQUJA.js';
|
|
|
4
4
|
import { BlocksTooltipProvider } from './chunk-KZJAG7T3.js';
|
|
5
5
|
import { prefixedTestId, testIdOr } from './chunk-7F6CBP3Z.js';
|
|
6
6
|
import { memo, useId, useRef, useEffect, forwardRef, useState, useCallback, useMemo, Fragment as Fragment$1 } from 'react';
|
|
7
|
-
import { Globe, BookOpen, ChevronsUpDown, Search, SquareSlash, Pin, X, Network, ArrowLeft, ArrowRight, Crown, Glasses, Zap, Sparkles, Check, Settings, Plus,
|
|
7
|
+
import { Globe, BookOpen, Bot, AtSign, ChevronsUpDown, Search, SquareSlash, MessagesSquare, Pin, X, Network, ArrowLeft, ArrowRight, Crown, Glasses, Zap, Sparkles, Check, Settings, Plus, Download, MessageCircleQuestion, Clock, Play, Pause, Loader2, MessageSquare, CheckCircle, Tag, User } from 'lucide-react';
|
|
8
8
|
import { cn, Button, HoverCardContent, Input, Badge, Tooltip, TooltipTrigger, TooltipContent, Popover, PopoverTrigger, PopoverContent, PassageCard, Tabs, TabsList, TabsTrigger, TabsContent } from '@arbidocs/react/ui';
|
|
9
9
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
10
10
|
import DOMPurify from 'dompurify';
|
|
@@ -221,6 +221,338 @@ var SlashMenu = memo(function SlashMenu2({
|
|
|
221
221
|
}
|
|
222
222
|
);
|
|
223
223
|
});
|
|
224
|
+
var DEFAULT_MENTION_LABELS = {
|
|
225
|
+
hint: "Enter or Tab to mention, Esc to dismiss",
|
|
226
|
+
list: "People and assistant to mention",
|
|
227
|
+
resultCount: (count) => `${count} ${count === 1 ? "match" : "matches"}`,
|
|
228
|
+
assistantBadge: "AI",
|
|
229
|
+
chipTitle: (label, kind) => kind === "assistant" ? `${label} (AI assistant)` : label
|
|
230
|
+
};
|
|
231
|
+
var MentionMenu = memo(function MentionMenu2({
|
|
232
|
+
open,
|
|
233
|
+
placement = "above",
|
|
234
|
+
items,
|
|
235
|
+
selectedIndex,
|
|
236
|
+
setSelectedIndex,
|
|
237
|
+
listboxId: listboxIdProp,
|
|
238
|
+
onSelect,
|
|
239
|
+
className,
|
|
240
|
+
labels,
|
|
241
|
+
testId,
|
|
242
|
+
itemTestIdPrefix
|
|
243
|
+
}) {
|
|
244
|
+
const l = { ...DEFAULT_MENTION_LABELS, ...labels };
|
|
245
|
+
const ownId = useId();
|
|
246
|
+
const listboxId = listboxIdProp ?? ownId;
|
|
247
|
+
const scrollRef = useRef(null);
|
|
248
|
+
useEffect(() => {
|
|
249
|
+
if (!open) return;
|
|
250
|
+
const el = scrollRef.current?.querySelector(
|
|
251
|
+
`[data-mention-index="${selectedIndex}"]`
|
|
252
|
+
);
|
|
253
|
+
el?.scrollIntoView?.({ block: "nearest" });
|
|
254
|
+
}, [open, selectedIndex]);
|
|
255
|
+
if (!open || items.length === 0) return null;
|
|
256
|
+
return /* @__PURE__ */ jsxs(
|
|
257
|
+
"div",
|
|
258
|
+
{
|
|
259
|
+
"data-slot": "mention-menu",
|
|
260
|
+
className: cn(
|
|
261
|
+
"absolute left-0 right-0 z-30 max-h-64 overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-lg",
|
|
262
|
+
placement === "above" ? "bottom-full mb-2" : "top-full mt-2",
|
|
263
|
+
className
|
|
264
|
+
),
|
|
265
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
266
|
+
"data-testid": testIdOr(testId, { testId: "mention-menu" }),
|
|
267
|
+
children: [
|
|
268
|
+
/* @__PURE__ */ jsx("div", { className: "border-b border-border/50 px-3 py-1.5 text-xs text-muted-foreground", children: l.hint }),
|
|
269
|
+
/* @__PURE__ */ jsx("div", { className: "sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", children: l.resultCount(items.length) }),
|
|
270
|
+
/* @__PURE__ */ jsx(
|
|
271
|
+
"div",
|
|
272
|
+
{
|
|
273
|
+
ref: scrollRef,
|
|
274
|
+
id: listboxId,
|
|
275
|
+
role: "listbox",
|
|
276
|
+
"aria-label": l.list,
|
|
277
|
+
className: "scrollbar-subtle max-h-56 overflow-y-auto py-1",
|
|
278
|
+
children: items.map((item, index) => {
|
|
279
|
+
const isActive = index === selectedIndex;
|
|
280
|
+
const Icon = item.kind === "assistant" ? Bot : AtSign;
|
|
281
|
+
return /* @__PURE__ */ jsxs(
|
|
282
|
+
"div",
|
|
283
|
+
{
|
|
284
|
+
id: listOptionId(listboxId, index),
|
|
285
|
+
role: "option",
|
|
286
|
+
"aria-selected": isActive,
|
|
287
|
+
"data-mention-index": index,
|
|
288
|
+
className: cn(
|
|
289
|
+
"flex cursor-pointer items-center gap-2 px-3 py-1.5 text-sm pointer-coarse:min-h-11",
|
|
290
|
+
isActive ? "bg-accent text-accent-foreground" : "hover:bg-accent/50"
|
|
291
|
+
),
|
|
292
|
+
onMouseEnter: () => setSelectedIndex(index),
|
|
293
|
+
onClick: () => onSelect(item),
|
|
294
|
+
"data-testid": prefixedTestId(itemTestIdPrefix, item.id, {
|
|
295
|
+
testId: `mention-item-${item.id}`
|
|
296
|
+
}),
|
|
297
|
+
children: [
|
|
298
|
+
/* @__PURE__ */ jsx(Icon, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground", "aria-hidden": "true" }),
|
|
299
|
+
/* @__PURE__ */ jsx("span", { className: "shrink-0 font-medium text-foreground", children: item.label }),
|
|
300
|
+
item.kind === "assistant" && /* @__PURE__ */ jsx("span", { className: "shrink-0 rounded bg-muted px-1 text-[10px] font-medium uppercase text-muted-foreground", children: l.assistantBadge }),
|
|
301
|
+
item.description && /* @__PURE__ */ jsx("span", { className: "truncate text-xs text-muted-foreground", children: item.description })
|
|
302
|
+
]
|
|
303
|
+
},
|
|
304
|
+
item.id
|
|
305
|
+
);
|
|
306
|
+
})
|
|
307
|
+
}
|
|
308
|
+
)
|
|
309
|
+
]
|
|
310
|
+
}
|
|
311
|
+
);
|
|
312
|
+
});
|
|
313
|
+
function MentionChip({
|
|
314
|
+
label,
|
|
315
|
+
kind,
|
|
316
|
+
id,
|
|
317
|
+
isSelf,
|
|
318
|
+
labels,
|
|
319
|
+
className,
|
|
320
|
+
testId
|
|
321
|
+
}) {
|
|
322
|
+
const l = { ...DEFAULT_MENTION_LABELS, ...labels };
|
|
323
|
+
return /* @__PURE__ */ jsxs(
|
|
324
|
+
"span",
|
|
325
|
+
{
|
|
326
|
+
"data-slot": "mention-chip",
|
|
327
|
+
"data-mention-kind": kind,
|
|
328
|
+
"data-mention-id": id,
|
|
329
|
+
title: l.chipTitle(label, kind),
|
|
330
|
+
className: cn(
|
|
331
|
+
"inline-flex items-baseline rounded px-1 font-medium",
|
|
332
|
+
isSelf ? "bg-primary/15 text-primary" : "bg-accent text-accent-foreground",
|
|
333
|
+
className
|
|
334
|
+
),
|
|
335
|
+
"data-testid": testIdOr(testId, { testId: `mention-chip-${id ?? kind}` }),
|
|
336
|
+
children: [
|
|
337
|
+
"@",
|
|
338
|
+
label
|
|
339
|
+
]
|
|
340
|
+
}
|
|
341
|
+
);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
// src/chat/mentions.ts
|
|
345
|
+
var MAX_QUERY_LENGTH = 40;
|
|
346
|
+
function findMentionQuery(text, caret) {
|
|
347
|
+
const before = text.slice(0, caret);
|
|
348
|
+
const at = before.lastIndexOf("@");
|
|
349
|
+
if (at < 0) return null;
|
|
350
|
+
if (at > 0 && !/\s/.test(before[at - 1])) return null;
|
|
351
|
+
const query = before.slice(at + 1);
|
|
352
|
+
if (query.length > MAX_QUERY_LENGTH || query.includes("\n") || query.startsWith(" ")) return null;
|
|
353
|
+
return { start: at, query };
|
|
354
|
+
}
|
|
355
|
+
function filterMentionCandidates(candidates, query) {
|
|
356
|
+
const q = query.trim().toLowerCase();
|
|
357
|
+
if (!q) return candidates.slice();
|
|
358
|
+
const scored = [];
|
|
359
|
+
for (const c of candidates) {
|
|
360
|
+
const label = c.label.toLowerCase();
|
|
361
|
+
if (label.startsWith(q)) scored.push({ c, score: 0 });
|
|
362
|
+
else if (label.split(/\s+/).some((word) => word.startsWith(q))) scored.push({ c, score: 1 });
|
|
363
|
+
else if (c.description?.toLowerCase().startsWith(q)) scored.push({ c, score: 2 });
|
|
364
|
+
}
|
|
365
|
+
return scored.sort((a, b) => a.score - b.score).map((s) => s.c);
|
|
366
|
+
}
|
|
367
|
+
function insertMention(text, start, caret, label) {
|
|
368
|
+
const inserted = `@${label} `;
|
|
369
|
+
return {
|
|
370
|
+
text: text.slice(0, start) + inserted + text.slice(caret),
|
|
371
|
+
caret: start + inserted.length
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
function tokenRanges(text, label) {
|
|
375
|
+
const needle = `@${label}`;
|
|
376
|
+
const ranges = [];
|
|
377
|
+
let from = 0;
|
|
378
|
+
for (; ; ) {
|
|
379
|
+
const i = text.indexOf(needle, from);
|
|
380
|
+
if (i < 0) break;
|
|
381
|
+
const end = i + needle.length;
|
|
382
|
+
const startsToken = i === 0 || /\s|\(|\[/.test(text[i - 1]);
|
|
383
|
+
const endsToken = end === text.length || !/[\p{L}\p{N}_]/u.test(text[end]);
|
|
384
|
+
if (startsToken && endsToken) ranges.push([i, end]);
|
|
385
|
+
from = end;
|
|
386
|
+
}
|
|
387
|
+
return ranges;
|
|
388
|
+
}
|
|
389
|
+
function extractMentions(text, candidates) {
|
|
390
|
+
const taken = [];
|
|
391
|
+
const found = [];
|
|
392
|
+
const byLength = [...candidates].sort((a, b) => b.label.length - a.label.length);
|
|
393
|
+
for (const c of byLength) {
|
|
394
|
+
if (!c.label) continue;
|
|
395
|
+
for (const [from, to] of tokenRanges(text, c.label)) {
|
|
396
|
+
if (taken.some(([a, b]) => from < b && to > a)) continue;
|
|
397
|
+
taken.push([from, to]);
|
|
398
|
+
if (!found.some((f) => f.c.id === c.id)) found.push({ c, at: from });
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
return found.sort((a, b) => a.at - b.at).map((f) => f.c);
|
|
402
|
+
}
|
|
403
|
+
function toMessageMentions(mentioned) {
|
|
404
|
+
return mentioned.map(
|
|
405
|
+
(c) => c.kind === "assistant" ? { type: "assistant" } : { type: "user", user_ext_id: c.id }
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
var MENTION_HREF_PREFIX = "#mention-";
|
|
409
|
+
function escapeLinkText(label) {
|
|
410
|
+
return label.replace(/[[\]\\]/g, (ch) => `\\${ch}`);
|
|
411
|
+
}
|
|
412
|
+
function linkMentions(content, mentions, assistantLabels = []) {
|
|
413
|
+
if (!mentions || mentions.length === 0 || !content) return content;
|
|
414
|
+
const targets = [];
|
|
415
|
+
for (const m of mentions) {
|
|
416
|
+
const id = m.type === "assistant" ? "assistant" : m.user_ext_id;
|
|
417
|
+
if (!id) continue;
|
|
418
|
+
const labels = m.type === "assistant" ? [m.label ?? "", ...assistantLabels] : [m.label ?? ""];
|
|
419
|
+
for (const label of labels) if (label) targets.push({ label, id });
|
|
420
|
+
}
|
|
421
|
+
targets.sort((a, b) => b.label.length - a.label.length);
|
|
422
|
+
const replacements = [];
|
|
423
|
+
for (const { label, id } of targets) {
|
|
424
|
+
for (const [from, to] of tokenRanges(content, label)) {
|
|
425
|
+
if (replacements.some((r) => from < r.to && to > r.from)) continue;
|
|
426
|
+
replacements.push({
|
|
427
|
+
from,
|
|
428
|
+
to,
|
|
429
|
+
text: `[@${escapeLinkText(label)}](${MENTION_HREF_PREFIX}${id})`
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
replacements.sort((a, b) => b.from - a.from);
|
|
434
|
+
let out = content;
|
|
435
|
+
for (const r of replacements) out = out.slice(0, r.from) + r.text + out.slice(r.to);
|
|
436
|
+
return out;
|
|
437
|
+
}
|
|
438
|
+
function mentionFromHref(href) {
|
|
439
|
+
if (!href?.startsWith(MENTION_HREF_PREFIX)) return null;
|
|
440
|
+
const id = href.slice(MENTION_HREF_PREFIX.length);
|
|
441
|
+
if (!id) return null;
|
|
442
|
+
return { kind: id === "assistant" ? "assistant" : "user", id };
|
|
443
|
+
}
|
|
444
|
+
function useMentionAutocomplete({
|
|
445
|
+
value,
|
|
446
|
+
onValueChange,
|
|
447
|
+
candidates,
|
|
448
|
+
textareaRef
|
|
449
|
+
}) {
|
|
450
|
+
const [caret, setCaret] = useState(null);
|
|
451
|
+
const [dismissedAt, setDismissedAt] = useState(null);
|
|
452
|
+
useEffect(() => {
|
|
453
|
+
if (dismissedAt !== null && value[dismissedAt] !== "@") setDismissedAt(null);
|
|
454
|
+
}, [value, dismissedAt]);
|
|
455
|
+
const match = useMemo(
|
|
456
|
+
() => caret === null ? null : findMentionQuery(value, Math.min(caret, value.length)),
|
|
457
|
+
[value, caret]
|
|
458
|
+
);
|
|
459
|
+
const items = useMemo(
|
|
460
|
+
() => match ? filterMentionCandidates(candidates, match.query) : [],
|
|
461
|
+
[match, candidates]
|
|
462
|
+
);
|
|
463
|
+
const isOpen = !!match && items.length > 0 && dismissedAt !== match.start;
|
|
464
|
+
const readCaret = useCallback(() => {
|
|
465
|
+
const ta = textareaRef.current;
|
|
466
|
+
setCaret(ta ? ta.selectionStart : null);
|
|
467
|
+
}, [textareaRef]);
|
|
468
|
+
const pick = useCallback(
|
|
469
|
+
(candidate) => {
|
|
470
|
+
if (!match || caret === null) return;
|
|
471
|
+
const next = insertMention(value, match.start, Math.min(caret, value.length), candidate.label);
|
|
472
|
+
onValueChange(next.text);
|
|
473
|
+
setCaret(next.caret);
|
|
474
|
+
setDismissedAt(match.start);
|
|
475
|
+
requestAnimationFrame(() => {
|
|
476
|
+
const ta = textareaRef.current;
|
|
477
|
+
if (!ta) return;
|
|
478
|
+
ta.focus();
|
|
479
|
+
ta.setSelectionRange(next.caret, next.caret);
|
|
480
|
+
});
|
|
481
|
+
},
|
|
482
|
+
[match, caret, value, onValueChange, textareaRef]
|
|
483
|
+
);
|
|
484
|
+
const nav = useListKeyNav({
|
|
485
|
+
open: isOpen,
|
|
486
|
+
items,
|
|
487
|
+
onPick: pick,
|
|
488
|
+
onDismiss: () => setDismissedAt(match?.start ?? null),
|
|
489
|
+
resetKey: match?.query
|
|
490
|
+
});
|
|
491
|
+
const handleValueChange = useCallback(
|
|
492
|
+
(next) => {
|
|
493
|
+
onValueChange(next);
|
|
494
|
+
const ta = textareaRef.current;
|
|
495
|
+
setCaret(ta ? ta.selectionStart : next.length);
|
|
496
|
+
if (dismissedAt !== null && (next.length < value.length || next[dismissedAt] !== "@")) {
|
|
497
|
+
setDismissedAt(null);
|
|
498
|
+
}
|
|
499
|
+
},
|
|
500
|
+
[onValueChange, textareaRef, dismissedAt, value]
|
|
501
|
+
);
|
|
502
|
+
return {
|
|
503
|
+
isOpen,
|
|
504
|
+
items,
|
|
505
|
+
nav,
|
|
506
|
+
pick,
|
|
507
|
+
onValueChange: handleValueChange,
|
|
508
|
+
textareaProps: { onSelect: readCaret }
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
var DEFAULT_ASSISTANT_MODE_TOGGLE_LABELS = {
|
|
512
|
+
always: "Assistant replies",
|
|
513
|
+
mentioned: "Thread",
|
|
514
|
+
alwaysHint: "The assistant answers every message. Click to make this a thread.",
|
|
515
|
+
mentionedHint: "A thread: messages are comments between people. @mention the assistant to get an answer. Click to have it answer every message."
|
|
516
|
+
};
|
|
517
|
+
function AssistantModeToggle({
|
|
518
|
+
mode,
|
|
519
|
+
onModeChange,
|
|
520
|
+
disabled,
|
|
521
|
+
labels,
|
|
522
|
+
className,
|
|
523
|
+
testId
|
|
524
|
+
}) {
|
|
525
|
+
const l = { ...DEFAULT_ASSISTANT_MODE_TOGGLE_LABELS, ...labels };
|
|
526
|
+
const isThread = mode === "mentioned";
|
|
527
|
+
const hint = isThread ? l.mentionedHint : l.alwaysHint;
|
|
528
|
+
const Icon = isThread ? MessagesSquare : Bot;
|
|
529
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
530
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
531
|
+
Button,
|
|
532
|
+
{
|
|
533
|
+
type: "button",
|
|
534
|
+
variant: "ghost",
|
|
535
|
+
size: "sm",
|
|
536
|
+
disabled,
|
|
537
|
+
"aria-pressed": isThread,
|
|
538
|
+
"aria-label": `${isThread ? l.mentioned : l.always}. ${hint}`,
|
|
539
|
+
onClick: () => onModeChange(isThread ? "always" : "mentioned"),
|
|
540
|
+
className: cn(
|
|
541
|
+
"h-8 gap-1.5 px-2 text-xs text-muted-foreground hover:bg-muted pointer-coarse:h-11",
|
|
542
|
+
isThread && "bg-accent text-accent-foreground",
|
|
543
|
+
className
|
|
544
|
+
),
|
|
545
|
+
"data-mode": mode,
|
|
546
|
+
"data-testid": testIdOr(testId, { testId: "assistant-mode-toggle" }),
|
|
547
|
+
children: [
|
|
548
|
+
/* @__PURE__ */ jsx(Icon, { className: "h-3.5 w-3.5", "aria-hidden": "true" }),
|
|
549
|
+
/* @__PURE__ */ jsx("span", { children: isThread ? l.mentioned : l.always })
|
|
550
|
+
]
|
|
551
|
+
}
|
|
552
|
+
) }),
|
|
553
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "top", className: "max-w-xs", children: hint })
|
|
554
|
+
] });
|
|
555
|
+
}
|
|
224
556
|
var DEFAULT_PINNED_DOC_CHIP_LABELS = {
|
|
225
557
|
unpin: "Unpin",
|
|
226
558
|
unpinDocument: (title) => `Unpin ${title}`
|
|
@@ -1627,6 +1959,6 @@ function AssistantToaster(props) {
|
|
|
1627
1959
|
return /* @__PURE__ */ jsx(Toaster, { ...props, dockOpen: dock.isOpen && isDockAvailable });
|
|
1628
1960
|
}
|
|
1629
1961
|
|
|
1630
|
-
export { AssistantToaster, BranchControls, ComposerAccessories, ComposerTools, ContextActionButton, ContextCheckRow, ContextPanelContent, ContextPanelFooter, ContextPanelTabs, ContextPickerList, ContextPickerRow, ContextSearchInput, ContextSelectList, ContextSelectRow, Conversation, ConversationBody, ConversationHeader, ConversationHeaderActions, ConversationHistoryPane, ConversationLoading, ConversationMain, ConversationRoot, ConversationSearchView, ConversationSettingsButton, DEFAULT_BRANCH_CONTROLS_LABELS, DEFAULT_CONVERSATION_LAYOUT_LABELS, DEFAULT_CONVERSATION_PARTS_LABELS, DEFAULT_CONVERSATION_SEARCH_LABELS, DEFAULT_LABEL_PIN_ROW_LABELS, DEFAULT_MODEL_PRICING_TIP_LABELS, DEFAULT_PENDING_ANSWER_BAR_LABELS, DEFAULT_PINNED_DOC_CHIP_LABELS, DEFAULT_SLASH_MENU_LABELS, DEFAULT_THREAD_MAP_LABELS, LabelPinRow, ModelAutoIcon, ModelConfigureButton, ModelDot, ModelMenuDivider, ModelMenuMessage, ModelOption, ModelOptionLabel, ModelPickerPopover, ModelPickerTrigger, ModelPricingTip, ModelTierIcon, ModelTierOption, ModelTriggerContent, NewChatButton, NewPaChatButton, PaModeBadge, PendingAnswerBar, PinnedDocChip, SlashMenu, ThreadMap, ThreadMapDiagram, ThreadMapError, ThreadMapLoading, isLongPastedText, useDismissibleCard, useListKeyNav, useLongPaste };
|
|
1631
|
-
//# sourceMappingURL=chunk-
|
|
1632
|
-
//# sourceMappingURL=chunk-
|
|
1962
|
+
export { AssistantModeToggle, AssistantToaster, BranchControls, ComposerAccessories, ComposerTools, ContextActionButton, ContextCheckRow, ContextPanelContent, ContextPanelFooter, ContextPanelTabs, ContextPickerList, ContextPickerRow, ContextSearchInput, ContextSelectList, ContextSelectRow, Conversation, ConversationBody, ConversationHeader, ConversationHeaderActions, ConversationHistoryPane, ConversationLoading, ConversationMain, ConversationRoot, ConversationSearchView, ConversationSettingsButton, DEFAULT_ASSISTANT_MODE_TOGGLE_LABELS, DEFAULT_BRANCH_CONTROLS_LABELS, DEFAULT_CONVERSATION_LAYOUT_LABELS, DEFAULT_CONVERSATION_PARTS_LABELS, DEFAULT_CONVERSATION_SEARCH_LABELS, DEFAULT_LABEL_PIN_ROW_LABELS, DEFAULT_MENTION_LABELS, DEFAULT_MODEL_PRICING_TIP_LABELS, DEFAULT_PENDING_ANSWER_BAR_LABELS, DEFAULT_PINNED_DOC_CHIP_LABELS, DEFAULT_SLASH_MENU_LABELS, DEFAULT_THREAD_MAP_LABELS, LabelPinRow, MENTION_HREF_PREFIX, MentionChip, MentionMenu, ModelAutoIcon, ModelConfigureButton, ModelDot, ModelMenuDivider, ModelMenuMessage, ModelOption, ModelOptionLabel, ModelPickerPopover, ModelPickerTrigger, ModelPricingTip, ModelTierIcon, ModelTierOption, ModelTriggerContent, NewChatButton, NewPaChatButton, PaModeBadge, PendingAnswerBar, PinnedDocChip, SlashMenu, ThreadMap, ThreadMapDiagram, ThreadMapError, ThreadMapLoading, extractMentions, filterMentionCandidates, findMentionQuery, insertMention, isLongPastedText, linkMentions, mentionFromHref, toMessageMentions, useDismissibleCard, useListKeyNav, useLongPaste, useMentionAutocomplete };
|
|
1963
|
+
//# sourceMappingURL=chunk-ABSII3ND.js.map
|
|
1964
|
+
//# sourceMappingURL=chunk-ABSII3ND.js.map
|